monaco-languageclient-examples 7.0.1 → 7.0.2
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.
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
(()=>{var LC=Object.create;var Fc=Object.defineProperty;var MC=Object.getOwnPropertyDescriptor;var FC=Object.getOwnPropertyNames;var UC=Object.getPrototypeOf,qC=Object.prototype.hasOwnProperty;var jC=(t,e)=>()=>(t&&(e=t(t=0)),e);var $=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),GC=(t,e)=>{for(var r in e)Fc(t,r,{get:e[r],enumerable:!0})},Vy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of FC(e))!qC.call(t,i)&&i!==r&&Fc(t,i,{get:()=>e[i],enumerable:!(n=MC(e,i))||n.enumerable});return t};var se=(t,e,r)=>(r=t!=null?LC(UC(t)):{},Vy(e||!t||!t.__esModule?Fc(r,"default",{value:t,enumerable:!0}):r,t)),ap=t=>Vy(Fc({},"__esModule",{value:!0}),t);var yo=$(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.stringArray=Ft.array=Ft.func=Ft.error=Ft.number=Ft.string=Ft.boolean=void 0;function HC(t){return t===!0||t===!1}Ft.boolean=HC;function Xy(t){return typeof t=="string"||t instanceof String}Ft.string=Xy;function WC(t){return typeof t=="number"||t instanceof Number}Ft.number=WC;function BC(t){return t instanceof Error}Ft.error=BC;function KC(t){return typeof t=="function"}Ft.func=KC;function Yy(t){return Array.isArray(t)}Ft.array=Yy;function zC(t){return Yy(t)&&t.every(e=>Xy(e))}Ft.stringArray=zC});var Ip=$(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.Message=j.NotificationType9=j.NotificationType8=j.NotificationType7=j.NotificationType6=j.NotificationType5=j.NotificationType4=j.NotificationType3=j.NotificationType2=j.NotificationType1=j.NotificationType0=j.NotificationType=j.RequestType9=j.RequestType8=j.RequestType7=j.RequestType6=j.RequestType5=j.RequestType4=j.RequestType3=j.RequestType2=j.RequestType1=j.RequestType=j.RequestType0=j.AbstractMessageSignature=j.ParameterStructures=j.ResponseError=j.ErrorCodes=void 0;var Li=yo(),cp;(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})(cp||(j.ErrorCodes=cp={}));var up=class t extends Error{constructor(e,r,n){super(r),this.code=Li.number(e)?e:cp.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}};j.ResponseError=up;var cr=class t{constructor(e){this.kind=e}static is(e){return e===t.auto||e===t.byName||e===t.byPosition}toString(){return this.kind}};j.ParameterStructures=cr;cr.auto=new cr("auto");cr.byPosition=new cr("byPosition");cr.byName=new cr("byName");var $e=class{constructor(e,r){this.method=e,this.numberOfParams=r}get parameterStructures(){return cr.auto}};j.AbstractMessageSignature=$e;var lp=class extends $e{constructor(e){super(e,0)}};j.RequestType0=lp;var fp=class extends $e{constructor(e,r=cr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};j.RequestType=fp;var dp=class extends $e{constructor(e,r=cr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};j.RequestType1=dp;var pp=class extends $e{constructor(e){super(e,2)}};j.RequestType2=pp;var mp=class extends $e{constructor(e){super(e,3)}};j.RequestType3=mp;var hp=class extends $e{constructor(e){super(e,4)}};j.RequestType4=hp;var gp=class extends $e{constructor(e){super(e,5)}};j.RequestType5=gp;var yp=class extends $e{constructor(e){super(e,6)}};j.RequestType6=yp;var Tp=class extends $e{constructor(e){super(e,7)}};j.RequestType7=Tp;var xp=class extends $e{constructor(e){super(e,8)}};j.RequestType8=xp;var vp=class extends $e{constructor(e){super(e,9)}};j.RequestType9=vp;var Rp=class extends $e{constructor(e,r=cr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};j.NotificationType=Rp;var Sp=class extends $e{constructor(e){super(e,0)}};j.NotificationType0=Sp;var bp=class extends $e{constructor(e,r=cr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};j.NotificationType1=bp;var Ap=class extends $e{constructor(e){super(e,2)}};j.NotificationType2=Ap;var wp=class extends $e{constructor(e){super(e,3)}};j.NotificationType3=wp;var kp=class extends $e{constructor(e){super(e,4)}};j.NotificationType4=kp;var Ep=class extends $e{constructor(e){super(e,5)}};j.NotificationType5=Ep;var _p=class extends $e{constructor(e){super(e,6)}};j.NotificationType6=_p;var Cp=class extends $e{constructor(e){super(e,7)}};j.NotificationType7=Cp;var Np=class extends $e{constructor(e){super(e,8)}};j.NotificationType8=Np;var Pp=class extends $e{constructor(e){super(e,9)}};j.NotificationType9=Pp;var Jy;(function(t){function e(i){let o=i;return o&&Li.string(o.method)&&(Li.string(o.id)||Li.number(o.id))}t.isRequest=e;function r(i){let o=i;return o&&Li.string(o.method)&&i.id===void 0}t.isNotification=r;function n(i){let o=i;return o&&(o.result!==void 0||!!o.error)&&(Li.string(o.id)||Li.number(o.id)||o.id===null)}t.isResponse=n})(Jy||(j.Message=Jy={}))});var Op=$(Qn=>{"use strict";var Qy;Object.defineProperty(Qn,"__esModule",{value:!0});Qn.LRUCache=Qn.LinkedMap=Qn.Touch=void 0;var Ut;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(Ut||(Qn.Touch=Ut={}));var Uc=class{constructor(){this[Qy]="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=Ut.None){let n=this._map.get(e);if(n)return r!==Ut.None&&this.touch(n,r),n.value}set(e,r,n=Ut.None){let i=this._map.get(e);if(i)i.value=r,n!==Ut.None&&this.touch(i,n);else{switch(i={key:e,value:r,next:void 0,previous:void 0},n){case Ut.None:this.addItemLast(i);break;case Ut.First:this.addItemFirst(i);break;case Ut.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}[(Qy=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!==Ut.First&&r!==Ut.Last)){if(r===Ut.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===Ut.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)}};Qn.LinkedMap=Uc;var Dp=class extends Uc{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=Ut.AsNew){return super.get(e,r)}peek(e){return super.get(e,Ut.None)}set(e,r){return super.set(e,r,Ut.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};Qn.LRUCache=Dp});var eT=$(qc=>{"use strict";Object.defineProperty(qc,"__esModule",{value:!0});qc.Disposable=void 0;var Zy;(function(t){function e(r){return{dispose:r}}t.create=e})(Zy||(qc.Disposable=Zy={}))});var Zn=$(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var $p;function Lp(){if($p===void 0)throw new Error("No runtime abstraction layer installed");return $p}(function(t){function e(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");$p=r}t.install=e})(Lp||(Lp={}));Mp.default=Lp});var xo=$(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.Emitter=To.Event=void 0;var VC=Zn(),tT;(function(t){let e={dispose(){}};t.None=function(){return e}})(tT||(To.Event=tT={}));var Fp=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,VC.default)().console.error(a)}return r}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},jc=class t{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,r,n)=>{this._callbacks||(this._callbacks=new Fp),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)}};To.Emitter=jc;jc._noop=function(){}});var Wc=$(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.CancellationTokenSource=vo.CancellationToken=void 0;var XC=Zn(),YC=yo(),Up=xo(),Gc;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Up.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Up.Event.None});function e(r){let n=r;return n&&(n===t.None||n===t.Cancelled||YC.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}t.is=e})(Gc||(vo.CancellationToken=Gc={}));var JC=Object.freeze(function(t,e){let r=(0,XC.default)().timer.setTimeout(t.bind(e),0);return{dispose(){r.dispose()}}}),Hc=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?JC:(this._emitter||(this._emitter=new Up.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},qp=class{get token(){return this._token||(this._token=new Hc),this._token}cancel(){this._token?this._token.cancel():this._token=Gc.Cancelled}dispose(){this._token?this._token instanceof Hc&&this._token.dispose():this._token=Gc.None}};vo.CancellationTokenSource=qp});var rT=$(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.SharedArrayReceiverStrategy=Ro.SharedArraySenderStrategy=void 0;var QC=Wc(),da;(function(t){t.Continue=0,t.Cancelled=1})(da||(da={}));var jp=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]=da.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,da.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};Ro.SharedArraySenderStrategy=jp;var Gp=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===da.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},Hp=class{constructor(e){this.token=new Gp(e)}cancel(){}dispose(){}},Wp=class{constructor(){this.kind="request"}createCancellationTokenSource(e){let r=e.$cancellationData;return r===void 0?new QC.CancellationTokenSource:new Hp(r)}};Ro.SharedArrayReceiverStrategy=Wp});var Kp=$(Bc=>{"use strict";Object.defineProperty(Bc,"__esModule",{value:!0});Bc.Semaphore=void 0;var ZC=Zn(),Bp=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,ZC.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()}}};Bc.Semaphore=Bp});var iT=$(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});ei.ReadableStreamMessageReader=ei.AbstractMessageReader=ei.MessageReader=void 0;var Vp=Zn(),So=yo(),zp=xo(),eN=Kp(),nT;(function(t){function e(r){let n=r;return n&&So.func(n.listen)&&So.func(n.dispose)&&So.func(n.onError)&&So.func(n.onClose)&&So.func(n.onPartialMessage)}t.is=e})(nT||(ei.MessageReader=nT={}));var Kc=class{constructor(){this.errorEmitter=new zp.Emitter,this.closeEmitter=new zp.Emitter,this.partialMessageEmitter=new zp.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: ${So.string(e.message)?e.message:"unknown"}`)}};ei.AbstractMessageReader=Kc;var Xp;(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,Vp.default)().applicationJson.decoder,c.set(a.name,a)),{charset:n,contentDecoder:o,contentDecoders:s,contentTypeDecoder:a,contentTypeDecoders:c}}t.fromOptions=e})(Xp||(Xp={}));var Yp=class extends Kc{constructor(e,r){super(),this.readable=e,this.options=Xp.fromOptions(r),this.buffer=(0,Vp.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new eN.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,Vp.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))}};
|
|
3
|
-
`,cT;(function(t){function e(r){let n=r;return n&&pa.func(n.dispose)&&pa.func(n.onClose)&&pa.func(n.onError)&&pa.func(n.write)}t.is=e})(cT||(
|
|
4
|
-
`,Zp=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
|
|
5
|
-
${l}`);let d=l.substr(0,f),p=l.substr(f+1).trim();a.set(e?d.toLowerCase():d,p)}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}};Vc.AbstractMessageBuffer=Zp});var hT=$(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.createMessageConnection=X.ConnectionOptions=X.MessageStrategy=X.CancellationStrategy=X.CancellationSenderStrategy=X.CancellationReceiverStrategy=X.RequestCancellationReceiverStrategy=X.IdCancellationReceiverStrategy=X.ConnectionStrategy=X.ConnectionError=X.ConnectionErrors=X.LogTraceNotification=X.SetTraceNotification=X.TraceFormat=X.TraceValues=X.Trace=X.NullLogger=X.ProgressType=X.ProgressToken=void 0;var fT=
|
|
6
|
-
${JSON.stringify(y.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.");else{let k=y.id,N=A.get(k);if(
|
|
7
|
-
${JSON.stringify(y,null,4)}`);let k=y;if(We.string(k.id)||We.number(k.id)){let N=k.id,q=A.get(N);q&&q.reject(new Error("The received response has neither a result nor an error property."))}}function Nt(y){if(y!=null)switch(m){case fe.Verbose:return JSON.stringify(y,null,4);case fe.Compact:return JSON.stringify(y);default:return}}function
|
|
1
|
+
(()=>{var FC=Object.create;var Fc=Object.defineProperty;var UC=Object.getOwnPropertyDescriptor;var qC=Object.getOwnPropertyNames;var jC=Object.getPrototypeOf,GC=Object.prototype.hasOwnProperty;var HC=(t,e)=>()=>(t&&(e=t(t=0)),e);var $=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),WC=(t,e)=>{for(var r in e)Fc(t,r,{get:e[r],enumerable:!0})},Vy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of qC(e))!GC.call(t,i)&&i!==r&&Fc(t,i,{get:()=>e[i],enumerable:!(n=UC(e,i))||n.enumerable});return t};var se=(t,e,r)=>(r=t!=null?FC(jC(t)):{},Vy(e||!t||!t.__esModule?Fc(r,"default",{value:t,enumerable:!0}):r,t)),ap=t=>Vy(Fc({},"__esModule",{value:!0}),t);var yo=$(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.stringArray=Ft.array=Ft.func=Ft.error=Ft.number=Ft.string=Ft.boolean=void 0;function BC(t){return t===!0||t===!1}Ft.boolean=BC;function Xy(t){return typeof t=="string"||t instanceof String}Ft.string=Xy;function KC(t){return typeof t=="number"||t instanceof Number}Ft.number=KC;function zC(t){return t instanceof Error}Ft.error=zC;function VC(t){return typeof t=="function"}Ft.func=VC;function Yy(t){return Array.isArray(t)}Ft.array=Yy;function XC(t){return Yy(t)&&t.every(e=>Xy(e))}Ft.stringArray=XC});var Ip=$(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.Message=j.NotificationType9=j.NotificationType8=j.NotificationType7=j.NotificationType6=j.NotificationType5=j.NotificationType4=j.NotificationType3=j.NotificationType2=j.NotificationType1=j.NotificationType0=j.NotificationType=j.RequestType9=j.RequestType8=j.RequestType7=j.RequestType6=j.RequestType5=j.RequestType4=j.RequestType3=j.RequestType2=j.RequestType1=j.RequestType=j.RequestType0=j.AbstractMessageSignature=j.ParameterStructures=j.ResponseError=j.ErrorCodes=void 0;var Mi=yo(),cp;(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})(cp||(j.ErrorCodes=cp={}));var up=class t extends Error{constructor(e,r,n){super(r),this.code=Mi.number(e)?e:cp.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}};j.ResponseError=up;var ar=class t{constructor(e){this.kind=e}static is(e){return e===t.auto||e===t.byName||e===t.byPosition}toString(){return this.kind}};j.ParameterStructures=ar;ar.auto=new ar("auto");ar.byPosition=new ar("byPosition");ar.byName=new ar("byName");var $e=class{constructor(e,r){this.method=e,this.numberOfParams=r}get parameterStructures(){return ar.auto}};j.AbstractMessageSignature=$e;var lp=class extends $e{constructor(e){super(e,0)}};j.RequestType0=lp;var fp=class extends $e{constructor(e,r=ar.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};j.RequestType=fp;var dp=class extends $e{constructor(e,r=ar.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};j.RequestType1=dp;var pp=class extends $e{constructor(e){super(e,2)}};j.RequestType2=pp;var mp=class extends $e{constructor(e){super(e,3)}};j.RequestType3=mp;var hp=class extends $e{constructor(e){super(e,4)}};j.RequestType4=hp;var gp=class extends $e{constructor(e){super(e,5)}};j.RequestType5=gp;var yp=class extends $e{constructor(e){super(e,6)}};j.RequestType6=yp;var Tp=class extends $e{constructor(e){super(e,7)}};j.RequestType7=Tp;var xp=class extends $e{constructor(e){super(e,8)}};j.RequestType8=xp;var vp=class extends $e{constructor(e){super(e,9)}};j.RequestType9=vp;var Rp=class extends $e{constructor(e,r=ar.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};j.NotificationType=Rp;var Sp=class extends $e{constructor(e){super(e,0)}};j.NotificationType0=Sp;var bp=class extends $e{constructor(e,r=ar.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};j.NotificationType1=bp;var Ap=class extends $e{constructor(e){super(e,2)}};j.NotificationType2=Ap;var wp=class extends $e{constructor(e){super(e,3)}};j.NotificationType3=wp;var kp=class extends $e{constructor(e){super(e,4)}};j.NotificationType4=kp;var Ep=class extends $e{constructor(e){super(e,5)}};j.NotificationType5=Ep;var _p=class extends $e{constructor(e){super(e,6)}};j.NotificationType6=_p;var Cp=class extends $e{constructor(e){super(e,7)}};j.NotificationType7=Cp;var Np=class extends $e{constructor(e){super(e,8)}};j.NotificationType8=Np;var Pp=class extends $e{constructor(e){super(e,9)}};j.NotificationType9=Pp;var Jy;(function(t){function e(i){let o=i;return o&&Mi.string(o.method)&&(Mi.string(o.id)||Mi.number(o.id))}t.isRequest=e;function r(i){let o=i;return o&&Mi.string(o.method)&&i.id===void 0}t.isNotification=r;function n(i){let o=i;return o&&(o.result!==void 0||!!o.error)&&(Mi.string(o.id)||Mi.number(o.id)||o.id===null)}t.isResponse=n})(Jy||(j.Message=Jy={}))});var Op=$(Jn=>{"use strict";var Qy;Object.defineProperty(Jn,"__esModule",{value:!0});Jn.LRUCache=Jn.LinkedMap=Jn.Touch=void 0;var Ut;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(Ut||(Jn.Touch=Ut={}));var Uc=class{constructor(){this[Qy]="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=Ut.None){let n=this._map.get(e);if(n)return r!==Ut.None&&this.touch(n,r),n.value}set(e,r,n=Ut.None){let i=this._map.get(e);if(i)i.value=r,n!==Ut.None&&this.touch(i,n);else{switch(i={key:e,value:r,next:void 0,previous:void 0},n){case Ut.None:this.addItemLast(i);break;case Ut.First:this.addItemFirst(i);break;case Ut.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}[(Qy=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!==Ut.First&&r!==Ut.Last)){if(r===Ut.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===Ut.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)}};Jn.LinkedMap=Uc;var Dp=class extends Uc{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=Ut.AsNew){return super.get(e,r)}peek(e){return super.get(e,Ut.None)}set(e,r){return super.set(e,r,Ut.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};Jn.LRUCache=Dp});var eT=$(qc=>{"use strict";Object.defineProperty(qc,"__esModule",{value:!0});qc.Disposable=void 0;var Zy;(function(t){function e(r){return{dispose:r}}t.create=e})(Zy||(qc.Disposable=Zy={}))});var Qn=$(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var $p;function Lp(){if($p===void 0)throw new Error("No runtime abstraction layer installed");return $p}(function(t){function e(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");$p=r}t.install=e})(Lp||(Lp={}));Mp.default=Lp});var xo=$(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.Emitter=To.Event=void 0;var YC=Qn(),tT;(function(t){let e={dispose(){}};t.None=function(){return e}})(tT||(To.Event=tT={}));var Fp=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,YC.default)().console.error(a)}return r}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},jc=class t{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,r,n)=>{this._callbacks||(this._callbacks=new Fp),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)}};To.Emitter=jc;jc._noop=function(){}});var Wc=$(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.CancellationTokenSource=vo.CancellationToken=void 0;var JC=Qn(),QC=yo(),Up=xo(),Gc;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Up.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Up.Event.None});function e(r){let n=r;return n&&(n===t.None||n===t.Cancelled||QC.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}t.is=e})(Gc||(vo.CancellationToken=Gc={}));var ZC=Object.freeze(function(t,e){let r=(0,JC.default)().timer.setTimeout(t.bind(e),0);return{dispose(){r.dispose()}}}),Hc=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?ZC:(this._emitter||(this._emitter=new Up.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},qp=class{get token(){return this._token||(this._token=new Hc),this._token}cancel(){this._token?this._token.cancel():this._token=Gc.Cancelled}dispose(){this._token?this._token instanceof Hc&&this._token.dispose():this._token=Gc.None}};vo.CancellationTokenSource=qp});var rT=$(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.SharedArrayReceiverStrategy=Ro.SharedArraySenderStrategy=void 0;var eN=Wc(),da;(function(t){t.Continue=0,t.Cancelled=1})(da||(da={}));var jp=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]=da.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,da.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};Ro.SharedArraySenderStrategy=jp;var Gp=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===da.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},Hp=class{constructor(e){this.token=new Gp(e)}cancel(){}dispose(){}},Wp=class{constructor(){this.kind="request"}createCancellationTokenSource(e){let r=e.$cancellationData;return r===void 0?new eN.CancellationTokenSource:new Hp(r)}};Ro.SharedArrayReceiverStrategy=Wp});var Kp=$(Bc=>{"use strict";Object.defineProperty(Bc,"__esModule",{value:!0});Bc.Semaphore=void 0;var tN=Qn(),Bp=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,tN.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()}}};Bc.Semaphore=Bp});var iT=$(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.ReadableStreamMessageReader=Zn.AbstractMessageReader=Zn.MessageReader=void 0;var Vp=Qn(),So=yo(),zp=xo(),rN=Kp(),nT;(function(t){function e(r){let n=r;return n&&So.func(n.listen)&&So.func(n.dispose)&&So.func(n.onError)&&So.func(n.onClose)&&So.func(n.onPartialMessage)}t.is=e})(nT||(Zn.MessageReader=nT={}));var Kc=class{constructor(){this.errorEmitter=new zp.Emitter,this.closeEmitter=new zp.Emitter,this.partialMessageEmitter=new zp.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: ${So.string(e.message)?e.message:"unknown"}`)}};Zn.AbstractMessageReader=Kc;var Xp;(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,Vp.default)().applicationJson.decoder,c.set(a.name,a)),{charset:n,contentDecoder:o,contentDecoders:s,contentTypeDecoder:a,contentTypeDecoders:c}}t.fromOptions=e})(Xp||(Xp={}));var Yp=class extends Kc{constructor(e,r){super(),this.readable=e,this.options=Xp.fromOptions(r),this.buffer=(0,Vp.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new rN.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,Vp.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))}};Zn.ReadableStreamMessageReader=Yp});var uT=$(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});ei.WriteableStreamMessageWriter=ei.AbstractMessageWriter=ei.MessageWriter=void 0;var oT=Qn(),pa=yo(),nN=Kp(),sT=xo(),iN="Content-Length: ",aT=`\r
|
|
3
|
+
`,cT;(function(t){function e(r){let n=r;return n&&pa.func(n.dispose)&&pa.func(n.onClose)&&pa.func(n.onError)&&pa.func(n.write)}t.is=e})(cT||(ei.MessageWriter=cT={}));var zc=class{constructor(){this.errorEmitter=new sT.Emitter,this.closeEmitter=new sT.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: ${pa.string(e.message)?e.message:"unknown"}`)}};ei.AbstractMessageWriter=zc;var Jp;(function(t){function e(r){return r===void 0||typeof r=="string"?{charset:r??"utf-8",contentTypeEncoder:(0,oT.default)().applicationJson.encoder}:{charset:r.charset??"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:r.contentTypeEncoder??(0,oT.default)().applicationJson.encoder}}t.fromOptions=e})(Jp||(Jp={}));var Qp=class extends zc{constructor(e,r){super(),this.writable=e,this.options=Jp.fromOptions(r),this.errorCount=0,this.writeSemaphore=new nN.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(iN,n.byteLength.toString(),aT),i.push(aT),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()}};ei.WriteableStreamMessageWriter=Qp});var lT=$(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.AbstractMessageBuffer=void 0;var oN=13,sN=10,aN=`\r
|
|
4
|
+
`,Zp=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 oN:switch(r){case 0:r=1;break;case 2:r=3;break;default:r=0}break;case sN: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(aN);if(c.length<2)return a;for(let u=0;u<c.length-2;u++){let l=c[u],f=l.indexOf(":");if(f===-1)throw new Error(`Message header must separate key and value using ':'
|
|
5
|
+
${l}`);let d=l.substr(0,f),p=l.substr(f+1).trim();a.set(e?d.toLowerCase():d,p)}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}};Vc.AbstractMessageBuffer=Zp});var hT=$(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.createMessageConnection=X.ConnectionOptions=X.MessageStrategy=X.CancellationStrategy=X.CancellationSenderStrategy=X.CancellationReceiverStrategy=X.RequestCancellationReceiverStrategy=X.IdCancellationReceiverStrategy=X.ConnectionStrategy=X.ConnectionError=X.ConnectionErrors=X.LogTraceNotification=X.SetTraceNotification=X.TraceFormat=X.TraceValues=X.Trace=X.NullLogger=X.ProgressType=X.ProgressToken=void 0;var fT=Qn(),We=yo(),W=Ip(),dT=Op(),ma=xo(),em=Wc(),ya;(function(t){t.type=new W.NotificationType("$/cancelRequest")})(ya||(ya={}));var tm;(function(t){function e(r){return typeof r=="string"||typeof r=="number"}t.is=e})(tm||(X.ProgressToken=tm={}));var ha;(function(t){t.type=new W.NotificationType("$/progress")})(ha||(ha={}));var rm=class{constructor(){}};X.ProgressType=rm;var nm;(function(t){function e(r){return We.func(r)}t.is=e})(nm||(nm={}));X.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var fe;(function(t){t[t.Off=0]="Off",t[t.Messages=1]="Messages",t[t.Compact=2]="Compact",t[t.Verbose=3]="Verbose"})(fe||(X.Trace=fe={}));var pT;(function(t){t.Off="off",t.Messages="messages",t.Compact="compact",t.Verbose="verbose"})(pT||(X.TraceValues=pT={}));(function(t){function e(n){if(!We.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})(fe||(X.Trace=fe={}));var yr;(function(t){t.Text="text",t.JSON="json"})(yr||(X.TraceFormat=yr={}));(function(t){function e(r){return We.string(r)?(r=r.toLowerCase(),r==="json"?t.JSON:t.Text):t.Text}t.fromString=e})(yr||(X.TraceFormat=yr={}));var im;(function(t){t.type=new W.NotificationType("$/setTrace")})(im||(X.SetTraceNotification=im={}));var Xc;(function(t){t.type=new W.NotificationType("$/logTrace")})(Xc||(X.LogTraceNotification=Xc={}));var ga;(function(t){t[t.Closed=1]="Closed",t[t.Disposed=2]="Disposed",t[t.AlreadyListening=3]="AlreadyListening"})(ga||(X.ConnectionErrors=ga={}));var bo=class t extends Error{constructor(e,r){super(r),this.code=e,Object.setPrototypeOf(this,t.prototype)}};X.ConnectionError=bo;var om;(function(t){function e(r){let n=r;return n&&We.func(n.cancelUndispatched)}t.is=e})(om||(X.ConnectionStrategy=om={}));var Yc;(function(t){function e(r){let n=r;return n&&(n.kind===void 0||n.kind==="id")&&We.func(n.createCancellationTokenSource)&&(n.dispose===void 0||We.func(n.dispose))}t.is=e})(Yc||(X.IdCancellationReceiverStrategy=Yc={}));var sm;(function(t){function e(r){let n=r;return n&&n.kind==="request"&&We.func(n.createCancellationTokenSource)&&(n.dispose===void 0||We.func(n.dispose))}t.is=e})(sm||(X.RequestCancellationReceiverStrategy=sm={}));var Jc;(function(t){t.Message=Object.freeze({createCancellationTokenSource(r){return new em.CancellationTokenSource}});function e(r){return Yc.is(r)||sm.is(r)}t.is=e})(Jc||(X.CancellationReceiverStrategy=Jc={}));var Qc;(function(t){t.Message=Object.freeze({sendCancellation(r,n){return r.sendNotification(ya.type,{id:n})},cleanup(r){}});function e(r){let n=r;return n&&We.func(n.sendCancellation)&&We.func(n.cleanup)}t.is=e})(Qc||(X.CancellationSenderStrategy=Qc={}));var Zc;(function(t){t.Message=Object.freeze({receiver:Jc.Message,sender:Qc.Message});function e(r){let n=r;return n&&Jc.is(n.receiver)&&Qc.is(n.sender)}t.is=e})(Zc||(X.CancellationStrategy=Zc={}));var eu;(function(t){function e(r){let n=r;return n&&We.func(n.handleMessage)}t.is=e})(eu||(X.MessageStrategy=eu={}));var mT;(function(t){function e(r){let n=r;return n&&(Zc.is(n.cancellationStrategy)||om.is(n.connectionStrategy)||eu.is(n.messageStrategy))}t.is=e})(mT||(X.ConnectionOptions=mT={}));var Wr;(function(t){t[t.New=1]="New",t[t.Listening=2]="Listening",t[t.Closed=3]="Closed",t[t.Disposed=4]="Disposed"})(Wr||(Wr={}));function cN(t,e,r,n){let i=r!==void 0?r:X.NullLogger,o=0,s=0,a=0,c="2.0",u,l=new Map,f,d=new Map,p=new Map,T,R=new dT.LinkedMap,A=new Map,S=new Set,h=new Map,m=fe.Off,b=yr.Text,_,V=Wr.New,Ct=new ma.Emitter,rt=new ma.Emitter,gr=new ma.Emitter,Xt=new ma.Emitter,I=new ma.Emitter,x=n&&n.cancellationStrategy?n.cancellationStrategy:Zc.Message;function D(y){if(y===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+y.toString()}function L(y){return y===null?"res-unknown-"+(++a).toString():"res-"+y.toString()}function ne(){return"not-"+(++s).toString()}function K(y,k){W.Message.isRequest(k)?y.set(D(k.id),k):W.Message.isResponse(k)?y.set(L(k.id),k):y.set(ne(),k)}function B(y){}function xt(){return V===Wr.Listening}function vt(){return V===Wr.Closed}function oe(){return V===Wr.Disposed}function en(){(V===Wr.New||V===Wr.Listening)&&(V=Wr.Closed,rt.fire(void 0))}function $c(y){Ct.fire([y,void 0,void 0])}function ip(y){Ct.fire(y)}t.onClose(en),t.onError($c),e.onClose(en),e.onError(ip);function ua(){T||R.size===0||(T=(0,fT.default)().timer.setImmediate(()=>{T=void 0,Lc()}))}function or(y){W.Message.isRequest(y)?sr(y):W.Message.isNotification(y)?Yt(y):W.Message.isResponse(y)?Xn(y):Gr(y)}function Lc(){if(R.size===0)return;let y=R.shift();try{let k=n?.messageStrategy;eu.is(k)?k.handleMessage(y,or):or(y)}finally{ua()}}let Rt=y=>{try{if(W.Message.isNotification(y)&&y.method===ya.type.method){let k=y.params.id,N=D(k),q=R.get(N);if(W.Message.isRequest(q)){let be=n?.connectionStrategy,Xe=be&&be.cancelUndispatched?be.cancelUndispatched(q,B):void 0;if(Xe&&(Xe.error!==void 0||Xe.result!==void 0)){R.delete(N),h.delete(k),Xe.id=q.id,Yn(Xe,y.method,Date.now()),e.write(Xe).catch(()=>i.error("Sending response for canceled message failed."));return}}let Oe=h.get(k);if(Oe!==void 0){Oe.cancel(),op(y);return}else S.add(k)}K(R,y)}finally{ua()}};function sr(y){if(oe())return;function k(ie,He,ge){let mt={jsonrpc:c,id:y.id};ie instanceof W.ResponseError?mt.error=ie.toJson():mt.result=ie===void 0?null:ie,Yn(mt,He,ge),e.write(mt).catch(()=>i.error("Sending response failed."))}function N(ie,He,ge){let mt={jsonrpc:c,id:y.id,error:ie.toJson()};Yn(mt,He,ge),e.write(mt).catch(()=>i.error("Sending response failed."))}function q(ie,He,ge){ie===void 0&&(ie=null);let mt={jsonrpc:c,id:y.id,result:ie};Yn(mt,He,ge),e.write(mt).catch(()=>i.error("Sending response failed."))}Mc(y);let Oe=l.get(y.method),be,Xe;Oe&&(be=Oe.type,Xe=Oe.handler);let nt=Date.now();if(Xe||u){let ie=y.id??String(Date.now()),He=Yc.is(x.receiver)?x.receiver.createCancellationTokenSource(ie):x.receiver.createCancellationTokenSource(y);y.id!==null&&S.has(y.id)&&He.cancel(),y.id!==null&&h.set(ie,He);try{let ge;if(Xe)if(y.params===void 0){if(be!==void 0&&be.numberOfParams!==0){N(new W.ResponseError(W.ErrorCodes.InvalidParams,`Request ${y.method} defines ${be.numberOfParams} params but received none.`),y.method,nt);return}ge=Xe(He.token)}else if(Array.isArray(y.params)){if(be!==void 0&&be.parameterStructures===W.ParameterStructures.byName){N(new W.ResponseError(W.ErrorCodes.InvalidParams,`Request ${y.method} defines parameters by name but received parameters by position`),y.method,nt);return}ge=Xe(...y.params,He.token)}else{if(be!==void 0&&be.parameterStructures===W.ParameterStructures.byPosition){N(new W.ResponseError(W.ErrorCodes.InvalidParams,`Request ${y.method} defines parameters by position but received parameters by name`),y.method,nt);return}ge=Xe(y.params,He.token)}else u&&(ge=u(y.method,y.params,He.token));let mt=ge;ge?mt.then?mt.then(Jt=>{h.delete(ie),k(Jt,y.method,nt)},Jt=>{h.delete(ie),Jt instanceof W.ResponseError?N(Jt,y.method,nt):Jt&&We.string(Jt.message)?N(new W.ResponseError(W.ErrorCodes.InternalError,`Request ${y.method} failed with message: ${Jt.message}`),y.method,nt):N(new W.ResponseError(W.ErrorCodes.InternalError,`Request ${y.method} failed unexpectedly without providing any details.`),y.method,nt)}):(h.delete(ie),k(ge,y.method,nt)):(h.delete(ie),q(ge,y.method,nt))}catch(ge){h.delete(ie),ge instanceof W.ResponseError?k(ge,y.method,nt):ge&&We.string(ge.message)?N(new W.ResponseError(W.ErrorCodes.InternalError,`Request ${y.method} failed with message: ${ge.message}`),y.method,nt):N(new W.ResponseError(W.ErrorCodes.InternalError,`Request ${y.method} failed unexpectedly without providing any details.`),y.method,nt)}}else N(new W.ResponseError(W.ErrorCodes.MethodNotFound,`Unhandled method ${y.method}`),y.method,nt)}function Xn(y){if(!oe())if(y.id===null)y.error?i.error(`Received response message without id: Error is:
|
|
6
|
+
${JSON.stringify(y.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.");else{let k=y.id,N=A.get(k);if(OC(y,N),N!==void 0){A.delete(k);try{if(y.error){let q=y.error;N.reject(new W.ResponseError(q.code,q.message,q.data))}else if(y.result!==void 0)N.resolve(y.result);else throw new Error("Should never happen.")}catch(q){q.message?i.error(`Response handler '${N.method}' failed with message: ${q.message}`):i.error(`Response handler '${N.method}' failed unexpectedly.`)}}}}function Yt(y){if(oe())return;let k,N;if(y.method===ya.type.method){let q=y.params.id;S.delete(q),op(y);return}else{let q=d.get(y.method);q&&(N=q.handler,k=q.type)}if(N||f)try{if(op(y),N)if(y.params===void 0)k!==void 0&&k.numberOfParams!==0&&k.parameterStructures!==W.ParameterStructures.byName&&i.error(`Notification ${y.method} defines ${k.numberOfParams} params but received none.`),N();else if(Array.isArray(y.params)){let q=y.params;y.method===ha.type.method&&q.length===2&&tm.is(q[0])?N({token:q[0],value:q[1]}):(k!==void 0&&(k.parameterStructures===W.ParameterStructures.byName&&i.error(`Notification ${y.method} defines parameters by name but received parameters by position`),k.numberOfParams!==y.params.length&&i.error(`Notification ${y.method} defines ${k.numberOfParams} params but received ${q.length} arguments`)),N(...q))}else k!==void 0&&k.parameterStructures===W.ParameterStructures.byPosition&&i.error(`Notification ${y.method} defines parameters by position but received parameters by name`),N(y.params);else f&&f(y.method,y.params)}catch(q){q.message?i.error(`Notification handler '${y.method}' failed with message: ${q.message}`):i.error(`Notification handler '${y.method}' failed unexpectedly.`)}else gr.fire(y)}function Gr(y){if(!y){i.error("Received empty message.");return}i.error(`Received message which is neither a response nor a notification message:
|
|
7
|
+
${JSON.stringify(y,null,4)}`);let k=y;if(We.string(k.id)||We.number(k.id)){let N=k.id,q=A.get(N);q&&q.reject(new Error("The received response has neither a result nor an error property."))}}function Nt(y){if(y!=null)switch(m){case fe.Verbose:return JSON.stringify(y,null,4);case fe.Compact:return JSON.stringify(y);default:return}}function Hr(y){if(!(m===fe.Off||!_))if(b===yr.Text){let k;(m===fe.Verbose||m===fe.Compact)&&y.params&&(k=`Params: ${Nt(y.params)}
|
|
8
8
|
|
|
9
|
-
`),_.log(`Sending request '${y.method} - (${y.id})'.`,k)}else ho("send-request",y)}function
|
|
9
|
+
`),_.log(`Sending request '${y.method} - (${y.id})'.`,k)}else ho("send-request",y)}function wn(y){if(!(m===fe.Off||!_))if(b===yr.Text){let k;(m===fe.Verbose||m===fe.Compact)&&(y.params?k=`Params: ${Nt(y.params)}
|
|
10
10
|
|
|
11
11
|
`:k=`No parameters provided.
|
|
12
12
|
|
|
13
|
-
`),_.log(`Sending notification '${y.method}'.`,k)}else ho("send-notification",y)}function
|
|
13
|
+
`),_.log(`Sending notification '${y.method}'.`,k)}else ho("send-notification",y)}function Yn(y,k,N){if(!(m===fe.Off||!_))if(b===yr.Text){let q;(m===fe.Verbose||m===fe.Compact)&&(y.error&&y.error.data?q=`Error data: ${Nt(y.error.data)}
|
|
14
14
|
|
|
15
15
|
`:y.result?q=`Result: ${Nt(y.result)}
|
|
16
16
|
|
|
17
17
|
`:y.error===void 0&&(q=`No result returned.
|
|
18
18
|
|
|
19
|
-
`)),_.log(`Sending response '${k} - (${y.id})'. Processing request took ${Date.now()-N}ms`,q)}else ho("send-response",y)}function Mc(y){if(!(m===fe.Off||!_))if(b===
|
|
19
|
+
`)),_.log(`Sending response '${k} - (${y.id})'. Processing request took ${Date.now()-N}ms`,q)}else ho("send-response",y)}function Mc(y){if(!(m===fe.Off||!_))if(b===yr.Text){let k;(m===fe.Verbose||m===fe.Compact)&&y.params&&(k=`Params: ${Nt(y.params)}
|
|
20
20
|
|
|
21
|
-
`),_.log(`Received request '${y.method} - (${y.id})'.`,k)}else ho("receive-request",y)}function op(y){if(!(m===fe.Off||!_||y.method===Xc.type.method))if(b===
|
|
21
|
+
`),_.log(`Received request '${y.method} - (${y.id})'.`,k)}else ho("receive-request",y)}function op(y){if(!(m===fe.Off||!_||y.method===Xc.type.method))if(b===yr.Text){let k;(m===fe.Verbose||m===fe.Compact)&&(y.params?k=`Params: ${Nt(y.params)}
|
|
22
22
|
|
|
23
23
|
`:k=`No parameters provided.
|
|
24
24
|
|
|
25
|
-
`),_.log(`Received notification '${y.method}'.`,k)}else ho("receive-notification",y)}function
|
|
25
|
+
`),_.log(`Received notification '${y.method}'.`,k)}else ho("receive-notification",y)}function OC(y,k){if(!(m===fe.Off||!_))if(b===yr.Text){let N;if((m===fe.Verbose||m===fe.Compact)&&(y.error&&y.error.data?N=`Error data: ${Nt(y.error.data)}
|
|
26
26
|
|
|
27
27
|
`:y.result?N=`Result: ${Nt(y.result)}
|
|
28
28
|
|
|
29
29
|
`:y.error===void 0&&(N=`No result returned.
|
|
30
30
|
|
|
31
|
-
`)),k){let q=y.error?` Request failed: ${y.error.message} (${y.error.code}).`:"";_.log(`Received response '${k.method} - (${y.id})' in ${Date.now()-k.timerStart}ms.${q}`,N)}else _.log(`Received response ${y.id} without active response promise.`,N)}else ho("receive-response",y)}function ho(y,k){if(!_||m===fe.Off)return;let N={isLSPMessage:!0,type:y,message:k,timestamp:Date.now()};_.log(N)}function la(){if(vt())throw new bo(ga.Closed,"Connection is closed.");if(oe())throw new bo(ga.Disposed,"Connection is disposed.")}function DC(){if(xt())throw new bo(ga.AlreadyListening,"Connection is already listening")}function OC(){if(!xt())throw new Error("Call listen() first.")}function fa(y){return y===void 0?null:y}function By(y){if(y!==null)return y}function Ky(y){return y!=null&&!Array.isArray(y)&&typeof y=="object"}function sp(y,k){switch(y){case W.ParameterStructures.auto:return Ky(k)?By(k):[fa(k)];case W.ParameterStructures.byName:if(!Ky(k))throw new Error("Received parameters by name but param is not an object literal.");return By(k);case W.ParameterStructures.byPosition:return[fa(k)];default:throw new Error(`Unknown parameter structure ${y.toString()}`)}}function zy(y,k){let N,q=y.numberOfParams;switch(q){case 0:N=void 0;break;case 1:N=sp(y.parameterStructures,k[0]);break;default:N=[];for(let Oe=0;Oe<k.length&&Oe<q;Oe++)N.push(fa(k[Oe]));if(k.length<q)for(let Oe=k.length;Oe<q;Oe++)N.push(null);break}return N}let go={sendNotification:(y,...k)=>{la();let N,q;if(We.string(y)){N=y;let be=k[0],Xe=0,nt=W.ParameterStructures.auto;W.ParameterStructures.is(be)&&(Xe=1,nt=be);let ie=k.length,He=ie-Xe;switch(He){case 0:q=void 0;break;case 1:q=sp(nt,k[Xe]);break;default:if(nt===W.ParameterStructures.byName)throw new Error(`Received ${He} parameters for 'by Name' notification parameter structure.`);q=k.slice(Xe,ie).map(ge=>fa(ge));break}}else{let be=k;N=y.method,q=zy(y,be)}let Oe={jsonrpc:c,method:N,params:q};return En(Oe),e.write(Oe).catch(be=>{throw i.error("Sending notification failed."),be})},onNotification:(y,k)=>{la();let N;return We.func(y)?f=y:k&&(We.string(y)?(N=y,d.set(y,{type:void 0,handler:k})):(N=y.method,d.set(y.method,{type:y,handler:k}))),{dispose:()=>{N!==void 0?d.delete(N):f=void 0}}},onProgress:(y,k,N)=>{if(p.has(k))throw new Error(`Progress handler for token ${k} already registered`);return p.set(k,N),{dispose:()=>{p.delete(k)}}},sendProgress:(y,k,N)=>go.sendNotification(ha.type,{token:k,value:N}),onUnhandledProgress:Xt.event,sendRequest:(y,...k)=>{la(),OC();let N,q,Oe;if(We.string(y)){N=y;let ie=k[0],He=k[k.length-1],ge=0,mt=W.ParameterStructures.auto;W.ParameterStructures.is(ie)&&(ge=1,mt=ie);let Jt=k.length;em.CancellationToken.is(He)&&(Jt=Jt-1,Oe=He);let rn=Jt-ge;switch(rn){case 0:q=void 0;break;case 1:q=sp(mt,k[ge]);break;default:if(mt===W.ParameterStructures.byName)throw new Error(`Received ${rn} parameters for 'by Name' request parameter structure.`);q=k.slice(ge,Jt).map($C=>fa($C));break}}else{let ie=k;N=y.method,q=zy(y,ie);let He=y.numberOfParams;Oe=em.CancellationToken.is(ie[He])?ie[He]:void 0}let be=o++,Xe;Oe&&(Xe=Oe.onCancellationRequested(()=>{let ie=v.sender.sendCancellation(go,be);return ie===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${be}`),Promise.resolve()):ie.catch(()=>{i.log(`Sending cancellation messages for id ${be} failed`)})}));let nt={jsonrpc:c,id:be,method:N,params:q};return Wr(nt),typeof v.sender.enableCancellation=="function"&&v.sender.enableCancellation(nt),new Promise(async(ie,He)=>{let ge=rn=>{ie(rn),v.sender.cleanup(be),Xe?.dispose()},mt=rn=>{He(rn),v.sender.cleanup(be),Xe?.dispose()},Jt={method:N,timerStart:Date.now(),resolve:ge,reject:mt};try{await e.write(nt),A.set(be,Jt)}catch(rn){throw i.error("Sending request failed."),Jt.reject(new W.ResponseError(W.ErrorCodes.MessageWriteError,rn.message?rn.message:"Unknown reason")),rn}})},onRequest:(y,k)=>{la();let N=null;return nm.is(y)?(N=void 0,u=y):We.string(y)?(N=null,k!==void 0&&(N=y,l.set(y,{handler:k,type:void 0}))):k!==void 0&&(N=y.method,l.set(y.method,{type:y,handler:k})),{dispose:()=>{N!==null&&(N!==void 0?l.delete(N):u=void 0)}}},hasPendingResponse:()=>A.size>0,trace:async(y,k,N)=>{let q=!1,Oe=xr.Text;N!==void 0&&(We.boolean(N)?q=N:(q=N.sendNotification||!1,Oe=N.traceFormat||xr.Text)),m=y,b=Oe,m===fe.Off?_=void 0:_=k,q&&!vt()&&!oe()&&await go.sendNotification(im.type,{value:fe.toString(y)})},onError:Ct.event,onClose:rt.event,onUnhandledNotification:Tr.event,onDispose:I.event,end:()=>{e.end()},dispose:()=>{if(oe())return;V=Br.Disposed,I.fire(void 0);let y=new W.ResponseError(W.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let k of A.values())k.reject(y);A=new Map,h=new Map,x=new Set,S=new dT.LinkedMap,We.func(e.dispose)&&e.dispose(),We.func(t.dispose)&&t.dispose()},listen:()=>{la(),DC(),V=Br.Listening,t.listen(Rt)},inspect:()=>{(0,fT.default)().console.log("inspect")}};return go.onNotification(Xc.type,y=>{if(m===fe.Off||!_)return;let k=m===fe.Verbose||m===fe.Compact;_.log(y.message,k?y.verbose:void 0)}),go.onNotification(ha.type,y=>{let k=p.get(y.token);k?k(y.value):Xt.fire(y)}),go}X.createMessageConnection=sN});var tu=$(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.ProgressType=w.ProgressToken=w.createMessageConnection=w.NullLogger=w.ConnectionOptions=w.ConnectionStrategy=w.AbstractMessageBuffer=w.WriteableStreamMessageWriter=w.AbstractMessageWriter=w.MessageWriter=w.ReadableStreamMessageReader=w.AbstractMessageReader=w.MessageReader=w.SharedArrayReceiverStrategy=w.SharedArraySenderStrategy=w.CancellationToken=w.CancellationTokenSource=w.Emitter=w.Event=w.Disposable=w.LRUCache=w.Touch=w.LinkedMap=w.ParameterStructures=w.NotificationType9=w.NotificationType8=w.NotificationType7=w.NotificationType6=w.NotificationType5=w.NotificationType4=w.NotificationType3=w.NotificationType2=w.NotificationType1=w.NotificationType0=w.NotificationType=w.ErrorCodes=w.ResponseError=w.RequestType9=w.RequestType8=w.RequestType7=w.RequestType6=w.RequestType5=w.RequestType4=w.RequestType3=w.RequestType2=w.RequestType1=w.RequestType0=w.RequestType=w.Message=w.RAL=void 0;w.MessageStrategy=w.CancellationStrategy=w.CancellationSenderStrategy=w.CancellationReceiverStrategy=w.ConnectionError=w.ConnectionErrors=w.LogTraceNotification=w.SetTraceNotification=w.TraceFormat=w.TraceValues=w.Trace=void 0;var Ee=Ip();Object.defineProperty(w,"Message",{enumerable:!0,get:function(){return Ee.Message}});Object.defineProperty(w,"RequestType",{enumerable:!0,get:function(){return Ee.RequestType}});Object.defineProperty(w,"RequestType0",{enumerable:!0,get:function(){return Ee.RequestType0}});Object.defineProperty(w,"RequestType1",{enumerable:!0,get:function(){return Ee.RequestType1}});Object.defineProperty(w,"RequestType2",{enumerable:!0,get:function(){return Ee.RequestType2}});Object.defineProperty(w,"RequestType3",{enumerable:!0,get:function(){return Ee.RequestType3}});Object.defineProperty(w,"RequestType4",{enumerable:!0,get:function(){return Ee.RequestType4}});Object.defineProperty(w,"RequestType5",{enumerable:!0,get:function(){return Ee.RequestType5}});Object.defineProperty(w,"RequestType6",{enumerable:!0,get:function(){return Ee.RequestType6}});Object.defineProperty(w,"RequestType7",{enumerable:!0,get:function(){return Ee.RequestType7}});Object.defineProperty(w,"RequestType8",{enumerable:!0,get:function(){return Ee.RequestType8}});Object.defineProperty(w,"RequestType9",{enumerable:!0,get:function(){return Ee.RequestType9}});Object.defineProperty(w,"ResponseError",{enumerable:!0,get:function(){return Ee.ResponseError}});Object.defineProperty(w,"ErrorCodes",{enumerable:!0,get:function(){return Ee.ErrorCodes}});Object.defineProperty(w,"NotificationType",{enumerable:!0,get:function(){return Ee.NotificationType}});Object.defineProperty(w,"NotificationType0",{enumerable:!0,get:function(){return Ee.NotificationType0}});Object.defineProperty(w,"NotificationType1",{enumerable:!0,get:function(){return Ee.NotificationType1}});Object.defineProperty(w,"NotificationType2",{enumerable:!0,get:function(){return Ee.NotificationType2}});Object.defineProperty(w,"NotificationType3",{enumerable:!0,get:function(){return Ee.NotificationType3}});Object.defineProperty(w,"NotificationType4",{enumerable:!0,get:function(){return Ee.NotificationType4}});Object.defineProperty(w,"NotificationType5",{enumerable:!0,get:function(){return Ee.NotificationType5}});Object.defineProperty(w,"NotificationType6",{enumerable:!0,get:function(){return Ee.NotificationType6}});Object.defineProperty(w,"NotificationType7",{enumerable:!0,get:function(){return Ee.NotificationType7}});Object.defineProperty(w,"NotificationType8",{enumerable:!0,get:function(){return Ee.NotificationType8}});Object.defineProperty(w,"NotificationType9",{enumerable:!0,get:function(){return Ee.NotificationType9}});Object.defineProperty(w,"ParameterStructures",{enumerable:!0,get:function(){return Ee.ParameterStructures}});var am=Op();Object.defineProperty(w,"LinkedMap",{enumerable:!0,get:function(){return am.LinkedMap}});Object.defineProperty(w,"LRUCache",{enumerable:!0,get:function(){return am.LRUCache}});Object.defineProperty(w,"Touch",{enumerable:!0,get:function(){return am.Touch}});var aN=eT();Object.defineProperty(w,"Disposable",{enumerable:!0,get:function(){return aN.Disposable}});var gT=xo();Object.defineProperty(w,"Event",{enumerable:!0,get:function(){return gT.Event}});Object.defineProperty(w,"Emitter",{enumerable:!0,get:function(){return gT.Emitter}});var yT=Wc();Object.defineProperty(w,"CancellationTokenSource",{enumerable:!0,get:function(){return yT.CancellationTokenSource}});Object.defineProperty(w,"CancellationToken",{enumerable:!0,get:function(){return yT.CancellationToken}});var TT=rT();Object.defineProperty(w,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return TT.SharedArraySenderStrategy}});Object.defineProperty(w,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return TT.SharedArrayReceiverStrategy}});var cm=iT();Object.defineProperty(w,"MessageReader",{enumerable:!0,get:function(){return cm.MessageReader}});Object.defineProperty(w,"AbstractMessageReader",{enumerable:!0,get:function(){return cm.AbstractMessageReader}});Object.defineProperty(w,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return cm.ReadableStreamMessageReader}});var um=uT();Object.defineProperty(w,"MessageWriter",{enumerable:!0,get:function(){return um.MessageWriter}});Object.defineProperty(w,"AbstractMessageWriter",{enumerable:!0,get:function(){return um.AbstractMessageWriter}});Object.defineProperty(w,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return um.WriteableStreamMessageWriter}});var cN=lT();Object.defineProperty(w,"AbstractMessageBuffer",{enumerable:!0,get:function(){return cN.AbstractMessageBuffer}});var Pt=hT();Object.defineProperty(w,"ConnectionStrategy",{enumerable:!0,get:function(){return Pt.ConnectionStrategy}});Object.defineProperty(w,"ConnectionOptions",{enumerable:!0,get:function(){return Pt.ConnectionOptions}});Object.defineProperty(w,"NullLogger",{enumerable:!0,get:function(){return Pt.NullLogger}});Object.defineProperty(w,"createMessageConnection",{enumerable:!0,get:function(){return Pt.createMessageConnection}});Object.defineProperty(w,"ProgressToken",{enumerable:!0,get:function(){return Pt.ProgressToken}});Object.defineProperty(w,"ProgressType",{enumerable:!0,get:function(){return Pt.ProgressType}});Object.defineProperty(w,"Trace",{enumerable:!0,get:function(){return Pt.Trace}});Object.defineProperty(w,"TraceValues",{enumerable:!0,get:function(){return Pt.TraceValues}});Object.defineProperty(w,"TraceFormat",{enumerable:!0,get:function(){return Pt.TraceFormat}});Object.defineProperty(w,"SetTraceNotification",{enumerable:!0,get:function(){return Pt.SetTraceNotification}});Object.defineProperty(w,"LogTraceNotification",{enumerable:!0,get:function(){return Pt.LogTraceNotification}});Object.defineProperty(w,"ConnectionErrors",{enumerable:!0,get:function(){return Pt.ConnectionErrors}});Object.defineProperty(w,"ConnectionError",{enumerable:!0,get:function(){return Pt.ConnectionError}});Object.defineProperty(w,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return Pt.CancellationReceiverStrategy}});Object.defineProperty(w,"CancellationSenderStrategy",{enumerable:!0,get:function(){return Pt.CancellationSenderStrategy}});Object.defineProperty(w,"CancellationStrategy",{enumerable:!0,get:function(){return Pt.CancellationStrategy}});Object.defineProperty(w,"MessageStrategy",{enumerable:!0,get:function(){return Pt.MessageStrategy}});var uN=Zn();w.RAL=uN.default});var vT=$(pm=>{"use strict";Object.defineProperty(pm,"__esModule",{value:!0});var nn=tu(),ru=class t extends nn.AbstractMessageBuffer{constructor(e="utf-8"){super(e),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return t.emptyBuffer}fromString(e,r){return new TextEncoder().encode(e)}toString(e,r){return r==="ascii"?this.asciiDecoder.decode(e):new TextDecoder(r).decode(e)}asNative(e,r){return r===void 0?e:e.slice(0,r)}allocNative(e){return new Uint8Array(e)}};ru.emptyBuffer=new Uint8Array(0);var lm=class{constructor(e){this.socket=e,this._onData=new nn.Emitter,this._messageListener=r=>{r.data.arrayBuffer().then(i=>{this._onData.fire(new Uint8Array(i))},()=>{(0,nn.RAL)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(e){return this.socket.addEventListener("close",e),nn.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),nn.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),nn.Disposable.create(()=>this.socket.removeEventListener("end",e))}onData(e){return this._onData.event(e)}},fm=class{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener("close",e),nn.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),nn.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),nn.Disposable.create(()=>this.socket.removeEventListener("end",e))}write(e,r){if(typeof e=="string"){if(r!==void 0&&r!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${r}`);this.socket.send(e)}else this.socket.send(e);return Promise.resolve()}end(){this.socket.close()}},lN=new TextEncoder,xT=Object.freeze({messageBuffer:Object.freeze({create:t=>new ru(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(t,e)=>{if(e.charset!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${e.charset}`);return Promise.resolve(lN.encode(JSON.stringify(t,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(t,e)=>{if(!(t instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(e.charset).decode(t)))}})}),stream:Object.freeze({asReadableStream:t=>new lm(t),asWritableStream:t=>new fm(t)}),console,timer:Object.freeze({setTimeout(t,e,...r){let n=setTimeout(t,e,...r);return{dispose:()=>clearTimeout(n)}},setImmediate(t,...e){let r=setTimeout(t,0,...e);return{dispose:()=>clearTimeout(r)}},setInterval(t,e,...r){let n=setInterval(t,e,...r);return{dispose:()=>clearInterval(n)}}})});function dm(){return xT}(function(t){function e(){nn.RAL.install(xT)}t.install=e})(dm||(dm={}));pm.default=dm});var _n=$(vr=>{"use strict";var fN=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]}),dN=vr&&vr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&fN(e,t,r)};Object.defineProperty(vr,"__esModule",{value:!0});vr.createMessageConnection=vr.BrowserMessageWriter=vr.BrowserMessageReader=void 0;var pN=vT();pN.default.install();var Ao=tu();dN(tu(),vr);var mm=class extends Ao.AbstractMessageReader{constructor(e){super(),this._onData=new Ao.Emitter,this._messageListener=r=>{this._onData.fire(r.data)},e.addEventListener("error",r=>this.fireError(r)),e.onmessage=this._messageListener}listen(e){return this._onData.event(e)}};vr.BrowserMessageReader=mm;var hm=class extends Ao.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.addEventListener("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(){}};vr.BrowserMessageWriter=hm;function mN(t,e,r,n){return r===void 0&&(r=Ao.NullLogger),Ao.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Ao.createMessageConnection)(t,e,r,n)}vr.createMessageConnection=mN});var gm=$((TG,RT)=>{"use strict";RT.exports=_n()});var fu={};GC(fu,{AnnotatedTextEdit:()=>Cn,ChangeAnnotation:()=>Mi,ChangeAnnotationIdentifier:()=>It,CodeAction:()=>Xm,CodeActionContext:()=>Vm,CodeActionKind:()=>zm,CodeActionTriggerKind:()=>wa,CodeDescription:()=>wm,CodeLens:()=>Ym,Color:()=>iu,ColorInformation:()=>vm,ColorPresentation:()=>Rm,Command:()=>Ui,CompletionItem:()=>$m,CompletionItemKind:()=>ba,CompletionItemLabelDetails:()=>Om,CompletionItemTag:()=>Pm,CompletionList:()=>Lm,CreateFile:()=>ko,DeleteFile:()=>_o,Diagnostic:()=>va,DiagnosticRelatedInformation:()=>ou,DiagnosticSeverity:()=>Am,DiagnosticTag:()=>Fi,DocumentHighlight:()=>jm,DocumentHighlightKind:()=>qm,DocumentLink:()=>Qm,DocumentSymbol:()=>Km,DocumentUri:()=>ym,EOL:()=>hN,FoldingRange:()=>bm,FoldingRangeKind:()=>Sm,FormattingOptions:()=>Jm,Hover:()=>Mm,InlayHint:()=>ah,InlayHintKind:()=>uu,InlayHintLabelPart:()=>lu,InlineCompletionContext:()=>ph,InlineCompletionItem:()=>uh,InlineCompletionList:()=>lh,InlineCompletionTriggerKind:()=>fh,InlineValueContext:()=>sh,InlineValueEvaluatableExpression:()=>oh,InlineValueText:()=>nh,InlineValueVariableLookup:()=>ih,InsertReplaceEdit:()=>Im,InsertTextFormat:()=>Nm,InsertTextMode:()=>Dm,Location:()=>xa,LocationLink:()=>xm,MarkedString:()=>Aa,MarkupContent:()=>Co,MarkupKind:()=>cu,OptionalVersionedTextDocumentIdentifier:()=>Sa,ParameterInformation:()=>Fm,Position:()=>Qt,Range:()=>Ye,RenameFile:()=>Eo,SelectedCompletionInfo:()=>dh,SelectionRange:()=>Zm,SemanticTokenModifiers:()=>th,SemanticTokenTypes:()=>eh,SemanticTokens:()=>rh,SignatureInformation:()=>Um,StringValue:()=>ch,SymbolInformation:()=>Wm,SymbolKind:()=>Gm,SymbolTag:()=>Hm,TextDocument:()=>hh,TextDocumentEdit:()=>Ra,TextDocumentIdentifier:()=>Em,TextDocumentItem:()=>Cm,TextEdit:()=>on,URI:()=>nu,VersionedTextDocumentIdentifier:()=>_m,WorkspaceChange:()=>km,WorkspaceEdit:()=>su,WorkspaceFolder:()=>mh,WorkspaceSymbol:()=>Bm,integer:()=>Tm,uinteger:()=>Ta});var ym,nu,Tm,Ta,Qt,Ye,xa,xm,iu,vm,Rm,Sm,bm,ou,Am,Fi,wm,va,Ui,on,Mi,It,Cn,Ra,ko,Eo,_o,su,wo,au,km,Em,_m,Sa,Cm,cu,Co,ba,Nm,Pm,Im,Dm,Om,$m,Lm,Aa,Mm,Fm,Um,qm,jm,Gm,Hm,Wm,Bm,Km,zm,wa,Vm,Xm,Ym,Jm,Qm,Zm,eh,th,rh,nh,ih,oh,sh,uu,lu,ah,ch,uh,lh,fh,dh,ph,mh,hN,hh,gh,R,qi=jC(()=>{"use strict";(function(t){function e(r){return typeof r=="string"}t.is=e})(ym||(ym={}));(function(t){function e(r){return typeof r=="string"}t.is=e})(nu||(nu={}));(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})(Tm||(Tm={}));(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})(Ta||(Ta={}));(function(t){function e(n,i){return n===Number.MAX_VALUE&&(n=Ta.MAX_VALUE),i===Number.MAX_VALUE&&(i=Ta.MAX_VALUE),{line:n,character:i}}t.create=e;function r(n){let i=n;return R.objectLiteral(i)&&R.uinteger(i.line)&&R.uinteger(i.character)}t.is=r})(Qt||(Qt={}));(function(t){function e(n,i,o,s){if(R.uinteger(n)&&R.uinteger(i)&&R.uinteger(o)&&R.uinteger(s))return{start:Qt.create(n,i),end:Qt.create(o,s)};if(Qt.is(n)&&Qt.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 R.objectLiteral(i)&&Qt.is(i.start)&&Qt.is(i.end)}t.is=r})(Ye||(Ye={}));(function(t){function e(n,i){return{uri:n,range:i}}t.create=e;function r(n){let i=n;return R.objectLiteral(i)&&Ye.is(i.range)&&(R.string(i.uri)||R.undefined(i.uri))}t.is=r})(xa||(xa={}));(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 R.objectLiteral(i)&&Ye.is(i.targetRange)&&R.string(i.targetUri)&&Ye.is(i.targetSelectionRange)&&(Ye.is(i.originSelectionRange)||R.undefined(i.originSelectionRange))}t.is=r})(xm||(xm={}));(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 R.objectLiteral(i)&&R.numberRange(i.red,0,1)&&R.numberRange(i.green,0,1)&&R.numberRange(i.blue,0,1)&&R.numberRange(i.alpha,0,1)}t.is=r})(iu||(iu={}));(function(t){function e(n,i){return{range:n,color:i}}t.create=e;function r(n){let i=n;return R.objectLiteral(i)&&Ye.is(i.range)&&iu.is(i.color)}t.is=r})(vm||(vm={}));(function(t){function e(n,i,o){return{label:n,textEdit:i,additionalTextEdits:o}}t.create=e;function r(n){let i=n;return R.objectLiteral(i)&&R.string(i.label)&&(R.undefined(i.textEdit)||on.is(i))&&(R.undefined(i.additionalTextEdits)||R.typedArray(i.additionalTextEdits,on.is))}t.is=r})(Rm||(Rm={}));(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(Sm||(Sm={}));(function(t){function e(n,i,o,s,a,c){let u={startLine:n,endLine:i};return R.defined(o)&&(u.startCharacter=o),R.defined(s)&&(u.endCharacter=s),R.defined(a)&&(u.kind=a),R.defined(c)&&(u.collapsedText=c),u}t.create=e;function r(n){let i=n;return R.objectLiteral(i)&&R.uinteger(i.startLine)&&R.uinteger(i.startLine)&&(R.undefined(i.startCharacter)||R.uinteger(i.startCharacter))&&(R.undefined(i.endCharacter)||R.uinteger(i.endCharacter))&&(R.undefined(i.kind)||R.string(i.kind))}t.is=r})(bm||(bm={}));(function(t){function e(n,i){return{location:n,message:i}}t.create=e;function r(n){let i=n;return R.defined(i)&&xa.is(i.location)&&R.string(i.message)}t.is=r})(ou||(ou={}));(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(Am||(Am={}));(function(t){t.Unnecessary=1,t.Deprecated=2})(Fi||(Fi={}));(function(t){function e(r){let n=r;return R.objectLiteral(n)&&R.string(n.href)}t.is=e})(wm||(wm={}));(function(t){function e(n,i,o,s,a,c){let u={range:n,message:i};return R.defined(o)&&(u.severity=o),R.defined(s)&&(u.code=s),R.defined(a)&&(u.source=a),R.defined(c)&&(u.relatedInformation=c),u}t.create=e;function r(n){var i;let o=n;return R.defined(o)&&Ye.is(o.range)&&R.string(o.message)&&(R.number(o.severity)||R.undefined(o.severity))&&(R.integer(o.code)||R.string(o.code)||R.undefined(o.code))&&(R.undefined(o.codeDescription)||R.string((i=o.codeDescription)===null||i===void 0?void 0:i.href))&&(R.string(o.source)||R.undefined(o.source))&&(R.undefined(o.relatedInformation)||R.typedArray(o.relatedInformation,ou.is))}t.is=r})(va||(va={}));(function(t){function e(n,i,...o){let s={title:n,command:i};return R.defined(o)&&o.length>0&&(s.arguments=o),s}t.create=e;function r(n){let i=n;return R.defined(i)&&R.string(i.title)&&R.string(i.command)}t.is=r})(Ui||(Ui={}));(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 R.objectLiteral(s)&&R.string(s.newText)&&Ye.is(s.range)}t.is=i})(on||(on={}));(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 R.objectLiteral(i)&&R.string(i.label)&&(R.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(R.string(i.description)||i.description===void 0)}t.is=r})(Mi||(Mi={}));(function(t){function e(r){let n=r;return R.string(n)}t.is=e})(It||(It={}));(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 on.is(s)&&(Mi.is(s.annotationId)||It.is(s.annotationId))}t.is=i})(Cn||(Cn={}));(function(t){function e(n,i){return{textDocument:n,edits:i}}t.create=e;function r(n){let i=n;return R.defined(i)&&Sa.is(i.textDocument)&&Array.isArray(i.edits)}t.is=r})(Ra||(Ra={}));(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"&&R.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||R.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||R.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||It.is(i.annotationId))}t.is=r})(ko||(ko={}));(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"&&R.string(i.oldUri)&&R.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||R.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||R.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||It.is(i.annotationId))}t.is=r})(Eo||(Eo={}));(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"&&R.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||R.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||R.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||It.is(i.annotationId))}t.is=r})(_o||(_o={}));(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=>R.string(i.kind)?ko.is(i)||Eo.is(i)||_o.is(i):Ra.is(i)))}t.is=e})(su||(su={}));wo=class{constructor(e,r){this.edits=e,this.changeAnnotations=r}insert(e,r,n){let i,o;if(n===void 0?i=on.insert(e,r):It.is(n)?(o=n,i=Cn.insert(e,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(n),i=Cn.insert(e,r,o)),this.edits.push(i),o!==void 0)return o}replace(e,r,n){let i,o;if(n===void 0?i=on.replace(e,r):It.is(n)?(o=n,i=Cn.replace(e,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(n),i=Cn.replace(e,r,o)),this.edits.push(i),o!==void 0)return o}delete(e,r){let n,i;if(r===void 0?n=on.del(e):It.is(r)?(i=r,n=Cn.del(e,r)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(r),n=Cn.del(e,i)),this.edits.push(n),i!==void 0)return i}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},au=class{constructor(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,r){let n;if(It.is(e)?n=e:(n=this.nextId(),r=e),this._annotations[n]!==void 0)throw new Error(`Id ${n} is already in use.`);if(r===void 0)throw new Error(`No annotation provided for id ${n}`);return this._annotations[n]=r,this._size++,n}nextId(){return this._counter++,this._counter.toString()}},km=class{constructor(e){this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new au(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(r=>{if(Ra.is(r)){let n=new wo(r.edits,this._changeAnnotations);this._textEditChanges[r.textDocument.uri]=n}})):e.changes&&Object.keys(e.changes).forEach(r=>{let n=new wo(e.changes[r]);this._textEditChanges[r]=n})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(Sa.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let r={uri:e.uri,version:e.version},n=this._textEditChanges[r.uri];if(!n){let i=[],o={textDocument:r,edits:i};this._workspaceEdit.documentChanges.push(o),n=new wo(i,this._changeAnnotations),this._textEditChanges[r.uri]=n}return n}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let r=this._textEditChanges[e];if(!r){let n=[];this._workspaceEdit.changes[e]=n,r=new wo(n),this._textEditChanges[e]=r}return r}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new au,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;Mi.is(r)||It.is(r)?i=r:n=r;let o,s;if(i===void 0?o=ko.create(e,n):(s=It.is(i)?i:this._changeAnnotations.manage(i),o=ko.create(e,n,s)),this._workspaceEdit.documentChanges.push(o),s!==void 0)return s}renameFile(e,r,n,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let o;Mi.is(n)||It.is(n)?o=n:i=n;let s,a;if(o===void 0?s=Eo.create(e,r,i):(a=It.is(o)?o:this._changeAnnotations.manage(o),s=Eo.create(e,r,i,a)),this._workspaceEdit.documentChanges.push(s),a!==void 0)return a}deleteFile(e,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;Mi.is(r)||It.is(r)?i=r:n=r;let o,s;if(i===void 0?o=_o.create(e,n):(s=It.is(i)?i:this._changeAnnotations.manage(i),o=_o.create(e,n,s)),this._workspaceEdit.documentChanges.push(o),s!==void 0)return s}};(function(t){function e(n){return{uri:n}}t.create=e;function r(n){let i=n;return R.defined(i)&&R.string(i.uri)}t.is=r})(Em||(Em={}));(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return R.defined(i)&&R.string(i.uri)&&R.integer(i.version)}t.is=r})(_m||(_m={}));(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return R.defined(i)&&R.string(i.uri)&&(i.version===null||R.integer(i.version))}t.is=r})(Sa||(Sa={}));(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 R.defined(i)&&R.string(i.uri)&&R.string(i.languageId)&&R.integer(i.version)&&R.string(i.text)}t.is=r})(Cm||(Cm={}));(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(r){let n=r;return n===t.PlainText||n===t.Markdown}t.is=e})(cu||(cu={}));(function(t){function e(r){let n=r;return R.objectLiteral(r)&&cu.is(n.kind)&&R.string(n.value)}t.is=e})(Co||(Co={}));(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})(ba||(ba={}));(function(t){t.PlainText=1,t.Snippet=2})(Nm||(Nm={}));(function(t){t.Deprecated=1})(Pm||(Pm={}));(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&&R.string(i.newText)&&Ye.is(i.insert)&&Ye.is(i.replace)}t.is=r})(Im||(Im={}));(function(t){t.asIs=1,t.adjustIndentation=2})(Dm||(Dm={}));(function(t){function e(r){let n=r;return n&&(R.string(n.detail)||n.detail===void 0)&&(R.string(n.description)||n.description===void 0)}t.is=e})(Om||(Om={}));(function(t){function e(r){return{label:r}}t.create=e})($m||($m={}));(function(t){function e(r,n){return{items:r||[],isIncomplete:!!n}}t.create=e})(Lm||(Lm={}));(function(t){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function r(n){let i=n;return R.string(i)||R.objectLiteral(i)&&R.string(i.language)&&R.string(i.value)}t.is=r})(Aa||(Aa={}));(function(t){function e(r){let n=r;return!!n&&R.objectLiteral(n)&&(Co.is(n.contents)||Aa.is(n.contents)||R.typedArray(n.contents,Aa.is))&&(r.range===void 0||Ye.is(r.range))}t.is=e})(Mm||(Mm={}));(function(t){function e(r,n){return n?{label:r,documentation:n}:{label:r}}t.create=e})(Fm||(Fm={}));(function(t){function e(r,n,...i){let o={label:r};return R.defined(n)&&(o.documentation=n),R.defined(i)?o.parameters=i:o.parameters=[],o}t.create=e})(Um||(Um={}));(function(t){t.Text=1,t.Read=2,t.Write=3})(qm||(qm={}));(function(t){function e(r,n){let i={range:r};return R.number(n)&&(i.kind=n),i}t.create=e})(jm||(jm={}));(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})(Gm||(Gm={}));(function(t){t.Deprecated=1})(Hm||(Hm={}));(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})(Wm||(Wm={}));(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})(Bm||(Bm={}));(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&&R.string(i.name)&&R.number(i.kind)&&Ye.is(i.range)&&Ye.is(i.selectionRange)&&(i.detail===void 0||R.string(i.detail))&&(i.deprecated===void 0||R.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=r})(Km||(Km={}));(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"})(zm||(zm={}));(function(t){t.Invoked=1,t.Automatic=2})(wa||(wa={}));(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 R.defined(i)&&R.typedArray(i.diagnostics,va.is)&&(i.only===void 0||R.typedArray(i.only,R.string))&&(i.triggerKind===void 0||i.triggerKind===wa.Invoked||i.triggerKind===wa.Automatic)}t.is=r})(Vm||(Vm={}));(function(t){function e(n,i,o){let s={title:n},a=!0;return typeof i=="string"?(a=!1,s.kind=i):Ui.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&&R.string(i.title)&&(i.diagnostics===void 0||R.typedArray(i.diagnostics,va.is))&&(i.kind===void 0||R.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Ui.is(i.command))&&(i.isPreferred===void 0||R.boolean(i.isPreferred))&&(i.edit===void 0||su.is(i.edit))}t.is=r})(Xm||(Xm={}));(function(t){function e(n,i){let o={range:n};return R.defined(i)&&(o.data=i),o}t.create=e;function r(n){let i=n;return R.defined(i)&&Ye.is(i.range)&&(R.undefined(i.command)||Ui.is(i.command))}t.is=r})(Ym||(Ym={}));(function(t){function e(n,i){return{tabSize:n,insertSpaces:i}}t.create=e;function r(n){let i=n;return R.defined(i)&&R.uinteger(i.tabSize)&&R.boolean(i.insertSpaces)}t.is=r})(Jm||(Jm={}));(function(t){function e(n,i,o){return{range:n,target:i,data:o}}t.create=e;function r(n){let i=n;return R.defined(i)&&Ye.is(i.range)&&(R.undefined(i.target)||R.string(i.target))}t.is=r})(Qm||(Qm={}));(function(t){function e(n,i){return{range:n,parent:i}}t.create=e;function r(n){let i=n;return R.objectLiteral(i)&&Ye.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=r})(Zm||(Zm={}));(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"})(eh||(eh={}));(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"})(th||(th={}));(function(t){function e(r){let n=r;return R.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})(rh||(rh={}));(function(t){function e(n,i){return{range:n,text:i}}t.create=e;function r(n){let i=n;return i!=null&&Ye.is(i.range)&&R.string(i.text)}t.is=r})(nh||(nh={}));(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&&Ye.is(i.range)&&R.boolean(i.caseSensitiveLookup)&&(R.string(i.variableName)||i.variableName===void 0)}t.is=r})(ih||(ih={}));(function(t){function e(n,i){return{range:n,expression:i}}t.create=e;function r(n){let i=n;return i!=null&&Ye.is(i.range)&&(R.string(i.expression)||i.expression===void 0)}t.is=r})(oh||(oh={}));(function(t){function e(n,i){return{frameId:n,stoppedLocation:i}}t.create=e;function r(n){let i=n;return R.defined(i)&&Ye.is(n.stoppedLocation)}t.is=r})(sh||(sh={}));(function(t){t.Type=1,t.Parameter=2;function e(r){return r===1||r===2}t.is=e})(uu||(uu={}));(function(t){function e(n){return{value:n}}t.create=e;function r(n){let i=n;return R.objectLiteral(i)&&(i.tooltip===void 0||R.string(i.tooltip)||Co.is(i.tooltip))&&(i.location===void 0||xa.is(i.location))&&(i.command===void 0||Ui.is(i.command))}t.is=r})(lu||(lu={}));(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 R.objectLiteral(i)&&Qt.is(i.position)&&(R.string(i.label)||R.typedArray(i.label,lu.is))&&(i.kind===void 0||uu.is(i.kind))&&i.textEdits===void 0||R.typedArray(i.textEdits,on.is)&&(i.tooltip===void 0||R.string(i.tooltip)||Co.is(i.tooltip))&&(i.paddingLeft===void 0||R.boolean(i.paddingLeft))&&(i.paddingRight===void 0||R.boolean(i.paddingRight))}t.is=r})(ah||(ah={}));(function(t){function e(r){return{kind:"snippet",value:r}}t.createSnippet=e})(ch||(ch={}));(function(t){function e(r,n,i,o){return{insertText:r,filterText:n,range:i,command:o}}t.create=e})(uh||(uh={}));(function(t){function e(r){return{items:r}}t.create=e})(lh||(lh={}));(function(t){t.Invoked=0,t.Automatic=1})(fh||(fh={}));(function(t){function e(r,n){return{range:r,text:n}}t.create=e})(dh||(dh={}));(function(t){function e(r,n){return{triggerKind:r,selectedCompletionInfo:n}}t.create=e})(ph||(ph={}));(function(t){function e(r){let n=r;return R.objectLiteral(n)&&nu.is(n.uri)&&R.string(n.name)}t.is=e})(mh||(mh={}));hN=[`
|
|
31
|
+
`)),k){let q=y.error?` Request failed: ${y.error.message} (${y.error.code}).`:"";_.log(`Received response '${k.method} - (${y.id})' in ${Date.now()-k.timerStart}ms.${q}`,N)}else _.log(`Received response ${y.id} without active response promise.`,N)}else ho("receive-response",y)}function ho(y,k){if(!_||m===fe.Off)return;let N={isLSPMessage:!0,type:y,message:k,timestamp:Date.now()};_.log(N)}function la(){if(vt())throw new bo(ga.Closed,"Connection is closed.");if(oe())throw new bo(ga.Disposed,"Connection is disposed.")}function $C(){if(xt())throw new bo(ga.AlreadyListening,"Connection is already listening")}function LC(){if(!xt())throw new Error("Call listen() first.")}function fa(y){return y===void 0?null:y}function By(y){if(y!==null)return y}function Ky(y){return y!=null&&!Array.isArray(y)&&typeof y=="object"}function sp(y,k){switch(y){case W.ParameterStructures.auto:return Ky(k)?By(k):[fa(k)];case W.ParameterStructures.byName:if(!Ky(k))throw new Error("Received parameters by name but param is not an object literal.");return By(k);case W.ParameterStructures.byPosition:return[fa(k)];default:throw new Error(`Unknown parameter structure ${y.toString()}`)}}function zy(y,k){let N,q=y.numberOfParams;switch(q){case 0:N=void 0;break;case 1:N=sp(y.parameterStructures,k[0]);break;default:N=[];for(let Oe=0;Oe<k.length&&Oe<q;Oe++)N.push(fa(k[Oe]));if(k.length<q)for(let Oe=k.length;Oe<q;Oe++)N.push(null);break}return N}let go={sendNotification:(y,...k)=>{la();let N,q;if(We.string(y)){N=y;let be=k[0],Xe=0,nt=W.ParameterStructures.auto;W.ParameterStructures.is(be)&&(Xe=1,nt=be);let ie=k.length,He=ie-Xe;switch(He){case 0:q=void 0;break;case 1:q=sp(nt,k[Xe]);break;default:if(nt===W.ParameterStructures.byName)throw new Error(`Received ${He} parameters for 'by Name' notification parameter structure.`);q=k.slice(Xe,ie).map(ge=>fa(ge));break}}else{let be=k;N=y.method,q=zy(y,be)}let Oe={jsonrpc:c,method:N,params:q};return wn(Oe),e.write(Oe).catch(be=>{throw i.error("Sending notification failed."),be})},onNotification:(y,k)=>{la();let N;return We.func(y)?f=y:k&&(We.string(y)?(N=y,d.set(y,{type:void 0,handler:k})):(N=y.method,d.set(y.method,{type:y,handler:k}))),{dispose:()=>{N!==void 0?d.delete(N):f=void 0}}},onProgress:(y,k,N)=>{if(p.has(k))throw new Error(`Progress handler for token ${k} already registered`);return p.set(k,N),{dispose:()=>{p.delete(k)}}},sendProgress:(y,k,N)=>go.sendNotification(ha.type,{token:k,value:N}),onUnhandledProgress:Xt.event,sendRequest:(y,...k)=>{la(),LC();let N,q,Oe;if(We.string(y)){N=y;let ie=k[0],He=k[k.length-1],ge=0,mt=W.ParameterStructures.auto;W.ParameterStructures.is(ie)&&(ge=1,mt=ie);let Jt=k.length;em.CancellationToken.is(He)&&(Jt=Jt-1,Oe=He);let tn=Jt-ge;switch(tn){case 0:q=void 0;break;case 1:q=sp(mt,k[ge]);break;default:if(mt===W.ParameterStructures.byName)throw new Error(`Received ${tn} parameters for 'by Name' request parameter structure.`);q=k.slice(ge,Jt).map(MC=>fa(MC));break}}else{let ie=k;N=y.method,q=zy(y,ie);let He=y.numberOfParams;Oe=em.CancellationToken.is(ie[He])?ie[He]:void 0}let be=o++,Xe;Oe&&(Xe=Oe.onCancellationRequested(()=>{let ie=x.sender.sendCancellation(go,be);return ie===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${be}`),Promise.resolve()):ie.catch(()=>{i.log(`Sending cancellation messages for id ${be} failed`)})}));let nt={jsonrpc:c,id:be,method:N,params:q};return Hr(nt),typeof x.sender.enableCancellation=="function"&&x.sender.enableCancellation(nt),new Promise(async(ie,He)=>{let ge=tn=>{ie(tn),x.sender.cleanup(be),Xe?.dispose()},mt=tn=>{He(tn),x.sender.cleanup(be),Xe?.dispose()},Jt={method:N,timerStart:Date.now(),resolve:ge,reject:mt};try{await e.write(nt),A.set(be,Jt)}catch(tn){throw i.error("Sending request failed."),Jt.reject(new W.ResponseError(W.ErrorCodes.MessageWriteError,tn.message?tn.message:"Unknown reason")),tn}})},onRequest:(y,k)=>{la();let N=null;return nm.is(y)?(N=void 0,u=y):We.string(y)?(N=null,k!==void 0&&(N=y,l.set(y,{handler:k,type:void 0}))):k!==void 0&&(N=y.method,l.set(y.method,{type:y,handler:k})),{dispose:()=>{N!==null&&(N!==void 0?l.delete(N):u=void 0)}}},hasPendingResponse:()=>A.size>0,trace:async(y,k,N)=>{let q=!1,Oe=yr.Text;N!==void 0&&(We.boolean(N)?q=N:(q=N.sendNotification||!1,Oe=N.traceFormat||yr.Text)),m=y,b=Oe,m===fe.Off?_=void 0:_=k,q&&!vt()&&!oe()&&await go.sendNotification(im.type,{value:fe.toString(y)})},onError:Ct.event,onClose:rt.event,onUnhandledNotification:gr.event,onDispose:I.event,end:()=>{e.end()},dispose:()=>{if(oe())return;V=Wr.Disposed,I.fire(void 0);let y=new W.ResponseError(W.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let k of A.values())k.reject(y);A=new Map,h=new Map,S=new Set,R=new dT.LinkedMap,We.func(e.dispose)&&e.dispose(),We.func(t.dispose)&&t.dispose()},listen:()=>{la(),$C(),V=Wr.Listening,t.listen(Rt)},inspect:()=>{(0,fT.default)().console.log("inspect")}};return go.onNotification(Xc.type,y=>{if(m===fe.Off||!_)return;let k=m===fe.Verbose||m===fe.Compact;_.log(y.message,k?y.verbose:void 0)}),go.onNotification(ha.type,y=>{let k=p.get(y.token);k?k(y.value):Xt.fire(y)}),go}X.createMessageConnection=cN});var tu=$(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.ProgressType=w.ProgressToken=w.createMessageConnection=w.NullLogger=w.ConnectionOptions=w.ConnectionStrategy=w.AbstractMessageBuffer=w.WriteableStreamMessageWriter=w.AbstractMessageWriter=w.MessageWriter=w.ReadableStreamMessageReader=w.AbstractMessageReader=w.MessageReader=w.SharedArrayReceiverStrategy=w.SharedArraySenderStrategy=w.CancellationToken=w.CancellationTokenSource=w.Emitter=w.Event=w.Disposable=w.LRUCache=w.Touch=w.LinkedMap=w.ParameterStructures=w.NotificationType9=w.NotificationType8=w.NotificationType7=w.NotificationType6=w.NotificationType5=w.NotificationType4=w.NotificationType3=w.NotificationType2=w.NotificationType1=w.NotificationType0=w.NotificationType=w.ErrorCodes=w.ResponseError=w.RequestType9=w.RequestType8=w.RequestType7=w.RequestType6=w.RequestType5=w.RequestType4=w.RequestType3=w.RequestType2=w.RequestType1=w.RequestType0=w.RequestType=w.Message=w.RAL=void 0;w.MessageStrategy=w.CancellationStrategy=w.CancellationSenderStrategy=w.CancellationReceiverStrategy=w.ConnectionError=w.ConnectionErrors=w.LogTraceNotification=w.SetTraceNotification=w.TraceFormat=w.TraceValues=w.Trace=void 0;var Ee=Ip();Object.defineProperty(w,"Message",{enumerable:!0,get:function(){return Ee.Message}});Object.defineProperty(w,"RequestType",{enumerable:!0,get:function(){return Ee.RequestType}});Object.defineProperty(w,"RequestType0",{enumerable:!0,get:function(){return Ee.RequestType0}});Object.defineProperty(w,"RequestType1",{enumerable:!0,get:function(){return Ee.RequestType1}});Object.defineProperty(w,"RequestType2",{enumerable:!0,get:function(){return Ee.RequestType2}});Object.defineProperty(w,"RequestType3",{enumerable:!0,get:function(){return Ee.RequestType3}});Object.defineProperty(w,"RequestType4",{enumerable:!0,get:function(){return Ee.RequestType4}});Object.defineProperty(w,"RequestType5",{enumerable:!0,get:function(){return Ee.RequestType5}});Object.defineProperty(w,"RequestType6",{enumerable:!0,get:function(){return Ee.RequestType6}});Object.defineProperty(w,"RequestType7",{enumerable:!0,get:function(){return Ee.RequestType7}});Object.defineProperty(w,"RequestType8",{enumerable:!0,get:function(){return Ee.RequestType8}});Object.defineProperty(w,"RequestType9",{enumerable:!0,get:function(){return Ee.RequestType9}});Object.defineProperty(w,"ResponseError",{enumerable:!0,get:function(){return Ee.ResponseError}});Object.defineProperty(w,"ErrorCodes",{enumerable:!0,get:function(){return Ee.ErrorCodes}});Object.defineProperty(w,"NotificationType",{enumerable:!0,get:function(){return Ee.NotificationType}});Object.defineProperty(w,"NotificationType0",{enumerable:!0,get:function(){return Ee.NotificationType0}});Object.defineProperty(w,"NotificationType1",{enumerable:!0,get:function(){return Ee.NotificationType1}});Object.defineProperty(w,"NotificationType2",{enumerable:!0,get:function(){return Ee.NotificationType2}});Object.defineProperty(w,"NotificationType3",{enumerable:!0,get:function(){return Ee.NotificationType3}});Object.defineProperty(w,"NotificationType4",{enumerable:!0,get:function(){return Ee.NotificationType4}});Object.defineProperty(w,"NotificationType5",{enumerable:!0,get:function(){return Ee.NotificationType5}});Object.defineProperty(w,"NotificationType6",{enumerable:!0,get:function(){return Ee.NotificationType6}});Object.defineProperty(w,"NotificationType7",{enumerable:!0,get:function(){return Ee.NotificationType7}});Object.defineProperty(w,"NotificationType8",{enumerable:!0,get:function(){return Ee.NotificationType8}});Object.defineProperty(w,"NotificationType9",{enumerable:!0,get:function(){return Ee.NotificationType9}});Object.defineProperty(w,"ParameterStructures",{enumerable:!0,get:function(){return Ee.ParameterStructures}});var am=Op();Object.defineProperty(w,"LinkedMap",{enumerable:!0,get:function(){return am.LinkedMap}});Object.defineProperty(w,"LRUCache",{enumerable:!0,get:function(){return am.LRUCache}});Object.defineProperty(w,"Touch",{enumerable:!0,get:function(){return am.Touch}});var uN=eT();Object.defineProperty(w,"Disposable",{enumerable:!0,get:function(){return uN.Disposable}});var gT=xo();Object.defineProperty(w,"Event",{enumerable:!0,get:function(){return gT.Event}});Object.defineProperty(w,"Emitter",{enumerable:!0,get:function(){return gT.Emitter}});var yT=Wc();Object.defineProperty(w,"CancellationTokenSource",{enumerable:!0,get:function(){return yT.CancellationTokenSource}});Object.defineProperty(w,"CancellationToken",{enumerable:!0,get:function(){return yT.CancellationToken}});var TT=rT();Object.defineProperty(w,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return TT.SharedArraySenderStrategy}});Object.defineProperty(w,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return TT.SharedArrayReceiverStrategy}});var cm=iT();Object.defineProperty(w,"MessageReader",{enumerable:!0,get:function(){return cm.MessageReader}});Object.defineProperty(w,"AbstractMessageReader",{enumerable:!0,get:function(){return cm.AbstractMessageReader}});Object.defineProperty(w,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return cm.ReadableStreamMessageReader}});var um=uT();Object.defineProperty(w,"MessageWriter",{enumerable:!0,get:function(){return um.MessageWriter}});Object.defineProperty(w,"AbstractMessageWriter",{enumerable:!0,get:function(){return um.AbstractMessageWriter}});Object.defineProperty(w,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return um.WriteableStreamMessageWriter}});var lN=lT();Object.defineProperty(w,"AbstractMessageBuffer",{enumerable:!0,get:function(){return lN.AbstractMessageBuffer}});var Pt=hT();Object.defineProperty(w,"ConnectionStrategy",{enumerable:!0,get:function(){return Pt.ConnectionStrategy}});Object.defineProperty(w,"ConnectionOptions",{enumerable:!0,get:function(){return Pt.ConnectionOptions}});Object.defineProperty(w,"NullLogger",{enumerable:!0,get:function(){return Pt.NullLogger}});Object.defineProperty(w,"createMessageConnection",{enumerable:!0,get:function(){return Pt.createMessageConnection}});Object.defineProperty(w,"ProgressToken",{enumerable:!0,get:function(){return Pt.ProgressToken}});Object.defineProperty(w,"ProgressType",{enumerable:!0,get:function(){return Pt.ProgressType}});Object.defineProperty(w,"Trace",{enumerable:!0,get:function(){return Pt.Trace}});Object.defineProperty(w,"TraceValues",{enumerable:!0,get:function(){return Pt.TraceValues}});Object.defineProperty(w,"TraceFormat",{enumerable:!0,get:function(){return Pt.TraceFormat}});Object.defineProperty(w,"SetTraceNotification",{enumerable:!0,get:function(){return Pt.SetTraceNotification}});Object.defineProperty(w,"LogTraceNotification",{enumerable:!0,get:function(){return Pt.LogTraceNotification}});Object.defineProperty(w,"ConnectionErrors",{enumerable:!0,get:function(){return Pt.ConnectionErrors}});Object.defineProperty(w,"ConnectionError",{enumerable:!0,get:function(){return Pt.ConnectionError}});Object.defineProperty(w,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return Pt.CancellationReceiverStrategy}});Object.defineProperty(w,"CancellationSenderStrategy",{enumerable:!0,get:function(){return Pt.CancellationSenderStrategy}});Object.defineProperty(w,"CancellationStrategy",{enumerable:!0,get:function(){return Pt.CancellationStrategy}});Object.defineProperty(w,"MessageStrategy",{enumerable:!0,get:function(){return Pt.MessageStrategy}});var fN=Qn();w.RAL=fN.default});var vT=$(pm=>{"use strict";Object.defineProperty(pm,"__esModule",{value:!0});var rn=tu(),ru=class t extends rn.AbstractMessageBuffer{constructor(e="utf-8"){super(e),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return t.emptyBuffer}fromString(e,r){return new TextEncoder().encode(e)}toString(e,r){return r==="ascii"?this.asciiDecoder.decode(e):new TextDecoder(r).decode(e)}asNative(e,r){return r===void 0?e:e.slice(0,r)}allocNative(e){return new Uint8Array(e)}};ru.emptyBuffer=new Uint8Array(0);var lm=class{constructor(e){this.socket=e,this._onData=new rn.Emitter,this._messageListener=r=>{r.data.arrayBuffer().then(i=>{this._onData.fire(new Uint8Array(i))},()=>{(0,rn.RAL)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(e){return this.socket.addEventListener("close",e),rn.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),rn.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),rn.Disposable.create(()=>this.socket.removeEventListener("end",e))}onData(e){return this._onData.event(e)}},fm=class{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener("close",e),rn.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),rn.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),rn.Disposable.create(()=>this.socket.removeEventListener("end",e))}write(e,r){if(typeof e=="string"){if(r!==void 0&&r!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${r}`);this.socket.send(e)}else this.socket.send(e);return Promise.resolve()}end(){this.socket.close()}},dN=new TextEncoder,xT=Object.freeze({messageBuffer:Object.freeze({create:t=>new ru(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(t,e)=>{if(e.charset!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${e.charset}`);return Promise.resolve(dN.encode(JSON.stringify(t,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(t,e)=>{if(!(t instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(e.charset).decode(t)))}})}),stream:Object.freeze({asReadableStream:t=>new lm(t),asWritableStream:t=>new fm(t)}),console,timer:Object.freeze({setTimeout(t,e,...r){let n=setTimeout(t,e,...r);return{dispose:()=>clearTimeout(n)}},setImmediate(t,...e){let r=setTimeout(t,0,...e);return{dispose:()=>clearTimeout(r)}},setInterval(t,e,...r){let n=setInterval(t,e,...r);return{dispose:()=>clearInterval(n)}}})});function dm(){return xT}(function(t){function e(){rn.RAL.install(xT)}t.install=e})(dm||(dm={}));pm.default=dm});var kn=$(Tr=>{"use strict";var pN=Tr&&Tr.__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]}),mN=Tr&&Tr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&pN(e,t,r)};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.createMessageConnection=Tr.BrowserMessageWriter=Tr.BrowserMessageReader=void 0;var hN=vT();hN.default.install();var Ao=tu();mN(tu(),Tr);var mm=class extends Ao.AbstractMessageReader{constructor(e){super(),this._onData=new Ao.Emitter,this._messageListener=r=>{this._onData.fire(r.data)},e.addEventListener("error",r=>this.fireError(r)),e.onmessage=this._messageListener}listen(e){return this._onData.event(e)}};Tr.BrowserMessageReader=mm;var hm=class extends Ao.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.addEventListener("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(){}};Tr.BrowserMessageWriter=hm;function gN(t,e,r,n){return r===void 0&&(r=Ao.NullLogger),Ao.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Ao.createMessageConnection)(t,e,r,n)}Tr.createMessageConnection=gN});var gm=$((vG,RT)=>{"use strict";RT.exports=kn()});var fu={};WC(fu,{AnnotatedTextEdit:()=>En,ChangeAnnotation:()=>Fi,ChangeAnnotationIdentifier:()=>It,CodeAction:()=>Xm,CodeActionContext:()=>Vm,CodeActionKind:()=>zm,CodeActionTriggerKind:()=>wa,CodeDescription:()=>wm,CodeLens:()=>Ym,Color:()=>iu,ColorInformation:()=>vm,ColorPresentation:()=>Rm,Command:()=>qi,CompletionItem:()=>$m,CompletionItemKind:()=>ba,CompletionItemLabelDetails:()=>Om,CompletionItemTag:()=>Pm,CompletionList:()=>Lm,CreateFile:()=>ko,DeleteFile:()=>_o,Diagnostic:()=>va,DiagnosticRelatedInformation:()=>ou,DiagnosticSeverity:()=>Am,DiagnosticTag:()=>Ui,DocumentHighlight:()=>jm,DocumentHighlightKind:()=>qm,DocumentLink:()=>Qm,DocumentSymbol:()=>Km,DocumentUri:()=>ym,EOL:()=>yN,FoldingRange:()=>bm,FoldingRangeKind:()=>Sm,FormattingOptions:()=>Jm,Hover:()=>Mm,InlayHint:()=>ah,InlayHintKind:()=>uu,InlayHintLabelPart:()=>lu,InlineCompletionContext:()=>ph,InlineCompletionItem:()=>uh,InlineCompletionList:()=>lh,InlineCompletionTriggerKind:()=>fh,InlineValueContext:()=>sh,InlineValueEvaluatableExpression:()=>oh,InlineValueText:()=>nh,InlineValueVariableLookup:()=>ih,InsertReplaceEdit:()=>Im,InsertTextFormat:()=>Nm,InsertTextMode:()=>Dm,Location:()=>xa,LocationLink:()=>xm,MarkedString:()=>Aa,MarkupContent:()=>Co,MarkupKind:()=>cu,OptionalVersionedTextDocumentIdentifier:()=>Sa,ParameterInformation:()=>Fm,Position:()=>Qt,Range:()=>Ye,RenameFile:()=>Eo,SelectedCompletionInfo:()=>dh,SelectionRange:()=>Zm,SemanticTokenModifiers:()=>th,SemanticTokenTypes:()=>eh,SemanticTokens:()=>rh,SignatureInformation:()=>Um,StringValue:()=>ch,SymbolInformation:()=>Wm,SymbolKind:()=>Gm,SymbolTag:()=>Hm,TextDocument:()=>hh,TextDocumentEdit:()=>Ra,TextDocumentIdentifier:()=>Em,TextDocumentItem:()=>Cm,TextEdit:()=>nn,URI:()=>nu,VersionedTextDocumentIdentifier:()=>_m,WorkspaceChange:()=>km,WorkspaceEdit:()=>su,WorkspaceFolder:()=>mh,WorkspaceSymbol:()=>Bm,integer:()=>Tm,uinteger:()=>Ta});var ym,nu,Tm,Ta,Qt,Ye,xa,xm,iu,vm,Rm,Sm,bm,ou,Am,Ui,wm,va,qi,nn,Fi,It,En,Ra,ko,Eo,_o,su,wo,au,km,Em,_m,Sa,Cm,cu,Co,ba,Nm,Pm,Im,Dm,Om,$m,Lm,Aa,Mm,Fm,Um,qm,jm,Gm,Hm,Wm,Bm,Km,zm,wa,Vm,Xm,Ym,Jm,Qm,Zm,eh,th,rh,nh,ih,oh,sh,uu,lu,ah,ch,uh,lh,fh,dh,ph,mh,yN,hh,gh,v,ji=HC(()=>{"use strict";(function(t){function e(r){return typeof r=="string"}t.is=e})(ym||(ym={}));(function(t){function e(r){return typeof r=="string"}t.is=e})(nu||(nu={}));(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})(Tm||(Tm={}));(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})(Ta||(Ta={}));(function(t){function e(n,i){return n===Number.MAX_VALUE&&(n=Ta.MAX_VALUE),i===Number.MAX_VALUE&&(i=Ta.MAX_VALUE),{line:n,character:i}}t.create=e;function r(n){let i=n;return v.objectLiteral(i)&&v.uinteger(i.line)&&v.uinteger(i.character)}t.is=r})(Qt||(Qt={}));(function(t){function e(n,i,o,s){if(v.uinteger(n)&&v.uinteger(i)&&v.uinteger(o)&&v.uinteger(s))return{start:Qt.create(n,i),end:Qt.create(o,s)};if(Qt.is(n)&&Qt.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 v.objectLiteral(i)&&Qt.is(i.start)&&Qt.is(i.end)}t.is=r})(Ye||(Ye={}));(function(t){function e(n,i){return{uri:n,range:i}}t.create=e;function r(n){let i=n;return v.objectLiteral(i)&&Ye.is(i.range)&&(v.string(i.uri)||v.undefined(i.uri))}t.is=r})(xa||(xa={}));(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 v.objectLiteral(i)&&Ye.is(i.targetRange)&&v.string(i.targetUri)&&Ye.is(i.targetSelectionRange)&&(Ye.is(i.originSelectionRange)||v.undefined(i.originSelectionRange))}t.is=r})(xm||(xm={}));(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 v.objectLiteral(i)&&v.numberRange(i.red,0,1)&&v.numberRange(i.green,0,1)&&v.numberRange(i.blue,0,1)&&v.numberRange(i.alpha,0,1)}t.is=r})(iu||(iu={}));(function(t){function e(n,i){return{range:n,color:i}}t.create=e;function r(n){let i=n;return v.objectLiteral(i)&&Ye.is(i.range)&&iu.is(i.color)}t.is=r})(vm||(vm={}));(function(t){function e(n,i,o){return{label:n,textEdit:i,additionalTextEdits:o}}t.create=e;function r(n){let i=n;return v.objectLiteral(i)&&v.string(i.label)&&(v.undefined(i.textEdit)||nn.is(i))&&(v.undefined(i.additionalTextEdits)||v.typedArray(i.additionalTextEdits,nn.is))}t.is=r})(Rm||(Rm={}));(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(Sm||(Sm={}));(function(t){function e(n,i,o,s,a,c){let u={startLine:n,endLine:i};return v.defined(o)&&(u.startCharacter=o),v.defined(s)&&(u.endCharacter=s),v.defined(a)&&(u.kind=a),v.defined(c)&&(u.collapsedText=c),u}t.create=e;function r(n){let i=n;return v.objectLiteral(i)&&v.uinteger(i.startLine)&&v.uinteger(i.startLine)&&(v.undefined(i.startCharacter)||v.uinteger(i.startCharacter))&&(v.undefined(i.endCharacter)||v.uinteger(i.endCharacter))&&(v.undefined(i.kind)||v.string(i.kind))}t.is=r})(bm||(bm={}));(function(t){function e(n,i){return{location:n,message:i}}t.create=e;function r(n){let i=n;return v.defined(i)&&xa.is(i.location)&&v.string(i.message)}t.is=r})(ou||(ou={}));(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(Am||(Am={}));(function(t){t.Unnecessary=1,t.Deprecated=2})(Ui||(Ui={}));(function(t){function e(r){let n=r;return v.objectLiteral(n)&&v.string(n.href)}t.is=e})(wm||(wm={}));(function(t){function e(n,i,o,s,a,c){let u={range:n,message:i};return v.defined(o)&&(u.severity=o),v.defined(s)&&(u.code=s),v.defined(a)&&(u.source=a),v.defined(c)&&(u.relatedInformation=c),u}t.create=e;function r(n){var i;let o=n;return v.defined(o)&&Ye.is(o.range)&&v.string(o.message)&&(v.number(o.severity)||v.undefined(o.severity))&&(v.integer(o.code)||v.string(o.code)||v.undefined(o.code))&&(v.undefined(o.codeDescription)||v.string((i=o.codeDescription)===null||i===void 0?void 0:i.href))&&(v.string(o.source)||v.undefined(o.source))&&(v.undefined(o.relatedInformation)||v.typedArray(o.relatedInformation,ou.is))}t.is=r})(va||(va={}));(function(t){function e(n,i,...o){let s={title:n,command:i};return v.defined(o)&&o.length>0&&(s.arguments=o),s}t.create=e;function r(n){let i=n;return v.defined(i)&&v.string(i.title)&&v.string(i.command)}t.is=r})(qi||(qi={}));(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 v.objectLiteral(s)&&v.string(s.newText)&&Ye.is(s.range)}t.is=i})(nn||(nn={}));(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 v.objectLiteral(i)&&v.string(i.label)&&(v.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(v.string(i.description)||i.description===void 0)}t.is=r})(Fi||(Fi={}));(function(t){function e(r){let n=r;return v.string(n)}t.is=e})(It||(It={}));(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 nn.is(s)&&(Fi.is(s.annotationId)||It.is(s.annotationId))}t.is=i})(En||(En={}));(function(t){function e(n,i){return{textDocument:n,edits:i}}t.create=e;function r(n){let i=n;return v.defined(i)&&Sa.is(i.textDocument)&&Array.isArray(i.edits)}t.is=r})(Ra||(Ra={}));(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"&&v.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||v.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||v.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||It.is(i.annotationId))}t.is=r})(ko||(ko={}));(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"&&v.string(i.oldUri)&&v.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||v.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||v.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||It.is(i.annotationId))}t.is=r})(Eo||(Eo={}));(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"&&v.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||v.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||v.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||It.is(i.annotationId))}t.is=r})(_o||(_o={}));(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=>v.string(i.kind)?ko.is(i)||Eo.is(i)||_o.is(i):Ra.is(i)))}t.is=e})(su||(su={}));wo=class{constructor(e,r){this.edits=e,this.changeAnnotations=r}insert(e,r,n){let i,o;if(n===void 0?i=nn.insert(e,r):It.is(n)?(o=n,i=En.insert(e,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(n),i=En.insert(e,r,o)),this.edits.push(i),o!==void 0)return o}replace(e,r,n){let i,o;if(n===void 0?i=nn.replace(e,r):It.is(n)?(o=n,i=En.replace(e,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(n),i=En.replace(e,r,o)),this.edits.push(i),o!==void 0)return o}delete(e,r){let n,i;if(r===void 0?n=nn.del(e):It.is(r)?(i=r,n=En.del(e,r)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(r),n=En.del(e,i)),this.edits.push(n),i!==void 0)return i}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},au=class{constructor(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,r){let n;if(It.is(e)?n=e:(n=this.nextId(),r=e),this._annotations[n]!==void 0)throw new Error(`Id ${n} is already in use.`);if(r===void 0)throw new Error(`No annotation provided for id ${n}`);return this._annotations[n]=r,this._size++,n}nextId(){return this._counter++,this._counter.toString()}},km=class{constructor(e){this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new au(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(r=>{if(Ra.is(r)){let n=new wo(r.edits,this._changeAnnotations);this._textEditChanges[r.textDocument.uri]=n}})):e.changes&&Object.keys(e.changes).forEach(r=>{let n=new wo(e.changes[r]);this._textEditChanges[r]=n})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(Sa.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let r={uri:e.uri,version:e.version},n=this._textEditChanges[r.uri];if(!n){let i=[],o={textDocument:r,edits:i};this._workspaceEdit.documentChanges.push(o),n=new wo(i,this._changeAnnotations),this._textEditChanges[r.uri]=n}return n}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let r=this._textEditChanges[e];if(!r){let n=[];this._workspaceEdit.changes[e]=n,r=new wo(n),this._textEditChanges[e]=r}return r}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new au,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;Fi.is(r)||It.is(r)?i=r:n=r;let o,s;if(i===void 0?o=ko.create(e,n):(s=It.is(i)?i:this._changeAnnotations.manage(i),o=ko.create(e,n,s)),this._workspaceEdit.documentChanges.push(o),s!==void 0)return s}renameFile(e,r,n,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let o;Fi.is(n)||It.is(n)?o=n:i=n;let s,a;if(o===void 0?s=Eo.create(e,r,i):(a=It.is(o)?o:this._changeAnnotations.manage(o),s=Eo.create(e,r,i,a)),this._workspaceEdit.documentChanges.push(s),a!==void 0)return a}deleteFile(e,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;Fi.is(r)||It.is(r)?i=r:n=r;let o,s;if(i===void 0?o=_o.create(e,n):(s=It.is(i)?i:this._changeAnnotations.manage(i),o=_o.create(e,n,s)),this._workspaceEdit.documentChanges.push(o),s!==void 0)return s}};(function(t){function e(n){return{uri:n}}t.create=e;function r(n){let i=n;return v.defined(i)&&v.string(i.uri)}t.is=r})(Em||(Em={}));(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return v.defined(i)&&v.string(i.uri)&&v.integer(i.version)}t.is=r})(_m||(_m={}));(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return v.defined(i)&&v.string(i.uri)&&(i.version===null||v.integer(i.version))}t.is=r})(Sa||(Sa={}));(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 v.defined(i)&&v.string(i.uri)&&v.string(i.languageId)&&v.integer(i.version)&&v.string(i.text)}t.is=r})(Cm||(Cm={}));(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(r){let n=r;return n===t.PlainText||n===t.Markdown}t.is=e})(cu||(cu={}));(function(t){function e(r){let n=r;return v.objectLiteral(r)&&cu.is(n.kind)&&v.string(n.value)}t.is=e})(Co||(Co={}));(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})(ba||(ba={}));(function(t){t.PlainText=1,t.Snippet=2})(Nm||(Nm={}));(function(t){t.Deprecated=1})(Pm||(Pm={}));(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&&v.string(i.newText)&&Ye.is(i.insert)&&Ye.is(i.replace)}t.is=r})(Im||(Im={}));(function(t){t.asIs=1,t.adjustIndentation=2})(Dm||(Dm={}));(function(t){function e(r){let n=r;return n&&(v.string(n.detail)||n.detail===void 0)&&(v.string(n.description)||n.description===void 0)}t.is=e})(Om||(Om={}));(function(t){function e(r){return{label:r}}t.create=e})($m||($m={}));(function(t){function e(r,n){return{items:r||[],isIncomplete:!!n}}t.create=e})(Lm||(Lm={}));(function(t){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function r(n){let i=n;return v.string(i)||v.objectLiteral(i)&&v.string(i.language)&&v.string(i.value)}t.is=r})(Aa||(Aa={}));(function(t){function e(r){let n=r;return!!n&&v.objectLiteral(n)&&(Co.is(n.contents)||Aa.is(n.contents)||v.typedArray(n.contents,Aa.is))&&(r.range===void 0||Ye.is(r.range))}t.is=e})(Mm||(Mm={}));(function(t){function e(r,n){return n?{label:r,documentation:n}:{label:r}}t.create=e})(Fm||(Fm={}));(function(t){function e(r,n,...i){let o={label:r};return v.defined(n)&&(o.documentation=n),v.defined(i)?o.parameters=i:o.parameters=[],o}t.create=e})(Um||(Um={}));(function(t){t.Text=1,t.Read=2,t.Write=3})(qm||(qm={}));(function(t){function e(r,n){let i={range:r};return v.number(n)&&(i.kind=n),i}t.create=e})(jm||(jm={}));(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})(Gm||(Gm={}));(function(t){t.Deprecated=1})(Hm||(Hm={}));(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})(Wm||(Wm={}));(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})(Bm||(Bm={}));(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&&v.string(i.name)&&v.number(i.kind)&&Ye.is(i.range)&&Ye.is(i.selectionRange)&&(i.detail===void 0||v.string(i.detail))&&(i.deprecated===void 0||v.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=r})(Km||(Km={}));(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"})(zm||(zm={}));(function(t){t.Invoked=1,t.Automatic=2})(wa||(wa={}));(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 v.defined(i)&&v.typedArray(i.diagnostics,va.is)&&(i.only===void 0||v.typedArray(i.only,v.string))&&(i.triggerKind===void 0||i.triggerKind===wa.Invoked||i.triggerKind===wa.Automatic)}t.is=r})(Vm||(Vm={}));(function(t){function e(n,i,o){let s={title:n},a=!0;return typeof i=="string"?(a=!1,s.kind=i):qi.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&&v.string(i.title)&&(i.diagnostics===void 0||v.typedArray(i.diagnostics,va.is))&&(i.kind===void 0||v.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||qi.is(i.command))&&(i.isPreferred===void 0||v.boolean(i.isPreferred))&&(i.edit===void 0||su.is(i.edit))}t.is=r})(Xm||(Xm={}));(function(t){function e(n,i){let o={range:n};return v.defined(i)&&(o.data=i),o}t.create=e;function r(n){let i=n;return v.defined(i)&&Ye.is(i.range)&&(v.undefined(i.command)||qi.is(i.command))}t.is=r})(Ym||(Ym={}));(function(t){function e(n,i){return{tabSize:n,insertSpaces:i}}t.create=e;function r(n){let i=n;return v.defined(i)&&v.uinteger(i.tabSize)&&v.boolean(i.insertSpaces)}t.is=r})(Jm||(Jm={}));(function(t){function e(n,i,o){return{range:n,target:i,data:o}}t.create=e;function r(n){let i=n;return v.defined(i)&&Ye.is(i.range)&&(v.undefined(i.target)||v.string(i.target))}t.is=r})(Qm||(Qm={}));(function(t){function e(n,i){return{range:n,parent:i}}t.create=e;function r(n){let i=n;return v.objectLiteral(i)&&Ye.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=r})(Zm||(Zm={}));(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"})(eh||(eh={}));(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"})(th||(th={}));(function(t){function e(r){let n=r;return v.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})(rh||(rh={}));(function(t){function e(n,i){return{range:n,text:i}}t.create=e;function r(n){let i=n;return i!=null&&Ye.is(i.range)&&v.string(i.text)}t.is=r})(nh||(nh={}));(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&&Ye.is(i.range)&&v.boolean(i.caseSensitiveLookup)&&(v.string(i.variableName)||i.variableName===void 0)}t.is=r})(ih||(ih={}));(function(t){function e(n,i){return{range:n,expression:i}}t.create=e;function r(n){let i=n;return i!=null&&Ye.is(i.range)&&(v.string(i.expression)||i.expression===void 0)}t.is=r})(oh||(oh={}));(function(t){function e(n,i){return{frameId:n,stoppedLocation:i}}t.create=e;function r(n){let i=n;return v.defined(i)&&Ye.is(n.stoppedLocation)}t.is=r})(sh||(sh={}));(function(t){t.Type=1,t.Parameter=2;function e(r){return r===1||r===2}t.is=e})(uu||(uu={}));(function(t){function e(n){return{value:n}}t.create=e;function r(n){let i=n;return v.objectLiteral(i)&&(i.tooltip===void 0||v.string(i.tooltip)||Co.is(i.tooltip))&&(i.location===void 0||xa.is(i.location))&&(i.command===void 0||qi.is(i.command))}t.is=r})(lu||(lu={}));(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 v.objectLiteral(i)&&Qt.is(i.position)&&(v.string(i.label)||v.typedArray(i.label,lu.is))&&(i.kind===void 0||uu.is(i.kind))&&i.textEdits===void 0||v.typedArray(i.textEdits,nn.is)&&(i.tooltip===void 0||v.string(i.tooltip)||Co.is(i.tooltip))&&(i.paddingLeft===void 0||v.boolean(i.paddingLeft))&&(i.paddingRight===void 0||v.boolean(i.paddingRight))}t.is=r})(ah||(ah={}));(function(t){function e(r){return{kind:"snippet",value:r}}t.createSnippet=e})(ch||(ch={}));(function(t){function e(r,n,i,o){return{insertText:r,filterText:n,range:i,command:o}}t.create=e})(uh||(uh={}));(function(t){function e(r){return{items:r}}t.create=e})(lh||(lh={}));(function(t){t.Invoked=0,t.Automatic=1})(fh||(fh={}));(function(t){function e(r,n){return{range:r,text:n}}t.create=e})(dh||(dh={}));(function(t){function e(r,n){return{triggerKind:r,selectedCompletionInfo:n}}t.create=e})(ph||(ph={}));(function(t){function e(r){let n=r;return v.objectLiteral(n)&&nu.is(n.uri)&&v.string(n.name)}t.is=e})(mh||(mh={}));yN=[`
|
|
32
32
|
`,`\r
|
|
33
|
-
`,"\r"];(function(t){function e(o,s,a,c){return new gh(o,s,a,c)}t.create=e;function r(o){let s=o;return!!(
|
|
33
|
+
`,"\r"];(function(t){function e(o,s,a,c){return new gh(o,s,a,c)}t.create=e;function r(o){let s=o;return!!(v.defined(s)&&v.string(s.uri)&&(v.undefined(s.languageId)||v.string(s.languageId))&&v.uinteger(s.lineCount)&&v.func(s.getText)&&v.func(s.positionAt)&&v.func(s.offsetAt))}t.is=r;function n(o,s){let a=o.getText(),c=i(s,(l,f)=>{let d=l.range.start.line-f.range.start.line;return d===0?l.range.start.character-f.range.start.character:d}),u=a.length;for(let l=c.length-1;l>=0;l--){let f=c[l],d=o.offsetAt(f.range.start),p=o.offsetAt(f.range.end);if(p<=u)a=a.substring(0,d)+f.newText+a.substring(p,a.length);else throw new Error("Overlapping edit");u=d}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,f=0,d=0;for(;l<c.length&&f<u.length;)s(c[l],u[f])<=0?o[d++]=c[l++]:o[d++]=u[f++];for(;l<c.length;)o[d++]=c[l++];for(;f<u.length;)o[d++]=u[f++];return o}})(hh||(hh={}));gh=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===`
|
|
34
34
|
`,o==="\r"&&i+1<r.length&&r.charAt(i+1)===`
|
|
35
|
-
`&&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 Qt.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 Qt.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}};(function(t){let e=Object.prototype.toString;function r(p){return typeof p<"u"}t.defined=r;function n(p){return typeof p>"u"}t.undefined=n;function i(p){return p===!0||p===!1}t.boolean=i;function o(p){return e.call(p)==="[object String]"}t.string=o;function s(p){return e.call(p)==="[object Number]"}t.number=s;function a(p,T,S){return e.call(p)==="[object Number]"&&T<=p&&p<=S}t.numberRange=a;function c(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}t.integer=c;function u(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}t.uinteger=u;function l(p){return e.call(p)==="[object Function]"}t.func=l;function f(p){return p!==null&&typeof p=="object"}t.objectLiteral=f;function d(p,T){return Array.isArray(p)&&p.every(T)}t.typedArray=d})(R||(R={}))});var Me=$(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.ProtocolNotificationType=ur.ProtocolNotificationType0=ur.ProtocolRequestType=ur.ProtocolRequestType0=ur.RegistrationType=ur.MessageDirection=void 0;var No=_n(),ST;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(ST||(ur.MessageDirection=ST={}));var yh=class{constructor(e){this.method=e}};ur.RegistrationType=yh;var Th=class extends No.RequestType0{constructor(e){super(e)}};ur.ProtocolRequestType0=Th;var xh=class extends No.RequestType{constructor(e){super(e,No.ParameterStructures.byName)}};ur.ProtocolRequestType=xh;var vh=class extends No.NotificationType0{constructor(e){super(e)}};ur.ProtocolNotificationType0=vh;var Rh=class extends No.NotificationType{constructor(e){super(e,No.ParameterStructures.byName)}};ur.ProtocolNotificationType=Rh});var du=$(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.objectLiteral=at.typedArray=at.stringArray=at.array=at.func=at.error=at.number=at.string=at.boolean=void 0;function gN(t){return t===!0||t===!1}at.boolean=gN;function bT(t){return typeof t=="string"||t instanceof String}at.string=bT;function yN(t){return typeof t=="number"||t instanceof Number}at.number=yN;function TN(t){return t instanceof Error}at.error=TN;function xN(t){return typeof t=="function"}at.func=xN;function AT(t){return Array.isArray(t)}at.array=AT;function vN(t){return AT(t)&&t.every(e=>bT(e))}at.stringArray=vN;function RN(t,e){return Array.isArray(t)&&t.every(e)}at.typedArray=RN;function SN(t){return t!==null&&typeof t=="object"}at.objectLiteral=SN});var ET=$(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu.ImplementationRequest=void 0;var wT=Me(),kT;(function(t){t.method="textDocument/implementation",t.messageDirection=wT.MessageDirection.clientToServer,t.type=new wT.ProtocolRequestType(t.method)})(kT||(pu.ImplementationRequest=kT={}))});var NT=$(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.TypeDefinitionRequest=void 0;var _T=Me(),CT;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=_T.MessageDirection.clientToServer,t.type=new _T.ProtocolRequestType(t.method)})(CT||(mu.TypeDefinitionRequest=CT={}))});var DT=$(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.DidChangeWorkspaceFoldersNotification=Po.WorkspaceFoldersRequest=void 0;var hu=Me(),PT;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=hu.MessageDirection.serverToClient,t.type=new hu.ProtocolRequestType0(t.method)})(PT||(Po.WorkspaceFoldersRequest=PT={}));var IT;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=hu.MessageDirection.clientToServer,t.type=new hu.ProtocolNotificationType(t.method)})(IT||(Po.DidChangeWorkspaceFoldersNotification=IT={}))});var LT=$(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.ConfigurationRequest=void 0;var OT=Me(),$T;(function(t){t.method="workspace/configuration",t.messageDirection=OT.MessageDirection.serverToClient,t.type=new OT.ProtocolRequestType(t.method)})($T||(gu.ConfigurationRequest=$T={}))});var UT=$(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.ColorPresentationRequest=Io.DocumentColorRequest=void 0;var yu=Me(),MT;(function(t){t.method="textDocument/documentColor",t.messageDirection=yu.MessageDirection.clientToServer,t.type=new yu.ProtocolRequestType(t.method)})(MT||(Io.DocumentColorRequest=MT={}));var FT;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=yu.MessageDirection.clientToServer,t.type=new yu.ProtocolRequestType(t.method)})(FT||(Io.ColorPresentationRequest=FT={}))});var GT=$(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.FoldingRangeRefreshRequest=Do.FoldingRangeRequest=void 0;var Tu=Me(),qT;(function(t){t.method="textDocument/foldingRange",t.messageDirection=Tu.MessageDirection.clientToServer,t.type=new Tu.ProtocolRequestType(t.method)})(qT||(Do.FoldingRangeRequest=qT={}));var jT;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=Tu.MessageDirection.serverToClient,t.type=new Tu.ProtocolRequestType0(t.method)})(jT||(Do.FoldingRangeRefreshRequest=jT={}))});var BT=$(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.DeclarationRequest=void 0;var HT=Me(),WT;(function(t){t.method="textDocument/declaration",t.messageDirection=HT.MessageDirection.clientToServer,t.type=new HT.ProtocolRequestType(t.method)})(WT||(xu.DeclarationRequest=WT={}))});var VT=$(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.SelectionRangeRequest=void 0;var KT=Me(),zT;(function(t){t.method="textDocument/selectionRange",t.messageDirection=KT.MessageDirection.clientToServer,t.type=new KT.ProtocolRequestType(t.method)})(zT||(vu.SelectionRangeRequest=zT={}))});var QT=$(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.WorkDoneProgressCancelNotification=ri.WorkDoneProgressCreateRequest=ri.WorkDoneProgress=void 0;var bN=_n(),Ru=Me(),XT;(function(t){t.type=new bN.ProgressType;function e(r){return r===t.type}t.is=e})(XT||(ri.WorkDoneProgress=XT={}));var YT;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=Ru.MessageDirection.serverToClient,t.type=new Ru.ProtocolRequestType(t.method)})(YT||(ri.WorkDoneProgressCreateRequest=YT={}));var JT;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=Ru.MessageDirection.clientToServer,t.type=new Ru.ProtocolNotificationType(t.method)})(JT||(ri.WorkDoneProgressCancelNotification=JT={}))});var rx=$(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.CallHierarchyOutgoingCallsRequest=ni.CallHierarchyIncomingCallsRequest=ni.CallHierarchyPrepareRequest=void 0;var Oo=Me(),ZT;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=Oo.MessageDirection.clientToServer,t.type=new Oo.ProtocolRequestType(t.method)})(ZT||(ni.CallHierarchyPrepareRequest=ZT={}));var ex;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=Oo.MessageDirection.clientToServer,t.type=new Oo.ProtocolRequestType(t.method)})(ex||(ni.CallHierarchyIncomingCallsRequest=ex={}));var tx;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=Oo.MessageDirection.clientToServer,t.type=new Oo.ProtocolRequestType(t.method)})(tx||(ni.CallHierarchyOutgoingCallsRequest=tx={}))});var cx=$(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.SemanticTokensRefreshRequest=lr.SemanticTokensRangeRequest=lr.SemanticTokensDeltaRequest=lr.SemanticTokensRequest=lr.SemanticTokensRegistrationType=lr.TokenFormat=void 0;var Nn=Me(),nx;(function(t){t.Relative="relative"})(nx||(lr.TokenFormat=nx={}));var ka;(function(t){t.method="textDocument/semanticTokens",t.type=new Nn.RegistrationType(t.method)})(ka||(lr.SemanticTokensRegistrationType=ka={}));var ix;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=Nn.MessageDirection.clientToServer,t.type=new Nn.ProtocolRequestType(t.method),t.registrationMethod=ka.method})(ix||(lr.SemanticTokensRequest=ix={}));var ox;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=Nn.MessageDirection.clientToServer,t.type=new Nn.ProtocolRequestType(t.method),t.registrationMethod=ka.method})(ox||(lr.SemanticTokensDeltaRequest=ox={}));var sx;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=Nn.MessageDirection.clientToServer,t.type=new Nn.ProtocolRequestType(t.method),t.registrationMethod=ka.method})(sx||(lr.SemanticTokensRangeRequest=sx={}));var ax;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=Nn.MessageDirection.serverToClient,t.type=new Nn.ProtocolRequestType0(t.method)})(ax||(lr.SemanticTokensRefreshRequest=ax={}))});var fx=$(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.ShowDocumentRequest=void 0;var ux=Me(),lx;(function(t){t.method="window/showDocument",t.messageDirection=ux.MessageDirection.serverToClient,t.type=new ux.ProtocolRequestType(t.method)})(lx||(Su.ShowDocumentRequest=lx={}))});var mx=$(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});bu.LinkedEditingRangeRequest=void 0;var dx=Me(),px;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=dx.MessageDirection.clientToServer,t.type=new dx.ProtocolRequestType(t.method)})(px||(bu.LinkedEditingRangeRequest=px={}))});var Sx=$(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 Nr=Me(),hx;(function(t){t.file="file",t.folder="folder"})(hx||(qt.FileOperationPatternKind=hx={}));var gx;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=Nr.MessageDirection.clientToServer,t.type=new Nr.ProtocolRequestType(t.method)})(gx||(qt.WillCreateFilesRequest=gx={}));var yx;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=Nr.MessageDirection.clientToServer,t.type=new Nr.ProtocolNotificationType(t.method)})(yx||(qt.DidCreateFilesNotification=yx={}));var Tx;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=Nr.MessageDirection.clientToServer,t.type=new Nr.ProtocolRequestType(t.method)})(Tx||(qt.WillRenameFilesRequest=Tx={}));var xx;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=Nr.MessageDirection.clientToServer,t.type=new Nr.ProtocolNotificationType(t.method)})(xx||(qt.DidRenameFilesNotification=xx={}));var vx;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=Nr.MessageDirection.clientToServer,t.type=new Nr.ProtocolNotificationType(t.method)})(vx||(qt.DidDeleteFilesNotification=vx={}));var Rx;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=Nr.MessageDirection.clientToServer,t.type=new Nr.ProtocolRequestType(t.method)})(Rx||(qt.WillDeleteFilesRequest=Rx={}))});var Ex=$(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.MonikerRequest=ii.MonikerKind=ii.UniquenessLevel=void 0;var bx=Me(),Ax;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(Ax||(ii.UniquenessLevel=Ax={}));var wx;(function(t){t.$import="import",t.$export="export",t.local="local"})(wx||(ii.MonikerKind=wx={}));var kx;(function(t){t.method="textDocument/moniker",t.messageDirection=bx.MessageDirection.clientToServer,t.type=new bx.ProtocolRequestType(t.method)})(kx||(ii.MonikerRequest=kx={}))});var Px=$(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.TypeHierarchySubtypesRequest=oi.TypeHierarchySupertypesRequest=oi.TypeHierarchyPrepareRequest=void 0;var $o=Me(),_x;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=$o.MessageDirection.clientToServer,t.type=new $o.ProtocolRequestType(t.method)})(_x||(oi.TypeHierarchyPrepareRequest=_x={}));var Cx;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=$o.MessageDirection.clientToServer,t.type=new $o.ProtocolRequestType(t.method)})(Cx||(oi.TypeHierarchySupertypesRequest=Cx={}));var Nx;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=$o.MessageDirection.clientToServer,t.type=new $o.ProtocolRequestType(t.method)})(Nx||(oi.TypeHierarchySubtypesRequest=Nx={}))});var Ox=$(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.InlineValueRefreshRequest=Lo.InlineValueRequest=void 0;var Au=Me(),Ix;(function(t){t.method="textDocument/inlineValue",t.messageDirection=Au.MessageDirection.clientToServer,t.type=new Au.ProtocolRequestType(t.method)})(Ix||(Lo.InlineValueRequest=Ix={}));var Dx;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=Au.MessageDirection.serverToClient,t.type=new Au.ProtocolRequestType0(t.method)})(Dx||(Lo.InlineValueRefreshRequest=Dx={}))});var Fx=$(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.InlayHintRefreshRequest=si.InlayHintResolveRequest=si.InlayHintRequest=void 0;var Mo=Me(),$x;(function(t){t.method="textDocument/inlayHint",t.messageDirection=Mo.MessageDirection.clientToServer,t.type=new Mo.ProtocolRequestType(t.method)})($x||(si.InlayHintRequest=$x={}));var Lx;(function(t){t.method="inlayHint/resolve",t.messageDirection=Mo.MessageDirection.clientToServer,t.type=new Mo.ProtocolRequestType(t.method)})(Lx||(si.InlayHintResolveRequest=Lx={}));var Mx;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=Mo.MessageDirection.serverToClient,t.type=new Mo.ProtocolRequestType0(t.method)})(Mx||(si.InlayHintRefreshRequest=Mx={}))});var Bx=$(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.DiagnosticRefreshRequest=Pr.WorkspaceDiagnosticRequest=Pr.DocumentDiagnosticRequest=Pr.DocumentDiagnosticReportKind=Pr.DiagnosticServerCancellationData=void 0;var Wx=_n(),AN=du(),Fo=Me(),Ux;(function(t){function e(r){let n=r;return n&&AN.boolean(n.retriggerRequest)}t.is=e})(Ux||(Pr.DiagnosticServerCancellationData=Ux={}));var qx;(function(t){t.Full="full",t.Unchanged="unchanged"})(qx||(Pr.DocumentDiagnosticReportKind=qx={}));var jx;(function(t){t.method="textDocument/diagnostic",t.messageDirection=Fo.MessageDirection.clientToServer,t.type=new Fo.ProtocolRequestType(t.method),t.partialResult=new Wx.ProgressType})(jx||(Pr.DocumentDiagnosticRequest=jx={}));var Gx;(function(t){t.method="workspace/diagnostic",t.messageDirection=Fo.MessageDirection.clientToServer,t.type=new Fo.ProtocolRequestType(t.method),t.partialResult=new Wx.ProgressType})(Gx||(Pr.WorkspaceDiagnosticRequest=Gx={}));var Hx;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=Fo.MessageDirection.serverToClient,t.type=new Fo.ProtocolRequestType0(t.method)})(Hx||(Pr.DiagnosticRefreshRequest=Hx={}))});var Qx=$(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.DidCloseNotebookDocumentNotification=Je.DidSaveNotebookDocumentNotification=Je.DidChangeNotebookDocumentNotification=Je.NotebookCellArrayChange=Je.DidOpenNotebookDocumentNotification=Je.NotebookDocumentSyncRegistrationType=Je.NotebookDocument=Je.NotebookCell=Je.ExecutionSummary=Je.NotebookCellKind=void 0;var Ea=(qi(),ap(fu)),Kr=du(),sn=Me(),Sh;(function(t){t.Markup=1,t.Code=2;function e(r){return r===1||r===2}t.is=e})(Sh||(Je.NotebookCellKind=Sh={}));var bh;(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 Kr.objectLiteral(o)&&Ea.uinteger.is(o.executionOrder)&&(o.success===void 0||Kr.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})(bh||(Je.ExecutionSummary=bh={}));var wu;(function(t){function e(o,s){return{kind:o,document:s}}t.create=e;function r(o){let s=o;return Kr.objectLiteral(s)&&Sh.is(s.kind)&&Ea.DocumentUri.is(s.document)&&(s.metadata===void 0||Kr.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)&&!bh.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(Kr.objectLiteral(o)&&Kr.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 f=0;f<u.length;f++){let d=u[f];if(!i(o[d],s[d]))return!1}}return!0}})(wu||(Je.NotebookCell=wu={}));var Kx;(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 Kr.objectLiteral(i)&&Kr.string(i.uri)&&Ea.integer.is(i.version)&&Kr.typedArray(i.cells,wu.is)}t.is=r})(Kx||(Je.NotebookDocument=Kx={}));var Uo;(function(t){t.method="notebookDocument/sync",t.messageDirection=sn.MessageDirection.clientToServer,t.type=new sn.RegistrationType(t.method)})(Uo||(Je.NotebookDocumentSyncRegistrationType=Uo={}));var zx;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=sn.MessageDirection.clientToServer,t.type=new sn.ProtocolNotificationType(t.method),t.registrationMethod=Uo.method})(zx||(Je.DidOpenNotebookDocumentNotification=zx={}));var Vx;(function(t){function e(n){let i=n;return Kr.objectLiteral(i)&&Ea.uinteger.is(i.start)&&Ea.uinteger.is(i.deleteCount)&&(i.cells===void 0||Kr.typedArray(i.cells,wu.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})(Vx||(Je.NotebookCellArrayChange=Vx={}));var Xx;(function(t){t.method="notebookDocument/didChange",t.messageDirection=sn.MessageDirection.clientToServer,t.type=new sn.ProtocolNotificationType(t.method),t.registrationMethod=Uo.method})(Xx||(Je.DidChangeNotebookDocumentNotification=Xx={}));var Yx;(function(t){t.method="notebookDocument/didSave",t.messageDirection=sn.MessageDirection.clientToServer,t.type=new sn.ProtocolNotificationType(t.method),t.registrationMethod=Uo.method})(Yx||(Je.DidSaveNotebookDocumentNotification=Yx={}));var Jx;(function(t){t.method="notebookDocument/didClose",t.messageDirection=sn.MessageDirection.clientToServer,t.type=new sn.ProtocolNotificationType(t.method),t.registrationMethod=Uo.method})(Jx||(Je.DidCloseNotebookDocumentNotification=Jx={}))});var tv=$(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.InlineCompletionRequest=void 0;var Zx=Me(),ev;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=Zx.MessageDirection.clientToServer,t.type=new Zx.ProtocolRequestType(t.method)})(ev||(ku.InlineCompletionRequest=ev={}))});var mR=$(g=>{"use strict";Object.defineProperty(g,"__esModule",{value:!0});g.WorkspaceSymbolRequest=g.CodeActionResolveRequest=g.CodeActionRequest=g.DocumentSymbolRequest=g.DocumentHighlightRequest=g.ReferencesRequest=g.DefinitionRequest=g.SignatureHelpRequest=g.SignatureHelpTriggerKind=g.HoverRequest=g.CompletionResolveRequest=g.CompletionRequest=g.CompletionTriggerKind=g.PublishDiagnosticsNotification=g.WatchKind=g.RelativePattern=g.FileChangeType=g.DidChangeWatchedFilesNotification=g.WillSaveTextDocumentWaitUntilRequest=g.WillSaveTextDocumentNotification=g.TextDocumentSaveReason=g.DidSaveTextDocumentNotification=g.DidCloseTextDocumentNotification=g.DidChangeTextDocumentNotification=g.TextDocumentContentChangeEvent=g.DidOpenTextDocumentNotification=g.TextDocumentSyncKind=g.TelemetryEventNotification=g.LogMessageNotification=g.ShowMessageRequest=g.ShowMessageNotification=g.MessageType=g.DidChangeConfigurationNotification=g.ExitNotification=g.ShutdownRequest=g.InitializedNotification=g.InitializeErrorCodes=g.InitializeRequest=g.WorkDoneProgressOptions=g.TextDocumentRegistrationOptions=g.StaticRegistrationOptions=g.PositionEncodingKind=g.FailureHandlingKind=g.ResourceOperationKind=g.UnregistrationRequest=g.RegistrationRequest=g.DocumentSelector=g.NotebookCellTextDocumentFilter=g.NotebookDocumentFilter=g.TextDocumentFilter=void 0;g.MonikerRequest=g.MonikerKind=g.UniquenessLevel=g.WillDeleteFilesRequest=g.DidDeleteFilesNotification=g.WillRenameFilesRequest=g.DidRenameFilesNotification=g.WillCreateFilesRequest=g.DidCreateFilesNotification=g.FileOperationPatternKind=g.LinkedEditingRangeRequest=g.ShowDocumentRequest=g.SemanticTokensRegistrationType=g.SemanticTokensRefreshRequest=g.SemanticTokensRangeRequest=g.SemanticTokensDeltaRequest=g.SemanticTokensRequest=g.TokenFormat=g.CallHierarchyPrepareRequest=g.CallHierarchyOutgoingCallsRequest=g.CallHierarchyIncomingCallsRequest=g.WorkDoneProgressCancelNotification=g.WorkDoneProgressCreateRequest=g.WorkDoneProgress=g.SelectionRangeRequest=g.DeclarationRequest=g.FoldingRangeRefreshRequest=g.FoldingRangeRequest=g.ColorPresentationRequest=g.DocumentColorRequest=g.ConfigurationRequest=g.DidChangeWorkspaceFoldersNotification=g.WorkspaceFoldersRequest=g.TypeDefinitionRequest=g.ImplementationRequest=g.ApplyWorkspaceEditRequest=g.ExecuteCommandRequest=g.PrepareRenameRequest=g.RenameRequest=g.PrepareSupportDefaultBehavior=g.DocumentOnTypeFormattingRequest=g.DocumentRangesFormattingRequest=g.DocumentRangeFormattingRequest=g.DocumentFormattingRequest=g.DocumentLinkResolveRequest=g.DocumentLinkRequest=g.CodeLensRefreshRequest=g.CodeLensResolveRequest=g.CodeLensRequest=g.WorkspaceSymbolResolveRequest=void 0;g.InlineCompletionRequest=g.DidCloseNotebookDocumentNotification=g.DidSaveNotebookDocumentNotification=g.DidChangeNotebookDocumentNotification=g.NotebookCellArrayChange=g.DidOpenNotebookDocumentNotification=g.NotebookDocumentSyncRegistrationType=g.NotebookDocument=g.NotebookCell=g.ExecutionSummary=g.NotebookCellKind=g.DiagnosticRefreshRequest=g.WorkspaceDiagnosticRequest=g.DocumentDiagnosticRequest=g.DocumentDiagnosticReportKind=g.DiagnosticServerCancellationData=g.InlayHintRefreshRequest=g.InlayHintResolveRequest=g.InlayHintRequest=g.InlineValueRefreshRequest=g.InlineValueRequest=g.TypeHierarchySupertypesRequest=g.TypeHierarchySubtypesRequest=g.TypeHierarchyPrepareRequest=void 0;var E=Me(),rv=(qi(),ap(fu)),St=du(),wN=ET();Object.defineProperty(g,"ImplementationRequest",{enumerable:!0,get:function(){return wN.ImplementationRequest}});var kN=NT();Object.defineProperty(g,"TypeDefinitionRequest",{enumerable:!0,get:function(){return kN.TypeDefinitionRequest}});var lR=DT();Object.defineProperty(g,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return lR.WorkspaceFoldersRequest}});Object.defineProperty(g,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return lR.DidChangeWorkspaceFoldersNotification}});var EN=LT();Object.defineProperty(g,"ConfigurationRequest",{enumerable:!0,get:function(){return EN.ConfigurationRequest}});var fR=UT();Object.defineProperty(g,"DocumentColorRequest",{enumerable:!0,get:function(){return fR.DocumentColorRequest}});Object.defineProperty(g,"ColorPresentationRequest",{enumerable:!0,get:function(){return fR.ColorPresentationRequest}});var dR=GT();Object.defineProperty(g,"FoldingRangeRequest",{enumerable:!0,get:function(){return dR.FoldingRangeRequest}});Object.defineProperty(g,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return dR.FoldingRangeRefreshRequest}});var _N=BT();Object.defineProperty(g,"DeclarationRequest",{enumerable:!0,get:function(){return _N.DeclarationRequest}});var CN=VT();Object.defineProperty(g,"SelectionRangeRequest",{enumerable:!0,get:function(){return CN.SelectionRangeRequest}});var _h=QT();Object.defineProperty(g,"WorkDoneProgress",{enumerable:!0,get:function(){return _h.WorkDoneProgress}});Object.defineProperty(g,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return _h.WorkDoneProgressCreateRequest}});Object.defineProperty(g,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return _h.WorkDoneProgressCancelNotification}});var Ch=rx();Object.defineProperty(g,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return Ch.CallHierarchyIncomingCallsRequest}});Object.defineProperty(g,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return Ch.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(g,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return Ch.CallHierarchyPrepareRequest}});var qo=cx();Object.defineProperty(g,"TokenFormat",{enumerable:!0,get:function(){return qo.TokenFormat}});Object.defineProperty(g,"SemanticTokensRequest",{enumerable:!0,get:function(){return qo.SemanticTokensRequest}});Object.defineProperty(g,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return qo.SemanticTokensDeltaRequest}});Object.defineProperty(g,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return qo.SemanticTokensRangeRequest}});Object.defineProperty(g,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return qo.SemanticTokensRefreshRequest}});Object.defineProperty(g,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return qo.SemanticTokensRegistrationType}});var NN=fx();Object.defineProperty(g,"ShowDocumentRequest",{enumerable:!0,get:function(){return NN.ShowDocumentRequest}});var PN=mx();Object.defineProperty(g,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return PN.LinkedEditingRangeRequest}});var ji=Sx();Object.defineProperty(g,"FileOperationPatternKind",{enumerable:!0,get:function(){return ji.FileOperationPatternKind}});Object.defineProperty(g,"DidCreateFilesNotification",{enumerable:!0,get:function(){return ji.DidCreateFilesNotification}});Object.defineProperty(g,"WillCreateFilesRequest",{enumerable:!0,get:function(){return ji.WillCreateFilesRequest}});Object.defineProperty(g,"DidRenameFilesNotification",{enumerable:!0,get:function(){return ji.DidRenameFilesNotification}});Object.defineProperty(g,"WillRenameFilesRequest",{enumerable:!0,get:function(){return ji.WillRenameFilesRequest}});Object.defineProperty(g,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return ji.DidDeleteFilesNotification}});Object.defineProperty(g,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return ji.WillDeleteFilesRequest}});var Nh=Ex();Object.defineProperty(g,"UniquenessLevel",{enumerable:!0,get:function(){return Nh.UniquenessLevel}});Object.defineProperty(g,"MonikerKind",{enumerable:!0,get:function(){return Nh.MonikerKind}});Object.defineProperty(g,"MonikerRequest",{enumerable:!0,get:function(){return Nh.MonikerRequest}});var Ph=Px();Object.defineProperty(g,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return Ph.TypeHierarchyPrepareRequest}});Object.defineProperty(g,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return Ph.TypeHierarchySubtypesRequest}});Object.defineProperty(g,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return Ph.TypeHierarchySupertypesRequest}});var pR=Ox();Object.defineProperty(g,"InlineValueRequest",{enumerable:!0,get:function(){return pR.InlineValueRequest}});Object.defineProperty(g,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return pR.InlineValueRefreshRequest}});var Ih=Fx();Object.defineProperty(g,"InlayHintRequest",{enumerable:!0,get:function(){return Ih.InlayHintRequest}});Object.defineProperty(g,"InlayHintResolveRequest",{enumerable:!0,get:function(){return Ih.InlayHintResolveRequest}});Object.defineProperty(g,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return Ih.InlayHintRefreshRequest}});var _a=Bx();Object.defineProperty(g,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return _a.DiagnosticServerCancellationData}});Object.defineProperty(g,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return _a.DocumentDiagnosticReportKind}});Object.defineProperty(g,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return _a.DocumentDiagnosticRequest}});Object.defineProperty(g,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return _a.WorkspaceDiagnosticRequest}});Object.defineProperty(g,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return _a.DiagnosticRefreshRequest}});var an=Qx();Object.defineProperty(g,"NotebookCellKind",{enumerable:!0,get:function(){return an.NotebookCellKind}});Object.defineProperty(g,"ExecutionSummary",{enumerable:!0,get:function(){return an.ExecutionSummary}});Object.defineProperty(g,"NotebookCell",{enumerable:!0,get:function(){return an.NotebookCell}});Object.defineProperty(g,"NotebookDocument",{enumerable:!0,get:function(){return an.NotebookDocument}});Object.defineProperty(g,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return an.NotebookDocumentSyncRegistrationType}});Object.defineProperty(g,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return an.DidOpenNotebookDocumentNotification}});Object.defineProperty(g,"NotebookCellArrayChange",{enumerable:!0,get:function(){return an.NotebookCellArrayChange}});Object.defineProperty(g,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return an.DidChangeNotebookDocumentNotification}});Object.defineProperty(g,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return an.DidSaveNotebookDocumentNotification}});Object.defineProperty(g,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return an.DidCloseNotebookDocumentNotification}});var IN=tv();Object.defineProperty(g,"InlineCompletionRequest",{enumerable:!0,get:function(){return IN.InlineCompletionRequest}});var Ah;(function(t){function e(r){let n=r;return St.string(n)||St.string(n.language)||St.string(n.scheme)||St.string(n.pattern)}t.is=e})(Ah||(g.TextDocumentFilter=Ah={}));var wh;(function(t){function e(r){let n=r;return St.objectLiteral(n)&&(St.string(n.notebookType)||St.string(n.scheme)||St.string(n.pattern))}t.is=e})(wh||(g.NotebookDocumentFilter=wh={}));var kh;(function(t){function e(r){let n=r;return St.objectLiteral(n)&&(St.string(n.notebook)||wh.is(n.notebook))&&(n.language===void 0||St.string(n.language))}t.is=e})(kh||(g.NotebookCellTextDocumentFilter=kh={}));var Eh;(function(t){function e(r){if(!Array.isArray(r))return!1;for(let n of r)if(!St.string(n)&&!Ah.is(n)&&!kh.is(n))return!1;return!0}t.is=e})(Eh||(g.DocumentSelector=Eh={}));var nv;(function(t){t.method="client/registerCapability",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolRequestType(t.method)})(nv||(g.RegistrationRequest=nv={}));var iv;(function(t){t.method="client/unregisterCapability",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolRequestType(t.method)})(iv||(g.UnregistrationRequest=iv={}));var ov;(function(t){t.Create="create",t.Rename="rename",t.Delete="delete"})(ov||(g.ResourceOperationKind=ov={}));var sv;(function(t){t.Abort="abort",t.Transactional="transactional",t.TextOnlyTransactional="textOnlyTransactional",t.Undo="undo"})(sv||(g.FailureHandlingKind=sv={}));var av;(function(t){t.UTF8="utf-8",t.UTF16="utf-16",t.UTF32="utf-32"})(av||(g.PositionEncodingKind=av={}));var cv;(function(t){function e(r){let n=r;return n&&St.string(n.id)&&n.id.length>0}t.hasId=e})(cv||(g.StaticRegistrationOptions=cv={}));var uv;(function(t){function e(r){let n=r;return n&&(n.documentSelector===null||Eh.is(n.documentSelector))}t.is=e})(uv||(g.TextDocumentRegistrationOptions=uv={}));var lv;(function(t){function e(n){let i=n;return St.objectLiteral(i)&&(i.workDoneProgress===void 0||St.boolean(i.workDoneProgress))}t.is=e;function r(n){let i=n;return i&&St.boolean(i.workDoneProgress)}t.hasWorkDoneProgress=r})(lv||(g.WorkDoneProgressOptions=lv={}));var fv;(function(t){t.method="initialize",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(fv||(g.InitializeRequest=fv={}));var dv;(function(t){t.unknownProtocolVersion=1})(dv||(g.InitializeErrorCodes=dv={}));var pv;(function(t){t.method="initialized",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType(t.method)})(pv||(g.InitializedNotification=pv={}));var mv;(function(t){t.method="shutdown",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType0(t.method)})(mv||(g.ShutdownRequest=mv={}));var hv;(function(t){t.method="exit",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType0(t.method)})(hv||(g.ExitNotification=hv={}));var gv;(function(t){t.method="workspace/didChangeConfiguration",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType(t.method)})(gv||(g.DidChangeConfigurationNotification=gv={}));var yv;(function(t){t.Error=1,t.Warning=2,t.Info=3,t.Log=4,t.Debug=5})(yv||(g.MessageType=yv={}));var Tv;(function(t){t.method="window/showMessage",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolNotificationType(t.method)})(Tv||(g.ShowMessageNotification=Tv={}));var xv;(function(t){t.method="window/showMessageRequest",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolRequestType(t.method)})(xv||(g.ShowMessageRequest=xv={}));var vv;(function(t){t.method="window/logMessage",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolNotificationType(t.method)})(vv||(g.LogMessageNotification=vv={}));var Rv;(function(t){t.method="telemetry/event",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolNotificationType(t.method)})(Rv||(g.TelemetryEventNotification=Rv={}));var Sv;(function(t){t.None=0,t.Full=1,t.Incremental=2})(Sv||(g.TextDocumentSyncKind=Sv={}));var bv;(function(t){t.method="textDocument/didOpen",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType(t.method)})(bv||(g.DidOpenTextDocumentNotification=bv={}));var Av;(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})(Av||(g.TextDocumentContentChangeEvent=Av={}));var wv;(function(t){t.method="textDocument/didChange",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType(t.method)})(wv||(g.DidChangeTextDocumentNotification=wv={}));var kv;(function(t){t.method="textDocument/didClose",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType(t.method)})(kv||(g.DidCloseTextDocumentNotification=kv={}));var Ev;(function(t){t.method="textDocument/didSave",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType(t.method)})(Ev||(g.DidSaveTextDocumentNotification=Ev={}));var _v;(function(t){t.Manual=1,t.AfterDelay=2,t.FocusOut=3})(_v||(g.TextDocumentSaveReason=_v={}));var Cv;(function(t){t.method="textDocument/willSave",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType(t.method)})(Cv||(g.WillSaveTextDocumentNotification=Cv={}));var Nv;(function(t){t.method="textDocument/willSaveWaitUntil",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Nv||(g.WillSaveTextDocumentWaitUntilRequest=Nv={}));var Pv;(function(t){t.method="workspace/didChangeWatchedFiles",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType(t.method)})(Pv||(g.DidChangeWatchedFilesNotification=Pv={}));var Iv;(function(t){t.Created=1,t.Changed=2,t.Deleted=3})(Iv||(g.FileChangeType=Iv={}));var Dv;(function(t){function e(r){let n=r;return St.objectLiteral(n)&&(rv.URI.is(n.baseUri)||rv.WorkspaceFolder.is(n.baseUri))&&St.string(n.pattern)}t.is=e})(Dv||(g.RelativePattern=Dv={}));var Ov;(function(t){t.Create=1,t.Change=2,t.Delete=4})(Ov||(g.WatchKind=Ov={}));var $v;(function(t){t.method="textDocument/publishDiagnostics",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolNotificationType(t.method)})($v||(g.PublishDiagnosticsNotification=$v={}));var Lv;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.TriggerForIncompleteCompletions=3})(Lv||(g.CompletionTriggerKind=Lv={}));var Mv;(function(t){t.method="textDocument/completion",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Mv||(g.CompletionRequest=Mv={}));var Fv;(function(t){t.method="completionItem/resolve",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Fv||(g.CompletionResolveRequest=Fv={}));var Uv;(function(t){t.method="textDocument/hover",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Uv||(g.HoverRequest=Uv={}));var qv;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.ContentChange=3})(qv||(g.SignatureHelpTriggerKind=qv={}));var jv;(function(t){t.method="textDocument/signatureHelp",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(jv||(g.SignatureHelpRequest=jv={}));var Gv;(function(t){t.method="textDocument/definition",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Gv||(g.DefinitionRequest=Gv={}));var Hv;(function(t){t.method="textDocument/references",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Hv||(g.ReferencesRequest=Hv={}));var Wv;(function(t){t.method="textDocument/documentHighlight",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Wv||(g.DocumentHighlightRequest=Wv={}));var Bv;(function(t){t.method="textDocument/documentSymbol",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Bv||(g.DocumentSymbolRequest=Bv={}));var Kv;(function(t){t.method="textDocument/codeAction",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Kv||(g.CodeActionRequest=Kv={}));var zv;(function(t){t.method="codeAction/resolve",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(zv||(g.CodeActionResolveRequest=zv={}));var Vv;(function(t){t.method="workspace/symbol",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Vv||(g.WorkspaceSymbolRequest=Vv={}));var Xv;(function(t){t.method="workspaceSymbol/resolve",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Xv||(g.WorkspaceSymbolResolveRequest=Xv={}));var Yv;(function(t){t.method="textDocument/codeLens",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Yv||(g.CodeLensRequest=Yv={}));var Jv;(function(t){t.method="codeLens/resolve",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Jv||(g.CodeLensResolveRequest=Jv={}));var Qv;(function(t){t.method="workspace/codeLens/refresh",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolRequestType0(t.method)})(Qv||(g.CodeLensRefreshRequest=Qv={}));var Zv;(function(t){t.method="textDocument/documentLink",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Zv||(g.DocumentLinkRequest=Zv={}));var eR;(function(t){t.method="documentLink/resolve",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(eR||(g.DocumentLinkResolveRequest=eR={}));var tR;(function(t){t.method="textDocument/formatting",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(tR||(g.DocumentFormattingRequest=tR={}));var rR;(function(t){t.method="textDocument/rangeFormatting",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(rR||(g.DocumentRangeFormattingRequest=rR={}));var nR;(function(t){t.method="textDocument/rangesFormatting",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(nR||(g.DocumentRangesFormattingRequest=nR={}));var iR;(function(t){t.method="textDocument/onTypeFormatting",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(iR||(g.DocumentOnTypeFormattingRequest=iR={}));var oR;(function(t){t.Identifier=1})(oR||(g.PrepareSupportDefaultBehavior=oR={}));var sR;(function(t){t.method="textDocument/rename",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(sR||(g.RenameRequest=sR={}));var aR;(function(t){t.method="textDocument/prepareRename",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(aR||(g.PrepareRenameRequest=aR={}));var cR;(function(t){t.method="workspace/executeCommand",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(cR||(g.ExecuteCommandRequest=cR={}));var uR;(function(t){t.method="workspace/applyEdit",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolRequestType("workspace/applyEdit")})(uR||(g.ApplyWorkspaceEditRequest=uR={}))});var gR=$(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.createProtocolConnection=void 0;var hR=_n();function DN(t,e,r,n){return hR.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,hR.createMessageConnection)(t,e,r,n)}Eu.createProtocolConnection=DN});var TR=$(fr=>{"use strict";var ON=fr&&fr.__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=fr&&fr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ON(e,t,r)};Object.defineProperty(fr,"__esModule",{value:!0});fr.LSPErrorCodes=fr.createProtocolConnection=void 0;_u(_n(),fr);_u((qi(),ap(fu)),fr);_u(Me(),fr);_u(mR(),fr);var $N=gR();Object.defineProperty(fr,"createProtocolConnection",{enumerable:!0,get:function(){return $N.createProtocolConnection}});var yR;(function(t){t.lspReservedErrorRangeStart=-32899,t.RequestFailed=-32803,t.ServerCancelled=-32802,t.ContentModified=-32801,t.RequestCancelled=-32800,t.lspReservedErrorRangeEnd=-32800})(yR||(fr.LSPErrorCodes=yR={}))});var Qe=$(cn=>{"use strict";var LN=cn&&cn.__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]}),xR=cn&&cn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&LN(e,t,r)};Object.defineProperty(cn,"__esModule",{value:!0});cn.createProtocolConnection=void 0;var MN=gm();xR(gm(),cn);xR(TR(),cn);function FN(t,e,r,n){return(0,MN.createMessageConnection)(t,e,r,n)}cn.createProtocolConnection=FN});var Oh=$(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.SemanticTokensBuilder=ai.SemanticTokensDiff=ai.SemanticTokensFeature=void 0;var Cu=Qe(),UN=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(Cu.SemanticTokensRefreshRequest.type),on:e=>{let r=Cu.SemanticTokensRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onDelta:e=>{let r=Cu.SemanticTokensDeltaRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onRange:e=>{let r=Cu.SemanticTokensRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};ai.SemanticTokensFeature=UN;var Nu=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}]:[]}};ai.SemanticTokensDiff=Nu;var Dh=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 Nu(this._prevData,this._data).computeDiff()}:this.build()}};ai.SemanticTokensBuilder=Dh});var vR=$(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.InlineCompletionFeature=void 0;var qN=Qe(),jN=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(qN.InlineCompletionRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};Pu.InlineCompletionFeature=jN});var Lh=$(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.TextDocuments=void 0;var Gi=Qe(),$h=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new Gi.Emitter,this._onDidOpen=new Gi.Emitter,this._onDidClose=new Gi.Emitter,this._onDidSave=new Gi.Emitter,this._onWillSave=new Gi.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=Gi.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}))})),Gi.Disposable.create(()=>{r.forEach(n=>n.dispose())})}};Iu.TextDocuments=$h});var Fh=$(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.NotebookDocuments=jo.NotebookSyncFeature=void 0;var Ir=Qe(),RR=Lh(),GN=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(Ir.DidOpenNotebookDocumentNotification.type,r=>{e(r)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(Ir.DidChangeNotebookDocumentNotification.type,r=>{e(r)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(Ir.DidSaveNotebookDocumentNotification.type,r=>{e(r)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(Ir.DidCloseNotebookDocumentNotification.type,r=>{e(r)})}}};jo.NotebookSyncFeature=GN;var Du=class t{onDidOpenTextDocument(e){return this.openHandler=e,Ir.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,Ir.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,Ir.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}};Du.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var Mh=class{constructor(e){e instanceof RR.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new RR.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new Ir.Emitter,this._onDidChange=new Ir.Emitter,this._onDidSave=new Ir.Emitter,this._onDidClose=new Ir.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 Du,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=[],f=[],d=[];if(c.cells!==void 0){let x=c.cells;if(x.structure!==void 0){let h=x.structure.array;if(o.cells.splice(h.start,h.deleteCount,...h.cells!==void 0?h.cells:[]),x.structure.didOpen!==void 0)for(let m of x.structure.didOpen)r.openTextDocument({textDocument:m}),u.push(m.uri);if(x.structure.didClose)for(let m of x.structure.didClose)r.closeTextDocument({textDocument:m}),l.push(m.uri)}if(x.data!==void 0){let h=new Map(x.data.map(m=>[m.document,m]));for(let m=0;m<=o.cells.length;m++){let b=h.get(o.cells[m].document);if(b!==void 0){let _=o.cells.splice(m,1,b);if(f.push({old:_[0],new:b}),h.delete(b.document),h.size===0)break}}}if(x.textContent!==void 0)for(let h of x.textContent)r.changeTextDocument({textDocument:h.document,contentChanges:h.changes}),d.push(h.document.uri)}this.updateCellMap(o);let p={notebookDocument:o};a&&(p.metadata={old:s,new:o.metadata});let T=[];for(let x of u)T.push(this.getNotebookCell(x));let S=[];for(let x of l)S.push(this.getNotebookCell(x));let A=[];for(let x of d)A.push(this.getNotebookCell(x));(T.length>0||S.length>0||f.length>0||A.length>0)&&(p.cells={added:T,removed:S,changed:{data:f,textContent:A}}),(p.metadata!==void 0||p.cells!==void 0)&&this._onDidChange.fire(p)})),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)}})),Ir.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let r of e.cells)this.notebookCellMap.set(r.document,[r,e])}};jo.NotebookDocuments=Mh});var Uh=$(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.thenable=ct.typedArray=ct.stringArray=ct.array=ct.func=ct.error=ct.number=ct.string=ct.boolean=void 0;function HN(t){return t===!0||t===!1}ct.boolean=HN;function SR(t){return typeof t=="string"||t instanceof String}ct.string=SR;function WN(t){return typeof t=="number"||t instanceof Number}ct.number=WN;function BN(t){return t instanceof Error}ct.error=BN;function bR(t){return typeof t=="function"}ct.func=bR;function AR(t){return Array.isArray(t)}ct.array=AR;function KN(t){return AR(t)&&t.every(e=>SR(e))}ct.stringArray=KN;function zN(t,e){return Array.isArray(t)&&t.every(e)}ct.typedArray=zN;function VN(t){return t&&bR(t.then)}ct.thenable=VN});var qh=$(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.generateUuid=Dr.parse=Dr.isUUID=Dr.v4=Dr.empty=void 0;var Ca=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},Na=class t extends Ca{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(""))}};Na._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];Na._timeHighBits=["8","9","a","b"];Dr.empty=new Ca("00000000-0000-0000-0000-000000000000");function wR(){return new Na}Dr.v4=wR;var XN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function kR(t){return XN.test(t)}Dr.isUUID=kR;function YN(t){if(!kR(t))throw new Error("invalid uuid");return new Ca(t)}Dr.parse=YN;function JN(){return wR().asHex()}Dr.generateUuid=JN});var ER=$(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.attachPartialResult=ui.ProgressFeature=ui.attachWorkDone=void 0;var ci=Qe(),QN=qh(),Hi=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(ci.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(ci.WorkDoneProgress.type,this._token,n)}done(){t.Instances.delete(this._token),this._connection.sendProgress(ci.WorkDoneProgress.type,this._token,{kind:"end"})}};Hi.Instances=new Map;var Ou=class extends Hi{constructor(e,r){super(e,r),this._source=new ci.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},Pa=class{constructor(){}begin(){}report(){}done(){}},$u=class extends Pa{constructor(){super(),this._source=new ci.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function ZN(t,e){if(e===void 0||e.workDoneToken===void 0)return new Pa;let r=e.workDoneToken;return delete e.workDoneToken,new Hi(t,r)}ui.attachWorkDone=ZN;var eP=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(ci.WorkDoneProgressCancelNotification.type,r=>{let n=Hi.Instances.get(r.token);(n instanceof Ou||n instanceof $u)&&n.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new Pa:new Hi(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,QN.generateUuid)();return this.connection.sendRequest(ci.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new Ou(this.connection,e))}else return Promise.resolve(new $u)}};ui.ProgressFeature=eP;var jh;(function(t){t.type=new ci.ProgressType})(jh||(jh={}));var Gh=class{constructor(e,r){this._connection=e,this._token=r}report(e){this._connection.sendProgress(jh.type,this._token,e)}};function tP(t,e){if(e===void 0||e.partialResultToken===void 0)return;let r=e.partialResultToken;return delete e.partialResultToken,new Gh(t,r)}ui.attachPartialResult=tP});var _R=$(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.ConfigurationFeature=void 0;var rP=Qe(),nP=Uh(),iP=t=>class extends t{getConfiguration(e){return e?nP.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(rP.ConfigurationRequest.type,r).then(n=>Array.isArray(n)?Array.isArray(e)?n:n[0]:Array.isArray(e)?[]:null)}};Lu.ConfigurationFeature=iP});var CR=$(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.WorkspaceFoldersFeature=void 0;var Mu=Qe(),oP=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let r=e.workspace;r&&r.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new Mu.Emitter,this.connection.onNotification(Mu.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(Mu.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(Mu.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};Fu.WorkspaceFoldersFeature=oP});var NR=$(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.CallHierarchyFeature=void 0;var Hh=Qe(),sP=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(Hh.CallHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onIncomingCalls:e=>{let r=Hh.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onOutgoingCalls:e=>{let r=Hh.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Uu.CallHierarchyFeature=sP});var PR=$(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.ShowDocumentFeature=void 0;var aP=Qe(),cP=t=>class extends t{showDocument(e){return this.connection.sendRequest(aP.ShowDocumentRequest.type,e)}};qu.ShowDocumentFeature=cP});var IR=$(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.FileOperationsFeature=void 0;var Go=Qe(),uP=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(Go.DidCreateFilesNotification.type,r=>{e(r)})}onDidRenameFiles(e){return this.connection.onNotification(Go.DidRenameFilesNotification.type,r=>{e(r)})}onDidDeleteFiles(e){return this.connection.onNotification(Go.DidDeleteFilesNotification.type,r=>{e(r)})}onWillCreateFiles(e){return this.connection.onRequest(Go.WillCreateFilesRequest.type,(r,n)=>e(r,n))}onWillRenameFiles(e){return this.connection.onRequest(Go.WillRenameFilesRequest.type,(r,n)=>e(r,n))}onWillDeleteFiles(e){return this.connection.onRequest(Go.WillDeleteFilesRequest.type,(r,n)=>e(r,n))}};ju.FileOperationsFeature=uP});var DR=$(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});Gu.LinkedEditingRangeFeature=void 0;var lP=Qe(),fP=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(lP.LinkedEditingRangeRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0))}};Gu.LinkedEditingRangeFeature=fP});var OR=$(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.TypeHierarchyFeature=void 0;var Wh=Qe(),dP=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(Wh.TypeHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onSupertypes:e=>{let r=Wh.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onSubtypes:e=>{let r=Wh.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Hu.TypeHierarchyFeature=dP});var LR=$(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.InlineValueFeature=void 0;var $R=Qe(),pP=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest($R.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest($R.InlineValueRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};Wu.InlineValueFeature=pP});var FR=$(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});Bu.FoldingRangeFeature=void 0;var MR=Qe(),mP=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(MR.FoldingRangeRefreshRequest.type),on:e=>{let r=MR.FoldingRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Bu.FoldingRangeFeature=mP});var UR=$(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.InlayHintFeature=void 0;var Bh=Qe(),hP=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(Bh.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(Bh.InlayHintRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r))),resolve:e=>this.connection.onRequest(Bh.InlayHintResolveRequest.type,(r,n)=>e(r,n))}}};Ku.InlayHintFeature=hP});var qR=$(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.DiagnosticFeature=void 0;var Ia=Qe(),gP=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(Ia.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(Ia.DocumentDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(Ia.DocumentDiagnosticRequest.partialResult,r))),onWorkspace:e=>this.connection.onRequest(Ia.WorkspaceDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(Ia.WorkspaceDiagnosticRequest.partialResult,r)))}}};zu.DiagnosticFeature=gP});var jR=$(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.MonikerFeature=void 0;var yP=Qe(),TP=t=>class extends t{get moniker(){return{on:e=>{let r=yP.MonikerRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Vu.MonikerFeature=TP});var rS=$(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.createConnection=ae.combineFeatures=ae.combineNotebooksFeatures=ae.combineLanguagesFeatures=ae.combineWorkspaceFeatures=ae.combineWindowFeatures=ae.combineClientFeatures=ae.combineTracerFeatures=ae.combineTelemetryFeatures=ae.combineConsoleFeatures=ae._NotebooksImpl=ae._LanguagesImpl=ae.BulkUnregistration=ae.BulkRegistration=ae.ErrorMessageTracker=void 0;var P=Qe(),Or=Uh(),zh=qh(),z=ER(),xP=_R(),vP=CR(),RP=NR(),SP=Oh(),bP=PR(),AP=IR(),wP=DR(),kP=OR(),EP=LR(),_P=FR(),CP=UR(),NP=qR(),PP=Fh(),IP=jR();function Kh(t){if(t!==null)return t}var Vh=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)})}};ae.ErrorMessageTracker=Vh;var Xu=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(P.MessageType.Error,e)}warn(e){this.send(P.MessageType.Warning,e)}info(e){this.send(P.MessageType.Info,e)}log(e){this.send(P.MessageType.Log,e)}debug(e){this.send(P.MessageType.Debug,e)}send(e,r){this._rawConnection&&this._rawConnection.sendNotification(P.LogMessageNotification.type,{type:e,message:r}).catch(()=>{(0,P.RAL)().console.error("Sending log message failed")})}},Xh=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:P.MessageType.Error,message:e,actions:r};return this.connection.sendRequest(P.ShowMessageRequest.type,n).then(Kh)}showWarningMessage(e,...r){let n={type:P.MessageType.Warning,message:e,actions:r};return this.connection.sendRequest(P.ShowMessageRequest.type,n).then(Kh)}showInformationMessage(e,...r){let n={type:P.MessageType.Info,message:e,actions:r};return this.connection.sendRequest(P.ShowMessageRequest.type,n).then(Kh)}},GR=(0,bP.ShowDocumentFeature)((0,z.ProgressFeature)(Xh)),HR;(function(t){function e(){return new Yu}t.create=e})(HR||(ae.BulkRegistration=HR={}));var Yu=class{constructor(){this._registrations=[],this._registered=new Set}add(e,r){let n=Or.string(e)?e:e.method;if(this._registered.has(n))throw new Error(`${n} is already added to this registration`);let i=zh.generateUuid();this._registrations.push({id:i,method:n,registerOptions:r||{}}),this._registered.add(n)}asRegistrationParams(){return{registrations:this._registrations}}},WR;(function(t){function e(){return new Da(void 0,[])}t.create=e})(WR||(ae.BulkUnregistration=WR={}));var Da=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(P.UnregistrationRequest.type,r).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){let r=Or.string(e)?e:e.method,n=this._unregistrations.get(r);if(!n)return!1;let i={unregisterations:[n]};return this._connection.sendRequest(P.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(r)},o=>{this._connection.console.info(`Un-registering request handler for ${n.id} failed.`)}),!0}},Ju=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 Yu?this.registerMany(e):e instanceof Da?this.registerSingle1(e,r,n):this.registerSingle2(e,r)}registerSingle1(e,r,n){let i=Or.string(r)?r:r.method,o=zh.generateUuid(),s={registrations:[{id:o,method:i,registerOptions:n||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(P.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=Or.string(e)?e:e.method,i=zh.generateUuid(),o={registrations:[{id:i,method:n,registerOptions:r||{}}]};return this.connection.sendRequest(P.RegistrationRequest.type,o).then(s=>P.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(P.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(P.RegistrationRequest.type,r).then(()=>new Da(this._connection,r.registrations.map(n=>({id:n.id,method:n.method}))),n=>(this.connection.console.info("Bulk registration failed."),Promise.reject(n)))}},Yh=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(P.ApplyWorkspaceEditRequest.type,n)}},BR=(0,AP.FileOperationsFeature)((0,vP.WorkspaceFoldersFeature)((0,xP.ConfigurationFeature)(Yh))),Qu=class{constructor(){this._trace=P.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!==P.Trace.Off&&this.connection.sendNotification(P.LogTraceNotification.type,{message:e,verbose:this._trace===P.Trace.Verbose?r:void 0}).catch(()=>{})}},Zu=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(P.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}},el=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,z.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,z.attachPartialResult)(this.connection,r)}};ae._LanguagesImpl=el;var KR=(0,_P.FoldingRangeFeature)((0,IP.MonikerFeature)((0,NP.DiagnosticFeature)((0,CP.InlayHintFeature)((0,EP.InlineValueFeature)((0,kP.TypeHierarchyFeature)((0,wP.LinkedEditingRangeFeature)((0,SP.SemanticTokensFeature)((0,RP.CallHierarchyFeature)(el))))))))),tl=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,z.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,z.attachPartialResult)(this.connection,r)}};ae._NotebooksImpl=tl;var zR=(0,PP.NotebookSyncFeature)(tl);function VR(t,e){return function(r){return e(t(r))}}ae.combineConsoleFeatures=VR;function XR(t,e){return function(r){return e(t(r))}}ae.combineTelemetryFeatures=XR;function YR(t,e){return function(r){return e(t(r))}}ae.combineTracerFeatures=YR;function JR(t,e){return function(r){return e(t(r))}}ae.combineClientFeatures=JR;function QR(t,e){return function(r){return e(t(r))}}ae.combineWindowFeatures=QR;function ZR(t,e){return function(r){return e(t(r))}}ae.combineWorkspaceFeatures=ZR;function eS(t,e){return function(r){return e(t(r))}}ae.combineLanguagesFeatures=eS;function tS(t,e){return function(r){return e(t(r))}}ae.combineNotebooksFeatures=tS;function DP(t,e){function r(i,o,s){return i&&o?s(i,o):i||o}return{__brand:"features",console:r(t.console,e.console,VR),tracer:r(t.tracer,e.tracer,YR),telemetry:r(t.telemetry,e.telemetry,XR),client:r(t.client,e.client,JR),window:r(t.window,e.window,QR),workspace:r(t.workspace,e.workspace,ZR),languages:r(t.languages,e.languages,eS),notebooks:r(t.notebooks,e.notebooks,tS)}}ae.combineFeatures=DP;function OP(t,e,r){let n=r&&r.console?new(r.console(Xu)):new Xu,i=t(n);n.rawAttach(i);let o=r&&r.tracer?new(r.tracer(Qu)):new Qu,s=r&&r.telemetry?new(r.telemetry(Zu)):new Zu,a=r&&r.client?new(r.client(Ju)):new Ju,c=r&&r.window?new(r.window(GR)):new GR,u=r&&r.workspace?new(r.workspace(BR)):new BR,l=r&&r.languages?new(r.languages(KR)):new KR,f=r&&r.notebooks?new(r.notebooks(zR)):new zR,d=[n,o,s,a,c,u,l,f];function p(h){return h instanceof Promise?h:Or.thenable(h)?new Promise((m,b)=>{h.then(_=>m(_),_=>b(_))}):Promise.resolve(h)}let T,S,A,x={listen:()=>i.listen(),sendRequest:(h,...m)=>i.sendRequest(Or.string(h)?h:h.method,...m),onRequest:(h,m)=>i.onRequest(h,m),sendNotification:(h,m)=>{let b=Or.string(h)?h:h.method;return i.sendNotification(b,m)},onNotification:(h,m)=>i.onNotification(h,m),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:h=>(S=h,{dispose:()=>{S=void 0}}),onInitialized:h=>i.onNotification(P.InitializedNotification.type,h),onShutdown:h=>(T=h,{dispose:()=>{T=void 0}}),onExit:h=>(A=h,{dispose:()=>{A=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 f},onDidChangeConfiguration:h=>i.onNotification(P.DidChangeConfigurationNotification.type,h),onDidChangeWatchedFiles:h=>i.onNotification(P.DidChangeWatchedFilesNotification.type,h),__textDocumentSync:void 0,onDidOpenTextDocument:h=>i.onNotification(P.DidOpenTextDocumentNotification.type,h),onDidChangeTextDocument:h=>i.onNotification(P.DidChangeTextDocumentNotification.type,h),onDidCloseTextDocument:h=>i.onNotification(P.DidCloseTextDocumentNotification.type,h),onWillSaveTextDocument:h=>i.onNotification(P.WillSaveTextDocumentNotification.type,h),onWillSaveTextDocumentWaitUntil:h=>i.onRequest(P.WillSaveTextDocumentWaitUntilRequest.type,h),onDidSaveTextDocument:h=>i.onNotification(P.DidSaveTextDocumentNotification.type,h),sendDiagnostics:h=>i.sendNotification(P.PublishDiagnosticsNotification.type,h),onHover:h=>i.onRequest(P.HoverRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),void 0)),onCompletion:h=>i.onRequest(P.CompletionRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onCompletionResolve:h=>i.onRequest(P.CompletionResolveRequest.type,h),onSignatureHelp:h=>i.onRequest(P.SignatureHelpRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),void 0)),onDeclaration:h=>i.onRequest(P.DeclarationRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onDefinition:h=>i.onRequest(P.DefinitionRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onTypeDefinition:h=>i.onRequest(P.TypeDefinitionRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onImplementation:h=>i.onRequest(P.ImplementationRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onReferences:h=>i.onRequest(P.ReferencesRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onDocumentHighlight:h=>i.onRequest(P.DocumentHighlightRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onDocumentSymbol:h=>i.onRequest(P.DocumentSymbolRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onWorkspaceSymbol:h=>i.onRequest(P.WorkspaceSymbolRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onWorkspaceSymbolResolve:h=>i.onRequest(P.WorkspaceSymbolResolveRequest.type,h),onCodeAction:h=>i.onRequest(P.CodeActionRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onCodeActionResolve:h=>i.onRequest(P.CodeActionResolveRequest.type,(m,b)=>h(m,b)),onCodeLens:h=>i.onRequest(P.CodeLensRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onCodeLensResolve:h=>i.onRequest(P.CodeLensResolveRequest.type,(m,b)=>h(m,b)),onDocumentFormatting:h=>i.onRequest(P.DocumentFormattingRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),void 0)),onDocumentRangeFormatting:h=>i.onRequest(P.DocumentRangeFormattingRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),void 0)),onDocumentOnTypeFormatting:h=>i.onRequest(P.DocumentOnTypeFormattingRequest.type,(m,b)=>h(m,b)),onRenameRequest:h=>i.onRequest(P.RenameRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),void 0)),onPrepareRename:h=>i.onRequest(P.PrepareRenameRequest.type,(m,b)=>h(m,b)),onDocumentLinks:h=>i.onRequest(P.DocumentLinkRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onDocumentLinkResolve:h=>i.onRequest(P.DocumentLinkResolveRequest.type,(m,b)=>h(m,b)),onDocumentColor:h=>i.onRequest(P.DocumentColorRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onColorPresentation:h=>i.onRequest(P.ColorPresentationRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onFoldingRanges:h=>i.onRequest(P.FoldingRangeRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onSelectionRanges:h=>i.onRequest(P.SelectionRangeRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onExecuteCommand:h=>i.onRequest(P.ExecuteCommandRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),void 0)),dispose:()=>i.dispose()};for(let h of d)h.attach(x);return i.onRequest(P.InitializeRequest.type,h=>{e.initialize(h),Or.string(h.trace)&&(o.trace=P.Trace.fromString(h.trace));for(let m of d)m.initialize(h.capabilities);if(S){let m=S(h,new P.CancellationTokenSource().token,(0,z.attachWorkDone)(i,h),void 0);return p(m).then(b=>{if(b instanceof P.ResponseError)return b;let _=b;_||(_={capabilities:{}});let V=_.capabilities;V||(V={},_.capabilities=V),V.textDocumentSync===void 0||V.textDocumentSync===null?V.textDocumentSync=Or.number(x.__textDocumentSync)?x.__textDocumentSync:P.TextDocumentSyncKind.None:!Or.number(V.textDocumentSync)&&!Or.number(V.textDocumentSync.change)&&(V.textDocumentSync.change=Or.number(x.__textDocumentSync)?x.__textDocumentSync:P.TextDocumentSyncKind.None);for(let Ct of d)Ct.fillServerCapabilities(V);return _})}else{let m={capabilities:{textDocumentSync:P.TextDocumentSyncKind.None}};for(let b of d)b.fillServerCapabilities(m.capabilities);return m}}),i.onRequest(P.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,T)return T(new P.CancellationTokenSource().token)}),i.onNotification(P.ExitNotification.type,()=>{try{A&&A()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(P.SetTraceNotification.type,h=>{o.trace=P.Trace.fromString(h.value)}),x}ae.createConnection=OP});var Jh=$(jt=>{"use strict";var $P=jt&&jt.__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]}),iS=jt&&jt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$P(e,t,r)};Object.defineProperty(jt,"__esModule",{value:!0});jt.ProposedFeatures=jt.NotebookDocuments=jt.TextDocuments=jt.SemanticTokensBuilder=void 0;var LP=Oh();Object.defineProperty(jt,"SemanticTokensBuilder",{enumerable:!0,get:function(){return LP.SemanticTokensBuilder}});var MP=vR();iS(Qe(),jt);var FP=Lh();Object.defineProperty(jt,"TextDocuments",{enumerable:!0,get:function(){return FP.TextDocuments}});var UP=Fh();Object.defineProperty(jt,"NotebookDocuments",{enumerable:!0,get:function(){return UP.NotebookDocuments}});iS(rS(),jt);var nS;(function(t){t.all={__brand:"features",languages:MP.InlineCompletionFeature}})(nS||(jt.ProposedFeatures=nS={}))});var sS=$((CH,oS)=>{"use strict";oS.exports=Qe()});var de=$(un=>{"use strict";var qP=un&&un.__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]}),cS=un&&un.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qP(e,t,r)};Object.defineProperty(un,"__esModule",{value:!0});un.createConnection=void 0;var rl=Jh();cS(sS(),un);cS(Jh(),un);var aS=!1,jP={initialize:t=>{},get shutdownReceived(){return aS},set shutdownReceived(t){aS=t},exit:t=>{}};function GP(t,e,r,n){let i,o,s,a;t!==void 0&&t.__brand==="features"&&(i=t,t=e,e=r,r=n),rl.ConnectionStrategy.is(t)||rl.ConnectionOptions.is(t)?a=t:(o=t,s=e,a=r);let c=u=>(0,rl.createProtocolConnection)(o,s,u,a);return(0,rl.createConnection)(c,jP,i)}un.createConnection=GP});var AC=$((sue,bC)=>{"use strict";bC.exports=de()});var RC=se(de(),1);var nl=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=lS(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=uS(n.text,!1,o);if(c-a===l.length)for(let d=0,p=l.length;d<p;d++)u[d+a+1]=l[d];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 f=n.text.length-(s-o);if(f!==0)for(let d=a+1+l.length,p=u.length;d<p;d++)u[d]=u[d]+f}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=uS(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{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],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}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}},Ho;(function(t){function e(i,o,s,a){return new nl(i,o,s,a)}t.create=e;function r(i,o,s){if(i instanceof nl)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=Qh(o.map(HP),(l,f)=>{let d=l.range.start.line-f.range.start.line;return d===0?l.range.start.character-f.range.start.character:d}),c=0,u=[];for(let l of a){let f=i.offsetAt(l.range.start);if(f<c)throw new Error("Overlapping edit");f>c&&u.push(s.substring(c,f)),l.newText.length&&u.push(l.newText),c=i.offsetAt(l.range.end)}return u.push(s.substr(c)),u.join("")}t.applyEdits=n})(Ho||(Ho={}));function Qh(t,e){if(t.length<=1)return t;let r=t.length/2|0,n=t.slice(0,r),i=t.slice(r);Qh(n,e),Qh(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 uS(t,e,r=0){let n=e?[r]:[];for(let i=0;i<t.length;i++){let o=t.charCodeAt(i);(o===13||o===10)&&(o===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,n.push(r+i+1))}return n}function lS(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 HP(t){let e=lS(t.range);return e!==t.range?{newText:t.newText,range:e}:t}function ut(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function Pn(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"}function fS(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function Wo(t){return typeof t=="object"&&t!==null&&ut(t.container)&&Pn(t.reference)&&typeof t.message=="string"}var Wi=class{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,r){return ut(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 ln(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function Bi(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function dS(t){return ln(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){let r=e[Symbol.iterator]();return new t(()=>({first:this.startFn(),firstDone:!1}),n=>{let i;if(!n.firstDone){do if(i=this.nextFn(n.first),!i.done)return i;while(!i.done);n.firstDone=!0}do if(i=r.next(),!i.done)return i;while(!i.done);return Zt})}join(e=","){let r=this.iterator(),n="",i,o=!1;do i=r.next(),i.done||(o&&(n+=e),n+=WP(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(il(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(il(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){let r=new Set;return this.filter(n=>{let i=e?e(n):n;return r.has(i)?!1:(r.add(i),!0)})}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 WP(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function il(t){return!!t&&typeof t[Symbol.iterator]=="function"}var Bo=new Rr(()=>{},()=>Zt),Zt=Object.freeze({done:!0,value:void 0});function J(...t){if(t.length===1){let e=t[0];if(e instanceof Rr)return e;if(il(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++];il(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}):Bo}var $r=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}},ol;(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})(ol||(ol={}));function Zh(t){return new $r(t,e=>ln(e)?e.content:[],{includeRoot:!0})}function hS(t){return Zh(t).filter(Bi)}function gS(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function Oa(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function Gt(t){if(!t)return;let{offset:e,end:r,range:n}=t;return{range:n,offset:e,end:r,length:r-e}}var li;(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"})(li||(li={}));function BP(t,e){if(t.end.line<e.start.line||t.end.line===e.start.line&&t.end.character<t.start.character)return li.Before;if(t.start.line>e.end.line||t.start.line===e.end.line&&t.start.character>e.end.character)return li.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?li.Inside:r?li.OverlapBack:li.OverlapFront}function sl(t,e){return BP(t,e)>li.After}var eg=/^[\w\p{L}]$/u;function ht(t,e,r=eg){if(t){if(e>0){let n=e-t.offset,i=t.text.charAt(n);r.test(i)||e--}return dr(t,e)}}function yS(t,e){if(t){let r=KP(t,!0);if(r&&pS(r,e))return r;if(dS(t)){let n=t.content.findIndex(i=>!i.hidden);for(let i=n-1;i>=0;i--){let o=t.content[i];if(pS(o,e))return o}}}}function pS(t,e){return Bi(t)&&e.includes(t.tokenType.name)}function dr(t,e){if(Bi(t))return t;if(ln(t)){let r=0,n=t.content.length-1;for(;r<n;){let i=Math.floor((r+n)/2),o=t.content[i];if(o.offset>e)n=i-1;else if(o.end<=e)r=i+1;else return dr(o,e)}if(r===n)return dr(t.content[r],e)}}function KP(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 TS(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 xS(t,e){let r=zP(t,e);return r?r.parent.content.slice(r.a+1,r.b):[]}function zP(t,e){let r=mS(t),n=mS(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 mS(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()}function Ki(t,e,r,n){let i=[t,e,r,n].reduce(bS,{});return SS(i)}var tg=Symbol("isProxy");function al(t){if(t&&t[tg])for(let e of Object.values(t))al(e);return t}function SS(t,e){let r=new Proxy({},{deleteProperty:()=>!1,get:(n,i)=>RS(n,i,t,e||r),getOwnPropertyDescriptor:(n,i)=>(RS(n,i,t,e||r),Object.getOwnPropertyDescriptor(n,i)),has:(n,i)=>i in t,ownKeys:()=>[...Reflect.ownKeys(t),tg]});return r[tg]=!0,r}var vS=Symbol();function RS(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]===vS)throw new Error('Cycle detected. Please make "'+String(e)+'" lazy. See https://langium.org/docs/configuration-services/#resolving-cyclic-dependencies');return t[e]}else if(e in r){let i=r[e];t[e]=vS;try{t[e]=typeof i=="function"?i(n):SS(i,n)}catch(o){throw t[e]=o instanceof Error?o:void 0,o}return t[e]}else return}function bS(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]=bS(i,n):t[r]=n}}return t}var ye=class{constructor(e){if(this.map=new Map,e)for(let[r,n]of e)this.add(r,n)}get size(){return ol.sum(J(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 J(this.map.entries()).flatMap(([e,r])=>r.map(n=>[e,n]))}keys(){return J(this.map.keys())}values(){return J(this.map.values()).flat()}entriesGroupedByKey(){return J(this.map.entries())}};var rg="AbstractRule";var zi="AbstractType";var VP="Condition";var XP="TypeDefinition";var ng="AbstractElement";function Ko(t){return te.isInstance(t,ng)}var AS="ArrayType";function Vi(t){return te.isInstance(t,AS)}var wS="Conjunction";function kS(t){return te.isInstance(t,wS)}var ES="Disjunction";function _S(t){return te.isInstance(t,ES)}var CS="Grammar";function fi(t){return te.isInstance(t,CS)}var YP="GrammarImport";function cl(t){return te.isInstance(t,YP)}var JP="InferredType";function zo(t){return te.isInstance(t,JP)}var La="Interface";function Ht(t){return te.isInstance(t,La)}var NS="LiteralCondition";function PS(t){return te.isInstance(t,NS)}var IS="Negation";function DS(t){return te.isInstance(t,IS)}var OS="Parameter";function $S(t){return te.isInstance(t,OS)}var LS="ParameterReference";function Vo(t){return te.isInstance(t,LS)}var MS="ParserRule";function M(t){return te.isInstance(t,MS)}var FS="ReferenceType";function Xi(t){return te.isInstance(t,FS)}var QP="ReturnType";function Xo(t){return te.isInstance(t,QP)}var US="SimpleType";function Wt(t){return te.isInstance(t,US)}var ig="TerminalRule";function pe(t){return te.isInstance(t,ig)}var Ma="Type";function lt(t){return te.isInstance(t,Ma)}var ZP="TypeAttribute";function ul(t){return te.isInstance(t,ZP)}var qS="UnionType";function Lr(t){return te.isInstance(t,qS)}var jS="Action";function Te(t){return te.isInstance(t,jS)}var GS="Alternatives";function Sr(t){return te.isInstance(t,GS)}var HS="Assignment";function ce(t){return te.isInstance(t,HS)}var WS="CharacterRange";function ll(t){return te.isInstance(t,WS)}var BS="CrossReference";function Dt(t){return te.isInstance(t,BS)}var KS="EndOfFile";function fl(t){return te.isInstance(t,KS)}var zS="Group";function bt(t){return te.isInstance(t,zS)}var VS="Keyword";function Ze(t){return te.isInstance(t,VS)}var XS="NegatedToken";function YS(t){return te.isInstance(t,XS)}var JS="RegexToken";function QS(t){return te.isInstance(t,JS)}var ZS="RuleCall";function xe(t){return te.isInstance(t,ZS)}var eb="TerminalAlternatives";function tb(t){return te.isInstance(t,eb)}var rb="TerminalGroup";function nb(t){return te.isInstance(t,rb)}var ib="TerminalRuleCall";function dl(t){return te.isInstance(t,ib)}var ob="UnorderedGroup";function br(t){return te.isInstance(t,ob)}var sb="UntilToken";function ab(t){return te.isInstance(t,sb)}var cb="Wildcard";function ub(t){return te.isInstance(t,cb)}var $a=class extends Wi{getAllTypes(){return["AbstractElement","AbstractRule","AbstractType","Action","Alternatives","ArrayType","Assignment","CharacterRange","Condition","Conjunction","CrossReference","Disjunction","EndOfFile","Grammar","GrammarImport","Group","InferredType","Interface","Keyword","LiteralCondition","NamedArgument","NegatedToken","Negation","Parameter","ParameterReference","ParserRule","ReferenceType","RegexToken","ReturnType","RuleCall","SimpleType","TerminalAlternatives","TerminalGroup","TerminalRule","TerminalRuleCall","Type","TypeAttribute","TypeDefinition","UnionType","UnorderedGroup","UntilToken","Wildcard"]}computeIsSubtype(e,r){switch(e){case jS:return this.isSubtype(ng,r)||this.isSubtype(zi,r);case GS:case HS:case WS:case BS:case KS:case zS:case VS:case XS:case JS:case ZS:case eb:case rb:case ib:case ob:case sb:case cb:return this.isSubtype(ng,r);case AS:case FS:case US:case qS:return this.isSubtype(XP,r);case wS:case ES:case NS:case IS:case LS:return this.isSubtype(VP,r);case La:case Ma:return this.isSubtype(zi,r);case MS:return this.isSubtype(rg,r)||this.isSubtype(zi,r);case ig:return this.isSubtype(rg,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 zi;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return rg;case"Grammar:usedGrammars":return CS;case"NamedArgument:parameter":case"ParameterReference:parameter":return OS;case"TerminalRuleCall:rule":return ig;default:throw new Error(`${r} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case"Grammar":return{name:"Grammar",mandatory:[{name:"definesHiddenTokens",type:"boolean"},{name:"hiddenTokens",type:"array"},{name:"imports",type:"array"},{name:"interfaces",type:"array"},{name:"isDeclared",type:"boolean"},{name:"rules",type:"array"},{name:"types",type:"array"},{name:"usedGrammars",type:"array"}]};case"Interface":return{name:"Interface",mandatory:[{name:"attributes",type:"array"},{name:"superTypes",type:"array"}]};case"LiteralCondition":return{name:"LiteralCondition",mandatory:[{name:"true",type:"boolean"}]};case"NamedArgument":return{name:"NamedArgument",mandatory:[{name:"calledByName",type:"boolean"}]};case"ParserRule":return{name:"ParserRule",mandatory:[{name:"definesHiddenTokens",type:"boolean"},{name:"entry",type:"boolean"},{name:"fragment",type:"boolean"},{name:"hiddenTokens",type:"array"},{name:"parameters",type:"array"},{name:"wildcard",type:"boolean"}]};case"TerminalRule":return{name:"TerminalRule",mandatory:[{name:"fragment",type:"boolean"},{name:"hidden",type:"boolean"}]};case"TypeAttribute":return{name:"TypeAttribute",mandatory:[{name:"isOptional",type:"boolean"}]};case"UnionType":return{name:"UnionType",mandatory:[{name:"types",type:"array"}]};case"Alternatives":return{name:"Alternatives",mandatory:[{name:"elements",type:"array"}]};case"CrossReference":return{name:"CrossReference",mandatory:[{name:"deprecatedSyntax",type:"boolean"}]};case"Group":return{name:"Group",mandatory:[{name:"elements",type:"array"}]};case"RuleCall":return{name:"RuleCall",mandatory:[{name:"arguments",type:"array"}]};case"TerminalAlternatives":return{name:"TerminalAlternatives",mandatory:[{name:"elements",type:"array"}]};case"TerminalGroup":return{name:"TerminalGroup",mandatory:[{name:"elements",type:"array"}]};case"UnorderedGroup":return{name:"UnorderedGroup",mandatory:[{name:"elements",type:"array"}]};default:return{name:e,mandatory:[]}}}},te=new $a;function lb(t){for(let[e,r]of Object.entries(t))e.startsWith("$")||(Array.isArray(r)?r.forEach((n,i)=>{ut(n)&&(n.$container=t,n.$containerProperty=e,n.$containerIndex=i)}):ut(r)&&(r.$container=t,r.$containerProperty=e))}function ve(t,e){let r=t;for(;r;){if(e(r))return r;r=r.$container}}function Y(t){let r=pl(t).$document;if(!r)throw new Error("AST node has no document.");return r}function pl(t){for(;t.$container;)t=t.$container;return t}function di(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(ut(o)){if(n.keyIndex++,og(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(ut(a)&&og(a,r))return{done:!1,value:a}}n.arrayIndex=0}}n.keyIndex++}return Zt})}function Fe(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new $r(t,r=>di(r,e))}function zr(t,e){if(t){if(e?.range&&!og(t,e.range))return new $r(t,()=>[])}else throw new Error("Root node must be an AstNode.");return new $r(t,r=>di(r,e),{includeRoot:!0})}function og(t,e){var r;if(!e)return!0;let n=(r=t.$cstNode)===null||r===void 0?void 0:r.range;return n?sl(n,e):!1}function ml(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(Pn(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(Pn(o))return{done:!1,value:{reference:o,container:t,property:r,index:i}}}e.arrayIndex=0}}e.keyIndex++}return Zt})}function hl(t,e){let r=t.getTypeMetaData(e.$type),n=e;for(let i of r.mandatory){let o=n[i.name];i.type==="array"&&!Array.isArray(o)?n[i.name]=[]:i.type==="boolean"&&o===void 0&&(n[i.name]=!1)}}function fb(t){var e,r;if(t){if("astNode"in t)return rI(t);if(Array.isArray(t))return t.reduce(db,void 0);{let n=t,i=eI(n)?tI((r=(e=n?.root)===null||e===void 0?void 0:e.astNode)!==null&&r!==void 0?r:n?.astNode):void 0;return Yo(n,i)}}else return}function eI(t){return typeof t<"u"&&"element"in t&&"text"in t}function tI(t){try{return Y(t).uri.toString()}catch{return}}function rI(t){var e,r;let{astNode:n,property:i,index:o}=t??{},s=(e=n?.$cstNode)!==null&&e!==void 0?e:n?.$textRegion;if(!(n===void 0||s===void 0)){if(i===void 0)return Yo(s,sg(n));{let a=c=>o!==void 0&&o>-1&&Array.isArray(n[i])?o<c.length?c[o]:void 0:c.reduce(db,void 0);if(!((r=s.assignments)===null||r===void 0)&&r[i]){let c=a(s.assignments[i]);return c&&Yo(c,sg(n))}else if(n.$cstNode){let c=a(pi(n.$cstNode,i));return c&&Yo(c,sg(n))}else return}}}function sg(t){var e,r,n,i;return t.$cstNode?(r=(e=Y(t))===null||e===void 0?void 0:e.uri)===null||r===void 0?void 0:r.toString():t.$textRegion?t.$textRegion.documentURI||((i=(n=new $r(t,o=>o.$container?[o.$container]:[]).find(o=>{var s;return(s=o.$textRegion)===null||s===void 0?void 0:s.documentURI}))===null||n===void 0?void 0:n.$textRegion)===null||i===void 0?void 0:i.documentURI):void 0}function Yo(t,e){var r,n;let i={offset:t.offset,end:(r=t.end)!==null&&r!==void 0?r:t.offset+t.length,length:(n=t.length)!==null&&n!==void 0?n:t.end-t.offset};return t.range&&(i.range=t.range),e??(e=t.fileURI),e&&(i.fileURI=e),i}function db(t,e){var r,n;if(t){if(!e)return t&&Yo(t)}else return e&&Yo(e);let i=(r=t.end)!==null&&r!==void 0?r:t.offset+t.length,o=(n=e.end)!==null&&n!==void 0?n:e.offset+e.length,s=Math.min(t.offset,e.offset),a=Math.max(i,o),c=a-s,u={offset:s,end:a,length:c};if(t.range&&e.range&&(u.range={start:e.range.start.line<t.range.start.line||e.range.start.line===t.range.start.line&&e.range.start.character<t.range.start.character?e.range.start:t.range.start,end:e.range.end.line>t.range.end.line||e.range.end.line===t.range.end.line&&e.range.end.character>t.range.end.character?e.range.end:t.range.end}),t.fileURI||e.fileURI){let l=t.fileURI,f=e.fileURI,d=l&&f&&l!==f?`<unmergable text regions of ${l}, ${f}>`:l??f;u.fileURI=d}return u}var ag=class{constructor(e){this.defaultIndentation=" ",this.pendingIndent=!0,this.currentIndents=[],this.recentNonImmediateIndents=[],this.traceData=[],this.lines=[[]],typeof e=="string"?this.defaultIndentation=e:typeof e=="number"&&(this.defaultIndentation="".padStart(e))}get content(){return this.lines.map(e=>e.join("")).join("")}get currentLineNumber(){return this.lines.length-1}get currentLineContent(){return this.lines[this.currentLineNumber].join("")}get currentPosition(){return{offset:this.content.length,line:this.currentLineNumber,character:this.currentLineContent.length}}append(e,r){if(e.length>0){let n=r&&this.currentPosition;this.lines[this.currentLineNumber].push(e),n&&this.indentPendingTraceRegions(n)}}indentPendingTraceRegions(e){for(let r=this.traceData.length-1;r>=0;r--){let n=this.traceData[r];n.targetStart&&n.targetStart.offset===e.offset&&(n.targetStart=this.currentPosition)}}increaseIndent(e){this.currentIndents.push(e),e.indentImmediately||this.recentNonImmediateIndents.push(e)}decreaseIndent(){this.currentIndents.pop()}get relevantIndents(){return this.currentIndents.filter(e=>!this.recentNonImmediateIndents.includes(e))}resetCurrentLine(){this.lines[this.currentLineNumber]=[],this.pendingIndent=!0}addNewLine(){this.pendingIndent=!0,this.lines.push([]),this.recentNonImmediateIndents.length=0}pushTraceRegion(e){let r=nI(e,this.currentPosition,n=>{var i,o;return(o=(i=this.traceData[this.traceData.length-1])===null||i===void 0?void 0:i.children)===null||o===void 0?void 0:o.push(n)});return this.traceData.push(r),r}popTraceRegion(e){let r=this.traceData.pop();return this.assertTrue(r===e,"Trace region mismatch!"),r}getParentTraceSourceFileURI(){var e;for(let r=this.traceData.length-1;r>-1;r--){let n=(e=this.traceData[r].sourceRegion)===null||e===void 0?void 0:e.fileURI;if(n)return n}}assertTrue(e,r){if(!e)throw new Error(r)}};function nI(t,e,r){let n={sourceRegion:t,targetRegion:void 0,children:[],targetStart:e,complete:i=>{var o,s;return n.targetRegion={offset:n.targetStart.offset,end:i.offset,length:i.offset-n.targetStart.offset,range:{start:{line:n.targetStart.line,character:n.targetStart.character},end:{line:i.line,character:i.character}}},delete n.targetStart,((o=n.children)===null||o===void 0?void 0:o.length)===0&&delete n.children,!((s=n.targetRegion)===null||s===void 0)&&s.length&&r(n),delete n.complete,n}};return n}function pb(t,e){let r=new ag(e),n=r.pushTraceRegion(void 0);mb(t,r),r.popTraceRegion(n),n.complete&&n.complete(r.currentPosition);let i=n.children&&n.children.length===1?n.children[0]:void 0,o=i?.targetRegion,s=n.targetRegion;return o&&i.sourceRegion&&o.offset===s.offset&&o.length===s.length?{text:r.content,trace:i}:{text:r.content,trace:n}}function mb(t,e){typeof t=="string"?iI(t,e):t instanceof Jo?oI(t,e):t instanceof Ot?yb(t,e):t instanceof mi&&sI(t,e)}function hb(t,e){return typeof t=="string"?t.length!==0:t instanceof Ot?t.contents.some(r=>hb(r,e)):t instanceof mi?!(t.ifNotEmpty&&e.currentLineContent.length===0):!1}function iI(t,e){t&&(e.pendingIndent&&gb(e,!1),e.append(t))}function gb(t,e){var r;let n="";for(let i of t.relevantIndents.filter(o=>o.indentEmptyLines||!e))n+=(r=i.indentation)!==null&&r!==void 0?r:t.defaultIndentation;t.append(n,!0),t.pendingIndent=!1}function yb(t,e){let r,n=fb(t.tracedSource);n&&(r=e.pushTraceRegion(n));for(let i of t.contents)mb(i,e);if(r){e.popTraceRegion(r);let i=e.getParentTraceSourceFileURI();i&&n?.fileURI===i&&delete n.fileURI,r.complete&&r.complete(e.currentPosition)}}function oI(t,e){var r;if(hb(t,e)){t.indentImmediately&&!e.pendingIndent&&e.append((r=t.indentation)!==null&&r!==void 0?r:e.defaultIndentation,!0);try{e.increaseIndent(t),yb(t,e)}finally{e.decreaseIndent()}}}function sI(t,e){t.ifNotEmpty&&!aI(e.currentLineContent)?e.resetCurrentLine():(e.pendingIndent&&gb(e,!0),e.append(t.lineDelimiter),e.addNewLine())}function aI(t){return t.trimStart()!==""}var ZH=Object.freeze("__\xABSKIP^NEW^LINE^IF^EMPTY\xBB__"),Fa=/\r?\n/gm,cI=/\S|$/;function Tb(t){let e=t.filter(n=>n.length>0).map(n=>n.search(cI)),r=e.length===0?0:Math.min(...e);return Math.max(0,r)}function ug(t,...e){let r=uI(t),n=lI(t,e,r);return dI(n)}function Rb(t,e,r){return(n,...i)=>lg(t,e,r)(ug(n,...i))}function uI(t){let e=t.join("_").split(Fa),r=e.length>1&&e[0].trim().length===0,n=r&&e.length>1&&e[e.length-1].trim().length===0;if(e.length===1||e.length!==0&&e[0].trim().length!==0||e.length===2&&e[1].trim().length===0)return{indentation:0,omitFirstLine:r,omitLastLine:n,trimLastLine:e.length!==1&&e[e.length-1].trim().length===0};{let i=r?e.slice(1):e;i=n?i.slice(0,i.length-1):i,i=i.filter(s=>s.length!==0);let o=Tb(i);return{indentation:o,omitFirstLine:r,omitLastLine:n&&(e[e.length-1].length<o||!e[e.length-1].startsWith(i[0].substring(0,o)))}}}function lI(t,e,{indentation:r,omitFirstLine:n,omitLastLine:i,trimLastLine:o}){let s=[];t.forEach((u,l)=>{s.push(...u.split(Fa).map((f,d)=>d===0||f.length<r?f:f.substring(r)).reduce(l===0?(f,d,p)=>p===0?n?[]:[d]:p===1&&f.length===0?[d]:f.concat(gl,d):(f,d,p)=>p===0?[d]:f.concat(gl,d),[]).filter(f=>!(typeof f=="string"&&f.length===0)).concat(Zo(e[l])?e[l]:e[l]!==void 0?{content:String(e[l])}:l<e.length?Sb:[]))});let a=s.length,c=a!==0?s[a-1]:void 0;return(i||o)&&typeof c=="string"&&c.trim().length===0?n&&a!==1&&s[a-2]===gl?s.slice(0,a-2):s.slice(0,a-1):s}var gl={isNewLine:!0},Sb={isUndefinedSegment:!0},vb=t=>t===gl,cg=t=>t===Sb,fI=t=>t.content!==void 0;function dI(t){return t.reduce((r,n,i)=>cg(n)?r:vb(n)?{node:i!==0&&(cg(t[i-1])||Zo(t[i-1]))||i>1&&typeof t[i-1]=="string"&&(cg(t[i-2])||Zo(t[i-2]))?r.node.appendNewLineIfNotEmpty():r.node.appendNewLine()}:(()=>{var o;let s=(i===0||vb(t[i-1]))&&typeof n=="string"&&n.length!==0?"".padStart(n.length-n.trimStart().length):"",a=fI(n)?n.content:n,c;return{node:r.indented?r.node:s.length!==0?r.node.indent({indentation:s,indentImmediately:!1,indentedChildren:u=>c=u.append(a)}):r.node.append(a),indented:c??((o=r.indented)===null||o===void 0?void 0:o.append(a))}})(),{node:new Ot}).node}var xb=typeof process>"u"?`
|
|
35
|
+
`&&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 Qt.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 Qt.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}};(function(t){let e=Object.prototype.toString;function r(p){return typeof p<"u"}t.defined=r;function n(p){return typeof p>"u"}t.undefined=n;function i(p){return p===!0||p===!1}t.boolean=i;function o(p){return e.call(p)==="[object String]"}t.string=o;function s(p){return e.call(p)==="[object Number]"}t.number=s;function a(p,T,R){return e.call(p)==="[object Number]"&&T<=p&&p<=R}t.numberRange=a;function c(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}t.integer=c;function u(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}t.uinteger=u;function l(p){return e.call(p)==="[object Function]"}t.func=l;function f(p){return p!==null&&typeof p=="object"}t.objectLiteral=f;function d(p,T){return Array.isArray(p)&&p.every(T)}t.typedArray=d})(v||(v={}))});var Me=$(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.ProtocolNotificationType=cr.ProtocolNotificationType0=cr.ProtocolRequestType=cr.ProtocolRequestType0=cr.RegistrationType=cr.MessageDirection=void 0;var No=kn(),ST;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(ST||(cr.MessageDirection=ST={}));var yh=class{constructor(e){this.method=e}};cr.RegistrationType=yh;var Th=class extends No.RequestType0{constructor(e){super(e)}};cr.ProtocolRequestType0=Th;var xh=class extends No.RequestType{constructor(e){super(e,No.ParameterStructures.byName)}};cr.ProtocolRequestType=xh;var vh=class extends No.NotificationType0{constructor(e){super(e)}};cr.ProtocolNotificationType0=vh;var Rh=class extends No.NotificationType{constructor(e){super(e,No.ParameterStructures.byName)}};cr.ProtocolNotificationType=Rh});var du=$(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.objectLiteral=at.typedArray=at.stringArray=at.array=at.func=at.error=at.number=at.string=at.boolean=void 0;function TN(t){return t===!0||t===!1}at.boolean=TN;function bT(t){return typeof t=="string"||t instanceof String}at.string=bT;function xN(t){return typeof t=="number"||t instanceof Number}at.number=xN;function vN(t){return t instanceof Error}at.error=vN;function RN(t){return typeof t=="function"}at.func=RN;function AT(t){return Array.isArray(t)}at.array=AT;function SN(t){return AT(t)&&t.every(e=>bT(e))}at.stringArray=SN;function bN(t,e){return Array.isArray(t)&&t.every(e)}at.typedArray=bN;function AN(t){return t!==null&&typeof t=="object"}at.objectLiteral=AN});var ET=$(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu.ImplementationRequest=void 0;var wT=Me(),kT;(function(t){t.method="textDocument/implementation",t.messageDirection=wT.MessageDirection.clientToServer,t.type=new wT.ProtocolRequestType(t.method)})(kT||(pu.ImplementationRequest=kT={}))});var NT=$(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.TypeDefinitionRequest=void 0;var _T=Me(),CT;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=_T.MessageDirection.clientToServer,t.type=new _T.ProtocolRequestType(t.method)})(CT||(mu.TypeDefinitionRequest=CT={}))});var DT=$(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.DidChangeWorkspaceFoldersNotification=Po.WorkspaceFoldersRequest=void 0;var hu=Me(),PT;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=hu.MessageDirection.serverToClient,t.type=new hu.ProtocolRequestType0(t.method)})(PT||(Po.WorkspaceFoldersRequest=PT={}));var IT;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=hu.MessageDirection.clientToServer,t.type=new hu.ProtocolNotificationType(t.method)})(IT||(Po.DidChangeWorkspaceFoldersNotification=IT={}))});var LT=$(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.ConfigurationRequest=void 0;var OT=Me(),$T;(function(t){t.method="workspace/configuration",t.messageDirection=OT.MessageDirection.serverToClient,t.type=new OT.ProtocolRequestType(t.method)})($T||(gu.ConfigurationRequest=$T={}))});var UT=$(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.ColorPresentationRequest=Io.DocumentColorRequest=void 0;var yu=Me(),MT;(function(t){t.method="textDocument/documentColor",t.messageDirection=yu.MessageDirection.clientToServer,t.type=new yu.ProtocolRequestType(t.method)})(MT||(Io.DocumentColorRequest=MT={}));var FT;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=yu.MessageDirection.clientToServer,t.type=new yu.ProtocolRequestType(t.method)})(FT||(Io.ColorPresentationRequest=FT={}))});var GT=$(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.FoldingRangeRefreshRequest=Do.FoldingRangeRequest=void 0;var Tu=Me(),qT;(function(t){t.method="textDocument/foldingRange",t.messageDirection=Tu.MessageDirection.clientToServer,t.type=new Tu.ProtocolRequestType(t.method)})(qT||(Do.FoldingRangeRequest=qT={}));var jT;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=Tu.MessageDirection.serverToClient,t.type=new Tu.ProtocolRequestType0(t.method)})(jT||(Do.FoldingRangeRefreshRequest=jT={}))});var BT=$(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.DeclarationRequest=void 0;var HT=Me(),WT;(function(t){t.method="textDocument/declaration",t.messageDirection=HT.MessageDirection.clientToServer,t.type=new HT.ProtocolRequestType(t.method)})(WT||(xu.DeclarationRequest=WT={}))});var VT=$(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.SelectionRangeRequest=void 0;var KT=Me(),zT;(function(t){t.method="textDocument/selectionRange",t.messageDirection=KT.MessageDirection.clientToServer,t.type=new KT.ProtocolRequestType(t.method)})(zT||(vu.SelectionRangeRequest=zT={}))});var QT=$(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.WorkDoneProgressCancelNotification=ti.WorkDoneProgressCreateRequest=ti.WorkDoneProgress=void 0;var wN=kn(),Ru=Me(),XT;(function(t){t.type=new wN.ProgressType;function e(r){return r===t.type}t.is=e})(XT||(ti.WorkDoneProgress=XT={}));var YT;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=Ru.MessageDirection.serverToClient,t.type=new Ru.ProtocolRequestType(t.method)})(YT||(ti.WorkDoneProgressCreateRequest=YT={}));var JT;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=Ru.MessageDirection.clientToServer,t.type=new Ru.ProtocolNotificationType(t.method)})(JT||(ti.WorkDoneProgressCancelNotification=JT={}))});var rx=$(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.CallHierarchyOutgoingCallsRequest=ri.CallHierarchyIncomingCallsRequest=ri.CallHierarchyPrepareRequest=void 0;var Oo=Me(),ZT;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=Oo.MessageDirection.clientToServer,t.type=new Oo.ProtocolRequestType(t.method)})(ZT||(ri.CallHierarchyPrepareRequest=ZT={}));var ex;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=Oo.MessageDirection.clientToServer,t.type=new Oo.ProtocolRequestType(t.method)})(ex||(ri.CallHierarchyIncomingCallsRequest=ex={}));var tx;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=Oo.MessageDirection.clientToServer,t.type=new Oo.ProtocolRequestType(t.method)})(tx||(ri.CallHierarchyOutgoingCallsRequest=tx={}))});var cx=$(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.SemanticTokensRefreshRequest=ur.SemanticTokensRangeRequest=ur.SemanticTokensDeltaRequest=ur.SemanticTokensRequest=ur.SemanticTokensRegistrationType=ur.TokenFormat=void 0;var _n=Me(),nx;(function(t){t.Relative="relative"})(nx||(ur.TokenFormat=nx={}));var ka;(function(t){t.method="textDocument/semanticTokens",t.type=new _n.RegistrationType(t.method)})(ka||(ur.SemanticTokensRegistrationType=ka={}));var ix;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=_n.MessageDirection.clientToServer,t.type=new _n.ProtocolRequestType(t.method),t.registrationMethod=ka.method})(ix||(ur.SemanticTokensRequest=ix={}));var ox;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=_n.MessageDirection.clientToServer,t.type=new _n.ProtocolRequestType(t.method),t.registrationMethod=ka.method})(ox||(ur.SemanticTokensDeltaRequest=ox={}));var sx;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=_n.MessageDirection.clientToServer,t.type=new _n.ProtocolRequestType(t.method),t.registrationMethod=ka.method})(sx||(ur.SemanticTokensRangeRequest=sx={}));var ax;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=_n.MessageDirection.serverToClient,t.type=new _n.ProtocolRequestType0(t.method)})(ax||(ur.SemanticTokensRefreshRequest=ax={}))});var fx=$(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.ShowDocumentRequest=void 0;var ux=Me(),lx;(function(t){t.method="window/showDocument",t.messageDirection=ux.MessageDirection.serverToClient,t.type=new ux.ProtocolRequestType(t.method)})(lx||(Su.ShowDocumentRequest=lx={}))});var mx=$(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});bu.LinkedEditingRangeRequest=void 0;var dx=Me(),px;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=dx.MessageDirection.clientToServer,t.type=new dx.ProtocolRequestType(t.method)})(px||(bu.LinkedEditingRangeRequest=px={}))});var Sx=$(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 Cr=Me(),hx;(function(t){t.file="file",t.folder="folder"})(hx||(qt.FileOperationPatternKind=hx={}));var gx;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=Cr.MessageDirection.clientToServer,t.type=new Cr.ProtocolRequestType(t.method)})(gx||(qt.WillCreateFilesRequest=gx={}));var yx;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=Cr.MessageDirection.clientToServer,t.type=new Cr.ProtocolNotificationType(t.method)})(yx||(qt.DidCreateFilesNotification=yx={}));var Tx;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=Cr.MessageDirection.clientToServer,t.type=new Cr.ProtocolRequestType(t.method)})(Tx||(qt.WillRenameFilesRequest=Tx={}));var xx;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=Cr.MessageDirection.clientToServer,t.type=new Cr.ProtocolNotificationType(t.method)})(xx||(qt.DidRenameFilesNotification=xx={}));var vx;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=Cr.MessageDirection.clientToServer,t.type=new Cr.ProtocolNotificationType(t.method)})(vx||(qt.DidDeleteFilesNotification=vx={}));var Rx;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=Cr.MessageDirection.clientToServer,t.type=new Cr.ProtocolRequestType(t.method)})(Rx||(qt.WillDeleteFilesRequest=Rx={}))});var Ex=$(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.MonikerRequest=ni.MonikerKind=ni.UniquenessLevel=void 0;var bx=Me(),Ax;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(Ax||(ni.UniquenessLevel=Ax={}));var wx;(function(t){t.$import="import",t.$export="export",t.local="local"})(wx||(ni.MonikerKind=wx={}));var kx;(function(t){t.method="textDocument/moniker",t.messageDirection=bx.MessageDirection.clientToServer,t.type=new bx.ProtocolRequestType(t.method)})(kx||(ni.MonikerRequest=kx={}))});var Px=$(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.TypeHierarchySubtypesRequest=ii.TypeHierarchySupertypesRequest=ii.TypeHierarchyPrepareRequest=void 0;var $o=Me(),_x;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=$o.MessageDirection.clientToServer,t.type=new $o.ProtocolRequestType(t.method)})(_x||(ii.TypeHierarchyPrepareRequest=_x={}));var Cx;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=$o.MessageDirection.clientToServer,t.type=new $o.ProtocolRequestType(t.method)})(Cx||(ii.TypeHierarchySupertypesRequest=Cx={}));var Nx;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=$o.MessageDirection.clientToServer,t.type=new $o.ProtocolRequestType(t.method)})(Nx||(ii.TypeHierarchySubtypesRequest=Nx={}))});var Ox=$(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.InlineValueRefreshRequest=Lo.InlineValueRequest=void 0;var Au=Me(),Ix;(function(t){t.method="textDocument/inlineValue",t.messageDirection=Au.MessageDirection.clientToServer,t.type=new Au.ProtocolRequestType(t.method)})(Ix||(Lo.InlineValueRequest=Ix={}));var Dx;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=Au.MessageDirection.serverToClient,t.type=new Au.ProtocolRequestType0(t.method)})(Dx||(Lo.InlineValueRefreshRequest=Dx={}))});var Fx=$(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.InlayHintRefreshRequest=oi.InlayHintResolveRequest=oi.InlayHintRequest=void 0;var Mo=Me(),$x;(function(t){t.method="textDocument/inlayHint",t.messageDirection=Mo.MessageDirection.clientToServer,t.type=new Mo.ProtocolRequestType(t.method)})($x||(oi.InlayHintRequest=$x={}));var Lx;(function(t){t.method="inlayHint/resolve",t.messageDirection=Mo.MessageDirection.clientToServer,t.type=new Mo.ProtocolRequestType(t.method)})(Lx||(oi.InlayHintResolveRequest=Lx={}));var Mx;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=Mo.MessageDirection.serverToClient,t.type=new Mo.ProtocolRequestType0(t.method)})(Mx||(oi.InlayHintRefreshRequest=Mx={}))});var Bx=$(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.DiagnosticRefreshRequest=Nr.WorkspaceDiagnosticRequest=Nr.DocumentDiagnosticRequest=Nr.DocumentDiagnosticReportKind=Nr.DiagnosticServerCancellationData=void 0;var Wx=kn(),kN=du(),Fo=Me(),Ux;(function(t){function e(r){let n=r;return n&&kN.boolean(n.retriggerRequest)}t.is=e})(Ux||(Nr.DiagnosticServerCancellationData=Ux={}));var qx;(function(t){t.Full="full",t.Unchanged="unchanged"})(qx||(Nr.DocumentDiagnosticReportKind=qx={}));var jx;(function(t){t.method="textDocument/diagnostic",t.messageDirection=Fo.MessageDirection.clientToServer,t.type=new Fo.ProtocolRequestType(t.method),t.partialResult=new Wx.ProgressType})(jx||(Nr.DocumentDiagnosticRequest=jx={}));var Gx;(function(t){t.method="workspace/diagnostic",t.messageDirection=Fo.MessageDirection.clientToServer,t.type=new Fo.ProtocolRequestType(t.method),t.partialResult=new Wx.ProgressType})(Gx||(Nr.WorkspaceDiagnosticRequest=Gx={}));var Hx;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=Fo.MessageDirection.serverToClient,t.type=new Fo.ProtocolRequestType0(t.method)})(Hx||(Nr.DiagnosticRefreshRequest=Hx={}))});var Qx=$(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.DidCloseNotebookDocumentNotification=Je.DidSaveNotebookDocumentNotification=Je.DidChangeNotebookDocumentNotification=Je.NotebookCellArrayChange=Je.DidOpenNotebookDocumentNotification=Je.NotebookDocumentSyncRegistrationType=Je.NotebookDocument=Je.NotebookCell=Je.ExecutionSummary=Je.NotebookCellKind=void 0;var Ea=(ji(),ap(fu)),Br=du(),on=Me(),Sh;(function(t){t.Markup=1,t.Code=2;function e(r){return r===1||r===2}t.is=e})(Sh||(Je.NotebookCellKind=Sh={}));var bh;(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 Br.objectLiteral(o)&&Ea.uinteger.is(o.executionOrder)&&(o.success===void 0||Br.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})(bh||(Je.ExecutionSummary=bh={}));var wu;(function(t){function e(o,s){return{kind:o,document:s}}t.create=e;function r(o){let s=o;return Br.objectLiteral(s)&&Sh.is(s.kind)&&Ea.DocumentUri.is(s.document)&&(s.metadata===void 0||Br.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)&&!bh.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(Br.objectLiteral(o)&&Br.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 f=0;f<u.length;f++){let d=u[f];if(!i(o[d],s[d]))return!1}}return!0}})(wu||(Je.NotebookCell=wu={}));var Kx;(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 Br.objectLiteral(i)&&Br.string(i.uri)&&Ea.integer.is(i.version)&&Br.typedArray(i.cells,wu.is)}t.is=r})(Kx||(Je.NotebookDocument=Kx={}));var Uo;(function(t){t.method="notebookDocument/sync",t.messageDirection=on.MessageDirection.clientToServer,t.type=new on.RegistrationType(t.method)})(Uo||(Je.NotebookDocumentSyncRegistrationType=Uo={}));var zx;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=on.MessageDirection.clientToServer,t.type=new on.ProtocolNotificationType(t.method),t.registrationMethod=Uo.method})(zx||(Je.DidOpenNotebookDocumentNotification=zx={}));var Vx;(function(t){function e(n){let i=n;return Br.objectLiteral(i)&&Ea.uinteger.is(i.start)&&Ea.uinteger.is(i.deleteCount)&&(i.cells===void 0||Br.typedArray(i.cells,wu.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})(Vx||(Je.NotebookCellArrayChange=Vx={}));var Xx;(function(t){t.method="notebookDocument/didChange",t.messageDirection=on.MessageDirection.clientToServer,t.type=new on.ProtocolNotificationType(t.method),t.registrationMethod=Uo.method})(Xx||(Je.DidChangeNotebookDocumentNotification=Xx={}));var Yx;(function(t){t.method="notebookDocument/didSave",t.messageDirection=on.MessageDirection.clientToServer,t.type=new on.ProtocolNotificationType(t.method),t.registrationMethod=Uo.method})(Yx||(Je.DidSaveNotebookDocumentNotification=Yx={}));var Jx;(function(t){t.method="notebookDocument/didClose",t.messageDirection=on.MessageDirection.clientToServer,t.type=new on.ProtocolNotificationType(t.method),t.registrationMethod=Uo.method})(Jx||(Je.DidCloseNotebookDocumentNotification=Jx={}))});var tv=$(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.InlineCompletionRequest=void 0;var Zx=Me(),ev;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=Zx.MessageDirection.clientToServer,t.type=new Zx.ProtocolRequestType(t.method)})(ev||(ku.InlineCompletionRequest=ev={}))});var mR=$(g=>{"use strict";Object.defineProperty(g,"__esModule",{value:!0});g.WorkspaceSymbolRequest=g.CodeActionResolveRequest=g.CodeActionRequest=g.DocumentSymbolRequest=g.DocumentHighlightRequest=g.ReferencesRequest=g.DefinitionRequest=g.SignatureHelpRequest=g.SignatureHelpTriggerKind=g.HoverRequest=g.CompletionResolveRequest=g.CompletionRequest=g.CompletionTriggerKind=g.PublishDiagnosticsNotification=g.WatchKind=g.RelativePattern=g.FileChangeType=g.DidChangeWatchedFilesNotification=g.WillSaveTextDocumentWaitUntilRequest=g.WillSaveTextDocumentNotification=g.TextDocumentSaveReason=g.DidSaveTextDocumentNotification=g.DidCloseTextDocumentNotification=g.DidChangeTextDocumentNotification=g.TextDocumentContentChangeEvent=g.DidOpenTextDocumentNotification=g.TextDocumentSyncKind=g.TelemetryEventNotification=g.LogMessageNotification=g.ShowMessageRequest=g.ShowMessageNotification=g.MessageType=g.DidChangeConfigurationNotification=g.ExitNotification=g.ShutdownRequest=g.InitializedNotification=g.InitializeErrorCodes=g.InitializeRequest=g.WorkDoneProgressOptions=g.TextDocumentRegistrationOptions=g.StaticRegistrationOptions=g.PositionEncodingKind=g.FailureHandlingKind=g.ResourceOperationKind=g.UnregistrationRequest=g.RegistrationRequest=g.DocumentSelector=g.NotebookCellTextDocumentFilter=g.NotebookDocumentFilter=g.TextDocumentFilter=void 0;g.MonikerRequest=g.MonikerKind=g.UniquenessLevel=g.WillDeleteFilesRequest=g.DidDeleteFilesNotification=g.WillRenameFilesRequest=g.DidRenameFilesNotification=g.WillCreateFilesRequest=g.DidCreateFilesNotification=g.FileOperationPatternKind=g.LinkedEditingRangeRequest=g.ShowDocumentRequest=g.SemanticTokensRegistrationType=g.SemanticTokensRefreshRequest=g.SemanticTokensRangeRequest=g.SemanticTokensDeltaRequest=g.SemanticTokensRequest=g.TokenFormat=g.CallHierarchyPrepareRequest=g.CallHierarchyOutgoingCallsRequest=g.CallHierarchyIncomingCallsRequest=g.WorkDoneProgressCancelNotification=g.WorkDoneProgressCreateRequest=g.WorkDoneProgress=g.SelectionRangeRequest=g.DeclarationRequest=g.FoldingRangeRefreshRequest=g.FoldingRangeRequest=g.ColorPresentationRequest=g.DocumentColorRequest=g.ConfigurationRequest=g.DidChangeWorkspaceFoldersNotification=g.WorkspaceFoldersRequest=g.TypeDefinitionRequest=g.ImplementationRequest=g.ApplyWorkspaceEditRequest=g.ExecuteCommandRequest=g.PrepareRenameRequest=g.RenameRequest=g.PrepareSupportDefaultBehavior=g.DocumentOnTypeFormattingRequest=g.DocumentRangesFormattingRequest=g.DocumentRangeFormattingRequest=g.DocumentFormattingRequest=g.DocumentLinkResolveRequest=g.DocumentLinkRequest=g.CodeLensRefreshRequest=g.CodeLensResolveRequest=g.CodeLensRequest=g.WorkspaceSymbolResolveRequest=void 0;g.InlineCompletionRequest=g.DidCloseNotebookDocumentNotification=g.DidSaveNotebookDocumentNotification=g.DidChangeNotebookDocumentNotification=g.NotebookCellArrayChange=g.DidOpenNotebookDocumentNotification=g.NotebookDocumentSyncRegistrationType=g.NotebookDocument=g.NotebookCell=g.ExecutionSummary=g.NotebookCellKind=g.DiagnosticRefreshRequest=g.WorkspaceDiagnosticRequest=g.DocumentDiagnosticRequest=g.DocumentDiagnosticReportKind=g.DiagnosticServerCancellationData=g.InlayHintRefreshRequest=g.InlayHintResolveRequest=g.InlayHintRequest=g.InlineValueRefreshRequest=g.InlineValueRequest=g.TypeHierarchySupertypesRequest=g.TypeHierarchySubtypesRequest=g.TypeHierarchyPrepareRequest=void 0;var E=Me(),rv=(ji(),ap(fu)),St=du(),EN=ET();Object.defineProperty(g,"ImplementationRequest",{enumerable:!0,get:function(){return EN.ImplementationRequest}});var _N=NT();Object.defineProperty(g,"TypeDefinitionRequest",{enumerable:!0,get:function(){return _N.TypeDefinitionRequest}});var lR=DT();Object.defineProperty(g,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return lR.WorkspaceFoldersRequest}});Object.defineProperty(g,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return lR.DidChangeWorkspaceFoldersNotification}});var CN=LT();Object.defineProperty(g,"ConfigurationRequest",{enumerable:!0,get:function(){return CN.ConfigurationRequest}});var fR=UT();Object.defineProperty(g,"DocumentColorRequest",{enumerable:!0,get:function(){return fR.DocumentColorRequest}});Object.defineProperty(g,"ColorPresentationRequest",{enumerable:!0,get:function(){return fR.ColorPresentationRequest}});var dR=GT();Object.defineProperty(g,"FoldingRangeRequest",{enumerable:!0,get:function(){return dR.FoldingRangeRequest}});Object.defineProperty(g,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return dR.FoldingRangeRefreshRequest}});var NN=BT();Object.defineProperty(g,"DeclarationRequest",{enumerable:!0,get:function(){return NN.DeclarationRequest}});var PN=VT();Object.defineProperty(g,"SelectionRangeRequest",{enumerable:!0,get:function(){return PN.SelectionRangeRequest}});var _h=QT();Object.defineProperty(g,"WorkDoneProgress",{enumerable:!0,get:function(){return _h.WorkDoneProgress}});Object.defineProperty(g,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return _h.WorkDoneProgressCreateRequest}});Object.defineProperty(g,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return _h.WorkDoneProgressCancelNotification}});var Ch=rx();Object.defineProperty(g,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return Ch.CallHierarchyIncomingCallsRequest}});Object.defineProperty(g,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return Ch.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(g,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return Ch.CallHierarchyPrepareRequest}});var qo=cx();Object.defineProperty(g,"TokenFormat",{enumerable:!0,get:function(){return qo.TokenFormat}});Object.defineProperty(g,"SemanticTokensRequest",{enumerable:!0,get:function(){return qo.SemanticTokensRequest}});Object.defineProperty(g,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return qo.SemanticTokensDeltaRequest}});Object.defineProperty(g,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return qo.SemanticTokensRangeRequest}});Object.defineProperty(g,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return qo.SemanticTokensRefreshRequest}});Object.defineProperty(g,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return qo.SemanticTokensRegistrationType}});var IN=fx();Object.defineProperty(g,"ShowDocumentRequest",{enumerable:!0,get:function(){return IN.ShowDocumentRequest}});var DN=mx();Object.defineProperty(g,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return DN.LinkedEditingRangeRequest}});var Gi=Sx();Object.defineProperty(g,"FileOperationPatternKind",{enumerable:!0,get:function(){return Gi.FileOperationPatternKind}});Object.defineProperty(g,"DidCreateFilesNotification",{enumerable:!0,get:function(){return Gi.DidCreateFilesNotification}});Object.defineProperty(g,"WillCreateFilesRequest",{enumerable:!0,get:function(){return Gi.WillCreateFilesRequest}});Object.defineProperty(g,"DidRenameFilesNotification",{enumerable:!0,get:function(){return Gi.DidRenameFilesNotification}});Object.defineProperty(g,"WillRenameFilesRequest",{enumerable:!0,get:function(){return Gi.WillRenameFilesRequest}});Object.defineProperty(g,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return Gi.DidDeleteFilesNotification}});Object.defineProperty(g,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return Gi.WillDeleteFilesRequest}});var Nh=Ex();Object.defineProperty(g,"UniquenessLevel",{enumerable:!0,get:function(){return Nh.UniquenessLevel}});Object.defineProperty(g,"MonikerKind",{enumerable:!0,get:function(){return Nh.MonikerKind}});Object.defineProperty(g,"MonikerRequest",{enumerable:!0,get:function(){return Nh.MonikerRequest}});var Ph=Px();Object.defineProperty(g,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return Ph.TypeHierarchyPrepareRequest}});Object.defineProperty(g,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return Ph.TypeHierarchySubtypesRequest}});Object.defineProperty(g,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return Ph.TypeHierarchySupertypesRequest}});var pR=Ox();Object.defineProperty(g,"InlineValueRequest",{enumerable:!0,get:function(){return pR.InlineValueRequest}});Object.defineProperty(g,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return pR.InlineValueRefreshRequest}});var Ih=Fx();Object.defineProperty(g,"InlayHintRequest",{enumerable:!0,get:function(){return Ih.InlayHintRequest}});Object.defineProperty(g,"InlayHintResolveRequest",{enumerable:!0,get:function(){return Ih.InlayHintResolveRequest}});Object.defineProperty(g,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return Ih.InlayHintRefreshRequest}});var _a=Bx();Object.defineProperty(g,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return _a.DiagnosticServerCancellationData}});Object.defineProperty(g,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return _a.DocumentDiagnosticReportKind}});Object.defineProperty(g,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return _a.DocumentDiagnosticRequest}});Object.defineProperty(g,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return _a.WorkspaceDiagnosticRequest}});Object.defineProperty(g,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return _a.DiagnosticRefreshRequest}});var sn=Qx();Object.defineProperty(g,"NotebookCellKind",{enumerable:!0,get:function(){return sn.NotebookCellKind}});Object.defineProperty(g,"ExecutionSummary",{enumerable:!0,get:function(){return sn.ExecutionSummary}});Object.defineProperty(g,"NotebookCell",{enumerable:!0,get:function(){return sn.NotebookCell}});Object.defineProperty(g,"NotebookDocument",{enumerable:!0,get:function(){return sn.NotebookDocument}});Object.defineProperty(g,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return sn.NotebookDocumentSyncRegistrationType}});Object.defineProperty(g,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return sn.DidOpenNotebookDocumentNotification}});Object.defineProperty(g,"NotebookCellArrayChange",{enumerable:!0,get:function(){return sn.NotebookCellArrayChange}});Object.defineProperty(g,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return sn.DidChangeNotebookDocumentNotification}});Object.defineProperty(g,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return sn.DidSaveNotebookDocumentNotification}});Object.defineProperty(g,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return sn.DidCloseNotebookDocumentNotification}});var ON=tv();Object.defineProperty(g,"InlineCompletionRequest",{enumerable:!0,get:function(){return ON.InlineCompletionRequest}});var Ah;(function(t){function e(r){let n=r;return St.string(n)||St.string(n.language)||St.string(n.scheme)||St.string(n.pattern)}t.is=e})(Ah||(g.TextDocumentFilter=Ah={}));var wh;(function(t){function e(r){let n=r;return St.objectLiteral(n)&&(St.string(n.notebookType)||St.string(n.scheme)||St.string(n.pattern))}t.is=e})(wh||(g.NotebookDocumentFilter=wh={}));var kh;(function(t){function e(r){let n=r;return St.objectLiteral(n)&&(St.string(n.notebook)||wh.is(n.notebook))&&(n.language===void 0||St.string(n.language))}t.is=e})(kh||(g.NotebookCellTextDocumentFilter=kh={}));var Eh;(function(t){function e(r){if(!Array.isArray(r))return!1;for(let n of r)if(!St.string(n)&&!Ah.is(n)&&!kh.is(n))return!1;return!0}t.is=e})(Eh||(g.DocumentSelector=Eh={}));var nv;(function(t){t.method="client/registerCapability",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolRequestType(t.method)})(nv||(g.RegistrationRequest=nv={}));var iv;(function(t){t.method="client/unregisterCapability",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolRequestType(t.method)})(iv||(g.UnregistrationRequest=iv={}));var ov;(function(t){t.Create="create",t.Rename="rename",t.Delete="delete"})(ov||(g.ResourceOperationKind=ov={}));var sv;(function(t){t.Abort="abort",t.Transactional="transactional",t.TextOnlyTransactional="textOnlyTransactional",t.Undo="undo"})(sv||(g.FailureHandlingKind=sv={}));var av;(function(t){t.UTF8="utf-8",t.UTF16="utf-16",t.UTF32="utf-32"})(av||(g.PositionEncodingKind=av={}));var cv;(function(t){function e(r){let n=r;return n&&St.string(n.id)&&n.id.length>0}t.hasId=e})(cv||(g.StaticRegistrationOptions=cv={}));var uv;(function(t){function e(r){let n=r;return n&&(n.documentSelector===null||Eh.is(n.documentSelector))}t.is=e})(uv||(g.TextDocumentRegistrationOptions=uv={}));var lv;(function(t){function e(n){let i=n;return St.objectLiteral(i)&&(i.workDoneProgress===void 0||St.boolean(i.workDoneProgress))}t.is=e;function r(n){let i=n;return i&&St.boolean(i.workDoneProgress)}t.hasWorkDoneProgress=r})(lv||(g.WorkDoneProgressOptions=lv={}));var fv;(function(t){t.method="initialize",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(fv||(g.InitializeRequest=fv={}));var dv;(function(t){t.unknownProtocolVersion=1})(dv||(g.InitializeErrorCodes=dv={}));var pv;(function(t){t.method="initialized",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType(t.method)})(pv||(g.InitializedNotification=pv={}));var mv;(function(t){t.method="shutdown",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType0(t.method)})(mv||(g.ShutdownRequest=mv={}));var hv;(function(t){t.method="exit",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType0(t.method)})(hv||(g.ExitNotification=hv={}));var gv;(function(t){t.method="workspace/didChangeConfiguration",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType(t.method)})(gv||(g.DidChangeConfigurationNotification=gv={}));var yv;(function(t){t.Error=1,t.Warning=2,t.Info=3,t.Log=4,t.Debug=5})(yv||(g.MessageType=yv={}));var Tv;(function(t){t.method="window/showMessage",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolNotificationType(t.method)})(Tv||(g.ShowMessageNotification=Tv={}));var xv;(function(t){t.method="window/showMessageRequest",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolRequestType(t.method)})(xv||(g.ShowMessageRequest=xv={}));var vv;(function(t){t.method="window/logMessage",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolNotificationType(t.method)})(vv||(g.LogMessageNotification=vv={}));var Rv;(function(t){t.method="telemetry/event",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolNotificationType(t.method)})(Rv||(g.TelemetryEventNotification=Rv={}));var Sv;(function(t){t.None=0,t.Full=1,t.Incremental=2})(Sv||(g.TextDocumentSyncKind=Sv={}));var bv;(function(t){t.method="textDocument/didOpen",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType(t.method)})(bv||(g.DidOpenTextDocumentNotification=bv={}));var Av;(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})(Av||(g.TextDocumentContentChangeEvent=Av={}));var wv;(function(t){t.method="textDocument/didChange",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType(t.method)})(wv||(g.DidChangeTextDocumentNotification=wv={}));var kv;(function(t){t.method="textDocument/didClose",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType(t.method)})(kv||(g.DidCloseTextDocumentNotification=kv={}));var Ev;(function(t){t.method="textDocument/didSave",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType(t.method)})(Ev||(g.DidSaveTextDocumentNotification=Ev={}));var _v;(function(t){t.Manual=1,t.AfterDelay=2,t.FocusOut=3})(_v||(g.TextDocumentSaveReason=_v={}));var Cv;(function(t){t.method="textDocument/willSave",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType(t.method)})(Cv||(g.WillSaveTextDocumentNotification=Cv={}));var Nv;(function(t){t.method="textDocument/willSaveWaitUntil",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Nv||(g.WillSaveTextDocumentWaitUntilRequest=Nv={}));var Pv;(function(t){t.method="workspace/didChangeWatchedFiles",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolNotificationType(t.method)})(Pv||(g.DidChangeWatchedFilesNotification=Pv={}));var Iv;(function(t){t.Created=1,t.Changed=2,t.Deleted=3})(Iv||(g.FileChangeType=Iv={}));var Dv;(function(t){function e(r){let n=r;return St.objectLiteral(n)&&(rv.URI.is(n.baseUri)||rv.WorkspaceFolder.is(n.baseUri))&&St.string(n.pattern)}t.is=e})(Dv||(g.RelativePattern=Dv={}));var Ov;(function(t){t.Create=1,t.Change=2,t.Delete=4})(Ov||(g.WatchKind=Ov={}));var $v;(function(t){t.method="textDocument/publishDiagnostics",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolNotificationType(t.method)})($v||(g.PublishDiagnosticsNotification=$v={}));var Lv;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.TriggerForIncompleteCompletions=3})(Lv||(g.CompletionTriggerKind=Lv={}));var Mv;(function(t){t.method="textDocument/completion",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Mv||(g.CompletionRequest=Mv={}));var Fv;(function(t){t.method="completionItem/resolve",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Fv||(g.CompletionResolveRequest=Fv={}));var Uv;(function(t){t.method="textDocument/hover",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Uv||(g.HoverRequest=Uv={}));var qv;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.ContentChange=3})(qv||(g.SignatureHelpTriggerKind=qv={}));var jv;(function(t){t.method="textDocument/signatureHelp",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(jv||(g.SignatureHelpRequest=jv={}));var Gv;(function(t){t.method="textDocument/definition",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Gv||(g.DefinitionRequest=Gv={}));var Hv;(function(t){t.method="textDocument/references",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Hv||(g.ReferencesRequest=Hv={}));var Wv;(function(t){t.method="textDocument/documentHighlight",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Wv||(g.DocumentHighlightRequest=Wv={}));var Bv;(function(t){t.method="textDocument/documentSymbol",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Bv||(g.DocumentSymbolRequest=Bv={}));var Kv;(function(t){t.method="textDocument/codeAction",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Kv||(g.CodeActionRequest=Kv={}));var zv;(function(t){t.method="codeAction/resolve",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(zv||(g.CodeActionResolveRequest=zv={}));var Vv;(function(t){t.method="workspace/symbol",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Vv||(g.WorkspaceSymbolRequest=Vv={}));var Xv;(function(t){t.method="workspaceSymbol/resolve",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Xv||(g.WorkspaceSymbolResolveRequest=Xv={}));var Yv;(function(t){t.method="textDocument/codeLens",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Yv||(g.CodeLensRequest=Yv={}));var Jv;(function(t){t.method="codeLens/resolve",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Jv||(g.CodeLensResolveRequest=Jv={}));var Qv;(function(t){t.method="workspace/codeLens/refresh",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolRequestType0(t.method)})(Qv||(g.CodeLensRefreshRequest=Qv={}));var Zv;(function(t){t.method="textDocument/documentLink",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(Zv||(g.DocumentLinkRequest=Zv={}));var eR;(function(t){t.method="documentLink/resolve",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(eR||(g.DocumentLinkResolveRequest=eR={}));var tR;(function(t){t.method="textDocument/formatting",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(tR||(g.DocumentFormattingRequest=tR={}));var rR;(function(t){t.method="textDocument/rangeFormatting",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(rR||(g.DocumentRangeFormattingRequest=rR={}));var nR;(function(t){t.method="textDocument/rangesFormatting",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(nR||(g.DocumentRangesFormattingRequest=nR={}));var iR;(function(t){t.method="textDocument/onTypeFormatting",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(iR||(g.DocumentOnTypeFormattingRequest=iR={}));var oR;(function(t){t.Identifier=1})(oR||(g.PrepareSupportDefaultBehavior=oR={}));var sR;(function(t){t.method="textDocument/rename",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(sR||(g.RenameRequest=sR={}));var aR;(function(t){t.method="textDocument/prepareRename",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(aR||(g.PrepareRenameRequest=aR={}));var cR;(function(t){t.method="workspace/executeCommand",t.messageDirection=E.MessageDirection.clientToServer,t.type=new E.ProtocolRequestType(t.method)})(cR||(g.ExecuteCommandRequest=cR={}));var uR;(function(t){t.method="workspace/applyEdit",t.messageDirection=E.MessageDirection.serverToClient,t.type=new E.ProtocolRequestType("workspace/applyEdit")})(uR||(g.ApplyWorkspaceEditRequest=uR={}))});var gR=$(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.createProtocolConnection=void 0;var hR=kn();function $N(t,e,r,n){return hR.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,hR.createMessageConnection)(t,e,r,n)}Eu.createProtocolConnection=$N});var TR=$(lr=>{"use strict";var LN=lr&&lr.__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=lr&&lr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&LN(e,t,r)};Object.defineProperty(lr,"__esModule",{value:!0});lr.LSPErrorCodes=lr.createProtocolConnection=void 0;_u(kn(),lr);_u((ji(),ap(fu)),lr);_u(Me(),lr);_u(mR(),lr);var MN=gR();Object.defineProperty(lr,"createProtocolConnection",{enumerable:!0,get:function(){return MN.createProtocolConnection}});var yR;(function(t){t.lspReservedErrorRangeStart=-32899,t.RequestFailed=-32803,t.ServerCancelled=-32802,t.ContentModified=-32801,t.RequestCancelled=-32800,t.lspReservedErrorRangeEnd=-32800})(yR||(lr.LSPErrorCodes=yR={}))});var Qe=$(an=>{"use strict";var FN=an&&an.__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]}),xR=an&&an.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&FN(e,t,r)};Object.defineProperty(an,"__esModule",{value:!0});an.createProtocolConnection=void 0;var UN=gm();xR(gm(),an);xR(TR(),an);function qN(t,e,r,n){return(0,UN.createMessageConnection)(t,e,r,n)}an.createProtocolConnection=qN});var Oh=$(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.SemanticTokensBuilder=si.SemanticTokensDiff=si.SemanticTokensFeature=void 0;var Cu=Qe(),jN=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(Cu.SemanticTokensRefreshRequest.type),on:e=>{let r=Cu.SemanticTokensRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onDelta:e=>{let r=Cu.SemanticTokensDeltaRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onRange:e=>{let r=Cu.SemanticTokensRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};si.SemanticTokensFeature=jN;var Nu=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}]:[]}};si.SemanticTokensDiff=Nu;var Dh=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 Nu(this._prevData,this._data).computeDiff()}:this.build()}};si.SemanticTokensBuilder=Dh});var vR=$(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.InlineCompletionFeature=void 0;var GN=Qe(),HN=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(GN.InlineCompletionRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};Pu.InlineCompletionFeature=HN});var Lh=$(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.TextDocuments=void 0;var Hi=Qe(),$h=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new Hi.Emitter,this._onDidOpen=new Hi.Emitter,this._onDidClose=new Hi.Emitter,this._onDidSave=new Hi.Emitter,this._onWillSave=new Hi.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=Hi.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}))})),Hi.Disposable.create(()=>{r.forEach(n=>n.dispose())})}};Iu.TextDocuments=$h});var Fh=$(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.NotebookDocuments=jo.NotebookSyncFeature=void 0;var Pr=Qe(),RR=Lh(),WN=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(Pr.DidOpenNotebookDocumentNotification.type,r=>{e(r)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(Pr.DidChangeNotebookDocumentNotification.type,r=>{e(r)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(Pr.DidSaveNotebookDocumentNotification.type,r=>{e(r)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(Pr.DidCloseNotebookDocumentNotification.type,r=>{e(r)})}}};jo.NotebookSyncFeature=WN;var Du=class t{onDidOpenTextDocument(e){return this.openHandler=e,Pr.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,Pr.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,Pr.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}};Du.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var Mh=class{constructor(e){e instanceof RR.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new RR.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new Pr.Emitter,this._onDidChange=new Pr.Emitter,this._onDidSave=new Pr.Emitter,this._onDidClose=new Pr.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 Du,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=[],f=[],d=[];if(c.cells!==void 0){let S=c.cells;if(S.structure!==void 0){let h=S.structure.array;if(o.cells.splice(h.start,h.deleteCount,...h.cells!==void 0?h.cells:[]),S.structure.didOpen!==void 0)for(let m of S.structure.didOpen)r.openTextDocument({textDocument:m}),u.push(m.uri);if(S.structure.didClose)for(let m of S.structure.didClose)r.closeTextDocument({textDocument:m}),l.push(m.uri)}if(S.data!==void 0){let h=new Map(S.data.map(m=>[m.document,m]));for(let m=0;m<=o.cells.length;m++){let b=h.get(o.cells[m].document);if(b!==void 0){let _=o.cells.splice(m,1,b);if(f.push({old:_[0],new:b}),h.delete(b.document),h.size===0)break}}}if(S.textContent!==void 0)for(let h of S.textContent)r.changeTextDocument({textDocument:h.document,contentChanges:h.changes}),d.push(h.document.uri)}this.updateCellMap(o);let p={notebookDocument:o};a&&(p.metadata={old:s,new:o.metadata});let T=[];for(let S of u)T.push(this.getNotebookCell(S));let R=[];for(let S of l)R.push(this.getNotebookCell(S));let A=[];for(let S of d)A.push(this.getNotebookCell(S));(T.length>0||R.length>0||f.length>0||A.length>0)&&(p.cells={added:T,removed:R,changed:{data:f,textContent:A}}),(p.metadata!==void 0||p.cells!==void 0)&&this._onDidChange.fire(p)})),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)}})),Pr.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let r of e.cells)this.notebookCellMap.set(r.document,[r,e])}};jo.NotebookDocuments=Mh});var Uh=$(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.thenable=ct.typedArray=ct.stringArray=ct.array=ct.func=ct.error=ct.number=ct.string=ct.boolean=void 0;function BN(t){return t===!0||t===!1}ct.boolean=BN;function SR(t){return typeof t=="string"||t instanceof String}ct.string=SR;function KN(t){return typeof t=="number"||t instanceof Number}ct.number=KN;function zN(t){return t instanceof Error}ct.error=zN;function bR(t){return typeof t=="function"}ct.func=bR;function AR(t){return Array.isArray(t)}ct.array=AR;function VN(t){return AR(t)&&t.every(e=>SR(e))}ct.stringArray=VN;function XN(t,e){return Array.isArray(t)&&t.every(e)}ct.typedArray=XN;function YN(t){return t&&bR(t.then)}ct.thenable=YN});var qh=$(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.generateUuid=Ir.parse=Ir.isUUID=Ir.v4=Ir.empty=void 0;var Ca=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},Na=class t extends Ca{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(""))}};Na._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];Na._timeHighBits=["8","9","a","b"];Ir.empty=new Ca("00000000-0000-0000-0000-000000000000");function wR(){return new Na}Ir.v4=wR;var JN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function kR(t){return JN.test(t)}Ir.isUUID=kR;function QN(t){if(!kR(t))throw new Error("invalid uuid");return new Ca(t)}Ir.parse=QN;function ZN(){return wR().asHex()}Ir.generateUuid=ZN});var ER=$(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.attachPartialResult=ci.ProgressFeature=ci.attachWorkDone=void 0;var ai=Qe(),eP=qh(),Wi=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"})}};Wi.Instances=new Map;var Ou=class extends Wi{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()}},Pa=class{constructor(){}begin(){}report(){}done(){}},$u=class extends Pa{constructor(){super(),this._source=new ai.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function tP(t,e){if(e===void 0||e.workDoneToken===void 0)return new Pa;let r=e.workDoneToken;return delete e.workDoneToken,new Wi(t,r)}ci.attachWorkDone=tP;var rP=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=Wi.Instances.get(r.token);(n instanceof Ou||n instanceof $u)&&n.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new Pa:new Wi(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,eP.generateUuid)();return this.connection.sendRequest(ai.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new Ou(this.connection,e))}else return Promise.resolve(new $u)}};ci.ProgressFeature=rP;var jh;(function(t){t.type=new ai.ProgressType})(jh||(jh={}));var Gh=class{constructor(e,r){this._connection=e,this._token=r}report(e){this._connection.sendProgress(jh.type,this._token,e)}};function nP(t,e){if(e===void 0||e.partialResultToken===void 0)return;let r=e.partialResultToken;return delete e.partialResultToken,new Gh(t,r)}ci.attachPartialResult=nP});var _R=$(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.ConfigurationFeature=void 0;var iP=Qe(),oP=Uh(),sP=t=>class extends t{getConfiguration(e){return e?oP.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(iP.ConfigurationRequest.type,r).then(n=>Array.isArray(n)?Array.isArray(e)?n:n[0]:Array.isArray(e)?[]:null)}};Lu.ConfigurationFeature=sP});var CR=$(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.WorkspaceFoldersFeature=void 0;var Mu=Qe(),aP=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let r=e.workspace;r&&r.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new Mu.Emitter,this.connection.onNotification(Mu.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(Mu.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(Mu.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};Fu.WorkspaceFoldersFeature=aP});var NR=$(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.CallHierarchyFeature=void 0;var Hh=Qe(),cP=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(Hh.CallHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onIncomingCalls:e=>{let r=Hh.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onOutgoingCalls:e=>{let r=Hh.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Uu.CallHierarchyFeature=cP});var PR=$(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.ShowDocumentFeature=void 0;var uP=Qe(),lP=t=>class extends t{showDocument(e){return this.connection.sendRequest(uP.ShowDocumentRequest.type,e)}};qu.ShowDocumentFeature=lP});var IR=$(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.FileOperationsFeature=void 0;var Go=Qe(),fP=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(Go.DidCreateFilesNotification.type,r=>{e(r)})}onDidRenameFiles(e){return this.connection.onNotification(Go.DidRenameFilesNotification.type,r=>{e(r)})}onDidDeleteFiles(e){return this.connection.onNotification(Go.DidDeleteFilesNotification.type,r=>{e(r)})}onWillCreateFiles(e){return this.connection.onRequest(Go.WillCreateFilesRequest.type,(r,n)=>e(r,n))}onWillRenameFiles(e){return this.connection.onRequest(Go.WillRenameFilesRequest.type,(r,n)=>e(r,n))}onWillDeleteFiles(e){return this.connection.onRequest(Go.WillDeleteFilesRequest.type,(r,n)=>e(r,n))}};ju.FileOperationsFeature=fP});var DR=$(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});Gu.LinkedEditingRangeFeature=void 0;var dP=Qe(),pP=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(dP.LinkedEditingRangeRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0))}};Gu.LinkedEditingRangeFeature=pP});var OR=$(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.TypeHierarchyFeature=void 0;var Wh=Qe(),mP=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(Wh.TypeHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onSupertypes:e=>{let r=Wh.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onSubtypes:e=>{let r=Wh.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Hu.TypeHierarchyFeature=mP});var LR=$(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.InlineValueFeature=void 0;var $R=Qe(),hP=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest($R.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest($R.InlineValueRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};Wu.InlineValueFeature=hP});var FR=$(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});Bu.FoldingRangeFeature=void 0;var MR=Qe(),gP=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(MR.FoldingRangeRefreshRequest.type),on:e=>{let r=MR.FoldingRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Bu.FoldingRangeFeature=gP});var UR=$(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.InlayHintFeature=void 0;var Bh=Qe(),yP=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(Bh.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(Bh.InlayHintRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r))),resolve:e=>this.connection.onRequest(Bh.InlayHintResolveRequest.type,(r,n)=>e(r,n))}}};Ku.InlayHintFeature=yP});var qR=$(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.DiagnosticFeature=void 0;var Ia=Qe(),TP=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(Ia.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(Ia.DocumentDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(Ia.DocumentDiagnosticRequest.partialResult,r))),onWorkspace:e=>this.connection.onRequest(Ia.WorkspaceDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(Ia.WorkspaceDiagnosticRequest.partialResult,r)))}}};zu.DiagnosticFeature=TP});var jR=$(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.MonikerFeature=void 0;var xP=Qe(),vP=t=>class extends t{get moniker(){return{on:e=>{let r=xP.MonikerRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Vu.MonikerFeature=vP});var rS=$(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.createConnection=ae.combineFeatures=ae.combineNotebooksFeatures=ae.combineLanguagesFeatures=ae.combineWorkspaceFeatures=ae.combineWindowFeatures=ae.combineClientFeatures=ae.combineTracerFeatures=ae.combineTelemetryFeatures=ae.combineConsoleFeatures=ae._NotebooksImpl=ae._LanguagesImpl=ae.BulkUnregistration=ae.BulkRegistration=ae.ErrorMessageTracker=void 0;var P=Qe(),Dr=Uh(),zh=qh(),z=ER(),RP=_R(),SP=CR(),bP=NR(),AP=Oh(),wP=PR(),kP=IR(),EP=DR(),_P=OR(),CP=LR(),NP=FR(),PP=UR(),IP=qR(),DP=Fh(),OP=jR();function Kh(t){if(t!==null)return t}var Vh=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)})}};ae.ErrorMessageTracker=Vh;var Xu=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(P.MessageType.Error,e)}warn(e){this.send(P.MessageType.Warning,e)}info(e){this.send(P.MessageType.Info,e)}log(e){this.send(P.MessageType.Log,e)}debug(e){this.send(P.MessageType.Debug,e)}send(e,r){this._rawConnection&&this._rawConnection.sendNotification(P.LogMessageNotification.type,{type:e,message:r}).catch(()=>{(0,P.RAL)().console.error("Sending log message failed")})}},Xh=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:P.MessageType.Error,message:e,actions:r};return this.connection.sendRequest(P.ShowMessageRequest.type,n).then(Kh)}showWarningMessage(e,...r){let n={type:P.MessageType.Warning,message:e,actions:r};return this.connection.sendRequest(P.ShowMessageRequest.type,n).then(Kh)}showInformationMessage(e,...r){let n={type:P.MessageType.Info,message:e,actions:r};return this.connection.sendRequest(P.ShowMessageRequest.type,n).then(Kh)}},GR=(0,wP.ShowDocumentFeature)((0,z.ProgressFeature)(Xh)),HR;(function(t){function e(){return new Yu}t.create=e})(HR||(ae.BulkRegistration=HR={}));var Yu=class{constructor(){this._registrations=[],this._registered=new Set}add(e,r){let n=Dr.string(e)?e:e.method;if(this._registered.has(n))throw new Error(`${n} is already added to this registration`);let i=zh.generateUuid();this._registrations.push({id:i,method:n,registerOptions:r||{}}),this._registered.add(n)}asRegistrationParams(){return{registrations:this._registrations}}},WR;(function(t){function e(){return new Da(void 0,[])}t.create=e})(WR||(ae.BulkUnregistration=WR={}));var Da=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(P.UnregistrationRequest.type,r).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){let r=Dr.string(e)?e:e.method,n=this._unregistrations.get(r);if(!n)return!1;let i={unregisterations:[n]};return this._connection.sendRequest(P.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(r)},o=>{this._connection.console.info(`Un-registering request handler for ${n.id} failed.`)}),!0}},Ju=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 Yu?this.registerMany(e):e instanceof Da?this.registerSingle1(e,r,n):this.registerSingle2(e,r)}registerSingle1(e,r,n){let i=Dr.string(r)?r:r.method,o=zh.generateUuid(),s={registrations:[{id:o,method:i,registerOptions:n||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(P.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=Dr.string(e)?e:e.method,i=zh.generateUuid(),o={registrations:[{id:i,method:n,registerOptions:r||{}}]};return this.connection.sendRequest(P.RegistrationRequest.type,o).then(s=>P.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(P.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(P.RegistrationRequest.type,r).then(()=>new Da(this._connection,r.registrations.map(n=>({id:n.id,method:n.method}))),n=>(this.connection.console.info("Bulk registration failed."),Promise.reject(n)))}},Yh=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(P.ApplyWorkspaceEditRequest.type,n)}},BR=(0,kP.FileOperationsFeature)((0,SP.WorkspaceFoldersFeature)((0,RP.ConfigurationFeature)(Yh))),Qu=class{constructor(){this._trace=P.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!==P.Trace.Off&&this.connection.sendNotification(P.LogTraceNotification.type,{message:e,verbose:this._trace===P.Trace.Verbose?r:void 0}).catch(()=>{})}},Zu=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(P.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}},el=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,z.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,z.attachPartialResult)(this.connection,r)}};ae._LanguagesImpl=el;var KR=(0,NP.FoldingRangeFeature)((0,OP.MonikerFeature)((0,IP.DiagnosticFeature)((0,PP.InlayHintFeature)((0,CP.InlineValueFeature)((0,_P.TypeHierarchyFeature)((0,EP.LinkedEditingRangeFeature)((0,AP.SemanticTokensFeature)((0,bP.CallHierarchyFeature)(el))))))))),tl=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,z.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,z.attachPartialResult)(this.connection,r)}};ae._NotebooksImpl=tl;var zR=(0,DP.NotebookSyncFeature)(tl);function VR(t,e){return function(r){return e(t(r))}}ae.combineConsoleFeatures=VR;function XR(t,e){return function(r){return e(t(r))}}ae.combineTelemetryFeatures=XR;function YR(t,e){return function(r){return e(t(r))}}ae.combineTracerFeatures=YR;function JR(t,e){return function(r){return e(t(r))}}ae.combineClientFeatures=JR;function QR(t,e){return function(r){return e(t(r))}}ae.combineWindowFeatures=QR;function ZR(t,e){return function(r){return e(t(r))}}ae.combineWorkspaceFeatures=ZR;function eS(t,e){return function(r){return e(t(r))}}ae.combineLanguagesFeatures=eS;function tS(t,e){return function(r){return e(t(r))}}ae.combineNotebooksFeatures=tS;function $P(t,e){function r(i,o,s){return i&&o?s(i,o):i||o}return{__brand:"features",console:r(t.console,e.console,VR),tracer:r(t.tracer,e.tracer,YR),telemetry:r(t.telemetry,e.telemetry,XR),client:r(t.client,e.client,JR),window:r(t.window,e.window,QR),workspace:r(t.workspace,e.workspace,ZR),languages:r(t.languages,e.languages,eS),notebooks:r(t.notebooks,e.notebooks,tS)}}ae.combineFeatures=$P;function LP(t,e,r){let n=r&&r.console?new(r.console(Xu)):new Xu,i=t(n);n.rawAttach(i);let o=r&&r.tracer?new(r.tracer(Qu)):new Qu,s=r&&r.telemetry?new(r.telemetry(Zu)):new Zu,a=r&&r.client?new(r.client(Ju)):new Ju,c=r&&r.window?new(r.window(GR)):new GR,u=r&&r.workspace?new(r.workspace(BR)):new BR,l=r&&r.languages?new(r.languages(KR)):new KR,f=r&&r.notebooks?new(r.notebooks(zR)):new zR,d=[n,o,s,a,c,u,l,f];function p(h){return h instanceof Promise?h:Dr.thenable(h)?new Promise((m,b)=>{h.then(_=>m(_),_=>b(_))}):Promise.resolve(h)}let T,R,A,S={listen:()=>i.listen(),sendRequest:(h,...m)=>i.sendRequest(Dr.string(h)?h:h.method,...m),onRequest:(h,m)=>i.onRequest(h,m),sendNotification:(h,m)=>{let b=Dr.string(h)?h:h.method;return i.sendNotification(b,m)},onNotification:(h,m)=>i.onNotification(h,m),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:h=>(R=h,{dispose:()=>{R=void 0}}),onInitialized:h=>i.onNotification(P.InitializedNotification.type,h),onShutdown:h=>(T=h,{dispose:()=>{T=void 0}}),onExit:h=>(A=h,{dispose:()=>{A=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 f},onDidChangeConfiguration:h=>i.onNotification(P.DidChangeConfigurationNotification.type,h),onDidChangeWatchedFiles:h=>i.onNotification(P.DidChangeWatchedFilesNotification.type,h),__textDocumentSync:void 0,onDidOpenTextDocument:h=>i.onNotification(P.DidOpenTextDocumentNotification.type,h),onDidChangeTextDocument:h=>i.onNotification(P.DidChangeTextDocumentNotification.type,h),onDidCloseTextDocument:h=>i.onNotification(P.DidCloseTextDocumentNotification.type,h),onWillSaveTextDocument:h=>i.onNotification(P.WillSaveTextDocumentNotification.type,h),onWillSaveTextDocumentWaitUntil:h=>i.onRequest(P.WillSaveTextDocumentWaitUntilRequest.type,h),onDidSaveTextDocument:h=>i.onNotification(P.DidSaveTextDocumentNotification.type,h),sendDiagnostics:h=>i.sendNotification(P.PublishDiagnosticsNotification.type,h),onHover:h=>i.onRequest(P.HoverRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),void 0)),onCompletion:h=>i.onRequest(P.CompletionRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onCompletionResolve:h=>i.onRequest(P.CompletionResolveRequest.type,h),onSignatureHelp:h=>i.onRequest(P.SignatureHelpRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),void 0)),onDeclaration:h=>i.onRequest(P.DeclarationRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onDefinition:h=>i.onRequest(P.DefinitionRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onTypeDefinition:h=>i.onRequest(P.TypeDefinitionRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onImplementation:h=>i.onRequest(P.ImplementationRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onReferences:h=>i.onRequest(P.ReferencesRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onDocumentHighlight:h=>i.onRequest(P.DocumentHighlightRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onDocumentSymbol:h=>i.onRequest(P.DocumentSymbolRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onWorkspaceSymbol:h=>i.onRequest(P.WorkspaceSymbolRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onWorkspaceSymbolResolve:h=>i.onRequest(P.WorkspaceSymbolResolveRequest.type,h),onCodeAction:h=>i.onRequest(P.CodeActionRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onCodeActionResolve:h=>i.onRequest(P.CodeActionResolveRequest.type,(m,b)=>h(m,b)),onCodeLens:h=>i.onRequest(P.CodeLensRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onCodeLensResolve:h=>i.onRequest(P.CodeLensResolveRequest.type,(m,b)=>h(m,b)),onDocumentFormatting:h=>i.onRequest(P.DocumentFormattingRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),void 0)),onDocumentRangeFormatting:h=>i.onRequest(P.DocumentRangeFormattingRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),void 0)),onDocumentOnTypeFormatting:h=>i.onRequest(P.DocumentOnTypeFormattingRequest.type,(m,b)=>h(m,b)),onRenameRequest:h=>i.onRequest(P.RenameRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),void 0)),onPrepareRename:h=>i.onRequest(P.PrepareRenameRequest.type,(m,b)=>h(m,b)),onDocumentLinks:h=>i.onRequest(P.DocumentLinkRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onDocumentLinkResolve:h=>i.onRequest(P.DocumentLinkResolveRequest.type,(m,b)=>h(m,b)),onDocumentColor:h=>i.onRequest(P.DocumentColorRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onColorPresentation:h=>i.onRequest(P.ColorPresentationRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onFoldingRanges:h=>i.onRequest(P.FoldingRangeRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onSelectionRanges:h=>i.onRequest(P.SelectionRangeRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),(0,z.attachPartialResult)(i,m))),onExecuteCommand:h=>i.onRequest(P.ExecuteCommandRequest.type,(m,b)=>h(m,b,(0,z.attachWorkDone)(i,m),void 0)),dispose:()=>i.dispose()};for(let h of d)h.attach(S);return i.onRequest(P.InitializeRequest.type,h=>{e.initialize(h),Dr.string(h.trace)&&(o.trace=P.Trace.fromString(h.trace));for(let m of d)m.initialize(h.capabilities);if(R){let m=R(h,new P.CancellationTokenSource().token,(0,z.attachWorkDone)(i,h),void 0);return p(m).then(b=>{if(b instanceof P.ResponseError)return b;let _=b;_||(_={capabilities:{}});let V=_.capabilities;V||(V={},_.capabilities=V),V.textDocumentSync===void 0||V.textDocumentSync===null?V.textDocumentSync=Dr.number(S.__textDocumentSync)?S.__textDocumentSync:P.TextDocumentSyncKind.None:!Dr.number(V.textDocumentSync)&&!Dr.number(V.textDocumentSync.change)&&(V.textDocumentSync.change=Dr.number(S.__textDocumentSync)?S.__textDocumentSync:P.TextDocumentSyncKind.None);for(let Ct of d)Ct.fillServerCapabilities(V);return _})}else{let m={capabilities:{textDocumentSync:P.TextDocumentSyncKind.None}};for(let b of d)b.fillServerCapabilities(m.capabilities);return m}}),i.onRequest(P.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,T)return T(new P.CancellationTokenSource().token)}),i.onNotification(P.ExitNotification.type,()=>{try{A&&A()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(P.SetTraceNotification.type,h=>{o.trace=P.Trace.fromString(h.value)}),S}ae.createConnection=LP});var Jh=$(jt=>{"use strict";var MP=jt&&jt.__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]}),iS=jt&&jt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&MP(e,t,r)};Object.defineProperty(jt,"__esModule",{value:!0});jt.ProposedFeatures=jt.NotebookDocuments=jt.TextDocuments=jt.SemanticTokensBuilder=void 0;var FP=Oh();Object.defineProperty(jt,"SemanticTokensBuilder",{enumerable:!0,get:function(){return FP.SemanticTokensBuilder}});var UP=vR();iS(Qe(),jt);var qP=Lh();Object.defineProperty(jt,"TextDocuments",{enumerable:!0,get:function(){return qP.TextDocuments}});var jP=Fh();Object.defineProperty(jt,"NotebookDocuments",{enumerable:!0,get:function(){return jP.NotebookDocuments}});iS(rS(),jt);var nS;(function(t){t.all={__brand:"features",languages:UP.InlineCompletionFeature}})(nS||(jt.ProposedFeatures=nS={}))});var sS=$((PH,oS)=>{"use strict";oS.exports=Qe()});var de=$(cn=>{"use strict";var GP=cn&&cn.__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]}),cS=cn&&cn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&GP(e,t,r)};Object.defineProperty(cn,"__esModule",{value:!0});cn.createConnection=void 0;var rl=Jh();cS(sS(),cn);cS(Jh(),cn);var aS=!1,HP={initialize:t=>{},get shutdownReceived(){return aS},set shutdownReceived(t){aS=t},exit:t=>{}};function WP(t,e,r,n){let i,o,s,a;t!==void 0&&t.__brand==="features"&&(i=t,t=e,e=r,r=n),rl.ConnectionStrategy.is(t)||rl.ConnectionOptions.is(t)?a=t:(o=t,s=e,a=r);let c=u=>(0,rl.createProtocolConnection)(o,s,u,a);return(0,rl.createConnection)(c,HP,i)}cn.createConnection=WP});var kC=$((lue,wC)=>{"use strict";wC.exports=de()});var bC=se(de(),1);var nl=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=lS(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=uS(n.text,!1,o);if(c-a===l.length)for(let d=0,p=l.length;d<p;d++)u[d+a+1]=l[d];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 f=n.text.length-(s-o);if(f!==0)for(let d=a+1+l.length,p=u.length;d<p;d++)u[d]=u[d]+f}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=uS(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{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],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}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}},Ho;(function(t){function e(i,o,s,a){return new nl(i,o,s,a)}t.create=e;function r(i,o,s){if(i instanceof nl)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=Qh(o.map(BP),(l,f)=>{let d=l.range.start.line-f.range.start.line;return d===0?l.range.start.character-f.range.start.character:d}),c=0,u=[];for(let l of a){let f=i.offsetAt(l.range.start);if(f<c)throw new Error("Overlapping edit");f>c&&u.push(s.substring(c,f)),l.newText.length&&u.push(l.newText),c=i.offsetAt(l.range.end)}return u.push(s.substr(c)),u.join("")}t.applyEdits=n})(Ho||(Ho={}));function Qh(t,e){if(t.length<=1)return t;let r=t.length/2|0,n=t.slice(0,r),i=t.slice(r);Qh(n,e),Qh(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 uS(t,e,r=0){let n=e?[r]:[];for(let i=0;i<t.length;i++){let o=t.charCodeAt(i);(o===13||o===10)&&(o===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,n.push(r+i+1))}return n}function lS(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 BP(t){let e=lS(t.range);return e!==t.range?{newText:t.newText,range:e}:t}function ut(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function Cn(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"}function fS(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function Wo(t){return typeof t=="object"&&t!==null&&ut(t.container)&&Cn(t.reference)&&typeof t.message=="string"}var Bi=class{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,r){return ut(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 Kr(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function ui(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function dS(t){return Kr(t)&&typeof t.fullText=="string"}var xr=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){let r=e[Symbol.iterator]();return new t(()=>({first:this.startFn(),firstDone:!1}),n=>{let i;if(!n.firstDone){do if(i=this.nextFn(n.first),!i.done)return i;while(!i.done);n.firstDone=!0}do if(i=r.next(),!i.done)return i;while(!i.done);return Zt})}join(e=","){let r=this.iterator(),n="",i,o=!1;do i=r.next(),i.done||(o&&(n+=e),n+=KP(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(il(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(il(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){let r=new Set;return this.filter(n=>{let i=e?e(n):n;return r.has(i)?!1:(r.add(i),!0)})}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 KP(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function il(t){return!!t&&typeof t[Symbol.iterator]=="function"}var Bo=new xr(()=>{},()=>Zt),Zt=Object.freeze({done:!0,value:void 0});function J(...t){if(t.length===1){let e=t[0];if(e instanceof xr)return e;if(il(e))return new xr(()=>e[Symbol.iterator](),r=>r.next());if(typeof e.length=="number")return new xr(()=>({index:0}),r=>r.index<e.length?{done:!1,value:e[r.index++]}:Zt)}return t.length>1?new xr(()=>({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++];il(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}):Bo}var Or=class extends xr{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}},ol;(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})(ol||(ol={}));function Zh(t){return new Or(t,e=>Kr(e)?e.content:[],{includeRoot:!0})}function hS(t){return Zh(t).filter(ui)}function gS(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function Oa(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function Gt(t){if(!t)return;let{offset:e,end:r,range:n}=t;return{range:n,offset:e,end:r,length:r-e}}var li;(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"})(li||(li={}));function zP(t,e){if(t.end.line<e.start.line||t.end.line===e.start.line&&t.end.character<t.start.character)return li.Before;if(t.start.line>e.end.line||t.start.line===e.end.line&&t.start.character>e.end.character)return li.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?li.Inside:r?li.OverlapBack:li.OverlapFront}function sl(t,e){return zP(t,e)>li.After}var eg=/^[\w\p{L}]$/u;function ht(t,e,r=eg){if(t){if(e>0){let n=e-t.offset,i=t.text.charAt(n);r.test(i)||e--}return fi(t,e)}}function yS(t,e){if(t){let r=VP(t,!0);if(r&&pS(r,e))return r;if(dS(t)){let n=t.content.findIndex(i=>!i.hidden);for(let i=n-1;i>=0;i--){let o=t.content[i];if(pS(o,e))return o}}}}function pS(t,e){return ui(t)&&e.includes(t.tokenType.name)}function fi(t,e){if(ui(t))return t;if(Kr(t)){let r=TS(t,e,!1);if(r)return fi(r,e)}}function al(t,e){if(ui(t))return t;if(Kr(t)){let r=TS(t,e,!0);if(r)return al(r,e)}}function TS(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 VP(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 xS(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 vS(t,e){let r=XP(t,e);return r?r.parent.content.slice(r.a+1,r.b):[]}function XP(t,e){let r=mS(t),n=mS(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 mS(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()}function Ki(t,e,r,n){let i=[t,e,r,n].reduce(AS,{});return bS(i)}var tg=Symbol("isProxy");function cl(t){if(t&&t[tg])for(let e of Object.values(t))cl(e);return t}function bS(t,e){let r=new Proxy({},{deleteProperty:()=>!1,get:(n,i)=>SS(n,i,t,e||r),getOwnPropertyDescriptor:(n,i)=>(SS(n,i,t,e||r),Object.getOwnPropertyDescriptor(n,i)),has:(n,i)=>i in t,ownKeys:()=>[...Reflect.ownKeys(t),tg]});return r[tg]=!0,r}var RS=Symbol();function SS(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]===RS)throw new Error('Cycle detected. Please make "'+String(e)+'" lazy. See https://langium.org/docs/configuration-services/#resolving-cyclic-dependencies');return t[e]}else if(e in r){let i=r[e];t[e]=RS;try{t[e]=typeof i=="function"?i(n):bS(i,n)}catch(o){throw t[e]=o instanceof Error?o:void 0,o}return t[e]}else return}function AS(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]=AS(i,n):t[r]=n}}return t}var ye=class{constructor(e){if(this.map=new Map,e)for(let[r,n]of e)this.add(r,n)}get size(){return ol.sum(J(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 J(this.map.entries()).flatMap(([e,r])=>r.map(n=>[e,n]))}keys(){return J(this.map.keys())}values(){return J(this.map.values()).flat()}entriesGroupedByKey(){return J(this.map.entries())}};var rg="AbstractRule";var zi="AbstractType";var YP="Condition";var JP="TypeDefinition";var ng="AbstractElement";function Ko(t){return te.isInstance(t,ng)}var wS="ArrayType";function Vi(t){return te.isInstance(t,wS)}var kS="Conjunction";function ES(t){return te.isInstance(t,kS)}var _S="Disjunction";function CS(t){return te.isInstance(t,_S)}var NS="Grammar";function di(t){return te.isInstance(t,NS)}var QP="GrammarImport";function ul(t){return te.isInstance(t,QP)}var ZP="InferredType";function zo(t){return te.isInstance(t,ZP)}var La="Interface";function Ht(t){return te.isInstance(t,La)}var PS="LiteralCondition";function IS(t){return te.isInstance(t,PS)}var DS="Negation";function OS(t){return te.isInstance(t,DS)}var $S="Parameter";function LS(t){return te.isInstance(t,$S)}var MS="ParameterReference";function Vo(t){return te.isInstance(t,MS)}var FS="ParserRule";function M(t){return te.isInstance(t,FS)}var US="ReferenceType";function Xi(t){return te.isInstance(t,US)}var eI="ReturnType";function Xo(t){return te.isInstance(t,eI)}var qS="SimpleType";function Wt(t){return te.isInstance(t,qS)}var ig="TerminalRule";function pe(t){return te.isInstance(t,ig)}var Ma="Type";function lt(t){return te.isInstance(t,Ma)}var tI="TypeAttribute";function ll(t){return te.isInstance(t,tI)}var jS="UnionType";function $r(t){return te.isInstance(t,jS)}var GS="Action";function Te(t){return te.isInstance(t,GS)}var HS="Alternatives";function vr(t){return te.isInstance(t,HS)}var WS="Assignment";function ce(t){return te.isInstance(t,WS)}var BS="CharacterRange";function fl(t){return te.isInstance(t,BS)}var KS="CrossReference";function Dt(t){return te.isInstance(t,KS)}var zS="EndOfFile";function VS(t){return te.isInstance(t,zS)}var XS="Group";function bt(t){return te.isInstance(t,XS)}var YS="Keyword";function Ze(t){return te.isInstance(t,YS)}var JS="NegatedToken";function QS(t){return te.isInstance(t,JS)}var ZS="RegexToken";function eb(t){return te.isInstance(t,ZS)}var tb="RuleCall";function xe(t){return te.isInstance(t,tb)}var rb="TerminalAlternatives";function nb(t){return te.isInstance(t,rb)}var ib="TerminalGroup";function ob(t){return te.isInstance(t,ib)}var sb="TerminalRuleCall";function dl(t){return te.isInstance(t,sb)}var ab="UnorderedGroup";function Rr(t){return te.isInstance(t,ab)}var cb="UntilToken";function ub(t){return te.isInstance(t,cb)}var lb="Wildcard";function fb(t){return te.isInstance(t,lb)}var $a=class extends Bi{getAllTypes(){return["AbstractElement","AbstractRule","AbstractType","Action","Alternatives","ArrayType","Assignment","CharacterRange","Condition","Conjunction","CrossReference","Disjunction","EndOfFile","Grammar","GrammarImport","Group","InferredType","Interface","Keyword","LiteralCondition","NamedArgument","NegatedToken","Negation","Parameter","ParameterReference","ParserRule","ReferenceType","RegexToken","ReturnType","RuleCall","SimpleType","TerminalAlternatives","TerminalGroup","TerminalRule","TerminalRuleCall","Type","TypeAttribute","TypeDefinition","UnionType","UnorderedGroup","UntilToken","Wildcard"]}computeIsSubtype(e,r){switch(e){case GS:return this.isSubtype(ng,r)||this.isSubtype(zi,r);case HS:case WS:case BS:case KS:case zS:case XS:case YS:case JS:case ZS:case tb:case rb:case ib:case sb:case ab:case cb:case lb:return this.isSubtype(ng,r);case wS:case US:case qS:case jS:return this.isSubtype(JP,r);case kS:case _S:case PS:case DS:case MS:return this.isSubtype(YP,r);case La:case Ma:return this.isSubtype(zi,r);case FS:return this.isSubtype(rg,r)||this.isSubtype(zi,r);case ig:return this.isSubtype(rg,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 zi;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return rg;case"Grammar:usedGrammars":return NS;case"NamedArgument:parameter":case"ParameterReference:parameter":return $S;case"TerminalRuleCall:rule":return ig;default:throw new Error(`${r} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case"Grammar":return{name:"Grammar",mandatory:[{name:"definesHiddenTokens",type:"boolean"},{name:"hiddenTokens",type:"array"},{name:"imports",type:"array"},{name:"interfaces",type:"array"},{name:"isDeclared",type:"boolean"},{name:"rules",type:"array"},{name:"types",type:"array"},{name:"usedGrammars",type:"array"}]};case"Interface":return{name:"Interface",mandatory:[{name:"attributes",type:"array"},{name:"superTypes",type:"array"}]};case"LiteralCondition":return{name:"LiteralCondition",mandatory:[{name:"true",type:"boolean"}]};case"NamedArgument":return{name:"NamedArgument",mandatory:[{name:"calledByName",type:"boolean"}]};case"ParserRule":return{name:"ParserRule",mandatory:[{name:"definesHiddenTokens",type:"boolean"},{name:"entry",type:"boolean"},{name:"fragment",type:"boolean"},{name:"hiddenTokens",type:"array"},{name:"parameters",type:"array"},{name:"wildcard",type:"boolean"}]};case"TerminalRule":return{name:"TerminalRule",mandatory:[{name:"fragment",type:"boolean"},{name:"hidden",type:"boolean"}]};case"TypeAttribute":return{name:"TypeAttribute",mandatory:[{name:"isOptional",type:"boolean"}]};case"UnionType":return{name:"UnionType",mandatory:[{name:"types",type:"array"}]};case"Alternatives":return{name:"Alternatives",mandatory:[{name:"elements",type:"array"}]};case"CrossReference":return{name:"CrossReference",mandatory:[{name:"deprecatedSyntax",type:"boolean"}]};case"Group":return{name:"Group",mandatory:[{name:"elements",type:"array"}]};case"RuleCall":return{name:"RuleCall",mandatory:[{name:"arguments",type:"array"}]};case"TerminalAlternatives":return{name:"TerminalAlternatives",mandatory:[{name:"elements",type:"array"}]};case"TerminalGroup":return{name:"TerminalGroup",mandatory:[{name:"elements",type:"array"}]};case"UnorderedGroup":return{name:"UnorderedGroup",mandatory:[{name:"elements",type:"array"}]};default:return{name:e,mandatory:[]}}}},te=new $a;function db(t){for(let[e,r]of Object.entries(t))e.startsWith("$")||(Array.isArray(r)?r.forEach((n,i)=>{ut(n)&&(n.$container=t,n.$containerProperty=e,n.$containerIndex=i)}):ut(r)&&(r.$container=t,r.$containerProperty=e))}function ve(t,e){let r=t;for(;r;){if(e(r))return r;r=r.$container}}function Y(t){let r=pl(t).$document;if(!r)throw new Error("AST node has no document.");return r}function pl(t){for(;t.$container;)t=t.$container;return t}function pi(t,e){if(!t)throw new Error("Node must be an AstNode.");let r=e?.range;return new xr(()=>({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(ut(o)){if(n.keyIndex++,og(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(ut(a)&&og(a,r))return{done:!1,value:a}}n.arrayIndex=0}}n.keyIndex++}return Zt})}function Fe(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new Or(t,r=>pi(r,e))}function Pn(t,e){if(t){if(e?.range&&!og(t,e.range))return new Or(t,()=>[])}else throw new Error("Root node must be an AstNode.");return new Or(t,r=>pi(r,e),{includeRoot:!0})}function og(t,e){var r;if(!e)return!0;let n=(r=t.$cstNode)===null||r===void 0?void 0:r.range;return n?sl(n,e):!1}function ml(t){return new xr(()=>({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(Cn(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(Cn(o))return{done:!1,value:{reference:o,container:t,property:r,index:i}}}e.arrayIndex=0}}e.keyIndex++}return Zt})}function hl(t,e){let r=t.getTypeMetaData(e.$type),n=e;for(let i of r.mandatory){let o=n[i.name];i.type==="array"&&!Array.isArray(o)?n[i.name]=[]:i.type==="boolean"&&o===void 0&&(n[i.name]=!1)}}function pb(t){var e,r;if(t){if("astNode"in t)return iI(t);if(Array.isArray(t))return t.reduce(mb,void 0);{let n=t,i=rI(n)?nI((r=(e=n?.root)===null||e===void 0?void 0:e.astNode)!==null&&r!==void 0?r:n?.astNode):void 0;return Yo(n,i)}}else return}function rI(t){return typeof t<"u"&&"element"in t&&"text"in t}function nI(t){try{return Y(t).uri.toString()}catch{return}}function iI(t){var e,r;let{astNode:n,property:i,index:o}=t??{},s=(e=n?.$cstNode)!==null&&e!==void 0?e:n?.$textRegion;if(!(n===void 0||s===void 0)){if(i===void 0)return Yo(s,sg(n));{let a=c=>o!==void 0&&o>-1&&Array.isArray(n[i])?o<c.length?c[o]:void 0:c.reduce(mb,void 0);if(!((r=s.assignments)===null||r===void 0)&&r[i]){let c=a(s.assignments[i]);return c&&Yo(c,sg(n))}else if(n.$cstNode){let c=a(mi(n.$cstNode,i));return c&&Yo(c,sg(n))}else return}}}function sg(t){var e,r,n,i;return t.$cstNode?(r=(e=Y(t))===null||e===void 0?void 0:e.uri)===null||r===void 0?void 0:r.toString():t.$textRegion?t.$textRegion.documentURI||((i=(n=new Or(t,o=>o.$container?[o.$container]:[]).find(o=>{var s;return(s=o.$textRegion)===null||s===void 0?void 0:s.documentURI}))===null||n===void 0?void 0:n.$textRegion)===null||i===void 0?void 0:i.documentURI):void 0}function Yo(t,e){var r,n;let i={offset:t.offset,end:(r=t.end)!==null&&r!==void 0?r:t.offset+t.length,length:(n=t.length)!==null&&n!==void 0?n:t.end-t.offset};return t.range&&(i.range=t.range),e??(e=t.fileURI),e&&(i.fileURI=e),i}function mb(t,e){var r,n;if(t){if(!e)return t&&Yo(t)}else return e&&Yo(e);let i=(r=t.end)!==null&&r!==void 0?r:t.offset+t.length,o=(n=e.end)!==null&&n!==void 0?n:e.offset+e.length,s=Math.min(t.offset,e.offset),a=Math.max(i,o),c=a-s,u={offset:s,end:a,length:c};if(t.range&&e.range&&(u.range={start:e.range.start.line<t.range.start.line||e.range.start.line===t.range.start.line&&e.range.start.character<t.range.start.character?e.range.start:t.range.start,end:e.range.end.line>t.range.end.line||e.range.end.line===t.range.end.line&&e.range.end.character>t.range.end.character?e.range.end:t.range.end}),t.fileURI||e.fileURI){let l=t.fileURI,f=e.fileURI,d=l&&f&&l!==f?`<unmergable text regions of ${l}, ${f}>`:l??f;u.fileURI=d}return u}var ag=class{constructor(e){this.defaultIndentation=" ",this.pendingIndent=!0,this.currentIndents=[],this.recentNonImmediateIndents=[],this.traceData=[],this.lines=[[]],typeof e=="string"?this.defaultIndentation=e:typeof e=="number"&&(this.defaultIndentation="".padStart(e))}get content(){return this.lines.map(e=>e.join("")).join("")}get currentLineNumber(){return this.lines.length-1}get currentLineContent(){return this.lines[this.currentLineNumber].join("")}get currentPosition(){return{offset:this.content.length,line:this.currentLineNumber,character:this.currentLineContent.length}}append(e,r){if(e.length>0){let n=r&&this.currentPosition;this.lines[this.currentLineNumber].push(e),n&&this.indentPendingTraceRegions(n)}}indentPendingTraceRegions(e){for(let r=this.traceData.length-1;r>=0;r--){let n=this.traceData[r];n.targetStart&&n.targetStart.offset===e.offset&&(n.targetStart=this.currentPosition)}}increaseIndent(e){this.currentIndents.push(e),e.indentImmediately||this.recentNonImmediateIndents.push(e)}decreaseIndent(){this.currentIndents.pop()}get relevantIndents(){return this.currentIndents.filter(e=>!this.recentNonImmediateIndents.includes(e))}resetCurrentLine(){this.lines[this.currentLineNumber]=[],this.pendingIndent=!0}addNewLine(){this.pendingIndent=!0,this.lines.push([]),this.recentNonImmediateIndents.length=0}pushTraceRegion(e){let r=oI(e,this.currentPosition,n=>{var i,o;return(o=(i=this.traceData[this.traceData.length-1])===null||i===void 0?void 0:i.children)===null||o===void 0?void 0:o.push(n)});return this.traceData.push(r),r}popTraceRegion(e){let r=this.traceData.pop();return this.assertTrue(r===e,"Trace region mismatch!"),r}getParentTraceSourceFileURI(){var e;for(let r=this.traceData.length-1;r>-1;r--){let n=(e=this.traceData[r].sourceRegion)===null||e===void 0?void 0:e.fileURI;if(n)return n}}assertTrue(e,r){if(!e)throw new Error(r)}};function oI(t,e,r){let n={sourceRegion:t,targetRegion:void 0,children:[],targetStart:e,complete:i=>{var o,s;return n.targetRegion={offset:n.targetStart.offset,end:i.offset,length:i.offset-n.targetStart.offset,range:{start:{line:n.targetStart.line,character:n.targetStart.character},end:{line:i.line,character:i.character}}},delete n.targetStart,((o=n.children)===null||o===void 0?void 0:o.length)===0&&delete n.children,!((s=n.targetRegion)===null||s===void 0)&&s.length&&r(n),delete n.complete,n}};return n}function hb(t,e){let r=new ag(e),n=r.pushTraceRegion(void 0);gb(t,r),r.popTraceRegion(n),n.complete&&n.complete(r.currentPosition);let i=n.children&&n.children.length===1?n.children[0]:void 0,o=i?.targetRegion,s=n.targetRegion;return o&&i.sourceRegion&&o.offset===s.offset&&o.length===s.length?{text:r.content,trace:i}:{text:r.content,trace:n}}function gb(t,e){typeof t=="string"?sI(t,e):t instanceof Jo?aI(t,e):t instanceof Ot?xb(t,e):t instanceof hi&&cI(t,e)}function yb(t,e){return typeof t=="string"?t.length!==0:t instanceof Ot?t.contents.some(r=>yb(r,e)):t instanceof hi?!(t.ifNotEmpty&&e.currentLineContent.length===0):!1}function sI(t,e){t&&(e.pendingIndent&&Tb(e,!1),e.append(t))}function Tb(t,e){var r;let n="";for(let i of t.relevantIndents.filter(o=>o.indentEmptyLines||!e))n+=(r=i.indentation)!==null&&r!==void 0?r:t.defaultIndentation;t.append(n,!0),t.pendingIndent=!1}function xb(t,e){let r,n=pb(t.tracedSource);n&&(r=e.pushTraceRegion(n));for(let i of t.contents)gb(i,e);if(r){e.popTraceRegion(r);let i=e.getParentTraceSourceFileURI();i&&n?.fileURI===i&&delete n.fileURI,r.complete&&r.complete(e.currentPosition)}}function aI(t,e){var r;if(yb(t,e)){t.indentImmediately&&!e.pendingIndent&&e.append((r=t.indentation)!==null&&r!==void 0?r:e.defaultIndentation,!0);try{e.increaseIndent(t),xb(t,e)}finally{e.decreaseIndent()}}}function cI(t,e){t.ifNotEmpty&&!uI(e.currentLineContent)?e.resetCurrentLine():(e.pendingIndent&&Tb(e,!0),e.append(t.lineDelimiter),e.addNewLine())}function uI(t){return t.trimStart()!==""}var tW=Object.freeze("__\xABSKIP^NEW^LINE^IF^EMPTY\xBB__"),Fa=/\r?\n/gm,lI=/\S|$/;function vb(t){let e=t.filter(n=>n.length>0).map(n=>n.search(lI)),r=e.length===0?0:Math.min(...e);return Math.max(0,r)}function ug(t,...e){let r=fI(t),n=dI(t,e,r);return mI(n)}function bb(t,e,r){return(n,...i)=>lg(t,e,r)(ug(n,...i))}function fI(t){let e=t.join("_").split(Fa),r=e.length>1&&e[0].trim().length===0,n=r&&e.length>1&&e[e.length-1].trim().length===0;if(e.length===1||e.length!==0&&e[0].trim().length!==0||e.length===2&&e[1].trim().length===0)return{indentation:0,omitFirstLine:r,omitLastLine:n,trimLastLine:e.length!==1&&e[e.length-1].trim().length===0};{let i=r?e.slice(1):e;i=n?i.slice(0,i.length-1):i,i=i.filter(s=>s.length!==0);let o=vb(i);return{indentation:o,omitFirstLine:r,omitLastLine:n&&(e[e.length-1].length<o||!e[e.length-1].startsWith(i[0].substring(0,o)))}}}function dI(t,e,{indentation:r,omitFirstLine:n,omitLastLine:i,trimLastLine:o}){let s=[];t.forEach((u,l)=>{s.push(...u.split(Fa).map((f,d)=>d===0||f.length<r?f:f.substring(r)).reduce(l===0?(f,d,p)=>p===0?n?[]:[d]:p===1&&f.length===0?[d]:f.concat(gl,d):(f,d,p)=>p===0?[d]:f.concat(gl,d),[]).filter(f=>!(typeof f=="string"&&f.length===0)).concat(Zo(e[l])?e[l]:e[l]!==void 0?{content:String(e[l])}:l<e.length?Ab:[]))});let a=s.length,c=a!==0?s[a-1]:void 0;return(i||o)&&typeof c=="string"&&c.trim().length===0?n&&a!==1&&s[a-2]===gl?s.slice(0,a-2):s.slice(0,a-1):s}var gl={isNewLine:!0},Ab={isUndefinedSegment:!0},Sb=t=>t===gl,cg=t=>t===Ab,pI=t=>t.content!==void 0;function mI(t){return t.reduce((r,n,i)=>cg(n)?r:Sb(n)?{node:i!==0&&(cg(t[i-1])||Zo(t[i-1]))||i>1&&typeof t[i-1]=="string"&&(cg(t[i-2])||Zo(t[i-2]))?r.node.appendNewLineIfNotEmpty():r.node.appendNewLine()}:(()=>{var o;let s=(i===0||Sb(t[i-1]))&&typeof n=="string"&&n.length!==0?"".padStart(n.length-n.trimStart().length):"",a=pI(n)?n.content:n,c;return{node:r.indented?r.node:s.length!==0?r.node.indent({indentation:s,indentImmediately:!1,indentedChildren:u=>c=u.append(a)}):r.node.append(a),indented:c??((o=r.indented)===null||o===void 0?void 0:o.append(a))}})(),{node:new Ot}).node}var Rb=typeof process>"u"?`
|
|
36
36
|
`:process.platform==="win32"?`\r
|
|
37
37
|
`:`
|
|
38
|
-
`;function Zo(t){return t instanceof Ot||t instanceof Jo||t instanceof mi}function Qo(t,e){return Zo(t)?pb(t,e).text:String(t)}var Ot=class t{constructor(...e){this.contents=[],this.append(...e)}isEmpty(){return this.contents.length===0}trace(e,r,n){if(ut(e)){if(this.tracedSource={astNode:e,property:r,index:n},this.tracedSource.property===void 0&&this.tracedSource.index!==void 0&&this.tracedSource.index>-1)throw new Error("Generation support: 'property' argument must not be 'undefined' if a non-negative value is assigned to 'index' in 'CompositeGeneratorNode.trace(...)'.")}else this.tracedSource=e;return this}append(...e){for(let r of e)typeof r=="function"?r(this):r&&this.contents.push(r);return this}appendIf(e,...r){return e?this.append(...r):this}appendNewLine(){return this.append(Be)}appendNewLineIf(e){return e?this.append(Be):this}appendNewLineIfNotEmpty(){return this.append(pI)}appendNewLineIfNotEmptyIf(e){return e?this.appendNewLineIfNotEmpty():this}appendTemplate(e,...r){return this.append(ug(e,...r))}appendTemplateIf(e){return e?(r,...n)=>this.appendTemplate(r,...n):()=>this}indent(e){let{indentedChildren:r,indentation:n,indentEmptyLines:i,indentImmediately:o}=Array.isArray(e)||typeof e=="function"?{indentedChildren:e}:typeof e=="object"?e:{},s=new Jo(n,o,i);return this.contents.push(s),Array.isArray(r)?s.append(...r):r&&s.append(r),this}appendTraced(e,r,n){return i=>this.append(new t().trace(e,r,n).append(i))}appendTracedIf(e,r,n,i){return e?this.appendTraced(typeof r=="function"?r():r,n,i):()=>this}appendTracedTemplate(e,r,n){return(i,...o)=>this.append(Rb(e,r,n)(i,...o))}appendTracedTemplateIf(e,r,n,i){return e?this.appendTracedTemplate(typeof r=="function"?r():r,n,i):()=>this}};function lg(t,e,r){return n=>n instanceof Ot&&n.tracedSource===void 0?n.trace(t,e,r):new Ot().trace(t,e,r).append(n)}var Jo=class extends Ot{constructor(e,r=!0,n=!1){super(),this.indentImmediately=!0,this.indentEmptyLines=!1,typeof e=="string"?this.indentation=e:typeof e=="number"&&(this.indentation="".padStart(e)),this.indentImmediately=r,this.indentEmptyLines=n}},mi=class{constructor(e,r=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??xb,this.ifNotEmpty=r}},Be=new mi,pI=new mi(void 0,!0);function Dn(t){return"referenceType"in t}function On(t){return"elementType"in t}function gt(t){return"types"in t}function pg(t){if(gt(t)){let e=[];for(let r of t.types)e.push(...pg(r));return e}else return[t]}function Ar(t){return"value"in t}function wr(t){return"primitive"in t}function fn(t){return"string"in t}function Vr(t){return t&&"type"in t}function Yr(t){return t&&"properties"in t}var Tl=class{constructor(e,r){var n;this.superTypes=new Set,this.subTypes=new Set,this.typeNames=new Set,this.name=e,this.declared=(n=r?.declared)!==null&&n!==void 0?n:!1,this.dataType=r?.dataType}toAstTypesString(e){let r=new Ot;return r.append(`export type ${this.name} = ${Xr(this.type,"AstType")};`,Be),e&&(r.append(Be),wb(r,this.name)),this.dataType&&mI(r,this),Qo(r)}toDeclaredTypesString(e){let r=new Ot;return r.append(`type ${mg(this.name,e)} = ${Xr(this.type,"DeclaredType")};`,Be),Qo(r)}},es=class t{get superProperties(){return this.getSuperProperties(new Set)}getSuperProperties(e){if(e.has(this.name))return[];e.add(this.name);let r=new Map;for(let n of this.properties)r.set(n.name,n);for(let n of this.interfaceSuperTypes){let i=n.getSuperProperties(e);for(let o of i)r.has(o.name)||r.set(o.name,o)}return Array.from(r.values())}get allProperties(){let e=new Map(this.superProperties.map(n=>[n.name,n]));for(let n of this.subTypes)this.getSubTypeProperties(n,e,new Set);return Array.from(e.values())}getSubTypeProperties(e,r,n){if(n.has(this.name))return;n.add(this.name);let i=Yr(e)?e.properties:[];for(let o of i)r.has(o.name)||r.set(o.name,o);for(let o of e.subTypes)this.getSubTypeProperties(o,r,n)}get interfaceSuperTypes(){return Array.from(this.superTypes).filter(e=>e instanceof t)}constructor(e,r,n){this.superTypes=new Set,this.subTypes=new Set,this.containerTypes=new Set,this.typeNames=new Set,this.declared=!1,this.abstract=!1,this.properties=[],this.name=e,this.declared=r,this.abstract=n}toAstTypesString(e){let r=new Ot,n=this.interfaceSuperTypes.map(o=>o.name),i=n.length>0?Yi([...n]):["AstNode"];return r.append(`export interface ${this.name} extends ${i.join(", ")} {`,Be),r.indent(o=>{this.containerTypes.size>0&&o.append(`readonly $container: ${Yi([...this.containerTypes].map(s=>s.name)).join(" | ")};`,Be),this.typeNames.size>0&&o.append(`readonly $type: ${Yi([...this.typeNames]).map(s=>`'${s}'`).join(" | ")};`,Be),bb(o,this.properties,"AstType")}),r.append("}",Be),e&&(r.append(Be),wb(r,this.name)),Qo(r)}toDeclaredTypesString(e){let r=new Ot,n=mg(this.name,e),i=Yi(this.interfaceSuperTypes.map(o=>o.name)).join(", ");return r.append(`interface ${n}${i.length>0?` extends ${i}`:""} {`,Be),r.indent(o=>bb(o,this.properties,"DeclaredType",e)),r.append("}",Be),Qo(r)}},xl=class extends Error{constructor(e,r){super(e),this.name="TypeResolutionError",this.target=r}};function qa(t,e){return hi(t,e,new Map)}function hi(t,e,r){let n=`${Ua(t)}\xBB${Ua(e)}`,i=r.get(n);return i!==void 0||(r.set(n,!1),i=!1,gt(t)?i=t.types.every(o=>hi(o,e,r)):gt(e)?i=e.types.some(o=>hi(t,o,r)):Ar(e)&&Vr(e.value)?Ar(t)&&Vr(t.value)&&e.value.name===t.value.name?i=!0:i=hi(t,e.value.type,r):Dn(t)?i=Dn(e)&&hi(t.referenceType,e.referenceType,r):On(t)?i=On(e)&&hi(t.elementType,e.elementType,r):Ar(t)?Vr(t.value)?i=hi(t.value.type,e,r):Ar(e)?Vr(e.value)?i=hi(t,e.value.type,r):i=Ab(t.value,e.value,new Set):i=!1:wr(t)?i=wr(e)&&t.primitive===e.primitive:fn(t)&&(i=wr(e)&&e.primitive==="string"||fn(e)&&e.string===t.string),i&&r.set(n,i)),i}function Ab(t,e,r){let n=t.name;if(r.has(n))return!1;if(r.add(n),t.name===e.name)return!0;for(let i of t.superTypes)if(Yr(i)&&Ab(i,e,r))return!0;return!1}function Ua(t){if(Dn(t))return`@(${Ua(t.referenceType)})}`;if(On(t))return`(${Ua(t.elementType)})[]`;if(gt(t)){let e=t.types.map(r=>Ua(r)).join(" | ");return t.types.length<=1?`Union<${e}>`:e}else{if(Ar(t))return`Value<${t.value.name}>`;if(wr(t))return t.primitive;if(fn(t))return`'${t.string}'`}throw new Error("Invalid type")}function Xr(t,e="AstType"){if(Dn(t)){let r=Xr(t.referenceType,e);return e==="AstType"?`Reference<${r}>`:`@${fg(t.referenceType,r)}`}else if(On(t)){let r=Xr(t.elementType,e);return e==="AstType"?`Array<${r}>`:`${fg(t.elementType,r)}[]`}else if(gt(t)){let r=t.types.map(n=>fg(n,Xr(n,e)));return Yi(r).join(" | ")}else{if(Ar(t))return t.value.name;if(wr(t))return t.primitive;if(fn(t)){let r=e==="AstType"?"'":'"';return`${r}${t.string}${r}`}}throw new Error("Invalid type")}function fg(t,e){return gt(t)&&(e=`(${e})`),e}function bb(t,e,r,n=new Set){function i(o){let s=r==="AstType"?o.name:mg(o.name,n),a=o.optional&&!vl(o.type),c=Xr(o.type,r);return`${s}${a?"?":""}: ${c}`}Yi(e,(o,s)=>o.name.localeCompare(s.name)).forEach(o=>t.append(i(o),Be))}function vl(t){return On(t)?!0:Dn(t)?!1:gt(t)?t.types.every(e=>vl(e)):wr(t)?t.primitive==="boolean":!1}function wb(t,e){t.append(`export const ${e} = '${e}';`,Be),t.append(Be),t.append(`export function is${e}(item: unknown): item is ${e} {`,Be),t.indent(r=>r.append(`return reflection.isInstance(item, ${e});`,Be)),t.append("}",Be)}function mI(t,e){switch(e.dataType){case"string":if(dg(e.type)){let r=Array.from(e.subTypes).map(o=>o.name),n=kb(e.type),i=Eb(e.type);if(r.length===0&&n.length===0&&i.length===0)yl(t,e.name,`typeof item === '${e.dataType}'`);else{let o=hI(r,n,i);yl(t,e.name,o)}}break;case"number":case"boolean":case"bigint":yl(t,e.name,`typeof item === '${e.dataType}'`);break;case"Date":yl(t,e.name,"item instanceof Date");break;default:return}}function dg(t){let e=!0;if(wr(t))return t.primitive==="string";if(fn(t))return!0;if(gt(t)){for(let r of t.types)if(Ar(r))if(Vr(r.value)){if(!dg(r.value.type))return!1}else return!1;else if(wr(r)){if(r.primitive!=="string"||!r.regex)return!1}else if(gt(r))e=dg(r);else if(!fn(r))return!1}else return!1;return e}function hI(t,e,r){let n=[...t.map(i=>`is${i}(item)`),...e.map(i=>`item === '${i}'`)];if(r.length>0){let i=r.map(o=>`${o}.test(item)`).join(" || ");n.push(`(typeof item === 'string' && (${i}))`)}return n.join(" || ")}function mg(t,e){return e.has(t)?`^${t}`:t}function kb(t){let e=[];if(fn(t))return[t.string];if(gt(t))for(let r of t.types)fn(r)?e.push(r.string):gt(r)&&e.push(...kb(r));return e}function Eb(t){let e=[];if(wr(t)&&t.primitive==="string"&&t.regex&&e.push(t.regex),gt(t))for(let r of t.types)wr(r)&&r.primitive==="string"&&r.regex?e.push(r.regex):gt(r)&&e.push(...Eb(r));return e}function yl(t,e,r){t.append(Be,`export function is${e}(item: unknown): item is ${e} {`,Be),t.indent(n=>n.append(`return ${r};`,Be)),t.append("}",Be)}function Yi(t,e){return Array.from(new Set(t)).sort(e)}function hg(t,e,r,n){let i=new Set;return i.add(t),e.findReferences(t,{}).forEach(s=>{let a=r.getOrCreateDocument(s.sourceUri),c=n.getAstNode(a.parseResult.value,s.sourcePath);Ht(c)?(i.add(c),hg(c,e,r,n).forEach(l=>i.add(l))):c&<(c.$container)&&i.add(c.$container)}),i}function ja(t){let e=new Set;if(Ht(t))e.add(t),t.superTypes.forEach(r=>{if(Ht(r.ref)){e.add(r.ref);let n=ja(r.ref);for(let i of n)e.add(i)}});else if(lt(t)){let r=_b(t.type);for(let n of r){let i=ja(n);for(let o of i)e.add(o)}}return e}function _b(t){var e;if(Lr(t))return t.types.flatMap(r=>_b(r));if(Wt(t)){let r=(e=t.typeRef)===null||e===void 0?void 0:e.ref;if(lt(r)||Ht(r))return[r]}return[]}function gg(t,e){return t.interfaces.concat(e.interfaces)}function Sl(t){return t.interfaces.concat(t.unions)}function Cb(t){let e=t.sort((i,o)=>i.name.localeCompare(o.name)).map(i=>({value:i,nodes:[]}));for(let i of e)i.nodes=e.filter(o=>i.value.superTypes.has(o.value.name));let r=[],n=e.filter(i=>i.nodes.length===0);for(;n.length>0;){let i=n.shift();r.includes(i)||(r.push(i),e.filter(o=>o.nodes.includes(i)).forEach(o=>n.push(o)))}return r.map(i=>i.value)}function Nb(t){return Rl(t,new Set)}function Rl(t,e){if(e.has(t))return[];if(e.add(t),gt(t))return t.types.flatMap(r=>Rl(r,e));if(Ar(t)){let r=t.value;return"type"in r?Rl(r.type,e):[r.name]}else if(On(t))return Rl(t.elementType,e);return[]}function Ga(t){return typeof t.name=="string"}var ts=class{getName(e){if(Ga(e))return e.name}getNameNode(e){return $t(e.$cstNode,"name")}};function H(t){return t.charCodeAt(0)}function bl(t,e){Array.isArray(t)?t.forEach(function(r){e.push(r)}):e.push(t)}function rs(t,e){if(t[e]===!0)throw"duplicate flag "+e;let r=t[e];t[e]=!0}function Ji(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function Ha(){throw Error("Internal Error - Should never get here!")}function yg(t){return t.type==="Character"}var Wa=[];for(let t=H("0");t<=H("9");t++)Wa.push(t);var Ba=[H("_")].concat(Wa);for(let t=H("a");t<=H("z");t++)Ba.push(t);for(let t=H("A");t<=H("Z");t++)Ba.push(t);var Tg=[H(" "),H("\f"),H(`
|
|
39
|
-
`),H("\r"),H(" "),H("\v"),H(" "),H("\xA0"),H("\u1680"),H("\u2000"),H("\u2001"),H("\u2002"),H("\u2003"),H("\u2004"),H("\u2005"),H("\u2006"),H("\u2007"),H("\u2008"),H("\u2009"),H("\u200A"),H("\u2028"),H("\u2029"),H("\u202F"),H("\u205F"),H("\u3000"),H("\uFEFF")];var
|
|
38
|
+
`;function Zo(t){return t instanceof Ot||t instanceof Jo||t instanceof hi}function Qo(t,e){return Zo(t)?hb(t,e).text:String(t)}var Ot=class t{constructor(...e){this.contents=[],this.append(...e)}isEmpty(){return this.contents.length===0}trace(e,r,n){if(ut(e)){if(this.tracedSource={astNode:e,property:r,index:n},this.tracedSource.property===void 0&&this.tracedSource.index!==void 0&&this.tracedSource.index>-1)throw new Error("Generation support: 'property' argument must not be 'undefined' if a non-negative value is assigned to 'index' in 'CompositeGeneratorNode.trace(...)'.")}else this.tracedSource=e;return this}append(...e){for(let r of e)typeof r=="function"?r(this):r&&this.contents.push(r);return this}appendIf(e,...r){return e?this.append(...r):this}appendNewLine(){return this.append(Be)}appendNewLineIf(e){return e?this.append(Be):this}appendNewLineIfNotEmpty(){return this.append(hI)}appendNewLineIfNotEmptyIf(e){return e?this.appendNewLineIfNotEmpty():this}appendTemplate(e,...r){return this.append(ug(e,...r))}appendTemplateIf(e){return e?(r,...n)=>this.appendTemplate(r,...n):()=>this}indent(e){let{indentedChildren:r,indentation:n,indentEmptyLines:i,indentImmediately:o}=Array.isArray(e)||typeof e=="function"?{indentedChildren:e}:typeof e=="object"?e:{},s=new Jo(n,o,i);return this.contents.push(s),Array.isArray(r)?s.append(...r):r&&s.append(r),this}appendTraced(e,r,n){return i=>this.append(new t().trace(e,r,n).append(i))}appendTracedIf(e,r,n,i){return e?this.appendTraced(typeof r=="function"?r():r,n,i):()=>this}appendTracedTemplate(e,r,n){return(i,...o)=>this.append(bb(e,r,n)(i,...o))}appendTracedTemplateIf(e,r,n,i){return e?this.appendTracedTemplate(typeof r=="function"?r():r,n,i):()=>this}};function lg(t,e,r){return n=>n instanceof Ot&&n.tracedSource===void 0?n.trace(t,e,r):new Ot().trace(t,e,r).append(n)}var Jo=class extends Ot{constructor(e,r=!0,n=!1){super(),this.indentImmediately=!0,this.indentEmptyLines=!1,typeof e=="string"?this.indentation=e:typeof e=="number"&&(this.indentation="".padStart(e)),this.indentImmediately=r,this.indentEmptyLines=n}},hi=class{constructor(e,r=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??Rb,this.ifNotEmpty=r}},Be=new hi,hI=new hi(void 0,!0);function In(t){return"referenceType"in t}function Dn(t){return"elementType"in t}function gt(t){return"types"in t}function pg(t){if(gt(t)){let e=[];for(let r of t.types)e.push(...pg(r));return e}else return[t]}function Sr(t){return"value"in t}function br(t){return"primitive"in t}function un(t){return"string"in t}function zr(t){return t&&"type"in t}function Xr(t){return t&&"properties"in t}var Tl=class{constructor(e,r){var n;this.superTypes=new Set,this.subTypes=new Set,this.typeNames=new Set,this.name=e,this.declared=(n=r?.declared)!==null&&n!==void 0?n:!1,this.dataType=r?.dataType}toAstTypesString(e){let r=new Ot;return r.append(`export type ${this.name} = ${Vr(this.type,"AstType")};`,Be),e&&(r.append(Be),Eb(r,this.name)),this.dataType&&gI(r,this),Qo(r)}toDeclaredTypesString(e){let r=new Ot;return r.append(`type ${mg(this.name,e)} = ${Vr(this.type,"DeclaredType")};`,Be),Qo(r)}},es=class t{get superProperties(){return this.getSuperProperties(new Set)}getSuperProperties(e){if(e.has(this.name))return[];e.add(this.name);let r=new Map;for(let n of this.properties)r.set(n.name,n);for(let n of this.interfaceSuperTypes){let i=n.getSuperProperties(e);for(let o of i)r.has(o.name)||r.set(o.name,o)}return Array.from(r.values())}get allProperties(){let e=new Map(this.superProperties.map(n=>[n.name,n]));for(let n of this.subTypes)this.getSubTypeProperties(n,e,new Set);return Array.from(e.values())}getSubTypeProperties(e,r,n){if(n.has(this.name))return;n.add(this.name);let i=Xr(e)?e.properties:[];for(let o of i)r.has(o.name)||r.set(o.name,o);for(let o of e.subTypes)this.getSubTypeProperties(o,r,n)}get interfaceSuperTypes(){return Array.from(this.superTypes).filter(e=>e instanceof t)}constructor(e,r,n){this.superTypes=new Set,this.subTypes=new Set,this.containerTypes=new Set,this.typeNames=new Set,this.declared=!1,this.abstract=!1,this.properties=[],this.name=e,this.declared=r,this.abstract=n}toAstTypesString(e){let r=new Ot,n=this.interfaceSuperTypes.map(o=>o.name),i=n.length>0?Yi([...n]):["AstNode"];return r.append(`export interface ${this.name} extends ${i.join(", ")} {`,Be),r.indent(o=>{this.containerTypes.size>0&&o.append(`readonly $container: ${Yi([...this.containerTypes].map(s=>s.name)).join(" | ")};`,Be),this.typeNames.size>0&&o.append(`readonly $type: ${Yi([...this.typeNames]).map(s=>`'${s}'`).join(" | ")};`,Be),wb(o,this.properties,"AstType")}),r.append("}",Be),e&&(r.append(Be),Eb(r,this.name)),Qo(r)}toDeclaredTypesString(e){let r=new Ot,n=mg(this.name,e),i=Yi(this.interfaceSuperTypes.map(o=>o.name)).join(", ");return r.append(`interface ${n}${i.length>0?` extends ${i}`:""} {`,Be),r.indent(o=>wb(o,this.properties,"DeclaredType",e)),r.append("}",Be),Qo(r)}},xl=class extends Error{constructor(e,r){super(e),this.name="TypeResolutionError",this.target=r}};function qa(t,e){return gi(t,e,new Map)}function gi(t,e,r){let n=`${Ua(t)}\xBB${Ua(e)}`,i=r.get(n);return i!==void 0||(r.set(n,!1),i=!1,gt(t)?i=t.types.every(o=>gi(o,e,r)):gt(e)?i=e.types.some(o=>gi(t,o,r)):Sr(e)&&zr(e.value)?Sr(t)&&zr(t.value)&&e.value.name===t.value.name?i=!0:i=gi(t,e.value.type,r):In(t)?i=In(e)&&gi(t.referenceType,e.referenceType,r):Dn(t)?i=Dn(e)&&gi(t.elementType,e.elementType,r):Sr(t)?zr(t.value)?i=gi(t.value.type,e,r):Sr(e)?zr(e.value)?i=gi(t,e.value.type,r):i=kb(t.value,e.value,new Set):i=!1:br(t)?i=br(e)&&t.primitive===e.primitive:un(t)&&(i=br(e)&&e.primitive==="string"||un(e)&&e.string===t.string),i&&r.set(n,i)),i}function kb(t,e,r){let n=t.name;if(r.has(n))return!1;if(r.add(n),t.name===e.name)return!0;for(let i of t.superTypes)if(Xr(i)&&kb(i,e,r))return!0;return!1}function Ua(t){if(In(t))return`@(${Ua(t.referenceType)})}`;if(Dn(t))return`(${Ua(t.elementType)})[]`;if(gt(t)){let e=t.types.map(r=>Ua(r)).join(" | ");return t.types.length<=1?`Union<${e}>`:e}else{if(Sr(t))return`Value<${t.value.name}>`;if(br(t))return t.primitive;if(un(t))return`'${t.string}'`}throw new Error("Invalid type")}function Vr(t,e="AstType"){if(In(t)){let r=Vr(t.referenceType,e);return e==="AstType"?`Reference<${r}>`:`@${fg(t.referenceType,r)}`}else if(Dn(t)){let r=Vr(t.elementType,e);return e==="AstType"?`Array<${r}>`:`${fg(t.elementType,r)}[]`}else if(gt(t)){let r=t.types.map(n=>fg(n,Vr(n,e)));return Yi(r).join(" | ")}else{if(Sr(t))return t.value.name;if(br(t))return t.primitive;if(un(t)){let r=e==="AstType"?"'":'"';return`${r}${t.string}${r}`}}throw new Error("Invalid type")}function fg(t,e){return gt(t)&&(e=`(${e})`),e}function wb(t,e,r,n=new Set){function i(o){let s=r==="AstType"?o.name:mg(o.name,n),a=o.optional&&!vl(o.type),c=Vr(o.type,r);return`${s}${a?"?":""}: ${c}`}Yi(e,(o,s)=>o.name.localeCompare(s.name)).forEach(o=>t.append(i(o),Be))}function vl(t){return Dn(t)?!0:In(t)?!1:gt(t)?t.types.every(e=>vl(e)):br(t)?t.primitive==="boolean":!1}function Eb(t,e){t.append(`export const ${e} = '${e}';`,Be),t.append(Be),t.append(`export function is${e}(item: unknown): item is ${e} {`,Be),t.indent(r=>r.append(`return reflection.isInstance(item, ${e});`,Be)),t.append("}",Be)}function gI(t,e){switch(e.dataType){case"string":if(dg(e.type)){let r=Array.from(e.subTypes).map(o=>o.name),n=_b(e.type),i=Cb(e.type);if(r.length===0&&n.length===0&&i.length===0)yl(t,e.name,`typeof item === '${e.dataType}'`);else{let o=yI(r,n,i);yl(t,e.name,o)}}break;case"number":case"boolean":case"bigint":yl(t,e.name,`typeof item === '${e.dataType}'`);break;case"Date":yl(t,e.name,"item instanceof Date");break;default:return}}function dg(t){let e=!0;if(br(t))return t.primitive==="string";if(un(t))return!0;if(gt(t)){for(let r of t.types)if(Sr(r))if(zr(r.value)){if(!dg(r.value.type))return!1}else return!1;else if(br(r)){if(r.primitive!=="string"||!r.regex)return!1}else if(gt(r))e=dg(r);else if(!un(r))return!1}else return!1;return e}function yI(t,e,r){let n=[...t.map(i=>`is${i}(item)`),...e.map(i=>`item === '${i}'`)];if(r.length>0){let i=r.map(o=>`${o}.test(item)`).join(" || ");n.push(`(typeof item === 'string' && (${i}))`)}return n.join(" || ")}function mg(t,e){return e.has(t)?`^${t}`:t}function _b(t){let e=[];if(un(t))return[t.string];if(gt(t))for(let r of t.types)un(r)?e.push(r.string):gt(r)&&e.push(..._b(r));return e}function Cb(t){let e=[];if(br(t)&&t.primitive==="string"&&t.regex&&e.push(t.regex),gt(t))for(let r of t.types)br(r)&&r.primitive==="string"&&r.regex?e.push(r.regex):gt(r)&&e.push(...Cb(r));return e}function yl(t,e,r){t.append(Be,`export function is${e}(item: unknown): item is ${e} {`,Be),t.indent(n=>n.append(`return ${r};`,Be)),t.append("}",Be)}function Yi(t,e){return Array.from(new Set(t)).sort(e)}function hg(t,e,r,n){let i=new Set;return i.add(t),e.findReferences(t,{}).forEach(s=>{let a=r.getOrCreateDocument(s.sourceUri),c=n.getAstNode(a.parseResult.value,s.sourcePath);Ht(c)?(i.add(c),hg(c,e,r,n).forEach(l=>i.add(l))):c&<(c.$container)&&i.add(c.$container)}),i}function ja(t){let e=new Set;if(Ht(t))e.add(t),t.superTypes.forEach(r=>{if(Ht(r.ref)){e.add(r.ref);let n=ja(r.ref);for(let i of n)e.add(i)}});else if(lt(t)){let r=Nb(t.type);for(let n of r){let i=ja(n);for(let o of i)e.add(o)}}return e}function Nb(t){var e;if($r(t))return t.types.flatMap(r=>Nb(r));if(Wt(t)){let r=(e=t.typeRef)===null||e===void 0?void 0:e.ref;if(lt(r)||Ht(r))return[r]}return[]}function gg(t,e){return t.interfaces.concat(e.interfaces)}function Sl(t){return t.interfaces.concat(t.unions)}function Pb(t){let e=t.sort((i,o)=>i.name.localeCompare(o.name)).map(i=>({value:i,nodes:[]}));for(let i of e)i.nodes=e.filter(o=>i.value.superTypes.has(o.value.name));let r=[],n=e.filter(i=>i.nodes.length===0);for(;n.length>0;){let i=n.shift();r.includes(i)||(r.push(i),e.filter(o=>o.nodes.includes(i)).forEach(o=>n.push(o)))}return r.map(i=>i.value)}function Ib(t){return Rl(t,new Set)}function Rl(t,e){if(e.has(t))return[];if(e.add(t),gt(t))return t.types.flatMap(r=>Rl(r,e));if(Sr(t)){let r=t.value;return"type"in r?Rl(r.type,e):[r.name]}else if(Dn(t))return Rl(t.elementType,e);return[]}function Ga(t){return typeof t.name=="string"}var ts=class{getName(e){if(Ga(e))return e.name}getNameNode(e){return $t(e.$cstNode,"name")}};function H(t){return t.charCodeAt(0)}function bl(t,e){Array.isArray(t)?t.forEach(function(r){e.push(r)}):e.push(t)}function rs(t,e){if(t[e]===!0)throw"duplicate flag "+e;let r=t[e];t[e]=!0}function Ji(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function Ha(){throw Error("Internal Error - Should never get here!")}function yg(t){return t.type==="Character"}var Wa=[];for(let t=H("0");t<=H("9");t++)Wa.push(t);var Ba=[H("_")].concat(Wa);for(let t=H("a");t<=H("z");t++)Ba.push(t);for(let t=H("A");t<=H("Z");t++)Ba.push(t);var Tg=[H(" "),H("\f"),H(`
|
|
39
|
+
`),H("\r"),H(" "),H("\v"),H(" "),H("\xA0"),H("\u1680"),H("\u2000"),H("\u2001"),H("\u2002"),H("\u2003"),H("\u2004"),H("\u2005"),H("\u2006"),H("\u2007"),H("\u2008"),H("\u2009"),H("\u200A"),H("\u2028"),H("\u2029"),H("\u202F"),H("\u205F"),H("\u3000"),H("\uFEFF")];var TI=/[0-9a-fA-F]/,Al=/[0-9]/,xI=/[1-9]/,Qi=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":rs(n,"global");break;case"i":rs(n,"ignoreCase");break;case"m":rs(n,"multiLine");break;case"u":rs(n,"unicode");break;case"y":rs(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}Ji(r);let n=this.disjunction();return this.consumeChar(")"),{type:r,value:n,loc:this.loc(e)}}return Ha()}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;Ji(r);break}if(!(e===!0&&r===void 0)&&Ji(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()),Ji(e)?(e.loc=this.loc(r),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):Ha()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[H(`
|
|
40
40
|
`),H("\r"),H("\u2028"),H("\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=Wa;break;case"D":e=Wa,r=!0;break;case"s":e=Tg;break;case"S":e=Tg,r=!0;break;case"w":e=Ba;break;case"W":e=Ba,r=!0;break}return Ji(e)?{type:"Set",value:e,complement:r}:Ha()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=H("\f");break;case"n":e=H(`
|
|
41
41
|
`);break;case"r":e=H("\r");break;case"t":e=H(" ");break;case"v":e=H("\v");break}return Ji(e)?{type:"Character",value:e}:Ha()}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:H("\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:H(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|
42
42
|
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let e=this.popChar();return{type:"Character",value:H(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(yg(n)&&this.isRangeDash()){this.consumeChar("-");let o=this.classAtom(),s=o.type==="Character";if(yg(o)){if(o.value<n.value)throw Error("Range out of order in character class");e.push({from:n.value,to:o.value})}else bl(n.value,e),e.push(H("-")),bl(o.value,e)}else bl(n.value,e)}return this.consumeChar("]"),{type:"Set",complement:r,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
|
|
43
|
-
`: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:H("\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(
|
|
43
|
+
`: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:H("\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(xI.test(e)===!1)throw Error("Expecting a positive integer");for(;Al.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(Al.test(e)===!1)throw Error("Expecting an integer");for(;Al.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case`
|
|
44
44
|
`: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:H(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 Al.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
|
|
45
45
|
`: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`
|
|
46
|
-
`: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(
|
|
47
|
-
`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexStack=[];else{let n
|
|
48
|
-
`.match(n)}if(e.quantifier)this.isStarting=!1,this.endRegexStack=[];else{let r=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexStack.push(r),this.isStarting&&(this.startRegex+=r)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}},xg=new vg;function Pb(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),xg.reset(t),xg.visit(TI.pattern(t)),xg.multiline}catch{return!1}}function Rg(t){return(typeof t=="string"?new RegExp(t):t).test(" ")}function $n(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ib(t){return Array.prototype.map.call(t,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:$n(e)).join("")}function Db(t,e){let r=xI(t),n=e.match(r);return!!n&&n[0].length>0}function xI(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)}var Ob;(()=>{"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,f="",d=0,p=-1,T=0,S=0;S<=c.length;++S){if(S<c.length)l=c.charCodeAt(S);else{if(l===47)break;l=47}if(l===47){if(!(p===S-1||T===1))if(p!==S-1&&T===2){if(f.length<2||d!==2||f.charCodeAt(f.length-1)!==46||f.charCodeAt(f.length-2)!==46){if(f.length>2){var A=f.lastIndexOf("/");if(A!==f.length-1){A===-1?(f="",d=0):d=(f=f.slice(0,A)).length-1-f.lastIndexOf("/"),p=S,T=0;continue}}else if(f.length===2||f.length===1){f="",d=0,p=S,T=0;continue}}u&&(f.length>0?f+="/..":f="..",d=2)}else f.length>0?f+="/"+c.slice(p+1,S):f=c.slice(p+1,S),d=S-p-1;p=S,T=0}else l===46&&T!==-1?++T:T=-1}return f}var a={resolve:function(){for(var c,u="",l=!1,f=arguments.length-1;f>=-1&&!l;f--){var d;f>=0?d=arguments[f]:(c===void 0&&(c=process.cwd()),d=c),o(d),d.length!==0&&(u=d+"/"+u,l=d.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 f=c.length,d=f-l,p=1;p<u.length&&u.charCodeAt(p)===47;++p);for(var T=u.length-p,S=d<T?d:T,A=-1,x=0;x<=S;++x){if(x===S){if(T>S){if(u.charCodeAt(p+x)===47)return u.slice(p+x+1);if(x===0)return u.slice(p+x)}else d>S&&(c.charCodeAt(l+x)===47?A=x:x===0&&(A=0));break}var h=c.charCodeAt(l+x);if(h!==u.charCodeAt(p+x))break;h===47&&(A=x)}var m="";for(x=l+A+1;x<=f;++x)x!==f&&c.charCodeAt(x)!==47||(m.length===0?m+="..":m+="/..");return m.length>0?m+u.slice(p+A):(p+=A,u.charCodeAt(p)===47&&++p,u.slice(p))},_makeLong:function(c){return c},dirname:function(c){if(o(c),c.length===0)return".";for(var u=c.charCodeAt(0),l=u===47,f=-1,d=!0,p=c.length-1;p>=1;--p)if((u=c.charCodeAt(p))===47){if(!d){f=p;break}}else d=!1;return f===-1?l?"/":".":l&&f===1?"//":c.slice(0,f)},basename:function(c,u){if(u!==void 0&&typeof u!="string")throw new TypeError('"ext" argument must be a string');o(c);var l,f=0,d=-1,p=!0;if(u!==void 0&&u.length>0&&u.length<=c.length){if(u.length===c.length&&u===c)return"";var T=u.length-1,S=-1;for(l=c.length-1;l>=0;--l){var A=c.charCodeAt(l);if(A===47){if(!p){f=l+1;break}}else S===-1&&(p=!1,S=l+1),T>=0&&(A===u.charCodeAt(T)?--T==-1&&(d=l):(T=-1,d=S))}return f===d?d=S:d===-1&&(d=c.length),c.slice(f,d)}for(l=c.length-1;l>=0;--l)if(c.charCodeAt(l)===47){if(!p){f=l+1;break}}else d===-1&&(p=!1,d=l+1);return d===-1?"":c.slice(f,d)},extname:function(c){o(c);for(var u=-1,l=0,f=-1,d=!0,p=0,T=c.length-1;T>=0;--T){var S=c.charCodeAt(T);if(S!==47)f===-1&&(d=!1,f=T+1),S===46?u===-1?u=T:p!==1&&(p=1):u!==-1&&(p=-1);else if(!d){l=T+1;break}}return u===-1||f===-1||p===0||p===1&&u===f-1&&u===l+1?"":c.slice(u,f)},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 f=l.dir||l.root,d=l.base||(l.name||"")+(l.ext||"");return f?f===l.root?f+d:f+"/"+d:d}(0,c)},parse:function(c){o(c);var u={root:"",dir:"",base:"",ext:"",name:""};if(c.length===0)return u;var l,f=c.charCodeAt(0),d=f===47;d?(u.root="/",l=1):l=0;for(var p=-1,T=0,S=-1,A=!0,x=c.length-1,h=0;x>=l;--x)if((f=c.charCodeAt(x))!==47)S===-1&&(A=!1,S=x+1),f===46?p===-1?p=x:h!==1&&(h=1):p!==-1&&(h=-1);else if(!A){T=x+1;break}return p===-1||S===-1||h===0||h===1&&p===S-1&&p===T+1?S!==-1&&(u.base=u.name=T===0&&d?c.slice(1,S):c.slice(T,S)):(T===0&&d?(u.name=c.slice(1,p),u.base=c.slice(1,S)):(u.name=c.slice(T,p),u.base=c.slice(T,S)),u.ext=c.slice(p,S)),T>0?u.dir=c.slice(0,T-1):d&&(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:()=>d,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,v){if(!I.scheme&&v)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${I.authority}", path: "${I.path}", query: "${I.query}", fragment: "${I.fragment}"}`);if(I.scheme&&!o.test(I.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(I.path){if(I.authority){if(!s.test(I.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(I.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="/",f=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class d{static isUri(v){return v instanceof d||!!v&&typeof v.authority=="string"&&typeof v.fragment=="string"&&typeof v.path=="string"&&typeof v.query=="string"&&typeof v.scheme=="string"&&typeof v.fsPath=="string"&&typeof v.with=="function"&&typeof v.toString=="function"}scheme;authority;path;query;fragment;constructor(v,D,L,ne,K,B=!1){typeof v=="object"?(this.scheme=v.scheme||u,this.authority=v.authority||u,this.path=v.path||u,this.query=v.query||u,this.fragment=v.fragment||u):(this.scheme=function(xt,vt){return xt||vt?xt:"file"}(v,B),this.authority=D||u,this.path=function(xt,vt){switch(xt){case"https":case"http":case"file":vt?vt[0]!==l&&(vt=l+vt):vt=l}return vt}(this.scheme,L||u),this.query=ne||u,this.fragment=K||u,c(this,B))}get fsPath(){return h(this,!1)}with(v){if(!v)return this;let{scheme:D,authority:L,path:ne,query:K,fragment:B}=v;return D===void 0?D=this.scheme:D===null&&(D=u),L===void 0?L=this.authority:L===null&&(L=u),ne===void 0?ne=this.path:ne===null&&(ne=u),K===void 0?K=this.query:K===null&&(K=u),B===void 0?B=this.fragment:B===null&&(B=u),D===this.scheme&&L===this.authority&&ne===this.path&&K===this.query&&B===this.fragment?this:new T(D,L,ne,K,B)}static parse(v,D=!1){let L=f.exec(v);return L?new T(L[2]||u,V(L[4]||u),V(L[5]||u),V(L[7]||u),V(L[9]||u),D):new T(u,u,u,u,u)}static file(v){let D=u;if(i&&(v=v.replace(/\\/g,l)),v[0]===l&&v[1]===l){let L=v.indexOf(l,2);L===-1?(D=v.substring(2),v=l):(D=v.substring(2,L),v=v.substring(L)||l)}return new T("file",D,v,u,u)}static from(v){let D=new T(v.scheme,v.authority,v.path,v.query,v.fragment);return c(D,!0),D}toString(v=!1){return m(this,v)}toJSON(){return this}static revive(v){if(v){if(v instanceof d)return v;{let D=new T(v);return D._formatted=v.external,D._fsPath=v._sep===p?v.fsPath:null,D}}return v}}let p=i?1:void 0;class T extends d{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=h(this,!1)),this._fsPath}toString(v=!1){return v?m(this,!0):(this._formatted||(this._formatted=m(this,!1)),this._formatted)}toJSON(){let v={$mid:1};return this._fsPath&&(v.fsPath=this._fsPath,v._sep=p),this._formatted&&(v.external=this._formatted),this.path&&(v.path=this.path),this.scheme&&(v.scheme=this.scheme),this.authority&&(v.authority=this.authority),this.query&&(v.query=this.query),this.fragment&&(v.fragment=this.fragment),v}}let S={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 A(I,v,D){let L,ne=-1;for(let K=0;K<I.length;K++){let B=I.charCodeAt(K);if(B>=97&&B<=122||B>=65&&B<=90||B>=48&&B<=57||B===45||B===46||B===95||B===126||v&&B===47||D&&B===91||D&&B===93||D&&B===58)ne!==-1&&(L+=encodeURIComponent(I.substring(ne,K)),ne=-1),L!==void 0&&(L+=I.charAt(K));else{L===void 0&&(L=I.substr(0,K));let xt=S[B];xt!==void 0?(ne!==-1&&(L+=encodeURIComponent(I.substring(ne,K)),ne=-1),L+=xt):ne===-1&&(ne=K)}}return ne!==-1&&(L+=encodeURIComponent(I.substring(ne))),L!==void 0?L:I}function x(I){let v;for(let D=0;D<I.length;D++){let L=I.charCodeAt(D);L===35||L===63?(v===void 0&&(v=I.substr(0,D)),v+=S[L]):v!==void 0&&(v+=I[D])}return v!==void 0?v:I}function h(I,v){let D;return D=I.authority&&I.path.length>1&&I.scheme==="file"?`//${I.authority}${I.path}`:I.path.charCodeAt(0)===47&&(I.path.charCodeAt(1)>=65&&I.path.charCodeAt(1)<=90||I.path.charCodeAt(1)>=97&&I.path.charCodeAt(1)<=122)&&I.path.charCodeAt(2)===58?v?I.path.substr(1):I.path[1].toLowerCase()+I.path.substr(2):I.path,i&&(D=D.replace(/\//g,"\\")),D}function m(I,v){let D=v?x:A,L="",{scheme:ne,authority:K,path:B,query:xt,fragment:vt}=I;if(ne&&(L+=ne,L+=":"),(K||ne==="file")&&(L+=l,L+=l),K){let oe=K.indexOf("@");if(oe!==-1){let tn=K.substr(0,oe);K=K.substr(oe+1),oe=tn.lastIndexOf(":"),oe===-1?L+=D(tn,!1,!1):(L+=D(tn.substr(0,oe),!1,!1),L+=":",L+=D(tn.substr(oe+1),!1,!0)),L+="@"}K=K.toLowerCase(),oe=K.lastIndexOf(":"),oe===-1?L+=D(K,!1,!0):(L+=D(K.substr(0,oe),!1,!0),L+=K.substr(oe))}if(B){if(B.length>=3&&B.charCodeAt(0)===47&&B.charCodeAt(2)===58){let oe=B.charCodeAt(1);oe>=65&&oe<=90&&(B=`/${String.fromCharCode(oe+32)}:${B.substr(3)}`)}else if(B.length>=2&&B.charCodeAt(1)===58){let oe=B.charCodeAt(0);oe>=65&&oe<=90&&(B=`${String.fromCharCode(oe+32)}:${B.substr(2)}`)}L+=D(B,!0,!1)}return xt&&(L+="?",L+=D(xt,!1,!1)),vt&&(L+="#",L+=v?vt:A(vt,!1,!1)),L}function b(I){try{return decodeURIComponent(I)}catch{return I.length>3?I.substr(0,3)+b(I.substr(3)):I}}let _=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function V(I){return I.match(_)?I.replace(_,v=>b(v)):I}var Ct=r(470);let rt=Ct.posix||Ct,Tr="/";var Xt;(function(I){I.joinPath=function(v,...D){return v.with({path:rt.join(v.path,...D)})},I.resolvePath=function(v,...D){let L=v.path,ne=!1;L[0]!==Tr&&(L=Tr+L,ne=!0);let K=rt.resolve(L,...D);return ne&&K[0]===Tr&&!v.authority&&(K=K.substring(1)),v.with({path:K})},I.dirname=function(v){if(v.path.length===0||v.path===Tr)return v;let D=rt.dirname(v.path);return D.length===1&&D.charCodeAt(0)===46&&(D=""),v.with({path:D})},I.basename=function(v){return rt.basename(v.path)},I.extname=function(v){return rt.extname(v.path)}})(Xt||(Xt={}))})(),Ob=n})();var{URI:At,Utils:ns}=Ob;var ue;(function(t){t.basename=ns.basename,t.dirname=ns.dirname,t.extname=ns.extname,t.joinPath=ns.joinPath,t.resolvePath=ns.resolvePath;function e(n,i){return n?.toString()===i?.toString()}t.equals=e;function r(n,i){let o=typeof n=="string"?n:n.path,s=typeof i=="string"?i:i.path,a=o.split("/").filter(d=>d.length>0),c=s.split("/").filter(d=>d.length>0),u=0;for(;u<a.length&&a[u]===c[u];u++);let l="../".repeat(a.length-u),f=c.slice(u).join("/");return l+f}t.relative=r})(ue||(ue={}));var PW=ue.equals,IW=ue.relative;var wl,$b=()=>wl??(wl=kl(`{"$type":"Grammar","isDeclared":true,"name":"LangiumGrammar","rules":[{"$type":"ParserRule","name":"Grammar","entry":true,"definition":{"$type":"Group","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"isDeclared","operator":"?=","terminal":{"$type":"Keyword","value":"grammar"}},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"with"},{"$type":"Assignment","feature":"usedGrammars","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@0"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"usedGrammars","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@0"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}}],"cardinality":"*"}],"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Assignment","feature":"definesHiddenTokens","operator":"?=","terminal":{"$type":"Keyword","value":"hidden"}},{"$type":"Keyword","value":"("},{"$type":"Group","elements":[{"$type":"Assignment","feature":"hiddenTokens","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@11"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"hiddenTokens","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@11"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}}],"cardinality":"*"}],"cardinality":"?"},{"$type":"Keyword","value":")"}],"cardinality":"?"}],"cardinality":"?"},{"$type":"Assignment","feature":"imports","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"interfaces","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"types","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"+"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Interface","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"interface"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"extends"},{"$type":"Assignment","feature":"superTypes","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@0"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"superTypes","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@0"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}}],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SchemaType","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"attributes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TypeAttribute","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@59"},"arguments":[]}},{"$type":"Assignment","feature":"isOptional","operator":"?=","terminal":{"$type":"Keyword","value":"?"},"cardinality":"?"},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TypeDefinition","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"UnionType","inferredType":{"$type":"InferredType","name":"TypeDefinition"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"UnionType"},"feature":"types","operator":"+="},{"$type":"Group","elements":[{"$type":"Keyword","value":"|"},{"$type":"Assignment","feature":"types","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}],"cardinality":"+"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ArrayType","inferredType":{"$type":"InferredType","name":"TypeDefinition"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ArrayType"},"feature":"elementType","operator":"="},{"$type":"Keyword","value":"["},{"$type":"Keyword","value":"]"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ReferenceType","inferredType":{"$type":"InferredType","name":"TypeDefinition"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ReferenceType"}},{"$type":"Keyword","value":"@"},{"$type":"Assignment","feature":"referenceType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SimpleType","inferredType":{"$type":"InferredType","name":"TypeDefinition"},"definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Keyword","value":")"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"SimpleType"}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"typeRef","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@0"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"primitiveType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"stringType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@61"},"arguments":[]}}]}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PrimitiveType","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"string"},{"$type":"Keyword","value":"number"},{"$type":"Keyword","value":"boolean"},{"$type":"Keyword","value":"Date"},{"$type":"Keyword","value":"bigint"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Type","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"type"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}},{"$type":"Keyword","value":"="},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"AbstractRule","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@47"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"GrammarImport","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"import"},{"$type":"Assignment","feature":"path","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@61"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ParserRule","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"entry","operator":"?=","terminal":{"$type":"Keyword","value":"entry"}},{"$type":"Assignment","feature":"fragment","operator":"?=","terminal":{"$type":"Keyword","value":"fragment"}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"wildcard","operator":"?=","terminal":{"$type":"Keyword","value":"*"}},{"$type":"Group","elements":[{"$type":"Keyword","value":"returns"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"returnType","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@0"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"dataType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]}]},{"$type":"Assignment","feature":"inferredType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[{"$type":"NamedArgument","value":{"$type":"LiteralCondition","true":false},"calledByName":false}]}}],"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Assignment","feature":"definesHiddenTokens","operator":"?=","terminal":{"$type":"Keyword","value":"hidden"}},{"$type":"Keyword","value":"("},{"$type":"Group","elements":[{"$type":"Assignment","feature":"hiddenTokens","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@11"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"hiddenTokens","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@11"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}}],"cardinality":"*"}],"cardinality":"?"},{"$type":"Keyword","value":")"}],"cardinality":"?"},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"definition","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Keyword","value":";"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"InferredType","parameters":[{"$type":"Parameter","name":"imperative"}],"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","guardCondition":{"$type":"ParameterReference","parameter":{"$ref":"#/rules@14/parameters@0"}},"elements":[{"$type":"Keyword","value":"infer"}]},{"$type":"Group","guardCondition":{"$type":"Negation","value":{"$type":"ParameterReference","parameter":{"$ref":"#/rules@14/parameters@0"}}},"elements":[{"$type":"Keyword","value":"infers"}]}]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"wildcard":false},{"$type":"ParserRule","name":"RuleNameAndParams","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"<"},{"$type":"Group","elements":[{"$type":"Assignment","feature":"parameters","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"parameters","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"*"}],"cardinality":"?"},{"$type":"Keyword","value":">"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Parameter","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Alternatives","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Alternatives"},"feature":"elements","operator":"+="},{"$type":"Group","elements":[{"$type":"Keyword","value":"|"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}],"cardinality":"+"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ConditionalBranch","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Group"}},{"$type":"Keyword","value":"<"},{"$type":"Assignment","feature":"guardCondition","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]}},{"$type":"Keyword","value":">"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"+"}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"UnorderedGroup","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"UnorderedGroup"},"feature":"elements","operator":"+="},{"$type":"Group","elements":[{"$type":"Keyword","value":"&"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"+"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Group","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Group"},"feature":"elements","operator":"+="},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"+"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"AbstractToken","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"AbstractTokenWithCardinality","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@38"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]}]},{"$type":"Assignment","feature":"cardinality","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"?"},{"$type":"Keyword","value":"*"},{"$type":"Keyword","value":"+"}]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Action","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Action"}},{"$type":"Keyword","value":"{"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@0"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"inferredType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[{"$type":"NamedArgument","value":{"$type":"LiteralCondition","true":true},"calledByName":false}]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"."},{"$type":"Assignment","feature":"feature","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@59"},"arguments":[]}},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"="},{"$type":"Keyword","value":"+="}]}},{"$type":"Keyword","value":"current"}],"cardinality":"?"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"AbstractTerminal","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@44"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@36"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@37"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@45"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EndOfFile","definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"EndOfFile"}},{"$type":"Keyword","value":"EOF"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Keyword","definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@61"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RuleCall","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rule","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@11"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Keyword","value":"<"},{"$type":"Assignment","feature":"arguments","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"arguments","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}}],"cardinality":"*"},{"$type":"Keyword","value":">"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NamedArgument","definition":{"$type":"Group","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"parameter","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@16"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"calledByName","operator":"?=","terminal":{"$type":"Keyword","value":"="}}],"cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LiteralCondition","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"true","operator":"?=","terminal":{"$type":"Keyword","value":"true"}},{"$type":"Keyword","value":"false"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Disjunction","inferredType":{"$type":"InferredType","name":"Condition"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Disjunction"},"feature":"left","operator":"="},{"$type":"Keyword","value":"|"},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Conjunction","inferredType":{"$type":"InferredType","name":"Condition"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Conjunction"},"feature":"left","operator":"="},{"$type":"Keyword","value":"&"},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Negation","inferredType":{"$type":"InferredType","name":"Condition"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@33"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Negation"}},{"$type":"Keyword","value":"!"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Atom","inferredType":{"$type":"InferredType","name":"Condition"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@35"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@34"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ParenthesizedCondition","inferredType":{"$type":"InferredType","name":"Condition"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]},{"$type":"Keyword","value":")"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ParameterReference","definition":{"$type":"Assignment","feature":"parameter","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@16"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PredicatedKeyword","inferredType":{"$type":"InferredType","name":"Keyword"},"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"=>"},{"$type":"Keyword","value":"->"}]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@61"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PredicatedRuleCall","inferredType":{"$type":"InferredType","name":"RuleCall"},"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"=>"},{"$type":"Keyword","value":"->"}]},{"$type":"Assignment","feature":"rule","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@11"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Keyword","value":"<"},{"$type":"Assignment","feature":"arguments","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"arguments","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}}],"cardinality":"*"},{"$type":"Keyword","value":">"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Assignment","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Assignment"}},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"=>"},{"$type":"Keyword","value":"->"}],"cardinality":"?"},{"$type":"Assignment","feature":"feature","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@59"},"arguments":[]}},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"+="},{"$type":"Keyword","value":"="},{"$type":"Keyword","value":"?="}]}},{"$type":"Assignment","feature":"terminal","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"AssignableTerminal","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@40"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@42"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ParenthesizedAssignableElement","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]},{"$type":"Keyword","value":")"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"AssignableAlternatives","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Alternatives"},"feature":"elements","operator":"+="},{"$type":"Group","elements":[{"$type":"Keyword","value":"|"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}}],"cardinality":"+"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CrossReference","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"CrossReference"}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@0"},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"deprecatedSyntax","operator":"?=","terminal":{"$type":"Keyword","value":"|"}},{"$type":"Keyword","value":":"}]},{"$type":"Assignment","feature":"terminal","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@43"},"arguments":[]}}],"cardinality":"?"},{"$type":"Keyword","value":"]"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CrossReferenceableTerminal","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ParenthesizedElement","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]},{"$type":"Keyword","value":")"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PredicatedGroup","inferredType":{"$type":"InferredType","name":"Group"},"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"=>"},{"$type":"Keyword","value":"->"}]},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ReturnType","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TerminalRule","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"hidden","operator":"?=","terminal":{"$type":"Keyword","value":"hidden"},"cardinality":"?"},{"$type":"Keyword","value":"terminal"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"fragment","operator":"?=","terminal":{"$type":"Keyword","value":"fragment"}},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"returns"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@46"},"arguments":[]}}],"cardinality":"?"}]}]},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"definition","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":";"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TerminalAlternatives","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@49"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"TerminalAlternatives"},"feature":"elements","operator":"+="},{"$type":"Keyword","value":"|"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@49"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TerminalGroup","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"TerminalGroup"},"feature":"elements","operator":"+="},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},"cardinality":"+"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TerminalToken","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"Assignment","feature":"cardinality","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"?"},{"$type":"Keyword","value":"*"},{"$type":"Keyword","value":"+"}]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TerminalTokenElement","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@58"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@53"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@54"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@55"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@56"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@57"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ParenthesizedTerminalElement","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"lookahead","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"?="},{"$type":"Keyword","value":"?!"}]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]},{"$type":"Keyword","value":")"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TerminalRuleCall","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"TerminalRuleCall"}},{"$type":"Assignment","feature":"rule","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@47"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NegatedToken","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"NegatedToken"}},{"$type":"Keyword","value":"!"},{"$type":"Assignment","feature":"terminal","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"UntilToken","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"UntilToken"}},{"$type":"Keyword","value":"->"},{"$type":"Assignment","feature":"terminal","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RegexToken","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"RegexToken"}},{"$type":"Assignment","feature":"regex","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@62"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Wildcard","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Wildcard"}},{"$type":"Keyword","value":"."}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CharacterRange","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"CharacterRange"}},{"$type":"Assignment","feature":"left","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":".."},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"FeatureName","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"current"},{"$type":"Keyword","value":"entry"},{"$type":"Keyword","value":"extends"},{"$type":"Keyword","value":"false"},{"$type":"Keyword","value":"fragment"},{"$type":"Keyword","value":"grammar"},{"$type":"Keyword","value":"hidden"},{"$type":"Keyword","value":"import"},{"$type":"Keyword","value":"interface"},{"$type":"Keyword","value":"returns"},{"$type":"Keyword","value":"terminal"},{"$type":"Keyword","value":"true"},{"$type":"Keyword","value":"type"},{"$type":"Keyword","value":"infer"},{"$type":"Keyword","value":"infers"},{"$type":"Keyword","value":"with"},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"ID","definition":{"$type":"RegexToken","regex":"/\\\\^?[_a-zA-Z][\\\\w_]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"(\\\\\\\\.|[^\\"\\\\\\\\])*\\"|'(\\\\\\\\.|[^'\\\\\\\\])*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"RegexLiteral","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\/(?![*+?])(?:[^\\\\r\\\\n\\\\[/\\\\\\\\]|\\\\\\\\.|\\\\[(?:[^\\\\r\\\\n\\\\]\\\\\\\\]|\\\\\\\\.)*\\\\])+\\\\/[a-z]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/\\\\s+/"},"fragment":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}],"types":[{"$type":"Type","name":"AbstractType","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@1"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@10"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@23/definition/elements@0"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@13"}}]}}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"interfaces":[],"usedGrammars":[]}`));qi();var Ka=se(_n(),1);function vI(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}var Lb=0,RI=10;var Mb=Symbol("OperationCancelled");function Zi(t){return t===Mb}async function Ue(t){if(t===Ka.CancellationToken.None)return;let e=Date.now();if(e-Lb>=RI&&(Lb=e,await vI()),t.isCancellationRequested)throw Mb}var El=class{constructor(){this.previousAction=Promise.resolve(),this.previousTokenSource=new Ka.CancellationTokenSource}lock(e){this.cancel();let r=new Ka.CancellationTokenSource;return this.previousTokenSource=r,this.previousAction=this.previousAction.then(()=>e(r.token).catch(n=>{Zi(n)||console.error("Error: ",n)}))}cancel(){this.previousTokenSource.cancel()}};function kr(t){return{code:t}}var za;(function(t){t.all=["fast","slow","built-in"]})(za||(za={}));var _l=class{constructor(e){this.entries=new ye,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)}}}wrapValidationException(e,r){return async(n,i,o)=>{try{await e.call(r,n,i,o)}catch(s){if(Zi(s))throw s;console.error("An error occurred during validation:",s);let a=s instanceof Error?s.message:String(s);s instanceof Error&&s.stack&&console.error(s.stack),i("error","An error occurred during validation: "+a,{node:n})}}}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=J(this.entries.get(e)).concat(this.entries.get("AstNode"));return r&&(n=n.filter(i=>r.includes(i.category))),n.map(i=>i.check)}};function Fb(t,e){let r={unions:[],interfaces:[]};for(let n of t){let i=[];for(let a of n.attributes)i.push({name:a.name,optional:a.isOptional,astNodes:new Set([a]),type:eo(a.type)});let o=new Set;for(let a of n.superTypes)a.ref&&o.add(Jr(a.ref));let s={name:n.name,declared:!0,abstract:!1,properties:i,superTypes:o,subTypes:new Set};r.interfaces.push(s)}for(let n of e){let i={name:n.name,declared:!0,type:eo(n.type),superTypes:new Set,subTypes:new Set};r.unions.push(i)}return r}function eo(t){if(Vi(t))return{elementType:eo(t.elementType)};if(Xi(t))return{referenceType:eo(t.referenceType)};if(Lr(t))return{types:t.types.map(eo)};if(Wt(t)){let e;if(t.primitiveType)return e=t.primitiveType,{primitive:e};if(t.stringType)return e=t.stringType,{string:e};if(t.typeRef){let r=t.typeRef.ref,n=pn(r);if(n)return is(n)?{primitive:n}:{value:n}}}return{primitive:"unknown"}}function os(t){return"referenceType"in t}function Sg(t){return"elementType"in t}function Ub(t){return"types"in t}function bg(t){return"value"in t}function SI(t){return"primitive"in t}function bI(t){return"string"in t}function qb(t){let e=new Map,r=new Map;for(let n of t.interfaces){let i=new es(n.name,n.declared,n.abstract);e.set(n.name,i)}for(let n of t.unions){let i=new Tl(n.name,{declared:n.declared,dataType:n.dataType});r.set(n.name,i)}for(let n of t.interfaces){let i=e.get(n.name);for(let o of n.superTypes){let s=e.get(o)||r.get(o);s&&i.superTypes.add(s)}for(let o of n.subTypes){let s=e.get(o)||r.get(o);s&&i.subTypes.add(s)}for(let o of n.properties){let s=AI(o,e,r);i.properties.push(s)}}for(let n of t.unions){let i=r.get(n.name);i.type=Va(n.type,i,e,r)}return{interfaces:Array.from(e.values()),unions:Array.from(r.values())}}function AI(t,e,r){return{name:t.name,optional:t.optional,astNodes:t.astNodes,type:Va(t.type,void 0,e,r)}}function Va(t,e,r,n){if(Sg(t))return{elementType:Va(t.elementType,e,r,n)};if(os(t))return{referenceType:Va(t.referenceType,void 0,r,n)};if(Ub(t))return{types:t.types.map(i=>Va(i,e,r,n))};if(bI(t))return{string:t.string};if(SI(t))return{primitive:t.primitive,regex:t.regex};if(bg(t)){let i=r.get(t.value)||n.get(t.value);return i?(e&&e.subTypes.add(i),{value:i}):{primitive:"unknown"}}else throw new Error("Invalid property type")}function wg(t,e){let r=Xa(t),n=Xa(e);for(let i of n)wI(r,i)||r.push(i);return r.length===1?r[0]:{types:r}}function wI(t,e){return t.some(r=>Ag(r,e))}function Ag(t,e){return Sg(t)&&Sg(e)?Ag(t.elementType,e.elementType):os(t)&&os(e)?Ag(t.referenceType,e.referenceType):bg(t)&&bg(e)?t.value===e.value:!1}function Xa(t){return Ub(t)?t.types.flatMap(e=>Xa(e)):[t]}function jb(t){let e=t.validation.ValidationRegistry,r=t.validation.LangiumGrammarValidator,n={Action:[r.checkAssignmentReservedName],AbstractRule:r.checkRuleName,Assignment:[r.checkAssignmentWithFeatureName,r.checkAssignmentToFragmentRule,r.checkAssignmentTypes,r.checkAssignmentReservedName],ParserRule:[r.checkParserRuleDataType,r.checkRuleParametersUsed,r.checkParserRuleReservedName],TerminalRule:[r.checkTerminalRuleReturnType,r.checkHiddenTerminalRule,r.checkEmptyTerminalRule],InferredType:r.checkTypeReservedName,Keyword:r.checkKeyword,UnorderedGroup:r.checkUnorderedGroup,Grammar:[r.checkGrammarName,r.checkEntryGrammarRule,r.checkUniqueRuleName,r.checkUniqueTypeName,r.checkUniqueImportedRules,r.checkDuplicateImportedGrammar,r.checkGrammarHiddenTokens,r.checkGrammarForUnusedRules,r.checkGrammarTypeInfer,r.checkClashingTerminalNames],GrammarImport:r.checkPackageImport,CharacterRange:r.checkInvalidCharacterRange,Interface:[r.checkTypeReservedName,r.checkInterfacePropertyTypes],Type:[r.checkTypeReservedName],TypeAttribute:r.checkTypeReservedName,RuleCall:[r.checkUsedHiddenTerminalRule,r.checkUsedFragmentTerminalRule,r.checkRuleCallParameters],TerminalRuleCall:r.checkUsedHiddenTerminalRule,CrossReference:[r.checkCrossReferenceSyntax,r.checkCrossRefNameAssignment,r.checkCrossRefTerminalType,r.checkCrossRefType,r.checkCrossReferenceToTypeUnion],SimpleType:r.checkFragmentsInTypes,ReferenceType:r.checkReferenceTypeUnion,RegexToken:[r.checkInvalidRegexFlags,r.checkDirectlyUsedRegexFlags]};e.register(n,r)}var Re;(function(t){t.GrammarNameUppercase="grammar-name-uppercase",t.RuleNameUppercase="rule-name-uppercase",t.HiddenGrammarTokens="hidden-grammar-tokens",t.UseRegexTokens="use-regex-tokens",t.EntryRuleTokenSyntax="entry-rule-token-syntax",t.CrossRefTokenSyntax="cross-ref-token-syntax",t.UnnecessaryFileExtension="unnecessary-file-extension",t.InvalidReturns="invalid-returns",t.InvalidInfers="invalid-infers",t.MissingInfer="missing-infer",t.MissingReturns="missing-returns",t.SuperfluousInfer="superfluous-infer",t.OptionalUnorderedGroup="optional-unordered-group"})(Re||(Re={}));var Cl=class{constructor(e){this.references=e.references.References,this.documents=e.shared.workspace.LangiumDocuments}checkGrammarName(e,r){if(e.name){let n=e.name.substring(0,1);n.toUpperCase()!==n&&r("warning","Grammar name should start with an upper case letter.",{node:e,property:"name",data:kr(Re.GrammarNameUppercase)})}}checkEntryGrammarRule(e,r){if(e.isDeclared&&!e.name)return;let n=e.rules.filter(i=>M(i)&&i.entry);if(e.isDeclared&&n.length===0){let i=e.rules.find(o=>M(o)&&!Er(o));i?r("error","The grammar is missing an entry parser rule. This rule can be an entry one.",{node:i,property:"name",data:kr(Re.EntryRuleTokenSyntax)}):r("error","This grammar is missing an entry parser rule.",{node:e,property:"name"})}else!e.isDeclared&&n.length>=1?n.forEach(i=>r("error","Cannot declare entry rules for unnamed grammars.",{node:i,property:"name"})):n.length>1?n.forEach(i=>r("error","The entry rule has to be unique.",{node:i,property:"name"})):n.length===1&&Er(n[0])&&r("error","The entry rule cannot be a data type rule.",{node:n[0],property:"name"})}checkUniqueRuleName(e,r){let n=i=>J(i.rules).filter(o=>!Ya(o));this.checkUniqueName(e,r,n,"rule")}checkUniqueTypeName(e,r){let n=i=>J(i.types).concat(i.interfaces);this.checkUniqueName(e,r,n,"type")}checkUniqueName(e,r,n,i){let o=new ye;n(e).forEach(c=>o.add(c.name,c));for(let[,c]of o.entriesGroupedByKey())c.length>1&&c.forEach(u=>{r("error",`A ${i}'s name has to be unique.`,{node:u,property:"name"})});let s=new Set,a=Ja(this.documents,e);for(let c of a)n(c).forEach(u=>s.add(u.name));for(let c of o.keys())s.has(c)&&o.get(c).forEach(l=>{r("error",`A ${i} with the name '${l.name}' already exists in an imported grammar.`,{node:l,property:"name"})})}checkDuplicateImportedGrammar(e,r){let n=new ye;for(let i of e.imports){let o=Ln(this.documents,i);o&&n.add(o,i)}for(let[,i]of n.entriesGroupedByKey())i.length>1&&i.forEach((o,s)=>{s>0&&r("warning","The grammar is already being directly imported.",{node:o,tags:[Fi.Unnecessary]})})}checkUniqueImportedRules(e,r){let n=new Map;for(let o of e.imports){let s=Ja(this.documents,o);n.set(o,s)}let i=new ye;for(let o of e.imports){let s=n.get(o);for(let a of e.imports){if(o===a)continue;let c=n.get(a),u=this.getDuplicateExportedRules(s,c);for(let l of u)i.add(o,l)}}for(let o of e.imports){let s=i.get(o);s.length>0&&r("error","Some rules exported by this grammar are also included in other imports: "+J(s).distinct().join(", "),{node:o,property:"path"})}}getDuplicateExportedRules(e,r){let i=e.filter(a=>!r.includes(a)).flatMap(a=>a.rules),o=r.flatMap(a=>a.rules),s=new Set;for(let a of i){let c=a.name;for(let u of o){let l=u.name;c===l&&s.add(u.name)}}return s}checkGrammarTypeInfer(e,r){var n,i,o;let s=new Set;for(let c of e.types)s.add(c.name);for(let c of e.interfaces)s.add(c.name);for(let c of Ja(this.documents,e))c.types.forEach(u=>s.add(u.name)),c.interfaces.forEach(u=>s.add(u.name));for(let c of e.rules.filter(M)){if(Ya(c))continue;let u=Er(c),l=!c.returnType&&!c.dataType,f=pn(c);if(!u&&f&&s.has(f)===l){if((l||((n=c.returnType)===null||n===void 0?void 0:n.ref)!==void 0)&&c.inferredType===void 0)r("error",a(f,l),{node:c,property:"name",data:kr(Re.MissingReturns)});else if(l||((i=c.returnType)===null||i===void 0?void 0:i.ref)!==void 0){let d=Mr(c.inferredType.$cstNode,"infers");r("error",a(f,l),{node:c.inferredType,property:"name",data:{code:Re.InvalidInfers,actionSegment:Gt(d)}})}}else if(u&&l){let d=Mr(c.$cstNode,"infer");r("error","Data type rules cannot infer a type.",{node:c,property:"inferredType",data:{code:Re.InvalidInfers,actionSegment:Gt(d)}})}}for(let c of Fe(e).filter(Te)){let u=this.getActionType(c);if(u){let l=!!c.inferredType,f=pn(c);if(c.type&&f&&s.has(f)===l){let d=l?Mr(c.$cstNode,"infer"):Mr(c.$cstNode,"{");r("error",a(f,l),{node:c,property:"type",data:{code:l?Re.SuperfluousInfer:Re.MissingInfer,actionSegment:Gt(d)}})}else if(u&&f&&s.has(f)&&l&&c.$cstNode){let d=$t((o=c.inferredType)===null||o===void 0?void 0:o.$cstNode,"name"),p=Mr(c.$cstNode,"{");d&&p&&r("error",`${f} is a declared type and cannot be redefined.`,{node:c,property:"type",data:{code:Re.SuperfluousInfer,actionRange:{start:p.range.end,end:d.range.start}}})}}}function a(c,u){return u?`The type '${c}' is already explicitly declared and cannot be inferred.`:`The type '${c}' is not explicitly declared and must be inferred.`}}getActionType(e){var r;if(e.type)return(r=e.type)===null||r===void 0?void 0:r.ref;if(e.inferredType)return e.inferredType}checkGrammarHiddenTokens(e,r){e.definesHiddenTokens&&r("error","Hidden terminals are declared at the terminal definition.",{node:e,property:"definesHiddenTokens",data:kr(Re.HiddenGrammarTokens)})}checkHiddenTerminalRule(e,r){e.hidden&&e.fragment&&r("error","Cannot use terminal fragments as hidden tokens.",{node:e,property:"hidden"})}checkEmptyTerminalRule(e,r){try{let n=Ur(e);new RegExp(n).test("")&&r("error","This terminal could match an empty string.",{node:e,property:"name"})}catch{}}checkInvalidRegexFlags(e,r){let n=e.regex;if(n){let i=n.lastIndexOf("/"),o=n.substring(i+1),s="gmy",c=s+"isu",u=new Set,l=new Set;for(let d=0;d<o.length;d++){let p=o.charAt(d);c.includes(p)?s.includes(p)&&l.add(p):u.add(p)}let f=this.getFlagRange(e);f&&(u.size>0?r("error",`'${Array.from(u).join("")}' ${u.size>1?"are":"is"} not valid regular expression flag${u.size>1?"s":""}.`,{node:e,range:f}):l.size>0&&r("warning",`'${Array.from(l).join("")}' regular expression flag${l.size>1?"s":""} will be ignored by Langium.`,{node:e,range:f}))}}checkDirectlyUsedRegexFlags(e,r){if(!pe(e.$container)){let n=this.getFlagRange(e);n&&r("warning","Regular expression flags are only applied if the terminal is not a composition",{node:e,range:n})}}getFlagRange(e){let r=$t(e.$cstNode,"regex");if(!r||!e.regex)return;let n=e.regex,i=n.lastIndexOf("/")+1;return{start:{line:r.range.end.line,character:r.range.end.character-n.length+i},end:r.range.end}}checkUsedHiddenTerminalRule(e,r){let n=ve(e,i=>pe(i)||M(i));if(n){if("hidden"in n&&n.hidden)return;let i=e.rule.ref;pe(i)&&i.hidden&&r("error","Cannot use hidden terminal in non-hidden rule",{node:e,property:"rule"})}}checkUsedFragmentTerminalRule(e,r){let n=e.rule.ref;pe(n)&&n.fragment&&ve(e,M)&&r("error","Cannot use terminal fragments as part of parser rules.",{node:e,property:"rule"})}checkCrossReferenceSyntax(e,r){e.deprecatedSyntax&&r("error","'|' is deprecated. Please, use ':' instead.",{node:e,property:"deprecatedSyntax",data:kr(Re.CrossRefTokenSyntax)})}checkPackageImport(e,r){Ln(this.documents,e)===void 0?r("error","Import cannot be resolved.",{node:e,property:"path"}):e.path.endsWith(".langium")&&r("warning","Imports do not need file extensions.",{node:e,property:"path",data:kr(Re.UnnecessaryFileExtension)})}checkInvalidCharacterRange(e,r){if(e.right){let n="Character ranges cannot use more than one character",i=!1;e.left.value.length>1&&(i=!0,r("error",n,{node:e.left,property:"value"})),e.right.value.length>1&&(i=!0,r("error",n,{node:e.right,property:"value"})),i||r("hint","Consider using regex instead of character ranges",{node:e,data:kr(Re.UseRegexTokens)})}}checkGrammarForUnusedRules(e,r){let n=ss(e,!0);for(let i of e.rules)pe(i)&&i.hidden||Ya(i)||n.has(i)||r("hint","This rule is declared but never referenced.",{node:i,property:"name",tags:[Fi.Unnecessary]})}checkClashingTerminalNames(e,r){let n=new ye,i=new Set;for(let u of e.rules)pe(u)&&u.name&&n.add(u.name,u),M(u)&&Fe(u).filter(Ze).forEach(f=>i.add(f.value));let o=new ye,s=new ye;for(let u of e.imports){let l=Ja(this.documents,u);for(let f of l)for(let d of f.rules)pe(d)&&d.name?o.add(d.name,u):M(d)&&d.name&&Fe(d).filter(Ze).forEach(T=>s.add(T.value,u))}for(let u of n.values())if(i.has(u.name))r("error","Terminal name clashes with existing keyword.",{node:u,property:"name"});else if(s.has(u.name)){let l=s.get(u.name);r("error",`Terminal name clashes with imported keyword from "${l[0].path}".`,{node:u,property:"name"})}let a=new ye;for(let u of i)for(let l of o.get(u))a.add(l,u);for(let[u,l]of a.entriesGroupedByKey())l.length>0&&r("error",`Imported terminals (${l.join(", ")}) clash with locally defined keywords.`,{node:u,property:"path"});let c=new ye;for(let[u,l]of o.entriesGroupedByKey()){let f=s.get(u);f.length>0&&l.filter(d=>!f.includes(d)).forEach(d=>c.add(d,u))}for(let[u,l]of c.entriesGroupedByKey())l.length>0&&r("error",`Imported terminals (${l.join(", ")}) clash with imported keywords.`,{node:u,property:"path"})}checkRuleName(e,r){if(e.name&&!Ya(e)){let n=e.name.substring(0,1);n.toUpperCase()!==n&&r("warning","Rule name should start with an upper case letter.",{node:e,property:"name",data:kr(Re.RuleNameUppercase)})}}checkTypeReservedName(e,r){this.checkReservedName(e,"name",r)}checkAssignmentReservedName(e,r){this.checkReservedName(e,"feature",r)}checkParserRuleReservedName(e,r){e.inferredType||this.checkReservedName(e,"name",r)}checkReservedName(e,r,n){let i=e[r];typeof i=="string"&&kI.has(i)&&n("error",`'${i}' is a reserved name of the JavaScript runtime.`,{node:e,property:r})}checkKeyword(e,r){ve(e,M)&&(e.value.length===0?r("error","Keywords cannot be empty.",{node:e}):e.value.trim().length===0?r("error","Keywords cannot only consist of whitespace characters.",{node:e}):/\s/g.test(e.value)&&r("warning","Keywords should not contain whitespace characters.",{node:e}))}checkUnorderedGroup(e,r){e.elements.forEach(n=>{Fr(n.cardinality)&&r("error","Optional elements in Unordered groups are currently not supported",{node:n,data:kr(Re.OptionalUnorderedGroup)})})}checkRuleParametersUsed(e,r){let n=e.parameters;if(n.length>0){let i=Fe(e).filter(Vo);for(let o of n)i.some(s=>s.parameter.ref===o)||r("hint",`Parameter '${o.name}' is unused.`,{node:o,tags:[Fi.Unnecessary]})}}checkParserRuleDataType(e,r){if(Ya(e))return;let n=Hb(e),i=Er(e);!n&&i?r("error","This parser rule does not create an object. Add a primitive return type or an action to the start of the rule to force object instantiation.",{node:e,property:"name"}):n&&!i&&r("error","Normal parser rules are not allowed to return a primitive value. Use a datatype rule for that.",{node:e,property:e.dataType?"dataType":"returnType"})}checkAssignmentToFragmentRule(e,r){e.terminal&&xe(e.terminal)&&M(e.terminal.rule.ref)&&e.terminal.rule.ref.fragment&&r("error",`Cannot use fragment rule '${e.terminal.rule.ref.name}' for assignment of property '${e.feature}'.`,{node:e,property:"terminal"})}checkAssignmentTypes(e,r){if(!e.terminal)return;let n;Fe(e.terminal).map(o=>Dt(o)?"ref":"other").find(o=>n?o!==n:(n=o,!1))&&r("error",this.createMixedTypeError(e.feature),{node:e,property:"terminal"})}checkInterfacePropertyTypes(e,r){for(let n of e.attributes)if(n.type){let i=eo(n.type),o=Xa(i),s=!1,a=!1;for(let c of o)os(c)?s=!0:os(c)||(a=!0);s&&a&&r("error",this.createMixedTypeError(n.name),{node:n,property:"type"})}}createMixedTypeError(e){return`Mixing a cross-reference with other types is not supported. Consider splitting property "${e}" into two or more different properties.`}checkTerminalRuleReturnType(e,r){var n;!((n=e.type)===null||n===void 0)&&n.name&&!is(e.type.name)&&r("error","Terminal rules can only return primitive types like 'string', 'boolean', 'number', 'Date' or 'bigint'.",{node:e.type,property:"name"})}checkRuleCallParameters(e,r){let n=e.rule.ref;if(M(n)){let i=n.parameters.length,o=e.arguments.length;i!==o&&r("error",`Rule '${n.name}' expects ${i} arguments, but got ${o}.`,{node:e})}else pe(n)&&e.arguments.length>0&&r("error","Terminal rules do not accept any arguments",{node:e})}checkCrossRefNameAssignment(e,r){!e.terminal&&e.type.ref&&!Qa(e.type.ref)&&r("error","Cannot infer terminal or data type rule for cross-reference.",{node:e,property:"type"})}checkCrossRefTerminalType(e,r){var n;let i=e.terminal;if(xe(i)){let o=i.rule.ref;M(o)&&!Er(o)?r("error","Parser rules cannot be used for cross-references.",{node:i,property:"rule"}):M(o)&&!Wb(o)?r("error","Data type rules for cross-references must be of type string.",{node:i,property:"rule"}):pe(o)&&(!((n=o.type)===null||n===void 0)&&n.name)&&o.type.name!=="string"&&r("error","Terminal rules for cross-references must be of type string.",{node:i,property:"rule"})}}checkCrossRefType(e,r){let n=this.checkReferenceToRuleButNotType(e?.type);n&&r("error",n,{node:e,property:"type"})}checkCrossReferenceToTypeUnion(e,r){if(lt(e.type.ref)&&Lr(e.type.ref.type)){let n=Gb(e.type.ref.type);n.length>0&&r("error",`Cross-reference on type union is only valid if all alternatives are AST nodes. ${n.join(", ")} ${n.length>1?"are":"is"} not ${n.length>1?"":"an "}AST node${n.length>1?"s":""}.`,{node:e,property:"type"})}}checkFragmentsInTypes(e,r){var n,i;M((n=e.typeRef)===null||n===void 0?void 0:n.ref)&&(!((i=e.typeRef)===null||i===void 0)&&i.ref.fragment)&&r("error","Cannot use rule fragments in types.",{node:e,property:"typeRef"})}checkReferenceTypeUnion(e,r){Wt(e.referenceType)||r("error","Only direct rule references are allowed in reference types.",{node:e,property:"referenceType"})}checkReferenceToRuleButNotType(e){if(e&&M(e.ref)&&!Er(e.ref)&&(e.ref.returnType||e.ref.inferredType)){let r=pn(e.ref);if(r)return`Use the rule type '${r}' instead of the typed rule name '${e.ref.name}' for cross-references.`}}checkAssignmentWithFeatureName(e,r){e.feature==="name"&&Dt(e.terminal)&&r("warning",'The "name" property is not recommended for cross-references.',{node:e,property:"feature"})}};function Ya(t){return!t.definition||!t.definition.$cstNode||t.definition.$cstNode.length===0}var kI=new Set(["Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array","Map","Set","WeakMap","WeakSet","Error","AggregateError","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError","BigInt","RegExp","Number","Object","Function","Symbol","String","Math","NaN","Infinity","isFinite","isNaN","Buffer","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","globalThis","decodeURIComponent","decodeURI","encodeURIComponent","encodeURI","parseInt","parseFloat","Promise","Generator","GeneratorFunction","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Reflect","Proxy","Date","Intl","eval","undefined"]);function Gb(t){let e=[];return t.types.forEach(r=>{var n;Wt(r)&&(!((n=r.typeRef)===null||n===void 0)&&n.ref?lt(r.typeRef.ref)&&(Lr(r.typeRef.ref.type)?e.push(...Gb(r.typeRef.ref.type)):e.push(r.typeRef.ref.name)):r.stringType?e.push(`"${r.stringType}"`):r.primitiveType&&e.push(r.primitiveType))}),Array.from(new Set(e))}function Fr(t,e){return t==="?"||t==="*"||bt(e)&&!!e.guardCondition}function Bb(t){return t==="*"||t==="+"}function Er(t){return Kb(t,new Set)}function Kb(t,e){if(e.has(t))return!0;e.add(t);for(let r of Fe(t))if(xe(r)){if(!r.rule.ref||M(r.rule.ref)&&!Kb(r.rule.ref,e))return!1}else{if(ce(r))return!1;if(Te(r))return!1}return!!t.definition}function Hb(t){var e;let r=(e=t.returnType)===null||e===void 0?void 0:e.ref;return t.dataType!==void 0||lt(r)&&EI(r)}function EI(t){return Eg(t.type,new Set)}function Eg(t,e){if(e.has(t))return!0;if(e.add(t),Vi(t))return!1;if(Xi(t))return!1;if(Lr(t))return t.types.every(r=>Eg(r,e));if(Wt(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 lt(r)?Eg(r.type,e):!1}else return!1}else return!1}function Wb(t){return Za(t,new Set)}function Za(t,e){var r,n;if(e.has(t))return!0;if(e.add(t),M(t)){if(t.dataType)return t.dataType==="string";if(!((r=t.returnType)===null||r===void 0)&&r.ref)return Za(t.returnType.ref,e)}else{if(lt(t))return Za(t.type,e);if(Vi(t))return!1;if(Xi(t))return!1;if(Lr(t))return t.types.every(i=>Za(i,e));if(Wt(t)){if(t.primitiveType==="string")return!0;if(t.stringType)return!0;if(!((n=t.typeRef)===null||n===void 0)&&n.ref)return Za(t.typeRef.ref,e)}}return!1}function Cg(t){let e=t.$container;if(bt(e)){let r=e.elements,n=r.indexOf(t);for(let i=n-1;i>=0;i--){let o=r[i];if(Te(o))return o;{let s=Fe(r[i]).find(Te);if(s)return s}}}if(Ko(e))return Cg(e)}function Jr(t){var e;if(M(t))return Er(t)?t.name:(e=cs(t))!==null&&e!==void 0?e:t.name;if(Ht(t)||lt(t)||Xo(t))return t.name;if(Te(t)){let r=us(t);if(r)return r}else if(zo(t))return t.name;throw new xl("Cannot get name of Unknown Type",t.$cstNode)}function pn(t){if(t)try{return Jr(t)}catch{return}}function cs(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(M(e))return e.name;if(Ht(e)||lt(e))return e.name}}}function us(t){var e;if(t.inferredType)return t.inferredType.name;if(!((e=t.type)===null||e===void 0)&&e.ref)return Jr(t.type.ref)}function to(t){var e,r,n;return pe(t)?(r=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&r!==void 0?r:"string":Er(t)?t.name:(n=cs(t))!==null&&n!==void 0?n:t.name}function Ur(t){let e={s:!1,i:!1,u:!1},r=ls(t.definition,e),n=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(r,n)}var Ng=/[\s\S]/.source;function ls(t,e){if(tb(t))return _I(t);if(nb(t))return CI(t);if(ll(t))return II(t);if(dl(t)){let r=t.rule.ref;if(!r)throw new Error("Missing rule reference.");return Mn(ls(r.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else{if(YS(t))return PI(t);if(ab(t))return NI(t);if(QS(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")),Mn(n,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(ub(t))return Mn(Ng,{cardinality:t.cardinality,lookahead:t.lookahead});throw new Error(`Invalid terminal element: ${t?.$type}`)}}}function _I(t){return Mn(t.elements.map(e=>ls(e)).join("|"),{cardinality:t.cardinality,lookahead:t.lookahead})}function CI(t){return Mn(t.elements.map(e=>ls(e)).join(""),{cardinality:t.cardinality,lookahead:t.lookahead})}function NI(t){return Mn(`${Ng}*?${ls(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function PI(t){return Mn(`(?!${ls(t.terminal)})${Ng}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function II(t){return t.right?Mn(`[${kg(t.left)}-${kg(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):Mn(kg(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function kg(t){return $n(t.value)}function Mn(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 Pg(t){if(t.path===void 0||t.path.length===0)return;let e=ue.dirname(Y(t).uri),r=t.path;return r.endsWith(".langium")||(r+=".langium"),ue.resolvePath(e,r)}function Ln(t,e){let r=Pg(e);try{if(r){let i=t.getOrCreateDocument(r).parseResult.value;if(fi(i))return i}}catch{}}function Ja(t,e){if(cl(e)){let r=Ln(t,e);if(r){let n=_g(t,r);return n.push(r),n}return[]}else return _g(t,e)}function _g(t,e,r=e,n=new Set,i=new Set){let o=Y(e);if(r!==e&&i.add(e),!n.has(o.uri)){n.add(o.uri);for(let s of e.imports){let a=Ln(t,s);a&&_g(t,a,r,n,i)}}return Array.from(i)}function as(t){return ce(t)?[t]:Sr(t)||bt(t)||br(t)?t.elements.flatMap(e=>as(e)):xe(t)&&t.rule.ref?as(t.rule.ref.definition):[]}var DI=["string","number","boolean","Date","bigint"];function is(t){return DI.includes(t)}var Ig=class{constructor(e,r){this.context=e,this.root=r}getTypes(){let e={name:this.root.name,properties:this.root.properties,ruleCalls:this.root.ruleCalls,super:[]};return this.root.children.length===0?[{alt:e,next:[]}]:this.applyNext(this.root,{alt:e,next:this.root.children})}applyNext(e,r){let n=this.splitType(r.alt,r.next.length),i=[];for(let o=0;o<r.next.length;o++){let s=n[o],a=r.next[o];a.actionWithAssignment&&i.push({alt:zb(s),next:[]}),a.name!==void 0&&a.name!==s.name&&(a.actionWithAssignment?(s.properties=[],s.ruleCalls=[],s.super=[e.name],s.name=a.name):(s.super=[s.name,...s.ruleCalls],s.properties=[],s.ruleCalls=[],s.name=a.name)),s.properties.push(...a.properties),s.ruleCalls.push(...a.ruleCalls);let c={alt:s,next:a.children};c.next.length===0?(c.alt.super=c.alt.super.filter(u=>u!==c.alt.name),i.push(c)):i.push(...this.applyNext(e,c))}return Qb(i)}splitType(e,r){let n=[];for(let i=0;i<r;i++)n.push(zb(e));return n}getSuperTypes(e){let r=new Set;return this.collectSuperTypes(e,e,r),Array.from(r)}collectSuperTypes(e,r,n){if(r.ruleCalls.length>0){for(let i of r.ruleCalls)n.add(i);return}for(let i of r.parents)e.name===void 0?this.collectSuperTypes(i,i,n):i.name!==void 0&&i.name!==e.name?n.add(i.name):this.collectSuperTypes(e,i,n);r.parents.length===0&&r.name&&n.add(r.name)}connect(e,r){return r.parents.push(e),e.children.push(r),r}merge(...e){if(e.length===1)return e[0];if(e.length===0)throw new Error("No parts to merge");let r=ro();r.parents=e;for(let n of e)n.children.push(r);return r}hasLeafNode(e){return this.partHasLeafNode(e)}partHasLeafNode(e,r){return e.children.some(n=>n!==r)?!0:e.name?!1:e.parents.some(n=>this.partHasLeafNode(n,e))}};function OI(t){return{name:t.name,children:[],parents:[],actionWithAssignment:t.actionWithAssignment,ruleCalls:[...t.ruleCalls],properties:t.properties.map(Vb)}}function zb(t){return{name:t.name,super:t.super,ruleCalls:t.ruleCalls,properties:t.properties.map(e=>Vb(e))}}function Vb(t){return{name:t.name,optional:t.optional,type:t.type,astNodes:t.astNodes}}function Xb(t,e,r){let n=[],i={fragments:new Map};for(let c of t)n.push(...Yb(i,c));let o=qI(n),s=jI(o),a=GI(o,s,r);for(let c of e){let u=$I(c);a.unions.push({name:c.name,declared:!1,type:u,subTypes:new Set,superTypes:new Set,dataType:c.dataType})}return a}function $I(t){if(t.dataType&&t.dataType!=="string")return{primitive:t.dataType};let e=!1,r=()=>(e=!0,{primitive:"unknown"}),n=Dg(t.definition,r);return e?{primitive:"string"}:n}function Dg(t,e){var r,n,i;if(t.cardinality)return e();if(Sr(t))return{types:t.elements.map(o=>Dg(o,e))};if(bt(t)||br(t))return t.elements.length!==1?e():Dg(t.elements[0],e);if(xe(t)){let o=(r=t.rule)===null||r===void 0?void 0:r.ref;return o?pe(o)?{primitive:(i=(n=o.type)===null||n===void 0?void 0:n.name)!==null&&i!==void 0?i:"string",regex:Ur(o).toString()}:{value:o.name}:e()}else if(Ze(t))return{string:t.value};return e()}function Yb(t,e){let r=ro(e),n=new Ig(t,r);return e.definition&&Og(n,n.root,e.definition),n.getTypes()}function ro(t){return{name:M(t)||Te(t)?pn(t):t,properties:[],ruleCalls:[],children:[],parents:[],actionWithAssignment:!1}}function Og(t,e,r){let n=Fr(r.cardinality,r);if(Sr(r)){let i=[];n&&i.push(t.connect(e,ro()));for(let o of r.elements){let s=t.connect(e,ro());i.push(Og(t,s,o))}return t.merge(...i)}else if(bt(r)||br(r)){let i=t.connect(e,ro()),o;n&&(o=t.connect(e,ro()));for(let s of r.elements)i=Og(t,i,s);return o?t.merge(o,i):i}else{if(Te(r))return LI(t,e,r);ce(r)?MI(e,r):xe(r)&&FI(t,e,r)}return e}function LI(t,e,r){var n;if(!t.hasLeafNode(e)){let o=OI(e);t.connect(e,o)}let i=t.connect(e,ro(r));if(r.type){let o=(n=r.type)===null||n===void 0?void 0:n.ref;o&&Ga(o)&&(i.name=o.name)}return r.feature&&r.operator&&(i.actionWithAssignment=!0,i.properties.push({name:r.feature,optional:!1,type:no(r.operator==="+=",!1,t.root.ruleCalls.length!==0?t.root.ruleCalls:t.getSuperTypes(i)),astNodes:new Set([r])})),i}function MI(t,e){let r={types:new Set,reference:!1};Jb(e.terminal,r);let n=no(e.operator==="+=",r.reference,e.operator==="?="?["boolean"]:Array.from(r.types));t.properties.push({name:e.feature,optional:Fr(e.cardinality),type:n,astNodes:new Set([e])})}function Jb(t,e){if(Sr(t)||br(t)||bt(t))for(let r of t.elements)Jb(r,e);else if(Ze(t))e.types.add(`'${t.value}'`);else if(xe(t)&&t.rule.ref)e.types.add(to(t.rule.ref));else if(Dt(t)&&t.type.ref){let r=pn(t.type.ref);r&&e.types.add(r),e.reference=!0}}function FI(t,e,r){let n=r.rule.ref;if(M(n)&&n.fragment){let i=UI(n,t.context);Fr(r.cardinality)?e.properties.push(...i.map(o=>Object.assign(Object.assign({},o),{optional:!0}))):e.properties.push(...i)}else M(n)&&e.ruleCalls.push(to(n))}function UI(t,e){let r=e.fragments.get(t);if(r)return r;let n=[];e.fragments.set(t,n);let i=pn(t),o=Yb(e,t).filter(s=>s.alt.name===i);return n.push(...o.flatMap(s=>s.alt.properties)),n}function qI(t){let e=new Map,r=[],n=Qb(t).map(i=>i.alt);for(let i of n){let o={name:i.name,properties:i.properties,superTypes:new Set(i.super),subTypes:new Set,declared:!1,abstract:!1};e.set(o.name,o),i.ruleCalls.length>0&&(r.push(i),i.ruleCalls.forEach(s=>{s!==o.name&&o.subTypes.add(s)}))}for(let i of r)for(let o of i.ruleCalls){let s=e.get(o);s&&s.name!==i.name&&s.superTypes.add(i.name)}return Array.from(e.values())}function Qb(t){let e=t.reduce((n,i)=>n.add(i.alt.name,i),new ye),r=[];for(let[n,i]of e.entriesGroupedByKey()){let o=[],s=new Set,a={alt:{name:n,properties:o,ruleCalls:[],super:[]},next:[]};for(let c of i){let u=c.alt;a.alt.super.push(...u.super),a.next.push(...c.next);let l=u.properties;for(let f of l){let d=o.find(p=>p.name===f.name);d?(d.type=wg(d.type,f.type),f.astNodes.forEach(p=>d.astNodes.add(p))):o.push(Object.assign({},f))}u.ruleCalls.forEach(f=>s.add(f))}for(let c of i){let u=c.alt;if(u.ruleCalls.length===0)for(let l of o)u.properties.find(f=>f.name===l.name)||(l.optional=!0)}a.alt.ruleCalls=Array.from(s),r.push(a)}return r}function jI(t){let e=new Map(t.map(i=>[i.name,i])),r=[],n=new ye;for(let i of t)for(let o of i.superTypes)n.add(o,i.name);for(let[i,o]of n.entriesGroupedByKey())if(!e.has(i)){let s={declared:!1,name:i,subTypes:new Set,superTypes:new Set,type:no(!1,!1,o)};r.push(s)}return r}function GI(t,e,r){let n=new ye;for(let a of t)for(let c of a.superTypes)n.add(c,a.name);let i=new Set(r.interfaces.map(a=>a.name)),o={interfaces:[],unions:e},s=new Map(e.map(a=>[a.name,a]));for(let a of t){let c=new Set(n.get(a.name));if(a.properties.length===0&&c.size>0)if(i.has(a.name))a.abstract=!0,o.interfaces.push(a);else{let u=no(!1,!1,Array.from(c)),l=s.get(a.name);if(l)l.type=wg(l.type,u);else{let f={name:a.name,declared:!1,subTypes:c,superTypes:a.superTypes,type:u};o.unions.push(f),s.set(a.name,f)}}else o.interfaces.push(a)}for(let a of o.interfaces)a.superTypes=new Set([...a.superTypes].filter(c=>!s.has(c)));return o}function no(t,e,r){if(t)return{elementType:no(!1,e,r)};if(e)return{referenceType:no(!1,!1,r)};if(r.length===1){let n=r[0];return n.startsWith("'")?{string:n.substring(1,n.length-1)}:is(n)?{primitive:n}:{value:n}}else return{types:r.map(n=>no(!1,!1,[n]))}}function Zb(t,e){let r=eA(t,e),n=Fb(r.interfaces,r.types),i=Xb(r.parserRules,r.datatypeRules,n);return{astResources:r,inferred:i,declared:n}}function eA(t,e,r=new Set,n={parserRules:[],datatypeRules:[],interfaces:[],types:[]}){Array.isArray(t)||(t=[t]);for(let i of t){let o=Y(i);if(!r.has(o.uri)){r.add(o.uri);for(let s of i.rules)M(s)&&!s.fragment&&(Er(s)?n.datatypeRules.push(s):n.parserRules.push(s));if(i.interfaces.forEach(s=>n.interfaces.push(s)),i.types.forEach(s=>n.types.push(s)),e){let s=i.imports.map(a=>Ln(e,a)).filter(a=>a!==void 0);eA(s,e,r,n)}}}return n}function nA(t,e){let{inferred:r,declared:n,astResources:i}=Zb(t,e);return{astResources:i,inferred:tA(n,r),declared:tA(r,n)}}function tA(t,e){var r,n;let i={interfaces:Cb(rA(...t.interfaces,...(r=e?.interfaces)!==null&&r!==void 0?r:[])),unions:rA(...t.unions,...(n=e?.unions)!==null&&n!==void 0?n:[])},o=qb(i);return HI(o),o}function rA(...t){return Array.from(t.reduce((e,r)=>(e.set(r.name,r),e),new Map).values()).sort((e,r)=>e.name.localeCompare(r.name))}function HI(t){let e=BI(t),r=Array.from(e.values());KI(r),zI(t.interfaces),WI(r)}function WI(t){let e=new Set,r=n=>{if(!e.has(n)){e.add(n),n.typeNames.add(n.name);for(let i of n.subTypes)r(i),i.typeNames.forEach(o=>n.typeNames.add(o))}};t.forEach(r)}function BI({interfaces:t,unions:e}){let r=t.concat(e).reduce((i,o)=>(i.set(o.name,o),i),new Map),n=new Map;for(let i of e)n.set(i,$g(i.type,new Set));for(let[i,o]of n)o&&r.delete(i.name);return r}function $g(t,e){if(e.has(t))return!0;if(e.add(t),gt(t))return t.types.every(r=>$g(r,e));if(Ar(t)){let r=t.value;return Vr(r)?$g(r.type,e):!1}else return wr(t)||fn(t)}function KI(t){for(let e of t)for(let r of e.superTypes)r.subTypes.add(e)}function zI(t){var e;let r=t.reduce((s,a)=>(s.set(a.name,a),s),new Map);for(let s of t){let a=s.properties.flatMap(c=>Nb(c.type));for(let c of a)(e=r.get(c))===null||e===void 0||e.containerTypes.add(s)}let n=new Set,i=t.filter(s=>s.subTypes.size===0),o=new Set(i);for(;i.length>0;){let s=i.shift();if(s)for(let a of s.superTypes)Yr(a)&&(s.containerTypes.size===0?(n.add(a.name),a.containerTypes.clear()):n.has(a.name)||s.containerTypes.forEach(c=>a.containerTypes.add(c)),o.has(a)||(o.add(a),i.push(a)))}}var VI={languageId:"langium",fileExtensions:[".langium"],caseInsensitive:!1},XI={maxLookahead:3},iA={AstReflection:()=>new $a},oA={Grammar:()=>$b(),LanguageMetaData:()=>VI,parser:{ParserConfig:()=>XI}};var ec=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)}},fs=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=J(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}},sA={getElement(){},getAllElements(){return Bo}};var Nl=se(_n(),1);var ds=class{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,r=Nl.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,r)}async computeExportsForNode(e,r,n=di,i=Nl.CancellationToken.None){let o=[];this.exportNode(e,o,r);for(let s of n(e))await Ue(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=Nl.CancellationToken.None){let n=e.parseResult.value,i=new ye;for(let o of Fe(n))await Ue(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 Pl=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")}},Lg=class extends Pl{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()}},Il=class extends Pl{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}};var Dl=class extends Lg{constructor(e){super(),this.onDispose(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}};var ps=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 Dl(e.shared)}getScope(e){let r=[],n=this.reflection.getReferenceType(e),i=Y(e.container).precomputedScopes;if(i){let s=e.container;do{let a=i.get(s);a.length>0&&r.push(J(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 ec(J(e),r,n)}createScopeForNodes(e,r,n){let i=J(e).map(o=>{let s=this.nameProvider.getName(o);if(s)return this.descriptions.createDescription(o,s)}).nonNullable();return new ec(i,r,n)}getGlobalScope(e,r){return this.globalScopeCache.get(e,()=>new fs(this.indexManager.allElements(e)))}};var Ol=class extends ps{constructor(e){super(e),this.langiumDocuments=e.shared.workspace.LangiumDocuments}getScope(e){let r=this.reflection.getReferenceType(e);return r===zi?this.getTypeScope(r,e):super.getScope(e)}getTypeScope(e,r){let n,i=Y(r.container).precomputedScopes,o=pl(r.container);if(i&&o){let a=i.get(o);a.length>0&&(n=J(a).filter(c=>c.type===La||c.type===Ma))}let s=this.getGlobalScope(e,r);return n?this.createScope(n,s):s}getGlobalScope(e,r){let n=ve(r.container,fi);if(!n)return sA;let i=new Set;this.gatherImports(n,i);let o=this.indexManager.allElements(e,i);return e===zi&&(o=o.filter(s=>s.type===La||s.type===Ma)),new fs(o)}gatherImports(e,r){for(let n of e.imports){let i=Pg(n);if(i&&!r.has(i.toString())&&(r.add(i.toString()),this.langiumDocuments.hasDocument(i))){let s=this.langiumDocuments.getOrCreateDocument(i).parseResult.value;fi(s)&&this.gatherImports(s,r)}}}},$l=class extends ds{constructor(e){super(e),this.astNodeLocator=e.workspace.AstNodeLocator}exportNode(e,r,n){var i;if(super.exportNode(e,r,n),M(e)){if(!e.returnType&&!e.dataType){let o=(i=e.inferredType)!==null&&i!==void 0?i:e;r.push(this.createInterfaceDescription(o,o.name,n))}Fe(e).forEach(o=>{if(Te(o)&&o.inferredType){let s=us(o);s&&r.push(this.createInterfaceDescription(o,s,n))}})}}processNode(e,r,n){Xo(e)||(this.processTypeNode(e,r,n),this.processActionNode(e,r,n),super.processNode(e,r,n))}processTypeNode(e,r,n){var i;let o=e.$container;if(o&&M(e)&&!e.returnType&&!e.dataType){let s=(i=e.inferredType)!==null&&i!==void 0?i:e;n.add(o,this.createInterfaceDescription(s,s.name,r))}}processActionNode(e,r,n){let i=pl(e);if(i&&Te(e)&&e.inferredType){let o=us(e);o&&n.add(i,this.createInterfaceDescription(e,o,r))}}createInterfaceDescription(e,r,n=Y(e)){let i,o=()=>{var s;return i??(i=Gt((s=this.nameProvider.getNameNode(e))!==null&&s!==void 0?s:e.$cstNode))};return{node:e,name:r,get nameSegment(){return o()},selectionSegment:Gt(e.$cstNode),type:"Interface",documentUri:n.uri,path:this.astNodeLocator.getAstNodePath(e)}}};var _r=se(de(),1);var Bt=se(de(),1);var Ll=class{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,r={},n=Bt.CancellationToken.None){let i=e.parseResult,o=[];if(await Ue(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)===mn.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)===mn.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)===mn.LinkingError}))))return o;try{o.push(...await this.validateAst(i.value,r,n))}catch(s){if(Zi(s))throw s;console.error("An error occurred during validation:",s)}return await Ue(n),o}processLexingErrors(e,r,n){for(let i of e.lexerErrors){let o={severity:Bt.DiagnosticSeverity.Error,range:{start:{line:i.line-1,character:i.column-1},end:{line:i.line-1,character:i.column+i.length-1}},message:i.message,data:kr(mn.LexingError),source:this.getSource()};r.push(o)}}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))o=Bt.Range.create(0,0,0,0);else{let a=Bt.Position.create(s.endLine-1,s.endColumn);o=Bt.Range.create(a,a)}}}else o=Oa(i.token);if(o){let s={severity:Bt.DiagnosticSeverity.Error,range:o,message:i.message,data:kr(mn.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:mn.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=Bt.CancellationToken.None){let i=[],o=(s,a,c)=>{i.push(this.toDiagnostic(s,a,c))};return await Promise.all(zr(e).map(async s=>{await Ue(n);let a=this.validationRegistry.getChecks(s.$type,r.categories);for(let c of a)await c(s,o,n)})),i}toDiagnostic(e,r,n){return{message:r,range:YI(n),severity:JI(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 YI(t){if(Bt.Range.is(t.range))return t.range;let e;return typeof t.property=="string"?e=$t(t.node.$cstNode,t.property,t.index):typeof t.keyword=="string"&&(e=Mr(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 JI(t){switch(t){case"error":return Bt.DiagnosticSeverity.Error;case"warning":return Bt.DiagnosticSeverity.Warning;case"info":return Bt.DiagnosticSeverity.Information;case"hint":return Bt.DiagnosticSeverity.Hint;default:throw new Error("Invalid diagnostic severity: "+t)}}var mn;(function(t){t.LexingError="lexing-error",t.ParsingError="parsing-error",t.LinkingError="linking-error"})(mn||(mn={}));var Ml=class{constructor(e){this.reflection=e.shared.AstReflection,this.indexManager=e.shared.workspace.IndexManager}getCodeActions(e,r){let n=[],i=o=>o&&n.push(o);for(let o of r.context.diagnostics)this.createCodeActions(o,e,i);return n}createCodeActions(e,r,n){var i;switch((i=e.data)===null||i===void 0?void 0:i.code){case Re.GrammarNameUppercase:case Re.RuleNameUppercase:n(this.makeUpperCase(e,r));break;case Re.HiddenGrammarTokens:n(this.fixHiddenTerminals(e,r));break;case Re.UseRegexTokens:n(this.fixRegexTokens(e,r));break;case Re.EntryRuleTokenSyntax:n(this.addEntryKeyword(e,r));break;case Re.CrossRefTokenSyntax:n(this.fixCrossRefSyntax(e,r));break;case Re.UnnecessaryFileExtension:n(this.fixUnnecessaryFileExtension(e,r));break;case Re.MissingReturns:n(this.fixMissingReturns(e,r));break;case Re.InvalidInfers:case Re.InvalidReturns:n(this.fixInvalidReturnsInfers(e,r));break;case Re.MissingInfer:n(this.fixMissingInfer(e,r));break;case Re.SuperfluousInfer:n(this.fixSuperfluousInfer(e,r));break;case mn.LinkingError:{let o=e.data;o&&o.containerType==="RuleCall"&&o.property==="rule"&&n(this.addNewRule(e,o,r)),o&&this.lookInGlobalScope(e,o,r).forEach(n);break}}}fixMissingReturns(e,r){let n=r.textDocument.getText(e.range);if(n)return{title:`Add explicit return type for parser rule ${n}`,kind:_r.CodeActionKind.QuickFix,diagnostics:[e],edit:{changes:{[r.textDocument.uri]:[{range:e.range,newText:`${n} returns ${n}`}]}}}}fixInvalidReturnsInfers(e,r){let n=e.data;if(n&&n.actionSegment){let i=r.textDocument.getText(n.actionSegment.range);return{title:`Correct ${i} usage`,kind:_r.CodeActionKind.QuickFix,diagnostics:[e],edit:{changes:{[r.textDocument.uri]:[{range:n.actionSegment.range,newText:i==="infers"?"returns":"infers"}]}}}}}fixMissingInfer(e,r){let n=e.data;if(n&&n.actionSegment)return{title:"Correct 'infer' usage",kind:_r.CodeActionKind.QuickFix,diagnostics:[e],edit:{changes:{[r.textDocument.uri]:[{range:{start:n.actionSegment.range.end,end:n.actionSegment.range.end},newText:"infer "}]}}}}fixSuperfluousInfer(e,r){let n=e.data;if(n&&n.actionRange)return{title:"Remove the 'infer' keyword",kind:_r.CodeActionKind.QuickFix,diagnostics:[e],edit:{changes:{[r.textDocument.uri]:[{range:n.actionRange,newText:""}]}}}}fixUnnecessaryFileExtension(e,r){let n=Object.assign({},e.range.end);n.character-=1;let i=Object.assign({},n);return i.character-=8,{title:"Remove file extension",kind:_r.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[r.textDocument.uri]:[{range:{start:i,end:n},newText:""}]}}}}makeUpperCase(e,r){let n={start:e.range.start,end:{line:e.range.start.line,character:e.range.start.character+1}};return{title:"First letter to upper case",kind:_r.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[r.textDocument.uri]:[{range:n,newText:r.textDocument.getText(n).toUpperCase()}]}}}}addEntryKeyword(e,r){return{title:"Add entry keyword",kind:_r.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[r.textDocument.uri]:[{range:{start:e.range.start,end:e.range.start},newText:"entry "}]}}}}fixRegexTokens(e,r){let n=r.textDocument.offsetAt(e.range.start),i=r.parseResult.value.$cstNode;if(i){let o=dr(i,n),s=ve(o?.astNode,ll);if(s&&s.right&&s.$cstNode){let a=s.left.value,c=s.right.value;return{title:"Refactor into regular expression",kind:_r.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[r.textDocument.uri]:[{range:s.$cstNode.range,newText:`/[${$n(a)}-${$n(c)}]/`}]}}}}}}fixCrossRefSyntax(e,r){return{title:"Replace '|' with ':'",kind:_r.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[r.textDocument.uri]:[{range:e.range,newText:":"}]}}}}fixHiddenTerminals(e,r){let n=r.parseResult.value,i=n.hiddenTokens,o=[],s=$t(n.$cstNode,"definesHiddenTokens");if(s){let a=s.range.start,c=s.offset,u=n.$cstNode.text.indexOf(")",c)+1;o.push({newText:"",range:{start:a,end:r.textDocument.positionAt(u)}})}for(let a of i){let c=a.ref;if(c&&pe(c)&&!c.hidden&&c.$cstNode){let u=c.$cstNode.range.start;o.push({newText:"hidden ",range:{start:u,end:u}})}}return{title:"Fix hidden terminals",kind:_r.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[r.textDocument.uri]:o}}}}addNewRule(e,r,n){let i=n.textDocument.offsetAt(e.range.start),o=n.parseResult.value.$cstNode;if(o){let s=dr(o,i),a=ve(s?.astNode,M);if(a&&a.$cstNode)return{title:`Add new rule '${r.refText}'`,kind:_r.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!1,edit:{changes:{[n.textDocument.uri]:[{range:{start:a.$cstNode.range.end,end:a.$cstNode.range.end},newText:`
|
|
46
|
+
`: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(TI.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 ln=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 vI=new Qi,vg=class extends ln{constructor(){super(...arguments),this.isStarting=!0,this.endRegexStack=[],this.multiline=!1}get endRegex(){return this.endRegexStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegex="",this.isStarting=!0,this.endRegexStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexStack=[])}visitCharacter(e){let r=String.fromCharCode(e.value);if(!this.multiline&&r===`
|
|
47
|
+
`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexStack=[];else{let n=On(r);this.endRegexStack.push(n),this.isStarting&&(this.startRegex+=n)}}visitSet(e){if(!this.multiline){let r=this.regex.substring(e.loc.begin,e.loc.end),n=new RegExp(r);this.multiline=!!`
|
|
48
|
+
`.match(n)}if(e.quantifier)this.isStarting=!1,this.endRegexStack=[];else{let r=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexStack.push(r),this.isStarting&&(this.startRegex+=r)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}},xg=new vg;function Db(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),xg.reset(t),xg.visit(vI.pattern(t)),xg.multiline}catch{return!1}}function Rg(t){return(typeof t=="string"?new RegExp(t):t).test(" ")}function On(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ob(t){return Array.prototype.map.call(t,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:On(e)).join("")}function $b(t,e){let r=RI(t),n=e.match(r);return!!n&&n[0].length>0}function RI(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)}var Lb;(()=>{"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,f="",d=0,p=-1,T=0,R=0;R<=c.length;++R){if(R<c.length)l=c.charCodeAt(R);else{if(l===47)break;l=47}if(l===47){if(!(p===R-1||T===1))if(p!==R-1&&T===2){if(f.length<2||d!==2||f.charCodeAt(f.length-1)!==46||f.charCodeAt(f.length-2)!==46){if(f.length>2){var A=f.lastIndexOf("/");if(A!==f.length-1){A===-1?(f="",d=0):d=(f=f.slice(0,A)).length-1-f.lastIndexOf("/"),p=R,T=0;continue}}else if(f.length===2||f.length===1){f="",d=0,p=R,T=0;continue}}u&&(f.length>0?f+="/..":f="..",d=2)}else f.length>0?f+="/"+c.slice(p+1,R):f=c.slice(p+1,R),d=R-p-1;p=R,T=0}else l===46&&T!==-1?++T:T=-1}return f}var a={resolve:function(){for(var c,u="",l=!1,f=arguments.length-1;f>=-1&&!l;f--){var d;f>=0?d=arguments[f]:(c===void 0&&(c=process.cwd()),d=c),o(d),d.length!==0&&(u=d+"/"+u,l=d.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 f=c.length,d=f-l,p=1;p<u.length&&u.charCodeAt(p)===47;++p);for(var T=u.length-p,R=d<T?d:T,A=-1,S=0;S<=R;++S){if(S===R){if(T>R){if(u.charCodeAt(p+S)===47)return u.slice(p+S+1);if(S===0)return u.slice(p+S)}else d>R&&(c.charCodeAt(l+S)===47?A=S:S===0&&(A=0));break}var h=c.charCodeAt(l+S);if(h!==u.charCodeAt(p+S))break;h===47&&(A=S)}var m="";for(S=l+A+1;S<=f;++S)S!==f&&c.charCodeAt(S)!==47||(m.length===0?m+="..":m+="/..");return m.length>0?m+u.slice(p+A):(p+=A,u.charCodeAt(p)===47&&++p,u.slice(p))},_makeLong:function(c){return c},dirname:function(c){if(o(c),c.length===0)return".";for(var u=c.charCodeAt(0),l=u===47,f=-1,d=!0,p=c.length-1;p>=1;--p)if((u=c.charCodeAt(p))===47){if(!d){f=p;break}}else d=!1;return f===-1?l?"/":".":l&&f===1?"//":c.slice(0,f)},basename:function(c,u){if(u!==void 0&&typeof u!="string")throw new TypeError('"ext" argument must be a string');o(c);var l,f=0,d=-1,p=!0;if(u!==void 0&&u.length>0&&u.length<=c.length){if(u.length===c.length&&u===c)return"";var T=u.length-1,R=-1;for(l=c.length-1;l>=0;--l){var A=c.charCodeAt(l);if(A===47){if(!p){f=l+1;break}}else R===-1&&(p=!1,R=l+1),T>=0&&(A===u.charCodeAt(T)?--T==-1&&(d=l):(T=-1,d=R))}return f===d?d=R:d===-1&&(d=c.length),c.slice(f,d)}for(l=c.length-1;l>=0;--l)if(c.charCodeAt(l)===47){if(!p){f=l+1;break}}else d===-1&&(p=!1,d=l+1);return d===-1?"":c.slice(f,d)},extname:function(c){o(c);for(var u=-1,l=0,f=-1,d=!0,p=0,T=c.length-1;T>=0;--T){var R=c.charCodeAt(T);if(R!==47)f===-1&&(d=!1,f=T+1),R===46?u===-1?u=T:p!==1&&(p=1):u!==-1&&(p=-1);else if(!d){l=T+1;break}}return u===-1||f===-1||p===0||p===1&&u===f-1&&u===l+1?"":c.slice(u,f)},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 f=l.dir||l.root,d=l.base||(l.name||"")+(l.ext||"");return f?f===l.root?f+d:f+"/"+d:d}(0,c)},parse:function(c){o(c);var u={root:"",dir:"",base:"",ext:"",name:""};if(c.length===0)return u;var l,f=c.charCodeAt(0),d=f===47;d?(u.root="/",l=1):l=0;for(var p=-1,T=0,R=-1,A=!0,S=c.length-1,h=0;S>=l;--S)if((f=c.charCodeAt(S))!==47)R===-1&&(A=!1,R=S+1),f===46?p===-1?p=S:h!==1&&(h=1):p!==-1&&(h=-1);else if(!A){T=S+1;break}return p===-1||R===-1||h===0||h===1&&p===R-1&&p===T+1?R!==-1&&(u.base=u.name=T===0&&d?c.slice(1,R):c.slice(T,R)):(T===0&&d?(u.name=c.slice(1,p),u.base=c.slice(1,R)):(u.name=c.slice(T,p),u.base=c.slice(T,R)),u.ext=c.slice(p,R)),T>0?u.dir=c.slice(0,T-1):d&&(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:()=>d,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,x){if(!I.scheme&&x)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${I.authority}", path: "${I.path}", query: "${I.query}", fragment: "${I.fragment}"}`);if(I.scheme&&!o.test(I.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(I.path){if(I.authority){if(!s.test(I.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(I.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="/",f=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class d{static isUri(x){return x instanceof d||!!x&&typeof x.authority=="string"&&typeof x.fragment=="string"&&typeof x.path=="string"&&typeof x.query=="string"&&typeof x.scheme=="string"&&typeof x.fsPath=="string"&&typeof x.with=="function"&&typeof x.toString=="function"}scheme;authority;path;query;fragment;constructor(x,D,L,ne,K,B=!1){typeof x=="object"?(this.scheme=x.scheme||u,this.authority=x.authority||u,this.path=x.path||u,this.query=x.query||u,this.fragment=x.fragment||u):(this.scheme=function(xt,vt){return xt||vt?xt:"file"}(x,B),this.authority=D||u,this.path=function(xt,vt){switch(xt){case"https":case"http":case"file":vt?vt[0]!==l&&(vt=l+vt):vt=l}return vt}(this.scheme,L||u),this.query=ne||u,this.fragment=K||u,c(this,B))}get fsPath(){return h(this,!1)}with(x){if(!x)return this;let{scheme:D,authority:L,path:ne,query:K,fragment:B}=x;return D===void 0?D=this.scheme:D===null&&(D=u),L===void 0?L=this.authority:L===null&&(L=u),ne===void 0?ne=this.path:ne===null&&(ne=u),K===void 0?K=this.query:K===null&&(K=u),B===void 0?B=this.fragment:B===null&&(B=u),D===this.scheme&&L===this.authority&&ne===this.path&&K===this.query&&B===this.fragment?this:new T(D,L,ne,K,B)}static parse(x,D=!1){let L=f.exec(x);return L?new T(L[2]||u,V(L[4]||u),V(L[5]||u),V(L[7]||u),V(L[9]||u),D):new T(u,u,u,u,u)}static file(x){let D=u;if(i&&(x=x.replace(/\\/g,l)),x[0]===l&&x[1]===l){let L=x.indexOf(l,2);L===-1?(D=x.substring(2),x=l):(D=x.substring(2,L),x=x.substring(L)||l)}return new T("file",D,x,u,u)}static from(x){let D=new T(x.scheme,x.authority,x.path,x.query,x.fragment);return c(D,!0),D}toString(x=!1){return m(this,x)}toJSON(){return this}static revive(x){if(x){if(x instanceof d)return x;{let D=new T(x);return D._formatted=x.external,D._fsPath=x._sep===p?x.fsPath:null,D}}return x}}let p=i?1:void 0;class T extends d{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=h(this,!1)),this._fsPath}toString(x=!1){return x?m(this,!0):(this._formatted||(this._formatted=m(this,!1)),this._formatted)}toJSON(){let x={$mid:1};return this._fsPath&&(x.fsPath=this._fsPath,x._sep=p),this._formatted&&(x.external=this._formatted),this.path&&(x.path=this.path),this.scheme&&(x.scheme=this.scheme),this.authority&&(x.authority=this.authority),this.query&&(x.query=this.query),this.fragment&&(x.fragment=this.fragment),x}}let R={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 A(I,x,D){let L,ne=-1;for(let K=0;K<I.length;K++){let B=I.charCodeAt(K);if(B>=97&&B<=122||B>=65&&B<=90||B>=48&&B<=57||B===45||B===46||B===95||B===126||x&&B===47||D&&B===91||D&&B===93||D&&B===58)ne!==-1&&(L+=encodeURIComponent(I.substring(ne,K)),ne=-1),L!==void 0&&(L+=I.charAt(K));else{L===void 0&&(L=I.substr(0,K));let xt=R[B];xt!==void 0?(ne!==-1&&(L+=encodeURIComponent(I.substring(ne,K)),ne=-1),L+=xt):ne===-1&&(ne=K)}}return ne!==-1&&(L+=encodeURIComponent(I.substring(ne))),L!==void 0?L:I}function S(I){let x;for(let D=0;D<I.length;D++){let L=I.charCodeAt(D);L===35||L===63?(x===void 0&&(x=I.substr(0,D)),x+=R[L]):x!==void 0&&(x+=I[D])}return x!==void 0?x:I}function h(I,x){let D;return D=I.authority&&I.path.length>1&&I.scheme==="file"?`//${I.authority}${I.path}`:I.path.charCodeAt(0)===47&&(I.path.charCodeAt(1)>=65&&I.path.charCodeAt(1)<=90||I.path.charCodeAt(1)>=97&&I.path.charCodeAt(1)<=122)&&I.path.charCodeAt(2)===58?x?I.path.substr(1):I.path[1].toLowerCase()+I.path.substr(2):I.path,i&&(D=D.replace(/\//g,"\\")),D}function m(I,x){let D=x?S:A,L="",{scheme:ne,authority:K,path:B,query:xt,fragment:vt}=I;if(ne&&(L+=ne,L+=":"),(K||ne==="file")&&(L+=l,L+=l),K){let oe=K.indexOf("@");if(oe!==-1){let en=K.substr(0,oe);K=K.substr(oe+1),oe=en.lastIndexOf(":"),oe===-1?L+=D(en,!1,!1):(L+=D(en.substr(0,oe),!1,!1),L+=":",L+=D(en.substr(oe+1),!1,!0)),L+="@"}K=K.toLowerCase(),oe=K.lastIndexOf(":"),oe===-1?L+=D(K,!1,!0):(L+=D(K.substr(0,oe),!1,!0),L+=K.substr(oe))}if(B){if(B.length>=3&&B.charCodeAt(0)===47&&B.charCodeAt(2)===58){let oe=B.charCodeAt(1);oe>=65&&oe<=90&&(B=`/${String.fromCharCode(oe+32)}:${B.substr(3)}`)}else if(B.length>=2&&B.charCodeAt(1)===58){let oe=B.charCodeAt(0);oe>=65&&oe<=90&&(B=`${String.fromCharCode(oe+32)}:${B.substr(2)}`)}L+=D(B,!0,!1)}return xt&&(L+="?",L+=D(xt,!1,!1)),vt&&(L+="#",L+=x?vt:A(vt,!1,!1)),L}function b(I){try{return decodeURIComponent(I)}catch{return I.length>3?I.substr(0,3)+b(I.substr(3)):I}}let _=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function V(I){return I.match(_)?I.replace(_,x=>b(x)):I}var Ct=r(470);let rt=Ct.posix||Ct,gr="/";var Xt;(function(I){I.joinPath=function(x,...D){return x.with({path:rt.join(x.path,...D)})},I.resolvePath=function(x,...D){let L=x.path,ne=!1;L[0]!==gr&&(L=gr+L,ne=!0);let K=rt.resolve(L,...D);return ne&&K[0]===gr&&!x.authority&&(K=K.substring(1)),x.with({path:K})},I.dirname=function(x){if(x.path.length===0||x.path===gr)return x;let D=rt.dirname(x.path);return D.length===1&&D.charCodeAt(0)===46&&(D=""),x.with({path:D})},I.basename=function(x){return rt.basename(x.path)},I.extname=function(x){return rt.extname(x.path)}})(Xt||(Xt={}))})(),Lb=n})();var{URI:At,Utils:ns}=Lb;var ue;(function(t){t.basename=ns.basename,t.dirname=ns.dirname,t.extname=ns.extname,t.joinPath=ns.joinPath,t.resolvePath=ns.resolvePath;function e(n,i){return n?.toString()===i?.toString()}t.equals=e;function r(n,i){let o=typeof n=="string"?n:n.path,s=typeof i=="string"?i:i.path,a=o.split("/").filter(d=>d.length>0),c=s.split("/").filter(d=>d.length>0),u=0;for(;u<a.length&&a[u]===c[u];u++);let l="../".repeat(a.length-u),f=c.slice(u).join("/");return l+f}t.relative=r})(ue||(ue={}));var DW=ue.equals,OW=ue.relative;var wl,Mb=()=>wl??(wl=kl(`{"$type":"Grammar","isDeclared":true,"name":"LangiumGrammar","rules":[{"$type":"ParserRule","name":"Grammar","entry":true,"definition":{"$type":"Group","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"isDeclared","operator":"?=","terminal":{"$type":"Keyword","value":"grammar"}},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"with"},{"$type":"Assignment","feature":"usedGrammars","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@0"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"usedGrammars","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@0"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}}],"cardinality":"*"}],"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Assignment","feature":"definesHiddenTokens","operator":"?=","terminal":{"$type":"Keyword","value":"hidden"}},{"$type":"Keyword","value":"("},{"$type":"Group","elements":[{"$type":"Assignment","feature":"hiddenTokens","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@11"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"hiddenTokens","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@11"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}}],"cardinality":"*"}],"cardinality":"?"},{"$type":"Keyword","value":")"}],"cardinality":"?"}],"cardinality":"?"},{"$type":"Assignment","feature":"imports","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"interfaces","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"types","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"+"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Interface","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"interface"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"extends"},{"$type":"Assignment","feature":"superTypes","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@0"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"superTypes","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@0"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}}],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SchemaType","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"attributes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TypeAttribute","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@59"},"arguments":[]}},{"$type":"Assignment","feature":"isOptional","operator":"?=","terminal":{"$type":"Keyword","value":"?"},"cardinality":"?"},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TypeDefinition","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"UnionType","inferredType":{"$type":"InferredType","name":"TypeDefinition"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"UnionType"},"feature":"types","operator":"+="},{"$type":"Group","elements":[{"$type":"Keyword","value":"|"},{"$type":"Assignment","feature":"types","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}],"cardinality":"+"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ArrayType","inferredType":{"$type":"InferredType","name":"TypeDefinition"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ArrayType"},"feature":"elementType","operator":"="},{"$type":"Keyword","value":"["},{"$type":"Keyword","value":"]"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ReferenceType","inferredType":{"$type":"InferredType","name":"TypeDefinition"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ReferenceType"}},{"$type":"Keyword","value":"@"},{"$type":"Assignment","feature":"referenceType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SimpleType","inferredType":{"$type":"InferredType","name":"TypeDefinition"},"definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Keyword","value":")"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"SimpleType"}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"typeRef","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@0"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"primitiveType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"stringType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@61"},"arguments":[]}}]}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PrimitiveType","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"string"},{"$type":"Keyword","value":"number"},{"$type":"Keyword","value":"boolean"},{"$type":"Keyword","value":"Date"},{"$type":"Keyword","value":"bigint"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Type","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"type"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}},{"$type":"Keyword","value":"="},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"AbstractRule","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@47"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"GrammarImport","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"import"},{"$type":"Assignment","feature":"path","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@61"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ParserRule","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"entry","operator":"?=","terminal":{"$type":"Keyword","value":"entry"}},{"$type":"Assignment","feature":"fragment","operator":"?=","terminal":{"$type":"Keyword","value":"fragment"}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"wildcard","operator":"?=","terminal":{"$type":"Keyword","value":"*"}},{"$type":"Group","elements":[{"$type":"Keyword","value":"returns"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"returnType","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@0"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"dataType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]}]},{"$type":"Assignment","feature":"inferredType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[{"$type":"NamedArgument","value":{"$type":"LiteralCondition","true":false},"calledByName":false}]}}],"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Assignment","feature":"definesHiddenTokens","operator":"?=","terminal":{"$type":"Keyword","value":"hidden"}},{"$type":"Keyword","value":"("},{"$type":"Group","elements":[{"$type":"Assignment","feature":"hiddenTokens","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@11"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"hiddenTokens","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@11"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}}],"cardinality":"*"}],"cardinality":"?"},{"$type":"Keyword","value":")"}],"cardinality":"?"},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"definition","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Keyword","value":";"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"InferredType","parameters":[{"$type":"Parameter","name":"imperative"}],"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","guardCondition":{"$type":"ParameterReference","parameter":{"$ref":"#/rules@14/parameters@0"}},"elements":[{"$type":"Keyword","value":"infer"}]},{"$type":"Group","guardCondition":{"$type":"Negation","value":{"$type":"ParameterReference","parameter":{"$ref":"#/rules@14/parameters@0"}}},"elements":[{"$type":"Keyword","value":"infers"}]}]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"wildcard":false},{"$type":"ParserRule","name":"RuleNameAndParams","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"<"},{"$type":"Group","elements":[{"$type":"Assignment","feature":"parameters","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"parameters","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"*"}],"cardinality":"?"},{"$type":"Keyword","value":">"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Parameter","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Alternatives","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Alternatives"},"feature":"elements","operator":"+="},{"$type":"Group","elements":[{"$type":"Keyword","value":"|"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}],"cardinality":"+"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ConditionalBranch","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Group"}},{"$type":"Keyword","value":"<"},{"$type":"Assignment","feature":"guardCondition","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]}},{"$type":"Keyword","value":">"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"+"}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"UnorderedGroup","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"UnorderedGroup"},"feature":"elements","operator":"+="},{"$type":"Group","elements":[{"$type":"Keyword","value":"&"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"+"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Group","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Group"},"feature":"elements","operator":"+="},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"+"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"AbstractToken","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"AbstractTokenWithCardinality","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@38"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]}]},{"$type":"Assignment","feature":"cardinality","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"?"},{"$type":"Keyword","value":"*"},{"$type":"Keyword","value":"+"}]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Action","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Action"}},{"$type":"Keyword","value":"{"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@0"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"inferredType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[{"$type":"NamedArgument","value":{"$type":"LiteralCondition","true":true},"calledByName":false}]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"."},{"$type":"Assignment","feature":"feature","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@59"},"arguments":[]}},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"="},{"$type":"Keyword","value":"+="}]}},{"$type":"Keyword","value":"current"}],"cardinality":"?"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"AbstractTerminal","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@44"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@36"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@37"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@45"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EndOfFile","definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"EndOfFile"}},{"$type":"Keyword","value":"EOF"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Keyword","definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@61"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RuleCall","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rule","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@11"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Keyword","value":"<"},{"$type":"Assignment","feature":"arguments","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"arguments","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}}],"cardinality":"*"},{"$type":"Keyword","value":">"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NamedArgument","definition":{"$type":"Group","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"parameter","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@16"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"calledByName","operator":"?=","terminal":{"$type":"Keyword","value":"="}}],"cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LiteralCondition","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"true","operator":"?=","terminal":{"$type":"Keyword","value":"true"}},{"$type":"Keyword","value":"false"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Disjunction","inferredType":{"$type":"InferredType","name":"Condition"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Disjunction"},"feature":"left","operator":"="},{"$type":"Keyword","value":"|"},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Conjunction","inferredType":{"$type":"InferredType","name":"Condition"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Conjunction"},"feature":"left","operator":"="},{"$type":"Keyword","value":"&"},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Negation","inferredType":{"$type":"InferredType","name":"Condition"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@33"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Negation"}},{"$type":"Keyword","value":"!"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Atom","inferredType":{"$type":"InferredType","name":"Condition"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@35"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@34"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ParenthesizedCondition","inferredType":{"$type":"InferredType","name":"Condition"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]},{"$type":"Keyword","value":")"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ParameterReference","definition":{"$type":"Assignment","feature":"parameter","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@16"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PredicatedKeyword","inferredType":{"$type":"InferredType","name":"Keyword"},"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"=>"},{"$type":"Keyword","value":"->"}]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@61"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PredicatedRuleCall","inferredType":{"$type":"InferredType","name":"RuleCall"},"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"=>"},{"$type":"Keyword","value":"->"}]},{"$type":"Assignment","feature":"rule","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@11"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Keyword","value":"<"},{"$type":"Assignment","feature":"arguments","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"arguments","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}}],"cardinality":"*"},{"$type":"Keyword","value":">"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Assignment","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Assignment"}},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"=>"},{"$type":"Keyword","value":"->"}],"cardinality":"?"},{"$type":"Assignment","feature":"feature","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@59"},"arguments":[]}},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"+="},{"$type":"Keyword","value":"="},{"$type":"Keyword","value":"?="}]}},{"$type":"Assignment","feature":"terminal","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"AssignableTerminal","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@40"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@42"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ParenthesizedAssignableElement","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]},{"$type":"Keyword","value":")"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"AssignableAlternatives","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Alternatives"},"feature":"elements","operator":"+="},{"$type":"Group","elements":[{"$type":"Keyword","value":"|"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}}],"cardinality":"+"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CrossReference","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"CrossReference"}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@0"},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"deprecatedSyntax","operator":"?=","terminal":{"$type":"Keyword","value":"|"}},{"$type":"Keyword","value":":"}]},{"$type":"Assignment","feature":"terminal","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@43"},"arguments":[]}}],"cardinality":"?"},{"$type":"Keyword","value":"]"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CrossReferenceableTerminal","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ParenthesizedElement","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]},{"$type":"Keyword","value":")"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PredicatedGroup","inferredType":{"$type":"InferredType","name":"Group"},"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"=>"},{"$type":"Keyword","value":"->"}]},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ReturnType","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TerminalRule","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"hidden","operator":"?=","terminal":{"$type":"Keyword","value":"hidden"},"cardinality":"?"},{"$type":"Keyword","value":"terminal"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"fragment","operator":"?=","terminal":{"$type":"Keyword","value":"fragment"}},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"returns"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@46"},"arguments":[]}}],"cardinality":"?"}]}]},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"definition","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":";"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TerminalAlternatives","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@49"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"TerminalAlternatives"},"feature":"elements","operator":"+="},{"$type":"Keyword","value":"|"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@49"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TerminalGroup","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"TerminalGroup"},"feature":"elements","operator":"+="},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},"cardinality":"+"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TerminalToken","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"Assignment","feature":"cardinality","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"?"},{"$type":"Keyword","value":"*"},{"$type":"Keyword","value":"+"}]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TerminalTokenElement","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@58"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@53"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@54"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@55"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@56"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@57"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ParenthesizedTerminalElement","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"lookahead","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"?="},{"$type":"Keyword","value":"?!"}]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]},{"$type":"Keyword","value":")"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TerminalRuleCall","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"TerminalRuleCall"}},{"$type":"Assignment","feature":"rule","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@47"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"deprecatedSyntax":false}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NegatedToken","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"NegatedToken"}},{"$type":"Keyword","value":"!"},{"$type":"Assignment","feature":"terminal","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"UntilToken","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"UntilToken"}},{"$type":"Keyword","value":"->"},{"$type":"Assignment","feature":"terminal","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RegexToken","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"RegexToken"}},{"$type":"Assignment","feature":"regex","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@62"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Wildcard","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Wildcard"}},{"$type":"Keyword","value":"."}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CharacterRange","inferredType":{"$type":"InferredType","name":"AbstractElement"},"definition":{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"CharacterRange"}},{"$type":"Assignment","feature":"left","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":".."},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"FeatureName","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"current"},{"$type":"Keyword","value":"entry"},{"$type":"Keyword","value":"extends"},{"$type":"Keyword","value":"false"},{"$type":"Keyword","value":"fragment"},{"$type":"Keyword","value":"grammar"},{"$type":"Keyword","value":"hidden"},{"$type":"Keyword","value":"import"},{"$type":"Keyword","value":"interface"},{"$type":"Keyword","value":"returns"},{"$type":"Keyword","value":"terminal"},{"$type":"Keyword","value":"true"},{"$type":"Keyword","value":"type"},{"$type":"Keyword","value":"infer"},{"$type":"Keyword","value":"infers"},{"$type":"Keyword","value":"with"},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"ID","definition":{"$type":"RegexToken","regex":"/\\\\^?[_a-zA-Z][\\\\w_]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"(\\\\\\\\.|[^\\"\\\\\\\\])*\\"|'(\\\\\\\\.|[^'\\\\\\\\])*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"RegexLiteral","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\/(?![*+?])(?:[^\\\\r\\\\n\\\\[/\\\\\\\\]|\\\\\\\\.|\\\\[(?:[^\\\\r\\\\n\\\\]\\\\\\\\]|\\\\\\\\.)*\\\\])+\\\\/[a-z]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/\\\\s+/"},"fragment":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}],"types":[{"$type":"Type","name":"AbstractType","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@1"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@10"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@23/definition/elements@0"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@13"}}]}}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"interfaces":[],"usedGrammars":[]}`));ji();var Ka=se(kn(),1);function SI(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}var Fb=0,bI=10;var Ub=Symbol("OperationCancelled");function Zi(t){return t===Ub}async function Ue(t){if(t===Ka.CancellationToken.None)return;let e=Date.now();if(e-Fb>=bI&&(Fb=e,await SI()),t.isCancellationRequested)throw Ub}var El=class{constructor(){this.previousAction=Promise.resolve(),this.previousTokenSource=new Ka.CancellationTokenSource}lock(e){this.cancel();let r=new Ka.CancellationTokenSource;return this.previousTokenSource=r,this.previousAction=this.previousAction.then(()=>e(r.token).catch(n=>{Zi(n)||console.error("Error: ",n)}))}cancel(){this.previousTokenSource.cancel()}};function Ar(t){return{code:t}}var za;(function(t){t.all=["fast","slow","built-in"]})(za||(za={}));var _l=class{constructor(e){this.entries=new ye,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)}}}wrapValidationException(e,r){return async(n,i,o)=>{try{await e.call(r,n,i,o)}catch(s){if(Zi(s))throw s;console.error("An error occurred during validation:",s);let a=s instanceof Error?s.message:String(s);s instanceof Error&&s.stack&&console.error(s.stack),i("error","An error occurred during validation: "+a,{node:n})}}}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=J(this.entries.get(e)).concat(this.entries.get("AstNode"));return r&&(n=n.filter(i=>r.includes(i.category))),n.map(i=>i.check)}};function qb(t,e){let r={unions:[],interfaces:[]};for(let n of t){let i=[];for(let a of n.attributes)i.push({name:a.name,optional:a.isOptional,astNodes:new Set([a]),type:eo(a.type)});let o=new Set;for(let a of n.superTypes)a.ref&&o.add(Yr(a.ref));let s={name:n.name,declared:!0,abstract:!1,properties:i,superTypes:o,subTypes:new Set};r.interfaces.push(s)}for(let n of e){let i={name:n.name,declared:!0,type:eo(n.type),superTypes:new Set,subTypes:new Set};r.unions.push(i)}return r}function eo(t){if(Vi(t))return{elementType:eo(t.elementType)};if(Xi(t))return{referenceType:eo(t.referenceType)};if($r(t))return{types:t.types.map(eo)};if(Wt(t)){let e;if(t.primitiveType)return e=t.primitiveType,{primitive:e};if(t.stringType)return e=t.stringType,{string:e};if(t.typeRef){let r=t.typeRef.ref,n=fn(r);if(n)return is(n)?{primitive:n}:{value:n}}}return{primitive:"unknown"}}function os(t){return"referenceType"in t}function Sg(t){return"elementType"in t}function jb(t){return"types"in t}function bg(t){return"value"in t}function AI(t){return"primitive"in t}function wI(t){return"string"in t}function Gb(t){let e=new Map,r=new Map;for(let n of t.interfaces){let i=new es(n.name,n.declared,n.abstract);e.set(n.name,i)}for(let n of t.unions){let i=new Tl(n.name,{declared:n.declared,dataType:n.dataType});r.set(n.name,i)}for(let n of t.interfaces){let i=e.get(n.name);for(let o of n.superTypes){let s=e.get(o)||r.get(o);s&&i.superTypes.add(s)}for(let o of n.subTypes){let s=e.get(o)||r.get(o);s&&i.subTypes.add(s)}for(let o of n.properties){let s=kI(o,e,r);i.properties.push(s)}}for(let n of t.unions){let i=r.get(n.name);i.type=Va(n.type,i,e,r)}return{interfaces:Array.from(e.values()),unions:Array.from(r.values())}}function kI(t,e,r){return{name:t.name,optional:t.optional,astNodes:t.astNodes,type:Va(t.type,void 0,e,r)}}function Va(t,e,r,n){if(Sg(t))return{elementType:Va(t.elementType,e,r,n)};if(os(t))return{referenceType:Va(t.referenceType,void 0,r,n)};if(jb(t))return{types:t.types.map(i=>Va(i,e,r,n))};if(wI(t))return{string:t.string};if(AI(t))return{primitive:t.primitive,regex:t.regex};if(bg(t)){let i=r.get(t.value)||n.get(t.value);return i?(e&&e.subTypes.add(i),{value:i}):{primitive:"unknown"}}else throw new Error("Invalid property type")}function wg(t,e){let r=Xa(t),n=Xa(e);for(let i of n)EI(r,i)||r.push(i);return r.length===1?r[0]:{types:r}}function EI(t,e){return t.some(r=>Ag(r,e))}function Ag(t,e){return Sg(t)&&Sg(e)?Ag(t.elementType,e.elementType):os(t)&&os(e)?Ag(t.referenceType,e.referenceType):bg(t)&&bg(e)?t.value===e.value:!1}function Xa(t){return jb(t)?t.types.flatMap(e=>Xa(e)):[t]}function Hb(t){let e=t.validation.ValidationRegistry,r=t.validation.LangiumGrammarValidator,n={Action:[r.checkAssignmentReservedName],AbstractRule:r.checkRuleName,Assignment:[r.checkAssignmentWithFeatureName,r.checkAssignmentToFragmentRule,r.checkAssignmentTypes,r.checkAssignmentReservedName],ParserRule:[r.checkParserRuleDataType,r.checkRuleParametersUsed,r.checkParserRuleReservedName],TerminalRule:[r.checkTerminalRuleReturnType,r.checkHiddenTerminalRule,r.checkEmptyTerminalRule],InferredType:r.checkTypeReservedName,Keyword:r.checkKeyword,UnorderedGroup:r.checkUnorderedGroup,Grammar:[r.checkGrammarName,r.checkEntryGrammarRule,r.checkUniqueRuleName,r.checkUniqueTypeName,r.checkUniqueImportedRules,r.checkDuplicateImportedGrammar,r.checkGrammarHiddenTokens,r.checkGrammarForUnusedRules,r.checkGrammarTypeInfer,r.checkClashingTerminalNames],GrammarImport:r.checkPackageImport,CharacterRange:r.checkInvalidCharacterRange,Interface:[r.checkTypeReservedName,r.checkInterfacePropertyTypes],Type:[r.checkTypeReservedName],TypeAttribute:r.checkTypeReservedName,RuleCall:[r.checkUsedHiddenTerminalRule,r.checkUsedFragmentTerminalRule,r.checkRuleCallParameters],TerminalRuleCall:r.checkUsedHiddenTerminalRule,CrossReference:[r.checkCrossReferenceSyntax,r.checkCrossRefNameAssignment,r.checkCrossRefTerminalType,r.checkCrossRefType,r.checkCrossReferenceToTypeUnion],SimpleType:r.checkFragmentsInTypes,ReferenceType:r.checkReferenceTypeUnion,RegexToken:[r.checkInvalidRegexFlags,r.checkDirectlyUsedRegexFlags]};e.register(n,r)}var Re;(function(t){t.GrammarNameUppercase="grammar-name-uppercase",t.RuleNameUppercase="rule-name-uppercase",t.HiddenGrammarTokens="hidden-grammar-tokens",t.UseRegexTokens="use-regex-tokens",t.EntryRuleTokenSyntax="entry-rule-token-syntax",t.CrossRefTokenSyntax="cross-ref-token-syntax",t.UnnecessaryFileExtension="unnecessary-file-extension",t.InvalidReturns="invalid-returns",t.InvalidInfers="invalid-infers",t.MissingInfer="missing-infer",t.MissingReturns="missing-returns",t.SuperfluousInfer="superfluous-infer",t.OptionalUnorderedGroup="optional-unordered-group"})(Re||(Re={}));var Cl=class{constructor(e){this.references=e.references.References,this.documents=e.shared.workspace.LangiumDocuments}checkGrammarName(e,r){if(e.name){let n=e.name.substring(0,1);n.toUpperCase()!==n&&r("warning","Grammar name should start with an upper case letter.",{node:e,property:"name",data:Ar(Re.GrammarNameUppercase)})}}checkEntryGrammarRule(e,r){if(e.isDeclared&&!e.name)return;let n=e.rules.filter(i=>M(i)&&i.entry);if(e.isDeclared&&n.length===0){let i=e.rules.find(o=>M(o)&&!wr(o));i?r("error","The grammar is missing an entry parser rule. This rule can be an entry one.",{node:i,property:"name",data:Ar(Re.EntryRuleTokenSyntax)}):r("error","This grammar is missing an entry parser rule.",{node:e,property:"name"})}else!e.isDeclared&&n.length>=1?n.forEach(i=>r("error","Cannot declare entry rules for unnamed grammars.",{node:i,property:"name"})):n.length>1?n.forEach(i=>r("error","The entry rule has to be unique.",{node:i,property:"name"})):n.length===1&&wr(n[0])&&r("error","The entry rule cannot be a data type rule.",{node:n[0],property:"name"})}checkUniqueRuleName(e,r){let n=i=>J(i.rules).filter(o=>!Ya(o));this.checkUniqueName(e,r,n,"rule")}checkUniqueTypeName(e,r){let n=i=>J(i.types).concat(i.interfaces);this.checkUniqueName(e,r,n,"type")}checkUniqueName(e,r,n,i){let o=new ye;n(e).forEach(c=>o.add(c.name,c));for(let[,c]of o.entriesGroupedByKey())c.length>1&&c.forEach(u=>{r("error",`A ${i}'s name has to be unique.`,{node:u,property:"name"})});let s=new Set,a=Ja(this.documents,e);for(let c of a)n(c).forEach(u=>s.add(u.name));for(let c of o.keys())s.has(c)&&o.get(c).forEach(l=>{r("error",`A ${i} with the name '${l.name}' already exists in an imported grammar.`,{node:l,property:"name"})})}checkDuplicateImportedGrammar(e,r){let n=new ye;for(let i of e.imports){let o=$n(this.documents,i);o&&n.add(o,i)}for(let[,i]of n.entriesGroupedByKey())i.length>1&&i.forEach((o,s)=>{s>0&&r("warning","The grammar is already being directly imported.",{node:o,tags:[Ui.Unnecessary]})})}checkUniqueImportedRules(e,r){let n=new Map;for(let o of e.imports){let s=Ja(this.documents,o);n.set(o,s)}let i=new ye;for(let o of e.imports){let s=n.get(o);for(let a of e.imports){if(o===a)continue;let c=n.get(a),u=this.getDuplicateExportedRules(s,c);for(let l of u)i.add(o,l)}}for(let o of e.imports){let s=i.get(o);s.length>0&&r("error","Some rules exported by this grammar are also included in other imports: "+J(s).distinct().join(", "),{node:o,property:"path"})}}getDuplicateExportedRules(e,r){let i=e.filter(a=>!r.includes(a)).flatMap(a=>a.rules),o=r.flatMap(a=>a.rules),s=new Set;for(let a of i){let c=a.name;for(let u of o){let l=u.name;c===l&&s.add(u.name)}}return s}checkGrammarTypeInfer(e,r){var n,i,o;let s=new Set;for(let c of e.types)s.add(c.name);for(let c of e.interfaces)s.add(c.name);for(let c of Ja(this.documents,e))c.types.forEach(u=>s.add(u.name)),c.interfaces.forEach(u=>s.add(u.name));for(let c of e.rules.filter(M)){if(Ya(c))continue;let u=wr(c),l=!c.returnType&&!c.dataType,f=fn(c);if(!u&&f&&s.has(f)===l){if((l||((n=c.returnType)===null||n===void 0?void 0:n.ref)!==void 0)&&c.inferredType===void 0)r("error",a(f,l),{node:c,property:"name",data:Ar(Re.MissingReturns)});else if(l||((i=c.returnType)===null||i===void 0?void 0:i.ref)!==void 0){let d=Lr(c.inferredType.$cstNode,"infers");r("error",a(f,l),{node:c.inferredType,property:"name",data:{code:Re.InvalidInfers,actionSegment:Gt(d)}})}}else if(u&&l){let d=Lr(c.$cstNode,"infer");r("error","Data type rules cannot infer a type.",{node:c,property:"inferredType",data:{code:Re.InvalidInfers,actionSegment:Gt(d)}})}}for(let c of Fe(e).filter(Te)){let u=this.getActionType(c);if(u){let l=!!c.inferredType,f=fn(c);if(c.type&&f&&s.has(f)===l){let d=l?Lr(c.$cstNode,"infer"):Lr(c.$cstNode,"{");r("error",a(f,l),{node:c,property:"type",data:{code:l?Re.SuperfluousInfer:Re.MissingInfer,actionSegment:Gt(d)}})}else if(u&&f&&s.has(f)&&l&&c.$cstNode){let d=$t((o=c.inferredType)===null||o===void 0?void 0:o.$cstNode,"name"),p=Lr(c.$cstNode,"{");d&&p&&r("error",`${f} is a declared type and cannot be redefined.`,{node:c,property:"type",data:{code:Re.SuperfluousInfer,actionRange:{start:p.range.end,end:d.range.start}}})}}}function a(c,u){return u?`The type '${c}' is already explicitly declared and cannot be inferred.`:`The type '${c}' is not explicitly declared and must be inferred.`}}getActionType(e){var r;if(e.type)return(r=e.type)===null||r===void 0?void 0:r.ref;if(e.inferredType)return e.inferredType}checkGrammarHiddenTokens(e,r){e.definesHiddenTokens&&r("error","Hidden terminals are declared at the terminal definition.",{node:e,property:"definesHiddenTokens",data:Ar(Re.HiddenGrammarTokens)})}checkHiddenTerminalRule(e,r){e.hidden&&e.fragment&&r("error","Cannot use terminal fragments as hidden tokens.",{node:e,property:"hidden"})}checkEmptyTerminalRule(e,r){try{let n=Fr(e);new RegExp(n).test("")&&r("error","This terminal could match an empty string.",{node:e,property:"name"})}catch{}}checkInvalidRegexFlags(e,r){let n=e.regex;if(n){let i=n.lastIndexOf("/"),o=n.substring(i+1),s="gmy",c=s+"isu",u=new Set,l=new Set;for(let d=0;d<o.length;d++){let p=o.charAt(d);c.includes(p)?s.includes(p)&&l.add(p):u.add(p)}let f=this.getFlagRange(e);f&&(u.size>0?r("error",`'${Array.from(u).join("")}' ${u.size>1?"are":"is"} not valid regular expression flag${u.size>1?"s":""}.`,{node:e,range:f}):l.size>0&&r("warning",`'${Array.from(l).join("")}' regular expression flag${l.size>1?"s":""} will be ignored by Langium.`,{node:e,range:f}))}}checkDirectlyUsedRegexFlags(e,r){if(!pe(e.$container)){let n=this.getFlagRange(e);n&&r("warning","Regular expression flags are only applied if the terminal is not a composition",{node:e,range:n})}}getFlagRange(e){let r=$t(e.$cstNode,"regex");if(!r||!e.regex)return;let n=e.regex,i=n.lastIndexOf("/")+1;return{start:{line:r.range.end.line,character:r.range.end.character-n.length+i},end:r.range.end}}checkUsedHiddenTerminalRule(e,r){let n=ve(e,i=>pe(i)||M(i));if(n){if("hidden"in n&&n.hidden)return;let i=e.rule.ref;pe(i)&&i.hidden&&r("error","Cannot use hidden terminal in non-hidden rule",{node:e,property:"rule"})}}checkUsedFragmentTerminalRule(e,r){let n=e.rule.ref;pe(n)&&n.fragment&&ve(e,M)&&r("error","Cannot use terminal fragments as part of parser rules.",{node:e,property:"rule"})}checkCrossReferenceSyntax(e,r){e.deprecatedSyntax&&r("error","'|' is deprecated. Please, use ':' instead.",{node:e,property:"deprecatedSyntax",data:Ar(Re.CrossRefTokenSyntax)})}checkPackageImport(e,r){$n(this.documents,e)===void 0?r("error","Import cannot be resolved.",{node:e,property:"path"}):e.path.endsWith(".langium")&&r("warning","Imports do not need file extensions.",{node:e,property:"path",data:Ar(Re.UnnecessaryFileExtension)})}checkInvalidCharacterRange(e,r){if(e.right){let n="Character ranges cannot use more than one character",i=!1;e.left.value.length>1&&(i=!0,r("error",n,{node:e.left,property:"value"})),e.right.value.length>1&&(i=!0,r("error",n,{node:e.right,property:"value"})),i||r("hint","Consider using regex instead of character ranges",{node:e,data:Ar(Re.UseRegexTokens)})}}checkGrammarForUnusedRules(e,r){let n=ss(e,!0);for(let i of e.rules)pe(i)&&i.hidden||Ya(i)||n.has(i)||r("hint","This rule is declared but never referenced.",{node:i,property:"name",tags:[Ui.Unnecessary]})}checkClashingTerminalNames(e,r){let n=new ye,i=new Set;for(let u of e.rules)pe(u)&&u.name&&n.add(u.name,u),M(u)&&Fe(u).filter(Ze).forEach(f=>i.add(f.value));let o=new ye,s=new ye;for(let u of e.imports){let l=Ja(this.documents,u);for(let f of l)for(let d of f.rules)pe(d)&&d.name?o.add(d.name,u):M(d)&&d.name&&Fe(d).filter(Ze).forEach(T=>s.add(T.value,u))}for(let u of n.values())if(i.has(u.name))r("error","Terminal name clashes with existing keyword.",{node:u,property:"name"});else if(s.has(u.name)){let l=s.get(u.name);r("error",`Terminal name clashes with imported keyword from "${l[0].path}".`,{node:u,property:"name"})}let a=new ye;for(let u of i)for(let l of o.get(u))a.add(l,u);for(let[u,l]of a.entriesGroupedByKey())l.length>0&&r("error",`Imported terminals (${l.join(", ")}) clash with locally defined keywords.`,{node:u,property:"path"});let c=new ye;for(let[u,l]of o.entriesGroupedByKey()){let f=s.get(u);f.length>0&&l.filter(d=>!f.includes(d)).forEach(d=>c.add(d,u))}for(let[u,l]of c.entriesGroupedByKey())l.length>0&&r("error",`Imported terminals (${l.join(", ")}) clash with imported keywords.`,{node:u,property:"path"})}checkRuleName(e,r){if(e.name&&!Ya(e)){let n=e.name.substring(0,1);n.toUpperCase()!==n&&r("warning","Rule name should start with an upper case letter.",{node:e,property:"name",data:Ar(Re.RuleNameUppercase)})}}checkTypeReservedName(e,r){this.checkReservedName(e,"name",r)}checkAssignmentReservedName(e,r){this.checkReservedName(e,"feature",r)}checkParserRuleReservedName(e,r){e.inferredType||this.checkReservedName(e,"name",r)}checkReservedName(e,r,n){let i=e[r];typeof i=="string"&&_I.has(i)&&n("error",`'${i}' is a reserved name of the JavaScript runtime.`,{node:e,property:r})}checkKeyword(e,r){ve(e,M)&&(e.value.length===0?r("error","Keywords cannot be empty.",{node:e}):e.value.trim().length===0?r("error","Keywords cannot only consist of whitespace characters.",{node:e}):/\s/g.test(e.value)&&r("warning","Keywords should not contain whitespace characters.",{node:e}))}checkUnorderedGroup(e,r){e.elements.forEach(n=>{Mr(n.cardinality)&&r("error","Optional elements in Unordered groups are currently not supported",{node:n,data:Ar(Re.OptionalUnorderedGroup)})})}checkRuleParametersUsed(e,r){let n=e.parameters;if(n.length>0){let i=Fe(e).filter(Vo);for(let o of n)i.some(s=>s.parameter.ref===o)||r("hint",`Parameter '${o.name}' is unused.`,{node:o,tags:[Ui.Unnecessary]})}}checkParserRuleDataType(e,r){if(Ya(e))return;let n=Bb(e),i=wr(e);!n&&i?r("error","This parser rule does not create an object. Add a primitive return type or an action to the start of the rule to force object instantiation.",{node:e,property:"name"}):n&&!i&&r("error","Normal parser rules are not allowed to return a primitive value. Use a datatype rule for that.",{node:e,property:e.dataType?"dataType":"returnType"})}checkAssignmentToFragmentRule(e,r){e.terminal&&xe(e.terminal)&&M(e.terminal.rule.ref)&&e.terminal.rule.ref.fragment&&r("error",`Cannot use fragment rule '${e.terminal.rule.ref.name}' for assignment of property '${e.feature}'.`,{node:e,property:"terminal"})}checkAssignmentTypes(e,r){if(!e.terminal)return;let n;Fe(e.terminal).map(o=>Dt(o)?"ref":"other").find(o=>n?o!==n:(n=o,!1))&&r("error",this.createMixedTypeError(e.feature),{node:e,property:"terminal"})}checkInterfacePropertyTypes(e,r){for(let n of e.attributes)if(n.type){let i=eo(n.type),o=Xa(i),s=!1,a=!1;for(let c of o)os(c)?s=!0:os(c)||(a=!0);s&&a&&r("error",this.createMixedTypeError(n.name),{node:n,property:"type"})}}createMixedTypeError(e){return`Mixing a cross-reference with other types is not supported. Consider splitting property "${e}" into two or more different properties.`}checkTerminalRuleReturnType(e,r){var n;!((n=e.type)===null||n===void 0)&&n.name&&!is(e.type.name)&&r("error","Terminal rules can only return primitive types like 'string', 'boolean', 'number', 'Date' or 'bigint'.",{node:e.type,property:"name"})}checkRuleCallParameters(e,r){let n=e.rule.ref;if(M(n)){let i=n.parameters.length,o=e.arguments.length;i!==o&&r("error",`Rule '${n.name}' expects ${i} arguments, but got ${o}.`,{node:e})}else pe(n)&&e.arguments.length>0&&r("error","Terminal rules do not accept any arguments",{node:e})}checkCrossRefNameAssignment(e,r){!e.terminal&&e.type.ref&&!Qa(e.type.ref)&&r("error","Cannot infer terminal or data type rule for cross-reference.",{node:e,property:"type"})}checkCrossRefTerminalType(e,r){var n;let i=e.terminal;if(xe(i)){let o=i.rule.ref;M(o)&&!wr(o)?r("error","Parser rules cannot be used for cross-references.",{node:i,property:"rule"}):M(o)&&!Kb(o)?r("error","Data type rules for cross-references must be of type string.",{node:i,property:"rule"}):pe(o)&&(!((n=o.type)===null||n===void 0)&&n.name)&&o.type.name!=="string"&&r("error","Terminal rules for cross-references must be of type string.",{node:i,property:"rule"})}}checkCrossRefType(e,r){let n=this.checkReferenceToRuleButNotType(e?.type);n&&r("error",n,{node:e,property:"type"})}checkCrossReferenceToTypeUnion(e,r){if(lt(e.type.ref)&&$r(e.type.ref.type)){let n=Wb(e.type.ref.type);n.length>0&&r("error",`Cross-reference on type union is only valid if all alternatives are AST nodes. ${n.join(", ")} ${n.length>1?"are":"is"} not ${n.length>1?"":"an "}AST node${n.length>1?"s":""}.`,{node:e,property:"type"})}}checkFragmentsInTypes(e,r){var n,i;M((n=e.typeRef)===null||n===void 0?void 0:n.ref)&&(!((i=e.typeRef)===null||i===void 0)&&i.ref.fragment)&&r("error","Cannot use rule fragments in types.",{node:e,property:"typeRef"})}checkReferenceTypeUnion(e,r){Wt(e.referenceType)||r("error","Only direct rule references are allowed in reference types.",{node:e,property:"referenceType"})}checkReferenceToRuleButNotType(e){if(e&&M(e.ref)&&!wr(e.ref)&&(e.ref.returnType||e.ref.inferredType)){let r=fn(e.ref);if(r)return`Use the rule type '${r}' instead of the typed rule name '${e.ref.name}' for cross-references.`}}checkAssignmentWithFeatureName(e,r){e.feature==="name"&&Dt(e.terminal)&&r("warning",'The "name" property is not recommended for cross-references.',{node:e,property:"feature"})}};function Ya(t){return!t.definition||!t.definition.$cstNode||t.definition.$cstNode.length===0}var _I=new Set(["Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array","Map","Set","WeakMap","WeakSet","Error","AggregateError","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError","BigInt","RegExp","Number","Object","Function","Symbol","String","Math","NaN","Infinity","isFinite","isNaN","Buffer","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","globalThis","decodeURIComponent","decodeURI","encodeURIComponent","encodeURI","parseInt","parseFloat","Promise","Generator","GeneratorFunction","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Reflect","Proxy","Date","Intl","eval","undefined"]);function Wb(t){let e=[];return t.types.forEach(r=>{var n;Wt(r)&&(!((n=r.typeRef)===null||n===void 0)&&n.ref?lt(r.typeRef.ref)&&($r(r.typeRef.ref.type)?e.push(...Wb(r.typeRef.ref.type)):e.push(r.typeRef.ref.name)):r.stringType?e.push(`"${r.stringType}"`):r.primitiveType&&e.push(r.primitiveType))}),Array.from(new Set(e))}function Mr(t,e){return t==="?"||t==="*"||bt(e)&&!!e.guardCondition}function zb(t){return t==="*"||t==="+"}function wr(t){return Vb(t,new Set)}function Vb(t,e){if(e.has(t))return!0;e.add(t);for(let r of Fe(t))if(xe(r)){if(!r.rule.ref||M(r.rule.ref)&&!Vb(r.rule.ref,e))return!1}else{if(ce(r))return!1;if(Te(r))return!1}return!!t.definition}function Bb(t){var e;let r=(e=t.returnType)===null||e===void 0?void 0:e.ref;return t.dataType!==void 0||lt(r)&&CI(r)}function CI(t){return Eg(t.type,new Set)}function Eg(t,e){if(e.has(t))return!0;if(e.add(t),Vi(t))return!1;if(Xi(t))return!1;if($r(t))return t.types.every(r=>Eg(r,e));if(Wt(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 lt(r)?Eg(r.type,e):!1}else return!1}else return!1}function Kb(t){return Za(t,new Set)}function Za(t,e){var r,n;if(e.has(t))return!0;if(e.add(t),M(t)){if(t.dataType)return t.dataType==="string";if(!((r=t.returnType)===null||r===void 0)&&r.ref)return Za(t.returnType.ref,e)}else{if(lt(t))return Za(t.type,e);if(Vi(t))return!1;if(Xi(t))return!1;if($r(t))return t.types.every(i=>Za(i,e));if(Wt(t)){if(t.primitiveType==="string")return!0;if(t.stringType)return!0;if(!((n=t.typeRef)===null||n===void 0)&&n.ref)return Za(t.typeRef.ref,e)}}return!1}function Cg(t){let e=t.$container;if(bt(e)){let r=e.elements,n=r.indexOf(t);for(let i=n-1;i>=0;i--){let o=r[i];if(Te(o))return o;{let s=Fe(r[i]).find(Te);if(s)return s}}}if(Ko(e))return Cg(e)}function Yr(t){var e;if(M(t))return wr(t)?t.name:(e=cs(t))!==null&&e!==void 0?e:t.name;if(Ht(t)||lt(t)||Xo(t))return t.name;if(Te(t)){let r=us(t);if(r)return r}else if(zo(t))return t.name;throw new xl("Cannot get name of Unknown Type",t.$cstNode)}function fn(t){if(t)try{return Yr(t)}catch{return}}function cs(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(M(e))return e.name;if(Ht(e)||lt(e))return e.name}}}function us(t){var e;if(t.inferredType)return t.inferredType.name;if(!((e=t.type)===null||e===void 0)&&e.ref)return Yr(t.type.ref)}function to(t){var e,r,n;return pe(t)?(r=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&r!==void 0?r:"string":wr(t)?t.name:(n=cs(t))!==null&&n!==void 0?n:t.name}function Fr(t){let e={s:!1,i:!1,u:!1},r=ls(t.definition,e),n=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(r,n)}var Ng=/[\s\S]/.source;function ls(t,e){if(nb(t))return NI(t);if(ob(t))return PI(t);if(fl(t))return OI(t);if(dl(t)){let r=t.rule.ref;if(!r)throw new Error("Missing rule reference.");return Ln(ls(r.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else{if(QS(t))return DI(t);if(ub(t))return II(t);if(eb(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")),Ln(n,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(fb(t))return Ln(Ng,{cardinality:t.cardinality,lookahead:t.lookahead});throw new Error(`Invalid terminal element: ${t?.$type}`)}}}function NI(t){return Ln(t.elements.map(e=>ls(e)).join("|"),{cardinality:t.cardinality,lookahead:t.lookahead})}function PI(t){return Ln(t.elements.map(e=>ls(e)).join(""),{cardinality:t.cardinality,lookahead:t.lookahead})}function II(t){return Ln(`${Ng}*?${ls(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function DI(t){return Ln(`(?!${ls(t.terminal)})${Ng}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function OI(t){return t.right?Ln(`[${kg(t.left)}-${kg(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):Ln(kg(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function kg(t){return On(t.value)}function Ln(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 Pg(t){if(t.path===void 0||t.path.length===0)return;let e=ue.dirname(Y(t).uri),r=t.path;return r.endsWith(".langium")||(r+=".langium"),ue.resolvePath(e,r)}function $n(t,e){let r=Pg(e);try{if(r){let i=t.getOrCreateDocument(r).parseResult.value;if(di(i))return i}}catch{}}function Ja(t,e){if(ul(e)){let r=$n(t,e);if(r){let n=_g(t,r);return n.push(r),n}return[]}else return _g(t,e)}function _g(t,e,r=e,n=new Set,i=new Set){let o=Y(e);if(r!==e&&i.add(e),!n.has(o.uri)){n.add(o.uri);for(let s of e.imports){let a=$n(t,s);a&&_g(t,a,r,n,i)}}return Array.from(i)}function as(t){return ce(t)?[t]:vr(t)||bt(t)||Rr(t)?t.elements.flatMap(e=>as(e)):xe(t)&&t.rule.ref?as(t.rule.ref.definition):[]}var $I=["string","number","boolean","Date","bigint"];function is(t){return $I.includes(t)}var Ig=class{constructor(e,r){this.context=e,this.root=r}getTypes(){let e={name:this.root.name,properties:this.root.properties,ruleCalls:this.root.ruleCalls,super:[]};return this.root.children.length===0?[{alt:e,next:[]}]:this.applyNext(this.root,{alt:e,next:this.root.children})}applyNext(e,r){let n=this.splitType(r.alt,r.next.length),i=[];for(let o=0;o<r.next.length;o++){let s=n[o],a=r.next[o];a.actionWithAssignment&&i.push({alt:Xb(s),next:[]}),a.name!==void 0&&a.name!==s.name&&(a.actionWithAssignment?(s.properties=[],s.ruleCalls=[],s.super=[e.name],s.name=a.name):(s.super=[s.name,...s.ruleCalls],s.properties=[],s.ruleCalls=[],s.name=a.name)),s.properties.push(...a.properties),s.ruleCalls.push(...a.ruleCalls);let c={alt:s,next:a.children};c.next.length===0?(c.alt.super=c.alt.super.filter(u=>u!==c.alt.name),i.push(c)):i.push(...this.applyNext(e,c))}return eA(i)}splitType(e,r){let n=[];for(let i=0;i<r;i++)n.push(Xb(e));return n}getSuperTypes(e){let r=new Set;return this.collectSuperTypes(e,e,r),Array.from(r)}collectSuperTypes(e,r,n){if(r.ruleCalls.length>0){for(let i of r.ruleCalls)n.add(i);return}for(let i of r.parents)e.name===void 0?this.collectSuperTypes(i,i,n):i.name!==void 0&&i.name!==e.name?n.add(i.name):this.collectSuperTypes(e,i,n);r.parents.length===0&&r.name&&n.add(r.name)}connect(e,r){return r.parents.push(e),e.children.push(r),r}merge(...e){if(e.length===1)return e[0];if(e.length===0)throw new Error("No parts to merge");let r=ro();r.parents=e;for(let n of e)n.children.push(r);return r}hasLeafNode(e){return this.partHasLeafNode(e)}partHasLeafNode(e,r){return e.children.some(n=>n!==r)?!0:e.name?!1:e.parents.some(n=>this.partHasLeafNode(n,e))}};function LI(t){return{name:t.name,children:[],parents:[],actionWithAssignment:t.actionWithAssignment,ruleCalls:[...t.ruleCalls],properties:t.properties.map(Yb)}}function Xb(t){return{name:t.name,super:t.super,ruleCalls:t.ruleCalls,properties:t.properties.map(e=>Yb(e))}}function Yb(t){return{name:t.name,optional:t.optional,type:t.type,astNodes:t.astNodes}}function Jb(t,e,r){let n=[],i={fragments:new Map};for(let c of t)n.push(...Qb(i,c));let o=GI(n),s=HI(o),a=WI(o,s,r);for(let c of e){let u=MI(c);a.unions.push({name:c.name,declared:!1,type:u,subTypes:new Set,superTypes:new Set,dataType:c.dataType})}return a}function MI(t){if(t.dataType&&t.dataType!=="string")return{primitive:t.dataType};let e=!1,r=()=>(e=!0,{primitive:"unknown"}),n=Dg(t.definition,r);return e?{primitive:"string"}:n}function Dg(t,e){var r,n,i;if(t.cardinality)return e();if(vr(t))return{types:t.elements.map(o=>Dg(o,e))};if(bt(t)||Rr(t))return t.elements.length!==1?e():Dg(t.elements[0],e);if(xe(t)){let o=(r=t.rule)===null||r===void 0?void 0:r.ref;return o?pe(o)?{primitive:(i=(n=o.type)===null||n===void 0?void 0:n.name)!==null&&i!==void 0?i:"string",regex:Fr(o).toString()}:{value:o.name}:e()}else if(Ze(t))return{string:t.value};return e()}function Qb(t,e){let r=ro(e),n=new Ig(t,r);return e.definition&&Og(n,n.root,e.definition),n.getTypes()}function ro(t){return{name:M(t)||Te(t)?fn(t):t,properties:[],ruleCalls:[],children:[],parents:[],actionWithAssignment:!1}}function Og(t,e,r){let n=Mr(r.cardinality,r);if(vr(r)){let i=[];n&&i.push(t.connect(e,ro()));for(let o of r.elements){let s=t.connect(e,ro());i.push(Og(t,s,o))}return t.merge(...i)}else if(bt(r)||Rr(r)){let i=t.connect(e,ro()),o;n&&(o=t.connect(e,ro()));for(let s of r.elements)i=Og(t,i,s);return o?t.merge(o,i):i}else{if(Te(r))return FI(t,e,r);ce(r)?UI(e,r):xe(r)&&qI(t,e,r)}return e}function FI(t,e,r){var n;if(!t.hasLeafNode(e)){let o=LI(e);t.connect(e,o)}let i=t.connect(e,ro(r));if(r.type){let o=(n=r.type)===null||n===void 0?void 0:n.ref;o&&Ga(o)&&(i.name=o.name)}return r.feature&&r.operator&&(i.actionWithAssignment=!0,i.properties.push({name:r.feature,optional:!1,type:no(r.operator==="+=",!1,t.root.ruleCalls.length!==0?t.root.ruleCalls:t.getSuperTypes(i)),astNodes:new Set([r])})),i}function UI(t,e){let r={types:new Set,reference:!1};Zb(e.terminal,r);let n=no(e.operator==="+=",r.reference,e.operator==="?="?["boolean"]:Array.from(r.types));t.properties.push({name:e.feature,optional:Mr(e.cardinality),type:n,astNodes:new Set([e])})}function Zb(t,e){if(vr(t)||Rr(t)||bt(t))for(let r of t.elements)Zb(r,e);else if(Ze(t))e.types.add(`'${t.value}'`);else if(xe(t)&&t.rule.ref)e.types.add(to(t.rule.ref));else if(Dt(t)&&t.type.ref){let r=fn(t.type.ref);r&&e.types.add(r),e.reference=!0}}function qI(t,e,r){let n=r.rule.ref;if(M(n)&&n.fragment){let i=jI(n,t.context);Mr(r.cardinality)?e.properties.push(...i.map(o=>Object.assign(Object.assign({},o),{optional:!0}))):e.properties.push(...i)}else M(n)&&e.ruleCalls.push(to(n))}function jI(t,e){let r=e.fragments.get(t);if(r)return r;let n=[];e.fragments.set(t,n);let i=fn(t),o=Qb(e,t).filter(s=>s.alt.name===i);return n.push(...o.flatMap(s=>s.alt.properties)),n}function GI(t){let e=new Map,r=[],n=eA(t).map(i=>i.alt);for(let i of n){let o={name:i.name,properties:i.properties,superTypes:new Set(i.super),subTypes:new Set,declared:!1,abstract:!1};e.set(o.name,o),i.ruleCalls.length>0&&(r.push(i),i.ruleCalls.forEach(s=>{s!==o.name&&o.subTypes.add(s)}))}for(let i of r)for(let o of i.ruleCalls){let s=e.get(o);s&&s.name!==i.name&&s.superTypes.add(i.name)}return Array.from(e.values())}function eA(t){let e=t.reduce((n,i)=>n.add(i.alt.name,i),new ye),r=[];for(let[n,i]of e.entriesGroupedByKey()){let o=[],s=new Set,a={alt:{name:n,properties:o,ruleCalls:[],super:[]},next:[]};for(let c of i){let u=c.alt;a.alt.super.push(...u.super),a.next.push(...c.next);let l=u.properties;for(let f of l){let d=o.find(p=>p.name===f.name);d?(d.type=wg(d.type,f.type),f.astNodes.forEach(p=>d.astNodes.add(p))):o.push(Object.assign({},f))}u.ruleCalls.forEach(f=>s.add(f))}for(let c of i){let u=c.alt;if(u.ruleCalls.length===0)for(let l of o)u.properties.find(f=>f.name===l.name)||(l.optional=!0)}a.alt.ruleCalls=Array.from(s),r.push(a)}return r}function HI(t){let e=new Map(t.map(i=>[i.name,i])),r=[],n=new ye;for(let i of t)for(let o of i.superTypes)n.add(o,i.name);for(let[i,o]of n.entriesGroupedByKey())if(!e.has(i)){let s={declared:!1,name:i,subTypes:new Set,superTypes:new Set,type:no(!1,!1,o)};r.push(s)}return r}function WI(t,e,r){let n=new ye;for(let a of t)for(let c of a.superTypes)n.add(c,a.name);let i=new Set(r.interfaces.map(a=>a.name)),o={interfaces:[],unions:e},s=new Map(e.map(a=>[a.name,a]));for(let a of t){let c=new Set(n.get(a.name));if(a.properties.length===0&&c.size>0)if(i.has(a.name))a.abstract=!0,o.interfaces.push(a);else{let u=no(!1,!1,Array.from(c)),l=s.get(a.name);if(l)l.type=wg(l.type,u);else{let f={name:a.name,declared:!1,subTypes:c,superTypes:a.superTypes,type:u};o.unions.push(f),s.set(a.name,f)}}else o.interfaces.push(a)}for(let a of o.interfaces)a.superTypes=new Set([...a.superTypes].filter(c=>!s.has(c)));return o}function no(t,e,r){if(t)return{elementType:no(!1,e,r)};if(e)return{referenceType:no(!1,!1,r)};if(r.length===1){let n=r[0];return n.startsWith("'")?{string:n.substring(1,n.length-1)}:is(n)?{primitive:n}:{value:n}}else return{types:r.map(n=>no(!1,!1,[n]))}}function tA(t,e){let r=rA(t,e),n=qb(r.interfaces,r.types),i=Jb(r.parserRules,r.datatypeRules,n);return{astResources:r,inferred:i,declared:n}}function rA(t,e,r=new Set,n={parserRules:[],datatypeRules:[],interfaces:[],types:[]}){Array.isArray(t)||(t=[t]);for(let i of t){let o=Y(i);if(!r.has(o.uri)){r.add(o.uri);for(let s of i.rules)M(s)&&!s.fragment&&(wr(s)?n.datatypeRules.push(s):n.parserRules.push(s));if(i.interfaces.forEach(s=>n.interfaces.push(s)),i.types.forEach(s=>n.types.push(s)),e){let s=i.imports.map(a=>$n(e,a)).filter(a=>a!==void 0);rA(s,e,r,n)}}}return n}function oA(t,e){let{inferred:r,declared:n,astResources:i}=tA(t,e);return{astResources:i,inferred:nA(n,r),declared:nA(r,n)}}function nA(t,e){var r,n;let i={interfaces:Pb(iA(...t.interfaces,...(r=e?.interfaces)!==null&&r!==void 0?r:[])),unions:iA(...t.unions,...(n=e?.unions)!==null&&n!==void 0?n:[])},o=Gb(i);return BI(o),o}function iA(...t){return Array.from(t.reduce((e,r)=>(e.set(r.name,r),e),new Map).values()).sort((e,r)=>e.name.localeCompare(r.name))}function BI(t){let e=zI(t),r=Array.from(e.values());VI(r),XI(t.interfaces),KI(r)}function KI(t){let e=new Set,r=n=>{if(!e.has(n)){e.add(n),n.typeNames.add(n.name);for(let i of n.subTypes)r(i),i.typeNames.forEach(o=>n.typeNames.add(o))}};t.forEach(r)}function zI({interfaces:t,unions:e}){let r=t.concat(e).reduce((i,o)=>(i.set(o.name,o),i),new Map),n=new Map;for(let i of e)n.set(i,$g(i.type,new Set));for(let[i,o]of n)o&&r.delete(i.name);return r}function $g(t,e){if(e.has(t))return!0;if(e.add(t),gt(t))return t.types.every(r=>$g(r,e));if(Sr(t)){let r=t.value;return zr(r)?$g(r.type,e):!1}else return br(t)||un(t)}function VI(t){for(let e of t)for(let r of e.superTypes)r.subTypes.add(e)}function XI(t){var e;let r=t.reduce((s,a)=>(s.set(a.name,a),s),new Map);for(let s of t){let a=s.properties.flatMap(c=>Ib(c.type));for(let c of a)(e=r.get(c))===null||e===void 0||e.containerTypes.add(s)}let n=new Set,i=t.filter(s=>s.subTypes.size===0),o=new Set(i);for(;i.length>0;){let s=i.shift();if(s)for(let a of s.superTypes)Xr(a)&&(s.containerTypes.size===0?(n.add(a.name),a.containerTypes.clear()):n.has(a.name)||s.containerTypes.forEach(c=>a.containerTypes.add(c)),o.has(a)||(o.add(a),i.push(a)))}}var YI={languageId:"langium",fileExtensions:[".langium"],caseInsensitive:!1},JI={maxLookahead:3},sA={AstReflection:()=>new $a},aA={Grammar:()=>Mb(),LanguageMetaData:()=>YI,parser:{ParserConfig:()=>JI}};var ec=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)}},fs=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=J(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}},cA={getElement(){},getAllElements(){return Bo}};var Nl=se(kn(),1);var ds=class{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,r=Nl.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,r)}async computeExportsForNode(e,r,n=pi,i=Nl.CancellationToken.None){let o=[];this.exportNode(e,o,r);for(let s of n(e))await Ue(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=Nl.CancellationToken.None){let n=e.parseResult.value,i=new ye;for(let o of Fe(n))await Ue(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 Pl=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")}},Lg=class extends Pl{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()}},Il=class extends Pl{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}};var Dl=class extends Lg{constructor(e){super(),this.onDispose(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}};var ps=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 Dl(e.shared)}getScope(e){let r=[],n=this.reflection.getReferenceType(e),i=Y(e.container).precomputedScopes;if(i){let s=e.container;do{let a=i.get(s);a.length>0&&r.push(J(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 ec(J(e),r,n)}createScopeForNodes(e,r,n){let i=J(e).map(o=>{let s=this.nameProvider.getName(o);if(s)return this.descriptions.createDescription(o,s)}).nonNullable();return new ec(i,r,n)}getGlobalScope(e,r){return this.globalScopeCache.get(e,()=>new fs(this.indexManager.allElements(e)))}};var Ol=class extends ps{constructor(e){super(e),this.langiumDocuments=e.shared.workspace.LangiumDocuments}getScope(e){let r=this.reflection.getReferenceType(e);return r===zi?this.getTypeScope(r,e):super.getScope(e)}getTypeScope(e,r){let n,i=Y(r.container).precomputedScopes,o=pl(r.container);if(i&&o){let a=i.get(o);a.length>0&&(n=J(a).filter(c=>c.type===La||c.type===Ma))}let s=this.getGlobalScope(e,r);return n?this.createScope(n,s):s}getGlobalScope(e,r){let n=ve(r.container,di);if(!n)return cA;let i=new Set;this.gatherImports(n,i);let o=this.indexManager.allElements(e,i);return e===zi&&(o=o.filter(s=>s.type===La||s.type===Ma)),new fs(o)}gatherImports(e,r){for(let n of e.imports){let i=Pg(n);if(i&&!r.has(i.toString())&&(r.add(i.toString()),this.langiumDocuments.hasDocument(i))){let s=this.langiumDocuments.getOrCreateDocument(i).parseResult.value;di(s)&&this.gatherImports(s,r)}}}},$l=class extends ds{constructor(e){super(e),this.astNodeLocator=e.workspace.AstNodeLocator}exportNode(e,r,n){var i;if(super.exportNode(e,r,n),M(e)){if(!e.returnType&&!e.dataType){let o=(i=e.inferredType)!==null&&i!==void 0?i:e;r.push(this.createInterfaceDescription(o,o.name,n))}Fe(e).forEach(o=>{if(Te(o)&&o.inferredType){let s=us(o);s&&r.push(this.createInterfaceDescription(o,s,n))}})}}processNode(e,r,n){Xo(e)||(this.processTypeNode(e,r,n),this.processActionNode(e,r,n),super.processNode(e,r,n))}processTypeNode(e,r,n){var i;let o=e.$container;if(o&&M(e)&&!e.returnType&&!e.dataType){let s=(i=e.inferredType)!==null&&i!==void 0?i:e;n.add(o,this.createInterfaceDescription(s,s.name,r))}}processActionNode(e,r,n){let i=pl(e);if(i&&Te(e)&&e.inferredType){let o=us(e);o&&n.add(i,this.createInterfaceDescription(e,o,r))}}createInterfaceDescription(e,r,n=Y(e)){let i,o=()=>{var s;return i??(i=Gt((s=this.nameProvider.getNameNode(e))!==null&&s!==void 0?s:e.$cstNode))};return{node:e,name:r,get nameSegment(){return o()},selectionSegment:Gt(e.$cstNode),type:"Interface",documentUri:n.uri,path:this.astNodeLocator.getAstNodePath(e)}}};var kr=se(de(),1);var Bt=se(de(),1);var Ll=class{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,r={},n=Bt.CancellationToken.None){let i=e.parseResult,o=[];if(await Ue(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)===dn.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)===dn.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)===dn.LinkingError}))))return o;try{o.push(...await this.validateAst(i.value,r,n))}catch(s){if(Zi(s))throw s;console.error("An error occurred during validation:",s)}return await Ue(n),o}processLexingErrors(e,r,n){for(let i of e.lexerErrors){let o={severity:Bt.DiagnosticSeverity.Error,range:{start:{line:i.line-1,character:i.column-1},end:{line:i.line-1,character:i.column+i.length-1}},message:i.message,data:Ar(dn.LexingError),source:this.getSource()};r.push(o)}}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))o=Bt.Range.create(0,0,0,0);else{let a=Bt.Position.create(s.endLine-1,s.endColumn);o=Bt.Range.create(a,a)}}}else o=Oa(i.token);if(o){let s={severity:Bt.DiagnosticSeverity.Error,range:o,message:i.message,data:Ar(dn.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:dn.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=Bt.CancellationToken.None){let i=[],o=(s,a,c)=>{i.push(this.toDiagnostic(s,a,c))};return await Promise.all(Pn(e).map(async s=>{await Ue(n);let a=this.validationRegistry.getChecks(s.$type,r.categories);for(let c of a)await c(s,o,n)})),i}toDiagnostic(e,r,n){return{message:r,range:QI(n),severity:ZI(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 QI(t){if(Bt.Range.is(t.range))return t.range;let e;return typeof t.property=="string"?e=$t(t.node.$cstNode,t.property,t.index):typeof t.keyword=="string"&&(e=Lr(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 ZI(t){switch(t){case"error":return Bt.DiagnosticSeverity.Error;case"warning":return Bt.DiagnosticSeverity.Warning;case"info":return Bt.DiagnosticSeverity.Information;case"hint":return Bt.DiagnosticSeverity.Hint;default:throw new Error("Invalid diagnostic severity: "+t)}}var dn;(function(t){t.LexingError="lexing-error",t.ParsingError="parsing-error",t.LinkingError="linking-error"})(dn||(dn={}));var Ml=class{constructor(e){this.reflection=e.shared.AstReflection,this.indexManager=e.shared.workspace.IndexManager}getCodeActions(e,r){let n=[],i=o=>o&&n.push(o);for(let o of r.context.diagnostics)this.createCodeActions(o,e,i);return n}createCodeActions(e,r,n){var i;switch((i=e.data)===null||i===void 0?void 0:i.code){case Re.GrammarNameUppercase:case Re.RuleNameUppercase:n(this.makeUpperCase(e,r));break;case Re.HiddenGrammarTokens:n(this.fixHiddenTerminals(e,r));break;case Re.UseRegexTokens:n(this.fixRegexTokens(e,r));break;case Re.EntryRuleTokenSyntax:n(this.addEntryKeyword(e,r));break;case Re.CrossRefTokenSyntax:n(this.fixCrossRefSyntax(e,r));break;case Re.UnnecessaryFileExtension:n(this.fixUnnecessaryFileExtension(e,r));break;case Re.MissingReturns:n(this.fixMissingReturns(e,r));break;case Re.InvalidInfers:case Re.InvalidReturns:n(this.fixInvalidReturnsInfers(e,r));break;case Re.MissingInfer:n(this.fixMissingInfer(e,r));break;case Re.SuperfluousInfer:n(this.fixSuperfluousInfer(e,r));break;case dn.LinkingError:{let o=e.data;o&&o.containerType==="RuleCall"&&o.property==="rule"&&n(this.addNewRule(e,o,r)),o&&this.lookInGlobalScope(e,o,r).forEach(n);break}}}fixMissingReturns(e,r){let n=r.textDocument.getText(e.range);if(n)return{title:`Add explicit return type for parser rule ${n}`,kind:kr.CodeActionKind.QuickFix,diagnostics:[e],edit:{changes:{[r.textDocument.uri]:[{range:e.range,newText:`${n} returns ${n}`}]}}}}fixInvalidReturnsInfers(e,r){let n=e.data;if(n&&n.actionSegment){let i=r.textDocument.getText(n.actionSegment.range);return{title:`Correct ${i} usage`,kind:kr.CodeActionKind.QuickFix,diagnostics:[e],edit:{changes:{[r.textDocument.uri]:[{range:n.actionSegment.range,newText:i==="infers"?"returns":"infers"}]}}}}}fixMissingInfer(e,r){let n=e.data;if(n&&n.actionSegment)return{title:"Correct 'infer' usage",kind:kr.CodeActionKind.QuickFix,diagnostics:[e],edit:{changes:{[r.textDocument.uri]:[{range:{start:n.actionSegment.range.end,end:n.actionSegment.range.end},newText:"infer "}]}}}}fixSuperfluousInfer(e,r){let n=e.data;if(n&&n.actionRange)return{title:"Remove the 'infer' keyword",kind:kr.CodeActionKind.QuickFix,diagnostics:[e],edit:{changes:{[r.textDocument.uri]:[{range:n.actionRange,newText:""}]}}}}fixUnnecessaryFileExtension(e,r){let n=Object.assign({},e.range.end);n.character-=1;let i=Object.assign({},n);return i.character-=8,{title:"Remove file extension",kind:kr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[r.textDocument.uri]:[{range:{start:i,end:n},newText:""}]}}}}makeUpperCase(e,r){let n={start:e.range.start,end:{line:e.range.start.line,character:e.range.start.character+1}};return{title:"First letter to upper case",kind:kr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[r.textDocument.uri]:[{range:n,newText:r.textDocument.getText(n).toUpperCase()}]}}}}addEntryKeyword(e,r){return{title:"Add entry keyword",kind:kr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[r.textDocument.uri]:[{range:{start:e.range.start,end:e.range.start},newText:"entry "}]}}}}fixRegexTokens(e,r){let n=r.textDocument.offsetAt(e.range.start),i=r.parseResult.value.$cstNode;if(i){let o=fi(i,n),s=ve(o?.astNode,fl);if(s&&s.right&&s.$cstNode){let a=s.left.value,c=s.right.value;return{title:"Refactor into regular expression",kind:kr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[r.textDocument.uri]:[{range:s.$cstNode.range,newText:`/[${On(a)}-${On(c)}]/`}]}}}}}}fixCrossRefSyntax(e,r){return{title:"Replace '|' with ':'",kind:kr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[r.textDocument.uri]:[{range:e.range,newText:":"}]}}}}fixHiddenTerminals(e,r){let n=r.parseResult.value,i=n.hiddenTokens,o=[],s=$t(n.$cstNode,"definesHiddenTokens");if(s){let a=s.range.start,c=s.offset,u=n.$cstNode.text.indexOf(")",c)+1;o.push({newText:"",range:{start:a,end:r.textDocument.positionAt(u)}})}for(let a of i){let c=a.ref;if(c&&pe(c)&&!c.hidden&&c.$cstNode){let u=c.$cstNode.range.start;o.push({newText:"hidden ",range:{start:u,end:u}})}}return{title:"Fix hidden terminals",kind:kr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[r.textDocument.uri]:o}}}}addNewRule(e,r,n){let i=n.textDocument.offsetAt(e.range.start),o=n.parseResult.value.$cstNode;if(o){let s=fi(o,i),a=ve(s?.astNode,M);if(a&&a.$cstNode)return{title:`Add new rule '${r.refText}'`,kind:kr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!1,edit:{changes:{[n.textDocument.uri]:[{range:{start:a.$cstNode.range.end,end:a.$cstNode.range.end},newText:`
|
|
49
49
|
|
|
50
50
|
`+r.refText+`:
|
|
51
|
-
/* TODO implement rule */ {infer `+r.refText+"};"}]}}}}}lookInGlobalScope(e,r,n){var i,o;let s={container:{$type:r.containerType},property:r.property,reference:{$refText:r.refText}},a=this.reflection.getReferenceType(s),c=this.indexManager.allElements(a).filter(d=>d.name===r.refText),u=[],l=-1,f=-1;for(let d of c){if(ue.equals(d.documentUri,n.uri))continue;let p=
|
|
52
|
-
`);T&&((l<0||p.length<f)&&(l=u.length,f=p.length),u.push({title:`Add import to '${p}'`,kind:
|
|
53
|
-
${S}`}]}}}))}return l>=0&&(u[l].isPreferred=!0),u}};function QI(t,e){let r=ue.dirname(t),n=ue.relative(r,e);return!n.startsWith("./")&&!n.startsWith("../")&&(n="./"+n),n.endsWith(".langium")&&(n=n.substring(0,n.length-8)),n}qi();var gs=se(de(),1);function Mg(t,e){let r={stacks:t,tokens:e};return ZI(r),r.stacks.flat().forEach(i=>{i.property=void 0}),cA(r.stacks).map(i=>i[i.length-1])}function Fg(t){let{next:e,cardinalities:r,visited:n,plus:i}=t,o=[],s=e.feature;if(n.has(s))return[];n.add(s);let a,c=s;for(;c.$container;)if(bt(c.$container)){a=c.$container;break}else if(Ko(c.$container))c=c.$container;else break;if(Bb(c.cardinality)){let u=ms({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=>Fr(l.feature.cardinality,l.feature)||Fr(r.get(l.feature))||i.has(l.feature))&&o.push(...Fg({next:{feature:a,type:e.type},cardinalities:r,visited:n,plus:i}))}return o}function Ul(t){return ut(t)&&(t={feature:t}),ms({next:t,cardinalities:new Map,visited:new Set,plus:new Set})}function ms(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(bt(c)){if(s.has(c))return[];s.add(c)}if(bt(c))return aA(i,0,o,s,a).map(l=>Fl(l,c.cardinality,o));if(Sr(c)||br(c))return c.elements.flatMap(l=>ms({next:{feature:l,type:u,property:i.property},cardinalities:o,visited:s,plus:a})).map(l=>Fl(l,c.cardinality,o));if(ce(c)){let l={feature:c.terminal,type:u,property:(e=i.property)!==null&&e!==void 0?e:c.feature};return ms({next:l,cardinalities:o,visited:s,plus:a}).map(f=>Fl(f,c.cardinality,o))}else{if(Te(c))return Fg({next:{feature:c,type:Jr(c),property:(r=i.property)!==null&&r!==void 0?r:c.feature},cardinalities:o,visited:s,plus:a});if(xe(c)&&M(c.rule.ref)){let l=c.rule.ref,f={feature:l.definition,type:l.fragment||l.dataType?void 0:(n=cs(l))!==null&&n!==void 0?n:l.name,property:i.property};return ms({next:f,cardinalities:o,visited:s,plus:a}).map(d=>Fl(d,c.cardinality,o))}else return[i]}}function Fl(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(...ms({next:a,cardinalities:r,visited:n,plus:i})),!!Fr((o=a.feature.cardinality)!==null&&o!==void 0?o:r.get(a.feature),a.feature)););return s}function ZI(t){for(let e of t.tokens){let r=cA(t.stacks,e);t.stacks=r}}function cA(t,e){let r=[];for(let n of t)r.push(...e0(n,e));return r}function e0(t,e){let r=new Map,n=new Set(t.map(o=>o.feature).filter(t0)),i=[];for(;t.length>0;){let o=t.pop(),s=Fg({next:o,cardinalities:r,plus:n,visited:new Set}).filter(a=>e?Ug(a.feature,e):!0);for(let a of s)i.push([...t,a]);if(!s.every(a=>Fr(a.feature.cardinality,a.feature)||Fr(r.get(a.feature))))break}return i}function t0(t){if(t.cardinality==="+")return!0;let e=ve(t,ce);return!!(e&&e.cardinality==="+")}function Ug(t,e){if(Ze(t))return t.value===e.image;if(xe(t))return r0(t.rule.ref,e);if(Dt(t)){let r=ql(t);if(r)return Ug(r,e)}return!1}function r0(t,e){return M(t)?Ul(t.definition).some(n=>Ug(n.feature,e)):pe(t)?Ur(t).test(e.image):!1}function uA(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 hs=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}async getCompletion(e,r){let n=[],i=this.buildContexts(e,r.position),o=(c,u)=>{let l=this.fillCompletionItem(c,u);l&&n.push(l)},s=c=>Ze(c.feature)?c.feature.value:c.feature,a=[];for(let c of i)if(await Promise.all(J(c.features).distinct(s).exclude(a).map(u=>this.completionFor(c,u,o))),a.push(...c.features),!this.continueCompletion(n))break;return gs.CompletionList.create(this.deduplicateItems(n),!0)}deduplicateItems(e){return J(e).distinct(r=>`${r.kind}_${r.label}_${r.detail}`).toArray()}findFeaturesAt(e,r){let n=e.getText({start:gs.Position.create(0,0),end:e.positionAt(r)}),i=this.completionParser.parse(n),o=i.tokens;if(i.tokenIndex===0){let c=jl(this.grammar),u=Ul({feature:c.definition,type:cs(c)});return o.length>0?(o.shift(),Mg(u.map(l=>[l]),o)):u}let s=[...o].splice(i.tokenIndex);return Mg([i.elementStack.map(c=>({feature:c}))],s)}*buildContexts(e,r){var n,i,o,s,a;let c=e.parseResult.value.$cstNode;if(!c)return;let u=e.textDocument,l=u.getText(),f=u.offsetAt(r),d={document:e,textDocument:u,offset:f,position:r},p=this.findDataTypeRuleStart(c,f);if(p){let[m,b]=p,_=(n=dr(c,m))===null||n===void 0?void 0:n.astNode;yield Object.assign(Object.assign({},d),{node:_,tokenOffset:m,tokenEndOffset:b,features:this.findFeaturesAt(u,m)})}let{nextTokenStart:T,nextTokenEnd:S,previousTokenStart:A,previousTokenEnd:x}=this.backtrackToAnyToken(l,f),h;if(A!==void 0&&x!==void 0&&x===f&&(h=(i=dr(c,A))===null||i===void 0?void 0:i.astNode,yield Object.assign(Object.assign({},d),{node:h,tokenOffset:A,tokenEndOffset:x,features:this.findFeaturesAt(u,A)}),yield Object.assign(Object.assign({},d),{node:h,tokenOffset:x,tokenEndOffset:x,features:this.findFeaturesAt(u,x)})),h=(s=(o=dr(c,T))===null||o===void 0?void 0:o.astNode)!==null&&s!==void 0?s:A===void 0||(a=dr(c,A))===null||a===void 0?void 0:a.astNode,h)yield Object.assign(Object.assign({},d),{node:h,tokenOffset:T,tokenEndOffset:S,features:this.findFeaturesAt(u,T)});else{let m=jl(this.grammar);if(!m)throw new Error("Missing entry parser rule");yield Object.assign(Object.assign({},d),{tokenOffset:T,tokenEndOffset:S,features:Ul(m.definition)})}}findDataTypeRuleStart(e,r){var n,i;let o=ht(e,r,this.grammarConfig.nameRegexp),s=!!(!((n=ve(o?.grammarSource,M))===null||n===void 0)&&n.dataType);if(s){for(;s;)o=o?.container,s=!!(!((i=ve(o?.grammarSource,M))===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(Ze(r.feature))return this.completionForKeyword(e,r.feature,n);if(Dt(r.feature)&&e.node)return this.completionForCrossReference(e,r,n)}completionForCrossReference(e,r,n){let i=ve(r.feature,ce),o=e.node;if(i&&o){r.type&&(o={$type:r.type,$container:o,$containerProperty:r.property},hl(this.astReflection,o));let s={reference:{$refText:""},container:o,property:i.feature};try{this.scopeProvider.getScope(s).getAllElements().forEach(c=>{this.filterCrossReference(e,c)&&n(e,this.createReferenceCompletionItem(c))})}catch(a){console.error(a)}}}createReferenceCompletionItem(e){return{nodeDescription:e,kind:this.nodeKindProvider.getCompletionItemKind(e),detail:e.type,sortText:"0"}}filterCrossReference(e,r){return!0}completionForKeyword(e,r,n){this.filterKeyword(e,r)&&n(e,{label:r.value,kind:gs.CompletionItemKind.Keyword,detail:"Keyword",sortText:"1"})}filterKeyword(e,r){return r.value.match(/[\w]/)!==null}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 Gl=class extends hs{constructor(e){super(e),this.documents=()=>e.shared.workspace.LangiumDocuments}completionFor(e,r,n){let i=ve(r.feature,ce);if(i?.feature==="path")this.completeImportPath(e,n);else return super.completionFor(e,r,n)}completeImportPath(e,r){let i=e.textDocument.getText().substring(e.tokenOffset,e.offset),o=this.getAllFiles(e.document),s={start:e.position,end:e.position};if(i.length>0){let a=i.substring(1);o=o.filter(l=>l.startsWith(a));let c=e.textDocument.positionAt(e.tokenOffset+1),u=e.textDocument.positionAt(e.tokenEndOffset-1);s={start:c,end:u}}for(let a of o){let c=i.length>0?"":'"',u=`${c}${a}${c}`;r(e,{label:a,textEdit:{newText:u,range:s},kind:ba.File,sortText:"0"})}}getAllFiles(e){let r=this.documents().all,n=e.uri.toString(),i=ue.dirname(e.uri).toString(),o=[];for(let s of r)if(!ue.equals(s.uri,n)){let a=s.uri.toString(),c=a.substring(0,a.length-ue.extname(s.uri).length),u=ue.relative(i,c);u.startsWith(".")||(u=`./${u}`),o.push(u)}return o}};var tc=se(de(),1);var ys=class{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e){let r=[],n=i=>r.push(i);return this.collectFolding(e,n),r}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=Fe(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 hS(i))if(this.commentNames.includes(o.tokenType.name)){let s=this.toFoldingRange(e,o,tc.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)),tc.FoldingRange.create(o.line,s.line,o.character,s.character,n)}includeLastFoldingLine(e,r){if(r===tc.FoldingRangeKind.Comment)return!1;let n=e.text,i=n.charAt(n.length-1);return!(i==="}"||i===")"||i==="]")}};var Hl=class extends ys{shouldProcessContent(e){return!M(e)}};var Wl=class{constructor(){this.collector=()=>{}}getNodeFormatter(e){return new qg(e,this.collector)}formatDocument(e,r){let n=e.parseResult;return n.lexerErrors.length===0&&n.parserErrors.length===0?this.doDocumentFormat(e,r.options):[]}isFormatRangeErrorFree(e,r){let n=e.parseResult;return n.lexerErrors.length||n.parserErrors.length?Math.min(...n.lexerErrors.map(o=>{var s;return(s=o.line)!==null&&s!==void 0?s:Number.MAX_VALUE}),...n.parserErrors.map(o=>{var s;return(s=o.token.startLine)!==null&&s!==void 0?s:Number.MAX_VALUE}))>r.end.line:!0}formatDocumentRange(e,r){return this.isFormatRangeErrorFree(e,r.range)?this.doDocumentFormat(e,r.options,r.range):[]}formatDocumentOnType(e,r){let n={start:{character:0,line:r.position.line},end:r.position};return this.isFormatRangeErrorFree(e,n)?this.doDocumentFormat(e,r.options,n):[]}get formatOnTypeOptions(){}doDocumentFormat(e,r,n){let i=new Map,o=(a,c,u)=>{var l,f;let d=this.nodeModeToKey(a,c),p=i.get(d),T=(l=u.options.priority)!==null&&l!==void 0?l:0,S=(f=p?.options.priority)!==null&&f!==void 0?f:0;(!p||S<=T)&&i.set(d,u)};this.collector=o,this.iterateAstFormatting(e,n);let s=this.iterateCstFormatting(e,i,r,n);return this.avoidOverlappingEdits(e.textDocument,s)}avoidOverlappingEdits(e,r){let n=[];for(let i of r){let o=n[n.length-1];if(o){let s=e.offsetAt(i.range.start),a=e.offsetAt(o.range.end);s<a&&n.pop()}n.push(i)}return n}iterateAstFormatting(e,r){let n=e.parseResult.value;this.format(n);let i=Fe(n).iterator(),o;do if(o=i.next(),!o.done){let s=o.value;this.insideRange(s.$cstNode.range,r)?this.format(s):i.prune()}while(!o.done)}nodeModeToKey(e,r){return`${e.offset}:${e.end}:${r}`}insideRange(e,r){return!r||e.start.line<=r.start.line&&e.end.line>=r.end.line||e.start.line>=r.start.line&&e.end.line<=r.end.line||e.start.line<=r.end.line&&e.end.line>=r.end.line}isNecessary(e,r){return r.getText(e.range)!==e.newText}iterateCstFormatting(e,r,n,i){let o={indentation:0,options:n,document:e.textDocument},s=[],c=this.iterateCstTree(e,o).iterator(),u,l;do if(l=c.next(),!l.done){let f=l.value,d=Bi(f),p=this.nodeModeToKey(f,"prepend"),T=r.get(p);if(r.delete(p),T){let x=this.createTextEdit(u,f,T,o);for(let h of x)h&&this.insideRange(h.range,i)&&this.isNecessary(h,e.textDocument)&&s.push(h)}let S=this.nodeModeToKey(f,"append"),A=r.get(S);if(r.delete(S),A){let x=TS(f);if(x){let h=this.createTextEdit(f,x,A,o);for(let m of h)m&&this.insideRange(m.range,i)&&this.isNecessary(m,e.textDocument)&&s.push(m)}}if(!T&&f.hidden){let x=this.createHiddenTextEdits(u,f,void 0,o);for(let h of x)h&&this.insideRange(h.range,i)&&this.isNecessary(h,e.textDocument)&&s.push(h)}d&&(u=f)}while(!l.done);return s}createHiddenTextEdits(e,r,n,i){var o;let s=r.range.start.line;if(e&&e.range.end.line===s)return[];let a=[],c={start:{character:0,line:s},end:r.range.start},u=i.document.getText(c),l=this.findFittingMove(c,(o=n?.moves)!==null&&o!==void 0?o:[],i),f=this.getExistingIndentationCharacterCount(u,i),p=this.getIndentationCharacterCount(i,l)-f;if(p===0)return[];let T="";p>0&&(T=(i.options.insertSpaces?" ":" ").repeat(p));let S=r.text.split(`
|
|
54
|
-
`);
|
|
51
|
+
/* TODO implement rule */ {infer `+r.refText+"};"}]}}}}}lookInGlobalScope(e,r,n){var i,o;let s={container:{$type:r.containerType},property:r.property,reference:{$refText:r.refText}},a=this.reflection.getReferenceType(s),c=this.indexManager.allElements(a).filter(d=>d.name===r.refText),u=[],l=-1,f=-1;for(let d of c){if(ue.equals(d.documentUri,n.uri))continue;let p=e0(n.uri,d.documentUri),T,R="",A=n.parseResult.value,S=A.imports.find(h=>h.path&&p<h.path);if(S)T=(i=S.$cstNode)===null||i===void 0?void 0:i.range.start;else if(A.imports.length>0){let h=A.imports[A.imports.length-1].$cstNode.range.end;h&&(T={line:h.line+1,character:0})}else A.rules.length>0&&(T=(o=A.rules[0].$cstNode)===null||o===void 0?void 0:o.range.start,R=`
|
|
52
|
+
`);T&&((l<0||p.length<f)&&(l=u.length,f=p.length),u.push({title:`Add import to '${p}'`,kind:kr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!1,edit:{changes:{[n.textDocument.uri]:[{range:{start:T,end:T},newText:`import '${p}'
|
|
53
|
+
${R}`}]}}}))}return l>=0&&(u[l].isPreferred=!0),u}};function e0(t,e){let r=ue.dirname(t),n=ue.relative(r,e);return!n.startsWith("./")&&!n.startsWith("../")&&(n="./"+n),n.endsWith(".langium")&&(n=n.substring(0,n.length-8)),n}ji();var gs=se(de(),1);function Mg(t,e){let r={stacks:t,tokens:e};return t0(r),r.stacks.flat().forEach(i=>{i.property=void 0}),lA(r.stacks).map(i=>i[i.length-1])}function Fg(t){let{next:e,cardinalities:r,visited:n,plus:i}=t,o=[],s=e.feature;if(n.has(s))return[];n.add(s);let a,c=s;for(;c.$container;)if(bt(c.$container)){a=c.$container;break}else if(Ko(c.$container))c=c.$container;else break;if(zb(c.cardinality)){let u=ms({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(...uA({feature:a,type:e.type},u+1,r,n,i)),o.every(l=>Mr(l.feature.cardinality,l.feature)||Mr(r.get(l.feature))||i.has(l.feature))&&o.push(...Fg({next:{feature:a,type:e.type},cardinalities:r,visited:n,plus:i}))}return o}function Ul(t){return ut(t)&&(t={feature:t}),ms({next:t,cardinalities:new Map,visited:new Set,plus:new Set})}function ms(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(bt(c)){if(s.has(c))return[];s.add(c)}if(bt(c))return uA(i,0,o,s,a).map(l=>Fl(l,c.cardinality,o));if(vr(c)||Rr(c))return c.elements.flatMap(l=>ms({next:{feature:l,type:u,property:i.property},cardinalities:o,visited:s,plus:a})).map(l=>Fl(l,c.cardinality,o));if(ce(c)){let l={feature:c.terminal,type:u,property:(e=i.property)!==null&&e!==void 0?e:c.feature};return ms({next:l,cardinalities:o,visited:s,plus:a}).map(f=>Fl(f,c.cardinality,o))}else{if(Te(c))return Fg({next:{feature:c,type:Yr(c),property:(r=i.property)!==null&&r!==void 0?r:c.feature},cardinalities:o,visited:s,plus:a});if(xe(c)&&M(c.rule.ref)){let l=c.rule.ref,f={feature:l.definition,type:l.fragment||l.dataType?void 0:(n=cs(l))!==null&&n!==void 0?n:l.name,property:i.property};return ms({next:f,cardinalities:o,visited:s,plus:a}).map(d=>Fl(d,c.cardinality,o))}else return[i]}}function Fl(t,e,r){return r.set(t.feature,e),t}function uA(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(...ms({next:a,cardinalities:r,visited:n,plus:i})),!!Mr((o=a.feature.cardinality)!==null&&o!==void 0?o:r.get(a.feature),a.feature)););return s}function t0(t){for(let e of t.tokens){let r=lA(t.stacks,e);t.stacks=r}}function lA(t,e){let r=[];for(let n of t)r.push(...r0(n,e));return r}function r0(t,e){let r=new Map,n=new Set(t.map(o=>o.feature).filter(n0)),i=[];for(;t.length>0;){let o=t.pop(),s=Fg({next:o,cardinalities:r,plus:n,visited:new Set}).filter(a=>e?Ug(a.feature,e):!0);for(let a of s)i.push([...t,a]);if(!s.every(a=>Mr(a.feature.cardinality,a.feature)||Mr(r.get(a.feature))))break}return i}function n0(t){if(t.cardinality==="+")return!0;let e=ve(t,ce);return!!(e&&e.cardinality==="+")}function Ug(t,e){if(Ze(t))return t.value===e.image;if(xe(t))return i0(t.rule.ref,e);if(Dt(t)){let r=ql(t);if(r)return Ug(r,e)}return!1}function i0(t,e){return M(t)?Ul(t.definition).some(n=>Ug(n.feature,e)):pe(t)?Fr(t).test(e.image):!1}function fA(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 hs=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}async getCompletion(e,r){let n=[],i=this.buildContexts(e,r.position),o=(c,u)=>{let l=this.fillCompletionItem(c,u);l&&n.push(l)},s=c=>Ze(c.feature)?c.feature.value:c.feature,a=[];for(let c of i)if(await Promise.all(J(c.features).distinct(s).exclude(a).map(u=>this.completionFor(c,u,o))),a.push(...c.features),!this.continueCompletion(n))break;return gs.CompletionList.create(this.deduplicateItems(n),!0)}deduplicateItems(e){return J(e).distinct(r=>`${r.kind}_${r.label}_${r.detail}`).toArray()}findFeaturesAt(e,r){let n=e.getText({start:gs.Position.create(0,0),end:e.positionAt(r)}),i=this.completionParser.parse(n),o=i.tokens;if(i.tokenIndex===0){let c=jl(this.grammar),u=Ul({feature:c.definition,type:cs(c)});return o.length>0?(o.shift(),Mg(u.map(l=>[l]),o)):u}let s=[...o].splice(i.tokenIndex);return Mg([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[h,m]=l,b=(n=al(o,h))===null||n===void 0?void 0:n.astNode;yield Object.assign(Object.assign({},u),{node:b,tokenOffset:h,tokenEndOffset:m,features:this.findFeaturesAt(s,h)})}let{nextTokenStart:f,nextTokenEnd:d,previousTokenStart:p,previousTokenEnd:T}=this.backtrackToAnyToken(a,c),R=f;c<=f&&p!==void 0&&(R=p);let A=(i=al(o,R))===null||i===void 0?void 0:i.astNode,S=!0;if(p!==void 0&&T!==void 0&&T===c&&(yield Object.assign(Object.assign({},u),{node:A,tokenOffset:p,tokenEndOffset:T,features:this.findFeaturesAt(s,p)}),S=this.performNextTokenCompletion(e,a.substring(p,T),p,T),S&&(yield Object.assign(Object.assign({},u),{node:A,tokenOffset:T,tokenEndOffset:T,features:this.findFeaturesAt(s,T)}))),A)S&&(yield Object.assign(Object.assign({},u),{node:A,tokenOffset:f,tokenEndOffset:d,features:this.findFeaturesAt(s,f)}));else{let h=jl(this.grammar);if(!h)throw new Error("Missing entry parser rule");yield Object.assign(Object.assign({},u),{tokenOffset:f,tokenEndOffset:d,features:Ul(h.definition)})}}performNextTokenCompletion(e,r,n,i){return/\P{L}$/u.test(r)}findDataTypeRuleStart(e,r){var n,i;let o=ht(e,r,this.grammarConfig.nameRegexp),s=!!(!((n=ve(o?.grammarSource,M))===null||n===void 0)&&n.dataType);if(s){for(;s;)o=o?.container,s=!!(!((i=ve(o?.grammarSource,M))===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(Ze(r.feature))return this.completionForKeyword(e,r.feature,n);if(Dt(r.feature)&&e.node)return this.completionForCrossReference(e,r,n)}completionForCrossReference(e,r,n){let i=ve(r.feature,ce),o=e.node;if(i&&o){r.type&&(o={$type:r.type,$container:o,$containerProperty:r.property},hl(this.astReflection,o));let s={reference:{$refText:""},container:o,property:i.feature};try{this.scopeProvider.getScope(s).getAllElements().forEach(c=>{this.filterCrossReference(e,c)&&n(e,this.createReferenceCompletionItem(c))})}catch(a){console.error(a)}}}createReferenceCompletionItem(e){return{nodeDescription:e,kind:this.nodeKindProvider.getCompletionItemKind(e),detail:e.type,sortText:"0"}}filterCrossReference(e,r){return!0}completionForKeyword(e,r,n){this.filterKeyword(e,r)&&n(e,{label:r.value,kind:gs.CompletionItemKind.Keyword,detail:"Keyword",sortText:"1"})}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 Gl=class extends hs{constructor(e){super(e),this.documents=()=>e.shared.workspace.LangiumDocuments}completionFor(e,r,n){let i=ve(r.feature,ce);if(i?.feature==="path")this.completeImportPath(e,n);else return super.completionFor(e,r,n)}completeImportPath(e,r){let i=e.textDocument.getText().substring(e.tokenOffset,e.offset),o=this.getAllFiles(e.document),s={start:e.position,end:e.position};if(i.length>0){let a=i.substring(1);o=o.filter(l=>l.startsWith(a));let c=e.textDocument.positionAt(e.tokenOffset+1),u=e.textDocument.positionAt(e.tokenEndOffset-1);s={start:c,end:u}}for(let a of o){let c=i.length>0?"":'"',u=`${c}${a}${c}`;r(e,{label:a,textEdit:{newText:u,range:s},kind:ba.File,sortText:"0"})}}getAllFiles(e){let r=this.documents().all,n=e.uri.toString(),i=ue.dirname(e.uri).toString(),o=[];for(let s of r)if(!ue.equals(s.uri,n)){let a=s.uri.toString(),c=a.substring(0,a.length-ue.extname(s.uri).length),u=ue.relative(i,c);u.startsWith(".")||(u=`./${u}`),o.push(u)}return o}};var tc=se(de(),1);var ys=class{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e){let r=[],n=i=>r.push(i);return this.collectFolding(e,n),r}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=Fe(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 hS(i))if(this.commentNames.includes(o.tokenType.name)){let s=this.toFoldingRange(e,o,tc.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)),tc.FoldingRange.create(o.line,s.line,o.character,s.character,n)}includeLastFoldingLine(e,r){if(r===tc.FoldingRangeKind.Comment)return!1;let n=e.text,i=n.charAt(n.length-1);return!(i==="}"||i===")"||i==="]")}};var Hl=class extends ys{shouldProcessContent(e){return!M(e)}};var Wl=class{constructor(){this.collector=()=>{}}getNodeFormatter(e){return new qg(e,this.collector)}formatDocument(e,r){let n=e.parseResult;return n.lexerErrors.length===0&&n.parserErrors.length===0?this.doDocumentFormat(e,r.options):[]}isFormatRangeErrorFree(e,r){let n=e.parseResult;return n.lexerErrors.length||n.parserErrors.length?Math.min(...n.lexerErrors.map(o=>{var s;return(s=o.line)!==null&&s!==void 0?s:Number.MAX_VALUE}),...n.parserErrors.map(o=>{var s;return(s=o.token.startLine)!==null&&s!==void 0?s:Number.MAX_VALUE}))>r.end.line:!0}formatDocumentRange(e,r){return this.isFormatRangeErrorFree(e,r.range)?this.doDocumentFormat(e,r.options,r.range):[]}formatDocumentOnType(e,r){let n={start:{character:0,line:r.position.line},end:r.position};return this.isFormatRangeErrorFree(e,n)?this.doDocumentFormat(e,r.options,n):[]}get formatOnTypeOptions(){}doDocumentFormat(e,r,n){let i=new Map,o=(a,c,u)=>{var l,f;let d=this.nodeModeToKey(a,c),p=i.get(d),T=(l=u.options.priority)!==null&&l!==void 0?l:0,R=(f=p?.options.priority)!==null&&f!==void 0?f:0;(!p||R<=T)&&i.set(d,u)};this.collector=o,this.iterateAstFormatting(e,n);let s=this.iterateCstFormatting(e,i,r,n);return this.avoidOverlappingEdits(e.textDocument,s)}avoidOverlappingEdits(e,r){let n=[];for(let i of r){let o=n[n.length-1];if(o){let s=e.offsetAt(i.range.start),a=e.offsetAt(o.range.end);s<a&&n.pop()}n.push(i)}return n}iterateAstFormatting(e,r){let n=e.parseResult.value;this.format(n);let i=Fe(n).iterator(),o;do if(o=i.next(),!o.done){let s=o.value;this.insideRange(s.$cstNode.range,r)?this.format(s):i.prune()}while(!o.done)}nodeModeToKey(e,r){return`${e.offset}:${e.end}:${r}`}insideRange(e,r){return!r||e.start.line<=r.start.line&&e.end.line>=r.end.line||e.start.line>=r.start.line&&e.end.line<=r.end.line||e.start.line<=r.end.line&&e.end.line>=r.end.line}isNecessary(e,r){return r.getText(e.range)!==e.newText}iterateCstFormatting(e,r,n,i){let o={indentation:0,options:n,document:e.textDocument},s=[],c=this.iterateCstTree(e,o).iterator(),u,l;do if(l=c.next(),!l.done){let f=l.value,d=ui(f),p=this.nodeModeToKey(f,"prepend"),T=r.get(p);if(r.delete(p),T){let S=this.createTextEdit(u,f,T,o);for(let h of S)h&&this.insideRange(h.range,i)&&this.isNecessary(h,e.textDocument)&&s.push(h)}let R=this.nodeModeToKey(f,"append"),A=r.get(R);if(r.delete(R),A){let S=xS(f);if(S){let h=this.createTextEdit(f,S,A,o);for(let m of h)m&&this.insideRange(m.range,i)&&this.isNecessary(m,e.textDocument)&&s.push(m)}}if(!T&&f.hidden){let S=this.createHiddenTextEdits(u,f,void 0,o);for(let h of S)h&&this.insideRange(h.range,i)&&this.isNecessary(h,e.textDocument)&&s.push(h)}d&&(u=f)}while(!l.done);return s}createHiddenTextEdits(e,r,n,i){var o;let s=r.range.start.line;if(e&&e.range.end.line===s)return[];let a=[],c={start:{character:0,line:s},end:r.range.start},u=i.document.getText(c),l=this.findFittingMove(c,(o=n?.moves)!==null&&o!==void 0?o:[],i),f=this.getExistingIndentationCharacterCount(u,i),p=this.getIndentationCharacterCount(i,l)-f;if(p===0)return[];let T="";p>0&&(T=(i.options.insertSpaces?" ":" ").repeat(p));let R=r.text.split(`
|
|
54
|
+
`);R[0]=u+R[0];for(let A=0;A<R.length;A++){let S=s+A,h={character:0,line:S};if(p>0)a.push({newText:T,range:{start:h,end:h}});else{let m=R[A],b=0;for(;b<m.length;b++){let _=m.charAt(b);if(_!==" "&&_!==" ")break}a.push({newText:"",range:{start:h,end:{line:S,character:Math.min(b,Math.abs(p))}}})}}return a}getExistingIndentationCharacterCount(e,r){let n=" ".repeat(r.options.tabSize);return(r.options.insertSpaces?e.replaceAll(" ",n):e.replaceAll(n," ")).length}getIndentationCharacterCount(e,r){let n=e.indentation;return r&&r.tabs&&(n+=r.tabs),(e.options.insertSpaces?e.options.tabSize:1)*n}createTextEdit(e,r,n,i){var o;if(r.hidden)return this.createHiddenTextEdits(e,r,n,i);let s={start:(o=e?.range.end)!==null&&o!==void 0?o:{character:0,line:0},end:r.range.start},a=this.findFittingMove(s,n.moves,i);if(!a)return[];let c=a.characters,u=a.lines,l=a.tabs,f=i.indentation;i.indentation+=l??0;let d=[];return c!==void 0?d.push(this.createSpaceTextEdit(s,c,n.options)):u!==void 0?d.push(this.createLineTextEdit(s,u,i,n.options)):l!==void 0&&d.push(this.createTabTextEdit(s,!!e,i)),ui(r)&&(i.indentation=f),d}createSpaceTextEdit(e,r,n){if(e.start.line===e.end.line){let o=e.end.character-e.start.character;r=this.fitIntoOptions(r,o,n)}return{newText:" ".repeat(r),range:e}}createLineTextEdit(e,r,n,i){let o=e.end.line-e.start.line;r=this.fitIntoOptions(r,o,i);let a=(n.options.insertSpaces?" ".repeat(n.options.tabSize):" ").repeat(n.indentation);return{newText:`${`
|
|
55
55
|
`.repeat(r)}${a}`,range:e}}createTabTextEdit(e,r,n){let o=(n.options.insertSpaces?" ".repeat(n.options.tabSize):" ").repeat(n.indentation),s=r?1:0,a=Math.max(e.end.line-e.start.line,s);return{newText:`${`
|
|
56
|
-
`.repeat(a)}${o}`,range:e}}fitIntoOptions(e,r,n){return n.allowMore?e=Math.max(r,e):n.allowLess&&(e=Math.min(r,e)),e}findFittingMove(e,r,n){if(r.length===0)return;if(r.length===1)return r[0];let i=e.end.line-e.start.line;for(let o of r){if(o.lines!==void 0&&i<=o.lines)return o;if(o.lines===void 0&&i===0)return o}return r[r.length-1]}iterateCstTree(e,r){let i=e.parseResult.value.$cstNode;return i?new $r(i,o=>this.iterateCst(o,r)):Bo}iterateCst(e,r){if(!ln(e))return Bo;let n=r.indentation;return new Rr(()=>({index:0}),i=>i.index<e.content.length?{done:!1,value:e.content[i.index++]}:(r.indentation=n,Zt))}},qg=class{constructor(e,r){this.astNode=e,this.collector=r}node(e){return new Qr(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){let r=[];for(let n of e)n.$cstNode&&r.push(n.$cstNode);return new Qr(r,this.collector)}property(e,r){let n=$t(this.astNode.$cstNode,e,r);return new Qr(n?[n]:[],this.collector)}properties(...e){let r=[];for(let n of e){let i=pi(this.astNode.$cstNode,n);r.push(...i)}return new Qr(r,this.collector)}keyword(e,r){let n=Mr(this.astNode.$cstNode,e,r);return new Qr(n?[n]:[],this.collector)}keywords(...e){let r=[];for(let n of e){let i=Bl(this.astNode.$cstNode,n);r.push(...i)}return new Qr(r,this.collector)}cst(e){return new Qr([...e],this.collector)}interior(e,r){let n=e.nodes,i=r.nodes;if(n.length!==1||i.length!==1)return new Qr([],this.collector);let o=n[0],s=i[0];if(o.offset>s.offset){let a=o;o=s,s=a}return new Qr(xS(o,s),this.collector)}},Qr=class t{constructor(e,r){this.nodes=e,this.collector=r}prepend(e){for(let r of this.nodes)this.collector(r,"prepend",e);return this}append(e){for(let r of this.nodes)this.collector(r,"append",e);return this}surround(e){for(let r of this.nodes)this.collector(r,"prepend",e),this.collector(r,"append",e);return this}slice(e,r){return new t(this.nodes.slice(e,r),this.collector)}},G;(function(t){function e(...l){return{options:{},moves:l.flatMap(f=>f.moves).sort(u)}}t.fit=e;function r(l){return i(0,l)}t.noSpace=r;function n(l){return i(1,l)}t.oneSpace=n;function i(l,f){return{options:f??{},moves:[{characters:l}]}}t.spaces=i;function o(l){return s(1,l)}t.newLine=o;function s(l,f){return{options:f??{},moves:[{lines:l}]}}t.newLines=s;function a(l){return{options:l??{},moves:[{tabs:1,lines:1}]}}t.indent=a;function c(l){return{options:l??{},moves:[{tabs:0}]}}t.noIndent=c;function u(l,f){var d,p,T,S,A,x;let h=(d=l.lines)!==null&&d!==void 0?d:0,m=(p=f.lines)!==null&&p!==void 0?p:0,b=(T=l.tabs)!==null&&T!==void 0?T:0,_=(S=f.tabs)!==null&&S!==void 0?S:0,V=(A=l.characters)!==null&&A!==void 0?A:0,Ct=(x=f.characters)!==null&&x!==void 0?x:0;return h<m?-1:h>m?1:b<_?-1:b>_?1:V<Ct?-1:V>Ct?1:0}})(G||(G={}));var jg=G.fit(G.oneSpace(),G.indent()),Kl=class extends Wl{format(e){if(Dt(e))this.getNodeFormatter(e).properties("type","terminal").surround(G.noSpace());else if(M(e)){let r=this.getNodeFormatter(e);r.keywords("entry","fragment","returns").append(G.oneSpace()),(e.inferredType||e.returnType||e.dataType)&&e.parameters.length===0?r.property("name").append(G.oneSpace()):r.property("name").append(G.noSpace()),r.properties("parameters").append(G.noSpace()),r.keywords(",").append(G.oneSpace()),r.keywords("<").append(G.noSpace());let n=r.keyword(";"),i=r.keyword(":");i.prepend(G.noSpace()),r.interior(i,n).prepend(G.indent()),n.prepend(G.fit(G.noSpace(),G.newLine())),r.node(e).prepend(G.noIndent())}else if(pe(e)){let r=this.getNodeFormatter(e);e.type&&(r.property("name").append(G.oneSpace()),r.keyword("returns").append(G.oneSpace())),r.keywords("hidden","terminal","fragment").append(G.oneSpace()),r.keyword(":").prepend(G.noSpace()),r.keyword(";").prepend(G.fit(G.noSpace(),G.newLine())),r.node(e).prepend(G.noIndent())}else if(Te(e)){let r=this.getNodeFormatter(e);r.keyword("{").append(G.noSpace()),r.keywords(".","+=","=").surround(G.noSpace()),r.keyword("}").prepend(G.noSpace())}else if(zo(e))this.getNodeFormatter(e).keywords("infer","infers").append(G.oneSpace());else if(ce(e))this.getNodeFormatter(e).keywords("=","+=","?=").surround(G.noSpace());else if(xe(e)){let r=this.getNodeFormatter(e);r.keyword("<").surround(G.noSpace()),r.keyword(",").append(G.oneSpace()),r.properties("arguments").append(G.noSpace())}else if(Ht(e)){let r=this.getNodeFormatter(e);r.keyword("interface").append(G.oneSpace()),r.keyword("extends").prepend(G.oneSpace()).append(jg),r.keywords(",").prepend(G.noSpace()).append(jg);let n=r.keyword("{");n.prepend(G.fit(G.oneSpace(),G.newLine()));let i=r.keyword("}");i.prepend(G.newLine()),r.interior(n,i).prepend(G.indent())}else if(lt(e)){let r=this.getNodeFormatter(e);r.keyword("type").append(G.oneSpace()),r.keyword("=").prepend(G.oneSpace()).append(jg),r.keyword(";").prepend(G.noSpace()).append(G.newLine())}else if(fi(e)){let r=this.getNodeFormatter(e);r.nodes(...e.rules,...e.interfaces,...e.types,...e.imports).prepend(G.noIndent()),r.keyword("grammar").prepend(G.noSpace()).append(G.oneSpace())}Ko(e)&&this.getNodeFormatter(e).property("cardinality").prepend(G.noSpace())}};var Fn=se(de(),1);var Q=se(de(),1);var Hg={[Q.SemanticTokenTypes.class]:0,[Q.SemanticTokenTypes.comment]:1,[Q.SemanticTokenTypes.enum]:2,[Q.SemanticTokenTypes.enumMember]:3,[Q.SemanticTokenTypes.event]:4,[Q.SemanticTokenTypes.function]:5,[Q.SemanticTokenTypes.interface]:6,[Q.SemanticTokenTypes.keyword]:7,[Q.SemanticTokenTypes.macro]:8,[Q.SemanticTokenTypes.method]:9,[Q.SemanticTokenTypes.modifier]:10,[Q.SemanticTokenTypes.namespace]:11,[Q.SemanticTokenTypes.number]:12,[Q.SemanticTokenTypes.operator]:13,[Q.SemanticTokenTypes.parameter]:14,[Q.SemanticTokenTypes.property]:15,[Q.SemanticTokenTypes.regexp]:16,[Q.SemanticTokenTypes.string]:17,[Q.SemanticTokenTypes.struct]:18,[Q.SemanticTokenTypes.type]:19,[Q.SemanticTokenTypes.typeParameter]:20,[Q.SemanticTokenTypes.variable]:21,[Q.SemanticTokenTypes.decorator]:22},fA={[Q.SemanticTokenModifiers.abstract]:1,[Q.SemanticTokenModifiers.async]:2,[Q.SemanticTokenModifiers.declaration]:4,[Q.SemanticTokenModifiers.defaultLibrary]:8,[Q.SemanticTokenModifiers.definition]:16,[Q.SemanticTokenModifiers.deprecated]:32,[Q.SemanticTokenModifiers.documentation]:64,[Q.SemanticTokenModifiers.modification]:128,[Q.SemanticTokenModifiers.readonly]:256,[Q.SemanticTokenModifiers.static]:512},dA={legend:{tokenTypes:Object.keys(Hg),tokenModifiers:Object.keys(fA)},full:{delta:!0},range:!0},Gg=class extends Q.SemanticTokensBuilder{constructor(){super(...arguments),this._tokens=[]}push(e,r,n,i,o){this._tokens.push({line:e,char:r,length:n,tokenType:i,tokenModifiers:o})}build(){return this.applyTokens(),super.build()}buildEdits(){return this.applyTokens(),super.buildEdits()}applyTokens(){for(let e of this._tokens.sort(this.compareTokens))super.push(e.line,e.char,e.length,e.tokenType,e.tokenModifiers);this._tokens=[]}compareTokens(e,r){return e.line===r.line?e.char-r.char:e.line-r.line}},zl=class{constructor(e){this.tokensBuilders=new Map,e.shared.workspace.TextDocuments.onDidClose(r=>{this.tokensBuilders.delete(r.document.uri)}),e.shared.lsp.LanguageServer.onInitialize(r=>{var n;this.initialize((n=r.capabilities.textDocument)===null||n===void 0?void 0:n.semanticTokens)})}initialize(e){this.clientCapabilities=e}async semanticHighlight(e,r,n=Q.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.build()}async semanticHighlightRange(e,r,n=Q.CancellationToken.None){return this.currentRange=r.range,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.build()}async semanticHighlightDelta(e,r,n=Q.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.previousResult(r.previousResultId),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.buildEdits()}createAcceptor(){return r=>{"line"in r?this.highlightToken({range:{start:{line:r.line,character:r.char},end:{line:r.line,character:r.char+r.length}},type:r.type,modifier:r.modifier}):"range"in r?this.highlightToken(r):"keyword"in r?this.highlightKeyword(r):"property"in r?this.highlightProperty(r):this.highlightNode({node:r.cst,type:r.type,modifier:r.modifier})}}getDocumentTokensBuilder(e){let r=this.tokensBuilders.get(e.uri.toString());if(r)return r;let n=new Gg;return this.tokensBuilders.set(e.uri.toString(),n),n}async computeHighlighting(e,r,n){let i=e.parseResult.value,o=zr(i,{range:this.currentRange}).iterator(),s;do if(s=o.next(),!s.done){await Ue(n);let a=s.value;this.highlightElement(a,r)==="prune"&&o.prune()}while(!s.done)}highlightToken(e){var r;let{range:n,type:i}=e,o=e.modifier;if(this.currentRange&&!sl(n,this.currentRange)||!this.currentDocument||!this.currentTokensBuilder)return;let s=Hg[i],a=0;if(o!==void 0){typeof o=="string"&&(o=[o]);for(let l of o){let f=fA[l];a|=f}}let c=n.start.line,u=n.end.line;if(c===u){let l=n.start.character,f=n.end.character-l;this.currentTokensBuilder.push(c,l,f,s,a)}else if(!((r=this.clientCapabilities)===null||r===void 0)&&r.multilineTokenSupport){let l=n.start.character,f=this.currentDocument.textDocument.offsetAt(n.start),d=this.currentDocument.textDocument.offsetAt(n.end);this.currentTokensBuilder.push(c,l,d-f,s,a)}else{let l=n.start,f=this.currentDocument.textDocument.offsetAt({line:c+1,character:0});this.currentTokensBuilder.push(l.line,l.character,f-l.character-1,s,a);for(let d=c+1;d<u;d++){let p=f;f=this.currentDocument.textDocument.offsetAt({line:d+1,character:0}),this.currentTokensBuilder.push(d,0,f-p-1,s,a)}this.currentTokensBuilder.push(u,0,n.end.character,s,a)}}highlightProperty(e){let r=[];if(typeof e.index=="number"){let o=$t(e.node.$cstNode,e.property,e.index);o&&r.push(o)}else r.push(...pi(e.node.$cstNode,e.property));let{type:n,modifier:i}=e;for(let o of r)this.highlightNode({node:o,type:n,modifier:i})}highlightKeyword(e){let{node:r,keyword:n,type:i,index:o,modifier:s}=e,a=[];if(typeof o=="number"){let c=Mr(r.$cstNode,n,o);c&&a.push(c)}else a.push(...Bl(r.$cstNode,n));for(let c of a)this.highlightNode({node:c,type:i,modifier:s})}highlightNode(e){let{node:r,type:n,modifier:i}=e,o=r.range;this.highlightToken({range:o,type:n,modifier:i})}},lA;(function(t){function e(n,i){let o=new Map;Object.entries(Hg).forEach(([c,u])=>o.set(u,c));let s=0,a=0;return r(n.data,5).map(c=>{s+=c[0],c[0]!==0&&(a=0),a+=c[1];let u=c[2];return{offset:i.textDocument.offsetAt({line:s,character:a}),tokenType:o.get(c[3]),tokenModifiers:c[4],text:i.textDocument.getText({start:{line:s,character:a},end:{line:s,character:a+u}})}})}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}})(lA||(lA={}));var Vl=class extends zl{highlightElement(e,r){var n;ce(e)?r({node:e,property:"feature",type:Fn.SemanticTokenTypes.property}):Te(e)?e.feature&&r({node:e,property:"feature",type:Fn.SemanticTokenTypes.property}):Xo(e)?r({node:e,property:"name",type:Fn.SemanticTokenTypes.type}):Wt(e)?(e.primitiveType||e.typeRef)&&r({node:e,property:e.primitiveType?"primitiveType":"typeRef",type:Fn.SemanticTokenTypes.type}):$S(e)?r({node:e,property:"name",type:Fn.SemanticTokenTypes.parameter}):Vo(e)?r({node:e,property:"parameter",type:Fn.SemanticTokenTypes.parameter}):xe(e)?!((n=e.rule.ref)===null||n===void 0)&&n.fragment&&r({node:e,property:"rule",type:Fn.SemanticTokenTypes.type}):ul(e)&&r({node:e,property:"name",type:Fn.SemanticTokenTypes.property})}};var Xl=class extends ts{getName(e){return ce(e)?e.feature:super.getName(e)}getNameNode(e){return ce(e)?$t(e.$cstNode,"feature"):super.getNameNode(e)}};var Ts=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=xs(e),n=e.astNode;if(r&&n){let i=n[r.feature];if(Pn(i))return i.ref;if(Array.isArray(i)){for(let o of i)if(Pn(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||gS(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=>ue.equals(o.sourceUri,r.documentUri))),n.push(...i),J(n)}getReferenceToSelf(e){let r=this.nameProvider.getNameNode(e);if(r){let n=Y(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:i,targetUri:n.uri,targetPath:i,segment:Gt(r),local:!0}}}};var Yl=class extends Ts{constructor(e){super(e),this.documents=e.shared.workspace.LangiumDocuments}findDeclaration(e){let r=e.astNode,n=xs(e);if(n&&n.feature==="feature"){if(ce(r))return this.findAssignmentDeclaration(r);if(Te(r))return this.findActionDeclaration(r)}return super.findDeclaration(e)}findReferences(e,r){var n;return ul(e)?this.findReferencesToTypeAttribute(e,(n=r.includeDeclaration)!==null&&n!==void 0?n:!1):super.findReferences(e,r)}findReferencesToTypeAttribute(e,r){let n=[],i=ve(e,Ht);if(i){if(r){let a=this.getReferenceToSelf(e);a&&n.push(a)}let o=hg(i,this,this.documents,this.nodeLocator),s=[];o.forEach(a=>{let c=this.findRulesWithReturnType(a);s.push(...c)}),s.forEach(a=>{let c=this.createReferencesToAttribute(a,e);n.push(...c)})}return J(n)}createReferencesToAttribute(e,r){let n=[];if(M(e)){let i=as(e.definition).find(o=>o.feature===r.name);if(i?.$cstNode){let o=this.nameProvider.getNameNode(i);o&&n.push({sourceUri:Y(i).uri,sourcePath:this.nodeLocator.getAstNodePath(i),targetUri:Y(r).uri,targetPath:this.nodeLocator.getAstNodePath(r),segment:Gt(o),local:ue.equals(Y(i).uri,Y(r).uri)})}}else{if(e.feature===r.name){let o=$t(e.$cstNode,"feature");o&&n.push({sourceUri:Y(e).uri,sourcePath:this.nodeLocator.getAstNodePath(e),targetUri:Y(r).uri,targetPath:this.nodeLocator.getAstNodePath(r),segment:Gt(o),local:ue.equals(Y(e).uri,Y(r).uri)})}let i=ve(e,M);n.push(...this.createReferencesToAttribute(i,r))}return n}findAssignmentDeclaration(e){var r;let n=ve(e,M),i=Cg(e);if(i){let o=this.findActionDeclaration(i,e.feature);if(o)return o}if(!((r=n?.returnType)===null||r===void 0)&&r.ref&&(Ht(n.returnType.ref)||lt(n.returnType.ref))){let o=ja(n.returnType.ref);for(let s of o){let a=s.attributes.find(c=>c.name===e.feature);if(a)return a}}return e}findActionDeclaration(e,r){var n;if(!((n=e.type)===null||n===void 0)&&n.ref){let i=r??e.feature,o=ja(e.type.ref);for(let s of o){let a=s.attributes.find(c=>c.name===i);if(a)return a}}}findRulesWithReturnType(e){let r=[];return this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e)).forEach(i=>{let o=this.documents.getOrCreateDocument(i.sourceUri),s=this.nodeLocator.getAstNode(o.parseResult.value,i.sourcePath);(M(s)||Te(s))&&r.push(s)}),r}};var rc=se(de(),1);var pA=se(de(),1);var Jl=class{constructor(e){this.grammarConfig=e.parser.GrammarConfig,this.nameProvider=e.references.NameProvider,this.documents=e.shared.workspace.LangiumDocuments,this.references=e.references.References}prepareCallHierarchy(e,r){let n=e.parseResult.value,i=ht(n.$cstNode,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findDeclarationNode(i);if(o)return this.getCallHierarchyItems(o.astNode,e)}getCallHierarchyItems(e,r){let n=this.nameProvider.getNameNode(e),i=this.nameProvider.getName(e);if(!(!n||!e.$cstNode||i===void 0))return[Object.assign({kind:pA.SymbolKind.Method,name:i,range:e.$cstNode.range,selectionRange:n.range,uri:r.uri.toString()},this.getCallHierarchyItem(e))]}getCallHierarchyItem(e){}incomingCalls(e){let r=this.documents.getOrCreateDocument(At.parse(e.item.uri)),n=r.parseResult.value,i=ht(n.$cstNode,r.textDocument.offsetAt(e.item.range.start),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findReferences(i.astNode,{includeDeclaration:!1});return this.getIncomingCalls(i.astNode,o)}outgoingCalls(e){let r=this.documents.getOrCreateDocument(At.parse(e.item.uri)),n=r.parseResult.value,i=ht(n.$cstNode,r.textDocument.offsetAt(e.item.range.start),this.grammarConfig.nameRegexp);if(i)return this.getOutgoingCalls(i.astNode)}};var mA=se(de(),1);var vs=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,r){let n=e.parseResult.value;if(n.$cstNode){let i=n.$cstNode,o=ht(i,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(o)return this.collectLocationLinks(o,r)}}collectLocationLinks(e,r){var n;let i=this.findLink(e);if(i)return[mA.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=Y(r.astNode);if(r&&n)return{source:e,target:r,targetDocument:n}}}};var hA=se(de(),1);var Ql=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,r){let n=e.parseResult.value.$cstNode;if(!n)return;let i=ht(n,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findDeclaration(i);if(o){let s=ue.equals(Y(o).uri,e.uri),a={documentUri:e.uri,includeDeclaration:s};return this.references.findReferences(o,a).map(u=>this.createDocumentHighlight(u)).toArray()}}createDocumentHighlight(e){return hA.DocumentHighlight.create(e.segment.range)}};var Zl=class{constructor(e){this.nameProvider=e.references.NameProvider,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}getSymbols(e){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 di(r)){let o=this.getSymbol(e,i);n.push(...o)}if(n.length>0)return n}};var n0=se(de(),1);var ef=class{match(e,r){if(e.length===0)return!0;r=r.toLowerCase();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 gA<=e&&e<=yA&&i0<=r&&r<=o0||e===TA&&r!==TA}toUpperCharCode(e){return gA<=e&&e<=yA?e-32:e}},gA="a".charCodeAt(0),yA="z".charCodeAt(0),i0="A".charCodeAt(0),o0="Z".charCodeAt(0),TA="_".charCodeAt(0);var Wg=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=ht(o,s,this.grammarConfig.nameRegexp);if(a&&a.offset+a.length>s){let c=this.references.findDeclaration(a);if(c)return this.getAstNodeHoverContent(c)}}}},tf=class extends Wg{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 s0=se(de(),1);var a0=se(de(),1);var qr=se(de(),1);var Ae;(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"})(Ae||(Ae={}));var rf=class{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}fromTextDocument(e,r){return this.create(r??At.parse(e.uri),e)}fromString(e,r){return this.create(r,e)}fromModel(e,r){return this.create(r,{$model:e})}create(e,r){if(r??(r=this.textDocuments.get(e.toString())),r??(r=this.getContentFromFileSystem(e)),typeof r=="string"){let n=this.parse(e,r);return this.createLangiumDocument(n,e,void 0,r)}else if("$model"in r){let n={value:r.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(n,e)}else{let n=this.parse(e,r.getText());return this.createLangiumDocument(n,e,r)}}createLangiumDocument(e,r,n,i){let o;if(n)o={parseResult:e,uri:r,state:Ae.Parsed,references:[],textDocument:n};else{let s=this.createTextDocumentGetter(r,i);o={parseResult:e,uri:r,state:Ae.Parsed,references:[],get textDocument(){return s()}}}return e.value.$document=o,o}update(e){let r=this.textDocuments.get(e.uri.toString()),n=r?r.getText():this.getContentFromFileSystem(e.uri);if(r)Object.defineProperty(e,"textDocument",{value:r});else{let i=this.createTextDocumentGetter(e.uri,n);Object.defineProperty(e,"textDocument",{get:i})}return e.parseResult=this.parse(e.uri,n),e.parseResult.value.$document=e,e}getContentFromFileSystem(e){return this.fileSystemProvider.readFileSync(e)}parse(e,r){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(r)}createTextDocumentGetter(e,r){let n=this.serviceRegistry,i;return()=>i??(i=Ho.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,r??""))}},nf=class{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory}get all(){return J(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)}getOrCreateDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n||(n=this.langiumDocumentFactory.create(e),this.documentMap.set(r,n),n)}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(n.state=Ae.Changed,n.precomputedScopes=void 0,n.references=[],n.diagnostics=void 0),n}deleteDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(n.state=Ae.Changed,this.documentMap.delete(r)),n}};var c0=se(de(),1);function xA(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 of=class{constructor(e){this.onInitializeEmitter=new qr.Emitter,this.onInitializedEmitter=new qr.Emitter,this.services=e}get onInitialize(){return this.onInitializeEmitter.event}get onInitialized(){return this.onInitializedEmitter.event}async initialize(e){return this.eagerLoadServices(),this.onInitializeEmitter.fire(e),this.onInitializeEmitter.dispose(),this.buildInitializeResult(e)}eagerLoadServices(){al(this.services),this.services.ServiceRegistry.all.forEach(e=>al(e))}hasService(e){return this.services.ServiceRegistry.all.some(r=>e(r)!==void 0)}buildInitializeResult(e){var r;let n=this.services.ServiceRegistry.all,i=this.hasService(v=>v.lsp.Formatter),o=n.map(v=>{var D;return(D=v.lsp.Formatter)===null||D===void 0?void 0:D.formatOnTypeOptions}).find(v=>!!v),s=this.hasService(v=>v.lsp.CodeActionProvider),a=this.hasService(v=>v.lsp.SemanticTokenProvider),c=(r=this.services.lsp.ExecuteCommandHandler)===null||r===void 0?void 0:r.commands,u=this.hasService(v=>v.lsp.DocumentLinkProvider),l=xA(n.map(v=>{var D;return(D=v.lsp.SignatureHelp)===null||D===void 0?void 0:D.signatureHelpOptions})),f=this.hasService(v=>v.lsp.TypeProvider),d=this.hasService(v=>v.lsp.ImplementationProvider),p=this.hasService(v=>v.lsp.CompletionProvider),T=uA(n.map(v=>{var D;return(D=v.lsp.CompletionProvider)===null||D===void 0?void 0:D.completionOptions})),S=this.hasService(v=>v.lsp.ReferencesProvider),A=this.hasService(v=>v.lsp.DocumentSymbolProvider),x=this.hasService(v=>v.lsp.DefinitionProvider),h=this.hasService(v=>v.lsp.DocumentHighlightProvider),m=this.hasService(v=>v.lsp.FoldingRangeProvider),b=this.hasService(v=>v.lsp.HoverProvider),_=this.hasService(v=>v.lsp.RenameProvider),V=this.hasService(v=>v.lsp.CallHierarchyProvider),Ct=this.hasService(v=>v.lsp.CodeLensProvider),rt=this.hasService(v=>v.lsp.DeclarationProvider),Tr=this.hasService(v=>v.lsp.InlayHintProvider),Xt=this.services.lsp.WorkspaceSymbolProvider;return{capabilities:{workspace:{workspaceFolders:{supported:!0}},executeCommandProvider:c&&{commands:c},textDocumentSync:qr.TextDocumentSyncKind.Incremental,completionProvider:p?T:void 0,referencesProvider:S,documentSymbolProvider:A,definitionProvider:x,typeDefinitionProvider:f,documentHighlightProvider:h,codeActionProvider:s,documentFormattingProvider:i,documentRangeFormattingProvider:i,documentOnTypeFormattingProvider:o,foldingRangeProvider:m,hoverProvider:b,renameProvider:_?{prepareProvider:!0}:void 0,semanticTokensProvider:a?dA:void 0,signatureHelpProvider:l,implementationProvider:d,callHierarchyProvider:V?{}:void 0,documentLinkProvider:u?{resolveProvider:!1}:void 0,codeLensProvider:Ct?{resolveProvider:!1}:void 0,declarationProvider:rt,inlayHintProvider:Tr?{resolveProvider:!1}:void 0,workspaceSymbolProvider:Xt?{resolveProvider:!!Xt.resolveSymbol}:void 0}}}async initialized(e){this.onInitializedEmitter.fire(e),this.onInitializedEmitter.dispose()}};function RA(t){let e=t.lsp.Connection;if(!e)throw new Error("Starting a language server requires the languageServer.Connection service to be set.");u0(e,t),l0(e,t),f0(e,t),d0(e,t),m0(e,t),h0(e,t),g0(e,t),y0(e,t),x0(e,t),R0(e,t),S0(e,t),p0(e,t),b0(e,t),v0(e,t),A0(e,t),w0(e,t),E0(e,t),C0(e,t),I0(e,t),N0(e,t),_0(e,t),k0(e,t),T0(e,t),P0(e,t),e.onInitialize(n=>t.lsp.LanguageServer.initialize(n)),e.onInitialized(n=>t.lsp.LanguageServer.initialized(n)),t.workspace.TextDocuments.listen(e),e.listen()}function u0(t,e){let r=e.workspace.DocumentBuilder,n=e.workspace.MutexLock;function i(s,a){n.lock(c=>r.update(s,a,c))}e.workspace.TextDocuments.onDidChangeContent(s=>{i([At.parse(s.document.uri)],[])}),t.onDidChangeWatchedFiles(s=>{let a=[],c=[];for(let u of s.changes){let l=At.parse(u.uri);u.type===qr.FileChangeType.Deleted?c.push(l):a.push(l)}i(a,c)})}function l0(t,e){e.workspace.DocumentBuilder.onBuildPhase(Ae.Validated,async(n,i)=>{for(let o of n)if(o.diagnostics&&t.sendDiagnostics({uri:o.uri.toString(),diagnostics:o.diagnostics}),i.isCancellationRequested)return})}function f0(t,e){t.onCompletion(Kt((r,n,i,o)=>{var s;return(s=r.lsp.CompletionProvider)===null||s===void 0?void 0:s.getCompletion(n,i,o)},e))}function d0(t,e){t.onReferences(Kt((r,n,i,o)=>{var s;return(s=r.lsp.ReferencesProvider)===null||s===void 0?void 0:s.findReferences(n,i,o)},e))}function p0(t,e){t.onCodeAction(Kt((r,n,i,o)=>{var s;return(s=r.lsp.CodeActionProvider)===null||s===void 0?void 0:s.getCodeActions(n,i,o)},e))}function m0(t,e){t.onDocumentSymbol(Kt((r,n,i,o)=>{var s;return(s=r.lsp.DocumentSymbolProvider)===null||s===void 0?void 0:s.getSymbols(n,i,o)},e))}function h0(t,e){t.onDefinition(Kt((r,n,i,o)=>{var s;return(s=r.lsp.DefinitionProvider)===null||s===void 0?void 0:s.getDefinition(n,i,o)},e))}function g0(t,e){t.onTypeDefinition(Kt((r,n,i,o)=>{var s;return(s=r.lsp.TypeProvider)===null||s===void 0?void 0:s.getTypeDefinition(n,i,o)},e))}function y0(t,e){t.onImplementation(Kt((r,n,i,o)=>{var s;return(s=r.lsp.ImplementationProvider)===null||s===void 0?void 0:s.getImplementation(n,i,o)},e))}function T0(t,e){t.onDeclaration(Kt((r,n,i,o)=>{var s;return(s=r.lsp.DeclarationProvider)===null||s===void 0?void 0:s.getDeclaration(n,i,o)},e))}function x0(t,e){t.onDocumentHighlight(Kt((r,n,i,o)=>{var s;return(s=r.lsp.DocumentHighlightProvider)===null||s===void 0?void 0:s.getDocumentHighlight(n,i,o)},e))}function v0(t,e){t.onHover(Kt((r,n,i,o)=>{var s;return(s=r.lsp.HoverProvider)===null||s===void 0?void 0:s.getHoverContent(n,i,o)},e))}function R0(t,e){t.onFoldingRanges(Kt((r,n,i,o)=>{var s;return(s=r.lsp.FoldingRangeProvider)===null||s===void 0?void 0:s.getFoldingRanges(n,i,o)},e))}function S0(t,e){t.onDocumentFormatting(Kt((r,n,i,o)=>{var s;return(s=r.lsp.Formatter)===null||s===void 0?void 0:s.formatDocument(n,i,o)},e)),t.onDocumentRangeFormatting(Kt((r,n,i,o)=>{var s;return(s=r.lsp.Formatter)===null||s===void 0?void 0:s.formatDocumentRange(n,i,o)},e)),t.onDocumentOnTypeFormatting(Kt((r,n,i,o)=>{var s;return(s=r.lsp.Formatter)===null||s===void 0?void 0:s.formatDocumentOnType(n,i,o)},e))}function b0(t,e){t.onRenameRequest(Kt((r,n,i,o)=>{var s;return(s=r.lsp.RenameProvider)===null||s===void 0?void 0:s.rename(n,i,o)},e)),t.onPrepareRename(Kt((r,n,i,o)=>{var s;return(s=r.lsp.RenameProvider)===null||s===void 0?void 0:s.prepareRename(n,i,o)},e))}function A0(t,e){t.languages.inlayHint.on(gi((r,n,i,o)=>{var s;return(s=r.lsp.InlayHintProvider)===null||s===void 0?void 0:s.getInlayHints(n,i,o)},e))}function w0(t,e){let r={data:[]};t.languages.semanticTokens.on(gi((n,i,o,s)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlight(i,o,s):r,e)),t.languages.semanticTokens.onDelta(gi((n,i,o,s)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlightDelta(i,o,s):r,e)),t.languages.semanticTokens.onRange(gi((n,i,o,s)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlightRange(i,o,s):r,e))}function k0(t,e){t.onDidChangeConfiguration(r=>{r.settings&&e.workspace.ConfigurationProvider.updateConfiguration(r)})}function E0(t,e){let r=e.lsp.ExecuteCommandHandler;r&&t.onExecuteCommand(async(n,i)=>{var o;try{return await r.executeCommand(n.command,(o=n.arguments)!==null&&o!==void 0?o:[],i)}catch(s){return Rs(s)}})}function _0(t,e){t.onDocumentLinks(gi((r,n,i,o)=>{var s;return(s=r.lsp.DocumentLinkProvider)===null||s===void 0?void 0:s.getDocumentLinks(n,i,o)},e))}function C0(t,e){t.onSignatureHelp(gi((r,n,i,o)=>{var s;return(s=r.lsp.SignatureHelp)===null||s===void 0?void 0:s.provideSignatureHelp(n,i,o)},e))}function N0(t,e){t.onCodeLens(gi((r,n,i,o)=>{var s;return(s=r.lsp.CodeLensProvider)===null||s===void 0?void 0:s.provideCodeLens(n,i,o)},e))}function P0(t,e){var r;let n=e.lsp.WorkspaceSymbolProvider;if(n){t.onWorkspaceSymbol(async(o,s)=>{try{return await n.getSymbols(o,s)}catch(a){return Rs(a)}});let i=(r=n.resolveSymbol)===null||r===void 0?void 0:r.bind(n);i&&t.onWorkspaceSymbolResolve(async(o,s)=>{try{return await i(o,s)}catch(a){return Rs(a)}})}}function I0(t,e){t.languages.callHierarchy.onPrepare(gi((r,n,i,o)=>{var s;return r.lsp.CallHierarchyProvider&&(s=r.lsp.CallHierarchyProvider.prepareCallHierarchy(n,i,o))!==null&&s!==void 0?s:null},e)),t.languages.callHierarchy.onIncomingCalls(vA((r,n,i)=>{var o;return r.lsp.CallHierarchyProvider&&(o=r.lsp.CallHierarchyProvider.incomingCalls(n,i))!==null&&o!==void 0?o:null},e)),t.languages.callHierarchy.onOutgoingCalls(vA((r,n,i)=>{var o;return r.lsp.CallHierarchyProvider&&(o=r.lsp.CallHierarchyProvider.outgoingCalls(n,i))!==null&&o!==void 0?o:null},e))}function vA(t,e){let r=e.ServiceRegistry;return async(n,i)=>{let o=At.parse(n.item.uri),s=r.getServices(o);if(!s){let a=`Could not find service instance for uri: '${o.toString()}'`;throw console.error(a),new Error(a)}try{return await t(s,n,i)}catch(a){return Rs(a)}}}function gi(t,e){let r=e.workspace.LangiumDocuments,n=e.ServiceRegistry;return async(i,o)=>{let s=At.parse(i.textDocument.uri),a=n.getServices(s);if(!a)throw console.error(`Could not find service instance for uri: '${s.toString()}'`),new Error;let c=r.getOrCreateDocument(s);if(!c)throw new Error;try{return await t(a,c,i,o)}catch(u){return Rs(u)}}}function Kt(t,e){let r=e.workspace.LangiumDocuments,n=e.ServiceRegistry;return async(i,o)=>{let s=At.parse(i.textDocument.uri),a=n.getServices(s);if(!a)return console.error(`Could not find service instance for uri: '${s.toString()}'`),null;let c=r.getOrCreateDocument(s);if(!c)return null;try{return await t(a,c,i,o)}catch(u){return Rs(u)}}}function Rs(t){if(Zi(t))return new qr.ResponseError(qr.LSPErrorCodes.RequestCancelled,"The request has been cancelled.");if(t instanceof qr.ResponseError)return t;throw t}var af=se(de(),1),sf=class{getSymbolKind(){return af.SymbolKind.Field}getCompletionItemKind(){return af.CompletionItemKind.Reference}};var SA=se(de(),1);var cf=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}findReferences(e,r){let n=e.parseResult.value.$cstNode;if(!n)return[];let i=ht(n,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);return i?this.getReferences(i,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(SA.Location.create(a.sourceUri.toString(),a.segment.range))})}return i}};var bA=se(de(),1);var uf=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async rename(e,r){let n={},i=e.parseResult.value.$cstNode;if(!i)return;let o=e.textDocument.offsetAt(r.position),s=ht(i,o,this.grammarConfig.nameRegexp);if(!s)return;let a=this.references.findDeclaration(s);if(!a)return;let c={onlyLocal:!1,includeDeclaration:!0};return this.references.findReferences(a,c).forEach(l=>{let f=bA.TextEdit.replace(l.segment.range,r.newName),d=l.sourceUri.toString();n[d]?n[d].push(f):n[d]=[f]}),{changes:n}}prepareRename(e,r){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=ht(n,i,this.grammarConfig.nameRegexp);if(!o)return;if(this.references.findDeclaration(o)||this.isNameNode(o))return o.range}}isNameNode(e){return e?.astNode&&Ga(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}};var D0=se(de(),1);var AA=se(de(),1);var lf=class{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,r=AA.CancellationToken.None){let n=[],i=e.query.toLowerCase();for(let o of this.indexManager.allElements())if(await Ue(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 ff=class extends vs{constructor(e){super(e),this.documents=e.shared.workspace.LangiumDocuments}collectLocationLinks(e,r){var n,i,o,s,a,c;let u="path";if(cl(e.astNode)&&((n=xs(e))===null||n===void 0?void 0:n.feature)===u){let l=Ln(this.documents,e.astNode);if(l?.$document){let f=(i=this.findTargetObject(l))!==null&&i!==void 0?i:l,d=(s=(o=this.nameProvider.getNameNode(f))===null||o===void 0?void 0:o.range)!==null&&s!==void 0?s:rc.Range.create(0,0,0,0),p=(c=(a=f.$cstNode)===null||a===void 0?void 0:a.range)!==null&&c!==void 0?c:rc.Range.create(0,0,0,0);return[rc.LocationLink.create(l.$document.uri.toString(),p,d,e.range)]}return}return super.collectLocationLinks(e,r)}findTargetObject(e){return e.isDeclared?e:di(e).head()}};var Bg=se(de(),1);var df=class extends Jl{getIncomingCalls(e,r){if(!M(e))return;let n=new Map;if(r.forEach(i=>{let s=this.documents.getOrCreateDocument(i.sourceUri).parseResult.value;if(!s.$cstNode)return;let a=dr(s.$cstNode,i.segment.offset);if(!a)return;let c=ve(a.astNode,M);if(!c||!c.$cstNode)return;let u=this.nameProvider.getNameNode(c);if(!u)return;let l=i.sourceUri.toString(),f=l+"@"+u.text;n.has(f)?n.set(f,{parserRule:c.$cstNode,nameNode:u,targetNodes:[...n.get(f).targetNodes,a],docUri:l}):n.set(f,{parserRule:c.$cstNode,nameNode:u,targetNodes:[a],docUri:l})}),n.size!==0)return Array.from(n.values()).map(i=>({from:{kind:Bg.SymbolKind.Method,name:i.nameNode.text,range:i.parserRule.range,selectionRange:i.nameNode.range,uri:i.docUri},fromRanges:i.targetNodes.map(o=>o.range)}))}getOutgoingCalls(e){if(!M(e))return;let r=Fe(e).filter(xe).toArray(),n=new Map;if(r.forEach(i=>{var o;let s=i.$cstNode;if(!s)return;let a=(o=i.rule.ref)===null||o===void 0?void 0:o.$cstNode;if(!a)return;let c=this.nameProvider.getNameNode(a.astNode);if(!c)return;let u=Y(a.astNode).uri.toString(),l=u+"@"+c.text;n.has(l)?n.set(l,{refCstNode:a,to:c,from:[...n.get(l).from,s.range],docUri:u}):n.set(l,{refCstNode:a,to:c,from:[s.range],docUri:u})}),n.size!==0)return Array.from(n.values()).map(i=>({to:{kind:Bg.SymbolKind.Method,name:i.to.text,range:i.refCstNode.range,selectionRange:i.to.range,uri:i.docUri},fromRanges:i.from}))}};var pf=class{constructor(e){this.documents=e.shared.workspace.LangiumDocuments}collectValidationResources(e){let r=nA(e,this.documents);return{typeToValidationInfo:this.collectValidationInfo(r),typeToSuperProperties:this.collectSuperProperties(r)}}collectValidationInfo({astResources:e,inferred:r,declared:n}){let i=new Map,o=O0(e);for(let a of Sl(r))i.set(a.name,{inferred:a,inferredNodes:o.get(a.name)});let s=J(e.interfaces).concat(e.types).reduce((a,c)=>a.set(c.name,c),new Map);for(let a of Sl(n)){let c=s.get(a.name);if(c){let u=i.get(a.name);i.set(a.name,Object.assign(Object.assign({},u??{}),{declared:a,declaredNode:c}))}}return i}collectSuperProperties({inferred:e,declared:r}){let n=new Map,i=gg(e,r),o=new Map(i.map(s=>[s.name,s]));for(let s of gg(e,r))n.set(s.name,this.addSuperProperties(s,o,new Set));return n}addSuperProperties(e,r,n){if(n.has(e.name))return[];n.add(e.name);let i=[...e.properties];for(let o of e.superTypes){let s=r.get(o.name);s&&i.push(...this.addSuperProperties(s,r,n))}return i}};function O0({parserRules:t,datatypeRules:e}){let r=new ye;J(t).concat(e).forEach(i=>r.add(to(i),i));function n(i){if(Te(i)){let o=us(i);o&&r.add(o,i)}(Sr(i)||bt(i)||br(i))&&i.elements.forEach(o=>n(o))}return t.forEach(i=>n(i.definition)),r}function wA(t){return t&&"declared"in t}function kA(t){return t&&"inferred"in t}function EA(t){return t&&"inferred"in t&&"declared"in t}function CA(t){let e=t.validation.ValidationRegistry,r=t.validation.LangiumGrammarTypesValidator,n={Action:[r.checkActionIsNotUnionType],Grammar:[r.checkDeclaredTypesConsistency,r.checkDeclaredAndInferredTypesConsistency],Interface:[r.checkCyclicInterface],Type:[r.checkCyclicType]};e.register(n,r)}var mf=class{checkCyclicType(e,r){yi(e,new Set)&&r("error",`Type alias '${e.name}' circularly references itself.`,{node:e,property:"name"})}checkCyclicInterface(e,r){yi(e,new Set)&&r("error",`Type '${e.name}' recursively references itself as a base type.`,{node:e,property:"name"})}checkDeclaredTypesConsistency(e,r){var n;let i=(n=e.$document)===null||n===void 0?void 0:n.validationResources;if(i){for(let o of i.typeToValidationInfo.values())if(wA(o)&&Yr(o.declared)&&Ht(o.declaredNode)){let s=o;L0(s,r),M0(s,r)}}}checkDeclaredAndInferredTypesConsistency(e,r){var n;let i=(n=e.$document)===null||n===void 0?void 0:n.validationResources;if(i)for(let o of i.typeToValidationInfo.values())kA(o)&&o.inferred instanceof es&&$0(o.inferred,r),EA(o)&&q0(o,i,r)}checkActionIsNotUnionType(e,r){lt(e.type)&&r("error","Actions cannot create union types.",{node:e,property:"type"})}};function yi(t,e){var r;if(e.has(t))return!0;if(e.add(t),lt(t))return yi(t.type,e);if(Ht(t))return t.superTypes.some(n=>n.ref&&yi(n.ref,new Set(e)));if(Wt(t)){if(!((r=t.typeRef)===null||r===void 0)&&r.ref)return yi(t.typeRef.ref,e)}else{if(Xi(t))return yi(t.referenceType,e);if(Vi(t))return yi(t.elementType,e);if(Lr(t))return t.types.some(n=>yi(n,new Set(e)))}return!1}function $0(t,e){t.properties.forEach(r=>{var n;let i=pg(r.type);if(i.length>1){let o=a=>Dn(a)?"ref":"other",s=o(i[0]);if(i.slice(1).some(a=>o(a)!==s)){let a=(n=r.astNodes.values().next())===null||n===void 0?void 0:n.value;a&&e("error",`Mixing a cross-reference with other types is not supported. Consider splitting property "${r.name}" into two or more different properties.`,{node:a})}}})}function L0({declared:t,declaredNode:e},r){Array.from(t.superTypes).forEach((n,i)=>{n&&(Vr(n)&&r("error","Interfaces cannot extend union types.",{node:e,property:"superTypes",index:i}),n.declared||r("error","Extending an inferred type is discouraged.",{node:e,property:"superTypes",index:i}))})}function M0({declared:t,declaredNode:e},r){let n=t.properties.reduce((s,a)=>s.add(a.name,a),new ye);for(let[s,a]of n.entriesGroupedByKey())if(a.length>1)for(let c of a)r("error",`Cannot have two properties with the same name '${s}'.`,{node:Array.from(c.astNodes)[0],property:"name"});let i=Array.from(t.superTypes);for(let s=0;s<i.length;s++)for(let a=s+1;a<i.length;a++){let c=i[s],u=i[a],l=Yr(c)?c.superProperties:[],f=Yr(u)?u.superProperties:[],d=F0(l,f);d.length>0&&r("error",`Cannot simultaneously inherit from '${c}' and '${u}'. Their ${d.map(p=>"'"+p+"'").join(", ")} properties are not identical.`,{node:e,property:"name"})}let o=new Set;for(let s of i){let a=Yr(s)?s.superProperties:[];for(let c of a)o.add(c.name)}for(let s of t.properties)if(o.has(s.name)){let a=e.attributes.find(c=>c.name===s.name);a&&r("error",`Cannot redeclare property '${s.name}'. It is already inherited from another interface.`,{node:a,property:"name"})}}function F0(t,e){let r=[];for(let n of t){let i=e.find(o=>o.name===n.name);i&&!U0(n,i)&&r.push(n.name)}return r}function U0(t,e){return qa(t.type,e.type)&&qa(e.type,t.type)}function q0(t,e,r){let{inferred:n,declared:i,declaredNode:o,inferredNodes:s}=t,a=i.name,c=f=>d=>s.forEach(p=>r("error",`${d}${f?` ${f}`:""}.`,p?.inferredType?{node:p?.inferredType,property:"name"}:{node:p,property:Te(p)?"type":"name"})),u=(f,d)=>f.forEach(p=>r("error",d,{node:p,property:ce(p)||Te(p)?"feature":"name"})),l=f=>{s.forEach(d=>{M(d)&&as(d.definition).find(T=>T.feature===f)===void 0&&r("error",`Property '${f}' is missing in a rule '${d.name}', but is required in type '${a}'.`,{node:d,property:"parameters"})})};if(Vr(n)&&Vr(i))j0(n.type,i.type,c(`in a rule that returns type '${a}'`));else if(Yr(n)&&Yr(i))G0(n,i,e,c(`in a rule that returns type '${a}'`),u,l);else{let f=`Inferred and declared versions of type '${a}' both have to be interfaces or unions.`;c()(f),r("error",f,{node:o,property:"name"})}}function j0(t,e,r){qa(t,e)||r(`Cannot assign type '${Xr(t,"DeclaredType")}' to '${Xr(e,"DeclaredType")}'`)}function _A(t){return t.optional||vl(t.type)}function G0(t,e,r,n,i,o){let s=new Set(t.properties.map(f=>f.name)),a=new Map(t.allProperties.map(f=>[f.name,f])),c=new Map(e.superProperties.map(f=>[f.name,f])),u=f=>{if(gt(f))return{types:f.types.map(d=>u(d))};if(Dn(f))return{referenceType:u(f.referenceType)};if(On(f))return{elementType:u(f.elementType)};if(Ar(f)){let d=r.typeToValidationInfo.get(f.value.name);return d?{value:"declared"in d?d.declared:d.inferred}:f}return f};for(let[f,d]of a.entries()){let p=c.get(f);if(p){let T=Xr(d.type,"DeclaredType"),S=Xr(p.type,"DeclaredType");if(!qa(u(d.type),p.type)&&S!=="unknown"){let x=`The assigned type '${T}' is not compatible with the declared property '${f}' of type '${S}'.`;i(d.astNodes,x)}d.optional&&!_A(p)&&o(f)}else s.has(f)&&i(d.astNodes,`A property '${f}' is not expected.`)}let l=new Set;for(let[f,d]of c.entries())!a.get(f)&&!_A(d)&&l.add(f);if(l.size>0){let f=l.size>1?"Properties":"A property",d=l.size>1?"are expected":"is expected",p=Array.from(l).map(T=>`'${T}'`).sort().join(", ");n(`${f} ${p} ${d}.`)}}var H0={validation:{LangiumGrammarValidator:t=>new Cl(t),ValidationResourcesCollector:t=>new pf(t),LangiumGrammarTypesValidator:()=>new mf},lsp:{FoldingRangeProvider:t=>new Hl(t),CodeActionProvider:t=>new Ml(t),SemanticTokenProvider:t=>new Vl(t),Formatter:()=>new Kl,DefinitionProvider:t=>new ff(t),CallHierarchyProvider:t=>new df(t),CompletionProvider:t=>new Gl(t)},references:{ScopeComputation:t=>new $l(t),ScopeProvider:t=>new Ol(t),References:t=>new Yl(t),NameProvider:()=>new Xl}};function NA(t,e){let r=Ki(ic(t),iA,e),n=Ki(nc({shared:r}),oA,H0);return W0(r,n),r.ServiceRegistry.register(n),jb(n),CA(n),{shared:r,grammar:n}}function W0(t,e){t.workspace.DocumentBuilder.onBuildPhase(Ae.IndexedReferences,async(n,i)=>{for(let o of n){await Ue(i);let s=e.validation.ValidationResourcesCollector,a=o.parseResult.value;o.validationResources=s.collectValidationResources(a)}})}var Kg=class{readFile(){throw new Error("Method not implemented.")}readFileSync(){throw new Error("Method not implemented.")}async readDirectory(){return[]}},hf={fileSystemProvider:()=>new Kg};function jl(t){return t.rules.find(e=>M(e)&&e.entry)}function B0(t){return t.rules.filter(e=>pe(e)&&e.hidden)}function ss(t,e){let r=new Set,n=jl(t);if(!n)return new Set(t.rules);let i=[n].concat(B0(t));for(let s of i)PA(s,r,e);let o=new Set;for(let s of t.rules)(r.has(s.name)||pe(s)&&s.hidden)&&o.add(s);return o}function PA(t,e,r){e.add(t.name),Fe(t).forEach(n=>{if(xe(n)||r&&dl(n)){let i=n.rule.ref;i&&!e.has(i.name)&&PA(i,e,r)}})}function ql(t){if(t.terminal)return t.terminal;if(t.type.ref){let e=Qa(t.type.ref);return e?.terminal}}function IA(t){return t.hidden&&!Ur(t).test(" ")}function pi(t,e){return!t||!e?[]:zg(t,e,t.astNode,!0)}function $t(t,e,r){if(!t||!e)return;let n=zg(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 zg(t,e,r,n){if(!n){let i=ve(t.grammarSource,ce);if(i&&i.feature===e)return[t]}return ln(t)&&t.astNode===r?t.content.flatMap(i=>zg(i,e,r,!1)):[]}function Bl(t,e){return t?DA(t,e,t?.astNode):[]}function Mr(t,e,r){if(!t)return;let n=DA(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 DA(t,e,r){if(t.astNode!==r)return[];if(Ze(t.grammarSource)&&t.grammarSource.value===e)return[t];let n=Zh(t).iterator(),i,o=[];do if(i=n.next(),!i.done){let s=i.value;s.astNode===r?Ze(s.grammarSource)&&s.grammarSource.value===e&&o.push(s):n.prune()}while(!i.done);return o}function xs(t){var e;let r=t.astNode;for(;r===((e=t.container)===null||e===void 0?void 0:e.astNode);){let n=ve(t.grammarSource,ce);if(n)return n;t=t.container}}function Qa(t){return zo(t)&&(t=t.$container),OA(t,new Map)}function OA(t,e){var r;function n(i,o){let s;return ve(i,ce)||(s=OA(o,e)),e.set(t,s),s}if(e.has(t))return e.get(t);e.set(t,void 0);for(let i of Fe(t)){if(ce(i)&&i.feature.toLowerCase()==="name")return e.set(t,i),i;if(xe(i)&&M(i.rule.ref))return n(i,i.rule.ref);if(Wt(i)&&(!((r=i.typeRef)===null||r===void 0)&&r.ref))return n(i,i.typeRef.ref)}}function kl(t){var e;let r=NA(hf).grammar,n=r.serializer.JsonSerializer.deserialize(t);return r.shared.workspace.LangiumDocumentFactory.fromModel(n,At.parse(`memory://${(e=n.name)!==null&&e!==void 0?e:"grammar"}.langium`)),n}function $A(t){let e=[],r=t.Grammar;for(let n of r.rules)pe(n)&&IA(n)&&Pb(Ur(n))&&e.push(n.name);return{multilineCommentRules:e,nameRegexp:eg}}var K0=typeof global=="object"&&global&&global.Object===Object&&global,gf=K0;var z0=typeof self=="object"&&self&&self.Object===Object&&self,V0=gf||z0||Function("return this")(),ft=V0;var X0=ft.Symbol,wt=X0;var LA=Object.prototype,Y0=LA.hasOwnProperty,J0=LA.toString,oc=wt?wt.toStringTag:void 0;function Q0(t){var e=Y0.call(t,oc),r=t[oc];try{t[oc]=void 0;var n=!0}catch{}var i=J0.call(t);return n&&(e?t[oc]=r:delete t[oc]),i}var MA=Q0;var Z0=Object.prototype,eD=Z0.toString;function tD(t){return eD.call(t)}var FA=tD;var rD="[object Null]",nD="[object Undefined]",UA=wt?wt.toStringTag:void 0;function iD(t){return t==null?t===void 0?nD:rD:UA&&UA in Object(t)?MA(t):FA(t)}var er=iD;function oD(t){return t!=null&&typeof t=="object"}var it=oD;var sD="[object Symbol]";function aD(t){return typeof t=="symbol"||it(t)&&er(t)==sD}var hn=aD;function cD(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 gn=cD;var uD=Array.isArray,U=uD;var lD=1/0,qA=wt?wt.prototype:void 0,jA=qA?qA.toString:void 0;function GA(t){if(typeof t=="string")return t;if(U(t))return gn(t,GA)+"";if(hn(t))return jA?jA.call(t):"";var e=t+"";return e=="0"&&1/t==-lD?"-0":e}var HA=GA;var fD=/\s/;function dD(t){for(var e=t.length;e--&&fD.test(t.charAt(e)););return e}var WA=dD;var pD=/^\s+/;function mD(t){return t&&t.slice(0,WA(t)+1).replace(pD,"")}var BA=mD;function hD(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Ke=hD;var KA=0/0,gD=/^[-+]0x[0-9a-f]+$/i,yD=/^0b[01]+$/i,TD=/^0o[0-7]+$/i,xD=parseInt;function vD(t){if(typeof t=="number")return t;if(hn(t))return KA;if(Ke(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Ke(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=BA(t);var r=yD.test(t);return r||TD.test(t)?xD(t.slice(2),r?2:8):gD.test(t)?KA:+t}var zA=vD;var VA=1/0,RD=17976931348623157e292;function SD(t){if(!t)return t===0?t:0;if(t=zA(t),t===VA||t===-VA){var e=t<0?-1:1;return e*RD}return t===t?t:0}var XA=SD;function bD(t){var e=XA(t),r=e%1;return e===e?r?e-r:e:0}var yn=bD;function AD(t){return t}var pr=AD;var wD="[object AsyncFunction]",kD="[object Function]",ED="[object GeneratorFunction]",_D="[object Proxy]";function CD(t){if(!Ke(t))return!1;var e=er(t);return e==kD||e==ED||e==wD||e==_D}var tr=CD;var ND=ft["__core-js_shared__"],yf=ND;var YA=function(){var t=/[^.]+$/.exec(yf&&yf.keys&&yf.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function PD(t){return!!YA&&YA in t}var JA=PD;var ID=Function.prototype,DD=ID.toString;function OD(t){if(t!=null){try{return DD.call(t)}catch{}try{return t+""}catch{}}return""}var Un=OD;var $D=/[\\^$.*+?()[\]{}|]/g,LD=/^\[object .+?Constructor\]$/,MD=Function.prototype,FD=Object.prototype,UD=MD.toString,qD=FD.hasOwnProperty,jD=RegExp("^"+UD.call(qD).replace($D,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function GD(t){if(!Ke(t)||JA(t))return!1;var e=tr(t)?jD:LD;return e.test(Un(t))}var QA=GD;function HD(t,e){return t?.[e]}var ZA=HD;function WD(t,e){var r=ZA(t,e);return QA(r)?r:void 0}var mr=WD;var BD=mr(ft,"WeakMap"),Tf=BD;var ew=Object.create,KD=function(){function t(){}return function(e){if(!Ke(e))return{};if(ew)return ew(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),tw=KD;function zD(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 rw=zD;function VD(){}var ze=VD;function XD(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var nw=XD;var YD=800,JD=16,QD=Date.now;function ZD(t){var e=0,r=0;return function(){var n=QD(),i=JD-(n-r);if(r=n,i>0){if(++e>=YD)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var iw=ZD;function eO(t){return function(){return t}}var ow=eO;var tO=function(){try{var t=mr(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Ss=tO;var rO=Ss?function(t,e){return Ss(t,"toString",{configurable:!0,enumerable:!1,value:ow(e),writable:!0})}:pr,sw=rO;var nO=iw(sw),aw=nO;function iO(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var xf=iO;function oO(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 vf=oO;function sO(t){return t!==t}var cw=sO;function aO(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}var uw=aO;function cO(t,e,r){return e===e?uw(t,e,r):vf(t,cw,r)}var bs=cO;function uO(t,e){var r=t==null?0:t.length;return!!r&&bs(t,e,0)>-1}var Rf=uO;var lO=9007199254740991,fO=/^(?:0|[1-9]\d*)$/;function dO(t,e){var r=typeof t;return e=e??lO,!!e&&(r=="number"||r!="symbol"&&fO.test(t))&&t>-1&&t%1==0&&t<e}var Ti=dO;function pO(t,e,r){e=="__proto__"&&Ss?Ss(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var As=pO;function mO(t,e){return t===e||t!==t&&e!==e}var Tn=mO;var hO=Object.prototype,gO=hO.hasOwnProperty;function yO(t,e,r){var n=t[e];(!(gO.call(t,e)&&Tn(n,r))||r===void 0&&!(e in t))&&As(t,e,r)}var xi=yO;function TO(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?As(r,a,c):xi(r,a,c)}return r}var xn=TO;var lw=Math.max;function xO(t,e,r){return e=lw(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=lw(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),rw(t,this,a)}}var fw=xO;function vO(t,e){return aw(fw(t,e,pr),t+"")}var ws=vO;var RO=9007199254740991;function SO(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=RO}var ks=SO;function bO(t){return t!=null&&ks(t.length)&&!tr(t)}var dt=bO;function AO(t,e,r){if(!Ke(r))return!1;var n=typeof e;return(n=="number"?dt(r)&&Ti(e,r.length):n=="string"&&e in r)?Tn(r[e],t):!1}var vi=AO;function wO(t){return ws(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&&vi(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 dw=wO;var kO=Object.prototype;function EO(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||kO;return t===r}var vn=EO;function _O(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var pw=_O;var CO="[object Arguments]";function NO(t){return it(t)&&er(t)==CO}var Vg=NO;var mw=Object.prototype,PO=mw.hasOwnProperty,IO=mw.propertyIsEnumerable,DO=Vg(function(){return arguments}())?Vg:function(t){return it(t)&&PO.call(t,"callee")&&!IO.call(t,"callee")},Ri=DO;function OO(){return!1}var hw=OO;var Tw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,gw=Tw&&typeof module=="object"&&module&&!module.nodeType&&module,$O=gw&&gw.exports===Tw,yw=$O?ft.Buffer:void 0,LO=yw?yw.isBuffer:void 0,MO=LO||hw,qn=MO;var FO="[object Arguments]",UO="[object Array]",qO="[object Boolean]",jO="[object Date]",GO="[object Error]",HO="[object Function]",WO="[object Map]",BO="[object Number]",KO="[object Object]",zO="[object RegExp]",VO="[object Set]",XO="[object String]",YO="[object WeakMap]",JO="[object ArrayBuffer]",QO="[object DataView]",ZO="[object Float32Array]",e$="[object Float64Array]",t$="[object Int8Array]",r$="[object Int16Array]",n$="[object Int32Array]",i$="[object Uint8Array]",o$="[object Uint8ClampedArray]",s$="[object Uint16Array]",a$="[object Uint32Array]",Le={};Le[ZO]=Le[e$]=Le[t$]=Le[r$]=Le[n$]=Le[i$]=Le[o$]=Le[s$]=Le[a$]=!0;Le[FO]=Le[UO]=Le[JO]=Le[qO]=Le[QO]=Le[jO]=Le[GO]=Le[HO]=Le[WO]=Le[BO]=Le[KO]=Le[zO]=Le[VO]=Le[XO]=Le[YO]=!1;function c$(t){return it(t)&&ks(t.length)&&!!Le[er(t)]}var xw=c$;function u$(t){return function(e){return t(e)}}var Rn=u$;var vw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,sc=vw&&typeof module=="object"&&module&&!module.nodeType&&module,l$=sc&&sc.exports===vw,Xg=l$&&gf.process,f$=function(){try{var t=sc&&sc.require&&sc.require("util").types;return t||Xg&&Xg.binding&&Xg.binding("util")}catch{}}(),jr=f$;var Rw=jr&&jr.isTypedArray,d$=Rw?Rn(Rw):xw,Es=d$;var p$=Object.prototype,m$=p$.hasOwnProperty;function h$(t,e){var r=U(t),n=!r&&Ri(t),i=!r&&!n&&qn(t),o=!r&&!n&&!i&&Es(t),s=r||n||i||o,a=s?pw(t.length,String):[],c=a.length;for(var u in t)(e||m$.call(t,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Ti(u,c)))&&a.push(u);return a}var Sf=h$;function g$(t,e){return function(r){return t(e(r))}}var bf=g$;var y$=bf(Object.keys,Object),Sw=y$;var T$=Object.prototype,x$=T$.hasOwnProperty;function v$(t){if(!vn(t))return Sw(t);var e=[];for(var r in Object(t))x$.call(t,r)&&r!="constructor"&&e.push(r);return e}var Af=v$;function R$(t){return dt(t)?Sf(t):Af(t)}var _e=R$;var S$=Object.prototype,b$=S$.hasOwnProperty,A$=dw(function(t,e){if(vn(e)||dt(e)){xn(e,_e(e),t);return}for(var r in e)b$.call(e,r)&&xi(t,r,e[r])}),Lt=A$;function w$(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var bw=w$;var k$=Object.prototype,E$=k$.hasOwnProperty;function _$(t){if(!Ke(t))return bw(t);var e=vn(t),r=[];for(var n in t)n=="constructor"&&(e||!E$.call(t,n))||r.push(n);return r}var Aw=_$;function C$(t){return dt(t)?Sf(t,!0):Aw(t)}var Si=C$;var N$=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,P$=/^\w*$/;function I$(t,e){if(U(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||hn(t)?!0:P$.test(t)||!N$.test(t)||e!=null&&t in Object(e)}var _s=I$;var D$=mr(Object,"create"),jn=D$;function O$(){this.__data__=jn?jn(null):{},this.size=0}var ww=O$;function $$(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var kw=$$;var L$="__lodash_hash_undefined__",M$=Object.prototype,F$=M$.hasOwnProperty;function U$(t){var e=this.__data__;if(jn){var r=e[t];return r===L$?void 0:r}return F$.call(e,t)?e[t]:void 0}var Ew=U$;var q$=Object.prototype,j$=q$.hasOwnProperty;function G$(t){var e=this.__data__;return jn?e[t]!==void 0:j$.call(e,t)}var _w=G$;var H$="__lodash_hash_undefined__";function W$(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=jn&&e===void 0?H$:e,this}var Cw=W$;function Cs(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])}}Cs.prototype.clear=ww;Cs.prototype.delete=kw;Cs.prototype.get=Ew;Cs.prototype.has=_w;Cs.prototype.set=Cw;var Yg=Cs;function B$(){this.__data__=[],this.size=0}var Nw=B$;function K$(t,e){for(var r=t.length;r--;)if(Tn(t[r][0],e))return r;return-1}var bi=K$;var z$=Array.prototype,V$=z$.splice;function X$(t){var e=this.__data__,r=bi(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():V$.call(e,r,1),--this.size,!0}var Pw=X$;function Y$(t){var e=this.__data__,r=bi(e,t);return r<0?void 0:e[r][1]}var Iw=Y$;function J$(t){return bi(this.__data__,t)>-1}var Dw=J$;function Q$(t,e){var r=this.__data__,n=bi(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var Ow=Q$;function Ns(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])}}Ns.prototype.clear=Nw;Ns.prototype.delete=Pw;Ns.prototype.get=Iw;Ns.prototype.has=Dw;Ns.prototype.set=Ow;var Ai=Ns;var Z$=mr(ft,"Map"),wi=Z$;function eL(){this.size=0,this.__data__={hash:new Yg,map:new(wi||Ai),string:new Yg}}var $w=eL;function tL(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Lw=tL;function rL(t,e){var r=t.__data__;return Lw(e)?r[typeof e=="string"?"string":"hash"]:r.map}var ki=rL;function nL(t){var e=ki(this,t).delete(t);return this.size-=e?1:0,e}var Mw=nL;function iL(t){return ki(this,t).get(t)}var Fw=iL;function oL(t){return ki(this,t).has(t)}var Uw=oL;function sL(t,e){var r=ki(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var qw=sL;function Ps(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])}}Ps.prototype.clear=$w;Ps.prototype.delete=Mw;Ps.prototype.get=Fw;Ps.prototype.has=Uw;Ps.prototype.set=qw;var io=Ps;var aL="Expected a function";function Jg(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(aL);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(Jg.Cache||io),r}Jg.Cache=io;var jw=Jg;var cL=500;function uL(t){var e=jw(t,function(n){return r.size===cL&&r.clear(),n}),r=e.cache;return e}var Gw=uL;var lL=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,fL=/\\(\\)?/g,dL=Gw(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(lL,function(r,n,i,o){e.push(i?o.replace(fL,"$1"):n||r)}),e}),Hw=dL;function pL(t){return t==null?"":HA(t)}var Ww=pL;function mL(t,e){return U(t)?t:_s(t,e)?[t]:Hw(Ww(t))}var Ei=mL;var hL=1/0;function gL(t){if(typeof t=="string"||hn(t))return t;var e=t+"";return e=="0"&&1/t==-hL?"-0":e}var Sn=gL;function yL(t,e){e=Ei(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Sn(e[r++])];return r&&r==n?t:void 0}var Is=yL;function TL(t,e,r){var n=t==null?void 0:Is(t,e);return n===void 0?r:n}var Bw=TL;function xL(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var Ds=xL;var Kw=wt?wt.isConcatSpreadable:void 0;function vL(t){return U(t)||Ri(t)||!!(Kw&&t&&t[Kw])}var zw=vL;function Vw(t,e,r,n,i){var o=-1,s=t.length;for(r||(r=zw),i||(i=[]);++o<s;){var a=t[o];e>0&&r(a)?e>1?Vw(a,e-1,r,n,i):Ds(i,a):n||(i[i.length]=a)}return i}var Os=Vw;function RL(t){var e=t==null?0:t.length;return e?Os(t,1):[]}var ot=RL;var SL=bf(Object.getPrototypeOf,Object),wf=SL;function bL(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 kf=bL;function AL(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 Xw=AL;function wL(){this.__data__=new Ai,this.size=0}var Yw=wL;function kL(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Jw=kL;function EL(t){return this.__data__.get(t)}var Qw=EL;function _L(t){return this.__data__.has(t)}var Zw=_L;var CL=200;function NL(t,e){var r=this.__data__;if(r instanceof Ai){var n=r.__data__;if(!wi||n.length<CL-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new io(n)}return r.set(t,e),this.size=r.size,this}var ek=NL;function $s(t){var e=this.__data__=new Ai(t);this.size=e.size}$s.prototype.clear=Yw;$s.prototype.delete=Jw;$s.prototype.get=Qw;$s.prototype.has=Zw;$s.prototype.set=ek;var _i=$s;function PL(t,e){return t&&xn(e,_e(e),t)}var tk=PL;function IL(t,e){return t&&xn(e,Si(e),t)}var rk=IL;var sk=typeof exports=="object"&&exports&&!exports.nodeType&&exports,nk=sk&&typeof module=="object"&&module&&!module.nodeType&&module,DL=nk&&nk.exports===sk,ik=DL?ft.Buffer:void 0,ok=ik?ik.allocUnsafe:void 0;function OL(t,e){if(e)return t.slice();var r=t.length,n=ok?ok(r):new t.constructor(r);return t.copy(n),n}var ak=OL;function $L(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 Ls=$L;function LL(){return[]}var Ef=LL;var ML=Object.prototype,FL=ML.propertyIsEnumerable,ck=Object.getOwnPropertySymbols,UL=ck?function(t){return t==null?[]:(t=Object(t),Ls(ck(t),function(e){return FL.call(t,e)}))}:Ef,Ms=UL;function qL(t,e){return xn(t,Ms(t),e)}var uk=qL;var jL=Object.getOwnPropertySymbols,GL=jL?function(t){for(var e=[];t;)Ds(e,Ms(t)),t=wf(t);return e}:Ef,_f=GL;function HL(t,e){return xn(t,_f(t),e)}var lk=HL;function WL(t,e,r){var n=e(t);return U(t)?n:Ds(n,r(t))}var Cf=WL;function BL(t){return Cf(t,_e,Ms)}var ac=BL;function KL(t){return Cf(t,Si,_f)}var Nf=KL;var zL=mr(ft,"DataView"),Pf=zL;var VL=mr(ft,"Promise"),If=VL;var XL=mr(ft,"Set"),Ci=XL;var fk="[object Map]",YL="[object Object]",dk="[object Promise]",pk="[object Set]",mk="[object WeakMap]",hk="[object DataView]",JL=Un(Pf),QL=Un(wi),ZL=Un(If),eM=Un(Ci),tM=Un(Tf),oo=er;(Pf&&oo(new Pf(new ArrayBuffer(1)))!=hk||wi&&oo(new wi)!=fk||If&&oo(If.resolve())!=dk||Ci&&oo(new Ci)!=pk||Tf&&oo(new Tf)!=mk)&&(oo=function(t){var e=er(t),r=e==YL?t.constructor:void 0,n=r?Un(r):"";if(n)switch(n){case JL:return hk;case QL:return fk;case ZL:return dk;case eM:return pk;case tM:return mk}return e});var Zr=oo;var rM=Object.prototype,nM=rM.hasOwnProperty;function iM(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&nM.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var gk=iM;var oM=ft.Uint8Array,Fs=oM;function sM(t){var e=new t.constructor(t.byteLength);return new Fs(e).set(new Fs(t)),e}var Us=sM;function aM(t,e){var r=e?Us(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var yk=aM;var cM=/\w*$/;function uM(t){var e=new t.constructor(t.source,cM.exec(t));return e.lastIndex=t.lastIndex,e}var Tk=uM;var xk=wt?wt.prototype:void 0,vk=xk?xk.valueOf:void 0;function lM(t){return vk?Object(vk.call(t)):{}}var Rk=lM;function fM(t,e){var r=e?Us(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Sk=fM;var dM="[object Boolean]",pM="[object Date]",mM="[object Map]",hM="[object Number]",gM="[object RegExp]",yM="[object Set]",TM="[object String]",xM="[object Symbol]",vM="[object ArrayBuffer]",RM="[object DataView]",SM="[object Float32Array]",bM="[object Float64Array]",AM="[object Int8Array]",wM="[object Int16Array]",kM="[object Int32Array]",EM="[object Uint8Array]",_M="[object Uint8ClampedArray]",CM="[object Uint16Array]",NM="[object Uint32Array]";function PM(t,e,r){var n=t.constructor;switch(e){case vM:return Us(t);case dM:case pM:return new n(+t);case RM:return yk(t,r);case SM:case bM:case AM:case wM:case kM:case EM:case _M:case CM:case NM:return Sk(t,r);case mM:return new n;case hM:case TM:return new n(t);case gM:return Tk(t);case yM:return new n;case xM:return Rk(t)}}var bk=PM;function IM(t){return typeof t.constructor=="function"&&!vn(t)?tw(wf(t)):{}}var Ak=IM;var DM="[object Map]";function OM(t){return it(t)&&Zr(t)==DM}var wk=OM;var kk=jr&&jr.isMap,$M=kk?Rn(kk):wk,Ek=$M;var LM="[object Set]";function MM(t){return it(t)&&Zr(t)==LM}var _k=MM;var Ck=jr&&jr.isSet,FM=Ck?Rn(Ck):_k,Nk=FM;var UM=1,qM=2,jM=4,Pk="[object Arguments]",GM="[object Array]",HM="[object Boolean]",WM="[object Date]",BM="[object Error]",Ik="[object Function]",KM="[object GeneratorFunction]",zM="[object Map]",VM="[object Number]",Dk="[object Object]",XM="[object RegExp]",YM="[object Set]",JM="[object String]",QM="[object Symbol]",ZM="[object WeakMap]",eF="[object ArrayBuffer]",tF="[object DataView]",rF="[object Float32Array]",nF="[object Float64Array]",iF="[object Int8Array]",oF="[object Int16Array]",sF="[object Int32Array]",aF="[object Uint8Array]",cF="[object Uint8ClampedArray]",uF="[object Uint16Array]",lF="[object Uint32Array]",Ce={};Ce[Pk]=Ce[GM]=Ce[eF]=Ce[tF]=Ce[HM]=Ce[WM]=Ce[rF]=Ce[nF]=Ce[iF]=Ce[oF]=Ce[sF]=Ce[zM]=Ce[VM]=Ce[Dk]=Ce[XM]=Ce[YM]=Ce[JM]=Ce[QM]=Ce[aF]=Ce[cF]=Ce[uF]=Ce[lF]=!0;Ce[BM]=Ce[Ik]=Ce[ZM]=!1;function Df(t,e,r,n,i,o){var s,a=e&UM,c=e&qM,u=e&jM;if(r&&(s=i?r(t,n,i,o):r(t)),s!==void 0)return s;if(!Ke(t))return t;var l=U(t);if(l){if(s=gk(t),!a)return nw(t,s)}else{var f=Zr(t),d=f==Ik||f==KM;if(qn(t))return ak(t,a);if(f==Dk||f==Pk||d&&!i){if(s=c||d?{}:Ak(t),!a)return c?lk(t,rk(s,t)):uk(t,tk(s,t))}else{if(!Ce[f])return i?t:{};s=bk(t,f,a)}}o||(o=new _i);var p=o.get(t);if(p)return p;o.set(t,s),Nk(t)?t.forEach(function(A){s.add(Df(A,e,r,A,t,o))}):Ek(t)&&t.forEach(function(A,x){s.set(x,Df(A,e,r,x,t,o))});var T=u?c?Nf:ac:c?Si:_e,S=l?void 0:T(t);return xf(S||t,function(A,x){S&&(x=A,A=t[x]),xi(s,x,Df(A,e,r,x,t,o))}),s}var Ok=Df;var fF=4;function dF(t){return Ok(t,fF)}var Ne=dF;function pF(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 bn=pF;var mF="__lodash_hash_undefined__";function hF(t){return this.__data__.set(t,mF),this}var $k=hF;function gF(t){return this.__data__.has(t)}var Lk=gF;function Of(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new io;++e<r;)this.add(t[e])}Of.prototype.add=Of.prototype.push=$k;Of.prototype.has=Lk;var qs=Of;function yF(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 $f=yF;function TF(t,e){return t.has(e)}var js=TF;var xF=1,vF=2;function RF(t,e,r,n,i,o){var s=r&xF,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 f=-1,d=!0,p=r&vF?new qs:void 0;for(o.set(t,e),o.set(e,t);++f<a;){var T=t[f],S=e[f];if(n)var A=s?n(S,T,f,e,t,o):n(T,S,f,t,e,o);if(A!==void 0){if(A)continue;d=!1;break}if(p){if(!$f(e,function(x,h){if(!js(p,h)&&(T===x||i(T,x,r,n,o)))return p.push(h)})){d=!1;break}}else if(!(T===S||i(T,S,r,n,o))){d=!1;break}}return o.delete(t),o.delete(e),d}var Lf=RF;function SF(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var Mk=SF;function bF(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Gs=bF;var AF=1,wF=2,kF="[object Boolean]",EF="[object Date]",_F="[object Error]",CF="[object Map]",NF="[object Number]",PF="[object RegExp]",IF="[object Set]",DF="[object String]",OF="[object Symbol]",$F="[object ArrayBuffer]",LF="[object DataView]",Fk=wt?wt.prototype:void 0,Qg=Fk?Fk.valueOf:void 0;function MF(t,e,r,n,i,o,s){switch(r){case LF:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case $F:return!(t.byteLength!=e.byteLength||!o(new Fs(t),new Fs(e)));case kF:case EF:case NF:return Tn(+t,+e);case _F:return t.name==e.name&&t.message==e.message;case PF:case DF:return t==e+"";case CF:var a=Mk;case IF:var c=n&AF;if(a||(a=Gs),t.size!=e.size&&!c)return!1;var u=s.get(t);if(u)return u==e;n|=wF,s.set(t,e);var l=Lf(a(t),a(e),n,i,o,s);return s.delete(t),l;case OF:if(Qg)return Qg.call(t)==Qg.call(e)}return!1}var Uk=MF;var FF=1,UF=Object.prototype,qF=UF.hasOwnProperty;function jF(t,e,r,n,i,o){var s=r&FF,a=ac(t),c=a.length,u=ac(e),l=u.length;if(c!=l&&!s)return!1;for(var f=c;f--;){var d=a[f];if(!(s?d in e:qF.call(e,d)))return!1}var p=o.get(t),T=o.get(e);if(p&&T)return p==e&&T==t;var S=!0;o.set(t,e),o.set(e,t);for(var A=s;++f<c;){d=a[f];var x=t[d],h=e[d];if(n)var m=s?n(h,x,d,e,t,o):n(x,h,d,t,e,o);if(!(m===void 0?x===h||i(x,h,r,n,o):m)){S=!1;break}A||(A=d=="constructor")}if(S&&!A){var b=t.constructor,_=e.constructor;b!=_&&"constructor"in t&&"constructor"in e&&!(typeof b=="function"&&b instanceof b&&typeof _=="function"&&_ instanceof _)&&(S=!1)}return o.delete(t),o.delete(e),S}var qk=jF;var GF=1,jk="[object Arguments]",Gk="[object Array]",Mf="[object Object]",HF=Object.prototype,Hk=HF.hasOwnProperty;function WF(t,e,r,n,i,o){var s=U(t),a=U(e),c=s?Gk:Zr(t),u=a?Gk:Zr(e);c=c==jk?Mf:c,u=u==jk?Mf:u;var l=c==Mf,f=u==Mf,d=c==u;if(d&&qn(t)){if(!qn(e))return!1;s=!0,l=!1}if(d&&!l)return o||(o=new _i),s||Es(t)?Lf(t,e,r,n,i,o):Uk(t,e,c,r,n,i,o);if(!(r&GF)){var p=l&&Hk.call(t,"__wrapped__"),T=f&&Hk.call(e,"__wrapped__");if(p||T){var S=p?t.value():t,A=T?e.value():e;return o||(o=new _i),i(S,A,r,n,o)}}return d?(o||(o=new _i),qk(t,e,r,n,i,o)):!1}var Wk=WF;function Bk(t,e,r,n,i){return t===e?!0:t==null||e==null||!it(t)&&!it(e)?t!==t&&e!==e:Wk(t,e,r,n,Bk,i)}var Ff=Bk;var BF=1,KF=2;function zF(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 f=new _i;if(n)var d=n(u,l,c,t,e,f);if(!(d===void 0?Ff(l,u,BF|KF,n,f):d))return!1}}return!0}var Kk=zF;function VF(t){return t===t&&!Ke(t)}var Uf=VF;function XF(t){for(var e=_e(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,Uf(i)]}return e}var zk=XF;function YF(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var qf=YF;function JF(t){var e=zk(t);return e.length==1&&e[0][2]?qf(e[0][0],e[0][1]):function(r){return r===t||Kk(r,t,e)}}var Vk=JF;function QF(t,e){return t!=null&&e in Object(t)}var Xk=QF;function ZF(t,e,r){e=Ei(e,t);for(var n=-1,i=e.length,o=!1;++n<i;){var s=Sn(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&&ks(i)&&Ti(s,i)&&(U(t)||Ri(t)))}var jf=ZF;function e1(t,e){return t!=null&&jf(t,e,Xk)}var Yk=e1;var t1=1,r1=2;function n1(t,e){return _s(t)&&Uf(e)?qf(Sn(t),e):function(r){var n=Bw(r,t);return n===void 0&&n===e?Yk(r,t):Ff(e,n,t1|r1)}}var Jk=n1;function i1(t){return function(e){return e?.[t]}}var Qk=i1;function o1(t){return function(e){return Is(e,t)}}var Zk=o1;function s1(t){return _s(t)?Qk(Sn(t)):Zk(t)}var eE=s1;function a1(t){return typeof t=="function"?t:t==null?pr:typeof t=="object"?U(t)?Jk(t[0],t[1]):Vk(t):eE(t)}var et=a1;function c1(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 tE=c1;function u1(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 rE=u1;var l1=rE(),nE=l1;function f1(t,e){return t&&nE(t,e,_e)}var iE=f1;function d1(t,e){return function(r,n){if(r==null)return r;if(!dt(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 oE=d1;var p1=oE(iE),hr=p1;function m1(t,e,r,n){return hr(t,function(i,o,s){e(n,i,r(i),s)}),n}var sE=m1;function h1(t,e){return function(r,n){var i=U(r)?tE:sE,o=e?e():{};return i(r,t,et(n,2),o)}}var aE=h1;var cE=Object.prototype,g1=cE.hasOwnProperty,y1=ws(function(t,e){t=Object(t);var r=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&vi(e[0],e[1],i)&&(n=1);++r<n;)for(var o=e[r],s=Si(o),a=-1,c=s.length;++a<c;){var u=s[a],l=t[u];(l===void 0||Tn(l,cE[u])&&!g1.call(t,u))&&(t[u]=o[u])}return t}),Hs=y1;function T1(t){return it(t)&&dt(t)}var Zg=T1;function x1(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 Gf=x1;var v1=200;function R1(t,e,r,n){var i=-1,o=Rf,s=!0,a=t.length,c=[],u=e.length;if(!a)return c;r&&(e=gn(e,Rn(r))),n?(o=Gf,s=!1):e.length>=v1&&(o=js,s=!1,e=new qs(e));e:for(;++i<a;){var l=t[i],f=r==null?l:r(l);if(l=n||l!==0?l:0,s&&f===f){for(var d=u;d--;)if(e[d]===f)continue e;c.push(l)}else o(e,f,n)||c.push(l)}return c}var uE=R1;var S1=ws(function(t,e){return Zg(t)?uE(t,Os(e,1,Zg,!0)):[]}),Ni=S1;function b1(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var An=b1;function A1(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:yn(e),kf(t,e<0?0:e,n)):[]}var st=A1;function w1(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:yn(e),e=n-e,kf(t,0,e<0?0:e)):[]}var Gn=w1;function k1(t){return typeof t=="function"?t:pr}var lE=k1;function E1(t,e){var r=U(t)?xf:hr;return r(t,lE(e))}var O=E1;function _1(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 fE=_1;function C1(t,e){var r=!0;return hr(t,function(n,i,o){return r=!!e(n,i,o),r}),r}var dE=C1;function N1(t,e,r){var n=U(t)?fE:dE;return r&&vi(t,e,r)&&(e=void 0),n(t,et(e,3))}var zt=N1;function P1(t,e){var r=[];return hr(t,function(n,i,o){e(n,i,o)&&r.push(n)}),r}var Hf=P1;function I1(t,e){var r=U(t)?Ls:Hf;return r(t,et(e,3))}var kt=I1;function D1(t){return function(e,r,n){var i=Object(e);if(!dt(e)){var o=et(r,3);e=_e(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 pE=D1;var O1=Math.max;function $1(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:yn(r);return i<0&&(i=O1(n+i,0)),vf(t,et(e,3),i)}var mE=$1;var L1=pE(mE),wn=L1;function M1(t){return t&&t.length?t[0]:void 0}var Et=M1;function F1(t,e){var r=-1,n=dt(t)?Array(t.length):[];return hr(t,function(i,o,s){n[++r]=e(i,o,s)}),n}var hE=F1;function U1(t,e){var r=U(t)?gn:hE;return r(t,et(e,3))}var C=U1;function q1(t,e){return Os(C(t,e),1)}var Mt=q1;var j1=Object.prototype,G1=j1.hasOwnProperty,H1=aE(function(t,e,r){G1.call(t,r)?t[r].push(e):As(t,r,[e])}),ey=H1;var W1=Object.prototype,B1=W1.hasOwnProperty;function K1(t,e){return t!=null&&B1.call(t,e)}var gE=K1;function z1(t,e){return t!=null&&jf(t,e,gE)}var F=z1;var V1="[object String]";function X1(t){return typeof t=="string"||!U(t)&&it(t)&&er(t)==V1}var yt=X1;function Y1(t,e){return gn(e,function(r){return t[r]})}var yE=Y1;function J1(t){return t==null?[]:yE(t,_e(t))}var Se=J1;var Q1=Math.max;function Z1(t,e,r,n){t=dt(t)?t:Se(t),r=r&&!n?yn(r):0;var i=t.length;return r<0&&(r=Q1(i+r,0)),yt(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&bs(t,e,r)>-1}var qe=Z1;var eU=Math.max;function tU(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:yn(r);return i<0&&(i=eU(n+i,0)),bs(t,e,i)}var Wf=tU;var rU="[object Map]",nU="[object Set]",iU=Object.prototype,oU=iU.hasOwnProperty;function sU(t){if(t==null)return!0;if(dt(t)&&(U(t)||typeof t=="string"||typeof t.splice=="function"||qn(t)||Es(t)||Ri(t)))return!t.length;var e=Zr(t);if(e==rU||e==nU)return!t.size;if(vn(t))return!Af(t).length;for(var r in t)if(oU.call(t,r))return!1;return!0}var Z=sU;var aU="[object RegExp]";function cU(t){return it(t)&&er(t)==aU}var TE=cU;var xE=jr&&jr.isRegExp,uU=xE?Rn(xE):TE,Gr=uU;function lU(t){return t===void 0}var Vt=lU;function fU(t,e){return t<e}var vE=fU;function dU(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&&!hn(s):r(s,a)))var a=s,c=o}return c}var RE=dU;function pU(t){return t&&t.length?RE(t,pr,vE):void 0}var SE=pU;var mU="Expected a function";function hU(t){if(typeof t!="function")throw new TypeError(mU);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 bE=hU;function gU(t,e,r,n){if(!Ke(t))return t;e=Ei(e,t);for(var i=-1,o=e.length,s=o-1,a=t;a!=null&&++i<o;){var c=Sn(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=Ke(l)?l:Ti(e[i+1])?[]:{})}xi(a,c,u),a=a[c]}return t}var AE=gU;function yU(t,e,r){for(var n=-1,i=e.length,o={};++n<i;){var s=e[n],a=Is(t,s);r(a,s)&&AE(o,Ei(s,t),a)}return o}var wE=yU;function TU(t,e){if(t==null)return{};var r=gn(Nf(t),function(n){return[n]});return e=et(e),wE(t,r,function(n,i){return e(n,i[0])})}var gr=TU;function xU(t,e,r,n,i){return i(t,function(o,s,a){r=n?(n=!1,o):e(r,o,s,a)}),r}var kE=xU;function vU(t,e,r){var n=U(t)?Xw:kE,i=arguments.length<3;return n(t,et(e,4),r,i,hr)}var Ve=vU;function RU(t,e){var r=U(t)?Ls:Hf;return r(t,bE(et(e,3)))}var Pi=RU;function SU(t,e){var r;return hr(t,function(n,i,o){return r=e(n,i,o),!r}),!!r}var EE=SU;function bU(t,e,r){var n=U(t)?$f:EE;return r&&vi(t,e,r)&&(e=void 0),n(t,et(e,3))}var cc=bU;var AU=1/0,wU=Ci&&1/Gs(new Ci([,-0]))[1]==AU?function(t){return new Ci(t)}:ze,_E=wU;var kU=200;function EU(t,e,r){var n=-1,i=Rf,o=t.length,s=!0,a=[],c=a;if(r)s=!1,i=Gf;else if(o>=kU){var u=e?null:_E(t);if(u)return Gs(u);s=!1,i=js,c=new qs}else c=e?[]:a;e:for(;++n<o;){var l=t[n],f=e?e(l):l;if(l=r||l!==0?l:0,s&&f===f){for(var d=c.length;d--;)if(c[d]===f)continue e;e&&c.push(f),a.push(l)}else i(c,f,r)||(c!==a&&c.push(f),a.push(l))}return a}var Bf=EU;function _U(t){return t&&t.length?Bf(t):[]}var Ws=_U;function CU(t,e){return t&&t.length?Bf(t,et(e,2)):[]}var CE=CU;function Bs(t){console&&console.error&&console.error(`Error: ${t}`)}function uc(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function lc(t){let e=new Date().getTime(),r=t();return{time:new Date().getTime()-e,value:r}}function fc(t){function e(){}e.prototype=t;let r=new e;function n(){return typeof r.bar}return n(),n(),t;(0,eval)(t)}function NU(t){return PU(t)?t.LABEL:t.name}function PU(t){return yt(t.LABEL)&&t.LABEL!==""}var Cr=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),O(this.definition,r=>{r.accept(e)})}},me=class extends Cr{constructor(e){super([]),this.idx=1,Lt(this,gr(e,r=>r!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},rr=class extends Cr{constructor(e){super(e.definition),this.orgText="",Lt(this,gr(e,r=>r!==void 0))}},Pe=class extends Cr{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Lt(this,gr(e,r=>r!==void 0))}},he=class extends Cr{constructor(e){super(e.definition),this.idx=1,Lt(this,gr(e,r=>r!==void 0))}},Ie=class extends Cr{constructor(e){super(e.definition),this.idx=1,Lt(this,gr(e,r=>r!==void 0))}},De=class extends Cr{constructor(e){super(e.definition),this.idx=1,Lt(this,gr(e,r=>r!==void 0))}},re=class extends Cr{constructor(e){super(e.definition),this.idx=1,Lt(this,gr(e,r=>r!==void 0))}},we=class extends Cr{constructor(e){super(e.definition),this.idx=1,Lt(this,gr(e,r=>r!==void 0))}},ke=class extends Cr{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,Lt(this,gr(e,r=>r!==void 0))}},ee=class{constructor(e){this.idx=1,Lt(this,gr(e,r=>r!==void 0))}accept(e){e.visit(this)}};function Kf(t){return C(t,Ks)}function Ks(t){function e(r){return C(r,Ks)}if(t instanceof me){let r={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return yt(t.label)&&(r.label=t.label),r}else{if(t instanceof Pe)return{type:"Alternative",definition:e(t.definition)};if(t instanceof he)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof Ie)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof De)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:Ks(new ee({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof we)return{type:"RepetitionWithSeparator",idx:t.idx,separator:Ks(new ee({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof re)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof ke)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof ee){let r={type:"Terminal",name:t.terminalType.name,label:NU(t.terminalType),idx:t.idx};yt(t.label)&&(r.terminalLabel=t.label);let n=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(r.pattern=Gr(n)?n.source:n),r}else{if(t instanceof rr)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}var nr=class{visit(e){let r=e;switch(r.constructor){case me:return this.visitNonTerminal(r);case Pe:return this.visitAlternative(r);case he:return this.visitOption(r);case Ie:return this.visitRepetitionMandatory(r);case De:return this.visitRepetitionMandatoryWithSeparator(r);case we:return this.visitRepetitionWithSeparator(r);case re:return this.visitRepetition(r);case ke:return this.visitAlternation(r);case ee:return this.visitTerminal(r);case rr: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 ty(t){return t instanceof Pe||t instanceof he||t instanceof re||t instanceof Ie||t instanceof De||t instanceof we||t instanceof ee||t instanceof rr}function so(t,e=[]){return t instanceof he||t instanceof re||t instanceof we?!0:t instanceof ke?cc(t.definition,n=>so(n,e)):t instanceof me&&qe(e,t)?!1:t instanceof Cr?(t instanceof me&&e.push(t),zt(t.definition,n=>so(n,e))):!1}function ry(t){return t instanceof ke}function yr(t){if(t instanceof me)return"SUBRULE";if(t instanceof he)return"OPTION";if(t instanceof ke)return"OR";if(t instanceof Ie)return"AT_LEAST_ONE";if(t instanceof De)return"AT_LEAST_ONE_SEP";if(t instanceof we)return"MANY_SEP";if(t instanceof re)return"MANY";if(t instanceof ee)return"CONSUME";throw Error("non exhaustive match")}var Hn=class{walk(e,r=[]){O(e.definition,(n,i)=>{let o=st(e.definition,i+1);if(n instanceof me)this.walkProdRef(n,o,r);else if(n instanceof ee)this.walkTerminal(n,o,r);else if(n instanceof Pe)this.walkFlat(n,o,r);else if(n instanceof he)this.walkOption(n,o,r);else if(n instanceof Ie)this.walkAtLeastOne(n,o,r);else if(n instanceof De)this.walkAtLeastOneSep(n,o,r);else if(n instanceof we)this.walkManySep(n,o,r);else if(n instanceof re)this.walkMany(n,o,r);else if(n instanceof ke)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 he({definition:e.definition})].concat(r,n);this.walk(e,i)}walkAtLeastOneSep(e,r,n){let i=NE(e,r,n);this.walk(e,i)}walkMany(e,r,n){let i=[new he({definition:e.definition})].concat(r,n);this.walk(e,i)}walkManySep(e,r,n){let i=NE(e,r,n);this.walk(e,i)}walkOr(e,r,n){let i=r.concat(n);O(e.definition,o=>{let s=new Pe({definition:[o]});this.walk(s,i)})}};function NE(t,e,r){return[new he({definition:[new ee({terminalType:t.separator})].concat(t.definition)})].concat(e,r)}function ao(t){if(t instanceof me)return ao(t.referencedRule);if(t instanceof ee)return OU(t);if(ty(t))return IU(t);if(ry(t))return DU(t);throw Error("non exhaustive match")}function IU(t){let e=[],r=t.definition,n=0,i=r.length>n,o,s=!0;for(;i&&s;)o=r[n],s=so(o),e=e.concat(ao(o)),n=n+1,i=r.length>n;return Ws(e)}function DU(t){let e=C(t.definition,r=>ao(r));return Ws(ot(e))}function OU(t){return[t.terminalType]}var zf="_~IN~_";var ny=class extends Hn{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=$U(e.referencedRule,e.idx)+this.topProd.name,o=r.concat(n),s=new Pe({definition:o}),a=ao(s);this.follows[i]=a}};function PE(t){let e={};return O(t,r=>{let n=new ny(r).startWalking();Lt(e,n)}),e}function $U(t,e){return t.name+e+zf}var Vf={},LU=new Qi;function zs(t){let e=t.toString();if(Vf.hasOwnProperty(e))return Vf[e];{let r=LU.pattern(e);return Vf[e]=r,r}}function IE(){Vf={}}var OE="Complement Sets are not supported for first char optimization",dc=`Unable to use "first char" lexer optimizations:
|
|
57
|
-
`;function
|
|
56
|
+
`.repeat(a)}${o}`,range:e}}fitIntoOptions(e,r,n){return n.allowMore?e=Math.max(r,e):n.allowLess&&(e=Math.min(r,e)),e}findFittingMove(e,r,n){if(r.length===0)return;if(r.length===1)return r[0];let i=e.end.line-e.start.line;for(let o of r){if(o.lines!==void 0&&i<=o.lines)return o;if(o.lines===void 0&&i===0)return o}return r[r.length-1]}iterateCstTree(e,r){let i=e.parseResult.value.$cstNode;return i?new Or(i,o=>this.iterateCst(o,r)):Bo}iterateCst(e,r){if(!Kr(e))return Bo;let n=r.indentation;return new xr(()=>({index:0}),i=>i.index<e.content.length?{done:!1,value:e.content[i.index++]}:(r.indentation=n,Zt))}},qg=class{constructor(e,r){this.astNode=e,this.collector=r}node(e){return new Jr(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){let r=[];for(let n of e)n.$cstNode&&r.push(n.$cstNode);return new Jr(r,this.collector)}property(e,r){let n=$t(this.astNode.$cstNode,e,r);return new Jr(n?[n]:[],this.collector)}properties(...e){let r=[];for(let n of e){let i=mi(this.astNode.$cstNode,n);r.push(...i)}return new Jr(r,this.collector)}keyword(e,r){let n=Lr(this.astNode.$cstNode,e,r);return new Jr(n?[n]:[],this.collector)}keywords(...e){let r=[];for(let n of e){let i=Bl(this.astNode.$cstNode,n);r.push(...i)}return new Jr(r,this.collector)}cst(e){return new Jr([...e],this.collector)}interior(e,r){let n=e.nodes,i=r.nodes;if(n.length!==1||i.length!==1)return new Jr([],this.collector);let o=n[0],s=i[0];if(o.offset>s.offset){let a=o;o=s,s=a}return new Jr(vS(o,s),this.collector)}},Jr=class t{constructor(e,r){this.nodes=e,this.collector=r}prepend(e){for(let r of this.nodes)this.collector(r,"prepend",e);return this}append(e){for(let r of this.nodes)this.collector(r,"append",e);return this}surround(e){for(let r of this.nodes)this.collector(r,"prepend",e),this.collector(r,"append",e);return this}slice(e,r){return new t(this.nodes.slice(e,r),this.collector)}},G;(function(t){function e(...l){return{options:{},moves:l.flatMap(f=>f.moves).sort(u)}}t.fit=e;function r(l){return i(0,l)}t.noSpace=r;function n(l){return i(1,l)}t.oneSpace=n;function i(l,f){return{options:f??{},moves:[{characters:l}]}}t.spaces=i;function o(l){return s(1,l)}t.newLine=o;function s(l,f){return{options:f??{},moves:[{lines:l}]}}t.newLines=s;function a(l){return{options:l??{},moves:[{tabs:1,lines:1}]}}t.indent=a;function c(l){return{options:l??{},moves:[{tabs:0}]}}t.noIndent=c;function u(l,f){var d,p,T,R,A,S;let h=(d=l.lines)!==null&&d!==void 0?d:0,m=(p=f.lines)!==null&&p!==void 0?p:0,b=(T=l.tabs)!==null&&T!==void 0?T:0,_=(R=f.tabs)!==null&&R!==void 0?R:0,V=(A=l.characters)!==null&&A!==void 0?A:0,Ct=(S=f.characters)!==null&&S!==void 0?S:0;return h<m?-1:h>m?1:b<_?-1:b>_?1:V<Ct?-1:V>Ct?1:0}})(G||(G={}));var jg=G.fit(G.oneSpace(),G.indent()),Kl=class extends Wl{format(e){if(Dt(e))this.getNodeFormatter(e).properties("type","terminal").surround(G.noSpace());else if(M(e)){let r=this.getNodeFormatter(e);r.keywords("entry","fragment","returns").append(G.oneSpace()),(e.inferredType||e.returnType||e.dataType)&&e.parameters.length===0?r.property("name").append(G.oneSpace()):r.property("name").append(G.noSpace()),r.properties("parameters").append(G.noSpace()),r.keywords(",").append(G.oneSpace()),r.keywords("<").append(G.noSpace());let n=r.keyword(";"),i=r.keyword(":");i.prepend(G.noSpace()),r.interior(i,n).prepend(G.indent()),n.prepend(G.fit(G.noSpace(),G.newLine())),r.node(e).prepend(G.noIndent())}else if(pe(e)){let r=this.getNodeFormatter(e);e.type&&(r.property("name").append(G.oneSpace()),r.keyword("returns").append(G.oneSpace())),r.keywords("hidden","terminal","fragment").append(G.oneSpace()),r.keyword(":").prepend(G.noSpace()),r.keyword(";").prepend(G.fit(G.noSpace(),G.newLine())),r.node(e).prepend(G.noIndent())}else if(Te(e)){let r=this.getNodeFormatter(e);r.keyword("{").append(G.noSpace()),r.keywords(".","+=","=").surround(G.noSpace()),r.keyword("}").prepend(G.noSpace())}else if(zo(e))this.getNodeFormatter(e).keywords("infer","infers").append(G.oneSpace());else if(ce(e))this.getNodeFormatter(e).keywords("=","+=","?=").surround(G.noSpace());else if(xe(e)){let r=this.getNodeFormatter(e);r.keyword("<").surround(G.noSpace()),r.keyword(",").append(G.oneSpace()),r.properties("arguments").append(G.noSpace())}else if(Ht(e)){let r=this.getNodeFormatter(e);r.keyword("interface").append(G.oneSpace()),r.keyword("extends").prepend(G.oneSpace()).append(jg),r.keywords(",").prepend(G.noSpace()).append(jg);let n=r.keyword("{");n.prepend(G.fit(G.oneSpace(),G.newLine()));let i=r.keyword("}");i.prepend(G.newLine()),r.interior(n,i).prepend(G.indent())}else if(lt(e)){let r=this.getNodeFormatter(e);r.keyword("type").append(G.oneSpace()),r.keyword("=").prepend(G.oneSpace()).append(jg),r.keyword(";").prepend(G.noSpace()).append(G.newLine())}else if(di(e)){let r=this.getNodeFormatter(e);r.nodes(...e.rules,...e.interfaces,...e.types,...e.imports).prepend(G.noIndent()),r.keyword("grammar").prepend(G.noSpace()).append(G.oneSpace())}Ko(e)&&this.getNodeFormatter(e).property("cardinality").prepend(G.noSpace())}};var Mn=se(de(),1);var Q=se(de(),1);var Hg={[Q.SemanticTokenTypes.class]:0,[Q.SemanticTokenTypes.comment]:1,[Q.SemanticTokenTypes.enum]:2,[Q.SemanticTokenTypes.enumMember]:3,[Q.SemanticTokenTypes.event]:4,[Q.SemanticTokenTypes.function]:5,[Q.SemanticTokenTypes.interface]:6,[Q.SemanticTokenTypes.keyword]:7,[Q.SemanticTokenTypes.macro]:8,[Q.SemanticTokenTypes.method]:9,[Q.SemanticTokenTypes.modifier]:10,[Q.SemanticTokenTypes.namespace]:11,[Q.SemanticTokenTypes.number]:12,[Q.SemanticTokenTypes.operator]:13,[Q.SemanticTokenTypes.parameter]:14,[Q.SemanticTokenTypes.property]:15,[Q.SemanticTokenTypes.regexp]:16,[Q.SemanticTokenTypes.string]:17,[Q.SemanticTokenTypes.struct]:18,[Q.SemanticTokenTypes.type]:19,[Q.SemanticTokenTypes.typeParameter]:20,[Q.SemanticTokenTypes.variable]:21,[Q.SemanticTokenTypes.decorator]:22},pA={[Q.SemanticTokenModifiers.abstract]:1,[Q.SemanticTokenModifiers.async]:2,[Q.SemanticTokenModifiers.declaration]:4,[Q.SemanticTokenModifiers.defaultLibrary]:8,[Q.SemanticTokenModifiers.definition]:16,[Q.SemanticTokenModifiers.deprecated]:32,[Q.SemanticTokenModifiers.documentation]:64,[Q.SemanticTokenModifiers.modification]:128,[Q.SemanticTokenModifiers.readonly]:256,[Q.SemanticTokenModifiers.static]:512},mA={legend:{tokenTypes:Object.keys(Hg),tokenModifiers:Object.keys(pA)},full:{delta:!0},range:!0},Gg=class extends Q.SemanticTokensBuilder{constructor(){super(...arguments),this._tokens=[]}push(e,r,n,i,o){this._tokens.push({line:e,char:r,length:n,tokenType:i,tokenModifiers:o})}build(){return this.applyTokens(),super.build()}buildEdits(){return this.applyTokens(),super.buildEdits()}applyTokens(){for(let e of this._tokens.sort(this.compareTokens))super.push(e.line,e.char,e.length,e.tokenType,e.tokenModifiers);this._tokens=[]}compareTokens(e,r){return e.line===r.line?e.char-r.char:e.line-r.line}},zl=class{constructor(e){this.tokensBuilders=new Map,e.shared.workspace.TextDocuments.onDidClose(r=>{this.tokensBuilders.delete(r.document.uri)}),e.shared.lsp.LanguageServer.onInitialize(r=>{var n;this.initialize((n=r.capabilities.textDocument)===null||n===void 0?void 0:n.semanticTokens)})}initialize(e){this.clientCapabilities=e}async semanticHighlight(e,r,n=Q.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.build()}async semanticHighlightRange(e,r,n=Q.CancellationToken.None){return this.currentRange=r.range,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.build()}async semanticHighlightDelta(e,r,n=Q.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.previousResult(r.previousResultId),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.buildEdits()}createAcceptor(){return r=>{"line"in r?this.highlightToken({range:{start:{line:r.line,character:r.char},end:{line:r.line,character:r.char+r.length}},type:r.type,modifier:r.modifier}):"range"in r?this.highlightToken(r):"keyword"in r?this.highlightKeyword(r):"property"in r?this.highlightProperty(r):this.highlightNode({node:r.cst,type:r.type,modifier:r.modifier})}}getDocumentTokensBuilder(e){let r=this.tokensBuilders.get(e.uri.toString());if(r)return r;let n=new Gg;return this.tokensBuilders.set(e.uri.toString(),n),n}async computeHighlighting(e,r,n){let i=e.parseResult.value,o=Pn(i,{range:this.currentRange}).iterator(),s;do if(s=o.next(),!s.done){await Ue(n);let a=s.value;this.highlightElement(a,r)==="prune"&&o.prune()}while(!s.done)}highlightToken(e){var r;let{range:n,type:i}=e,o=e.modifier;if(this.currentRange&&!sl(n,this.currentRange)||!this.currentDocument||!this.currentTokensBuilder)return;let s=Hg[i],a=0;if(o!==void 0){typeof o=="string"&&(o=[o]);for(let l of o){let f=pA[l];a|=f}}let c=n.start.line,u=n.end.line;if(c===u){let l=n.start.character,f=n.end.character-l;this.currentTokensBuilder.push(c,l,f,s,a)}else if(!((r=this.clientCapabilities)===null||r===void 0)&&r.multilineTokenSupport){let l=n.start.character,f=this.currentDocument.textDocument.offsetAt(n.start),d=this.currentDocument.textDocument.offsetAt(n.end);this.currentTokensBuilder.push(c,l,d-f,s,a)}else{let l=n.start,f=this.currentDocument.textDocument.offsetAt({line:c+1,character:0});this.currentTokensBuilder.push(l.line,l.character,f-l.character-1,s,a);for(let d=c+1;d<u;d++){let p=f;f=this.currentDocument.textDocument.offsetAt({line:d+1,character:0}),this.currentTokensBuilder.push(d,0,f-p-1,s,a)}this.currentTokensBuilder.push(u,0,n.end.character,s,a)}}highlightProperty(e){let r=[];if(typeof e.index=="number"){let o=$t(e.node.$cstNode,e.property,e.index);o&&r.push(o)}else r.push(...mi(e.node.$cstNode,e.property));let{type:n,modifier:i}=e;for(let o of r)this.highlightNode({node:o,type:n,modifier:i})}highlightKeyword(e){let{node:r,keyword:n,type:i,index:o,modifier:s}=e,a=[];if(typeof o=="number"){let c=Lr(r.$cstNode,n,o);c&&a.push(c)}else a.push(...Bl(r.$cstNode,n));for(let c of a)this.highlightNode({node:c,type:i,modifier:s})}highlightNode(e){let{node:r,type:n,modifier:i}=e,o=r.range;this.highlightToken({range:o,type:n,modifier:i})}},dA;(function(t){function e(n,i){let o=new Map;Object.entries(Hg).forEach(([c,u])=>o.set(u,c));let s=0,a=0;return r(n.data,5).map(c=>{s+=c[0],c[0]!==0&&(a=0),a+=c[1];let u=c[2];return{offset:i.textDocument.offsetAt({line:s,character:a}),tokenType:o.get(c[3]),tokenModifiers:c[4],text:i.textDocument.getText({start:{line:s,character:a},end:{line:s,character:a+u}})}})}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}})(dA||(dA={}));var Vl=class extends zl{highlightElement(e,r){var n;ce(e)?r({node:e,property:"feature",type:Mn.SemanticTokenTypes.property}):Te(e)?e.feature&&r({node:e,property:"feature",type:Mn.SemanticTokenTypes.property}):Xo(e)?r({node:e,property:"name",type:Mn.SemanticTokenTypes.type}):Wt(e)?(e.primitiveType||e.typeRef)&&r({node:e,property:e.primitiveType?"primitiveType":"typeRef",type:Mn.SemanticTokenTypes.type}):LS(e)?r({node:e,property:"name",type:Mn.SemanticTokenTypes.parameter}):Vo(e)?r({node:e,property:"parameter",type:Mn.SemanticTokenTypes.parameter}):xe(e)?!((n=e.rule.ref)===null||n===void 0)&&n.fragment&&r({node:e,property:"rule",type:Mn.SemanticTokenTypes.type}):ll(e)&&r({node:e,property:"name",type:Mn.SemanticTokenTypes.property})}};var Xl=class extends ts{getName(e){return ce(e)?e.feature:super.getName(e)}getNameNode(e){return ce(e)?$t(e.$cstNode,"feature"):super.getNameNode(e)}};var Ts=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=xs(e),n=e.astNode;if(r&&n){let i=n[r.feature];if(Cn(i))return i.ref;if(Array.isArray(i)){for(let o of i)if(Cn(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||gS(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=>ue.equals(o.sourceUri,r.documentUri))),n.push(...i),J(n)}getReferenceToSelf(e){let r=this.nameProvider.getNameNode(e);if(r){let n=Y(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:i,targetUri:n.uri,targetPath:i,segment:Gt(r),local:!0}}}};var Yl=class extends Ts{constructor(e){super(e),this.documents=e.shared.workspace.LangiumDocuments}findDeclaration(e){let r=e.astNode,n=xs(e);if(n&&n.feature==="feature"){if(ce(r))return this.findAssignmentDeclaration(r);if(Te(r))return this.findActionDeclaration(r)}return super.findDeclaration(e)}findReferences(e,r){var n;return ll(e)?this.findReferencesToTypeAttribute(e,(n=r.includeDeclaration)!==null&&n!==void 0?n:!1):super.findReferences(e,r)}findReferencesToTypeAttribute(e,r){let n=[],i=ve(e,Ht);if(i){if(r){let a=this.getReferenceToSelf(e);a&&n.push(a)}let o=hg(i,this,this.documents,this.nodeLocator),s=[];o.forEach(a=>{let c=this.findRulesWithReturnType(a);s.push(...c)}),s.forEach(a=>{let c=this.createReferencesToAttribute(a,e);n.push(...c)})}return J(n)}createReferencesToAttribute(e,r){let n=[];if(M(e)){let i=as(e.definition).find(o=>o.feature===r.name);if(i?.$cstNode){let o=this.nameProvider.getNameNode(i);o&&n.push({sourceUri:Y(i).uri,sourcePath:this.nodeLocator.getAstNodePath(i),targetUri:Y(r).uri,targetPath:this.nodeLocator.getAstNodePath(r),segment:Gt(o),local:ue.equals(Y(i).uri,Y(r).uri)})}}else{if(e.feature===r.name){let o=$t(e.$cstNode,"feature");o&&n.push({sourceUri:Y(e).uri,sourcePath:this.nodeLocator.getAstNodePath(e),targetUri:Y(r).uri,targetPath:this.nodeLocator.getAstNodePath(r),segment:Gt(o),local:ue.equals(Y(e).uri,Y(r).uri)})}let i=ve(e,M);n.push(...this.createReferencesToAttribute(i,r))}return n}findAssignmentDeclaration(e){var r;let n=ve(e,M),i=Cg(e);if(i){let o=this.findActionDeclaration(i,e.feature);if(o)return o}if(!((r=n?.returnType)===null||r===void 0)&&r.ref&&(Ht(n.returnType.ref)||lt(n.returnType.ref))){let o=ja(n.returnType.ref);for(let s of o){let a=s.attributes.find(c=>c.name===e.feature);if(a)return a}}return e}findActionDeclaration(e,r){var n;if(!((n=e.type)===null||n===void 0)&&n.ref){let i=r??e.feature,o=ja(e.type.ref);for(let s of o){let a=s.attributes.find(c=>c.name===i);if(a)return a}}}findRulesWithReturnType(e){let r=[];return this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e)).forEach(i=>{let o=this.documents.getOrCreateDocument(i.sourceUri),s=this.nodeLocator.getAstNode(o.parseResult.value,i.sourcePath);(M(s)||Te(s))&&r.push(s)}),r}};var rc=se(de(),1);var hA=se(de(),1);var Jl=class{constructor(e){this.grammarConfig=e.parser.GrammarConfig,this.nameProvider=e.references.NameProvider,this.documents=e.shared.workspace.LangiumDocuments,this.references=e.references.References}prepareCallHierarchy(e,r){let n=e.parseResult.value,i=ht(n.$cstNode,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findDeclarationNode(i);if(o)return this.getCallHierarchyItems(o.astNode,e)}getCallHierarchyItems(e,r){let n=this.nameProvider.getNameNode(e),i=this.nameProvider.getName(e);if(!(!n||!e.$cstNode||i===void 0))return[Object.assign({kind:hA.SymbolKind.Method,name:i,range:e.$cstNode.range,selectionRange:n.range,uri:r.uri.toString()},this.getCallHierarchyItem(e))]}getCallHierarchyItem(e){}incomingCalls(e){let r=this.documents.getOrCreateDocument(At.parse(e.item.uri)),n=r.parseResult.value,i=ht(n.$cstNode,r.textDocument.offsetAt(e.item.range.start),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findReferences(i.astNode,{includeDeclaration:!1});return this.getIncomingCalls(i.astNode,o)}outgoingCalls(e){let r=this.documents.getOrCreateDocument(At.parse(e.item.uri)),n=r.parseResult.value,i=ht(n.$cstNode,r.textDocument.offsetAt(e.item.range.start),this.grammarConfig.nameRegexp);if(i)return this.getOutgoingCalls(i.astNode)}};var gA=se(de(),1);var vs=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,r){let n=e.parseResult.value;if(n.$cstNode){let i=n.$cstNode,o=ht(i,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(o)return this.collectLocationLinks(o,r)}}collectLocationLinks(e,r){var n;let i=this.findLink(e);if(i)return[gA.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=Y(r.astNode);if(r&&n)return{source:e,target:r,targetDocument:n}}}};var yA=se(de(),1);var Ql=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,r){let n=e.parseResult.value.$cstNode;if(!n)return;let i=ht(n,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findDeclaration(i);if(o){let s=ue.equals(Y(o).uri,e.uri),a={documentUri:e.uri,includeDeclaration:s};return this.references.findReferences(o,a).map(u=>this.createDocumentHighlight(u)).toArray()}}createDocumentHighlight(e){return yA.DocumentHighlight.create(e.segment.range)}};var Zl=class{constructor(e){this.nameProvider=e.references.NameProvider,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}getSymbols(e){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 pi(r)){let o=this.getSymbol(e,i);n.push(...o)}if(n.length>0)return n}};var o0=se(de(),1);var ef=class{match(e,r){if(e.length===0)return!0;r=r.toLowerCase();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 TA<=e&&e<=xA&&s0<=r&&r<=a0||e===vA&&r!==vA}toUpperCharCode(e){return TA<=e&&e<=xA?e-32:e}},TA="a".charCodeAt(0),xA="z".charCodeAt(0),s0="A".charCodeAt(0),a0="Z".charCodeAt(0),vA="_".charCodeAt(0);var Wg=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=ht(o,s,this.grammarConfig.nameRegexp);if(a&&a.offset+a.length>s){let c=this.references.findDeclaration(a);if(c)return this.getAstNodeHoverContent(c)}}}},tf=class extends Wg{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 c0=se(de(),1);var u0=se(de(),1);var Ur=se(de(),1);var Ae;(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"})(Ae||(Ae={}));var rf=class{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}fromTextDocument(e,r){return this.create(r??At.parse(e.uri),e)}fromString(e,r){return this.create(r,e)}fromModel(e,r){return this.create(r,{$model:e})}create(e,r){if(r??(r=this.textDocuments.get(e.toString())),r??(r=this.getContentFromFileSystem(e)),typeof r=="string"){let n=this.parse(e,r);return this.createLangiumDocument(n,e,void 0,r)}else if("$model"in r){let n={value:r.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(n,e)}else{let n=this.parse(e,r.getText());return this.createLangiumDocument(n,e,r)}}createLangiumDocument(e,r,n,i){let o;if(n)o={parseResult:e,uri:r,state:Ae.Parsed,references:[],textDocument:n};else{let s=this.createTextDocumentGetter(r,i);o={parseResult:e,uri:r,state:Ae.Parsed,references:[],get textDocument(){return s()}}}return e.value.$document=o,o}update(e){let r=this.textDocuments.get(e.uri.toString()),n=r?r.getText():this.getContentFromFileSystem(e.uri);if(r)Object.defineProperty(e,"textDocument",{value:r});else{let i=this.createTextDocumentGetter(e.uri,n);Object.defineProperty(e,"textDocument",{get:i})}return e.parseResult=this.parse(e.uri,n),e.parseResult.value.$document=e,e}getContentFromFileSystem(e){return this.fileSystemProvider.readFileSync(e)}parse(e,r){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(r)}createTextDocumentGetter(e,r){let n=this.serviceRegistry,i;return()=>i??(i=Ho.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,r??""))}},nf=class{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory}get all(){return J(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)}getOrCreateDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n||(n=this.langiumDocumentFactory.create(e),this.documentMap.set(r,n),n)}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(n.state=Ae.Changed,n.precomputedScopes=void 0,n.references=[],n.diagnostics=void 0),n}deleteDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(n.state=Ae.Changed,this.documentMap.delete(r)),n}};var l0=se(de(),1);function RA(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 of=class{constructor(e){this.onInitializeEmitter=new Ur.Emitter,this.onInitializedEmitter=new Ur.Emitter,this.services=e}get onInitialize(){return this.onInitializeEmitter.event}get onInitialized(){return this.onInitializedEmitter.event}async initialize(e){return this.eagerLoadServices(),this.onInitializeEmitter.fire(e),this.onInitializeEmitter.dispose(),this.buildInitializeResult(e)}eagerLoadServices(){cl(this.services),this.services.ServiceRegistry.all.forEach(e=>cl(e))}hasService(e){return this.services.ServiceRegistry.all.some(r=>e(r)!==void 0)}buildInitializeResult(e){var r;let n=this.services.ServiceRegistry.all,i=this.hasService(x=>x.lsp.Formatter),o=n.map(x=>{var D;return(D=x.lsp.Formatter)===null||D===void 0?void 0:D.formatOnTypeOptions}).find(x=>!!x),s=this.hasService(x=>x.lsp.CodeActionProvider),a=this.hasService(x=>x.lsp.SemanticTokenProvider),c=(r=this.services.lsp.ExecuteCommandHandler)===null||r===void 0?void 0:r.commands,u=this.hasService(x=>x.lsp.DocumentLinkProvider),l=RA(n.map(x=>{var D;return(D=x.lsp.SignatureHelp)===null||D===void 0?void 0:D.signatureHelpOptions})),f=this.hasService(x=>x.lsp.TypeProvider),d=this.hasService(x=>x.lsp.ImplementationProvider),p=this.hasService(x=>x.lsp.CompletionProvider),T=fA(n.map(x=>{var D;return(D=x.lsp.CompletionProvider)===null||D===void 0?void 0:D.completionOptions})),R=this.hasService(x=>x.lsp.ReferencesProvider),A=this.hasService(x=>x.lsp.DocumentSymbolProvider),S=this.hasService(x=>x.lsp.DefinitionProvider),h=this.hasService(x=>x.lsp.DocumentHighlightProvider),m=this.hasService(x=>x.lsp.FoldingRangeProvider),b=this.hasService(x=>x.lsp.HoverProvider),_=this.hasService(x=>x.lsp.RenameProvider),V=this.hasService(x=>x.lsp.CallHierarchyProvider),Ct=this.hasService(x=>x.lsp.CodeLensProvider),rt=this.hasService(x=>x.lsp.DeclarationProvider),gr=this.hasService(x=>x.lsp.InlayHintProvider),Xt=this.services.lsp.WorkspaceSymbolProvider;return{capabilities:{workspace:{workspaceFolders:{supported:!0}},executeCommandProvider:c&&{commands:c},textDocumentSync:Ur.TextDocumentSyncKind.Incremental,completionProvider:p?T:void 0,referencesProvider:R,documentSymbolProvider:A,definitionProvider:S,typeDefinitionProvider:f,documentHighlightProvider:h,codeActionProvider:s,documentFormattingProvider:i,documentRangeFormattingProvider:i,documentOnTypeFormattingProvider:o,foldingRangeProvider:m,hoverProvider:b,renameProvider:_?{prepareProvider:!0}:void 0,semanticTokensProvider:a?mA:void 0,signatureHelpProvider:l,implementationProvider:d,callHierarchyProvider:V?{}:void 0,documentLinkProvider:u?{resolveProvider:!1}:void 0,codeLensProvider:Ct?{resolveProvider:!1}:void 0,declarationProvider:rt,inlayHintProvider:gr?{resolveProvider:!1}:void 0,workspaceSymbolProvider:Xt?{resolveProvider:!!Xt.resolveSymbol}:void 0}}}async initialized(e){this.onInitializedEmitter.fire(e),this.onInitializedEmitter.dispose()}};function bA(t){let e=t.lsp.Connection;if(!e)throw new Error("Starting a language server requires the languageServer.Connection service to be set.");f0(e,t),d0(e,t),p0(e,t),m0(e,t),g0(e,t),y0(e,t),T0(e,t),x0(e,t),R0(e,t),b0(e,t),A0(e,t),h0(e,t),w0(e,t),S0(e,t),k0(e,t),E0(e,t),C0(e,t),P0(e,t),O0(e,t),I0(e,t),N0(e,t),_0(e,t),v0(e,t),D0(e,t),e.onInitialize(n=>t.lsp.LanguageServer.initialize(n)),e.onInitialized(n=>t.lsp.LanguageServer.initialized(n)),t.workspace.TextDocuments.listen(e),e.listen()}function f0(t,e){let r=e.workspace.DocumentBuilder,n=e.workspace.MutexLock;function i(s,a){n.lock(c=>r.update(s,a,c))}e.workspace.TextDocuments.onDidChangeContent(s=>{i([At.parse(s.document.uri)],[])}),t.onDidChangeWatchedFiles(s=>{let a=[],c=[];for(let u of s.changes){let l=At.parse(u.uri);u.type===Ur.FileChangeType.Deleted?c.push(l):a.push(l)}i(a,c)})}function d0(t,e){e.workspace.DocumentBuilder.onBuildPhase(Ae.Validated,async(n,i)=>{for(let o of n)if(o.diagnostics&&t.sendDiagnostics({uri:o.uri.toString(),diagnostics:o.diagnostics}),i.isCancellationRequested)return})}function p0(t,e){t.onCompletion(Kt((r,n,i,o)=>{var s;return(s=r.lsp.CompletionProvider)===null||s===void 0?void 0:s.getCompletion(n,i,o)},e))}function m0(t,e){t.onReferences(Kt((r,n,i,o)=>{var s;return(s=r.lsp.ReferencesProvider)===null||s===void 0?void 0:s.findReferences(n,i,o)},e))}function h0(t,e){t.onCodeAction(Kt((r,n,i,o)=>{var s;return(s=r.lsp.CodeActionProvider)===null||s===void 0?void 0:s.getCodeActions(n,i,o)},e))}function g0(t,e){t.onDocumentSymbol(Kt((r,n,i,o)=>{var s;return(s=r.lsp.DocumentSymbolProvider)===null||s===void 0?void 0:s.getSymbols(n,i,o)},e))}function y0(t,e){t.onDefinition(Kt((r,n,i,o)=>{var s;return(s=r.lsp.DefinitionProvider)===null||s===void 0?void 0:s.getDefinition(n,i,o)},e))}function T0(t,e){t.onTypeDefinition(Kt((r,n,i,o)=>{var s;return(s=r.lsp.TypeProvider)===null||s===void 0?void 0:s.getTypeDefinition(n,i,o)},e))}function x0(t,e){t.onImplementation(Kt((r,n,i,o)=>{var s;return(s=r.lsp.ImplementationProvider)===null||s===void 0?void 0:s.getImplementation(n,i,o)},e))}function v0(t,e){t.onDeclaration(Kt((r,n,i,o)=>{var s;return(s=r.lsp.DeclarationProvider)===null||s===void 0?void 0:s.getDeclaration(n,i,o)},e))}function R0(t,e){t.onDocumentHighlight(Kt((r,n,i,o)=>{var s;return(s=r.lsp.DocumentHighlightProvider)===null||s===void 0?void 0:s.getDocumentHighlight(n,i,o)},e))}function S0(t,e){t.onHover(Kt((r,n,i,o)=>{var s;return(s=r.lsp.HoverProvider)===null||s===void 0?void 0:s.getHoverContent(n,i,o)},e))}function b0(t,e){t.onFoldingRanges(Kt((r,n,i,o)=>{var s;return(s=r.lsp.FoldingRangeProvider)===null||s===void 0?void 0:s.getFoldingRanges(n,i,o)},e))}function A0(t,e){t.onDocumentFormatting(Kt((r,n,i,o)=>{var s;return(s=r.lsp.Formatter)===null||s===void 0?void 0:s.formatDocument(n,i,o)},e)),t.onDocumentRangeFormatting(Kt((r,n,i,o)=>{var s;return(s=r.lsp.Formatter)===null||s===void 0?void 0:s.formatDocumentRange(n,i,o)},e)),t.onDocumentOnTypeFormatting(Kt((r,n,i,o)=>{var s;return(s=r.lsp.Formatter)===null||s===void 0?void 0:s.formatDocumentOnType(n,i,o)},e))}function w0(t,e){t.onRenameRequest(Kt((r,n,i,o)=>{var s;return(s=r.lsp.RenameProvider)===null||s===void 0?void 0:s.rename(n,i,o)},e)),t.onPrepareRename(Kt((r,n,i,o)=>{var s;return(s=r.lsp.RenameProvider)===null||s===void 0?void 0:s.prepareRename(n,i,o)},e))}function k0(t,e){t.languages.inlayHint.on(yi((r,n,i,o)=>{var s;return(s=r.lsp.InlayHintProvider)===null||s===void 0?void 0:s.getInlayHints(n,i,o)},e))}function E0(t,e){let r={data:[]};t.languages.semanticTokens.on(yi((n,i,o,s)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlight(i,o,s):r,e)),t.languages.semanticTokens.onDelta(yi((n,i,o,s)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlightDelta(i,o,s):r,e)),t.languages.semanticTokens.onRange(yi((n,i,o,s)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlightRange(i,o,s):r,e))}function _0(t,e){t.onDidChangeConfiguration(r=>{r.settings&&e.workspace.ConfigurationProvider.updateConfiguration(r)})}function C0(t,e){let r=e.lsp.ExecuteCommandHandler;r&&t.onExecuteCommand(async(n,i)=>{var o;try{return await r.executeCommand(n.command,(o=n.arguments)!==null&&o!==void 0?o:[],i)}catch(s){return Rs(s)}})}function N0(t,e){t.onDocumentLinks(yi((r,n,i,o)=>{var s;return(s=r.lsp.DocumentLinkProvider)===null||s===void 0?void 0:s.getDocumentLinks(n,i,o)},e))}function P0(t,e){t.onSignatureHelp(yi((r,n,i,o)=>{var s;return(s=r.lsp.SignatureHelp)===null||s===void 0?void 0:s.provideSignatureHelp(n,i,o)},e))}function I0(t,e){t.onCodeLens(yi((r,n,i,o)=>{var s;return(s=r.lsp.CodeLensProvider)===null||s===void 0?void 0:s.provideCodeLens(n,i,o)},e))}function D0(t,e){var r;let n=e.lsp.WorkspaceSymbolProvider;if(n){t.onWorkspaceSymbol(async(o,s)=>{try{return await n.getSymbols(o,s)}catch(a){return Rs(a)}});let i=(r=n.resolveSymbol)===null||r===void 0?void 0:r.bind(n);i&&t.onWorkspaceSymbolResolve(async(o,s)=>{try{return await i(o,s)}catch(a){return Rs(a)}})}}function O0(t,e){t.languages.callHierarchy.onPrepare(yi((r,n,i,o)=>{var s;return r.lsp.CallHierarchyProvider&&(s=r.lsp.CallHierarchyProvider.prepareCallHierarchy(n,i,o))!==null&&s!==void 0?s:null},e)),t.languages.callHierarchy.onIncomingCalls(SA((r,n,i)=>{var o;return r.lsp.CallHierarchyProvider&&(o=r.lsp.CallHierarchyProvider.incomingCalls(n,i))!==null&&o!==void 0?o:null},e)),t.languages.callHierarchy.onOutgoingCalls(SA((r,n,i)=>{var o;return r.lsp.CallHierarchyProvider&&(o=r.lsp.CallHierarchyProvider.outgoingCalls(n,i))!==null&&o!==void 0?o:null},e))}function SA(t,e){let r=e.ServiceRegistry;return async(n,i)=>{let o=At.parse(n.item.uri),s=r.getServices(o);if(!s){let a=`Could not find service instance for uri: '${o.toString()}'`;throw console.error(a),new Error(a)}try{return await t(s,n,i)}catch(a){return Rs(a)}}}function yi(t,e){let r=e.workspace.LangiumDocuments,n=e.ServiceRegistry;return async(i,o)=>{let s=At.parse(i.textDocument.uri),a=n.getServices(s);if(!a)throw console.error(`Could not find service instance for uri: '${s.toString()}'`),new Error;let c=r.getOrCreateDocument(s);if(!c)throw new Error;try{return await t(a,c,i,o)}catch(u){return Rs(u)}}}function Kt(t,e){let r=e.workspace.LangiumDocuments,n=e.ServiceRegistry;return async(i,o)=>{let s=At.parse(i.textDocument.uri),a=n.getServices(s);if(!a)return console.error(`Could not find service instance for uri: '${s.toString()}'`),null;let c=r.getOrCreateDocument(s);if(!c)return null;try{return await t(a,c,i,o)}catch(u){return Rs(u)}}}function Rs(t){if(Zi(t))return new Ur.ResponseError(Ur.LSPErrorCodes.RequestCancelled,"The request has been cancelled.");if(t instanceof Ur.ResponseError)return t;throw t}var af=se(de(),1),sf=class{getSymbolKind(){return af.SymbolKind.Field}getCompletionItemKind(){return af.CompletionItemKind.Reference}};var AA=se(de(),1);var cf=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}findReferences(e,r){let n=e.parseResult.value.$cstNode;if(!n)return[];let i=ht(n,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);return i?this.getReferences(i,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(AA.Location.create(a.sourceUri.toString(),a.segment.range))})}return i}};var wA=se(de(),1);var uf=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async rename(e,r){let n={},i=e.parseResult.value.$cstNode;if(!i)return;let o=e.textDocument.offsetAt(r.position),s=ht(i,o,this.grammarConfig.nameRegexp);if(!s)return;let a=this.references.findDeclaration(s);if(!a)return;let c={onlyLocal:!1,includeDeclaration:!0};return this.references.findReferences(a,c).forEach(l=>{let f=wA.TextEdit.replace(l.segment.range,r.newName),d=l.sourceUri.toString();n[d]?n[d].push(f):n[d]=[f]}),{changes:n}}prepareRename(e,r){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=ht(n,i,this.grammarConfig.nameRegexp);if(!o)return;if(this.references.findDeclaration(o)||this.isNameNode(o))return o.range}}isNameNode(e){return e?.astNode&&Ga(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}};var $0=se(de(),1);var kA=se(de(),1);var lf=class{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,r=kA.CancellationToken.None){let n=[],i=e.query.toLowerCase();for(let o of this.indexManager.allElements())if(await Ue(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 ff=class extends vs{constructor(e){super(e),this.documents=e.shared.workspace.LangiumDocuments}collectLocationLinks(e,r){var n,i,o,s,a,c;let u="path";if(ul(e.astNode)&&((n=xs(e))===null||n===void 0?void 0:n.feature)===u){let l=$n(this.documents,e.astNode);if(l?.$document){let f=(i=this.findTargetObject(l))!==null&&i!==void 0?i:l,d=(s=(o=this.nameProvider.getNameNode(f))===null||o===void 0?void 0:o.range)!==null&&s!==void 0?s:rc.Range.create(0,0,0,0),p=(c=(a=f.$cstNode)===null||a===void 0?void 0:a.range)!==null&&c!==void 0?c:rc.Range.create(0,0,0,0);return[rc.LocationLink.create(l.$document.uri.toString(),p,d,e.range)]}return}return super.collectLocationLinks(e,r)}findTargetObject(e){return e.isDeclared?e:pi(e).head()}};var Bg=se(de(),1);var df=class extends Jl{getIncomingCalls(e,r){if(!M(e))return;let n=new Map;if(r.forEach(i=>{let s=this.documents.getOrCreateDocument(i.sourceUri).parseResult.value;if(!s.$cstNode)return;let a=fi(s.$cstNode,i.segment.offset);if(!a)return;let c=ve(a.astNode,M);if(!c||!c.$cstNode)return;let u=this.nameProvider.getNameNode(c);if(!u)return;let l=i.sourceUri.toString(),f=l+"@"+u.text;n.has(f)?n.set(f,{parserRule:c.$cstNode,nameNode:u,targetNodes:[...n.get(f).targetNodes,a],docUri:l}):n.set(f,{parserRule:c.$cstNode,nameNode:u,targetNodes:[a],docUri:l})}),n.size!==0)return Array.from(n.values()).map(i=>({from:{kind:Bg.SymbolKind.Method,name:i.nameNode.text,range:i.parserRule.range,selectionRange:i.nameNode.range,uri:i.docUri},fromRanges:i.targetNodes.map(o=>o.range)}))}getOutgoingCalls(e){if(!M(e))return;let r=Fe(e).filter(xe).toArray(),n=new Map;if(r.forEach(i=>{var o;let s=i.$cstNode;if(!s)return;let a=(o=i.rule.ref)===null||o===void 0?void 0:o.$cstNode;if(!a)return;let c=this.nameProvider.getNameNode(a.astNode);if(!c)return;let u=Y(a.astNode).uri.toString(),l=u+"@"+c.text;n.has(l)?n.set(l,{refCstNode:a,to:c,from:[...n.get(l).from,s.range],docUri:u}):n.set(l,{refCstNode:a,to:c,from:[s.range],docUri:u})}),n.size!==0)return Array.from(n.values()).map(i=>({to:{kind:Bg.SymbolKind.Method,name:i.to.text,range:i.refCstNode.range,selectionRange:i.to.range,uri:i.docUri},fromRanges:i.from}))}};var pf=class{constructor(e){this.documents=e.shared.workspace.LangiumDocuments}collectValidationResources(e){let r=oA(e,this.documents);return{typeToValidationInfo:this.collectValidationInfo(r),typeToSuperProperties:this.collectSuperProperties(r)}}collectValidationInfo({astResources:e,inferred:r,declared:n}){let i=new Map,o=L0(e);for(let a of Sl(r))i.set(a.name,{inferred:a,inferredNodes:o.get(a.name)});let s=J(e.interfaces).concat(e.types).reduce((a,c)=>a.set(c.name,c),new Map);for(let a of Sl(n)){let c=s.get(a.name);if(c){let u=i.get(a.name);i.set(a.name,Object.assign(Object.assign({},u??{}),{declared:a,declaredNode:c}))}}return i}collectSuperProperties({inferred:e,declared:r}){let n=new Map,i=gg(e,r),o=new Map(i.map(s=>[s.name,s]));for(let s of gg(e,r))n.set(s.name,this.addSuperProperties(s,o,new Set));return n}addSuperProperties(e,r,n){if(n.has(e.name))return[];n.add(e.name);let i=[...e.properties];for(let o of e.superTypes){let s=r.get(o.name);s&&i.push(...this.addSuperProperties(s,r,n))}return i}};function L0({parserRules:t,datatypeRules:e}){let r=new ye;J(t).concat(e).forEach(i=>r.add(to(i),i));function n(i){if(Te(i)){let o=us(i);o&&r.add(o,i)}(vr(i)||bt(i)||Rr(i))&&i.elements.forEach(o=>n(o))}return t.forEach(i=>n(i.definition)),r}function EA(t){return t&&"declared"in t}function _A(t){return t&&"inferred"in t}function CA(t){return t&&"inferred"in t&&"declared"in t}function PA(t){let e=t.validation.ValidationRegistry,r=t.validation.LangiumGrammarTypesValidator,n={Action:[r.checkActionIsNotUnionType],Grammar:[r.checkDeclaredTypesConsistency,r.checkDeclaredAndInferredTypesConsistency],Interface:[r.checkCyclicInterface],Type:[r.checkCyclicType]};e.register(n,r)}var mf=class{checkCyclicType(e,r){Ti(e,new Set)&&r("error",`Type alias '${e.name}' circularly references itself.`,{node:e,property:"name"})}checkCyclicInterface(e,r){Ti(e,new Set)&&r("error",`Type '${e.name}' recursively references itself as a base type.`,{node:e,property:"name"})}checkDeclaredTypesConsistency(e,r){var n;let i=(n=e.$document)===null||n===void 0?void 0:n.validationResources;if(i){for(let o of i.typeToValidationInfo.values())if(EA(o)&&Xr(o.declared)&&Ht(o.declaredNode)){let s=o;F0(s,r),U0(s,r)}}}checkDeclaredAndInferredTypesConsistency(e,r){var n;let i=(n=e.$document)===null||n===void 0?void 0:n.validationResources;if(i)for(let o of i.typeToValidationInfo.values())_A(o)&&o.inferred instanceof es&&M0(o.inferred,r),CA(o)&&G0(o,i,r)}checkActionIsNotUnionType(e,r){lt(e.type)&&r("error","Actions cannot create union types.",{node:e,property:"type"})}};function Ti(t,e){var r;if(e.has(t))return!0;if(e.add(t),lt(t))return Ti(t.type,e);if(Ht(t))return t.superTypes.some(n=>n.ref&&Ti(n.ref,new Set(e)));if(Wt(t)){if(!((r=t.typeRef)===null||r===void 0)&&r.ref)return Ti(t.typeRef.ref,e)}else{if(Xi(t))return Ti(t.referenceType,e);if(Vi(t))return Ti(t.elementType,e);if($r(t))return t.types.some(n=>Ti(n,new Set(e)))}return!1}function M0(t,e){t.properties.forEach(r=>{var n;let i=pg(r.type);if(i.length>1){let o=a=>In(a)?"ref":"other",s=o(i[0]);if(i.slice(1).some(a=>o(a)!==s)){let a=(n=r.astNodes.values().next())===null||n===void 0?void 0:n.value;a&&e("error",`Mixing a cross-reference with other types is not supported. Consider splitting property "${r.name}" into two or more different properties.`,{node:a})}}})}function F0({declared:t,declaredNode:e},r){Array.from(t.superTypes).forEach((n,i)=>{n&&(zr(n)&&r("error","Interfaces cannot extend union types.",{node:e,property:"superTypes",index:i}),n.declared||r("error","Extending an inferred type is discouraged.",{node:e,property:"superTypes",index:i}))})}function U0({declared:t,declaredNode:e},r){let n=t.properties.reduce((s,a)=>s.add(a.name,a),new ye);for(let[s,a]of n.entriesGroupedByKey())if(a.length>1)for(let c of a)r("error",`Cannot have two properties with the same name '${s}'.`,{node:Array.from(c.astNodes)[0],property:"name"});let i=Array.from(t.superTypes);for(let s=0;s<i.length;s++)for(let a=s+1;a<i.length;a++){let c=i[s],u=i[a],l=Xr(c)?c.superProperties:[],f=Xr(u)?u.superProperties:[],d=q0(l,f);d.length>0&&r("error",`Cannot simultaneously inherit from '${c}' and '${u}'. Their ${d.map(p=>"'"+p+"'").join(", ")} properties are not identical.`,{node:e,property:"name"})}let o=new Set;for(let s of i){let a=Xr(s)?s.superProperties:[];for(let c of a)o.add(c.name)}for(let s of t.properties)if(o.has(s.name)){let a=e.attributes.find(c=>c.name===s.name);a&&r("error",`Cannot redeclare property '${s.name}'. It is already inherited from another interface.`,{node:a,property:"name"})}}function q0(t,e){let r=[];for(let n of t){let i=e.find(o=>o.name===n.name);i&&!j0(n,i)&&r.push(n.name)}return r}function j0(t,e){return qa(t.type,e.type)&&qa(e.type,t.type)}function G0(t,e,r){let{inferred:n,declared:i,declaredNode:o,inferredNodes:s}=t,a=i.name,c=f=>d=>s.forEach(p=>r("error",`${d}${f?` ${f}`:""}.`,p?.inferredType?{node:p?.inferredType,property:"name"}:{node:p,property:Te(p)?"type":"name"})),u=(f,d)=>f.forEach(p=>r("error",d,{node:p,property:ce(p)||Te(p)?"feature":"name"})),l=f=>{s.forEach(d=>{M(d)&&as(d.definition).find(T=>T.feature===f)===void 0&&r("error",`Property '${f}' is missing in a rule '${d.name}', but is required in type '${a}'.`,{node:d,property:"parameters"})})};if(zr(n)&&zr(i))H0(n.type,i.type,c(`in a rule that returns type '${a}'`));else if(Xr(n)&&Xr(i))W0(n,i,e,c(`in a rule that returns type '${a}'`),u,l);else{let f=`Inferred and declared versions of type '${a}' both have to be interfaces or unions.`;c()(f),r("error",f,{node:o,property:"name"})}}function H0(t,e,r){qa(t,e)||r(`Cannot assign type '${Vr(t,"DeclaredType")}' to '${Vr(e,"DeclaredType")}'`)}function NA(t){return t.optional||vl(t.type)}function W0(t,e,r,n,i,o){let s=new Set(t.properties.map(f=>f.name)),a=new Map(t.allProperties.map(f=>[f.name,f])),c=new Map(e.superProperties.map(f=>[f.name,f])),u=f=>{if(gt(f))return{types:f.types.map(d=>u(d))};if(In(f))return{referenceType:u(f.referenceType)};if(Dn(f))return{elementType:u(f.elementType)};if(Sr(f)){let d=r.typeToValidationInfo.get(f.value.name);return d?{value:"declared"in d?d.declared:d.inferred}:f}return f};for(let[f,d]of a.entries()){let p=c.get(f);if(p){let T=Vr(d.type,"DeclaredType"),R=Vr(p.type,"DeclaredType");if(!qa(u(d.type),p.type)&&R!=="unknown"){let S=`The assigned type '${T}' is not compatible with the declared property '${f}' of type '${R}'.`;i(d.astNodes,S)}d.optional&&!NA(p)&&o(f)}else s.has(f)&&i(d.astNodes,`A property '${f}' is not expected.`)}let l=new Set;for(let[f,d]of c.entries())!a.get(f)&&!NA(d)&&l.add(f);if(l.size>0){let f=l.size>1?"Properties":"A property",d=l.size>1?"are expected":"is expected",p=Array.from(l).map(T=>`'${T}'`).sort().join(", ");n(`${f} ${p} ${d}.`)}}var B0={validation:{LangiumGrammarValidator:t=>new Cl(t),ValidationResourcesCollector:t=>new pf(t),LangiumGrammarTypesValidator:()=>new mf},lsp:{FoldingRangeProvider:t=>new Hl(t),CodeActionProvider:t=>new Ml(t),SemanticTokenProvider:t=>new Vl(t),Formatter:()=>new Kl,DefinitionProvider:t=>new ff(t),CallHierarchyProvider:t=>new df(t),CompletionProvider:t=>new Gl(t)},references:{ScopeComputation:t=>new $l(t),ScopeProvider:t=>new Ol(t),References:t=>new Yl(t),NameProvider:()=>new Xl}};function IA(t,e){let r=Ki(ic(t),sA,e),n=Ki(nc({shared:r}),aA,B0);return K0(r,n),r.ServiceRegistry.register(n),Hb(n),PA(n),{shared:r,grammar:n}}function K0(t,e){t.workspace.DocumentBuilder.onBuildPhase(Ae.IndexedReferences,async(n,i)=>{for(let o of n){await Ue(i);let s=e.validation.ValidationResourcesCollector,a=o.parseResult.value;o.validationResources=s.collectValidationResources(a)}})}var Kg=class{readFile(){throw new Error("Method not implemented.")}readFileSync(){throw new Error("Method not implemented.")}async readDirectory(){return[]}},hf={fileSystemProvider:()=>new Kg};function jl(t){return t.rules.find(e=>M(e)&&e.entry)}function z0(t){return t.rules.filter(e=>pe(e)&&e.hidden)}function ss(t,e){let r=new Set,n=jl(t);if(!n)return new Set(t.rules);let i=[n].concat(z0(t));for(let s of i)DA(s,r,e);let o=new Set;for(let s of t.rules)(r.has(s.name)||pe(s)&&s.hidden)&&o.add(s);return o}function DA(t,e,r){e.add(t.name),Fe(t).forEach(n=>{if(xe(n)||r&&dl(n)){let i=n.rule.ref;i&&!e.has(i.name)&&DA(i,e,r)}})}function ql(t){if(t.terminal)return t.terminal;if(t.type.ref){let e=Qa(t.type.ref);return e?.terminal}}function OA(t){return t.hidden&&!Fr(t).test(" ")}function mi(t,e){return!t||!e?[]:zg(t,e,t.astNode,!0)}function $t(t,e,r){if(!t||!e)return;let n=zg(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 zg(t,e,r,n){if(!n){let i=ve(t.grammarSource,ce);if(i&&i.feature===e)return[t]}return Kr(t)&&t.astNode===r?t.content.flatMap(i=>zg(i,e,r,!1)):[]}function Bl(t,e){return t?$A(t,e,t?.astNode):[]}function Lr(t,e,r){if(!t)return;let n=$A(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 $A(t,e,r){if(t.astNode!==r)return[];if(Ze(t.grammarSource)&&t.grammarSource.value===e)return[t];let n=Zh(t).iterator(),i,o=[];do if(i=n.next(),!i.done){let s=i.value;s.astNode===r?Ze(s.grammarSource)&&s.grammarSource.value===e&&o.push(s):n.prune()}while(!i.done);return o}function xs(t){var e;let r=t.astNode;for(;r===((e=t.container)===null||e===void 0?void 0:e.astNode);){let n=ve(t.grammarSource,ce);if(n)return n;t=t.container}}function Qa(t){return zo(t)&&(t=t.$container),LA(t,new Map)}function LA(t,e){var r;function n(i,o){let s;return ve(i,ce)||(s=LA(o,e)),e.set(t,s),s}if(e.has(t))return e.get(t);e.set(t,void 0);for(let i of Fe(t)){if(ce(i)&&i.feature.toLowerCase()==="name")return e.set(t,i),i;if(xe(i)&&M(i.rule.ref))return n(i,i.rule.ref);if(Wt(i)&&(!((r=i.typeRef)===null||r===void 0)&&r.ref))return n(i,i.typeRef.ref)}}function kl(t){var e;let r=IA(hf).grammar,n=r.serializer.JsonSerializer.deserialize(t);return r.shared.workspace.LangiumDocumentFactory.fromModel(n,At.parse(`memory://${(e=n.name)!==null&&e!==void 0?e:"grammar"}.langium`)),n}function MA(t){let e=[],r=t.Grammar;for(let n of r.rules)pe(n)&&OA(n)&&Db(Fr(n))&&e.push(n.name);return{multilineCommentRules:e,nameRegexp:eg}}var V0=typeof global=="object"&&global&&global.Object===Object&&global,gf=V0;var X0=typeof self=="object"&&self&&self.Object===Object&&self,Y0=gf||X0||Function("return this")(),ft=Y0;var J0=ft.Symbol,wt=J0;var FA=Object.prototype,Q0=FA.hasOwnProperty,Z0=FA.toString,oc=wt?wt.toStringTag:void 0;function eD(t){var e=Q0.call(t,oc),r=t[oc];try{t[oc]=void 0;var n=!0}catch{}var i=Z0.call(t);return n&&(e?t[oc]=r:delete t[oc]),i}var UA=eD;var tD=Object.prototype,rD=tD.toString;function nD(t){return rD.call(t)}var qA=nD;var iD="[object Null]",oD="[object Undefined]",jA=wt?wt.toStringTag:void 0;function sD(t){return t==null?t===void 0?oD:iD:jA&&jA in Object(t)?UA(t):qA(t)}var er=sD;function aD(t){return t!=null&&typeof t=="object"}var it=aD;var cD="[object Symbol]";function uD(t){return typeof t=="symbol"||it(t)&&er(t)==cD}var pn=uD;function lD(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 mn=lD;var fD=Array.isArray,U=fD;var dD=1/0,GA=wt?wt.prototype:void 0,HA=GA?GA.toString:void 0;function WA(t){if(typeof t=="string")return t;if(U(t))return mn(t,WA)+"";if(pn(t))return HA?HA.call(t):"";var e=t+"";return e=="0"&&1/t==-dD?"-0":e}var BA=WA;var pD=/\s/;function mD(t){for(var e=t.length;e--&&pD.test(t.charAt(e)););return e}var KA=mD;var hD=/^\s+/;function gD(t){return t&&t.slice(0,KA(t)+1).replace(hD,"")}var zA=gD;function yD(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Ke=yD;var VA=0/0,TD=/^[-+]0x[0-9a-f]+$/i,xD=/^0b[01]+$/i,vD=/^0o[0-7]+$/i,RD=parseInt;function SD(t){if(typeof t=="number")return t;if(pn(t))return VA;if(Ke(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Ke(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=zA(t);var r=xD.test(t);return r||vD.test(t)?RD(t.slice(2),r?2:8):TD.test(t)?VA:+t}var XA=SD;var YA=1/0,bD=17976931348623157e292;function AD(t){if(!t)return t===0?t:0;if(t=XA(t),t===YA||t===-YA){var e=t<0?-1:1;return e*bD}return t===t?t:0}var JA=AD;function wD(t){var e=JA(t),r=e%1;return e===e?r?e-r:e:0}var hn=wD;function kD(t){return t}var fr=kD;var ED="[object AsyncFunction]",_D="[object Function]",CD="[object GeneratorFunction]",ND="[object Proxy]";function PD(t){if(!Ke(t))return!1;var e=er(t);return e==_D||e==CD||e==ED||e==ND}var tr=PD;var ID=ft["__core-js_shared__"],yf=ID;var QA=function(){var t=/[^.]+$/.exec(yf&&yf.keys&&yf.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function DD(t){return!!QA&&QA in t}var ZA=DD;var OD=Function.prototype,$D=OD.toString;function LD(t){if(t!=null){try{return $D.call(t)}catch{}try{return t+""}catch{}}return""}var Fn=LD;var MD=/[\\^$.*+?()[\]{}|]/g,FD=/^\[object .+?Constructor\]$/,UD=Function.prototype,qD=Object.prototype,jD=UD.toString,GD=qD.hasOwnProperty,HD=RegExp("^"+jD.call(GD).replace(MD,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function WD(t){if(!Ke(t)||ZA(t))return!1;var e=tr(t)?HD:FD;return e.test(Fn(t))}var ew=WD;function BD(t,e){return t?.[e]}var tw=BD;function KD(t,e){var r=tw(t,e);return ew(r)?r:void 0}var dr=KD;var zD=dr(ft,"WeakMap"),Tf=zD;var rw=Object.create,VD=function(){function t(){}return function(e){if(!Ke(e))return{};if(rw)return rw(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),nw=VD;function XD(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 iw=XD;function YD(){}var ze=YD;function JD(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var ow=JD;var QD=800,ZD=16,eO=Date.now;function tO(t){var e=0,r=0;return function(){var n=eO(),i=ZD-(n-r);if(r=n,i>0){if(++e>=QD)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var sw=tO;function rO(t){return function(){return t}}var aw=rO;var nO=function(){try{var t=dr(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Ss=nO;var iO=Ss?function(t,e){return Ss(t,"toString",{configurable:!0,enumerable:!1,value:aw(e),writable:!0})}:fr,cw=iO;var oO=sw(cw),uw=oO;function sO(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var xf=sO;function aO(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 vf=aO;function cO(t){return t!==t}var lw=cO;function uO(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}var fw=uO;function lO(t,e,r){return e===e?fw(t,e,r):vf(t,lw,r)}var bs=lO;function fO(t,e){var r=t==null?0:t.length;return!!r&&bs(t,e,0)>-1}var Rf=fO;var dO=9007199254740991,pO=/^(?:0|[1-9]\d*)$/;function mO(t,e){var r=typeof t;return e=e??dO,!!e&&(r=="number"||r!="symbol"&&pO.test(t))&&t>-1&&t%1==0&&t<e}var xi=mO;function hO(t,e,r){e=="__proto__"&&Ss?Ss(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var As=hO;function gO(t,e){return t===e||t!==t&&e!==e}var gn=gO;var yO=Object.prototype,TO=yO.hasOwnProperty;function xO(t,e,r){var n=t[e];(!(TO.call(t,e)&&gn(n,r))||r===void 0&&!(e in t))&&As(t,e,r)}var vi=xO;function vO(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?As(r,a,c):vi(r,a,c)}return r}var yn=vO;var dw=Math.max;function RO(t,e,r){return e=dw(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=dw(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),iw(t,this,a)}}var pw=RO;function SO(t,e){return uw(pw(t,e,fr),t+"")}var ws=SO;var bO=9007199254740991;function AO(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=bO}var ks=AO;function wO(t){return t!=null&&ks(t.length)&&!tr(t)}var dt=wO;function kO(t,e,r){if(!Ke(r))return!1;var n=typeof e;return(n=="number"?dt(r)&&xi(e,r.length):n=="string"&&e in r)?gn(r[e],t):!1}var Ri=kO;function EO(t){return ws(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&&Ri(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 mw=EO;var _O=Object.prototype;function CO(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||_O;return t===r}var Tn=CO;function NO(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var hw=NO;var PO="[object Arguments]";function IO(t){return it(t)&&er(t)==PO}var Vg=IO;var gw=Object.prototype,DO=gw.hasOwnProperty,OO=gw.propertyIsEnumerable,$O=Vg(function(){return arguments}())?Vg:function(t){return it(t)&&DO.call(t,"callee")&&!OO.call(t,"callee")},Si=$O;function LO(){return!1}var yw=LO;var vw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Tw=vw&&typeof module=="object"&&module&&!module.nodeType&&module,MO=Tw&&Tw.exports===vw,xw=MO?ft.Buffer:void 0,FO=xw?xw.isBuffer:void 0,UO=FO||yw,Un=UO;var qO="[object Arguments]",jO="[object Array]",GO="[object Boolean]",HO="[object Date]",WO="[object Error]",BO="[object Function]",KO="[object Map]",zO="[object Number]",VO="[object Object]",XO="[object RegExp]",YO="[object Set]",JO="[object String]",QO="[object WeakMap]",ZO="[object ArrayBuffer]",e$="[object DataView]",t$="[object Float32Array]",r$="[object Float64Array]",n$="[object Int8Array]",i$="[object Int16Array]",o$="[object Int32Array]",s$="[object Uint8Array]",a$="[object Uint8ClampedArray]",c$="[object Uint16Array]",u$="[object Uint32Array]",Le={};Le[t$]=Le[r$]=Le[n$]=Le[i$]=Le[o$]=Le[s$]=Le[a$]=Le[c$]=Le[u$]=!0;Le[qO]=Le[jO]=Le[ZO]=Le[GO]=Le[e$]=Le[HO]=Le[WO]=Le[BO]=Le[KO]=Le[zO]=Le[VO]=Le[XO]=Le[YO]=Le[JO]=Le[QO]=!1;function l$(t){return it(t)&&ks(t.length)&&!!Le[er(t)]}var Rw=l$;function f$(t){return function(e){return t(e)}}var xn=f$;var Sw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,sc=Sw&&typeof module=="object"&&module&&!module.nodeType&&module,d$=sc&&sc.exports===Sw,Xg=d$&&gf.process,p$=function(){try{var t=sc&&sc.require&&sc.require("util").types;return t||Xg&&Xg.binding&&Xg.binding("util")}catch{}}(),qr=p$;var bw=qr&&qr.isTypedArray,m$=bw?xn(bw):Rw,Es=m$;var h$=Object.prototype,g$=h$.hasOwnProperty;function y$(t,e){var r=U(t),n=!r&&Si(t),i=!r&&!n&&Un(t),o=!r&&!n&&!i&&Es(t),s=r||n||i||o,a=s?hw(t.length,String):[],c=a.length;for(var u in t)(e||g$.call(t,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||xi(u,c)))&&a.push(u);return a}var Sf=y$;function T$(t,e){return function(r){return t(e(r))}}var bf=T$;var x$=bf(Object.keys,Object),Aw=x$;var v$=Object.prototype,R$=v$.hasOwnProperty;function S$(t){if(!Tn(t))return Aw(t);var e=[];for(var r in Object(t))R$.call(t,r)&&r!="constructor"&&e.push(r);return e}var Af=S$;function b$(t){return dt(t)?Sf(t):Af(t)}var _e=b$;var A$=Object.prototype,w$=A$.hasOwnProperty,k$=mw(function(t,e){if(Tn(e)||dt(e)){yn(e,_e(e),t);return}for(var r in e)w$.call(e,r)&&vi(t,r,e[r])}),Lt=k$;function E$(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var ww=E$;var _$=Object.prototype,C$=_$.hasOwnProperty;function N$(t){if(!Ke(t))return ww(t);var e=Tn(t),r=[];for(var n in t)n=="constructor"&&(e||!C$.call(t,n))||r.push(n);return r}var kw=N$;function P$(t){return dt(t)?Sf(t,!0):kw(t)}var bi=P$;var I$=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,D$=/^\w*$/;function O$(t,e){if(U(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||pn(t)?!0:D$.test(t)||!I$.test(t)||e!=null&&t in Object(e)}var _s=O$;var $$=dr(Object,"create"),qn=$$;function L$(){this.__data__=qn?qn(null):{},this.size=0}var Ew=L$;function M$(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var _w=M$;var F$="__lodash_hash_undefined__",U$=Object.prototype,q$=U$.hasOwnProperty;function j$(t){var e=this.__data__;if(qn){var r=e[t];return r===F$?void 0:r}return q$.call(e,t)?e[t]:void 0}var Cw=j$;var G$=Object.prototype,H$=G$.hasOwnProperty;function W$(t){var e=this.__data__;return qn?e[t]!==void 0:H$.call(e,t)}var Nw=W$;var B$="__lodash_hash_undefined__";function K$(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=qn&&e===void 0?B$:e,this}var Pw=K$;function Cs(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])}}Cs.prototype.clear=Ew;Cs.prototype.delete=_w;Cs.prototype.get=Cw;Cs.prototype.has=Nw;Cs.prototype.set=Pw;var Yg=Cs;function z$(){this.__data__=[],this.size=0}var Iw=z$;function V$(t,e){for(var r=t.length;r--;)if(gn(t[r][0],e))return r;return-1}var Ai=V$;var X$=Array.prototype,Y$=X$.splice;function J$(t){var e=this.__data__,r=Ai(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Y$.call(e,r,1),--this.size,!0}var Dw=J$;function Q$(t){var e=this.__data__,r=Ai(e,t);return r<0?void 0:e[r][1]}var Ow=Q$;function Z$(t){return Ai(this.__data__,t)>-1}var $w=Z$;function eL(t,e){var r=this.__data__,n=Ai(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var Lw=eL;function Ns(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])}}Ns.prototype.clear=Iw;Ns.prototype.delete=Dw;Ns.prototype.get=Ow;Ns.prototype.has=$w;Ns.prototype.set=Lw;var wi=Ns;var tL=dr(ft,"Map"),ki=tL;function rL(){this.size=0,this.__data__={hash:new Yg,map:new(ki||wi),string:new Yg}}var Mw=rL;function nL(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Fw=nL;function iL(t,e){var r=t.__data__;return Fw(e)?r[typeof e=="string"?"string":"hash"]:r.map}var Ei=iL;function oL(t){var e=Ei(this,t).delete(t);return this.size-=e?1:0,e}var Uw=oL;function sL(t){return Ei(this,t).get(t)}var qw=sL;function aL(t){return Ei(this,t).has(t)}var jw=aL;function cL(t,e){var r=Ei(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var Gw=cL;function Ps(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])}}Ps.prototype.clear=Mw;Ps.prototype.delete=Uw;Ps.prototype.get=qw;Ps.prototype.has=jw;Ps.prototype.set=Gw;var io=Ps;var uL="Expected a function";function Jg(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(uL);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(Jg.Cache||io),r}Jg.Cache=io;var Hw=Jg;var lL=500;function fL(t){var e=Hw(t,function(n){return r.size===lL&&r.clear(),n}),r=e.cache;return e}var Ww=fL;var dL=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,pL=/\\(\\)?/g,mL=Ww(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(dL,function(r,n,i,o){e.push(i?o.replace(pL,"$1"):n||r)}),e}),Bw=mL;function hL(t){return t==null?"":BA(t)}var Kw=hL;function gL(t,e){return U(t)?t:_s(t,e)?[t]:Bw(Kw(t))}var _i=gL;var yL=1/0;function TL(t){if(typeof t=="string"||pn(t))return t;var e=t+"";return e=="0"&&1/t==-yL?"-0":e}var vn=TL;function xL(t,e){e=_i(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[vn(e[r++])];return r&&r==n?t:void 0}var Is=xL;function vL(t,e,r){var n=t==null?void 0:Is(t,e);return n===void 0?r:n}var zw=vL;function RL(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var Ds=RL;var Vw=wt?wt.isConcatSpreadable:void 0;function SL(t){return U(t)||Si(t)||!!(Vw&&t&&t[Vw])}var Xw=SL;function Yw(t,e,r,n,i){var o=-1,s=t.length;for(r||(r=Xw),i||(i=[]);++o<s;){var a=t[o];e>0&&r(a)?e>1?Yw(a,e-1,r,n,i):Ds(i,a):n||(i[i.length]=a)}return i}var Os=Yw;function bL(t){var e=t==null?0:t.length;return e?Os(t,1):[]}var ot=bL;var AL=bf(Object.getPrototypeOf,Object),wf=AL;function wL(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 kf=wL;function kL(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 Jw=kL;function EL(){this.__data__=new wi,this.size=0}var Qw=EL;function _L(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Zw=_L;function CL(t){return this.__data__.get(t)}var ek=CL;function NL(t){return this.__data__.has(t)}var tk=NL;var PL=200;function IL(t,e){var r=this.__data__;if(r instanceof wi){var n=r.__data__;if(!ki||n.length<PL-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new io(n)}return r.set(t,e),this.size=r.size,this}var rk=IL;function $s(t){var e=this.__data__=new wi(t);this.size=e.size}$s.prototype.clear=Qw;$s.prototype.delete=Zw;$s.prototype.get=ek;$s.prototype.has=tk;$s.prototype.set=rk;var Ci=$s;function DL(t,e){return t&&yn(e,_e(e),t)}var nk=DL;function OL(t,e){return t&&yn(e,bi(e),t)}var ik=OL;var ck=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ok=ck&&typeof module=="object"&&module&&!module.nodeType&&module,$L=ok&&ok.exports===ck,sk=$L?ft.Buffer:void 0,ak=sk?sk.allocUnsafe:void 0;function LL(t,e){if(e)return t.slice();var r=t.length,n=ak?ak(r):new t.constructor(r);return t.copy(n),n}var uk=LL;function ML(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 Ls=ML;function FL(){return[]}var Ef=FL;var UL=Object.prototype,qL=UL.propertyIsEnumerable,lk=Object.getOwnPropertySymbols,jL=lk?function(t){return t==null?[]:(t=Object(t),Ls(lk(t),function(e){return qL.call(t,e)}))}:Ef,Ms=jL;function GL(t,e){return yn(t,Ms(t),e)}var fk=GL;var HL=Object.getOwnPropertySymbols,WL=HL?function(t){for(var e=[];t;)Ds(e,Ms(t)),t=wf(t);return e}:Ef,_f=WL;function BL(t,e){return yn(t,_f(t),e)}var dk=BL;function KL(t,e,r){var n=e(t);return U(t)?n:Ds(n,r(t))}var Cf=KL;function zL(t){return Cf(t,_e,Ms)}var ac=zL;function VL(t){return Cf(t,bi,_f)}var Nf=VL;var XL=dr(ft,"DataView"),Pf=XL;var YL=dr(ft,"Promise"),If=YL;var JL=dr(ft,"Set"),Ni=JL;var pk="[object Map]",QL="[object Object]",mk="[object Promise]",hk="[object Set]",gk="[object WeakMap]",yk="[object DataView]",ZL=Fn(Pf),eM=Fn(ki),tM=Fn(If),rM=Fn(Ni),nM=Fn(Tf),oo=er;(Pf&&oo(new Pf(new ArrayBuffer(1)))!=yk||ki&&oo(new ki)!=pk||If&&oo(If.resolve())!=mk||Ni&&oo(new Ni)!=hk||Tf&&oo(new Tf)!=gk)&&(oo=function(t){var e=er(t),r=e==QL?t.constructor:void 0,n=r?Fn(r):"";if(n)switch(n){case ZL:return yk;case eM:return pk;case tM:return mk;case rM:return hk;case nM:return gk}return e});var Qr=oo;var iM=Object.prototype,oM=iM.hasOwnProperty;function sM(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&oM.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Tk=sM;var aM=ft.Uint8Array,Fs=aM;function cM(t){var e=new t.constructor(t.byteLength);return new Fs(e).set(new Fs(t)),e}var Us=cM;function uM(t,e){var r=e?Us(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var xk=uM;var lM=/\w*$/;function fM(t){var e=new t.constructor(t.source,lM.exec(t));return e.lastIndex=t.lastIndex,e}var vk=fM;var Rk=wt?wt.prototype:void 0,Sk=Rk?Rk.valueOf:void 0;function dM(t){return Sk?Object(Sk.call(t)):{}}var bk=dM;function pM(t,e){var r=e?Us(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Ak=pM;var mM="[object Boolean]",hM="[object Date]",gM="[object Map]",yM="[object Number]",TM="[object RegExp]",xM="[object Set]",vM="[object String]",RM="[object Symbol]",SM="[object ArrayBuffer]",bM="[object DataView]",AM="[object Float32Array]",wM="[object Float64Array]",kM="[object Int8Array]",EM="[object Int16Array]",_M="[object Int32Array]",CM="[object Uint8Array]",NM="[object Uint8ClampedArray]",PM="[object Uint16Array]",IM="[object Uint32Array]";function DM(t,e,r){var n=t.constructor;switch(e){case SM:return Us(t);case mM:case hM:return new n(+t);case bM:return xk(t,r);case AM:case wM:case kM:case EM:case _M:case CM:case NM:case PM:case IM:return Ak(t,r);case gM:return new n;case yM:case vM:return new n(t);case TM:return vk(t);case xM:return new n;case RM:return bk(t)}}var wk=DM;function OM(t){return typeof t.constructor=="function"&&!Tn(t)?nw(wf(t)):{}}var kk=OM;var $M="[object Map]";function LM(t){return it(t)&&Qr(t)==$M}var Ek=LM;var _k=qr&&qr.isMap,MM=_k?xn(_k):Ek,Ck=MM;var FM="[object Set]";function UM(t){return it(t)&&Qr(t)==FM}var Nk=UM;var Pk=qr&&qr.isSet,qM=Pk?xn(Pk):Nk,Ik=qM;var jM=1,GM=2,HM=4,Dk="[object Arguments]",WM="[object Array]",BM="[object Boolean]",KM="[object Date]",zM="[object Error]",Ok="[object Function]",VM="[object GeneratorFunction]",XM="[object Map]",YM="[object Number]",$k="[object Object]",JM="[object RegExp]",QM="[object Set]",ZM="[object String]",eF="[object Symbol]",tF="[object WeakMap]",rF="[object ArrayBuffer]",nF="[object DataView]",iF="[object Float32Array]",oF="[object Float64Array]",sF="[object Int8Array]",aF="[object Int16Array]",cF="[object Int32Array]",uF="[object Uint8Array]",lF="[object Uint8ClampedArray]",fF="[object Uint16Array]",dF="[object Uint32Array]",Ce={};Ce[Dk]=Ce[WM]=Ce[rF]=Ce[nF]=Ce[BM]=Ce[KM]=Ce[iF]=Ce[oF]=Ce[sF]=Ce[aF]=Ce[cF]=Ce[XM]=Ce[YM]=Ce[$k]=Ce[JM]=Ce[QM]=Ce[ZM]=Ce[eF]=Ce[uF]=Ce[lF]=Ce[fF]=Ce[dF]=!0;Ce[zM]=Ce[Ok]=Ce[tF]=!1;function Df(t,e,r,n,i,o){var s,a=e&jM,c=e&GM,u=e&HM;if(r&&(s=i?r(t,n,i,o):r(t)),s!==void 0)return s;if(!Ke(t))return t;var l=U(t);if(l){if(s=Tk(t),!a)return ow(t,s)}else{var f=Qr(t),d=f==Ok||f==VM;if(Un(t))return uk(t,a);if(f==$k||f==Dk||d&&!i){if(s=c||d?{}:kk(t),!a)return c?dk(t,ik(s,t)):fk(t,nk(s,t))}else{if(!Ce[f])return i?t:{};s=wk(t,f,a)}}o||(o=new Ci);var p=o.get(t);if(p)return p;o.set(t,s),Ik(t)?t.forEach(function(A){s.add(Df(A,e,r,A,t,o))}):Ck(t)&&t.forEach(function(A,S){s.set(S,Df(A,e,r,S,t,o))});var T=u?c?Nf:ac:c?bi:_e,R=l?void 0:T(t);return xf(R||t,function(A,S){R&&(S=A,A=t[S]),vi(s,S,Df(A,e,r,S,t,o))}),s}var Lk=Df;var pF=4;function mF(t){return Lk(t,pF)}var Ne=mF;function hF(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 Rn=hF;var gF="__lodash_hash_undefined__";function yF(t){return this.__data__.set(t,gF),this}var Mk=yF;function TF(t){return this.__data__.has(t)}var Fk=TF;function Of(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new io;++e<r;)this.add(t[e])}Of.prototype.add=Of.prototype.push=Mk;Of.prototype.has=Fk;var qs=Of;function xF(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 $f=xF;function vF(t,e){return t.has(e)}var js=vF;var RF=1,SF=2;function bF(t,e,r,n,i,o){var s=r&RF,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 f=-1,d=!0,p=r&SF?new qs:void 0;for(o.set(t,e),o.set(e,t);++f<a;){var T=t[f],R=e[f];if(n)var A=s?n(R,T,f,e,t,o):n(T,R,f,t,e,o);if(A!==void 0){if(A)continue;d=!1;break}if(p){if(!$f(e,function(S,h){if(!js(p,h)&&(T===S||i(T,S,r,n,o)))return p.push(h)})){d=!1;break}}else if(!(T===R||i(T,R,r,n,o))){d=!1;break}}return o.delete(t),o.delete(e),d}var Lf=bF;function AF(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var Uk=AF;function wF(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Gs=wF;var kF=1,EF=2,_F="[object Boolean]",CF="[object Date]",NF="[object Error]",PF="[object Map]",IF="[object Number]",DF="[object RegExp]",OF="[object Set]",$F="[object String]",LF="[object Symbol]",MF="[object ArrayBuffer]",FF="[object DataView]",qk=wt?wt.prototype:void 0,Qg=qk?qk.valueOf:void 0;function UF(t,e,r,n,i,o,s){switch(r){case FF:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case MF:return!(t.byteLength!=e.byteLength||!o(new Fs(t),new Fs(e)));case _F:case CF:case IF:return gn(+t,+e);case NF:return t.name==e.name&&t.message==e.message;case DF:case $F:return t==e+"";case PF:var a=Uk;case OF:var c=n&kF;if(a||(a=Gs),t.size!=e.size&&!c)return!1;var u=s.get(t);if(u)return u==e;n|=EF,s.set(t,e);var l=Lf(a(t),a(e),n,i,o,s);return s.delete(t),l;case LF:if(Qg)return Qg.call(t)==Qg.call(e)}return!1}var jk=UF;var qF=1,jF=Object.prototype,GF=jF.hasOwnProperty;function HF(t,e,r,n,i,o){var s=r&qF,a=ac(t),c=a.length,u=ac(e),l=u.length;if(c!=l&&!s)return!1;for(var f=c;f--;){var d=a[f];if(!(s?d in e:GF.call(e,d)))return!1}var p=o.get(t),T=o.get(e);if(p&&T)return p==e&&T==t;var R=!0;o.set(t,e),o.set(e,t);for(var A=s;++f<c;){d=a[f];var S=t[d],h=e[d];if(n)var m=s?n(h,S,d,e,t,o):n(S,h,d,t,e,o);if(!(m===void 0?S===h||i(S,h,r,n,o):m)){R=!1;break}A||(A=d=="constructor")}if(R&&!A){var b=t.constructor,_=e.constructor;b!=_&&"constructor"in t&&"constructor"in e&&!(typeof b=="function"&&b instanceof b&&typeof _=="function"&&_ instanceof _)&&(R=!1)}return o.delete(t),o.delete(e),R}var Gk=HF;var WF=1,Hk="[object Arguments]",Wk="[object Array]",Mf="[object Object]",BF=Object.prototype,Bk=BF.hasOwnProperty;function KF(t,e,r,n,i,o){var s=U(t),a=U(e),c=s?Wk:Qr(t),u=a?Wk:Qr(e);c=c==Hk?Mf:c,u=u==Hk?Mf:u;var l=c==Mf,f=u==Mf,d=c==u;if(d&&Un(t)){if(!Un(e))return!1;s=!0,l=!1}if(d&&!l)return o||(o=new Ci),s||Es(t)?Lf(t,e,r,n,i,o):jk(t,e,c,r,n,i,o);if(!(r&WF)){var p=l&&Bk.call(t,"__wrapped__"),T=f&&Bk.call(e,"__wrapped__");if(p||T){var R=p?t.value():t,A=T?e.value():e;return o||(o=new Ci),i(R,A,r,n,o)}}return d?(o||(o=new Ci),Gk(t,e,r,n,i,o)):!1}var Kk=KF;function zk(t,e,r,n,i){return t===e?!0:t==null||e==null||!it(t)&&!it(e)?t!==t&&e!==e:Kk(t,e,r,n,zk,i)}var Ff=zk;var zF=1,VF=2;function XF(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 f=new Ci;if(n)var d=n(u,l,c,t,e,f);if(!(d===void 0?Ff(l,u,zF|VF,n,f):d))return!1}}return!0}var Vk=XF;function YF(t){return t===t&&!Ke(t)}var Uf=YF;function JF(t){for(var e=_e(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,Uf(i)]}return e}var Xk=JF;function QF(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var qf=QF;function ZF(t){var e=Xk(t);return e.length==1&&e[0][2]?qf(e[0][0],e[0][1]):function(r){return r===t||Vk(r,t,e)}}var Yk=ZF;function e1(t,e){return t!=null&&e in Object(t)}var Jk=e1;function t1(t,e,r){e=_i(e,t);for(var n=-1,i=e.length,o=!1;++n<i;){var s=vn(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&&ks(i)&&xi(s,i)&&(U(t)||Si(t)))}var jf=t1;function r1(t,e){return t!=null&&jf(t,e,Jk)}var Qk=r1;var n1=1,i1=2;function o1(t,e){return _s(t)&&Uf(e)?qf(vn(t),e):function(r){var n=zw(r,t);return n===void 0&&n===e?Qk(r,t):Ff(e,n,n1|i1)}}var Zk=o1;function s1(t){return function(e){return e?.[t]}}var eE=s1;function a1(t){return function(e){return Is(e,t)}}var tE=a1;function c1(t){return _s(t)?eE(vn(t)):tE(t)}var rE=c1;function u1(t){return typeof t=="function"?t:t==null?fr:typeof t=="object"?U(t)?Zk(t[0],t[1]):Yk(t):rE(t)}var et=u1;function l1(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 nE=l1;function f1(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 iE=f1;var d1=iE(),oE=d1;function p1(t,e){return t&&oE(t,e,_e)}var sE=p1;function m1(t,e){return function(r,n){if(r==null)return r;if(!dt(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 aE=m1;var h1=aE(sE),pr=h1;function g1(t,e,r,n){return pr(t,function(i,o,s){e(n,i,r(i),s)}),n}var cE=g1;function y1(t,e){return function(r,n){var i=U(r)?nE:cE,o=e?e():{};return i(r,t,et(n,2),o)}}var uE=y1;var lE=Object.prototype,T1=lE.hasOwnProperty,x1=ws(function(t,e){t=Object(t);var r=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&Ri(e[0],e[1],i)&&(n=1);++r<n;)for(var o=e[r],s=bi(o),a=-1,c=s.length;++a<c;){var u=s[a],l=t[u];(l===void 0||gn(l,lE[u])&&!T1.call(t,u))&&(t[u]=o[u])}return t}),Hs=x1;function v1(t){return it(t)&&dt(t)}var Zg=v1;function R1(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 Gf=R1;var S1=200;function b1(t,e,r,n){var i=-1,o=Rf,s=!0,a=t.length,c=[],u=e.length;if(!a)return c;r&&(e=mn(e,xn(r))),n?(o=Gf,s=!1):e.length>=S1&&(o=js,s=!1,e=new qs(e));e:for(;++i<a;){var l=t[i],f=r==null?l:r(l);if(l=n||l!==0?l:0,s&&f===f){for(var d=u;d--;)if(e[d]===f)continue e;c.push(l)}else o(e,f,n)||c.push(l)}return c}var fE=b1;var A1=ws(function(t,e){return Zg(t)?fE(t,Os(e,1,Zg,!0)):[]}),Pi=A1;function w1(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var Sn=w1;function k1(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:hn(e),kf(t,e<0?0:e,n)):[]}var st=k1;function E1(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:hn(e),e=n-e,kf(t,0,e<0?0:e)):[]}var jn=E1;function _1(t){return typeof t=="function"?t:fr}var dE=_1;function C1(t,e){var r=U(t)?xf:pr;return r(t,dE(e))}var O=C1;function N1(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 pE=N1;function P1(t,e){var r=!0;return pr(t,function(n,i,o){return r=!!e(n,i,o),r}),r}var mE=P1;function I1(t,e,r){var n=U(t)?pE:mE;return r&&Ri(t,e,r)&&(e=void 0),n(t,et(e,3))}var zt=I1;function D1(t,e){var r=[];return pr(t,function(n,i,o){e(n,i,o)&&r.push(n)}),r}var Hf=D1;function O1(t,e){var r=U(t)?Ls:Hf;return r(t,et(e,3))}var kt=O1;function $1(t){return function(e,r,n){var i=Object(e);if(!dt(e)){var o=et(r,3);e=_e(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 hE=$1;var L1=Math.max;function M1(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:hn(r);return i<0&&(i=L1(n+i,0)),vf(t,et(e,3),i)}var gE=M1;var F1=hE(gE),bn=F1;function U1(t){return t&&t.length?t[0]:void 0}var Et=U1;function q1(t,e){var r=-1,n=dt(t)?Array(t.length):[];return pr(t,function(i,o,s){n[++r]=e(i,o,s)}),n}var yE=q1;function j1(t,e){var r=U(t)?mn:yE;return r(t,et(e,3))}var C=j1;function G1(t,e){return Os(C(t,e),1)}var Mt=G1;var H1=Object.prototype,W1=H1.hasOwnProperty,B1=uE(function(t,e,r){W1.call(t,r)?t[r].push(e):As(t,r,[e])}),ey=B1;var K1=Object.prototype,z1=K1.hasOwnProperty;function V1(t,e){return t!=null&&z1.call(t,e)}var TE=V1;function X1(t,e){return t!=null&&jf(t,e,TE)}var F=X1;var Y1="[object String]";function J1(t){return typeof t=="string"||!U(t)&&it(t)&&er(t)==Y1}var yt=J1;function Q1(t,e){return mn(e,function(r){return t[r]})}var xE=Q1;function Z1(t){return t==null?[]:xE(t,_e(t))}var Se=Z1;var eU=Math.max;function tU(t,e,r,n){t=dt(t)?t:Se(t),r=r&&!n?hn(r):0;var i=t.length;return r<0&&(r=eU(i+r,0)),yt(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&bs(t,e,r)>-1}var qe=tU;var rU=Math.max;function nU(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:hn(r);return i<0&&(i=rU(n+i,0)),bs(t,e,i)}var Wf=nU;var iU="[object Map]",oU="[object Set]",sU=Object.prototype,aU=sU.hasOwnProperty;function cU(t){if(t==null)return!0;if(dt(t)&&(U(t)||typeof t=="string"||typeof t.splice=="function"||Un(t)||Es(t)||Si(t)))return!t.length;var e=Qr(t);if(e==iU||e==oU)return!t.size;if(Tn(t))return!Af(t).length;for(var r in t)if(aU.call(t,r))return!1;return!0}var Z=cU;var uU="[object RegExp]";function lU(t){return it(t)&&er(t)==uU}var vE=lU;var RE=qr&&qr.isRegExp,fU=RE?xn(RE):vE,jr=fU;function dU(t){return t===void 0}var Vt=dU;function pU(t,e){return t<e}var SE=pU;function mU(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&&!pn(s):r(s,a)))var a=s,c=o}return c}var bE=mU;function hU(t){return t&&t.length?bE(t,fr,SE):void 0}var AE=hU;var gU="Expected a function";function yU(t){if(typeof t!="function")throw new TypeError(gU);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 wE=yU;function TU(t,e,r,n){if(!Ke(t))return t;e=_i(e,t);for(var i=-1,o=e.length,s=o-1,a=t;a!=null&&++i<o;){var c=vn(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=Ke(l)?l:xi(e[i+1])?[]:{})}vi(a,c,u),a=a[c]}return t}var kE=TU;function xU(t,e,r){for(var n=-1,i=e.length,o={};++n<i;){var s=e[n],a=Is(t,s);r(a,s)&&kE(o,_i(s,t),a)}return o}var EE=xU;function vU(t,e){if(t==null)return{};var r=mn(Nf(t),function(n){return[n]});return e=et(e),EE(t,r,function(n,i){return e(n,i[0])})}var mr=vU;function RU(t,e,r,n,i){return i(t,function(o,s,a){r=n?(n=!1,o):e(r,o,s,a)}),r}var _E=RU;function SU(t,e,r){var n=U(t)?Jw:_E,i=arguments.length<3;return n(t,et(e,4),r,i,pr)}var Ve=SU;function bU(t,e){var r=U(t)?Ls:Hf;return r(t,wE(et(e,3)))}var Ii=bU;function AU(t,e){var r;return pr(t,function(n,i,o){return r=e(n,i,o),!r}),!!r}var CE=AU;function wU(t,e,r){var n=U(t)?$f:CE;return r&&Ri(t,e,r)&&(e=void 0),n(t,et(e,3))}var cc=wU;var kU=1/0,EU=Ni&&1/Gs(new Ni([,-0]))[1]==kU?function(t){return new Ni(t)}:ze,NE=EU;var _U=200;function CU(t,e,r){var n=-1,i=Rf,o=t.length,s=!0,a=[],c=a;if(r)s=!1,i=Gf;else if(o>=_U){var u=e?null:NE(t);if(u)return Gs(u);s=!1,i=js,c=new qs}else c=e?[]:a;e:for(;++n<o;){var l=t[n],f=e?e(l):l;if(l=r||l!==0?l:0,s&&f===f){for(var d=c.length;d--;)if(c[d]===f)continue e;e&&c.push(f),a.push(l)}else i(c,f,r)||(c!==a&&c.push(f),a.push(l))}return a}var Bf=CU;function NU(t){return t&&t.length?Bf(t):[]}var Ws=NU;function PU(t,e){return t&&t.length?Bf(t,et(e,2)):[]}var PE=PU;function Bs(t){console&&console.error&&console.error(`Error: ${t}`)}function uc(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function lc(t){let e=new Date().getTime(),r=t();return{time:new Date().getTime()-e,value:r}}function fc(t){function e(){}e.prototype=t;let r=new e;function n(){return typeof r.bar}return n(),n(),t;(0,eval)(t)}function IU(t){return DU(t)?t.LABEL:t.name}function DU(t){return yt(t.LABEL)&&t.LABEL!==""}var Er=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),O(this.definition,r=>{r.accept(e)})}},me=class extends Er{constructor(e){super([]),this.idx=1,Lt(this,mr(e,r=>r!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},rr=class extends Er{constructor(e){super(e.definition),this.orgText="",Lt(this,mr(e,r=>r!==void 0))}},Pe=class extends Er{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Lt(this,mr(e,r=>r!==void 0))}},he=class extends Er{constructor(e){super(e.definition),this.idx=1,Lt(this,mr(e,r=>r!==void 0))}},Ie=class extends Er{constructor(e){super(e.definition),this.idx=1,Lt(this,mr(e,r=>r!==void 0))}},De=class extends Er{constructor(e){super(e.definition),this.idx=1,Lt(this,mr(e,r=>r!==void 0))}},re=class extends Er{constructor(e){super(e.definition),this.idx=1,Lt(this,mr(e,r=>r!==void 0))}},we=class extends Er{constructor(e){super(e.definition),this.idx=1,Lt(this,mr(e,r=>r!==void 0))}},ke=class extends Er{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,Lt(this,mr(e,r=>r!==void 0))}},ee=class{constructor(e){this.idx=1,Lt(this,mr(e,r=>r!==void 0))}accept(e){e.visit(this)}};function Kf(t){return C(t,Ks)}function Ks(t){function e(r){return C(r,Ks)}if(t instanceof me){let r={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return yt(t.label)&&(r.label=t.label),r}else{if(t instanceof Pe)return{type:"Alternative",definition:e(t.definition)};if(t instanceof he)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof Ie)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof De)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:Ks(new ee({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof we)return{type:"RepetitionWithSeparator",idx:t.idx,separator:Ks(new ee({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof re)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof ke)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof ee){let r={type:"Terminal",name:t.terminalType.name,label:IU(t.terminalType),idx:t.idx};yt(t.label)&&(r.terminalLabel=t.label);let n=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(r.pattern=jr(n)?n.source:n),r}else{if(t instanceof rr)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}var nr=class{visit(e){let r=e;switch(r.constructor){case me:return this.visitNonTerminal(r);case Pe:return this.visitAlternative(r);case he:return this.visitOption(r);case Ie:return this.visitRepetitionMandatory(r);case De:return this.visitRepetitionMandatoryWithSeparator(r);case we:return this.visitRepetitionWithSeparator(r);case re:return this.visitRepetition(r);case ke:return this.visitAlternation(r);case ee:return this.visitTerminal(r);case rr: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 ty(t){return t instanceof Pe||t instanceof he||t instanceof re||t instanceof Ie||t instanceof De||t instanceof we||t instanceof ee||t instanceof rr}function so(t,e=[]){return t instanceof he||t instanceof re||t instanceof we?!0:t instanceof ke?cc(t.definition,n=>so(n,e)):t instanceof me&&qe(e,t)?!1:t instanceof Er?(t instanceof me&&e.push(t),zt(t.definition,n=>so(n,e))):!1}function ry(t){return t instanceof ke}function hr(t){if(t instanceof me)return"SUBRULE";if(t instanceof he)return"OPTION";if(t instanceof ke)return"OR";if(t instanceof Ie)return"AT_LEAST_ONE";if(t instanceof De)return"AT_LEAST_ONE_SEP";if(t instanceof we)return"MANY_SEP";if(t instanceof re)return"MANY";if(t instanceof ee)return"CONSUME";throw Error("non exhaustive match")}var Gn=class{walk(e,r=[]){O(e.definition,(n,i)=>{let o=st(e.definition,i+1);if(n instanceof me)this.walkProdRef(n,o,r);else if(n instanceof ee)this.walkTerminal(n,o,r);else if(n instanceof Pe)this.walkFlat(n,o,r);else if(n instanceof he)this.walkOption(n,o,r);else if(n instanceof Ie)this.walkAtLeastOne(n,o,r);else if(n instanceof De)this.walkAtLeastOneSep(n,o,r);else if(n instanceof we)this.walkManySep(n,o,r);else if(n instanceof re)this.walkMany(n,o,r);else if(n instanceof ke)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 he({definition:e.definition})].concat(r,n);this.walk(e,i)}walkAtLeastOneSep(e,r,n){let i=IE(e,r,n);this.walk(e,i)}walkMany(e,r,n){let i=[new he({definition:e.definition})].concat(r,n);this.walk(e,i)}walkManySep(e,r,n){let i=IE(e,r,n);this.walk(e,i)}walkOr(e,r,n){let i=r.concat(n);O(e.definition,o=>{let s=new Pe({definition:[o]});this.walk(s,i)})}};function IE(t,e,r){return[new he({definition:[new ee({terminalType:t.separator})].concat(t.definition)})].concat(e,r)}function ao(t){if(t instanceof me)return ao(t.referencedRule);if(t instanceof ee)return LU(t);if(ty(t))return OU(t);if(ry(t))return $U(t);throw Error("non exhaustive match")}function OU(t){let e=[],r=t.definition,n=0,i=r.length>n,o,s=!0;for(;i&&s;)o=r[n],s=so(o),e=e.concat(ao(o)),n=n+1,i=r.length>n;return Ws(e)}function $U(t){let e=C(t.definition,r=>ao(r));return Ws(ot(e))}function LU(t){return[t.terminalType]}var zf="_~IN~_";var ny=class extends Gn{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=MU(e.referencedRule,e.idx)+this.topProd.name,o=r.concat(n),s=new Pe({definition:o}),a=ao(s);this.follows[i]=a}};function DE(t){let e={};return O(t,r=>{let n=new ny(r).startWalking();Lt(e,n)}),e}function MU(t,e){return t.name+e+zf}var Vf={},FU=new Qi;function zs(t){let e=t.toString();if(Vf.hasOwnProperty(e))return Vf[e];{let r=FU.pattern(e);return Vf[e]=r,r}}function OE(){Vf={}}var LE="Complement Sets are not supported for first char optimization",dc=`Unable to use "first char" lexer optimizations:
|
|
57
|
+
`;function ME(t,e=!1){try{let r=zs(t);return iy(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===LE)e&&uc(`${dc} Unable to optimize: < ${t.toString()} >
|
|
58
58
|
Complement Sets cannot be automatically optimized.
|
|
59
59
|
This will disable the lexer's first char optimizations.
|
|
60
60
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n="";e&&(n=`
|
|
@@ -62,49 +62,49 @@ ${S}`}]}}}))}return l>=0&&(u[l].isPreferred=!0),u}};function QI(t,e){let r=ue.di
|
|
|
62
62
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),Bs(`${dc}
|
|
63
63
|
Failed parsing: < ${t.toString()} >
|
|
64
64
|
Using the @chevrotain/regexp-to-ast library
|
|
65
|
-
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function iy(t,e,r){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)iy(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":Xf(s.value,e,r);break;case"Set":if(s.complement===!0)throw Error(
|
|
66
|
-
`],tracer:(h,m)=>m()});let r=e.tracer;r("initCharCodeToOptimizedIndexMap",()=>{
|
|
65
|
+
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function iy(t,e,r){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)iy(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":Xf(s.value,e,r);break;case"Set":if(s.complement===!0)throw Error(LE);O(s.value,c=>{if(typeof c=="number")Xf(c,e,r);else{let u=c;if(r===!0)for(let l=u.from;l<=u.to;l++)Xf(l,e,r);else{for(let l=u.from;l<=u.to&&l<Vs;l++)Xf(l,e,r);if(u.to>=Vs){let l=u.from>=Vs?u.from:Vs,f=u.to,d=An(l),p=An(f);for(let T=d;T<=p;T++)e[T]=T}}}});break;case"Group":iy(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"&&oy(s)===!1||s.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return Se(e)}function Xf(t,e,r){let n=An(t);e[n]=n,r===!0&&UU(t,e)}function UU(t,e){let r=String.fromCharCode(t),n=r.toUpperCase();if(n!==r){let i=An(n.charCodeAt(0));e[i]=i}else{let i=r.toLowerCase();if(i!==r){let o=An(i.charCodeAt(0));e[o]=o}}}function $E(t,e){return bn(t.value,r=>{if(typeof r=="number")return qe(e,r);{let n=r;return bn(e,i=>n.from<=i&&i<=n.to)!==void 0}})}function oy(t){let e=t.quantifier;return e&&e.atLeast===0?!0:t.value?U(t.value)?zt(t.value,oy):oy(t.value):!1}var sy=class extends ln{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){qe(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?$E(e,this.targetCharCodes)===void 0&&(this.found=!0):$E(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Yf(t,e){if(e instanceof RegExp){let r=zs(e),n=new sy(t);return n.visit(r),n.found}else return bn(e,r=>qe(t,r.charCodeAt(0)))!==void 0}var co="PATTERN",Xs="defaultMode",Jf="modes",cy=typeof new RegExp("(?:)").sticky=="boolean";function qE(t,e){e=Hs(e,{useSticky:cy,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
|
|
66
|
+
`],tracer:(h,m)=>m()});let r=e.tracer;r("initCharCodeToOptimizedIndexMap",()=>{nq()});let n;r("Reject Lexer.NA",()=>{n=Ii(t,h=>h[co]===tt.NA)});let i=!1,o;r("Transform Patterns",()=>{i=!1,o=C(n,h=>{let m=h[co];if(jr(m)){let b=m.source;return b.length===1&&b!=="^"&&b!=="$"&&b!=="."&&!m.ignoreCase?b:b.length===2&&b[0]==="\\"&&!qe(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],b[1])?b[1]:e.useSticky?UE(m):FE(m)}else{if(tr(m))return i=!0,{exec:m};if(typeof m=="object")return i=!0,m;if(typeof m=="string"){if(m.length===1)return m;{let b=m.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),_=new RegExp(b);return e.useSticky?UE(_):FE(_)}}else throw Error("non exhaustive match")}})});let s,a,c,u,l;r("misc mapping",()=>{s=C(n,h=>h.tokenTypeIdx),a=C(n,h=>{let m=h.GROUP;if(m!==tt.SKIPPED){if(yt(m))return m;if(Vt(m))return!1;throw Error("non exhaustive match")}}),c=C(n,h=>{let m=h.LONGER_ALT;if(m)return U(m)?C(m,_=>Wf(n,_)):[Wf(n,m)]}),u=C(n,h=>h.PUSH_MODE),l=C(n,h=>F(h,"POP_MODE"))});let f;r("Line Terminator Handling",()=>{let h=VE(e.lineTerminatorCharacters);f=C(n,m=>!1),e.positionTracking!=="onlyOffset"&&(f=C(n,m=>F(m,"LINE_BREAKS")?!!m.LINE_BREAKS:zE(m,h)===!1&&Yf(h,m.PATTERN)))});let d,p,T,R;r("Misc Mapping #2",()=>{d=C(n,BE),p=C(o,tq),T=Ve(n,(h,m)=>{let b=m.GROUP;return yt(b)&&b!==tt.SKIPPED&&(h[b]=[]),h},{}),R=C(o,(h,m)=>({pattern:o[m],longerAlt:c[m],canLineTerminator:f[m],isCustom:d[m],short:p[m],group:a[m],push:u[m],pop:l[m],tokenTypeIdx:s[m],tokenType:n[m]}))});let A=!0,S=[];return e.safeMode||r("First Char Optimization",()=>{S=Ve(n,(h,m,b)=>{if(typeof m.PATTERN=="string"){let _=m.PATTERN.charCodeAt(0),V=An(_);ay(h,V,R[b])}else if(U(m.START_CHARS_HINT)){let _;O(m.START_CHARS_HINT,V=>{let Ct=typeof V=="string"?V.charCodeAt(0):V,rt=An(Ct);_!==rt&&(_=rt,ay(h,rt,R[b]))})}else if(jr(m.PATTERN))if(m.PATTERN.unicode)A=!1,e.ensureOptimizations&&Bs(`${dc} Unable to analyze < ${m.PATTERN.toString()} > pattern.
|
|
67
67
|
The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|
68
68
|
This will disable the lexer's first char optimizations.
|
|
69
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let _
|
|
69
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let _=ME(m.PATTERN,e.ensureOptimizations);Z(_)&&(A=!1),O(_,V=>{ay(h,V,R[b])})}else e.ensureOptimizations&&Bs(`${dc} TokenType: <${m.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
|
|
70
70
|
This will disable the lexer's first char optimizations.
|
|
71
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),A=!1;return h},[])}),{emptyGroups:T,patternIdxToConfig:
|
|
71
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),A=!1;return h},[])}),{emptyGroups:T,patternIdxToConfig:R,charCodeToPatternIdxToConfig:S,hasCustom:i,canBeOptimized:A}}function jE(t,e){let r=[],n=jU(t);r=r.concat(n.errors);let i=GU(n.valid),o=i.valid;return r=r.concat(i.errors),r=r.concat(qU(o)),r=r.concat(YU(o)),r=r.concat(JU(o,e)),r=r.concat(QU(o)),r}function qU(t){let e=[],r=kt(t,n=>jr(n[co]));return e=e.concat(WU(r)),e=e.concat(zU(r)),e=e.concat(VU(r)),e=e.concat(XU(r)),e=e.concat(BU(r)),e}function jU(t){let e=kt(t,i=>!F(i,co)),r=C(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:je.MISSING_PATTERN,tokenTypes:[i]})),n=Pi(t,e);return{errors:r,valid:n}}function GU(t){let e=kt(t,i=>{let o=i[co];return!jr(o)&&!tr(o)&&!F(o,"exec")&&!yt(o)}),r=C(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:je.INVALID_PATTERN,tokenTypes:[i]})),n=Pi(t,e);return{errors:r,valid:n}}var HU=/[^\\][$]/;function WU(t){class e extends ln{constructor(){super(...arguments),this.found=!1}visitEndAnchor(o){this.found=!0}}let r=kt(t,i=>{let o=i.PATTERN;try{let s=zs(o),a=new e;return a.visit(s),a.found}catch{return HU.test(o.source)}});return C(r,i=>({message:`Unexpected RegExp Anchor Error:
|
|
72
72
|
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|
73
|
-
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:je.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function
|
|
73
|
+
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:je.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function BU(t){let e=kt(t,n=>n.PATTERN.test(""));return C(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:je.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}var KU=/[^\\[][\^]|^\^/;function zU(t){class e extends ln{constructor(){super(...arguments),this.found=!1}visitStartAnchor(o){this.found=!0}}let r=kt(t,i=>{let o=i.PATTERN;try{let s=zs(o),a=new e;return a.visit(s),a.found}catch{return KU.test(o.source)}});return C(r,i=>({message:`Unexpected RegExp Anchor Error:
|
|
74
74
|
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|
75
|
-
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:je.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function
|
|
75
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:je.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function VU(t){let e=kt(t,n=>{let i=n[co];return i instanceof RegExp&&(i.multiline||i.global)});return C(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:je.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}function XU(t){let e=[],r=C(t,o=>Ve(t,(s,a)=>(o.PATTERN.source===a.PATTERN.source&&!qe(e,a)&&a.PATTERN!==tt.NA&&(e.push(a),s.push(a)),s),[]));r=Rn(r);let n=kt(r,o=>o.length>1);return C(n,o=>{let s=C(o,c=>c.name);return{message:`The same RegExp pattern ->${Et(o).PATTERN}<-has been used in all of the following Token Types: ${s.join(", ")} <-`,type:je.DUPLICATE_PATTERNS_FOUND,tokenTypes:o}})}function YU(t){let e=kt(t,n=>{if(!F(n,"GROUP"))return!1;let i=n.GROUP;return i!==tt.SKIPPED&&i!==tt.NA&&!yt(i)});return C(e,n=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:je.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}function JU(t,e){let r=kt(t,i=>i.PUSH_MODE!==void 0&&!qe(e,i.PUSH_MODE));return C(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:je.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function QU(t){let e=[],r=Ve(t,(n,i,o)=>{let s=i.PATTERN;return s===tt.NA||(yt(s)?n.push({str:s,idx:o,tokenType:i}):jr(s)&&eq(s)&&n.push({str:s.source,idx:o,tokenType:i})),n},[]);return O(t,(n,i)=>{O(r,({str:o,idx:s,tokenType:a})=>{if(i<s&&ZU(o,n.PATTERN)){let c=`Token: ->${a.name}<- can never be matched.
|
|
76
76
|
Because it appears AFTER the Token Type ->${n.name}<-in the lexer's definition.
|
|
77
|
-
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:je.UNREACHABLE_PATTERN,tokenTypes:[n,a]})}})}),e}function
|
|
77
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:je.UNREACHABLE_PATTERN,tokenTypes:[n,a]})}})}),e}function ZU(t,e){if(jr(e)){let r=e.exec(t);return r!==null&&r.index===0}else{if(tr(e))return e(t,0,[],{});if(F(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function eq(t){return bn([".","\\","[","]","|","^","$","(",")","?","*","+","{"],r=>t.source.indexOf(r)!==-1)===void 0}function FE(t){let e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function UE(t){let e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function GE(t,e,r){let n=[];return F(t,Xs)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Xs+`> property in its definition
|
|
78
78
|
`,type:je.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),F(t,Jf)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Jf+`> property in its definition
|
|
79
79
|
`,type:je.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),F(t,Jf)&&F(t,Xs)&&!F(t.modes,t.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${Xs}: <${t.defaultMode}>which does not exist
|
|
80
80
|
`,type:je.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),F(t,Jf)&&O(t.modes,(i,o)=>{O(i,(s,a)=>{if(Vt(s))n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${o}> at index: <${a}>
|
|
81
81
|
`,type:je.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(F(s,"LONGER_ALT")){let c=U(s.LONGER_ALT)?s.LONGER_ALT:[s.LONGER_ALT];O(c,u=>{!Vt(u)&&!qe(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}>
|
|
82
|
-
`,type:je.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}function
|
|
82
|
+
`,type:je.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}function HE(t,e,r){let n=[],i=!1,o=Rn(ot(Se(t.modes))),s=Ii(o,c=>c[co]===tt.NA),a=VE(r);return e&&O(s,c=>{let u=zE(c,a);if(u!==!1){let f={message:rq(c,u),type:u.issue,tokenType:c};n.push(f)}else F(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):Yf(a,c.PATTERN)&&(i=!0)}),e&&!i&&n.push({message:`Warning: No LINE_BREAKS Found.
|
|
83
83
|
This Lexer has been defined to track line and column information,
|
|
84
84
|
But none of the Token Types can be identified as matching a line terminator.
|
|
85
85
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|
86
|
-
for details.`,type:je.NO_LINE_BREAKS_FLAGS}),n}function
|
|
86
|
+
for details.`,type:je.NO_LINE_BREAKS_FLAGS}),n}function WE(t){let e={},r=_e(t);return O(r,n=>{let i=t[n];if(U(i))e[n]=[];else throw Error("non exhaustive match")}),e}function BE(t){let e=t.PATTERN;if(jr(e))return!1;if(tr(e))return!0;if(F(e,"exec"))return!0;if(yt(e))return!1;throw Error("non exhaustive match")}function tq(t){return yt(t)&&t.length===1?t.charCodeAt(0):!1}var KE={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 zE(t,e){if(F(t,"LINE_BREAKS"))return!1;if(jr(t.PATTERN)){try{Yf(e,t.PATTERN)}catch(r){return{issue:je.IDENTIFY_TERMINATOR,errMsg:r.message}}return!1}else{if(yt(t.PATTERN))return!1;if(BE(t))return{issue:je.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function rq(t,e){if(e.issue===je.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
|
|
87
87
|
The problem is in the <${t.name}> Token Type
|
|
88
88
|
Root cause: ${e.errMsg}.
|
|
89
89
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===je.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
90
90
|
The problem is in the <${t.name}> Token Type
|
|
91
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function
|
|
91
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function VE(t){return C(t,r=>yt(r)?r.charCodeAt(0):r)}function ay(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}var Vs=256,Qf=[];function An(t){return t<Vs?t:Qf[t]}function nq(){if(Z(Qf)){Qf=new Array(65536);for(let t=0;t<65536;t++)Qf[t]=t>255?255+~~(t/255):t}}function Hn(t,e){let r=t.tokenTypeIdx;return r===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[r]===!0}function Ys(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}var XE=1,JE={};function Wn(t){let e=iq(t);oq(e),aq(e),sq(e),O(e,r=>{r.isParent=r.categoryMatches.length>0})}function iq(t){let e=Ne(t),r=t,n=!0;for(;n;){r=Rn(ot(C(r,o=>o.CATEGORIES)));let i=Pi(r,e);e=e.concat(i),Z(i)?n=!1:r=i}return e}function oq(t){O(t,e=>{uy(e)||(JE[XE]=e,e.tokenTypeIdx=XE++),YE(e)&&!U(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),YE(e)||(e.CATEGORIES=[]),cq(e)||(e.categoryMatches=[]),uq(e)||(e.categoryMatchesMap={})})}function sq(t){O(t,e=>{e.categoryMatches=[],O(e.categoryMatchesMap,(r,n)=>{e.categoryMatches.push(JE[n].tokenTypeIdx)})})}function aq(t){O(t,e=>{QE([],e)})}function QE(t,e){O(t,r=>{e.categoryMatchesMap[r.tokenTypeIdx]=!0}),O(e.CATEGORIES,r=>{let n=t.concat(e);qe(n,r)||QE(n,r)})}function uy(t){return F(t,"tokenTypeIdx")}function YE(t){return F(t,"CATEGORIES")}function cq(t){return F(t,"categoryMatches")}function uq(t){return F(t,"categoryMatchesMap")}function ZE(t){return F(t,"tokenTypeIdx")}var ly={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 je;(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"})(je||(je={}));var pc={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
92
92
|
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:ly,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(pc);var tt=class{constructor(e,r=pc){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}=lc(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.
|
|
93
|
-
a boolean 2nd argument is no longer supported`);this.config=Lt({},pc,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===pc.lineTerminatorsPattern)this.config.lineTerminatorsPattern=
|
|
94
|
-
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),U(e)?i={modes:{defaultMode:Ne(e)},defaultMode:Xs}:(o=!1,i=Ne(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(
|
|
93
|
+
a boolean 2nd argument is no longer supported`);this.config=Lt({},pc,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===pc.lineTerminatorsPattern)this.config.lineTerminatorsPattern=KE;else if(this.config.lineTerminatorCharacters===pc.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
94
|
+
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),U(e)?i={modes:{defaultMode:Ne(e)},defaultMode:Xs}:(o=!1,i=Ne(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(GE(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(HE(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},O(i.modes,(a,c)=>{i.modes[c]=Ii(a,u=>Vt(u))});let s=_e(i.modes);if(O(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(jE(a,s))}),Z(this.lexerDefinitionErrors)){Wn(a);let u;this.TRACE_INIT("analyzeTokenTypes",()=>{u=qE(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=Lt({},this.emptyGroups,u.emptyGroups),this.hasCustom=u.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=u.canBeOptimized}})}),this.defaultMode=i.defaultMode,!Z(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let c=C(this.lexerDefinitionErrors,u=>u.message).join(`-----------------------
|
|
95
95
|
`);throw new Error(`Errors detected in definition of Lexer:
|
|
96
|
-
`+c)}O(this.lexerDefinitionWarning,a=>{uc(a.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(cy?(this.chopInput=
|
|
96
|
+
`+c)}O(this.lexerDefinitionWarning,a=>{uc(a.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(cy?(this.chopInput=fr,this.match=this.matchWithTest):(this.updateLastIndex=ze,this.match=this.matchWithExec),o&&(this.handleModes=ze),this.trackStartLines===!1&&(this.computeNewColumn=fr),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=ze),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{let a=Ve(this.canModeBeOptimized,(c,u,l)=>(u===!1&&c.push(l),c),[]);if(r.ensureOptimizations&&!Z(a))throw Error(`Lexer Modes: < ${a.join(", ")} > cannot be optimized.
|
|
97
97
|
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|
98
|
-
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{
|
|
98
|
+
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{OE()}),this.TRACE_INIT("toFastProperties",()=>{fc(this)})})}tokenize(e,r=this.defaultMode){if(!Z(this.lexerDefinitionErrors)){let i=C(this.lexerDefinitionErrors,o=>o.message).join(`-----------------------
|
|
99
99
|
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
100
|
-
`+i)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let n,i,o,s,a,c,u,l,f,d,p,T,
|
|
101
|
-
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return F(t,
|
|
102
|
-
but found: '`+Et(e).image+"'";if(n)return o+n+a;{let c=Ve(t,(d,p)=>d.concat(p),[]),u=C(c,d=>`[${C(d,p=>
|
|
100
|
+
`+i)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let n,i,o,s,a,c,u,l,f,d,p,T,R,A,S,h,m=e,b=m.length,_=0,V=0,Ct=this.hasCustom?0:Math.floor(e.length/10),rt=new Array(Ct),gr=[],Xt=this.trackStartLines?1:void 0,I=this.trackStartLines?1:void 0,x=WE(this.emptyGroups),D=this.trackStartLines,L=this.config.lineTerminatorsPattern,ne=0,K=[],B=[],xt=[],vt=[];Object.freeze(vt);let oe;function en(){return K}function $c(Rt){let sr=An(Rt),Xn=B[sr];return Xn===void 0?vt:Xn}let ip=Rt=>{if(xt.length===1&&Rt.tokenType.PUSH_MODE===void 0){let sr=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(Rt);gr.push({offset:Rt.startOffset,line:Rt.startLine,column:Rt.startColumn,length:Rt.image.length,message:sr})}else{xt.pop();let sr=Sn(xt);K=this.patternIdxToConfig[sr],B=this.charCodeToPatternIdxToConfig[sr],ne=K.length;let Xn=this.canModeBeOptimized[sr]&&this.config.safeMode===!1;B&&Xn?oe=$c:oe=en}};function ua(Rt){xt.push(Rt),B=this.charCodeToPatternIdxToConfig[Rt],K=this.patternIdxToConfig[Rt],ne=K.length,ne=K.length;let sr=this.canModeBeOptimized[Rt]&&this.config.safeMode===!1;B&&sr?oe=$c:oe=en}ua.call(this,r);let or,Lc=this.config.recoveryEnabled;for(;_<b;){c=null;let Rt=m.charCodeAt(_),sr=oe(Rt),Xn=sr.length;for(n=0;n<Xn;n++){or=sr[n];let Yt=or.pattern;u=null;let Gr=or.short;if(Gr!==!1?Rt===Gr&&(c=Yt):or.isCustom===!0?(h=Yt.exec(m,_,rt,x),h!==null?(c=h[0],h.payload!==void 0&&(u=h.payload)):c=null):(this.updateLastIndex(Yt,_),c=this.match(Yt,e,_)),c!==null){if(a=or.longerAlt,a!==void 0){let Nt=a.length;for(o=0;o<Nt;o++){let Hr=K[a[o]],wn=Hr.pattern;if(l=null,Hr.isCustom===!0?(h=wn.exec(m,_,rt,x),h!==null?(s=h[0],h.payload!==void 0&&(l=h.payload)):s=null):(this.updateLastIndex(wn,_),s=this.match(wn,e,_)),s&&s.length>c.length){c=s,u=l,or=Hr;break}}}break}}if(c!==null){if(f=c.length,d=or.group,d!==void 0&&(p=or.tokenTypeIdx,T=this.createTokenInstance(c,_,p,or.tokenType,Xt,I,f),this.handlePayload(T,u),d===!1?V=this.addToken(rt,V,T):x[d].push(T)),e=this.chopInput(e,f),_=_+f,I=this.computeNewColumn(I,f),D===!0&&or.canLineTerminator===!0){let Yt=0,Gr,Nt;L.lastIndex=0;do Gr=L.test(c),Gr===!0&&(Nt=L.lastIndex-1,Yt++);while(Gr===!0);Yt!==0&&(Xt=Xt+Yt,I=f-Nt,this.updateTokenEndLineColumnLocation(T,d,Nt,Yt,Xt,I,f))}this.handleModes(or,ip,ua,T)}else{let Yt=_,Gr=Xt,Nt=I,Hr=Lc===!1;for(;Hr===!1&&_<b;)for(e=this.chopInput(e,1),_++,i=0;i<ne;i++){let wn=K[i],Yn=wn.pattern,Mc=wn.short;if(Mc!==!1?m.charCodeAt(_)===Mc&&(Hr=!0):wn.isCustom===!0?Hr=Yn.exec(m,_,rt,x)!==null:(this.updateLastIndex(Yn,_),Hr=Yn.exec(e)!==null),Hr===!0)break}if(R=_-Yt,I=this.computeNewColumn(I,R),S=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(m,Yt,R,Gr,Nt),gr.push({offset:Yt,line:Gr,column:Nt,length:R,message:S}),Lc===!1)break}}return this.hasCustom||(rt.length=V),{tokens:rt,groups:x,errors:gr}}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}};tt.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.";tt.NA=/NOT_APPLICABLE/;function Bn(t){return fy(t)?t.LABEL:t.name}function fy(t){return yt(t.LABEL)&&t.LABEL!==""}var lq="parent",e_="categories",t_="label",r_="group",n_="push_mode",i_="pop_mode",o_="longer_alt",s_="line_breaks",a_="start_chars_hint";function Zf(t){return fq(t)}function fq(t){let e=t.pattern,r={};if(r.name=t.name,Vt(e)||(r.PATTERN=e),F(t,lq))throw`The parent property is no longer supported.
|
|
101
|
+
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return F(t,e_)&&(r.CATEGORIES=t[e_]),Wn([r]),F(t,t_)&&(r.LABEL=t[t_]),F(t,r_)&&(r.GROUP=t[r_]),F(t,i_)&&(r.POP_MODE=t[i_]),F(t,n_)&&(r.PUSH_MODE=t[n_]),F(t,o_)&&(r.LONGER_ALT=t[o_]),F(t,s_)&&(r.LINE_BREAKS=t[s_]),F(t,a_)&&(r.START_CHARS_HINT=t[a_]),r}var _r=Zf({name:"EOF",pattern:tt.NA});Wn([_r]);function uo(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 mc(t,e){return Hn(t,e)}var Kn={buildMismatchTokenMessage({expected:t,actual:e,previous:r,ruleName:n}){return`Expecting ${fy(t)?`--> ${Bn(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=`
|
|
102
|
+
but found: '`+Et(e).image+"'";if(n)return o+n+a;{let c=Ve(t,(d,p)=>d.concat(p),[]),u=C(c,d=>`[${C(d,p=>Bn(p)).join(", ")}]`),f=`one of these possible Token sequences:
|
|
103
103
|
${C(u,(d,p)=>` ${p+1}. ${d}`).join(`
|
|
104
104
|
`)}`;return o+f+a}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:r,ruleName:n}){let i="Expecting: ",s=`
|
|
105
105
|
but found: '`+Et(e).image+"'";if(r)return i+r+s;{let c=`expecting at least one iteration which starts with one of these possible Token sequences::
|
|
106
|
-
<${C(t,u=>`[${C(u,l=>
|
|
107
|
-
inside top level rule: ->`+t.name+"<-"}},
|
|
106
|
+
<${C(t,u=>`[${C(u,l=>Bn(l)).join(",")}]`).join(" ,")}>`;return i+c+s}}};Object.freeze(Kn);var c_={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
|
|
107
|
+
inside top level rule: ->`+t.name+"<-"}},Zr={buildDuplicateFoundError(t,e){function r(l){return l instanceof ee?l.terminalType.name:l instanceof me?l.nonTerminalName:""}let n=t.name,i=Et(e),o=i.idx,s=hr(i),a=r(i),c=o>0,u=`->${s}${c?o:""}<- ${a?`with argument: ->${a}<-`:""}
|
|
108
108
|
appears more than once (${e.length} times) in the top level rule: ->${n}<-.
|
|
109
109
|
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
|
|
110
110
|
`;return u=u.replace(/[ \t]+/g," "),u=u.replace(/\s\s+/g,`
|
|
@@ -112,14 +112,14 @@ inside top level rule: ->`+t.name+"<-"}},en={buildDuplicateFoundError(t,e){funct
|
|
|
112
112
|
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>.
|
|
113
113
|
To resolve this make sure each Terminal and Non-Terminal names are unique
|
|
114
114
|
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
|
|
115
|
-
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){let e=C(t.prefixPath,i=>
|
|
115
|
+
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){let e=C(t.prefixPath,i=>Bn(i)).join(", "),r=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
|
|
116
116
|
in <OR${r}> inside <${t.topLevelRule.name}> Rule,
|
|
117
117
|
<${e}> may appears as a prefix path in all these alternatives.
|
|
118
118
|
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
|
|
119
|
-
For Further details.`},buildAlternationAmbiguityError(t){let e=C(t.prefixPath,i=>
|
|
119
|
+
For Further details.`},buildAlternationAmbiguityError(t){let e=C(t.prefixPath,i=>Bn(i)).join(", "),r=t.alternation.idx===0?"":t.alternation.idx,n=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${r}> inside <${t.topLevelRule.name}> Rule,
|
|
120
120
|
<${e}> may appears as a prefix path in all these alternatives.
|
|
121
121
|
`;return n=n+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
122
|
-
For Further details.`,n},buildEmptyRepetitionError(t){let e=
|
|
122
|
+
For Further details.`,n},buildEmptyRepetitionError(t){let e=hr(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens.
|
|
123
123
|
This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
|
|
124
124
|
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives:
|
|
125
125
|
<OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
|
|
@@ -128,43 +128,43 @@ rule: <${e}> can be invoked from itself (directly or indirectly)
|
|
|
128
128
|
without consuming any Tokens. The grammar path that causes this is:
|
|
129
129
|
${n}
|
|
130
130
|
To fix this refactor your grammar to remove the left recursion.
|
|
131
|
-
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof rr?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function a_(t,e){let r=new dy(t,e);return r.resolveRefs(),r.errors}var dy=class extends nr{constructor(e,r){super(),this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){O(Se(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:Tt.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}};var py=class extends Hn{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=Ne(this.path.ruleStack).reverse(),this.occurrenceStack=Ne(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(){Z(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},ed=class extends py{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 Pe({definition:i});this.possibleTokTypes=ao(o),this.found=!0}}},Js=class extends Hn{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}},td=class extends Js{walkMany(e,r,n){if(e.idx===this.occurrence){let i=Et(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ee&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,r,n)}},hc=class extends Js{walkManySep(e,r,n){if(e.idx===this.occurrence){let i=Et(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ee&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,r,n)}},rd=class extends Js{walkAtLeastOne(e,r,n){if(e.idx===this.occurrence){let i=Et(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ee&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,r,n)}},gc=class extends Js{walkAtLeastOneSep(e,r,n){if(e.idx===this.occurrence){let i=Et(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ee&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,r,n)}};function nd(t,e,r=[]){r=Ne(r);let n=[],i=0;function o(a){return a.concat(st(t,i+1))}function s(a){let c=nd(o(a),e,r);return n.concat(c)}for(;r.length<e&&i<t.length;){let a=t[i];if(a instanceof Pe)return s(a.definition);if(a instanceof me)return s(a.definition);if(a instanceof he)n=s(a.definition);else if(a instanceof Ie){let c=a.definition.concat([new re({definition:a.definition})]);return s(c)}else if(a instanceof De){let c=[new Pe({definition:a.definition}),new re({definition:[new ee({terminalType:a.separator})].concat(a.definition)})];return s(c)}else if(a instanceof we){let c=a.definition.concat([new re({definition:[new ee({terminalType:a.separator})].concat(a.definition)})]);n=s(c)}else if(a instanceof re){let c=a.definition.concat([new re({definition:a.definition})]);n=s(c)}else{if(a instanceof ke)return O(a.definition,c=>{Z(c.definition)===!1&&(n=s(c.definition))}),n;if(a instanceof ee)r.push(a.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:r,suffixDef:st(t,i)}),n}function id(t,e,r,n){let i="EXIT_NONE_TERMINAL",o=[i],s="EXIT_ALTERNATIVE",a=!1,c=e.length,u=c-n-1,l=[],f=[];for(f.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!Z(f);){let d=f.pop();if(d===s){a&&An(f).idx<=u&&f.pop();continue}let p=d.def,T=d.idx,S=d.ruleStack,A=d.occurrenceStack;if(Z(p))continue;let x=p[0];if(x===i){let h={idx:T,def:st(p),ruleStack:Gn(S),occurrenceStack:Gn(A)};f.push(h)}else if(x instanceof ee)if(T<c-1){let h=T+1,m=e[h];if(r(m,x.terminalType)){let b={idx:h,def:st(p),ruleStack:S,occurrenceStack:A};f.push(b)}}else if(T===c-1)l.push({nextTokenType:x.terminalType,nextTokenOccurrence:x.idx,ruleStack:S,occurrenceStack:A}),a=!0;else throw Error("non exhaustive match");else if(x instanceof me){let h=Ne(S);h.push(x.nonTerminalName);let m=Ne(A);m.push(x.idx);let b={idx:T,def:x.definition.concat(o,st(p)),ruleStack:h,occurrenceStack:m};f.push(b)}else if(x instanceof he){let h={idx:T,def:st(p),ruleStack:S,occurrenceStack:A};f.push(h),f.push(s);let m={idx:T,def:x.definition.concat(st(p)),ruleStack:S,occurrenceStack:A};f.push(m)}else if(x instanceof Ie){let h=new re({definition:x.definition,idx:x.idx}),m=x.definition.concat([h],st(p)),b={idx:T,def:m,ruleStack:S,occurrenceStack:A};f.push(b)}else if(x instanceof De){let h=new ee({terminalType:x.separator}),m=new re({definition:[h].concat(x.definition),idx:x.idx}),b=x.definition.concat([m],st(p)),_={idx:T,def:b,ruleStack:S,occurrenceStack:A};f.push(_)}else if(x instanceof we){let h={idx:T,def:st(p),ruleStack:S,occurrenceStack:A};f.push(h),f.push(s);let m=new ee({terminalType:x.separator}),b=new re({definition:[m].concat(x.definition),idx:x.idx}),_=x.definition.concat([b],st(p)),V={idx:T,def:_,ruleStack:S,occurrenceStack:A};f.push(V)}else if(x instanceof re){let h={idx:T,def:st(p),ruleStack:S,occurrenceStack:A};f.push(h),f.push(s);let m=new re({definition:x.definition,idx:x.idx}),b=x.definition.concat([m],st(p)),_={idx:T,def:b,ruleStack:S,occurrenceStack:A};f.push(_)}else if(x instanceof ke)for(let h=x.definition.length-1;h>=0;h--){let m=x.definition[h],b={idx:T,def:m.definition.concat(st(p)),ruleStack:S,occurrenceStack:A};f.push(b),f.push(s)}else if(x instanceof Pe)f.push({idx:T,def:x.definition.concat(st(p)),ruleStack:S,occurrenceStack:A});else if(x instanceof rr)f.push(lq(x,T,S,A));else throw Error("non exhaustive match")}return l}function lq(t,e,r,n){let i=Ne(r);i.push(t.name);let o=Ne(n);return o.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:o}}var Ge;(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"})(Ge||(Ge={}));function yc(t){if(t instanceof he||t==="Option")return Ge.OPTION;if(t instanceof re||t==="Repetition")return Ge.REPETITION;if(t instanceof Ie||t==="RepetitionMandatory")return Ge.REPETITION_MANDATORY;if(t instanceof De||t==="RepetitionMandatoryWithSeparator")return Ge.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof we||t==="RepetitionWithSeparator")return Ge.REPETITION_WITH_SEPARATOR;if(t instanceof ke||t==="Alternation")return Ge.ALTERNATION;throw Error("non exhaustive match")}function sd(t){let{occurrence:e,rule:r,prodType:n,maxLookahead:i}=t,o=yc(n);return o===Ge.ALTERNATION?Qs(e,r,i):Zs(e,r,o,i)}function u_(t,e,r,n,i,o){let s=Qs(t,e,r),a=h_(s)?Ys:Wn;return o(s,n,a,i)}function l_(t,e,r,n,i,o){let s=Zs(t,e,i,r),a=h_(s)?Ys:Wn;return o(s[0],a,n)}function f_(t,e,r,n){let i=t.length,o=zt(t,s=>zt(s,a=>a.length===1));if(e)return function(s){let a=C(s,c=>c.GATE);for(let c=0;c<i;c++){let u=t[c],l=u.length,f=a[c];if(!(f!==void 0&&f.call(this)===!1))e:for(let d=0;d<l;d++){let p=u[d],T=p.length;for(let S=0;S<T;S++){let A=this.LA(S+1);if(r(A,p[S])===!1)continue e}return c}}};if(o&&!n){let s=C(t,c=>ot(c)),a=Ve(s,(c,u,l)=>(O(u,f=>{F(c,f.tokenTypeIdx)||(c[f.tokenTypeIdx]=l),O(f.categoryMatches,d=>{F(c,d)||(c[d]=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],f=l.length;for(let d=0;d<f;d++){let p=this.LA(d+1);if(r(p,l[d])===!1)continue e}return s}}}}function d_(t,e,r){let n=zt(t,o=>o.length===1),i=t.length;if(n&&!r){let o=ot(t);if(o.length===1&&Z(o[0].categoryMatches)){let a=o[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===a}}else{let s=Ve(o,(a,c,u)=>(a[c.tokenTypeIdx]=!0,O(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 hy=class extends Hn{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,Ge.OPTION,r,n)||super.walkOption(e,r,n)}walkAtLeastOne(e,r,n){this.checkIsTarget(e,Ge.REPETITION_MANDATORY,r,n)||super.walkOption(e,r,n)}walkAtLeastOneSep(e,r,n){this.checkIsTarget(e,Ge.REPETITION_MANDATORY_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}walkMany(e,r,n){this.checkIsTarget(e,Ge.REPETITION,r,n)||super.walkOption(e,r,n)}walkManySep(e,r,n){this.checkIsTarget(e,Ge.REPETITION_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}},od=class extends nr{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,Ge.OPTION)}visitRepetition(e){this.checkIsTarget(e,Ge.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,Ge.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,Ge.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,Ge.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,Ge.ALTERNATION)}};function c_(t){let e=new Array(t);for(let r=0;r<t;r++)e[r]=[];return e}function my(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 fq(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 p_(t,e){let r=C(t,s=>nd([s],1)),n=c_(r.length),i=C(r,s=>{let a={};return O(s,c=>{let u=my(c.partialPath);O(u,l=>{a[l]=!0})}),a}),o=r;for(let s=1;s<=e;s++){let a=o;o=c_(a.length);for(let c=0;c<a.length;c++){let u=a[c];for(let l=0;l<u.length;l++){let f=u[l].partialPath,d=u[l].suffixDef,p=my(f);if(fq(i,p,c)||Z(d)||f.length===e){let S=n[c];if(ad(S,f)===!1){S.push(f);for(let A=0;A<p.length;A++){let x=p[A];i[c][x]=!0}}}else{let S=nd(d,s+1,f);o[c]=o[c].concat(S),O(S,A=>{let x=my(A.partialPath);O(x,h=>{i[c][h]=!0})})}}}}return n}function Qs(t,e,r,n){let i=new od(t,Ge.ALTERNATION,n);return e.accept(i),p_(i.result,r)}function Zs(t,e,r,n){let i=new od(t,r);e.accept(i);let o=i.result,a=new hy(e,t,r).startWalking(),c=new Pe({definition:o}),u=new Pe({definition:a});return p_([c,u],n)}function ad(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 m_(t,e){return t.length<e.length&&zt(t,(r,n)=>{let i=e[n];return r===i||i.categoryMatchesMap[r.tokenTypeIdx]})}function h_(t){return zt(t,e=>zt(e,r=>zt(r,n=>Z(n.categoryMatches))))}function g_(t){let e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return C(e,r=>Object.assign({type:Tt.CUSTOM_LOOKAHEAD_VALIDATION},r))}function y_(t,e,r,n){let i=Mt(t,c=>dq(c,r)),o=Tq(t,e,r),s=Mt(t,c=>hq(c,r)),a=Mt(t,c=>mq(c,t,n,r));return i.concat(o,s,a)}function dq(t,e){let r=new gy;t.accept(r);let n=r.allProductions,i=ey(n,pq),o=gr(i,a=>a.length>1);return C(Se(o),a=>{let c=Et(a),u=e.buildDuplicateFoundError(t,a),l=yr(c),f={message:u,type:Tt.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:l,occurrence:c.idx},d=T_(c);return d&&(f.parameter=d),f})}function pq(t){return`${yr(t)}_#_${t.idx}_#_${T_(t)}`}function T_(t){return t instanceof ee?t.terminalType.name:t instanceof me?t.nonTerminalName:""}var gy=class extends nr{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 mq(t,e,r,n){let i=[];if(Ve(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:Tt.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function x_(t,e,r){let n=[],i;return qe(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:Tt.INVALID_RULE_OVERRIDE,ruleName:t})),n}function Ty(t,e,r,n=[]){let i=[],o=cd(e.definition);if(Z(o))return[];{let s=t.name;qe(o,t)&&i.push({message:r.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:Tt.LEFT_RECURSION,ruleName:s});let c=Ni(o,n.concat([t])),u=Mt(c,l=>{let f=Ne(n);return f.push(l),Ty(t,l,r,f)});return i.concat(u)}}function cd(t){let e=[];if(Z(t))return e;let r=Et(t);if(r instanceof me)e.push(r.referencedRule);else if(r instanceof Pe||r instanceof he||r instanceof Ie||r instanceof De||r instanceof we||r instanceof re)e=e.concat(cd(r.definition));else if(r instanceof ke)e=ot(C(r.definition,o=>cd(o.definition)));else if(!(r instanceof ee))throw Error("non exhaustive match");let n=so(r),i=t.length>1;if(n&&i){let o=st(t);return e.concat(cd(o))}else return e}var Tc=class extends nr{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function v_(t,e){let r=new Tc;t.accept(r);let n=r.alternations;return Mt(n,o=>{let s=Gn(o.definition);return Mt(s,(a,c)=>{let u=id([a],[],Wn,1);return Z(u)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:o,emptyChoiceIdx:c}),type:Tt.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:o.idx,alternative:c+1}]:[]})})}function R_(t,e,r){let n=new Tc;t.accept(n);let i=n.alternations;return i=Pi(i,s=>s.ignoreAmbiguities===!0),Mt(i,s=>{let a=s.idx,c=s.maxLookahead||e,u=Qs(a,t,c,s),l=gq(u,s,t,r),f=yq(u,s,t,r);return l.concat(f)})}var yy=class extends nr{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 hq(t,e){let r=new Tc;t.accept(r);let n=r.alternations;return Mt(n,o=>o.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:o}),type:Tt.TOO_MANY_ALTS,ruleName:t.name,occurrence:o.idx}]:[])}function S_(t,e,r){let n=[];return O(t,i=>{let o=new yy;i.accept(o);let s=o.allProductions;O(s,a=>{let c=yc(a),u=a.maxLookahead||e,l=a.idx,d=Zs(l,i,c,u)[0];if(Z(ot(d))){let p=r.buildEmptyRepetitionError({topLevelRule:i,repetition:a});n.push({message:p,type:Tt.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function gq(t,e,r,n){let i=[],o=Ve(t,(a,c,u)=>(e.definition[u].ignoreAmbiguities===!0||O(c,l=>{let f=[u];O(t,(d,p)=>{u!==p&&ad(d,l)&&e.definition[p].ignoreAmbiguities!==!0&&f.push(p)}),f.length>1&&!ad(i,l)&&(i.push(l),a.push({alts:f,path:l}))}),a),[]);return C(o,a=>{let c=C(a.alts,l=>l+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:c,prefixPath:a.path}),type:Tt.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:e.idx,alternatives:a.alts}})}function yq(t,e,r,n){let i=Ve(t,(s,a,c)=>{let u=C(a,l=>({idx:c,path:l}));return s.concat(u)},[]);return bn(Mt(i,s=>{if(e.definition[s.idx].ignoreAmbiguities===!0)return[];let c=s.idx,u=s.path,l=kt(i,d=>e.definition[d.idx].ignoreAmbiguities!==!0&&d.idx<c&&m_(d.path,u));return C(l,d=>{let p=[d.idx+1,c+1],T=e.idx===0?"":e.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:p,prefixPath:d.path}),type:Tt.AMBIGUOUS_PREFIX_ALTS,ruleName:r.name,occurrence:T,alternatives:p}})}))}function Tq(t,e,r){let n=[],i=C(e,o=>o.name);return O(t,o=>{let s=o.name;if(qe(i,s)){let a=r.buildNamespaceConflictError(o);n.push({message:a,type:Tt.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:s})}}),n}function b_(t){let e=Hs(t,{errMsgProvider:s_}),r={};return O(t.rules,n=>{r[n.name]=n}),a_(r,e.errMsgProvider)}function A_(t){return t=Hs(t,{errMsgProvider:en}),y_(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}var w_="MismatchedTokenException",k_="NoViableAltException",E_="EarlyExitException",__="NotAllInputParsedException",C_=[w_,k_,E_,__];Object.freeze(C_);function Ii(t){return qe(C_,t.name)}var ea=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)}},lo=class extends ea{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=w_}},xc=class extends ea{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=k_}},vc=class extends ea{constructor(e,r){super(e,r),this.name=__}},Rc=class extends ea{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=E_}};var xy={},Ry="InRuleRecoveryException",vy=class extends Error{constructor(e){super(e),this.name=Ry}},ud=class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=F(e,"recoveryEnabled")?e.recoveryEnabled:or.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=xq)}getTokenToInsert(e){let r=uo(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),f=()=>{let d=this.LA(0),p=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:u,previous:d,ruleName:this.getCurrRuleFullName()}),T=new lo(p,u,this.LA(0));T.resyncedTokens=Gn(a),this.SAVE_ERROR(T)};for(;!c;)if(this.tokenMatcher(l,i)){f();return}else if(n.call(this)){f(),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 vy("sad sad panda")}canPerformInRuleRecovery(e,r){return this.canRecoverWithSingleTokenInsertion(e,r)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,r){if(!this.canTokenTypeBeInsertedInRecovery(e)||Z(r))return!1;let n=this.LA(1);return wn(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 qe(n,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),r=this.LA(1),n=2;for(;;){let i=wn(e,o=>mc(r,o));if(i!==void 0)return i;r=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return xy;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 C(e,(n,i)=>i===0?xy:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:r[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){let e=C(this.buildFullFollowKeyStack(),r=>this.getFollowSetFromFollowKey(r));return ot(e)}getFollowSetFromFollowKey(e){if(e===xy)return[ir];let r=e.ruleName+e.idxInCallingRule+zf+e.inRule;return this.resyncFollows[r]}addToResyncTokens(e,r){return this.tokenMatcher(e,ir)||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 Gn(r)}attemptInRepetitionRecovery(e,r,n,i,o,s,a){}getCurrentGrammarPath(e,r){let n=this.getHumanReadableRuleStack(),i=Ne(this.RULE_OCCURRENCE_STACK);return{ruleStack:n,occurrenceStack:i,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return C(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}};function xq(t,e,r,n,i,o,s){let a=this.getKeyForAutomaticLookahead(n,i),c=this.firstAfterRepMap[a];if(c===void 0){let d=this.getCurrRuleFullName(),p=this.getGAstProductions()[d];c=new o(p,i).startWalking(),this.firstAfterRepMap[a]=c}let u=c.token,l=c.occurrence,f=c.isEndOfRule;this.RULE_STACK.length===1&&f&&u===void 0&&(u=ir,l=1),!(u===void 0||l===void 0)&&this.shouldInRepetitionRecoveryBeTried(u,l,s)&&this.tryInRepetitionRecovery(t,e,r,u)}function ld(t,e,r){return r|e|t}var Qre=32-8;var Vn=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(Z(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 Mt(e,r=>Ty(r,r,en))}validateEmptyOrAlternatives(e){return Mt(e,r=>v_(r,en))}validateAmbiguousAlternationAlternatives(e,r){return Mt(e,n=>R_(n,r,en))}validateSomeNonEmptyLookaheadPath(e,r){return S_(e,r,en)}buildLookaheadForAlternation(e){return u_(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,f_)}buildLookaheadForOptional(e){return l_(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,yc(e.prodType),d_)}};var dd=class{initLooksAhead(e){this.dynamicTokensEnabled=F(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:or.dynamicTokensEnabled,this.maxLookahead=F(e,"maxLookahead")?e.maxLookahead:or.maxLookahead,this.lookaheadStrategy=F(e,"lookaheadStrategy")?e.lookaheadStrategy:new Vn({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){O(e,r=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{let{alternation:n,repetition:i,option:o,repetitionMandatory:s,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:c}=vq(r);O(n,u=>{let l=u.idx===0?"":u.idx;this.TRACE_INIT(`${yr(u)}${l}`,()=>{let f=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:u.idx,rule:r,maxLookahead:u.maxLookahead||this.maxLookahead,hasPredicates:u.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),d=ld(this.fullRuleNameToShort[r.name],256,u.idx);this.setLaFuncCache(d,f)})}),O(i,u=>{this.computeLookaheadFunc(r,u.idx,768,"Repetition",u.maxLookahead,yr(u))}),O(o,u=>{this.computeLookaheadFunc(r,u.idx,512,"Option",u.maxLookahead,yr(u))}),O(s,u=>{this.computeLookaheadFunc(r,u.idx,1024,"RepetitionMandatory",u.maxLookahead,yr(u))}),O(a,u=>{this.computeLookaheadFunc(r,u.idx,1536,"RepetitionMandatoryWithSeparator",u.maxLookahead,yr(u))}),O(c,u=>{this.computeLookaheadFunc(r,u.idx,1280,"RepetitionWithSeparator",u.maxLookahead,yr(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=ld(this.fullRuleNameToShort[e.name],n,r);this.setLaFuncCache(c,a)})}getKeyForAutomaticLookahead(e,r){let n=this.getLastExplicitRuleShortName();return ld(n,e,r)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,r){this.lookAheadFuncsCache.set(e,r)}},Sy=class extends nr{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)}},fd=new Sy;function vq(t){fd.reset(),t.accept(fd);let e=fd.dslMethods;return fd.reset(),e}function wy(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function ky(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 N_(t,e,r){t.children[r]===void 0?t.children[r]=[e]:t.children[r].push(e)}function P_(t,e,r){t.children[e]===void 0?t.children[e]=[r]:t.children[e].push(r)}var Rq="name";function Ey(t,e){Object.defineProperty(t,Rq,{enumerable:!1,configurable:!0,writable:!1,value:e})}function Sq(t,e){let r=_e(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 I_(t,e){let r=function(){};Ey(r,t+"BaseSemantics");let n={visit:function(i,o){if(U(i)&&(i=i[0]),!Vt(i))return this[i.name](i.children,o)},validateVisitor:function(){let i=bq(this,e);if(!Z(i)){let o=C(i,s=>s.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
131
|
+
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof rr?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function u_(t,e){let r=new dy(t,e);return r.resolveRefs(),r.errors}var dy=class extends nr{constructor(e,r){super(),this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){O(Se(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:Tt.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}};var py=class extends Gn{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=Ne(this.path.ruleStack).reverse(),this.occurrenceStack=Ne(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(){Z(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},ed=class extends py{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 Pe({definition:i});this.possibleTokTypes=ao(o),this.found=!0}}},Js=class extends Gn{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}},td=class extends Js{walkMany(e,r,n){if(e.idx===this.occurrence){let i=Et(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ee&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,r,n)}},hc=class extends Js{walkManySep(e,r,n){if(e.idx===this.occurrence){let i=Et(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ee&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,r,n)}},rd=class extends Js{walkAtLeastOne(e,r,n){if(e.idx===this.occurrence){let i=Et(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ee&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,r,n)}},gc=class extends Js{walkAtLeastOneSep(e,r,n){if(e.idx===this.occurrence){let i=Et(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof ee&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,r,n)}};function nd(t,e,r=[]){r=Ne(r);let n=[],i=0;function o(a){return a.concat(st(t,i+1))}function s(a){let c=nd(o(a),e,r);return n.concat(c)}for(;r.length<e&&i<t.length;){let a=t[i];if(a instanceof Pe)return s(a.definition);if(a instanceof me)return s(a.definition);if(a instanceof he)n=s(a.definition);else if(a instanceof Ie){let c=a.definition.concat([new re({definition:a.definition})]);return s(c)}else if(a instanceof De){let c=[new Pe({definition:a.definition}),new re({definition:[new ee({terminalType:a.separator})].concat(a.definition)})];return s(c)}else if(a instanceof we){let c=a.definition.concat([new re({definition:[new ee({terminalType:a.separator})].concat(a.definition)})]);n=s(c)}else if(a instanceof re){let c=a.definition.concat([new re({definition:a.definition})]);n=s(c)}else{if(a instanceof ke)return O(a.definition,c=>{Z(c.definition)===!1&&(n=s(c.definition))}),n;if(a instanceof ee)r.push(a.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:r,suffixDef:st(t,i)}),n}function id(t,e,r,n){let i="EXIT_NONE_TERMINAL",o=[i],s="EXIT_ALTERNATIVE",a=!1,c=e.length,u=c-n-1,l=[],f=[];for(f.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!Z(f);){let d=f.pop();if(d===s){a&&Sn(f).idx<=u&&f.pop();continue}let p=d.def,T=d.idx,R=d.ruleStack,A=d.occurrenceStack;if(Z(p))continue;let S=p[0];if(S===i){let h={idx:T,def:st(p),ruleStack:jn(R),occurrenceStack:jn(A)};f.push(h)}else if(S instanceof ee)if(T<c-1){let h=T+1,m=e[h];if(r(m,S.terminalType)){let b={idx:h,def:st(p),ruleStack:R,occurrenceStack:A};f.push(b)}}else if(T===c-1)l.push({nextTokenType:S.terminalType,nextTokenOccurrence:S.idx,ruleStack:R,occurrenceStack:A}),a=!0;else throw Error("non exhaustive match");else if(S instanceof me){let h=Ne(R);h.push(S.nonTerminalName);let m=Ne(A);m.push(S.idx);let b={idx:T,def:S.definition.concat(o,st(p)),ruleStack:h,occurrenceStack:m};f.push(b)}else if(S instanceof he){let h={idx:T,def:st(p),ruleStack:R,occurrenceStack:A};f.push(h),f.push(s);let m={idx:T,def:S.definition.concat(st(p)),ruleStack:R,occurrenceStack:A};f.push(m)}else if(S instanceof Ie){let h=new re({definition:S.definition,idx:S.idx}),m=S.definition.concat([h],st(p)),b={idx:T,def:m,ruleStack:R,occurrenceStack:A};f.push(b)}else if(S instanceof De){let h=new ee({terminalType:S.separator}),m=new re({definition:[h].concat(S.definition),idx:S.idx}),b=S.definition.concat([m],st(p)),_={idx:T,def:b,ruleStack:R,occurrenceStack:A};f.push(_)}else if(S instanceof we){let h={idx:T,def:st(p),ruleStack:R,occurrenceStack:A};f.push(h),f.push(s);let m=new ee({terminalType:S.separator}),b=new re({definition:[m].concat(S.definition),idx:S.idx}),_=S.definition.concat([b],st(p)),V={idx:T,def:_,ruleStack:R,occurrenceStack:A};f.push(V)}else if(S instanceof re){let h={idx:T,def:st(p),ruleStack:R,occurrenceStack:A};f.push(h),f.push(s);let m=new re({definition:S.definition,idx:S.idx}),b=S.definition.concat([m],st(p)),_={idx:T,def:b,ruleStack:R,occurrenceStack:A};f.push(_)}else if(S instanceof ke)for(let h=S.definition.length-1;h>=0;h--){let m=S.definition[h],b={idx:T,def:m.definition.concat(st(p)),ruleStack:R,occurrenceStack:A};f.push(b),f.push(s)}else if(S instanceof Pe)f.push({idx:T,def:S.definition.concat(st(p)),ruleStack:R,occurrenceStack:A});else if(S instanceof rr)f.push(dq(S,T,R,A));else throw Error("non exhaustive match")}return l}function dq(t,e,r,n){let i=Ne(r);i.push(t.name);let o=Ne(n);return o.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:o}}var Ge;(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"})(Ge||(Ge={}));function yc(t){if(t instanceof he||t==="Option")return Ge.OPTION;if(t instanceof re||t==="Repetition")return Ge.REPETITION;if(t instanceof Ie||t==="RepetitionMandatory")return Ge.REPETITION_MANDATORY;if(t instanceof De||t==="RepetitionMandatoryWithSeparator")return Ge.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof we||t==="RepetitionWithSeparator")return Ge.REPETITION_WITH_SEPARATOR;if(t instanceof ke||t==="Alternation")return Ge.ALTERNATION;throw Error("non exhaustive match")}function sd(t){let{occurrence:e,rule:r,prodType:n,maxLookahead:i}=t,o=yc(n);return o===Ge.ALTERNATION?Qs(e,r,i):Zs(e,r,o,i)}function f_(t,e,r,n,i,o){let s=Qs(t,e,r),a=y_(s)?Ys:Hn;return o(s,n,a,i)}function d_(t,e,r,n,i,o){let s=Zs(t,e,i,r),a=y_(s)?Ys:Hn;return o(s[0],a,n)}function p_(t,e,r,n){let i=t.length,o=zt(t,s=>zt(s,a=>a.length===1));if(e)return function(s){let a=C(s,c=>c.GATE);for(let c=0;c<i;c++){let u=t[c],l=u.length,f=a[c];if(!(f!==void 0&&f.call(this)===!1))e:for(let d=0;d<l;d++){let p=u[d],T=p.length;for(let R=0;R<T;R++){let A=this.LA(R+1);if(r(A,p[R])===!1)continue e}return c}}};if(o&&!n){let s=C(t,c=>ot(c)),a=Ve(s,(c,u,l)=>(O(u,f=>{F(c,f.tokenTypeIdx)||(c[f.tokenTypeIdx]=l),O(f.categoryMatches,d=>{F(c,d)||(c[d]=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],f=l.length;for(let d=0;d<f;d++){let p=this.LA(d+1);if(r(p,l[d])===!1)continue e}return s}}}}function m_(t,e,r){let n=zt(t,o=>o.length===1),i=t.length;if(n&&!r){let o=ot(t);if(o.length===1&&Z(o[0].categoryMatches)){let a=o[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===a}}else{let s=Ve(o,(a,c,u)=>(a[c.tokenTypeIdx]=!0,O(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 hy=class extends Gn{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,Ge.OPTION,r,n)||super.walkOption(e,r,n)}walkAtLeastOne(e,r,n){this.checkIsTarget(e,Ge.REPETITION_MANDATORY,r,n)||super.walkOption(e,r,n)}walkAtLeastOneSep(e,r,n){this.checkIsTarget(e,Ge.REPETITION_MANDATORY_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}walkMany(e,r,n){this.checkIsTarget(e,Ge.REPETITION,r,n)||super.walkOption(e,r,n)}walkManySep(e,r,n){this.checkIsTarget(e,Ge.REPETITION_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}},od=class extends nr{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,Ge.OPTION)}visitRepetition(e){this.checkIsTarget(e,Ge.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,Ge.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,Ge.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,Ge.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,Ge.ALTERNATION)}};function l_(t){let e=new Array(t);for(let r=0;r<t;r++)e[r]=[];return e}function my(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 pq(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 h_(t,e){let r=C(t,s=>nd([s],1)),n=l_(r.length),i=C(r,s=>{let a={};return O(s,c=>{let u=my(c.partialPath);O(u,l=>{a[l]=!0})}),a}),o=r;for(let s=1;s<=e;s++){let a=o;o=l_(a.length);for(let c=0;c<a.length;c++){let u=a[c];for(let l=0;l<u.length;l++){let f=u[l].partialPath,d=u[l].suffixDef,p=my(f);if(pq(i,p,c)||Z(d)||f.length===e){let R=n[c];if(ad(R,f)===!1){R.push(f);for(let A=0;A<p.length;A++){let S=p[A];i[c][S]=!0}}}else{let R=nd(d,s+1,f);o[c]=o[c].concat(R),O(R,A=>{let S=my(A.partialPath);O(S,h=>{i[c][h]=!0})})}}}}return n}function Qs(t,e,r,n){let i=new od(t,Ge.ALTERNATION,n);return e.accept(i),h_(i.result,r)}function Zs(t,e,r,n){let i=new od(t,r);e.accept(i);let o=i.result,a=new hy(e,t,r).startWalking(),c=new Pe({definition:o}),u=new Pe({definition:a});return h_([c,u],n)}function ad(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 g_(t,e){return t.length<e.length&&zt(t,(r,n)=>{let i=e[n];return r===i||i.categoryMatchesMap[r.tokenTypeIdx]})}function y_(t){return zt(t,e=>zt(e,r=>zt(r,n=>Z(n.categoryMatches))))}function T_(t){let e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return C(e,r=>Object.assign({type:Tt.CUSTOM_LOOKAHEAD_VALIDATION},r))}function x_(t,e,r,n){let i=Mt(t,c=>mq(c,r)),o=vq(t,e,r),s=Mt(t,c=>yq(c,r)),a=Mt(t,c=>gq(c,t,n,r));return i.concat(o,s,a)}function mq(t,e){let r=new gy;t.accept(r);let n=r.allProductions,i=ey(n,hq),o=mr(i,a=>a.length>1);return C(Se(o),a=>{let c=Et(a),u=e.buildDuplicateFoundError(t,a),l=hr(c),f={message:u,type:Tt.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:l,occurrence:c.idx},d=v_(c);return d&&(f.parameter=d),f})}function hq(t){return`${hr(t)}_#_${t.idx}_#_${v_(t)}`}function v_(t){return t instanceof ee?t.terminalType.name:t instanceof me?t.nonTerminalName:""}var gy=class extends nr{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 gq(t,e,r,n){let i=[];if(Ve(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:Tt.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function R_(t,e,r){let n=[],i;return qe(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:Tt.INVALID_RULE_OVERRIDE,ruleName:t})),n}function Ty(t,e,r,n=[]){let i=[],o=cd(e.definition);if(Z(o))return[];{let s=t.name;qe(o,t)&&i.push({message:r.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:Tt.LEFT_RECURSION,ruleName:s});let c=Pi(o,n.concat([t])),u=Mt(c,l=>{let f=Ne(n);return f.push(l),Ty(t,l,r,f)});return i.concat(u)}}function cd(t){let e=[];if(Z(t))return e;let r=Et(t);if(r instanceof me)e.push(r.referencedRule);else if(r instanceof Pe||r instanceof he||r instanceof Ie||r instanceof De||r instanceof we||r instanceof re)e=e.concat(cd(r.definition));else if(r instanceof ke)e=ot(C(r.definition,o=>cd(o.definition)));else if(!(r instanceof ee))throw Error("non exhaustive match");let n=so(r),i=t.length>1;if(n&&i){let o=st(t);return e.concat(cd(o))}else return e}var Tc=class extends nr{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function S_(t,e){let r=new Tc;t.accept(r);let n=r.alternations;return Mt(n,o=>{let s=jn(o.definition);return Mt(s,(a,c)=>{let u=id([a],[],Hn,1);return Z(u)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:o,emptyChoiceIdx:c}),type:Tt.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:o.idx,alternative:c+1}]:[]})})}function b_(t,e,r){let n=new Tc;t.accept(n);let i=n.alternations;return i=Ii(i,s=>s.ignoreAmbiguities===!0),Mt(i,s=>{let a=s.idx,c=s.maxLookahead||e,u=Qs(a,t,c,s),l=Tq(u,s,t,r),f=xq(u,s,t,r);return l.concat(f)})}var yy=class extends nr{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 yq(t,e){let r=new Tc;t.accept(r);let n=r.alternations;return Mt(n,o=>o.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:o}),type:Tt.TOO_MANY_ALTS,ruleName:t.name,occurrence:o.idx}]:[])}function A_(t,e,r){let n=[];return O(t,i=>{let o=new yy;i.accept(o);let s=o.allProductions;O(s,a=>{let c=yc(a),u=a.maxLookahead||e,l=a.idx,d=Zs(l,i,c,u)[0];if(Z(ot(d))){let p=r.buildEmptyRepetitionError({topLevelRule:i,repetition:a});n.push({message:p,type:Tt.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function Tq(t,e,r,n){let i=[],o=Ve(t,(a,c,u)=>(e.definition[u].ignoreAmbiguities===!0||O(c,l=>{let f=[u];O(t,(d,p)=>{u!==p&&ad(d,l)&&e.definition[p].ignoreAmbiguities!==!0&&f.push(p)}),f.length>1&&!ad(i,l)&&(i.push(l),a.push({alts:f,path:l}))}),a),[]);return C(o,a=>{let c=C(a.alts,l=>l+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:c,prefixPath:a.path}),type:Tt.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:e.idx,alternatives:a.alts}})}function xq(t,e,r,n){let i=Ve(t,(s,a,c)=>{let u=C(a,l=>({idx:c,path:l}));return s.concat(u)},[]);return Rn(Mt(i,s=>{if(e.definition[s.idx].ignoreAmbiguities===!0)return[];let c=s.idx,u=s.path,l=kt(i,d=>e.definition[d.idx].ignoreAmbiguities!==!0&&d.idx<c&&g_(d.path,u));return C(l,d=>{let p=[d.idx+1,c+1],T=e.idx===0?"":e.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:p,prefixPath:d.path}),type:Tt.AMBIGUOUS_PREFIX_ALTS,ruleName:r.name,occurrence:T,alternatives:p}})}))}function vq(t,e,r){let n=[],i=C(e,o=>o.name);return O(t,o=>{let s=o.name;if(qe(i,s)){let a=r.buildNamespaceConflictError(o);n.push({message:a,type:Tt.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:s})}}),n}function w_(t){let e=Hs(t,{errMsgProvider:c_}),r={};return O(t.rules,n=>{r[n.name]=n}),u_(r,e.errMsgProvider)}function k_(t){return t=Hs(t,{errMsgProvider:Zr}),x_(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}var E_="MismatchedTokenException",__="NoViableAltException",C_="EarlyExitException",N_="NotAllInputParsedException",P_=[E_,__,C_,N_];Object.freeze(P_);function Di(t){return qe(P_,t.name)}var ea=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)}},lo=class extends ea{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=E_}},xc=class extends ea{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=__}},vc=class extends ea{constructor(e,r){super(e,r),this.name=N_}},Rc=class extends ea{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=C_}};var xy={},Ry="InRuleRecoveryException",vy=class extends Error{constructor(e){super(e),this.name=Ry}},ud=class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=F(e,"recoveryEnabled")?e.recoveryEnabled:ir.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=Rq)}getTokenToInsert(e){let r=uo(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),f=()=>{let d=this.LA(0),p=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:u,previous:d,ruleName:this.getCurrRuleFullName()}),T=new lo(p,u,this.LA(0));T.resyncedTokens=jn(a),this.SAVE_ERROR(T)};for(;!c;)if(this.tokenMatcher(l,i)){f();return}else if(n.call(this)){f(),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 vy("sad sad panda")}canPerformInRuleRecovery(e,r){return this.canRecoverWithSingleTokenInsertion(e,r)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,r){if(!this.canTokenTypeBeInsertedInRecovery(e)||Z(r))return!1;let n=this.LA(1);return bn(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 qe(n,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),r=this.LA(1),n=2;for(;;){let i=bn(e,o=>mc(r,o));if(i!==void 0)return i;r=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return xy;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 C(e,(n,i)=>i===0?xy:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:r[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){let e=C(this.buildFullFollowKeyStack(),r=>this.getFollowSetFromFollowKey(r));return ot(e)}getFollowSetFromFollowKey(e){if(e===xy)return[_r];let r=e.ruleName+e.idxInCallingRule+zf+e.inRule;return this.resyncFollows[r]}addToResyncTokens(e,r){return this.tokenMatcher(e,_r)||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 jn(r)}attemptInRepetitionRecovery(e,r,n,i,o,s,a){}getCurrentGrammarPath(e,r){let n=this.getHumanReadableRuleStack(),i=Ne(this.RULE_OCCURRENCE_STACK);return{ruleStack:n,occurrenceStack:i,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return C(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}};function Rq(t,e,r,n,i,o,s){let a=this.getKeyForAutomaticLookahead(n,i),c=this.firstAfterRepMap[a];if(c===void 0){let d=this.getCurrRuleFullName(),p=this.getGAstProductions()[d];c=new o(p,i).startWalking(),this.firstAfterRepMap[a]=c}let u=c.token,l=c.occurrence,f=c.isEndOfRule;this.RULE_STACK.length===1&&f&&u===void 0&&(u=_r,l=1),!(u===void 0||l===void 0)&&this.shouldInRepetitionRecoveryBeTried(u,l,s)&&this.tryInRepetitionRecovery(t,e,r,u)}function ld(t,e,r){return r|e|t}var ene=32-8;var zn=class{constructor(e){var r;this.maxLookahead=(r=e?.maxLookahead)!==null&&r!==void 0?r:ir.maxLookahead}validate(e){let r=this.validateNoLeftRecursion(e.rules);if(Z(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 Mt(e,r=>Ty(r,r,Zr))}validateEmptyOrAlternatives(e){return Mt(e,r=>S_(r,Zr))}validateAmbiguousAlternationAlternatives(e,r){return Mt(e,n=>b_(n,r,Zr))}validateSomeNonEmptyLookaheadPath(e,r){return A_(e,r,Zr)}buildLookaheadForAlternation(e){return f_(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,p_)}buildLookaheadForOptional(e){return d_(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,yc(e.prodType),m_)}};var dd=class{initLooksAhead(e){this.dynamicTokensEnabled=F(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:ir.dynamicTokensEnabled,this.maxLookahead=F(e,"maxLookahead")?e.maxLookahead:ir.maxLookahead,this.lookaheadStrategy=F(e,"lookaheadStrategy")?e.lookaheadStrategy:new zn({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){O(e,r=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{let{alternation:n,repetition:i,option:o,repetitionMandatory:s,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:c}=Sq(r);O(n,u=>{let l=u.idx===0?"":u.idx;this.TRACE_INIT(`${hr(u)}${l}`,()=>{let f=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:u.idx,rule:r,maxLookahead:u.maxLookahead||this.maxLookahead,hasPredicates:u.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),d=ld(this.fullRuleNameToShort[r.name],256,u.idx);this.setLaFuncCache(d,f)})}),O(i,u=>{this.computeLookaheadFunc(r,u.idx,768,"Repetition",u.maxLookahead,hr(u))}),O(o,u=>{this.computeLookaheadFunc(r,u.idx,512,"Option",u.maxLookahead,hr(u))}),O(s,u=>{this.computeLookaheadFunc(r,u.idx,1024,"RepetitionMandatory",u.maxLookahead,hr(u))}),O(a,u=>{this.computeLookaheadFunc(r,u.idx,1536,"RepetitionMandatoryWithSeparator",u.maxLookahead,hr(u))}),O(c,u=>{this.computeLookaheadFunc(r,u.idx,1280,"RepetitionWithSeparator",u.maxLookahead,hr(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=ld(this.fullRuleNameToShort[e.name],n,r);this.setLaFuncCache(c,a)})}getKeyForAutomaticLookahead(e,r){let n=this.getLastExplicitRuleShortName();return ld(n,e,r)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,r){this.lookAheadFuncsCache.set(e,r)}},Sy=class extends nr{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)}},fd=new Sy;function Sq(t){fd.reset(),t.accept(fd);let e=fd.dslMethods;return fd.reset(),e}function wy(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function ky(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 I_(t,e,r){t.children[r]===void 0?t.children[r]=[e]:t.children[r].push(e)}function D_(t,e,r){t.children[e]===void 0?t.children[e]=[r]:t.children[e].push(r)}var bq="name";function Ey(t,e){Object.defineProperty(t,bq,{enumerable:!1,configurable:!0,writable:!1,value:e})}function Aq(t,e){let r=_e(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 O_(t,e){let r=function(){};Ey(r,t+"BaseSemantics");let n={visit:function(i,o){if(U(i)&&(i=i[0]),!Vt(i))return this[i.name](i.children,o)},validateVisitor:function(){let i=wq(this,e);if(!Z(i)){let o=C(i,s=>s.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
132
132
|
${o.join(`
|
|
133
133
|
|
|
134
134
|
`).replace(/\n/g,`
|
|
135
|
-
`)}`)}}};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=e,r}function
|
|
135
|
+
`)}`)}}};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=e,r}function $_(t,e,r){let n=function(){};Ey(n,t+"BaseSemanticsWithDefaults");let i=Object.create(r.prototype);return O(e,o=>{i[o]=Aq}),n.prototype=i,n.prototype.constructor=n,n}var _y;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(_y||(_y={}));function wq(t,e){return kq(t,e)}function kq(t,e){let r=kt(e,i=>tr(t[i])===!1),n=C(r,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:_y.MISSING_METHOD,methodName:i}));return Rn(n)}var gd=class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=F(e,"nodeLocationTracking")?e.nodeLocationTracking:ir.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=ze,this.cstFinallyStateUpdate=ze,this.cstPostTerminal=ze,this.cstPostNonTerminal=ze,this.cstPostRule=ze;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=ky,this.setNodeLocationFromNode=ky,this.cstPostRule=ze,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=ze,this.setNodeLocationFromNode=ze,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=wy,this.setNodeLocationFromNode=wy,this.cstPostRule=ze,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=ze,this.setNodeLocationFromNode=ze,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=ze,this.setNodeLocationFromNode=ze,this.cstPostRule=ze,this.setInitialNodeLocation=ze;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];I_(n,r,e),this.setNodeLocationFromToken(n.location,r)}cstPostNonTerminal(e,r){let n=this.CST_STACK[this.CST_STACK.length-1];D_(n,r,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(Vt(this.baseCstVisitorConstructor)){let e=O_(this.className,_e(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(Vt(this.baseCstVisitorWithDefaultsConstructor)){let e=$_(this.className,_e(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 yd=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)):ta}LA(e){let r=this.currIdx+e;return r<0||this.tokVectorLength<=r?ta: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 Td=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=ra){if(qe(this.definedRulesNames,e)){let s={message:Zr.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Tt.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=ra){let i=R_(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(Di(i))return!1;throw i}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Kf(Se(this.gastProductionsCache))}};var xd=class{initRecognizerEngine(e,r){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Ys,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},F(r,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
136
136
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|
137
137
|
For Further details.`);if(U(e)){if(Z(e))throw Error(`A Token Vocabulary cannot be empty.
|
|
138
138
|
Note that the first argument for the parser constructor
|
|
139
139
|
is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
|
|
140
140
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|
141
|
-
For Further details.`)}if(U(e))this.tokensMap=Ve(e,(o,s)=>(o[s.name]=s,o),{});else if(F(e,"modes")&&zt(ot(Se(e.modes)),
|
|
142
|
-
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let i=F(n,"resyncEnabled")?n.resyncEnabled:ra.resyncEnabled,o=F(n,"recoveryValueFunc")?n.recoveryValueFunc:ra.recoveryValueFunc,s=this.ruleShortNameIdx<<4+8;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 f=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(f),f}catch(f){return this.invokeRuleCatch(f,i,o)}finally{this.ruleFinallyStateUpdate()}}:a=function(...l){try{return this.ruleInvocationStateUpdate(s,e,this.subruleIdx),r.apply(this,l)}catch(f){return this.invokeRuleCatch(f,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(
|
|
143
|
-
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(
|
|
141
|
+
For Further details.`)}if(U(e))this.tokensMap=Ve(e,(o,s)=>(o[s.name]=s,o),{});else if(F(e,"modes")&&zt(ot(Se(e.modes)),ZE)){let o=ot(Se(e.modes)),s=Ws(o);this.tokensMap=Ve(s,(a,c)=>(a[c.name]=c,a),{})}else if(Ke(e))this.tokensMap=Ne(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=_r;let n=F(e,"modes")?ot(Se(e.modes)):Se(e),i=zt(n,o=>Z(o.categoryMatches));this.tokenMatcher=i?Ys:Hn,Wn(Se(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'
|
|
142
|
+
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let i=F(n,"resyncEnabled")?n.resyncEnabled:ra.resyncEnabled,o=F(n,"recoveryValueFunc")?n.recoveryValueFunc:ra.recoveryValueFunc,s=this.ruleShortNameIdx<<4+8;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 f=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(f),f}catch(f){return this.invokeRuleCatch(f,i,o)}finally{this.ruleFinallyStateUpdate()}}:a=function(...l){try{return this.ruleInvocationStateUpdate(s,e,this.subruleIdx),r.apply(this,l)}catch(f){return this.invokeRuleCatch(f,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(Di(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,Ge.REPETITION_MANDATORY,r.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,r],i,1024,e,rd)}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,gc],a,1536,e,gc)}else throw this.raiseEarlyExitException(e,Ge.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,td,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,hc],a,1280,e,hc)}}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=U(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 vc(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 Di(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 lo(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===Ry?n:o}}else throw n}saveRecogState(){let e=this.errors,r=Ne(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),_r)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}};var vd=class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=F(e,"errorMessageProvider")?e.errorMessageProvider:ir.errorMessageProvider}SAVE_ERROR(e){if(Di(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:Ne(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return Ne(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,r,n){let i=this.getCurrRuleFullName(),o=this.getGAstProductions()[i],a=Zs(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 Rc(u,this.LA(1),this.LA(0)))}raiseNoAltException(e,r){let n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],o=Qs(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 xc(c,this.LA(1),a))}};var Rd=class{initContentAssist(){}computeContentAssist(e,r){let n=this.gastProductionsCache[e];if(Vt(n))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return id([n],r,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let r=Et(e.ruleStack),i=this.getGAstProductions()[r];return new ed(i,e).startWalking()}};var Ad={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Ad);var L_=!0,M_=Math.pow(2,8)-1,U_=Zf({name:"RECORDING_PHASE_TOKEN",pattern:tt.NA});Wn([U_]);var q_=uo(U_,`This IToken indicates the Parser is in Recording Phase
|
|
143
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(q_);var _q={name:`This CSTNode indicates the Parser is in Recording Phase
|
|
144
144
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},Sd=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 ta}topLevelRuleRecord(e,r){try{let n=new rr({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+`
|
|
145
145
|
This error was thrown during the "grammar recording phase" For more info see:
|
|
146
|
-
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}}optionInternalRecord(e,r){return bc.call(this,he,e,r)}atLeastOneInternalRecord(e,r){bc.call(this,Ie,r,e)}atLeastOneSepFirstInternalRecord(e,r){bc.call(this,De,r,e,
|
|
147
|
-
inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}let i=
|
|
148
|
-
inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let i=
|
|
149
|
-
Idx value must be a none negative value smaller than ${
|
|
146
|
+
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}}optionInternalRecord(e,r){return bc.call(this,he,e,r)}atLeastOneInternalRecord(e,r){bc.call(this,Ie,r,e)}atLeastOneSepFirstInternalRecord(e,r){bc.call(this,De,r,e,L_)}manyInternalRecord(e,r){bc.call(this,re,r,e)}manySepFirstInternalRecord(e,r){bc.call(this,we,r,e,L_)}orInternalRecord(e,r){return Cq.call(this,e,r)}subruleInternalRecord(e,r,n){if(bd(r),!e||F(e,"ruleName")===!1){let a=new Error(`<SUBRULE${F_(r)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
|
|
147
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}let i=Sn(this.recordingProdStack),o=e.ruleName,s=new me({idx:r,nonTerminalName:o,label:n?.LABEL,referencedRule:void 0});return i.definition.push(s),this.outputCst?_q:Ad}consumeInternalRecord(e,r,n){if(bd(r),!uy(e)){let s=new Error(`<CONSUME${F_(r)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
|
|
148
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let i=Sn(this.recordingProdStack),o=new ee({idx:r,terminalType:e,label:n?.LABEL});return i.definition.push(o),q_}};function bc(t,e,r,n=!1){bd(r);let i=Sn(this.recordingProdStack),o=tr(e)?e:e.DEF,s=new t({definition:[],idx:r});return n&&(s.separator=e.SEP),F(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(s),o.call(this),i.definition.push(s),this.recordingProdStack.pop(),Ad}function Cq(t,e){bd(e);let r=Sn(this.recordingProdStack),n=U(t)===!1,i=n===!1?t:t.DEF,o=new ke({definition:[],idx:e,ignoreAmbiguities:n&&t.IGNORE_AMBIGUITIES===!0});F(t,"MAX_LOOKAHEAD")&&(o.maxLookahead=t.MAX_LOOKAHEAD);let s=cc(i,a=>tr(a.GATE));return o.hasPredicates=s,r.definition.push(o),O(i,a=>{let c=new Pe({definition:[]});o.definition.push(c),F(a,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:F(a,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),a.ALT.call(this),this.recordingProdStack.pop()}),Ad}function F_(t){return t===0?"":`${t}`}function bd(t){if(t<0||t>M_){let e=new Error(`Invalid DSL Method idx value: <${t}>
|
|
149
|
+
Idx value must be a none negative value smaller than ${M_+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}var wd=class{initPerformanceTracer(e){if(F(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=ir.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}=lc(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 j_(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 ta=uo(_r,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(ta);var ir=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Kn,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),ra=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0}),Tt;(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"})(Tt||(Tt={}));function kd(t=void 0){return function(){return t}}var Ac=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",()=>{fc(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),O(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=w_({rules:Se(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(Z(n)&&this.skipValidations===!1){let i=k_({rules:Se(this.gastProductionsCache),tokenTypes:Se(this.tokensMap),errMsgProvider:Zr,grammarName:r}),o=T_({lookaheadStrategy:this.lookaheadStrategy,rules:Se(this.gastProductionsCache),tokenTypes:Se(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(i,o)}}),Z(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let i=DE(Se(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:Se(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Se(this.gastProductionsCache))})),!t.DEFER_DEFINITION_ERRORS_HANDLING&&!Z(this.definitionErrors))throw e=C(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
|
|
150
150
|
${e.join(`
|
|
151
151
|
-------------------------------
|
|
152
152
|
`)}`)})}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),F(r,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
153
153
|
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
154
154
|
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|
155
|
-
For further details.`);this.skipValidations=F(r,"skipValidations")?r.skipValidations:
|
|
155
|
+
For further details.`);this.skipValidations=F(r,"skipValidations")?r.skipValidations:ir.skipValidations}};Ac.DEFER_DEFINITION_ERRORS_HANDLING=!1;j_(Ac,[ud,dd,gd,yd,xd,Td,vd,Rd,Sd,wd]);var wc=class extends Ac{constructor(e,r=ir){let n=Ne(r);n.outputCst=!1,super(e,n)}};function fo(t,e,r){return`${t.name}_${e}_${r}`}var Oi=1,Pq=2,G_=4,H_=5;var oa=7,Iq=8,Dq=9,Oq=10,$q=11,W_=12,kc=class{constructor(e){this.target=e}isEpsilon(){return!1}},na=class extends kc{constructor(e,r){super(e),this.tokenType=r}},Ec=class extends kc{constructor(e){super(e)}isEpsilon(){return!0}},ia=class extends kc{constructor(e,r,n){super(e),this.rule=r,this.followState=n}isEpsilon(){return!0}};function B_(t){let e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};Lq(e,t);let r=t.length;for(let n=0;n<r;n++){let i=t[n],o=po(e,i,i);o!==void 0&&zq(e,i,o)}return e}function Lq(t,e){let r=e.length;for(let n=0;n<r;n++){let i=e[n],o=_t(t,i,void 0,{type:Pq}),s=_t(t,i,void 0,{type:oa});o.stop=s,t.ruleToStartState.set(i,o),t.ruleToStopState.set(i,s)}}function K_(t,e,r){return r instanceof ee?Ny(t,e,r.terminalType,r):r instanceof me?Kq(t,e,r):r instanceof ke?jq(t,e,r):r instanceof he?Gq(t,e,r):r instanceof re?Mq(t,e,r):r instanceof we?Fq(t,e,r):r instanceof Ie?Uq(t,e,r):r instanceof De?qq(t,e,r):po(t,e,r)}function Mq(t,e,r){let n=_t(t,e,r,{type:H_});$i(t,n);let i=sa(t,e,n,r,po(t,e,r));return V_(t,e,r,i)}function Fq(t,e,r){let n=_t(t,e,r,{type:H_});$i(t,n);let i=sa(t,e,n,r,po(t,e,r)),o=Ny(t,e,r.separator,r);return V_(t,e,r,i,o)}function Uq(t,e,r){let n=_t(t,e,r,{type:G_});$i(t,n);let i=sa(t,e,n,r,po(t,e,r));return z_(t,e,r,i)}function qq(t,e,r){let n=_t(t,e,r,{type:G_});$i(t,n);let i=sa(t,e,n,r,po(t,e,r)),o=Ny(t,e,r.separator,r);return z_(t,e,r,i,o)}function jq(t,e,r){let n=_t(t,e,r,{type:Oi});$i(t,n);let i=C(r.definition,s=>K_(t,e,s));return sa(t,e,n,r,...i)}function Gq(t,e,r){let n=_t(t,e,r,{type:Oi});$i(t,n);let i=sa(t,e,n,r,po(t,e,r));return Hq(t,e,r,i)}function po(t,e,r){let n=kt(C(r.definition,i=>K_(t,e,i)),i=>i!==void 0);return n.length===1?n[0]:n.length===0?void 0:Bq(t,n)}function z_(t,e,r,n,i){let o=n.left,s=n.right,a=_t(t,e,r,{type:$q});$i(t,a);let c=_t(t,e,r,{type:W_});return o.loopback=a,c.loopback=a,t.decisionMap[fo(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",r.idx)]=a,pt(s,a),i===void 0?(pt(a,o),pt(a,c)):(pt(a,c),pt(a,i.left),pt(i.right,o)),{left:o,right:c}}function V_(t,e,r,n,i){let o=n.left,s=n.right,a=_t(t,e,r,{type:Oq});$i(t,a);let c=_t(t,e,r,{type:W_}),u=_t(t,e,r,{type:Dq});return a.loopback=u,c.loopback=u,pt(a,o),pt(a,c),pt(s,u),i!==void 0?(pt(u,c),pt(u,i.left),pt(i.right,o)):pt(u,a),t.decisionMap[fo(e,i?"RepetitionWithSeparator":"Repetition",r.idx)]=a,{left:a,right:c}}function Hq(t,e,r,n){let i=n.left,o=n.right;return pt(i,o),t.decisionMap[fo(e,"Option",r.idx)]=i,n}function $i(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function sa(t,e,r,n,...i){let o=_t(t,e,n,{type:Iq,start:r});r.end=o;for(let a of i)a!==void 0?(pt(r,a.left),pt(a.right,o)):pt(r,o);let s={left:r,right:o};return t.decisionMap[fo(e,Wq(n),n.idx)]=r,s}function Wq(t){if(t instanceof ke)return"Alternation";if(t instanceof he)return"Option";if(t instanceof re)return"Repetition";if(t instanceof we)return"RepetitionWithSeparator";if(t instanceof Ie)return"RepetitionMandatory";if(t instanceof De)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function Bq(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 ia,u=a,l=e[o+1].left;s.left.type===Oi&&s.right.type===Oi&&a!==void 0&&(c&&u.followState===s.right||a.target===s.right)?(c?u.followState=l:a.target=l,Vq(t,s.right)):pt(s.right,l)}let n=e[0],i=e[r-1];return{left:n.left,right:i.right}}function Ny(t,e,r,n){let i=_t(t,e,n,{type:Oi}),o=_t(t,e,n,{type:Oi});return Py(i,new na(o,r)),{left:i,right:o}}function Kq(t,e,r){let n=r.referencedRule,i=t.ruleToStartState.get(n),o=_t(t,e,r,{type:Oi}),s=_t(t,e,r,{type:Oi}),a=new ia(i,n,s);return Py(o,a),{left:o,right:s}}function zq(t,e,r){let n=t.ruleToStartState.get(e);pt(n,r.left);let i=t.ruleToStopState.get(e);return pt(r.right,i),{left:n,right:i}}function pt(t,e){let r=new Ec(e);Py(t,r)}function _t(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 Py(t,e){t.transitions.length===0&&(t.epsilonOnlyTransitions=e.isEpsilon()),t.transitions.push(e)}function Vq(t,e){t.states.splice(t.states.indexOf(e),1)}var _c={},aa=class{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){let r=Iy(e);r in this.map||(this.map[r]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return C(this.configs,e=>e.alt)}get key(){let e="";for(let r in this.map)e+=r+":";return e}};function Iy(t,e=!0){return`${e?`a${t.alt}`:""}s${t.state.stateNumber}:${t.stack.map(r=>r.stateNumber.toString()).join("_")}`}function Xq(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 Ed=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}},X_=new Ed,Cc=class extends zn{constructor(e){var r;super(),this.logging=(r=e?.logging)!==null&&r!==void 0?r:n=>console.log(n)}initialize(e){this.atn=B_(e.rules),this.dfas=Yq(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=fo(n,"Alternation",r),l=this.atn.decisionMap[c].decision,f=C(sd({maxLookahead:1,occurrence:r,prodType:"Alternation",rule:n}),d=>C(d,p=>p[0]));if(Y_(f,!1)&&!o){let d=Ve(f,(p,T,R)=>(O(T,A=>{A&&(p[A.tokenTypeIdx]=R,O(A.categoryMatches,S=>{p[S]=R}))}),p),{});return i?function(p){var T;let R=this.LA(1),A=d[R.tokenTypeIdx];if(p!==void 0&&A!==void 0){let S=(T=p[A])===null||T===void 0?void 0:T.GATE;if(S!==void 0&&S.call(this)===!1)return}return A}:function(){let p=this.LA(1);return d[p.tokenTypeIdx]}}else return i?function(d){let p=new Ed,T=d===void 0?0:d.length;for(let A=0;A<T;A++){let S=d?.[A].GATE;p.set(A,S===void 0||S.call(this))}let R=Dy.call(this,s,l,p,a);return typeof R=="number"?R:void 0}:function(){let d=Dy.call(this,s,l,X_,a);return typeof d=="number"?d:void 0}}buildLookaheadForOptional(e){let{prodOccurrence:r,rule:n,prodType:i,dynamicTokensEnabled:o}=e,s=this.dfas,a=this.logging,c=fo(n,i,r),l=this.atn.decisionMap[c].decision,f=C(sd({maxLookahead:1,occurrence:r,prodType:i,rule:n}),d=>C(d,p=>p[0]));if(Y_(f)&&f[0][0]&&!o){let d=f[0],p=ot(d);if(p.length===1&&Z(p[0].categoryMatches)){let R=p[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===R}}else{let T=Ve(p,(R,A)=>(A!==void 0&&(R[A.tokenTypeIdx]=!0,O(A.categoryMatches,S=>{R[S]=!0})),R),{});return function(){let R=this.LA(1);return T[R.tokenTypeIdx]===!0}}}return function(){let d=Dy.call(this,s,l,X_,a);return typeof d=="object"?!1:d===0}}};function Y_(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 Yq(t){let e=t.decisionStates.length,r=Array(e);for(let n=0;n<e;n++)r[n]=Xq(t.decisionStates[n],n);return r}function Dy(t,e,r,n){let i=t[e](r),o=i.start;if(o===void 0){let a=aj(i.atnStartState);o=Z_(i,Q_(a)),i.start=o}return Jq.apply(this,[i,o,r,n])}function Jq(t,e,r,n){let i=e,o=1,s=[],a=this.LA(o++);for(;;){let c=nj(i,a);if(c===void 0&&(c=Qq.apply(this,[t,i,a,o,r,n])),c===_c)return rj(s,i,a);if(c.isAcceptState===!0)return c.prediction;i=c,s.push(a),a=this.LA(o++)}}function Qq(t,e,r,n,i,o){let s=ij(e.configs,r,i);if(s.size===0)return J_(t,e,r,_c),_c;let a=Q_(s),c=sj(s,i);if(c!==void 0)a.isAcceptState=!0,a.prediction=c,a.configs.uniqueAlt=c;else if(fj(s)){let u=AE(s.alts);a.isAcceptState=!0,a.prediction=u,a.configs.uniqueAlt=u,Zq.apply(this,[t,n,s.alts,o])}return a=J_(t,e,r,a),a}function Zq(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=ej({topLevelRule:s,ambiguityIndices:r,production:a,prefixPath:i});n(c)}function ej(t){let e=C(t.prefixPath,i=>Bn(i)).join(", "),r=t.production.idx===0?"":t.production.idx,n=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(", ")}> in <${tj(t.production)}${r}> inside <${t.topLevelRule.name}> Rule,
|
|
156
156
|
<${e}> may appears as a prefix path in all these alternatives.
|
|
157
157
|
`;return n=n+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
158
|
-
For Further details.`,n}function Zq(t){if(t instanceof me)return"SUBRULE";if(t instanceof he)return"OPTION";if(t instanceof ke)return"OR";if(t instanceof Ie)return"AT_LEAST_ONE";if(t instanceof De)return"AT_LEAST_ONE_SEP";if(t instanceof we)return"MANY_SEP";if(t instanceof re)return"MANY";if(t instanceof ee)return"CONSUME";throw Error("non exhaustive match")}function ej(t,e,r){let n=Mt(e.configs.elements,o=>o.state.transitions),i=CE(n.filter(o=>o instanceof na).map(o=>o.tokenType),o=>o.tokenTypeIdx);return{actualToken:r,possibleTokenTypes:i,tokenPath:t}}function tj(t,e){return t.edges[e.tokenTypeIdx]}function rj(t,e,r){let n=new aa,i=[];for(let s of t.elements){if(r.is(s.alt)===!1)continue;if(s.state.type===oa){i.push(s);continue}let a=s.state.transitions.length;for(let c=0;c<a;c++){let u=s.state.transitions[c],l=nj(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 aa;for(let s of n.elements)_d(s,o)}if(i.length>0&&!aj(o))for(let s of i)o.add(s);return o}function nj(t,e){if(t instanceof na&&mc(e,t.tokenType))return t.target}function ij(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 Y_(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function X_(t,e,r,n){return n=J_(t,n),e.edges[r.tokenTypeIdx]=n,n}function J_(t,e){if(e===_c)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 oj(t){let e=new aa,r=t.transitions.length;for(let n=0;n<r;n++){let o={state:t.transitions[n].target,alt:n,stack:[]};_d(o,e)}return e}function _d(t,e){let r=t.state;if(r.type===oa){if(t.stack.length>0){let i=[...t.stack],s={state:i.pop(),alt:t.alt,stack:i};_d(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=sj(t,o);s!==void 0&&_d(s,e)}}function sj(t,e){if(e instanceof Ec)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof ia){let r=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:r}}}function aj(t){for(let e of t.elements)if(e.state.type===oa)return!0;return!1}function cj(t){for(let e of t.elements)if(e.state.type!==oa)return!1;return!0}function uj(t){if(cj(t))return!0;let e=lj(t.elements);return fj(e)&&!dj(e)}function lj(t){let e=new Map;for(let r of t){let n=Iy(r,!1),i=e.get(n);i===void 0&&(i={},e.set(n,i)),i[r.alt]=!0}return e}function fj(t){for(let e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function dj(t){for(let e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}qi();var Cd=class{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]}buildRootNode(e){return this.rootNode=new $y(e),this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let r=new Id;return r.grammarSource=e,r.root=this.rootNode,this.current.content.push(r),this.nodeStack.push(r),r}buildLeafNode(e,r){let n=new Pd(e.startOffset,e.image.length,Oa(e),e.tokenType,!1);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)}}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)}addHiddenTokens(e){for(let r of e){let n=new Pd(r.startOffset,r.image.length,Oa(r),r.tokenType,!0);n.root=this.rootNode,this.addHiddenToken(this.rootNode,n)}}addHiddenToken(e,r){let{offset:n,end:i}=r;for(let o=0;o<e.content.length;o++){let s=e.content[o],{offset:a,end:c}=s;if(ln(s)&&n>a&&i<c){this.addHiddenToken(s,r);return}else if(i<=a){e.content.splice(o,0,r);return}}e.content.push(r)}},Nd=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)}},Pd=class extends Nd{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}},Id=class extends Nd{constructor(){super(...arguments),this.content=new Oy(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:Qt.create(0,0),end:Qt.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]}},Oy=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}},$y=class extends Id{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}};var My=Symbol("Datatype");function Ly(t){return t.$type===My}var Q_="\u200B",Z_=t=>t.endsWith(Q_)?t:t+Q_,Dd=class{constructor(e){this._unorderedGroups=new Map,this.lexer=e.parser.Lexer;let r=this.lexer.definition;this.wrapper=new Uy(r,Object.assign(Object.assign({},e.parser.ParserConfig),{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)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}},Od=class extends Dd{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new Cd,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=e.fragment?void 0:Er(e)?My:Jr(e),i=this.wrapper.DEFINE_RULE(Z_(e.name),this.startImplementation(n,r).bind(this));return e.entry&&(this.mainRule=i),i}parse(e){this.nodeBuilder.buildRootNode(e);let r=this.lexer.tokenize(e);this.wrapper.input=r.tokens;let n=this.mainRule.call(this.wrapper,{});return this.nodeBuilder.addHiddenTokens(r.hidden),this.unorderedGroups.clear(),{value:n,lexerErrors:r.errors,parserErrors:this.wrapper.errors}}startImplementation(e,r){return n=>{if(!this.isRecording()){let o={$type:e};this.stack.push(o),e===My&&(o.value="")}let i;try{i=r(n)}catch{i=void 0}return!this.isRecording()&&i===void 0&&(i=this.construct()),i}}consume(e,r,n){let i=this.wrapper.wrapConsume(e,r);if(!this.isRecording()&&!i.isInsertedInRecovery){let o=this.nodeBuilder.buildLeafNode(i,n),{assignment:s,isCrossRef:a}=this.getAssignment(n),c=this.current;if(s){let u=Ze(n)?i.image:this.converter.convert(i.image,o);this.assign(s.operator,s.feature,u,o,a)}else if(Ly(c)){let u=i.image;Ze(n)||(u=this.converter.convert(u,o).toString()),c.value+=u}}}subrule(e,r,n,i){let o;this.isRecording()||(o=this.nodeBuilder.buildCompositeNode(n));let s=this.wrapper.wrapSubrule(e,r,i);!this.isRecording()&&o&&o.length>0&&this.performSubruleAssignment(s,n,o)}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(Ly(s))s.value+=e.toString();else{let a=e.$type,c=this.assignWithoutOverride(e,s);a&&(c.$type=a);let u=c;this.stack.pop(),this.stack.push(u)}}}action(e,r){if(!this.isRecording()){let n=this.current;if(!n.$cstNode&&r.feature&&r.operator){n=this.construct(!1);let o=n.$cstNode.feature;this.nodeBuilder.buildCompositeNode(o)}let i={$type:e};this.stack.pop(),this.stack.push(i),r.feature&&r.operator&&this.assign(r.operator,r.feature,n,n.$cstNode,!1)}}construct(e=!0){if(this.isRecording())return;let r=this.current;return lb(r),this.nodeBuilder.construct(r),e&&this.stack.pop(),Ly(r)?this.converter.convert(r.value,r.$cstNode):(hl(this.astReflection,r),r)}getAssignment(e){if(!this.assignmentMap.has(e)){let r=ve(e,ce);this.assignmentMap.set(e,{assignment:r,isCrossRef:r?Dt(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[n,i]of Object.entries(r)){let o=e[n];o===void 0?e[n]=i:Array.isArray(o)&&Array.isArray(i)&&(i.push(...o),e[n]=i)}return e}get definitionErrors(){return this.wrapper.definitionErrors}},Fy=class{buildMismatchTokenMessage(e){return zn.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return zn.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return zn.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return zn.buildEarlyExitMessage(e)}},Nc=class extends Fy{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}\`.`}},$d=class extends Dd{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);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(Z_(e.name),this.startImplementation(r).bind(this));return 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){this.before(n),this.wrapper.wrapSubrule(e,r,i),this.after(n)}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}},pj={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new Nc},Uy=class extends wc{constructor(e,r){let n=r&&"maxLookahead"in r;super(e,Object.assign(Object.assign(Object.assign({},pj),{lookaheadStrategy:n?new Vn({maxLookahead:r.maxLookahead}):new Cc}),r))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,r){return this.RULE(e,r)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,r){return this.consume(e,r)}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)}};var Pc=class extends Error{constructor(e,r){super(e?`${r} at ${e.range.start.line}:${e.range.start.character}`:r)}};function Ld(t){throw new Error("Error! The input value was not handled.")}function Fd(t,e,r){return mj({parser:e,tokens:r,rules:new Map,ruleNames:new Map},t),e}function mj(t,e){let r=ss(e,!1),n=J(e.rules).filter(M).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});o.rules.set(i.name,t.parser.rule(i,mo(o,i.definition)))}}function mo(t,e,r=!1){let n;if(Ze(e))n=Rj(t,e);else if(Te(e))n=hj(t,e);else if(ce(e))n=mo(t,e.terminal);else if(Dt(e))n=eC(t,e);else if(xe(e))n=gj(t,e);else if(Sr(e))n=Tj(t,e);else if(br(e))n=xj(t,e);else if(bt(e))n=vj(t,e);else if(fl(e)){let i=t.consume++;n=()=>t.parser.consume(i,ir,e)}else throw new Pc(e.$cstNode,`Unexpected element type: ${e.$type}`);return tC(t,r?void 0:Md(e),n,e.cardinality)}function hj(t,e){let r=Jr(e);return()=>t.parser.action(r,e)}function gj(t,e){let r=e.rule.ref;if(M(r)){let n=t.subrule++,i=e.arguments.length>0?yj(r,e.arguments):()=>({});return o=>t.parser.subrule(n,rC(t,r),e,i(o))}else if(pe(r)){let n=t.consume++,i=qy(t,r.name);return()=>t.parser.consume(n,i,e)}else if(r)Ld(r);else throw new Pc(e.$cstNode,`Undefined rule type: ${e.$type}`)}function yj(t,e){let r=e.map(n=>Xn(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 Xn(t){if(_S(t)){let e=Xn(t.left),r=Xn(t.right);return n=>e(n)||r(n)}else if(kS(t)){let e=Xn(t.left),r=Xn(t.right);return n=>e(n)&&r(n)}else if(DS(t)){let e=Xn(t.value);return r=>!e(r)}else if(Vo(t)){let e=t.parameter.ref.name;return r=>r!==void 0&&r[e]===!0}else if(PS(t)){let e=!!t.true;return()=>e}Ld(t)}function Tj(t,e){if(e.elements.length===1)return mo(t,e.elements[0]);{let r=[];for(let i of e.elements){let o={ALT:mo(t,i,!0)},s=Md(i);s&&(o.GATE=Xn(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 xj(t,e){if(e.elements.length===1)return mo(t,e.elements[0]);let r=[];for(let a of e.elements){let c={ALT:mo(t,a,!0)},u=Md(a);u&&(c.GATE=Xn(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},f=t.parser;l.ALT=()=>{if(c.ALT(a),!f.isRecording()){let p=i(n,f);f.unorderedGroups.get(p)||f.unorderedGroups.set(p,[]);let T=f.unorderedGroups.get(p);typeof T?.[u]>"u"&&(T[u]=!0)}};let d=c.GATE;return d?l.GATE=()=>d(a):l.GATE=()=>{let p=f.unorderedGroups.get(i(n,f));return!p?.[u]},l})),s=tC(t,Md(e),o,"*");return a=>{s(a),t.parser.isRecording()||t.parser.unorderedGroups.delete(i(n,t.parser))}}function vj(t,e){let r=e.elements.map(n=>mo(t,n));return n=>r.forEach(i=>i(n))}function Md(t){if(bt(t))return t.guardCondition}function eC(t,e,r=e.terminal){if(r)if(xe(r)&&M(r.rule.ref)){let n=t.subrule++;return i=>t.parser.subrule(n,rC(t,r.rule.ref),e,i)}else if(xe(r)&&pe(r.rule.ref)){let n=t.consume++,i=qy(t,r.rule.ref.name);return()=>t.parser.consume(n,i,e)}else if(Ze(r)){let n=t.consume++,i=qy(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=Qa(e.type.ref),i=n?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+Jr(e.type.ref));return eC(t,e,i)}}function Rj(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 tC(t,e,r,n){let i=e&&Xn(e);if(!n)if(i){let o=t.or++;return s=>t.parser.alternatives(o,[{ALT:()=>r(s),GATE:()=>i(s)},{ALT:kd(),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:kd(),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 Ld(n)}function rC(t,e){let r=Sj(t,e),n=t.rules.get(r);if(!n)throw new Error(`Rule "${r}" not found."`);return n}function Sj(t,e){if(M(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let r=e,n=r.$container,i=e.$type;for(;!M(n);)(bt(n)||Sr(n)||br(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 qy(t,e){let r=t.tokens[e];if(!r)throw new Error(`Token "${e}" not found."`);return r}function nC(t){let e=t.Grammar,r=t.parser.Lexer,n=new $d(t);return Fd(e,n,r.definition),n.finalize(),n}function iC(t){let e=bj(t);return e.finalize(),e}function bj(t){let e=t.Grammar,r=t.parser.Lexer,n=new Od(t);return Fd(e,n,r.definition)}var Ud=class{buildTokens(e,r){let n=J(ss(e,!1)),i=this.buildTerminalTokens(n),o=this.buildKeywordTokens(n,i,r);return i.forEach(s=>{let a=s.PATTERN;typeof a=="object"&&a&&"test"in a&&Rg(a)?o.unshift(s):o.push(s)}),n.some(s=>zr(s.definition).some(fl))&&o.push(ir),o}buildTerminalTokens(e){return e.filter(pe).filter(r=>!r.fragment).map(r=>this.buildTerminalToken(r)).toArray()}buildTerminalToken(e){let r=Ur(e),n=r.flags.includes("u")?this.regexPatternFunction(r):r,i={name:e.name,PATTERN:n,LINE_BREAKS:!0};return e.hidden&&(i.GROUP=Rg(r)?tt.SKIPPED:"hidden"),i}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(M).flatMap(i=>Fe(i).filter(Ze)).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){return{name:e.value,PATTERN:this.buildKeywordPattern(e,n),LONGER_ALT:this.findLongerAlt(e,r)}}buildKeywordPattern(e,r){return r?new RegExp(Ib(e.value)):e.value}findLongerAlt(e,r){return r.reduce((n,i)=>{let o=i?.PATTERN;return o?.source&&Db("^"+o.source+"$",e.value)&&n.push(i),n},[])}};var qd=class{convert(e,r){let n=r.grammarSource;if(Dt(n)&&(n=ql(n)),xe(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 Ej(r);case"STRING":return Aj(r);case"ID":return kj(r)}switch((i=to(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return Nj(r);case"boolean":return Pj(r);case"bigint":return _j(r);case"date":return Cj(r);default:return r}}};function Aj(t){let e="";for(let r=1;r<t.length-1;r++){let n=t.charAt(r);if(n==="\\"){let i=t.charAt(++r);e+=wj(i)}else e+=n}return e}function wj(t){switch(t){case"b":return"\b";case"f":return"\f";case"n":return`
|
|
159
|
-
`;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return t}}function kj(t){return t.charAt(0)==="^"?t.substring(1):t}function Ej(t){return parseInt(t)}function _j(t){return BigInt(t)}function Cj(t){return new Date(t)}function Nj(t){return Number(t)}function Pj(t){return t.toLowerCase()==="true"}var oC=se(de(),1);var jd=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=oC.CancellationToken.None){for(let n of zr(e.parseResult.value))await Ue(r),ml(n).forEach(i=>this.doLink(i,e))}doLink(e,r){let n=e.reference;if(n._ref===void 0)try{let i=this.getCandidate(e);if(Wo(i))n._ref=i;else if(n._nodeDescription=i,this.langiumDocuments().hasDocument(i.documentUri)){let o=this.loadAstNode(i);n._ref=o??this.createLinkingError(e,i)}}catch(i){n._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${n.$refText}': ${i}`})}r.references.push(n)}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(ut(this._ref))return this._ref;if(fS(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){let c=o.getLinkedNode({reference:s,container:e,property:r});if(c.error&&Y(e).state<Ae.ComputedScopes)return;this._ref=(a=c.node)!==null&&a!==void 0?a:c.error,this._nodeDescription=c.descr}return ut(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return Wo(this._ref)?this._ref:void 0}};return s}getLinkedNode(e){try{let r=this.getCandidate(e);if(Wo(r))return{error:r};let n=this.loadAstNode(r);return n?{node:n,descr:r}:{descr:r,error:this.createLinkingError(e,r)}}catch(r){return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${r}`})}}}loadAstNode(e){if(e.node)return e.node;let r=this.langiumDocuments().getOrCreateDocument(e.documentUri);return this.astNodeLocator.getAstNode(r.parseResult.value,e.path)}createLinkingError(e,r){let n=Y(e.container);n.state<Ae.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 aC(t){return typeof t.$comment=="string"}function sC(t){return typeof t=="object"&&!!t&&("$ref"in t||"$error"in t)}var Gd=class{constructor(e){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,r){let n=r?.replacer,i=(s,a)=>this.replacer(s,a,r);return JSON.stringify(e,n?(s,a)=>n(s,a,i):i,r?.space)}deserialize(e){let r=JSON.parse(e);return this.linkNode(r,r),r}replacer(e,r,{refText:n,sourceText:i,textRegions:o,comments:s}={}){var a,c,u;if(!this.ignoreProperties.has(e))if(Pn(r)){let l=r.ref,f=n?r.$refText:void 0;return l?{$refText:f,$ref:"#"+(l&&this.astNodeLocator.getAstNodePath(l))}:{$refText:f,$error:(c=(a=r.error)===null||a===void 0?void 0:a.message)!==null&&c!==void 0?c:"Could not resolve reference"}}else{let l;if(o&&ut(r)&&(l=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},r)),(!e||r.$document)&&l?.$textRegion))try{l.$textRegion.documentURI=Y(r).uri.toString()}catch{}return i&&!e&&ut(r)&&(l??(l=Object.assign({},r)),l.$sourceText=(u=r.$cstNode)===null||u===void 0?void 0:u.text),s&&ut(r)&&(l??(l=Object.assign({},r)),l.$comment=this.commentProvider.getComment(r)),l??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=pi(e.$cstNode,o).map(r);s.length!==0&&(i[o]=s)}),e}}linkNode(e,r,n,i,o){for(let[a,c]of Object.entries(e))if(Array.isArray(c))for(let u=0;u<c.length;u++){let l=c[u];sC(l)?c[u]=this.reviveReference(e,a,r,l):ut(l)&&this.linkNode(l,r,e,a,u)}else sC(c)?e[a]=this.reviveReference(e,a,r,c):ut(c)&&this.linkNode(c,r,e,a);let s=e;s.$container=n,s.$containerProperty=i,s.$containerIndex=o}reviveReference(e,r,n,i){let o=i.$refText;if(i.$ref){let s=this.getRefNode(n,i.$ref);return o||(o=this.nameProvider.getName(s)),{$refText:o??"",ref:s}}else if(i.$error){let s={$refText:o??""};return s.error={container:e,property:r,message:i.$error,reference:s},s}else return}getRefNode(e,r){return this.astNodeLocator.getAstNode(e,r.substring(1))}};var Hd=class{register(e){if(!this.singleton&&!this.map){this.singleton=e;return}if(!this.map&&(this.map={},this.singleton)){for(let r of this.singleton.LanguageMetaData.fileExtensions)this.map[r]=this.singleton;this.singleton=void 0}for(let r of e.LanguageMetaData.fileExtensions)this.map[r]!==void 0&&this.map[r]!==e&&console.warn(`The file extension ${r} is used by multiple languages. It is now assigned to '${e.LanguageMetaData.languageId}'.`),this.map[r]=e}getServices(e){if(this.singleton!==void 0)return this.singleton;if(this.map===void 0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");let r=ue.extname(e),n=this.map[r];if(!n)throw new Error(`The service registry contains no services for the extension '${r}'.`);return n}get all(){return this.singleton!==void 0?[this.singleton]:this.map!==void 0?Object.values(this.map):[]}};var cC=se(de(),1);var Wd=class{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,r,n=Y(e)){r??(r=this.nameProvider.getName(e));let i=this.astNodeLocator.getAstNodePath(e);if(!r)throw new Error(`Node at path ${i} has no name.`);let o,s=()=>{var a;return o??(o=Gt((a=this.nameProvider.getNameNode(e))!==null&&a!==void 0?a:e.$cstNode))};return{node:e,name:r,get nameSegment(){return s()},selectionSegment:Gt(e.$cstNode),type:e.$type,documentUri:n.uri,path:i}}},Bd=class{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,r=cC.CancellationToken.None){let n=[],i=e.parseResult.value;for(let o of zr(i))await Ue(r),ml(o).filter(s=>!Wo(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=Y(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:r.documentUri,targetPath:r.path,segment:Gt(n),local:ue.equals(r.documentUri,i)}}};var Kd=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 uC=se(Qe(),1),zd=class{constructor(e){this.settings={},this.workspaceConfig=!1,this.initialized=!1,this.serviceRegistry=e.ServiceRegistry,this.connection=e.lsp.Connection,e.lsp.LanguageServer.onInitialize(r=>{var n,i;this.workspaceConfig=(i=(n=r.capabilities.workspace)===null||n===void 0?void 0:n.configuration)!==null&&i!==void 0?i:!1}),e.lsp.LanguageServer.onInitialized(r=>{var n;let i=this.serviceRegistry.all;(n=e.lsp.Connection)===null||n===void 0||n.client.register(uC.DidChangeConfigurationNotification.type,{section:i.map(o=>this.toSectionName(o.LanguageMetaData.languageId))})})}async initialize(){if(this.workspaceConfig&&this.connection){let r=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),n=await this.connection.workspace.getConfiguration(r);r.forEach((i,o)=>{this.updateSectionConfiguration(i.section,n[o])})}this.initialized=!0}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(r=>{this.updateSectionConfiguration(r,e.settings[r])})}updateSectionConfiguration(e,r){this.settings[e]=r}async getConfiguration(e,r){this.initialized||await this.initialize();let n=this.toSectionName(e);if(this.settings[n])return this.settings[n][r]}toSectionName(e){return`${e}`}};var ca=se(de(),1);var Vd=class{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new ye,this.buildState=new Map,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,r={},n=ca.CancellationToken.None){var i,o;for(let s of e){let a=s.uri.toString();if(s.state===Ae.Validated){if(typeof r.validation=="boolean"&&r.validation)s.state=Ae.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 f=((o=r.validation.categories)!==null&&o!==void 0?o:za.all).filter(d=>!u.includes(d));f.length>0&&(this.buildState.set(a,{completed:!1,options:{validation:Object.assign(Object.assign({},r.validation),{categories:f})},result:c.result}),s.state=Ae.IndexedReferences)}}}else this.buildState.delete(a)}await this.emitUpdate(e.map(s=>s.uri),[]),await this.buildDocuments(e,r,n)}async update(e,r,n=ca.CancellationToken.None){for(let s of r)this.langiumDocuments.deleteDocument(s),this.buildState.delete(s.toString());this.indexManager.remove(r);for(let s of e)this.langiumDocuments.invalidateDocument(s)||this.langiumDocuments.getOrCreateDocument(s),this.buildState.delete(s.toString());let i=J(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,Ae.ComputedScopes),s.diagnostics=void 0}),await this.emitUpdate(e,r),await Ue(n);let o=this.langiumDocuments.all.filter(s=>{var a;return s.state<Ae.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)))}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),ca.Disposable.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,Ae.Parsed,n,o=>{this.langiumDocumentFactory.update(o)}),await this.runCancelable(e,Ae.IndexedContent,n,o=>this.indexManager.updateContent(o,n)),await this.runCancelable(e,Ae.ComputedScopes,n,async o=>{let s=this.serviceRegistry.getServices(o.uri).references.ScopeComputation;o.precomputedScopes=await s.computeLocalScopes(o,n)}),await this.runCancelable(e,Ae.Linked,n,o=>this.serviceRegistry.getServices(o.uri).references.Linker.link(o,n)),await this.runCancelable(e,Ae.IndexedReferences,n,o=>this.indexManager.updateReferences(o,n));let i=e.filter(o=>this.shouldValidate(o));await this.runCancelable(i,Ae.Validated,n,o=>this.validate(o,n));for(let o of e){let s=this.buildState.get(o.uri.toString());s&&(s.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(s=>s.state<r);for(let s of o)await Ue(n),await i(s),s.state=r;await this.notifyBuildPhase(o,r,n)}onBuildPhase(e,r){return this.buildPhaseListeners.add(e,r),ca.Disposable.create(()=>{this.buildPhaseListeners.delete(e,r)})}async notifyBuildPhase(e,r,n){if(e.length===0)return;let i=this.buildPhaseListeners.get(r);for(let o of i)await Ue(n),await o(e,n)}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:za.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 jy=se(de(),1);var Xd=class{constructor(e){this.simpleIndex=new Map,this.simpleTypeIndex=new Il,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,r){let n=Y(e).uri,i=[];return this.referenceIndex.forEach(o=>{o.forEach(s=>{ue.equals(s.targetUri,n)&&s.targetPath===r&&i.push(s)})}),J(i)}allElements(e,r){let n=J(this.simpleIndex.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.simpleTypeIndex.get(e,r,()=>{var o;return((o=this.simpleIndex.get(e))!==null&&o!==void 0?o:[]).filter(a=>this.astReflection.isSubtype(a.type,r))}):(n=this.simpleIndex.get(e))!==null&&n!==void 0?n:[]}remove(e){for(let r of e){let n=r.toString();this.simpleIndex.delete(n),this.simpleTypeIndex.clear(n),this.referenceIndex.delete(n)}}async updateContent(e,r=jy.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,r);for(let s of i)s.node=void 0;let o=e.uri.toString();this.simpleIndex.set(o,i),this.simpleTypeIndex.clear(o)}async updateReferences(e,r=jy.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 lC=se(de(),1);var Yd=class{constructor(e){this.initialBuildOptions={},this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.MutexLock,e.lsp.LanguageServer.onInitialize(r=>{var n;this.folders=(n=r.workspaceFolders)!==null&&n!==void 0?n:void 0}),e.lsp.LanguageServer.onInitialized(r=>{this.mutex.lock(n=>{var i;return this.initializeWorkspace((i=this.folders)!==null&&i!==void 0?i:[],n)})})}async initializeWorkspace(e,r=lC.CancellationToken.None){let n=this.serviceRegistry.all.flatMap(s=>s.LanguageMetaData.fileExtensions),i=[],o=s=>{i.push(s),this.langiumDocuments.hasDocument(s.uri)||this.langiumDocuments.addDocument(s)};await this.loadAdditionalDocuments(e,o),await Promise.all(e.map(s=>[s,this.getRootFolder(s)]).map(async s=>this.traverseFolder(...s,n,o))),await Ue(r),await this.documentBuilder.build(i,this.initialBuildOptions,r)}loadAdditionalDocuments(e,r){return Promise.resolve()}getRootFolder(e){return At.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=this.langiumDocuments.getOrCreateDocument(s.uri);i(a)}}}))}includeEntry(e,r,n){let i=ue.basename(r.uri);if(i.startsWith("."))return!1;if(r.isDirectory)return i!=="node_modules"&&i!=="out";if(r.isFile){let o=ue.extname(r.uri);return n.includes(o)}return!1}};var Jd=class{constructor(e){let r=e.parser.TokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(r);let n=fC(r)?Object.values(r):r;this.chevrotainLexer=new tt(n,{positionTracking:"full"})}get definition(){return this.tokenTypes}tokenize(e){var r;let n=this.chevrotainLexer.tokenize(e);return{tokens:n.tokens,errors:n.errors,hidden:(r=n.groups.hidden)!==null&&r!==void 0?r:[]}}toTokenTypeDictionary(e){if(fC(e))return e;let r=dC(e)?Object.values(e.modes).flat():e,n={};return r.forEach(i=>n[i.name]=i),n}};function Ij(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function dC(t){return t&&"modes"in t&&"defaultMode"in t}function fC(t){return!Ij(t)&&!dC(t)}var le=se(de(),1);function hC(t,e,r){let n,i;typeof t=="string"?(i=e,n=r):(i=t.range.start,n=e),i||(i=le.Position.create(0,0));let o=yC(t),s=Wy(n),a=Oj({lines:o,position:i,options:s});return Uj({index:0,tokens:a,position:i})}function gC(t,e){let r=Wy(e),n=yC(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 yC(t){let e="";return typeof t=="string"?e=t:e=t.text,e.split(Fa)}var pC=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,Dj=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function Oj(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],f=0;if(c&&t.options.start){let p=(e=t.options.start)===null||e===void 0?void 0:e.exec(l);p&&(f=p.index+p[0].length)}else{let p=(r=t.options.line)===null||r===void 0?void 0:r.exec(l);p&&(f=p.index+p[0].length)}if(u){let p=(n=t.options.end)===null||n===void 0?void 0:n.exec(l);p&&(l=l.substring(0,p.index))}if(l=l.substring(0,Fj(l)),Hy(l,f)>=l.length){if(i.length>0){let p=le.Position.create(o,s);i.push({type:"break",content:"",range:le.Range.create(p,p)})}}else{pC.lastIndex=f;let p=pC.exec(l);if(p){let T=p[0],S=p[1],A=le.Position.create(o,s+f),x=le.Position.create(o,s+f+T.length);i.push({type:"tag",content:S,range:le.Range.create(A,x)}),f+=T.length,f=Hy(l,f)}if(f<l.length){let T=l.substring(f),S=Array.from(T.matchAll(Dj));i.push(...$j(S,T,o,s+f))}}o++,s=0}return i.length>0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function $j(t,e,r,n){let i=[];if(t.length===0){let o=le.Position.create(r,n),s=le.Position.create(r,n+e.length);i.push({type:"text",content:e,range:le.Range.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:le.Range.create(le.Position.create(r,o+n),le.Position.create(r,c+n))});let l=u.length+1,f=a[1];if(i.push({type:"inline-tag",content:f,range:le.Range.create(le.Position.create(r,o+l+n),le.Position.create(r,o+l+f.length+n))}),l+=f.length,a.length===4){l+=a[2].length;let d=a[3];i.push({type:"text",content:d,range:le.Range.create(le.Position.create(r,o+l+n),le.Position.create(r,o+l+d.length+n))})}else i.push({type:"text",content:"",range:le.Range.create(le.Position.create(r,o+l+n),le.Position.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:le.Range.create(le.Position.create(r,o+n),le.Position.create(r,o+n+s.length))})}return i}var Lj=/\S/,Mj=/\s*$/;function Hy(t,e){let r=t.substring(e).match(Lj);return r?e+r.index:t.length}function Fj(t){let e=t.match(Mj);if(e&&typeof e.index=="number")return e.index}function Uj(t){var e,r,n,i;let o=le.Position.create(t.position.line,t.position.character);if(t.tokens.length===0)return new Qd([],le.Range.create(o,o));let s=[];for(;t.index<t.tokens.length;){let u=qj(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 Qd(s,le.Range.create(a,c))}function qj(t,e){let r=t.tokens[t.index];if(r.type==="tag")return xC(t,!1);if(r.type==="text"||r.type==="inline-tag")return TC(t);jj(r,e),t.index++}function jj(t,e){if(e){let r=new Zd("",t.range);"inlines"in e?e.inlines.push(r):e.content.inlines.push(r)}}function TC(t){let e=t.tokens[t.index],r=e,n=e,i=[];for(;e&&e.type!=="break"&&e.type!=="tag";)i.push(Gj(t)),n=e,e=t.tokens[t.index];return new Dc(i,le.Range.create(r.range.start,n.range.end))}function Gj(t){return t.tokens[t.index].type==="inline-tag"?xC(t,!0):vC(t)}function xC(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=vC(t);return new Ic(n,new Dc([o],o.range),e,le.Range.create(r.range.start,o.range.end))}else{let o=TC(t);return new Ic(n,o,e,le.Range.create(r.range.start,o.range.end))}else{let o=r.range;return new Ic(n,new Dc([],o),e,o)}}function vC(t){let e=t.tokens[t.index++];return new Zd(e.content,e.range)}function Wy(t){if(!t)return Wy({start:"/**",end:"*/",line:"*"});let{start:e,end:r,line:n}=t;return{start:Gy(e,!0),end:Gy(r,!1),line:Gy(n,!0)}}function Gy(t,e){if(typeof t=="string"||typeof t=="object"){let r=typeof t=="string"?$n(t):t.source;return e?new RegExp(`^\\s*${r}`):new RegExp(`\\s*${r}\\s*$`)}else return t}var Qd=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+=mC(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+=mC(r)+i}return r.trim()}},Ic=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}
|
|
160
|
-
${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=
|
|
161
|
-
${r}`),this.inline?`{${i}}`:i}};function
|
|
158
|
+
For Further details.`,n}function tj(t){if(t instanceof me)return"SUBRULE";if(t instanceof he)return"OPTION";if(t instanceof ke)return"OR";if(t instanceof Ie)return"AT_LEAST_ONE";if(t instanceof De)return"AT_LEAST_ONE_SEP";if(t instanceof we)return"MANY_SEP";if(t instanceof re)return"MANY";if(t instanceof ee)return"CONSUME";throw Error("non exhaustive match")}function rj(t,e,r){let n=Mt(e.configs.elements,o=>o.state.transitions),i=PE(n.filter(o=>o instanceof na).map(o=>o.tokenType),o=>o.tokenTypeIdx);return{actualToken:r,possibleTokenTypes:i,tokenPath:t}}function nj(t,e){return t.edges[e.tokenTypeIdx]}function ij(t,e,r){let n=new aa,i=[];for(let s of t.elements){if(r.is(s.alt)===!1)continue;if(s.state.type===oa){i.push(s);continue}let a=s.state.transitions.length;for(let c=0;c<a;c++){let u=s.state.transitions[c],l=oj(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 aa;for(let s of n.elements)_d(s,o)}if(i.length>0&&!uj(o))for(let s of i)o.add(s);return o}function oj(t,e){if(t instanceof na&&mc(e,t.tokenType))return t.target}function sj(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 Q_(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function J_(t,e,r,n){return n=Z_(t,n),e.edges[r.tokenTypeIdx]=n,n}function Z_(t,e){if(e===_c)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 aj(t){let e=new aa,r=t.transitions.length;for(let n=0;n<r;n++){let o={state:t.transitions[n].target,alt:n,stack:[]};_d(o,e)}return e}function _d(t,e){let r=t.state;if(r.type===oa){if(t.stack.length>0){let i=[...t.stack],s={state:i.pop(),alt:t.alt,stack:i};_d(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=cj(t,o);s!==void 0&&_d(s,e)}}function cj(t,e){if(e instanceof Ec)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof ia){let r=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:r}}}function uj(t){for(let e of t.elements)if(e.state.type===oa)return!0;return!1}function lj(t){for(let e of t.elements)if(e.state.type!==oa)return!1;return!0}function fj(t){if(lj(t))return!0;let e=dj(t.elements);return pj(e)&&!mj(e)}function dj(t){let e=new Map;for(let r of t){let n=Iy(r,!1),i=e.get(n);i===void 0&&(i={},e.set(n,i)),i[r.alt]=!0}return e}function pj(t){for(let e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function mj(t){for(let e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}ji();var Cd=class{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]}buildRootNode(e){return this.rootNode=new $y(e),this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let r=new Id;return r.grammarSource=e,r.root=this.rootNode,this.current.content.push(r),this.nodeStack.push(r),r}buildLeafNode(e,r){let n=new Pd(e.startOffset,e.image.length,Oa(e),e.tokenType,!1);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)}}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)}addHiddenTokens(e){for(let r of e){let n=new Pd(r.startOffset,r.image.length,Oa(r),r.tokenType,!0);n.root=this.rootNode,this.addHiddenToken(this.rootNode,n)}}addHiddenToken(e,r){let{offset:n,end:i}=r;for(let o=0;o<e.content.length;o++){let s=e.content[o],{offset:a,end:c}=s;if(Kr(s)&&n>a&&i<c){this.addHiddenToken(s,r);return}else if(i<=a){e.content.splice(o,0,r);return}}e.content.push(r)}},Nd=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)}},Pd=class extends Nd{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}},Id=class extends Nd{constructor(){super(...arguments),this.content=new Oy(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:Qt.create(0,0),end:Qt.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]}},Oy=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}},$y=class extends Id{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}};var My=Symbol("Datatype");function Ly(t){return t.$type===My}var eC="\u200B",tC=t=>t.endsWith(eC)?t:t+eC,Dd=class{constructor(e){this._unorderedGroups=new Map,this.lexer=e.parser.Lexer;let r=this.lexer.definition;this.wrapper=new Uy(r,Object.assign(Object.assign({},e.parser.ParserConfig),{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)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}},Od=class extends Dd{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new Cd,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=e.fragment?void 0:wr(e)?My:Yr(e),i=this.wrapper.DEFINE_RULE(tC(e.name),this.startImplementation(n,r).bind(this));return e.entry&&(this.mainRule=i),i}parse(e){this.nodeBuilder.buildRootNode(e);let r=this.lexer.tokenize(e);this.wrapper.input=r.tokens;let n=this.mainRule.call(this.wrapper,{});return this.nodeBuilder.addHiddenTokens(r.hidden),this.unorderedGroups.clear(),{value:n,lexerErrors:r.errors,parserErrors:this.wrapper.errors}}startImplementation(e,r){return n=>{if(!this.isRecording()){let o={$type:e};this.stack.push(o),e===My&&(o.value="")}let i;try{i=r(n)}catch{i=void 0}return!this.isRecording()&&i===void 0&&(i=this.construct()),i}}consume(e,r,n){let i=this.wrapper.wrapConsume(e,r);if(!this.isRecording()&&this.isValidToken(i)){let o=this.nodeBuilder.buildLeafNode(i,n),{assignment:s,isCrossRef:a}=this.getAssignment(n),c=this.current;if(s){let u=Ze(n)?i.image:this.converter.convert(i.image,o);this.assign(s.operator,s.feature,u,o,a)}else if(Ly(c)){let u=i.image;Ze(n)||(u=this.converter.convert(u,o).toString()),c.value+=u}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,r,n,i){let o;this.isRecording()||(o=this.nodeBuilder.buildCompositeNode(n));let s=this.wrapper.wrapSubrule(e,r,i);!this.isRecording()&&o&&o.length>0&&this.performSubruleAssignment(s,n,o)}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(Ly(s))s.value+=e.toString();else{let a=e.$type,c=this.assignWithoutOverride(e,s);a&&(c.$type=a);let u=c;this.stack.pop(),this.stack.push(u)}}}action(e,r){if(!this.isRecording()){let n=this.current;if(!n.$cstNode&&r.feature&&r.operator){n=this.construct(!1);let o=n.$cstNode.feature;this.nodeBuilder.buildCompositeNode(o)}let i={$type:e};this.stack.pop(),this.stack.push(i),r.feature&&r.operator&&this.assign(r.operator,r.feature,n,n.$cstNode,!1)}}construct(e=!0){if(this.isRecording())return;let r=this.current;return db(r),this.nodeBuilder.construct(r),e&&this.stack.pop(),Ly(r)?this.converter.convert(r.value,r.$cstNode):(hl(this.astReflection,r),r)}getAssignment(e){if(!this.assignmentMap.has(e)){let r=ve(e,ce);this.assignmentMap.set(e,{assignment:r,isCrossRef:r?Dt(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[n,i]of Object.entries(r)){let o=e[n];o===void 0?e[n]=i:Array.isArray(o)&&Array.isArray(i)&&(i.push(...o),e[n]=i)}return e}get definitionErrors(){return this.wrapper.definitionErrors}},Fy=class{buildMismatchTokenMessage(e){return Kn.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return Kn.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return Kn.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return Kn.buildEarlyExitMessage(e)}},Nc=class extends Fy{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}\`.`}},$d=class extends Dd{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);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(tC(e.name),this.startImplementation(r).bind(this));return 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){this.before(n),this.wrapper.wrapSubrule(e,r,i),this.after(n)}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}},hj={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new Nc},Uy=class extends wc{constructor(e,r){let n=r&&"maxLookahead"in r;super(e,Object.assign(Object.assign(Object.assign({},hj),{lookaheadStrategy:n?new zn({maxLookahead:r.maxLookahead}):new Cc}),r))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,r){return this.RULE(e,r)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,r){return this.consume(e,r)}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)}};var Pc=class extends Error{constructor(e,r){super(e?`${r} at ${e.range.start.line}:${e.range.start.character}`:r)}};function Ld(t){throw new Error("Error! The input value was not handled.")}function Fd(t,e,r){return gj({parser:e,tokens:r,rules:new Map,ruleNames:new Map},t),e}function gj(t,e){let r=ss(e,!1),n=J(e.rules).filter(M).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});o.rules.set(i.name,t.parser.rule(i,mo(o,i.definition)))}}function mo(t,e,r=!1){let n;if(Ze(e))n=bj(t,e);else if(Te(e))n=yj(t,e);else if(ce(e))n=mo(t,e.terminal);else if(Dt(e))n=rC(t,e);else if(xe(e))n=Tj(t,e);else if(vr(e))n=vj(t,e);else if(Rr(e))n=Rj(t,e);else if(bt(e))n=Sj(t,e);else if(VS(e)){let i=t.consume++;n=()=>t.parser.consume(i,_r,e)}else throw new Pc(e.$cstNode,`Unexpected element type: ${e.$type}`);return nC(t,r?void 0:Md(e),n,e.cardinality)}function yj(t,e){let r=Yr(e);return()=>t.parser.action(r,e)}function Tj(t,e){let r=e.rule.ref;if(M(r)){let n=t.subrule++,i=e.arguments.length>0?xj(r,e.arguments):()=>({});return o=>t.parser.subrule(n,iC(t,r),e,i(o))}else if(pe(r)){let n=t.consume++,i=qy(t,r.name);return()=>t.parser.consume(n,i,e)}else if(r)Ld(r);else throw new Pc(e.$cstNode,`Undefined rule type: ${e.$type}`)}function xj(t,e){let r=e.map(n=>Vn(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 Vn(t){if(CS(t)){let e=Vn(t.left),r=Vn(t.right);return n=>e(n)||r(n)}else if(ES(t)){let e=Vn(t.left),r=Vn(t.right);return n=>e(n)&&r(n)}else if(OS(t)){let e=Vn(t.value);return r=>!e(r)}else if(Vo(t)){let e=t.parameter.ref.name;return r=>r!==void 0&&r[e]===!0}else if(IS(t)){let e=!!t.true;return()=>e}Ld(t)}function vj(t,e){if(e.elements.length===1)return mo(t,e.elements[0]);{let r=[];for(let i of e.elements){let o={ALT:mo(t,i,!0)},s=Md(i);s&&(o.GATE=Vn(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 Rj(t,e){if(e.elements.length===1)return mo(t,e.elements[0]);let r=[];for(let a of e.elements){let c={ALT:mo(t,a,!0)},u=Md(a);u&&(c.GATE=Vn(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},f=t.parser;l.ALT=()=>{if(c.ALT(a),!f.isRecording()){let p=i(n,f);f.unorderedGroups.get(p)||f.unorderedGroups.set(p,[]);let T=f.unorderedGroups.get(p);typeof T?.[u]>"u"&&(T[u]=!0)}};let d=c.GATE;return d?l.GATE=()=>d(a):l.GATE=()=>{let p=f.unorderedGroups.get(i(n,f));return!p?.[u]},l})),s=nC(t,Md(e),o,"*");return a=>{s(a),t.parser.isRecording()||t.parser.unorderedGroups.delete(i(n,t.parser))}}function Sj(t,e){let r=e.elements.map(n=>mo(t,n));return n=>r.forEach(i=>i(n))}function Md(t){if(bt(t))return t.guardCondition}function rC(t,e,r=e.terminal){if(r)if(xe(r)&&M(r.rule.ref)){let n=t.subrule++;return i=>t.parser.subrule(n,iC(t,r.rule.ref),e,i)}else if(xe(r)&&pe(r.rule.ref)){let n=t.consume++,i=qy(t,r.rule.ref.name);return()=>t.parser.consume(n,i,e)}else if(Ze(r)){let n=t.consume++,i=qy(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=Qa(e.type.ref),i=n?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+Yr(e.type.ref));return rC(t,e,i)}}function bj(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 nC(t,e,r,n){let i=e&&Vn(e);if(!n)if(i){let o=t.or++;return s=>t.parser.alternatives(o,[{ALT:()=>r(s),GATE:()=>i(s)},{ALT:kd(),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:kd(),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 Ld(n)}function iC(t,e){let r=Aj(t,e),n=t.rules.get(r);if(!n)throw new Error(`Rule "${r}" not found."`);return n}function Aj(t,e){if(M(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let r=e,n=r.$container,i=e.$type;for(;!M(n);)(bt(n)||vr(n)||Rr(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 qy(t,e){let r=t.tokens[e];if(!r)throw new Error(`Token "${e}" not found."`);return r}function oC(t){let e=t.Grammar,r=t.parser.Lexer,n=new $d(t);return Fd(e,n,r.definition),n.finalize(),n}function sC(t){let e=wj(t);return e.finalize(),e}function wj(t){let e=t.Grammar,r=t.parser.Lexer,n=new Od(t);return Fd(e,n,r.definition)}var Ud=class{buildTokens(e,r){let n=J(ss(e,!1)),i=this.buildTerminalTokens(n),o=this.buildKeywordTokens(n,i,r);return i.forEach(s=>{let a=s.PATTERN;typeof a=="object"&&a&&"test"in a&&Rg(a)?o.unshift(s):o.push(s)}),o}buildTerminalTokens(e){return e.filter(pe).filter(r=>!r.fragment).map(r=>this.buildTerminalToken(r)).toArray()}buildTerminalToken(e){let r=Fr(e),n=r.flags.includes("u")?this.regexPatternFunction(r):r,i={name:e.name,PATTERN:n,LINE_BREAKS:!0};return e.hidden&&(i.GROUP=Rg(r)?tt.SKIPPED:"hidden"),i}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(M).flatMap(i=>Fe(i).filter(Ze)).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){return{name:e.value,PATTERN:this.buildKeywordPattern(e,n),LONGER_ALT:this.findLongerAlt(e,r)}}buildKeywordPattern(e,r){return r?new RegExp(Ob(e.value)):e.value}findLongerAlt(e,r){return r.reduce((n,i)=>{let o=i?.PATTERN;return o?.source&&$b("^"+o.source+"$",e.value)&&n.push(i),n},[])}};var qd=class{convert(e,r){let n=r.grammarSource;if(Dt(n)&&(n=ql(n)),xe(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 Cj(r);case"STRING":return kj(r);case"ID":return _j(r)}switch((i=to(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return Ij(r);case"boolean":return Dj(r);case"bigint":return Nj(r);case"date":return Pj(r);default:return r}}};function kj(t){let e="";for(let r=1;r<t.length-1;r++){let n=t.charAt(r);if(n==="\\"){let i=t.charAt(++r);e+=Ej(i)}else e+=n}return e}function Ej(t){switch(t){case"b":return"\b";case"f":return"\f";case"n":return`
|
|
159
|
+
`;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return t}}function _j(t){return t.charAt(0)==="^"?t.substring(1):t}function Cj(t){return parseInt(t)}function Nj(t){return BigInt(t)}function Pj(t){return new Date(t)}function Ij(t){return Number(t)}function Dj(t){return t.toLowerCase()==="true"}var aC=se(de(),1);var jd=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=aC.CancellationToken.None){for(let n of Pn(e.parseResult.value))await Ue(r),ml(n).forEach(i=>this.doLink(i,e))}doLink(e,r){let n=e.reference;if(n._ref===void 0)try{let i=this.getCandidate(e);if(Wo(i))n._ref=i;else if(n._nodeDescription=i,this.langiumDocuments().hasDocument(i.documentUri)){let o=this.loadAstNode(i);n._ref=o??this.createLinkingError(e,i)}}catch(i){n._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${n.$refText}': ${i}`})}r.references.push(n)}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(ut(this._ref))return this._ref;if(fS(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){let c=o.getLinkedNode({reference:s,container:e,property:r});if(c.error&&Y(e).state<Ae.ComputedScopes)return;this._ref=(a=c.node)!==null&&a!==void 0?a:c.error,this._nodeDescription=c.descr}return ut(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return Wo(this._ref)?this._ref:void 0}};return s}getLinkedNode(e){try{let r=this.getCandidate(e);if(Wo(r))return{error:r};let n=this.loadAstNode(r);return n?{node:n,descr:r}:{descr:r,error:this.createLinkingError(e,r)}}catch(r){return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${r}`})}}}loadAstNode(e){if(e.node)return e.node;let r=this.langiumDocuments().getOrCreateDocument(e.documentUri);return this.astNodeLocator.getAstNode(r.parseResult.value,e.path)}createLinkingError(e,r){let n=Y(e.container);n.state<Ae.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 uC(t){return typeof t.$comment=="string"}function cC(t){return typeof t=="object"&&!!t&&("$ref"in t||"$error"in t)}var Gd=class{constructor(e){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,r){let n=r?.replacer,i=(s,a)=>this.replacer(s,a,r);return JSON.stringify(e,n?(s,a)=>n(s,a,i):i,r?.space)}deserialize(e){let r=JSON.parse(e);return this.linkNode(r,r),r}replacer(e,r,{refText:n,sourceText:i,textRegions:o,comments:s}={}){var a,c,u;if(!this.ignoreProperties.has(e))if(Cn(r)){let l=r.ref,f=n?r.$refText:void 0;return l?{$refText:f,$ref:"#"+(l&&this.astNodeLocator.getAstNodePath(l))}:{$refText:f,$error:(c=(a=r.error)===null||a===void 0?void 0:a.message)!==null&&c!==void 0?c:"Could not resolve reference"}}else{let l;if(o&&ut(r)&&(l=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},r)),(!e||r.$document)&&l?.$textRegion))try{l.$textRegion.documentURI=Y(r).uri.toString()}catch{}return i&&!e&&ut(r)&&(l??(l=Object.assign({},r)),l.$sourceText=(u=r.$cstNode)===null||u===void 0?void 0:u.text),s&&ut(r)&&(l??(l=Object.assign({},r)),l.$comment=this.commentProvider.getComment(r)),l??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=mi(e.$cstNode,o).map(r);s.length!==0&&(i[o]=s)}),e}}linkNode(e,r,n,i,o){for(let[a,c]of Object.entries(e))if(Array.isArray(c))for(let u=0;u<c.length;u++){let l=c[u];cC(l)?c[u]=this.reviveReference(e,a,r,l):ut(l)&&this.linkNode(l,r,e,a,u)}else cC(c)?e[a]=this.reviveReference(e,a,r,c):ut(c)&&this.linkNode(c,r,e,a);let s=e;s.$container=n,s.$containerProperty=i,s.$containerIndex=o}reviveReference(e,r,n,i){let o=i.$refText;if(i.$ref){let s=this.getRefNode(n,i.$ref);return o||(o=this.nameProvider.getName(s)),{$refText:o??"",ref:s}}else if(i.$error){let s={$refText:o??""};return s.error={container:e,property:r,message:i.$error,reference:s},s}else return}getRefNode(e,r){return this.astNodeLocator.getAstNode(e,r.substring(1))}};var Hd=class{register(e){if(!this.singleton&&!this.map){this.singleton=e;return}if(!this.map&&(this.map={},this.singleton)){for(let r of this.singleton.LanguageMetaData.fileExtensions)this.map[r]=this.singleton;this.singleton=void 0}for(let r of e.LanguageMetaData.fileExtensions)this.map[r]!==void 0&&this.map[r]!==e&&console.warn(`The file extension ${r} is used by multiple languages. It is now assigned to '${e.LanguageMetaData.languageId}'.`),this.map[r]=e}getServices(e){if(this.singleton!==void 0)return this.singleton;if(this.map===void 0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");let r=ue.extname(e),n=this.map[r];if(!n)throw new Error(`The service registry contains no services for the extension '${r}'.`);return n}get all(){return this.singleton!==void 0?[this.singleton]:this.map!==void 0?Object.values(this.map):[]}};var lC=se(de(),1);var Wd=class{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,r,n=Y(e)){r??(r=this.nameProvider.getName(e));let i=this.astNodeLocator.getAstNodePath(e);if(!r)throw new Error(`Node at path ${i} has no name.`);let o,s=()=>{var a;return o??(o=Gt((a=this.nameProvider.getNameNode(e))!==null&&a!==void 0?a:e.$cstNode))};return{node:e,name:r,get nameSegment(){return s()},selectionSegment:Gt(e.$cstNode),type:e.$type,documentUri:n.uri,path:i}}},Bd=class{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,r=lC.CancellationToken.None){let n=[],i=e.parseResult.value;for(let o of Pn(i))await Ue(r),ml(o).filter(s=>!Wo(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=Y(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:r.documentUri,targetPath:r.path,segment:Gt(n),local:ue.equals(r.documentUri,i)}}};var Kd=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 fC=se(Qe(),1),zd=class{constructor(e){this.settings={},this.workspaceConfig=!1,this.initialized=!1,this.serviceRegistry=e.ServiceRegistry,this.connection=e.lsp.Connection,e.lsp.LanguageServer.onInitialize(r=>{var n,i;this.workspaceConfig=(i=(n=r.capabilities.workspace)===null||n===void 0?void 0:n.configuration)!==null&&i!==void 0?i:!1}),e.lsp.LanguageServer.onInitialized(r=>{var n;let i=this.serviceRegistry.all;(n=e.lsp.Connection)===null||n===void 0||n.client.register(fC.DidChangeConfigurationNotification.type,{section:i.map(o=>this.toSectionName(o.LanguageMetaData.languageId))})})}async initialize(){if(this.workspaceConfig&&this.connection){let r=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),n=await this.connection.workspace.getConfiguration(r);r.forEach((i,o)=>{this.updateSectionConfiguration(i.section,n[o])})}this.initialized=!0}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(r=>{this.updateSectionConfiguration(r,e.settings[r])})}updateSectionConfiguration(e,r){this.settings[e]=r}async getConfiguration(e,r){this.initialized||await this.initialize();let n=this.toSectionName(e);if(this.settings[n])return this.settings[n][r]}toSectionName(e){return`${e}`}};var ca=se(de(),1);var Vd=class{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new ye,this.buildState=new Map,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,r={},n=ca.CancellationToken.None){var i,o;for(let s of e){let a=s.uri.toString();if(s.state===Ae.Validated){if(typeof r.validation=="boolean"&&r.validation)s.state=Ae.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 f=((o=r.validation.categories)!==null&&o!==void 0?o:za.all).filter(d=>!u.includes(d));f.length>0&&(this.buildState.set(a,{completed:!1,options:{validation:Object.assign(Object.assign({},r.validation),{categories:f})},result:c.result}),s.state=Ae.IndexedReferences)}}}else this.buildState.delete(a)}await this.emitUpdate(e.map(s=>s.uri),[]),await this.buildDocuments(e,r,n)}async update(e,r,n=ca.CancellationToken.None){for(let s of r)this.langiumDocuments.deleteDocument(s),this.buildState.delete(s.toString());this.indexManager.remove(r);for(let s of e)this.langiumDocuments.invalidateDocument(s)||this.langiumDocuments.getOrCreateDocument(s),this.buildState.delete(s.toString());let i=J(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,Ae.ComputedScopes),s.diagnostics=void 0}),await this.emitUpdate(e,r),await Ue(n);let o=this.langiumDocuments.all.filter(s=>{var a;return s.state<Ae.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)))}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),ca.Disposable.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,Ae.Parsed,n,o=>{this.langiumDocumentFactory.update(o)}),await this.runCancelable(e,Ae.IndexedContent,n,o=>this.indexManager.updateContent(o,n)),await this.runCancelable(e,Ae.ComputedScopes,n,async o=>{let s=this.serviceRegistry.getServices(o.uri).references.ScopeComputation;o.precomputedScopes=await s.computeLocalScopes(o,n)}),await this.runCancelable(e,Ae.Linked,n,o=>this.serviceRegistry.getServices(o.uri).references.Linker.link(o,n)),await this.runCancelable(e,Ae.IndexedReferences,n,o=>this.indexManager.updateReferences(o,n));let i=e.filter(o=>this.shouldValidate(o));await this.runCancelable(i,Ae.Validated,n,o=>this.validate(o,n));for(let o of e){let s=this.buildState.get(o.uri.toString());s&&(s.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(s=>s.state<r);for(let s of o)await Ue(n),await i(s),s.state=r;await this.notifyBuildPhase(o,r,n)}onBuildPhase(e,r){return this.buildPhaseListeners.add(e,r),ca.Disposable.create(()=>{this.buildPhaseListeners.delete(e,r)})}async notifyBuildPhase(e,r,n){if(e.length===0)return;let i=this.buildPhaseListeners.get(r);for(let o of i)await Ue(n),await o(e,n)}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:za.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 jy=se(de(),1);var Xd=class{constructor(e){this.simpleIndex=new Map,this.simpleTypeIndex=new Il,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,r){let n=Y(e).uri,i=[];return this.referenceIndex.forEach(o=>{o.forEach(s=>{ue.equals(s.targetUri,n)&&s.targetPath===r&&i.push(s)})}),J(i)}allElements(e,r){let n=J(this.simpleIndex.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.simpleTypeIndex.get(e,r,()=>{var o;return((o=this.simpleIndex.get(e))!==null&&o!==void 0?o:[]).filter(a=>this.astReflection.isSubtype(a.type,r))}):(n=this.simpleIndex.get(e))!==null&&n!==void 0?n:[]}remove(e){for(let r of e){let n=r.toString();this.simpleIndex.delete(n),this.simpleTypeIndex.clear(n),this.referenceIndex.delete(n)}}async updateContent(e,r=jy.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,r);for(let s of i)s.node=void 0;let o=e.uri.toString();this.simpleIndex.set(o,i),this.simpleTypeIndex.clear(o)}async updateReferences(e,r=jy.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 dC=se(de(),1);var Yd=class{constructor(e){this.initialBuildOptions={},this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.MutexLock,e.lsp.LanguageServer.onInitialize(r=>{var n;this.folders=(n=r.workspaceFolders)!==null&&n!==void 0?n:void 0}),e.lsp.LanguageServer.onInitialized(r=>{this.mutex.lock(n=>{var i;return this.initializeWorkspace((i=this.folders)!==null&&i!==void 0?i:[],n)})})}async initializeWorkspace(e,r=dC.CancellationToken.None){let n=this.serviceRegistry.all.flatMap(s=>s.LanguageMetaData.fileExtensions),i=[],o=s=>{i.push(s),this.langiumDocuments.hasDocument(s.uri)||this.langiumDocuments.addDocument(s)};await this.loadAdditionalDocuments(e,o),await Promise.all(e.map(s=>[s,this.getRootFolder(s)]).map(async s=>this.traverseFolder(...s,n,o))),await Ue(r),await this.documentBuilder.build(i,this.initialBuildOptions,r)}loadAdditionalDocuments(e,r){return Promise.resolve()}getRootFolder(e){return At.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=this.langiumDocuments.getOrCreateDocument(s.uri);i(a)}}}))}includeEntry(e,r,n){let i=ue.basename(r.uri);if(i.startsWith("."))return!1;if(r.isDirectory)return i!=="node_modules"&&i!=="out";if(r.isFile){let o=ue.extname(r.uri);return n.includes(o)}return!1}};var Jd=class{constructor(e){let r=e.parser.TokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(r);let n=pC(r)?Object.values(r):r;this.chevrotainLexer=new tt(n,{positionTracking:"full"})}get definition(){return this.tokenTypes}tokenize(e){var r;let n=this.chevrotainLexer.tokenize(e);return{tokens:n.tokens,errors:n.errors,hidden:(r=n.groups.hidden)!==null&&r!==void 0?r:[]}}toTokenTypeDictionary(e){if(pC(e))return e;let r=mC(e)?Object.values(e.modes).flat():e,n={};return r.forEach(i=>n[i.name]=i),n}};function Oj(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function mC(t){return t&&"modes"in t&&"defaultMode"in t}function pC(t){return!Oj(t)&&!mC(t)}var le=se(de(),1);function yC(t,e,r){let n,i;typeof t=="string"?(i=e,n=r):(i=t.range.start,n=e),i||(i=le.Position.create(0,0));let o=xC(t),s=Wy(n),a=Lj({lines:o,position:i,options:s});return jj({index:0,tokens:a,position:i})}function TC(t,e){let r=Wy(e),n=xC(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 xC(t){let e="";return typeof t=="string"?e=t:e=t.text,e.split(Fa)}var hC=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,$j=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function Lj(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],f=0;if(c&&t.options.start){let p=(e=t.options.start)===null||e===void 0?void 0:e.exec(l);p&&(f=p.index+p[0].length)}else{let p=(r=t.options.line)===null||r===void 0?void 0:r.exec(l);p&&(f=p.index+p[0].length)}if(u){let p=(n=t.options.end)===null||n===void 0?void 0:n.exec(l);p&&(l=l.substring(0,p.index))}if(l=l.substring(0,qj(l)),Hy(l,f)>=l.length){if(i.length>0){let p=le.Position.create(o,s);i.push({type:"break",content:"",range:le.Range.create(p,p)})}}else{hC.lastIndex=f;let p=hC.exec(l);if(p){let T=p[0],R=p[1],A=le.Position.create(o,s+f),S=le.Position.create(o,s+f+T.length);i.push({type:"tag",content:R,range:le.Range.create(A,S)}),f+=T.length,f=Hy(l,f)}if(f<l.length){let T=l.substring(f),R=Array.from(T.matchAll($j));i.push(...Mj(R,T,o,s+f))}}o++,s=0}return i.length>0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function Mj(t,e,r,n){let i=[];if(t.length===0){let o=le.Position.create(r,n),s=le.Position.create(r,n+e.length);i.push({type:"text",content:e,range:le.Range.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:le.Range.create(le.Position.create(r,o+n),le.Position.create(r,c+n))});let l=u.length+1,f=a[1];if(i.push({type:"inline-tag",content:f,range:le.Range.create(le.Position.create(r,o+l+n),le.Position.create(r,o+l+f.length+n))}),l+=f.length,a.length===4){l+=a[2].length;let d=a[3];i.push({type:"text",content:d,range:le.Range.create(le.Position.create(r,o+l+n),le.Position.create(r,o+l+d.length+n))})}else i.push({type:"text",content:"",range:le.Range.create(le.Position.create(r,o+l+n),le.Position.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:le.Range.create(le.Position.create(r,o+n),le.Position.create(r,o+n+s.length))})}return i}var Fj=/\S/,Uj=/\s*$/;function Hy(t,e){let r=t.substring(e).match(Fj);return r?e+r.index:t.length}function qj(t){let e=t.match(Uj);if(e&&typeof e.index=="number")return e.index}function jj(t){var e,r,n,i;let o=le.Position.create(t.position.line,t.position.character);if(t.tokens.length===0)return new Qd([],le.Range.create(o,o));let s=[];for(;t.index<t.tokens.length;){let u=Gj(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 Qd(s,le.Range.create(a,c))}function Gj(t,e){let r=t.tokens[t.index];if(r.type==="tag")return RC(t,!1);if(r.type==="text"||r.type==="inline-tag")return vC(t);Hj(r,e),t.index++}function Hj(t,e){if(e){let r=new Zd("",t.range);"inlines"in e?e.inlines.push(r):e.content.inlines.push(r)}}function vC(t){let e=t.tokens[t.index],r=e,n=e,i=[];for(;e&&e.type!=="break"&&e.type!=="tag";)i.push(Wj(t)),n=e,e=t.tokens[t.index];return new Dc(i,le.Range.create(r.range.start,n.range.end))}function Wj(t){return t.tokens[t.index].type==="inline-tag"?RC(t,!0):SC(t)}function RC(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=SC(t);return new Ic(n,new Dc([o],o.range),e,le.Range.create(r.range.start,o.range.end))}else{let o=vC(t);return new Ic(n,o,e,le.Range.create(r.range.start,o.range.end))}else{let o=r.range;return new Ic(n,new Dc([],o),e,o)}}function SC(t){let e=t.tokens[t.index++];return new Zd(e.content,e.range)}function Wy(t){if(!t)return Wy({start:"/**",end:"*/",line:"*"});let{start:e,end:r,line:n}=t;return{start:Gy(e,!0),end:Gy(r,!1),line:Gy(n,!0)}}function Gy(t,e){if(typeof t=="string"||typeof t=="object"){let r=typeof t=="string"?On(t):t.source;return e?new RegExp(`^\\s*${r}`):new RegExp(`\\s*${r}\\s*$`)}else return t}var Qd=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+=gC(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+=gC(r)+i}return r.trim()}},Ic=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}
|
|
160
|
+
${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=Bj(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}
|
|
161
|
+
${r}`),this.inline?`{${i}}`:i}};function Bj(t,e,r){var n,i;if(t==="linkplain"||t==="linkcode"||t==="link"){let o=e.indexOf(" "),s=e;if(o>0){let c=Hy(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:Kj(e,s)}}function Kj(t,e){try{return At.parse(t,!0),`[${e}](${t})`}catch{return t}}var Dc=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+=`
|
|
162
162
|
`)}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+=`
|
|
163
|
-
`)}return r}},Zd=class{constructor(e,r){this.text=e,this.range=r}toString(){return this.text}toMarkdown(){return this.text}};function
|
|
163
|
+
`)}return r}},Zd=class{constructor(e,r){this.text=e,this.range=r}toString(){return this.text}toMarkdown(){return this.text}};function gC(t){return t.endsWith(`
|
|
164
164
|
`)?`
|
|
165
165
|
`:`
|
|
166
166
|
|
|
167
|
-
`}var ep=class{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){let r=this.commentProvider.getComment(e);if(r&&
|
|
167
|
+
`}var ep=class{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){let r=this.commentProvider.getComment(e);if(r&&TC(r))return yC(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=Y(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 tp=class{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var r;return uC(e)?e.$comment:(r=yS(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||r===void 0?void 0:r.text}};function nc(t){return{documentation:{CommentProvider:e=>new tp(e),DocumentationProvider:e=>new ep(e)},parser:{GrammarConfig:e=>MA(e),LangiumParser:e=>sC(e),CompletionParser:e=>oC(e),ValueConverter:()=>new qd,TokenBuilder:()=>new Ud,Lexer:e=>new Jd(e),ParserErrorMessageProvider:()=>new Nc},lsp:{CompletionProvider:e=>new hs(e),DocumentSymbolProvider:e=>new Zl(e),HoverProvider:e=>new tf(e),FoldingRangeProvider:e=>new ys(e),ReferencesProvider:e=>new cf(e),DefinitionProvider:e=>new vs(e),DocumentHighlightProvider:e=>new Ql(e),RenameProvider:e=>new uf(e)},workspace:{AstNodeLocator:()=>new Kd,AstNodeDescriptionProvider:e=>new Wd(e),ReferenceDescriptionProvider:e=>new Bd(e)},references:{Linker:e=>new jd(e),NameProvider:()=>new ts,ScopeProvider:e=>new ps(e),ScopeComputation:e=>new ds(e),References:e=>new Ts(e)},serializer:{JsonSerializer:e=>new Gd(e)},validation:{DocumentValidator:e=>new Ll(e),ValidationRegistry:e=>new _l(e)},shared:()=>t.shared}}function ic(t){return{ServiceRegistry:()=>new Hd,lsp:{Connection:()=>t.connection,LanguageServer:e=>new of(e),WorkspaceSymbolProvider:e=>new lf(e),NodeKindProvider:()=>new sf,FuzzyMatcher:()=>new ef},workspace:{LangiumDocuments:e=>new nf(e),LangiumDocumentFactory:e=>new rf(e),DocumentBuilder:e=>new Vd(e),TextDocuments:()=>new bC.TextDocuments(Ho),IndexManager:e=>new Xd(e),WorkspaceManager:e=>new Yd(e),FileSystemProvider:e=>t.fileSystemProvider(e),MutexLock:()=>new El,ConfigurationProvider:e=>new zd(e)}}}var AC;(function(t){function e(r){return{dispose:async()=>await r()}}t.create=e})(AC||(AC={}));var Li=se(kC(),1);var zj="Command";var Vj="Event";var Xj="State";var Oc=class extends Bi{getAllTypes(){return["Command","Event","State","Statemachine","Transition"]}computeIsSubtype(e,r){switch(e){default:return!1}}getReferenceType(e){let r=`${e.container.$type}:${e.property}`;switch(r){case"State:actions":return zj;case"Statemachine:init":case"Transition:state":return Xj;case"Transition:event":return Vj;default:throw new Error(`${r} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case"State":return{name:"State",mandatory:[{name:"actions",type:"array"},{name:"transitions",type:"array"}]};case"Statemachine":return{name:"Statemachine",mandatory:[{name:"commands",type:"array"},{name:"events",type:"array"},{name:"states",type:"array"}]};default:return{name:e,mandatory:[]}}}},due=new Oc;var rp,EC=()=>rp??(rp=kl(`{
|
|
168
168
|
"$type": "Grammar",
|
|
169
169
|
"isDeclared": true,
|
|
170
170
|
"name": "Statemachine",
|
|
@@ -488,7 +488,7 @@ ${r}`),this.inline?`{${i}}`:i}};function Hj(t,e,r){var n,i;if(t==="linkplain"||t
|
|
|
488
488
|
"interfaces": [],
|
|
489
489
|
"types": [],
|
|
490
490
|
"usedGrammars": []
|
|
491
|
-
}`));var
|
|
491
|
+
}`));var Yj={languageId:"statemachine",fileExtensions:[".statemachine"],caseInsensitive:!1},_C={AstReflection:()=>new Oc},CC={Grammar:()=>EC(),LanguageMetaData:()=>Yj,parser:{}};function NC(t){let e=t.validation.ValidationRegistry,r=t.validation.StatemachineValidator,n={State:r.checkStateNameStartsWithCapital,Statemachine:r.checkUniqueStatesAndEvents};e.register(n,r)}var np=class{checkStateNameStartsWithCapital(e,r){if(e.name){let n=e.name.substring(0,1);n.toUpperCase()!==n&&r("warning","State name should start with a capital letter.",{node:e,property:"name"})}}checkUniqueStatesAndEvents(e,r){let n=new ye,i=[...e.states,...e.events];for(let o of i)n.add(o.name,o);for(let[o,s]of n.entriesGroupedByKey())if(s.length>1)for(let a of s)r("error",`Duplicate identifier name: ${o}`,{node:a,property:"name"})}};var Jj={validation:{StatemachineValidator:()=>new np}};function PC(t){let e=Ki(ic(t),_C),r=Ki(nc({shared:e}),CC,Jj);return e.ServiceRegistry.register(r),NC(r),{shared:e,statemachine:r}}var Qj=new Li.BrowserMessageReader(self),Zj=new Li.BrowserMessageWriter(self),IC=(0,Li.createConnection)(Qj,Zj),{shared:DC,statemachine:eG}=PC(Object.assign({connection:IC},hf));bA(DC);var tG=new Li.NotificationType("browser/DocumentChange"),rG=eG.serializer.JsonSerializer;DC.workspace.DocumentBuilder.onBuildPhase(Ae.Validated,t=>{var e;for(let r of t){let n=rG.serialize(r.parseResult.value);IC.sendNotification(tG,{uri:r.uri.toString(),content:n,diagnostics:(e=r.diagnostics)!==null&&e!==void 0?e:[]})}});})();
|
|
492
492
|
/*! Bundled license information:
|
|
493
493
|
|
|
494
494
|
lodash-es/lodash.js:
|