devicetree-language-server 0.14.1 → 0.14.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.
package/dist/server.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var gj=Object.create;var wg=Object.defineProperty;var yj=Object.getOwnPropertyDescriptor;var Tj=Object.getOwnPropertyNames;var vj=Object.getPrototypeOf,bj=Object.prototype.hasOwnProperty;var R=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Sj=(t,e)=>{for(var r in e)wg(t,r,{get:e[r],enumerable:!0})},_j=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Tj(e))!bj.call(t,i)&&i!==r&&wg(t,i,{get:()=>e[i],enumerable:!(n=yj(e,i))||n.enumerable});return t};var q=(t,e,r)=>(r=t!=null?gj(vj(t)):{},_j(e||!t||!t.__esModule?wg(r,"default",{value:t,enumerable:!0}):r,t));var kd=R(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.thenable=Wt.typedArray=Wt.stringArray=Wt.array=Wt.func=Wt.error=Wt.number=Wt.string=Wt.boolean=void 0;function Pj(t){return t===!0||t===!1}Wt.boolean=Pj;function ok(t){return typeof t=="string"||t instanceof String}Wt.string=ok;function kj(t){return typeof t=="number"||t instanceof Number}Wt.number=kj;function Nj(t){return t instanceof Error}Wt.error=Nj;function ak(t){return typeof t=="function"}Wt.func=ak;function ck(t){return Array.isArray(t)}Wt.array=ck;function Rj(t){return ck(t)&&t.every(e=>ok(e))}Wt.stringArray=Rj;function Ej(t,e){return Array.isArray(t)&&t.every(e)}Wt.typedArray=Ej;function wj(t){return t&&ak(t.then)}Wt.thenable=wj});var Ko=R(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.stringArray=Pr.array=Pr.func=Pr.error=Pr.number=Pr.string=Pr.boolean=void 0;function Dj(t){return t===!0||t===!1}Pr.boolean=Dj;function lk(t){return typeof t=="string"||t instanceof String}Pr.string=lk;function Cj(t){return typeof t=="number"||t instanceof Number}Pr.number=Cj;function Aj(t){return t instanceof Error}Pr.error=Aj;function Ij(t){return typeof t=="function"}Pr.func=Ij;function uk(t){return Array.isArray(t)}Pr.array=uk;function Oj(t){return uk(t)&&t.every(e=>lk(e))}Pr.stringArray=Oj});var Zg=R(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.Message=ae.NotificationType9=ae.NotificationType8=ae.NotificationType7=ae.NotificationType6=ae.NotificationType5=ae.NotificationType4=ae.NotificationType3=ae.NotificationType2=ae.NotificationType1=ae.NotificationType0=ae.NotificationType=ae.RequestType9=ae.RequestType8=ae.RequestType7=ae.RequestType6=ae.RequestType5=ae.RequestType4=ae.RequestType3=ae.RequestType2=ae.RequestType1=ae.RequestType=ae.RequestType0=ae.AbstractMessageSignature=ae.ParameterStructures=ae.ResponseError=ae.ErrorCodes=void 0;var io=Ko(),Dg;(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})(Dg||(ae.ErrorCodes=Dg={}));var Cg=class t extends Error{constructor(e,r,n){super(r),this.code=io.number(e)?e:Dg.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}};ae.ResponseError=Cg;var zr=class t{constructor(e){this.kind=e}static is(e){return e===t.auto||e===t.byName||e===t.byPosition}toString(){return this.kind}};ae.ParameterStructures=zr;zr.auto=new zr("auto");zr.byPosition=new zr("byPosition");zr.byName=new zr("byName");var St=class{constructor(e,r){this.method=e,this.numberOfParams=r}get parameterStructures(){return zr.auto}};ae.AbstractMessageSignature=St;var Ag=class extends St{constructor(e){super(e,0)}};ae.RequestType0=Ag;var Ig=class extends St{constructor(e,r=zr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ae.RequestType=Ig;var Og=class extends St{constructor(e,r=zr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ae.RequestType1=Og;var xg=class extends St{constructor(e){super(e,2)}};ae.RequestType2=xg;var Mg=class extends St{constructor(e){super(e,3)}};ae.RequestType3=Mg;var Lg=class extends St{constructor(e){super(e,4)}};ae.RequestType4=Lg;var qg=class extends St{constructor(e){super(e,5)}};ae.RequestType5=qg;var $g=class extends St{constructor(e){super(e,6)}};ae.RequestType6=$g;var Fg=class extends St{constructor(e){super(e,7)}};ae.RequestType7=Fg;var Bg=class extends St{constructor(e){super(e,8)}};ae.RequestType8=Bg;var jg=class extends St{constructor(e){super(e,9)}};ae.RequestType9=jg;var Ug=class extends St{constructor(e,r=zr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ae.NotificationType=Ug;var Hg=class extends St{constructor(e){super(e,0)}};ae.NotificationType0=Hg;var Vg=class extends St{constructor(e,r=zr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ae.NotificationType1=Vg;var Wg=class extends St{constructor(e){super(e,2)}};ae.NotificationType2=Wg;var zg=class extends St{constructor(e){super(e,3)}};ae.NotificationType3=zg;var Gg=class extends St{constructor(e){super(e,4)}};ae.NotificationType4=Gg;var Yg=class extends St{constructor(e){super(e,5)}};ae.NotificationType5=Yg;var Kg=class extends St{constructor(e){super(e,6)}};ae.NotificationType6=Kg;var Xg=class extends St{constructor(e){super(e,7)}};ae.NotificationType7=Xg;var Jg=class extends St{constructor(e){super(e,8)}};ae.NotificationType8=Jg;var Qg=class extends St{constructor(e){super(e,9)}};ae.NotificationType9=Qg;var dk;(function(t){function e(i){let s=i;return s&&io.string(s.method)&&(io.string(s.id)||io.number(s.id))}t.isRequest=e;function r(i){let s=i;return s&&io.string(s.method)&&i.id===void 0}t.isNotification=r;function n(i){let s=i;return s&&(s.result!==void 0||!!s.error)&&(io.string(s.id)||io.number(s.id)||s.id===null)}t.isResponse=n})(dk||(ae.Message=dk={}))});var ty=R(ls=>{"use strict";var fk;Object.defineProperty(ls,"__esModule",{value:!0});ls.LRUCache=ls.LinkedMap=ls.Touch=void 0;var kr;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(kr||(ls.Touch=kr={}));var Nd=class{constructor(){this[fk]="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=kr.None){let n=this._map.get(e);if(n)return r!==kr.None&&this.touch(n,r),n.value}set(e,r,n=kr.None){let i=this._map.get(e);if(i)i.value=r,n!==kr.None&&this.touch(i,n);else{switch(i={key:e,value:r,next:void 0,previous:void 0},n){case kr.None:this.addItemLast(i);break;case kr.First:this.addItemFirst(i);break;case kr.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}[(fk=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!==kr.First&&r!==kr.Last)){if(r===kr.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===kr.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)}};ls.LinkedMap=Nd;var ey=class extends Nd{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=kr.AsNew){return super.get(e,r)}peek(e){return super.get(e,kr.None)}set(e,r){return super.set(e,r,kr.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};ls.LRUCache=ey});var hk=R(Rd=>{"use strict";Object.defineProperty(Rd,"__esModule",{value:!0});Rd.Disposable=void 0;var pk;(function(t){function e(r){return{dispose:r}}t.create=e})(pk||(Rd.Disposable=pk={}))});var us=R(iy=>{"use strict";Object.defineProperty(iy,"__esModule",{value:!0});var ry;function ny(){if(ry===void 0)throw new Error("No runtime abstraction layer installed");return ry}(function(t){function e(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");ry=r}t.install=e})(ny||(ny={}));iy.default=ny});var Jo=R(Xo=>{"use strict";Object.defineProperty(Xo,"__esModule",{value:!0});Xo.Emitter=Xo.Event=void 0;var xj=us(),mk;(function(t){let e={dispose(){}};t.None=function(){return e}})(mk||(Xo.Event=mk={}));var sy=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,s=this._callbacks.length;i<s;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 s=0,o=n.length;s<o;s++)try{r.push(n[s].apply(i[s],e))}catch(a){(0,xj.default)().console.error(a)}return r}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},Ed=class t{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,r,n)=>{this._callbacks||(this._callbacks=new sy),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)}};Xo.Emitter=Ed;Ed._noop=function(){}});var Cd=R(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.CancellationTokenSource=Qo.CancellationToken=void 0;var Mj=us(),Lj=Ko(),oy=Jo(),wd;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:oy.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:oy.Event.None});function e(r){let n=r;return n&&(n===t.None||n===t.Cancelled||Lj.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}t.is=e})(wd||(Qo.CancellationToken=wd={}));var qj=Object.freeze(function(t,e){let r=(0,Mj.default)().timer.setTimeout(t.bind(e),0);return{dispose(){r.dispose()}}}),Dd=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?qj:(this._emitter||(this._emitter=new oy.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},ay=class{get token(){return this._token||(this._token=new Dd),this._token}cancel(){this._token?this._token.cancel():this._token=wd.Cancelled}dispose(){this._token?this._token instanceof Dd&&this._token.dispose():this._token=wd.None}};Qo.CancellationTokenSource=ay});var gk=R(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.SharedArrayReceiverStrategy=Zo.SharedArraySenderStrategy=void 0;var $j=Cd(),Cc;(function(t){t.Continue=0,t.Cancelled=1})(Cc||(Cc={}));var cy=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]=Cc.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,Cc.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};Zo.SharedArraySenderStrategy=cy;var ly=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Cc.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},uy=class{constructor(e){this.token=new ly(e)}cancel(){}dispose(){}},dy=class{constructor(){this.kind="request"}createCancellationTokenSource(e){let r=e.$cancellationData;return r===void 0?new $j.CancellationTokenSource:new uy(r)}};Zo.SharedArrayReceiverStrategy=dy});var py=R(Ad=>{"use strict";Object.defineProperty(Ad,"__esModule",{value:!0});Ad.Semaphore=void 0;var Fj=us(),fy=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,Fj.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()}}};Ad.Semaphore=fy});var Tk=R(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.ReadableStreamMessageReader=ds.AbstractMessageReader=ds.MessageReader=void 0;var my=us(),ea=Ko(),hy=Jo(),Bj=py(),yk;(function(t){function e(r){let n=r;return n&&ea.func(n.listen)&&ea.func(n.dispose)&&ea.func(n.onError)&&ea.func(n.onClose)&&ea.func(n.onPartialMessage)}t.is=e})(yk||(ds.MessageReader=yk={}));var Id=class{constructor(){this.errorEmitter=new hy.Emitter,this.closeEmitter=new hy.Emitter,this.partialMessageEmitter=new hy.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: ${ea.string(e.message)?e.message:"unknown"}`)}};ds.AbstractMessageReader=Id;var gy;(function(t){function e(r){let n,i,s,o=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&&(s=r.contentDecoder,o.set(s.name,s)),r.contentDecoders!==void 0)for(let l of r.contentDecoders)o.set(l.name,l);if(r.contentTypeDecoder!==void 0&&(a=r.contentTypeDecoder,c.set(a.name,a)),r.contentTypeDecoders!==void 0)for(let l of r.contentTypeDecoders)c.set(l.name,l)}return a===void 0&&(a=(0,my.default)().applicationJson.decoder,c.set(a.name,a)),{charset:n,contentDecoder:s,contentDecoders:o,contentTypeDecoder:a,contentTypeDecoders:c}}t.fromOptions=e})(gy||(gy={}));var yy=class extends Id{constructor(e,r){super(),this.readable=e,this.options=gy.fromOptions(r),this.buffer=(0,my.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new Bj.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.
3
- ${JSON.stringify(Object.fromEntries(n))}`));return}let s=parseInt(i);if(isNaN(s)){this.fireError(new Error(`Content-Length value must be a number. Got ${i}`));return}this.nextMessageLength=s}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,my.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))}};ds.ReadableStreamMessageReader=yy});var Pk=R(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.WriteableStreamMessageWriter=fs.AbstractMessageWriter=fs.MessageWriter=void 0;var vk=us(),Ac=Ko(),jj=py(),bk=Jo(),Uj="Content-Length: ",Sk=`\r
4
- `,_k;(function(t){function e(r){let n=r;return n&&Ac.func(n.dispose)&&Ac.func(n.onClose)&&Ac.func(n.onError)&&Ac.func(n.write)}t.is=e})(_k||(fs.MessageWriter=_k={}));var Od=class{constructor(){this.errorEmitter=new bk.Emitter,this.closeEmitter=new bk.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: ${Ac.string(e.message)?e.message:"unknown"}`)}};fs.AbstractMessageWriter=Od;var Ty;(function(t){function e(r){return r===void 0||typeof r=="string"?{charset:r??"utf-8",contentTypeEncoder:(0,vk.default)().applicationJson.encoder}:{charset:r.charset??"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:r.contentTypeEncoder??(0,vk.default)().applicationJson.encoder}}t.fromOptions=e})(Ty||(Ty={}));var vy=class extends Od{constructor(e,r){super(),this.writable=e,this.options=Ty.fromOptions(r),this.errorCount=0,this.writeSemaphore=new jj.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(Uj,n.byteLength.toString(),Sk),i.push(Sk),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()}};fs.WriteableStreamMessageWriter=vy});var kk=R(xd=>{"use strict";Object.defineProperty(xd,"__esModule",{value:!0});xd.AbstractMessageBuffer=void 0;var Hj=13,Vj=10,Wj=`\r
2
+ "use strict";var gj=Object.create;var wg=Object.defineProperty;var yj=Object.getOwnPropertyDescriptor;var Tj=Object.getOwnPropertyNames;var vj=Object.getPrototypeOf,bj=Object.prototype.hasOwnProperty;var R=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Sj=(t,e)=>{for(var r in e)wg(t,r,{get:e[r],enumerable:!0})},_j=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Tj(e))!bj.call(t,i)&&i!==r&&wg(t,i,{get:()=>e[i],enumerable:!(n=yj(e,i))||n.enumerable});return t};var q=(t,e,r)=>(r=t!=null?gj(vj(t)):{},_j(e||!t||!t.__esModule?wg(r,"default",{value:t,enumerable:!0}):r,t));var kd=R(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.thenable=Wt.typedArray=Wt.stringArray=Wt.array=Wt.func=Wt.error=Wt.number=Wt.string=Wt.boolean=void 0;function Pj(t){return t===!0||t===!1}Wt.boolean=Pj;function ok(t){return typeof t=="string"||t instanceof String}Wt.string=ok;function kj(t){return typeof t=="number"||t instanceof Number}Wt.number=kj;function Nj(t){return t instanceof Error}Wt.error=Nj;function ak(t){return typeof t=="function"}Wt.func=ak;function ck(t){return Array.isArray(t)}Wt.array=ck;function Rj(t){return ck(t)&&t.every(e=>ok(e))}Wt.stringArray=Rj;function Ej(t,e){return Array.isArray(t)&&t.every(e)}Wt.typedArray=Ej;function wj(t){return t&&ak(t.then)}Wt.thenable=wj});var Ko=R(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.stringArray=Pr.array=Pr.func=Pr.error=Pr.number=Pr.string=Pr.boolean=void 0;function Dj(t){return t===!0||t===!1}Pr.boolean=Dj;function lk(t){return typeof t=="string"||t instanceof String}Pr.string=lk;function Cj(t){return typeof t=="number"||t instanceof Number}Pr.number=Cj;function Aj(t){return t instanceof Error}Pr.error=Aj;function Ij(t){return typeof t=="function"}Pr.func=Ij;function uk(t){return Array.isArray(t)}Pr.array=uk;function Oj(t){return uk(t)&&t.every(e=>lk(e))}Pr.stringArray=Oj});var Zg=R(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.Message=ae.NotificationType9=ae.NotificationType8=ae.NotificationType7=ae.NotificationType6=ae.NotificationType5=ae.NotificationType4=ae.NotificationType3=ae.NotificationType2=ae.NotificationType1=ae.NotificationType0=ae.NotificationType=ae.RequestType9=ae.RequestType8=ae.RequestType7=ae.RequestType6=ae.RequestType5=ae.RequestType4=ae.RequestType3=ae.RequestType2=ae.RequestType1=ae.RequestType=ae.RequestType0=ae.AbstractMessageSignature=ae.ParameterStructures=ae.ResponseError=ae.ErrorCodes=void 0;var io=Ko(),Dg;(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})(Dg||(ae.ErrorCodes=Dg={}));var Cg=class t extends Error{constructor(e,r,n){super(r),this.code=io.number(e)?e:Dg.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}};ae.ResponseError=Cg;var zr=class t{constructor(e){this.kind=e}static is(e){return e===t.auto||e===t.byName||e===t.byPosition}toString(){return this.kind}};ae.ParameterStructures=zr;zr.auto=new zr("auto");zr.byPosition=new zr("byPosition");zr.byName=new zr("byName");var St=class{constructor(e,r){this.method=e,this.numberOfParams=r}get parameterStructures(){return zr.auto}};ae.AbstractMessageSignature=St;var Ag=class extends St{constructor(e){super(e,0)}};ae.RequestType0=Ag;var Ig=class extends St{constructor(e,r=zr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ae.RequestType=Ig;var Og=class extends St{constructor(e,r=zr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ae.RequestType1=Og;var xg=class extends St{constructor(e){super(e,2)}};ae.RequestType2=xg;var Mg=class extends St{constructor(e){super(e,3)}};ae.RequestType3=Mg;var Lg=class extends St{constructor(e){super(e,4)}};ae.RequestType4=Lg;var qg=class extends St{constructor(e){super(e,5)}};ae.RequestType5=qg;var $g=class extends St{constructor(e){super(e,6)}};ae.RequestType6=$g;var Fg=class extends St{constructor(e){super(e,7)}};ae.RequestType7=Fg;var Bg=class extends St{constructor(e){super(e,8)}};ae.RequestType8=Bg;var jg=class extends St{constructor(e){super(e,9)}};ae.RequestType9=jg;var Ug=class extends St{constructor(e,r=zr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ae.NotificationType=Ug;var Hg=class extends St{constructor(e){super(e,0)}};ae.NotificationType0=Hg;var Vg=class extends St{constructor(e,r=zr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ae.NotificationType1=Vg;var Wg=class extends St{constructor(e){super(e,2)}};ae.NotificationType2=Wg;var zg=class extends St{constructor(e){super(e,3)}};ae.NotificationType3=zg;var Gg=class extends St{constructor(e){super(e,4)}};ae.NotificationType4=Gg;var Yg=class extends St{constructor(e){super(e,5)}};ae.NotificationType5=Yg;var Kg=class extends St{constructor(e){super(e,6)}};ae.NotificationType6=Kg;var Xg=class extends St{constructor(e){super(e,7)}};ae.NotificationType7=Xg;var Jg=class extends St{constructor(e){super(e,8)}};ae.NotificationType8=Jg;var Qg=class extends St{constructor(e){super(e,9)}};ae.NotificationType9=Qg;var dk;(function(t){function e(i){let s=i;return s&&io.string(s.method)&&(io.string(s.id)||io.number(s.id))}t.isRequest=e;function r(i){let s=i;return s&&io.string(s.method)&&i.id===void 0}t.isNotification=r;function n(i){let s=i;return s&&(s.result!==void 0||!!s.error)&&(io.string(s.id)||io.number(s.id)||s.id===null)}t.isResponse=n})(dk||(ae.Message=dk={}))});var ty=R(us=>{"use strict";var fk;Object.defineProperty(us,"__esModule",{value:!0});us.LRUCache=us.LinkedMap=us.Touch=void 0;var kr;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(kr||(us.Touch=kr={}));var Nd=class{constructor(){this[fk]="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=kr.None){let n=this._map.get(e);if(n)return r!==kr.None&&this.touch(n,r),n.value}set(e,r,n=kr.None){let i=this._map.get(e);if(i)i.value=r,n!==kr.None&&this.touch(i,n);else{switch(i={key:e,value:r,next:void 0,previous:void 0},n){case kr.None:this.addItemLast(i);break;case kr.First:this.addItemFirst(i);break;case kr.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}[(fk=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!==kr.First&&r!==kr.Last)){if(r===kr.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===kr.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)}};us.LinkedMap=Nd;var ey=class extends Nd{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=kr.AsNew){return super.get(e,r)}peek(e){return super.get(e,kr.None)}set(e,r){return super.set(e,r,kr.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};us.LRUCache=ey});var hk=R(Rd=>{"use strict";Object.defineProperty(Rd,"__esModule",{value:!0});Rd.Disposable=void 0;var pk;(function(t){function e(r){return{dispose:r}}t.create=e})(pk||(Rd.Disposable=pk={}))});var ds=R(iy=>{"use strict";Object.defineProperty(iy,"__esModule",{value:!0});var ry;function ny(){if(ry===void 0)throw new Error("No runtime abstraction layer installed");return ry}(function(t){function e(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");ry=r}t.install=e})(ny||(ny={}));iy.default=ny});var Jo=R(Xo=>{"use strict";Object.defineProperty(Xo,"__esModule",{value:!0});Xo.Emitter=Xo.Event=void 0;var xj=ds(),mk;(function(t){let e={dispose(){}};t.None=function(){return e}})(mk||(Xo.Event=mk={}));var sy=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,s=this._callbacks.length;i<s;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 s=0,o=n.length;s<o;s++)try{r.push(n[s].apply(i[s],e))}catch(a){(0,xj.default)().console.error(a)}return r}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},Ed=class t{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,r,n)=>{this._callbacks||(this._callbacks=new sy),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)}};Xo.Emitter=Ed;Ed._noop=function(){}});var Cd=R(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.CancellationTokenSource=Qo.CancellationToken=void 0;var Mj=ds(),Lj=Ko(),oy=Jo(),wd;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:oy.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:oy.Event.None});function e(r){let n=r;return n&&(n===t.None||n===t.Cancelled||Lj.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}t.is=e})(wd||(Qo.CancellationToken=wd={}));var qj=Object.freeze(function(t,e){let r=(0,Mj.default)().timer.setTimeout(t.bind(e),0);return{dispose(){r.dispose()}}}),Dd=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?qj:(this._emitter||(this._emitter=new oy.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},ay=class{get token(){return this._token||(this._token=new Dd),this._token}cancel(){this._token?this._token.cancel():this._token=wd.Cancelled}dispose(){this._token?this._token instanceof Dd&&this._token.dispose():this._token=wd.None}};Qo.CancellationTokenSource=ay});var gk=R(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.SharedArrayReceiverStrategy=Zo.SharedArraySenderStrategy=void 0;var $j=Cd(),Cc;(function(t){t.Continue=0,t.Cancelled=1})(Cc||(Cc={}));var cy=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]=Cc.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,Cc.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};Zo.SharedArraySenderStrategy=cy;var ly=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Cc.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},uy=class{constructor(e){this.token=new ly(e)}cancel(){}dispose(){}},dy=class{constructor(){this.kind="request"}createCancellationTokenSource(e){let r=e.$cancellationData;return r===void 0?new $j.CancellationTokenSource:new uy(r)}};Zo.SharedArrayReceiverStrategy=dy});var py=R(Ad=>{"use strict";Object.defineProperty(Ad,"__esModule",{value:!0});Ad.Semaphore=void 0;var Fj=ds(),fy=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,Fj.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()}}};Ad.Semaphore=fy});var Tk=R(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.ReadableStreamMessageReader=fs.AbstractMessageReader=fs.MessageReader=void 0;var my=ds(),ea=Ko(),hy=Jo(),Bj=py(),yk;(function(t){function e(r){let n=r;return n&&ea.func(n.listen)&&ea.func(n.dispose)&&ea.func(n.onError)&&ea.func(n.onClose)&&ea.func(n.onPartialMessage)}t.is=e})(yk||(fs.MessageReader=yk={}));var Id=class{constructor(){this.errorEmitter=new hy.Emitter,this.closeEmitter=new hy.Emitter,this.partialMessageEmitter=new hy.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: ${ea.string(e.message)?e.message:"unknown"}`)}};fs.AbstractMessageReader=Id;var gy;(function(t){function e(r){let n,i,s,o=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&&(s=r.contentDecoder,o.set(s.name,s)),r.contentDecoders!==void 0)for(let l of r.contentDecoders)o.set(l.name,l);if(r.contentTypeDecoder!==void 0&&(a=r.contentTypeDecoder,c.set(a.name,a)),r.contentTypeDecoders!==void 0)for(let l of r.contentTypeDecoders)c.set(l.name,l)}return a===void 0&&(a=(0,my.default)().applicationJson.decoder,c.set(a.name,a)),{charset:n,contentDecoder:s,contentDecoders:o,contentTypeDecoder:a,contentTypeDecoders:c}}t.fromOptions=e})(gy||(gy={}));var yy=class extends Id{constructor(e,r){super(),this.readable=e,this.options=gy.fromOptions(r),this.buffer=(0,my.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new Bj.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.
3
+ ${JSON.stringify(Object.fromEntries(n))}`));return}let s=parseInt(i);if(isNaN(s)){this.fireError(new Error(`Content-Length value must be a number. Got ${i}`));return}this.nextMessageLength=s}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,my.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))}};fs.ReadableStreamMessageReader=yy});var Pk=R(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.WriteableStreamMessageWriter=ps.AbstractMessageWriter=ps.MessageWriter=void 0;var vk=ds(),Ac=Ko(),jj=py(),bk=Jo(),Uj="Content-Length: ",Sk=`\r
4
+ `,_k;(function(t){function e(r){let n=r;return n&&Ac.func(n.dispose)&&Ac.func(n.onClose)&&Ac.func(n.onError)&&Ac.func(n.write)}t.is=e})(_k||(ps.MessageWriter=_k={}));var Od=class{constructor(){this.errorEmitter=new bk.Emitter,this.closeEmitter=new bk.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: ${Ac.string(e.message)?e.message:"unknown"}`)}};ps.AbstractMessageWriter=Od;var Ty;(function(t){function e(r){return r===void 0||typeof r=="string"?{charset:r??"utf-8",contentTypeEncoder:(0,vk.default)().applicationJson.encoder}:{charset:r.charset??"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:r.contentTypeEncoder??(0,vk.default)().applicationJson.encoder}}t.fromOptions=e})(Ty||(Ty={}));var vy=class extends Od{constructor(e,r){super(),this.writable=e,this.options=Ty.fromOptions(r),this.errorCount=0,this.writeSemaphore=new jj.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(Uj,n.byteLength.toString(),Sk),i.push(Sk),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()}};ps.WriteableStreamMessageWriter=vy});var kk=R(xd=>{"use strict";Object.defineProperty(xd,"__esModule",{value:!0});xd.AbstractMessageBuffer=void 0;var Hj=13,Vj=10,Wj=`\r
5
5
  `,by=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,s=0;e:for(;n<this._chunks.length;){let l=this._chunks[n];for(i=0;i<l.length;){switch(l[i]){case Hj:switch(r){case 0:r=1;break;case 2:r=3;break;default:r=0}break;case Vj:switch(r){case 1:r=2;break;case 3:r=4,i++;break e;default:r=0}break;default:r=0}i++}s+=l.byteLength,n++}if(r!==4)return;let o=this._read(s+i),a=new Map,c=this.toString(o,"ascii").split(Wj);if(c.length<2)return a;for(let l=0;l<c.length-2;l++){let u=c[l],d=u.indexOf(":");if(d===-1)throw new Error(`Message header must separate key and value using ':'
6
- ${u}`);let f=u.substr(0,d),p=u.substr(d+1).trim();a.set(e?f.toLowerCase():f,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 s=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(s)}if(this._chunks[0].byteLength>e){let s=this._chunks[0],o=this.asNative(s,e);return this._chunks[0]=s.slice(e),this._totalLength-=e,o}let r=this.allocNative(e),n=0,i=0;for(;e>0;){let s=this._chunks[i];if(s.byteLength>e){let o=s.slice(0,e);r.set(o,n),n+=e,this._chunks[i]=s.slice(e),this._totalLength-=e,e-=e}else r.set(s,n),n+=s.byteLength,this._chunks.shift(),this._totalLength-=s.byteLength,e-=s.byteLength}return r}};xd.AbstractMessageBuffer=by});var Dk=R(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.createMessageConnection=Se.ConnectionOptions=Se.MessageStrategy=Se.CancellationStrategy=Se.CancellationSenderStrategy=Se.CancellationReceiverStrategy=Se.RequestCancellationReceiverStrategy=Se.IdCancellationReceiverStrategy=Se.ConnectionStrategy=Se.ConnectionError=Se.ConnectionErrors=Se.LogTraceNotification=Se.SetTraceNotification=Se.TraceFormat=Se.TraceValues=Se.Trace=Se.NullLogger=Se.ProgressType=Se.ProgressToken=void 0;var Nk=us(),Ct=Ko(),he=Zg(),Rk=ty(),Ic=Jo(),Sy=Cd(),Mc;(function(t){t.type=new he.NotificationType("$/cancelRequest")})(Mc||(Mc={}));var _y;(function(t){function e(r){return typeof r=="string"||typeof r=="number"}t.is=e})(_y||(Se.ProgressToken=_y={}));var Oc;(function(t){t.type=new he.NotificationType("$/progress")})(Oc||(Oc={}));var Py=class{constructor(){}};Se.ProgressType=Py;var ky;(function(t){function e(r){return Ct.func(r)}t.is=e})(ky||(ky={}));Se.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var Je;(function(t){t[t.Off=0]="Off",t[t.Messages=1]="Messages",t[t.Compact=2]="Compact",t[t.Verbose=3]="Verbose"})(Je||(Se.Trace=Je={}));var Ek;(function(t){t.Off="off",t.Messages="messages",t.Compact="compact",t.Verbose="verbose"})(Ek||(Se.TraceValues=Ek={}));(function(t){function e(n){if(!Ct.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})(Je||(Se.Trace=Je={}));var gn;(function(t){t.Text="text",t.JSON="json"})(gn||(Se.TraceFormat=gn={}));(function(t){function e(r){return Ct.string(r)?(r=r.toLowerCase(),r==="json"?t.JSON:t.Text):t.Text}t.fromString=e})(gn||(Se.TraceFormat=gn={}));var Ny;(function(t){t.type=new he.NotificationType("$/setTrace")})(Ny||(Se.SetTraceNotification=Ny={}));var Md;(function(t){t.type=new he.NotificationType("$/logTrace")})(Md||(Se.LogTraceNotification=Md={}));var xc;(function(t){t[t.Closed=1]="Closed",t[t.Disposed=2]="Disposed",t[t.AlreadyListening=3]="AlreadyListening"})(xc||(Se.ConnectionErrors=xc={}));var ta=class t extends Error{constructor(e,r){super(r),this.code=e,Object.setPrototypeOf(this,t.prototype)}};Se.ConnectionError=ta;var Ry;(function(t){function e(r){let n=r;return n&&Ct.func(n.cancelUndispatched)}t.is=e})(Ry||(Se.ConnectionStrategy=Ry={}));var Ld;(function(t){function e(r){let n=r;return n&&(n.kind===void 0||n.kind==="id")&&Ct.func(n.createCancellationTokenSource)&&(n.dispose===void 0||Ct.func(n.dispose))}t.is=e})(Ld||(Se.IdCancellationReceiverStrategy=Ld={}));var Ey;(function(t){function e(r){let n=r;return n&&n.kind==="request"&&Ct.func(n.createCancellationTokenSource)&&(n.dispose===void 0||Ct.func(n.dispose))}t.is=e})(Ey||(Se.RequestCancellationReceiverStrategy=Ey={}));var qd;(function(t){t.Message=Object.freeze({createCancellationTokenSource(r){return new Sy.CancellationTokenSource}});function e(r){return Ld.is(r)||Ey.is(r)}t.is=e})(qd||(Se.CancellationReceiverStrategy=qd={}));var $d;(function(t){t.Message=Object.freeze({sendCancellation(r,n){return r.sendNotification(Mc.type,{id:n})},cleanup(r){}});function e(r){let n=r;return n&&Ct.func(n.sendCancellation)&&Ct.func(n.cleanup)}t.is=e})($d||(Se.CancellationSenderStrategy=$d={}));var Fd;(function(t){t.Message=Object.freeze({receiver:qd.Message,sender:$d.Message});function e(r){let n=r;return n&&qd.is(n.receiver)&&$d.is(n.sender)}t.is=e})(Fd||(Se.CancellationStrategy=Fd={}));var Bd;(function(t){function e(r){let n=r;return n&&Ct.func(n.handleMessage)}t.is=e})(Bd||(Se.MessageStrategy=Bd={}));var wk;(function(t){function e(r){let n=r;return n&&(Fd.is(n.cancellationStrategy)||Ry.is(n.connectionStrategy)||Bd.is(n.messageStrategy))}t.is=e})(wk||(Se.ConnectionOptions=wk={}));var Xn;(function(t){t[t.New=1]="New",t[t.Listening=2]="Listening",t[t.Closed=3]="Closed",t[t.Disposed=4]="Disposed"})(Xn||(Xn={}));function zj(t,e,r,n){let i=r!==void 0?r:Se.NullLogger,s=0,o=0,a=0,c="2.0",l,u=new Map,d,f=new Map,p=new Map,m,h=new Rk.LinkedMap,y=new Map,S=new Set,v=new Map,b=Je.Off,P=gn.Text,N,$=Xn.New,j=new Ic.Emitter,L=new Ic.Emitter,ye=new Ic.Emitter,qe=new Ic.Emitter,pe=new Ic.Emitter,Pe=n&&n.cancellationStrategy?n.cancellationStrategy:Fd.Message;function ur(E){if(E===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+E.toString()}function _r(E){return E===null?"res-unknown-"+(++a).toString():"res-"+E.toString()}function cd(){return"not-"+(++o).toString()}function Eg(E,F){he.Message.isRequest(F)?E.set(ur(F.id),F):he.Message.isResponse(F)?E.set(_r(F.id),F):E.set(cd(),F)}function ld(E){}function kc(){return $===Xn.Listening}function to(){return $===Xn.Closed}function ji(){return $===Xn.Disposed}function Vo(){($===Xn.New||$===Xn.Listening)&&($=Xn.Closed,L.fire(void 0))}function ro(E){j.fire([E,void 0,void 0])}function ud(E){j.fire(E)}t.onClose(Vo),t.onError(ro),e.onClose(Vo),e.onError(ud);function Nc(){m||h.size===0||(m=(0,Nk.default)().timer.setImmediate(()=>{m=void 0,dd()}))}function Rc(E){he.Message.isRequest(E)?pd(E):he.Message.isNotification(E)?md(E):he.Message.isResponse(E)?hd(E):Wo(E)}function dd(){if(h.size===0)return;let E=h.shift();try{let F=n?.messageStrategy;Bd.is(F)?F.handleMessage(E,Rc):Rc(E)}finally{Nc()}}let fd=E=>{try{if(he.Message.isNotification(E)&&E.method===Mc.type.method){let F=E.params.id,G=ur(F),re=h.get(G);if(he.Message.isRequest(re)){let tt=n?.connectionStrategy,bt=tt&&tt.cancelUndispatched?tt.cancelUndispatched(re,ld):void 0;if(bt&&(bt.error!==void 0||bt.result!==void 0)){h.delete(G),v.delete(F),bt.id=re.id,no(bt,E.method,Date.now()),e.write(bt).catch(()=>i.error("Sending response for canceled message failed."));return}}let st=v.get(F);if(st!==void 0){st.cancel(),zo(E);return}else S.add(F)}Eg(h,E)}finally{Nc()}};function pd(E){if(ji())return;function F(Oe,lt,Ke){let Ot={jsonrpc:c,id:E.id};Oe instanceof he.ResponseError?Ot.error=Oe.toJson():Ot.result=Oe===void 0?null:Oe,no(Ot,lt,Ke),e.write(Ot).catch(()=>i.error("Sending response failed."))}function G(Oe,lt,Ke){let Ot={jsonrpc:c,id:E.id,error:Oe.toJson()};no(Ot,lt,Ke),e.write(Ot).catch(()=>i.error("Sending response failed."))}function re(Oe,lt,Ke){Oe===void 0&&(Oe=null);let Ot={jsonrpc:c,id:E.id,result:Oe};no(Ot,lt,Ke),e.write(Ot).catch(()=>i.error("Sending response failed."))}Td(E);let st=u.get(E.method),tt,bt;st&&(tt=st.type,bt=st.handler);let Nt=Date.now();if(bt||l){let Oe=E.id??String(Date.now()),lt=Ld.is(Pe.receiver)?Pe.receiver.createCancellationTokenSource(Oe):Pe.receiver.createCancellationTokenSource(E);E.id!==null&&S.has(E.id)&&lt.cancel(),E.id!==null&&v.set(Oe,lt);try{let Ke;if(bt)if(E.params===void 0){if(tt!==void 0&&tt.numberOfParams!==0){G(new he.ResponseError(he.ErrorCodes.InvalidParams,`Request ${E.method} defines ${tt.numberOfParams} params but received none.`),E.method,Nt);return}Ke=bt(lt.token)}else if(Array.isArray(E.params)){if(tt!==void 0&&tt.parameterStructures===he.ParameterStructures.byName){G(new he.ResponseError(he.ErrorCodes.InvalidParams,`Request ${E.method} defines parameters by name but received parameters by position`),E.method,Nt);return}Ke=bt(...E.params,lt.token)}else{if(tt!==void 0&&tt.parameterStructures===he.ParameterStructures.byPosition){G(new he.ResponseError(he.ErrorCodes.InvalidParams,`Request ${E.method} defines parameters by position but received parameters by name`),E.method,Nt);return}Ke=bt(E.params,lt.token)}else l&&(Ke=l(E.method,E.params,lt.token));let Ot=Ke;Ke?Ot.then?Ot.then(tr=>{v.delete(Oe),F(tr,E.method,Nt)},tr=>{v.delete(Oe),tr instanceof he.ResponseError?G(tr,E.method,Nt):tr&&Ct.string(tr.message)?G(new he.ResponseError(he.ErrorCodes.InternalError,`Request ${E.method} failed with message: ${tr.message}`),E.method,Nt):G(new he.ResponseError(he.ErrorCodes.InternalError,`Request ${E.method} failed unexpectedly without providing any details.`),E.method,Nt)}):(v.delete(Oe),F(Ke,E.method,Nt)):(v.delete(Oe),re(Ke,E.method,Nt))}catch(Ke){v.delete(Oe),Ke instanceof he.ResponseError?F(Ke,E.method,Nt):Ke&&Ct.string(Ke.message)?G(new he.ResponseError(he.ErrorCodes.InternalError,`Request ${E.method} failed with message: ${Ke.message}`),E.method,Nt):G(new he.ResponseError(he.ErrorCodes.InternalError,`Request ${E.method} failed unexpectedly without providing any details.`),E.method,Nt)}}else G(new he.ResponseError(he.ErrorCodes.MethodNotFound,`Unhandled method ${E.method}`),E.method,Nt)}function hd(E){if(!ji())if(E.id===null)E.error?i.error(`Received response message without id: Error is:
6
+ ${u}`);let f=u.substr(0,d),p=u.substr(d+1).trim();a.set(e?f.toLowerCase():f,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 s=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(s)}if(this._chunks[0].byteLength>e){let s=this._chunks[0],o=this.asNative(s,e);return this._chunks[0]=s.slice(e),this._totalLength-=e,o}let r=this.allocNative(e),n=0,i=0;for(;e>0;){let s=this._chunks[i];if(s.byteLength>e){let o=s.slice(0,e);r.set(o,n),n+=e,this._chunks[i]=s.slice(e),this._totalLength-=e,e-=e}else r.set(s,n),n+=s.byteLength,this._chunks.shift(),this._totalLength-=s.byteLength,e-=s.byteLength}return r}};xd.AbstractMessageBuffer=by});var Dk=R(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.createMessageConnection=Se.ConnectionOptions=Se.MessageStrategy=Se.CancellationStrategy=Se.CancellationSenderStrategy=Se.CancellationReceiverStrategy=Se.RequestCancellationReceiverStrategy=Se.IdCancellationReceiverStrategy=Se.ConnectionStrategy=Se.ConnectionError=Se.ConnectionErrors=Se.LogTraceNotification=Se.SetTraceNotification=Se.TraceFormat=Se.TraceValues=Se.Trace=Se.NullLogger=Se.ProgressType=Se.ProgressToken=void 0;var Nk=ds(),Ct=Ko(),he=Zg(),Rk=ty(),Ic=Jo(),Sy=Cd(),Mc;(function(t){t.type=new he.NotificationType("$/cancelRequest")})(Mc||(Mc={}));var _y;(function(t){function e(r){return typeof r=="string"||typeof r=="number"}t.is=e})(_y||(Se.ProgressToken=_y={}));var Oc;(function(t){t.type=new he.NotificationType("$/progress")})(Oc||(Oc={}));var Py=class{constructor(){}};Se.ProgressType=Py;var ky;(function(t){function e(r){return Ct.func(r)}t.is=e})(ky||(ky={}));Se.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var Je;(function(t){t[t.Off=0]="Off",t[t.Messages=1]="Messages",t[t.Compact=2]="Compact",t[t.Verbose=3]="Verbose"})(Je||(Se.Trace=Je={}));var Ek;(function(t){t.Off="off",t.Messages="messages",t.Compact="compact",t.Verbose="verbose"})(Ek||(Se.TraceValues=Ek={}));(function(t){function e(n){if(!Ct.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})(Je||(Se.Trace=Je={}));var gn;(function(t){t.Text="text",t.JSON="json"})(gn||(Se.TraceFormat=gn={}));(function(t){function e(r){return Ct.string(r)?(r=r.toLowerCase(),r==="json"?t.JSON:t.Text):t.Text}t.fromString=e})(gn||(Se.TraceFormat=gn={}));var Ny;(function(t){t.type=new he.NotificationType("$/setTrace")})(Ny||(Se.SetTraceNotification=Ny={}));var Md;(function(t){t.type=new he.NotificationType("$/logTrace")})(Md||(Se.LogTraceNotification=Md={}));var xc;(function(t){t[t.Closed=1]="Closed",t[t.Disposed=2]="Disposed",t[t.AlreadyListening=3]="AlreadyListening"})(xc||(Se.ConnectionErrors=xc={}));var ta=class t extends Error{constructor(e,r){super(r),this.code=e,Object.setPrototypeOf(this,t.prototype)}};Se.ConnectionError=ta;var Ry;(function(t){function e(r){let n=r;return n&&Ct.func(n.cancelUndispatched)}t.is=e})(Ry||(Se.ConnectionStrategy=Ry={}));var Ld;(function(t){function e(r){let n=r;return n&&(n.kind===void 0||n.kind==="id")&&Ct.func(n.createCancellationTokenSource)&&(n.dispose===void 0||Ct.func(n.dispose))}t.is=e})(Ld||(Se.IdCancellationReceiverStrategy=Ld={}));var Ey;(function(t){function e(r){let n=r;return n&&n.kind==="request"&&Ct.func(n.createCancellationTokenSource)&&(n.dispose===void 0||Ct.func(n.dispose))}t.is=e})(Ey||(Se.RequestCancellationReceiverStrategy=Ey={}));var qd;(function(t){t.Message=Object.freeze({createCancellationTokenSource(r){return new Sy.CancellationTokenSource}});function e(r){return Ld.is(r)||Ey.is(r)}t.is=e})(qd||(Se.CancellationReceiverStrategy=qd={}));var $d;(function(t){t.Message=Object.freeze({sendCancellation(r,n){return r.sendNotification(Mc.type,{id:n})},cleanup(r){}});function e(r){let n=r;return n&&Ct.func(n.sendCancellation)&&Ct.func(n.cleanup)}t.is=e})($d||(Se.CancellationSenderStrategy=$d={}));var Fd;(function(t){t.Message=Object.freeze({receiver:qd.Message,sender:$d.Message});function e(r){let n=r;return n&&qd.is(n.receiver)&&$d.is(n.sender)}t.is=e})(Fd||(Se.CancellationStrategy=Fd={}));var Bd;(function(t){function e(r){let n=r;return n&&Ct.func(n.handleMessage)}t.is=e})(Bd||(Se.MessageStrategy=Bd={}));var wk;(function(t){function e(r){let n=r;return n&&(Fd.is(n.cancellationStrategy)||Ry.is(n.connectionStrategy)||Bd.is(n.messageStrategy))}t.is=e})(wk||(Se.ConnectionOptions=wk={}));var Xn;(function(t){t[t.New=1]="New",t[t.Listening=2]="Listening",t[t.Closed=3]="Closed",t[t.Disposed=4]="Disposed"})(Xn||(Xn={}));function zj(t,e,r,n){let i=r!==void 0?r:Se.NullLogger,s=0,o=0,a=0,c="2.0",l,u=new Map,d,f=new Map,p=new Map,m,h=new Rk.LinkedMap,y=new Map,S=new Set,v=new Map,b=Je.Off,P=gn.Text,N,$=Xn.New,j=new Ic.Emitter,L=new Ic.Emitter,ye=new Ic.Emitter,qe=new Ic.Emitter,pe=new Ic.Emitter,Pe=n&&n.cancellationStrategy?n.cancellationStrategy:Fd.Message;function ur(E){if(E===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+E.toString()}function _r(E){return E===null?"res-unknown-"+(++a).toString():"res-"+E.toString()}function cd(){return"not-"+(++o).toString()}function Eg(E,F){he.Message.isRequest(F)?E.set(ur(F.id),F):he.Message.isResponse(F)?E.set(_r(F.id),F):E.set(cd(),F)}function ld(E){}function kc(){return $===Xn.Listening}function to(){return $===Xn.Closed}function ji(){return $===Xn.Disposed}function Vo(){($===Xn.New||$===Xn.Listening)&&($=Xn.Closed,L.fire(void 0))}function ro(E){j.fire([E,void 0,void 0])}function ud(E){j.fire(E)}t.onClose(Vo),t.onError(ro),e.onClose(Vo),e.onError(ud);function Nc(){m||h.size===0||(m=(0,Nk.default)().timer.setImmediate(()=>{m=void 0,dd()}))}function Rc(E){he.Message.isRequest(E)?pd(E):he.Message.isNotification(E)?md(E):he.Message.isResponse(E)?hd(E):Wo(E)}function dd(){if(h.size===0)return;let E=h.shift();try{let F=n?.messageStrategy;Bd.is(F)?F.handleMessage(E,Rc):Rc(E)}finally{Nc()}}let fd=E=>{try{if(he.Message.isNotification(E)&&E.method===Mc.type.method){let F=E.params.id,G=ur(F),re=h.get(G);if(he.Message.isRequest(re)){let tt=n?.connectionStrategy,bt=tt&&tt.cancelUndispatched?tt.cancelUndispatched(re,ld):void 0;if(bt&&(bt.error!==void 0||bt.result!==void 0)){h.delete(G),v.delete(F),bt.id=re.id,no(bt,E.method,Date.now()),e.write(bt).catch(()=>i.error("Sending response for canceled message failed."));return}}let st=v.get(F);if(st!==void 0){st.cancel(),zo(E);return}else S.add(F)}Eg(h,E)}finally{Nc()}};function pd(E){if(ji())return;function F(Oe,lt,Ke){let Ot={jsonrpc:c,id:E.id};Oe instanceof he.ResponseError?Ot.error=Oe.toJson():Ot.result=Oe===void 0?null:Oe,no(Ot,lt,Ke),e.write(Ot).catch(()=>i.error("Sending response failed."))}function G(Oe,lt,Ke){let Ot={jsonrpc:c,id:E.id,error:Oe.toJson()};no(Ot,lt,Ke),e.write(Ot).catch(()=>i.error("Sending response failed."))}function re(Oe,lt,Ke){Oe===void 0&&(Oe=null);let Ot={jsonrpc:c,id:E.id,result:Oe};no(Ot,lt,Ke),e.write(Ot).catch(()=>i.error("Sending response failed."))}Td(E);let st=u.get(E.method),tt,bt;st&&(tt=st.type,bt=st.handler);let Nt=Date.now();if(bt||l){let Oe=E.id??String(Date.now()),lt=Ld.is(Pe.receiver)?Pe.receiver.createCancellationTokenSource(Oe):Pe.receiver.createCancellationTokenSource(E);E.id!==null&&S.has(E.id)&&lt.cancel(),E.id!==null&&v.set(Oe,lt);try{let Ke;if(bt)if(E.params===void 0){if(tt!==void 0&&tt.numberOfParams!==0){G(new he.ResponseError(he.ErrorCodes.InvalidParams,`Request ${E.method} defines ${tt.numberOfParams} params but received none.`),E.method,Nt);return}Ke=bt(lt.token)}else if(Array.isArray(E.params)){if(tt!==void 0&&tt.parameterStructures===he.ParameterStructures.byName){G(new he.ResponseError(he.ErrorCodes.InvalidParams,`Request ${E.method} defines parameters by name but received parameters by position`),E.method,Nt);return}Ke=bt(...E.params,lt.token)}else{if(tt!==void 0&&tt.parameterStructures===he.ParameterStructures.byPosition){G(new he.ResponseError(he.ErrorCodes.InvalidParams,`Request ${E.method} defines parameters by position but received parameters by name`),E.method,Nt);return}Ke=bt(E.params,lt.token)}else l&&(Ke=l(E.method,E.params,lt.token));let Ot=Ke;Ke?Ot.then?Ot.then(tr=>{v.delete(Oe),F(tr,E.method,Nt)},tr=>{v.delete(Oe),tr instanceof he.ResponseError?G(tr,E.method,Nt):tr&&Ct.string(tr.message)?G(new he.ResponseError(he.ErrorCodes.InternalError,`Request ${E.method} failed with message: ${tr.message}`),E.method,Nt):G(new he.ResponseError(he.ErrorCodes.InternalError,`Request ${E.method} failed unexpectedly without providing any details.`),E.method,Nt)}):(v.delete(Oe),F(Ke,E.method,Nt)):(v.delete(Oe),re(Ke,E.method,Nt))}catch(Ke){v.delete(Oe),Ke instanceof he.ResponseError?F(Ke,E.method,Nt):Ke&&Ct.string(Ke.message)?G(new he.ResponseError(he.ErrorCodes.InternalError,`Request ${E.method} failed with message: ${Ke.message}`),E.method,Nt):G(new he.ResponseError(he.ErrorCodes.InternalError,`Request ${E.method} failed unexpectedly without providing any details.`),E.method,Nt)}}else G(new he.ResponseError(he.ErrorCodes.MethodNotFound,`Unhandled method ${E.method}`),E.method,Nt)}function hd(E){if(!ji())if(E.id===null)E.error?i.error(`Received response message without id: Error is:
7
7
  ${JSON.stringify(E.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.");else{let F=E.id,G=y.get(F);if(vd(E,G),G!==void 0){y.delete(F);try{if(E.error){let re=E.error;G.reject(new he.ResponseError(re.code,re.message,re.data))}else if(E.result!==void 0)G.resolve(E.result);else throw new Error("Should never happen.")}catch(re){re.message?i.error(`Response handler '${G.method}' failed with message: ${re.message}`):i.error(`Response handler '${G.method}' failed unexpectedly.`)}}}}function md(E){if(ji())return;let F,G;if(E.method===Mc.type.method){let re=E.params.id;S.delete(re),zo(E);return}else{let re=f.get(E.method);re&&(G=re.handler,F=re.type)}if(G||d)try{if(zo(E),G)if(E.params===void 0)F!==void 0&&F.numberOfParams!==0&&F.parameterStructures!==he.ParameterStructures.byName&&i.error(`Notification ${E.method} defines ${F.numberOfParams} params but received none.`),G();else if(Array.isArray(E.params)){let re=E.params;E.method===Oc.type.method&&re.length===2&&_y.is(re[0])?G({token:re[0],value:re[1]}):(F!==void 0&&(F.parameterStructures===he.ParameterStructures.byName&&i.error(`Notification ${E.method} defines parameters by name but received parameters by position`),F.numberOfParams!==E.params.length&&i.error(`Notification ${E.method} defines ${F.numberOfParams} params but received ${re.length} arguments`)),G(...re))}else F!==void 0&&F.parameterStructures===he.ParameterStructures.byPosition&&i.error(`Notification ${E.method} defines parameters by position but received parameters by name`),G(E.params);else d&&d(E.method,E.params)}catch(re){re.message?i.error(`Notification handler '${E.method}' failed with message: ${re.message}`):i.error(`Notification handler '${E.method}' failed unexpectedly.`)}else ye.fire(E)}function Wo(E){if(!E){i.error("Received empty message.");return}i.error(`Received message which is neither a response nor a notification message:
8
8
  ${JSON.stringify(E,null,4)}`);let F=E;if(Ct.string(F.id)||Ct.number(F.id)){let G=F.id,re=y.get(G);re&&re.reject(new Error("The received response has neither a result nor an error property."))}}function Gn(E){if(E!=null)switch(b){case Je.Verbose:return JSON.stringify(E,null,4);case Je.Compact:return JSON.stringify(E);default:return}}function gd(E){if(!(b===Je.Off||!N))if(P===gn.Text){let F;(b===Je.Verbose||b===Je.Compact)&&E.params&&(F=`Params: ${Gn(E.params)}
9
9
 
@@ -29,12 +29,12 @@ ${JSON.stringify(E,null,4)}`);let F=E;if(Ct.string(F.id)||Ct.number(F.id)){let G
29
29
 
30
30
  `:E.error===void 0&&(G=`No result returned.
31
31
 
32
- `)),F){let re=E.error?` Request failed: ${E.error.message} (${E.error.code}).`:"";N.log(`Received response '${F.method} - (${E.id})' in ${Date.now()-F.timerStart}ms.${re}`,G)}else N.log(`Received response ${E.id} without active response promise.`,G)}else Ui("receive-response",E)}function Ui(E,F){if(!N||b===Je.Off)return;let G={isLSPMessage:!0,type:E,message:F,timestamp:Date.now()};N.log(G)}function cs(){if(to())throw new ta(xc.Closed,"Connection is closed.");if(ji())throw new ta(xc.Disposed,"Connection is disposed.")}function bd(){if(kc())throw new ta(xc.AlreadyListening,"Connection is already listening")}function Sd(){if(!kc())throw new Error("Call listen() first.")}function vi(E){return E===void 0?null:E}function Ec(E){if(E!==null)return E}function wc(E){return E!=null&&!Array.isArray(E)&&typeof E=="object"}function Go(E,F){switch(E){case he.ParameterStructures.auto:return wc(F)?Ec(F):[vi(F)];case he.ParameterStructures.byName:if(!wc(F))throw new Error("Received parameters by name but param is not an object literal.");return Ec(F);case he.ParameterStructures.byPosition:return[vi(F)];default:throw new Error(`Unknown parameter structure ${E.toString()}`)}}function Dc(E,F){let G,re=E.numberOfParams;switch(re){case 0:G=void 0;break;case 1:G=Go(E.parameterStructures,F[0]);break;default:G=[];for(let st=0;st<F.length&&st<re;st++)G.push(vi(F[st]));if(F.length<re)for(let st=F.length;st<re;st++)G.push(null);break}return G}let Hi={sendNotification:(E,...F)=>{cs();let G,re;if(Ct.string(E)){G=E;let tt=F[0],bt=0,Nt=he.ParameterStructures.auto;he.ParameterStructures.is(tt)&&(bt=1,Nt=tt);let Oe=F.length,lt=Oe-bt;switch(lt){case 0:re=void 0;break;case 1:re=Go(Nt,F[bt]);break;default:if(Nt===he.ParameterStructures.byName)throw new Error(`Received ${lt} parameters for 'by Name' notification parameter structure.`);re=F.slice(bt,Oe).map(Ke=>vi(Ke));break}}else{let tt=F;G=E.method,re=Dc(E,tt)}let st={jsonrpc:c,method:G,params:re};return yd(st),e.write(st).catch(tt=>{throw i.error("Sending notification failed."),tt})},onNotification:(E,F)=>{cs();let G;return Ct.func(E)?d=E:F&&(Ct.string(E)?(G=E,f.set(E,{type:void 0,handler:F})):(G=E.method,f.set(E.method,{type:E,handler:F}))),{dispose:()=>{G!==void 0?f.delete(G):d=void 0}}},onProgress:(E,F,G)=>{if(p.has(F))throw new Error(`Progress handler for token ${F} already registered`);return p.set(F,G),{dispose:()=>{p.delete(F)}}},sendProgress:(E,F,G)=>Hi.sendNotification(Oc.type,{token:F,value:G}),onUnhandledProgress:qe.event,sendRequest:(E,...F)=>{cs(),Sd();let G,re,st;if(Ct.string(E)){G=E;let Oe=F[0],lt=F[F.length-1],Ke=0,Ot=he.ParameterStructures.auto;he.ParameterStructures.is(Oe)&&(Ke=1,Ot=Oe);let tr=F.length;Sy.CancellationToken.is(lt)&&(tr=tr-1,st=lt);let mn=tr-Ke;switch(mn){case 0:re=void 0;break;case 1:re=Go(Ot,F[Ke]);break;default:if(Ot===he.ParameterStructures.byName)throw new Error(`Received ${mn} parameters for 'by Name' request parameter structure.`);re=F.slice(Ke,tr).map(_d=>vi(_d));break}}else{let Oe=F;G=E.method,re=Dc(E,Oe);let lt=E.numberOfParams;st=Sy.CancellationToken.is(Oe[lt])?Oe[lt]:void 0}let tt=s++,bt;st&&(bt=st.onCancellationRequested(()=>{let Oe=Pe.sender.sendCancellation(Hi,tt);return Oe===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${tt}`),Promise.resolve()):Oe.catch(()=>{i.log(`Sending cancellation messages for id ${tt} failed`)})}));let Nt={jsonrpc:c,id:tt,method:G,params:re};return gd(Nt),typeof Pe.sender.enableCancellation=="function"&&Pe.sender.enableCancellation(Nt),new Promise(async(Oe,lt)=>{let Ke=mn=>{Oe(mn),Pe.sender.cleanup(tt),bt?.dispose()},Ot=mn=>{lt(mn),Pe.sender.cleanup(tt),bt?.dispose()},tr={method:G,timerStart:Date.now(),resolve:Ke,reject:Ot};try{await e.write(Nt),y.set(tt,tr)}catch(mn){throw i.error("Sending request failed."),tr.reject(new he.ResponseError(he.ErrorCodes.MessageWriteError,mn.message?mn.message:"Unknown reason")),mn}})},onRequest:(E,F)=>{cs();let G=null;return ky.is(E)?(G=void 0,l=E):Ct.string(E)?(G=null,F!==void 0&&(G=E,u.set(E,{handler:F,type:void 0}))):F!==void 0&&(G=E.method,u.set(E.method,{type:E,handler:F})),{dispose:()=>{G!==null&&(G!==void 0?u.delete(G):l=void 0)}}},hasPendingResponse:()=>y.size>0,trace:async(E,F,G)=>{let re=!1,st=gn.Text;G!==void 0&&(Ct.boolean(G)?re=G:(re=G.sendNotification||!1,st=G.traceFormat||gn.Text)),b=E,P=st,b===Je.Off?N=void 0:N=F,re&&!to()&&!ji()&&await Hi.sendNotification(Ny.type,{value:Je.toString(E)})},onError:j.event,onClose:L.event,onUnhandledNotification:ye.event,onDispose:pe.event,end:()=>{e.end()},dispose:()=>{if(ji())return;$=Xn.Disposed,pe.fire(void 0);let E=new he.ResponseError(he.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let F of y.values())F.reject(E);y=new Map,v=new Map,S=new Set,h=new Rk.LinkedMap,Ct.func(e.dispose)&&e.dispose(),Ct.func(t.dispose)&&t.dispose()},listen:()=>{cs(),bd(),$=Xn.Listening,t.listen(fd)},inspect:()=>{(0,Nk.default)().console.log("inspect")}};return Hi.onNotification(Md.type,E=>{if(b===Je.Off||!N)return;let F=b===Je.Verbose||b===Je.Compact;N.log(E.message,F?E.verbose:void 0)}),Hi.onNotification(Oc.type,E=>{let F=p.get(E.token);F?F(E.value):qe.fire(E)}),Hi}Se.createMessageConnection=zj});var jd=R(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.ProgressType=O.ProgressToken=O.createMessageConnection=O.NullLogger=O.ConnectionOptions=O.ConnectionStrategy=O.AbstractMessageBuffer=O.WriteableStreamMessageWriter=O.AbstractMessageWriter=O.MessageWriter=O.ReadableStreamMessageReader=O.AbstractMessageReader=O.MessageReader=O.SharedArrayReceiverStrategy=O.SharedArraySenderStrategy=O.CancellationToken=O.CancellationTokenSource=O.Emitter=O.Event=O.Disposable=O.LRUCache=O.Touch=O.LinkedMap=O.ParameterStructures=O.NotificationType9=O.NotificationType8=O.NotificationType7=O.NotificationType6=O.NotificationType5=O.NotificationType4=O.NotificationType3=O.NotificationType2=O.NotificationType1=O.NotificationType0=O.NotificationType=O.ErrorCodes=O.ResponseError=O.RequestType9=O.RequestType8=O.RequestType7=O.RequestType6=O.RequestType5=O.RequestType4=O.RequestType3=O.RequestType2=O.RequestType1=O.RequestType0=O.RequestType=O.Message=O.RAL=void 0;O.MessageStrategy=O.CancellationStrategy=O.CancellationSenderStrategy=O.CancellationReceiverStrategy=O.ConnectionError=O.ConnectionErrors=O.LogTraceNotification=O.SetTraceNotification=O.TraceFormat=O.TraceValues=O.Trace=void 0;var Tt=Zg();Object.defineProperty(O,"Message",{enumerable:!0,get:function(){return Tt.Message}});Object.defineProperty(O,"RequestType",{enumerable:!0,get:function(){return Tt.RequestType}});Object.defineProperty(O,"RequestType0",{enumerable:!0,get:function(){return Tt.RequestType0}});Object.defineProperty(O,"RequestType1",{enumerable:!0,get:function(){return Tt.RequestType1}});Object.defineProperty(O,"RequestType2",{enumerable:!0,get:function(){return Tt.RequestType2}});Object.defineProperty(O,"RequestType3",{enumerable:!0,get:function(){return Tt.RequestType3}});Object.defineProperty(O,"RequestType4",{enumerable:!0,get:function(){return Tt.RequestType4}});Object.defineProperty(O,"RequestType5",{enumerable:!0,get:function(){return Tt.RequestType5}});Object.defineProperty(O,"RequestType6",{enumerable:!0,get:function(){return Tt.RequestType6}});Object.defineProperty(O,"RequestType7",{enumerable:!0,get:function(){return Tt.RequestType7}});Object.defineProperty(O,"RequestType8",{enumerable:!0,get:function(){return Tt.RequestType8}});Object.defineProperty(O,"RequestType9",{enumerable:!0,get:function(){return Tt.RequestType9}});Object.defineProperty(O,"ResponseError",{enumerable:!0,get:function(){return Tt.ResponseError}});Object.defineProperty(O,"ErrorCodes",{enumerable:!0,get:function(){return Tt.ErrorCodes}});Object.defineProperty(O,"NotificationType",{enumerable:!0,get:function(){return Tt.NotificationType}});Object.defineProperty(O,"NotificationType0",{enumerable:!0,get:function(){return Tt.NotificationType0}});Object.defineProperty(O,"NotificationType1",{enumerable:!0,get:function(){return Tt.NotificationType1}});Object.defineProperty(O,"NotificationType2",{enumerable:!0,get:function(){return Tt.NotificationType2}});Object.defineProperty(O,"NotificationType3",{enumerable:!0,get:function(){return Tt.NotificationType3}});Object.defineProperty(O,"NotificationType4",{enumerable:!0,get:function(){return Tt.NotificationType4}});Object.defineProperty(O,"NotificationType5",{enumerable:!0,get:function(){return Tt.NotificationType5}});Object.defineProperty(O,"NotificationType6",{enumerable:!0,get:function(){return Tt.NotificationType6}});Object.defineProperty(O,"NotificationType7",{enumerable:!0,get:function(){return Tt.NotificationType7}});Object.defineProperty(O,"NotificationType8",{enumerable:!0,get:function(){return Tt.NotificationType8}});Object.defineProperty(O,"NotificationType9",{enumerable:!0,get:function(){return Tt.NotificationType9}});Object.defineProperty(O,"ParameterStructures",{enumerable:!0,get:function(){return Tt.ParameterStructures}});var wy=ty();Object.defineProperty(O,"LinkedMap",{enumerable:!0,get:function(){return wy.LinkedMap}});Object.defineProperty(O,"LRUCache",{enumerable:!0,get:function(){return wy.LRUCache}});Object.defineProperty(O,"Touch",{enumerable:!0,get:function(){return wy.Touch}});var Gj=hk();Object.defineProperty(O,"Disposable",{enumerable:!0,get:function(){return Gj.Disposable}});var Ck=Jo();Object.defineProperty(O,"Event",{enumerable:!0,get:function(){return Ck.Event}});Object.defineProperty(O,"Emitter",{enumerable:!0,get:function(){return Ck.Emitter}});var Ak=Cd();Object.defineProperty(O,"CancellationTokenSource",{enumerable:!0,get:function(){return Ak.CancellationTokenSource}});Object.defineProperty(O,"CancellationToken",{enumerable:!0,get:function(){return Ak.CancellationToken}});var Ik=gk();Object.defineProperty(O,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return Ik.SharedArraySenderStrategy}});Object.defineProperty(O,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return Ik.SharedArrayReceiverStrategy}});var Dy=Tk();Object.defineProperty(O,"MessageReader",{enumerable:!0,get:function(){return Dy.MessageReader}});Object.defineProperty(O,"AbstractMessageReader",{enumerable:!0,get:function(){return Dy.AbstractMessageReader}});Object.defineProperty(O,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return Dy.ReadableStreamMessageReader}});var Cy=Pk();Object.defineProperty(O,"MessageWriter",{enumerable:!0,get:function(){return Cy.MessageWriter}});Object.defineProperty(O,"AbstractMessageWriter",{enumerable:!0,get:function(){return Cy.AbstractMessageWriter}});Object.defineProperty(O,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return Cy.WriteableStreamMessageWriter}});var Yj=kk();Object.defineProperty(O,"AbstractMessageBuffer",{enumerable:!0,get:function(){return Yj.AbstractMessageBuffer}});var dr=Dk();Object.defineProperty(O,"ConnectionStrategy",{enumerable:!0,get:function(){return dr.ConnectionStrategy}});Object.defineProperty(O,"ConnectionOptions",{enumerable:!0,get:function(){return dr.ConnectionOptions}});Object.defineProperty(O,"NullLogger",{enumerable:!0,get:function(){return dr.NullLogger}});Object.defineProperty(O,"createMessageConnection",{enumerable:!0,get:function(){return dr.createMessageConnection}});Object.defineProperty(O,"ProgressToken",{enumerable:!0,get:function(){return dr.ProgressToken}});Object.defineProperty(O,"ProgressType",{enumerable:!0,get:function(){return dr.ProgressType}});Object.defineProperty(O,"Trace",{enumerable:!0,get:function(){return dr.Trace}});Object.defineProperty(O,"TraceValues",{enumerable:!0,get:function(){return dr.TraceValues}});Object.defineProperty(O,"TraceFormat",{enumerable:!0,get:function(){return dr.TraceFormat}});Object.defineProperty(O,"SetTraceNotification",{enumerable:!0,get:function(){return dr.SetTraceNotification}});Object.defineProperty(O,"LogTraceNotification",{enumerable:!0,get:function(){return dr.LogTraceNotification}});Object.defineProperty(O,"ConnectionErrors",{enumerable:!0,get:function(){return dr.ConnectionErrors}});Object.defineProperty(O,"ConnectionError",{enumerable:!0,get:function(){return dr.ConnectionError}});Object.defineProperty(O,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return dr.CancellationReceiverStrategy}});Object.defineProperty(O,"CancellationSenderStrategy",{enumerable:!0,get:function(){return dr.CancellationSenderStrategy}});Object.defineProperty(O,"CancellationStrategy",{enumerable:!0,get:function(){return dr.CancellationStrategy}});Object.defineProperty(O,"MessageStrategy",{enumerable:!0,get:function(){return dr.MessageStrategy}});var Kj=us();O.RAL=Kj.default});var Mk=R(xy=>{"use strict";Object.defineProperty(xy,"__esModule",{value:!0});var Ok=require("util"),Wi=jd(),Ud=class t extends Wi.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return t.emptyBuffer}fromString(e,r){return Buffer.from(e,r)}toString(e,r){return e instanceof Buffer?e.toString(r):new Ok.TextDecoder(r).decode(e)}asNative(e,r){return r===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,r):Buffer.from(e,0,r)}allocNative(e){return Buffer.allocUnsafe(e)}};Ud.emptyBuffer=Buffer.allocUnsafe(0);var Ay=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),Wi.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),Wi.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),Wi.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),Wi.Disposable.create(()=>this.stream.off("data",e))}},Iy=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),Wi.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),Wi.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),Wi.Disposable.create(()=>this.stream.off("end",e))}write(e,r){return new Promise((n,i)=>{let s=o=>{o==null?n():i(o)};typeof e=="string"?this.stream.write(e,r,s):this.stream.write(e,s)})}end(){this.stream.end()}},xk=Object.freeze({messageBuffer:Object.freeze({create:t=>new Ud(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(t,e)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(t,void 0,0),e.charset))}catch(r){return Promise.reject(r)}}}),decoder:Object.freeze({name:"application/json",decode:(t,e)=>{try{return t instanceof Buffer?Promise.resolve(JSON.parse(t.toString(e.charset))):Promise.resolve(JSON.parse(new Ok.TextDecoder(e.charset).decode(t)))}catch(r){return Promise.reject(r)}}})}),stream:Object.freeze({asReadableStream:t=>new Ay(t),asWritableStream:t=>new Iy(t)}),console,timer:Object.freeze({setTimeout(t,e,...r){let n=setTimeout(t,e,...r);return{dispose:()=>clearTimeout(n)}},setImmediate(t,...e){let r=setImmediate(t,...e);return{dispose:()=>clearImmediate(r)}},setInterval(t,e,...r){let n=setInterval(t,e,...r);return{dispose:()=>clearInterval(n)}}})});function Oy(){return xk}(function(t){function e(){Wi.RAL.install(xk)}t.install=e})(Oy||(Oy={}));xy.default=Oy});var ao=R(Fe=>{"use strict";var Xj=Fe&&Fe.__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]})),Jj=Fe&&Fe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Xj(e,t,r)};Object.defineProperty(Fe,"__esModule",{value:!0});Fe.createMessageConnection=Fe.createServerSocketTransport=Fe.createClientSocketTransport=Fe.createServerPipeTransport=Fe.createClientPipeTransport=Fe.generateRandomPipeName=Fe.StreamMessageWriter=Fe.StreamMessageReader=Fe.SocketMessageWriter=Fe.SocketMessageReader=Fe.PortMessageWriter=Fe.PortMessageReader=Fe.IPCMessageWriter=Fe.IPCMessageReader=void 0;var ra=Mk();ra.default.install();var Lk=require("path"),Qj=require("os"),Zj=require("crypto"),Wd=require("net"),yn=jd();Jj(jd(),Fe);var My=class extends yn.AbstractMessageReader{constructor(e){super(),this.process=e;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose())}listen(e){return this.process.on("message",e),yn.Disposable.create(()=>this.process.off("message",e))}};Fe.IPCMessageReader=My;var Ly=class extends yn.AbstractMessageWriter{constructor(e){super(),this.process=e,this.errorCount=0;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose)}write(e){try{return typeof this.process.send=="function"&&this.process.send(e,void 0,void 0,r=>{r?(this.errorCount++,this.handleError(r,e)):this.errorCount=0}),Promise.resolve()}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){}};Fe.IPCMessageWriter=Ly;var qy=class extends yn.AbstractMessageReader{constructor(e){super(),this.onData=new yn.Emitter,e.on("close",()=>this.fireClose),e.on("error",r=>this.fireError(r)),e.on("message",r=>{this.onData.fire(r)})}listen(e){return this.onData.event(e)}};Fe.PortMessageReader=qy;var $y=class extends yn.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.on("close",()=>this.fireClose()),e.on("error",r=>this.fireError(r))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){}};Fe.PortMessageWriter=$y;var so=class extends yn.ReadableStreamMessageReader{constructor(e,r="utf-8"){super((0,ra.default)().stream.asReadableStream(e),r)}};Fe.SocketMessageReader=so;var oo=class extends yn.WriteableStreamMessageWriter{constructor(e,r){super((0,ra.default)().stream.asWritableStream(e),r),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};Fe.SocketMessageWriter=oo;var Hd=class extends yn.ReadableStreamMessageReader{constructor(e,r){super((0,ra.default)().stream.asReadableStream(e),r)}};Fe.StreamMessageReader=Hd;var Vd=class extends yn.WriteableStreamMessageWriter{constructor(e,r){super((0,ra.default)().stream.asWritableStream(e),r)}};Fe.StreamMessageWriter=Vd;var qk=process.env.XDG_RUNTIME_DIR,eU=new Map([["linux",107],["darwin",103]]);function tU(){let t=(0,Zj.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${t}-sock`;let e;qk?e=Lk.join(qk,`vscode-ipc-${t}.sock`):e=Lk.join(Qj.tmpdir(),`vscode-${t}.sock`);let r=eU.get(process.platform);return r!==void 0&&e.length>r&&(0,ra.default)().console.warn(`WARNING: IPC handle "${e}" is longer than ${r} characters.`),e}Fe.generateRandomPipeName=tU;function rU(t,e="utf-8"){let r,n=new Promise((i,s)=>{r=i});return new Promise((i,s)=>{let o=(0,Wd.createServer)(a=>{o.close(),r([new so(a,e),new oo(a,e)])});o.on("error",s),o.listen(t,()=>{o.removeListener("error",s),i({onConnected:()=>n})})})}Fe.createClientPipeTransport=rU;function nU(t,e="utf-8"){let r=(0,Wd.createConnection)(t);return[new so(r,e),new oo(r,e)]}Fe.createServerPipeTransport=nU;function iU(t,e="utf-8"){let r,n=new Promise((i,s)=>{r=i});return new Promise((i,s)=>{let o=(0,Wd.createServer)(a=>{o.close(),r([new so(a,e),new oo(a,e)])});o.on("error",s),o.listen(t,"127.0.0.1",()=>{o.removeListener("error",s),i({onConnected:()=>n})})})}Fe.createClientSocketTransport=iU;function sU(t,e="utf-8"){let r=(0,Wd.createConnection)(t,"127.0.0.1");return[new so(r,e),new oo(r,e)]}Fe.createServerSocketTransport=sU;function oU(t){let e=t;return e.read!==void 0&&e.addListener!==void 0}function aU(t){let e=t;return e.write!==void 0&&e.addListener!==void 0}function cU(t,e,r,n){r||(r=yn.NullLogger);let i=oU(t)?new Hd(t):t,s=aU(e)?new Vd(e):e;return yn.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,yn.createMessageConnection)(i,s,r,n)}Fe.createMessageConnection=cU});var Fy=R((yZ,$k)=>{"use strict";$k.exports=ao()});var Gd=R((Fk,zd)=>{(function(t){if(typeof zd=="object"&&typeof zd.exports=="object"){var e=t(require,Fk);e!==void 0&&(zd.exports=e)}else typeof define=="function"&&define.amd&&define(["require","exports"],t)})(function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TextDocument=e.EOL=e.WorkspaceFolder=e.InlineCompletionContext=e.SelectedCompletionInfo=e.InlineCompletionTriggerKind=e.InlineCompletionList=e.InlineCompletionItem=e.StringValue=e.InlayHint=e.InlayHintLabelPart=e.InlayHintKind=e.InlineValueContext=e.InlineValueEvaluatableExpression=e.InlineValueVariableLookup=e.InlineValueText=e.SemanticTokens=e.SemanticTokenModifiers=e.SemanticTokenTypes=e.SelectionRange=e.DocumentLink=e.FormattingOptions=e.CodeLens=e.CodeAction=e.CodeActionContext=e.CodeActionTriggerKind=e.CodeActionKind=e.DocumentSymbol=e.WorkspaceSymbol=e.SymbolInformation=e.SymbolTag=e.SymbolKind=e.DocumentHighlight=e.DocumentHighlightKind=e.SignatureInformation=e.ParameterInformation=e.Hover=e.MarkedString=e.CompletionList=e.CompletionItem=e.CompletionItemLabelDetails=e.InsertTextMode=e.InsertReplaceEdit=e.CompletionItemTag=e.InsertTextFormat=e.CompletionItemKind=e.MarkupContent=e.MarkupKind=e.TextDocumentItem=e.OptionalVersionedTextDocumentIdentifier=e.VersionedTextDocumentIdentifier=e.TextDocumentIdentifier=e.WorkspaceChange=e.WorkspaceEdit=e.DeleteFile=e.RenameFile=e.CreateFile=e.TextDocumentEdit=e.AnnotatedTextEdit=e.ChangeAnnotationIdentifier=e.ChangeAnnotation=e.TextEdit=e.Command=e.Diagnostic=e.CodeDescription=e.DiagnosticTag=e.DiagnosticSeverity=e.DiagnosticRelatedInformation=e.FoldingRange=e.FoldingRangeKind=e.ColorPresentation=e.ColorInformation=e.Color=e.LocationLink=e.Location=e.Range=e.Position=e.uinteger=e.integer=e.URI=e.DocumentUri=void 0;var r;(function(T){function w(D){return typeof D=="string"}T.is=w})(r||(e.DocumentUri=r={}));var n;(function(T){function w(D){return typeof D=="string"}T.is=w})(n||(e.URI=n={}));var i;(function(T){T.MIN_VALUE=-2147483648,T.MAX_VALUE=2147483647;function w(D){return typeof D=="number"&&T.MIN_VALUE<=D&&D<=T.MAX_VALUE}T.is=w})(i||(e.integer=i={}));var s;(function(T){T.MIN_VALUE=0,T.MAX_VALUE=2147483647;function w(D){return typeof D=="number"&&T.MIN_VALUE<=D&&D<=T.MAX_VALUE}T.is=w})(s||(e.uinteger=s={}));var o;(function(T){function w(_,g){return _===Number.MAX_VALUE&&(_=s.MAX_VALUE),g===Number.MAX_VALUE&&(g=s.MAX_VALUE),{line:_,character:g}}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&I.uinteger(g.line)&&I.uinteger(g.character)}T.is=D})(o||(e.Position=o={}));var a;(function(T){function w(_,g,A,B){if(I.uinteger(_)&&I.uinteger(g)&&I.uinteger(A)&&I.uinteger(B))return{start:o.create(_,g),end:o.create(A,B)};if(o.is(_)&&o.is(g))return{start:_,end:g};throw new Error("Range#create called with invalid arguments[".concat(_,", ").concat(g,", ").concat(A,", ").concat(B,"]"))}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&o.is(g.start)&&o.is(g.end)}T.is=D})(a||(e.Range=a={}));var c;(function(T){function w(_,g){return{uri:_,range:g}}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&a.is(g.range)&&(I.string(g.uri)||I.undefined(g.uri))}T.is=D})(c||(e.Location=c={}));var l;(function(T){function w(_,g,A,B){return{targetUri:_,targetRange:g,targetSelectionRange:A,originSelectionRange:B}}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&a.is(g.targetRange)&&I.string(g.targetUri)&&a.is(g.targetSelectionRange)&&(a.is(g.originSelectionRange)||I.undefined(g.originSelectionRange))}T.is=D})(l||(e.LocationLink=l={}));var u;(function(T){function w(_,g,A,B){return{red:_,green:g,blue:A,alpha:B}}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&I.numberRange(g.red,0,1)&&I.numberRange(g.green,0,1)&&I.numberRange(g.blue,0,1)&&I.numberRange(g.alpha,0,1)}T.is=D})(u||(e.Color=u={}));var d;(function(T){function w(_,g){return{range:_,color:g}}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&a.is(g.range)&&u.is(g.color)}T.is=D})(d||(e.ColorInformation=d={}));var f;(function(T){function w(_,g,A){return{label:_,textEdit:g,additionalTextEdits:A}}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&I.string(g.label)&&(I.undefined(g.textEdit)||N.is(g))&&(I.undefined(g.additionalTextEdits)||I.typedArray(g.additionalTextEdits,N.is))}T.is=D})(f||(e.ColorPresentation=f={}));var p;(function(T){T.Comment="comment",T.Imports="imports",T.Region="region"})(p||(e.FoldingRangeKind=p={}));var m;(function(T){function w(_,g,A,B,be,xt){var yt={startLine:_,endLine:g};return I.defined(A)&&(yt.startCharacter=A),I.defined(B)&&(yt.endCharacter=B),I.defined(be)&&(yt.kind=be),I.defined(xt)&&(yt.collapsedText=xt),yt}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&I.uinteger(g.startLine)&&I.uinteger(g.startLine)&&(I.undefined(g.startCharacter)||I.uinteger(g.startCharacter))&&(I.undefined(g.endCharacter)||I.uinteger(g.endCharacter))&&(I.undefined(g.kind)||I.string(g.kind))}T.is=D})(m||(e.FoldingRange=m={}));var h;(function(T){function w(_,g){return{location:_,message:g}}T.create=w;function D(_){var g=_;return I.defined(g)&&c.is(g.location)&&I.string(g.message)}T.is=D})(h||(e.DiagnosticRelatedInformation=h={}));var y;(function(T){T.Error=1,T.Warning=2,T.Information=3,T.Hint=4})(y||(e.DiagnosticSeverity=y={}));var S;(function(T){T.Unnecessary=1,T.Deprecated=2})(S||(e.DiagnosticTag=S={}));var v;(function(T){function w(D){var _=D;return I.objectLiteral(_)&&I.string(_.href)}T.is=w})(v||(e.CodeDescription=v={}));var b;(function(T){function w(_,g,A,B,be,xt){var yt={range:_,message:g};return I.defined(A)&&(yt.severity=A),I.defined(B)&&(yt.code=B),I.defined(be)&&(yt.source=be),I.defined(xt)&&(yt.relatedInformation=xt),yt}T.create=w;function D(_){var g,A=_;return I.defined(A)&&a.is(A.range)&&I.string(A.message)&&(I.number(A.severity)||I.undefined(A.severity))&&(I.integer(A.code)||I.string(A.code)||I.undefined(A.code))&&(I.undefined(A.codeDescription)||I.string((g=A.codeDescription)===null||g===void 0?void 0:g.href))&&(I.string(A.source)||I.undefined(A.source))&&(I.undefined(A.relatedInformation)||I.typedArray(A.relatedInformation,h.is))}T.is=D})(b||(e.Diagnostic=b={}));var P;(function(T){function w(_,g){for(var A=[],B=2;B<arguments.length;B++)A[B-2]=arguments[B];var be={title:_,command:g};return I.defined(A)&&A.length>0&&(be.arguments=A),be}T.create=w;function D(_){var g=_;return I.defined(g)&&I.string(g.title)&&I.string(g.command)}T.is=D})(P||(e.Command=P={}));var N;(function(T){function w(A,B){return{range:A,newText:B}}T.replace=w;function D(A,B){return{range:{start:A,end:A},newText:B}}T.insert=D;function _(A){return{range:A,newText:""}}T.del=_;function g(A){var B=A;return I.objectLiteral(B)&&I.string(B.newText)&&a.is(B.range)}T.is=g})(N||(e.TextEdit=N={}));var $;(function(T){function w(_,g,A){var B={label:_};return g!==void 0&&(B.needsConfirmation=g),A!==void 0&&(B.description=A),B}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&I.string(g.label)&&(I.boolean(g.needsConfirmation)||g.needsConfirmation===void 0)&&(I.string(g.description)||g.description===void 0)}T.is=D})($||(e.ChangeAnnotation=$={}));var j;(function(T){function w(D){var _=D;return I.string(_)}T.is=w})(j||(e.ChangeAnnotationIdentifier=j={}));var L;(function(T){function w(A,B,be){return{range:A,newText:B,annotationId:be}}T.replace=w;function D(A,B,be){return{range:{start:A,end:A},newText:B,annotationId:be}}T.insert=D;function _(A,B){return{range:A,newText:"",annotationId:B}}T.del=_;function g(A){var B=A;return N.is(B)&&($.is(B.annotationId)||j.is(B.annotationId))}T.is=g})(L||(e.AnnotatedTextEdit=L={}));var ye;(function(T){function w(_,g){return{textDocument:_,edits:g}}T.create=w;function D(_){var g=_;return I.defined(g)&&to.is(g.textDocument)&&Array.isArray(g.edits)}T.is=D})(ye||(e.TextDocumentEdit=ye={}));var qe;(function(T){function w(_,g,A){var B={kind:"create",uri:_};return g!==void 0&&(g.overwrite!==void 0||g.ignoreIfExists!==void 0)&&(B.options=g),A!==void 0&&(B.annotationId=A),B}T.create=w;function D(_){var g=_;return g&&g.kind==="create"&&I.string(g.uri)&&(g.options===void 0||(g.options.overwrite===void 0||I.boolean(g.options.overwrite))&&(g.options.ignoreIfExists===void 0||I.boolean(g.options.ignoreIfExists)))&&(g.annotationId===void 0||j.is(g.annotationId))}T.is=D})(qe||(e.CreateFile=qe={}));var pe;(function(T){function w(_,g,A,B){var be={kind:"rename",oldUri:_,newUri:g};return A!==void 0&&(A.overwrite!==void 0||A.ignoreIfExists!==void 0)&&(be.options=A),B!==void 0&&(be.annotationId=B),be}T.create=w;function D(_){var g=_;return g&&g.kind==="rename"&&I.string(g.oldUri)&&I.string(g.newUri)&&(g.options===void 0||(g.options.overwrite===void 0||I.boolean(g.options.overwrite))&&(g.options.ignoreIfExists===void 0||I.boolean(g.options.ignoreIfExists)))&&(g.annotationId===void 0||j.is(g.annotationId))}T.is=D})(pe||(e.RenameFile=pe={}));var Pe;(function(T){function w(_,g,A){var B={kind:"delete",uri:_};return g!==void 0&&(g.recursive!==void 0||g.ignoreIfNotExists!==void 0)&&(B.options=g),A!==void 0&&(B.annotationId=A),B}T.create=w;function D(_){var g=_;return g&&g.kind==="delete"&&I.string(g.uri)&&(g.options===void 0||(g.options.recursive===void 0||I.boolean(g.options.recursive))&&(g.options.ignoreIfNotExists===void 0||I.boolean(g.options.ignoreIfNotExists)))&&(g.annotationId===void 0||j.is(g.annotationId))}T.is=D})(Pe||(e.DeleteFile=Pe={}));var ur;(function(T){function w(D){var _=D;return _&&(_.changes!==void 0||_.documentChanges!==void 0)&&(_.documentChanges===void 0||_.documentChanges.every(function(g){return I.string(g.kind)?qe.is(g)||pe.is(g)||Pe.is(g):ye.is(g)}))}T.is=w})(ur||(e.WorkspaceEdit=ur={}));var _r=(function(){function T(w,D){this.edits=w,this.changeAnnotations=D}return T.prototype.insert=function(w,D,_){var g,A;if(_===void 0?g=N.insert(w,D):j.is(_)?(A=_,g=L.insert(w,D,_)):(this.assertChangeAnnotations(this.changeAnnotations),A=this.changeAnnotations.manage(_),g=L.insert(w,D,A)),this.edits.push(g),A!==void 0)return A},T.prototype.replace=function(w,D,_){var g,A;if(_===void 0?g=N.replace(w,D):j.is(_)?(A=_,g=L.replace(w,D,_)):(this.assertChangeAnnotations(this.changeAnnotations),A=this.changeAnnotations.manage(_),g=L.replace(w,D,A)),this.edits.push(g),A!==void 0)return A},T.prototype.delete=function(w,D){var _,g;if(D===void 0?_=N.del(w):j.is(D)?(g=D,_=L.del(w,D)):(this.assertChangeAnnotations(this.changeAnnotations),g=this.changeAnnotations.manage(D),_=L.del(w,g)),this.edits.push(_),g!==void 0)return g},T.prototype.add=function(w){this.edits.push(w)},T.prototype.all=function(){return this.edits},T.prototype.clear=function(){this.edits.splice(0,this.edits.length)},T.prototype.assertChangeAnnotations=function(w){if(w===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},T})(),cd=(function(){function T(w){this._annotations=w===void 0?Object.create(null):w,this._counter=0,this._size=0}return T.prototype.all=function(){return this._annotations},Object.defineProperty(T.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),T.prototype.manage=function(w,D){var _;if(j.is(w)?_=w:(_=this.nextId(),D=w),this._annotations[_]!==void 0)throw new Error("Id ".concat(_," is already in use."));if(D===void 0)throw new Error("No annotation provided for id ".concat(_));return this._annotations[_]=D,this._size++,_},T.prototype.nextId=function(){return this._counter++,this._counter.toString()},T})(),Eg=(function(){function T(w){var D=this;this._textEditChanges=Object.create(null),w!==void 0?(this._workspaceEdit=w,w.documentChanges?(this._changeAnnotations=new cd(w.changeAnnotations),w.changeAnnotations=this._changeAnnotations.all(),w.documentChanges.forEach(function(_){if(ye.is(_)){var g=new _r(_.edits,D._changeAnnotations);D._textEditChanges[_.textDocument.uri]=g}})):w.changes&&Object.keys(w.changes).forEach(function(_){var g=new _r(w.changes[_]);D._textEditChanges[_]=g})):this._workspaceEdit={}}return Object.defineProperty(T.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),T.prototype.getTextEditChange=function(w){if(to.is(w)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var D={uri:w.uri,version:w.version},_=this._textEditChanges[D.uri];if(!_){var g=[],A={textDocument:D,edits:g};this._workspaceEdit.documentChanges.push(A),_=new _r(g,this._changeAnnotations),this._textEditChanges[D.uri]=_}return _}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var _=this._textEditChanges[w];if(!_){var g=[];this._workspaceEdit.changes[w]=g,_=new _r(g),this._textEditChanges[w]=_}return _}},T.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new cd,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},T.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},T.prototype.createFile=function(w,D,_){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;$.is(D)||j.is(D)?g=D:_=D;var A,B;if(g===void 0?A=qe.create(w,_):(B=j.is(g)?g:this._changeAnnotations.manage(g),A=qe.create(w,_,B)),this._workspaceEdit.documentChanges.push(A),B!==void 0)return B},T.prototype.renameFile=function(w,D,_,g){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var A;$.is(_)||j.is(_)?A=_:g=_;var B,be;if(A===void 0?B=pe.create(w,D,g):(be=j.is(A)?A:this._changeAnnotations.manage(A),B=pe.create(w,D,g,be)),this._workspaceEdit.documentChanges.push(B),be!==void 0)return be},T.prototype.deleteFile=function(w,D,_){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;$.is(D)||j.is(D)?g=D:_=D;var A,B;if(g===void 0?A=Pe.create(w,_):(B=j.is(g)?g:this._changeAnnotations.manage(g),A=Pe.create(w,_,B)),this._workspaceEdit.documentChanges.push(A),B!==void 0)return B},T})();e.WorkspaceChange=Eg;var ld;(function(T){function w(_){return{uri:_}}T.create=w;function D(_){var g=_;return I.defined(g)&&I.string(g.uri)}T.is=D})(ld||(e.TextDocumentIdentifier=ld={}));var kc;(function(T){function w(_,g){return{uri:_,version:g}}T.create=w;function D(_){var g=_;return I.defined(g)&&I.string(g.uri)&&I.integer(g.version)}T.is=D})(kc||(e.VersionedTextDocumentIdentifier=kc={}));var to;(function(T){function w(_,g){return{uri:_,version:g}}T.create=w;function D(_){var g=_;return I.defined(g)&&I.string(g.uri)&&(g.version===null||I.integer(g.version))}T.is=D})(to||(e.OptionalVersionedTextDocumentIdentifier=to={}));var ji;(function(T){function w(_,g,A,B){return{uri:_,languageId:g,version:A,text:B}}T.create=w;function D(_){var g=_;return I.defined(g)&&I.string(g.uri)&&I.string(g.languageId)&&I.integer(g.version)&&I.string(g.text)}T.is=D})(ji||(e.TextDocumentItem=ji={}));var Vo;(function(T){T.PlainText="plaintext",T.Markdown="markdown";function w(D){var _=D;return _===T.PlainText||_===T.Markdown}T.is=w})(Vo||(e.MarkupKind=Vo={}));var ro;(function(T){function w(D){var _=D;return I.objectLiteral(D)&&Vo.is(_.kind)&&I.string(_.value)}T.is=w})(ro||(e.MarkupContent=ro={}));var ud;(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})(ud||(e.CompletionItemKind=ud={}));var Nc;(function(T){T.PlainText=1,T.Snippet=2})(Nc||(e.InsertTextFormat=Nc={}));var Rc;(function(T){T.Deprecated=1})(Rc||(e.CompletionItemTag=Rc={}));var dd;(function(T){function w(_,g,A){return{newText:_,insert:g,replace:A}}T.create=w;function D(_){var g=_;return g&&I.string(g.newText)&&a.is(g.insert)&&a.is(g.replace)}T.is=D})(dd||(e.InsertReplaceEdit=dd={}));var fd;(function(T){T.asIs=1,T.adjustIndentation=2})(fd||(e.InsertTextMode=fd={}));var pd;(function(T){function w(D){var _=D;return _&&(I.string(_.detail)||_.detail===void 0)&&(I.string(_.description)||_.description===void 0)}T.is=w})(pd||(e.CompletionItemLabelDetails=pd={}));var hd;(function(T){function w(D){return{label:D}}T.create=w})(hd||(e.CompletionItem=hd={}));var md;(function(T){function w(D,_){return{items:D||[],isIncomplete:!!_}}T.create=w})(md||(e.CompletionList=md={}));var Wo;(function(T){function w(_){return _.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}T.fromPlainText=w;function D(_){var g=_;return I.string(g)||I.objectLiteral(g)&&I.string(g.language)&&I.string(g.value)}T.is=D})(Wo||(e.MarkedString=Wo={}));var Gn;(function(T){function w(D){var _=D;return!!_&&I.objectLiteral(_)&&(ro.is(_.contents)||Wo.is(_.contents)||I.typedArray(_.contents,Wo.is))&&(D.range===void 0||a.is(D.range))}T.is=w})(Gn||(e.Hover=Gn={}));var gd;(function(T){function w(D,_){return _?{label:D,documentation:_}:{label:D}}T.create=w})(gd||(e.ParameterInformation=gd={}));var yd;(function(T){function w(D,_){for(var g=[],A=2;A<arguments.length;A++)g[A-2]=arguments[A];var B={label:D};return I.defined(_)&&(B.documentation=_),I.defined(g)?B.parameters=g:B.parameters=[],B}T.create=w})(yd||(e.SignatureInformation=yd={}));var no;(function(T){T.Text=1,T.Read=2,T.Write=3})(no||(e.DocumentHighlightKind=no={}));var Td;(function(T){function w(D,_){var g={range:D};return I.number(_)&&(g.kind=_),g}T.create=w})(Td||(e.DocumentHighlight=Td={}));var zo;(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})(zo||(e.SymbolKind=zo={}));var vd;(function(T){T.Deprecated=1})(vd||(e.SymbolTag=vd={}));var Ui;(function(T){function w(D,_,g,A,B){var be={name:D,kind:_,location:{uri:A,range:g}};return B&&(be.containerName=B),be}T.create=w})(Ui||(e.SymbolInformation=Ui={}));var cs;(function(T){function w(D,_,g,A){return A!==void 0?{name:D,kind:_,location:{uri:g,range:A}}:{name:D,kind:_,location:{uri:g}}}T.create=w})(cs||(e.WorkspaceSymbol=cs={}));var bd;(function(T){function w(_,g,A,B,be,xt){var yt={name:_,detail:g,kind:A,range:B,selectionRange:be};return xt!==void 0&&(yt.children=xt),yt}T.create=w;function D(_){var g=_;return g&&I.string(g.name)&&I.number(g.kind)&&a.is(g.range)&&a.is(g.selectionRange)&&(g.detail===void 0||I.string(g.detail))&&(g.deprecated===void 0||I.boolean(g.deprecated))&&(g.children===void 0||Array.isArray(g.children))&&(g.tags===void 0||Array.isArray(g.tags))}T.is=D})(bd||(e.DocumentSymbol=bd={}));var Sd;(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"})(Sd||(e.CodeActionKind=Sd={}));var vi;(function(T){T.Invoked=1,T.Automatic=2})(vi||(e.CodeActionTriggerKind=vi={}));var Ec;(function(T){function w(_,g,A){var B={diagnostics:_};return g!=null&&(B.only=g),A!=null&&(B.triggerKind=A),B}T.create=w;function D(_){var g=_;return I.defined(g)&&I.typedArray(g.diagnostics,b.is)&&(g.only===void 0||I.typedArray(g.only,I.string))&&(g.triggerKind===void 0||g.triggerKind===vi.Invoked||g.triggerKind===vi.Automatic)}T.is=D})(Ec||(e.CodeActionContext=Ec={}));var wc;(function(T){function w(_,g,A){var B={title:_},be=!0;return typeof g=="string"?(be=!1,B.kind=g):P.is(g)?B.command=g:B.edit=g,be&&A!==void 0&&(B.kind=A),B}T.create=w;function D(_){var g=_;return g&&I.string(g.title)&&(g.diagnostics===void 0||I.typedArray(g.diagnostics,b.is))&&(g.kind===void 0||I.string(g.kind))&&(g.edit!==void 0||g.command!==void 0)&&(g.command===void 0||P.is(g.command))&&(g.isPreferred===void 0||I.boolean(g.isPreferred))&&(g.edit===void 0||ur.is(g.edit))}T.is=D})(wc||(e.CodeAction=wc={}));var Go;(function(T){function w(_,g){var A={range:_};return I.defined(g)&&(A.data=g),A}T.create=w;function D(_){var g=_;return I.defined(g)&&a.is(g.range)&&(I.undefined(g.command)||P.is(g.command))}T.is=D})(Go||(e.CodeLens=Go={}));var Dc;(function(T){function w(_,g){return{tabSize:_,insertSpaces:g}}T.create=w;function D(_){var g=_;return I.defined(g)&&I.uinteger(g.tabSize)&&I.boolean(g.insertSpaces)}T.is=D})(Dc||(e.FormattingOptions=Dc={}));var Hi;(function(T){function w(_,g,A){return{range:_,target:g,data:A}}T.create=w;function D(_){var g=_;return I.defined(g)&&a.is(g.range)&&(I.undefined(g.target)||I.string(g.target))}T.is=D})(Hi||(e.DocumentLink=Hi={}));var E;(function(T){function w(_,g){return{range:_,parent:g}}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&a.is(g.range)&&(g.parent===void 0||T.is(g.parent))}T.is=D})(E||(e.SelectionRange=E={}));var F;(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"})(F||(e.SemanticTokenTypes=F={}));var G;(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"})(G||(e.SemanticTokenModifiers=G={}));var re;(function(T){function w(D){var _=D;return I.objectLiteral(_)&&(_.resultId===void 0||typeof _.resultId=="string")&&Array.isArray(_.data)&&(_.data.length===0||typeof _.data[0]=="number")}T.is=w})(re||(e.SemanticTokens=re={}));var st;(function(T){function w(_,g){return{range:_,text:g}}T.create=w;function D(_){var g=_;return g!=null&&a.is(g.range)&&I.string(g.text)}T.is=D})(st||(e.InlineValueText=st={}));var tt;(function(T){function w(_,g,A){return{range:_,variableName:g,caseSensitiveLookup:A}}T.create=w;function D(_){var g=_;return g!=null&&a.is(g.range)&&I.boolean(g.caseSensitiveLookup)&&(I.string(g.variableName)||g.variableName===void 0)}T.is=D})(tt||(e.InlineValueVariableLookup=tt={}));var bt;(function(T){function w(_,g){return{range:_,expression:g}}T.create=w;function D(_){var g=_;return g!=null&&a.is(g.range)&&(I.string(g.expression)||g.expression===void 0)}T.is=D})(bt||(e.InlineValueEvaluatableExpression=bt={}));var Nt;(function(T){function w(_,g){return{frameId:_,stoppedLocation:g}}T.create=w;function D(_){var g=_;return I.defined(g)&&a.is(_.stoppedLocation)}T.is=D})(Nt||(e.InlineValueContext=Nt={}));var Oe;(function(T){T.Type=1,T.Parameter=2;function w(D){return D===1||D===2}T.is=w})(Oe||(e.InlayHintKind=Oe={}));var lt;(function(T){function w(_){return{value:_}}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&(g.tooltip===void 0||I.string(g.tooltip)||ro.is(g.tooltip))&&(g.location===void 0||c.is(g.location))&&(g.command===void 0||P.is(g.command))}T.is=D})(lt||(e.InlayHintLabelPart=lt={}));var Ke;(function(T){function w(_,g,A){var B={position:_,label:g};return A!==void 0&&(B.kind=A),B}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&o.is(g.position)&&(I.string(g.label)||I.typedArray(g.label,lt.is))&&(g.kind===void 0||Oe.is(g.kind))&&g.textEdits===void 0||I.typedArray(g.textEdits,N.is)&&(g.tooltip===void 0||I.string(g.tooltip)||ro.is(g.tooltip))&&(g.paddingLeft===void 0||I.boolean(g.paddingLeft))&&(g.paddingRight===void 0||I.boolean(g.paddingRight))}T.is=D})(Ke||(e.InlayHint=Ke={}));var Ot;(function(T){function w(D){return{kind:"snippet",value:D}}T.createSnippet=w})(Ot||(e.StringValue=Ot={}));var tr;(function(T){function w(D,_,g,A){return{insertText:D,filterText:_,range:g,command:A}}T.create=w})(tr||(e.InlineCompletionItem=tr={}));var mn;(function(T){function w(D){return{items:D}}T.create=w})(mn||(e.InlineCompletionList=mn={}));var _d;(function(T){T.Invoked=0,T.Automatic=1})(_d||(e.InlineCompletionTriggerKind=_d={}));var tk;(function(T){function w(D,_){return{range:D,text:_}}T.create=w})(tk||(e.SelectedCompletionInfo=tk={}));var rk;(function(T){function w(D,_){return{triggerKind:D,selectedCompletionInfo:_}}T.create=w})(rk||(e.InlineCompletionContext=rk={}));var nk;(function(T){function w(D){var _=D;return I.objectLiteral(_)&&n.is(_.uri)&&I.string(_.name)}T.is=w})(nk||(e.WorkspaceFolder=nk={})),e.EOL=[`
32
+ `)),F){let re=E.error?` Request failed: ${E.error.message} (${E.error.code}).`:"";N.log(`Received response '${F.method} - (${E.id})' in ${Date.now()-F.timerStart}ms.${re}`,G)}else N.log(`Received response ${E.id} without active response promise.`,G)}else Ui("receive-response",E)}function Ui(E,F){if(!N||b===Je.Off)return;let G={isLSPMessage:!0,type:E,message:F,timestamp:Date.now()};N.log(G)}function ls(){if(to())throw new ta(xc.Closed,"Connection is closed.");if(ji())throw new ta(xc.Disposed,"Connection is disposed.")}function bd(){if(kc())throw new ta(xc.AlreadyListening,"Connection is already listening")}function Sd(){if(!kc())throw new Error("Call listen() first.")}function vi(E){return E===void 0?null:E}function Ec(E){if(E!==null)return E}function wc(E){return E!=null&&!Array.isArray(E)&&typeof E=="object"}function Go(E,F){switch(E){case he.ParameterStructures.auto:return wc(F)?Ec(F):[vi(F)];case he.ParameterStructures.byName:if(!wc(F))throw new Error("Received parameters by name but param is not an object literal.");return Ec(F);case he.ParameterStructures.byPosition:return[vi(F)];default:throw new Error(`Unknown parameter structure ${E.toString()}`)}}function Dc(E,F){let G,re=E.numberOfParams;switch(re){case 0:G=void 0;break;case 1:G=Go(E.parameterStructures,F[0]);break;default:G=[];for(let st=0;st<F.length&&st<re;st++)G.push(vi(F[st]));if(F.length<re)for(let st=F.length;st<re;st++)G.push(null);break}return G}let Hi={sendNotification:(E,...F)=>{ls();let G,re;if(Ct.string(E)){G=E;let tt=F[0],bt=0,Nt=he.ParameterStructures.auto;he.ParameterStructures.is(tt)&&(bt=1,Nt=tt);let Oe=F.length,lt=Oe-bt;switch(lt){case 0:re=void 0;break;case 1:re=Go(Nt,F[bt]);break;default:if(Nt===he.ParameterStructures.byName)throw new Error(`Received ${lt} parameters for 'by Name' notification parameter structure.`);re=F.slice(bt,Oe).map(Ke=>vi(Ke));break}}else{let tt=F;G=E.method,re=Dc(E,tt)}let st={jsonrpc:c,method:G,params:re};return yd(st),e.write(st).catch(tt=>{throw i.error("Sending notification failed."),tt})},onNotification:(E,F)=>{ls();let G;return Ct.func(E)?d=E:F&&(Ct.string(E)?(G=E,f.set(E,{type:void 0,handler:F})):(G=E.method,f.set(E.method,{type:E,handler:F}))),{dispose:()=>{G!==void 0?f.delete(G):d=void 0}}},onProgress:(E,F,G)=>{if(p.has(F))throw new Error(`Progress handler for token ${F} already registered`);return p.set(F,G),{dispose:()=>{p.delete(F)}}},sendProgress:(E,F,G)=>Hi.sendNotification(Oc.type,{token:F,value:G}),onUnhandledProgress:qe.event,sendRequest:(E,...F)=>{ls(),Sd();let G,re,st;if(Ct.string(E)){G=E;let Oe=F[0],lt=F[F.length-1],Ke=0,Ot=he.ParameterStructures.auto;he.ParameterStructures.is(Oe)&&(Ke=1,Ot=Oe);let tr=F.length;Sy.CancellationToken.is(lt)&&(tr=tr-1,st=lt);let mn=tr-Ke;switch(mn){case 0:re=void 0;break;case 1:re=Go(Ot,F[Ke]);break;default:if(Ot===he.ParameterStructures.byName)throw new Error(`Received ${mn} parameters for 'by Name' request parameter structure.`);re=F.slice(Ke,tr).map(_d=>vi(_d));break}}else{let Oe=F;G=E.method,re=Dc(E,Oe);let lt=E.numberOfParams;st=Sy.CancellationToken.is(Oe[lt])?Oe[lt]:void 0}let tt=s++,bt;st&&(bt=st.onCancellationRequested(()=>{let Oe=Pe.sender.sendCancellation(Hi,tt);return Oe===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${tt}`),Promise.resolve()):Oe.catch(()=>{i.log(`Sending cancellation messages for id ${tt} failed`)})}));let Nt={jsonrpc:c,id:tt,method:G,params:re};return gd(Nt),typeof Pe.sender.enableCancellation=="function"&&Pe.sender.enableCancellation(Nt),new Promise(async(Oe,lt)=>{let Ke=mn=>{Oe(mn),Pe.sender.cleanup(tt),bt?.dispose()},Ot=mn=>{lt(mn),Pe.sender.cleanup(tt),bt?.dispose()},tr={method:G,timerStart:Date.now(),resolve:Ke,reject:Ot};try{await e.write(Nt),y.set(tt,tr)}catch(mn){throw i.error("Sending request failed."),tr.reject(new he.ResponseError(he.ErrorCodes.MessageWriteError,mn.message?mn.message:"Unknown reason")),mn}})},onRequest:(E,F)=>{ls();let G=null;return ky.is(E)?(G=void 0,l=E):Ct.string(E)?(G=null,F!==void 0&&(G=E,u.set(E,{handler:F,type:void 0}))):F!==void 0&&(G=E.method,u.set(E.method,{type:E,handler:F})),{dispose:()=>{G!==null&&(G!==void 0?u.delete(G):l=void 0)}}},hasPendingResponse:()=>y.size>0,trace:async(E,F,G)=>{let re=!1,st=gn.Text;G!==void 0&&(Ct.boolean(G)?re=G:(re=G.sendNotification||!1,st=G.traceFormat||gn.Text)),b=E,P=st,b===Je.Off?N=void 0:N=F,re&&!to()&&!ji()&&await Hi.sendNotification(Ny.type,{value:Je.toString(E)})},onError:j.event,onClose:L.event,onUnhandledNotification:ye.event,onDispose:pe.event,end:()=>{e.end()},dispose:()=>{if(ji())return;$=Xn.Disposed,pe.fire(void 0);let E=new he.ResponseError(he.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let F of y.values())F.reject(E);y=new Map,v=new Map,S=new Set,h=new Rk.LinkedMap,Ct.func(e.dispose)&&e.dispose(),Ct.func(t.dispose)&&t.dispose()},listen:()=>{ls(),bd(),$=Xn.Listening,t.listen(fd)},inspect:()=>{(0,Nk.default)().console.log("inspect")}};return Hi.onNotification(Md.type,E=>{if(b===Je.Off||!N)return;let F=b===Je.Verbose||b===Je.Compact;N.log(E.message,F?E.verbose:void 0)}),Hi.onNotification(Oc.type,E=>{let F=p.get(E.token);F?F(E.value):qe.fire(E)}),Hi}Se.createMessageConnection=zj});var jd=R(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.ProgressType=O.ProgressToken=O.createMessageConnection=O.NullLogger=O.ConnectionOptions=O.ConnectionStrategy=O.AbstractMessageBuffer=O.WriteableStreamMessageWriter=O.AbstractMessageWriter=O.MessageWriter=O.ReadableStreamMessageReader=O.AbstractMessageReader=O.MessageReader=O.SharedArrayReceiverStrategy=O.SharedArraySenderStrategy=O.CancellationToken=O.CancellationTokenSource=O.Emitter=O.Event=O.Disposable=O.LRUCache=O.Touch=O.LinkedMap=O.ParameterStructures=O.NotificationType9=O.NotificationType8=O.NotificationType7=O.NotificationType6=O.NotificationType5=O.NotificationType4=O.NotificationType3=O.NotificationType2=O.NotificationType1=O.NotificationType0=O.NotificationType=O.ErrorCodes=O.ResponseError=O.RequestType9=O.RequestType8=O.RequestType7=O.RequestType6=O.RequestType5=O.RequestType4=O.RequestType3=O.RequestType2=O.RequestType1=O.RequestType0=O.RequestType=O.Message=O.RAL=void 0;O.MessageStrategy=O.CancellationStrategy=O.CancellationSenderStrategy=O.CancellationReceiverStrategy=O.ConnectionError=O.ConnectionErrors=O.LogTraceNotification=O.SetTraceNotification=O.TraceFormat=O.TraceValues=O.Trace=void 0;var Tt=Zg();Object.defineProperty(O,"Message",{enumerable:!0,get:function(){return Tt.Message}});Object.defineProperty(O,"RequestType",{enumerable:!0,get:function(){return Tt.RequestType}});Object.defineProperty(O,"RequestType0",{enumerable:!0,get:function(){return Tt.RequestType0}});Object.defineProperty(O,"RequestType1",{enumerable:!0,get:function(){return Tt.RequestType1}});Object.defineProperty(O,"RequestType2",{enumerable:!0,get:function(){return Tt.RequestType2}});Object.defineProperty(O,"RequestType3",{enumerable:!0,get:function(){return Tt.RequestType3}});Object.defineProperty(O,"RequestType4",{enumerable:!0,get:function(){return Tt.RequestType4}});Object.defineProperty(O,"RequestType5",{enumerable:!0,get:function(){return Tt.RequestType5}});Object.defineProperty(O,"RequestType6",{enumerable:!0,get:function(){return Tt.RequestType6}});Object.defineProperty(O,"RequestType7",{enumerable:!0,get:function(){return Tt.RequestType7}});Object.defineProperty(O,"RequestType8",{enumerable:!0,get:function(){return Tt.RequestType8}});Object.defineProperty(O,"RequestType9",{enumerable:!0,get:function(){return Tt.RequestType9}});Object.defineProperty(O,"ResponseError",{enumerable:!0,get:function(){return Tt.ResponseError}});Object.defineProperty(O,"ErrorCodes",{enumerable:!0,get:function(){return Tt.ErrorCodes}});Object.defineProperty(O,"NotificationType",{enumerable:!0,get:function(){return Tt.NotificationType}});Object.defineProperty(O,"NotificationType0",{enumerable:!0,get:function(){return Tt.NotificationType0}});Object.defineProperty(O,"NotificationType1",{enumerable:!0,get:function(){return Tt.NotificationType1}});Object.defineProperty(O,"NotificationType2",{enumerable:!0,get:function(){return Tt.NotificationType2}});Object.defineProperty(O,"NotificationType3",{enumerable:!0,get:function(){return Tt.NotificationType3}});Object.defineProperty(O,"NotificationType4",{enumerable:!0,get:function(){return Tt.NotificationType4}});Object.defineProperty(O,"NotificationType5",{enumerable:!0,get:function(){return Tt.NotificationType5}});Object.defineProperty(O,"NotificationType6",{enumerable:!0,get:function(){return Tt.NotificationType6}});Object.defineProperty(O,"NotificationType7",{enumerable:!0,get:function(){return Tt.NotificationType7}});Object.defineProperty(O,"NotificationType8",{enumerable:!0,get:function(){return Tt.NotificationType8}});Object.defineProperty(O,"NotificationType9",{enumerable:!0,get:function(){return Tt.NotificationType9}});Object.defineProperty(O,"ParameterStructures",{enumerable:!0,get:function(){return Tt.ParameterStructures}});var wy=ty();Object.defineProperty(O,"LinkedMap",{enumerable:!0,get:function(){return wy.LinkedMap}});Object.defineProperty(O,"LRUCache",{enumerable:!0,get:function(){return wy.LRUCache}});Object.defineProperty(O,"Touch",{enumerable:!0,get:function(){return wy.Touch}});var Gj=hk();Object.defineProperty(O,"Disposable",{enumerable:!0,get:function(){return Gj.Disposable}});var Ck=Jo();Object.defineProperty(O,"Event",{enumerable:!0,get:function(){return Ck.Event}});Object.defineProperty(O,"Emitter",{enumerable:!0,get:function(){return Ck.Emitter}});var Ak=Cd();Object.defineProperty(O,"CancellationTokenSource",{enumerable:!0,get:function(){return Ak.CancellationTokenSource}});Object.defineProperty(O,"CancellationToken",{enumerable:!0,get:function(){return Ak.CancellationToken}});var Ik=gk();Object.defineProperty(O,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return Ik.SharedArraySenderStrategy}});Object.defineProperty(O,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return Ik.SharedArrayReceiverStrategy}});var Dy=Tk();Object.defineProperty(O,"MessageReader",{enumerable:!0,get:function(){return Dy.MessageReader}});Object.defineProperty(O,"AbstractMessageReader",{enumerable:!0,get:function(){return Dy.AbstractMessageReader}});Object.defineProperty(O,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return Dy.ReadableStreamMessageReader}});var Cy=Pk();Object.defineProperty(O,"MessageWriter",{enumerable:!0,get:function(){return Cy.MessageWriter}});Object.defineProperty(O,"AbstractMessageWriter",{enumerable:!0,get:function(){return Cy.AbstractMessageWriter}});Object.defineProperty(O,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return Cy.WriteableStreamMessageWriter}});var Yj=kk();Object.defineProperty(O,"AbstractMessageBuffer",{enumerable:!0,get:function(){return Yj.AbstractMessageBuffer}});var dr=Dk();Object.defineProperty(O,"ConnectionStrategy",{enumerable:!0,get:function(){return dr.ConnectionStrategy}});Object.defineProperty(O,"ConnectionOptions",{enumerable:!0,get:function(){return dr.ConnectionOptions}});Object.defineProperty(O,"NullLogger",{enumerable:!0,get:function(){return dr.NullLogger}});Object.defineProperty(O,"createMessageConnection",{enumerable:!0,get:function(){return dr.createMessageConnection}});Object.defineProperty(O,"ProgressToken",{enumerable:!0,get:function(){return dr.ProgressToken}});Object.defineProperty(O,"ProgressType",{enumerable:!0,get:function(){return dr.ProgressType}});Object.defineProperty(O,"Trace",{enumerable:!0,get:function(){return dr.Trace}});Object.defineProperty(O,"TraceValues",{enumerable:!0,get:function(){return dr.TraceValues}});Object.defineProperty(O,"TraceFormat",{enumerable:!0,get:function(){return dr.TraceFormat}});Object.defineProperty(O,"SetTraceNotification",{enumerable:!0,get:function(){return dr.SetTraceNotification}});Object.defineProperty(O,"LogTraceNotification",{enumerable:!0,get:function(){return dr.LogTraceNotification}});Object.defineProperty(O,"ConnectionErrors",{enumerable:!0,get:function(){return dr.ConnectionErrors}});Object.defineProperty(O,"ConnectionError",{enumerable:!0,get:function(){return dr.ConnectionError}});Object.defineProperty(O,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return dr.CancellationReceiverStrategy}});Object.defineProperty(O,"CancellationSenderStrategy",{enumerable:!0,get:function(){return dr.CancellationSenderStrategy}});Object.defineProperty(O,"CancellationStrategy",{enumerable:!0,get:function(){return dr.CancellationStrategy}});Object.defineProperty(O,"MessageStrategy",{enumerable:!0,get:function(){return dr.MessageStrategy}});var Kj=ds();O.RAL=Kj.default});var Mk=R(xy=>{"use strict";Object.defineProperty(xy,"__esModule",{value:!0});var Ok=require("util"),Wi=jd(),Ud=class t extends Wi.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return t.emptyBuffer}fromString(e,r){return Buffer.from(e,r)}toString(e,r){return e instanceof Buffer?e.toString(r):new Ok.TextDecoder(r).decode(e)}asNative(e,r){return r===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,r):Buffer.from(e,0,r)}allocNative(e){return Buffer.allocUnsafe(e)}};Ud.emptyBuffer=Buffer.allocUnsafe(0);var Ay=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),Wi.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),Wi.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),Wi.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),Wi.Disposable.create(()=>this.stream.off("data",e))}},Iy=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),Wi.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),Wi.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),Wi.Disposable.create(()=>this.stream.off("end",e))}write(e,r){return new Promise((n,i)=>{let s=o=>{o==null?n():i(o)};typeof e=="string"?this.stream.write(e,r,s):this.stream.write(e,s)})}end(){this.stream.end()}},xk=Object.freeze({messageBuffer:Object.freeze({create:t=>new Ud(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(t,e)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(t,void 0,0),e.charset))}catch(r){return Promise.reject(r)}}}),decoder:Object.freeze({name:"application/json",decode:(t,e)=>{try{return t instanceof Buffer?Promise.resolve(JSON.parse(t.toString(e.charset))):Promise.resolve(JSON.parse(new Ok.TextDecoder(e.charset).decode(t)))}catch(r){return Promise.reject(r)}}})}),stream:Object.freeze({asReadableStream:t=>new Ay(t),asWritableStream:t=>new Iy(t)}),console,timer:Object.freeze({setTimeout(t,e,...r){let n=setTimeout(t,e,...r);return{dispose:()=>clearTimeout(n)}},setImmediate(t,...e){let r=setImmediate(t,...e);return{dispose:()=>clearImmediate(r)}},setInterval(t,e,...r){let n=setInterval(t,e,...r);return{dispose:()=>clearInterval(n)}}})});function Oy(){return xk}(function(t){function e(){Wi.RAL.install(xk)}t.install=e})(Oy||(Oy={}));xy.default=Oy});var ao=R(Fe=>{"use strict";var Xj=Fe&&Fe.__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]})),Jj=Fe&&Fe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Xj(e,t,r)};Object.defineProperty(Fe,"__esModule",{value:!0});Fe.createMessageConnection=Fe.createServerSocketTransport=Fe.createClientSocketTransport=Fe.createServerPipeTransport=Fe.createClientPipeTransport=Fe.generateRandomPipeName=Fe.StreamMessageWriter=Fe.StreamMessageReader=Fe.SocketMessageWriter=Fe.SocketMessageReader=Fe.PortMessageWriter=Fe.PortMessageReader=Fe.IPCMessageWriter=Fe.IPCMessageReader=void 0;var ra=Mk();ra.default.install();var Lk=require("path"),Qj=require("os"),Zj=require("crypto"),Wd=require("net"),yn=jd();Jj(jd(),Fe);var My=class extends yn.AbstractMessageReader{constructor(e){super(),this.process=e;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose())}listen(e){return this.process.on("message",e),yn.Disposable.create(()=>this.process.off("message",e))}};Fe.IPCMessageReader=My;var Ly=class extends yn.AbstractMessageWriter{constructor(e){super(),this.process=e,this.errorCount=0;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose)}write(e){try{return typeof this.process.send=="function"&&this.process.send(e,void 0,void 0,r=>{r?(this.errorCount++,this.handleError(r,e)):this.errorCount=0}),Promise.resolve()}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){}};Fe.IPCMessageWriter=Ly;var qy=class extends yn.AbstractMessageReader{constructor(e){super(),this.onData=new yn.Emitter,e.on("close",()=>this.fireClose),e.on("error",r=>this.fireError(r)),e.on("message",r=>{this.onData.fire(r)})}listen(e){return this.onData.event(e)}};Fe.PortMessageReader=qy;var $y=class extends yn.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.on("close",()=>this.fireClose()),e.on("error",r=>this.fireError(r))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){}};Fe.PortMessageWriter=$y;var so=class extends yn.ReadableStreamMessageReader{constructor(e,r="utf-8"){super((0,ra.default)().stream.asReadableStream(e),r)}};Fe.SocketMessageReader=so;var oo=class extends yn.WriteableStreamMessageWriter{constructor(e,r){super((0,ra.default)().stream.asWritableStream(e),r),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};Fe.SocketMessageWriter=oo;var Hd=class extends yn.ReadableStreamMessageReader{constructor(e,r){super((0,ra.default)().stream.asReadableStream(e),r)}};Fe.StreamMessageReader=Hd;var Vd=class extends yn.WriteableStreamMessageWriter{constructor(e,r){super((0,ra.default)().stream.asWritableStream(e),r)}};Fe.StreamMessageWriter=Vd;var qk=process.env.XDG_RUNTIME_DIR,eU=new Map([["linux",107],["darwin",103]]);function tU(){let t=(0,Zj.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${t}-sock`;let e;qk?e=Lk.join(qk,`vscode-ipc-${t}.sock`):e=Lk.join(Qj.tmpdir(),`vscode-${t}.sock`);let r=eU.get(process.platform);return r!==void 0&&e.length>r&&(0,ra.default)().console.warn(`WARNING: IPC handle "${e}" is longer than ${r} characters.`),e}Fe.generateRandomPipeName=tU;function rU(t,e="utf-8"){let r,n=new Promise((i,s)=>{r=i});return new Promise((i,s)=>{let o=(0,Wd.createServer)(a=>{o.close(),r([new so(a,e),new oo(a,e)])});o.on("error",s),o.listen(t,()=>{o.removeListener("error",s),i({onConnected:()=>n})})})}Fe.createClientPipeTransport=rU;function nU(t,e="utf-8"){let r=(0,Wd.createConnection)(t);return[new so(r,e),new oo(r,e)]}Fe.createServerPipeTransport=nU;function iU(t,e="utf-8"){let r,n=new Promise((i,s)=>{r=i});return new Promise((i,s)=>{let o=(0,Wd.createServer)(a=>{o.close(),r([new so(a,e),new oo(a,e)])});o.on("error",s),o.listen(t,"127.0.0.1",()=>{o.removeListener("error",s),i({onConnected:()=>n})})})}Fe.createClientSocketTransport=iU;function sU(t,e="utf-8"){let r=(0,Wd.createConnection)(t,"127.0.0.1");return[new so(r,e),new oo(r,e)]}Fe.createServerSocketTransport=sU;function oU(t){let e=t;return e.read!==void 0&&e.addListener!==void 0}function aU(t){let e=t;return e.write!==void 0&&e.addListener!==void 0}function cU(t,e,r,n){r||(r=yn.NullLogger);let i=oU(t)?new Hd(t):t,s=aU(e)?new Vd(e):e;return yn.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,yn.createMessageConnection)(i,s,r,n)}Fe.createMessageConnection=cU});var Fy=R((yZ,$k)=>{"use strict";$k.exports=ao()});var Gd=R((Fk,zd)=>{(function(t){if(typeof zd=="object"&&typeof zd.exports=="object"){var e=t(require,Fk);e!==void 0&&(zd.exports=e)}else typeof define=="function"&&define.amd&&define(["require","exports"],t)})(function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TextDocument=e.EOL=e.WorkspaceFolder=e.InlineCompletionContext=e.SelectedCompletionInfo=e.InlineCompletionTriggerKind=e.InlineCompletionList=e.InlineCompletionItem=e.StringValue=e.InlayHint=e.InlayHintLabelPart=e.InlayHintKind=e.InlineValueContext=e.InlineValueEvaluatableExpression=e.InlineValueVariableLookup=e.InlineValueText=e.SemanticTokens=e.SemanticTokenModifiers=e.SemanticTokenTypes=e.SelectionRange=e.DocumentLink=e.FormattingOptions=e.CodeLens=e.CodeAction=e.CodeActionContext=e.CodeActionTriggerKind=e.CodeActionKind=e.DocumentSymbol=e.WorkspaceSymbol=e.SymbolInformation=e.SymbolTag=e.SymbolKind=e.DocumentHighlight=e.DocumentHighlightKind=e.SignatureInformation=e.ParameterInformation=e.Hover=e.MarkedString=e.CompletionList=e.CompletionItem=e.CompletionItemLabelDetails=e.InsertTextMode=e.InsertReplaceEdit=e.CompletionItemTag=e.InsertTextFormat=e.CompletionItemKind=e.MarkupContent=e.MarkupKind=e.TextDocumentItem=e.OptionalVersionedTextDocumentIdentifier=e.VersionedTextDocumentIdentifier=e.TextDocumentIdentifier=e.WorkspaceChange=e.WorkspaceEdit=e.DeleteFile=e.RenameFile=e.CreateFile=e.TextDocumentEdit=e.AnnotatedTextEdit=e.ChangeAnnotationIdentifier=e.ChangeAnnotation=e.TextEdit=e.Command=e.Diagnostic=e.CodeDescription=e.DiagnosticTag=e.DiagnosticSeverity=e.DiagnosticRelatedInformation=e.FoldingRange=e.FoldingRangeKind=e.ColorPresentation=e.ColorInformation=e.Color=e.LocationLink=e.Location=e.Range=e.Position=e.uinteger=e.integer=e.URI=e.DocumentUri=void 0;var r;(function(T){function w(D){return typeof D=="string"}T.is=w})(r||(e.DocumentUri=r={}));var n;(function(T){function w(D){return typeof D=="string"}T.is=w})(n||(e.URI=n={}));var i;(function(T){T.MIN_VALUE=-2147483648,T.MAX_VALUE=2147483647;function w(D){return typeof D=="number"&&T.MIN_VALUE<=D&&D<=T.MAX_VALUE}T.is=w})(i||(e.integer=i={}));var s;(function(T){T.MIN_VALUE=0,T.MAX_VALUE=2147483647;function w(D){return typeof D=="number"&&T.MIN_VALUE<=D&&D<=T.MAX_VALUE}T.is=w})(s||(e.uinteger=s={}));var o;(function(T){function w(_,g){return _===Number.MAX_VALUE&&(_=s.MAX_VALUE),g===Number.MAX_VALUE&&(g=s.MAX_VALUE),{line:_,character:g}}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&I.uinteger(g.line)&&I.uinteger(g.character)}T.is=D})(o||(e.Position=o={}));var a;(function(T){function w(_,g,A,B){if(I.uinteger(_)&&I.uinteger(g)&&I.uinteger(A)&&I.uinteger(B))return{start:o.create(_,g),end:o.create(A,B)};if(o.is(_)&&o.is(g))return{start:_,end:g};throw new Error("Range#create called with invalid arguments[".concat(_,", ").concat(g,", ").concat(A,", ").concat(B,"]"))}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&o.is(g.start)&&o.is(g.end)}T.is=D})(a||(e.Range=a={}));var c;(function(T){function w(_,g){return{uri:_,range:g}}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&a.is(g.range)&&(I.string(g.uri)||I.undefined(g.uri))}T.is=D})(c||(e.Location=c={}));var l;(function(T){function w(_,g,A,B){return{targetUri:_,targetRange:g,targetSelectionRange:A,originSelectionRange:B}}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&a.is(g.targetRange)&&I.string(g.targetUri)&&a.is(g.targetSelectionRange)&&(a.is(g.originSelectionRange)||I.undefined(g.originSelectionRange))}T.is=D})(l||(e.LocationLink=l={}));var u;(function(T){function w(_,g,A,B){return{red:_,green:g,blue:A,alpha:B}}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&I.numberRange(g.red,0,1)&&I.numberRange(g.green,0,1)&&I.numberRange(g.blue,0,1)&&I.numberRange(g.alpha,0,1)}T.is=D})(u||(e.Color=u={}));var d;(function(T){function w(_,g){return{range:_,color:g}}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&a.is(g.range)&&u.is(g.color)}T.is=D})(d||(e.ColorInformation=d={}));var f;(function(T){function w(_,g,A){return{label:_,textEdit:g,additionalTextEdits:A}}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&I.string(g.label)&&(I.undefined(g.textEdit)||N.is(g))&&(I.undefined(g.additionalTextEdits)||I.typedArray(g.additionalTextEdits,N.is))}T.is=D})(f||(e.ColorPresentation=f={}));var p;(function(T){T.Comment="comment",T.Imports="imports",T.Region="region"})(p||(e.FoldingRangeKind=p={}));var m;(function(T){function w(_,g,A,B,be,xt){var yt={startLine:_,endLine:g};return I.defined(A)&&(yt.startCharacter=A),I.defined(B)&&(yt.endCharacter=B),I.defined(be)&&(yt.kind=be),I.defined(xt)&&(yt.collapsedText=xt),yt}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&I.uinteger(g.startLine)&&I.uinteger(g.startLine)&&(I.undefined(g.startCharacter)||I.uinteger(g.startCharacter))&&(I.undefined(g.endCharacter)||I.uinteger(g.endCharacter))&&(I.undefined(g.kind)||I.string(g.kind))}T.is=D})(m||(e.FoldingRange=m={}));var h;(function(T){function w(_,g){return{location:_,message:g}}T.create=w;function D(_){var g=_;return I.defined(g)&&c.is(g.location)&&I.string(g.message)}T.is=D})(h||(e.DiagnosticRelatedInformation=h={}));var y;(function(T){T.Error=1,T.Warning=2,T.Information=3,T.Hint=4})(y||(e.DiagnosticSeverity=y={}));var S;(function(T){T.Unnecessary=1,T.Deprecated=2})(S||(e.DiagnosticTag=S={}));var v;(function(T){function w(D){var _=D;return I.objectLiteral(_)&&I.string(_.href)}T.is=w})(v||(e.CodeDescription=v={}));var b;(function(T){function w(_,g,A,B,be,xt){var yt={range:_,message:g};return I.defined(A)&&(yt.severity=A),I.defined(B)&&(yt.code=B),I.defined(be)&&(yt.source=be),I.defined(xt)&&(yt.relatedInformation=xt),yt}T.create=w;function D(_){var g,A=_;return I.defined(A)&&a.is(A.range)&&I.string(A.message)&&(I.number(A.severity)||I.undefined(A.severity))&&(I.integer(A.code)||I.string(A.code)||I.undefined(A.code))&&(I.undefined(A.codeDescription)||I.string((g=A.codeDescription)===null||g===void 0?void 0:g.href))&&(I.string(A.source)||I.undefined(A.source))&&(I.undefined(A.relatedInformation)||I.typedArray(A.relatedInformation,h.is))}T.is=D})(b||(e.Diagnostic=b={}));var P;(function(T){function w(_,g){for(var A=[],B=2;B<arguments.length;B++)A[B-2]=arguments[B];var be={title:_,command:g};return I.defined(A)&&A.length>0&&(be.arguments=A),be}T.create=w;function D(_){var g=_;return I.defined(g)&&I.string(g.title)&&I.string(g.command)}T.is=D})(P||(e.Command=P={}));var N;(function(T){function w(A,B){return{range:A,newText:B}}T.replace=w;function D(A,B){return{range:{start:A,end:A},newText:B}}T.insert=D;function _(A){return{range:A,newText:""}}T.del=_;function g(A){var B=A;return I.objectLiteral(B)&&I.string(B.newText)&&a.is(B.range)}T.is=g})(N||(e.TextEdit=N={}));var $;(function(T){function w(_,g,A){var B={label:_};return g!==void 0&&(B.needsConfirmation=g),A!==void 0&&(B.description=A),B}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&I.string(g.label)&&(I.boolean(g.needsConfirmation)||g.needsConfirmation===void 0)&&(I.string(g.description)||g.description===void 0)}T.is=D})($||(e.ChangeAnnotation=$={}));var j;(function(T){function w(D){var _=D;return I.string(_)}T.is=w})(j||(e.ChangeAnnotationIdentifier=j={}));var L;(function(T){function w(A,B,be){return{range:A,newText:B,annotationId:be}}T.replace=w;function D(A,B,be){return{range:{start:A,end:A},newText:B,annotationId:be}}T.insert=D;function _(A,B){return{range:A,newText:"",annotationId:B}}T.del=_;function g(A){var B=A;return N.is(B)&&($.is(B.annotationId)||j.is(B.annotationId))}T.is=g})(L||(e.AnnotatedTextEdit=L={}));var ye;(function(T){function w(_,g){return{textDocument:_,edits:g}}T.create=w;function D(_){var g=_;return I.defined(g)&&to.is(g.textDocument)&&Array.isArray(g.edits)}T.is=D})(ye||(e.TextDocumentEdit=ye={}));var qe;(function(T){function w(_,g,A){var B={kind:"create",uri:_};return g!==void 0&&(g.overwrite!==void 0||g.ignoreIfExists!==void 0)&&(B.options=g),A!==void 0&&(B.annotationId=A),B}T.create=w;function D(_){var g=_;return g&&g.kind==="create"&&I.string(g.uri)&&(g.options===void 0||(g.options.overwrite===void 0||I.boolean(g.options.overwrite))&&(g.options.ignoreIfExists===void 0||I.boolean(g.options.ignoreIfExists)))&&(g.annotationId===void 0||j.is(g.annotationId))}T.is=D})(qe||(e.CreateFile=qe={}));var pe;(function(T){function w(_,g,A,B){var be={kind:"rename",oldUri:_,newUri:g};return A!==void 0&&(A.overwrite!==void 0||A.ignoreIfExists!==void 0)&&(be.options=A),B!==void 0&&(be.annotationId=B),be}T.create=w;function D(_){var g=_;return g&&g.kind==="rename"&&I.string(g.oldUri)&&I.string(g.newUri)&&(g.options===void 0||(g.options.overwrite===void 0||I.boolean(g.options.overwrite))&&(g.options.ignoreIfExists===void 0||I.boolean(g.options.ignoreIfExists)))&&(g.annotationId===void 0||j.is(g.annotationId))}T.is=D})(pe||(e.RenameFile=pe={}));var Pe;(function(T){function w(_,g,A){var B={kind:"delete",uri:_};return g!==void 0&&(g.recursive!==void 0||g.ignoreIfNotExists!==void 0)&&(B.options=g),A!==void 0&&(B.annotationId=A),B}T.create=w;function D(_){var g=_;return g&&g.kind==="delete"&&I.string(g.uri)&&(g.options===void 0||(g.options.recursive===void 0||I.boolean(g.options.recursive))&&(g.options.ignoreIfNotExists===void 0||I.boolean(g.options.ignoreIfNotExists)))&&(g.annotationId===void 0||j.is(g.annotationId))}T.is=D})(Pe||(e.DeleteFile=Pe={}));var ur;(function(T){function w(D){var _=D;return _&&(_.changes!==void 0||_.documentChanges!==void 0)&&(_.documentChanges===void 0||_.documentChanges.every(function(g){return I.string(g.kind)?qe.is(g)||pe.is(g)||Pe.is(g):ye.is(g)}))}T.is=w})(ur||(e.WorkspaceEdit=ur={}));var _r=(function(){function T(w,D){this.edits=w,this.changeAnnotations=D}return T.prototype.insert=function(w,D,_){var g,A;if(_===void 0?g=N.insert(w,D):j.is(_)?(A=_,g=L.insert(w,D,_)):(this.assertChangeAnnotations(this.changeAnnotations),A=this.changeAnnotations.manage(_),g=L.insert(w,D,A)),this.edits.push(g),A!==void 0)return A},T.prototype.replace=function(w,D,_){var g,A;if(_===void 0?g=N.replace(w,D):j.is(_)?(A=_,g=L.replace(w,D,_)):(this.assertChangeAnnotations(this.changeAnnotations),A=this.changeAnnotations.manage(_),g=L.replace(w,D,A)),this.edits.push(g),A!==void 0)return A},T.prototype.delete=function(w,D){var _,g;if(D===void 0?_=N.del(w):j.is(D)?(g=D,_=L.del(w,D)):(this.assertChangeAnnotations(this.changeAnnotations),g=this.changeAnnotations.manage(D),_=L.del(w,g)),this.edits.push(_),g!==void 0)return g},T.prototype.add=function(w){this.edits.push(w)},T.prototype.all=function(){return this.edits},T.prototype.clear=function(){this.edits.splice(0,this.edits.length)},T.prototype.assertChangeAnnotations=function(w){if(w===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},T})(),cd=(function(){function T(w){this._annotations=w===void 0?Object.create(null):w,this._counter=0,this._size=0}return T.prototype.all=function(){return this._annotations},Object.defineProperty(T.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),T.prototype.manage=function(w,D){var _;if(j.is(w)?_=w:(_=this.nextId(),D=w),this._annotations[_]!==void 0)throw new Error("Id ".concat(_," is already in use."));if(D===void 0)throw new Error("No annotation provided for id ".concat(_));return this._annotations[_]=D,this._size++,_},T.prototype.nextId=function(){return this._counter++,this._counter.toString()},T})(),Eg=(function(){function T(w){var D=this;this._textEditChanges=Object.create(null),w!==void 0?(this._workspaceEdit=w,w.documentChanges?(this._changeAnnotations=new cd(w.changeAnnotations),w.changeAnnotations=this._changeAnnotations.all(),w.documentChanges.forEach(function(_){if(ye.is(_)){var g=new _r(_.edits,D._changeAnnotations);D._textEditChanges[_.textDocument.uri]=g}})):w.changes&&Object.keys(w.changes).forEach(function(_){var g=new _r(w.changes[_]);D._textEditChanges[_]=g})):this._workspaceEdit={}}return Object.defineProperty(T.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),T.prototype.getTextEditChange=function(w){if(to.is(w)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var D={uri:w.uri,version:w.version},_=this._textEditChanges[D.uri];if(!_){var g=[],A={textDocument:D,edits:g};this._workspaceEdit.documentChanges.push(A),_=new _r(g,this._changeAnnotations),this._textEditChanges[D.uri]=_}return _}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var _=this._textEditChanges[w];if(!_){var g=[];this._workspaceEdit.changes[w]=g,_=new _r(g),this._textEditChanges[w]=_}return _}},T.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new cd,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},T.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},T.prototype.createFile=function(w,D,_){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;$.is(D)||j.is(D)?g=D:_=D;var A,B;if(g===void 0?A=qe.create(w,_):(B=j.is(g)?g:this._changeAnnotations.manage(g),A=qe.create(w,_,B)),this._workspaceEdit.documentChanges.push(A),B!==void 0)return B},T.prototype.renameFile=function(w,D,_,g){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var A;$.is(_)||j.is(_)?A=_:g=_;var B,be;if(A===void 0?B=pe.create(w,D,g):(be=j.is(A)?A:this._changeAnnotations.manage(A),B=pe.create(w,D,g,be)),this._workspaceEdit.documentChanges.push(B),be!==void 0)return be},T.prototype.deleteFile=function(w,D,_){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;$.is(D)||j.is(D)?g=D:_=D;var A,B;if(g===void 0?A=Pe.create(w,_):(B=j.is(g)?g:this._changeAnnotations.manage(g),A=Pe.create(w,_,B)),this._workspaceEdit.documentChanges.push(A),B!==void 0)return B},T})();e.WorkspaceChange=Eg;var ld;(function(T){function w(_){return{uri:_}}T.create=w;function D(_){var g=_;return I.defined(g)&&I.string(g.uri)}T.is=D})(ld||(e.TextDocumentIdentifier=ld={}));var kc;(function(T){function w(_,g){return{uri:_,version:g}}T.create=w;function D(_){var g=_;return I.defined(g)&&I.string(g.uri)&&I.integer(g.version)}T.is=D})(kc||(e.VersionedTextDocumentIdentifier=kc={}));var to;(function(T){function w(_,g){return{uri:_,version:g}}T.create=w;function D(_){var g=_;return I.defined(g)&&I.string(g.uri)&&(g.version===null||I.integer(g.version))}T.is=D})(to||(e.OptionalVersionedTextDocumentIdentifier=to={}));var ji;(function(T){function w(_,g,A,B){return{uri:_,languageId:g,version:A,text:B}}T.create=w;function D(_){var g=_;return I.defined(g)&&I.string(g.uri)&&I.string(g.languageId)&&I.integer(g.version)&&I.string(g.text)}T.is=D})(ji||(e.TextDocumentItem=ji={}));var Vo;(function(T){T.PlainText="plaintext",T.Markdown="markdown";function w(D){var _=D;return _===T.PlainText||_===T.Markdown}T.is=w})(Vo||(e.MarkupKind=Vo={}));var ro;(function(T){function w(D){var _=D;return I.objectLiteral(D)&&Vo.is(_.kind)&&I.string(_.value)}T.is=w})(ro||(e.MarkupContent=ro={}));var ud;(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})(ud||(e.CompletionItemKind=ud={}));var Nc;(function(T){T.PlainText=1,T.Snippet=2})(Nc||(e.InsertTextFormat=Nc={}));var Rc;(function(T){T.Deprecated=1})(Rc||(e.CompletionItemTag=Rc={}));var dd;(function(T){function w(_,g,A){return{newText:_,insert:g,replace:A}}T.create=w;function D(_){var g=_;return g&&I.string(g.newText)&&a.is(g.insert)&&a.is(g.replace)}T.is=D})(dd||(e.InsertReplaceEdit=dd={}));var fd;(function(T){T.asIs=1,T.adjustIndentation=2})(fd||(e.InsertTextMode=fd={}));var pd;(function(T){function w(D){var _=D;return _&&(I.string(_.detail)||_.detail===void 0)&&(I.string(_.description)||_.description===void 0)}T.is=w})(pd||(e.CompletionItemLabelDetails=pd={}));var hd;(function(T){function w(D){return{label:D}}T.create=w})(hd||(e.CompletionItem=hd={}));var md;(function(T){function w(D,_){return{items:D||[],isIncomplete:!!_}}T.create=w})(md||(e.CompletionList=md={}));var Wo;(function(T){function w(_){return _.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}T.fromPlainText=w;function D(_){var g=_;return I.string(g)||I.objectLiteral(g)&&I.string(g.language)&&I.string(g.value)}T.is=D})(Wo||(e.MarkedString=Wo={}));var Gn;(function(T){function w(D){var _=D;return!!_&&I.objectLiteral(_)&&(ro.is(_.contents)||Wo.is(_.contents)||I.typedArray(_.contents,Wo.is))&&(D.range===void 0||a.is(D.range))}T.is=w})(Gn||(e.Hover=Gn={}));var gd;(function(T){function w(D,_){return _?{label:D,documentation:_}:{label:D}}T.create=w})(gd||(e.ParameterInformation=gd={}));var yd;(function(T){function w(D,_){for(var g=[],A=2;A<arguments.length;A++)g[A-2]=arguments[A];var B={label:D};return I.defined(_)&&(B.documentation=_),I.defined(g)?B.parameters=g:B.parameters=[],B}T.create=w})(yd||(e.SignatureInformation=yd={}));var no;(function(T){T.Text=1,T.Read=2,T.Write=3})(no||(e.DocumentHighlightKind=no={}));var Td;(function(T){function w(D,_){var g={range:D};return I.number(_)&&(g.kind=_),g}T.create=w})(Td||(e.DocumentHighlight=Td={}));var zo;(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})(zo||(e.SymbolKind=zo={}));var vd;(function(T){T.Deprecated=1})(vd||(e.SymbolTag=vd={}));var Ui;(function(T){function w(D,_,g,A,B){var be={name:D,kind:_,location:{uri:A,range:g}};return B&&(be.containerName=B),be}T.create=w})(Ui||(e.SymbolInformation=Ui={}));var ls;(function(T){function w(D,_,g,A){return A!==void 0?{name:D,kind:_,location:{uri:g,range:A}}:{name:D,kind:_,location:{uri:g}}}T.create=w})(ls||(e.WorkspaceSymbol=ls={}));var bd;(function(T){function w(_,g,A,B,be,xt){var yt={name:_,detail:g,kind:A,range:B,selectionRange:be};return xt!==void 0&&(yt.children=xt),yt}T.create=w;function D(_){var g=_;return g&&I.string(g.name)&&I.number(g.kind)&&a.is(g.range)&&a.is(g.selectionRange)&&(g.detail===void 0||I.string(g.detail))&&(g.deprecated===void 0||I.boolean(g.deprecated))&&(g.children===void 0||Array.isArray(g.children))&&(g.tags===void 0||Array.isArray(g.tags))}T.is=D})(bd||(e.DocumentSymbol=bd={}));var Sd;(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"})(Sd||(e.CodeActionKind=Sd={}));var vi;(function(T){T.Invoked=1,T.Automatic=2})(vi||(e.CodeActionTriggerKind=vi={}));var Ec;(function(T){function w(_,g,A){var B={diagnostics:_};return g!=null&&(B.only=g),A!=null&&(B.triggerKind=A),B}T.create=w;function D(_){var g=_;return I.defined(g)&&I.typedArray(g.diagnostics,b.is)&&(g.only===void 0||I.typedArray(g.only,I.string))&&(g.triggerKind===void 0||g.triggerKind===vi.Invoked||g.triggerKind===vi.Automatic)}T.is=D})(Ec||(e.CodeActionContext=Ec={}));var wc;(function(T){function w(_,g,A){var B={title:_},be=!0;return typeof g=="string"?(be=!1,B.kind=g):P.is(g)?B.command=g:B.edit=g,be&&A!==void 0&&(B.kind=A),B}T.create=w;function D(_){var g=_;return g&&I.string(g.title)&&(g.diagnostics===void 0||I.typedArray(g.diagnostics,b.is))&&(g.kind===void 0||I.string(g.kind))&&(g.edit!==void 0||g.command!==void 0)&&(g.command===void 0||P.is(g.command))&&(g.isPreferred===void 0||I.boolean(g.isPreferred))&&(g.edit===void 0||ur.is(g.edit))}T.is=D})(wc||(e.CodeAction=wc={}));var Go;(function(T){function w(_,g){var A={range:_};return I.defined(g)&&(A.data=g),A}T.create=w;function D(_){var g=_;return I.defined(g)&&a.is(g.range)&&(I.undefined(g.command)||P.is(g.command))}T.is=D})(Go||(e.CodeLens=Go={}));var Dc;(function(T){function w(_,g){return{tabSize:_,insertSpaces:g}}T.create=w;function D(_){var g=_;return I.defined(g)&&I.uinteger(g.tabSize)&&I.boolean(g.insertSpaces)}T.is=D})(Dc||(e.FormattingOptions=Dc={}));var Hi;(function(T){function w(_,g,A){return{range:_,target:g,data:A}}T.create=w;function D(_){var g=_;return I.defined(g)&&a.is(g.range)&&(I.undefined(g.target)||I.string(g.target))}T.is=D})(Hi||(e.DocumentLink=Hi={}));var E;(function(T){function w(_,g){return{range:_,parent:g}}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&a.is(g.range)&&(g.parent===void 0||T.is(g.parent))}T.is=D})(E||(e.SelectionRange=E={}));var F;(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"})(F||(e.SemanticTokenTypes=F={}));var G;(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"})(G||(e.SemanticTokenModifiers=G={}));var re;(function(T){function w(D){var _=D;return I.objectLiteral(_)&&(_.resultId===void 0||typeof _.resultId=="string")&&Array.isArray(_.data)&&(_.data.length===0||typeof _.data[0]=="number")}T.is=w})(re||(e.SemanticTokens=re={}));var st;(function(T){function w(_,g){return{range:_,text:g}}T.create=w;function D(_){var g=_;return g!=null&&a.is(g.range)&&I.string(g.text)}T.is=D})(st||(e.InlineValueText=st={}));var tt;(function(T){function w(_,g,A){return{range:_,variableName:g,caseSensitiveLookup:A}}T.create=w;function D(_){var g=_;return g!=null&&a.is(g.range)&&I.boolean(g.caseSensitiveLookup)&&(I.string(g.variableName)||g.variableName===void 0)}T.is=D})(tt||(e.InlineValueVariableLookup=tt={}));var bt;(function(T){function w(_,g){return{range:_,expression:g}}T.create=w;function D(_){var g=_;return g!=null&&a.is(g.range)&&(I.string(g.expression)||g.expression===void 0)}T.is=D})(bt||(e.InlineValueEvaluatableExpression=bt={}));var Nt;(function(T){function w(_,g){return{frameId:_,stoppedLocation:g}}T.create=w;function D(_){var g=_;return I.defined(g)&&a.is(_.stoppedLocation)}T.is=D})(Nt||(e.InlineValueContext=Nt={}));var Oe;(function(T){T.Type=1,T.Parameter=2;function w(D){return D===1||D===2}T.is=w})(Oe||(e.InlayHintKind=Oe={}));var lt;(function(T){function w(_){return{value:_}}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&(g.tooltip===void 0||I.string(g.tooltip)||ro.is(g.tooltip))&&(g.location===void 0||c.is(g.location))&&(g.command===void 0||P.is(g.command))}T.is=D})(lt||(e.InlayHintLabelPart=lt={}));var Ke;(function(T){function w(_,g,A){var B={position:_,label:g};return A!==void 0&&(B.kind=A),B}T.create=w;function D(_){var g=_;return I.objectLiteral(g)&&o.is(g.position)&&(I.string(g.label)||I.typedArray(g.label,lt.is))&&(g.kind===void 0||Oe.is(g.kind))&&g.textEdits===void 0||I.typedArray(g.textEdits,N.is)&&(g.tooltip===void 0||I.string(g.tooltip)||ro.is(g.tooltip))&&(g.paddingLeft===void 0||I.boolean(g.paddingLeft))&&(g.paddingRight===void 0||I.boolean(g.paddingRight))}T.is=D})(Ke||(e.InlayHint=Ke={}));var Ot;(function(T){function w(D){return{kind:"snippet",value:D}}T.createSnippet=w})(Ot||(e.StringValue=Ot={}));var tr;(function(T){function w(D,_,g,A){return{insertText:D,filterText:_,range:g,command:A}}T.create=w})(tr||(e.InlineCompletionItem=tr={}));var mn;(function(T){function w(D){return{items:D}}T.create=w})(mn||(e.InlineCompletionList=mn={}));var _d;(function(T){T.Invoked=0,T.Automatic=1})(_d||(e.InlineCompletionTriggerKind=_d={}));var tk;(function(T){function w(D,_){return{range:D,text:_}}T.create=w})(tk||(e.SelectedCompletionInfo=tk={}));var rk;(function(T){function w(D,_){return{triggerKind:D,selectedCompletionInfo:_}}T.create=w})(rk||(e.InlineCompletionContext=rk={}));var nk;(function(T){function w(D){var _=D;return I.objectLiteral(_)&&n.is(_.uri)&&I.string(_.name)}T.is=w})(nk||(e.WorkspaceFolder=nk={})),e.EOL=[`
33
33
  `,`\r
34
34
  `,"\r"];var ik;(function(T){function w(A,B,be,xt){return new mj(A,B,be,xt)}T.create=w;function D(A){var B=A;return!!(I.defined(B)&&I.string(B.uri)&&(I.undefined(B.languageId)||I.string(B.languageId))&&I.uinteger(B.lineCount)&&I.func(B.getText)&&I.func(B.positionAt)&&I.func(B.offsetAt))}T.is=D;function _(A,B){for(var be=A.getText(),xt=g(B,function(Yo,Pd){var sk=Yo.range.start.line-Pd.range.start.line;return sk===0?Yo.range.start.character-Pd.range.start.character:sk}),yt=be.length,Yn=xt.length-1;Yn>=0;Yn--){var Kn=xt[Yn],Vi=A.offsetAt(Kn.range.start),$e=A.offsetAt(Kn.range.end);if($e<=yt)be=be.substring(0,Vi)+Kn.newText+be.substring($e,be.length);else throw new Error("Overlapping edit");yt=Vi}return be}T.applyEdits=_;function g(A,B){if(A.length<=1)return A;var be=A.length/2|0,xt=A.slice(0,be),yt=A.slice(be);g(xt,B),g(yt,B);for(var Yn=0,Kn=0,Vi=0;Yn<xt.length&&Kn<yt.length;){var $e=B(xt[Yn],yt[Kn]);$e<=0?A[Vi++]=xt[Yn++]:A[Vi++]=yt[Kn++]}for(;Yn<xt.length;)A[Vi++]=xt[Yn++];for(;Kn<yt.length;)A[Vi++]=yt[Kn++];return A}})(ik||(e.TextDocument=ik={}));var mj=(function(){function T(w,D,_,g){this._uri=w,this._languageId=D,this._version=_,this._content=g,this._lineOffsets=void 0}return Object.defineProperty(T.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),T.prototype.getText=function(w){if(w){var D=this.offsetAt(w.start),_=this.offsetAt(w.end);return this._content.substring(D,_)}return this._content},T.prototype.update=function(w,D){this._content=w.text,this._version=D,this._lineOffsets=void 0},T.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var w=[],D=this._content,_=!0,g=0;g<D.length;g++){_&&(w.push(g),_=!1);var A=D.charAt(g);_=A==="\r"||A===`
35
35
  `,A==="\r"&&g+1<D.length&&D.charAt(g+1)===`
36
- `&&g++}_&&D.length>0&&w.push(D.length),this._lineOffsets=w}return this._lineOffsets},T.prototype.positionAt=function(w){w=Math.max(Math.min(w,this._content.length),0);var D=this.getLineOffsets(),_=0,g=D.length;if(g===0)return o.create(0,w);for(;_<g;){var A=Math.floor((_+g)/2);D[A]>w?g=A:_=A+1}var B=_-1;return o.create(B,w-D[B])},T.prototype.offsetAt=function(w){var D=this.getLineOffsets();if(w.line>=D.length)return this._content.length;if(w.line<0)return 0;var _=D[w.line],g=w.line+1<D.length?D[w.line+1]:this._content.length;return Math.max(Math.min(_+w.character,g),_)},Object.defineProperty(T.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),T})(),I;(function(T){var w=Object.prototype.toString;function D($e){return typeof $e<"u"}T.defined=D;function _($e){return typeof $e>"u"}T.undefined=_;function g($e){return $e===!0||$e===!1}T.boolean=g;function A($e){return w.call($e)==="[object String]"}T.string=A;function B($e){return w.call($e)==="[object Number]"}T.number=B;function be($e,Yo,Pd){return w.call($e)==="[object Number]"&&Yo<=$e&&$e<=Pd}T.numberRange=be;function xt($e){return w.call($e)==="[object Number]"&&-2147483648<=$e&&$e<=2147483647}T.integer=xt;function yt($e){return w.call($e)==="[object Number]"&&0<=$e&&$e<=2147483647}T.uinteger=yt;function Yn($e){return w.call($e)==="[object Function]"}T.func=Yn;function Kn($e){return $e!==null&&typeof $e=="object"}T.objectLiteral=Kn;function Vi($e,Yo){return Array.isArray($e)&&$e.every(Yo)}T.typedArray=Vi})(I||(I={}))})});var Rt=R(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.ProtocolNotificationType=Gr.ProtocolNotificationType0=Gr.ProtocolRequestType=Gr.ProtocolRequestType0=Gr.RegistrationType=Gr.MessageDirection=void 0;var na=ao(),Bk;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(Bk||(Gr.MessageDirection=Bk={}));var By=class{constructor(e){this.method=e}};Gr.RegistrationType=By;var jy=class extends na.RequestType0{constructor(e){super(e)}};Gr.ProtocolRequestType0=jy;var Uy=class extends na.RequestType{constructor(e){super(e,na.ParameterStructures.byName)}};Gr.ProtocolRequestType=Uy;var Hy=class extends na.NotificationType0{constructor(e){super(e)}};Gr.ProtocolNotificationType0=Hy;var Vy=class extends na.NotificationType{constructor(e){super(e,na.ParameterStructures.byName)}};Gr.ProtocolNotificationType=Vy});var Yd=R(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.objectLiteral=zt.typedArray=zt.stringArray=zt.array=zt.func=zt.error=zt.number=zt.string=zt.boolean=void 0;function lU(t){return t===!0||t===!1}zt.boolean=lU;function jk(t){return typeof t=="string"||t instanceof String}zt.string=jk;function uU(t){return typeof t=="number"||t instanceof Number}zt.number=uU;function dU(t){return t instanceof Error}zt.error=dU;function fU(t){return typeof t=="function"}zt.func=fU;function Uk(t){return Array.isArray(t)}zt.array=Uk;function pU(t){return Uk(t)&&t.every(e=>jk(e))}zt.stringArray=pU;function hU(t,e){return Array.isArray(t)&&t.every(e)}zt.typedArray=hU;function mU(t){return t!==null&&typeof t=="object"}zt.objectLiteral=mU});var Wk=R(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.ImplementationRequest=void 0;var Hk=Rt(),Vk;(function(t){t.method="textDocument/implementation",t.messageDirection=Hk.MessageDirection.clientToServer,t.type=new Hk.ProtocolRequestType(t.method)})(Vk||(Kd.ImplementationRequest=Vk={}))});var Yk=R(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});Xd.TypeDefinitionRequest=void 0;var zk=Rt(),Gk;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=zk.MessageDirection.clientToServer,t.type=new zk.ProtocolRequestType(t.method)})(Gk||(Xd.TypeDefinitionRequest=Gk={}))});var Jk=R(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.DidChangeWorkspaceFoldersNotification=ia.WorkspaceFoldersRequest=void 0;var Jd=Rt(),Kk;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=Jd.MessageDirection.serverToClient,t.type=new Jd.ProtocolRequestType0(t.method)})(Kk||(ia.WorkspaceFoldersRequest=Kk={}));var Xk;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=Jd.MessageDirection.clientToServer,t.type=new Jd.ProtocolNotificationType(t.method)})(Xk||(ia.DidChangeWorkspaceFoldersNotification=Xk={}))});var eN=R(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.ConfigurationRequest=void 0;var Qk=Rt(),Zk;(function(t){t.method="workspace/configuration",t.messageDirection=Qk.MessageDirection.serverToClient,t.type=new Qk.ProtocolRequestType(t.method)})(Zk||(Qd.ConfigurationRequest=Zk={}))});var nN=R(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.ColorPresentationRequest=sa.DocumentColorRequest=void 0;var Zd=Rt(),tN;(function(t){t.method="textDocument/documentColor",t.messageDirection=Zd.MessageDirection.clientToServer,t.type=new Zd.ProtocolRequestType(t.method)})(tN||(sa.DocumentColorRequest=tN={}));var rN;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=Zd.MessageDirection.clientToServer,t.type=new Zd.ProtocolRequestType(t.method)})(rN||(sa.ColorPresentationRequest=rN={}))});var oN=R(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.FoldingRangeRefreshRequest=oa.FoldingRangeRequest=void 0;var ef=Rt(),iN;(function(t){t.method="textDocument/foldingRange",t.messageDirection=ef.MessageDirection.clientToServer,t.type=new ef.ProtocolRequestType(t.method)})(iN||(oa.FoldingRangeRequest=iN={}));var sN;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=ef.MessageDirection.serverToClient,t.type=new ef.ProtocolRequestType0(t.method)})(sN||(oa.FoldingRangeRefreshRequest=sN={}))});var lN=R(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});tf.DeclarationRequest=void 0;var aN=Rt(),cN;(function(t){t.method="textDocument/declaration",t.messageDirection=aN.MessageDirection.clientToServer,t.type=new aN.ProtocolRequestType(t.method)})(cN||(tf.DeclarationRequest=cN={}))});var fN=R(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});rf.SelectionRangeRequest=void 0;var uN=Rt(),dN;(function(t){t.method="textDocument/selectionRange",t.messageDirection=uN.MessageDirection.clientToServer,t.type=new uN.ProtocolRequestType(t.method)})(dN||(rf.SelectionRangeRequest=dN={}))});var gN=R(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.WorkDoneProgressCancelNotification=ps.WorkDoneProgressCreateRequest=ps.WorkDoneProgress=void 0;var gU=ao(),nf=Rt(),pN;(function(t){t.type=new gU.ProgressType;function e(r){return r===t.type}t.is=e})(pN||(ps.WorkDoneProgress=pN={}));var hN;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=nf.MessageDirection.serverToClient,t.type=new nf.ProtocolRequestType(t.method)})(hN||(ps.WorkDoneProgressCreateRequest=hN={}));var mN;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=nf.MessageDirection.clientToServer,t.type=new nf.ProtocolNotificationType(t.method)})(mN||(ps.WorkDoneProgressCancelNotification=mN={}))});var bN=R(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.CallHierarchyOutgoingCallsRequest=hs.CallHierarchyIncomingCallsRequest=hs.CallHierarchyPrepareRequest=void 0;var aa=Rt(),yN;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=aa.MessageDirection.clientToServer,t.type=new aa.ProtocolRequestType(t.method)})(yN||(hs.CallHierarchyPrepareRequest=yN={}));var TN;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=aa.MessageDirection.clientToServer,t.type=new aa.ProtocolRequestType(t.method)})(TN||(hs.CallHierarchyIncomingCallsRequest=TN={}));var vN;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=aa.MessageDirection.clientToServer,t.type=new aa.ProtocolRequestType(t.method)})(vN||(hs.CallHierarchyOutgoingCallsRequest=vN={}))});var RN=R(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.SemanticTokensRefreshRequest=Yr.SemanticTokensRangeRequest=Yr.SemanticTokensDeltaRequest=Yr.SemanticTokensRequest=Yr.SemanticTokensRegistrationType=Yr.TokenFormat=void 0;var zi=Rt(),SN;(function(t){t.Relative="relative"})(SN||(Yr.TokenFormat=SN={}));var Lc;(function(t){t.method="textDocument/semanticTokens",t.type=new zi.RegistrationType(t.method)})(Lc||(Yr.SemanticTokensRegistrationType=Lc={}));var _N;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=zi.MessageDirection.clientToServer,t.type=new zi.ProtocolRequestType(t.method),t.registrationMethod=Lc.method})(_N||(Yr.SemanticTokensRequest=_N={}));var PN;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=zi.MessageDirection.clientToServer,t.type=new zi.ProtocolRequestType(t.method),t.registrationMethod=Lc.method})(PN||(Yr.SemanticTokensDeltaRequest=PN={}));var kN;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=zi.MessageDirection.clientToServer,t.type=new zi.ProtocolRequestType(t.method),t.registrationMethod=Lc.method})(kN||(Yr.SemanticTokensRangeRequest=kN={}));var NN;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=zi.MessageDirection.serverToClient,t.type=new zi.ProtocolRequestType0(t.method)})(NN||(Yr.SemanticTokensRefreshRequest=NN={}))});var DN=R(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.ShowDocumentRequest=void 0;var EN=Rt(),wN;(function(t){t.method="window/showDocument",t.messageDirection=EN.MessageDirection.serverToClient,t.type=new EN.ProtocolRequestType(t.method)})(wN||(sf.ShowDocumentRequest=wN={}))});var IN=R(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.LinkedEditingRangeRequest=void 0;var CN=Rt(),AN;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=CN.MessageDirection.clientToServer,t.type=new CN.ProtocolRequestType(t.method)})(AN||(of.LinkedEditingRangeRequest=AN={}))});var BN=R(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.WillDeleteFilesRequest=Nr.DidDeleteFilesNotification=Nr.DidRenameFilesNotification=Nr.WillRenameFilesRequest=Nr.DidCreateFilesNotification=Nr.WillCreateFilesRequest=Nr.FileOperationPatternKind=void 0;var Nn=Rt(),ON;(function(t){t.file="file",t.folder="folder"})(ON||(Nr.FileOperationPatternKind=ON={}));var xN;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=Nn.MessageDirection.clientToServer,t.type=new Nn.ProtocolRequestType(t.method)})(xN||(Nr.WillCreateFilesRequest=xN={}));var MN;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=Nn.MessageDirection.clientToServer,t.type=new Nn.ProtocolNotificationType(t.method)})(MN||(Nr.DidCreateFilesNotification=MN={}));var LN;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=Nn.MessageDirection.clientToServer,t.type=new Nn.ProtocolRequestType(t.method)})(LN||(Nr.WillRenameFilesRequest=LN={}));var qN;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=Nn.MessageDirection.clientToServer,t.type=new Nn.ProtocolNotificationType(t.method)})(qN||(Nr.DidRenameFilesNotification=qN={}));var $N;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=Nn.MessageDirection.clientToServer,t.type=new Nn.ProtocolNotificationType(t.method)})($N||(Nr.DidDeleteFilesNotification=$N={}));var FN;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=Nn.MessageDirection.clientToServer,t.type=new Nn.ProtocolRequestType(t.method)})(FN||(Nr.WillDeleteFilesRequest=FN={}))});var WN=R(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.MonikerRequest=ms.MonikerKind=ms.UniquenessLevel=void 0;var jN=Rt(),UN;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(UN||(ms.UniquenessLevel=UN={}));var HN;(function(t){t.$import="import",t.$export="export",t.local="local"})(HN||(ms.MonikerKind=HN={}));var VN;(function(t){t.method="textDocument/moniker",t.messageDirection=jN.MessageDirection.clientToServer,t.type=new jN.ProtocolRequestType(t.method)})(VN||(ms.MonikerRequest=VN={}))});var KN=R(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.TypeHierarchySubtypesRequest=gs.TypeHierarchySupertypesRequest=gs.TypeHierarchyPrepareRequest=void 0;var ca=Rt(),zN;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=ca.MessageDirection.clientToServer,t.type=new ca.ProtocolRequestType(t.method)})(zN||(gs.TypeHierarchyPrepareRequest=zN={}));var GN;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=ca.MessageDirection.clientToServer,t.type=new ca.ProtocolRequestType(t.method)})(GN||(gs.TypeHierarchySupertypesRequest=GN={}));var YN;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=ca.MessageDirection.clientToServer,t.type=new ca.ProtocolRequestType(t.method)})(YN||(gs.TypeHierarchySubtypesRequest=YN={}))});var QN=R(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.InlineValueRefreshRequest=la.InlineValueRequest=void 0;var af=Rt(),XN;(function(t){t.method="textDocument/inlineValue",t.messageDirection=af.MessageDirection.clientToServer,t.type=new af.ProtocolRequestType(t.method)})(XN||(la.InlineValueRequest=XN={}));var JN;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=af.MessageDirection.serverToClient,t.type=new af.ProtocolRequestType0(t.method)})(JN||(la.InlineValueRefreshRequest=JN={}))});var rR=R(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.InlayHintRefreshRequest=ys.InlayHintResolveRequest=ys.InlayHintRequest=void 0;var ua=Rt(),ZN;(function(t){t.method="textDocument/inlayHint",t.messageDirection=ua.MessageDirection.clientToServer,t.type=new ua.ProtocolRequestType(t.method)})(ZN||(ys.InlayHintRequest=ZN={}));var eR;(function(t){t.method="inlayHint/resolve",t.messageDirection=ua.MessageDirection.clientToServer,t.type=new ua.ProtocolRequestType(t.method)})(eR||(ys.InlayHintResolveRequest=eR={}));var tR;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=ua.MessageDirection.serverToClient,t.type=new ua.ProtocolRequestType0(t.method)})(tR||(ys.InlayHintRefreshRequest=tR={}))});var lR=R(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.DiagnosticRefreshRequest=Rn.WorkspaceDiagnosticRequest=Rn.DocumentDiagnosticRequest=Rn.DocumentDiagnosticReportKind=Rn.DiagnosticServerCancellationData=void 0;var cR=ao(),yU=Yd(),da=Rt(),nR;(function(t){function e(r){let n=r;return n&&yU.boolean(n.retriggerRequest)}t.is=e})(nR||(Rn.DiagnosticServerCancellationData=nR={}));var iR;(function(t){t.Full="full",t.Unchanged="unchanged"})(iR||(Rn.DocumentDiagnosticReportKind=iR={}));var sR;(function(t){t.method="textDocument/diagnostic",t.messageDirection=da.MessageDirection.clientToServer,t.type=new da.ProtocolRequestType(t.method),t.partialResult=new cR.ProgressType})(sR||(Rn.DocumentDiagnosticRequest=sR={}));var oR;(function(t){t.method="workspace/diagnostic",t.messageDirection=da.MessageDirection.clientToServer,t.type=new da.ProtocolRequestType(t.method),t.partialResult=new cR.ProgressType})(oR||(Rn.WorkspaceDiagnosticRequest=oR={}));var aR;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=da.MessageDirection.serverToClient,t.type=new da.ProtocolRequestType0(t.method)})(aR||(Rn.DiagnosticRefreshRequest=aR={}))});var gR=R(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.DidCloseNotebookDocumentNotification=Mt.DidSaveNotebookDocumentNotification=Mt.DidChangeNotebookDocumentNotification=Mt.NotebookCellArrayChange=Mt.DidOpenNotebookDocumentNotification=Mt.NotebookDocumentSyncRegistrationType=Mt.NotebookDocument=Mt.NotebookCell=Mt.ExecutionSummary=Mt.NotebookCellKind=void 0;var qc=Gd(),Jn=Yd(),bi=Rt(),Wy;(function(t){t.Markup=1,t.Code=2;function e(r){return r===1||r===2}t.is=e})(Wy||(Mt.NotebookCellKind=Wy={}));var zy;(function(t){function e(i,s){let o={executionOrder:i};return(s===!0||s===!1)&&(o.success=s),o}t.create=e;function r(i){let s=i;return Jn.objectLiteral(s)&&qc.uinteger.is(s.executionOrder)&&(s.success===void 0||Jn.boolean(s.success))}t.is=r;function n(i,s){return i===s?!0:i==null||s===null||s===void 0?!1:i.executionOrder===s.executionOrder&&i.success===s.success}t.equals=n})(zy||(Mt.ExecutionSummary=zy={}));var cf;(function(t){function e(s,o){return{kind:s,document:o}}t.create=e;function r(s){let o=s;return Jn.objectLiteral(o)&&Wy.is(o.kind)&&qc.DocumentUri.is(o.document)&&(o.metadata===void 0||Jn.objectLiteral(o.metadata))}t.is=r;function n(s,o){let a=new Set;return s.document!==o.document&&a.add("document"),s.kind!==o.kind&&a.add("kind"),s.executionSummary!==o.executionSummary&&a.add("executionSummary"),(s.metadata!==void 0||o.metadata!==void 0)&&!i(s.metadata,o.metadata)&&a.add("metadata"),(s.executionSummary!==void 0||o.executionSummary!==void 0)&&!zy.equals(s.executionSummary,o.executionSummary)&&a.add("executionSummary"),a}t.diff=n;function i(s,o){if(s===o)return!0;if(s==null||o===null||o===void 0||typeof s!=typeof o||typeof s!="object")return!1;let a=Array.isArray(s),c=Array.isArray(o);if(a!==c)return!1;if(a&&c){if(s.length!==o.length)return!1;for(let l=0;l<s.length;l++)if(!i(s[l],o[l]))return!1}if(Jn.objectLiteral(s)&&Jn.objectLiteral(o)){let l=Object.keys(s),u=Object.keys(o);if(l.length!==u.length||(l.sort(),u.sort(),!i(l,u)))return!1;for(let d=0;d<l.length;d++){let f=l[d];if(!i(s[f],o[f]))return!1}}return!0}})(cf||(Mt.NotebookCell=cf={}));var uR;(function(t){function e(n,i,s,o){return{uri:n,notebookType:i,version:s,cells:o}}t.create=e;function r(n){let i=n;return Jn.objectLiteral(i)&&Jn.string(i.uri)&&qc.integer.is(i.version)&&Jn.typedArray(i.cells,cf.is)}t.is=r})(uR||(Mt.NotebookDocument=uR={}));var fa;(function(t){t.method="notebookDocument/sync",t.messageDirection=bi.MessageDirection.clientToServer,t.type=new bi.RegistrationType(t.method)})(fa||(Mt.NotebookDocumentSyncRegistrationType=fa={}));var dR;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=bi.MessageDirection.clientToServer,t.type=new bi.ProtocolNotificationType(t.method),t.registrationMethod=fa.method})(dR||(Mt.DidOpenNotebookDocumentNotification=dR={}));var fR;(function(t){function e(n){let i=n;return Jn.objectLiteral(i)&&qc.uinteger.is(i.start)&&qc.uinteger.is(i.deleteCount)&&(i.cells===void 0||Jn.typedArray(i.cells,cf.is))}t.is=e;function r(n,i,s){let o={start:n,deleteCount:i};return s!==void 0&&(o.cells=s),o}t.create=r})(fR||(Mt.NotebookCellArrayChange=fR={}));var pR;(function(t){t.method="notebookDocument/didChange",t.messageDirection=bi.MessageDirection.clientToServer,t.type=new bi.ProtocolNotificationType(t.method),t.registrationMethod=fa.method})(pR||(Mt.DidChangeNotebookDocumentNotification=pR={}));var hR;(function(t){t.method="notebookDocument/didSave",t.messageDirection=bi.MessageDirection.clientToServer,t.type=new bi.ProtocolNotificationType(t.method),t.registrationMethod=fa.method})(hR||(Mt.DidSaveNotebookDocumentNotification=hR={}));var mR;(function(t){t.method="notebookDocument/didClose",t.messageDirection=bi.MessageDirection.clientToServer,t.type=new bi.ProtocolNotificationType(t.method),t.registrationMethod=fa.method})(mR||(Mt.DidCloseNotebookDocumentNotification=mR={}))});var vR=R(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});lf.InlineCompletionRequest=void 0;var yR=Rt(),TR;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=yR.MessageDirection.clientToServer,t.type=new yR.ProtocolRequestType(t.method)})(TR||(lf.InlineCompletionRequest=TR={}))});var IE=R(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.WorkspaceSymbolRequest=k.CodeActionResolveRequest=k.CodeActionRequest=k.DocumentSymbolRequest=k.DocumentHighlightRequest=k.ReferencesRequest=k.DefinitionRequest=k.SignatureHelpRequest=k.SignatureHelpTriggerKind=k.HoverRequest=k.CompletionResolveRequest=k.CompletionRequest=k.CompletionTriggerKind=k.PublishDiagnosticsNotification=k.WatchKind=k.RelativePattern=k.FileChangeType=k.DidChangeWatchedFilesNotification=k.WillSaveTextDocumentWaitUntilRequest=k.WillSaveTextDocumentNotification=k.TextDocumentSaveReason=k.DidSaveTextDocumentNotification=k.DidCloseTextDocumentNotification=k.DidChangeTextDocumentNotification=k.TextDocumentContentChangeEvent=k.DidOpenTextDocumentNotification=k.TextDocumentSyncKind=k.TelemetryEventNotification=k.LogMessageNotification=k.ShowMessageRequest=k.ShowMessageNotification=k.MessageType=k.DidChangeConfigurationNotification=k.ExitNotification=k.ShutdownRequest=k.InitializedNotification=k.InitializeErrorCodes=k.InitializeRequest=k.WorkDoneProgressOptions=k.TextDocumentRegistrationOptions=k.StaticRegistrationOptions=k.PositionEncodingKind=k.FailureHandlingKind=k.ResourceOperationKind=k.UnregistrationRequest=k.RegistrationRequest=k.DocumentSelector=k.NotebookCellTextDocumentFilter=k.NotebookDocumentFilter=k.TextDocumentFilter=void 0;k.MonikerRequest=k.MonikerKind=k.UniquenessLevel=k.WillDeleteFilesRequest=k.DidDeleteFilesNotification=k.WillRenameFilesRequest=k.DidRenameFilesNotification=k.WillCreateFilesRequest=k.DidCreateFilesNotification=k.FileOperationPatternKind=k.LinkedEditingRangeRequest=k.ShowDocumentRequest=k.SemanticTokensRegistrationType=k.SemanticTokensRefreshRequest=k.SemanticTokensRangeRequest=k.SemanticTokensDeltaRequest=k.SemanticTokensRequest=k.TokenFormat=k.CallHierarchyPrepareRequest=k.CallHierarchyOutgoingCallsRequest=k.CallHierarchyIncomingCallsRequest=k.WorkDoneProgressCancelNotification=k.WorkDoneProgressCreateRequest=k.WorkDoneProgress=k.SelectionRangeRequest=k.DeclarationRequest=k.FoldingRangeRefreshRequest=k.FoldingRangeRequest=k.ColorPresentationRequest=k.DocumentColorRequest=k.ConfigurationRequest=k.DidChangeWorkspaceFoldersNotification=k.WorkspaceFoldersRequest=k.TypeDefinitionRequest=k.ImplementationRequest=k.ApplyWorkspaceEditRequest=k.ExecuteCommandRequest=k.PrepareRenameRequest=k.RenameRequest=k.PrepareSupportDefaultBehavior=k.DocumentOnTypeFormattingRequest=k.DocumentRangesFormattingRequest=k.DocumentRangeFormattingRequest=k.DocumentFormattingRequest=k.DocumentLinkResolveRequest=k.DocumentLinkRequest=k.CodeLensRefreshRequest=k.CodeLensResolveRequest=k.CodeLensRequest=k.WorkspaceSymbolResolveRequest=void 0;k.InlineCompletionRequest=k.DidCloseNotebookDocumentNotification=k.DidSaveNotebookDocumentNotification=k.DidChangeNotebookDocumentNotification=k.NotebookCellArrayChange=k.DidOpenNotebookDocumentNotification=k.NotebookDocumentSyncRegistrationType=k.NotebookDocument=k.NotebookCell=k.ExecutionSummary=k.NotebookCellKind=k.DiagnosticRefreshRequest=k.WorkspaceDiagnosticRequest=k.DocumentDiagnosticRequest=k.DocumentDiagnosticReportKind=k.DiagnosticServerCancellationData=k.InlayHintRefreshRequest=k.InlayHintResolveRequest=k.InlayHintRequest=k.InlineValueRefreshRequest=k.InlineValueRequest=k.TypeHierarchySupertypesRequest=k.TypeHierarchySubtypesRequest=k.TypeHierarchyPrepareRequest=void 0;var z=Rt(),bR=Gd(),rr=Yd(),TU=Wk();Object.defineProperty(k,"ImplementationRequest",{enumerable:!0,get:function(){return TU.ImplementationRequest}});var vU=Yk();Object.defineProperty(k,"TypeDefinitionRequest",{enumerable:!0,get:function(){return vU.TypeDefinitionRequest}});var wE=Jk();Object.defineProperty(k,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return wE.WorkspaceFoldersRequest}});Object.defineProperty(k,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return wE.DidChangeWorkspaceFoldersNotification}});var bU=eN();Object.defineProperty(k,"ConfigurationRequest",{enumerable:!0,get:function(){return bU.ConfigurationRequest}});var DE=nN();Object.defineProperty(k,"DocumentColorRequest",{enumerable:!0,get:function(){return DE.DocumentColorRequest}});Object.defineProperty(k,"ColorPresentationRequest",{enumerable:!0,get:function(){return DE.ColorPresentationRequest}});var CE=oN();Object.defineProperty(k,"FoldingRangeRequest",{enumerable:!0,get:function(){return CE.FoldingRangeRequest}});Object.defineProperty(k,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return CE.FoldingRangeRefreshRequest}});var SU=lN();Object.defineProperty(k,"DeclarationRequest",{enumerable:!0,get:function(){return SU.DeclarationRequest}});var _U=fN();Object.defineProperty(k,"SelectionRangeRequest",{enumerable:!0,get:function(){return _U.SelectionRangeRequest}});var Jy=gN();Object.defineProperty(k,"WorkDoneProgress",{enumerable:!0,get:function(){return Jy.WorkDoneProgress}});Object.defineProperty(k,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return Jy.WorkDoneProgressCreateRequest}});Object.defineProperty(k,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return Jy.WorkDoneProgressCancelNotification}});var Qy=bN();Object.defineProperty(k,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return Qy.CallHierarchyIncomingCallsRequest}});Object.defineProperty(k,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return Qy.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(k,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return Qy.CallHierarchyPrepareRequest}});var pa=RN();Object.defineProperty(k,"TokenFormat",{enumerable:!0,get:function(){return pa.TokenFormat}});Object.defineProperty(k,"SemanticTokensRequest",{enumerable:!0,get:function(){return pa.SemanticTokensRequest}});Object.defineProperty(k,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return pa.SemanticTokensDeltaRequest}});Object.defineProperty(k,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return pa.SemanticTokensRangeRequest}});Object.defineProperty(k,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return pa.SemanticTokensRefreshRequest}});Object.defineProperty(k,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return pa.SemanticTokensRegistrationType}});var PU=DN();Object.defineProperty(k,"ShowDocumentRequest",{enumerable:!0,get:function(){return PU.ShowDocumentRequest}});var kU=IN();Object.defineProperty(k,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return kU.LinkedEditingRangeRequest}});var co=BN();Object.defineProperty(k,"FileOperationPatternKind",{enumerable:!0,get:function(){return co.FileOperationPatternKind}});Object.defineProperty(k,"DidCreateFilesNotification",{enumerable:!0,get:function(){return co.DidCreateFilesNotification}});Object.defineProperty(k,"WillCreateFilesRequest",{enumerable:!0,get:function(){return co.WillCreateFilesRequest}});Object.defineProperty(k,"DidRenameFilesNotification",{enumerable:!0,get:function(){return co.DidRenameFilesNotification}});Object.defineProperty(k,"WillRenameFilesRequest",{enumerable:!0,get:function(){return co.WillRenameFilesRequest}});Object.defineProperty(k,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return co.DidDeleteFilesNotification}});Object.defineProperty(k,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return co.WillDeleteFilesRequest}});var Zy=WN();Object.defineProperty(k,"UniquenessLevel",{enumerable:!0,get:function(){return Zy.UniquenessLevel}});Object.defineProperty(k,"MonikerKind",{enumerable:!0,get:function(){return Zy.MonikerKind}});Object.defineProperty(k,"MonikerRequest",{enumerable:!0,get:function(){return Zy.MonikerRequest}});var eT=KN();Object.defineProperty(k,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return eT.TypeHierarchyPrepareRequest}});Object.defineProperty(k,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return eT.TypeHierarchySubtypesRequest}});Object.defineProperty(k,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return eT.TypeHierarchySupertypesRequest}});var AE=QN();Object.defineProperty(k,"InlineValueRequest",{enumerable:!0,get:function(){return AE.InlineValueRequest}});Object.defineProperty(k,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return AE.InlineValueRefreshRequest}});var tT=rR();Object.defineProperty(k,"InlayHintRequest",{enumerable:!0,get:function(){return tT.InlayHintRequest}});Object.defineProperty(k,"InlayHintResolveRequest",{enumerable:!0,get:function(){return tT.InlayHintResolveRequest}});Object.defineProperty(k,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return tT.InlayHintRefreshRequest}});var $c=lR();Object.defineProperty(k,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return $c.DiagnosticServerCancellationData}});Object.defineProperty(k,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return $c.DocumentDiagnosticReportKind}});Object.defineProperty(k,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return $c.DocumentDiagnosticRequest}});Object.defineProperty(k,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return $c.WorkspaceDiagnosticRequest}});Object.defineProperty(k,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return $c.DiagnosticRefreshRequest}});var Si=gR();Object.defineProperty(k,"NotebookCellKind",{enumerable:!0,get:function(){return Si.NotebookCellKind}});Object.defineProperty(k,"ExecutionSummary",{enumerable:!0,get:function(){return Si.ExecutionSummary}});Object.defineProperty(k,"NotebookCell",{enumerable:!0,get:function(){return Si.NotebookCell}});Object.defineProperty(k,"NotebookDocument",{enumerable:!0,get:function(){return Si.NotebookDocument}});Object.defineProperty(k,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return Si.NotebookDocumentSyncRegistrationType}});Object.defineProperty(k,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return Si.DidOpenNotebookDocumentNotification}});Object.defineProperty(k,"NotebookCellArrayChange",{enumerable:!0,get:function(){return Si.NotebookCellArrayChange}});Object.defineProperty(k,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return Si.DidChangeNotebookDocumentNotification}});Object.defineProperty(k,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return Si.DidSaveNotebookDocumentNotification}});Object.defineProperty(k,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return Si.DidCloseNotebookDocumentNotification}});var NU=vR();Object.defineProperty(k,"InlineCompletionRequest",{enumerable:!0,get:function(){return NU.InlineCompletionRequest}});var Gy;(function(t){function e(r){let n=r;return rr.string(n)||rr.string(n.language)||rr.string(n.scheme)||rr.string(n.pattern)}t.is=e})(Gy||(k.TextDocumentFilter=Gy={}));var Yy;(function(t){function e(r){let n=r;return rr.objectLiteral(n)&&(rr.string(n.notebookType)||rr.string(n.scheme)||rr.string(n.pattern))}t.is=e})(Yy||(k.NotebookDocumentFilter=Yy={}));var Ky;(function(t){function e(r){let n=r;return rr.objectLiteral(n)&&(rr.string(n.notebook)||Yy.is(n.notebook))&&(n.language===void 0||rr.string(n.language))}t.is=e})(Ky||(k.NotebookCellTextDocumentFilter=Ky={}));var Xy;(function(t){function e(r){if(!Array.isArray(r))return!1;for(let n of r)if(!rr.string(n)&&!Gy.is(n)&&!Ky.is(n))return!1;return!0}t.is=e})(Xy||(k.DocumentSelector=Xy={}));var SR;(function(t){t.method="client/registerCapability",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType(t.method)})(SR||(k.RegistrationRequest=SR={}));var _R;(function(t){t.method="client/unregisterCapability",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType(t.method)})(_R||(k.UnregistrationRequest=_R={}));var PR;(function(t){t.Create="create",t.Rename="rename",t.Delete="delete"})(PR||(k.ResourceOperationKind=PR={}));var kR;(function(t){t.Abort="abort",t.Transactional="transactional",t.TextOnlyTransactional="textOnlyTransactional",t.Undo="undo"})(kR||(k.FailureHandlingKind=kR={}));var NR;(function(t){t.UTF8="utf-8",t.UTF16="utf-16",t.UTF32="utf-32"})(NR||(k.PositionEncodingKind=NR={}));var RR;(function(t){function e(r){let n=r;return n&&rr.string(n.id)&&n.id.length>0}t.hasId=e})(RR||(k.StaticRegistrationOptions=RR={}));var ER;(function(t){function e(r){let n=r;return n&&(n.documentSelector===null||Xy.is(n.documentSelector))}t.is=e})(ER||(k.TextDocumentRegistrationOptions=ER={}));var wR;(function(t){function e(n){let i=n;return rr.objectLiteral(i)&&(i.workDoneProgress===void 0||rr.boolean(i.workDoneProgress))}t.is=e;function r(n){let i=n;return i&&rr.boolean(i.workDoneProgress)}t.hasWorkDoneProgress=r})(wR||(k.WorkDoneProgressOptions=wR={}));var DR;(function(t){t.method="initialize",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(DR||(k.InitializeRequest=DR={}));var CR;(function(t){t.unknownProtocolVersion=1})(CR||(k.InitializeErrorCodes=CR={}));var AR;(function(t){t.method="initialized",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(AR||(k.InitializedNotification=AR={}));var IR;(function(t){t.method="shutdown",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType0(t.method)})(IR||(k.ShutdownRequest=IR={}));var OR;(function(t){t.method="exit",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType0(t.method)})(OR||(k.ExitNotification=OR={}));var xR;(function(t){t.method="workspace/didChangeConfiguration",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(xR||(k.DidChangeConfigurationNotification=xR={}));var MR;(function(t){t.Error=1,t.Warning=2,t.Info=3,t.Log=4,t.Debug=5})(MR||(k.MessageType=MR={}));var LR;(function(t){t.method="window/showMessage",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolNotificationType(t.method)})(LR||(k.ShowMessageNotification=LR={}));var qR;(function(t){t.method="window/showMessageRequest",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType(t.method)})(qR||(k.ShowMessageRequest=qR={}));var $R;(function(t){t.method="window/logMessage",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolNotificationType(t.method)})($R||(k.LogMessageNotification=$R={}));var FR;(function(t){t.method="telemetry/event",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolNotificationType(t.method)})(FR||(k.TelemetryEventNotification=FR={}));var BR;(function(t){t.None=0,t.Full=1,t.Incremental=2})(BR||(k.TextDocumentSyncKind=BR={}));var jR;(function(t){t.method="textDocument/didOpen",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(jR||(k.DidOpenTextDocumentNotification=jR={}));var UR;(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})(UR||(k.TextDocumentContentChangeEvent=UR={}));var HR;(function(t){t.method="textDocument/didChange",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(HR||(k.DidChangeTextDocumentNotification=HR={}));var VR;(function(t){t.method="textDocument/didClose",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(VR||(k.DidCloseTextDocumentNotification=VR={}));var WR;(function(t){t.method="textDocument/didSave",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(WR||(k.DidSaveTextDocumentNotification=WR={}));var zR;(function(t){t.Manual=1,t.AfterDelay=2,t.FocusOut=3})(zR||(k.TextDocumentSaveReason=zR={}));var GR;(function(t){t.method="textDocument/willSave",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(GR||(k.WillSaveTextDocumentNotification=GR={}));var YR;(function(t){t.method="textDocument/willSaveWaitUntil",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(YR||(k.WillSaveTextDocumentWaitUntilRequest=YR={}));var KR;(function(t){t.method="workspace/didChangeWatchedFiles",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(KR||(k.DidChangeWatchedFilesNotification=KR={}));var XR;(function(t){t.Created=1,t.Changed=2,t.Deleted=3})(XR||(k.FileChangeType=XR={}));var JR;(function(t){function e(r){let n=r;return rr.objectLiteral(n)&&(bR.URI.is(n.baseUri)||bR.WorkspaceFolder.is(n.baseUri))&&rr.string(n.pattern)}t.is=e})(JR||(k.RelativePattern=JR={}));var QR;(function(t){t.Create=1,t.Change=2,t.Delete=4})(QR||(k.WatchKind=QR={}));var ZR;(function(t){t.method="textDocument/publishDiagnostics",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolNotificationType(t.method)})(ZR||(k.PublishDiagnosticsNotification=ZR={}));var eE;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.TriggerForIncompleteCompletions=3})(eE||(k.CompletionTriggerKind=eE={}));var tE;(function(t){t.method="textDocument/completion",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(tE||(k.CompletionRequest=tE={}));var rE;(function(t){t.method="completionItem/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(rE||(k.CompletionResolveRequest=rE={}));var nE;(function(t){t.method="textDocument/hover",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(nE||(k.HoverRequest=nE={}));var iE;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.ContentChange=3})(iE||(k.SignatureHelpTriggerKind=iE={}));var sE;(function(t){t.method="textDocument/signatureHelp",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(sE||(k.SignatureHelpRequest=sE={}));var oE;(function(t){t.method="textDocument/definition",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(oE||(k.DefinitionRequest=oE={}));var aE;(function(t){t.method="textDocument/references",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(aE||(k.ReferencesRequest=aE={}));var cE;(function(t){t.method="textDocument/documentHighlight",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(cE||(k.DocumentHighlightRequest=cE={}));var lE;(function(t){t.method="textDocument/documentSymbol",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(lE||(k.DocumentSymbolRequest=lE={}));var uE;(function(t){t.method="textDocument/codeAction",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(uE||(k.CodeActionRequest=uE={}));var dE;(function(t){t.method="codeAction/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(dE||(k.CodeActionResolveRequest=dE={}));var fE;(function(t){t.method="workspace/symbol",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(fE||(k.WorkspaceSymbolRequest=fE={}));var pE;(function(t){t.method="workspaceSymbol/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(pE||(k.WorkspaceSymbolResolveRequest=pE={}));var hE;(function(t){t.method="textDocument/codeLens",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(hE||(k.CodeLensRequest=hE={}));var mE;(function(t){t.method="codeLens/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(mE||(k.CodeLensResolveRequest=mE={}));var gE;(function(t){t.method="workspace/codeLens/refresh",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType0(t.method)})(gE||(k.CodeLensRefreshRequest=gE={}));var yE;(function(t){t.method="textDocument/documentLink",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(yE||(k.DocumentLinkRequest=yE={}));var TE;(function(t){t.method="documentLink/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(TE||(k.DocumentLinkResolveRequest=TE={}));var vE;(function(t){t.method="textDocument/formatting",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(vE||(k.DocumentFormattingRequest=vE={}));var bE;(function(t){t.method="textDocument/rangeFormatting",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(bE||(k.DocumentRangeFormattingRequest=bE={}));var SE;(function(t){t.method="textDocument/rangesFormatting",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(SE||(k.DocumentRangesFormattingRequest=SE={}));var _E;(function(t){t.method="textDocument/onTypeFormatting",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(_E||(k.DocumentOnTypeFormattingRequest=_E={}));var PE;(function(t){t.Identifier=1})(PE||(k.PrepareSupportDefaultBehavior=PE={}));var kE;(function(t){t.method="textDocument/rename",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(kE||(k.RenameRequest=kE={}));var NE;(function(t){t.method="textDocument/prepareRename",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(NE||(k.PrepareRenameRequest=NE={}));var RE;(function(t){t.method="workspace/executeCommand",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(RE||(k.ExecuteCommandRequest=RE={}));var EE;(function(t){t.method="workspace/applyEdit",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType("workspace/applyEdit")})(EE||(k.ApplyWorkspaceEditRequest=EE={}))});var xE=R(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});uf.createProtocolConnection=void 0;var OE=ao();function RU(t,e,r,n){return OE.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,OE.createMessageConnection)(t,e,r,n)}uf.createProtocolConnection=RU});var LE=R(Kr=>{"use strict";var EU=Kr&&Kr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),df=Kr&&Kr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&EU(e,t,r)};Object.defineProperty(Kr,"__esModule",{value:!0});Kr.LSPErrorCodes=Kr.createProtocolConnection=void 0;df(ao(),Kr);df(Gd(),Kr);df(Rt(),Kr);df(IE(),Kr);var wU=xE();Object.defineProperty(Kr,"createProtocolConnection",{enumerable:!0,get:function(){return wU.createProtocolConnection}});var ME;(function(t){t.lspReservedErrorRangeStart=-32899,t.RequestFailed=-32803,t.ServerCancelled=-32802,t.ContentModified=-32801,t.RequestCancelled=-32800,t.lspReservedErrorRangeEnd=-32800})(ME||(Kr.LSPErrorCodes=ME={}))});var Ft=R(_i=>{"use strict";var DU=_i&&_i.__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]})),qE=_i&&_i.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&DU(e,t,r)};Object.defineProperty(_i,"__esModule",{value:!0});_i.createProtocolConnection=void 0;var CU=Fy();qE(Fy(),_i);qE(LE(),_i);function AU(t,e,r,n){return(0,CU.createMessageConnection)(t,e,r,n)}_i.createProtocolConnection=AU});var rT=R(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.generateUuid=En.parse=En.isUUID=En.v4=En.empty=void 0;var Fc=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},Bc=class t extends Fc{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(""))}};Bc._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];Bc._timeHighBits=["8","9","a","b"];En.empty=new Fc("00000000-0000-0000-0000-000000000000");function $E(){return new Bc}En.v4=$E;var IU=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function FE(t){return IU.test(t)}En.isUUID=FE;function OU(t){if(!FE(t))throw new Error("invalid uuid");return new Fc(t)}En.parse=OU;function xU(){return $E().asHex()}En.generateUuid=xU});var BE=R(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.attachPartialResult=vs.ProgressFeature=vs.attachWorkDone=void 0;var Ts=Ft(),MU=rT(),lo=class t{constructor(e,r){this._connection=e,this._token=r,t.Instances.set(this._token,this)}begin(e,r,n,i){let s={kind:"begin",title:e,percentage:r,message:n,cancellable:i};this._connection.sendProgress(Ts.WorkDoneProgress.type,this._token,s)}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(Ts.WorkDoneProgress.type,this._token,n)}done(){t.Instances.delete(this._token),this._connection.sendProgress(Ts.WorkDoneProgress.type,this._token,{kind:"end"})}};lo.Instances=new Map;var ff=class extends lo{constructor(e,r){super(e,r),this._source=new Ts.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},jc=class{constructor(){}begin(){}report(){}done(){}},pf=class extends jc{constructor(){super(),this._source=new Ts.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function LU(t,e){if(e===void 0||e.workDoneToken===void 0)return new jc;let r=e.workDoneToken;return delete e.workDoneToken,new lo(t,r)}vs.attachWorkDone=LU;var qU=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(Ts.WorkDoneProgressCancelNotification.type,r=>{let n=lo.Instances.get(r.token);(n instanceof ff||n instanceof pf)&&n.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new jc:new lo(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,MU.generateUuid)();return this.connection.sendRequest(Ts.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new ff(this.connection,e))}else return Promise.resolve(new pf)}};vs.ProgressFeature=qU;var nT;(function(t){t.type=new Ts.ProgressType})(nT||(nT={}));var iT=class{constructor(e,r){this._connection=e,this._token=r}report(e){this._connection.sendProgress(nT.type,this._token,e)}};function $U(t,e){if(e===void 0||e.partialResultToken===void 0)return;let r=e.partialResultToken;return delete e.partialResultToken,new iT(t,r)}vs.attachPartialResult=$U});var jE=R(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});hf.ConfigurationFeature=void 0;var FU=Ft(),BU=kd(),jU=t=>class extends t{getConfiguration(e){return e?BU.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(FU.ConfigurationRequest.type,r).then(n=>Array.isArray(n)?Array.isArray(e)?n:n[0]:Array.isArray(e)?[]:null)}};hf.ConfigurationFeature=jU});var UE=R(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});gf.WorkspaceFoldersFeature=void 0;var mf=Ft(),UU=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let r=e.workspace;r&&r.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new mf.Emitter,this.connection.onNotification(mf.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(mf.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(mf.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};gf.WorkspaceFoldersFeature=UU});var HE=R(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});yf.CallHierarchyFeature=void 0;var sT=Ft(),HU=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(sT.CallHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onIncomingCalls:e=>{let r=sT.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onOutgoingCalls:e=>{let r=sT.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};yf.CallHierarchyFeature=HU});var aT=R(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.SemanticTokensBuilder=bs.SemanticTokensDiff=bs.SemanticTokensFeature=void 0;var Tf=Ft(),VU=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(Tf.SemanticTokensRefreshRequest.type),on:e=>{let r=Tf.SemanticTokensRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onDelta:e=>{let r=Tf.SemanticTokensDeltaRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onRange:e=>{let r=Tf.SemanticTokensRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};bs.SemanticTokensFeature=VU;var vf=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,s=r-1;for(;i>=n&&s>=n&&this.originalSequence[i]===this.modifiedSequence[s];)i--,s--;(i<n||s<n)&&(i++,s++);let o=i-n+1,a=this.modifiedSequence.slice(n,s+1);return a.length===1&&a[0]===this.originalSequence[i]?[{start:n,deleteCount:o-1}]:[{start:n,deleteCount:o,data:a}]}else return n<r?[{start:n,deleteCount:0,data:this.modifiedSequence.slice(n)}]:n<e?[{start:n,deleteCount:e-n}]:[]}};bs.SemanticTokensDiff=vf;var oT=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,s){let o=e,a=r;this._dataLen>0&&(o-=this._prevLine,o===0&&(a-=this._prevChar)),this._data[this._dataLen++]=o,this._data[this._dataLen++]=a,this._data[this._dataLen++]=n,this._data[this._dataLen++]=i,this._data[this._dataLen++]=s,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 vf(this._prevData,this._data).computeDiff()}:this.build()}};bs.SemanticTokensBuilder=oT});var VE=R(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});bf.ShowDocumentFeature=void 0;var WU=Ft(),zU=t=>class extends t{showDocument(e){return this.connection.sendRequest(WU.ShowDocumentRequest.type,e)}};bf.ShowDocumentFeature=zU});var WE=R(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});Sf.FileOperationsFeature=void 0;var ha=Ft(),GU=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(ha.DidCreateFilesNotification.type,r=>{e(r)})}onDidRenameFiles(e){return this.connection.onNotification(ha.DidRenameFilesNotification.type,r=>{e(r)})}onDidDeleteFiles(e){return this.connection.onNotification(ha.DidDeleteFilesNotification.type,r=>{e(r)})}onWillCreateFiles(e){return this.connection.onRequest(ha.WillCreateFilesRequest.type,(r,n)=>e(r,n))}onWillRenameFiles(e){return this.connection.onRequest(ha.WillRenameFilesRequest.type,(r,n)=>e(r,n))}onWillDeleteFiles(e){return this.connection.onRequest(ha.WillDeleteFilesRequest.type,(r,n)=>e(r,n))}};Sf.FileOperationsFeature=GU});var zE=R(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.LinkedEditingRangeFeature=void 0;var YU=Ft(),KU=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(YU.LinkedEditingRangeRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0))}};_f.LinkedEditingRangeFeature=KU});var GE=R(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});Pf.TypeHierarchyFeature=void 0;var cT=Ft(),XU=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(cT.TypeHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onSupertypes:e=>{let r=cT.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onSubtypes:e=>{let r=cT.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Pf.TypeHierarchyFeature=XU});var KE=R(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});kf.InlineValueFeature=void 0;var YE=Ft(),JU=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest(YE.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(YE.InlineValueRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};kf.InlineValueFeature=JU});var JE=R(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});Nf.FoldingRangeFeature=void 0;var XE=Ft(),QU=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(XE.FoldingRangeRefreshRequest.type),on:e=>{let r=XE.FoldingRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Nf.FoldingRangeFeature=QU});var QE=R(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});Rf.InlayHintFeature=void 0;var lT=Ft(),ZU=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(lT.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(lT.InlayHintRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r))),resolve:e=>this.connection.onRequest(lT.InlayHintResolveRequest.type,(r,n)=>e(r,n))}}};Rf.InlayHintFeature=ZU});var ZE=R(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.DiagnosticFeature=void 0;var Uc=Ft(),eH=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(Uc.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(Uc.DocumentDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(Uc.DocumentDiagnosticRequest.partialResult,r))),onWorkspace:e=>this.connection.onRequest(Uc.WorkspaceDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(Uc.WorkspaceDiagnosticRequest.partialResult,r)))}}};Ef.DiagnosticFeature=eH});var dT=R(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});wf.TextDocuments=void 0;var uo=Ft(),uT=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new uo.Emitter,this._onDidOpen=new uo.Emitter,this._onDidClose=new uo.Emitter,this._onDidSave=new uo.Emitter,this._onWillSave=new uo.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=uo.TextDocumentSyncKind.Incremental;let r=[];return r.push(e.onDidOpenTextDocument(n=>{let i=n.textDocument,s=this._configuration.create(i.uri,i.languageId,i.version,i.text);this._syncedDocuments.set(i.uri,s);let o=Object.freeze({document:s});this._onDidOpen.fire(o),this._onDidChangeContent.fire(o)})),r.push(e.onDidChangeTextDocument(n=>{let i=n.textDocument,s=n.contentChanges;if(s.length===0)return;let{version:o}=i;if(o==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,s,o),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 s=this._syncedDocuments.get(n.textDocument.uri);return s!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:s,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}))})),uo.Disposable.create(()=>{r.forEach(n=>n.dispose())})}};wf.TextDocuments=uT});var pT=R(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.NotebookDocuments=ma.NotebookSyncFeature=void 0;var wn=Ft(),ew=dT(),tH=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(wn.DidOpenNotebookDocumentNotification.type,r=>{e(r)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(wn.DidChangeNotebookDocumentNotification.type,r=>{e(r)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(wn.DidSaveNotebookDocumentNotification.type,r=>{e(r)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(wn.DidCloseNotebookDocumentNotification.type,r=>{e(r)})}}};ma.NotebookSyncFeature=tH;var Df=class t{onDidOpenTextDocument(e){return this.openHandler=e,wn.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,wn.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,wn.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}};Df.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var fT=class{constructor(e){e instanceof ew.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new ew.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new wn.Emitter,this._onDidChange=new wn.Emitter,this._onDidSave=new wn.Emitter,this._onDidClose=new wn.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 Df,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 s of i.cellTextDocuments)r.openTextDocument({textDocument:s});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),n.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{let s=this.notebookDocuments.get(i.notebookDocument.uri);if(s===void 0)return;s.version=i.notebookDocument.version;let o=s.metadata,a=!1,c=i.change;c.metadata!==void 0&&(a=!0,s.metadata=c.metadata);let l=[],u=[],d=[],f=[];if(c.cells!==void 0){let S=c.cells;if(S.structure!==void 0){let v=S.structure.array;if(s.cells.splice(v.start,v.deleteCount,...v.cells!==void 0?v.cells:[]),S.structure.didOpen!==void 0)for(let b of S.structure.didOpen)r.openTextDocument({textDocument:b}),l.push(b.uri);if(S.structure.didClose)for(let b of S.structure.didClose)r.closeTextDocument({textDocument:b}),u.push(b.uri)}if(S.data!==void 0){let v=new Map(S.data.map(b=>[b.document,b]));for(let b=0;b<=s.cells.length;b++){let P=v.get(s.cells[b].document);if(P!==void 0){let N=s.cells.splice(b,1,P);if(d.push({old:N[0],new:P}),v.delete(P.document),v.size===0)break}}}if(S.textContent!==void 0)for(let v of S.textContent)r.changeTextDocument({textDocument:v.document,contentChanges:v.changes}),f.push(v.document.uri)}this.updateCellMap(s);let p={notebookDocument:s};a&&(p.metadata={old:o,new:s.metadata});let m=[];for(let S of l)m.push(this.getNotebookCell(S));let h=[];for(let S of u)h.push(this.getNotebookCell(S));let y=[];for(let S of f)y.push(this.getNotebookCell(S));(m.length>0||h.length>0||d.length>0||y.length>0)&&(p.cells={added:m,removed:h,changed:{data:d,textContent:y}}),(p.metadata!==void 0||p.cells!==void 0)&&this._onDidChange.fire(p)})),n.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let s=this.notebookDocuments.get(i.notebookDocument.uri);s!==void 0&&this._onDidSave.fire(s)})),n.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{let s=this.notebookDocuments.get(i.notebookDocument.uri);if(s!==void 0){this._onDidClose.fire(s);for(let o of i.cellTextDocuments)r.closeTextDocument({textDocument:o});this.notebookDocuments.delete(i.notebookDocument.uri);for(let o of s.cells)this.notebookCellMap.delete(o.document)}})),wn.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let r of e.cells)this.notebookCellMap.set(r.document,[r,e])}};ma.NotebookDocuments=fT});var tw=R(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.MonikerFeature=void 0;var rH=Ft(),nH=t=>class extends t{get moniker(){return{on:e=>{let r=rH.MonikerRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Cf.MonikerFeature=nH});var vT=R(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.createConnection=Xe.combineFeatures=Xe.combineNotebooksFeatures=Xe.combineLanguagesFeatures=Xe.combineWorkspaceFeatures=Xe.combineWindowFeatures=Xe.combineClientFeatures=Xe.combineTracerFeatures=Xe.combineTelemetryFeatures=Xe.combineConsoleFeatures=Xe._NotebooksImpl=Xe._LanguagesImpl=Xe.BulkUnregistration=Xe.BulkRegistration=Xe.ErrorMessageTracker=void 0;var K=Ft(),Dn=kd(),mT=rT(),ve=BE(),iH=jE(),sH=UE(),oH=HE(),aH=aT(),cH=VE(),lH=WE(),uH=zE(),dH=GE(),fH=KE(),pH=JE(),hH=QE(),mH=ZE(),gH=pT(),yH=tw();function hT(t){if(t!==null)return t}var gT=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)})}};Xe.ErrorMessageTracker=gT;var Af=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(K.MessageType.Error,e)}warn(e){this.send(K.MessageType.Warning,e)}info(e){this.send(K.MessageType.Info,e)}log(e){this.send(K.MessageType.Log,e)}debug(e){this.send(K.MessageType.Debug,e)}send(e,r){this._rawConnection&&this._rawConnection.sendNotification(K.LogMessageNotification.type,{type:e,message:r}).catch(()=>{(0,K.RAL)().console.error("Sending log message failed")})}},yT=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:K.MessageType.Error,message:e,actions:r};return this.connection.sendRequest(K.ShowMessageRequest.type,n).then(hT)}showWarningMessage(e,...r){let n={type:K.MessageType.Warning,message:e,actions:r};return this.connection.sendRequest(K.ShowMessageRequest.type,n).then(hT)}showInformationMessage(e,...r){let n={type:K.MessageType.Info,message:e,actions:r};return this.connection.sendRequest(K.ShowMessageRequest.type,n).then(hT)}},rw=(0,cH.ShowDocumentFeature)((0,ve.ProgressFeature)(yT)),nw;(function(t){function e(){return new If}t.create=e})(nw||(Xe.BulkRegistration=nw={}));var If=class{constructor(){this._registrations=[],this._registered=new Set}add(e,r){let n=Dn.string(e)?e:e.method;if(this._registered.has(n))throw new Error(`${n} is already added to this registration`);let i=mT.generateUuid();this._registrations.push({id:i,method:n,registerOptions:r||{}}),this._registered.add(n)}asRegistrationParams(){return{registrations:this._registrations}}},iw;(function(t){function e(){return new Hc(void 0,[])}t.create=e})(iw||(Xe.BulkUnregistration=iw={}));var Hc=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(K.UnregistrationRequest.type,r).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){let r=Dn.string(e)?e:e.method,n=this._unregistrations.get(r);if(!n)return!1;let i={unregisterations:[n]};return this._connection.sendRequest(K.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(r)},s=>{this._connection.console.info(`Un-registering request handler for ${n.id} failed.`)}),!0}},Of=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 If?this.registerMany(e):e instanceof Hc?this.registerSingle1(e,r,n):this.registerSingle2(e,r)}registerSingle1(e,r,n){let i=Dn.string(r)?r:r.method,s=mT.generateUuid(),o={registrations:[{id:s,method:i,registerOptions:n||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(K.RegistrationRequest.type,o).then(a=>(e.add({id:s,method:i}),e),a=>(this.connection.console.info(`Registering request handler for ${i} failed.`),Promise.reject(a)))}registerSingle2(e,r){let n=Dn.string(e)?e:e.method,i=mT.generateUuid(),s={registrations:[{id:i,method:n,registerOptions:r||{}}]};return this.connection.sendRequest(K.RegistrationRequest.type,s).then(o=>K.Disposable.create(()=>{this.unregisterSingle(i,n).catch(()=>{this.connection.console.info(`Un-registering capability with id ${i} failed.`)})}),o=>(this.connection.console.info(`Registering request handler for ${n} failed.`),Promise.reject(o)))}unregisterSingle(e,r){let n={unregisterations:[{id:e,method:r}]};return this.connection.sendRequest(K.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(K.RegistrationRequest.type,r).then(()=>new Hc(this._connection,r.registrations.map(n=>({id:n.id,method:n.method}))),n=>(this.connection.console.info("Bulk registration failed."),Promise.reject(n)))}},TT=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(K.ApplyWorkspaceEditRequest.type,n)}},sw=(0,lH.FileOperationsFeature)((0,sH.WorkspaceFoldersFeature)((0,iH.ConfigurationFeature)(TT))),xf=class{constructor(){this._trace=K.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!==K.Trace.Off&&this.connection.sendNotification(K.LogTraceNotification.type,{message:e,verbose:this._trace===K.Trace.Verbose?r:void 0}).catch(()=>{})}},Mf=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(K.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}},Lf=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,ve.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,ve.attachPartialResult)(this.connection,r)}};Xe._LanguagesImpl=Lf;var ow=(0,pH.FoldingRangeFeature)((0,yH.MonikerFeature)((0,mH.DiagnosticFeature)((0,hH.InlayHintFeature)((0,fH.InlineValueFeature)((0,dH.TypeHierarchyFeature)((0,uH.LinkedEditingRangeFeature)((0,aH.SemanticTokensFeature)((0,oH.CallHierarchyFeature)(Lf))))))))),qf=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,ve.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,ve.attachPartialResult)(this.connection,r)}};Xe._NotebooksImpl=qf;var aw=(0,gH.NotebookSyncFeature)(qf);function cw(t,e){return function(r){return e(t(r))}}Xe.combineConsoleFeatures=cw;function lw(t,e){return function(r){return e(t(r))}}Xe.combineTelemetryFeatures=lw;function uw(t,e){return function(r){return e(t(r))}}Xe.combineTracerFeatures=uw;function dw(t,e){return function(r){return e(t(r))}}Xe.combineClientFeatures=dw;function fw(t,e){return function(r){return e(t(r))}}Xe.combineWindowFeatures=fw;function pw(t,e){return function(r){return e(t(r))}}Xe.combineWorkspaceFeatures=pw;function hw(t,e){return function(r){return e(t(r))}}Xe.combineLanguagesFeatures=hw;function mw(t,e){return function(r){return e(t(r))}}Xe.combineNotebooksFeatures=mw;function TH(t,e){function r(i,s,o){return i&&s?o(i,s):i||s}return{__brand:"features",console:r(t.console,e.console,cw),tracer:r(t.tracer,e.tracer,uw),telemetry:r(t.telemetry,e.telemetry,lw),client:r(t.client,e.client,dw),window:r(t.window,e.window,fw),workspace:r(t.workspace,e.workspace,pw),languages:r(t.languages,e.languages,hw),notebooks:r(t.notebooks,e.notebooks,mw)}}Xe.combineFeatures=TH;function vH(t,e,r){let n=r&&r.console?new(r.console(Af)):new Af,i=t(n);n.rawAttach(i);let s=r&&r.tracer?new(r.tracer(xf)):new xf,o=r&&r.telemetry?new(r.telemetry(Mf)):new Mf,a=r&&r.client?new(r.client(Of)):new Of,c=r&&r.window?new(r.window(rw)):new rw,l=r&&r.workspace?new(r.workspace(sw)):new sw,u=r&&r.languages?new(r.languages(ow)):new ow,d=r&&r.notebooks?new(r.notebooks(aw)):new aw,f=[n,s,o,a,c,l,u,d];function p(v){return v instanceof Promise?v:Dn.thenable(v)?new Promise((b,P)=>{v.then(N=>b(N),N=>P(N))}):Promise.resolve(v)}let m,h,y,S={listen:()=>i.listen(),sendRequest:(v,...b)=>i.sendRequest(Dn.string(v)?v:v.method,...b),onRequest:(v,b)=>i.onRequest(v,b),sendNotification:(v,b)=>{let P=Dn.string(v)?v:v.method;return i.sendNotification(P,b)},onNotification:(v,b)=>i.onNotification(v,b),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:v=>(h=v,{dispose:()=>{h=void 0}}),onInitialized:v=>i.onNotification(K.InitializedNotification.type,v),onShutdown:v=>(m=v,{dispose:()=>{m=void 0}}),onExit:v=>(y=v,{dispose:()=>{y=void 0}}),get console(){return n},get telemetry(){return o},get tracer(){return s},get client(){return a},get window(){return c},get workspace(){return l},get languages(){return u},get notebooks(){return d},onDidChangeConfiguration:v=>i.onNotification(K.DidChangeConfigurationNotification.type,v),onDidChangeWatchedFiles:v=>i.onNotification(K.DidChangeWatchedFilesNotification.type,v),__textDocumentSync:void 0,onDidOpenTextDocument:v=>i.onNotification(K.DidOpenTextDocumentNotification.type,v),onDidChangeTextDocument:v=>i.onNotification(K.DidChangeTextDocumentNotification.type,v),onDidCloseTextDocument:v=>i.onNotification(K.DidCloseTextDocumentNotification.type,v),onWillSaveTextDocument:v=>i.onNotification(K.WillSaveTextDocumentNotification.type,v),onWillSaveTextDocumentWaitUntil:v=>i.onRequest(K.WillSaveTextDocumentWaitUntilRequest.type,v),onDidSaveTextDocument:v=>i.onNotification(K.DidSaveTextDocumentNotification.type,v),sendDiagnostics:v=>i.sendNotification(K.PublishDiagnosticsNotification.type,v),onHover:v=>i.onRequest(K.HoverRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),void 0)),onCompletion:v=>i.onRequest(K.CompletionRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onCompletionResolve:v=>i.onRequest(K.CompletionResolveRequest.type,v),onSignatureHelp:v=>i.onRequest(K.SignatureHelpRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),void 0)),onDeclaration:v=>i.onRequest(K.DeclarationRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onDefinition:v=>i.onRequest(K.DefinitionRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onTypeDefinition:v=>i.onRequest(K.TypeDefinitionRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onImplementation:v=>i.onRequest(K.ImplementationRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onReferences:v=>i.onRequest(K.ReferencesRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onDocumentHighlight:v=>i.onRequest(K.DocumentHighlightRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onDocumentSymbol:v=>i.onRequest(K.DocumentSymbolRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onWorkspaceSymbol:v=>i.onRequest(K.WorkspaceSymbolRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onWorkspaceSymbolResolve:v=>i.onRequest(K.WorkspaceSymbolResolveRequest.type,v),onCodeAction:v=>i.onRequest(K.CodeActionRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onCodeActionResolve:v=>i.onRequest(K.CodeActionResolveRequest.type,(b,P)=>v(b,P)),onCodeLens:v=>i.onRequest(K.CodeLensRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onCodeLensResolve:v=>i.onRequest(K.CodeLensResolveRequest.type,(b,P)=>v(b,P)),onDocumentFormatting:v=>i.onRequest(K.DocumentFormattingRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),void 0)),onDocumentRangeFormatting:v=>i.onRequest(K.DocumentRangeFormattingRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),void 0)),onDocumentOnTypeFormatting:v=>i.onRequest(K.DocumentOnTypeFormattingRequest.type,(b,P)=>v(b,P)),onRenameRequest:v=>i.onRequest(K.RenameRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),void 0)),onPrepareRename:v=>i.onRequest(K.PrepareRenameRequest.type,(b,P)=>v(b,P)),onDocumentLinks:v=>i.onRequest(K.DocumentLinkRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onDocumentLinkResolve:v=>i.onRequest(K.DocumentLinkResolveRequest.type,(b,P)=>v(b,P)),onDocumentColor:v=>i.onRequest(K.DocumentColorRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onColorPresentation:v=>i.onRequest(K.ColorPresentationRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onFoldingRanges:v=>i.onRequest(K.FoldingRangeRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onSelectionRanges:v=>i.onRequest(K.SelectionRangeRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onExecuteCommand:v=>i.onRequest(K.ExecuteCommandRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),void 0)),dispose:()=>i.dispose()};for(let v of f)v.attach(S);return i.onRequest(K.InitializeRequest.type,v=>{e.initialize(v),Dn.string(v.trace)&&(s.trace=K.Trace.fromString(v.trace));for(let b of f)b.initialize(v.capabilities);if(h){let b=h(v,new K.CancellationTokenSource().token,(0,ve.attachWorkDone)(i,v),void 0);return p(b).then(P=>{if(P instanceof K.ResponseError)return P;let N=P;N||(N={capabilities:{}});let $=N.capabilities;$||($={},N.capabilities=$),$.textDocumentSync===void 0||$.textDocumentSync===null?$.textDocumentSync=Dn.number(S.__textDocumentSync)?S.__textDocumentSync:K.TextDocumentSyncKind.None:!Dn.number($.textDocumentSync)&&!Dn.number($.textDocumentSync.change)&&($.textDocumentSync.change=Dn.number(S.__textDocumentSync)?S.__textDocumentSync:K.TextDocumentSyncKind.None);for(let j of f)j.fillServerCapabilities($);return N})}else{let b={capabilities:{textDocumentSync:K.TextDocumentSyncKind.None}};for(let P of f)P.fillServerCapabilities(b.capabilities);return b}}),i.onRequest(K.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,m)return m(new K.CancellationTokenSource().token)}),i.onNotification(K.ExitNotification.type,()=>{try{y&&y()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(K.SetTraceNotification.type,v=>{s.trace=K.Trace.fromString(v.value)}),S}Xe.createConnection=vH});var gw=R(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});Xr.resolveModulePath=Xr.FileSystem=Xr.resolveGlobalYarnPath=Xr.resolveGlobalNodePath=Xr.resolve=Xr.uriToFilePath=void 0;var bH=require("url"),Qn=require("path"),bT=require("fs"),kT=require("child_process");function SH(t){let e=bH.parse(t);if(e.protocol!=="file:"||!e.path)return;let r=e.path.split("/");for(var n=0,i=r.length;n<i;n++)r[n]=decodeURIComponent(r[n]);if(process.platform==="win32"&&r.length>1){let s=r[0],o=r[1];s.length===0&&o.length>1&&o[1]===":"&&r.shift()}return Qn.normalize(r.join("/"))}Xr.uriToFilePath=SH;function ST(){return process.platform==="win32"}function $f(t,e,r,n){let i="NODE_PATH",s=["var p = process;","p.on('message',function(m){","if(m.c==='e'){","p.exit(0);","}","else if(m.c==='rs'){","try{","var r=require.resolve(m.a);","p.send({c:'r',s:true,r:r});","}","catch(err){","p.send({c:'r',s:false});","}","}","});"].join("");return new Promise((o,a)=>{let c=process.env,l=Object.create(null);Object.keys(c).forEach(u=>l[u]=c[u]),e&&bT.existsSync(e)&&(l[i]?l[i]=e+Qn.delimiter+l[i]:l[i]=e,n&&n(`NODE_PATH value is: ${l[i]}`)),l.ELECTRON_RUN_AS_NODE="1";try{let u=(0,kT.fork)("",[],{cwd:r,env:l,execArgv:["-e",s]});if(u.pid===void 0){a(new Error(`Starting process to resolve node module ${t} failed`));return}u.on("error",f=>{a(f)}),u.on("message",f=>{f.c==="r"&&(u.send({c:"e"}),f.s?o(f.r):a(new Error(`Failed to resolve module: ${t}`)))});let d={c:"rs",a:t};u.send(d)}catch(u){a(u)}})}Xr.resolve=$f;function _T(t){let e="npm",r=Object.create(null);Object.keys(process.env).forEach(s=>r[s]=process.env[s]),r.NO_UPDATE_NOTIFIER="true";let n={encoding:"utf8",env:r};ST()&&(e="npm.cmd",n.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let s=(0,kT.spawnSync)(e,["config","get","prefix"],n).stdout;if(!s){t&&t("'npm config get prefix' didn't return a value.");return}let o=s.trim();return t&&t(`'npm config get prefix' value is: ${o}`),o.length>0?ST()?Qn.join(o,"node_modules"):Qn.join(o,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}Xr.resolveGlobalNodePath=_T;function _H(t){let e="yarn",r={encoding:"utf8"};ST()&&(e="yarn.cmd",r.shell=!0);let n=()=>{};try{process.on("SIGPIPE",n);let i=(0,kT.spawnSync)(e,["global","dir","--json"],r),s=i.stdout;if(!s){t&&(t("'yarn global dir' didn't return a value."),i.stderr&&t(i.stderr));return}let o=s.trim().split(/\r?\n/);for(let a of o)try{let c=JSON.parse(a);if(c.type==="log")return Qn.join(c.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",n)}}Xr.resolveGlobalYarnPath=_H;var PT;(function(t){let e;function r(){return e!==void 0||(process.platform==="win32"?e=!1:e=!bT.existsSync(__filename.toUpperCase())||!bT.existsSync(__filename.toLowerCase())),e}t.isCaseSensitive=r;function n(i,s){return r()?Qn.normalize(s).indexOf(Qn.normalize(i))===0:Qn.normalize(s).toLowerCase().indexOf(Qn.normalize(i).toLowerCase())===0}t.isParent=n})(PT||(Xr.FileSystem=PT={}));function PH(t,e,r,n){return r?(Qn.isAbsolute(r)||(r=Qn.join(t,r)),$f(e,r,r,n).then(i=>PT.isParent(r,i)?i:Promise.reject(new Error(`Failed to load ${e} from node path location.`))).then(void 0,i=>$f(e,_T(n),t,n))):$f(e,_T(n),t,n)}Xr.resolveModulePath=PH});var NT=R((N5,yw)=>{"use strict";yw.exports=Ft()});var Tw=R(Ff=>{"use strict";Object.defineProperty(Ff,"__esModule",{value:!0});Ff.InlineCompletionFeature=void 0;var kH=Ft(),NH=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(kH.InlineCompletionRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};Ff.InlineCompletionFeature=NH});var Sw=R(Rr=>{"use strict";var RH=Rr&&Rr.__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]})),bw=Rr&&Rr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&RH(e,t,r)};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.ProposedFeatures=Rr.NotebookDocuments=Rr.TextDocuments=Rr.SemanticTokensBuilder=void 0;var EH=aT();Object.defineProperty(Rr,"SemanticTokensBuilder",{enumerable:!0,get:function(){return EH.SemanticTokensBuilder}});var wH=Tw();bw(Ft(),Rr);var DH=dT();Object.defineProperty(Rr,"TextDocuments",{enumerable:!0,get:function(){return DH.TextDocuments}});var CH=pT();Object.defineProperty(Rr,"NotebookDocuments",{enumerable:!0,get:function(){return CH.NotebookDocuments}});bw(vT(),Rr);var vw;(function(t){t.all={__brand:"features",languages:wH.InlineCompletionFeature}})(vw||(Rr.ProposedFeatures=vw={}))});var U=R(Cn=>{"use strict";var AH=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]})),Nw=Cn&&Cn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&AH(e,t,r)};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.createConnection=Cn.Files=void 0;var _w=require("node:util"),RT=kd(),IH=vT(),Vc=gw(),fo=NT();Nw(NT(),Cn);Nw(Sw(),Cn);var Pw;(function(t){t.uriToFilePath=Vc.uriToFilePath,t.resolveGlobalNodePath=Vc.resolveGlobalNodePath,t.resolveGlobalYarnPath=Vc.resolveGlobalYarnPath,t.resolve=Vc.resolve,t.resolveModulePath=Vc.resolveModulePath})(Pw||(Cn.Files=Pw={}));var kw;function Bf(){if(kw!==void 0)try{kw.end()}catch{}}var ga=!1,Rw;function OH(){let t="--clientProcessId";function e(r){try{let n=parseInt(r);isNaN(n)||(Rw=setInterval(()=>{try{process.kill(n,0)}catch{Bf(),process.exit(ga?0:1)}},3e3))}catch{}}for(let r=2;r<process.argv.length;r++){let n=process.argv[r];if(n===t&&r+1<process.argv.length){e(process.argv[r+1]);return}else{let i=n.split("=");i[0]===t&&e(i[1])}}}OH();var xH={initialize:t=>{let e=t.processId;RT.number(e)&&Rw===void 0&&setInterval(()=>{try{process.kill(e,0)}catch{process.exit(ga?0:1)}},3e3)},get shutdownReceived(){return ga},set shutdownReceived(t){ga=t},exit:t=>{Bf(),process.exit(t)}};function MH(t,e,r,n){let i,s,o,a;return t!==void 0&&t.__brand==="features"&&(i=t,t=e,e=r,r=n),fo.ConnectionStrategy.is(t)||fo.ConnectionOptions.is(t)?a=t:(s=t,o=e,a=r),LH(s,o,a,i)}Cn.createConnection=MH;function LH(t,e,r,n){let i=!1;if(!t&&!e&&process.argv.length>2){let c,l,u=process.argv.slice(2);for(let d=0;d<u.length;d++){let f=u[d];if(f==="--node-ipc"){t=new fo.IPCMessageReader(process),e=new fo.IPCMessageWriter(process);break}else if(f==="--stdio"){i=!0,t=process.stdin,e=process.stdout;break}else if(f==="--socket"){c=parseInt(u[d+1]);break}else if(f==="--pipe"){l=u[d+1];break}else{var s=f.split("=");if(s[0]==="--socket"){c=parseInt(s[1]);break}else if(s[0]==="--pipe"){l=s[1];break}}}if(c){let d=(0,fo.createServerSocketTransport)(c);t=d[0],e=d[1]}else if(l){let d=(0,fo.createServerPipeTransport)(l);t=d[0],e=d[1]}}var o="Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'";if(!t)throw new Error("Connection input stream is not set. "+o);if(!e)throw new Error("Connection output stream is not set. "+o);if(RT.func(t.read)&&RT.func(t.on)){let c=t;c.on("end",()=>{Bf(),process.exit(ga?0:1)}),c.on("close",()=>{Bf(),process.exit(ga?0:1)})}let a=c=>{let l=(0,fo.createProtocolConnection)(t,e,c,r);return i&&qH(c),l};return(0,IH.createConnection)(a,xH,n)}function qH(t){function e(n){return n.map(i=>typeof i=="string"?i:(0,_w.inspect)(i)).join(" ")}let r=new Map;console.assert=function(i,...s){if(!i)if(s.length===0)t.error("Assertion failed");else{let[o,...a]=s;t.error(`Assertion failed: ${o} ${e(a)}`)}},console.count=function(i="default"){let s=String(i),o=r.get(s)??0;o+=1,r.set(s,o),t.log(`${s}: ${s}`)},console.countReset=function(i){i===void 0?r.clear():r.delete(String(i))},console.debug=function(...i){t.log(e(i))},console.dir=function(i,s){t.log((0,_w.inspect)(i,s))},console.log=function(...i){t.log(e(i))},console.error=function(...i){t.error(e(i))},console.trace=function(...i){let s=new Error().stack.replace(/(.+\n){2}/,""),o="Trace";i.length!==0&&(o+=`: ${e(i)}`),t.log(`${o}
37
- ${s}`)},console.warn=function(...i){t.warn(e(i))}}});var ww=R((C5,Ew)=>{"use strict";Ew.exports=U()});var Ve=R(Tr=>{"use strict";var Vv=Symbol.for("yaml.alias"),PM=Symbol.for("yaml.document"),$h=Symbol.for("yaml.map"),kM=Symbol.for("yaml.pair"),Wv=Symbol.for("yaml.scalar"),Fh=Symbol.for("yaml.seq"),rs=Symbol.for("yaml.node.type"),J2=t=>!!t&&typeof t=="object"&&t[rs]===Vv,Q2=t=>!!t&&typeof t=="object"&&t[rs]===PM,Z2=t=>!!t&&typeof t=="object"&&t[rs]===$h,ez=t=>!!t&&typeof t=="object"&&t[rs]===kM,NM=t=>!!t&&typeof t=="object"&&t[rs]===Wv,tz=t=>!!t&&typeof t=="object"&&t[rs]===Fh;function RM(t){if(t&&typeof t=="object")switch(t[rs]){case $h:case Fh:return!0}return!1}function rz(t){if(t&&typeof t=="object")switch(t[rs]){case Vv:case $h:case Wv:case Fh:return!0}return!1}var nz=t=>(NM(t)||RM(t))&&!!t.anchor;Tr.ALIAS=Vv;Tr.DOC=PM;Tr.MAP=$h;Tr.NODE_TYPE=rs;Tr.PAIR=kM;Tr.SCALAR=Wv;Tr.SEQ=Fh;Tr.hasAnchor=nz;Tr.isAlias=J2;Tr.isCollection=RM;Tr.isDocument=Q2;Tr.isMap=Z2;Tr.isNode=rz;Tr.isPair=ez;Tr.isScalar=NM;Tr.isSeq=tz});var Hl=R(zv=>{"use strict";var er=Ve(),on=Symbol("break visit"),EM=Symbol("skip children"),Mi=Symbol("remove node");function Bh(t,e){let r=wM(e);er.isDocument(t)?Ya(null,t.contents,r,Object.freeze([t]))===Mi&&(t.contents=null):Ya(null,t,r,Object.freeze([]))}Bh.BREAK=on;Bh.SKIP=EM;Bh.REMOVE=Mi;function Ya(t,e,r,n){let i=DM(t,e,r,n);if(er.isNode(i)||er.isPair(i))return CM(t,n,i),Ya(t,i,r,n);if(typeof i!="symbol"){if(er.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s<e.items.length;++s){let o=Ya(s,e.items[s],r,n);if(typeof o=="number")s=o-1;else{if(o===on)return on;o===Mi&&(e.items.splice(s,1),s-=1)}}}else if(er.isPair(e)){n=Object.freeze(n.concat(e));let s=Ya("key",e.key,r,n);if(s===on)return on;s===Mi&&(e.key=null);let o=Ya("value",e.value,r,n);if(o===on)return on;o===Mi&&(e.value=null)}}return i}async function jh(t,e){let r=wM(e);er.isDocument(t)?await Ka(null,t.contents,r,Object.freeze([t]))===Mi&&(t.contents=null):await Ka(null,t,r,Object.freeze([]))}jh.BREAK=on;jh.SKIP=EM;jh.REMOVE=Mi;async function Ka(t,e,r,n){let i=await DM(t,e,r,n);if(er.isNode(i)||er.isPair(i))return CM(t,n,i),Ka(t,i,r,n);if(typeof i!="symbol"){if(er.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s<e.items.length;++s){let o=await Ka(s,e.items[s],r,n);if(typeof o=="number")s=o-1;else{if(o===on)return on;o===Mi&&(e.items.splice(s,1),s-=1)}}}else if(er.isPair(e)){n=Object.freeze(n.concat(e));let s=await Ka("key",e.key,r,n);if(s===on)return on;s===Mi&&(e.key=null);let o=await Ka("value",e.value,r,n);if(o===on)return on;o===Mi&&(e.value=null)}}return i}function wM(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function DM(t,e,r,n){if(typeof r=="function")return r(t,e,n);if(er.isMap(e))return r.Map?.(t,e,n);if(er.isSeq(e))return r.Seq?.(t,e,n);if(er.isPair(e))return r.Pair?.(t,e,n);if(er.isScalar(e))return r.Scalar?.(t,e,n);if(er.isAlias(e))return r.Alias?.(t,e,n)}function CM(t,e,r){let n=e[e.length-1];if(er.isCollection(n))n.items[t]=r;else if(er.isPair(n))t==="key"?n.key=r:n.value=r;else if(er.isDocument(n))n.contents=r;else{let i=er.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}zv.visit=Bh;zv.visitAsync=jh});var Gv=R(IM=>{"use strict";var AM=Ve(),iz=Hl(),sz={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},oz=t=>t.replace(/[!,[\]{}]/g,e=>sz[e]),Vl=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[s,o]=n;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[s]=n;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let o=/^\d+\.\d+$/.test(s);return r(6,`Unsupported YAML version ${s}`,o),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let s=this.tags[n];if(s)try{return s+decodeURIComponent(i)}catch(o){return r(String(o)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+oz(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&AM.isNode(e.contents)){let s={};iz.visit(e.contents,(o,a)=>{AM.isNode(a)&&a.tag&&(s[a.tag]=!0)}),i=Object.keys(s)}else i=[];for(let[s,o]of n)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&r.push(`%TAG ${s} ${o}`);return r.join(`
36
+ `&&g++}_&&D.length>0&&w.push(D.length),this._lineOffsets=w}return this._lineOffsets},T.prototype.positionAt=function(w){w=Math.max(Math.min(w,this._content.length),0);var D=this.getLineOffsets(),_=0,g=D.length;if(g===0)return o.create(0,w);for(;_<g;){var A=Math.floor((_+g)/2);D[A]>w?g=A:_=A+1}var B=_-1;return o.create(B,w-D[B])},T.prototype.offsetAt=function(w){var D=this.getLineOffsets();if(w.line>=D.length)return this._content.length;if(w.line<0)return 0;var _=D[w.line],g=w.line+1<D.length?D[w.line+1]:this._content.length;return Math.max(Math.min(_+w.character,g),_)},Object.defineProperty(T.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),T})(),I;(function(T){var w=Object.prototype.toString;function D($e){return typeof $e<"u"}T.defined=D;function _($e){return typeof $e>"u"}T.undefined=_;function g($e){return $e===!0||$e===!1}T.boolean=g;function A($e){return w.call($e)==="[object String]"}T.string=A;function B($e){return w.call($e)==="[object Number]"}T.number=B;function be($e,Yo,Pd){return w.call($e)==="[object Number]"&&Yo<=$e&&$e<=Pd}T.numberRange=be;function xt($e){return w.call($e)==="[object Number]"&&-2147483648<=$e&&$e<=2147483647}T.integer=xt;function yt($e){return w.call($e)==="[object Number]"&&0<=$e&&$e<=2147483647}T.uinteger=yt;function Yn($e){return w.call($e)==="[object Function]"}T.func=Yn;function Kn($e){return $e!==null&&typeof $e=="object"}T.objectLiteral=Kn;function Vi($e,Yo){return Array.isArray($e)&&$e.every(Yo)}T.typedArray=Vi})(I||(I={}))})});var Rt=R(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.ProtocolNotificationType=Gr.ProtocolNotificationType0=Gr.ProtocolRequestType=Gr.ProtocolRequestType0=Gr.RegistrationType=Gr.MessageDirection=void 0;var na=ao(),Bk;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(Bk||(Gr.MessageDirection=Bk={}));var By=class{constructor(e){this.method=e}};Gr.RegistrationType=By;var jy=class extends na.RequestType0{constructor(e){super(e)}};Gr.ProtocolRequestType0=jy;var Uy=class extends na.RequestType{constructor(e){super(e,na.ParameterStructures.byName)}};Gr.ProtocolRequestType=Uy;var Hy=class extends na.NotificationType0{constructor(e){super(e)}};Gr.ProtocolNotificationType0=Hy;var Vy=class extends na.NotificationType{constructor(e){super(e,na.ParameterStructures.byName)}};Gr.ProtocolNotificationType=Vy});var Yd=R(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.objectLiteral=zt.typedArray=zt.stringArray=zt.array=zt.func=zt.error=zt.number=zt.string=zt.boolean=void 0;function lU(t){return t===!0||t===!1}zt.boolean=lU;function jk(t){return typeof t=="string"||t instanceof String}zt.string=jk;function uU(t){return typeof t=="number"||t instanceof Number}zt.number=uU;function dU(t){return t instanceof Error}zt.error=dU;function fU(t){return typeof t=="function"}zt.func=fU;function Uk(t){return Array.isArray(t)}zt.array=Uk;function pU(t){return Uk(t)&&t.every(e=>jk(e))}zt.stringArray=pU;function hU(t,e){return Array.isArray(t)&&t.every(e)}zt.typedArray=hU;function mU(t){return t!==null&&typeof t=="object"}zt.objectLiteral=mU});var Wk=R(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.ImplementationRequest=void 0;var Hk=Rt(),Vk;(function(t){t.method="textDocument/implementation",t.messageDirection=Hk.MessageDirection.clientToServer,t.type=new Hk.ProtocolRequestType(t.method)})(Vk||(Kd.ImplementationRequest=Vk={}))});var Yk=R(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});Xd.TypeDefinitionRequest=void 0;var zk=Rt(),Gk;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=zk.MessageDirection.clientToServer,t.type=new zk.ProtocolRequestType(t.method)})(Gk||(Xd.TypeDefinitionRequest=Gk={}))});var Jk=R(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.DidChangeWorkspaceFoldersNotification=ia.WorkspaceFoldersRequest=void 0;var Jd=Rt(),Kk;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=Jd.MessageDirection.serverToClient,t.type=new Jd.ProtocolRequestType0(t.method)})(Kk||(ia.WorkspaceFoldersRequest=Kk={}));var Xk;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=Jd.MessageDirection.clientToServer,t.type=new Jd.ProtocolNotificationType(t.method)})(Xk||(ia.DidChangeWorkspaceFoldersNotification=Xk={}))});var eN=R(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.ConfigurationRequest=void 0;var Qk=Rt(),Zk;(function(t){t.method="workspace/configuration",t.messageDirection=Qk.MessageDirection.serverToClient,t.type=new Qk.ProtocolRequestType(t.method)})(Zk||(Qd.ConfigurationRequest=Zk={}))});var nN=R(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.ColorPresentationRequest=sa.DocumentColorRequest=void 0;var Zd=Rt(),tN;(function(t){t.method="textDocument/documentColor",t.messageDirection=Zd.MessageDirection.clientToServer,t.type=new Zd.ProtocolRequestType(t.method)})(tN||(sa.DocumentColorRequest=tN={}));var rN;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=Zd.MessageDirection.clientToServer,t.type=new Zd.ProtocolRequestType(t.method)})(rN||(sa.ColorPresentationRequest=rN={}))});var oN=R(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.FoldingRangeRefreshRequest=oa.FoldingRangeRequest=void 0;var ef=Rt(),iN;(function(t){t.method="textDocument/foldingRange",t.messageDirection=ef.MessageDirection.clientToServer,t.type=new ef.ProtocolRequestType(t.method)})(iN||(oa.FoldingRangeRequest=iN={}));var sN;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=ef.MessageDirection.serverToClient,t.type=new ef.ProtocolRequestType0(t.method)})(sN||(oa.FoldingRangeRefreshRequest=sN={}))});var lN=R(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});tf.DeclarationRequest=void 0;var aN=Rt(),cN;(function(t){t.method="textDocument/declaration",t.messageDirection=aN.MessageDirection.clientToServer,t.type=new aN.ProtocolRequestType(t.method)})(cN||(tf.DeclarationRequest=cN={}))});var fN=R(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});rf.SelectionRangeRequest=void 0;var uN=Rt(),dN;(function(t){t.method="textDocument/selectionRange",t.messageDirection=uN.MessageDirection.clientToServer,t.type=new uN.ProtocolRequestType(t.method)})(dN||(rf.SelectionRangeRequest=dN={}))});var gN=R(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.WorkDoneProgressCancelNotification=hs.WorkDoneProgressCreateRequest=hs.WorkDoneProgress=void 0;var gU=ao(),nf=Rt(),pN;(function(t){t.type=new gU.ProgressType;function e(r){return r===t.type}t.is=e})(pN||(hs.WorkDoneProgress=pN={}));var hN;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=nf.MessageDirection.serverToClient,t.type=new nf.ProtocolRequestType(t.method)})(hN||(hs.WorkDoneProgressCreateRequest=hN={}));var mN;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=nf.MessageDirection.clientToServer,t.type=new nf.ProtocolNotificationType(t.method)})(mN||(hs.WorkDoneProgressCancelNotification=mN={}))});var bN=R(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.CallHierarchyOutgoingCallsRequest=ms.CallHierarchyIncomingCallsRequest=ms.CallHierarchyPrepareRequest=void 0;var aa=Rt(),yN;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=aa.MessageDirection.clientToServer,t.type=new aa.ProtocolRequestType(t.method)})(yN||(ms.CallHierarchyPrepareRequest=yN={}));var TN;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=aa.MessageDirection.clientToServer,t.type=new aa.ProtocolRequestType(t.method)})(TN||(ms.CallHierarchyIncomingCallsRequest=TN={}));var vN;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=aa.MessageDirection.clientToServer,t.type=new aa.ProtocolRequestType(t.method)})(vN||(ms.CallHierarchyOutgoingCallsRequest=vN={}))});var RN=R(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.SemanticTokensRefreshRequest=Yr.SemanticTokensRangeRequest=Yr.SemanticTokensDeltaRequest=Yr.SemanticTokensRequest=Yr.SemanticTokensRegistrationType=Yr.TokenFormat=void 0;var zi=Rt(),SN;(function(t){t.Relative="relative"})(SN||(Yr.TokenFormat=SN={}));var Lc;(function(t){t.method="textDocument/semanticTokens",t.type=new zi.RegistrationType(t.method)})(Lc||(Yr.SemanticTokensRegistrationType=Lc={}));var _N;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=zi.MessageDirection.clientToServer,t.type=new zi.ProtocolRequestType(t.method),t.registrationMethod=Lc.method})(_N||(Yr.SemanticTokensRequest=_N={}));var PN;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=zi.MessageDirection.clientToServer,t.type=new zi.ProtocolRequestType(t.method),t.registrationMethod=Lc.method})(PN||(Yr.SemanticTokensDeltaRequest=PN={}));var kN;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=zi.MessageDirection.clientToServer,t.type=new zi.ProtocolRequestType(t.method),t.registrationMethod=Lc.method})(kN||(Yr.SemanticTokensRangeRequest=kN={}));var NN;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=zi.MessageDirection.serverToClient,t.type=new zi.ProtocolRequestType0(t.method)})(NN||(Yr.SemanticTokensRefreshRequest=NN={}))});var DN=R(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.ShowDocumentRequest=void 0;var EN=Rt(),wN;(function(t){t.method="window/showDocument",t.messageDirection=EN.MessageDirection.serverToClient,t.type=new EN.ProtocolRequestType(t.method)})(wN||(sf.ShowDocumentRequest=wN={}))});var IN=R(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.LinkedEditingRangeRequest=void 0;var CN=Rt(),AN;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=CN.MessageDirection.clientToServer,t.type=new CN.ProtocolRequestType(t.method)})(AN||(of.LinkedEditingRangeRequest=AN={}))});var BN=R(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.WillDeleteFilesRequest=Nr.DidDeleteFilesNotification=Nr.DidRenameFilesNotification=Nr.WillRenameFilesRequest=Nr.DidCreateFilesNotification=Nr.WillCreateFilesRequest=Nr.FileOperationPatternKind=void 0;var Nn=Rt(),ON;(function(t){t.file="file",t.folder="folder"})(ON||(Nr.FileOperationPatternKind=ON={}));var xN;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=Nn.MessageDirection.clientToServer,t.type=new Nn.ProtocolRequestType(t.method)})(xN||(Nr.WillCreateFilesRequest=xN={}));var MN;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=Nn.MessageDirection.clientToServer,t.type=new Nn.ProtocolNotificationType(t.method)})(MN||(Nr.DidCreateFilesNotification=MN={}));var LN;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=Nn.MessageDirection.clientToServer,t.type=new Nn.ProtocolRequestType(t.method)})(LN||(Nr.WillRenameFilesRequest=LN={}));var qN;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=Nn.MessageDirection.clientToServer,t.type=new Nn.ProtocolNotificationType(t.method)})(qN||(Nr.DidRenameFilesNotification=qN={}));var $N;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=Nn.MessageDirection.clientToServer,t.type=new Nn.ProtocolNotificationType(t.method)})($N||(Nr.DidDeleteFilesNotification=$N={}));var FN;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=Nn.MessageDirection.clientToServer,t.type=new Nn.ProtocolRequestType(t.method)})(FN||(Nr.WillDeleteFilesRequest=FN={}))});var WN=R(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.MonikerRequest=gs.MonikerKind=gs.UniquenessLevel=void 0;var jN=Rt(),UN;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(UN||(gs.UniquenessLevel=UN={}));var HN;(function(t){t.$import="import",t.$export="export",t.local="local"})(HN||(gs.MonikerKind=HN={}));var VN;(function(t){t.method="textDocument/moniker",t.messageDirection=jN.MessageDirection.clientToServer,t.type=new jN.ProtocolRequestType(t.method)})(VN||(gs.MonikerRequest=VN={}))});var KN=R(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.TypeHierarchySubtypesRequest=ys.TypeHierarchySupertypesRequest=ys.TypeHierarchyPrepareRequest=void 0;var ca=Rt(),zN;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=ca.MessageDirection.clientToServer,t.type=new ca.ProtocolRequestType(t.method)})(zN||(ys.TypeHierarchyPrepareRequest=zN={}));var GN;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=ca.MessageDirection.clientToServer,t.type=new ca.ProtocolRequestType(t.method)})(GN||(ys.TypeHierarchySupertypesRequest=GN={}));var YN;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=ca.MessageDirection.clientToServer,t.type=new ca.ProtocolRequestType(t.method)})(YN||(ys.TypeHierarchySubtypesRequest=YN={}))});var QN=R(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.InlineValueRefreshRequest=la.InlineValueRequest=void 0;var af=Rt(),XN;(function(t){t.method="textDocument/inlineValue",t.messageDirection=af.MessageDirection.clientToServer,t.type=new af.ProtocolRequestType(t.method)})(XN||(la.InlineValueRequest=XN={}));var JN;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=af.MessageDirection.serverToClient,t.type=new af.ProtocolRequestType0(t.method)})(JN||(la.InlineValueRefreshRequest=JN={}))});var rR=R(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.InlayHintRefreshRequest=Ts.InlayHintResolveRequest=Ts.InlayHintRequest=void 0;var ua=Rt(),ZN;(function(t){t.method="textDocument/inlayHint",t.messageDirection=ua.MessageDirection.clientToServer,t.type=new ua.ProtocolRequestType(t.method)})(ZN||(Ts.InlayHintRequest=ZN={}));var eR;(function(t){t.method="inlayHint/resolve",t.messageDirection=ua.MessageDirection.clientToServer,t.type=new ua.ProtocolRequestType(t.method)})(eR||(Ts.InlayHintResolveRequest=eR={}));var tR;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=ua.MessageDirection.serverToClient,t.type=new ua.ProtocolRequestType0(t.method)})(tR||(Ts.InlayHintRefreshRequest=tR={}))});var lR=R(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.DiagnosticRefreshRequest=Rn.WorkspaceDiagnosticRequest=Rn.DocumentDiagnosticRequest=Rn.DocumentDiagnosticReportKind=Rn.DiagnosticServerCancellationData=void 0;var cR=ao(),yU=Yd(),da=Rt(),nR;(function(t){function e(r){let n=r;return n&&yU.boolean(n.retriggerRequest)}t.is=e})(nR||(Rn.DiagnosticServerCancellationData=nR={}));var iR;(function(t){t.Full="full",t.Unchanged="unchanged"})(iR||(Rn.DocumentDiagnosticReportKind=iR={}));var sR;(function(t){t.method="textDocument/diagnostic",t.messageDirection=da.MessageDirection.clientToServer,t.type=new da.ProtocolRequestType(t.method),t.partialResult=new cR.ProgressType})(sR||(Rn.DocumentDiagnosticRequest=sR={}));var oR;(function(t){t.method="workspace/diagnostic",t.messageDirection=da.MessageDirection.clientToServer,t.type=new da.ProtocolRequestType(t.method),t.partialResult=new cR.ProgressType})(oR||(Rn.WorkspaceDiagnosticRequest=oR={}));var aR;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=da.MessageDirection.serverToClient,t.type=new da.ProtocolRequestType0(t.method)})(aR||(Rn.DiagnosticRefreshRequest=aR={}))});var gR=R(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.DidCloseNotebookDocumentNotification=Mt.DidSaveNotebookDocumentNotification=Mt.DidChangeNotebookDocumentNotification=Mt.NotebookCellArrayChange=Mt.DidOpenNotebookDocumentNotification=Mt.NotebookDocumentSyncRegistrationType=Mt.NotebookDocument=Mt.NotebookCell=Mt.ExecutionSummary=Mt.NotebookCellKind=void 0;var qc=Gd(),Jn=Yd(),bi=Rt(),Wy;(function(t){t.Markup=1,t.Code=2;function e(r){return r===1||r===2}t.is=e})(Wy||(Mt.NotebookCellKind=Wy={}));var zy;(function(t){function e(i,s){let o={executionOrder:i};return(s===!0||s===!1)&&(o.success=s),o}t.create=e;function r(i){let s=i;return Jn.objectLiteral(s)&&qc.uinteger.is(s.executionOrder)&&(s.success===void 0||Jn.boolean(s.success))}t.is=r;function n(i,s){return i===s?!0:i==null||s===null||s===void 0?!1:i.executionOrder===s.executionOrder&&i.success===s.success}t.equals=n})(zy||(Mt.ExecutionSummary=zy={}));var cf;(function(t){function e(s,o){return{kind:s,document:o}}t.create=e;function r(s){let o=s;return Jn.objectLiteral(o)&&Wy.is(o.kind)&&qc.DocumentUri.is(o.document)&&(o.metadata===void 0||Jn.objectLiteral(o.metadata))}t.is=r;function n(s,o){let a=new Set;return s.document!==o.document&&a.add("document"),s.kind!==o.kind&&a.add("kind"),s.executionSummary!==o.executionSummary&&a.add("executionSummary"),(s.metadata!==void 0||o.metadata!==void 0)&&!i(s.metadata,o.metadata)&&a.add("metadata"),(s.executionSummary!==void 0||o.executionSummary!==void 0)&&!zy.equals(s.executionSummary,o.executionSummary)&&a.add("executionSummary"),a}t.diff=n;function i(s,o){if(s===o)return!0;if(s==null||o===null||o===void 0||typeof s!=typeof o||typeof s!="object")return!1;let a=Array.isArray(s),c=Array.isArray(o);if(a!==c)return!1;if(a&&c){if(s.length!==o.length)return!1;for(let l=0;l<s.length;l++)if(!i(s[l],o[l]))return!1}if(Jn.objectLiteral(s)&&Jn.objectLiteral(o)){let l=Object.keys(s),u=Object.keys(o);if(l.length!==u.length||(l.sort(),u.sort(),!i(l,u)))return!1;for(let d=0;d<l.length;d++){let f=l[d];if(!i(s[f],o[f]))return!1}}return!0}})(cf||(Mt.NotebookCell=cf={}));var uR;(function(t){function e(n,i,s,o){return{uri:n,notebookType:i,version:s,cells:o}}t.create=e;function r(n){let i=n;return Jn.objectLiteral(i)&&Jn.string(i.uri)&&qc.integer.is(i.version)&&Jn.typedArray(i.cells,cf.is)}t.is=r})(uR||(Mt.NotebookDocument=uR={}));var fa;(function(t){t.method="notebookDocument/sync",t.messageDirection=bi.MessageDirection.clientToServer,t.type=new bi.RegistrationType(t.method)})(fa||(Mt.NotebookDocumentSyncRegistrationType=fa={}));var dR;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=bi.MessageDirection.clientToServer,t.type=new bi.ProtocolNotificationType(t.method),t.registrationMethod=fa.method})(dR||(Mt.DidOpenNotebookDocumentNotification=dR={}));var fR;(function(t){function e(n){let i=n;return Jn.objectLiteral(i)&&qc.uinteger.is(i.start)&&qc.uinteger.is(i.deleteCount)&&(i.cells===void 0||Jn.typedArray(i.cells,cf.is))}t.is=e;function r(n,i,s){let o={start:n,deleteCount:i};return s!==void 0&&(o.cells=s),o}t.create=r})(fR||(Mt.NotebookCellArrayChange=fR={}));var pR;(function(t){t.method="notebookDocument/didChange",t.messageDirection=bi.MessageDirection.clientToServer,t.type=new bi.ProtocolNotificationType(t.method),t.registrationMethod=fa.method})(pR||(Mt.DidChangeNotebookDocumentNotification=pR={}));var hR;(function(t){t.method="notebookDocument/didSave",t.messageDirection=bi.MessageDirection.clientToServer,t.type=new bi.ProtocolNotificationType(t.method),t.registrationMethod=fa.method})(hR||(Mt.DidSaveNotebookDocumentNotification=hR={}));var mR;(function(t){t.method="notebookDocument/didClose",t.messageDirection=bi.MessageDirection.clientToServer,t.type=new bi.ProtocolNotificationType(t.method),t.registrationMethod=fa.method})(mR||(Mt.DidCloseNotebookDocumentNotification=mR={}))});var vR=R(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});lf.InlineCompletionRequest=void 0;var yR=Rt(),TR;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=yR.MessageDirection.clientToServer,t.type=new yR.ProtocolRequestType(t.method)})(TR||(lf.InlineCompletionRequest=TR={}))});var IE=R(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.WorkspaceSymbolRequest=k.CodeActionResolveRequest=k.CodeActionRequest=k.DocumentSymbolRequest=k.DocumentHighlightRequest=k.ReferencesRequest=k.DefinitionRequest=k.SignatureHelpRequest=k.SignatureHelpTriggerKind=k.HoverRequest=k.CompletionResolveRequest=k.CompletionRequest=k.CompletionTriggerKind=k.PublishDiagnosticsNotification=k.WatchKind=k.RelativePattern=k.FileChangeType=k.DidChangeWatchedFilesNotification=k.WillSaveTextDocumentWaitUntilRequest=k.WillSaveTextDocumentNotification=k.TextDocumentSaveReason=k.DidSaveTextDocumentNotification=k.DidCloseTextDocumentNotification=k.DidChangeTextDocumentNotification=k.TextDocumentContentChangeEvent=k.DidOpenTextDocumentNotification=k.TextDocumentSyncKind=k.TelemetryEventNotification=k.LogMessageNotification=k.ShowMessageRequest=k.ShowMessageNotification=k.MessageType=k.DidChangeConfigurationNotification=k.ExitNotification=k.ShutdownRequest=k.InitializedNotification=k.InitializeErrorCodes=k.InitializeRequest=k.WorkDoneProgressOptions=k.TextDocumentRegistrationOptions=k.StaticRegistrationOptions=k.PositionEncodingKind=k.FailureHandlingKind=k.ResourceOperationKind=k.UnregistrationRequest=k.RegistrationRequest=k.DocumentSelector=k.NotebookCellTextDocumentFilter=k.NotebookDocumentFilter=k.TextDocumentFilter=void 0;k.MonikerRequest=k.MonikerKind=k.UniquenessLevel=k.WillDeleteFilesRequest=k.DidDeleteFilesNotification=k.WillRenameFilesRequest=k.DidRenameFilesNotification=k.WillCreateFilesRequest=k.DidCreateFilesNotification=k.FileOperationPatternKind=k.LinkedEditingRangeRequest=k.ShowDocumentRequest=k.SemanticTokensRegistrationType=k.SemanticTokensRefreshRequest=k.SemanticTokensRangeRequest=k.SemanticTokensDeltaRequest=k.SemanticTokensRequest=k.TokenFormat=k.CallHierarchyPrepareRequest=k.CallHierarchyOutgoingCallsRequest=k.CallHierarchyIncomingCallsRequest=k.WorkDoneProgressCancelNotification=k.WorkDoneProgressCreateRequest=k.WorkDoneProgress=k.SelectionRangeRequest=k.DeclarationRequest=k.FoldingRangeRefreshRequest=k.FoldingRangeRequest=k.ColorPresentationRequest=k.DocumentColorRequest=k.ConfigurationRequest=k.DidChangeWorkspaceFoldersNotification=k.WorkspaceFoldersRequest=k.TypeDefinitionRequest=k.ImplementationRequest=k.ApplyWorkspaceEditRequest=k.ExecuteCommandRequest=k.PrepareRenameRequest=k.RenameRequest=k.PrepareSupportDefaultBehavior=k.DocumentOnTypeFormattingRequest=k.DocumentRangesFormattingRequest=k.DocumentRangeFormattingRequest=k.DocumentFormattingRequest=k.DocumentLinkResolveRequest=k.DocumentLinkRequest=k.CodeLensRefreshRequest=k.CodeLensResolveRequest=k.CodeLensRequest=k.WorkspaceSymbolResolveRequest=void 0;k.InlineCompletionRequest=k.DidCloseNotebookDocumentNotification=k.DidSaveNotebookDocumentNotification=k.DidChangeNotebookDocumentNotification=k.NotebookCellArrayChange=k.DidOpenNotebookDocumentNotification=k.NotebookDocumentSyncRegistrationType=k.NotebookDocument=k.NotebookCell=k.ExecutionSummary=k.NotebookCellKind=k.DiagnosticRefreshRequest=k.WorkspaceDiagnosticRequest=k.DocumentDiagnosticRequest=k.DocumentDiagnosticReportKind=k.DiagnosticServerCancellationData=k.InlayHintRefreshRequest=k.InlayHintResolveRequest=k.InlayHintRequest=k.InlineValueRefreshRequest=k.InlineValueRequest=k.TypeHierarchySupertypesRequest=k.TypeHierarchySubtypesRequest=k.TypeHierarchyPrepareRequest=void 0;var z=Rt(),bR=Gd(),rr=Yd(),TU=Wk();Object.defineProperty(k,"ImplementationRequest",{enumerable:!0,get:function(){return TU.ImplementationRequest}});var vU=Yk();Object.defineProperty(k,"TypeDefinitionRequest",{enumerable:!0,get:function(){return vU.TypeDefinitionRequest}});var wE=Jk();Object.defineProperty(k,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return wE.WorkspaceFoldersRequest}});Object.defineProperty(k,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return wE.DidChangeWorkspaceFoldersNotification}});var bU=eN();Object.defineProperty(k,"ConfigurationRequest",{enumerable:!0,get:function(){return bU.ConfigurationRequest}});var DE=nN();Object.defineProperty(k,"DocumentColorRequest",{enumerable:!0,get:function(){return DE.DocumentColorRequest}});Object.defineProperty(k,"ColorPresentationRequest",{enumerable:!0,get:function(){return DE.ColorPresentationRequest}});var CE=oN();Object.defineProperty(k,"FoldingRangeRequest",{enumerable:!0,get:function(){return CE.FoldingRangeRequest}});Object.defineProperty(k,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return CE.FoldingRangeRefreshRequest}});var SU=lN();Object.defineProperty(k,"DeclarationRequest",{enumerable:!0,get:function(){return SU.DeclarationRequest}});var _U=fN();Object.defineProperty(k,"SelectionRangeRequest",{enumerable:!0,get:function(){return _U.SelectionRangeRequest}});var Jy=gN();Object.defineProperty(k,"WorkDoneProgress",{enumerable:!0,get:function(){return Jy.WorkDoneProgress}});Object.defineProperty(k,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return Jy.WorkDoneProgressCreateRequest}});Object.defineProperty(k,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return Jy.WorkDoneProgressCancelNotification}});var Qy=bN();Object.defineProperty(k,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return Qy.CallHierarchyIncomingCallsRequest}});Object.defineProperty(k,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return Qy.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(k,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return Qy.CallHierarchyPrepareRequest}});var pa=RN();Object.defineProperty(k,"TokenFormat",{enumerable:!0,get:function(){return pa.TokenFormat}});Object.defineProperty(k,"SemanticTokensRequest",{enumerable:!0,get:function(){return pa.SemanticTokensRequest}});Object.defineProperty(k,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return pa.SemanticTokensDeltaRequest}});Object.defineProperty(k,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return pa.SemanticTokensRangeRequest}});Object.defineProperty(k,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return pa.SemanticTokensRefreshRequest}});Object.defineProperty(k,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return pa.SemanticTokensRegistrationType}});var PU=DN();Object.defineProperty(k,"ShowDocumentRequest",{enumerable:!0,get:function(){return PU.ShowDocumentRequest}});var kU=IN();Object.defineProperty(k,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return kU.LinkedEditingRangeRequest}});var co=BN();Object.defineProperty(k,"FileOperationPatternKind",{enumerable:!0,get:function(){return co.FileOperationPatternKind}});Object.defineProperty(k,"DidCreateFilesNotification",{enumerable:!0,get:function(){return co.DidCreateFilesNotification}});Object.defineProperty(k,"WillCreateFilesRequest",{enumerable:!0,get:function(){return co.WillCreateFilesRequest}});Object.defineProperty(k,"DidRenameFilesNotification",{enumerable:!0,get:function(){return co.DidRenameFilesNotification}});Object.defineProperty(k,"WillRenameFilesRequest",{enumerable:!0,get:function(){return co.WillRenameFilesRequest}});Object.defineProperty(k,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return co.DidDeleteFilesNotification}});Object.defineProperty(k,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return co.WillDeleteFilesRequest}});var Zy=WN();Object.defineProperty(k,"UniquenessLevel",{enumerable:!0,get:function(){return Zy.UniquenessLevel}});Object.defineProperty(k,"MonikerKind",{enumerable:!0,get:function(){return Zy.MonikerKind}});Object.defineProperty(k,"MonikerRequest",{enumerable:!0,get:function(){return Zy.MonikerRequest}});var eT=KN();Object.defineProperty(k,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return eT.TypeHierarchyPrepareRequest}});Object.defineProperty(k,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return eT.TypeHierarchySubtypesRequest}});Object.defineProperty(k,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return eT.TypeHierarchySupertypesRequest}});var AE=QN();Object.defineProperty(k,"InlineValueRequest",{enumerable:!0,get:function(){return AE.InlineValueRequest}});Object.defineProperty(k,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return AE.InlineValueRefreshRequest}});var tT=rR();Object.defineProperty(k,"InlayHintRequest",{enumerable:!0,get:function(){return tT.InlayHintRequest}});Object.defineProperty(k,"InlayHintResolveRequest",{enumerable:!0,get:function(){return tT.InlayHintResolveRequest}});Object.defineProperty(k,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return tT.InlayHintRefreshRequest}});var $c=lR();Object.defineProperty(k,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return $c.DiagnosticServerCancellationData}});Object.defineProperty(k,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return $c.DocumentDiagnosticReportKind}});Object.defineProperty(k,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return $c.DocumentDiagnosticRequest}});Object.defineProperty(k,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return $c.WorkspaceDiagnosticRequest}});Object.defineProperty(k,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return $c.DiagnosticRefreshRequest}});var Si=gR();Object.defineProperty(k,"NotebookCellKind",{enumerable:!0,get:function(){return Si.NotebookCellKind}});Object.defineProperty(k,"ExecutionSummary",{enumerable:!0,get:function(){return Si.ExecutionSummary}});Object.defineProperty(k,"NotebookCell",{enumerable:!0,get:function(){return Si.NotebookCell}});Object.defineProperty(k,"NotebookDocument",{enumerable:!0,get:function(){return Si.NotebookDocument}});Object.defineProperty(k,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return Si.NotebookDocumentSyncRegistrationType}});Object.defineProperty(k,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return Si.DidOpenNotebookDocumentNotification}});Object.defineProperty(k,"NotebookCellArrayChange",{enumerable:!0,get:function(){return Si.NotebookCellArrayChange}});Object.defineProperty(k,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return Si.DidChangeNotebookDocumentNotification}});Object.defineProperty(k,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return Si.DidSaveNotebookDocumentNotification}});Object.defineProperty(k,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return Si.DidCloseNotebookDocumentNotification}});var NU=vR();Object.defineProperty(k,"InlineCompletionRequest",{enumerable:!0,get:function(){return NU.InlineCompletionRequest}});var Gy;(function(t){function e(r){let n=r;return rr.string(n)||rr.string(n.language)||rr.string(n.scheme)||rr.string(n.pattern)}t.is=e})(Gy||(k.TextDocumentFilter=Gy={}));var Yy;(function(t){function e(r){let n=r;return rr.objectLiteral(n)&&(rr.string(n.notebookType)||rr.string(n.scheme)||rr.string(n.pattern))}t.is=e})(Yy||(k.NotebookDocumentFilter=Yy={}));var Ky;(function(t){function e(r){let n=r;return rr.objectLiteral(n)&&(rr.string(n.notebook)||Yy.is(n.notebook))&&(n.language===void 0||rr.string(n.language))}t.is=e})(Ky||(k.NotebookCellTextDocumentFilter=Ky={}));var Xy;(function(t){function e(r){if(!Array.isArray(r))return!1;for(let n of r)if(!rr.string(n)&&!Gy.is(n)&&!Ky.is(n))return!1;return!0}t.is=e})(Xy||(k.DocumentSelector=Xy={}));var SR;(function(t){t.method="client/registerCapability",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType(t.method)})(SR||(k.RegistrationRequest=SR={}));var _R;(function(t){t.method="client/unregisterCapability",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType(t.method)})(_R||(k.UnregistrationRequest=_R={}));var PR;(function(t){t.Create="create",t.Rename="rename",t.Delete="delete"})(PR||(k.ResourceOperationKind=PR={}));var kR;(function(t){t.Abort="abort",t.Transactional="transactional",t.TextOnlyTransactional="textOnlyTransactional",t.Undo="undo"})(kR||(k.FailureHandlingKind=kR={}));var NR;(function(t){t.UTF8="utf-8",t.UTF16="utf-16",t.UTF32="utf-32"})(NR||(k.PositionEncodingKind=NR={}));var RR;(function(t){function e(r){let n=r;return n&&rr.string(n.id)&&n.id.length>0}t.hasId=e})(RR||(k.StaticRegistrationOptions=RR={}));var ER;(function(t){function e(r){let n=r;return n&&(n.documentSelector===null||Xy.is(n.documentSelector))}t.is=e})(ER||(k.TextDocumentRegistrationOptions=ER={}));var wR;(function(t){function e(n){let i=n;return rr.objectLiteral(i)&&(i.workDoneProgress===void 0||rr.boolean(i.workDoneProgress))}t.is=e;function r(n){let i=n;return i&&rr.boolean(i.workDoneProgress)}t.hasWorkDoneProgress=r})(wR||(k.WorkDoneProgressOptions=wR={}));var DR;(function(t){t.method="initialize",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(DR||(k.InitializeRequest=DR={}));var CR;(function(t){t.unknownProtocolVersion=1})(CR||(k.InitializeErrorCodes=CR={}));var AR;(function(t){t.method="initialized",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(AR||(k.InitializedNotification=AR={}));var IR;(function(t){t.method="shutdown",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType0(t.method)})(IR||(k.ShutdownRequest=IR={}));var OR;(function(t){t.method="exit",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType0(t.method)})(OR||(k.ExitNotification=OR={}));var xR;(function(t){t.method="workspace/didChangeConfiguration",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(xR||(k.DidChangeConfigurationNotification=xR={}));var MR;(function(t){t.Error=1,t.Warning=2,t.Info=3,t.Log=4,t.Debug=5})(MR||(k.MessageType=MR={}));var LR;(function(t){t.method="window/showMessage",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolNotificationType(t.method)})(LR||(k.ShowMessageNotification=LR={}));var qR;(function(t){t.method="window/showMessageRequest",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType(t.method)})(qR||(k.ShowMessageRequest=qR={}));var $R;(function(t){t.method="window/logMessage",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolNotificationType(t.method)})($R||(k.LogMessageNotification=$R={}));var FR;(function(t){t.method="telemetry/event",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolNotificationType(t.method)})(FR||(k.TelemetryEventNotification=FR={}));var BR;(function(t){t.None=0,t.Full=1,t.Incremental=2})(BR||(k.TextDocumentSyncKind=BR={}));var jR;(function(t){t.method="textDocument/didOpen",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(jR||(k.DidOpenTextDocumentNotification=jR={}));var UR;(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})(UR||(k.TextDocumentContentChangeEvent=UR={}));var HR;(function(t){t.method="textDocument/didChange",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(HR||(k.DidChangeTextDocumentNotification=HR={}));var VR;(function(t){t.method="textDocument/didClose",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(VR||(k.DidCloseTextDocumentNotification=VR={}));var WR;(function(t){t.method="textDocument/didSave",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(WR||(k.DidSaveTextDocumentNotification=WR={}));var zR;(function(t){t.Manual=1,t.AfterDelay=2,t.FocusOut=3})(zR||(k.TextDocumentSaveReason=zR={}));var GR;(function(t){t.method="textDocument/willSave",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(GR||(k.WillSaveTextDocumentNotification=GR={}));var YR;(function(t){t.method="textDocument/willSaveWaitUntil",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(YR||(k.WillSaveTextDocumentWaitUntilRequest=YR={}));var KR;(function(t){t.method="workspace/didChangeWatchedFiles",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolNotificationType(t.method)})(KR||(k.DidChangeWatchedFilesNotification=KR={}));var XR;(function(t){t.Created=1,t.Changed=2,t.Deleted=3})(XR||(k.FileChangeType=XR={}));var JR;(function(t){function e(r){let n=r;return rr.objectLiteral(n)&&(bR.URI.is(n.baseUri)||bR.WorkspaceFolder.is(n.baseUri))&&rr.string(n.pattern)}t.is=e})(JR||(k.RelativePattern=JR={}));var QR;(function(t){t.Create=1,t.Change=2,t.Delete=4})(QR||(k.WatchKind=QR={}));var ZR;(function(t){t.method="textDocument/publishDiagnostics",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolNotificationType(t.method)})(ZR||(k.PublishDiagnosticsNotification=ZR={}));var eE;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.TriggerForIncompleteCompletions=3})(eE||(k.CompletionTriggerKind=eE={}));var tE;(function(t){t.method="textDocument/completion",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(tE||(k.CompletionRequest=tE={}));var rE;(function(t){t.method="completionItem/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(rE||(k.CompletionResolveRequest=rE={}));var nE;(function(t){t.method="textDocument/hover",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(nE||(k.HoverRequest=nE={}));var iE;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.ContentChange=3})(iE||(k.SignatureHelpTriggerKind=iE={}));var sE;(function(t){t.method="textDocument/signatureHelp",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(sE||(k.SignatureHelpRequest=sE={}));var oE;(function(t){t.method="textDocument/definition",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(oE||(k.DefinitionRequest=oE={}));var aE;(function(t){t.method="textDocument/references",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(aE||(k.ReferencesRequest=aE={}));var cE;(function(t){t.method="textDocument/documentHighlight",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(cE||(k.DocumentHighlightRequest=cE={}));var lE;(function(t){t.method="textDocument/documentSymbol",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(lE||(k.DocumentSymbolRequest=lE={}));var uE;(function(t){t.method="textDocument/codeAction",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(uE||(k.CodeActionRequest=uE={}));var dE;(function(t){t.method="codeAction/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(dE||(k.CodeActionResolveRequest=dE={}));var fE;(function(t){t.method="workspace/symbol",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(fE||(k.WorkspaceSymbolRequest=fE={}));var pE;(function(t){t.method="workspaceSymbol/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(pE||(k.WorkspaceSymbolResolveRequest=pE={}));var hE;(function(t){t.method="textDocument/codeLens",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(hE||(k.CodeLensRequest=hE={}));var mE;(function(t){t.method="codeLens/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(mE||(k.CodeLensResolveRequest=mE={}));var gE;(function(t){t.method="workspace/codeLens/refresh",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType0(t.method)})(gE||(k.CodeLensRefreshRequest=gE={}));var yE;(function(t){t.method="textDocument/documentLink",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(yE||(k.DocumentLinkRequest=yE={}));var TE;(function(t){t.method="documentLink/resolve",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(TE||(k.DocumentLinkResolveRequest=TE={}));var vE;(function(t){t.method="textDocument/formatting",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(vE||(k.DocumentFormattingRequest=vE={}));var bE;(function(t){t.method="textDocument/rangeFormatting",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(bE||(k.DocumentRangeFormattingRequest=bE={}));var SE;(function(t){t.method="textDocument/rangesFormatting",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(SE||(k.DocumentRangesFormattingRequest=SE={}));var _E;(function(t){t.method="textDocument/onTypeFormatting",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(_E||(k.DocumentOnTypeFormattingRequest=_E={}));var PE;(function(t){t.Identifier=1})(PE||(k.PrepareSupportDefaultBehavior=PE={}));var kE;(function(t){t.method="textDocument/rename",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(kE||(k.RenameRequest=kE={}));var NE;(function(t){t.method="textDocument/prepareRename",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(NE||(k.PrepareRenameRequest=NE={}));var RE;(function(t){t.method="workspace/executeCommand",t.messageDirection=z.MessageDirection.clientToServer,t.type=new z.ProtocolRequestType(t.method)})(RE||(k.ExecuteCommandRequest=RE={}));var EE;(function(t){t.method="workspace/applyEdit",t.messageDirection=z.MessageDirection.serverToClient,t.type=new z.ProtocolRequestType("workspace/applyEdit")})(EE||(k.ApplyWorkspaceEditRequest=EE={}))});var xE=R(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});uf.createProtocolConnection=void 0;var OE=ao();function RU(t,e,r,n){return OE.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,OE.createMessageConnection)(t,e,r,n)}uf.createProtocolConnection=RU});var LE=R(Kr=>{"use strict";var EU=Kr&&Kr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),df=Kr&&Kr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&EU(e,t,r)};Object.defineProperty(Kr,"__esModule",{value:!0});Kr.LSPErrorCodes=Kr.createProtocolConnection=void 0;df(ao(),Kr);df(Gd(),Kr);df(Rt(),Kr);df(IE(),Kr);var wU=xE();Object.defineProperty(Kr,"createProtocolConnection",{enumerable:!0,get:function(){return wU.createProtocolConnection}});var ME;(function(t){t.lspReservedErrorRangeStart=-32899,t.RequestFailed=-32803,t.ServerCancelled=-32802,t.ContentModified=-32801,t.RequestCancelled=-32800,t.lspReservedErrorRangeEnd=-32800})(ME||(Kr.LSPErrorCodes=ME={}))});var Ft=R(_i=>{"use strict";var DU=_i&&_i.__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]})),qE=_i&&_i.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&DU(e,t,r)};Object.defineProperty(_i,"__esModule",{value:!0});_i.createProtocolConnection=void 0;var CU=Fy();qE(Fy(),_i);qE(LE(),_i);function AU(t,e,r,n){return(0,CU.createMessageConnection)(t,e,r,n)}_i.createProtocolConnection=AU});var rT=R(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.generateUuid=En.parse=En.isUUID=En.v4=En.empty=void 0;var Fc=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},Bc=class t extends Fc{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(""))}};Bc._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];Bc._timeHighBits=["8","9","a","b"];En.empty=new Fc("00000000-0000-0000-0000-000000000000");function $E(){return new Bc}En.v4=$E;var IU=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function FE(t){return IU.test(t)}En.isUUID=FE;function OU(t){if(!FE(t))throw new Error("invalid uuid");return new Fc(t)}En.parse=OU;function xU(){return $E().asHex()}En.generateUuid=xU});var BE=R(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.attachPartialResult=bs.ProgressFeature=bs.attachWorkDone=void 0;var vs=Ft(),MU=rT(),lo=class t{constructor(e,r){this._connection=e,this._token=r,t.Instances.set(this._token,this)}begin(e,r,n,i){let s={kind:"begin",title:e,percentage:r,message:n,cancellable:i};this._connection.sendProgress(vs.WorkDoneProgress.type,this._token,s)}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(vs.WorkDoneProgress.type,this._token,n)}done(){t.Instances.delete(this._token),this._connection.sendProgress(vs.WorkDoneProgress.type,this._token,{kind:"end"})}};lo.Instances=new Map;var ff=class extends lo{constructor(e,r){super(e,r),this._source=new vs.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},jc=class{constructor(){}begin(){}report(){}done(){}},pf=class extends jc{constructor(){super(),this._source=new vs.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function LU(t,e){if(e===void 0||e.workDoneToken===void 0)return new jc;let r=e.workDoneToken;return delete e.workDoneToken,new lo(t,r)}bs.attachWorkDone=LU;var qU=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(vs.WorkDoneProgressCancelNotification.type,r=>{let n=lo.Instances.get(r.token);(n instanceof ff||n instanceof pf)&&n.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new jc:new lo(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,MU.generateUuid)();return this.connection.sendRequest(vs.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new ff(this.connection,e))}else return Promise.resolve(new pf)}};bs.ProgressFeature=qU;var nT;(function(t){t.type=new vs.ProgressType})(nT||(nT={}));var iT=class{constructor(e,r){this._connection=e,this._token=r}report(e){this._connection.sendProgress(nT.type,this._token,e)}};function $U(t,e){if(e===void 0||e.partialResultToken===void 0)return;let r=e.partialResultToken;return delete e.partialResultToken,new iT(t,r)}bs.attachPartialResult=$U});var jE=R(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});hf.ConfigurationFeature=void 0;var FU=Ft(),BU=kd(),jU=t=>class extends t{getConfiguration(e){return e?BU.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(FU.ConfigurationRequest.type,r).then(n=>Array.isArray(n)?Array.isArray(e)?n:n[0]:Array.isArray(e)?[]:null)}};hf.ConfigurationFeature=jU});var UE=R(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});gf.WorkspaceFoldersFeature=void 0;var mf=Ft(),UU=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let r=e.workspace;r&&r.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new mf.Emitter,this.connection.onNotification(mf.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(mf.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(mf.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};gf.WorkspaceFoldersFeature=UU});var HE=R(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});yf.CallHierarchyFeature=void 0;var sT=Ft(),HU=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(sT.CallHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onIncomingCalls:e=>{let r=sT.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onOutgoingCalls:e=>{let r=sT.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};yf.CallHierarchyFeature=HU});var aT=R(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.SemanticTokensBuilder=Ss.SemanticTokensDiff=Ss.SemanticTokensFeature=void 0;var Tf=Ft(),VU=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(Tf.SemanticTokensRefreshRequest.type),on:e=>{let r=Tf.SemanticTokensRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onDelta:e=>{let r=Tf.SemanticTokensDeltaRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onRange:e=>{let r=Tf.SemanticTokensRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Ss.SemanticTokensFeature=VU;var vf=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,s=r-1;for(;i>=n&&s>=n&&this.originalSequence[i]===this.modifiedSequence[s];)i--,s--;(i<n||s<n)&&(i++,s++);let o=i-n+1,a=this.modifiedSequence.slice(n,s+1);return a.length===1&&a[0]===this.originalSequence[i]?[{start:n,deleteCount:o-1}]:[{start:n,deleteCount:o,data:a}]}else return n<r?[{start:n,deleteCount:0,data:this.modifiedSequence.slice(n)}]:n<e?[{start:n,deleteCount:e-n}]:[]}};Ss.SemanticTokensDiff=vf;var oT=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,s){let o=e,a=r;this._dataLen>0&&(o-=this._prevLine,o===0&&(a-=this._prevChar)),this._data[this._dataLen++]=o,this._data[this._dataLen++]=a,this._data[this._dataLen++]=n,this._data[this._dataLen++]=i,this._data[this._dataLen++]=s,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 vf(this._prevData,this._data).computeDiff()}:this.build()}};Ss.SemanticTokensBuilder=oT});var VE=R(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});bf.ShowDocumentFeature=void 0;var WU=Ft(),zU=t=>class extends t{showDocument(e){return this.connection.sendRequest(WU.ShowDocumentRequest.type,e)}};bf.ShowDocumentFeature=zU});var WE=R(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});Sf.FileOperationsFeature=void 0;var ha=Ft(),GU=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(ha.DidCreateFilesNotification.type,r=>{e(r)})}onDidRenameFiles(e){return this.connection.onNotification(ha.DidRenameFilesNotification.type,r=>{e(r)})}onDidDeleteFiles(e){return this.connection.onNotification(ha.DidDeleteFilesNotification.type,r=>{e(r)})}onWillCreateFiles(e){return this.connection.onRequest(ha.WillCreateFilesRequest.type,(r,n)=>e(r,n))}onWillRenameFiles(e){return this.connection.onRequest(ha.WillRenameFilesRequest.type,(r,n)=>e(r,n))}onWillDeleteFiles(e){return this.connection.onRequest(ha.WillDeleteFilesRequest.type,(r,n)=>e(r,n))}};Sf.FileOperationsFeature=GU});var zE=R(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.LinkedEditingRangeFeature=void 0;var YU=Ft(),KU=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(YU.LinkedEditingRangeRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0))}};_f.LinkedEditingRangeFeature=KU});var GE=R(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});Pf.TypeHierarchyFeature=void 0;var cT=Ft(),XU=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(cT.TypeHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onSupertypes:e=>{let r=cT.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onSubtypes:e=>{let r=cT.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Pf.TypeHierarchyFeature=XU});var KE=R(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});kf.InlineValueFeature=void 0;var YE=Ft(),JU=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest(YE.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(YE.InlineValueRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};kf.InlineValueFeature=JU});var JE=R(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});Nf.FoldingRangeFeature=void 0;var XE=Ft(),QU=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(XE.FoldingRangeRefreshRequest.type),on:e=>{let r=XE.FoldingRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Nf.FoldingRangeFeature=QU});var QE=R(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});Rf.InlayHintFeature=void 0;var lT=Ft(),ZU=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(lT.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(lT.InlayHintRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r))),resolve:e=>this.connection.onRequest(lT.InlayHintResolveRequest.type,(r,n)=>e(r,n))}}};Rf.InlayHintFeature=ZU});var ZE=R(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.DiagnosticFeature=void 0;var Uc=Ft(),eH=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(Uc.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(Uc.DocumentDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(Uc.DocumentDiagnosticRequest.partialResult,r))),onWorkspace:e=>this.connection.onRequest(Uc.WorkspaceDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(Uc.WorkspaceDiagnosticRequest.partialResult,r)))}}};Ef.DiagnosticFeature=eH});var dT=R(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});wf.TextDocuments=void 0;var uo=Ft(),uT=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new uo.Emitter,this._onDidOpen=new uo.Emitter,this._onDidClose=new uo.Emitter,this._onDidSave=new uo.Emitter,this._onWillSave=new uo.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=uo.TextDocumentSyncKind.Incremental;let r=[];return r.push(e.onDidOpenTextDocument(n=>{let i=n.textDocument,s=this._configuration.create(i.uri,i.languageId,i.version,i.text);this._syncedDocuments.set(i.uri,s);let o=Object.freeze({document:s});this._onDidOpen.fire(o),this._onDidChangeContent.fire(o)})),r.push(e.onDidChangeTextDocument(n=>{let i=n.textDocument,s=n.contentChanges;if(s.length===0)return;let{version:o}=i;if(o==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,s,o),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 s=this._syncedDocuments.get(n.textDocument.uri);return s!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:s,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}))})),uo.Disposable.create(()=>{r.forEach(n=>n.dispose())})}};wf.TextDocuments=uT});var pT=R(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.NotebookDocuments=ma.NotebookSyncFeature=void 0;var wn=Ft(),ew=dT(),tH=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(wn.DidOpenNotebookDocumentNotification.type,r=>{e(r)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(wn.DidChangeNotebookDocumentNotification.type,r=>{e(r)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(wn.DidSaveNotebookDocumentNotification.type,r=>{e(r)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(wn.DidCloseNotebookDocumentNotification.type,r=>{e(r)})}}};ma.NotebookSyncFeature=tH;var Df=class t{onDidOpenTextDocument(e){return this.openHandler=e,wn.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,wn.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,wn.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}};Df.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var fT=class{constructor(e){e instanceof ew.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new ew.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new wn.Emitter,this._onDidChange=new wn.Emitter,this._onDidSave=new wn.Emitter,this._onDidClose=new wn.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 Df,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 s of i.cellTextDocuments)r.openTextDocument({textDocument:s});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),n.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{let s=this.notebookDocuments.get(i.notebookDocument.uri);if(s===void 0)return;s.version=i.notebookDocument.version;let o=s.metadata,a=!1,c=i.change;c.metadata!==void 0&&(a=!0,s.metadata=c.metadata);let l=[],u=[],d=[],f=[];if(c.cells!==void 0){let S=c.cells;if(S.structure!==void 0){let v=S.structure.array;if(s.cells.splice(v.start,v.deleteCount,...v.cells!==void 0?v.cells:[]),S.structure.didOpen!==void 0)for(let b of S.structure.didOpen)r.openTextDocument({textDocument:b}),l.push(b.uri);if(S.structure.didClose)for(let b of S.structure.didClose)r.closeTextDocument({textDocument:b}),u.push(b.uri)}if(S.data!==void 0){let v=new Map(S.data.map(b=>[b.document,b]));for(let b=0;b<=s.cells.length;b++){let P=v.get(s.cells[b].document);if(P!==void 0){let N=s.cells.splice(b,1,P);if(d.push({old:N[0],new:P}),v.delete(P.document),v.size===0)break}}}if(S.textContent!==void 0)for(let v of S.textContent)r.changeTextDocument({textDocument:v.document,contentChanges:v.changes}),f.push(v.document.uri)}this.updateCellMap(s);let p={notebookDocument:s};a&&(p.metadata={old:o,new:s.metadata});let m=[];for(let S of l)m.push(this.getNotebookCell(S));let h=[];for(let S of u)h.push(this.getNotebookCell(S));let y=[];for(let S of f)y.push(this.getNotebookCell(S));(m.length>0||h.length>0||d.length>0||y.length>0)&&(p.cells={added:m,removed:h,changed:{data:d,textContent:y}}),(p.metadata!==void 0||p.cells!==void 0)&&this._onDidChange.fire(p)})),n.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let s=this.notebookDocuments.get(i.notebookDocument.uri);s!==void 0&&this._onDidSave.fire(s)})),n.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{let s=this.notebookDocuments.get(i.notebookDocument.uri);if(s!==void 0){this._onDidClose.fire(s);for(let o of i.cellTextDocuments)r.closeTextDocument({textDocument:o});this.notebookDocuments.delete(i.notebookDocument.uri);for(let o of s.cells)this.notebookCellMap.delete(o.document)}})),wn.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let r of e.cells)this.notebookCellMap.set(r.document,[r,e])}};ma.NotebookDocuments=fT});var tw=R(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.MonikerFeature=void 0;var rH=Ft(),nH=t=>class extends t{get moniker(){return{on:e=>{let r=rH.MonikerRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Cf.MonikerFeature=nH});var vT=R(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.createConnection=Xe.combineFeatures=Xe.combineNotebooksFeatures=Xe.combineLanguagesFeatures=Xe.combineWorkspaceFeatures=Xe.combineWindowFeatures=Xe.combineClientFeatures=Xe.combineTracerFeatures=Xe.combineTelemetryFeatures=Xe.combineConsoleFeatures=Xe._NotebooksImpl=Xe._LanguagesImpl=Xe.BulkUnregistration=Xe.BulkRegistration=Xe.ErrorMessageTracker=void 0;var K=Ft(),Dn=kd(),mT=rT(),ve=BE(),iH=jE(),sH=UE(),oH=HE(),aH=aT(),cH=VE(),lH=WE(),uH=zE(),dH=GE(),fH=KE(),pH=JE(),hH=QE(),mH=ZE(),gH=pT(),yH=tw();function hT(t){if(t!==null)return t}var gT=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)})}};Xe.ErrorMessageTracker=gT;var Af=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(K.MessageType.Error,e)}warn(e){this.send(K.MessageType.Warning,e)}info(e){this.send(K.MessageType.Info,e)}log(e){this.send(K.MessageType.Log,e)}debug(e){this.send(K.MessageType.Debug,e)}send(e,r){this._rawConnection&&this._rawConnection.sendNotification(K.LogMessageNotification.type,{type:e,message:r}).catch(()=>{(0,K.RAL)().console.error("Sending log message failed")})}},yT=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:K.MessageType.Error,message:e,actions:r};return this.connection.sendRequest(K.ShowMessageRequest.type,n).then(hT)}showWarningMessage(e,...r){let n={type:K.MessageType.Warning,message:e,actions:r};return this.connection.sendRequest(K.ShowMessageRequest.type,n).then(hT)}showInformationMessage(e,...r){let n={type:K.MessageType.Info,message:e,actions:r};return this.connection.sendRequest(K.ShowMessageRequest.type,n).then(hT)}},rw=(0,cH.ShowDocumentFeature)((0,ve.ProgressFeature)(yT)),nw;(function(t){function e(){return new If}t.create=e})(nw||(Xe.BulkRegistration=nw={}));var If=class{constructor(){this._registrations=[],this._registered=new Set}add(e,r){let n=Dn.string(e)?e:e.method;if(this._registered.has(n))throw new Error(`${n} is already added to this registration`);let i=mT.generateUuid();this._registrations.push({id:i,method:n,registerOptions:r||{}}),this._registered.add(n)}asRegistrationParams(){return{registrations:this._registrations}}},iw;(function(t){function e(){return new Hc(void 0,[])}t.create=e})(iw||(Xe.BulkUnregistration=iw={}));var Hc=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(K.UnregistrationRequest.type,r).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){let r=Dn.string(e)?e:e.method,n=this._unregistrations.get(r);if(!n)return!1;let i={unregisterations:[n]};return this._connection.sendRequest(K.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(r)},s=>{this._connection.console.info(`Un-registering request handler for ${n.id} failed.`)}),!0}},Of=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 If?this.registerMany(e):e instanceof Hc?this.registerSingle1(e,r,n):this.registerSingle2(e,r)}registerSingle1(e,r,n){let i=Dn.string(r)?r:r.method,s=mT.generateUuid(),o={registrations:[{id:s,method:i,registerOptions:n||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(K.RegistrationRequest.type,o).then(a=>(e.add({id:s,method:i}),e),a=>(this.connection.console.info(`Registering request handler for ${i} failed.`),Promise.reject(a)))}registerSingle2(e,r){let n=Dn.string(e)?e:e.method,i=mT.generateUuid(),s={registrations:[{id:i,method:n,registerOptions:r||{}}]};return this.connection.sendRequest(K.RegistrationRequest.type,s).then(o=>K.Disposable.create(()=>{this.unregisterSingle(i,n).catch(()=>{this.connection.console.info(`Un-registering capability with id ${i} failed.`)})}),o=>(this.connection.console.info(`Registering request handler for ${n} failed.`),Promise.reject(o)))}unregisterSingle(e,r){let n={unregisterations:[{id:e,method:r}]};return this.connection.sendRequest(K.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(K.RegistrationRequest.type,r).then(()=>new Hc(this._connection,r.registrations.map(n=>({id:n.id,method:n.method}))),n=>(this.connection.console.info("Bulk registration failed."),Promise.reject(n)))}},TT=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(K.ApplyWorkspaceEditRequest.type,n)}},sw=(0,lH.FileOperationsFeature)((0,sH.WorkspaceFoldersFeature)((0,iH.ConfigurationFeature)(TT))),xf=class{constructor(){this._trace=K.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!==K.Trace.Off&&this.connection.sendNotification(K.LogTraceNotification.type,{message:e,verbose:this._trace===K.Trace.Verbose?r:void 0}).catch(()=>{})}},Mf=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(K.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}},Lf=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,ve.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,ve.attachPartialResult)(this.connection,r)}};Xe._LanguagesImpl=Lf;var ow=(0,pH.FoldingRangeFeature)((0,yH.MonikerFeature)((0,mH.DiagnosticFeature)((0,hH.InlayHintFeature)((0,fH.InlineValueFeature)((0,dH.TypeHierarchyFeature)((0,uH.LinkedEditingRangeFeature)((0,aH.SemanticTokensFeature)((0,oH.CallHierarchyFeature)(Lf))))))))),qf=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,ve.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,ve.attachPartialResult)(this.connection,r)}};Xe._NotebooksImpl=qf;var aw=(0,gH.NotebookSyncFeature)(qf);function cw(t,e){return function(r){return e(t(r))}}Xe.combineConsoleFeatures=cw;function lw(t,e){return function(r){return e(t(r))}}Xe.combineTelemetryFeatures=lw;function uw(t,e){return function(r){return e(t(r))}}Xe.combineTracerFeatures=uw;function dw(t,e){return function(r){return e(t(r))}}Xe.combineClientFeatures=dw;function fw(t,e){return function(r){return e(t(r))}}Xe.combineWindowFeatures=fw;function pw(t,e){return function(r){return e(t(r))}}Xe.combineWorkspaceFeatures=pw;function hw(t,e){return function(r){return e(t(r))}}Xe.combineLanguagesFeatures=hw;function mw(t,e){return function(r){return e(t(r))}}Xe.combineNotebooksFeatures=mw;function TH(t,e){function r(i,s,o){return i&&s?o(i,s):i||s}return{__brand:"features",console:r(t.console,e.console,cw),tracer:r(t.tracer,e.tracer,uw),telemetry:r(t.telemetry,e.telemetry,lw),client:r(t.client,e.client,dw),window:r(t.window,e.window,fw),workspace:r(t.workspace,e.workspace,pw),languages:r(t.languages,e.languages,hw),notebooks:r(t.notebooks,e.notebooks,mw)}}Xe.combineFeatures=TH;function vH(t,e,r){let n=r&&r.console?new(r.console(Af)):new Af,i=t(n);n.rawAttach(i);let s=r&&r.tracer?new(r.tracer(xf)):new xf,o=r&&r.telemetry?new(r.telemetry(Mf)):new Mf,a=r&&r.client?new(r.client(Of)):new Of,c=r&&r.window?new(r.window(rw)):new rw,l=r&&r.workspace?new(r.workspace(sw)):new sw,u=r&&r.languages?new(r.languages(ow)):new ow,d=r&&r.notebooks?new(r.notebooks(aw)):new aw,f=[n,s,o,a,c,l,u,d];function p(v){return v instanceof Promise?v:Dn.thenable(v)?new Promise((b,P)=>{v.then(N=>b(N),N=>P(N))}):Promise.resolve(v)}let m,h,y,S={listen:()=>i.listen(),sendRequest:(v,...b)=>i.sendRequest(Dn.string(v)?v:v.method,...b),onRequest:(v,b)=>i.onRequest(v,b),sendNotification:(v,b)=>{let P=Dn.string(v)?v:v.method;return i.sendNotification(P,b)},onNotification:(v,b)=>i.onNotification(v,b),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:v=>(h=v,{dispose:()=>{h=void 0}}),onInitialized:v=>i.onNotification(K.InitializedNotification.type,v),onShutdown:v=>(m=v,{dispose:()=>{m=void 0}}),onExit:v=>(y=v,{dispose:()=>{y=void 0}}),get console(){return n},get telemetry(){return o},get tracer(){return s},get client(){return a},get window(){return c},get workspace(){return l},get languages(){return u},get notebooks(){return d},onDidChangeConfiguration:v=>i.onNotification(K.DidChangeConfigurationNotification.type,v),onDidChangeWatchedFiles:v=>i.onNotification(K.DidChangeWatchedFilesNotification.type,v),__textDocumentSync:void 0,onDidOpenTextDocument:v=>i.onNotification(K.DidOpenTextDocumentNotification.type,v),onDidChangeTextDocument:v=>i.onNotification(K.DidChangeTextDocumentNotification.type,v),onDidCloseTextDocument:v=>i.onNotification(K.DidCloseTextDocumentNotification.type,v),onWillSaveTextDocument:v=>i.onNotification(K.WillSaveTextDocumentNotification.type,v),onWillSaveTextDocumentWaitUntil:v=>i.onRequest(K.WillSaveTextDocumentWaitUntilRequest.type,v),onDidSaveTextDocument:v=>i.onNotification(K.DidSaveTextDocumentNotification.type,v),sendDiagnostics:v=>i.sendNotification(K.PublishDiagnosticsNotification.type,v),onHover:v=>i.onRequest(K.HoverRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),void 0)),onCompletion:v=>i.onRequest(K.CompletionRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onCompletionResolve:v=>i.onRequest(K.CompletionResolveRequest.type,v),onSignatureHelp:v=>i.onRequest(K.SignatureHelpRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),void 0)),onDeclaration:v=>i.onRequest(K.DeclarationRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onDefinition:v=>i.onRequest(K.DefinitionRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onTypeDefinition:v=>i.onRequest(K.TypeDefinitionRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onImplementation:v=>i.onRequest(K.ImplementationRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onReferences:v=>i.onRequest(K.ReferencesRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onDocumentHighlight:v=>i.onRequest(K.DocumentHighlightRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onDocumentSymbol:v=>i.onRequest(K.DocumentSymbolRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onWorkspaceSymbol:v=>i.onRequest(K.WorkspaceSymbolRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onWorkspaceSymbolResolve:v=>i.onRequest(K.WorkspaceSymbolResolveRequest.type,v),onCodeAction:v=>i.onRequest(K.CodeActionRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onCodeActionResolve:v=>i.onRequest(K.CodeActionResolveRequest.type,(b,P)=>v(b,P)),onCodeLens:v=>i.onRequest(K.CodeLensRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onCodeLensResolve:v=>i.onRequest(K.CodeLensResolveRequest.type,(b,P)=>v(b,P)),onDocumentFormatting:v=>i.onRequest(K.DocumentFormattingRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),void 0)),onDocumentRangeFormatting:v=>i.onRequest(K.DocumentRangeFormattingRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),void 0)),onDocumentOnTypeFormatting:v=>i.onRequest(K.DocumentOnTypeFormattingRequest.type,(b,P)=>v(b,P)),onRenameRequest:v=>i.onRequest(K.RenameRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),void 0)),onPrepareRename:v=>i.onRequest(K.PrepareRenameRequest.type,(b,P)=>v(b,P)),onDocumentLinks:v=>i.onRequest(K.DocumentLinkRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onDocumentLinkResolve:v=>i.onRequest(K.DocumentLinkResolveRequest.type,(b,P)=>v(b,P)),onDocumentColor:v=>i.onRequest(K.DocumentColorRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onColorPresentation:v=>i.onRequest(K.ColorPresentationRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onFoldingRanges:v=>i.onRequest(K.FoldingRangeRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onSelectionRanges:v=>i.onRequest(K.SelectionRangeRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),(0,ve.attachPartialResult)(i,b))),onExecuteCommand:v=>i.onRequest(K.ExecuteCommandRequest.type,(b,P)=>v(b,P,(0,ve.attachWorkDone)(i,b),void 0)),dispose:()=>i.dispose()};for(let v of f)v.attach(S);return i.onRequest(K.InitializeRequest.type,v=>{e.initialize(v),Dn.string(v.trace)&&(s.trace=K.Trace.fromString(v.trace));for(let b of f)b.initialize(v.capabilities);if(h){let b=h(v,new K.CancellationTokenSource().token,(0,ve.attachWorkDone)(i,v),void 0);return p(b).then(P=>{if(P instanceof K.ResponseError)return P;let N=P;N||(N={capabilities:{}});let $=N.capabilities;$||($={},N.capabilities=$),$.textDocumentSync===void 0||$.textDocumentSync===null?$.textDocumentSync=Dn.number(S.__textDocumentSync)?S.__textDocumentSync:K.TextDocumentSyncKind.None:!Dn.number($.textDocumentSync)&&!Dn.number($.textDocumentSync.change)&&($.textDocumentSync.change=Dn.number(S.__textDocumentSync)?S.__textDocumentSync:K.TextDocumentSyncKind.None);for(let j of f)j.fillServerCapabilities($);return N})}else{let b={capabilities:{textDocumentSync:K.TextDocumentSyncKind.None}};for(let P of f)P.fillServerCapabilities(b.capabilities);return b}}),i.onRequest(K.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,m)return m(new K.CancellationTokenSource().token)}),i.onNotification(K.ExitNotification.type,()=>{try{y&&y()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(K.SetTraceNotification.type,v=>{s.trace=K.Trace.fromString(v.value)}),S}Xe.createConnection=vH});var gw=R(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});Xr.resolveModulePath=Xr.FileSystem=Xr.resolveGlobalYarnPath=Xr.resolveGlobalNodePath=Xr.resolve=Xr.uriToFilePath=void 0;var bH=require("url"),Qn=require("path"),bT=require("fs"),kT=require("child_process");function SH(t){let e=bH.parse(t);if(e.protocol!=="file:"||!e.path)return;let r=e.path.split("/");for(var n=0,i=r.length;n<i;n++)r[n]=decodeURIComponent(r[n]);if(process.platform==="win32"&&r.length>1){let s=r[0],o=r[1];s.length===0&&o.length>1&&o[1]===":"&&r.shift()}return Qn.normalize(r.join("/"))}Xr.uriToFilePath=SH;function ST(){return process.platform==="win32"}function $f(t,e,r,n){let i="NODE_PATH",s=["var p = process;","p.on('message',function(m){","if(m.c==='e'){","p.exit(0);","}","else if(m.c==='rs'){","try{","var r=require.resolve(m.a);","p.send({c:'r',s:true,r:r});","}","catch(err){","p.send({c:'r',s:false});","}","}","});"].join("");return new Promise((o,a)=>{let c=process.env,l=Object.create(null);Object.keys(c).forEach(u=>l[u]=c[u]),e&&bT.existsSync(e)&&(l[i]?l[i]=e+Qn.delimiter+l[i]:l[i]=e,n&&n(`NODE_PATH value is: ${l[i]}`)),l.ELECTRON_RUN_AS_NODE="1";try{let u=(0,kT.fork)("",[],{cwd:r,env:l,execArgv:["-e",s]});if(u.pid===void 0){a(new Error(`Starting process to resolve node module ${t} failed`));return}u.on("error",f=>{a(f)}),u.on("message",f=>{f.c==="r"&&(u.send({c:"e"}),f.s?o(f.r):a(new Error(`Failed to resolve module: ${t}`)))});let d={c:"rs",a:t};u.send(d)}catch(u){a(u)}})}Xr.resolve=$f;function _T(t){let e="npm",r=Object.create(null);Object.keys(process.env).forEach(s=>r[s]=process.env[s]),r.NO_UPDATE_NOTIFIER="true";let n={encoding:"utf8",env:r};ST()&&(e="npm.cmd",n.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let s=(0,kT.spawnSync)(e,["config","get","prefix"],n).stdout;if(!s){t&&t("'npm config get prefix' didn't return a value.");return}let o=s.trim();return t&&t(`'npm config get prefix' value is: ${o}`),o.length>0?ST()?Qn.join(o,"node_modules"):Qn.join(o,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}Xr.resolveGlobalNodePath=_T;function _H(t){let e="yarn",r={encoding:"utf8"};ST()&&(e="yarn.cmd",r.shell=!0);let n=()=>{};try{process.on("SIGPIPE",n);let i=(0,kT.spawnSync)(e,["global","dir","--json"],r),s=i.stdout;if(!s){t&&(t("'yarn global dir' didn't return a value."),i.stderr&&t(i.stderr));return}let o=s.trim().split(/\r?\n/);for(let a of o)try{let c=JSON.parse(a);if(c.type==="log")return Qn.join(c.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",n)}}Xr.resolveGlobalYarnPath=_H;var PT;(function(t){let e;function r(){return e!==void 0||(process.platform==="win32"?e=!1:e=!bT.existsSync(__filename.toUpperCase())||!bT.existsSync(__filename.toLowerCase())),e}t.isCaseSensitive=r;function n(i,s){return r()?Qn.normalize(s).indexOf(Qn.normalize(i))===0:Qn.normalize(s).toLowerCase().indexOf(Qn.normalize(i).toLowerCase())===0}t.isParent=n})(PT||(Xr.FileSystem=PT={}));function PH(t,e,r,n){return r?(Qn.isAbsolute(r)||(r=Qn.join(t,r)),$f(e,r,r,n).then(i=>PT.isParent(r,i)?i:Promise.reject(new Error(`Failed to load ${e} from node path location.`))).then(void 0,i=>$f(e,_T(n),t,n))):$f(e,_T(n),t,n)}Xr.resolveModulePath=PH});var NT=R((N5,yw)=>{"use strict";yw.exports=Ft()});var Tw=R(Ff=>{"use strict";Object.defineProperty(Ff,"__esModule",{value:!0});Ff.InlineCompletionFeature=void 0;var kH=Ft(),NH=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(kH.InlineCompletionRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};Ff.InlineCompletionFeature=NH});var Sw=R(Rr=>{"use strict";var RH=Rr&&Rr.__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]})),bw=Rr&&Rr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&RH(e,t,r)};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.ProposedFeatures=Rr.NotebookDocuments=Rr.TextDocuments=Rr.SemanticTokensBuilder=void 0;var EH=aT();Object.defineProperty(Rr,"SemanticTokensBuilder",{enumerable:!0,get:function(){return EH.SemanticTokensBuilder}});var wH=Tw();bw(Ft(),Rr);var DH=dT();Object.defineProperty(Rr,"TextDocuments",{enumerable:!0,get:function(){return DH.TextDocuments}});var CH=pT();Object.defineProperty(Rr,"NotebookDocuments",{enumerable:!0,get:function(){return CH.NotebookDocuments}});bw(vT(),Rr);var vw;(function(t){t.all={__brand:"features",languages:wH.InlineCompletionFeature}})(vw||(Rr.ProposedFeatures=vw={}))});var U=R(Cn=>{"use strict";var AH=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]})),Nw=Cn&&Cn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&AH(e,t,r)};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.createConnection=Cn.Files=void 0;var _w=require("node:util"),RT=kd(),IH=vT(),Vc=gw(),fo=NT();Nw(NT(),Cn);Nw(Sw(),Cn);var Pw;(function(t){t.uriToFilePath=Vc.uriToFilePath,t.resolveGlobalNodePath=Vc.resolveGlobalNodePath,t.resolveGlobalYarnPath=Vc.resolveGlobalYarnPath,t.resolve=Vc.resolve,t.resolveModulePath=Vc.resolveModulePath})(Pw||(Cn.Files=Pw={}));var kw;function Bf(){if(kw!==void 0)try{kw.end()}catch{}}var ga=!1,Rw;function OH(){let t="--clientProcessId";function e(r){try{let n=parseInt(r);isNaN(n)||(Rw=setInterval(()=>{try{process.kill(n,0)}catch{Bf(),process.exit(ga?0:1)}},3e3))}catch{}}for(let r=2;r<process.argv.length;r++){let n=process.argv[r];if(n===t&&r+1<process.argv.length){e(process.argv[r+1]);return}else{let i=n.split("=");i[0]===t&&e(i[1])}}}OH();var xH={initialize:t=>{let e=t.processId;RT.number(e)&&Rw===void 0&&setInterval(()=>{try{process.kill(e,0)}catch{process.exit(ga?0:1)}},3e3)},get shutdownReceived(){return ga},set shutdownReceived(t){ga=t},exit:t=>{Bf(),process.exit(t)}};function MH(t,e,r,n){let i,s,o,a;return t!==void 0&&t.__brand==="features"&&(i=t,t=e,e=r,r=n),fo.ConnectionStrategy.is(t)||fo.ConnectionOptions.is(t)?a=t:(s=t,o=e,a=r),LH(s,o,a,i)}Cn.createConnection=MH;function LH(t,e,r,n){let i=!1;if(!t&&!e&&process.argv.length>2){let c,l,u=process.argv.slice(2);for(let d=0;d<u.length;d++){let f=u[d];if(f==="--node-ipc"){t=new fo.IPCMessageReader(process),e=new fo.IPCMessageWriter(process);break}else if(f==="--stdio"){i=!0,t=process.stdin,e=process.stdout;break}else if(f==="--socket"){c=parseInt(u[d+1]);break}else if(f==="--pipe"){l=u[d+1];break}else{var s=f.split("=");if(s[0]==="--socket"){c=parseInt(s[1]);break}else if(s[0]==="--pipe"){l=s[1];break}}}if(c){let d=(0,fo.createServerSocketTransport)(c);t=d[0],e=d[1]}else if(l){let d=(0,fo.createServerPipeTransport)(l);t=d[0],e=d[1]}}var o="Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'";if(!t)throw new Error("Connection input stream is not set. "+o);if(!e)throw new Error("Connection output stream is not set. "+o);if(RT.func(t.read)&&RT.func(t.on)){let c=t;c.on("end",()=>{Bf(),process.exit(ga?0:1)}),c.on("close",()=>{Bf(),process.exit(ga?0:1)})}let a=c=>{let l=(0,fo.createProtocolConnection)(t,e,c,r);return i&&qH(c),l};return(0,IH.createConnection)(a,xH,n)}function qH(t){function e(n){return n.map(i=>typeof i=="string"?i:(0,_w.inspect)(i)).join(" ")}let r=new Map;console.assert=function(i,...s){if(!i)if(s.length===0)t.error("Assertion failed");else{let[o,...a]=s;t.error(`Assertion failed: ${o} ${e(a)}`)}},console.count=function(i="default"){let s=String(i),o=r.get(s)??0;o+=1,r.set(s,o),t.log(`${s}: ${s}`)},console.countReset=function(i){i===void 0?r.clear():r.delete(String(i))},console.debug=function(...i){t.log(e(i))},console.dir=function(i,s){t.log((0,_w.inspect)(i,s))},console.log=function(...i){t.log(e(i))},console.error=function(...i){t.error(e(i))},console.trace=function(...i){let s=new Error().stack.replace(/(.+\n){2}/,""),o="Trace";i.length!==0&&(o+=`: ${e(i)}`),t.log(`${o}
37
+ ${s}`)},console.warn=function(...i){t.warn(e(i))}}});var ww=R((C5,Ew)=>{"use strict";Ew.exports=U()});var Ve=R(Tr=>{"use strict";var Vv=Symbol.for("yaml.alias"),PM=Symbol.for("yaml.document"),$h=Symbol.for("yaml.map"),kM=Symbol.for("yaml.pair"),Wv=Symbol.for("yaml.scalar"),Fh=Symbol.for("yaml.seq"),ns=Symbol.for("yaml.node.type"),JW=t=>!!t&&typeof t=="object"&&t[ns]===Vv,QW=t=>!!t&&typeof t=="object"&&t[ns]===PM,ZW=t=>!!t&&typeof t=="object"&&t[ns]===$h,ez=t=>!!t&&typeof t=="object"&&t[ns]===kM,NM=t=>!!t&&typeof t=="object"&&t[ns]===Wv,tz=t=>!!t&&typeof t=="object"&&t[ns]===Fh;function RM(t){if(t&&typeof t=="object")switch(t[ns]){case $h:case Fh:return!0}return!1}function rz(t){if(t&&typeof t=="object")switch(t[ns]){case Vv:case $h:case Wv:case Fh:return!0}return!1}var nz=t=>(NM(t)||RM(t))&&!!t.anchor;Tr.ALIAS=Vv;Tr.DOC=PM;Tr.MAP=$h;Tr.NODE_TYPE=ns;Tr.PAIR=kM;Tr.SCALAR=Wv;Tr.SEQ=Fh;Tr.hasAnchor=nz;Tr.isAlias=JW;Tr.isCollection=RM;Tr.isDocument=QW;Tr.isMap=ZW;Tr.isNode=rz;Tr.isPair=ez;Tr.isScalar=NM;Tr.isSeq=tz});var Hl=R(zv=>{"use strict";var er=Ve(),on=Symbol("break visit"),EM=Symbol("skip children"),Mi=Symbol("remove node");function Bh(t,e){let r=wM(e);er.isDocument(t)?Ya(null,t.contents,r,Object.freeze([t]))===Mi&&(t.contents=null):Ya(null,t,r,Object.freeze([]))}Bh.BREAK=on;Bh.SKIP=EM;Bh.REMOVE=Mi;function Ya(t,e,r,n){let i=DM(t,e,r,n);if(er.isNode(i)||er.isPair(i))return CM(t,n,i),Ya(t,i,r,n);if(typeof i!="symbol"){if(er.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s<e.items.length;++s){let o=Ya(s,e.items[s],r,n);if(typeof o=="number")s=o-1;else{if(o===on)return on;o===Mi&&(e.items.splice(s,1),s-=1)}}}else if(er.isPair(e)){n=Object.freeze(n.concat(e));let s=Ya("key",e.key,r,n);if(s===on)return on;s===Mi&&(e.key=null);let o=Ya("value",e.value,r,n);if(o===on)return on;o===Mi&&(e.value=null)}}return i}async function jh(t,e){let r=wM(e);er.isDocument(t)?await Ka(null,t.contents,r,Object.freeze([t]))===Mi&&(t.contents=null):await Ka(null,t,r,Object.freeze([]))}jh.BREAK=on;jh.SKIP=EM;jh.REMOVE=Mi;async function Ka(t,e,r,n){let i=await DM(t,e,r,n);if(er.isNode(i)||er.isPair(i))return CM(t,n,i),Ka(t,i,r,n);if(typeof i!="symbol"){if(er.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s<e.items.length;++s){let o=await Ka(s,e.items[s],r,n);if(typeof o=="number")s=o-1;else{if(o===on)return on;o===Mi&&(e.items.splice(s,1),s-=1)}}}else if(er.isPair(e)){n=Object.freeze(n.concat(e));let s=await Ka("key",e.key,r,n);if(s===on)return on;s===Mi&&(e.key=null);let o=await Ka("value",e.value,r,n);if(o===on)return on;o===Mi&&(e.value=null)}}return i}function wM(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function DM(t,e,r,n){if(typeof r=="function")return r(t,e,n);if(er.isMap(e))return r.Map?.(t,e,n);if(er.isSeq(e))return r.Seq?.(t,e,n);if(er.isPair(e))return r.Pair?.(t,e,n);if(er.isScalar(e))return r.Scalar?.(t,e,n);if(er.isAlias(e))return r.Alias?.(t,e,n)}function CM(t,e,r){let n=e[e.length-1];if(er.isCollection(n))n.items[t]=r;else if(er.isPair(n))t==="key"?n.key=r:n.value=r;else if(er.isDocument(n))n.contents=r;else{let i=er.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}zv.visit=Bh;zv.visitAsync=jh});var Gv=R(IM=>{"use strict";var AM=Ve(),iz=Hl(),sz={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},oz=t=>t.replace(/[!,[\]{}]/g,e=>sz[e]),Vl=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[s,o]=n;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[s]=n;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let o=/^\d+\.\d+$/.test(s);return r(6,`Unsupported YAML version ${s}`,o),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let s=this.tags[n];if(s)try{return s+decodeURIComponent(i)}catch(o){return r(String(o)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+oz(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&AM.isNode(e.contents)){let s={};iz.visit(e.contents,(o,a)=>{AM.isNode(a)&&a.tag&&(s[a.tag]=!0)}),i=Object.keys(s)}else i=[];for(let[s,o]of n)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&r.push(`%TAG ${s} ${o}`);return r.join(`
38
38
  `)}};Vl.defaultYaml={explicit:!1,version:"1.2"};Vl.defaultTags={"!!":"tag:yaml.org,2002:"};IM.Directives=Vl});var Uh=R(Wl=>{"use strict";var OM=Ve(),az=Hl();function cz(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function xM(t){let e=new Set;return az.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function MM(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function lz(t,e){let r=[],n=new Map,i=null;return{onAnchor:s=>{r.push(s),i??(i=xM(t));let o=MM(e,i);return i.add(o),o},setAnchors:()=>{for(let s of r){let o=n.get(s);if(typeof o=="object"&&o.anchor&&(OM.isScalar(o.node)||OM.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:n}}Wl.anchorIsValid=cz;Wl.anchorNames=xM;Wl.createNodeAnchors=lz;Wl.findNewAnchor=MM});var Yv=R(LM=>{"use strict";function zl(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,s=n.length;i<s;++i){let o=n[i],a=zl(t,n,String(i),o);a===void 0?delete n[i]:a!==o&&(n[i]=a)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let s=n.get(i),o=zl(t,n,i,s);o===void 0?n.delete(i):o!==s&&n.set(i,o)}else if(n instanceof Set)for(let i of Array.from(n)){let s=zl(t,n,i,i);s===void 0?n.delete(i):s!==i&&(n.delete(i),n.add(s))}else for(let[i,s]of Object.entries(n)){let o=zl(t,n,i,s);o===void 0?delete n[i]:o!==s&&(n[i]=o)}return t.call(e,r,n)}LM.applyReviver=zl});var Os=R($M=>{"use strict";var uz=Ve();function qM(t,e,r){if(Array.isArray(t))return t.map((n,i)=>qM(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!uz.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=s=>{n.res=s,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}$M.toJS=qM});var Hh=R(BM=>{"use strict";var dz=Yv(),FM=Ve(),fz=Os(),Kv=class{constructor(e){Object.defineProperty(this,FM.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:s}={}){if(!FM.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=fz.toJS(this,"",o);if(typeof i=="function")for(let{count:c,res:l}of o.anchors.values())i(l,c);return typeof s=="function"?dz.applyReviver(s,{"":a},"",a):a}};BM.NodeBase=Kv});var Gl=R(jM=>{"use strict";var pz=Uh(),hz=Hl(),Xa=Ve(),mz=Hh(),gz=Os(),Xv=class extends mz.NodeBase{constructor(e){super(Xa.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],hz.visit(e,{Node:(s,o)=>{(Xa.isAlias(o)||Xa.hasAnchor(o))&&n.push(o)}}),r&&(r.aliasResolveCache=n));let i;for(let s of n){if(s===this)break;s.anchor===this.source&&(i=s)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:s}=r,o=this.resolve(i,r);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(o);if(a||(gz.toJS(o,null,r),a=n.get(o)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Vh(i,o,n)),a.count*a.aliasCount>s)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(pz.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(e.implicitKey)return`${i} `}return i}};function Vh(t,e,r){if(Xa.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Xa.isCollection(e)){let n=0;for(let i of e.items){let s=Vh(t,i,r);s>n&&(n=s)}return n}else if(Xa.isPair(e)){let n=Vh(t,e.key,r),i=Vh(t,e.value,r);return Math.max(n,i)}return 1}jM.Alias=Xv});var Jt=R(Jv=>{"use strict";var yz=Ve(),Tz=Hh(),vz=Os(),bz=t=>!t||typeof t!="function"&&typeof t!="object",xs=class extends Tz.NodeBase{constructor(e){super(yz.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:vz.toJS(this.value,e,r)}toString(){return String(this.value)}};xs.BLOCK_FOLDED="BLOCK_FOLDED";xs.BLOCK_LITERAL="BLOCK_LITERAL";xs.PLAIN="PLAIN";xs.QUOTE_DOUBLE="QUOTE_DOUBLE";xs.QUOTE_SINGLE="QUOTE_SINGLE";Jv.Scalar=xs;Jv.isScalarValue=bz});var Yl=R(HM=>{"use strict";var Sz=Gl(),ko=Ve(),UM=Jt(),_z="tag:yaml.org,2002:";function Pz(t,e,r){if(e){let n=r.filter(s=>s.tag===e),i=n.find(s=>!s.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function kz(t,e,r){if(ko.isDocument(t)&&(t=t.contents),ko.isNode(t))return t;if(ko.isPair(t)){let d=r.schema[ko.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:s,schema:o,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Sz.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=_z+e.slice(2));let l=Pz(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new UM.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?o[ko.MAP]:Symbol.iterator in Object(t)?o[ko.SEQ]:o[ko.MAP]}s&&(s(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new UM.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}HM.createNode=kz});var zh=R(Wh=>{"use strict";var Nz=Yl(),Li=Ve(),Rz=Hh();function Qv(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let s=e[i];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let o=[];o[s]=n,n=o}else n=new Map([[s,n]])}return Nz.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var VM=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Zv=class extends Rz.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Li.isNode(n)||Li.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(VM(e))this.add(r);else{let[n,...i]=e,s=this.get(n,!0);if(Li.isCollection(s))s.addIn(i,r);else if(s===void 0&&this.schema)this.set(n,Qv(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Li.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,s=this.get(n,!0);return i.length===0?!r&&Li.isScalar(s)?s.value:s:Li.isCollection(s)?s.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Li.isPair(r))return!1;let n=r.value;return n==null||e&&Li.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Li.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let s=this.get(n,!0);if(Li.isCollection(s))s.setIn(i,r);else if(s===void 0&&this.schema)this.set(n,Qv(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Wh.Collection=Zv;Wh.collectionFromPath=Qv;Wh.isEmptyPath=VM});var Kl=R(Gh=>{"use strict";var Ez=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function eb(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var wz=(t,e,r)=>t.endsWith(`
39
39
  `)?eb(r,e):r.includes(`
40
40
  `)?`
@@ -67,14 +67,14 @@ ${l}${v}${r}${p}`}function Iz(t,e,r,n){let{type:i,value:s}=t,{actualString:o,imp
67
67
  `)?Ja(s,e):Kh(t,e,r,n);if(!a&&!u&&i!==fi.Scalar.PLAIN&&s.includes(`
68
68
  `))return Kh(t,e,r,n);if(Jh(s)){if(c==="")return e.forceBlockIndent=!0,Kh(t,e,r,n);if(a&&c===l)return Ja(s,e)}let d=s.replace(/\n+/g,`$&
69
69
  ${c}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return Ja(s,e)}return a?d:Ms.foldFlowLines(d,c,Ms.FOLD_FLOW,Xh(e,!1))}function Oz(t,e,r,n){let{implicitKey:i,inFlow:s}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==fi.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=fi.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case fi.Scalar.BLOCK_FOLDED:case fi.Scalar.BLOCK_LITERAL:return i||s?Ja(o.value,e):Kh(o,e,r,n);case fi.Scalar.QUOTE_DOUBLE:return Jl(o.value,e);case fi.Scalar.QUOTE_SINGLE:return rb(o.value,e);case fi.Scalar.PLAIN:return Iz(o,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}GM.stringifyString=Oz});var Zl=R(ib=>{"use strict";var xz=Uh(),Ls=Ve(),Mz=Kl(),Lz=Ql();function qz(t,e){let r=Object.assign({blockQuote:!0,commentString:Mz.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function $z(t,e){if(e.tag){let i=t.filter(s=>s.tag===e.tag);if(i.length>0)return i.find(s=>s.format===e.format)??i[0]}let r,n;if(Ls.isScalar(e)){n=e.value;let i=t.filter(s=>s.identify?.(n));if(i.length>1){let s=i.filter(o=>o.test);s.length>0&&(i=s)}r=i.find(s=>s.format===e.format)??i.find(s=>!s.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function Fz(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],s=(Ls.isScalar(t)||Ls.isCollection(t))&&t.anchor;s&&xz.anchorIsValid(s)&&(r.add(s),i.push(`&${s}`));let o=t.tag??(e.default?null:e.tag);return o&&i.push(n.directives.tagString(o)),i.join(" ")}function Bz(t,e,r,n){if(Ls.isPair(t))return t.toString(e,r,n);if(Ls.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,s=Ls.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=$z(e.doc.schema.tags,s));let o=Fz(s,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof i.stringify=="function"?i.stringify(s,e,r,n):Ls.isScalar(s)?Lz.stringifyString(s,e,r,n):s.toString(e,r,n);return o?Ls.isScalar(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
70
- ${e.indent}${a}`:a}ib.createStringifyContext=qz;ib.stringify=Bz});var JM=R(XM=>{"use strict";var ns=Ve(),YM=Jt(),KM=Zl(),eu=Kl();function jz({key:t,value:e},r,n,i){let{allNullValues:s,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=ns.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(ns.isCollection(t)||!ns.isNode(t)&&typeof t=="object"){let j="With simple keys, collection cannot be used as a key value";throw new Error(j)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||ns.isCollection(t)||(ns.isScalar(t)?t.type===YM.Scalar.BLOCK_FOLDED||t.type===YM.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!s),indent:a+c});let m=!1,h=!1,y=KM.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&y.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(s||e==null)return m&&n&&n(),y===""?"?":p?`? ${y}`:y}else if(s&&!d||e==null&&p)return y=`? ${y}`,f&&!m?y+=eu.lineComment(y,r.indent,l(f)):h&&i&&i(),y;m&&(f=null),p?(f&&(y+=eu.lineComment(y,r.indent,l(f))),y=`? ${y}
71
- ${a}:`):(y=`${y}:`,f&&(y+=eu.lineComment(y,r.indent,l(f))));let S,v,b;ns.isNode(e)?(S=!!e.spaceBefore,v=e.commentBefore,b=e.comment):(S=!1,v=null,b=null,e&&typeof e=="object"&&(e=o.createNode(e))),r.implicitKey=!1,!p&&!f&&ns.isScalar(e)&&(r.indentAtStart=y.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&ns.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let P=!1,N=KM.stringify(e,r,()=>P=!0,()=>h=!0),$=" ";if(f||S||v){if($=S?`
70
+ ${e.indent}${a}`:a}ib.createStringifyContext=qz;ib.stringify=Bz});var JM=R(XM=>{"use strict";var is=Ve(),YM=Jt(),KM=Zl(),eu=Kl();function jz({key:t,value:e},r,n,i){let{allNullValues:s,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=is.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(is.isCollection(t)||!is.isNode(t)&&typeof t=="object"){let j="With simple keys, collection cannot be used as a key value";throw new Error(j)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||is.isCollection(t)||(is.isScalar(t)?t.type===YM.Scalar.BLOCK_FOLDED||t.type===YM.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!s),indent:a+c});let m=!1,h=!1,y=KM.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&y.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(s||e==null)return m&&n&&n(),y===""?"?":p?`? ${y}`:y}else if(s&&!d||e==null&&p)return y=`? ${y}`,f&&!m?y+=eu.lineComment(y,r.indent,l(f)):h&&i&&i(),y;m&&(f=null),p?(f&&(y+=eu.lineComment(y,r.indent,l(f))),y=`? ${y}
71
+ ${a}:`):(y=`${y}:`,f&&(y+=eu.lineComment(y,r.indent,l(f))));let S,v,b;is.isNode(e)?(S=!!e.spaceBefore,v=e.commentBefore,b=e.comment):(S=!1,v=null,b=null,e&&typeof e=="object"&&(e=o.createNode(e))),r.implicitKey=!1,!p&&!f&&is.isScalar(e)&&(r.indentAtStart=y.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&is.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let P=!1,N=KM.stringify(e,r,()=>P=!0,()=>h=!0),$=" ";if(f||S||v){if($=S?`
72
72
  `:"",v){let j=l(v);$+=`
73
73
  ${eu.indentComment(j,r.indent)}`}N===""&&!r.inFlow?$===`
74
74
  `&&b&&($=`
75
75
 
76
76
  `):$+=`
77
- ${r.indent}`}else if(!p&&ns.isCollection(e)){let j=N[0],L=N.indexOf(`
77
+ ${r.indent}`}else if(!p&&is.isCollection(e)){let j=N[0],L=N.indexOf(`
78
78
  `),ye=L!==-1,qe=r.inFlow??e.flow??e.items.length===0;if(ye||!qe){let pe=!1;if(ye&&(j==="&"||j==="!")){let Pe=N.indexOf(" ");j==="&"&&Pe!==-1&&Pe<L&&N[Pe+1]==="!"&&(Pe=N.indexOf(" ",Pe+1)),(Pe===-1||L<Pe)&&(pe=!0)}pe||($=`
79
79
  ${r.indent}`)}}else(N===""||N[0]===`
80
80
  `)&&($="");return y+=$+N,r.inFlow?P&&n&&n():b&&!P?y+=eu.lineComment(y,r.indent,l(b)):h&&i&&i(),y}XM.stringifyPair=jz});var ob=R(sb=>{"use strict";var QM=require("process");function Uz(t,...e){t==="debug"&&console.log(...e)}function Hz(t,e){(t==="debug"||t==="warn")&&(typeof QM.emitWarning=="function"?QM.emitWarning(e):console.warn(e))}sb.debug=Uz;sb.warn=Hz});var rm=R(tm=>{"use strict";var em=Ve(),ZM=Jt(),Qh="<<",Zh={identify:t=>t===Qh||typeof t=="symbol"&&t.description===Qh,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ZM.Scalar(Symbol(Qh)),{addToJSMap:e1}),stringify:()=>Qh},Vz=(t,e)=>(Zh.identify(e)||em.isScalar(e)&&(!e.type||e.type===ZM.Scalar.PLAIN)&&Zh.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Zh.tag&&r.default);function e1(t,e,r){let n=t1(t,r);if(em.isSeq(n))for(let i of n.items)ab(t,e,i);else if(Array.isArray(n))for(let i of n)ab(t,e,i);else ab(t,e,n)}function ab(t,e,r){let n=t1(t,r);if(!em.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[s,o]of i)e instanceof Map?e.has(s)||e.set(s,o):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function t1(t,e){return t&&em.isAlias(e)?e.resolve(t.doc,t):e}tm.addMergeToJSMap=e1;tm.isMergeKey=Vz;tm.merge=Zh});var lb=R(i1=>{"use strict";var Wz=ob(),r1=rm(),zz=Zl(),n1=Ve(),cb=Os();function Gz(t,e,{key:r,value:n}){if(n1.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(r1.isMergeKey(t,r))r1.addMergeToJSMap(t,e,n);else{let i=cb.toJS(r,"",t);if(e instanceof Map)e.set(i,cb.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let s=Yz(r,i,t),o=cb.toJS(n,s,t);s in e?Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[s]=o}}return e}function Yz(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(n1.isNode(t)&&r?.doc){let n=zz.createStringifyContext(r.doc,{});n.anchors=new Set;for(let s of r.anchors.keys())n.anchors.add(s.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),Wz.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}i1.addPairToJSMap=Gz});var qs=R(ub=>{"use strict";var s1=Yl(),Kz=JM(),Xz=lb(),nm=Ve();function Jz(t,e,r){let n=s1.createNode(t,void 0,r),i=s1.createNode(e,void 0,r);return new im(n,i)}var im=class t{constructor(e,r=null){Object.defineProperty(this,nm.NODE_TYPE,{value:nm.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return nm.isNode(r)&&(r=r.clone(e)),nm.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Xz.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Kz.stringifyPair(this,e,r,n):JSON.stringify(this)}};ub.Pair=im;ub.createPair=Jz});var db=R(a1=>{"use strict";var No=Ve(),o1=Zl(),sm=Kl();function Qz(t,e,r){return(e.inFlow??t.flow?eG:Zz)(t,e,r)}function Zz({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:s,onChompKeep:o,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:s,type:null}),d=!1,f=[];for(let m=0;m<e.length;++m){let h=e[m],y=null;if(No.isNode(h))!d&&h.spaceBefore&&f.push(""),om(r,f,h.commentBefore,d),h.comment&&(y=h.comment);else if(No.isPair(h)){let v=No.isNode(h.key)?h.key:null;v&&(!d&&v.spaceBefore&&f.push(""),om(r,f,v.commentBefore,d))}d=!1;let S=o1.stringify(h,u,()=>y=null,()=>d=!0);y&&(S+=sm.lineComment(S,s,l(y))),d&&y&&(d=!1),f.push(n+S)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;m<f.length;++m){let h=f[m];p+=h?`
@@ -172,15 +172,15 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
172
172
  `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
173
173
  `,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){xm(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",s=[];if(i&&r.sep&&!r.value){let o=[];for(let a=0;a<r.sep.length;++a){let c=r.sep[a];switch(c.type){case"newline":o.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(s=r.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(js(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(nq(r.key)&&!js(r.sep,"newline")){let o=ic(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:c}]})}else s.length>0?r.sep=r.sep.concat(s,this.sourceToken):r.sep.push(this.sourceToken);else if(js(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let o=ic(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:s,key:null,sep:[this.sourceToken]}):js(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);i||r.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(o):(Object.assign(r,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!r.explicitKey&&r.sep&&!js(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:s});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){xm(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||js(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=Om(n),s=ic(i);rq(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(`
174
174
  `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
175
- `,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=Om(e),n=ic(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=Om(e),n=ic(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};iq.Parser=SS});var lq=R(Tu=>{"use strict";var sq=cS(),s3=lu(),yu=fu(),o3=ob(),a3=Ve(),c3=bS(),oq=_S();function aq(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new c3.LineCounter||null,prettyErrors:e}}function l3(t,e={}){let{lineCounter:r,prettyErrors:n}=aq(e),i=new oq.Parser(r?.addNewLine),s=new sq.Composer(e),o=Array.from(s.compose(i.parse(t)));if(n&&r)for(let a of o)a.errors.forEach(yu.prettifyError(t,r)),a.warnings.forEach(yu.prettifyError(t,r));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function cq(t,e={}){let{lineCounter:r,prettyErrors:n}=aq(e),i=new oq.Parser(r?.addNewLine),s=new sq.Composer(e),o=null;for(let a of s.compose(i.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new yu.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(o.errors.forEach(yu.prettifyError(t,r)),o.warnings.forEach(yu.prettifyError(t,r))),o}function u3(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=cq(t,r);if(!i)return null;if(i.warnings.forEach(s=>o3.warn(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function d3(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return a3.isDocument(t)&&!n?t.toString(r):new s3.Document(t,n,r).toString(r)}Tu.parse=u3;Tu.parseAllDocuments=l3;Tu.parseDocument=cq;Tu.stringify=d3});var kS=R(rt=>{"use strict";var f3=cS(),p3=lu(),h3=Ub(),PS=fu(),m3=Gl(),Us=Ve(),g3=qs(),y3=Jt(),T3=Fs(),v3=Bs(),b3=Am(),S3=TS(),_3=bS(),P3=_S(),Mm=lq(),uq=Hl();rt.Composer=f3.Composer;rt.Document=p3.Document;rt.Schema=h3.Schema;rt.YAMLError=PS.YAMLError;rt.YAMLParseError=PS.YAMLParseError;rt.YAMLWarning=PS.YAMLWarning;rt.Alias=m3.Alias;rt.isAlias=Us.isAlias;rt.isCollection=Us.isCollection;rt.isDocument=Us.isDocument;rt.isMap=Us.isMap;rt.isNode=Us.isNode;rt.isPair=Us.isPair;rt.isScalar=Us.isScalar;rt.isSeq=Us.isSeq;rt.Pair=g3.Pair;rt.Scalar=y3.Scalar;rt.YAMLMap=T3.YAMLMap;rt.YAMLSeq=v3.YAMLSeq;rt.CST=b3;rt.Lexer=S3.Lexer;rt.LineCounter=_3.LineCounter;rt.Parser=P3.Parser;rt.parse=Mm.parse;rt.parseAllDocuments=Mm.parseAllDocuments;rt.parseDocument=Mm.parseDocument;rt.stringify=Mm.stringify;rt.visit=uq.visit;rt.visitAsync=uq.visitAsync});var Su=R(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.regexpCode=Ye.getEsmExportName=Ye.getProperty=Ye.safeStringify=Ye.stringify=Ye.strConcat=Ye.addCodeArg=Ye.str=Ye._=Ye.nil=Ye._Code=Ye.Name=Ye.IDENTIFIER=Ye._CodeOrName=void 0;var vu=class{};Ye._CodeOrName=vu;Ye.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Co=class extends vu{constructor(e){if(super(),!Ye.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Ye.Name=Co;var jn=class extends vu{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Co&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Ye._Code=jn;Ye.nil=new jn("");function dq(t,...e){let r=[t[0]],n=0;for(;n<e.length;)RS(r,e[n]),r.push(t[++n]);return new jn(r)}Ye._=dq;var NS=new jn("+");function fq(t,...e){let r=[bu(t[0])],n=0;for(;n<e.length;)r.push(NS),RS(r,e[n]),r.push(NS,bu(t[++n]));return k3(r),new jn(r)}Ye.str=fq;function RS(t,e){e instanceof jn?t.push(...e._items):e instanceof Co?t.push(e):t.push(E3(e))}Ye.addCodeArg=RS;function k3(t){let e=1;for(;e<t.length-1;){if(t[e]===NS){let r=N3(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function N3(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Co||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Co))return`"${t}${e.slice(1)}`}function R3(t,e){return e.emptyStr()?t:t.emptyStr()?e:fq`${t}${e}`}Ye.strConcat=R3;function E3(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:bu(Array.isArray(t)?t.join(","):t)}function w3(t){return new jn(bu(t))}Ye.stringify=w3;function bu(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Ye.safeStringify=bu;function D3(t){return typeof t=="string"&&Ye.IDENTIFIER.test(t)?new jn(`.${t}`):dq`[${t}]`}Ye.getProperty=D3;function C3(t){if(typeof t=="string"&&Ye.IDENTIFIER.test(t))return new jn(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Ye.getEsmExportName=C3;function A3(t){return new jn(t.toString())}Ye.regexpCode=A3});var DS=R(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.ValueScope=ln.ValueScopeName=ln.Scope=ln.varKinds=ln.UsedValueState=void 0;var cn=Su(),ES=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Lm;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Lm||(ln.UsedValueState=Lm={}));ln.varKinds={const:new cn.Name("const"),let:new cn.Name("let"),var:new cn.Name("var")};var qm=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof cn.Name?e:this.name(e)}name(e){return new cn.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};ln.Scope=qm;var $m=class extends cn.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,cn._)`.${new cn.Name(r)}[${n}]`}};ln.ValueScopeName=$m;var I3=(0,cn._)`\n`,wS=class extends qm{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?I3:cn.nil}}get(){return this._scope}name(e){return new $m(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let u=a.get(o);if(u)return u}else a=this._values[s]=new Map;a.set(o,i);let c=this._scope[s]||(this._scope[s]=[]),l=c.length;return c[l]=r.ref,i.setValue(r,{property:s,itemIndex:l}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,cn._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let s=cn.nil;for(let o in e){let a=e[o];if(!a)continue;let c=n[o]=n[o]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,Lm.Started);let u=r(l);if(u){let d=this.opts.es5?ln.varKinds.var:ln.varKinds.const;s=(0,cn._)`${s}${d} ${l} = ${u};${this.opts._n}`}else if(u=i?.(l))s=(0,cn._)`${s}${u}${this.opts._n}`;else throw new ES(l);c.set(l,Lm.Completed)})}return s}};ln.ValueScope=wS});var _e=R(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.or=we.and=we.not=we.CodeGen=we.operators=we.varKinds=we.ValueScopeName=we.ValueScope=we.Scope=we.Name=we.regexpCode=we.stringify=we.getProperty=we.nil=we.strConcat=we.str=we._=void 0;var Be=Su(),hi=DS(),Hs=Su();Object.defineProperty(we,"_",{enumerable:!0,get:function(){return Hs._}});Object.defineProperty(we,"str",{enumerable:!0,get:function(){return Hs.str}});Object.defineProperty(we,"strConcat",{enumerable:!0,get:function(){return Hs.strConcat}});Object.defineProperty(we,"nil",{enumerable:!0,get:function(){return Hs.nil}});Object.defineProperty(we,"getProperty",{enumerable:!0,get:function(){return Hs.getProperty}});Object.defineProperty(we,"stringify",{enumerable:!0,get:function(){return Hs.stringify}});Object.defineProperty(we,"regexpCode",{enumerable:!0,get:function(){return Hs.regexpCode}});Object.defineProperty(we,"Name",{enumerable:!0,get:function(){return Hs.Name}});var Um=DS();Object.defineProperty(we,"Scope",{enumerable:!0,get:function(){return Um.Scope}});Object.defineProperty(we,"ValueScope",{enumerable:!0,get:function(){return Um.ValueScope}});Object.defineProperty(we,"ValueScopeName",{enumerable:!0,get:function(){return Um.ValueScopeName}});Object.defineProperty(we,"varKinds",{enumerable:!0,get:function(){return Um.varKinds}});we.operators={GT:new Be._Code(">"),GTE:new Be._Code(">="),LT:new Be._Code("<"),LTE:new Be._Code("<="),EQ:new Be._Code("==="),NEQ:new Be._Code("!=="),NOT:new Be._Code("!"),OR:new Be._Code("||"),AND:new Be._Code("&&"),ADD:new Be._Code("+")};var is=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},CS=class extends is{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?hi.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=oc(this.rhs,e,r)),this}get names(){return this.rhs instanceof Be._CodeOrName?this.rhs.names:{}}},Fm=class extends is{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Be.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=oc(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Be.Name?{}:{...this.lhs.names};return jm(e,this.rhs)}},AS=class extends Fm{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},IS=class extends is{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},OS=class extends is{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},xS=class extends is{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},MS=class extends is{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=oc(this.code,e,r),this}get names(){return this.code instanceof Be._CodeOrName?this.code.names:{}}},_u=class extends is{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(e,r)||(O3(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Oo(e,r.names),{})}},ss=class extends _u{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},LS=class extends _u{},sc=class extends ss{};sc.kind="else";var Ao=class t extends ss{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new sc(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(pq(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=oc(this.condition,e,r),this}get names(){let e=super.names;return jm(e,this.condition),this.else&&Oo(e,this.else.names),e}};Ao.kind="if";var Io=class extends ss{};Io.kind="for";var qS=class extends Io{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=oc(this.iteration,e,r),this}get names(){return Oo(super.names,this.iteration.names)}},$S=class extends Io{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?hi.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=jm(super.names,this.from);return jm(e,this.to)}},Bm=class extends Io{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=oc(this.iterable,e,r),this}get names(){return Oo(super.names,this.iterable.names)}},Pu=class extends ss{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Pu.kind="func";var ku=class extends _u{render(e){return"return "+super.render(e)}};ku.kind="return";var FS=class extends ss{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Oo(e,this.catch.names),this.finally&&Oo(e,this.finally.names),e}},Nu=class extends ss{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Nu.kind="catch";var Ru=class extends ss{render(e){return"finally"+super.render(e)}};Ru.kind="finally";var BS=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
175
+ `,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=Om(e),n=ic(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=Om(e),n=ic(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};iq.Parser=SS});var lq=R(Tu=>{"use strict";var sq=cS(),s3=lu(),yu=fu(),o3=ob(),a3=Ve(),c3=bS(),oq=_S();function aq(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new c3.LineCounter||null,prettyErrors:e}}function l3(t,e={}){let{lineCounter:r,prettyErrors:n}=aq(e),i=new oq.Parser(r?.addNewLine),s=new sq.Composer(e),o=Array.from(s.compose(i.parse(t)));if(n&&r)for(let a of o)a.errors.forEach(yu.prettifyError(t,r)),a.warnings.forEach(yu.prettifyError(t,r));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function cq(t,e={}){let{lineCounter:r,prettyErrors:n}=aq(e),i=new oq.Parser(r?.addNewLine),s=new sq.Composer(e),o=null;for(let a of s.compose(i.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new yu.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(o.errors.forEach(yu.prettifyError(t,r)),o.warnings.forEach(yu.prettifyError(t,r))),o}function u3(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=cq(t,r);if(!i)return null;if(i.warnings.forEach(s=>o3.warn(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function d3(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return a3.isDocument(t)&&!n?t.toString(r):new s3.Document(t,n,r).toString(r)}Tu.parse=u3;Tu.parseAllDocuments=l3;Tu.parseDocument=cq;Tu.stringify=d3});var kS=R(rt=>{"use strict";var f3=cS(),p3=lu(),h3=Ub(),PS=fu(),m3=Gl(),Us=Ve(),g3=qs(),y3=Jt(),T3=Fs(),v3=Bs(),b3=Am(),S3=TS(),_3=bS(),P3=_S(),Mm=lq(),uq=Hl();rt.Composer=f3.Composer;rt.Document=p3.Document;rt.Schema=h3.Schema;rt.YAMLError=PS.YAMLError;rt.YAMLParseError=PS.YAMLParseError;rt.YAMLWarning=PS.YAMLWarning;rt.Alias=m3.Alias;rt.isAlias=Us.isAlias;rt.isCollection=Us.isCollection;rt.isDocument=Us.isDocument;rt.isMap=Us.isMap;rt.isNode=Us.isNode;rt.isPair=Us.isPair;rt.isScalar=Us.isScalar;rt.isSeq=Us.isSeq;rt.Pair=g3.Pair;rt.Scalar=y3.Scalar;rt.YAMLMap=T3.YAMLMap;rt.YAMLSeq=v3.YAMLSeq;rt.CST=b3;rt.Lexer=S3.Lexer;rt.LineCounter=_3.LineCounter;rt.Parser=P3.Parser;rt.parse=Mm.parse;rt.parseAllDocuments=Mm.parseAllDocuments;rt.parseDocument=Mm.parseDocument;rt.stringify=Mm.stringify;rt.visit=uq.visit;rt.visitAsync=uq.visitAsync});var Su=R(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.regexpCode=Ye.getEsmExportName=Ye.getProperty=Ye.safeStringify=Ye.stringify=Ye.strConcat=Ye.addCodeArg=Ye.str=Ye._=Ye.nil=Ye._Code=Ye.Name=Ye.IDENTIFIER=Ye._CodeOrName=void 0;var vu=class{};Ye._CodeOrName=vu;Ye.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Co=class extends vu{constructor(e){if(super(),!Ye.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Ye.Name=Co;var jn=class extends vu{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Co&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Ye._Code=jn;Ye.nil=new jn("");function dq(t,...e){let r=[t[0]],n=0;for(;n<e.length;)RS(r,e[n]),r.push(t[++n]);return new jn(r)}Ye._=dq;var NS=new jn("+");function fq(t,...e){let r=[bu(t[0])],n=0;for(;n<e.length;)r.push(NS),RS(r,e[n]),r.push(NS,bu(t[++n]));return k3(r),new jn(r)}Ye.str=fq;function RS(t,e){e instanceof jn?t.push(...e._items):e instanceof Co?t.push(e):t.push(E3(e))}Ye.addCodeArg=RS;function k3(t){let e=1;for(;e<t.length-1;){if(t[e]===NS){let r=N3(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function N3(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Co||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Co))return`"${t}${e.slice(1)}`}function R3(t,e){return e.emptyStr()?t:t.emptyStr()?e:fq`${t}${e}`}Ye.strConcat=R3;function E3(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:bu(Array.isArray(t)?t.join(","):t)}function w3(t){return new jn(bu(t))}Ye.stringify=w3;function bu(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Ye.safeStringify=bu;function D3(t){return typeof t=="string"&&Ye.IDENTIFIER.test(t)?new jn(`.${t}`):dq`[${t}]`}Ye.getProperty=D3;function C3(t){if(typeof t=="string"&&Ye.IDENTIFIER.test(t))return new jn(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Ye.getEsmExportName=C3;function A3(t){return new jn(t.toString())}Ye.regexpCode=A3});var DS=R(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.ValueScope=ln.ValueScopeName=ln.Scope=ln.varKinds=ln.UsedValueState=void 0;var cn=Su(),ES=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Lm;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Lm||(ln.UsedValueState=Lm={}));ln.varKinds={const:new cn.Name("const"),let:new cn.Name("let"),var:new cn.Name("var")};var qm=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof cn.Name?e:this.name(e)}name(e){return new cn.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};ln.Scope=qm;var $m=class extends cn.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,cn._)`.${new cn.Name(r)}[${n}]`}};ln.ValueScopeName=$m;var I3=(0,cn._)`\n`,wS=class extends qm{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?I3:cn.nil}}get(){return this._scope}name(e){return new $m(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let u=a.get(o);if(u)return u}else a=this._values[s]=new Map;a.set(o,i);let c=this._scope[s]||(this._scope[s]=[]),l=c.length;return c[l]=r.ref,i.setValue(r,{property:s,itemIndex:l}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,cn._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let s=cn.nil;for(let o in e){let a=e[o];if(!a)continue;let c=n[o]=n[o]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,Lm.Started);let u=r(l);if(u){let d=this.opts.es5?ln.varKinds.var:ln.varKinds.const;s=(0,cn._)`${s}${d} ${l} = ${u};${this.opts._n}`}else if(u=i?.(l))s=(0,cn._)`${s}${u}${this.opts._n}`;else throw new ES(l);c.set(l,Lm.Completed)})}return s}};ln.ValueScope=wS});var _e=R(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.or=we.and=we.not=we.CodeGen=we.operators=we.varKinds=we.ValueScopeName=we.ValueScope=we.Scope=we.Name=we.regexpCode=we.stringify=we.getProperty=we.nil=we.strConcat=we.str=we._=void 0;var Be=Su(),hi=DS(),Hs=Su();Object.defineProperty(we,"_",{enumerable:!0,get:function(){return Hs._}});Object.defineProperty(we,"str",{enumerable:!0,get:function(){return Hs.str}});Object.defineProperty(we,"strConcat",{enumerable:!0,get:function(){return Hs.strConcat}});Object.defineProperty(we,"nil",{enumerable:!0,get:function(){return Hs.nil}});Object.defineProperty(we,"getProperty",{enumerable:!0,get:function(){return Hs.getProperty}});Object.defineProperty(we,"stringify",{enumerable:!0,get:function(){return Hs.stringify}});Object.defineProperty(we,"regexpCode",{enumerable:!0,get:function(){return Hs.regexpCode}});Object.defineProperty(we,"Name",{enumerable:!0,get:function(){return Hs.Name}});var Um=DS();Object.defineProperty(we,"Scope",{enumerable:!0,get:function(){return Um.Scope}});Object.defineProperty(we,"ValueScope",{enumerable:!0,get:function(){return Um.ValueScope}});Object.defineProperty(we,"ValueScopeName",{enumerable:!0,get:function(){return Um.ValueScopeName}});Object.defineProperty(we,"varKinds",{enumerable:!0,get:function(){return Um.varKinds}});we.operators={GT:new Be._Code(">"),GTE:new Be._Code(">="),LT:new Be._Code("<"),LTE:new Be._Code("<="),EQ:new Be._Code("==="),NEQ:new Be._Code("!=="),NOT:new Be._Code("!"),OR:new Be._Code("||"),AND:new Be._Code("&&"),ADD:new Be._Code("+")};var ss=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},CS=class extends ss{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?hi.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=oc(this.rhs,e,r)),this}get names(){return this.rhs instanceof Be._CodeOrName?this.rhs.names:{}}},Fm=class extends ss{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Be.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=oc(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Be.Name?{}:{...this.lhs.names};return jm(e,this.rhs)}},AS=class extends Fm{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},IS=class extends ss{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},OS=class extends ss{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},xS=class extends ss{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},MS=class extends ss{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=oc(this.code,e,r),this}get names(){return this.code instanceof Be._CodeOrName?this.code.names:{}}},_u=class extends ss{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(e,r)||(O3(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Oo(e,r.names),{})}},os=class extends _u{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},LS=class extends _u{},sc=class extends os{};sc.kind="else";var Ao=class t extends os{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new sc(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(pq(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=oc(this.condition,e,r),this}get names(){let e=super.names;return jm(e,this.condition),this.else&&Oo(e,this.else.names),e}};Ao.kind="if";var Io=class extends os{};Io.kind="for";var qS=class extends Io{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=oc(this.iteration,e,r),this}get names(){return Oo(super.names,this.iteration.names)}},$S=class extends Io{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?hi.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=jm(super.names,this.from);return jm(e,this.to)}},Bm=class extends Io{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=oc(this.iterable,e,r),this}get names(){return Oo(super.names,this.iterable.names)}},Pu=class extends os{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Pu.kind="func";var ku=class extends _u{render(e){return"return "+super.render(e)}};ku.kind="return";var FS=class extends os{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Oo(e,this.catch.names),this.finally&&Oo(e,this.finally.names),e}},Nu=class extends os{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Nu.kind="catch";var Ru=class extends os{render(e){return"finally"+super.render(e)}};Ru.kind="finally";var BS=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
176
176
  `:""},this._extScope=e,this._scope=new hi.Scope({parent:e}),this._nodes=[new LS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let s=this._scope.toName(r);return n!==void 0&&i&&(this._constants[s.str]=n),this._leafNode(new CS(e,s,n)),s}const(e,r,n){return this._def(hi.varKinds.const,e,r,n)}let(e,r,n){return this._def(hi.varKinds.let,e,r,n)}var(e,r,n){return this._def(hi.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Fm(e,r,n))}add(e,r){return this._leafNode(new AS(e,we.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Be.nil&&this._leafNode(new MS(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,Be.addCodeArg)(r,i));return r.push("}"),new Be._Code(r)}if(e,r,n){if(this._blockNode(new Ao(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Ao(e))}else(){return this._elseNode(new sc)}endIf(){return this._endBlockNode(Ao,sc)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new qS(e),r)}forRange(e,r,n,i,s=this.opts.es5?hi.varKinds.var:hi.varKinds.let){let o=this._scope.toName(e);return this._for(new $S(s,o,r,n),()=>i(o))}forOf(e,r,n,i=hi.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=r instanceof Be.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Be._)`${o}.length`,a=>{this.var(s,(0,Be._)`${o}[${a}]`),n(s)})}return this._for(new Bm("of",i,s,r),()=>n(s))}forIn(e,r,n,i=this.opts.es5?hi.varKinds.var:hi.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Be._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new Bm("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(Io)}label(e){return this._leafNode(new IS(e))}break(e){return this._leafNode(new OS(e))}return(e){let r=new ku;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(ku)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new FS;if(this._blockNode(i),this.code(e),r){let s=this.name("e");this._currNode=i.catch=new Nu(s),r(s)}return n&&(this._currNode=i.finally=new Ru,this.code(n)),this._endBlockNode(Nu,Ru)}throw(e){return this._leafNode(new xS(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Be.nil,n,i){return this._blockNode(new Pu(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Pu)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Ao))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};we.CodeGen=BS;function Oo(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function jm(t,e){return e instanceof Be._CodeOrName?Oo(t,e.names):t}function oc(t,e,r){if(t instanceof Be.Name)return n(t);if(!i(t))return t;return new Be._Code(t._items.reduce((s,o)=>(o instanceof Be.Name&&(o=n(o)),o instanceof Be._Code?s.push(...o._items):s.push(o),s),[]));function n(s){let o=r[s.str];return o===void 0||e[s.str]!==1?s:(delete e[s.str],o)}function i(s){return s instanceof Be._Code&&s._items.some(o=>o instanceof Be.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function O3(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function pq(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Be._)`!${jS(t)}`}we.not=pq;var x3=hq(we.operators.AND);function M3(...t){return t.reduce(x3)}we.and=M3;var L3=hq(we.operators.OR);function q3(...t){return t.reduce(L3)}we.or=q3;function hq(t){return(e,r)=>e===Be.nil?r:r===Be.nil?e:(0,Be._)`${jS(e)} ${t} ${jS(r)}`}function jS(t){return t instanceof Be.Name?t:(0,Be._)`(${t})`}});var Ie=R(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.checkStrictMode=Ae.getErrorPath=Ae.Type=Ae.useFunc=Ae.setEvaluated=Ae.evaluatedPropsToName=Ae.mergeEvaluated=Ae.eachItem=Ae.unescapeJsonPointer=Ae.escapeJsonPointer=Ae.escapeFragment=Ae.unescapeFragment=Ae.schemaRefOrVal=Ae.schemaHasRulesButRef=Ae.schemaHasRules=Ae.checkUnknownRules=Ae.alwaysValidSchema=Ae.toHash=void 0;var gt=_e(),$3=Su();function F3(t){let e={};for(let r of t)e[r]=!0;return e}Ae.toHash=F3;function B3(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(yq(t,e),!Tq(e,t.self.RULES.all))}Ae.alwaysValidSchema=B3;function yq(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let s in e)i[s]||Sq(t,`unknown keyword: "${s}"`)}Ae.checkUnknownRules=yq;function Tq(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Ae.schemaHasRules=Tq;function j3(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Ae.schemaHasRulesButRef=j3;function U3({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,gt._)`${r}`}return(0,gt._)`${t}${e}${(0,gt.getProperty)(n)}`}Ae.schemaRefOrVal=U3;function H3(t){return vq(decodeURIComponent(t))}Ae.unescapeFragment=H3;function V3(t){return encodeURIComponent(HS(t))}Ae.escapeFragment=V3;function HS(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Ae.escapeJsonPointer=HS;function vq(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Ae.unescapeJsonPointer=vq;function W3(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Ae.eachItem=W3;function mq({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,s,o,a)=>{let c=o===void 0?s:o instanceof gt.Name?(s instanceof gt.Name?t(i,s,o):e(i,s,o),o):s instanceof gt.Name?(e(i,o,s),s):r(s,o);return a===gt.Name&&!(c instanceof gt.Name)?n(i,c):c}}Ae.mergeEvaluated={props:mq({mergeNames:(t,e,r)=>t.if((0,gt._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,gt._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,gt._)`${r} || {}`).code((0,gt._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,gt._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,gt._)`${r} || {}`),VS(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:bq}),items:mq({mergeNames:(t,e,r)=>t.if((0,gt._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,gt._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,gt._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,gt._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function bq(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,gt._)`{}`);return e!==void 0&&VS(t,r,e),r}Ae.evaluatedPropsToName=bq;function VS(t,e,r){Object.keys(r).forEach(n=>t.assign((0,gt._)`${e}${(0,gt.getProperty)(n)}`,!0))}Ae.setEvaluated=VS;var gq={};function z3(t,e){return t.scopeValue("func",{ref:e,code:gq[e.code]||(gq[e.code]=new $3._Code(e.code))})}Ae.useFunc=z3;var US;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(US||(Ae.Type=US={}));function G3(t,e,r){if(t instanceof gt.Name){let n=e===US.Num;return r?n?(0,gt._)`"[" + ${t} + "]"`:(0,gt._)`"['" + ${t} + "']"`:n?(0,gt._)`"/" + ${t}`:(0,gt._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,gt.getProperty)(t).toString():"/"+HS(t)}Ae.getErrorPath=G3;function Sq(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Ae.checkStrictMode=Sq});var Un=R(WS=>{"use strict";Object.defineProperty(WS,"__esModule",{value:!0});var Ar=_e(),Y3={data:new Ar.Name("data"),valCxt:new Ar.Name("valCxt"),instancePath:new Ar.Name("instancePath"),parentData:new Ar.Name("parentData"),parentDataProperty:new Ar.Name("parentDataProperty"),rootData:new Ar.Name("rootData"),dynamicAnchors:new Ar.Name("dynamicAnchors"),vErrors:new Ar.Name("vErrors"),errors:new Ar.Name("errors"),this:new Ar.Name("this"),self:new Ar.Name("self"),scope:new Ar.Name("scope"),json:new Ar.Name("json"),jsonPos:new Ar.Name("jsonPos"),jsonLen:new Ar.Name("jsonLen"),jsonPart:new Ar.Name("jsonPart")};WS.default=Y3});var Eu=R(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.extendErrors=Ir.resetErrorsCount=Ir.reportExtraError=Ir.reportError=Ir.keyword$DataError=Ir.keywordError=void 0;var We=_e(),Hm=Ie(),Hr=Un();Ir.keywordError={message:({keyword:t})=>(0,We.str)`must pass "${t}" keyword validation`};Ir.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,We.str)`"${t}" keyword must be ${e} ($data)`:(0,We.str)`"${t}" keyword is invalid ($data)`};function K3(t,e=Ir.keywordError,r,n){let{it:i}=t,{gen:s,compositeRule:o,allErrors:a}=i,c=kq(t,e,r);n??(o||a)?_q(s,c):Pq(i,(0,We._)`[${c}]`)}Ir.reportError=K3;function X3(t,e=Ir.keywordError,r){let{it:n}=t,{gen:i,compositeRule:s,allErrors:o}=n,a=kq(t,e,r);_q(i,a),s||o||Pq(n,Hr.default.vErrors)}Ir.reportExtraError=X3;function J3(t,e){t.assign(Hr.default.errors,e),t.if((0,We._)`${Hr.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,We._)`${Hr.default.vErrors}.length`,e),()=>t.assign(Hr.default.vErrors,null)))}Ir.resetErrorsCount=J3;function Q3({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:s}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,Hr.default.errors,a=>{t.const(o,(0,We._)`${Hr.default.vErrors}[${a}]`),t.if((0,We._)`${o}.instancePath === undefined`,()=>t.assign((0,We._)`${o}.instancePath`,(0,We.strConcat)(Hr.default.instancePath,s.errorPath))),t.assign((0,We._)`${o}.schemaPath`,(0,We.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,We._)`${o}.schema`,r),t.assign((0,We._)`${o}.data`,n))})}Ir.extendErrors=Q3;function _q(t,e){let r=t.const("err",e);t.if((0,We._)`${Hr.default.vErrors} === null`,()=>t.assign(Hr.default.vErrors,(0,We._)`[${r}]`),(0,We._)`${Hr.default.vErrors}.push(${r})`),t.code((0,We._)`${Hr.default.errors}++`)}function Pq(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,We._)`new ${t.ValidationError}(${e})`):(r.assign((0,We._)`${n}.errors`,e),r.return(!1))}var xo={keyword:new We.Name("keyword"),schemaPath:new We.Name("schemaPath"),params:new We.Name("params"),propertyName:new We.Name("propertyName"),message:new We.Name("message"),schema:new We.Name("schema"),parentSchema:new We.Name("parentSchema")};function kq(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,We._)`{}`:Z3(t,e,r)}function Z3(t,e,r={}){let{gen:n,it:i}=t,s=[eX(i,r),tX(t,r)];return rX(t,e,s),n.object(...s)}function eX({errorPath:t},{instancePath:e}){let r=e?(0,We.str)`${t}${(0,Hm.getErrorPath)(e,Hm.Type.Str)}`:t;return[Hr.default.instancePath,(0,We.strConcat)(Hr.default.instancePath,r)]}function tX({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,We.str)`${e}/${t}`;return r&&(i=(0,We.str)`${i}${(0,Hm.getErrorPath)(r,Hm.Type.Str)}`),[xo.schemaPath,i]}function rX(t,{params:e,message:r},n){let{keyword:i,data:s,schemaValue:o,it:a}=t,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;n.push([xo.keyword,i],[xo.params,typeof e=="function"?e(t):e||(0,We._)`{}`]),c.messages&&n.push([xo.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([xo.schema,o],[xo.parentSchema,(0,We._)`${u}${d}`],[Hr.default.data,s]),l&&n.push([xo.propertyName,l])}});var Rq=R(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.boolOrEmptySchema=ac.topBoolOrEmptySchema=void 0;var nX=Eu(),iX=_e(),sX=Un(),oX={message:"boolean schema is false"};function aX(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Nq(t,!1):typeof r=="object"&&r.$async===!0?e.return(sX.default.data):(e.assign((0,iX._)`${n}.errors`,null),e.return(!0))}ac.topBoolOrEmptySchema=aX;function cX(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Nq(t)):r.var(e,!0)}ac.boolOrEmptySchema=cX;function Nq(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,nX.reportError)(i,oX,void 0,e)}});var zS=R(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.getRules=cc.isJSONType=void 0;var lX=["string","number","integer","boolean","null","object","array"],uX=new Set(lX);function dX(t){return typeof t=="string"&&uX.has(t)}cc.isJSONType=dX;function fX(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}cc.getRules=fX});var GS=R(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.shouldUseRule=Vs.shouldUseGroup=Vs.schemaHasRulesForType=void 0;function pX({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Eq(t,n)}Vs.schemaHasRulesForType=pX;function Eq(t,e){return e.rules.some(r=>wq(t,r))}Vs.shouldUseGroup=Eq;function wq(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Vs.shouldUseRule=wq});var wu=R(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.reportTypeError=Or.checkDataTypes=Or.checkDataType=Or.coerceAndCheckDataType=Or.getJSONTypes=Or.getSchemaTypes=Or.DataType=void 0;var hX=zS(),mX=GS(),gX=Eu(),ke=_e(),Dq=Ie(),lc;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(lc||(Or.DataType=lc={}));function yX(t){let e=Cq(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Or.getSchemaTypes=yX;function Cq(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(hX.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Or.getJSONTypes=Cq;function TX(t,e){let{gen:r,data:n,opts:i}=t,s=vX(e,i.coerceTypes),o=e.length>0&&!(s.length===0&&e.length===1&&(0,mX.schemaHasRulesForType)(t,e[0]));if(o){let a=KS(e,n,i.strictNumbers,lc.Wrong);r.if(a,()=>{s.length?bX(t,e,s):XS(t)})}return o}Or.coerceAndCheckDataType=TX;var Aq=new Set(["string","number","integer","boolean","null"]);function vX(t,e){return e?t.filter(r=>Aq.has(r)||e==="array"&&r==="array"):[]}function bX(t,e,r){let{gen:n,data:i,opts:s}=t,o=n.let("dataType",(0,ke._)`typeof ${i}`),a=n.let("coerced",(0,ke._)`undefined`);s.coerceTypes==="array"&&n.if((0,ke._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,ke._)`${i}[0]`).assign(o,(0,ke._)`typeof ${i}`).if(KS(e,i,s.strictNumbers),()=>n.assign(a,i))),n.if((0,ke._)`${a} !== undefined`);for(let l of r)(Aq.has(l)||l==="array"&&s.coerceTypes==="array")&&c(l);n.else(),XS(t),n.endIf(),n.if((0,ke._)`${a} !== undefined`,()=>{n.assign(i,a),SX(t,a)});function c(l){switch(l){case"string":n.elseIf((0,ke._)`${o} == "number" || ${o} == "boolean"`).assign(a,(0,ke._)`"" + ${i}`).elseIf((0,ke._)`${i} === null`).assign(a,(0,ke._)`""`);return;case"number":n.elseIf((0,ke._)`${o} == "boolean" || ${i} === null
177
177
  || (${o} == "string" && ${i} && ${i} == +${i})`).assign(a,(0,ke._)`+${i}`);return;case"integer":n.elseIf((0,ke._)`${o} === "boolean" || ${i} === null
178
178
  || (${o} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(a,(0,ke._)`+${i}`);return;case"boolean":n.elseIf((0,ke._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(a,!1).elseIf((0,ke._)`${i} === "true" || ${i} === 1`).assign(a,!0);return;case"null":n.elseIf((0,ke._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(a,null);return;case"array":n.elseIf((0,ke._)`${o} === "string" || ${o} === "number"
179
- || ${o} === "boolean" || ${i} === null`).assign(a,(0,ke._)`[${i}]`)}}}function SX({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,ke._)`${e} !== undefined`,()=>t.assign((0,ke._)`${e}[${r}]`,n))}function YS(t,e,r,n=lc.Correct){let i=n===lc.Correct?ke.operators.EQ:ke.operators.NEQ,s;switch(t){case"null":return(0,ke._)`${e} ${i} null`;case"array":s=(0,ke._)`Array.isArray(${e})`;break;case"object":s=(0,ke._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=o((0,ke._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=o();break;default:return(0,ke._)`typeof ${e} ${i} ${t}`}return n===lc.Correct?s:(0,ke.not)(s);function o(a=ke.nil){return(0,ke.and)((0,ke._)`typeof ${e} == "number"`,a,r?(0,ke._)`isFinite(${e})`:ke.nil)}}Or.checkDataType=YS;function KS(t,e,r,n){if(t.length===1)return YS(t[0],e,r,n);let i,s=(0,Dq.toHash)(t);if(s.array&&s.object){let o=(0,ke._)`typeof ${e} != "object"`;i=s.null?o:(0,ke._)`!${e} || ${o}`,delete s.null,delete s.array,delete s.object}else i=ke.nil;s.number&&delete s.integer;for(let o in s)i=(0,ke.and)(i,YS(o,e,r,n));return i}Or.checkDataTypes=KS;var _X={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,ke._)`{type: ${t}}`:(0,ke._)`{type: ${e}}`};function XS(t){let e=PX(t);(0,gX.reportError)(e,_X)}Or.reportTypeError=XS;function PX(t){let{gen:e,data:r,schema:n}=t,i=(0,Dq.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var Oq=R(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.assignDefaults=void 0;var uc=_e(),kX=Ie();function NX(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)Iq(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,s)=>Iq(t,s,i.default))}Vm.assignDefaults=NX;function Iq(t,e,r){let{gen:n,compositeRule:i,data:s,opts:o}=t;if(r===void 0)return;let a=(0,uc._)`${s}${(0,uc.getProperty)(e)}`;if(i){(0,kX.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,uc._)`${a} === undefined`;o.useDefaults==="empty"&&(c=(0,uc._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,uc._)`${a} = ${(0,uc.stringify)(r)}`)}});var Hn=R(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.validateUnion=ct.validateArray=ct.usePattern=ct.callValidateCode=ct.schemaProperties=ct.allSchemaProperties=ct.noPropertyInData=ct.propertyInData=ct.isOwnProperty=ct.hasPropFunc=ct.reportMissingProp=ct.checkMissingProp=ct.checkReportMissingProp=void 0;var Pt=_e(),JS=Ie(),Ws=Un(),RX=Ie();function EX(t,e){let{gen:r,data:n,it:i}=t;r.if(ZS(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Pt._)`${e}`},!0),t.error()})}ct.checkReportMissingProp=EX;function wX({gen:t,data:e,it:{opts:r}},n,i){return(0,Pt.or)(...n.map(s=>(0,Pt.and)(ZS(t,e,s,r.ownProperties),(0,Pt._)`${i} = ${s}`)))}ct.checkMissingProp=wX;function DX(t,e){t.setParams({missingProperty:e},!0),t.error()}ct.reportMissingProp=DX;function xq(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Pt._)`Object.prototype.hasOwnProperty`})}ct.hasPropFunc=xq;function QS(t,e,r){return(0,Pt._)`${xq(t)}.call(${e}, ${r})`}ct.isOwnProperty=QS;function CX(t,e,r,n){let i=(0,Pt._)`${e}${(0,Pt.getProperty)(r)} !== undefined`;return n?(0,Pt._)`${i} && ${QS(t,e,r)}`:i}ct.propertyInData=CX;function ZS(t,e,r,n){let i=(0,Pt._)`${e}${(0,Pt.getProperty)(r)} === undefined`;return n?(0,Pt.or)(i,(0,Pt.not)(QS(t,e,r))):i}ct.noPropertyInData=ZS;function Mq(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}ct.allSchemaProperties=Mq;function AX(t,e){return Mq(e).filter(r=>!(0,JS.alwaysValidSchema)(t,e[r]))}ct.schemaProperties=AX;function IX({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:s},it:o},a,c,l){let u=l?(0,Pt._)`${t}, ${e}, ${n}${i}`:e,d=[[Ws.default.instancePath,(0,Pt.strConcat)(Ws.default.instancePath,s)],[Ws.default.parentData,o.parentData],[Ws.default.parentDataProperty,o.parentDataProperty],[Ws.default.rootData,Ws.default.rootData]];o.opts.dynamicRef&&d.push([Ws.default.dynamicAnchors,Ws.default.dynamicAnchors]);let f=(0,Pt._)`${u}, ${r.object(...d)}`;return c!==Pt.nil?(0,Pt._)`${a}.call(${c}, ${f})`:(0,Pt._)`${a}(${f})`}ct.callValidateCode=IX;var OX=(0,Pt._)`new RegExp`;function xX({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,s=i(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,Pt._)`${i.code==="new RegExp"?OX:(0,RX.useFunc)(t,i)}(${r}, ${n})`})}ct.usePattern=xX;function MX(t){let{gen:e,data:r,keyword:n,it:i}=t,s=e.name("valid");if(i.allErrors){let a=e.let("valid",!0);return o(()=>e.assign(a,!1)),a}return e.var(s,!0),o(()=>e.break()),s;function o(a){let c=e.const("len",(0,Pt._)`${r}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:n,dataProp:l,dataPropType:JS.Type.Num},s),e.if((0,Pt.not)(s),a)})}}ct.validateArray=MX;function LX(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,JS.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,l)=>{let u=t.subschema({keyword:n,schemaProp:l,compositeRule:!0},a);e.assign(o,(0,Pt._)`${o} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,Pt.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}ct.validateUnion=LX});var $q=R(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.validateKeywordUsage=qi.validSchemaType=qi.funcKeywordCode=qi.macroKeywordCode=void 0;var Vr=_e(),Mo=Un(),qX=Hn(),$X=Eu();function FX(t,e){let{gen:r,keyword:n,schema:i,parentSchema:s,it:o}=t,a=e.macro.call(o.self,i,s,o),c=qq(r,n,a);o.opts.validateSchema!==!1&&o.self.validateSchema(a,!0);let l=r.name("valid");t.subschema({schema:a,schemaPath:Vr.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}qi.macroKeywordCode=FX;function BX(t,e){var r;let{gen:n,keyword:i,schema:s,parentSchema:o,$data:a,it:c}=t;UX(c,e);let l=!a&&e.compile?e.compile.call(c.self,s,o,c):e.validate,u=qq(n,i,l),d=n.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)h(),e.modifying&&Lq(t),y(()=>t.error());else{let S=e.async?p():m();e.modifying&&Lq(t),y(()=>jX(t,S))}}function p(){let S=n.let("ruleErrs",null);return n.try(()=>h((0,Vr._)`await `),v=>n.assign(d,!1).if((0,Vr._)`${v} instanceof ${c.ValidationError}`,()=>n.assign(S,(0,Vr._)`${v}.errors`),()=>n.throw(v))),S}function m(){let S=(0,Vr._)`${u}.errors`;return n.assign(S,null),h(Vr.nil),S}function h(S=e.async?(0,Vr._)`await `:Vr.nil){let v=c.opts.passContext?Mo.default.this:Mo.default.self,b=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Vr._)`${S}${(0,qX.callValidateCode)(t,u,v,b)}`,e.modifying)}function y(S){var v;n.if((0,Vr.not)((v=e.valid)!==null&&v!==void 0?v:d),S)}}qi.funcKeywordCode=BX;function Lq(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Vr._)`${n.parentData}[${n.parentDataProperty}]`))}function jX(t,e){let{gen:r}=t;r.if((0,Vr._)`Array.isArray(${e})`,()=>{r.assign(Mo.default.vErrors,(0,Vr._)`${Mo.default.vErrors} === null ? ${e} : ${Mo.default.vErrors}.concat(${e})`).assign(Mo.default.errors,(0,Vr._)`${Mo.default.vErrors}.length`),(0,$X.extendErrors)(t)},()=>t.error())}function UX({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function qq(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Vr.stringify)(r)})}function HX(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}qi.validSchemaType=HX;function VX({schema:t,opts:e,self:r,errSchemaPath:n},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}qi.validateKeywordUsage=VX});var Bq=R(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.extendSubschemaMode=zs.extendSubschemaData=zs.getSubschema=void 0;var $i=_e(),Fq=Ie();function WX(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:s,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,$i._)`${t.schemaPath}${(0,$i.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,$i._)`${t.schemaPath}${(0,$i.getProperty)(e)}${(0,$i.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Fq.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||s===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}zs.getSubschema=WX;function zX(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:s,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=e,f=a.let("data",(0,$i._)`${e.data}${(0,$i.getProperty)(r)}`,!0);c(f),t.errorPath=(0,$i.str)`${l}${(0,Fq.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,$i._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let l=i instanceof $i.Name?i:a.let("data",i,!0);c(l),o!==void 0&&(t.propertyName=o)}s&&(t.dataTypes=s);function c(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l]}}zs.extendSubschemaData=zX;function GX(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:s}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}zs.extendSubschemaMode=GX});var e_=R((JDe,jq)=>{"use strict";jq.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;i--!==0;){var o=s[i];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}});var Hq=R((QDe,Uq)=>{"use strict";var Gs=Uq.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};Wm(e,n,i,t,"",t)};Gs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Gs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Gs.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Gs.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Wm(t,e,r,n,i,s,o,a,c,l){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,s,o,a,c,l);for(var u in n){var d=n[u];if(Array.isArray(d)){if(u in Gs.arrayKeywords)for(var f=0;f<d.length;f++)Wm(t,e,r,d[f],i+"/"+u+"/"+f,s,i,u,n,f)}else if(u in Gs.propsKeywords){if(d&&typeof d=="object")for(var p in d)Wm(t,e,r,d[p],i+"/"+u+"/"+YX(p),s,i,u,n,p)}else(u in Gs.keywords||t.allKeys&&!(u in Gs.skipKeywords))&&Wm(t,e,r,d,i+"/"+u,s,i,u,n)}r(n,i,s,o,a,c,l)}}function YX(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Du=R(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.getSchemaRefs=un.resolveUrl=un.normalizeId=un._getFullPath=un.getFullPath=un.inlineRef=void 0;var KX=Ie(),XX=e_(),JX=Hq(),QX=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function ZX(t,e=!0){return typeof t=="boolean"?!0:e===!0?!t_(t):e?Vq(t)<=e:!1}un.inlineRef=ZX;var e4=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function t_(t){for(let e in t){if(e4.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(t_)||typeof r=="object"&&t_(r))return!0}return!1}function Vq(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!QX.has(r)&&(typeof t[r]=="object"&&(0,KX.eachItem)(t[r],n=>e+=Vq(n)),e===1/0))return 1/0}return e}function Wq(t,e="",r){r!==!1&&(e=dc(e));let n=t.parse(e);return zq(t,n)}un.getFullPath=Wq;function zq(t,e){return t.serialize(e).split("#")[0]+"#"}un._getFullPath=zq;var t4=/#\/?$/;function dc(t){return t?t.replace(t4,""):""}un.normalizeId=dc;function r4(t,e,r){return r=dc(r),t.resolve(e,r)}un.resolveUrl=r4;var n4=/^[a-z_][-a-z0-9._]*$/i;function i4(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=dc(t[r]||e),s={"":i},o=Wq(n,i,!1),a={},c=new Set;return JX(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=o+f,y=s[m];typeof d[r]=="string"&&(y=S.call(this,d[r])),v.call(this,d.$anchor),v.call(this,d.$dynamicAnchor),s[f]=y;function S(b){let P=this.opts.uriResolver.resolve;if(b=dc(y?P(y,b):b),c.has(b))throw u(b);c.add(b);let N=this.refs[b];return typeof N=="string"&&(N=this.refs[N]),typeof N=="object"?l(d,N.schema,b):b!==dc(h)&&(b[0]==="#"?(l(d,a[b],b),a[b]=d):this.refs[b]=h),b}function v(b){if(typeof b=="string"){if(!n4.test(b))throw new Error(`invalid anchor "${b}"`);S.call(this,`#${b}`)}}}),a;function l(d,f,p){if(f!==void 0&&!XX(d,f))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}un.getSchemaRefs=i4});var Iu=R(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.getData=Ys.KeywordCxt=Ys.validateFunctionCode=void 0;var Jq=Rq(),Gq=wu(),n_=GS(),zm=wu(),s4=Oq(),Au=$q(),r_=Bq(),oe=_e(),Te=Un(),o4=Du(),os=Ie(),Cu=Eu();function a4(t){if(e$(t)&&(t$(t),Zq(t))){u4(t);return}Qq(t,()=>(0,Jq.topBoolOrEmptySchema)(t))}Ys.validateFunctionCode=a4;function Qq({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},s){i.code.es5?t.func(e,(0,oe._)`${Te.default.data}, ${Te.default.valCxt}`,n.$async,()=>{t.code((0,oe._)`"use strict"; ${Yq(r,i)}`),l4(t,i),t.code(s)}):t.func(e,(0,oe._)`${Te.default.data}, ${c4(i)}`,n.$async,()=>t.code(Yq(r,i)).code(s))}function c4(t){return(0,oe._)`{${Te.default.instancePath}="", ${Te.default.parentData}, ${Te.default.parentDataProperty}, ${Te.default.rootData}=${Te.default.data}${t.dynamicRef?(0,oe._)`, ${Te.default.dynamicAnchors}={}`:oe.nil}}={}`}function l4(t,e){t.if(Te.default.valCxt,()=>{t.var(Te.default.instancePath,(0,oe._)`${Te.default.valCxt}.${Te.default.instancePath}`),t.var(Te.default.parentData,(0,oe._)`${Te.default.valCxt}.${Te.default.parentData}`),t.var(Te.default.parentDataProperty,(0,oe._)`${Te.default.valCxt}.${Te.default.parentDataProperty}`),t.var(Te.default.rootData,(0,oe._)`${Te.default.valCxt}.${Te.default.rootData}`),e.dynamicRef&&t.var(Te.default.dynamicAnchors,(0,oe._)`${Te.default.valCxt}.${Te.default.dynamicAnchors}`)},()=>{t.var(Te.default.instancePath,(0,oe._)`""`),t.var(Te.default.parentData,(0,oe._)`undefined`),t.var(Te.default.parentDataProperty,(0,oe._)`undefined`),t.var(Te.default.rootData,Te.default.data),e.dynamicRef&&t.var(Te.default.dynamicAnchors,(0,oe._)`{}`)})}function u4(t){let{schema:e,opts:r,gen:n}=t;Qq(t,()=>{r.$comment&&e.$comment&&n$(t),m4(t),n.let(Te.default.vErrors,null),n.let(Te.default.errors,0),r.unevaluated&&d4(t),r$(t),T4(t)})}function d4(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,oe._)`${r}.evaluated`),e.if((0,oe._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,oe._)`${t.evaluated}.props`,(0,oe._)`undefined`)),e.if((0,oe._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,oe._)`${t.evaluated}.items`,(0,oe._)`undefined`))}function Yq(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,oe._)`/*# sourceURL=${r} */`:oe.nil}function f4(t,e){if(e$(t)&&(t$(t),Zq(t))){p4(t,e);return}(0,Jq.boolOrEmptySchema)(t,e)}function Zq({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function e$(t){return typeof t.schema!="boolean"}function p4(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&n$(t),g4(t),y4(t);let s=n.const("_errs",Te.default.errors);r$(t,s),n.var(e,(0,oe._)`${s} === ${Te.default.errors}`)}function t$(t){(0,os.checkUnknownRules)(t),h4(t)}function r$(t,e){if(t.opts.jtd)return Kq(t,[],!1,e);let r=(0,Gq.getSchemaTypes)(t.schema),n=(0,Gq.coerceAndCheckDataType)(t,r);Kq(t,r,!n,e)}function h4(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,os.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function m4(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,os.checkStrictMode)(t,"default is ignored in the schema root")}function g4(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,o4.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function y4(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function n$({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let s=r.$comment;if(i.$comment===!0)t.code((0,oe._)`${Te.default.self}.logger.log(${s})`);else if(typeof i.$comment=="function"){let o=(0,oe.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,oe._)`${Te.default.self}.opts.$comment(${s}, ${o}, ${a}.schema)`)}}function T4(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:s}=t;r.$async?e.if((0,oe._)`${Te.default.errors} === 0`,()=>e.return(Te.default.data),()=>e.throw((0,oe._)`new ${i}(${Te.default.vErrors})`)):(e.assign((0,oe._)`${n}.errors`,Te.default.vErrors),s.unevaluated&&v4(t),e.return((0,oe._)`${Te.default.errors} === 0`))}function v4({gen:t,evaluated:e,props:r,items:n}){r instanceof oe.Name&&t.assign((0,oe._)`${e}.props`,r),n instanceof oe.Name&&t.assign((0,oe._)`${e}.items`,n)}function Kq(t,e,r,n){let{gen:i,schema:s,data:o,allErrors:a,opts:c,self:l}=t,{RULES:u}=l;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,os.schemaHasRulesButRef)(s,u))){i.block(()=>s$(t,"$ref",u.all.$ref.definition));return}c.jtd||b4(t,e),i.block(()=>{for(let f of u.rules)d(f);d(u.post)});function d(f){(0,n_.shouldUseGroup)(s,f)&&(f.type?(i.if((0,zm.checkDataType)(f.type,o,c.strictNumbers)),Xq(t,f),e.length===1&&e[0]===f.type&&r&&(i.else(),(0,zm.reportTypeError)(t)),i.endIf()):Xq(t,f),a||i.if((0,oe._)`${Te.default.errors} === ${n||0}`))}}function Xq(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,s4.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,n_.shouldUseRule)(n,s)&&s$(t,s.keyword,s.definition,e.type)})}function b4(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(S4(t,e),t.opts.allowUnionTypes||_4(t,e),P4(t,t.dataTypes))}function S4(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{i$(t.dataTypes,r)||i_(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),N4(t,e)}}function _4(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&i_(t,"use allowUnionTypes to allow union type keyword")}function P4(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,n_.shouldUseRule)(t.schema,i)){let{type:s}=i.definition;s.length&&!s.some(o=>k4(e,o))&&i_(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function k4(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function i$(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function N4(t,e){let r=[];for(let n of t.dataTypes)i$(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function i_(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,os.checkStrictMode)(t,e,t.opts.strictTypes)}var Gm=class{constructor(e,r,n){if((0,Au.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,os.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",o$(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Au.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",Te.default.errors))}result(e,r,n){this.failResult((0,oe.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,oe.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,oe._)`${r} !== undefined && (${(0,oe.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Cu.reportExtraError:Cu.reportError)(this,this.def.error,r)}$dataError(){(0,Cu.reportError)(this,this.def.$dataError||Cu.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Cu.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=oe.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=oe.nil,r=oe.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:s,def:o}=this;n.if((0,oe.or)((0,oe._)`${i} === undefined`,r)),e!==oe.nil&&n.assign(e,!0),(s.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==oe.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:s}=this;return(0,oe.or)(o(),a());function o(){if(n.length){if(!(r instanceof oe.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,oe._)`${(0,zm.checkDataTypes)(c,r,s.opts.strictNumbers,zm.DataType.Wrong)}`}return oe.nil}function a(){if(i.validateSchema){let c=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,oe._)`!${c}(${r})`}return oe.nil}}subschema(e,r){let n=(0,r_.getSubschema)(this.it,e);(0,r_.extendSubschemaData)(n,this.it,e),(0,r_.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return f4(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=os.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=os.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,oe.Name)),!0}};Ys.KeywordCxt=Gm;function s$(t,e,r,n){let i=new Gm(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,Au.funcKeywordCode)(i,r):"macro"in r?(0,Au.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,Au.funcKeywordCode)(i,r)}var R4=/^\/(?:[^~]|~0|~1)*$/,E4=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function o$(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,s;if(t==="")return Te.default.rootData;if(t[0]==="/"){if(!R4.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,s=Te.default.rootData}else{let l=E4.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+l[1];if(i=l[2],i==="#"){if(u>=e)throw new Error(c("property/index",u));return n[e-u]}if(u>e)throw new Error(c("data",u));if(s=r[e-u],!i)return s}let o=s,a=i.split("/");for(let l of a)l&&(s=(0,oe._)`${s}${(0,oe.getProperty)((0,os.unescapeJsonPointer)(l))}`,o=(0,oe._)`${o} && ${s}`);return o;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${e}`}}Ys.getData=o$});var Ym=R(o_=>{"use strict";Object.defineProperty(o_,"__esModule",{value:!0});var s_=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};o_.default=s_});var Ou=R(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var a_=Du(),c_=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,a_.resolveUrl)(e,r,n),this.missingSchema=(0,a_.normalizeId)((0,a_.getFullPath)(e,this.missingRef))}};l_.default=c_});var xu=R(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.resolveSchema=Vn.getCompilingSchema=Vn.resolveRef=Vn.compileSchema=Vn.SchemaEnv=void 0;var mi=_e(),w4=Ym(),Lo=Un(),gi=Du(),a$=Ie(),D4=Iu(),fc=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,gi.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Vn.SchemaEnv=fc;function d_(t){let e=c$.call(this,t);if(e)return e;let r=(0,gi.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new mi.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),a;t.$async&&(a=o.scopeValue("Error",{ref:w4.default,code:(0,mi._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");t.validateName=c;let l={gen:o,allErrors:this.opts.allErrors,data:Lo.default.data,parentData:Lo.default.parentData,parentDataProperty:Lo.default.parentDataProperty,dataNames:[Lo.default.data],dataPathArr:[mi.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,mi.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:mi.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,mi._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,D4.validateFunctionCode)(l),o.optimize(this.opts.code.optimize);let d=o.toString();u=`${o.scopeRefs(Lo.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${Lo.default.self}`,`${Lo.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:o._values}),this.opts.unevaluated){let{props:m,items:h}=l;p.evaluated={props:m instanceof mi.Name?void 0:m,items:h instanceof mi.Name?void 0:h,dynamicProps:m instanceof mi.Name,dynamicItems:h instanceof mi.Name},p.source&&(p.source.evaluated=(0,mi.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}Vn.compileSchema=d_;function C4(t,e,r){var n;r=(0,gi.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let s=O4.call(this,t,r);if(s===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;o&&(s=new fc({schema:o,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=A4.call(this,s)}Vn.resolveRef=C4;function A4(t){return(0,gi.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:d_.call(this,t)}function c$(t){for(let e of this._compilations)if(I4(e,t))return e}Vn.getCompilingSchema=c$;function I4(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function O4(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Km.call(this,t,e)}function Km(t,e){let r=this.opts.uriResolver.parse(e),n=(0,gi._getFullPath)(this.opts.uriResolver,r),i=(0,gi.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return u_.call(this,r,t);let s=(0,gi.normalizeId)(n),o=this.refs[s]||this.schemas[s];if(typeof o=="string"){let a=Km.call(this,t,o);return typeof a?.schema!="object"?void 0:u_.call(this,r,a)}if(typeof o?.schema=="object"){if(o.validate||d_.call(this,o),s===(0,gi.normalizeId)(e)){let{schema:a}=o,{schemaId:c}=this.opts,l=a[c];return l&&(i=(0,gi.resolveUrl)(this.opts.uriResolver,i,l)),new fc({schema:a,schemaId:c,root:t,baseId:i})}return u_.call(this,r,o)}}Vn.resolveSchema=Km;var x4=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function u_(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,a$.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!x4.has(a)&&l&&(e=(0,gi.resolveUrl)(this.opts.uriResolver,e,l))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,a$.schemaHasRulesButRef)(r,this.RULES)){let a=(0,gi.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=Km.call(this,n,a)}let{schemaId:o}=this.opts;if(s=s||new fc({schema:r,schemaId:o,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var l$=R((iCe,M4)=>{M4.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var y_=R((sCe,g$)=>{"use strict";var L4=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),p_=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),q4=RegExp.prototype.test.bind(/^\d*$/u),qo=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),h_=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),d$=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),m_=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),$4=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),dn=new Array(256);{let t="0123456789ABCDEF";for(let e=0;e<256;e++)dn[e]="%"+t[e>>4]+t[e&15]}function xr(t){return t<2048?dn[192|t>>6]+dn[128|t&63]:t<65536?dn[224|t>>12]+dn[128|t>>6&63]+dn[128|t&63]:dn[240|t>>18]+dn[128|t>>12&63]+dn[128|t>>6&63]+dn[128|t&63]}function F4(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var B4=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),j4=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),U4=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),H4=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function V4(t){if(t.length===0)return!1;for(let e=0;e<t.length;e++)if(!U4(t[e])){if(t[e]==="%"&&e+2<t.length&&qo(t.slice(e+1,e+3))){e+=2;continue}return!1}return!0}function u$(t){let e=-1,r=0,n=-1,i=0;for(let a=0;a<t.length;a++)t[a]==="0"?(n===-1&&(n=a),i++,i>r&&(r=i,e=n)):(n=-1,i=0);if(r<2)return t.join(":");let s=t.slice(0,e).join(":"),o=t.slice(e+r).join(":");return s+"::"+o}function W4(t){let e=t.indexOf("::");if(e!==-1&&t.indexOf("::",e+1)!==-1)return;let r=e===-1?t.split(":"):t.slice(0,e).split(":"),n=e===-1?[]:t.slice(e+2).split(":");e!==-1&&(r.length===1&&r[0]===""&&(r.length=0),n.length===1&&n[0]===""&&(n.length=0));let i=r.concat(n),s=0;for(let a=0;a<i.length;a++){let c=i[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==i.length-1||e!==-1&&n.length===0||!p_(c))return;s+=2;continue}if(!B4(c))return;i[a]=parseInt(c,16).toString(16),s++}if(e===-1)return s!==8?void 0:u$(i);if(s>=8)return;let o=i.slice(0,r.length);for(let a=s;a<8;a++)o.push("0");for(let a=r.length;a<i.length;a++)o.push(i[a]);return u$(o)}function f_(t){let e=t[0]==="["&&t[t.length-1]==="]";if((t[0]==="["||t[t.length-1]==="]")&&!e)return{host:t,isIPV6:!1,error:!0};let n=e?t.slice(1,-1):t;if(e&&j4(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(z4(n,":")<2)return{host:t,isIPV6:!1,error:e};let i="",s=n.indexOf("%");if(s!==-1){let a=n.slice(s,s+3).toLowerCase()==="%25"?3:1;if(i=n.slice(s+a),!V4(i))return{host:t,isIPV6:!1,error:!0};n=n.slice(0,s)}let o=W4(n);return o===void 0?{host:t,isIPV6:!1,error:!0}:{host:o+(i?"%"+i:""),escapedHost:o+(i?"%25"+i:""),isIPV6:!0}}function z4(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function G4(t){let e=t,r=[],n=-1,i=0;for(;i=e.length;){if(i===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(i===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(i===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}var Y4={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},K4=/[@/?#:]/g,X4=/[@/?#]/g;function f$(t,e){let r=e?X4:K4;return r.lastIndex=0,t.replace(r,n=>Y4[n])}function p$(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let i=t.slice(n+1,n+3);if(qo(i)){let s=i.toUpperCase(),o=String.fromCharCode(parseInt(s,16));e&&h_(o)?r+=o:r+="%"+s,n+=2;continue}}r+=t[n]}return r}function J4(t){let e="";for(let r=0;r<t.length;r++){let n=t[r];if(n==="%"&&r+2<t.length){let i=t.slice(r+1,r+3);if(qo(i)){let s=i.toUpperCase(),o=String.fromCharCode(parseInt(s,16));o!=="."&&h_(o)?e+=o:e+="%"+s,r+=2;continue}}if(d$(n))e+=n;else{let i=t.charCodeAt(r);if(i<128)e+=m$(i)?n:dn[i];else if(i<55296||i>57343)e+=xr(i);else if(i<=56319&&r+1<t.length){let s=t.charCodeAt(r+1);s>=56320&&s<=57343?(e+=xr(65536+(i-55296<<10)+(s-56320)),r++):e+=xr(65533)}else e+=xr(65533)}}return e}function Q4(t,e=!1){let r="",n=e&&t[0]!=="/";for(let i=0;i<t.length;i++){let s=t[i];if(s==="%"&&i+2<t.length){let o=t.slice(i+1,i+3);if(qo(o)){r+="%"+o.toUpperCase(),i+=2;continue}}if(s==="/"&&(n=!1),d$(s)&&(s!==":"||!n))r+=s;else{let o=t.charCodeAt(i);if(o<128)r+=dn[o];else if(o<55296||o>57343)r+=xr(o);else if(o<=56319&&i+1<t.length){let a=t.charCodeAt(i+1);a>=56320&&a<=57343?(r+=xr(65536+(o-55296<<10)+(a-56320)),i++):r+=xr(65533)}else r+=xr(65533)}}return r}function g_(t,e){let r="";for(let n=0;n<t.length;n++){let i=t[n];if(i==="%"&&n+2<t.length){let s=t.slice(n+1,n+3);if(qo(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(e(i))r+=i;else{let s=t.charCodeAt(n);if(s<128)r+=dn[s];else if(s<55296||s>57343)r+=xr(s);else if(s<=56319&&n+1<t.length){let o=t.charCodeAt(n+1);o>=56320&&o<=57343?(r+=xr(65536+(s-55296<<10)+(o-56320)),n++):r+=xr(65533)}else r+=xr(65533)}}return r}function h$(t){return g_(t,$4)}function Z4(t){return g_(t,m_)}function e9(t){return g_(t,m_)}function m$(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===42||t===43||t===45||t===46||t===47||t===64||t===95}function t9(t){let e="";for(let r=0;r<t.length;r++){let n=t[r];if(n==="%"&&r+2<t.length){let i=t.slice(r+1,r+3);if(qo(i)){let s=i.toUpperCase(),o=String.fromCharCode(parseInt(s,16));h_(o)?e+=o:e+="%"+s,r+=2;continue}}if(m_(n))e+=n;else{let i=t.charCodeAt(r);if(i<128)e+=m$(i)?n:dn[i];else if(i<55296||i>57343)e+=xr(i);else if(i<=56319&&r+1<t.length){let s=t.charCodeAt(r+1);s>=56320&&s<=57343?(e+=xr(65536+(i-55296<<10)+(s-56320)),r++):e+=xr(65533)}else e+=xr(65533)}}return e}function r9(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(qo(n)){e+="%"+n.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function n9(t){let e=[];if(t.userinfo!==void 0&&(e.push(h$(t.userinfo)),e.push("@")),t.host!==void 0){let r=t.host;if(!p_(r)){let n=f_(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=p$(r,!0),n=f_(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=f$(r,!1)}e.push(r)}if(typeof t.port=="number"||typeof t.port=="string"){let r=String(t.port);if(!q4(r))throw new TypeError("URI port is malformed.");e.push(":"),e.push(r)}return e.length?e.join(""):void 0}g$.exports={nonSimpleDomain:H4,recomposeAuthority:n9,reescapeHostDelimiters:f$,normalizePercentEncoding:p$,normalizePathEncoding:J4,serializePathEncoding:Q4,normalizeQueryFragmentEncoding:t9,encodeUserinfo:h$,encodeQuery:Z4,encodeFragment:e9,escapePreservingEscapes:r9,removeDotSegments:G4,isIPv4:p_,isUUID:L4,normalizeIPv6:f_,stringArrayToHexStripped:F4}});var S$=R((oCe,b$)=>{"use strict";var{isUUID:i9}=y_(),s9=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,o9=["http","https","ws","wss","urn","urn:uuid"];function a9(t){return o9.indexOf(t)!==-1}function T_(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function y$(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function T$(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function c9(t){return t.secure=T_(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function l9(t){if((t.port===(T_(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let e=t.resourceName.indexOf("?"),r=e===-1?t.resourceName:t.resourceName.slice(0,e);t.path=r&&r!=="/"?r:void 0,t.query=e===-1?void 0:t.resourceName.slice(e+1),t.resourceName=void 0}return t.fragment=void 0,t}function u9(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(s9);if(r&&r[0]===t.path){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,s=v_(i);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function d9(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,s=v_(i);s&&(t=s.serialize(t,e));let o=t,a=t.nss;return o.path=`${n||e.nid}:${a}`,e.skipEscape=!0,o}function f9(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!i9(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function p9(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var v$={scheme:"http",domainHost:!0,parse:y$,serialize:T$},h9={scheme:"https",domainHost:v$.domainHost,parse:y$,serialize:T$},Xm={scheme:"ws",domainHost:!0,parse:c9,serialize:l9},m9={scheme:"wss",domainHost:Xm.domainHost,parse:Xm.parse,serialize:Xm.serialize},g9={scheme:"urn",parse:u9,serialize:d9,skipNormalize:!0},y9={scheme:"urn:uuid",parse:f9,serialize:p9,skipNormalize:!0},Jm={http:v$,https:h9,ws:Xm,wss:m9,urn:g9,"urn:uuid":y9};Object.setPrototypeOf(Jm,null);function v_(t){return t&&(Jm[t]||Jm[t.toLowerCase()])||void 0}b$.exports={wsIsSecure:T_,SCHEMES:Jm,isValidSchemeName:a9,getSchemeHandler:v_}});var x$=R((aCe,eg)=>{"use strict";var{normalizeIPv6:R$,removeDotSegments:Lu,recomposeAuthority:T9,normalizePercentEncoding:b_,normalizePathEncoding:v9,serializePathEncoding:_$,normalizeQueryFragmentEncoding:P$,encodeQuery:b9,encodeFragment:S9,reescapeHostDelimiters:_9,isIPv4:E$,nonSimpleDomain:P9}=y_(),{SCHEMES:w$,getSchemeHandler:S_}=S$(),D$=/^[A-Za-z][A-Za-z0-9+.-]*$/u,C$="URI scheme is malformed.";function k$(t){let e=unescape(String(t));if(!D$.test(e))throw new TypeError(C$);return e}function k9(t,e){return typeof t=="string"?t=I9(t,e):typeof t=="object"&&(t=Zm($o(t,e),e)),t}function N9(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:i,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:l}=Qm(t,n),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:f,malformedSchemeSpecific:p,malformedHost:m,malformedScheme:h}=Qm(e,n);if(s||d||o||f||a||p||c||m||l||h)throw new Error(i.error||u.error||"URI is malformed.");let y=A$(i,u,n,!0),S=S_(r&&r.scheme||y.scheme),v=y.host,b=v!==void 0&&v!==""&&(E$(v)||R$(v).isIPV6);I$(y,r||{},S,b);let P=v&&v.indexOf("%")!==-1&&!/\P{ASCII}/u.test(v);if(y.error&&!P)throw new Error(y.error);return n.skipEscape=!0,$o(y,n)}function A$(t,e,r,n){let i={};return n||(t=Zm($o(t,r),r),e=Zm($o(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Lu(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Lu(e.path||""),i.query=e.query):(e.path?(e.path[0]==="/"?i.path=Lu(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=Lu(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function R9(t,e,r){let n=N$(t,r),i=N$(e,r);return n!==void 0&&i!==void 0&&n===i}function $o(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[];r.scheme&&(r.scheme=k$(r.scheme));let s=S_(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n);let o=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!n.skipEscape&&r.scheme===void 0&&!o;r.path!==void 0&&(n.skipEscape?r.path=b_(r.path):r.path=_$(r.path,a)),n.reference!=="suffix"&&r.scheme&&(r.scheme=k$(r.scheme),i.push(r.scheme,":"));let c=T9(r);if(c!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(c),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let l=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(l=Lu(l)),a&&(l=_$(l,!0)),c===void 0&&l[0]==="/"&&l[1]==="/"&&(l="/%2F"+l.slice(2)),i.push(l)}return r.query!==void 0&&i.push("?",b9(r.query)),r.fragment!==void 0&&i.push("#",S9(r.fragment)),i.join("")}var E9=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,w9=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,D9=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function C9(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function Mu(t){if(t===void 0)return!1;let e=t.indexOf("%");for(;e!==-1;){if(e+2>=t.length||!/^[\da-f]{2}$/iu.test(t.slice(e+1,e+3)))return!0;e=t.indexOf("%",e+3)}return!1}function __(t){return t[0]==="["&&t[t.length-1]==="]"}function A9(t){let e=t[4];return Mu(t[3])||e!==void 0&&!__(e)&&Mu(e)||Mu(t[6])||Mu(t[7])||Mu(t[8])}function I$(t,e,r,n){if(!e.unicodeSupport&&(!r||!r.unicodeSupport)&&t.host&&!__(t.host)&&(e.domainHost||r&&r.domainHost)&&n===!1&&P9(t.host))try{t.host=new URL("http://"+t.host).hostname}catch(i){return t.error=t.error||"Host's domain name can not be converted to ASCII: "+i,!0}return!1}function Qm(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1,s=!1,o=!1,a=!1,c=!1,l=!1,u=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let d=t.match(w9);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",i=!0);let f=t.match(D9);if(f!==null){let m=f[1],h=m.replace(/[\t\n\r]/g,"");h.length>=2&&(h.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",i=!0):m.length!==h.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",i=!0))}let p=t.match(E9);if(p){if(n.scheme=p[1],n.userinfo=p[3],n.host=p[4],n.port=parseInt(p[5],10),n.path=p[6]||"",n.query=p[7],n.fragment=p[8],n.scheme!==void 0){let y=unescape(n.scheme);D$.test(y)?n.scheme=y.toLowerCase():(n.error=n.error||C$,l=!0)}s=A9(p),s&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=p[5]);let m=C9(n,p);if(m!==void 0&&(n.error=n.error||m,i=!0),n.host)if(E$(n.host)===!1){let S=__(n.host),v=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,b=R$(n.host);u=b.isIPV6||b.isIPVFuture===!0,c=v&&(!S||b.error===!0),n.host=u?b.host:b.host.toLowerCase(),c&&(n.error=n.error||"URI host is malformed.",i=!0)}else u=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let h=S_(r.scheme||n.scheme);if(c||(a=I$(n,r,h,u)),t.indexOf("%")!==-1&&n.host!==void 0&&!c){let y=u?n.host:b_(n.host,!0);u||(y=b_(y.toLowerCase())),n.host=_9(y,u)}(!h||h&&!h.skipNormalize)&&(n.path&&(n.path=v9(n.path)),n.query&&(n.query=P$(n.query)),n.fragment&&(n.fragment=P$(n.fragment))),h&&h.parse&&(h.parse(n,r),h===w$.urn&&n.nid===void 0&&(o=!0))}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:i,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:l}}function Zm(t,e){return Qm(t,e).parsed}function I9(t,e){return O$(t,e).normalized}function O$(t,e){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:i,malformedSchemeSpecific:s,malformedHost:o,malformedScheme:a}=Qm(t,e);return{normalized:n||i||s||o||a?t:$o(r,e),malformedAuthorityOrPort:n,malformedPercentEncoding:i,malformedSchemeSpecific:s,malformedHost:o,malformedScheme:a}}function N$(t,e){if(typeof t!="string"&&typeof t!="object")return;let r;try{r=typeof t=="string"?t:$o(t,e)}catch{return}let{normalized:n,malformedAuthorityOrPort:i,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:c}=O$(r,e);return i||s||o||a||c?void 0:n}var P_={SCHEMES:w$,normalize:k9,resolve:N9,resolveComponent:A$,equal:R9,serialize:$o,parse:Zm};eg.exports=P_;eg.exports.default=P_;eg.exports.fastUri=P_});var L$=R(k_=>{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});var M$=x$();M$.code='require("ajv/dist/runtime/uri").default';k_.default=M$});var V$=R(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.CodeGen=vr.Name=vr.nil=vr.stringify=vr.str=vr._=vr.KeywordCxt=void 0;var O9=Iu();Object.defineProperty(vr,"KeywordCxt",{enumerable:!0,get:function(){return O9.KeywordCxt}});var pc=_e();Object.defineProperty(vr,"_",{enumerable:!0,get:function(){return pc._}});Object.defineProperty(vr,"str",{enumerable:!0,get:function(){return pc.str}});Object.defineProperty(vr,"stringify",{enumerable:!0,get:function(){return pc.stringify}});Object.defineProperty(vr,"nil",{enumerable:!0,get:function(){return pc.nil}});Object.defineProperty(vr,"Name",{enumerable:!0,get:function(){return pc.Name}});Object.defineProperty(vr,"CodeGen",{enumerable:!0,get:function(){return pc.CodeGen}});var x9=Ym(),j$=Ou(),M9=zS(),qu=xu(),L9=_e(),$u=Du(),tg=wu(),R_=Ie(),q$=l$(),q9=L$(),U$=(t,e)=>new RegExp(t,e);U$.code="new RegExp";var $9=["removeAdditional","useDefaults","coerceTypes"],F9=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),B9={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},j9={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},$$=200;function U9(t){var e,r,n,i,s,o,a,c,l,u,d,f,p,m,h,y,S,v,b,P,N,$,j,L,ye;let qe=t.strict,pe=(e=t.code)===null||e===void 0?void 0:e.optimize,Pe=pe===!0||pe===void 0?1:pe||0,ur=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:U$,_r=(i=t.uriResolver)!==null&&i!==void 0?i:q9.default;return{strictSchema:(o=(s=t.strictSchema)!==null&&s!==void 0?s:qe)!==null&&o!==void 0?o:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:qe)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=t.strictTypes)!==null&&l!==void 0?l:qe)!==null&&u!==void 0?u:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:qe)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:qe)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:Pe,regExp:ur}:{optimize:Pe,regExp:ur},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:$$,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:$$,meta:(S=t.meta)!==null&&S!==void 0?S:!0,messages:(v=t.messages)!==null&&v!==void 0?v:!0,inlineRefs:(b=t.inlineRefs)!==null&&b!==void 0?b:!0,schemaId:(P=t.schemaId)!==null&&P!==void 0?P:"$id",addUsedSchema:(N=t.addUsedSchema)!==null&&N!==void 0?N:!0,validateSchema:($=t.validateSchema)!==null&&$!==void 0?$:!0,validateFormats:(j=t.validateFormats)!==null&&j!==void 0?j:!0,unicodeRegExp:(L=t.unicodeRegExp)!==null&&L!==void 0?L:!0,int32range:(ye=t.int32range)!==null&&ye!==void 0?ye:!0,uriResolver:_r}}var Fu=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...U9(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new L9.ValueScope({scope:{},prefixes:F9,es5:r,lines:n}),this.logger=Y9(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,M9.getRules)(),F$.call(this,B9,e,"NOT SUPPORTED"),F$.call(this,j9,e,"DEPRECATED","warn"),this._metaOpts=z9.call(this),e.formats&&V9.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&W9.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),H9.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=q$;n==="id"&&(i={...q$},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(u,d){await s.call(this,u.$schema);let f=this._addSchema(u,d);return f.validate||o.call(this,f)}async function s(u){u&&!this.getSchema(u)&&await i.call(this,{$ref:u},!0)}async function o(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof j$.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),o.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function c(u){let d=await l.call(this,u);this.refs[u]||await s.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function l(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,i);return this}let s;if(typeof e=="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw new Error(`schema ${o} must be string`)}return r=(0,$u.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return i}getSchema(e){let r;for(;typeof(r=B$.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new qu.SchemaEnv({schema:{},schemaId:n});if(r=qu.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=B$.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,$u.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(X9.call(this,n,r),!r)return(0,R_.eachItem)(n,s=>N_.call(this,s)),this;Q9.call(this,r);let i={...r,type:(0,tg.getJSONTypes)(r.type),schemaType:(0,tg.getJSONTypes)(r.schemaType)};return(0,R_.eachItem)(n,i.type.length===0?s=>N_.call(this,s,i):s=>i.type.forEach(o=>N_.call(this,s,i,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(s=>s.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,s)=>i+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let s=i.split("/").slice(1),o=e;for(let a of s)o=o[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=o[a];l&&u&&(o[a]=H$(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:a}=this.opts;if(typeof e=="object")o=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,$u.normalizeId)(o||n);let l=$u.getSchemaRefs.call(this,e,n);return c=new qu.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:l}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):qu.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{qu.compileSchema.call(this,e)}finally{this.opts=r}}};Fu.ValidationError=x9.default;Fu.MissingRefError=j$.default;vr.default=Fu;function F$(t,e,r,n="error"){for(let i in t){let s=i;s in e&&this.logger[n](`${r}: option ${i}. ${t[s]}`)}}function B$(t){return t=(0,$u.normalizeId)(t),this.schemas[t]||this.refs[t]}function H9(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function V9(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function W9(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function z9(){let t={...this.opts};for(let e of $9)delete t[e];return t}var G9={log(){},warn(){},error(){}};function Y9(t){if(t===!1)return G9;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var K9=/^[a-z_$][a-z0-9_$:-]*$/i;function X9(t,e){let{RULES:r}=this;if((0,R_.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!K9.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function N_(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,o=i?s.post:s.rules.find(({type:c})=>c===r);if(o||(o={type:r,rules:[]},s.rules.push(o)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,tg.getJSONTypes)(e.type),schemaType:(0,tg.getJSONTypes)(e.schemaType)}};e.before?J9.call(this,o,a,e.before):o.rules.push(a),s.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function J9(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Q9(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=H$(e)),t.validateSchema=this.compile(e,!0))}var Z9={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function H$(t){return{anyOf:[t,Z9]}}});var W$=R(E_=>{"use strict";Object.defineProperty(E_,"__esModule",{value:!0});var e6={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};E_.default=e6});var ig=R(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.callRef=Fo.getValidate=void 0;var t6=Ou(),z$=Hn(),fn=_e(),hc=Un(),G$=xu(),rg=Ie(),r6={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:s,validateName:o,opts:a,self:c}=n,{root:l}=s;if((r==="#"||r==="#/")&&i===l.baseId)return d();let u=G$.resolveRef.call(c,l,i,r);if(u===void 0)throw new t6.default(n.opts.uriResolver,i,r);if(u instanceof G$.SchemaEnv)return f(u);return p(u);function d(){if(s===l)return ng(t,o,s,s.$async);let m=e.scopeValue("root",{ref:l});return ng(t,(0,fn._)`${m}.validate`,l,l.$async)}function f(m){let h=Y$(t,m);ng(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,fn.stringify)(m)}:{ref:m}),y=e.name("valid"),S=t.subschema({schema:m,dataTypes:[],schemaPath:fn.nil,topSchemaRef:h,errSchemaPath:r},y);t.mergeEvaluated(S),t.ok(y)}}};function Y$(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,fn._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Fo.getValidate=Y$;function ng(t,e,r,n){let{gen:i,it:s}=t,{allErrors:o,schemaEnv:a,opts:c}=s,l=c.passContext?hc.default.this:fn.nil;n?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=i.let("valid");i.try(()=>{i.code((0,fn._)`await ${(0,z$.callValidateCode)(t,e,l)}`),p(e),o||i.assign(m,!0)},h=>{i.if((0,fn._)`!(${h} instanceof ${s.ValidationError})`,()=>i.throw(h)),f(h),o||i.assign(m,!1)}),t.ok(m)}function d(){t.result((0,z$.callValidateCode)(t,e,l),()=>p(e),()=>f(e))}function f(m){let h=(0,fn._)`${m}.errors`;i.assign(hc.default.vErrors,(0,fn._)`${hc.default.vErrors} === null ? ${h} : ${hc.default.vErrors}.concat(${h})`),i.assign(hc.default.errors,(0,fn._)`${hc.default.vErrors}.length`)}function p(m){var h;if(!s.opts.unevaluated)return;let y=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=rg.mergeEvaluated.props(i,y.props,s.props));else{let S=i.var("props",(0,fn._)`${m}.evaluated.props`);s.props=rg.mergeEvaluated.props(i,S,s.props,fn.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=rg.mergeEvaluated.items(i,y.items,s.items));else{let S=i.var("items",(0,fn._)`${m}.evaluated.items`);s.items=rg.mergeEvaluated.items(i,S,s.items,fn.Name)}}}Fo.callRef=ng;Fo.default=r6});var K$=R(w_=>{"use strict";Object.defineProperty(w_,"__esModule",{value:!0});var n6=W$(),i6=ig(),s6=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",n6.default,i6.default];w_.default=s6});var X$=R(D_=>{"use strict";Object.defineProperty(D_,"__esModule",{value:!0});var sg=_e(),Ks=sg.operators,og={maximum:{okStr:"<=",ok:Ks.LTE,fail:Ks.GT},minimum:{okStr:">=",ok:Ks.GTE,fail:Ks.LT},exclusiveMaximum:{okStr:"<",ok:Ks.LT,fail:Ks.GTE},exclusiveMinimum:{okStr:">",ok:Ks.GT,fail:Ks.LTE}},o6={message:({keyword:t,schemaCode:e})=>(0,sg.str)`must be ${og[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,sg._)`{comparison: ${og[t].okStr}, limit: ${e}}`},a6={keyword:Object.keys(og),type:"number",schemaType:"number",$data:!0,error:o6,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,sg._)`${r} ${og[e].fail} ${n} || isNaN(${r})`)}};D_.default=a6});var J$=R(C_=>{"use strict";Object.defineProperty(C_,"__esModule",{value:!0});var Bu=_e(),c6={message:({schemaCode:t})=>(0,Bu.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Bu._)`{multipleOf: ${t}}`},l6={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:c6,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,s=i.opts.multipleOfPrecision,o=e.let("res"),a=s?(0,Bu._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,Bu._)`${o} !== parseInt(${o})`;t.fail$data((0,Bu._)`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};C_.default=l6});var Z$=R(A_=>{"use strict";Object.defineProperty(A_,"__esModule",{value:!0});function Q$(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}A_.default=Q$;Q$.code='require("ajv/dist/runtime/ucs2length").default'});var eF=R(I_=>{"use strict";Object.defineProperty(I_,"__esModule",{value:!0});var Bo=_e(),u6=Ie(),d6=Z$(),f6={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Bo.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Bo._)`{limit: ${t}}`},p6={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:f6,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,s=e==="maxLength"?Bo.operators.GT:Bo.operators.LT,o=i.opts.unicode===!1?(0,Bo._)`${r}.length`:(0,Bo._)`${(0,u6.useFunc)(t.gen,d6.default)}(${r})`;t.fail$data((0,Bo._)`${o} ${s} ${n}`)}};I_.default=p6});var tF=R(O_=>{"use strict";Object.defineProperty(O_,"__esModule",{value:!0});var h6=Hn(),m6=Ie(),mc=_e(),g6={message:({schemaCode:t})=>(0,mc.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,mc._)`{pattern: ${t}}`},y6={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:g6,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:s,it:o}=t,a=o.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=o.opts.code,l=c.code==="new RegExp"?(0,mc._)`new RegExp`:(0,m6.useFunc)(e,c),u=e.let("valid");e.try(()=>e.assign(u,(0,mc._)`${l}(${s}, ${a}).test(${r})`),()=>e.assign(u,!1)),t.fail$data((0,mc._)`!${u}`)}else{let c=(0,h6.usePattern)(t,i);t.fail$data((0,mc._)`!${c}.test(${r})`)}}};O_.default=y6});var rF=R(x_=>{"use strict";Object.defineProperty(x_,"__esModule",{value:!0});var ju=_e(),T6={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,ju.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,ju._)`{limit: ${t}}`},v6={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:T6,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?ju.operators.GT:ju.operators.LT;t.fail$data((0,ju._)`Object.keys(${r}).length ${i} ${n}`)}};x_.default=v6});var nF=R(M_=>{"use strict";Object.defineProperty(M_,"__esModule",{value:!0});var Uu=Hn(),Hu=_e(),b6=Ie(),S6={message:({params:{missingProperty:t}})=>(0,Hu.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Hu._)`{missingProperty: ${t}}`},_6={keyword:"required",type:"object",schemaType:"array",$data:!0,error:S6,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:s,it:o}=t,{opts:a}=o;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(o.allErrors?l():u(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let y=o.schemaEnv.baseId+o.errSchemaPath,S=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,b6.checkStrictMode)(o,S,o.opts.strictRequired)}}function l(){if(c||s)t.block$data(Hu.nil,d);else for(let p of r)(0,Uu.checkReportMissingProp)(t,p)}function u(){let p=e.let("missing");if(c||s){let m=e.let("valid",!0);t.block$data(m,()=>f(p,m)),t.ok(m)}else e.if((0,Uu.checkMissingProp)(t,r,p)),(0,Uu.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,Uu.noPropertyInData)(e,i,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(m,(0,Uu.propertyInData)(e,i,p,a.ownProperties)),e.if((0,Hu.not)(m),()=>{t.error(),e.break()})},Hu.nil)}}};M_.default=_6});var iF=R(L_=>{"use strict";Object.defineProperty(L_,"__esModule",{value:!0});var Vu=_e(),P6={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Vu.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Vu._)`{limit: ${t}}`},k6={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:P6,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?Vu.operators.GT:Vu.operators.LT;t.fail$data((0,Vu._)`${r}.length ${i} ${n}`)}};L_.default=k6});var ag=R(q_=>{"use strict";Object.defineProperty(q_,"__esModule",{value:!0});var sF=e_();sF.code='require("ajv/dist/runtime/equal").default';q_.default=sF});var oF=R(F_=>{"use strict";Object.defineProperty(F_,"__esModule",{value:!0});var $_=wu(),br=_e(),N6=Ie(),R6=ag(),E6={message:({params:{i:t,j:e}})=>(0,br.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,br._)`{i: ${t}, j: ${e}}`},w6={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:E6,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:s,schemaCode:o,it:a}=t;if(!n&&!i)return;let c=e.let("valid"),l=s.items?(0,$_.getSchemaTypes)(s.items):[];t.block$data(c,u,(0,br._)`${o} === false`),t.ok(c);function u(){let m=e.let("i",(0,br._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,br._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return l.length>0&&!l.some(m=>m==="object"||m==="array")}function f(m,h){let y=e.name("item"),S=(0,$_.checkDataTypes)(l,y,a.opts.strictNumbers,$_.DataType.Wrong),v=e.const("indices",(0,br._)`{}`);e.for((0,br._)`;${m}--;`,()=>{e.let(y,(0,br._)`${r}[${m}]`),e.if(S,(0,br._)`continue`),l.length>1&&e.if((0,br._)`typeof ${y} == "string"`,(0,br._)`${y} += "_"`),e.if((0,br._)`typeof ${v}[${y}] == "number"`,()=>{e.assign(h,(0,br._)`${v}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,br._)`${v}[${y}] = ${m}`)})}function p(m,h){let y=(0,N6.useFunc)(e,R6.default),S=e.name("outer");e.label(S).for((0,br._)`;${m}--;`,()=>e.for((0,br._)`${h} = ${m}; ${h}--;`,()=>e.if((0,br._)`${y}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(S)})))}}};F_.default=w6});var aF=R(j_=>{"use strict";Object.defineProperty(j_,"__esModule",{value:!0});var B_=_e(),D6=Ie(),C6=ag(),A6={message:"must be equal to constant",params:({schemaCode:t})=>(0,B_._)`{allowedValue: ${t}}`},I6={keyword:"const",$data:!0,error:A6,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,B_._)`!${(0,D6.useFunc)(e,C6.default)}(${r}, ${i})`):t.fail((0,B_._)`${s} !== ${r}`)}};j_.default=I6});var cF=R(U_=>{"use strict";Object.defineProperty(U_,"__esModule",{value:!0});var Wu=_e(),O6=Ie(),x6=ag(),M6={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Wu._)`{allowedValues: ${t}}`},L6={keyword:"enum",schemaType:"array",$data:!0,error:M6,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:s,it:o}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=o.opts.loopEnum,c,l=()=>c??(c=(0,O6.useFunc)(e,x6.default)),u;if(a||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let p=e.const("vSchema",s);u=(0,Wu.or)(...i.map((m,h)=>f(p,h)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",s,p=>e.if((0,Wu._)`${l()}(${r}, ${p})`,()=>e.assign(u,!0).break()))}function f(p,m){let h=i[m];return typeof h=="object"&&h!==null?(0,Wu._)`${l()}(${r}, ${p}[${m}])`:(0,Wu._)`${r} === ${h}`}}};U_.default=L6});var lF=R(H_=>{"use strict";Object.defineProperty(H_,"__esModule",{value:!0});var q6=X$(),$6=J$(),F6=eF(),B6=tF(),j6=rF(),U6=nF(),H6=iF(),V6=oF(),W6=aF(),z6=cF(),G6=[q6.default,$6.default,F6.default,B6.default,j6.default,U6.default,H6.default,V6.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},W6.default,z6.default];H_.default=G6});var W_=R(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.validateAdditionalItems=void 0;var jo=_e(),V_=Ie(),Y6={message:({params:{len:t}})=>(0,jo.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,jo._)`{limit: ${t}}`},K6={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Y6,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,V_.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}uF(t,n)}};function uF(t,e){let{gen:r,schema:n,data:i,keyword:s,it:o}=t;o.items=!0;let a=r.const("len",(0,jo._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,jo._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,V_.alwaysValidSchema)(o,n)){let l=r.var("valid",(0,jo._)`${a} <= ${e.length}`);r.if((0,jo.not)(l),()=>c(l)),t.ok(l)}function c(l){r.forRange("i",e.length,a,u=>{t.subschema({keyword:s,dataProp:u,dataPropType:V_.Type.Num},l),o.allErrors||r.if((0,jo.not)(l),()=>r.break())})}}zu.validateAdditionalItems=uF;zu.default=K6});var z_=R(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});Gu.validateTuple=void 0;var dF=_e(),cg=Ie(),X6=Hn(),J6={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return fF(t,"additionalItems",e);r.items=!0,!(0,cg.alwaysValidSchema)(r,e)&&t.ok((0,X6.validateArray)(t))}};function fF(t,e,r=t.schema){let{gen:n,parentSchema:i,data:s,keyword:o,it:a}=t;u(i),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=cg.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),l=n.const("len",(0,dF._)`${s}.length`);r.forEach((d,f)=>{(0,cg.alwaysValidSchema)(a,d)||(n.if((0,dF._)`${l} > ${f}`,()=>t.subschema({keyword:o,schemaProp:f,dataProp:f},c)),t.ok(c))});function u(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let y=`"${o}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,cg.checkStrictMode)(a,y,f.strictTuples)}}}Gu.validateTuple=fF;Gu.default=J6});var pF=R(G_=>{"use strict";Object.defineProperty(G_,"__esModule",{value:!0});var Q6=z_(),Z6={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Q6.validateTuple)(t,"items")};G_.default=Z6});var mF=R(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0});var hF=_e(),eJ=Ie(),tJ=Hn(),rJ=W_(),nJ={message:({params:{len:t}})=>(0,hF.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,hF._)`{limit: ${t}}`},iJ={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:nJ,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,eJ.alwaysValidSchema)(n,e)&&(i?(0,rJ.validateAdditionalItems)(t,i):t.ok((0,tJ.validateArray)(t)))}};Y_.default=iJ});var gF=R(K_=>{"use strict";Object.defineProperty(K_,"__esModule",{value:!0});var Wn=_e(),lg=Ie(),sJ={message:({params:{min:t,max:e}})=>e===void 0?(0,Wn.str)`must contain at least ${t} valid item(s)`:(0,Wn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Wn._)`{minContains: ${t}}`:(0,Wn._)`{minContains: ${t}, maxContains: ${e}}`},oJ={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:sJ,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t,o,a,{minContains:c,maxContains:l}=n;s.opts.next?(o=c===void 0?1:c,a=l):o=1;let u=e.const("len",(0,Wn._)`${i}.length`);if(t.setParams({min:o,max:a}),a===void 0&&o===0){(0,lg.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){(0,lg.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,lg.alwaysValidSchema)(s,r)){let h=(0,Wn._)`${u} >= ${o}`;a!==void 0&&(h=(0,Wn._)`${h} && ${u} <= ${a}`),t.pass(h);return}s.items=!0;let d=e.name("valid");a===void 0&&o===1?p(d,()=>e.if(d,()=>e.break())):o===0?(e.let(d,!0),a!==void 0&&e.if((0,Wn._)`${i}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),y=e.let("count",0);p(h,()=>e.if(h,()=>m(y)))}function p(h,y){e.forRange("i",0,u,S=>{t.subschema({keyword:"contains",dataProp:S,dataPropType:lg.Type.Num,compositeRule:!0},h),y()})}function m(h){e.code((0,Wn._)`${h}++`),a===void 0?e.if((0,Wn._)`${h} >= ${o}`,()=>e.assign(d,!0).break()):(e.if((0,Wn._)`${h} > ${a}`,()=>e.assign(d,!1).break()),o===1?e.assign(d,!0):e.if((0,Wn._)`${h} >= ${o}`,()=>e.assign(d,!0)))}}};K_.default=oJ});var ug=R(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.validateSchemaDeps=Fi.validatePropertyDeps=Fi.error=void 0;var X_=_e(),aJ=Ie(),Yu=Hn();Fi.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,X_.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,X_._)`{property: ${t},
179
+ || ${o} === "boolean" || ${i} === null`).assign(a,(0,ke._)`[${i}]`)}}}function SX({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,ke._)`${e} !== undefined`,()=>t.assign((0,ke._)`${e}[${r}]`,n))}function YS(t,e,r,n=lc.Correct){let i=n===lc.Correct?ke.operators.EQ:ke.operators.NEQ,s;switch(t){case"null":return(0,ke._)`${e} ${i} null`;case"array":s=(0,ke._)`Array.isArray(${e})`;break;case"object":s=(0,ke._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=o((0,ke._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=o();break;default:return(0,ke._)`typeof ${e} ${i} ${t}`}return n===lc.Correct?s:(0,ke.not)(s);function o(a=ke.nil){return(0,ke.and)((0,ke._)`typeof ${e} == "number"`,a,r?(0,ke._)`isFinite(${e})`:ke.nil)}}Or.checkDataType=YS;function KS(t,e,r,n){if(t.length===1)return YS(t[0],e,r,n);let i,s=(0,Dq.toHash)(t);if(s.array&&s.object){let o=(0,ke._)`typeof ${e} != "object"`;i=s.null?o:(0,ke._)`!${e} || ${o}`,delete s.null,delete s.array,delete s.object}else i=ke.nil;s.number&&delete s.integer;for(let o in s)i=(0,ke.and)(i,YS(o,e,r,n));return i}Or.checkDataTypes=KS;var _X={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,ke._)`{type: ${t}}`:(0,ke._)`{type: ${e}}`};function XS(t){let e=PX(t);(0,gX.reportError)(e,_X)}Or.reportTypeError=XS;function PX(t){let{gen:e,data:r,schema:n}=t,i=(0,Dq.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var Oq=R(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.assignDefaults=void 0;var uc=_e(),kX=Ie();function NX(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)Iq(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,s)=>Iq(t,s,i.default))}Vm.assignDefaults=NX;function Iq(t,e,r){let{gen:n,compositeRule:i,data:s,opts:o}=t;if(r===void 0)return;let a=(0,uc._)`${s}${(0,uc.getProperty)(e)}`;if(i){(0,kX.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,uc._)`${a} === undefined`;o.useDefaults==="empty"&&(c=(0,uc._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,uc._)`${a} = ${(0,uc.stringify)(r)}`)}});var Hn=R(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.validateUnion=ct.validateArray=ct.usePattern=ct.callValidateCode=ct.schemaProperties=ct.allSchemaProperties=ct.noPropertyInData=ct.propertyInData=ct.isOwnProperty=ct.hasPropFunc=ct.reportMissingProp=ct.checkMissingProp=ct.checkReportMissingProp=void 0;var Pt=_e(),JS=Ie(),Ws=Un(),RX=Ie();function EX(t,e){let{gen:r,data:n,it:i}=t;r.if(ZS(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Pt._)`${e}`},!0),t.error()})}ct.checkReportMissingProp=EX;function wX({gen:t,data:e,it:{opts:r}},n,i){return(0,Pt.or)(...n.map(s=>(0,Pt.and)(ZS(t,e,s,r.ownProperties),(0,Pt._)`${i} = ${s}`)))}ct.checkMissingProp=wX;function DX(t,e){t.setParams({missingProperty:e},!0),t.error()}ct.reportMissingProp=DX;function xq(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Pt._)`Object.prototype.hasOwnProperty`})}ct.hasPropFunc=xq;function QS(t,e,r){return(0,Pt._)`${xq(t)}.call(${e}, ${r})`}ct.isOwnProperty=QS;function CX(t,e,r,n){let i=(0,Pt._)`${e}${(0,Pt.getProperty)(r)} !== undefined`;return n?(0,Pt._)`${i} && ${QS(t,e,r)}`:i}ct.propertyInData=CX;function ZS(t,e,r,n){let i=(0,Pt._)`${e}${(0,Pt.getProperty)(r)} === undefined`;return n?(0,Pt.or)(i,(0,Pt.not)(QS(t,e,r))):i}ct.noPropertyInData=ZS;function Mq(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}ct.allSchemaProperties=Mq;function AX(t,e){return Mq(e).filter(r=>!(0,JS.alwaysValidSchema)(t,e[r]))}ct.schemaProperties=AX;function IX({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:s},it:o},a,c,l){let u=l?(0,Pt._)`${t}, ${e}, ${n}${i}`:e,d=[[Ws.default.instancePath,(0,Pt.strConcat)(Ws.default.instancePath,s)],[Ws.default.parentData,o.parentData],[Ws.default.parentDataProperty,o.parentDataProperty],[Ws.default.rootData,Ws.default.rootData]];o.opts.dynamicRef&&d.push([Ws.default.dynamicAnchors,Ws.default.dynamicAnchors]);let f=(0,Pt._)`${u}, ${r.object(...d)}`;return c!==Pt.nil?(0,Pt._)`${a}.call(${c}, ${f})`:(0,Pt._)`${a}(${f})`}ct.callValidateCode=IX;var OX=(0,Pt._)`new RegExp`;function xX({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,s=i(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,Pt._)`${i.code==="new RegExp"?OX:(0,RX.useFunc)(t,i)}(${r}, ${n})`})}ct.usePattern=xX;function MX(t){let{gen:e,data:r,keyword:n,it:i}=t,s=e.name("valid");if(i.allErrors){let a=e.let("valid",!0);return o(()=>e.assign(a,!1)),a}return e.var(s,!0),o(()=>e.break()),s;function o(a){let c=e.const("len",(0,Pt._)`${r}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:n,dataProp:l,dataPropType:JS.Type.Num},s),e.if((0,Pt.not)(s),a)})}}ct.validateArray=MX;function LX(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,JS.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,l)=>{let u=t.subschema({keyword:n,schemaProp:l,compositeRule:!0},a);e.assign(o,(0,Pt._)`${o} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,Pt.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}ct.validateUnion=LX});var $q=R(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.validateKeywordUsage=qi.validSchemaType=qi.funcKeywordCode=qi.macroKeywordCode=void 0;var Vr=_e(),Mo=Un(),qX=Hn(),$X=Eu();function FX(t,e){let{gen:r,keyword:n,schema:i,parentSchema:s,it:o}=t,a=e.macro.call(o.self,i,s,o),c=qq(r,n,a);o.opts.validateSchema!==!1&&o.self.validateSchema(a,!0);let l=r.name("valid");t.subschema({schema:a,schemaPath:Vr.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}qi.macroKeywordCode=FX;function BX(t,e){var r;let{gen:n,keyword:i,schema:s,parentSchema:o,$data:a,it:c}=t;UX(c,e);let l=!a&&e.compile?e.compile.call(c.self,s,o,c):e.validate,u=qq(n,i,l),d=n.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)h(),e.modifying&&Lq(t),y(()=>t.error());else{let S=e.async?p():m();e.modifying&&Lq(t),y(()=>jX(t,S))}}function p(){let S=n.let("ruleErrs",null);return n.try(()=>h((0,Vr._)`await `),v=>n.assign(d,!1).if((0,Vr._)`${v} instanceof ${c.ValidationError}`,()=>n.assign(S,(0,Vr._)`${v}.errors`),()=>n.throw(v))),S}function m(){let S=(0,Vr._)`${u}.errors`;return n.assign(S,null),h(Vr.nil),S}function h(S=e.async?(0,Vr._)`await `:Vr.nil){let v=c.opts.passContext?Mo.default.this:Mo.default.self,b=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Vr._)`${S}${(0,qX.callValidateCode)(t,u,v,b)}`,e.modifying)}function y(S){var v;n.if((0,Vr.not)((v=e.valid)!==null&&v!==void 0?v:d),S)}}qi.funcKeywordCode=BX;function Lq(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Vr._)`${n.parentData}[${n.parentDataProperty}]`))}function jX(t,e){let{gen:r}=t;r.if((0,Vr._)`Array.isArray(${e})`,()=>{r.assign(Mo.default.vErrors,(0,Vr._)`${Mo.default.vErrors} === null ? ${e} : ${Mo.default.vErrors}.concat(${e})`).assign(Mo.default.errors,(0,Vr._)`${Mo.default.vErrors}.length`),(0,$X.extendErrors)(t)},()=>t.error())}function UX({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function qq(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Vr.stringify)(r)})}function HX(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}qi.validSchemaType=HX;function VX({schema:t,opts:e,self:r,errSchemaPath:n},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}qi.validateKeywordUsage=VX});var Bq=R(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.extendSubschemaMode=zs.extendSubschemaData=zs.getSubschema=void 0;var $i=_e(),Fq=Ie();function WX(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:s,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,$i._)`${t.schemaPath}${(0,$i.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,$i._)`${t.schemaPath}${(0,$i.getProperty)(e)}${(0,$i.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Fq.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||s===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}zs.getSubschema=WX;function zX(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:s,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=e,f=a.let("data",(0,$i._)`${e.data}${(0,$i.getProperty)(r)}`,!0);c(f),t.errorPath=(0,$i.str)`${l}${(0,Fq.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,$i._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let l=i instanceof $i.Name?i:a.let("data",i,!0);c(l),o!==void 0&&(t.propertyName=o)}s&&(t.dataTypes=s);function c(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l]}}zs.extendSubschemaData=zX;function GX(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:s}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}zs.extendSubschemaMode=GX});var e_=R((JDe,jq)=>{"use strict";jq.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;i--!==0;){var o=s[i];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}});var Hq=R((QDe,Uq)=>{"use strict";var Gs=Uq.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};Wm(e,n,i,t,"",t)};Gs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Gs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Gs.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Gs.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Wm(t,e,r,n,i,s,o,a,c,l){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,s,o,a,c,l);for(var u in n){var d=n[u];if(Array.isArray(d)){if(u in Gs.arrayKeywords)for(var f=0;f<d.length;f++)Wm(t,e,r,d[f],i+"/"+u+"/"+f,s,i,u,n,f)}else if(u in Gs.propsKeywords){if(d&&typeof d=="object")for(var p in d)Wm(t,e,r,d[p],i+"/"+u+"/"+YX(p),s,i,u,n,p)}else(u in Gs.keywords||t.allKeys&&!(u in Gs.skipKeywords))&&Wm(t,e,r,d,i+"/"+u,s,i,u,n)}r(n,i,s,o,a,c,l)}}function YX(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Du=R(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.getSchemaRefs=un.resolveUrl=un.normalizeId=un._getFullPath=un.getFullPath=un.inlineRef=void 0;var KX=Ie(),XX=e_(),JX=Hq(),QX=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function ZX(t,e=!0){return typeof t=="boolean"?!0:e===!0?!t_(t):e?Vq(t)<=e:!1}un.inlineRef=ZX;var e4=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function t_(t){for(let e in t){if(e4.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(t_)||typeof r=="object"&&t_(r))return!0}return!1}function Vq(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!QX.has(r)&&(typeof t[r]=="object"&&(0,KX.eachItem)(t[r],n=>e+=Vq(n)),e===1/0))return 1/0}return e}function Wq(t,e="",r){r!==!1&&(e=dc(e));let n=t.parse(e);return zq(t,n)}un.getFullPath=Wq;function zq(t,e){return t.serialize(e).split("#")[0]+"#"}un._getFullPath=zq;var t4=/#\/?$/;function dc(t){return t?t.replace(t4,""):""}un.normalizeId=dc;function r4(t,e,r){return r=dc(r),t.resolve(e,r)}un.resolveUrl=r4;var n4=/^[a-z_][-a-z0-9._]*$/i;function i4(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=dc(t[r]||e),s={"":i},o=Wq(n,i,!1),a={},c=new Set;return JX(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=o+f,y=s[m];typeof d[r]=="string"&&(y=S.call(this,d[r])),v.call(this,d.$anchor),v.call(this,d.$dynamicAnchor),s[f]=y;function S(b){let P=this.opts.uriResolver.resolve;if(b=dc(y?P(y,b):b),c.has(b))throw u(b);c.add(b);let N=this.refs[b];return typeof N=="string"&&(N=this.refs[N]),typeof N=="object"?l(d,N.schema,b):b!==dc(h)&&(b[0]==="#"?(l(d,a[b],b),a[b]=d):this.refs[b]=h),b}function v(b){if(typeof b=="string"){if(!n4.test(b))throw new Error(`invalid anchor "${b}"`);S.call(this,`#${b}`)}}}),a;function l(d,f,p){if(f!==void 0&&!XX(d,f))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}un.getSchemaRefs=i4});var Iu=R(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.getData=Ys.KeywordCxt=Ys.validateFunctionCode=void 0;var Jq=Rq(),Gq=wu(),n_=GS(),zm=wu(),s4=Oq(),Au=$q(),r_=Bq(),oe=_e(),Te=Un(),o4=Du(),as=Ie(),Cu=Eu();function a4(t){if(e$(t)&&(t$(t),Zq(t))){u4(t);return}Qq(t,()=>(0,Jq.topBoolOrEmptySchema)(t))}Ys.validateFunctionCode=a4;function Qq({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},s){i.code.es5?t.func(e,(0,oe._)`${Te.default.data}, ${Te.default.valCxt}`,n.$async,()=>{t.code((0,oe._)`"use strict"; ${Yq(r,i)}`),l4(t,i),t.code(s)}):t.func(e,(0,oe._)`${Te.default.data}, ${c4(i)}`,n.$async,()=>t.code(Yq(r,i)).code(s))}function c4(t){return(0,oe._)`{${Te.default.instancePath}="", ${Te.default.parentData}, ${Te.default.parentDataProperty}, ${Te.default.rootData}=${Te.default.data}${t.dynamicRef?(0,oe._)`, ${Te.default.dynamicAnchors}={}`:oe.nil}}={}`}function l4(t,e){t.if(Te.default.valCxt,()=>{t.var(Te.default.instancePath,(0,oe._)`${Te.default.valCxt}.${Te.default.instancePath}`),t.var(Te.default.parentData,(0,oe._)`${Te.default.valCxt}.${Te.default.parentData}`),t.var(Te.default.parentDataProperty,(0,oe._)`${Te.default.valCxt}.${Te.default.parentDataProperty}`),t.var(Te.default.rootData,(0,oe._)`${Te.default.valCxt}.${Te.default.rootData}`),e.dynamicRef&&t.var(Te.default.dynamicAnchors,(0,oe._)`${Te.default.valCxt}.${Te.default.dynamicAnchors}`)},()=>{t.var(Te.default.instancePath,(0,oe._)`""`),t.var(Te.default.parentData,(0,oe._)`undefined`),t.var(Te.default.parentDataProperty,(0,oe._)`undefined`),t.var(Te.default.rootData,Te.default.data),e.dynamicRef&&t.var(Te.default.dynamicAnchors,(0,oe._)`{}`)})}function u4(t){let{schema:e,opts:r,gen:n}=t;Qq(t,()=>{r.$comment&&e.$comment&&n$(t),m4(t),n.let(Te.default.vErrors,null),n.let(Te.default.errors,0),r.unevaluated&&d4(t),r$(t),T4(t)})}function d4(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,oe._)`${r}.evaluated`),e.if((0,oe._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,oe._)`${t.evaluated}.props`,(0,oe._)`undefined`)),e.if((0,oe._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,oe._)`${t.evaluated}.items`,(0,oe._)`undefined`))}function Yq(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,oe._)`/*# sourceURL=${r} */`:oe.nil}function f4(t,e){if(e$(t)&&(t$(t),Zq(t))){p4(t,e);return}(0,Jq.boolOrEmptySchema)(t,e)}function Zq({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function e$(t){return typeof t.schema!="boolean"}function p4(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&n$(t),g4(t),y4(t);let s=n.const("_errs",Te.default.errors);r$(t,s),n.var(e,(0,oe._)`${s} === ${Te.default.errors}`)}function t$(t){(0,as.checkUnknownRules)(t),h4(t)}function r$(t,e){if(t.opts.jtd)return Kq(t,[],!1,e);let r=(0,Gq.getSchemaTypes)(t.schema),n=(0,Gq.coerceAndCheckDataType)(t,r);Kq(t,r,!n,e)}function h4(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,as.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function m4(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,as.checkStrictMode)(t,"default is ignored in the schema root")}function g4(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,o4.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function y4(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function n$({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let s=r.$comment;if(i.$comment===!0)t.code((0,oe._)`${Te.default.self}.logger.log(${s})`);else if(typeof i.$comment=="function"){let o=(0,oe.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,oe._)`${Te.default.self}.opts.$comment(${s}, ${o}, ${a}.schema)`)}}function T4(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:s}=t;r.$async?e.if((0,oe._)`${Te.default.errors} === 0`,()=>e.return(Te.default.data),()=>e.throw((0,oe._)`new ${i}(${Te.default.vErrors})`)):(e.assign((0,oe._)`${n}.errors`,Te.default.vErrors),s.unevaluated&&v4(t),e.return((0,oe._)`${Te.default.errors} === 0`))}function v4({gen:t,evaluated:e,props:r,items:n}){r instanceof oe.Name&&t.assign((0,oe._)`${e}.props`,r),n instanceof oe.Name&&t.assign((0,oe._)`${e}.items`,n)}function Kq(t,e,r,n){let{gen:i,schema:s,data:o,allErrors:a,opts:c,self:l}=t,{RULES:u}=l;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,as.schemaHasRulesButRef)(s,u))){i.block(()=>s$(t,"$ref",u.all.$ref.definition));return}c.jtd||b4(t,e),i.block(()=>{for(let f of u.rules)d(f);d(u.post)});function d(f){(0,n_.shouldUseGroup)(s,f)&&(f.type?(i.if((0,zm.checkDataType)(f.type,o,c.strictNumbers)),Xq(t,f),e.length===1&&e[0]===f.type&&r&&(i.else(),(0,zm.reportTypeError)(t)),i.endIf()):Xq(t,f),a||i.if((0,oe._)`${Te.default.errors} === ${n||0}`))}}function Xq(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,s4.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,n_.shouldUseRule)(n,s)&&s$(t,s.keyword,s.definition,e.type)})}function b4(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(S4(t,e),t.opts.allowUnionTypes||_4(t,e),P4(t,t.dataTypes))}function S4(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{i$(t.dataTypes,r)||i_(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),N4(t,e)}}function _4(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&i_(t,"use allowUnionTypes to allow union type keyword")}function P4(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,n_.shouldUseRule)(t.schema,i)){let{type:s}=i.definition;s.length&&!s.some(o=>k4(e,o))&&i_(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function k4(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function i$(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function N4(t,e){let r=[];for(let n of t.dataTypes)i$(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function i_(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,as.checkStrictMode)(t,e,t.opts.strictTypes)}var Gm=class{constructor(e,r,n){if((0,Au.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,as.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",o$(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Au.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",Te.default.errors))}result(e,r,n){this.failResult((0,oe.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,oe.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,oe._)`${r} !== undefined && (${(0,oe.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Cu.reportExtraError:Cu.reportError)(this,this.def.error,r)}$dataError(){(0,Cu.reportError)(this,this.def.$dataError||Cu.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Cu.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=oe.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=oe.nil,r=oe.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:s,def:o}=this;n.if((0,oe.or)((0,oe._)`${i} === undefined`,r)),e!==oe.nil&&n.assign(e,!0),(s.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==oe.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:s}=this;return(0,oe.or)(o(),a());function o(){if(n.length){if(!(r instanceof oe.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,oe._)`${(0,zm.checkDataTypes)(c,r,s.opts.strictNumbers,zm.DataType.Wrong)}`}return oe.nil}function a(){if(i.validateSchema){let c=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,oe._)`!${c}(${r})`}return oe.nil}}subschema(e,r){let n=(0,r_.getSubschema)(this.it,e);(0,r_.extendSubschemaData)(n,this.it,e),(0,r_.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return f4(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=as.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=as.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,oe.Name)),!0}};Ys.KeywordCxt=Gm;function s$(t,e,r,n){let i=new Gm(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,Au.funcKeywordCode)(i,r):"macro"in r?(0,Au.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,Au.funcKeywordCode)(i,r)}var R4=/^\/(?:[^~]|~0|~1)*$/,E4=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function o$(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,s;if(t==="")return Te.default.rootData;if(t[0]==="/"){if(!R4.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,s=Te.default.rootData}else{let l=E4.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+l[1];if(i=l[2],i==="#"){if(u>=e)throw new Error(c("property/index",u));return n[e-u]}if(u>e)throw new Error(c("data",u));if(s=r[e-u],!i)return s}let o=s,a=i.split("/");for(let l of a)l&&(s=(0,oe._)`${s}${(0,oe.getProperty)((0,as.unescapeJsonPointer)(l))}`,o=(0,oe._)`${o} && ${s}`);return o;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${e}`}}Ys.getData=o$});var Ym=R(o_=>{"use strict";Object.defineProperty(o_,"__esModule",{value:!0});var s_=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};o_.default=s_});var Ou=R(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var a_=Du(),c_=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,a_.resolveUrl)(e,r,n),this.missingSchema=(0,a_.normalizeId)((0,a_.getFullPath)(e,this.missingRef))}};l_.default=c_});var xu=R(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.resolveSchema=Vn.getCompilingSchema=Vn.resolveRef=Vn.compileSchema=Vn.SchemaEnv=void 0;var mi=_e(),w4=Ym(),Lo=Un(),gi=Du(),a$=Ie(),D4=Iu(),fc=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,gi.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Vn.SchemaEnv=fc;function d_(t){let e=c$.call(this,t);if(e)return e;let r=(0,gi.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new mi.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),a;t.$async&&(a=o.scopeValue("Error",{ref:w4.default,code:(0,mi._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");t.validateName=c;let l={gen:o,allErrors:this.opts.allErrors,data:Lo.default.data,parentData:Lo.default.parentData,parentDataProperty:Lo.default.parentDataProperty,dataNames:[Lo.default.data],dataPathArr:[mi.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,mi.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:mi.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,mi._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,D4.validateFunctionCode)(l),o.optimize(this.opts.code.optimize);let d=o.toString();u=`${o.scopeRefs(Lo.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${Lo.default.self}`,`${Lo.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:o._values}),this.opts.unevaluated){let{props:m,items:h}=l;p.evaluated={props:m instanceof mi.Name?void 0:m,items:h instanceof mi.Name?void 0:h,dynamicProps:m instanceof mi.Name,dynamicItems:h instanceof mi.Name},p.source&&(p.source.evaluated=(0,mi.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}Vn.compileSchema=d_;function C4(t,e,r){var n;r=(0,gi.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let s=O4.call(this,t,r);if(s===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;o&&(s=new fc({schema:o,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=A4.call(this,s)}Vn.resolveRef=C4;function A4(t){return(0,gi.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:d_.call(this,t)}function c$(t){for(let e of this._compilations)if(I4(e,t))return e}Vn.getCompilingSchema=c$;function I4(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function O4(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Km.call(this,t,e)}function Km(t,e){let r=this.opts.uriResolver.parse(e),n=(0,gi._getFullPath)(this.opts.uriResolver,r),i=(0,gi.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return u_.call(this,r,t);let s=(0,gi.normalizeId)(n),o=this.refs[s]||this.schemas[s];if(typeof o=="string"){let a=Km.call(this,t,o);return typeof a?.schema!="object"?void 0:u_.call(this,r,a)}if(typeof o?.schema=="object"){if(o.validate||d_.call(this,o),s===(0,gi.normalizeId)(e)){let{schema:a}=o,{schemaId:c}=this.opts,l=a[c];return l&&(i=(0,gi.resolveUrl)(this.opts.uriResolver,i,l)),new fc({schema:a,schemaId:c,root:t,baseId:i})}return u_.call(this,r,o)}}Vn.resolveSchema=Km;var x4=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function u_(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,a$.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!x4.has(a)&&l&&(e=(0,gi.resolveUrl)(this.opts.uriResolver,e,l))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,a$.schemaHasRulesButRef)(r,this.RULES)){let a=(0,gi.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=Km.call(this,n,a)}let{schemaId:o}=this.opts;if(s=s||new fc({schema:r,schemaId:o,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var l$=R((iCe,M4)=>{M4.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var y_=R((sCe,g$)=>{"use strict";var L4=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),p_=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),q4=RegExp.prototype.test.bind(/^\d*$/u),qo=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),h_=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),d$=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),m_=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),$4=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),dn=new Array(256);{let t="0123456789ABCDEF";for(let e=0;e<256;e++)dn[e]="%"+t[e>>4]+t[e&15]}function xr(t){return t<2048?dn[192|t>>6]+dn[128|t&63]:t<65536?dn[224|t>>12]+dn[128|t>>6&63]+dn[128|t&63]:dn[240|t>>18]+dn[128|t>>12&63]+dn[128|t>>6&63]+dn[128|t&63]}function F4(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var B4=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),j4=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),U4=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),H4=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function V4(t){if(t.length===0)return!1;for(let e=0;e<t.length;e++)if(!U4(t[e])){if(t[e]==="%"&&e+2<t.length&&qo(t.slice(e+1,e+3))){e+=2;continue}return!1}return!0}function u$(t){let e=-1,r=0,n=-1,i=0;for(let a=0;a<t.length;a++)t[a]==="0"?(n===-1&&(n=a),i++,i>r&&(r=i,e=n)):(n=-1,i=0);if(r<2)return t.join(":");let s=t.slice(0,e).join(":"),o=t.slice(e+r).join(":");return s+"::"+o}function W4(t){let e=t.indexOf("::");if(e!==-1&&t.indexOf("::",e+1)!==-1)return;let r=e===-1?t.split(":"):t.slice(0,e).split(":"),n=e===-1?[]:t.slice(e+2).split(":");e!==-1&&(r.length===1&&r[0]===""&&(r.length=0),n.length===1&&n[0]===""&&(n.length=0));let i=r.concat(n),s=0;for(let a=0;a<i.length;a++){let c=i[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==i.length-1||e!==-1&&n.length===0||!p_(c))return;s+=2;continue}if(!B4(c))return;i[a]=parseInt(c,16).toString(16),s++}if(e===-1)return s!==8?void 0:u$(i);if(s>=8)return;let o=i.slice(0,r.length);for(let a=s;a<8;a++)o.push("0");for(let a=r.length;a<i.length;a++)o.push(i[a]);return u$(o)}function f_(t){let e=t[0]==="["&&t[t.length-1]==="]";if((t[0]==="["||t[t.length-1]==="]")&&!e)return{host:t,isIPV6:!1,error:!0};let n=e?t.slice(1,-1):t;if(e&&j4(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(z4(n,":")<2)return{host:t,isIPV6:!1,error:e};let i="",s=n.indexOf("%");if(s!==-1){let a=n.slice(s,s+3).toLowerCase()==="%25"?3:1;if(i=n.slice(s+a),!V4(i))return{host:t,isIPV6:!1,error:!0};n=n.slice(0,s)}let o=W4(n);return o===void 0?{host:t,isIPV6:!1,error:!0}:{host:o+(i?"%"+i:""),escapedHost:o+(i?"%25"+i:""),isIPV6:!0}}function z4(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function G4(t){let e=t,r=[],n=-1,i=0;for(;i=e.length;){if(i===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(i===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(i===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}var Y4={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},K4=/[@/?#:]/g,X4=/[@/?#]/g;function f$(t,e){let r=e?X4:K4;return r.lastIndex=0,t.replace(r,n=>Y4[n])}function p$(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let i=t.slice(n+1,n+3);if(qo(i)){let s=i.toUpperCase(),o=String.fromCharCode(parseInt(s,16));e&&h_(o)?r+=o:r+="%"+s,n+=2;continue}}r+=t[n]}return r}function J4(t){let e="";for(let r=0;r<t.length;r++){let n=t[r];if(n==="%"&&r+2<t.length){let i=t.slice(r+1,r+3);if(qo(i)){let s=i.toUpperCase(),o=String.fromCharCode(parseInt(s,16));o!=="."&&h_(o)?e+=o:e+="%"+s,r+=2;continue}}if(d$(n))e+=n;else{let i=t.charCodeAt(r);if(i<128)e+=m$(i)?n:dn[i];else if(i<55296||i>57343)e+=xr(i);else if(i<=56319&&r+1<t.length){let s=t.charCodeAt(r+1);s>=56320&&s<=57343?(e+=xr(65536+(i-55296<<10)+(s-56320)),r++):e+=xr(65533)}else e+=xr(65533)}}return e}function Q4(t,e=!1){let r="",n=e&&t[0]!=="/";for(let i=0;i<t.length;i++){let s=t[i];if(s==="%"&&i+2<t.length){let o=t.slice(i+1,i+3);if(qo(o)){r+="%"+o.toUpperCase(),i+=2;continue}}if(s==="/"&&(n=!1),d$(s)&&(s!==":"||!n))r+=s;else{let o=t.charCodeAt(i);if(o<128)r+=dn[o];else if(o<55296||o>57343)r+=xr(o);else if(o<=56319&&i+1<t.length){let a=t.charCodeAt(i+1);a>=56320&&a<=57343?(r+=xr(65536+(o-55296<<10)+(a-56320)),i++):r+=xr(65533)}else r+=xr(65533)}}return r}function g_(t,e){let r="";for(let n=0;n<t.length;n++){let i=t[n];if(i==="%"&&n+2<t.length){let s=t.slice(n+1,n+3);if(qo(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(e(i))r+=i;else{let s=t.charCodeAt(n);if(s<128)r+=dn[s];else if(s<55296||s>57343)r+=xr(s);else if(s<=56319&&n+1<t.length){let o=t.charCodeAt(n+1);o>=56320&&o<=57343?(r+=xr(65536+(s-55296<<10)+(o-56320)),n++):r+=xr(65533)}else r+=xr(65533)}}return r}function h$(t){return g_(t,$4)}function Z4(t){return g_(t,m_)}function e9(t){return g_(t,m_)}function m$(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===42||t===43||t===45||t===46||t===47||t===64||t===95}function t9(t){let e="";for(let r=0;r<t.length;r++){let n=t[r];if(n==="%"&&r+2<t.length){let i=t.slice(r+1,r+3);if(qo(i)){let s=i.toUpperCase(),o=String.fromCharCode(parseInt(s,16));h_(o)?e+=o:e+="%"+s,r+=2;continue}}if(m_(n))e+=n;else{let i=t.charCodeAt(r);if(i<128)e+=m$(i)?n:dn[i];else if(i<55296||i>57343)e+=xr(i);else if(i<=56319&&r+1<t.length){let s=t.charCodeAt(r+1);s>=56320&&s<=57343?(e+=xr(65536+(i-55296<<10)+(s-56320)),r++):e+=xr(65533)}else e+=xr(65533)}}return e}function r9(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(qo(n)){e+="%"+n.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function n9(t){let e=[];if(t.userinfo!==void 0&&(e.push(h$(t.userinfo)),e.push("@")),t.host!==void 0){let r=t.host;if(!p_(r)){let n=f_(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=p$(r,!0),n=f_(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=f$(r,!1)}e.push(r)}if(typeof t.port=="number"||typeof t.port=="string"){let r=String(t.port);if(!q4(r))throw new TypeError("URI port is malformed.");e.push(":"),e.push(r)}return e.length?e.join(""):void 0}g$.exports={nonSimpleDomain:H4,recomposeAuthority:n9,reescapeHostDelimiters:f$,normalizePercentEncoding:p$,normalizePathEncoding:J4,serializePathEncoding:Q4,normalizeQueryFragmentEncoding:t9,encodeUserinfo:h$,encodeQuery:Z4,encodeFragment:e9,escapePreservingEscapes:r9,removeDotSegments:G4,isIPv4:p_,isUUID:L4,normalizeIPv6:f_,stringArrayToHexStripped:F4}});var S$=R((oCe,b$)=>{"use strict";var{isUUID:i9}=y_(),s9=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,o9=["http","https","ws","wss","urn","urn:uuid"];function a9(t){return o9.indexOf(t)!==-1}function T_(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function y$(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function T$(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function c9(t){return t.secure=T_(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function l9(t){if((t.port===(T_(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let e=t.resourceName.indexOf("?"),r=e===-1?t.resourceName:t.resourceName.slice(0,e);t.path=r&&r!=="/"?r:void 0,t.query=e===-1?void 0:t.resourceName.slice(e+1),t.resourceName=void 0}return t.fragment=void 0,t}function u9(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(s9);if(r&&r[0]===t.path){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,s=v_(i);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function d9(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,s=v_(i);s&&(t=s.serialize(t,e));let o=t,a=t.nss;return o.path=`${n||e.nid}:${a}`,e.skipEscape=!0,o}function f9(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!i9(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function p9(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var v$={scheme:"http",domainHost:!0,parse:y$,serialize:T$},h9={scheme:"https",domainHost:v$.domainHost,parse:y$,serialize:T$},Xm={scheme:"ws",domainHost:!0,parse:c9,serialize:l9},m9={scheme:"wss",domainHost:Xm.domainHost,parse:Xm.parse,serialize:Xm.serialize},g9={scheme:"urn",parse:u9,serialize:d9,skipNormalize:!0},y9={scheme:"urn:uuid",parse:f9,serialize:p9,skipNormalize:!0},Jm={http:v$,https:h9,ws:Xm,wss:m9,urn:g9,"urn:uuid":y9};Object.setPrototypeOf(Jm,null);function v_(t){return t&&(Jm[t]||Jm[t.toLowerCase()])||void 0}b$.exports={wsIsSecure:T_,SCHEMES:Jm,isValidSchemeName:a9,getSchemeHandler:v_}});var x$=R((aCe,eg)=>{"use strict";var{normalizeIPv6:R$,removeDotSegments:Lu,recomposeAuthority:T9,normalizePercentEncoding:b_,normalizePathEncoding:v9,serializePathEncoding:_$,normalizeQueryFragmentEncoding:P$,encodeQuery:b9,encodeFragment:S9,reescapeHostDelimiters:_9,isIPv4:E$,nonSimpleDomain:P9}=y_(),{SCHEMES:w$,getSchemeHandler:S_}=S$(),D$=/^[A-Za-z][A-Za-z0-9+.-]*$/u,C$="URI scheme is malformed.";function k$(t){let e=unescape(String(t));if(!D$.test(e))throw new TypeError(C$);return e}function k9(t,e){return typeof t=="string"?t=I9(t,e):typeof t=="object"&&(t=Zm($o(t,e),e)),t}function N9(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:i,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:l}=Qm(t,n),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:f,malformedSchemeSpecific:p,malformedHost:m,malformedScheme:h}=Qm(e,n);if(s||d||o||f||a||p||c||m||l||h)throw new Error(i.error||u.error||"URI is malformed.");let y=A$(i,u,n,!0),S=S_(r&&r.scheme||y.scheme),v=y.host,b=v!==void 0&&v!==""&&(E$(v)||R$(v).isIPV6);I$(y,r||{},S,b);let P=v&&v.indexOf("%")!==-1&&!/\P{ASCII}/u.test(v);if(y.error&&!P)throw new Error(y.error);return n.skipEscape=!0,$o(y,n)}function A$(t,e,r,n){let i={};return n||(t=Zm($o(t,r),r),e=Zm($o(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Lu(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Lu(e.path||""),i.query=e.query):(e.path?(e.path[0]==="/"?i.path=Lu(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=Lu(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function R9(t,e,r){let n=N$(t,r),i=N$(e,r);return n!==void 0&&i!==void 0&&n===i}function $o(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[];r.scheme&&(r.scheme=k$(r.scheme));let s=S_(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n);let o=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!n.skipEscape&&r.scheme===void 0&&!o;r.path!==void 0&&(n.skipEscape?r.path=b_(r.path):r.path=_$(r.path,a)),n.reference!=="suffix"&&r.scheme&&(r.scheme=k$(r.scheme),i.push(r.scheme,":"));let c=T9(r);if(c!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(c),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let l=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(l=Lu(l)),a&&(l=_$(l,!0)),c===void 0&&l[0]==="/"&&l[1]==="/"&&(l="/%2F"+l.slice(2)),i.push(l)}return r.query!==void 0&&i.push("?",b9(r.query)),r.fragment!==void 0&&i.push("#",S9(r.fragment)),i.join("")}var E9=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,w9=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,D9=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function C9(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function Mu(t){if(t===void 0)return!1;let e=t.indexOf("%");for(;e!==-1;){if(e+2>=t.length||!/^[\da-f]{2}$/iu.test(t.slice(e+1,e+3)))return!0;e=t.indexOf("%",e+3)}return!1}function __(t){return t[0]==="["&&t[t.length-1]==="]"}function A9(t){let e=t[4];return Mu(t[3])||e!==void 0&&!__(e)&&Mu(e)||Mu(t[6])||Mu(t[7])||Mu(t[8])}function I$(t,e,r,n){if(!e.unicodeSupport&&(!r||!r.unicodeSupport)&&t.host&&!__(t.host)&&(e.domainHost||r&&r.domainHost)&&n===!1&&P9(t.host))try{t.host=new URL("http://"+t.host).hostname}catch(i){return t.error=t.error||"Host's domain name can not be converted to ASCII: "+i,!0}return!1}function Qm(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1,s=!1,o=!1,a=!1,c=!1,l=!1,u=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let d=t.match(w9);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",i=!0);let f=t.match(D9);if(f!==null){let m=f[1],h=m.replace(/[\t\n\r]/g,"");h.length>=2&&(h.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",i=!0):m.length!==h.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",i=!0))}let p=t.match(E9);if(p){if(n.scheme=p[1],n.userinfo=p[3],n.host=p[4],n.port=parseInt(p[5],10),n.path=p[6]||"",n.query=p[7],n.fragment=p[8],n.scheme!==void 0){let y=unescape(n.scheme);D$.test(y)?n.scheme=y.toLowerCase():(n.error=n.error||C$,l=!0)}s=A9(p),s&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=p[5]);let m=C9(n,p);if(m!==void 0&&(n.error=n.error||m,i=!0),n.host)if(E$(n.host)===!1){let S=__(n.host),v=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,b=R$(n.host);u=b.isIPV6||b.isIPVFuture===!0,c=v&&(!S||b.error===!0),n.host=u?b.host:b.host.toLowerCase(),c&&(n.error=n.error||"URI host is malformed.",i=!0)}else u=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let h=S_(r.scheme||n.scheme);if(c||(a=I$(n,r,h,u)),t.indexOf("%")!==-1&&n.host!==void 0&&!c){let y=u?n.host:b_(n.host,!0);u||(y=b_(y.toLowerCase())),n.host=_9(y,u)}(!h||h&&!h.skipNormalize)&&(n.path&&(n.path=v9(n.path)),n.query&&(n.query=P$(n.query)),n.fragment&&(n.fragment=P$(n.fragment))),h&&h.parse&&(h.parse(n,r),h===w$.urn&&n.nid===void 0&&(o=!0))}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:i,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:l}}function Zm(t,e){return Qm(t,e).parsed}function I9(t,e){return O$(t,e).normalized}function O$(t,e){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:i,malformedSchemeSpecific:s,malformedHost:o,malformedScheme:a}=Qm(t,e);return{normalized:n||i||s||o||a?t:$o(r,e),malformedAuthorityOrPort:n,malformedPercentEncoding:i,malformedSchemeSpecific:s,malformedHost:o,malformedScheme:a}}function N$(t,e){if(typeof t!="string"&&typeof t!="object")return;let r;try{r=typeof t=="string"?t:$o(t,e)}catch{return}let{normalized:n,malformedAuthorityOrPort:i,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:c}=O$(r,e);return i||s||o||a||c?void 0:n}var P_={SCHEMES:w$,normalize:k9,resolve:N9,resolveComponent:A$,equal:R9,serialize:$o,parse:Zm};eg.exports=P_;eg.exports.default=P_;eg.exports.fastUri=P_});var L$=R(k_=>{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});var M$=x$();M$.code='require("ajv/dist/runtime/uri").default';k_.default=M$});var V$=R(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.CodeGen=vr.Name=vr.nil=vr.stringify=vr.str=vr._=vr.KeywordCxt=void 0;var O9=Iu();Object.defineProperty(vr,"KeywordCxt",{enumerable:!0,get:function(){return O9.KeywordCxt}});var pc=_e();Object.defineProperty(vr,"_",{enumerable:!0,get:function(){return pc._}});Object.defineProperty(vr,"str",{enumerable:!0,get:function(){return pc.str}});Object.defineProperty(vr,"stringify",{enumerable:!0,get:function(){return pc.stringify}});Object.defineProperty(vr,"nil",{enumerable:!0,get:function(){return pc.nil}});Object.defineProperty(vr,"Name",{enumerable:!0,get:function(){return pc.Name}});Object.defineProperty(vr,"CodeGen",{enumerable:!0,get:function(){return pc.CodeGen}});var x9=Ym(),j$=Ou(),M9=zS(),qu=xu(),L9=_e(),$u=Du(),tg=wu(),R_=Ie(),q$=l$(),q9=L$(),U$=(t,e)=>new RegExp(t,e);U$.code="new RegExp";var $9=["removeAdditional","useDefaults","coerceTypes"],F9=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),B9={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},j9={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},$$=200;function U9(t){var e,r,n,i,s,o,a,c,l,u,d,f,p,m,h,y,S,v,b,P,N,$,j,L,ye;let qe=t.strict,pe=(e=t.code)===null||e===void 0?void 0:e.optimize,Pe=pe===!0||pe===void 0?1:pe||0,ur=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:U$,_r=(i=t.uriResolver)!==null&&i!==void 0?i:q9.default;return{strictSchema:(o=(s=t.strictSchema)!==null&&s!==void 0?s:qe)!==null&&o!==void 0?o:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:qe)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=t.strictTypes)!==null&&l!==void 0?l:qe)!==null&&u!==void 0?u:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:qe)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:qe)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:Pe,regExp:ur}:{optimize:Pe,regExp:ur},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:$$,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:$$,meta:(S=t.meta)!==null&&S!==void 0?S:!0,messages:(v=t.messages)!==null&&v!==void 0?v:!0,inlineRefs:(b=t.inlineRefs)!==null&&b!==void 0?b:!0,schemaId:(P=t.schemaId)!==null&&P!==void 0?P:"$id",addUsedSchema:(N=t.addUsedSchema)!==null&&N!==void 0?N:!0,validateSchema:($=t.validateSchema)!==null&&$!==void 0?$:!0,validateFormats:(j=t.validateFormats)!==null&&j!==void 0?j:!0,unicodeRegExp:(L=t.unicodeRegExp)!==null&&L!==void 0?L:!0,int32range:(ye=t.int32range)!==null&&ye!==void 0?ye:!0,uriResolver:_r}}var Fu=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...U9(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new L9.ValueScope({scope:{},prefixes:F9,es5:r,lines:n}),this.logger=Y9(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,M9.getRules)(),F$.call(this,B9,e,"NOT SUPPORTED"),F$.call(this,j9,e,"DEPRECATED","warn"),this._metaOpts=z9.call(this),e.formats&&V9.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&W9.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),H9.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=q$;n==="id"&&(i={...q$},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(u,d){await s.call(this,u.$schema);let f=this._addSchema(u,d);return f.validate||o.call(this,f)}async function s(u){u&&!this.getSchema(u)&&await i.call(this,{$ref:u},!0)}async function o(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof j$.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),o.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function c(u){let d=await l.call(this,u);this.refs[u]||await s.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function l(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,i);return this}let s;if(typeof e=="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw new Error(`schema ${o} must be string`)}return r=(0,$u.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return i}getSchema(e){let r;for(;typeof(r=B$.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new qu.SchemaEnv({schema:{},schemaId:n});if(r=qu.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=B$.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,$u.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(X9.call(this,n,r),!r)return(0,R_.eachItem)(n,s=>N_.call(this,s)),this;Q9.call(this,r);let i={...r,type:(0,tg.getJSONTypes)(r.type),schemaType:(0,tg.getJSONTypes)(r.schemaType)};return(0,R_.eachItem)(n,i.type.length===0?s=>N_.call(this,s,i):s=>i.type.forEach(o=>N_.call(this,s,i,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(s=>s.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,s)=>i+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let s=i.split("/").slice(1),o=e;for(let a of s)o=o[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=o[a];l&&u&&(o[a]=H$(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:a}=this.opts;if(typeof e=="object")o=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,$u.normalizeId)(o||n);let l=$u.getSchemaRefs.call(this,e,n);return c=new qu.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:l}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):qu.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{qu.compileSchema.call(this,e)}finally{this.opts=r}}};Fu.ValidationError=x9.default;Fu.MissingRefError=j$.default;vr.default=Fu;function F$(t,e,r,n="error"){for(let i in t){let s=i;s in e&&this.logger[n](`${r}: option ${i}. ${t[s]}`)}}function B$(t){return t=(0,$u.normalizeId)(t),this.schemas[t]||this.refs[t]}function H9(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function V9(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function W9(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function z9(){let t={...this.opts};for(let e of $9)delete t[e];return t}var G9={log(){},warn(){},error(){}};function Y9(t){if(t===!1)return G9;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var K9=/^[a-z_$][a-z0-9_$:-]*$/i;function X9(t,e){let{RULES:r}=this;if((0,R_.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!K9.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function N_(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,o=i?s.post:s.rules.find(({type:c})=>c===r);if(o||(o={type:r,rules:[]},s.rules.push(o)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,tg.getJSONTypes)(e.type),schemaType:(0,tg.getJSONTypes)(e.schemaType)}};e.before?J9.call(this,o,a,e.before):o.rules.push(a),s.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function J9(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Q9(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=H$(e)),t.validateSchema=this.compile(e,!0))}var Z9={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function H$(t){return{anyOf:[t,Z9]}}});var W$=R(E_=>{"use strict";Object.defineProperty(E_,"__esModule",{value:!0});var e6={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};E_.default=e6});var ig=R(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.callRef=Fo.getValidate=void 0;var t6=Ou(),z$=Hn(),fn=_e(),hc=Un(),G$=xu(),rg=Ie(),r6={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:s,validateName:o,opts:a,self:c}=n,{root:l}=s;if((r==="#"||r==="#/")&&i===l.baseId)return d();let u=G$.resolveRef.call(c,l,i,r);if(u===void 0)throw new t6.default(n.opts.uriResolver,i,r);if(u instanceof G$.SchemaEnv)return f(u);return p(u);function d(){if(s===l)return ng(t,o,s,s.$async);let m=e.scopeValue("root",{ref:l});return ng(t,(0,fn._)`${m}.validate`,l,l.$async)}function f(m){let h=Y$(t,m);ng(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,fn.stringify)(m)}:{ref:m}),y=e.name("valid"),S=t.subschema({schema:m,dataTypes:[],schemaPath:fn.nil,topSchemaRef:h,errSchemaPath:r},y);t.mergeEvaluated(S),t.ok(y)}}};function Y$(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,fn._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Fo.getValidate=Y$;function ng(t,e,r,n){let{gen:i,it:s}=t,{allErrors:o,schemaEnv:a,opts:c}=s,l=c.passContext?hc.default.this:fn.nil;n?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=i.let("valid");i.try(()=>{i.code((0,fn._)`await ${(0,z$.callValidateCode)(t,e,l)}`),p(e),o||i.assign(m,!0)},h=>{i.if((0,fn._)`!(${h} instanceof ${s.ValidationError})`,()=>i.throw(h)),f(h),o||i.assign(m,!1)}),t.ok(m)}function d(){t.result((0,z$.callValidateCode)(t,e,l),()=>p(e),()=>f(e))}function f(m){let h=(0,fn._)`${m}.errors`;i.assign(hc.default.vErrors,(0,fn._)`${hc.default.vErrors} === null ? ${h} : ${hc.default.vErrors}.concat(${h})`),i.assign(hc.default.errors,(0,fn._)`${hc.default.vErrors}.length`)}function p(m){var h;if(!s.opts.unevaluated)return;let y=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=rg.mergeEvaluated.props(i,y.props,s.props));else{let S=i.var("props",(0,fn._)`${m}.evaluated.props`);s.props=rg.mergeEvaluated.props(i,S,s.props,fn.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=rg.mergeEvaluated.items(i,y.items,s.items));else{let S=i.var("items",(0,fn._)`${m}.evaluated.items`);s.items=rg.mergeEvaluated.items(i,S,s.items,fn.Name)}}}Fo.callRef=ng;Fo.default=r6});var K$=R(w_=>{"use strict";Object.defineProperty(w_,"__esModule",{value:!0});var n6=W$(),i6=ig(),s6=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",n6.default,i6.default];w_.default=s6});var X$=R(D_=>{"use strict";Object.defineProperty(D_,"__esModule",{value:!0});var sg=_e(),Ks=sg.operators,og={maximum:{okStr:"<=",ok:Ks.LTE,fail:Ks.GT},minimum:{okStr:">=",ok:Ks.GTE,fail:Ks.LT},exclusiveMaximum:{okStr:"<",ok:Ks.LT,fail:Ks.GTE},exclusiveMinimum:{okStr:">",ok:Ks.GT,fail:Ks.LTE}},o6={message:({keyword:t,schemaCode:e})=>(0,sg.str)`must be ${og[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,sg._)`{comparison: ${og[t].okStr}, limit: ${e}}`},a6={keyword:Object.keys(og),type:"number",schemaType:"number",$data:!0,error:o6,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,sg._)`${r} ${og[e].fail} ${n} || isNaN(${r})`)}};D_.default=a6});var J$=R(C_=>{"use strict";Object.defineProperty(C_,"__esModule",{value:!0});var Bu=_e(),c6={message:({schemaCode:t})=>(0,Bu.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Bu._)`{multipleOf: ${t}}`},l6={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:c6,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,s=i.opts.multipleOfPrecision,o=e.let("res"),a=s?(0,Bu._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,Bu._)`${o} !== parseInt(${o})`;t.fail$data((0,Bu._)`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};C_.default=l6});var Z$=R(A_=>{"use strict";Object.defineProperty(A_,"__esModule",{value:!0});function Q$(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}A_.default=Q$;Q$.code='require("ajv/dist/runtime/ucs2length").default'});var eF=R(I_=>{"use strict";Object.defineProperty(I_,"__esModule",{value:!0});var Bo=_e(),u6=Ie(),d6=Z$(),f6={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Bo.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Bo._)`{limit: ${t}}`},p6={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:f6,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,s=e==="maxLength"?Bo.operators.GT:Bo.operators.LT,o=i.opts.unicode===!1?(0,Bo._)`${r}.length`:(0,Bo._)`${(0,u6.useFunc)(t.gen,d6.default)}(${r})`;t.fail$data((0,Bo._)`${o} ${s} ${n}`)}};I_.default=p6});var tF=R(O_=>{"use strict";Object.defineProperty(O_,"__esModule",{value:!0});var h6=Hn(),m6=Ie(),mc=_e(),g6={message:({schemaCode:t})=>(0,mc.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,mc._)`{pattern: ${t}}`},y6={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:g6,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:s,it:o}=t,a=o.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=o.opts.code,l=c.code==="new RegExp"?(0,mc._)`new RegExp`:(0,m6.useFunc)(e,c),u=e.let("valid");e.try(()=>e.assign(u,(0,mc._)`${l}(${s}, ${a}).test(${r})`),()=>e.assign(u,!1)),t.fail$data((0,mc._)`!${u}`)}else{let c=(0,h6.usePattern)(t,i);t.fail$data((0,mc._)`!${c}.test(${r})`)}}};O_.default=y6});var rF=R(x_=>{"use strict";Object.defineProperty(x_,"__esModule",{value:!0});var ju=_e(),T6={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,ju.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,ju._)`{limit: ${t}}`},v6={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:T6,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?ju.operators.GT:ju.operators.LT;t.fail$data((0,ju._)`Object.keys(${r}).length ${i} ${n}`)}};x_.default=v6});var nF=R(M_=>{"use strict";Object.defineProperty(M_,"__esModule",{value:!0});var Uu=Hn(),Hu=_e(),b6=Ie(),S6={message:({params:{missingProperty:t}})=>(0,Hu.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Hu._)`{missingProperty: ${t}}`},_6={keyword:"required",type:"object",schemaType:"array",$data:!0,error:S6,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:s,it:o}=t,{opts:a}=o;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(o.allErrors?l():u(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let y=o.schemaEnv.baseId+o.errSchemaPath,S=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,b6.checkStrictMode)(o,S,o.opts.strictRequired)}}function l(){if(c||s)t.block$data(Hu.nil,d);else for(let p of r)(0,Uu.checkReportMissingProp)(t,p)}function u(){let p=e.let("missing");if(c||s){let m=e.let("valid",!0);t.block$data(m,()=>f(p,m)),t.ok(m)}else e.if((0,Uu.checkMissingProp)(t,r,p)),(0,Uu.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,Uu.noPropertyInData)(e,i,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(m,(0,Uu.propertyInData)(e,i,p,a.ownProperties)),e.if((0,Hu.not)(m),()=>{t.error(),e.break()})},Hu.nil)}}};M_.default=_6});var iF=R(L_=>{"use strict";Object.defineProperty(L_,"__esModule",{value:!0});var Vu=_e(),P6={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Vu.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Vu._)`{limit: ${t}}`},k6={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:P6,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?Vu.operators.GT:Vu.operators.LT;t.fail$data((0,Vu._)`${r}.length ${i} ${n}`)}};L_.default=k6});var ag=R(q_=>{"use strict";Object.defineProperty(q_,"__esModule",{value:!0});var sF=e_();sF.code='require("ajv/dist/runtime/equal").default';q_.default=sF});var oF=R(F_=>{"use strict";Object.defineProperty(F_,"__esModule",{value:!0});var $_=wu(),br=_e(),N6=Ie(),R6=ag(),E6={message:({params:{i:t,j:e}})=>(0,br.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,br._)`{i: ${t}, j: ${e}}`},w6={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:E6,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:s,schemaCode:o,it:a}=t;if(!n&&!i)return;let c=e.let("valid"),l=s.items?(0,$_.getSchemaTypes)(s.items):[];t.block$data(c,u,(0,br._)`${o} === false`),t.ok(c);function u(){let m=e.let("i",(0,br._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,br._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return l.length>0&&!l.some(m=>m==="object"||m==="array")}function f(m,h){let y=e.name("item"),S=(0,$_.checkDataTypes)(l,y,a.opts.strictNumbers,$_.DataType.Wrong),v=e.const("indices",(0,br._)`{}`);e.for((0,br._)`;${m}--;`,()=>{e.let(y,(0,br._)`${r}[${m}]`),e.if(S,(0,br._)`continue`),l.length>1&&e.if((0,br._)`typeof ${y} == "string"`,(0,br._)`${y} += "_"`),e.if((0,br._)`typeof ${v}[${y}] == "number"`,()=>{e.assign(h,(0,br._)`${v}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,br._)`${v}[${y}] = ${m}`)})}function p(m,h){let y=(0,N6.useFunc)(e,R6.default),S=e.name("outer");e.label(S).for((0,br._)`;${m}--;`,()=>e.for((0,br._)`${h} = ${m}; ${h}--;`,()=>e.if((0,br._)`${y}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(S)})))}}};F_.default=w6});var aF=R(j_=>{"use strict";Object.defineProperty(j_,"__esModule",{value:!0});var B_=_e(),D6=Ie(),C6=ag(),A6={message:"must be equal to constant",params:({schemaCode:t})=>(0,B_._)`{allowedValue: ${t}}`},I6={keyword:"const",$data:!0,error:A6,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,B_._)`!${(0,D6.useFunc)(e,C6.default)}(${r}, ${i})`):t.fail((0,B_._)`${s} !== ${r}`)}};j_.default=I6});var cF=R(U_=>{"use strict";Object.defineProperty(U_,"__esModule",{value:!0});var Wu=_e(),O6=Ie(),x6=ag(),M6={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Wu._)`{allowedValues: ${t}}`},L6={keyword:"enum",schemaType:"array",$data:!0,error:M6,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:s,it:o}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=o.opts.loopEnum,c,l=()=>c??(c=(0,O6.useFunc)(e,x6.default)),u;if(a||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let p=e.const("vSchema",s);u=(0,Wu.or)(...i.map((m,h)=>f(p,h)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",s,p=>e.if((0,Wu._)`${l()}(${r}, ${p})`,()=>e.assign(u,!0).break()))}function f(p,m){let h=i[m];return typeof h=="object"&&h!==null?(0,Wu._)`${l()}(${r}, ${p}[${m}])`:(0,Wu._)`${r} === ${h}`}}};U_.default=L6});var lF=R(H_=>{"use strict";Object.defineProperty(H_,"__esModule",{value:!0});var q6=X$(),$6=J$(),F6=eF(),B6=tF(),j6=rF(),U6=nF(),H6=iF(),V6=oF(),W6=aF(),z6=cF(),G6=[q6.default,$6.default,F6.default,B6.default,j6.default,U6.default,H6.default,V6.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},W6.default,z6.default];H_.default=G6});var W_=R(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.validateAdditionalItems=void 0;var jo=_e(),V_=Ie(),Y6={message:({params:{len:t}})=>(0,jo.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,jo._)`{limit: ${t}}`},K6={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Y6,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,V_.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}uF(t,n)}};function uF(t,e){let{gen:r,schema:n,data:i,keyword:s,it:o}=t;o.items=!0;let a=r.const("len",(0,jo._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,jo._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,V_.alwaysValidSchema)(o,n)){let l=r.var("valid",(0,jo._)`${a} <= ${e.length}`);r.if((0,jo.not)(l),()=>c(l)),t.ok(l)}function c(l){r.forRange("i",e.length,a,u=>{t.subschema({keyword:s,dataProp:u,dataPropType:V_.Type.Num},l),o.allErrors||r.if((0,jo.not)(l),()=>r.break())})}}zu.validateAdditionalItems=uF;zu.default=K6});var z_=R(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});Gu.validateTuple=void 0;var dF=_e(),cg=Ie(),X6=Hn(),J6={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return fF(t,"additionalItems",e);r.items=!0,!(0,cg.alwaysValidSchema)(r,e)&&t.ok((0,X6.validateArray)(t))}};function fF(t,e,r=t.schema){let{gen:n,parentSchema:i,data:s,keyword:o,it:a}=t;u(i),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=cg.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),l=n.const("len",(0,dF._)`${s}.length`);r.forEach((d,f)=>{(0,cg.alwaysValidSchema)(a,d)||(n.if((0,dF._)`${l} > ${f}`,()=>t.subschema({keyword:o,schemaProp:f,dataProp:f},c)),t.ok(c))});function u(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let y=`"${o}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,cg.checkStrictMode)(a,y,f.strictTuples)}}}Gu.validateTuple=fF;Gu.default=J6});var pF=R(G_=>{"use strict";Object.defineProperty(G_,"__esModule",{value:!0});var Q6=z_(),Z6={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Q6.validateTuple)(t,"items")};G_.default=Z6});var mF=R(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0});var hF=_e(),eJ=Ie(),tJ=Hn(),rJ=W_(),nJ={message:({params:{len:t}})=>(0,hF.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,hF._)`{limit: ${t}}`},iJ={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:nJ,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,eJ.alwaysValidSchema)(n,e)&&(i?(0,rJ.validateAdditionalItems)(t,i):t.ok((0,tJ.validateArray)(t)))}};Y_.default=iJ});var gF=R(K_=>{"use strict";Object.defineProperty(K_,"__esModule",{value:!0});var Wn=_e(),lg=Ie(),sJ={message:({params:{min:t,max:e}})=>e===void 0?(0,Wn.str)`must contain at least ${t} valid item(s)`:(0,Wn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Wn._)`{minContains: ${t}}`:(0,Wn._)`{minContains: ${t}, maxContains: ${e}}`},oJ={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:sJ,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t,o,a,{minContains:c,maxContains:l}=n;s.opts.next?(o=c===void 0?1:c,a=l):o=1;let u=e.const("len",(0,Wn._)`${i}.length`);if(t.setParams({min:o,max:a}),a===void 0&&o===0){(0,lg.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){(0,lg.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,lg.alwaysValidSchema)(s,r)){let h=(0,Wn._)`${u} >= ${o}`;a!==void 0&&(h=(0,Wn._)`${h} && ${u} <= ${a}`),t.pass(h);return}s.items=!0;let d=e.name("valid");a===void 0&&o===1?p(d,()=>e.if(d,()=>e.break())):o===0?(e.let(d,!0),a!==void 0&&e.if((0,Wn._)`${i}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),y=e.let("count",0);p(h,()=>e.if(h,()=>m(y)))}function p(h,y){e.forRange("i",0,u,S=>{t.subschema({keyword:"contains",dataProp:S,dataPropType:lg.Type.Num,compositeRule:!0},h),y()})}function m(h){e.code((0,Wn._)`${h}++`),a===void 0?e.if((0,Wn._)`${h} >= ${o}`,()=>e.assign(d,!0).break()):(e.if((0,Wn._)`${h} > ${a}`,()=>e.assign(d,!1).break()),o===1?e.assign(d,!0):e.if((0,Wn._)`${h} >= ${o}`,()=>e.assign(d,!0)))}}};K_.default=oJ});var ug=R(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.validateSchemaDeps=Fi.validatePropertyDeps=Fi.error=void 0;var X_=_e(),aJ=Ie(),Yu=Hn();Fi.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,X_.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,X_._)`{property: ${t},
180
180
  missingProperty: ${n},
181
181
  depsCount: ${e},
182
182
  deps: ${r}}`};var cJ={keyword:"dependencies",type:"object",schemaType:"object",error:Fi.error,code(t){let[e,r]=lJ(t);yF(t,e),TF(t,r)}};function lJ({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function yF(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let o in e){let a=e[o];if(a.length===0)continue;let c=(0,Yu.propertyInData)(r,n,o,i.opts.ownProperties);t.setParams({property:o,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(c,()=>{for(let l of a)(0,Yu.checkReportMissingProp)(t,l)}):(r.if((0,X_._)`${c} && (${(0,Yu.checkMissingProp)(t,a,s)})`),(0,Yu.reportMissingProp)(t,s),r.else())}}Fi.validatePropertyDeps=yF;function TF(t,e=t.schema){let{gen:r,data:n,keyword:i,it:s}=t,o=r.name("valid");for(let a in e)(0,aJ.alwaysValidSchema)(s,e[a])||(r.if((0,Yu.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:i,schemaProp:a},o);t.mergeValidEvaluated(c,o)},()=>r.var(o,!0)),t.ok(o))}Fi.validateSchemaDeps=TF;Fi.default=cJ});var bF=R(J_=>{"use strict";Object.defineProperty(J_,"__esModule",{value:!0});var vF=_e(),uJ=Ie(),dJ={message:"property name must be valid",params:({params:t})=>(0,vF._)`{propertyName: ${t.propertyName}}`},fJ={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:dJ,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,uJ.alwaysValidSchema)(i,r))return;let s=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},s),e.if((0,vF.not)(s),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(s)}};J_.default=fJ});var Z_=R(Q_=>{"use strict";Object.defineProperty(Q_,"__esModule",{value:!0});var dg=Hn(),yi=_e(),pJ=Un(),fg=Ie(),hJ={message:"must NOT have additional properties",params:({params:t})=>(0,yi._)`{additionalProperty: ${t.additionalProperty}}`},mJ={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:hJ,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:s,it:o}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=o;if(o.props=!0,c.removeAdditional!=="all"&&(0,fg.alwaysValidSchema)(o,r))return;let l=(0,dg.allSchemaProperties)(n.properties),u=(0,dg.allSchemaProperties)(n.patternProperties);d(),t.ok((0,yi._)`${s} === ${pJ.default.errors}`);function d(){e.forIn("key",i,y=>{!l.length&&!u.length?m(y):e.if(f(y),()=>m(y))})}function f(y){let S;if(l.length>8){let v=(0,fg.schemaRefOrVal)(o,n.properties,"properties");S=(0,dg.isOwnProperty)(e,v,y)}else l.length?S=(0,yi.or)(...l.map(v=>(0,yi._)`${y} === ${v}`)):S=yi.nil;return u.length&&(S=(0,yi.or)(S,...u.map(v=>(0,yi._)`${(0,dg.usePattern)(t,v)}.test(${y})`))),(0,yi.not)(S)}function p(y){e.code((0,yi._)`delete ${i}[${y}]`)}function m(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,fg.alwaysValidSchema)(o,r)){let S=e.name("valid");c.removeAdditional==="failing"?(h(y,S,!1),e.if((0,yi.not)(S),()=>{t.reset(),p(y)})):(h(y,S),a||e.if((0,yi.not)(S),()=>e.break()))}}function h(y,S,v){let b={keyword:"additionalProperties",dataProp:y,dataPropType:fg.Type.Str};v===!1&&Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(b,S)}}};Q_.default=mJ});var PF=R(tP=>{"use strict";Object.defineProperty(tP,"__esModule",{value:!0});var gJ=Iu(),SF=Hn(),eP=Ie(),_F=Z_(),yJ={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&_F.default.code(new gJ.KeywordCxt(s,_F.default,"additionalProperties"));let o=(0,SF.allSchemaProperties)(r);for(let d of o)s.definedProperties.add(d);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=eP.mergeEvaluated.props(e,(0,eP.toHash)(o),s.props));let a=o.filter(d=>!(0,eP.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)l(d)?u(d):(e.if((0,SF.propertyInData)(e,i,d,s.opts.ownProperties)),u(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function l(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};tP.default=yJ});var EF=R(rP=>{"use strict";Object.defineProperty(rP,"__esModule",{value:!0});var kF=Hn(),pg=_e(),NF=Ie(),RF=Ie(),TJ={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:s}=t,{opts:o}=s,a=(0,kF.allSchemaProperties)(r),c=a.filter(h=>(0,NF.alwaysValidSchema)(s,r[h]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let l=o.strictSchema&&!o.allowMatchingProperties&&i.properties,u=e.name("valid");s.props!==!0&&!(s.props instanceof pg.Name)&&(s.props=(0,RF.evaluatedPropsToName)(e,s.props));let{props:d}=s;f();function f(){for(let h of a)l&&p(h),s.allErrors?m(h):(e.var(u,!0),m(h),e.if(u))}function p(h){for(let y in l)new RegExp(h).test(y)&&(0,NF.checkStrictMode)(s,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,y=>{e.if((0,pg._)`${(0,kF.usePattern)(t,h)}.test(${y})`,()=>{let S=c.includes(h);S||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:RF.Type.Str},u),s.opts.unevaluated&&d!==!0?e.assign((0,pg._)`${d}[${y}]`,!0):!S&&!s.allErrors&&e.if((0,pg.not)(u),()=>e.break())})})}}};rP.default=TJ});var wF=R(nP=>{"use strict";Object.defineProperty(nP,"__esModule",{value:!0});var vJ=Ie(),bJ={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,vJ.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};nP.default=bJ});var DF=R(iP=>{"use strict";Object.defineProperty(iP,"__esModule",{value:!0});var SJ=Hn(),_J={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:SJ.validateUnion,error:{message:"must match a schema in anyOf"}};iP.default=_J});var CF=R(sP=>{"use strict";Object.defineProperty(sP,"__esModule",{value:!0});var hg=_e(),PJ=Ie(),kJ={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,hg._)`{passingSchemas: ${t.passing}}`},NJ={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:kJ,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let s=r,o=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(l),t.result(o,()=>t.reset(),()=>t.error(!0));function l(){s.forEach((u,d)=>{let f;(0,PJ.alwaysValidSchema)(i,u)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,hg._)`${c} && ${o}`).assign(o,!1).assign(a,(0,hg._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(a,d),f&&t.mergeEvaluated(f,hg.Name)})})}}};sP.default=NJ});var AF=R(oP=>{"use strict";Object.defineProperty(oP,"__esModule",{value:!0});var RJ=Ie(),EJ={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((s,o)=>{if((0,RJ.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(a)})}};oP.default=EJ});var xF=R(aP=>{"use strict";Object.defineProperty(aP,"__esModule",{value:!0});var mg=_e(),OF=Ie(),wJ={message:({params:t})=>(0,mg.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,mg._)`{failingKeyword: ${t.ifClause}}`},DJ={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:wJ,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,OF.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=IF(n,"then"),s=IF(n,"else");if(!i&&!s)return;let o=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),i&&s){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(a,l("then",u),l("else",u))}else i?e.if(a,l("then")):e.if((0,mg.not)(a),l("else"));t.pass(o,()=>t.error(!0));function c(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(u)}function l(u,d){return()=>{let f=t.subschema({keyword:u},a);e.assign(o,a),t.mergeValidEvaluated(f,o),d?e.assign(d,(0,mg._)`${u}`):t.setParams({ifClause:u})}}}};function IF(t,e){let r=t.schema[e];return r!==void 0&&!(0,OF.alwaysValidSchema)(t,r)}aP.default=DJ});var MF=R(cP=>{"use strict";Object.defineProperty(cP,"__esModule",{value:!0});var CJ=Ie(),AJ={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,CJ.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};cP.default=AJ});var LF=R(lP=>{"use strict";Object.defineProperty(lP,"__esModule",{value:!0});var IJ=W_(),OJ=pF(),xJ=z_(),MJ=mF(),LJ=gF(),qJ=ug(),$J=bF(),FJ=Z_(),BJ=PF(),jJ=EF(),UJ=wF(),HJ=DF(),VJ=CF(),WJ=AF(),zJ=xF(),GJ=MF();function YJ(t=!1){let e=[UJ.default,HJ.default,VJ.default,WJ.default,zJ.default,GJ.default,$J.default,FJ.default,qJ.default,BJ.default,jJ.default];return t?e.push(OJ.default,MJ.default):e.push(IJ.default,xJ.default),e.push(LJ.default),e}lP.default=YJ});var qF=R(uP=>{"use strict";Object.defineProperty(uP,"__esModule",{value:!0});var Ht=_e(),KJ={message:({schemaCode:t})=>(0,Ht.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Ht._)`{format: ${t}}`},XJ={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:KJ,code(t,e){let{gen:r,data:n,$data:i,schema:s,schemaCode:o,it:a}=t,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;i?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,Ht._)`${m}[${o}]`),y=r.let("fType"),S=r.let("format");r.if((0,Ht._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,(0,Ht._)`${h}.type || "string"`).assign(S,(0,Ht._)`${h}.validate`),()=>r.assign(y,(0,Ht._)`"string"`).assign(S,h)),t.fail$data((0,Ht.or)(v(),b()));function v(){return c.strictSchema===!1?Ht.nil:(0,Ht._)`${o} && !${S}`}function b(){let P=u.$async?(0,Ht._)`(${h}.async ? await ${S}(${n}) : ${S}(${n}))`:(0,Ht._)`${S}(${n})`,N=(0,Ht._)`(typeof ${S} == "function" ? ${P} : ${S}.test(${n}))`;return(0,Ht._)`${S} && ${S} !== true && ${y} === ${e} && !${N}`}}function p(){let m=d.formats[s];if(!m){v();return}if(m===!0)return;let[h,y,S]=b(m);h===e&&t.pass(P());function v(){if(c.strictSchema===!1){d.logger.warn(N());return}throw new Error(N());function N(){return`unknown format "${s}" ignored in schema at path "${l}"`}}function b(N){let $=N instanceof RegExp?(0,Ht.regexpCode)(N):c.code.formats?(0,Ht._)`${c.code.formats}${(0,Ht.getProperty)(s)}`:void 0,j=r.scopeValue("formats",{key:s,ref:N,code:$});return typeof N=="object"&&!(N instanceof RegExp)?[N.type||"string",N.validate,(0,Ht._)`${j}.validate`]:["string",N,j]}function P(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Ht._)`await ${S}(${n})`}return typeof y=="function"?(0,Ht._)`${S}(${n})`:(0,Ht._)`${S}.test(${n})`}}}};uP.default=XJ});var $F=R(dP=>{"use strict";Object.defineProperty(dP,"__esModule",{value:!0});var JJ=qF(),QJ=[JJ.default];dP.default=QJ});var FF=R(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});gc.contentVocabulary=gc.metadataVocabulary=void 0;gc.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];gc.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var jF=R(fP=>{"use strict";Object.defineProperty(fP,"__esModule",{value:!0});var ZJ=K$(),e8=lF(),t8=LF(),r8=$F(),BF=FF(),n8=[ZJ.default,e8.default,(0,t8.default)(),r8.default,BF.metadataVocabulary,BF.contentVocabulary];fP.default=n8});var hP=R(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.dynamicAnchor=void 0;var pP=_e(),i8=Un(),UF=xu(),s8=ig(),o8={keyword:"$dynamicAnchor",schemaType:"string",code:t=>HF(t,t.schema)};function HF(t,e){let{gen:r,it:n}=t;n.schemaEnv.root.dynamicAnchors[e]=!0;let i=(0,pP._)`${i8.default.dynamicAnchors}${(0,pP.getProperty)(e)}`,s=n.errSchemaPath==="#"?n.validateName:a8(t);r.if((0,pP._)`!${i}`,()=>r.assign(i,s))}Ku.dynamicAnchor=HF;function a8(t){let{schemaEnv:e,schema:r,self:n}=t.it,{root:i,baseId:s,localRefs:o,meta:a}=e.root,{schemaId:c}=n.opts,l=new UF.SchemaEnv({schema:r,schemaId:c,root:i,baseId:s,localRefs:o,meta:a});return UF.compileSchema.call(n,l),(0,s8.getValidate)(t,l)}Ku.default=o8});var mP=R(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.dynamicRef=void 0;var VF=_e(),c8=Un(),WF=ig(),l8={keyword:"$dynamicRef",schemaType:"string",code:t=>zF(t,t.schema)};function zF(t,e){let{gen:r,keyword:n,it:i}=t;if(e[0]!=="#")throw new Error(`"${n}" only supports hash fragment reference`);let s=e.slice(1);if(i.allErrors)o();else{let c=r.let("valid",!1);o(c),t.ok(c)}function o(c){if(i.schemaEnv.root.dynamicAnchors[s]){let l=r.let("_v",(0,VF._)`${c8.default.dynamicAnchors}${(0,VF.getProperty)(s)}`);r.if(l,a(l,c),a(i.validateName,c))}else a(i.validateName,c)()}function a(c,l){return l?()=>r.block(()=>{(0,WF.callRef)(t,c),r.let(l,!0)}):()=>(0,WF.callRef)(t,c)}}Xu.dynamicRef=zF;Xu.default=l8});var GF=R(gP=>{"use strict";Object.defineProperty(gP,"__esModule",{value:!0});var u8=hP(),d8=Ie(),f8={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,u8.dynamicAnchor)(t,""):(0,d8.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}};gP.default=f8});var YF=R(yP=>{"use strict";Object.defineProperty(yP,"__esModule",{value:!0});var p8=mP(),h8={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,p8.dynamicRef)(t,t.schema)};yP.default=h8});var KF=R(TP=>{"use strict";Object.defineProperty(TP,"__esModule",{value:!0});var m8=hP(),g8=mP(),y8=GF(),T8=YF(),v8=[m8.default,g8.default,y8.default,T8.default];TP.default=v8});var JF=R(vP=>{"use strict";Object.defineProperty(vP,"__esModule",{value:!0});var XF=ug(),b8={keyword:"dependentRequired",type:"object",schemaType:"object",error:XF.error,code:t=>(0,XF.validatePropertyDeps)(t)};vP.default=b8});var QF=R(bP=>{"use strict";Object.defineProperty(bP,"__esModule",{value:!0});var S8=ug(),_8={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,S8.validateSchemaDeps)(t)};bP.default=_8});var ZF=R(SP=>{"use strict";Object.defineProperty(SP,"__esModule",{value:!0});var P8=Ie(),k8={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:e,it:r}){e.contains===void 0&&(0,P8.checkStrictMode)(r,`"${t}" without "contains" is ignored`)}};SP.default=k8});var eB=R(_P=>{"use strict";Object.defineProperty(_P,"__esModule",{value:!0});var N8=JF(),R8=QF(),E8=ZF(),w8=[N8.default,R8.default,E8.default];_P.default=w8});var rB=R(PP=>{"use strict";Object.defineProperty(PP,"__esModule",{value:!0});var Xs=_e(),tB=Ie(),D8=Un(),C8={message:"must NOT have unevaluated properties",params:({params:t})=>(0,Xs._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},A8={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:C8,code(t){let{gen:e,schema:r,data:n,errsCount:i,it:s}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:o,props:a}=s;a instanceof Xs.Name?e.if((0,Xs._)`${a} !== true`,()=>e.forIn("key",n,d=>e.if(l(a,d),()=>c(d)))):a!==!0&&e.forIn("key",n,d=>a===void 0?c(d):e.if(u(a,d),()=>c(d))),s.props=!0,t.ok((0,Xs._)`${i} === ${D8.default.errors}`);function c(d){if(r===!1){t.setParams({unevaluatedProperty:d}),t.error(),o||e.break();return}if(!(0,tB.alwaysValidSchema)(s,r)){let f=e.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:tB.Type.Str},f),o||e.if((0,Xs.not)(f),()=>e.break())}}function l(d,f){return(0,Xs._)`!${d} || !${d}[${f}]`}function u(d,f){let p=[];for(let m in d)d[m]===!0&&p.push((0,Xs._)`${f} !== ${m}`);return(0,Xs.and)(...p)}}};PP.default=A8});var iB=R(kP=>{"use strict";Object.defineProperty(kP,"__esModule",{value:!0});var Uo=_e(),nB=Ie(),I8={message:({params:{len:t}})=>(0,Uo.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Uo._)`{limit: ${t}}`},O8={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:I8,code(t){let{gen:e,schema:r,data:n,it:i}=t,s=i.items||0;if(s===!0)return;let o=e.const("len",(0,Uo._)`${n}.length`);if(r===!1)t.setParams({len:s}),t.fail((0,Uo._)`${o} > ${s}`);else if(typeof r=="object"&&!(0,nB.alwaysValidSchema)(i,r)){let c=e.var("valid",(0,Uo._)`${o} <= ${s}`);e.if((0,Uo.not)(c),()=>a(c,s)),t.ok(c)}i.items=!0;function a(c,l){e.forRange("i",l,o,u=>{t.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:nB.Type.Num},c),i.allErrors||e.if((0,Uo.not)(c),()=>e.break())})}}};kP.default=O8});var sB=R(NP=>{"use strict";Object.defineProperty(NP,"__esModule",{value:!0});var x8=rB(),M8=iB(),L8=[x8.default,M8.default];NP.default=L8});var aB=R(gg=>{"use strict";Object.defineProperty(gg,"__esModule",{value:!0});gg.DiscrError=void 0;var oB;(function(t){t.Tag="tag",t.Mapping="mapping"})(oB||(gg.DiscrError=oB={}))});var lB=R(EP=>{"use strict";Object.defineProperty(EP,"__esModule",{value:!0});var yc=_e(),RP=aB(),cB=xu(),q8=Ou(),$8=Ie(),F8={message:({params:{discrError:t,tagName:e}})=>t===RP.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,yc._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},B8={keyword:"discriminator",type:"object",schemaType:"object",error:F8,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:s}=t,{oneOf:o}=i;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),l=e.const("tag",(0,yc._)`${r}${(0,yc.getProperty)(a)}`);e.if((0,yc._)`typeof ${l} == "string"`,()=>u(),()=>t.error(!1,{discrError:RP.DiscrError.Tag,tag:l,tagName:a})),t.ok(c);function u(){let p=f();e.if(!1);for(let m in p)e.elseIf((0,yc._)`${l} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:RP.DiscrError.Mapping,tag:l,tagName:a}),e.endIf()}function d(p){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:p},m);return t.mergeEvaluated(h,yc.Name),m}function f(){var p;let m={},h=S(i),y=!0;for(let P=0;P<o.length;P++){let N=o[P];if(N?.$ref&&!(0,$8.schemaHasRulesButRef)(N,s.self.RULES)){let j=N.$ref;if(N=cB.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,j),N instanceof cB.SchemaEnv&&(N=N.schema),N===void 0)throw new q8.default(s.opts.uriResolver,s.baseId,j)}let $=(p=N?.properties)===null||p===void 0?void 0:p[a];if(typeof $!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(h||S(N)),v($,P)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function S({required:P}){return Array.isArray(P)&&P.includes(a)}function v(P,N){if(P.const)b(P.const,N);else if(P.enum)for(let $ of P.enum)b($,N);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function b(P,N){if(typeof P!="string"||P in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[P]=N}}}};EP.default=B8});var uB=R((a0e,j8)=>{j8.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}});var dB=R((c0e,U8)=>{U8.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}});var fB=R((l0e,H8)=>{H8.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}});var pB=R((u0e,V8)=>{V8.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}});var hB=R((d0e,W8)=>{W8.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}});var mB=R((f0e,z8)=>{z8.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var gB=R((p0e,G8)=>{G8.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var yB=R(wP=>{"use strict";Object.defineProperty(wP,"__esModule",{value:!0});var Y8=uB(),K8=dB(),X8=fB(),J8=pB(),Q8=hB(),Z8=mB(),eQ=gB(),tQ=["/properties"];function rQ(t){return[Y8,K8,X8,J8,e(this,Q8),Z8,e(this,eQ)].forEach(r=>this.addMetaSchema(r,void 0,!1)),this;function e(r,n){return t?r.$dataMetaSchema(n,tQ):n}}wP.default=rQ});var TB=R((kt,CP)=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.MissingRefError=kt.ValidationError=kt.CodeGen=kt.Name=kt.nil=kt.stringify=kt.str=kt._=kt.KeywordCxt=kt.Ajv2019=void 0;var nQ=V$(),iQ=jF(),sQ=KF(),oQ=eB(),aQ=sB(),cQ=lB(),lQ=yB(),DP="https://json-schema.org/draft/2019-09/schema",Tc=class extends nQ.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(sQ.default),iQ.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(oQ.default),this.addVocabulary(aQ.default),this.opts.discriminator&&this.addKeyword(cQ.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:r}=this.opts;r&&(lQ.default.call(this,e),this.refs["http://json-schema.org/schema"]=DP)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(DP)?DP:void 0)}};kt.Ajv2019=Tc;CP.exports=kt=Tc;CP.exports.Ajv2019=Tc;Object.defineProperty(kt,"__esModule",{value:!0});kt.default=Tc;var uQ=Iu();Object.defineProperty(kt,"KeywordCxt",{enumerable:!0,get:function(){return uQ.KeywordCxt}});var vc=_e();Object.defineProperty(kt,"_",{enumerable:!0,get:function(){return vc._}});Object.defineProperty(kt,"str",{enumerable:!0,get:function(){return vc.str}});Object.defineProperty(kt,"stringify",{enumerable:!0,get:function(){return vc.stringify}});Object.defineProperty(kt,"nil",{enumerable:!0,get:function(){return vc.nil}});Object.defineProperty(kt,"Name",{enumerable:!0,get:function(){return vc.Name}});Object.defineProperty(kt,"CodeGen",{enumerable:!0,get:function(){return vc.CodeGen}});var dQ=Ym();Object.defineProperty(kt,"ValidationError",{enumerable:!0,get:function(){return dQ.default}});var fQ=Ou();Object.defineProperty(kt,"MissingRefError",{enumerable:!0,get:function(){return fQ.default}})});var Pc=require("path"),Re=q(ww());var jf=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=Aw(n.range),s=this.offsetAt(i.start),o=this.offsetAt(i.end);this._content=this._content.substring(0,s)+n.text+this._content.substring(o,this._content.length);let a=Math.max(i.start.line,0),c=Math.max(i.end.line,0),l=this._lineOffsets,u=Dw(n.text,!1,s);if(c-a===u.length)for(let f=0,p=u.length;f<p;f++)l[f+a+1]=u[f];else u.length<1e4?l.splice(a+1,c-a,...u):this._lineOffsets=l=l.slice(0,a+1).concat(u,l.slice(c+1));let d=n.text.length-(o-s);if(d!==0)for(let f=a+1+u.length,p=l.length;f<p;f++)l[f]=l[f]+d}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=Dw(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 o=Math.floor((n+i)/2);r[o]>e?i=o:n=o+1}let s=n-1;return e=this.ensureBeforeEOL(e,r[s]),{line:s,character:e-r[s]}}offsetAt(e){let r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;let n=r[e.line];if(e.character<=0)return n;let i=e.line+1<r.length?r[e.line+1]:this._content.length,s=Math.min(n+e.character,i);return this.ensureBeforeEOL(s,n)}getLineRange(e){let r=this.getLineOffsets();if(e>=r.length){let o=r.length-1;return{start:{line:o,character:0},end:{line:o,character:this._content.length-r[o]}}}else if(e<0)return{start:{line:0,character:0},end:{line:0,character:0}};let n=r[e],i=e+1<r.length?r[e+1]:this._content.length,s=this.ensureBeforeEOL(i,n);return{start:{line:e,character:0},end:{line:e,character:s-n}}}getEOLCharacters(e){let r=this.getLineOffsets();if(e>=r.length)return"";if(e<0)return"";let n=e+1<r.length?r[e+1]:this._content.length,i=this.ensureBeforeEOL(n,r[e]);return this._content.substring(i,n)}ensureBeforeEOL(e,r){for(;e>r&&Cw(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}},Lt;(function(t){function e(i,s,o,a){return new jf(i,s,o,a)}t.create=e;function r(i,s,o){if(i instanceof jf)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=r;function n(i,s){let o=i.getText(),a=ET(s.map($H),(u,d)=>{let f=u.range.start.line-d.range.start.line;return f===0?u.range.start.character-d.range.start.character:f}),c=0,l=[];for(let u of a){let d=i.offsetAt(u.range.start);if(d<c)throw new Error("Overlapping edit");d>c&&l.push(o.substring(c,d)),u.newText.length&&l.push(u.newText),c=i.offsetAt(u.range.end)}return l.push(o.substr(c)),l.join("")}t.applyEdits=n})(Lt||(Lt={}));function ET(t,e){if(t.length<=1)return t;let r=t.length/2|0,n=t.slice(0,r),i=t.slice(r);ET(n,e),ET(i,e);let s=0,o=0,a=0;for(;s<n.length&&o<i.length;)e(n[s],i[o])<=0?t[a++]=n[s++]:t[a++]=i[o++];for(;s<n.length;)t[a++]=n[s++];for(;o<i.length;)t[a++]=i[o++];return t}function Dw(t,e,r=0){let n=e?[r]:[];for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);Cw(s)&&(s===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,n.push(r+i+1))}return n}function Cw(t){return t===13||t===10}function Aw(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 $H(t){let e=Aw(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var Wc=["namespace","class","enum","interface","struct","typeParameter","type","parameter","variable","property","enumMember","decorator","event","function","method","macro","label","comment","string","keyword","number","regexp","operator"],zc=["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"];var DT=q(require("url")),Bw=require("crypto"),va=require("path"),Yt=q(U());var wT=q(U());var Jr=q(U());var te=class{constructor(e){this._children=[];this.syntaxIssues=[];this.resettableIssues=[];this._firstToken=e?.start,this._lastToken=e?.end}get issues(){return[...this.syntaxIssues,...this.resettableIssues]}resetIssues(){this.resettableIssues=[],this.children.forEach(e=>e.resetIssues())}get serializeIssues(){return this.issues.map(e=>e())}get firstToken(){return this._firstToken??this._children[0].firstToken}set firstToken(e){this._firstToken=e}get lastToken(){return this._lastToken??this._children[this._children.length-1]?.lastToken??this.firstToken}set lastToken(e){this._lastToken=e}get fsPath(){return this.firstToken.fsPath}getTopMostAstNodeForFile(e){return fe(e,this.fsPath)?[this]:this.children.flatMap(r=>r.getTopMostAstNodeForFile(e))}getDocumentSymbols(e){if(!this.docSymbolsMeta)return this.children.flatMap(n=>n.getDocumentSymbols(e)??[]);if(!fe(this.fsPath,e))return[];let r=ce(this);return[{name:this.docSymbolsMeta.name?this.docSymbolsMeta.name:"__UNSET__",kind:this.docSymbolsMeta.kind,range:r,selectionRange:r,children:[...this.children.flatMap(n=>n.getDocumentSymbols(e)??[])]}]}getWorkspaceSymbols(){if(!this.docSymbolsMeta)return this.children.flatMap(i=>i.getWorkspaceSymbols()??[]);let e=this.docSymbolsMeta.kind;if(![Jr.SymbolKind.File,Jr.SymbolKind.Class,Jr.SymbolKind.Constant].some(i=>i===e))return[];let r=fr(this.fsPath),n=r?.range??ce(this);return[{location:Jr.Location.create(ue(r?.fsPath??this.fsPath),n),name:this.docSymbolsMeta.name?this.docSymbolsMeta.name:"__UNSET__",kind:this.docSymbolsMeta.kind},...this.children.flatMap(i=>i.getWorkspaceSymbols()??[]).filter(i=>i.kind===Jr.SymbolKind.File||i.kind===Jr.SymbolKind.Class||i.kind===Jr.SymbolKind.Constant)]}buildSemanticTokens(e){this._children.forEach(r=>r.buildSemanticTokens(e)),!(!this.semanticTokenType||!this.semanticTokenModifiers)&&e(Gi(this.semanticTokenType),Yi(this.semanticTokenModifiers),this.firstToken,this.lastToken)}get children(){return this._children}get allDescendants(){return this.allDescendantsCache??=[...this._children,...this._children.flatMap(e=>e.allDescendants)],this.allDescendantsCache}addChild(e){e&&(e.parentNode=this,this._children.push(e)),this.allDescendantsCache=void 0}isAncestorOf(e){return this.children.some(r=>r===e||r.isAncestorOf(e))}toPrettyString(e){return this.toString()}toString(e){return"TODO"}get range(){return Jr.Range.create(Jr.Position.create(this.firstToken.pos.line,this.firstToken.pos.col),Jr.Position.create(this.lastToken.pos.line,this.lastToken.pos.colEnd))}get serializeURL(){return ue(this.fsPath)}serialize(e){return{url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var ge=class extends te{get firstToken(){return this.operator?this.operator.firstToken:super.firstToken}toJson(){return-1}#e;resolve(e){return this.#e??=Gc(this.toString(),e),this.#e}#r;evaluate(e){return this.#r??=Le(`${this.operator?this.operator.toString():""}${this.resolve(e)}`),this.#r}#n;isTrue(e){return this.#n??=Le(`!!(${this.operator?this.operator.toString():""}${this.resolve(e)})`),typeof this.#n=="boolean"&&this.#n}toPrettyString(e){let r=this.evaluate(e);return`${r.toString()} /* ${this.toString()}${typeof r=="number"?` = 0x${r.toString(16)}`:""} */`}serialize(e){return{type:"EXPRESSION",value:this.toString(),evaluated:this.evaluate(e),url:this.serializeURL,range:this.range,issues:this.serializeIssues}}},nr=class t extends ge{constructor(r,n,i){super();this.expression=r;this.wrapped=n;this.addChild(r),i&&(this.addChild(i.operator),this.addChild(i.expression),this.join=[],this.join?.push(i))}get firstToken(){return this.openBracket?this.openBracket:super.firstToken}get lastToken(){return this.closeBracket?this.closeBracket:super.lastToken}addExpression(r,n){this.addChild(r),this.addChild(n),this.join??=[],this.join?.push({operator:r,expression:n})}toString(){let r=this.children.map(n=>"radix"in n&&n.radix===16?`0x${n.toString()}`:n.toString()).join(" ");return this.wrapped?`(${r})`:`${r}`}isTrue(r){let n=`(${this.children.map(i=>i instanceof ge?i.resolve(r):i.toString()).join(" ")})`;return Le(`!!(${this.operator?this.operator.toString():""}${n})`)}get flatJoin(){return this.wrapped?this.join??(this.expression instanceof t?this.expression.flatJoin:[]):[...this.expression instanceof t?this.expression.flatJoin:[],...this.join?.flatMap(r=>[{operator:r.operator,expression:r.expression instanceof t?r.expression.expression:r.expression},...r.expression instanceof t?r.expression.flatJoin:[]])??[]]}};var Pi=class extends ge{constructor(r,n,i){super(n);this.value=r;this.docSymbolsMeta={name:`param${i+1}`,kind:wT.SymbolKind.Variable},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}toString(){return this.value}},Gt=class extends ge{constructor(r,n){super();this.functionName=r;this.params=n;this.addChild(r),this.params.forEach(i=>this.addChild(i))}getDocumentSymbols(r){return fe(this.fsPath,r)?[{name:this.functionName.name,kind:wT.SymbolKind.Function,range:ce(this),selectionRange:ce(this),children:this.params.flatMap(n=>n?.getDocumentSymbols(r)??[])}]:[]}toString(){return`${this.functionName.toString()}(${this.params.map(r=>r?.toString()??"").join(", ")})`}isTrue(r){if(this.functionName.name==="defined"){let n=!!(this.params.length===1&&this.params[0]&&r.has(this.params[0].value));return this.operator?Le(`!!(${this.operator}${n})`):n}return super.isTrue(r)}};var Zn=q(U());var Lw=q(U());var Iw=q(U());var ne=class extends te{constructor(r,n){super(n);this.value=r;this.semanticTokenType="string",this.semanticTokenModifiers="declaration",this.docSymbolsMeta={name:this.value,kind:Iw.SymbolKind.String}}toString(){return`"${this.value.toString()}"`}toJson(){return this.value}serialize(){return{type:"STRING",value:this.value,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var xw=q(U());var Ow=q(U());var ir=class extends ge{constructor(r,n,i=10){super(n);this.value=r;this.radix=i;this.docSymbolsMeta={name:this.value.toString(),kind:Ow.SymbolKind.Number},this.semanticTokenType="number",this.semanticTokenModifiers="declaration"}resolve(r){return this.value.toString()}evaluate(r){return this.value}isTrue(r){return!!this.value}toString(r){return this.value.toString(r??this.radix)}toJson(){return this.value}toPrettyString(r){let n=this.value;return this.radix===16?`0x${n.toString(16)} /* ${typeof n=="number"?`${n.toString(10)}`:""} */`:`${n.toString(10)} /* ${typeof n=="number"?`0x${n.toString(16)}`:""} */`}serialize(){return{type:"NUMBER_VALUE",value:`${this.radix===16?"0x":""}${this.toString()}`,evaluated:this.value,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var ut=class extends te{constructor(r){super();this.values=r;this.docSymbolsMeta={name:"Cell Array",kind:xw.SymbolKind.Array},this.values.forEach(n=>this.addChild(n))}toString(){return`<${this.values.map(r=>r.toString()).join(" ")}>`}toPrettyString(r){return`<${this.values.map(n=>n.toPrettyString(r)).join(" ")}>`}toJson(){if(this.values.length===1)return this.values[0].value?.toJson();if(this.values.length===2&&this.values.every(r=>r.value instanceof ir)){let r=new ArrayBuffer(8),n=new DataView(r);return this.values.map(i=>i.value.value).forEach((i,s)=>{n.setUint32(s*4,i)}),n.getBigUint64(0)}return this.values.map(r=>r.value?.toJson()??NaN)}serialize(r){return{type:"ARRAY_VALUE",value:this.values.map(n=>n.value?.serialize(r)??null),url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var Mw=q(U());var Lr=class extends te{constructor(r){super();this.values=r;this.docSymbolsMeta={name:"Byte String Value",kind:Mw.SymbolKind.Array},this.values.forEach(n=>this.addChild(n))}toString(){return`[${this.values.map(r=>r.toString(16).padStart(2,"0")).join(" ")}]`}toJson(){return this.values.map(r=>r.value?.toJson()??NaN)}serialize(){return{type:"BYTESTRING",values:this.values.map(r=>r.value?.serialize()??null),url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var Qe=class extends te{constructor(r,n){super(n);this.name=r;this.semanticTokenType="property",this.semanticTokenModifiers="declaration"}toString(){return this.name}serialize(){return{value:this.name,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}},Ee=class extends te{constructor(r,n=[]){super();this.propertyName=r;this.labels=n;this._values=void 0;this.docSymbolsMeta={name:this.propertyName?.name??"Unknown",kind:Lw.SymbolKind.Property},this.labels.forEach(i=>this.addChild(i)),this.addChild(r)}set values(r){if(this._values)throw new Error("Only one property name is allowed");this._values=r,this.addChild(r)}get values(){return this._values}get quickValues(){return this.values?.values.map(r=>r?r.value instanceof ne?r.value.value:r.value instanceof ut?r.value.values.map(n=>n.value instanceof ir?n.value.value:NaN):r.value instanceof Lr?r.value.values.map(n=>n.value?.value??NaN):NaN:null)}getFlatAstValues(){return this.values?.values.flatMap(r=>r?r.value instanceof ne?r.value:r.value instanceof ut?r.value.values.map(n=>n.value):r.value instanceof Lr?r.value.values.map(n=>n.value):r.value:null)}toString(){return`${this.propertyName?.toString()??"__UNSET__"}${this.assignOperatorToken?` = ${this._values?.values.map(r=>r?.toString()??"NULL").join(", ")??"NULL"}`:""};`}toPrettyString(r,n){return`${this.propertyName?.toString()??"__UNSET__"}${this.assignOperatorToken?` = ${this._values?.values.map(i=>i?.toPrettyString(r)??"NULL").join(n?`,
183
- ${" ".repeat(n)}`:", ")??"NULL"}`:""};${ki(this.fsPath)?" /* default value from binding */":""}`}serialize(r){return{name:this.propertyName?.serialize()??null,values:this.values===void 0?void 0:this.values?.values.map(n=>n?.value?.serialize(r)??null)??null,url:this.serializeURL,range:this.range,issues:[...this.serializeIssues,...this.values?.issues.map(n=>n())??[]]}}};var qw=q(U());var pr=class extends te{constructor(r,n){super();this.keyword=n;this.addChild(n),this.docSymbolsMeta={name:r,kind:qw.SymbolKind.Function}}};var Qr=class extends pr{constructor(r){super("Delete Node",r);this._nodeNameOrRef=null}set nodeNameOrRef(r){if(this._nodeNameOrRef)throw new Error("Only one property name is allowed");this._nodeNameOrRef=r,this.addChild(r)}get nodeNameOrRef(){return this._nodeNameOrRef}};var dt=class extends pr{constructor(r){super("Delete Property",r);this._propertyName=null}set propertyName(r){if(this._propertyName)throw new Error("Only only property name is allowed");this._propertyName=r,this.addChild(r)}get propertyName(){return this._propertyName}};var $w=q(U());var ie=class extends te{constructor(r){super();this.label=r;this.docSymbolsMeta={name:`&${this.label?.value??"NULL"}`,kind:$w.SymbolKind.Key},this.addChild(r)}get value(){return this.label?.value}toString(){return`&${this.label?.value??"NULL"}`}toJson(){return-1}serialize(){return{type:"LABEL_REF",label:this.label?.toString()??null,nodePath:this.linksTo?.pathString??null,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var De=class t extends te{constructor(){super()}get path(){if(!this.pathName)return["__UNDEFINED__"];if(!this.parentNode||this instanceof nt)return[this.pathName];if(!(this.parentNode instanceof t))return;let e=this.parentNode.path;return e?[...e,this.pathName]:[this.pathName]}get pathName(){}get nodes(){return this.children.filter(e=>e instanceof t)}get deleteNodes(){return this.children.filter(e=>e instanceof Qr)}addNodeChild(e){this.addChild(e)}},nt=class extends De{constructor(){super(),this.docSymbolsMeta={name:"/",kind:Zn.SymbolKind.Class}}get properties(){return this.children.filter(e=>e instanceof Ee)}#e;get name(){return this.#e??=new je("/",me(this.firstToken)),this.#e}get identifierAst(){return this.name}get deleteProperties(){return this.children.filter(e=>e instanceof dt)}get nodes(){return this.children.filter(e=>e instanceof Ce)}get pathName(){return"/"}serialize(e){return{type:"ROOT",properties:this.properties.map(r=>r.serialize(e)),nodes:this.nodes.map(r=>r.serialize(e)),url:this.serializeURL,range:this.range,issues:this.serializeIssues,scopeOpen:this.openScope&&se(this.openScope),scopeClose:this.closeScope&&se(this.closeScope,!1)}}},ot=class extends De{constructor(r=[]){super();this.labels=r;this._reference=null;this.docSymbolsMeta={name:"DTC Name",kind:Zn.SymbolKind.Class},r.forEach(n=>{super.addChild(n)})}get serializeIssues(){return[...this.issues,...this.reference?.issues??[]].map(r=>r())}get identifierAst(){return this.reference}set reference(r){if(this._reference)throw new Error("Only on label reference is allowed");this._reference=r;let n;r instanceof ie?n=r.value:n=r?.path?.pathParts.at(-1)?.name??"DTC Name",this.docSymbolsMeta={name:n??"DTC Name",kind:Zn.SymbolKind.Class},this.addChild(r)}get path(){return this.resolveNodePath?this.resolveNodePath:super.path}get reference(){return this._reference}get nodes(){return this.children.filter(r=>r instanceof Ce)}get pathName(){if(this.reference instanceof ie&&this.reference.label?.value)return`&${this.reference.label.value}`}get properties(){return this.children.filter(r=>r instanceof Ee)}get deleteProperties(){return this.children.filter(r=>r instanceof dt)}serialize(r){return{type:"REF",labels:this.labels.map(n=>n.serialize(r)),name:this.reference?.serialize()??null,properties:this.properties.map(n=>n.serialize(r)),nodes:this.nodes.map(n=>n.serialize(r)),url:this.serializeURL,range:this.range,issues:this.serializeIssues,scopeOpen:this.openScope&&se(this.openScope),scopeClose:this.closeScope&&se(this.closeScope,!1)}}},Ce=class t extends De{constructor(r=[],n){super();this.labels=r;this.omitIfNoRef=n;this._name=null;this.docSymbolsMeta={name:"DTC Name",kind:Zn.SymbolKind.Class},n&&this.addChild(n),r.forEach(i=>{this.addChild(i)})}get identifierAst(){return this.name}get serializeIssues(){return[...this.issues,...this.name?.issues??[]].map(r=>r())}set name(r){if(this._name)throw new Error("Only on label reference is allowed");this._name=r,this.docSymbolsMeta={name:this._name?.toString()??"DTC Name",kind:Zn.SymbolKind.Class},this.addChild(r)}get name(){return this._name}get nodes(){return this.children.filter(r=>r instanceof t)}get pathName(){return this._name?.toString()}get properties(){return this.children.filter(r=>r instanceof Ee)}get deleteProperties(){return this.children.filter(r=>r instanceof dt)}serialize(r){return{type:"CHILD",labels:this.labels.map(n=>n.serialize(r)),name:this.name?.serialize()??null,properties:this.properties.map(n=>n.serialize(r)),nodes:this.nodes.map(n=>n.serialize(r)),url:this.serializeURL,range:this.range,issues:this.serializeIssues,scopeOpen:this.openScope&&se(this.openScope),scopeClose:this.closeScope&&se(this.closeScope,!1)}}},Yc=class extends te{constructor(r,n){super(n);this.address=r;this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}toString(){return this.address?.map((r,n)=>r.toString(16).padStart(n?8:0,"0")).join("")??"NaN"}serialize(){return{address:this.address,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}},je=class extends te{constructor(r,n,i){super(n);this.name=r;this._address=i;this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}get value(){return this.name}get address(){return this._address}set address(r){if(this._address)throw new Error("Address can only be set once");r&&(this.lastToken=void 0,this._address=r,r.forEach(n=>this.addChild(n)))}get fullAddress(){return this._address?[...this._address.flatMap(r=>r.address)]:void 0}toString(){return this._address!==void 0?`${this.name}@${this._address.map(r=>r.toString()).join(",")}`:this.name}buildSemanticTokens(r){let n=this.firstToken;if(!n.value)return;let i={...n,pos:{...n.pos,len:this.name.length}};r(Gi("type"),Yi("declaration"),i,i),this.address!==void 0&&this.address.forEach(s=>{r(Gi("decorator"),Yi("declaration"),s.firstToken,s.lastToken),s.buildSemanticTokens(r)})}get serializeIssues(){return[...this.issues,...this._address?.flatMap(r=>r.issues)??[]].map(r=>r())}serialize(){let r=this.firstToken;return{fullName:this.toString(),name:{name:this.name,url:this.serializeURL,range:Zn.Range.create(Zn.Position.create(r.pos.line,r.pos.col),Zn.Position.create(r.pos.line,r.pos.colEnd)),issues:this.serializeIssues},address:this.address?.map(n=>n.serialize())??null,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var sr=(t,e,r=!0,n=!0)=>({start:{line:t?.pos.line??0,character:r?t?.pos.col??0:(t?.pos.col??0)+(t?.pos.len??0)},end:{line:e?.pos.line??0,character:n?(e?.pos.col??0)+(e?.pos.len??0):e?.pos.col??0}});var se=(t,e=!0)=>Yt.Position.create(t.pos.line,e?t.pos.colEnd:t.pos.col),ce=t=>sr(t.firstToken,t.lastToken),Gi=t=>Wc.findIndex(e=>e===t),Yi=t=>zc.findIndex(e=>e===t),Ss=(t,e,r)=>!fe(t.fsPath,e)||r.line<t.pos.line?!1:r.line>t.pos.line?!0:r.character>=t.pos.colEnd,CT=(t,e,r)=>fe(t.fsPath,e)?r.line<t.pos.line?!0:r.line>t.pos.line?!1:r.character<t.pos.col:!1,Qt=(t,e,r)=>{let n=t.firstToken,i=t.lastToken;return!!((n.pos.line<r.line||n.pos.line===r.line&&n.pos.col<=r.character)&&(i.pos.line>r.line||i.pos.line===r.line&&i.pos.colEnd>=r.character)&&fe(t.fsPath,e))},po=(t,e)=>{let r=(i,s)=>i.line<s.line||i.line===s.line&&i.character<=s.character,n=(i,s)=>i.line>s.line||i.line===s.line&&i.character>=s.character;return r(t.start,e.start)&&n(t.end,e.end)},jw=(t,e,r)=>{let n=t.firstToken,i=t.lastToken;return!!(t.lastToken.value!==";"&&(n.pos.line===r.line||i.pos.line===r.line)&&r.character>=i.pos.colEnd&&fe(t.fsPath,e))},Uw=(t,e,r)=>{if(!t)return!1;let i=t.filter(s=>s.pos.line===r.line).at(-1);return i&&i.pos.col>=r.character?!1:e.lastToken===i};var ti=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].reverse().find(s=>Qt(s,e,r));return n},Kc=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].find(s=>CT(s.lastToken,e,r));return n===t?void 0:n},Xc=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].reverse().find(s=>Ss(s.firstToken,e,r));return n===t?void 0:n},AT="#virtual",ki=t=>t.includes(AT),Vf=(t,e)=>`${t}?loc=${e.start.line}:${e.start.character}-${e.end.line}:${e.end.character}${AT}`,fr=t=>{if(!ki(t))return;let[e,r]=t.split("?"),[n,i]=r.replace("loc=","").replace(AT,"").split("-"),[s,o]=n.split(":"),[a,c]=i.split(":");return{fsPath:e,range:Yt.Range.create(Yt.Position.create(Number.parseInt(s),Number.parseInt(o)),Yt.Position.create(Number.parseInt(a),Number.parseInt(c)))}},IT=t=>{let e=fr(t.fsPath);e&&(t.range=e.range,t.fsPath=e?.fsPath,t.virtual=!0,t.linkedTo=t.linkedTo.map(({range:r,fsPath:n})=>{let i=fr(n);return{range:i?.range??r,fsPath:i?.fsPath??n,templateStrings:[]}}))},Y=(t,e,r=e,n,{severity:i=Yt.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l,inclusiveStart:u,inclusiveEnd:d}={severity:Yt.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[]})=>{let f={issues:Array.isArray(t)?t:[t],range:sr(e,r,u,d),fsPath:e.fsPath,severity:i,linkedTo:s.map(({range:h,fsPath:y})=>{let S=fr(y);return S?{...S,templateStrings:[]}:{range:h,fsPath:y,templateStrings:[]}}),tags:o,templateStrings:a,edit:c,codeActionTitle:l};IT(f);let p,m=()=>(p??={severity:f.severity,range:f.range,message:f.issues?f.issues.map(UH).join(" or "):"",source:"devicetree",tags:f.tags,data:{firstToken:{pos:e.pos,tokens:e.tokens,value:e.value},lastToken:{pos:r.pos,tokens:r.tokens,value:r.value},type:"SyntaxIssue",items:f.issues,edit:f.edit,codeActionTitle:f.codeActionTitle,virtual:!!f.virtual}},p);return n?.syntaxIssues.push(m),{raw:f,diagnostic:m}},Bt=(t,e,r,n,{severity:i=Yt.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l,linkedToTemplateStrings:u=[]}={severity:Yt.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[],linkedToTemplateStrings:[]})=>{let d={issues:Array.isArray(t)?t:[t],range:sr(e,r),fsPath:e.fsPath,severity:i,linkedTo:s.map(({range:m,fsPath:h},y)=>{let S=fr(h);return S?{...S,templateStrings:[]}:{range:m,fsPath:h,templateStrings:u.at(y)??[]}}),tags:o,templateStrings:a,edit:c,codeActionTitle:l};IT(d);let f,p=()=>(f??={severity:d.severity,range:d.range,message:HH(d),source:"devicetree",tags:d.tags,relatedInformation:[...d.linkedTo.map(m=>({message:d.issues.map(h=>VH(h,m.templateStrings)).join(" or "),location:{uri:ue(m.fsPath),range:m.range}}))]},f);return n?.resettableIssues.push(p),{raw:d,diagnostic:p}},x=(t,e,r,n,{severity:i=Yt.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l}={severity:Yt.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[]})=>{let u={issues:Array.isArray(t)?t:[t],range:sr(e,r),severity:i,fsPath:e.fsPath,linkedTo:s.map(({range:p,fsPath:m})=>{let h=fr(m);return h?{...h,templateStrings:[]}:{range:p,fsPath:m,templateStrings:[]}}),tags:o,templateStrings:a,edit:c,codeActionTitle:l};IT(u);let d,f=()=>(d??={severity:u.severity,range:u.range,message:WH(u),relatedInformation:[...u.linkedTo.map(p=>({message:u.issues.map(zH).join(" or "),location:{uri:ue(p.fsPath),range:p.range}}))],source:"devicetree",tags:u.tags,data:{type:"StandardTypeIssue",firstToken:{pos:e.pos,tokens:e.tokens,value:e.value},lastToken:{pos:r.pos,tokens:r.tokens,value:r.value},edit:u.edit,codeActionTitle:u.codeActionTitle,items:u.issues,virtual:!!u.virtual}},d);return Array.isArray(n)?n.forEach(p=>p.resettableIssues.push(f)):n?.resettableIssues.push(f),{raw:u,diagnostic:f}};function ze(t,e,r,{severity:n=Yt.DiagnosticSeverity.Warning,linkedTo:i=[],tags:s,templateStrings:o=[],edit:a,codeActionTitle:c}={severity:Yt.DiagnosticSeverity.Warning,linkedTo:[],templateStrings:[],edit:[],codeActionTitle:void 0},l=r){let u={issues:Array.isArray(t)?t:[t],range:Yt.Range.create(r,l),severity:n,fsPath:e,linkedTo:i.map(({range:p,fsPath:m})=>({range:p,fsPath:m,templateStrings:[]})),tags:s,templateStrings:o,edit:a,codeActionTitle:c,virtual:ki(e)},d;return{raw:u,diagnostic:()=>(d??={severity:u.severity,range:u.range,message:GH(u),relatedInformation:[...u.linkedTo.map(p=>({message:u.issues.map(YH).join(" or "),location:{uri:ue(p.fsPath),range:p.range}}))],source:"devicetree",tags:u.tags,data:{type:"FormattingIssues",items:u.issues,edit:u.edit,codeActionTitle:u.codeActionTitle,virtual:!!u.virtual}},d)}}var Hw=(t,e)=>[...t].sort((n,i)=>{let s=e.getSortKey(n),o=e.getSortKey(i);if(s===void 0||o===void 0)throw new Error("Sort keys must be set");if(s!==o)return s-o;let a=n.lastToken,c=i.lastToken;return a.pos.line!==c.pos.line?a.pos.line-c.pos.line:a.pos.col-c.pos.col});async function Et(t,e,r){let n=Ne(t.textDocument.uri);if(!e)return[];let i=performance.now(),s=await e.getRuntime(),o,a,c=s.context.allParsers.flatMap(u=>u.injectedMacros).find(u=>Qt(u,n,t.position));return c&&(o={runtime:s,item:null,ast:ti(c,n,t.position)},a=Number.MAX_SAFE_INTEGER),o||(o=s.getDeepestAstNode(n,t.position),a=e.getSortKey(o?.ast)??e.getSortKeyFile(t.position,n)),console.log(`search: ${performance.now()-i}ms`),r(o,u=>{let d=t.position;if(fe(u.fsPath,n)){let f=u.lastToken;return f.pos.line<d.line||f.pos.line===d.line&&f.pos.colEnd<=d.character}return a!==void 0&&(e.getSortKey(u)??-1)<=a})}function me(t,e){return{start:t,end:e??t}}var H=(t,e)=>t?.tokens.some(r=>r===e),at=(t,e)=>r=>r?.value&&(e?.caseInsensitive?t.toLowerCase()===r.value.toLowerCase():t===r.value)?"yes":e?.allowPartial?FH(t)(r):"no",Ue=t=>e=>e?.tokens.some(r=>r===t)?"yes":"no",FH=t=>e=>e?.value&&t.startsWith(e.value)?"partial":"no",hr=(t,e)=>!!t&&!!e&&t.pos.line===e.pos.line&&fe(t.fsPath,e.fsPath),Kt=(t,e)=>t?.tokens[0]===21&&e?.tokens[0]===21&&(t?.prevToken&&t.prevToken.value===e?.value||e?.prevToken&&e.prevToken.value===t?.value)?!0:!!t&&!!e&&t.pos.colEnd===e.pos.col&&hr(t,e),Wf=t=>t.map((e,r)=>({index:r,context:e,files:e.getContextFiles()})),Er=(t,e,r,n)=>{if("id"in e){let s=t?.find(o=>o.id===e.id);return s||void 0}if("name"in e){let s=t?.find(o=>o.ctxNames.includes(e.name));return s||void 0}return r?.getContextFiles().find(s=>fe(s,e.fsPath))?r:Wf(t).sort(s=>s.context.id===n?-1:0).find(s=>s.files.some(o=>fe(o,e.fsPath)))?.context},OT=(t,e)=>Wf(t).filter(n=>n.files.some(i=>fe(i,e))).map(n=>n.context),Vw=t=>{let e=/^(\w+)\s+(.*)$/,r=/^(\w+)\(([^)]*)\)\s+(.*)$/,n=/^(\w+)\(([^)]*),\s*\.\.\.\)\s+(.*)$/,i;if(i=n.exec(t)){let[,,s,o]=i,a=s.split(",").map(c=>c.trim());return(...c)=>{let l=o,u=c.slice(a.length).join(", ");return a.forEach((d,f)=>{l=l.replace(new RegExp(`(?<!#)#\\s*${d}\\b`,"g"),`"${c[f]??""}"`)}),l=l.replace(/(?<!#)#\s*__VA_ARGS__/g,`"${u}"`),a.forEach((d,f)=>{let p=new RegExp(`\\b${d}\\b`,"g");l=l.replace(p,c[f]??"")}),l=l.replace(/__VA_ARGS__/g,u),l}}else if(i=r.exec(t)){let[,,s,o]=i,a=s.split(",").map(c=>c.trim());return(...c)=>{let l=o;return a.forEach((u,d)=>{l=l.replace(new RegExp(`(?<!#)#\\s*${u}\\b`,"g"),`"${c[d]??""}"`)}),a.forEach((u,d)=>{let f=new RegExp(`\\b${u}\\b`,"g");l=l.replace(f,c[d]??"")}),l}}else if(i=e.exec(t)){let[,,s]=i;return s.trim()}};function BH(t){if(!t.trim())return[];let e=[],r="",n=0;for(let i=0;i<t.length;i++){let s=t[i];s===","&&n===0?(e.push(r.trim()),r=""):(s==="("?n++:s===")"&&n--,r+=s)}return r.trim()&&e.push(r.trim()),e}var jH=0,Gc=(t,e)=>{let r=s=>s.replace(/\s*##\s*/g,""),n=t,i;do i=n,n=r(i),n=n.replace(/\b(\w+)\(([^()]*(?:\([^()]*\)[^()]*)*)\)|\b(\w+)\b/g,(s,o,a,c)=>{if(o==="defined"){let l=a.split(",").map(u=>u.trim());return l[0]?e.get(l[0])?.resolver:l}else if(o&&typeof e.get(o)?.resolver=="function"){let l=BH(a).map(u=>u.trim()).map(u=>u==="__COUNTER__"?(jH++).toString():u).map(u=>Gc(u,e));return(e.get(o)?.resolver)(...l)}else if(c&&typeof e.get(c)?.resolver=="string")return e.get(c)?.resolver;return s});while(n!==i);return n};function xT(t){return t.replace(/'(.)'/g,(e,r)=>r.charCodeAt(0).toString()).replace(/(0x[a-f\d]+|\d+)[ul]*/gi,"$1")}function Le(t){try{return(0,eval)(xT(t))}catch{}return t}var ue=t=>DT.default.pathToFileURL(t).toString(),Ne=t=>ft(DT.default.fileURLToPath(t)),Ww=(t,e)=>{let r=(0,va.relative)(t,e);return!!r&&!r.startsWith("..")&&!(0,va.isAbsolute)(r)},fe=(t,e)=>!t||!e?!1:t===e,ft=t=>(0,va.normalize)(process.platform==="win32"?t.toLowerCase():t),Ki=t=>(0,Bw.createHash)("sha256").update([ft(t.dtsFile),...t.includePaths.map(ft),...t.overlays.map(ft),t.bindingType,...t.zephyrBindings.map(ft),...t.deviceOrgBindingsMetaSchema.map(ft),...t.deviceOrgTreeBindings.map(ft),`showFormattingErrorAsDiagnostics-${t.showFormattingErrorAsDiagnostics}`,`disableFileWatchers-${t.disableFileWatchers}`].join(":")).digest("hex"),UH=t=>{switch(t){case 0:return"Expected value";case 1:return"Expected ';'";case 2:return"Expected '{'";case 3:return"Expected '}'";case 4:return"Expected '['";case 5:return"Expected ']'";case 12:return"Expected '>'";case 13:return"Expected '<'";case 16:return`Expected '"'`;case 17:return`Expected "'"\\`;case 24:return"Missing ':'";case 21:return"Missing '/'";case 26:return'Expected ")"';case 28:return'Missing ","';case 6:return"Expected property name";case 7:return"Expected node name";case 49:return"Node name shall start with a lower or upper case character";case 50:return"Node unit address should not start with 0x";case 51:return"Node unit address should not end with with ULL";case 8:return"Expected node address";case 9:return"Expected node path";case 48:return"Expected node path reference";case 10:return"Expected node reference";case 11:return"Expected root node name";case 14:return"Expected bytestring";case 15:return"Expected two digits for each byte in bytestring";case 20:return"Hex values are not allowed";case 18:return"Expected label name";case 19:return"Expected '/' at the start of a node path";case 23:return"Found ';' without a statement";case 25:return"Did you mean /delete-node/ or /delete-property/?";case 34:return"Did you mean /delete-node/?";case 35:return"Did you mean /delete-property/?";case 22:return"Unknown syntax";case 27:return"Expected expression";case 31:return"Expected macro identifier";case 30:return"Expected macro identifier or function like macro";case 29:return"White space is not allowed";case 32:return"Properties can only be defined in a node";case 53:return"Node name syntax can only be used inside a node definition.";case 33:return"Properties can only be deleted inside a node";case 36:return"Unable to resolve include";case 52:return"Unknown Node Address syntax";case 37:return"Expected start address";case 38:return"Expected end address";case 39:case 40:return"Expected 8|16|32|64";case 42:return"Unknown macro name";case 43:return"Expected function like macro";case 44:return"Macro expects less arguments";case 45:return"Macro expects more arguments";case 46:return"Missing #ENDIF";case 47:return"Block Unused";case 41:return"This syntax is not officially part of the DTS V0.4 standard"}},HH=t=>t.issues.map(e=>{switch(e){case 0:return`Property "${t.templateStrings[0]}" is replaced by a later definition`;case 1:return"Cannot delete a property before it has been defined";case 2:return"Node name already defined";case 5:return"Cannot delete a node before it has been defined";case 3:return`No node with that reference "${t.templateStrings[0]}" has been defined`;case 8:return`No node with name "${t.templateStrings[0]}" could be found in "/${t.templateStrings[1]}".`;case 4:return`Label name "${t.templateStrings[0]}" already defined`;case 6:return`Property "${t.templateStrings[0]}" was deleted`;case 7:return`Node "${t.templateStrings[0]}" was deleted`;case 9:return`The following node "${t.templateStrings[1]}" shall be present in "${t.templateStrings[0]}" node.`;case 10:return`The following node "${t.templateStrings[0]}" address range collides with another node. Address start: "${t.templateStrings[1]}", end: "${t.templateStrings[2]}".`;case 11:return`The following file "${t.templateStrings[0]}" has already been included in ${t.templateStrings[1]}.`}}).join(" or "),VH=(t,e)=>{switch(t){case 0:return"Property name already defined.";case 2:return"Defined here";case 4:return"Defined here";case 7:case 6:return"Deleted here";case 9:return"Node";case 10:return`Node "${e[0]}". Address start: "${e[1]}", end: "${e[2]}".`;case 11:return"Include";default:return"TODO"}},WH=t=>t.issues.map(e=>{switch(e){case 9:return`Only these value are allowed ${t.templateStrings[0]}`;case 1:return"INTRO should be empty";case 8:return"INTRO can only be assigned one value";case 5:return"INTRO should be assigned a U32";case 6:return"INTRO should be assigned a U64";case 7:return"INTRO should be assigned a 'property encoded array'";case 2:return"INTRO should be assigned a string";case 3:return"INTRO should be assigned a string list";case 4:return`INTRO expects ${t.templateStrings[1]} values`;case 0:return"INTRO is required";case 11:return"INTRO should be omitted";case 27:return"INTRO name is not permitted under this node";case 34:return"INTRO name is not defined in the type binding for this node";case 10:return"INTRO address value must match node address";case 12:return"INTRO should be 'cpu'";case 13:return"INTRO should be 'memory'";case 14:return"INTRO is deprecated and should not be used'";case 15:return`INTRO ${t.templateStrings[1]}'`;case 18:return"INTRO value must be unique in the entire Devicetree";case 19:return`INTRO should have format ${t.templateStrings[1]}`;case 16:return`INTRO requires property "${t.templateStrings[1]}" in node path "${t.templateStrings[2]}"`;case 17:return"Unable to resolve interrupt parent node";case 20:return`INTRO should have format ${t.templateStrings[1]}`;case 21:return"Node is disabled";case 22:return"Unable to resolve handle";case 23:return`Unable to find "${t.templateStrings[0]}" in ${t.templateStrings[1]}`;case 24:return t.templateStrings[0];case 25:return t.templateStrings[0];case 26:return t.templateStrings[0];case 28:return t.templateStrings[0];case 35:return"Unable to find mapping range for address";case 29:return`INTRO exceeds address space available for this mapping. The range ends at ${t.templateStrings[2]}, the node ends at ${t.templateStrings[1]}`;case 30:return"Map entry overlaps with others entries";case 31:return"Unable to match to a nexus map entry";case 32:return`Unknown node type "${t.templateStrings[0]}"`;case 33:return`Missing name for "${t.templateStrings[0]}" index ${t.templateStrings[1]}"`;case 36:return"Node address is missing";case 37:return`Binding must be used on bus type${t.templateStrings.length?"s":""}: ${t.templateStrings.join(" or ")}`;case 38:return"Empty ranges property should only be used when #address-cells is identical to parent node #address-cells";case 39:return'The value should be one of the following: "spin-table" or "[vendor],[method]"';case 40:return'The value should match "[vendor],[method]"';case 41:return`Value must not be be less than ${t.templateStrings[0]}`;case 42:return`Value must not be greater than ${t.templateStrings[0]}`;case 44:return`Assignment exceeds max-len of ${t.templateStrings[1]} for property "${t.templateStrings[0]}"`;case 43:return`INTRO has missing values. It must have a minimum of ${t.templateStrings[1]} ${t.templateStrings[1]==="1"?"entry":"entries"}`}}).join(" or ").replace("INTRO",`Property "${t.templateStrings[0]}"`).replaceAll("INTRO ",""),zH=t=>{switch(t){case 16:case 0:return"Node";case 15:return"Ignored reason";case 18:return"Conflicting properties";case 8:return"Additional value";case 21:return"Disabled by";case 29:return"Mapping range";case 30:return"Map entry";case 31:return"Nexus map entries";case 33:return"Names property";case 35:return"Range property";default:return"TODO"}},GH=t=>t.issues.map(e=>{switch(e){case 4:return"Add end of line to end of file";case 1:return`${t.codeActionTitle}. Expecting ${t.templateStrings[0]}.`;case 0:return"Move to a new line";case 3:return"Remove trailing whitespace at the end of file.";case 2:return"Remove trailing whitespace at the end of the line.";case 5:return`Fix indentation. ${t.templateStrings.at(0)?.length===0?"No indentation expected":`Expecting ${t.templateStrings[0]}`}`;case 6:return`Move token "${t.templateStrings[0]}" next to expression`;case 7:return"Remove (...) enclosure. This expression should only be enclosed in the #define of the macro";case 8:return`Line is too long. ${t.codeActionTitle}`;case 9:return`Hex values must be lowercase. ${t.codeActionTitle}`;case 10:return"Node address is already a hex value. Remove '0x'.";case 11:return"Node address size is determined by '@size-cells', Remove 'ull'.";case 12:return`'\\' is not necessary. ${t.codeActionTitle}`;case 13:return`Node does not contribute anything. ${t.codeActionTitle}`;case 14:return`Property is redefined in same closure. ${t.codeActionTitle}`;case 15:return`${t.codeActionTitle}`}}).join(" or "),YH=t=>"TODO";var qt=(t,e)=>{let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let i=t[t.length-r+n]??0,s=e[e.length-r+n]??0;if(i<s)return-1;if(i>s)return 1}return 0},ei=(t,e)=>{let r=Math.max(t.length,e.length),n=new Array(r).fill(0),i=0;for(let s=0;s<r;s++){let o=t[t.length-1-s]??0,a=e[e.length-1-s]??0,c=o+a+i;n[r-1-s]=c>>>0,i=c>4294967295?1:0}return i&&n.unshift(1),n},KH=(t,e)=>{let r=Math.max(t.length,e.length),n=new Array(r).fill(0),i=0;for(let s=0;s<r;s++){let o=t[t.length-1-s]??0,a=e[e.length-1-s]??0;o-=i,o<a?(o+=4294967296,i=1):i=0,n[r-1-s]=o-a>>>0}for(;n.length>1&&n[0]===0;)n.shift();return n},XH=(t,e)=>ei(t,e),zw=(t,e)=>{let r=[];for(let n of t){let i=n.childAddress,s=n.length,o=ei(i,s);if(qt(e,i)>=0&&qt(e,o)<0){let a=KH(e,i),c=n.parentAddress,l=XH(c,a),u=ei(c,s);r.push({start:l,end:u,range:sr(n.rangeTokens.start,n.rangeTokens.end),fsPath:n.rangeTokens.start.fsPath})}}return r};function Gw(t){return Array.isArray(t)&&Array.isArray(t[0])}function Jc(t){return!t||t instanceof Gt?t:Jc(t.parentNode)}function Zr(t,e){let r=e.filter(n=>!n.raw.virtual).flatMap(n=>n.raw.edit).filter(n=>!!n);return MT(t,r)}function MT(t,e){let r=t.getText(),n=e.slice().sort((s,o)=>{let a=t.offsetAt(s.range.start),c=t.offsetAt(o.range.start);if(a!==c)return c-a;let l=t.offsetAt(s.range.end),u=t.offsetAt(o.range.end);if(l!==u)return u-l;let d=a===l&&s.newText.length>0,f=c===u&&o.newText.length>0;return d!==f?d?1:-1:0}),i=r;for(let s of n){let o=t.offsetAt(s.range.start),a=t.offsetAt(s.range.end);i=i.slice(0,o)+s.newText+i.slice(a)}return i}function Fw(t,e){return t.line<e.line?-1:t.line>e.line?1:t.character<e.character?-1:t.character>e.character?1:0}function Yw(t,e){return Fw(t.end,e.start)>0&&Fw(t.start,e.end)<0}var Kw=(t,e)=>{let r=Xw(t,e),n=Jw(t,e);r&&(t.topComment=r),n&&(t.endComment=n)},Xw=(t,e)=>{let r=e.find(i=>!i.disabled&&i.lastToken===t.firstToken.prevToken&&(i.lastToken.pos.line===t.firstToken.pos.line||i.lastToken.pos.line+1===t.firstToken.pos.line));if(!r||r.astBeforeComment)return;r.astAfterComment=t;let n=Xw(r,e);return n&&(n.astAfterComment=t,r.astAfterComment=void 0),n??r},Jw=(t,e)=>{let r=e.find(i=>!i.disabled&&i.firstToken.prevToken===t.lastToken&&i.firstToken.pos.line===t.lastToken.pos.line);if(!r)return;r.astBeforeComment=t;let n=Jw(r,e);return n&&(n.astBeforeComment=t,r.astBeforeComment=void 0),n??r},ho=(t,e,r)=>{let n=[42,44,45,36];return r||n.push(52,32,53,8,49),t.severity===Yt.DiagnosticSeverity.Error&&fe(t.fsPath,e)&&!n.some(i=>t.issues.includes(i))};function zf(t){let e=t?.charAt(0);return!!e&&(e>="A"&&e<="Z"||e>="a"&&e<="z")}var ba=t=>{if(t)return t instanceof De?t:ba(t?.parentNode)},Sa=(t,e,r=0)=>{if(!e||!e.parentNode?.fsPath)return r;let n=ba(e.parentNode);return Sa(t,n,r+1)};function Qw(t,e,r,n){let i=r-e,s=n.length,o=t.length-i+s,a=new Array(o),c=0;for(let l=0;l<e;l++,c++)a[c]=t[l];for(let l=0;l<s;l++,c++)a[c]=n[l];for(let l=r;l<t.length;l++,c++)a[c]=t[l];return a}function _s(t){return t?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):""}function Gf(t,e,r,n,i){let s=e.closeScope?.prevToken??e.lastToken.prevToken;if(!s)return;let o="";switch(n.types[0]){case"U32":case"U64":case"PROP_ENCODED_ARRAY":o=` = <${r==="reg"&&t.address?t.address.map(a=>`0x${a.toString(16)}`).join(" "):""}>`;break;case"STRING":case"STRINGLIST":o=' = ""';break;case"BYTESTRING":o=" = []";break}return Yt.TextEdit.insert(Yt.Position.create(s.pos.line,s.pos.col+1),`
183
+ ${" ".repeat(n)}`:", ")??"NULL"}`:""};${ki(this.fsPath)?" /* default value from binding */":""}`}serialize(r){return{name:this.propertyName?.serialize()??null,values:this.values===void 0?void 0:this.values?.values.map(n=>n?.value?.serialize(r)??null)??null,url:this.serializeURL,range:this.range,issues:[...this.serializeIssues,...this.values?.issues.map(n=>n())??[]]}}};var qw=q(U());var pr=class extends te{constructor(r,n){super();this.keyword=n;this.addChild(n),this.docSymbolsMeta={name:r,kind:qw.SymbolKind.Function}}};var Qr=class extends pr{constructor(r){super("Delete Node",r);this._nodeNameOrRef=null}set nodeNameOrRef(r){if(this._nodeNameOrRef)throw new Error("Only one property name is allowed");this._nodeNameOrRef=r,this.addChild(r)}get nodeNameOrRef(){return this._nodeNameOrRef}};var dt=class extends pr{constructor(r){super("Delete Property",r);this._propertyName=null}set propertyName(r){if(this._propertyName)throw new Error("Only only property name is allowed");this._propertyName=r,this.addChild(r)}get propertyName(){return this._propertyName}};var $w=q(U());var ie=class extends te{constructor(r){super();this.label=r;this.docSymbolsMeta={name:`&${this.label?.value??"NULL"}`,kind:$w.SymbolKind.Key},this.addChild(r)}get value(){return this.label?.value}toString(){return`&${this.label?.value??"NULL"}`}toJson(){return-1}serialize(){return{type:"LABEL_REF",label:this.label?.toString()??null,nodePath:this.linksTo?.pathString??null,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var De=class t extends te{constructor(){super()}get path(){if(!this.pathName)return["__UNDEFINED__"];if(!this.parentNode||this instanceof nt)return[this.pathName];if(!(this.parentNode instanceof t))return;let e=this.parentNode.path;return e?[...e,this.pathName]:[this.pathName]}get pathName(){}get nodes(){return this.children.filter(e=>e instanceof t)}get deleteNodes(){return this.children.filter(e=>e instanceof Qr)}addNodeChild(e){this.addChild(e)}},nt=class extends De{constructor(){super(),this.docSymbolsMeta={name:"/",kind:Zn.SymbolKind.Class}}get properties(){return this.children.filter(e=>e instanceof Ee)}#e;get name(){return this.#e??=new je("/",me(this.firstToken)),this.#e}get identifierAst(){return this.name}get deleteProperties(){return this.children.filter(e=>e instanceof dt)}get nodes(){return this.children.filter(e=>e instanceof Ce)}get pathName(){return"/"}serialize(e){return{type:"ROOT",properties:this.properties.map(r=>r.serialize(e)),nodes:this.nodes.map(r=>r.serialize(e)),url:this.serializeURL,range:this.range,issues:this.serializeIssues,scopeOpen:this.openScope&&se(this.openScope),scopeClose:this.closeScope&&se(this.closeScope,!1)}}},ot=class extends De{constructor(r=[]){super();this.labels=r;this._reference=null;this.docSymbolsMeta={name:"DTC Name",kind:Zn.SymbolKind.Class},r.forEach(n=>{super.addChild(n)})}get serializeIssues(){return[...this.issues,...this.reference?.issues??[]].map(r=>r())}get identifierAst(){return this.reference}set reference(r){if(this._reference)throw new Error("Only on label reference is allowed");this._reference=r;let n;r instanceof ie?n=r.value:n=r?.path?.pathParts.at(-1)?.name??"DTC Name",this.docSymbolsMeta={name:n??"DTC Name",kind:Zn.SymbolKind.Class},this.addChild(r)}get path(){return this.resolveNodePath?this.resolveNodePath:super.path}get reference(){return this._reference}get nodes(){return this.children.filter(r=>r instanceof Ce)}get pathName(){if(this.reference instanceof ie&&this.reference.label?.value)return`&${this.reference.label.value}`}get properties(){return this.children.filter(r=>r instanceof Ee)}get deleteProperties(){return this.children.filter(r=>r instanceof dt)}serialize(r){return{type:"REF",labels:this.labels.map(n=>n.serialize(r)),name:this.reference?.serialize()??null,properties:this.properties.map(n=>n.serialize(r)),nodes:this.nodes.map(n=>n.serialize(r)),url:this.serializeURL,range:this.range,issues:this.serializeIssues,scopeOpen:this.openScope&&se(this.openScope),scopeClose:this.closeScope&&se(this.closeScope,!1)}}},Ce=class t extends De{constructor(r=[],n){super();this.labels=r;this.omitIfNoRef=n;this._name=null;this.docSymbolsMeta={name:"DTC Name",kind:Zn.SymbolKind.Class},n&&this.addChild(n),r.forEach(i=>{this.addChild(i)})}get identifierAst(){return this.name}get serializeIssues(){return[...this.issues,...this.name?.issues??[]].map(r=>r())}set name(r){if(this._name)throw new Error("Only on label reference is allowed");this._name=r,this.docSymbolsMeta={name:this._name?.toString()??"DTC Name",kind:Zn.SymbolKind.Class},this.addChild(r)}get name(){return this._name}get nodes(){return this.children.filter(r=>r instanceof t)}get pathName(){return this._name?.toString()}get properties(){return this.children.filter(r=>r instanceof Ee)}get deleteProperties(){return this.children.filter(r=>r instanceof dt)}serialize(r){return{type:"CHILD",labels:this.labels.map(n=>n.serialize(r)),name:this.name?.serialize()??null,properties:this.properties.map(n=>n.serialize(r)),nodes:this.nodes.map(n=>n.serialize(r)),url:this.serializeURL,range:this.range,issues:this.serializeIssues,scopeOpen:this.openScope&&se(this.openScope),scopeClose:this.closeScope&&se(this.closeScope,!1)}}},Yc=class extends te{constructor(r,n){super(n);this.address=r;this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}toString(){return this.address?.map((r,n)=>r.toString(16).padStart(n?8:0,"0")).join("")??"NaN"}serialize(){return{address:this.address,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}},je=class extends te{constructor(r,n,i){super(n);this.name=r;this._address=i;this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}get value(){return this.name}get address(){return this._address}set address(r){if(this._address)throw new Error("Address can only be set once");r&&(this.lastToken=void 0,this._address=r,r.forEach(n=>this.addChild(n)))}get fullAddress(){return this._address?[...this._address.flatMap(r=>r.address)]:void 0}toString(){return this._address!==void 0?`${this.name}@${this._address.map(r=>r.toString()).join(",")}`:this.name}buildSemanticTokens(r){let n=this.firstToken;if(!n.value)return;let i={...n,pos:{...n.pos,len:this.name.length}};r(Gi("type"),Yi("declaration"),i,i),this.address!==void 0&&this.address.forEach(s=>{r(Gi("decorator"),Yi("declaration"),s.firstToken,s.lastToken),s.buildSemanticTokens(r)})}get serializeIssues(){return[...this.issues,...this._address?.flatMap(r=>r.issues)??[]].map(r=>r())}serialize(){let r=this.firstToken;return{fullName:this.toString(),name:{name:this.name,url:this.serializeURL,range:Zn.Range.create(Zn.Position.create(r.pos.line,r.pos.col),Zn.Position.create(r.pos.line,r.pos.colEnd)),issues:this.serializeIssues},address:this.address?.map(n=>n.serialize())??null,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var sr=(t,e,r=!0,n=!0)=>({start:{line:t?.pos.line??0,character:r?t?.pos.col??0:(t?.pos.col??0)+(t?.pos.len??0)},end:{line:e?.pos.line??0,character:n?(e?.pos.col??0)+(e?.pos.len??0):e?.pos.col??0}});var se=(t,e=!0)=>Yt.Position.create(t.pos.line,e?t.pos.colEnd:t.pos.col),ce=t=>sr(t.firstToken,t.lastToken),Gi=t=>Wc.findIndex(e=>e===t),Yi=t=>zc.findIndex(e=>e===t),_s=(t,e,r)=>!fe(t.fsPath,e)||r.line<t.pos.line?!1:r.line>t.pos.line?!0:r.character>=t.pos.colEnd,CT=(t,e,r)=>fe(t.fsPath,e)?r.line<t.pos.line?!0:r.line>t.pos.line?!1:r.character<t.pos.col:!1,Qt=(t,e,r)=>{let n=t.firstToken,i=t.lastToken;return!!((n.pos.line<r.line||n.pos.line===r.line&&n.pos.col<=r.character)&&(i.pos.line>r.line||i.pos.line===r.line&&i.pos.colEnd>=r.character)&&fe(t.fsPath,e))},po=(t,e)=>{let r=(i,s)=>i.line<s.line||i.line===s.line&&i.character<=s.character,n=(i,s)=>i.line>s.line||i.line===s.line&&i.character>=s.character;return r(t.start,e.start)&&n(t.end,e.end)},jw=(t,e,r)=>{let n=t.firstToken,i=t.lastToken;return!!(t.lastToken.value!==";"&&(n.pos.line===r.line||i.pos.line===r.line)&&r.character>=i.pos.colEnd&&fe(t.fsPath,e))},Uw=(t,e,r)=>{if(!t)return!1;let i=t.filter(s=>s.pos.line===r.line).at(-1);return i&&i.pos.col>=r.character?!1:e.lastToken===i};var ti=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].reverse().find(s=>Qt(s,e,r));return n},Kc=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].find(s=>CT(s.lastToken,e,r));return n===t?void 0:n},Xc=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].reverse().find(s=>_s(s.firstToken,e,r));return n===t?void 0:n},AT="#virtual",ki=t=>t.includes(AT),Vf=(t,e)=>`${t}?loc=${e.start.line}:${e.start.character}-${e.end.line}:${e.end.character}${AT}`,fr=t=>{if(!ki(t))return;let[e,r]=t.split("?"),[n,i]=r.replace("loc=","").replace(AT,"").split("-"),[s,o]=n.split(":"),[a,c]=i.split(":");return{fsPath:e,range:Yt.Range.create(Yt.Position.create(Number.parseInt(s),Number.parseInt(o)),Yt.Position.create(Number.parseInt(a),Number.parseInt(c)))}},IT=t=>{let e=fr(t.fsPath);e&&(t.range=e.range,t.fsPath=e?.fsPath,t.virtual=!0,t.linkedTo=t.linkedTo.map(({range:r,fsPath:n})=>{let i=fr(n);return{range:i?.range??r,fsPath:i?.fsPath??n,templateStrings:[]}}))},Y=(t,e,r=e,n,{severity:i=Yt.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l,inclusiveStart:u,inclusiveEnd:d}={severity:Yt.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[]})=>{let f={issues:Array.isArray(t)?t:[t],range:sr(e,r,u,d),fsPath:e.fsPath,severity:i,linkedTo:s.map(({range:h,fsPath:y})=>{let S=fr(y);return S?{...S,templateStrings:[]}:{range:h,fsPath:y,templateStrings:[]}}),tags:o,templateStrings:a,edit:c,codeActionTitle:l};IT(f);let p,m=()=>(p??={severity:f.severity,range:f.range,message:f.issues?f.issues.map(UH).join(" or "):"",source:"devicetree",tags:f.tags,data:{firstToken:{pos:e.pos,tokens:e.tokens,value:e.value},lastToken:{pos:r.pos,tokens:r.tokens,value:r.value},type:"SyntaxIssue",items:f.issues,edit:f.edit,codeActionTitle:f.codeActionTitle,virtual:!!f.virtual}},p);return n?.syntaxIssues.push(m),{raw:f,diagnostic:m}},Bt=(t,e,r,n,{severity:i=Yt.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l,linkedToTemplateStrings:u=[]}={severity:Yt.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[],linkedToTemplateStrings:[]})=>{let d={issues:Array.isArray(t)?t:[t],range:sr(e,r),fsPath:e.fsPath,severity:i,linkedTo:s.map(({range:m,fsPath:h},y)=>{let S=fr(h);return S?{...S,templateStrings:[]}:{range:m,fsPath:h,templateStrings:u.at(y)??[]}}),tags:o,templateStrings:a,edit:c,codeActionTitle:l};IT(d);let f,p=()=>(f??={severity:d.severity,range:d.range,message:HH(d),source:"devicetree",tags:d.tags,relatedInformation:[...d.linkedTo.map(m=>({message:d.issues.map(h=>VH(h,m.templateStrings)).join(" or "),location:{uri:ue(m.fsPath),range:m.range}}))]},f);return n?.resettableIssues.push(p),{raw:d,diagnostic:p}},x=(t,e,r,n,{severity:i=Yt.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l}={severity:Yt.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[]})=>{let u={issues:Array.isArray(t)?t:[t],range:sr(e,r),severity:i,fsPath:e.fsPath,linkedTo:s.map(({range:p,fsPath:m})=>{let h=fr(m);return h?{...h,templateStrings:[]}:{range:p,fsPath:m,templateStrings:[]}}),tags:o,templateStrings:a,edit:c,codeActionTitle:l};IT(u);let d,f=()=>(d??={severity:u.severity,range:u.range,message:WH(u),relatedInformation:[...u.linkedTo.map(p=>({message:u.issues.map(zH).join(" or "),location:{uri:ue(p.fsPath),range:p.range}}))],source:"devicetree",tags:u.tags,data:{type:"StandardTypeIssue",firstToken:{pos:e.pos,tokens:e.tokens,value:e.value},lastToken:{pos:r.pos,tokens:r.tokens,value:r.value},edit:u.edit,codeActionTitle:u.codeActionTitle,items:u.issues,virtual:!!u.virtual}},d);return Array.isArray(n)?n.forEach(p=>p.resettableIssues.push(f)):n?.resettableIssues.push(f),{raw:u,diagnostic:f}};function ze(t,e,r,{severity:n=Yt.DiagnosticSeverity.Warning,linkedTo:i=[],tags:s,templateStrings:o=[],edit:a,codeActionTitle:c}={severity:Yt.DiagnosticSeverity.Warning,linkedTo:[],templateStrings:[],edit:[],codeActionTitle:void 0},l=r){let u={issues:Array.isArray(t)?t:[t],range:Yt.Range.create(r,l),severity:n,fsPath:e,linkedTo:i.map(({range:p,fsPath:m})=>({range:p,fsPath:m,templateStrings:[]})),tags:s,templateStrings:o,edit:a,codeActionTitle:c,virtual:ki(e)},d;return{raw:u,diagnostic:()=>(d??={severity:u.severity,range:u.range,message:GH(u),relatedInformation:[...u.linkedTo.map(p=>({message:u.issues.map(YH).join(" or "),location:{uri:ue(p.fsPath),range:p.range}}))],source:"devicetree",tags:u.tags,data:{type:"FormattingIssues",items:u.issues,edit:u.edit,codeActionTitle:u.codeActionTitle,virtual:!!u.virtual}},d)}}var Hw=(t,e)=>[...t].sort((n,i)=>{let s=e.getSortKey(n),o=e.getSortKey(i);if(s===void 0||o===void 0)throw new Error("Sort keys must be set");if(s!==o)return s-o;let a=n.lastToken,c=i.lastToken;return a.pos.line!==c.pos.line?a.pos.line-c.pos.line:a.pos.col-c.pos.col});async function Et(t,e,r){let n=Ne(t.textDocument.uri);if(!e)return[];let i=performance.now(),s=await e.getRuntime(),o,a,c=s.context.allParsers.flatMap(u=>u.injectedMacros).find(u=>Qt(u,n,t.position));return c&&(o={runtime:s,item:null,ast:ti(c,n,t.position)},a=Number.MAX_SAFE_INTEGER),o||(o=s.getDeepestAstNode(n,t.position),a=e.getSortKey(o?.ast)??e.getSortKeyFile(t.position,n)),console.log(`search: ${performance.now()-i}ms`),r(o,u=>{let d=t.position;if(fe(u.fsPath,n)){let f=u.lastToken;return f.pos.line<d.line||f.pos.line===d.line&&f.pos.colEnd<=d.character}return a!==void 0&&(e.getSortKey(u)??-1)<=a})}function me(t,e){return{start:t,end:e??t}}var H=(t,e)=>t?.tokens.some(r=>r===e),at=(t,e)=>r=>r?.value&&(e?.caseInsensitive?t.toLowerCase()===r.value.toLowerCase():t===r.value)?"yes":e?.allowPartial?FH(t)(r):"no",Ue=t=>e=>e?.tokens.some(r=>r===t)?"yes":"no",FH=t=>e=>e?.value&&t.startsWith(e.value)?"partial":"no",hr=(t,e)=>!!t&&!!e&&t.pos.line===e.pos.line&&fe(t.fsPath,e.fsPath),Kt=(t,e)=>t?.tokens[0]===21&&e?.tokens[0]===21&&(t?.prevToken&&t.prevToken.value===e?.value||e?.prevToken&&e.prevToken.value===t?.value)?!0:!!t&&!!e&&t.pos.colEnd===e.pos.col&&hr(t,e),Wf=t=>t.map((e,r)=>({index:r,context:e,files:e.getContextFiles()})),Er=(t,e,r,n)=>{if("id"in e){let s=t?.find(o=>o.id===e.id);return s||void 0}if("name"in e){let s=t?.find(o=>o.ctxNames.includes(e.name));return s||void 0}return r?.getContextFiles().find(s=>fe(s,e.fsPath))?r:Wf(t).sort(s=>s.context.id===n?-1:0).find(s=>s.files.some(o=>fe(o,e.fsPath)))?.context},OT=(t,e)=>Wf(t).filter(n=>n.files.some(i=>fe(i,e))).map(n=>n.context),Vw=t=>{let e=/^(\w+)\s+(.*)$/,r=/^(\w+)\(([^)]*)\)\s+(.*)$/,n=/^(\w+)\(([^)]*),\s*\.\.\.\)\s+(.*)$/,i;if(i=n.exec(t)){let[,,s,o]=i,a=s.split(",").map(c=>c.trim());return(...c)=>{let l=o,u=c.slice(a.length).join(", ");return a.forEach((d,f)=>{l=l.replace(new RegExp(`(?<!#)#\\s*${d}\\b`,"g"),`"${c[f]??""}"`)}),l=l.replace(/(?<!#)#\s*__VA_ARGS__/g,`"${u}"`),a.forEach((d,f)=>{let p=new RegExp(`\\b${d}\\b`,"g");l=l.replace(p,c[f]??"")}),l=l.replace(/__VA_ARGS__/g,u),l}}else if(i=r.exec(t)){let[,,s,o]=i,a=s.split(",").map(c=>c.trim());return(...c)=>{let l=o;return a.forEach((u,d)=>{l=l.replace(new RegExp(`(?<!#)#\\s*${u}\\b`,"g"),`"${c[d]??""}"`)}),a.forEach((u,d)=>{let f=new RegExp(`\\b${u}\\b`,"g");l=l.replace(f,c[d]??"")}),l}}else if(i=e.exec(t)){let[,,s]=i;return s.trim()}};function BH(t){if(!t.trim())return[];let e=[],r="",n=0;for(let i=0;i<t.length;i++){let s=t[i];s===","&&n===0?(e.push(r.trim()),r=""):(s==="("?n++:s===")"&&n--,r+=s)}return r.trim()&&e.push(r.trim()),e}var jH=0,Gc=(t,e)=>{let r=s=>s.replace(/\s*##\s*/g,""),n=t,i;do i=n,n=r(i),n=n.replace(/\b(\w+)\(([^()]*(?:\([^()]*\)[^()]*)*)\)|\b(\w+)\b/g,(s,o,a,c)=>{if(o==="defined"){let l=a.split(",").map(u=>u.trim());return l[0]?e.get(l[0])?.resolver:l}else if(o&&typeof e.get(o)?.resolver=="function"){let l=BH(a).map(u=>u.trim()).map(u=>u==="__COUNTER__"?(jH++).toString():u).map(u=>Gc(u,e));return(e.get(o)?.resolver)(...l)}else if(c&&typeof e.get(c)?.resolver=="string")return e.get(c)?.resolver;return s});while(n!==i);return n};function xT(t){return t.replace(/'(.)'/g,(e,r)=>r.charCodeAt(0).toString()).replace(/(0x[a-f\d]+|\d+)[ul]*/gi,"$1")}function Le(t){try{return(0,eval)(xT(t))}catch{}return t}var ue=t=>DT.default.pathToFileURL(t).toString(),Ne=t=>ft(DT.default.fileURLToPath(t)),Ww=(t,e)=>{let r=(0,va.relative)(t,e);return!!r&&!r.startsWith("..")&&!(0,va.isAbsolute)(r)},fe=(t,e)=>!t||!e?!1:t===e,ft=t=>(0,va.normalize)(process.platform==="win32"?t.toLowerCase():t),Ki=t=>(0,Bw.createHash)("sha256").update([ft(t.dtsFile),...t.includePaths.map(ft),...t.overlays.map(ft),t.bindingType,...t.zephyrBindings.map(ft),...t.deviceOrgBindingsMetaSchema.map(ft),...t.deviceOrgTreeBindings.map(ft),`showFormattingErrorAsDiagnostics-${t.showFormattingErrorAsDiagnostics}`,`disableFileWatchers-${t.disableFileWatchers}`].join(":")).digest("hex"),UH=t=>{switch(t){case 0:return"Expected value";case 1:return"Expected ';'";case 2:return"Expected '{'";case 3:return"Expected '}'";case 4:return"Expected '['";case 5:return"Expected ']'";case 12:return"Expected '>'";case 13:return"Expected '<'";case 16:return`Expected '"'`;case 17:return`Expected "'"\\`;case 24:return"Missing ':'";case 21:return"Missing '/'";case 26:return'Expected ")"';case 28:return'Missing ","';case 6:return"Expected property name";case 7:return"Expected node name";case 49:return"Node name shall start with a lower or upper case character";case 50:return"Node unit address should not start with 0x";case 51:return"Node unit address should not end with with ULL";case 8:return"Expected node address";case 9:return"Expected node path";case 48:return"Expected node path reference";case 10:return"Expected node reference";case 11:return"Expected root node name";case 14:return"Expected bytestring";case 15:return"Expected two digits for each byte in bytestring";case 20:return"Hex values are not allowed";case 18:return"Expected label name";case 19:return"Expected '/' at the start of a node path";case 23:return"Found ';' without a statement";case 25:return"Did you mean /delete-node/ or /delete-property/?";case 34:return"Did you mean /delete-node/?";case 35:return"Did you mean /delete-property/?";case 22:return"Unknown syntax";case 27:return"Expected expression";case 31:return"Expected macro identifier";case 30:return"Expected macro identifier or function like macro";case 29:return"White space is not allowed";case 32:return"Properties can only be defined in a node";case 53:return"Node name syntax can only be used inside a node definition.";case 33:return"Properties can only be deleted inside a node";case 36:return"Unable to resolve include";case 52:return"Unknown Node Address syntax";case 37:return"Expected start address";case 38:return"Expected end address";case 39:case 40:return"Expected 8|16|32|64";case 42:return"Unknown macro name";case 43:return"Expected function like macro";case 44:return"Macro expects less arguments";case 45:return"Macro expects more arguments";case 46:return"Missing #ENDIF";case 47:return"Block Unused";case 41:return"This syntax is not officially part of the DTS V0.4 standard"}},HH=t=>t.issues.map(e=>{switch(e){case 0:return`Property "${t.templateStrings[0]}" is replaced by a later definition`;case 1:return"Cannot delete a property before it has been defined";case 2:return"Node name already defined";case 5:return"Cannot delete a node before it has been defined";case 3:return`No node with that reference "${t.templateStrings[0]}" has been defined`;case 8:return`No node with name "${t.templateStrings[0]}" could be found in "/${t.templateStrings[1]}".`;case 4:return`Label name "${t.templateStrings[0]}" already defined`;case 6:return`Property "${t.templateStrings[0]}" was deleted`;case 7:return`Node "${t.templateStrings[0]}" was deleted`;case 9:return`The following node "${t.templateStrings[1]}" shall be present in "${t.templateStrings[0]}" node.`;case 10:return`The following node "${t.templateStrings[0]}" address range collides with another node. Address start: "${t.templateStrings[1]}", end: "${t.templateStrings[2]}".`;case 11:return`The following file "${t.templateStrings[0]}" has already been included in ${t.templateStrings[1]}.`}}).join(" or "),VH=(t,e)=>{switch(t){case 0:return"Property name already defined.";case 2:return"Defined here";case 4:return"Defined here";case 7:case 6:return"Deleted here";case 9:return"Node";case 10:return`Node "${e[0]}". Address start: "${e[1]}", end: "${e[2]}".`;case 11:return"Include";default:return"TODO"}},WH=t=>t.issues.map(e=>{switch(e){case 9:return`Only these value are allowed ${t.templateStrings[0]}`;case 1:return"INTRO should be empty";case 8:return"INTRO can only be assigned one value";case 5:return"INTRO should be assigned a U32";case 6:return"INTRO should be assigned a U64";case 7:return"INTRO should be assigned a 'property encoded array'";case 2:return"INTRO should be assigned a string";case 3:return"INTRO should be assigned a string list";case 4:return`INTRO expects ${t.templateStrings[1]} values`;case 0:return"INTRO is required";case 11:return"INTRO should be omitted";case 27:return"INTRO name is not permitted under this node";case 34:return"INTRO name is not defined in the type binding for this node";case 10:return"INTRO address value must match node address";case 12:return"INTRO should be 'cpu'";case 13:return"INTRO should be 'memory'";case 14:return"INTRO is deprecated and should not be used'";case 15:return`INTRO ${t.templateStrings[1]}'`;case 18:return"INTRO value must be unique in the entire Devicetree";case 19:return`INTRO should have format ${t.templateStrings[1]}`;case 16:return`INTRO requires property "${t.templateStrings[1]}" in node path "${t.templateStrings[2]}"`;case 17:return"Unable to resolve interrupt parent node";case 20:return`INTRO should have format ${t.templateStrings[1]}`;case 21:return"Node is disabled";case 22:return"Unable to resolve handle";case 23:return`Unable to find "${t.templateStrings[0]}" in ${t.templateStrings[1]}`;case 24:return t.templateStrings[0];case 25:return t.templateStrings[0];case 26:return t.templateStrings[0];case 28:return t.templateStrings[0];case 35:return"Unable to find mapping range for address";case 29:return`INTRO exceeds address space available for this mapping. The range ends at ${t.templateStrings[2]}, the node ends at ${t.templateStrings[1]}`;case 30:return"Map entry overlaps with others entries";case 31:return"Unable to match to a nexus map entry";case 32:return`Unknown node type "${t.templateStrings[0]}"`;case 33:return`Missing name for "${t.templateStrings[0]}" index ${t.templateStrings[1]}"`;case 36:return"Node address is missing";case 37:return`Binding must be used on bus type${t.templateStrings.length?"s":""}: ${t.templateStrings.join(" or ")}`;case 38:return"Empty ranges property should only be used when #address-cells is identical to parent node #address-cells";case 39:return'The value should be one of the following: "spin-table" or "[vendor],[method]"';case 40:return'The value should match "[vendor],[method]"';case 41:return`Value must not be be less than ${t.templateStrings[0]}`;case 42:return`Value must not be greater than ${t.templateStrings[0]}`;case 44:return`Assignment exceeds max-len of ${t.templateStrings[1]} for property "${t.templateStrings[0]}"`;case 43:return`INTRO has missing values. It must have a minimum of ${t.templateStrings[1]} ${t.templateStrings[1]==="1"?"entry":"entries"}`}}).join(" or ").replace("INTRO",`Property "${t.templateStrings[0]}"`).replaceAll("INTRO ",""),zH=t=>{switch(t){case 16:case 0:return"Node";case 15:return"Ignored reason";case 18:return"Conflicting properties";case 8:return"Additional value";case 21:return"Disabled by";case 29:return"Mapping range";case 30:return"Map entry";case 31:return"Nexus map entries";case 33:return"Names property";case 35:return"Range property";default:return"TODO"}},GH=t=>t.issues.map(e=>{switch(e){case 4:return"Add end of line to end of file";case 1:return`${t.codeActionTitle}. Expecting ${t.templateStrings[0]}.`;case 0:return"Move to a new line";case 3:return"Remove trailing whitespace at the end of file.";case 2:return"Remove trailing whitespace at the end of the line.";case 5:return`Fix indentation. ${t.templateStrings.at(0)?.length===0?"No indentation expected":`Expecting ${t.templateStrings[0]}`}`;case 6:return`Move token "${t.templateStrings[0]}" next to expression`;case 7:return"Remove (...) enclosure. This expression should only be enclosed in the #define of the macro";case 8:return`Line is too long. ${t.codeActionTitle}`;case 9:return`Hex values must be lowercase. ${t.codeActionTitle}`;case 10:return"Node address is already a hex value. Remove '0x'.";case 11:return"Node address size is determined by '@size-cells', Remove 'ull'.";case 12:return`'\\' is not necessary. ${t.codeActionTitle}`;case 13:return`Node does not contribute anything. ${t.codeActionTitle}`;case 14:return`Property is redefined in same closure. ${t.codeActionTitle}`;case 15:return`${t.codeActionTitle}`}}).join(" or "),YH=t=>"TODO";var qt=(t,e)=>{let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let i=t[t.length-r+n]??0,s=e[e.length-r+n]??0;if(i<s)return-1;if(i>s)return 1}return 0},ei=(t,e)=>{let r=Math.max(t.length,e.length),n=new Array(r).fill(0),i=0;for(let s=0;s<r;s++){let o=t[t.length-1-s]??0,a=e[e.length-1-s]??0,c=o+a+i;n[r-1-s]=c>>>0,i=c>4294967295?1:0}return i&&n.unshift(1),n},KH=(t,e)=>{let r=Math.max(t.length,e.length),n=new Array(r).fill(0),i=0;for(let s=0;s<r;s++){let o=t[t.length-1-s]??0,a=e[e.length-1-s]??0;o-=i,o<a?(o+=4294967296,i=1):i=0,n[r-1-s]=o-a>>>0}for(;n.length>1&&n[0]===0;)n.shift();return n},XH=(t,e)=>ei(t,e),zw=(t,e)=>{let r=[];for(let n of t){let i=n.childAddress,s=n.length,o=ei(i,s);if(qt(e,i)>=0&&qt(e,o)<0){let a=KH(e,i),c=n.parentAddress,l=XH(c,a),u=ei(c,s);r.push({start:l,end:u,range:sr(n.rangeTokens.start,n.rangeTokens.end),fsPath:n.rangeTokens.start.fsPath})}}return r};function Gw(t){return Array.isArray(t)&&Array.isArray(t[0])}function Jc(t){return!t||t instanceof Gt?t:Jc(t.parentNode)}function Zr(t,e){let r=e.filter(n=>!n.raw.virtual).flatMap(n=>n.raw.edit).filter(n=>!!n);return MT(t,r)}function MT(t,e){let r=t.getText(),n=e.slice().sort((s,o)=>{let a=t.offsetAt(s.range.start),c=t.offsetAt(o.range.start);if(a!==c)return c-a;let l=t.offsetAt(s.range.end),u=t.offsetAt(o.range.end);if(l!==u)return u-l;let d=a===l&&s.newText.length>0,f=c===u&&o.newText.length>0;return d!==f?d?1:-1:0}),i=r;for(let s of n){let o=t.offsetAt(s.range.start),a=t.offsetAt(s.range.end);i=i.slice(0,o)+s.newText+i.slice(a)}return i}function Fw(t,e){return t.line<e.line?-1:t.line>e.line?1:t.character<e.character?-1:t.character>e.character?1:0}function Yw(t,e){return Fw(t.end,e.start)>0&&Fw(t.start,e.end)<0}var Kw=(t,e)=>{let r=Xw(t,e),n=Jw(t,e);r&&(t.topComment=r),n&&(t.endComment=n)},Xw=(t,e)=>{let r=e.find(i=>!i.disabled&&i.lastToken===t.firstToken.prevToken&&(i.lastToken.pos.line===t.firstToken.pos.line||i.lastToken.pos.line+1===t.firstToken.pos.line));if(!r||r.astBeforeComment)return;r.astAfterComment=t;let n=Xw(r,e);return n&&(n.astAfterComment=t,r.astAfterComment=void 0),n??r},Jw=(t,e)=>{let r=e.find(i=>!i.disabled&&i.firstToken.prevToken===t.lastToken&&i.firstToken.pos.line===t.lastToken.pos.line);if(!r)return;r.astBeforeComment=t;let n=Jw(r,e);return n&&(n.astBeforeComment=t,r.astBeforeComment=void 0),n??r},ho=(t,e,r)=>{let n=[42,44,45,36];return r||n.push(52,32,53,8,49),t.severity===Yt.DiagnosticSeverity.Error&&fe(t.fsPath,e)&&!n.some(i=>t.issues.includes(i))};function zf(t){let e=t?.charAt(0);return!!e&&(e>="A"&&e<="Z"||e>="a"&&e<="z")}var ba=t=>{if(t)return t instanceof De?t:ba(t?.parentNode)},Sa=(t,e,r=0)=>{if(!e||!e.parentNode?.fsPath)return r;let n=ba(e.parentNode);return Sa(t,n,r+1)};function Qw(t,e,r,n){let i=r-e,s=n.length,o=t.length-i+s,a=new Array(o),c=0;for(let l=0;l<e;l++,c++)a[c]=t[l];for(let l=0;l<s;l++,c++)a[c]=n[l];for(let l=r;l<t.length;l++,c++)a[c]=t[l];return a}function Xi(t){return t?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):""}function Gf(t,e,r,n,i){let s=e.closeScope?.prevToken??e.lastToken.prevToken;if(!s)return;let o="";switch(n.types[0]){case"U32":case"U64":case"PROP_ENCODED_ARRAY":o=` = <${r==="reg"&&t.address?t.address.map(a=>`0x${a.toString(16)}`).join(" "):""}>`;break;case"STRING":case"STRINGLIST":o=' = ""';break;case"BYTESTRING":o=" = []";break}return Yt.TextEdit.insert(Yt.Position.create(s.pos.line,s.pos.col+1),`
184
184
  ${"".padEnd(Sa(s.fsPath,e),i.context.formattingOptions.insertSpaces?" ".repeat(i.context.formattingOptions.tabSize):" ")}${r}${o};`)}var wt=t=>[".dts",".dtsi",".dtso",".overlay",".keymap"].some(e=>t.endsWith(e));var dl=require("fs"),wa=require("path"),gr=q(U());var ZC=require("path"),In=q(U());var qr=class extends te{constructor(r,n,i,s){super();this.startLabels=r;this.value=n;this.endLabels=i;this.bits=s;this.startLabels.forEach(o=>{this.addChild(o)}),this.addChild(s),this.addChild(n),this.endLabels.forEach(o=>{this.addChild(o)})}toString(){return`${[this.value?.toString()??"NULL",...this.endLabels.map(r=>r.toString())].join(" ")}`}toPrettyString(r){return`${[this.value?.toPrettyString(r)??"NULL",...this.endLabels.map(n=>n.toString())].join(" ")}`}toJson(){return this.value?.toJson()}};var Zt=t=>t instanceof pr?!0:t instanceof De?!1:t.parentNode?Zt(t.parentNode):!1;var LT=t=>{if(t instanceof Ee)return t;if(!(t instanceof De))return t.parentNode?LT(t.parentNode):void 0},mo=t=>!t||t instanceof Ee?!1:t instanceof qr||mo(t.parentNode),qT=t=>{if(t instanceof Ce||t instanceof nt)return t.name;if(t instanceof ot)return t.reference},Yf=t=>[...t.map(qT)].filter(e=>!!e),$T=(t,e)=>e?e.parentNode===t||$T(t,e.parentNode):!1;var Xt=q(U());var Zw=q(U());var ri=class extends te{constructor(){super();this._pathParts=[]}addPath(r,n){this._pathParts.push(r),n&&this.addChild(n),this.addChild(r)}get pathParts(){return[...this._pathParts]}toString(){return this._pathParts.map(r=>r?.toString()??"<NULL>").join("/")}buildSemanticTokens(r){this._children.forEach(n=>{n instanceof je?n.buildSemanticTokens(r):r(Gi("operator"),Yi("declaration"),n.firstToken,n.lastToken)})}},it=class extends te{constructor(r){super();this.path=r;this.docSymbolsMeta={name:`/${this.path?.toString()??""}`,kind:Zw.SymbolKind.Namespace},this.addChild(r)}toString(){return`&${this.path?.toString()??"NULL"}`}toJson(){return-1}serialize(){let r=this.path?.toString();return{type:"NODE_PATH",nodePath:r==="/"?r:`/${r??""}`,url:this.serializeURL,range:this.range,issues:this.serializeIssues}}};var W=class{constructor(e,r,n="optional",i=void 0,s,o){this.name=e;this.type=r;this.def=i;this.additionalTypeCheck=o;this.hideAutoComplete=!1;this.list=!1;this.onHover=()=>({kind:Xt.MarkupKind.Markdown,value:["### Type","**DTS native type** ",`${this.type.map(e=>e.types.join(" or ")).join(",")}
185
185
 
186
186
  `,...this.bindingType?["**Binding type** ",`${this.bindingType}
@@ -273,7 +273,7 @@ any circumstances other than under the control of the device driver using the re
273
273
  `)}${this.nodes.length?`
274
274
  ${this.nodes.map(r=>`${r.fullName} { /* ... */ };`).join(`
275
275
  `)}`:""}
276
- };`}toMarkupContent(e){return{kind:In.MarkupKind.Markdown,value:["### Path",this.pathString,"### Current State","```devicetree",this.toTooltipString(e),"```",...this.nodeType?.vendor?["### Vendor",...this.nodeType?.vendor?[this.nodeType?.vendor]:[]]:[],...this.nodeType?.maintainers?["### Maintainers",...this.nodeType?.maintainers??[]]:[],...this.nodeType?.title?["### Title",_s(this.nodeType?.title)]:[],...this.nodeType?.description?["### Description",_s(this.nodeType?.description)]:[],...this.nodeType?.examples?["### Examples","```devicetree",...this.nodeType?.examples??[],"```"]:[]].join(`
276
+ };`}toMarkupContent(e){return{kind:In.MarkupKind.Markdown,value:["### Path",this.pathString,"### Current State","```devicetree",this.toTooltipString(e),"```",...this.nodeType?.vendor?["### Vendor",...this.nodeType?.vendor?[this.nodeType?.vendor]:[]]:[],...this.nodeType?.maintainers?["### Maintainers",...this.nodeType?.maintainers??[]]:[],...this.nodeType?.title?["### Title",Xi(this.nodeType?.title)]:[],...this.nodeType?.description?["### Description",Xi(this.nodeType?.description)]:[],...this.nodeType?.examples?["### Examples","```devicetree",...this.nodeType?.examples??[],"```"]:[]].join(`
277
277
  `)}}toFullString(e,r,n=1){let i=this.hasOmitIfNoRef();return i&&this.linkedRefLabels.length===0&&this.linkedNodeNamePaths.length===0?`/* /omit-if-no-ref/ ${this.uniqueLabels().join(" ")}${this.labels.length?" ":""}${this.fullName} {${this.properties.length?`
278
278
  ${" ".repeat(n)}`:""}${this.properties.map(o=>o.toString()).join(`
279
279
  ${" ".repeat(n)}`)}${this.nodes.length?`
@@ -289,21 +289,21 @@ ${" ".repeat(n)}`)}${this.nodes.length?`${this.properties.length?`
289
289
 
290
290
  ${" ".repeat(n)}`)}`:""}
291
291
  ${" ".repeat(n-1)}};`}serialize(e,r,n=()=>!0){let i=this.mappedReg(r),s=this.implementations.filter(n),o=this.nodeType;e[this.pathString]={nodeType:o instanceof _t?{...o,extends:Array.from(this.nodeType?.extends??[]),properties:o.properties.map(a=>({name:typeof a.name=="string"?a.name:a.name.toString(),nameIsRegex:typeof a.name!="string",allowedValues:a.allowedValues,type:a.type,description:a.description?.join(`
292
- `),required:a.required(this)==="required"})),zephyrBinding:o.zephyrBinding,vendor:o.vendor}:void 0,issues:s.flatMap(a=>a.serializeIssues),path:this.pathString,disabled:this.disabled,name:this.name,fullName:this.fullName,labels:Array.from(new Set(this.labels.filter(n).map(a=>a.label.value))),nodes:s.filter(n).map(a=>a.serialize(r)),properties:this.properties.map(a=>a.serialize(r,n)).filter(a=>!!a),childNodes:this.nodes.filter(a=>a.implementations.some(n)).map(a=>a.pathString),reg:i?.map(a=>({mappedStartAddress:a?.startAddress,mappedEndAddress:a?.endAddress,startAddress:a?.startAddressRaw,endAddress:a?.endAddressRaw,size:a?.size,inMappingRange:a?.inMappingRange})),interruptControllerMappings:this.interrupControlerMapping.map(a=>({cells:a.expressions.map(c=>c.serialize(r)),path:a.node.pathString,property:a.property.ast.serialize(r),specifierSpace:a.specifierSpace})),specifierNexusMappings:this.spesifierNexusMapping.map(a=>({cells:a.expressions.map(c=>c.serialize(r)),path:a.node.pathString,propertyNodePath:a.property.parent.pathString,property:a.property.ast.serialize(r),specifierSpace:a.specifierSpace})),nexusMaps:this.properties.filter(a=>!!a.name.match(/^(?!no-).*?-map$/)).flatMap(a=>{let c=a.name.split("-map",1)[0];return(this.getNexusMap(c,r)?.map??[]).map(u=>({childCellCount:u.childCellCount,mappingValues:u.mappingValues.map(d=>d.serialize(r)),target:u.node?.pathString,targetAst:u.nodeAst?.serialize(r),parentCellCount:u.parentCellCount,parentValues:u.parentValues?.map(d=>d.serialize(r)),specifierSpace:c}))})??[],deletedProperties:this.deletedProperties.filter(a=>n(a.by)).map(a=>({deleteAst:a.by.serialize(r),deletedAst:a.property.serialize(r,n)})).filter(a=>!!a.deletedAst)},this.nodes.filter(a=>a.implementations.some(n)).forEach(a=>a.serialize(e,r,n))}get memoryRegionName(){return this.parent?.name==="/"||this.parent?.properties.some(e=>e.name==="ranges")?this.parent.memoryRegionName:this.pathString}getMemoryViews(e){let r=[],n=this.memoryRegionName;return this.properties.some(i=>i.name==="reg")&&this.mappedReg(e)?.forEach(i=>{let s=i.startAddress,o=i.size;r.push({name:i.missingMapping?this.pathString:n,labels:Array.from(new Set(this.labels.map(a=>a.label.toString()))),nodePath:this.pathString,start:s,size:o,disabled:this.disabled})}),r.push(...this.nodes.flatMap(i=>i.getMemoryViews(e))),r}};var Pa=q(U());var tv=q(U());var Ps=class extends te{constructor(r,n){super(n);this.label=r;this.docSymbolsMeta={name:this.label.value,kind:tv.SymbolKind.Constant},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration",this.addChild(r)}toString(){return`${this.label.toString()}:`}serialize(r){return{value:this.label.value,...super.serialize(r)}}},mr=class extends te{constructor(r,n){super(n);this.value=r;this.docSymbolsMeta={name:this.value,kind:tv.SymbolKind.Variable},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}buildSemanticTokens(r){let n=this.parentNode;if(!(n instanceof ie&&n.linksTo)){super.buildSemanticTokens(r);return}r(Gi("type"),Yi("declaration"),this.firstToken,this.lastToken)}toString(){return`${this.value}`}};var et=class{constructor(e,r){this.ast=e;this.parent=r;this.nexusMapsTo=[]}getDeepestAstNode(e,r){let n=ti(this.ast,e,r);return this.ast.assignOperatorToken&&Ss(this.ast.assignOperatorToken,e,r)?{item:this,ast:n,beforeAst:Xc(this.ast,e,r),afterAst:Kc(this.ast,e,r)}:{item:this,ast:n}}get name(){return this.ast.propertyName?.name??"[UNSET]"}get labels(){return this.ast.allDescendants.filter(e=>e instanceof Ps)}get labelsMapped(){return this.labels.map(e=>({label:e,owner:this.ast.labels.some(r=>r===e)?this:null}))}getArgumentIndex(e){if(!e)return;let r=this.ast.getFlatAstValues()?.findIndex(n=>n===e||n?.isAncestorOf(e));return r===-1?void 0:r}get issues(){return this.replacedIssues}get replacedIssues(){return[...this.replaces?.replacedIssues??[],...this.replaces?[Bt(0,this.replaces.ast.firstToken,this.replaces.ast.lastToken,this.replaces.ast,{severity:Pa.DiagnosticSeverity.Hint,linkedTo:[this.ast],tags:[Pa.DiagnosticTag.Unnecessary],templateStrings:[this.name]})]:[]]}onHover(){if(this.nexusMapsTo.length)return{kind:Pa.MarkupKind.Markdown,value:["### Nexus mappings",...this.nexusMapsTo.filter(e=>!!e.mapItem).flatMap(e=>["```",`${this.name} = <... ${e.mappingValuesAst.map(r=>r.toString()).join(" ")} ...> maps to <... ${e.mapItem.mappingValues.map(r=>r.toString()).join(" ")} ...>;`,"```",`[Mapping (${e.mappingValuesAst.map(r=>r.toString()).join(" ")})](${`${e.mapItem.mappingValues[0].fsPath}#L${e.mapItem.mappingValues[0].firstToken.pos.line+1}`})`])].join(`
292
+ `),required:a.required(this)==="required"})),zephyrBinding:o.zephyrBinding,vendor:o.vendor}:void 0,issues:s.flatMap(a=>a.serializeIssues),path:this.pathString,disabled:this.disabled,name:this.name,fullName:this.fullName,labels:Array.from(new Set(this.labels.filter(n).map(a=>a.label.value))),nodes:s.filter(n).map(a=>a.serialize(r)),properties:this.properties.map(a=>a.serialize(r,n)).filter(a=>!!a),childNodes:this.nodes.filter(a=>a.implementations.some(n)).map(a=>a.pathString),reg:i?.map(a=>({mappedStartAddress:a?.startAddress,mappedEndAddress:a?.endAddress,startAddress:a?.startAddressRaw,endAddress:a?.endAddressRaw,size:a?.size,inMappingRange:a?.inMappingRange})),interruptControllerMappings:this.interrupControlerMapping.map(a=>({cells:a.expressions.map(c=>c.serialize(r)),path:a.node.pathString,property:a.property.ast.serialize(r),specifierSpace:a.specifierSpace})),specifierNexusMappings:this.spesifierNexusMapping.map(a=>({cells:a.expressions.map(c=>c.serialize(r)),path:a.node.pathString,propertyNodePath:a.property.parent.pathString,property:a.property.ast.serialize(r),specifierSpace:a.specifierSpace})),nexusMaps:this.properties.filter(a=>!!a.name.match(/^(?!no-).*?-map$/)).flatMap(a=>{let c=a.name.split("-map",1)[0];return(this.getNexusMap(c,r)?.map??[]).map(u=>({childCellCount:u.childCellCount,mappingValues:u.mappingValues.map(d=>d.serialize(r)),target:u.node?.pathString,targetAst:u.nodeAst?.serialize(r),parentCellCount:u.parentCellCount,parentValues:u.parentValues?.map(d=>d.serialize(r)),specifierSpace:c}))})??[],deletedProperties:this.deletedProperties.filter(a=>n(a.by)).map(a=>({deleteAst:a.by.serialize(r),deletedAst:a.property.serialize(r,n)})).filter(a=>!!a.deletedAst)},this.nodes.filter(a=>a.implementations.some(n)).forEach(a=>a.serialize(e,r,n))}get memoryRegionName(){return this.parent?.name==="/"||this.parent?.properties.some(e=>e.name==="ranges")?this.parent.memoryRegionName:this.pathString}getMemoryViews(e){let r=[],n=this.memoryRegionName;return this.properties.some(i=>i.name==="reg")&&this.mappedReg(e)?.forEach(i=>{let s=i.startAddress,o=i.size;r.push({name:i.missingMapping?this.pathString:n,labels:Array.from(new Set(this.labels.map(a=>a.label.toString()))),nodePath:this.pathString,start:s,size:o,disabled:this.disabled})}),r.push(...this.nodes.flatMap(i=>i.getMemoryViews(e))),r}};var Pa=q(U());var tv=q(U());var Ps=class extends te{constructor(r,n){super(n);this.label=r;this.docSymbolsMeta={name:this.label.value,kind:tv.SymbolKind.Constant},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration",this.addChild(r)}toString(){return`${this.label.toString()}:`}serialize(r){return{value:this.label.value,...super.serialize(r)}}},mr=class extends te{constructor(r,n){super(n);this.value=r;this.docSymbolsMeta={name:this.value,kind:tv.SymbolKind.Variable},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}buildSemanticTokens(r){let n=this.parentNode;if(!(n instanceof ie&&n.linksTo)){super.buildSemanticTokens(r);return}r(Gi("type"),Yi("declaration"),this.firstToken,this.lastToken)}toString(){return`${this.value}`}};var et=class{constructor(e,r){this.ast=e;this.parent=r;this.nexusMapsTo=[]}getDeepestAstNode(e,r){let n=ti(this.ast,e,r);return this.ast.assignOperatorToken&&_s(this.ast.assignOperatorToken,e,r)?{item:this,ast:n,beforeAst:Xc(this.ast,e,r),afterAst:Kc(this.ast,e,r)}:{item:this,ast:n}}get name(){return this.ast.propertyName?.name??"[UNSET]"}get labels(){return this.ast.allDescendants.filter(e=>e instanceof Ps)}get labelsMapped(){return this.labels.map(e=>({label:e,owner:this.ast.labels.some(r=>r===e)?this:null}))}getArgumentIndex(e){if(!e)return;let r=this.ast.getFlatAstValues()?.findIndex(n=>n===e||n?.isAncestorOf(e));return r===-1?void 0:r}get issues(){return this.replacedIssues}get replacedIssues(){return[...this.replaces?.replacedIssues??[],...this.replaces?[Bt(0,this.replaces.ast.firstToken,this.replaces.ast.lastToken,this.replaces.ast,{severity:Pa.DiagnosticSeverity.Hint,linkedTo:[this.ast],tags:[Pa.DiagnosticTag.Unnecessary],templateStrings:[this.name]})]:[]]}onHover(){if(this.nexusMapsTo.length)return{kind:Pa.MarkupKind.Markdown,value:["### Nexus mappings",...this.nexusMapsTo.filter(e=>!!e.mapItem).flatMap(e=>["```",`${this.name} = <... ${e.mappingValuesAst.map(r=>r.toString()).join(" ")} ...> maps to <... ${e.mapItem.mappingValues.map(r=>r.toString()).join(" ")} ...>;`,"```",`[Mapping (${e.mappingValuesAst.map(r=>r.toString()).join(" ")})](${`${e.mapItem.mappingValues[0].fsPath}#L${e.mapItem.mappingValues[0].firstToken.pos.line+1}`})`])].join(`
293
293
  `)}}get allReplaced(){return this.replaces?[this.replaces,...this.replaces.allReplaced]:[]}toString(){return this.ast.toString()}toPrettyString(e,r){return this.ast.toPrettyString(e,r)}serialize(e,r=()=>!0){let n=[this,...this.allReplaced].find(i=>r(i.ast));if(n)return{...n.ast.serialize(e),nodePath:this.parent.pathString,replaces:n.allReplaced.map(i=>({range:ce(i.ast),url:i.ast.serializeURL,values:i.ast.values===void 0?void 0:i.ast.values?.values.map(s=>s?.value?.serialize(e)??null)??null})),nexusMapEntry:n.nexusMapsTo.map(i=>({mappingValuesAst:i.mappingValuesAst.map(s=>s.serialize(e)),cellCount:i.cellCount,specifierSpace:i.specifierSpace,target:i.target.pathString,mapItem:i.mapItem?{childCellCount:i.mapItem.childCellCount,mappingValues:i.mapItem.mappingValues.map(s=>s.serialize(e)),target:i.mapItem.node?.pathString,targetAst:i.mapItem.nodeAst?.serialize(e),parentCellCount:i.mapItem.parentCellCount,parentValues:i.mapItem.parentValues?.map(s=>s.serialize(e)),specifierSpace:i.specifierSpace??"interrupt"}:void 0}))}}};var o0=q(require("path")),mp=q(U());var ll=require("fs");var rn=class t{constructor(e,r){this.text=e;this.fsPath=r;this.inComment=!1;this.lineNumber=0;this.columnNumber=0;this._tokens=[];let n=this.text.replace(/\r\n/g,`
294
294
  `).trimEnd();this.lines=n.split(`
295
295
  `);for(let i=0;i<this.lines.length;i++)this.lines[i]+=`
296
296
  `;this.lexIt()}get tokens(){return this._tokens}isWhiteSpace(){let e=this.currentChar;if(!e)return!1;let r=e.charCodeAt(0);return r===32||r===9||r===10||r===13||r===12||r===11}get endOfFile(){return this.isOnLastLine&&this.isOnLastCharOfLine}get isOnLastLine(){return this.lineNumber===this.lines.length-1}get isOnLastCharOfLine(){return this.lines[this.lineNumber].length<=this.columnNumber}moveToNextLine(){for(;!this.isOnLastLine;)if(this.columnNumber=0,this.lineNumber++,this.lines[this.lineNumber].length>0)return!0;return!1}moveOnLine(){let r=this.lines[this.lineNumber].length;return this.columnNumber>=r?this.moveToNextLine():(this.columnNumber++,this.columnNumber>=r&&this.moveToNextLine(),!0)}move(){return this.lineNumber>=this.lines.length?!1:this.moveOnLine()}get currentChar(){if(this.lineNumber>=this.lines.length)return null;let e=this.lines[this.lineNumber];return this.columnNumber>=e.length?null:e[this.columnNumber]}static{this.SYNTAX_CHARS=new Set(["^","~","|","!","\\","<",">",";","=","/","{","}","[","]","(",")","*","%","&",".",":","+","@","-","_",",","x","X","?"])}static isSyntaxChar(e){return e?t.SYNTAX_CHARS.has(e):!1}static isLetterCode(e){return e>=65&&e<=90||e>=97&&e<=122}getWord(){let e="";for(;!this.isWhiteSpace()&&(e.length&&!t.isSyntaxChar(this.currentChar)||!e.length);){if(e+=this.currentChar??"",e.length===1&&t.isSyntaxChar(this.currentChar)){this.move();break}let r=this.lineNumber;if(!this.move()||this.lineNumber!==r)return e}return this.inComment&&e==="*"&&this.currentChar==="/"&&(this.inComment=!1),this.inCommentLineStart!==void 0&&this.lineNumber!==this.inCommentLineStart&&(this.inCommentLineStart=void 0,this.inComment=!1),!this.inComment&&e==="/"&&this.currentChar==="*"&&(this.inCommentLineStart=void 0,this.inComment=!0),!this.inComment&&e==="/"&&this.currentChar==="/"&&(this.inCommentLineStart=this.lineNumber,this.inComment=!0),e}getString(e){let r=e;for(;this.currentChar!==e;){if(this.currentChar===`
297
- `){let o=this.lineNumber,a=this.columnNumber,c=r.length;this.pushToken({tokens:[21],value:r,pos:{col:a-c,line:o,len:c,colEnd:a}}),r=""}else if(this.currentChar==="\\"){let o=this.lineNumber;if(r+=this.currentChar??"",this.move())o===this.lineNumber&&(r+=this.currentChar??"");else break}else r+=this.currentChar??"";if(!this.move())break}r+=e;let n=this.lineNumber,i=this.columnNumber+1,s=r.length;this.pushToken({tokens:[21],value:r,pos:{col:i-s,line:n,len:s,colEnd:i}}),this.move()}lexIt(){for(;!this.endOfFile;){for(;this.isWhiteSpace();)this.move();let e=this.getWord();e&&this.process(e)}}static{this.SINGLE_CHAR_TOKENS=new Map([["{",[2]],["}",[3]],["(",[42]],[")",[43]],["[",[11]],["]",[12]],[";",[1]],[":",[50]],["=",[0]],[">",[4]],["<",[5]],["!",[6]],["|",[8]],["^",[9]],["&",[40,7]],["~",[10]],["/",[13]],["\\",[14]],["+",[15]],["-",[16]],["*",[17]],["%",[18]],["?",[44]],[".",[45]],["_",[48]],["@",[49]],[",",[24]]])}static{this.KEYWORD_TOKENS=new Map([["true",38],["false",39],["#define",25],["#include",26],["#line",27],["#undef",28],["#error",29],["#pragma",30],["#defined",31],["#if",32],["#ifdef",33],["#ifndef",34],["#elif",35],["#else",36],["#endif",37]])}process(e){let r=this.isString(e);if(!r){let i=t.KEYWORD_TOKENS.get(e.toLowerCase());if(i&&(r=!0,this.pushToken({tokens:[i],value:e.toLowerCase(),pos:this.generatePos(e,e.toLowerCase())}),i===39||i===38)){let s=this.tokens.length-1;if(Kt(this.tokens[s-1],this.tokens[s]))r=!1,this.tokens.pop();else return!0}}if(r||(r=this.isDigit(e)||this.isHexDigit(e)||this.isLetters(e)),!r&&e.length===1){let i=t.SINGLE_CHAR_TOKENS.get(e);if(i)return r=!0,this.pushToken({tokens:i,value:e,pos:this.generatePos(e,e)}),!0}if(r||(r=this.isHash(e)||this.unknownToken(e)),!r)throw new Error(`Lexer is not complete!!! Could not find token for "${e}"`);let n=this._tokens[this._tokens.length-1];return r&&!n?.tokens.some(i=>i===21)&&n&&n.pos.len<e.length?this.process(e.slice(n.pos.len)):!0}pushToken(e){let r={tokens:e.tokens,pos:e.pos,value:e.value,fsPath:this.fsPath},n=this._tokens[this._tokens.length-1];r.prevToken=n,n&&(n.nextToken=r),this._tokens.push(r)}isLetters(e){let r=e[0]?.charCodeAt(0);if(t.isLetterCode(r)){let n="";for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);if(t.isLetterCode(s))n+=e[i];else break}return this.pushToken({tokens:[47],value:n,pos:this.generatePos(e,n)}),!0}return!1}isDigit(e){let r=e[0],n=r?.charCodeAt(0);return n>=48&&n<=57?(this.pushToken({tokens:[20,19],value:r,pos:this.generatePos(e,r)}),!0):!1}isHexDigit(e){let r=e[0],n=r?.charCodeAt(0);return n>=65&&n<=70||n>=97&&n<=102?(this.pushToken({tokens:[20,47],value:r,pos:this.generatePos(e,r)}),!0):!1}isHash(e){return e.startsWith("#")?(this.pushToken({tokens:[46],pos:this.generatePos(e,"#"),value:"#"}),!0):!1}unknownToken(e){return this.pushToken({tokens:[41],pos:this.generatePos(e," "),value:e}),!0}isString(e){if(this.inComment)return!1;let r=e[0];if(r==='"'||r==="'"){let n=e.length-1;if(this.columnNumber+1<n)throw new Error("Error while rewinding");return this.columnNumber-=n,this.getString(r),!0}return!1}generatePos(e,r){let n=this.columnNumber-e.length,i=r.length;return{line:this.lineNumber,col:n,len:i,colEnd:n+i}}};var rv=require("fs"),Ra=require("path"),al=q(U());var At=class extends te{constructor(e){super(e),this.semanticTokenType="keyword",this.semanticTokenModifiers="declaration"}};var e0=require("path"),op=q(U());var ni=class extends te{constructor(r,n){super();this.keyword=r;this.path=n;this.docSymbolsMeta={name:`Include ${n}`,kind:op.SymbolKind.File},this.addChild(r),this.addChild(n)}get resolvedPath(){return this._resolvedPath}set resolvedPath(r){this.docSymbolsMeta={name:`Include ${r}`,kind:op.SymbolKind.File},this._resolvedPath=r}},ka=class extends te{constructor(r,n,i){super(i);this._path=r;this.relative=n;this.docSymbolsMeta={name:(0,e0.basename)(this.path),kind:op.SymbolKind.File},this.semanticTokenType="string",this.semanticTokenModifiers="declaration"}get path(){return this.relative?this._path.slice(1,-1):this._path}};var t0=q(U());var vt=class extends ge{constructor(r,n){super(n);this.name=r;this.docSymbolsMeta={name:this.name.toString(),kind:t0.SymbolKind.Variable},this.semanticTokenType="macro",this.semanticTokenModifiers="declaration"}toString(){return this.name}};var ap=class extends te{constructor(r,n){super(n);this.operator=r;this.semanticTokenType="operator",this.semanticTokenModifiers="declaration"}toString(){return this.operator}};var r0=q(U());var Na=class extends At{toString(){return"..."}},ii=class extends te{constructor(r,n){super();this.functionName=r;this.params=n;this.addChild(r),this.params.forEach(i=>this.addChild(i))}getDocumentSymbols(r){return fe(this.fsPath,r)?[{name:this.functionName.name,kind:r0.SymbolKind.Function,range:ce(this),selectionRange:ce(this),children:this.params.flatMap(n=>n.getDocumentSymbols(r))}]:[]}toString(){return`${this.functionName}(${this.params.map(r=>r.toString()).join(",")})`}};var Xi=class t{constructor(){this.positionStack=[];this._issues=[];this.issueLengthPositionStack=[];this.moveEndOfLine=(e,r=!0,n=!1)=>{let i=e.pos.line;if(this.currentToken?.pos.line!==i||!fe(this.currentToken?.fsPath,e.fsPath))return;let s=this.currentToken,o=s;for(;this.currentToken?.pos.line===i&&fe(this.currentToken?.fsPath,e.fsPath);)o=this.moveToNextToken;return r&&this._issues.push(Y(22,s,o,null)),n&&o?.value==="\\"&&o.nextToken?this.moveEndOfLine(o.nextToken,r):o};this.parsing=new Promise(e=>{setTimeout(()=>{this.parse().then(e)})})}reset(){this.issueLengthPositionStack=[],this.positionStack=[],this._issues=[]}get issues(){return this._issues}get stable(){return this.parsing}get done(){return this.peekIndex()>=this.tokens.length}get moveToNextToken(){let e=this.currentToken;if(e)return this.moveStackIndex(),e}enqueueToStack(){this.issueLengthPositionStack.push(this._issues.length),this.positionStack.push(this.peekIndex())}popStack(){let e=this.issueLengthPositionStack.pop()??0;e!==this._issues.length&&this._issues.splice(e),this.positionStack.pop()}mergeStack(){let e=this.issueLengthPositionStack.pop(),r=this.positionStack.pop();if(r===void 0||e===void 0)throw new Error("Index out of bounds");this.positionStack[this.positionStack.length-1]=r}peekIndex(e=1){let r=this.positionStack.at(-1*e);if(r===void 0)throw new Error("Index out of bounds");return r}get currentToken(){return this.tokens.at(this.peekIndex())}get prevToken(){let e=this.peekIndex()-1;if(e!==-1)return this.tokens[e]}moveStackIndex(){let e=this.positionStack.length-1;if(this.positionStack[e]===void 0)throw new Error("Index out of bounds");this.positionStack[e]!==this.tokens.length&&this.positionStack[e]++}checkConcurrentTokens(e){this.enqueueToStack();let r=[];return e.every(n=>{let i=this.currentToken,s=n(i),o=!1;return s!=="no"&&i&&(r.push(i),this.moveToNextToken,o=Kt(i,this.currentToken)),s==="yes"&&o}),this.mergeStack(),r}consumeAnyConcurrentTokens(e){this.enqueueToStack();let r=[],n,i=!0;for(;e.some(s=>s(this.currentToken)==="yes"&&i);)r.push(this.currentToken),n=this.moveToNextToken,i=Kt(n,this.currentToken);return this.mergeStack(),r}getDocumentSymbols(e){return this.allAstItems.flatMap(r=>r.getDocumentSymbols(e))}getWorkspaceSymbols(){return this.allAstItems.flatMap(e=>e.getWorkspaceSymbols())}static push(e,r,n,i,s,o){if(!n||!i||!fe(n.fsPath,s)||!fe(i.fsPath,s))return;let a=i.pos.colEnd-n.pos.col;o.push({line:n.pos.line,char:n.pos.col,length:i===n?i.pos.len:a,tokenType:e,tokenModifiers:r})}buildSemanticTokens(e,r,n=[]){this.allAstItems.forEach(i=>{i.buildSemanticTokens((...s)=>t.push(...s,r,n))}),n.sort((i,s)=>i.line===s.line?i.char-s.char:i.line-s.line).forEach(i=>e.push(i.line,i.char,i.length,i.tokenType,i.tokenModifiers))}processCIdentifier(e,r,n=!1){this.enqueueToStack();let i=this.consumeAnyConcurrentTokens([19,47,48].map(Ue));if(!i.length){this.popStack();return}if(!i?.[0]?.value.match(/^[_A-Za-z]/)){this.popStack();return}let s=i.map(a=>a.value).join(""),o=new vt(s,me(i[0],i.at(-1)));if(n&&!e.has(o.name)){this.popStack();return}return!r&&o.firstToken!==o.lastToken&&o.name!=="defined"&&(e.get(o.name)||this._issues.push(Y(42,o.firstToken,o.lastToken,o))),this.mergeStack(),o}isOperator(){this.enqueueToStack();let e=this.moveToNextToken;if(!e){this.popStack();return}let r=e,n;if(H(e,40)?(n="&",H(this.currentToken,40)&&(n="&&",r=this.moveToNextToken)):H(e,6)?(n="!",H(this.currentToken,0)&&(n="!=",r=this.moveToNextToken)):H(e,10)?n="~":H(e,8)?(n="|",H(this.currentToken,8)&&(n="||",r=this.moveToNextToken)):H(e,9)?n="^":H(e,4)?(n=">",H(this.currentToken,4)?(n=">>",r=this.moveToNextToken):H(this.currentToken,0)&&(n=">=",r=this.moveToNextToken)):H(e,5)?(n="<",H(this.currentToken,5)?(n="<<",r=this.moveToNextToken):H(this.currentToken,0)&&(n="<=",r=this.moveToNextToken)):H(e,15)?n="+":H(e,16)?n="-":H(e,17)?n="*":H(e,13)?n="/":H(e,18)?n="%":H(e,46)?H(this.currentToken,46)&&(n="##",r=this.moveToNextToken):H(e,0)&&H(this.currentToken,0)&&(n="==",r=this.moveToNextToken),n){let i=new ap(n,me(e,r));return this.mergeStack(),i}this.popStack()}parseScopedBlock(e,r,n){this.enqueueToStack();let i=this.moveToNextToken;if(!i||!e(i)){this.popStack();return}let s=this.peekIndex(),o=()=>{this.positionStack[this.positionStack.length-1]=s},a=m=>m.flatMap(h=>"items"in h?a(h.items):h),c=[i],l=[],u=[];u[0]={rewind:o,tokens:[]};let d=this.currentToken;for(;d&&!r(d);){if(n?.(d)){let m=this.peekIndex()+1,h=()=>{this.positionStack[this.positionStack.length-1]=m};c.push(d),l.push(d),u[u.length]={rewind:h,tokens:[]}}else if(e(d)){let m=this.parseScopedBlock(e,r,n);m&&(c.push(m),u[u.length-1].tokens.push(...a(m.items))),d=this.currentToken;continue}else c.push(d),u[u.length-1].tokens.push(d);this.moveToNextToken,d=this.currentToken}let f=d;f&&r(f)&&(this.moveToNextToken,c.push(f));let p={startToken:i,items:c,splitTokens:u,endToken:f,separatorTokens:l};return this.mergeStack(),p}isFunctionCall(e){this.enqueueToStack();let r=this.processCIdentifier(e,!1);if(!r){this.popStack();return}if(!(e.get(r.name)?.macro.identifier instanceof ii)&&!Kt(r.lastToken,this.currentToken)){this.popStack();return}let i=this.processMacroCallParams();if(!i){this.popStack();return}if(r.name==="defined")i.length>1?this._issues.push(Y(44,r.firstToken,r.lastToken,r)):i.length<1&&this._issues.push(Y(45,r.firstToken,r.lastToken,r));else{let o=e.get(r.name)?.macro;o&&(o?.identifier instanceof ii?o.identifier.params.at(-1)instanceof Na||(i.length>o.identifier.params.length?this._issues.push(Y(44,r.firstToken,r.lastToken,r,{linkedTo:[o]})):i.length<o.identifier.params.length&&this._issues.push(Y(45,r.firstToken,r.lastToken,r,{linkedTo:[o]}))):this._issues.push(Y(43,r.firstToken,r.lastToken,r)))}let s=new Gt(r,i);return s.lastToken=this.prevToken,this.mergeStack(),s}processHex(){this.enqueueToStack();let e=this.checkConcurrentTokens([at("0"),at("x",{caseInsensitive:!0})]);if(e.length!==2){this.popStack();return}let r=this.consumeAnyConcurrentTokens([19,20].map(Ue));if(!r.length){this.popStack();return}let n=Number.parseInt(r.map(s=>s.value).join(""),16),i=new ir(n,me(e[0],r.at(-1)),16);return this.mergeStack(),i}processDec(e=!1){this.enqueueToStack();let r;e&&(H(this.currentToken,16)||H(this.currentToken,15))&&Kt(this.currentToken,this.currentToken?.nextToken)&&(r=this.moveToNextToken);let n=this.consumeAnyConcurrentTokens([19].map(Ue));if(!n.length){this.popStack();return}let i=Number.parseInt(n.map(o=>o.value).join(""),10);r&&H(r,16)&&(i=4294967295-i);let s=new ir(i,me(r??n[0],n.at(-1)),10);return this.mergeStack(),s}processEnclosedExpression(e,r){this.enqueueToStack();let n,i;if(H(this.currentToken,42)){let s;n=this.moveToNextToken,i=n;let o=this.processExpression(e,r,!0);return o&&(s=new nr(o,!0),o=new nr(s,!1),s.openBracket=n),H(this.currentToken,43)?(i=this.moveToNextToken,s&&(s.closeBracket=i)):n&&this._issues.push(Y(26,n,n,r)),this.mergeStack(),o}this.popStack()}processExpression(e,r,n=!1){this.enqueueToStack();let i,s;if(n&&(s=this.isOperator()),i=this.processEnclosedExpression(e,r)||this.isFunctionCall(e)||this.processCIdentifier(e,!1)||this.processHex()||this.processDec(!0),!i){this.popStack();return}if(s&&(i.operator=s),n){let o=this.isOperator();for(;o;){let a=this.processExpression(e,r,!0);a?i instanceof nr?i.addExpression(o,a):i=new nr(i,!1,{operator:o,expression:a}):this._issues.push(Y(27,o.firstToken,o.lastToken,r)),o=this.isOperator()}}return this.mergeStack(),i}processMacroCallParams(){if(!H(this.currentToken,42))return;let e=this.parseScopedBlock(n=>!!H(n,42),n=>!!H(n,43),n=>!!H(n,24));return e?.items.length===2&&H(e.endToken,43)?[]:e?.splitTokens.map((n,i)=>{if(n.tokens.length===0)return null;let s=new Pi(n.tokens.map((o,a)=>{let c=o.value;return o.pos.line===n.tokens.at(a+1)?.pos.line?c=c.padEnd(n.tokens[a+1].pos.col-o.pos.col," "):o.value==="\\"&&(c=c.slice(0,-1)),c}).join(""),me(n.tokens[0],n.tokens.at(-1)),i);return s.splitToken=e.separatorTokens.at(i),s})}};var Tn=class extends te{constructor(r){super();this.comments=r;this.disabled=!1;r.forEach(this.addChild.bind(this))}toString(){return this.comments.map(r=>r.toString()).join(`
298
- `)}},vn=class extends te{constructor(r){super(r);this.disabled=!1;this.semanticTokenType="comment",this.semanticTokenModifiers="documentation"}toString(){let r,n=this.firstToken,i="";for(;n!==this.lastToken;)i+=n?.value.padStart(n.value.length+(r?n.pos.col-r.pos.colEnd:0)," "),r=n,n=n?.nextToken;n&&(i+=n?.value.padStart(n.value.length+(r?n.pos.col-r.pos.colEnd:0)," "));let s=i.match(/^\s*(?:(?:\/\/|\/\*+)\s*)?(.*?)\s*(?:\*\/)?\s*$/s);return s?s[1]:""}};var cp=class t extends Xi{constructor(r,n=()=>$r().requestTokens(this.fsPath,!0)){super();this.fsPath=r;this.getTokens=n;this.comments=[];this.tokens=[]}cleanUpComments(){let r=[];for(let n=0;n<this.tokens.length;n++){let i=t.processBlockComment(this.tokens,n)||t.processLineComment(this.tokens,n);i&&(n=i.index,r.push(...i.tokenUsed),this.comments.push(i.comment))}if(r.length>0){let n=new Set(r),i=[];for(let s=0;s<this.tokens.length;s++)n.has(s)||i.push(this.tokens[s]);this.tokens=i}}get allAstItems(){return this.comments}reset(){super.reset(),this.comments=[]}reparse(){return this.reset(),this.parse()}async parse(){this.tokens=this.getTokens(),this.cleanUpComments()}static processBlockComment(r,n){let i=[],s=()=>(i.push(n++),r[n]),o=()=>r[n],a=()=>r[n-1],c=o(),l=c;if(!c||!H(c,13)||(l=s(),!H(l,17)||c.pos.line!==l.pos.line||c.pos.col+1!==l.pos.col))return;let u=()=>!(!H(a(),17)||!H(o(),13)||!Kt(a(),o())),d=l.pos.line,f=c,p=[];l=s();do{if(o()?.pos.line!==d){let y=new vn(me(f,a()));p.push(y),d=o().pos.line??0,f=o()}l=s()}while(n<r.length&&!u());let m=new vn(me(f,o()));p.push(m);let h=new Tn(p);return s(),{comment:h,tokenUsed:i,index:n-1}}static processLineComment(r,n){let i=[];if(!H(r[n],13)||r.length===n+1||!H(r[n+1],13)||!Kt(r[n],r[n+1]))return;for(;r[n].pos.line===r.at(n+1)?.pos.line;)i.push(n++);return i.push(n++),{comment:new vn(me(r[i[0]],r[i.at(-1)])),tokenUsed:i,index:n-1}}};var n0=q(U());var lp=class extends te{constructor(r,n){super(r);this.content=n}toString(){let r=this.content.filter(n=>!H(n,14));return r.map((n,i)=>{let s=n.value;return n.pos.line===r.at(i+1)?.pos.line?s=s.padEnd(r[i+1].pos.col-n.pos.col," "):r.at(i+1)&&(s=s.padEnd(s.length+1," ")),s}).join("")}},rl=class extends te{constructor(r,n,i){super();this.keyword=r;this.identifier=n;this.content=i;this.addChild(r),this.addChild(this.identifier),this.content&&this.addChild(this.content)}get name(){return this.identifier instanceof vt?this.identifier.name:this.identifier.functionName.name}toString(){return this.toStringCache??=[this.identifier.toString(),...this.content?[this.content?.toString()]:[]].join(" "),this.toStringCache}toMarkupContent(){return{kind:n0.MarkupKind.Markdown,value:["```cpp",`#define ${this.toString()}`,"```"].join(`
299
- `)}}};var il=class extends te{constructor(e){super(e)}},sl=class extends te{constructor(r,n){super();this.keyword=r;this.content=n;this.active=!1;this.addChild(r)}},ol=class extends sl{constructor(r,n,i){super(r,i);this.expression=n;this.addChild(n),this.addChild(i)}useBlock(r){return this.expression&&r.has(this.expression.name)}},up=class extends sl{constructor(r,n,i){super(r,i);this.expression=n;this.addChild(n),this.addChild(i)}useBlock(r){return this.expression?.isTrue(r)}},dp=class extends ol{useBlock(e){return this.expression&&!e.has(this.expression.name)}},fp=class extends sl{};var nl=(t,e)=>{let r=t,n=[];for(;r&&(n.push(r),r!==e);)r=r.nextToken;return n},On=class extends te{constructor(r,n,i){super();this.ifBlocks=r;this.endIf=n;this.elseOption=i;r.forEach(s=>this.addChild(s)),i&&this.addChild(i),this.addChild(n)}getInValidTokenRange(r){let n=this.ifBlocks.find(i=>i.useBlock(r));return n?n.active=!0:this.elseOption&&(this.elseOption.active=!0),this.getInValidTokenRangeWhenActiveBlock(n||this.elseOption)}get inactiveRanges(){let r=[],n=!!this.elseOption;this.ifBlocks.forEach((s,o)=>{if(s.active)return;let a=o===this.ifBlocks.length-1,c=s.firstToken,l=a?n?this.elseOption.firstToken:this.lastToken:s.content?.lastToken??this.ifBlocks[o+1].firstToken??s.lastToken;r.push(Ze.create(se(c),se(l)))});let i=r.length!==this.ifBlocks.length;if(this.elseOption&&i){let s=this.elseOption.firstToken,o=this.elseOption.content?.lastToken??this.endIf?.lastToken??this.lastToken;return r.push(Ze.create(se(s),se(o))),r}if(!i){let s=this.firstToken,o=this.lastToken;return[Ze.create(se(s),se(o))]}return r}getInValidTokenRangeWhenActiveBlock(r){let n=new WeakSet,i=!1;return this.ifBlocks.forEach(s=>{let o=s.expression?.lastToken??s.keyword.lastToken;nl(s.firstToken,o).forEach(a=>n.add(a)),!i&&s===r?i=!0:s.content&&nl(s.content.firstToken,s.content.lastToken).forEach(a=>n.add(a))}),this.elseOption&&(nl(this.elseOption.keyword.firstToken,this.elseOption.keyword.lastToken).forEach(s=>n.add(s)),i&&this.elseOption.content&&nl(this.elseOption.content.firstToken,this.elseOption.content.lastToken).forEach(s=>n.add(s))),this.endIf&&nl(this.endIf.firstToken,this.endIf.lastToken).forEach(s=>n.add(s)),n}};var Ea=class extends Xi{constructor(r,n,i,s,o){super();this.fsPath=r;this.incudes=n;this.getTokens=s;this.optimizeForFormatting=o;this.tokens=[];this.nodes=[];this._comments=[];this.dtsIncludes=[];this.macroSnapShot=new Map;this.macros=new Map;this.rangesToClean=new Set;this.macroStart=!1;i&&(Array.from(i).forEach(([a,c])=>this.macroSnapShot.set(a,c)),Array.from(i).forEach(([a,c])=>this.macros.set(a,c)))}get comments(){return this._comments}removeComments(r){this._comments=this._comments.filter(n=>!r.has(n))}get currentToken(){let r=this.prevToken,n=this.peekIndex(),i=this.tokens.at(n),s=hr(r,i)||!r||H(r,14)&&r.pos.line+1===i?.pos.line;if(!(this.macroStart&&!s))return this.macroStart&&H(i,14)?(this.moveStackIndex(),this.currentToken):i}reset(r){super.reset(),this.macros.clear(),r?(this.macroSnapShot.clear(),Array.from(r).forEach(([n,i])=>this.macroSnapShot.set(n,i)),Array.from(r).forEach(([n,i])=>this.macros.set(n,i))):Array.from(this.macroSnapShot).forEach(([n,i])=>this.macros.set(n,i)),this.nodes=[],this.dtsIncludes=[],this.rangesToClean=new Set}async reparse(r){let n=this.stable;return this.parsing=new Promise(i=>{n.then(()=>{if(r&&r.size===this.macroSnapShot.size){let s=Array.from(r);if(Array.from(this.macroSnapShot).every(([o,a],c)=>{let[l,u]=s[c];return l===o&&u.macro.toString()===a.macro.toString()})){console.log("header file cache hit",this.fsPath),i();return}}this.reset(r),this.parse().then(i)})}),this.parsing}async parse(){let r=new cp(this.fsPath,this.getTokens);if(await r.stable,this.tokens=r.tokens,this._comments=r.allAstItems,this.positionStack.push(0),this.tokens.length!==0){for(;!this.done;)await this.lineProcessor();if(this.rangesToClean.size&&!this.fsPath.endsWith(".h")&&(this.tokens=this.tokens.filter(n=>!this.rangesToClean.has(n))),this.positionStack.length!==1)throw new Error("Incorrect final stack size")}}async lineProcessor(){if(this.enqueueToStack(),!(!this.prevToken||this.prevToken.pos.line!==this.currentToken?.pos.line||!fe(this.prevToken.fsPath,this.currentToken.fsPath))){this.moveEndOfLine(this.prevToken,!1),this.mergeStack();return}let n=this.currentToken,i=await this.processInclude()||this.processDefinitions()||this.processUndef()||this.processError();this.processIfDefBlocks(),n&&this.moveEndOfLine(n,!!i),this.mergeStack()}addTokensToClean(r){for(let n=r.start;n<r.start+r.count;n++){let i=this.tokens[n];i&&this.rangesToClean.add(i)}}processDefinitions(){this.enqueueToStack();let r=this.peekIndex(),n=this.moveToNextToken;if(!n||!H(n,25))return this.popStack(),!1;this.macroStart=!0;let i=new At(me(n)),s=this.isFunctionDefinition()||this.processCIdentifier(this.macros,!0);if(!s)return this._issues.push(Y(30,i.firstToken,i.lastToken,i)),this.mergeStack(),this.macroStart=!1,!0;let o=this.consumeDefinitionContent(),a;o.length&&(a=new lp(me(o[0],o.at(-1)),o));let c=new rl(i,s,a);this.macros.set(c.name,{macro:c,resolver:Vw(c.toString())}),this.nodes.push(c);let l=this.peekIndex();return this.addTokensToClean({start:r,count:l-r}),this.mergeStack(),this.macroStart=!1,!0}processUndef(){this.enqueueToStack();let r=this.peekIndex(),n=this.moveToNextToken;if(!n||!H(n,28))return this.popStack(),!1;this.macroStart=!0;let i=new At(me(n)),s=this.processCIdentifier(this.macros,!0);if(!s)return this._issues.push(Y(30,i.firstToken,i.lastToken,i)),this.mergeStack(),this.macroStart=!1,!0;let o=new rl(i,s);this.macros.delete(s.name),this.nodes.push(o);let a=this.peekIndex();return this.addTokensToClean({start:r,count:a-r}),this.mergeStack(),this.macroStart=!1,!0}processError(){this.enqueueToStack();let r=this.peekIndex(),n=this.moveToNextToken;if(!n||!H(n,29))return this.popStack(),!1;this.moveEndOfLine(n,!1,!0);let i=this.peekIndex();return this.addTokensToClean({start:r,count:i-r}),this.mergeStack(),!0}consumeDefinitionContent(){let r=[];for(;this.currentToken;){let n=this.moveToNextToken;n&&r.push(n)}return r}isFunctionDefinition(){this.enqueueToStack();let r=this.processCIdentifier(this.macros,!0);if(!r){this.popStack();return}let n=this.moveToNextToken;if(!H(n,42)||!Kt(r.lastToken,n)){this.popStack();return}let i=[],s=this.processCIdentifier(this.macros,!0)||this.processVariadic();for(;s;)i.push(s),!H(this.currentToken,24)&&!H(this.currentToken,43)?this._issues.push(Y(28,s.firstToken,s.lastToken,s)):H(this.currentToken,43)||(n=this.moveToNextToken),s=this.processCIdentifier(this.macros,!0)||this.processVariadic();let o=new ii(r,i);if(H(this.currentToken,43))n=this.moveToNextToken,o.lastToken=n;else{o.lastToken=this.prevToken;let a=i.at(-1)??o;this._issues.push(Y(26,a.firstToken,a.lastToken,a))}return this.mergeStack(),o}processVariadic(){this.enqueueToStack();let r=this.checkConcurrentTokens([Ue(45),Ue(45),Ue(45)]);if(r.length!==3){this.popStack();return}let n=new Na(me(r[0],r.at(-1)));return this.mergeStack(),n}processIfDefBlocks(){let r=this.peekIndex(),n=this.parseScopedBlock(a=>!!a&&[33,34,32].some(c=>H(a,c))&&!hr(a.prevToken,a),a=>!!a&&[37].some(c=>H(a,c))&&!hr(a.prevToken,a),a=>!!a&&[36,35].some(c=>H(a,c))&&!hr(a.prevToken,a));if(!n)return;let i=this.processIfBlock(n);this.nodes.push(i);let s=i.getInValidTokenRange(this.macros);this.tokens=this.tokens.filter(a=>!s.has(a));let o=i.inactiveRanges;this._comments.forEach(a=>{o.some(c=>po(c,a.range))&&(a.disabled=!0)}),[...i.ifBlocks,...i.elseOption?[i.elseOption]:[]].forEach(a=>{!a.active&&a.content&&this._issues.push(Y(47,a.content.firstToken,a.content.lastToken,a.content,{severity:al.DiagnosticSeverity.Hint,tags:[al.DiagnosticTag.Unnecessary]}))}),this.positionStack[this.positionStack.length-1]=r}processIfBlock(r){this.enqueueToStack();let n=new At(me(r.startToken)),i=[],s;r.splitTokens.forEach((c,l)=>{c.rewind();let u=this.prevToken,d=l===r.splitTokens.length-1&&H(u,36),f=new At(me(u));this.macroStart=!0;let p,m;if(H(f.firstToken,33)||H(f.firstToken,34)?(m=this.processCIdentifier(this.macros,!0),p=m):(p=this.processExpression(this.macros,f,!0)||this.processCIdentifier(this.macros,!0),p instanceof vt&&p.name.toLowerCase()==="defined"&&(p=this.processExpression(this.macros,f,!0)||this.processCIdentifier(this.macros,!0))),this.macroStart=!1,d){let h=u,y=new At(me(h)),S;c.tokens.length&&(S=new il(me(c.tokens[0],c.tokens.at(-1)))),s=new fp(y,S??null)}else{p||this._issues.push(Y(31,f.firstToken,f.lastToken,f));let h,y=c.tokens.indexOf(p?.lastToken??n.lastToken)+1,S=c.tokens[y];y!==-1&&S&&(h=new il(me(S,c.tokens.at(-1)))),H(f.firstToken,33)?i.push(new ol(f,m??null,h??null)):H(f.firstToken,34)?i.push(new dp(f,m??null,h??null)):i.push(new up(f,p??null,h??null))}});let o;r.endToken?o=new At(me(r.endToken)):this._issues.push(Y(46,n.firstToken,n.lastToken,n));let a=new On(i,o??null,s);return this.mergeStack(),a}get allAstItems(){return[...this.dtsIncludes,...this.nodes,...this.comments]}resolveInclude(r){if(r.path.path)return r.path.relative?[(0,Ra.resolve)((0,Ra.dirname)(r.fsPath),r.path.path),...this.incudes.map(n=>(0,Ra.resolve)(n,r.path.path))].find(n=>(0,rv.existsSync)(n)):this.incudes.map(n=>(0,Ra.resolve)(n,r.path.path)).find(n=>(0,rv.existsSync)(n))}async processInclude(){this.enqueueToStack();let r=this.peekIndex(),n=this.currentToken;if(!n)return this.popStack(),!1;let i=n,s=n;if(H(n,26))this.moveToNextToken;else{let h=this.checkConcurrentTokens([Ue(13),at("include"),Ue(13)]);if(h.length!==3)return this.popStack(),!1;i=h[0],s=h.at(-1)}let o=i,a=new At(me(i,s));n=this.moveToNextToken;let c=n,l=!!H(n,21);if(!c||!l&&!H(n,5))return o&&this.moveEndOfLine(o),this.mergeStack(),!0;let u="";if(l)u=n?.value??"";else for(;this.currentToken?.pos.line===o.pos.line&&!H(this.currentToken,4);)u+=this.currentToken?.value??"",n=this.moveToNextToken;let d=new ka(u,l,me(c,n)),f=new ni(a,d);this.dtsIncludes.push(f),l||(this.currentToken?.pos.line!==o.pos.line||!H(this.currentToken,4)?this._issues.push(Y(12,f.firstToken,f.lastToken,f)):(n=this.moveToNextToken,d.lastToken=n)),this.mergeStack();let p=this.peekIndex(),m=this.resolveInclude(f);if(f.resolvedPath=m,m||this._issues.push(Y(36,f.path.firstToken,f.path.lastToken,f.path,{severity:al.DiagnosticSeverity.Warning})),m&&!this.optimizeForFormatting){$r().requestTokens(m,!0);let h=cl().getCPreprocessorParser(m,this.incudes,this.macros,this.fsPath);await h.stable,this._issues.push(...h.issues),this.macros.clear(),Array.from(h.macros).forEach(([y,S])=>this.macros.set(y,S)),m.endsWith(".h")?this.addTokensToClean({start:r,count:p-r}):(this.tokens=Qw(this.tokens,r,p,h.tokens),this.positionStack[this.positionStack.length-1]=r),this.nodes.push(...h.nodes),this.dtsIncludes.push(...h.dtsIncludes)}else this.addTokensToClean({start:r,count:p-r});return!0}};var nv,pp=class{constructor(){this.headerFiles=new Map;this.includeOwners=new WeakMap}getCPreprocessorParser(e,r,n,i){e=ft(e);let s=`${Array.from(n).map(l=>l[1].macro.toString()).join("::")}`,o=this.headerFiles.get(e)?.get(s);if(o)return o.reparse(n),o;console.log("No c-preprocessor cache",e);let a=new Ea(e,r,n),c=this.includeOwners.get(a)??new Set;return c.add(i),this.includeOwners.set(a,c),this.headerFiles.has(e)||this.headerFiles.set(e,new Map),this.headerFiles.get(e)?.set(s,a),a}reset(e){e=ft(e);let r=this.headerFiles.get(e);r&&Array.from(r).forEach(([n,i])=>{console.log("disposing c-preprocessor cache for",e),Array.from(this.includeOwners.get(i)??[]).forEach(this.reset.bind(this)),this.headerFiles.delete(e)})}};function cl(){return nv??=new pp,nv}function i0(){nv=new pp}var iv,hp=class t{constructor(){this.fileMap=new Map}static clone(e){let r=e.length;if(r===0)return[];let n=new Array(r),i;for(let s=0;s<r;s++){let o=e[s],a={tokens:o.tokens,pos:o.pos,value:o.value,fsPath:o.fsPath,prevToken:i,nextToken:void 0};i&&(i.nextToken=a),n[s]=a,i=a}return n}needsRenew(e,r){return e=ft(e),this.fileMap.get(e)?.text!==r}getDocument(e,r){return Lt.create(e,"devicetree",0,r??this.fileMap.get(e)?.text??(0,ll.readFileSync)(e).toString())}renewLexer(e,r){if(e=ft(e),cl().reset(e),!r&&!(0,ll.existsSync)(e))return[];try{r??=(0,ll.readFileSync)(e).toString();let n=new rn(r,e);return this.fileMap.set(e,n),t.clone(n.tokens)}catch{}return[]}requestTokens(e,r){e=ft(e);let n=this.fileMap.get(e)?.tokens;return!n&&r?[...this.renewLexer(e)]:t.clone(n??[])}reset(e){e=ft(e),cl().reset(e),this.fileMap.delete(e)}};function $r(){return iv??=new hp,iv}function s0(){iv=new hp}var Ei=class t{constructor(e){this.context=e;this.comments=[];this.references=[];this.unlinkedDeletes=[];this.unlinkedRefNodes=[];this.globalDeletes=[];this.rootNode=new J(this.context.bindingLoader,"/");this.labelsUsedCache=new Map;this.fileTopMostAstCache=new Map}fileTopMostAsts(e){let r=this.fileTopMostAstCache.get(e);if(r)return r;let n=[...this.rootNode.implementations,...this.references,...this.unlinkedDeletes,...this.unlinkedRefNodes,...this.globalDeletes,...this.context.overlayParsers.flatMap(i=>[...i.cPreprocessorParser.allAstItems,...i.unhandledStatements.children]),...this.context.parser.cPreprocessorParser.allAstItems,...this.context.parser.unhandledStatements.children].flatMap(i=>i.getTopMostAstNodeForFile(e));return this.fileTopMostAstCache.set(e,n),n}getDeepestAstNode(e,r){let n=this.fileTopMostAsts(e),i=$r().requestTokens(e,!1),s=n.find(o=>Qt(o,e,r)||Uw(i,o,r));if(!s){let o=this.context.allParsers.flatMap(l=>l.includes),a=(l,u)=>{let d=o.find(f=>fe(f.resolvedPath,l));return d&&this.context.getSortKeyFile(u,l)===void 0?a(d.lastToken.fsPath,se(d.lastToken)):d},c=a(e,r);c&&(s=n.at(-1)?.parentNode,e=c.fsPath,r=mp.Position.create(c.lastToken.pos.line,c.lastToken.pos.colEnd))}if(s instanceof ot){let a=this.rootNode.getReferenceBy(s)?.getDeepestAstNode(e,r);return a?{...a,runtime:this}:{item:null,runtime:this,ast:ti(s,e,r)}}else if(s instanceof nt&&s.path){let o=this.rootNode.getDeepestAstNode(e,r);return o?{...o,runtime:this}:void 0}else if(s instanceof Ce&&s.path){let o=t.getNodeFromPath(s.path.slice(1),this.rootNode)?.getDeepestAstNode(e,r);return o?{...o,runtime:this}:void 0}else if(s)return{runtime:this,item:null,ast:ti(s,e,r)}}static getNodeFromPath(e,r,n=!0){if(e.length===0)return r;let i=e[0].split("@"),s=i[0],a=i.at(1)?.split(",").map(u=>Number.parseInt(u,16)),c=e.slice(1),l=r.getNode(s,a,n);return l?t.getNodeFromPath(c,l,n):void 0}resolvePath(e,r){if(!e.at(0)?.startsWith("&"))return e;let n=this.labelsUsedCache.get(e[0].slice(1));return n||(r??=this.rootNode.allDescendantsLabels,r.find(s=>s.label.value===e.at(0)?.slice(1)&&s.parentNode instanceof De)?.lastLinkedTo?.path)}get issues(){return this.issuesCache??=[...this.labelIssues(),...this.includeIssues(),...this.rootNode.getIssues(this.context.macros)],this.issuesCache}includeIssues(){let e=new Map;for(let a of this.context.allParsers.flatMap(c=>c.includes)){if(!a.resolvedPath||!wt(a.resolvedPath))continue;let c=e.get(a.resolvedPath)??[];c.push(a),e.set(a.resolvedPath,c)}let r=new Set([...e.entries()].filter(([,a])=>a.length>1).map(([a])=>a)),n=new Map,i=a=>{for(let c of a.includes){let l=n.get(c.fsPath)??[];l.push(a.fsPath),n.set(c.fsPath,l),i(c)}},s=this.context.getFileTree();i(s.mainDtsPath);for(let a of s.overlays)i(a);function o(a,c=new Set){if(c.has(a))return!1;c.add(a);let l=n.get(a);if(!l)return!1;for(let u of l)if(r.has(u)||o(u,c))return!0;return!1}return[...e.values()].filter(a=>a.length>1).filter(a=>!o(a[0].resolvedPath)).map(([a,...c])=>Bt(11,a.firstToken,a.lastToken,a,{linkedTo:c,templateStrings:[`#include <${a.path.path}>`,c.map(l=>o0.default.basename(l.fsPath)).join(", ")],severity:mp.DiagnosticSeverity.Warning}))}labelIssues(){let e=[],r=new Map;return this.rootNode.allDescendantsLabelsMapped.forEach(n=>{r.has(n.label.label.value)?r.get(n.label.label.value)?.push(n):r.set(n.label.label.value,[n])}),Array.from(r).forEach(n=>{let i=n[1];if(i.length>1){let s=i.find(a=>a.owner instanceof J);if(!i.every(a=>a&&a.owner===s?.owner)||!s){let a=i[i.length-1].label;e.push(Bt(4,a.firstToken,a.lastToken,a,{linkedTo:i.slice(0,-1).map(c=>c.label),templateStrings:[i.at(0).label.label.value]}))}}}),e}get typesIssues(){let e=r=>[...r.nodeType?.getIssue(this,r)??[],...r.nodes.flatMap(n=>e(n))];return this.typesIssuesCache??=e(this.rootNode),this.typesIssuesCache}getOrderedNodeAst(e){return Hw(e.implementations,this.context)}};var ul=q(U());var a0=q(U());var gp=class extends te{constructor(r){super();this.values=r;this.docSymbolsMeta={name:"Values",kind:a0.SymbolKind.String},this.values.forEach(n=>this.addChild(n))}toString(){return this.values.map(r=>r?.toString()).join(",")}toJson(){return this.values.length===1?this.values[0]?.toJson():this.values.map(r=>r?.toJson())}};var c0=q(U());var yp=class extends te{constructor(r){super();this.keyword=r;this.addChild(r),this.docSymbolsMeta={name:"DTS Document version",kind:c0.SymbolKind.Function}}};var wi=class extends te{constructor(r,n){super();this.value=r;this.labels=n;this.labels.forEach(i=>{this.addChild(i)}),this.addChild(this.value)}toString(r){return`${this.labels.map(n=>n.toString()).join(" ")}${this.value?.toString(r)??"NULL"}`}toPrettyString(r){return`${this.labels.map(n=>n.toString()).join(" ")}${this.value?.toPrettyString(r)??"NULL"}`}};var l0=q(U());var Tp=class extends te{constructor(r,n,i){super();this.keyword=r;this.startAddress=n;this.endAddress=i;this.addChild(r),this.docSymbolsMeta={name:"Memreserve",kind:l0.SymbolKind.Function},this.addChild(n),this.addChild(i)}toString(){return`/memreserve/ 0x${this.startAddress?.value?.toString(16)} 0x${this.endAddress?.value?.toString(16)}`}};var u0=q(U());var vp=class extends te{constructor(r,n){super();this.keyword=r;this.bitsSize=n;this.addChild(r),this.docSymbolsMeta={name:"bits",kind:u0.SymbolKind.Function},this.addChild(n)}toString(){return`/bits/ ${this.bitsSize?.value?.toString()}`}};var xn=class extends Xi{constructor(r,n,i,s,o){super();this.fsPath=r;this.incudes=n;this.tokens=[];this.others=[];this.rootDocument=new De;this.unhandledStatements=new nt;this.injectedMacros=[];this.plugin=!1;this.#e=!1;this.cPreprocessorParser=new Ea(this.fsPath,this.incudes,i,s,o)}get issues(){return[...this._issues,...this.cPreprocessorParser.issues]}getFiles(){return[this.fsPath,...this.cPreprocessorParser.dtsIncludes.flatMap(r=>r.resolvedPath).filter(r=>!!r)]}reset(){super.reset(),this.others=[],this.rootDocument=new De,this._issues=[],this.unhandledStatements=new nt,this.#e=!1,this.plugin=!1}async reparse(){let r=performance.now(),n=this.stable;return this.parsing=new Promise(i=>{n.then(async()=>{this.reset(),await this.cPreprocessorParser.reparse(),await this.parse(),console.log("parsing",performance.now()-r),i()})}),this.parsing}async parse(){if(await this.cPreprocessorParser.stable,this.tokens=this.cPreprocessorParser.tokens,ft(this.fsPath).endsWith(".h")||(this.positionStack.push(0),this.tokens.length===0))return;let r=async()=>{if(!(this.isDtsDocumentVersion()||this.isMemreserve()||this.isPlugin()||this.isRootNodeDefinition(this.rootDocument)||this.isDeleteNode(this.rootDocument,"Ref")||this.processInjectPreProcessorMacros(this.cPreprocessorParser.macros)||this.isChildNode(this.rootDocument,"Ref")||this.isProperty(this.unhandledStatements)||this.isDeleteProperty(this.unhandledStatements)||this.isChildNode(this.unhandledStatements,"Name"))){let s=this.moveToNextToken;s&&(this._issues.push(Y(22,s,s,null)),this.reportExtraEndStatements())}};for(;!this.done;)await r();this.fsPath.endsWith(".dtsi")||(this.unhandledStatements.nodes.forEach(s=>{this._issues.push(Y(53,s.firstToken,s.lastToken,s))}),this.unhandledStatements.properties.forEach(s=>{this._issues.push(Y(32,s.firstToken,s.lastToken,s))}),this.unhandledStatements.deleteProperties.forEach(s=>{this._issues.push(Y(33,s.firstToken,s.lastToken,s))}));let n=this.allAstItems.flatMap(s=>[s,...s.allDescendants]),i=this.cPreprocessorParser.comments;if(i.length&&n.forEach(s=>{(s instanceof De||s instanceof Ee||s instanceof ni)&&Kw(s,i)}),this.positionStack.length!==1)throw new Error("Incorrect final stack size")}processInjectPreProcessorMacros(r){let n=this.peekIndex(),i=this.isFunctionCall(r)||this.processCIdentifier(r,!0,!0);return this.injectPreProcessorResults(r,i,n)}injectPreProcessorResults(r,n,i){let s=n?.resolve(r);if(n&&typeof s=="string"){s=xT(s);let o=Vf(n.fsPath,ce(n)),a=new Set;if(this.cPreprocessorParser.comments.forEach(l=>{Qt(n,n.fsPath,l.range.start)&&a.add(l)}),this.cPreprocessorParser.removeComments(a),this.injectedMacros.push(n),n instanceof vt&&s.includes(n.name)||n instanceof Gt&&s.includes(n.functionName.name))return!0;let c=new rn(s,o);return this.tokens.splice(i,this.peekIndex()-i,...c.tokens),this.positionStack[this.positionStack.length-1]=i,!0}}isRootNodeDefinition(r){this.enqueueToStack();let n=this.moveToNextToken,i=n;if(!n||!H(n,13))return this.popStack(),!1;if(i=this.moveToNextToken,!i||!H(i,2))return this.popStack(),!1;let s=new nt;s.openScope=i,r.addNodeChild(s),this.processNode(s,"Name");let o=this.nodeEnd(s)??i;return s.firstToken=n,s.lastToken=o,this.mergeStack(),!0}nodeEnd(r){let n=this.currentToken;if(H(n,3))this.moveToNextToken;else{let i=this.prevToken;return i&&this._issues.push(Y(3,i,i,r)),this.endStatement(r,!1)}return this.prevToken?.value==="}"&&(r.closeScope=this.prevToken),this.endStatement(r)}isNodeEnd(){return H(this.currentToken,3)||H(this.currentToken,1)}endStatement(r,n=!0){let i=this.currentToken;if(!H(i,1)){let s=this.prevToken;if(s&&n)return this._issues.push(Y(1,s,s,r)),s}return this.moveToNextToken,this.reportExtraEndStatements(),i}reportExtraEndStatements(){for(;H(this.currentToken,1);){let r=this.moveToNextToken;r&&this._issues.push(Y(23,r,r,null))}}processNode(r,n){if(this.done)return!1;let i=!1,s=!1;do{for(;this.processInjectPreProcessorMacros(this.cPreprocessorParser.macros););if(s=this.isChildNode(r,n)||this.isProperty(r)||this.isDeleteNode(r,n)||this.isDeleteProperty(r),!s&&!this.isNodeEnd()&&!this.done){let o=this.moveToNextToken;o&&(this._issues.push(Y(22,o,o,null)),this.reportExtraEndStatements())}else if(this.done)break;i=i||s}while(!this.isNodeEnd());return i}processOptionalLabelAssign(r=!1){let n=[],i=this.isLabelAssign(r);for(;i;)n.push(i),i=this.isLabelAssign(r);return n}isChildNode(r,n){this.enqueueToStack();let i;n==="Name"&&(i=this.isOmitIfNoRefNode());let s=this.processOptionalLabelAssign(),o,a,c=n==="Ref"?new ot(s):new Ce(s,i);if(n==="Ref"?(this.enqueueToStack(),a=this.processNodePathRef(c),!a||!H(this.currentToken,2)?(this.popStack(),a=void 0):this.mergeStack(),a??=this.isLabelRef(c)):n==="Name"&&(o=this.isNodeName()),!a&&!o){if(!H(this.currentToken,2))return this.popStack(),!1;c.firstToken=this.currentToken,this._issues.push(Y(n==="Name"?[7]:[10,48,11],c.firstToken,this.currentToken?.nextToken,c))}let l=!1;if(a&&c instanceof ot?(c.reference=a,l=!0):o&&c instanceof Ce&&(l=o.address!==void 0,c.name=o),H(this.currentToken,2)){c.openScope=this.moveToNextToken;let u=!1;do u=this.processNode(c,"Name");while(u);let d=this.nodeEnd(c);c.lastToken=d}else if(l){let u=a??o;u&&this._issues.push(Y(2,u.firstToken,u.lastToken,u))}else return this.popStack(),!1;return r.addNodeChild(c),this.mergeStack(),!0}processNodeAddress(r){let n=this.prevToken;this.enqueueToStack();let i=this.checkConcurrentTokens([at("0"),at("x",{caseInsensitive:!0})]);i.length!==2?(i=[],this.popStack()):(this._issues.push(Y(50,i[0],i[1],r,{severity:ul.DiagnosticSeverity.Warning})),n=i.at(-1),this.mergeStack());let s=this.consumeAnyConcurrentTokens([19,20,48].map(Ue)),o=l=>{l.length%8!==0&&(l=l.padStart(Math.ceil(l.length/8)*8,"0"));let u=[];for(let d=0;d<l.length;d+=8){let f=l.slice(d,d+8);u.push(parseInt(f,16)>>>0)}return u},a=s.length?o(s.filter(l=>l.value!=="_").map(l=>l.value).join("")):[NaN];return n&&(a.some(l=>Number.isNaN(l))?this._issues.push(Y(8,n,n,r)):!Number.isNaN(a)&&!Kt(n,s[0])&&!ki(s[0].fsPath)&&this._issues.push(Y(29,n,s[0],r,{inclusiveStart:!1,inclusiveEnd:!1}))),this.currentToken?.value.toUpperCase()==="ULL"&&(this._issues.push(Y(51,this.currentToken,this.currentToken,r,{severity:ul.DiagnosticSeverity.Warning})),this.moveToNextToken),new Yc(a,me(i.at(0)??s[0]??this.prevToken,this.prevToken))}processNodeAddresses(r){this.enqueueToStack();let n=this.checkConcurrentTokens([Ue(49)]);if(n.length){Kt(r.lastToken,n[0])||this._issues.push(Y(29,r.lastToken,n[0],r,{inclusiveStart:!1,inclusiveEnd:!1}));let i=[],s=()=>{this.processInjectPreProcessorMacros(this.cPreprocessorParser.macros),i.push(this.processNodeAddress(r)),H(this.currentToken,24)&&(this.prevToken&&!Kt(this.prevToken,this.currentToken)&&this._issues.push(Y(29,this.prevToken,this.currentToken,r,{inclusiveStart:!1,inclusiveEnd:!1})),this.moveToNextToken,s())};s();let o=this.currentToken;for(;!H(this.currentToken,2)&&!H(this.currentToken,1)&&!H(this.currentToken,3)&&!H(this.currentToken,13)&&hr(this.currentToken,i.at(-1)?.lastToken);)this.moveToNextToken;if(o&&o!==this.currentToken){this._issues.push(Y(52,o,this.currentToken,r));let a=new Yc([],me(o,this.prevToken));i.push(a)}return this.mergeStack(),i}this.popStack()}isNodeName(){this.enqueueToStack();let r=this.consumeAnyConcurrentTokens([19,47,24,45,48,15,16].map(Ue));if(!r.length){this.popStack();return}let n=r.map(a=>a.value).join(""),i=new je(n,me(r[0],r.at(-1))),s=this.processNodeAddresses(i);i.address=s;let o=["__overlay__","__fixups__","__local_fixups__","__symbols__","__overrides__","__dormant__"];return!zf(n)&&(!this.plugin||!o.includes(n)&&this.plugin)&&this._issues.push(Y(49,i.firstToken,i.lastToken,i)),this.mergeStack(),i}isPropertyName(){this.enqueueToStack();let r=this.consumeAnyConcurrentTokens([19,47,24,45,48,15,16,44,46].map(Ue));if(!r.length){this.popStack();return}let n=new Qe(r.map(i=>i.value).join(""),me(r[0],r.at(-1)));return this.mergeStack(),n}isLabelName(){this.enqueueToStack();let r=this.consumeAnyConcurrentTokens([19,47,48].map(Ue));if(!r.length){this.popStack();return}if(!zf(r?.[0].value)){this.popStack();return}let n=r.map(s=>s.value).join(""),i=new mr(n,me(r[0],r[r.length-1]));return this.mergeStack(),i}isLabelAssign(r){this.enqueueToStack();let n=this.consumeAnyConcurrentTokens([19,47,48].map(Ue));if(!n.length){this.popStack();return}if(!zf(n?.[0].value)){this.popStack();return}let i=n.map(c=>c.value).join(""),s=this.currentToken,o=s&&H(s,50),a=new Ps(new mr(i,me(n[0],n.at(-1))),me(n[0],o?s:n.at(-1)));if(o){let c=n.at(-1);c&&(s.pos.line!==a.firstToken.pos.line||s.pos.col!==c.pos.colEnd)&&this._issues.push(Y(29,c,s,a,{inclusiveStart:!1,inclusiveEnd:!1})),this.moveToNextToken}else if(r)this._issues.push(Y(24,a.firstToken,a.lastToken,a));else{this.popStack();return}return this.mergeStack(),a}isProperty(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(),i=this.isPropertyName();if(!i)return this.popStack(),!1;if(H(this.currentToken,2)||H(this.currentToken,49))return this.popStack(),!1;let s=new Ee(i,n),o;H(this.currentToken,0)?(s.assignOperatorToken=this.moveToNextToken,o=this.processValue(r),o?.values.filter(c=>!!c).length||this._issues.push(Y(0,s.firstToken,s.lastToken,s)),s.values=o??null):s.values=void 0;let a=this.endStatement(s);return s.lastToken=a,r.addNodeChild(s),this.mergeStack(),!0}isDtsDocumentVersion(){this.enqueueToStack();let r=this.checkConcurrentTokens([Ue(13),at("d"),at("ts"),Ue(16),at("v"),at("1")]);if(r.length!==6)return this.popStack(),!1;let n=r[0],i=n,s=new At;s.firstToken=n;let o=new yp(s);if(this.others.push(o),H(this.currentToken,13))i=this.moveToNextToken;else return s.lastToken=r.at(-1),this._issues.push(Y(21,o.firstToken,o.lastToken,o)),this.mergeStack(),!0;return s.lastToken=i,o.lastToken=this.endStatement(o),this.mergeStack(),!0}isMemreserve(){this.enqueueToStack();let r=this.checkConcurrentTokens([Ue(13),at("memreserve")]);if(r.length!==2)return this.popStack(),!1;let n=new At;n.firstToken=r[0];let s=r[0];H(this.currentToken,13)?(s=this.moveToNextToken,n.lastToken=s):(n.lastToken=r.at(-1),this._issues.push(Y(21,n.firstToken,n.lastToken,n)));let o=this.processHex()||this.processDec(),a=o&&(this.processHex()||this.processDec()),c=new Tp(n,o,a);if(this.others.push(c),o||this._issues.push(Y(37,n.firstToken,n.lastToken,n)),!a){let l=o??n;this._issues.push(Y(38,l.firstToken,l.lastToken,c))}return c.lastToken=this.endStatement(c),this.mergeStack(),!0}isPlugin(){this.enqueueToStack();let r=this.checkConcurrentTokens([Ue(13),at("plugin"),Ue(13)]);if(r.length!==3)return this.popStack(),!1;let n=new At(me(r[0],r.at(-1)));return n.lastToken=this.endStatement(n),this.mergeStack(),this.others.push(n),this.plugin=!0,!0}processBits(){this.enqueueToStack();let r=this.checkConcurrentTokens([Ue(13),at("b"),at("its")]);if(r.length!==3){this.popStack();return}let n=new At;n.firstToken=r[0];let s=r[0];H(this.currentToken,13)?(s=this.moveToNextToken,n.lastToken=s):(n.lastToken=r.at(-1),this._issues.push(Y(21,n.firstToken,n.lastToken,n)));let o=this.processDec(),a=new vp(n,o);return this.others.push(a),o?o.value!==8&&o.value!==16&&o.value!==32&&o.value!==64&&this._issues.push(Y(40,o.firstToken,o.lastToken,o)):this._issues.push(Y(39,n.firstToken,n.lastToken,n)),this._issues.push(Y(41,a.firstToken,a.lastToken,a,{severity:ul.DiagnosticSeverity.Warning})),this.mergeStack(),a}isOmitIfNoRefNode(){this.enqueueToStack();let r=this.checkConcurrentTokens([Ue(13),at("omit"),Ue(16),at("if"),Ue(16),at("no"),Ue(16),at("ref"),Ue(13)]);if(r.length!==9){this.popStack();return}let n=new At(me(r[0],r.at(-1)));return this.mergeStack(),n}isDeleteNode(r,n){this.enqueueToStack();let i=this.checkConcurrentTokens([Ue(13),at("d"),at("e"),at("lete",{allowPartial:!0}),Ue(16),at("node",{allowPartial:!0})]);if(!i.length)return this.popStack(),!1;let s=i[0],o=s,a=new At;if(a.firstToken=s,i.length===1&&!H(this.currentToken,2)){this._issues.push(Y(25,a.firstToken,a.lastToken,a)),a.lastToken=i.at(-1);let d=new Qr(a);return r.addNodeChild(d),this.mergeStack(),!0}let c=i.map(d=>d.value??"").join("");if(!"/delete-node/".startsWith(c)||c.endsWith("-"))return this.popStack(),!1;a.lastToken=i.at(-1),c!=="/delete-node"?this._issues.push(Y(c.startsWith("/delete-n")?34:25,a.firstToken,a.lastToken,a)):H(this.currentToken,13)?(o=this.moveToNextToken,a.lastToken=o):this._issues.push(Y(21,a.firstToken,a.lastToken,a));let l=new Qr(a);if(hr(a.lastToken,s)){let d=this.processNodePathRef(r);d&&n==="Name"&&this._issues.push(Y(7,d.firstToken,d.lastToken,d));let f=d?void 0:this.isLabelRef(r);f&&n==="Name"&&this._issues.push(Y(7,f.firstToken,f.lastToken,f));let p=d||f?void 0:this.isNodeName();p&&n==="Ref"&&this._issues.push(Y(10,p.firstToken,p.lastToken,p)),!d&&!p&&!f&&this._issues.push(Y([7,10],l.firstToken,l.lastToken,l)),l.nodeNameOrRef=d??f??p??null}else n==="Name"?this._issues.push(Y(7,a.firstToken,a.lastToken,a)):n==="Ref"&&this._issues.push(Y(10,a.firstToken,a.lastToken,a));let u=this.endStatement(l);return l.lastToken=u,r.addNodeChild(l),this.mergeStack(),!0}isDeleteProperty(r){this.enqueueToStack();let n=this.checkConcurrentTokens([Ue(13),at("d"),at("e"),at("lete",{allowPartial:!0}),Ue(16),at("property",{allowPartial:!0})]);if(!n.length)return this.popStack(),!1;let i=n[0],s=i,o=new At;if(o.firstToken=i,n.length===1&&!H(this.currentToken,2)){this._issues.push(Y(25,o.firstToken,o.lastToken,o)),o.lastToken=n.at(-1);let u=new dt(o);return r.addNodeChild(u),this.mergeStack(),!0}let a=n.map(u=>u.value??"").join("");if(!"/delete-property/".startsWith(a)||a.endsWith("-"))return this.popStack(),!1;o.lastToken=n.at(-1),a!=="/delete-property"?this._issues.push(Y(a.startsWith("/delete-p")?35:25,o.firstToken,o.lastToken,o)):H(this.currentToken,13)?(s=this.moveToNextToken,o.lastToken=s):this._issues.push(Y(21,o.firstToken,o.lastToken,o));let c=new dt(o);if(hr(o.lastToken,i)){let u=this.isPropertyName();u||this._issues.push(Y(6,c.firstToken,c.lastToken,c)),c.propertyName=u??null}else this._issues.push(Y(6,o.firstToken,o.lastToken,o));let l=this.endStatement(c);return c.lastToken=l,r.addNodeChild(c),this.mergeStack(),!0}isNodePathRef(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!0),i=this.processNodePathRef(r);if(!i){this.popStack();return}let s=[];this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&s.push(...this.processOptionalLabelAssign(!0));let o=new qr(n,i,s);return this.mergeStack(),o}processValue(r){this.enqueueToStack();let i=(()=>{let o=()=>(this.processStringValue()||this.isNodePathRef(r)||this.isLabelRefValue(r)||this.arrayValues(r)||this.processByteStringValue()||this.isExpressionValue(r))??null,a=o();if(!a)return[];let c=[a];for(;!H(this.currentToken,1);){let l=this.prevToken,u=this.currentToken,d,f=H(this.currentToken,24);if(f)d=this.currentToken,this.moveToNextToken;else if(!hr(this.prevToken,this.currentToken))break;let p=o();if(u&&p===null&&f){let h=new te(me(u,this.currentToken));this._issues.push(Y(0,h.firstToken,h.lastToken,h))}if(!f&&p===null)break;if(l&&!f&&p){let h=new te(me(l));this._issues.push(Y(28,h.firstToken,h.lastToken,h))}let m=c.at(-1);m&&(m.nextValueSeparator??=d),c.push(p)}return c})();if(i.length===0){this.popStack();return}return this.mergeStack(),new gp(i)}processStringValue(){this.enqueueToStack();let r=this.processOptionalLabelAssign(!0),n=this.consumeAnyConcurrentTokens([Ue(21)]);if(!n.length){this.popStack();return}if(n.some(u=>u.value===void 0))throw new Error("Token must have value");let i=n.map(u=>u.value).join(`
300
- `),s=i,o=['"',"'"].some(u=>s.endsWith(u));o&&(s=s.slice(1,-1));let a=new ne(s,me(n[0],n.at(-1)));o||this._issues.push(Y(i.startsWith('"')?16:17,a.firstToken,a.lastToken,a));let c=[];this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&(c=this.processOptionalLabelAssign(!0));let l=new qr(r,a,c);return this.mergeStack(),l}arrayValues(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!0),i=this.processBits(),s=this.currentToken;if(H(s,5))this.moveToNextToken;else{this.popStack();return}let o=this.processArrayValues(r)??null;o.openBracket=s;let a=this.processOptionalLabelAssign(!0)??[],c=new qr(n,o,a,i);if(!H(this.currentToken,4))this._issues.push(Y(12,c.firstToken,c.lastToken,c));else{let u=this.moveToNextToken;o&&(o.closeBracket=u)}let l=[];return this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&(l=this.processOptionalLabelAssign(!0)),this.mergeStack(),c.endLabels.push(...l),c.firstToken=s,c.lastToken=this.prevToken,c}processByteStringValue(){this.enqueueToStack();let r=this.processOptionalLabelAssign(!0),n=this.moveToNextToken,i=n;if(!H(i,11)){this.popStack();return}let s=this.processLabeledValue(()=>this.processHexString()),o=this.processOptionalLabelAssign(!0)??[];s.forEach(u=>{let d=0;u.value&&u.value.firstToken===u.value.lastToken&&(d=u.value.firstToken.pos.len),d%2!==0&&this._issues.push(Y(15,u.firstToken,u.lastToken,u))});let a=new Lr(s??[]);a.openBracket=i,a.values.length===0&&(a.firstToken=n,this._issues.push(Y(14,a.firstToken,a.lastToken,a,{severity:ul.DiagnosticSeverity.Information})));let c=new qr(r,a,o);H(this.currentToken,12)?a.closeBracket=this.moveToNextToken:this._issues.push(Y(5,c.firstToken,c.lastToken,c));let l=[];return this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&(l=this.processOptionalLabelAssign(!0)),this.mergeStack(),c.endLabels.push(...l),c.firstToken=n,a.lastToken=this.prevToken,c}processLabeledValue(r){this.enqueueToStack();let n=r(),i=[];if(!n)return this.popStack(),[];for(;n;)i.push(n),n=r();if(i.length){let s=r();s&&i.push(s)}return this.mergeStack(),i}processArrayValues(r){this.enqueueToStack();let n=this.processLabeledValue(()=>{let s=()=>this.processRefValue(r,!1)||this.processLabeledHex(!1)||this.processLabeledDec(!1)||this.processLabeledExpression(!0,!1,r),o=this.peekIndex(),a=s();return a&&!this.cPreprocessorParser.optimizeForFormatting&&(a.value instanceof Gt&&a.value.params.every(c=>!!c)&&this.cPreprocessorParser.macros.has(a.value.functionName.name)||a.value instanceof vt&&this.cPreprocessorParser.macros.has(a.value.name))&&typeof a.value.evaluate(this.cPreprocessorParser.macros)=="string"?(this.injectPreProcessorResults(this.cPreprocessorParser.macros,a.value,o),s()):a}),i=new ut(n);return n.length===0&&(i.firstToken=this.currentToken),this.mergeStack(),i}processLabeledHex(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(r),i=this.processHex();if(!i){this.popStack();return}let s=new wi(i,n);return this.mergeStack(),s}processHexString(){this.enqueueToStack();let r=this.processOptionalLabelAssign(!1),n=this.checkConcurrentTokens([20,20].map(Ue));if(!n.length){this.popStack();return}let i=Number.parseInt(n.map(a=>a.value).join(""),16),s=new ir(i,me(n[0],n.at(-1)),16),o=new wi(s,r);return this.mergeStack(),o}processLabeledDec(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(r),i=this.processDec();if(!i){this.popStack();return}let s=new wi(i,n);return this.mergeStack(),s}processLabeledExpression(r=!0,n=r,i){this.enqueueToStack();let s=[];r&&(s=this.processOptionalLabelAssign(n));let o=this.processExpression(this.cPreprocessorParser.macros,i);if(!o){this.popStack();return}let a=new wi(o,s);return this.mergeStack(),a}isExpressionValue(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!1),i=this.processExpression(this.cPreprocessorParser.macros,r);if(!i){this.popStack();return}let s=this.processOptionalLabelAssign(!0),o=new qr(n,i,s);return this.mergeStack(),o}isLabelRef(r){this.enqueueToStack();let n=this.currentToken;if(!n||!H(n,40)){this.popStack();return}else this.moveToNextToken;let i=this.isLabelName();if(!i){let o=new ie(null);return this._issues.push(Y(18,n,n,r)),o.firstToken=n,this.mergeStack(),o}n&&(i.firstToken.pos.line!==n.pos.line||i.firstToken.pos.col!==n.pos.colEnd)&&this._issues.push(Y(29,n,i.firstToken,r,{inclusiveStart:!1,inclusiveEnd:!1}));let s=new ie(i);return s.firstToken=n,this.mergeStack(),s}isLabelRefValue(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!0),i=this.isLabelRef(r);if(!i){this.popStack();return}let s=[];this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&(s=this.processOptionalLabelAssign(!0));let o=new qr(n,i,s);return this.mergeStack(),o}processRefValue(r,n){this.enqueueToStack();let i=this.processOptionalLabelAssign(n),s=this.currentToken;if(!s||!H(s,40)){this.popStack();return}let o=this.processNodePathRef(r);if(o!==void 0){let l=new wi(o,i);return this.mergeStack(),l}let a=this.isLabelRef(r);if(a===void 0){this._issues.push(Y([18,9],s,s,r));let l=new wi(null,i);return l.firstToken=i.at(0)?.firstToken??s,this.mergeStack(),l}let c=new wi(a,i);return c.firstToken=i.at(0)?.firstToken??s,this.mergeStack(),c}processNodePath(r=!0,n=new ri){this.enqueueToStack();let i;if(H(this.currentToken,13))i=this.moveToNextToken;else{if(!r){this.popStack();return}this.prevToken&&this._issues.push(Y(19,this.prevToken,this.prevToken,n))}let s=this.isNodeName(),o=i??this.prevToken;if(!s&&o&&!r&&this._issues.push(Y(7,o,o,n)),!r||s?n.addPath(s??null,i?new te(me(i)):void 0):r&&!s&&i&&(n.addPath(new je("/",me(i))),n.firstToken=i),r&&!i&&n.children.length===0){this.mergeStack();return}return this.processNodePath(!1,n),this.mergeStack(),n}processNodePathRef(r){this.enqueueToStack();let n=this.moveToNextToken,i=n;if(!H(i,40)){this.popStack();return}let s=this.moveToNextToken;if(i=s,!H(i,2)){this.popStack();return}n&&!Kt(n,s)&&this._issues.push(Y(29,n,s,r,{inclusiveStart:!1,inclusiveEnd:!1}));let o=this.processNodePath(),a=new it(o??null),c=this.currentToken??this.prevToken,l=c;return o?.children.forEach((u,d)=>{if(d===o?.children.length-1&&u&&l&&!Kt(u.lastToken,l)){this._issues.push(Y(29,u.lastToken,l,r,{inclusiveStart:!1,inclusiveEnd:!1}));return}if(d===0&&s&&!Kt(s,u?.firstToken)){this._issues.push(Y(29,s,u?.firstToken,r,{inclusiveStart:!1,inclusiveEnd:!1}));return}let f=o?.children[d+1];u&&f&&!Kt(u.lastToken,f.firstToken)&&this._issues.push(Y(29,u.lastToken,f?.firstToken,r,{inclusiveStart:!1,inclusiveEnd:!1}))}),H(c,3)?this.moveToNextToken:this.prevToken&&this._issues.push(Y(3,this.prevToken,this.prevToken,r)),a.firstToken=n,a.lastToken=c??this.prevToken,this.mergeStack(),a}get includes(){return this.cPreprocessorParser.dtsIncludes}get allAstItems(){return[...this.cPreprocessorParser.allAstItems,...this.rootDocument.children,...this.others,...this.unhandledStatements.properties,...this.unhandledStatements.deleteProperties,...this.unhandledStatements.nodes]}#e;get latestSemanticTokensBuilt(){return this.#e}buildSemanticTokens(r,n){let i=[];this.injectedMacros.forEach(s=>{s.buildSemanticTokens((...o)=>Xi.push(...o,n,i))}),super.buildSemanticTokens(r,n,i),this.#e=!0}};var bp=class t{constructor(e,r,n){this.settings=e;this.formattingOptions=r;this.bindingLoader=n;this._issues=[];this.overlayParsers=[];this.overlays=[];this.ctxNames_=new Set;this.sortKeys=new WeakMap;this.staleFsPaths=new Set;let i={...e,ctxName:e.ctxName??(0,wa.basename)(e.dtsFile)};this.isFullContext=this.settings.dtsFile.toLowerCase().endsWith(".dts"),this.overlays=i.overlays,this.overlays.filter(dl.existsSync);let s=this.isFullContext&&n?.type==="Zephyr"?[(0,wa.join)((0,wa.dirname)(this.settings.dtsFile),"dts"),...i.includePaths]:i.includePaths;this.parser=new xn(i.dtsFile,s),this.ctxNames_.add(i.ctxName),this.id=Ki(i),this.parser.stable.then(()=>{this.overlayParsers=this.overlays?.map(o=>new xn(o,s,this.parser.cPreprocessorParser.macros))??[]})}get macros(){return this.allParsers.at(-1).cPreprocessorParser.macros}get ctxNames(){return Array.from(this.ctxNames_)}addCtxName(e){this.ctxNames_.add(e)}removeCtxName(e){this.ctxNames_.delete(e)}async getContextIssues(){return[...(await this.getRuntime()).issues,...this._issues]}getFileTree(){let e=new Map,r=n=>({fsPath:n,includes:(e.get(n)??[]).map(i=>r(i.resolvedPath??i.path))});return[...this.parser.includes,...this.overlayParsers.flatMap(n=>n.includes)].forEach(n=>{let i=e.get(n.fsPath);i||(i=[],e.set(n.fsPath,i)),i.push({path:n.path.path,resolvedPath:n.resolvedPath})}),{mainDtsPath:r(this.parser.fsPath),overlays:this.overlays.map(r)}}async stable(){await Promise.all([this.parser.stable,...this.overlayParsers.map(e=>e.stable)])}async getRuntime(){return await this.stable(),this._runtime??=this.evaluate(),this._runtime}getContextFiles(){return[...this.overlayParsers.flatMap(e=>e.getFiles()),...this.parser.getFiles()]}isInContext(e){return this.getContextFiles().some(r=>fe(r,e))}getFsPathParser(e){return this.allParsers.find(n=>n.getFiles().some(i=>fe(i,e)))}async getAllStableParsers(){return await this.stable(),this.allParsers}get allParsers(){return[this.parser,...this.overlayParsers]}async getDocumentLinks(e,r){if(!this.isInContext(e))return[];let i=(await this.getRuntime()).rootNode.allBindingsProperties.filter(s=>fe(s.ast.fsPath,e)&&s.ast.values&&(!r||Qt(s.ast.values,e,r))).flatMap(s=>s.ast.values?.values.flatMap(o=>{let c=s.parent?.nodeTypes.find(l=>o?.value instanceof ne&&l.compatible===o.value.value);return c&&c.bindingsPath?{range:ce(o.value),target:ue(c.bindingsPath)}:void 0})).filter(s=>!!s)??[];return[...[...this.parser.cPreprocessorParser.dtsIncludes,...this.overlayParsers.flatMap(s=>s.cPreprocessorParser.dtsIncludes)].filter(s=>fe(s.fsPath,e)&&(!r||Qt(s,e,r))).map(s=>{let o=this.parser.cPreprocessorParser.resolveInclude(s);if(o)return{range:ce(s.path),target:ue(o)}}).filter(s=>!!s)??[],...i]}linkPropertiesLabelsAndNodePaths(e){let r=s=>[...s.properties,...s.nodes.flatMap(r)],n=r(e.rootNode),i=e.rootNode.allDescendantsLabels;n.forEach(s=>s.ast.allDescendants.forEach(o=>{if(o instanceof ie){let a=e.resolvePath([`&${o.label?.value}`],i);if(a){let c=e.rootNode.getChild(a);o.linksTo=c,c?.linkedRefLabels.push(o)}else o.value&&this._issues.push(Bt(3,o.firstToken,o.lastToken,o,{templateStrings:[o.value],severity:this.parser.plugin?gr.DiagnosticSeverity.Information:gr.DiagnosticSeverity.Error}))}else o instanceof ri&&this.linkNodePath(o,e.rootNode)}))}linkNodePath(e,r){let n=r,i=e.pathParts;for(let s=0;s<i.length&&i[s];s++){let o=!1,a=i[s];if(a){let c=s===0&&a.name==="/"?r:n?.getNode(a.name,a.fullAddress,!1);a.linksTo=c,!o&&!c&&(o=!0,this._issues.push(Bt(8,a.firstToken,a.lastToken,a,{templateStrings:[a.toString(),`${e.pathParts.filter(l=>l?.linksTo).map(l=>l?.toString()).join("/")}`],severity:this.parser.plugin?gr.DiagnosticSeverity.Information:gr.DiagnosticSeverity.Error}))),c?.linkedNodeNamePaths.push(a),n=c}else break}}setStaleFsPath(e){this.staleFsPaths.add(e)}async reevaluate(e){this.setStaleFsPath(e);let r=new Set;return this.staleFsPaths.forEach(n=>{let i=this.getFsPathParser(n);i&&r.add(i)}),r.size?(this.sortKeys=new WeakMap,await Promise.all(Array.from(r).map(n=>n.reparse())),this._runtime=this.evaluate(),this._runtime):this._runtime}getSortKey(e,r=!1){if(e)return this.sortKeys.get(r?e.lastToken:e.firstToken)}async evaluate(){let e=performance.now();await this.stable();let r=new Ei(this);this.staleFsPaths.clear(),this._issues=[],this.parser.rootDocument.resetIssues(),this.processRoot(this.parser.rootDocument,r);for(let i=0;i<this.overlayParsers.length;i++)this.overlayParsers[i].rootDocument.resetIssues(),this.processRoot(this.overlayParsers[i].rootDocument,r);let n=await Promise.all(r.rootNode.defaultProperties.map(async i=>{let s=new rn(i.text,i.fsPath),o=new xn(i.fsPath,[],void 0,()=>s.tokens);return await o.stable,this.processRoot(o.rootDocument,r),o}));return r.comments=this.parser.cPreprocessorParser.allAstItems.filter(i=>i instanceof vn),[...this.allParsers,...n].flatMap(i=>i.tokens).forEach((i,s)=>this.sortKeys.set(i,s)),this.linkPropertiesLabelsAndNodePaths(r),this.reportNodeNameAndPropertyClashes(r),console.log(`(ID: ${this.id}) evaluate`,performance.now()-e),r}getSortKeyFile(e,r){let n=this.findTokenBeforePosition(e,r),i=n,s=i?this.sortKeys.get(i):void 0;for(;i&&!s;)i=i.nextToken,s=i?this.sortKeys.get(i):void 0;if(s!==void 0)return s;for(i=n,s=i?this.sortKeys.get(i):void 0;i&&!s;)i=i.prevToken,s=i?this.sortKeys.get(i):void 0;return s}findTokenBeforePosition(e,r){let n=this.allParsers.flatMap(i=>({parser:i,tokens:i.tokens}));for(let[i,s]of n.entries()){if(s.tokens.length===0&&fe(s.parser.fsPath,r)){let c=n.slice(0,i).reverse().find(l=>l.tokens.length);return i?c?.tokens[c.tokens.length-1]:void 0}let o=s.tokens.find((c,l)=>Ss(c,r,e)&&(l===s.tokens.length-1||!c.nextToken||CT(c.nextToken,r,e)));if(o)return o;let a=s.parser.includes.find(c=>c.resolvedPath===r);if(a)return a.lastToken;if(s.parser.getFiles().some(c=>fe(c,r)))return s.tokens[s.tokens.length-1]}}reportNodeNameAndPropertyClashes(e){let r=n=>{n.properties.forEach(i=>{n.nodes.filter(o=>o.address===void 0&&o.name===i.ast.propertyName?.name&&o.definitions.at(-1)?.name).forEach(o=>{let a=o.definitions,c=a[a.length-1].name;this._issues.push(Bt(2,c.firstToken,c.lastToken,c,{linkedTo:[i.ast,...i.allReplaced.map(l=>l.ast)]}))})}),n.nodes.forEach(r)};r(e.rootNode)}processRoot(e,r){for(let n=0;n<e.children.length;n++){let i=e.children[n];this.processChild(i,r.rootNode,r)}}processChild(e,r,n){e instanceof De?this.processDtcBaseNode(e,r,n):e instanceof Ee?this.processDtcProperty(e,r,n):e instanceof Qr?this.processDeleteNode(e,r,n):e instanceof dt&&this.processDeleteProperty(e,r,n)}checkNodeUniqueNames(e,r){let n=(o,a)=>o.filter(c=>c.name===a.name&&(c.address===a.fullAddress&&c.address===void 0||qt(c.address??[],a.fullAddress??[])===0)).map(c=>c.issueAst),i=r.nodes.map(o=>{let a=o.definitions[0];return{name:o.name,address:o.address,issueAst:a.name??a}}),s=[];e.children.forEach(o=>{if(o instanceof Ce&&o.name){let a=n(s.map(c=>({name:c.name,address:c.fullAddress,issueAst:c})),o.name);a.length&&this._issues.push(Bt(2,o.name.firstToken,o.name.lastToken,o.name,{linkedTo:a})),s.push(o.name)}else if(o instanceof Qr&&o.nodeNameOrRef instanceof je){let a=o.nodeNameOrRef;n(i,a)&&(s=s.filter(c=>n(s.map(l=>({name:l.name,address:l.fullAddress,issueAst:l})),c).length))}})}getCompileCommands(){if(!(!this.settings.compileCommands||!(0,dl.existsSync)(this.settings.compileCommands)))return JSON.parse((0,dl.readFileSync)(this.settings.compileCommands).toString())}processDtcBaseNode(e,r,n){e instanceof nt?this.processDtcRootNode(e,n):e instanceof Ce?this.processDtcChildNode(e,r,n):e instanceof ot&&this.processDtcRefNode(e,n)}processDtcRootNode(e,r){r.rootNode.implementations.push(e),this.checkNodeUniqueNames(e,r.rootNode),e.children.forEach(n=>this.processChild(n,r.rootNode,r))}processDtcChildNode(e,r,n){if(e.name?.name){let i=e.path?n.resolvePath(e.path):void 0,o=(i?n.rootNode.getChild(i):void 0)??new J(this.bindingLoader,e.name.name,e.name.fullAddress,r);o.implementations.push(e),e.labels.forEach(a=>a.lastLinkedTo=o),r=o,this.checkNodeUniqueNames(e,o)}e.children.forEach(i=>this.processChild(i,r,n))}processDtcRefNodeLabelRef(e,r,n){let i,s=e.resolveNodePath??(e.pathName?n.resolvePath([e.pathName]):void 0);return s?(e.resolveNodePath??=[...s],i=n.rootNode.getChild(s),r.linksTo=i,e.labels.forEach(o=>o.lastLinkedTo=i),i?.linkedRefLabels.push(r),i?.implementations.push(e),e.labels.forEach(o=>{n.labelsUsedCache.set(o.label.value,s)}),i?(n.references.push(e),this.checkNodeUniqueNames(e,i)):n.unlinkedRefNodes.push(e)):(this._issues.push(Bt(3,r.firstToken,r.lastToken,r,{templateStrings:[r.label?.value??""],severity:this.parser.plugin?gr.DiagnosticSeverity.Information:gr.DiagnosticSeverity.Error})),n.unlinkedRefNodes.push(e)),i}processDtcRefNodeNodePathRef(e,r,n){let i;r.path&&this.linkNodePath(r.path,n.rootNode);let o=r.path?.pathParts.at(-1)?.linksTo?.path;return o?(e.resolveNodePath??=o,i=n.rootNode.getChild(o),e.labels.forEach(a=>a.lastLinkedTo=i),i?.implementations.push(e),e.labels.forEach(a=>{n.labelsUsedCache.set(a.label.value,o)}),i?(n.references.push(e),this.checkNodeUniqueNames(e,i)):n.unlinkedRefNodes.push(e)):n.unlinkedRefNodes.push(e),i}processDtcRefNode(e,r){let n;e.reference?e.reference instanceof ie?n=this.processDtcRefNodeLabelRef(e,e.reference,r):n=this.processDtcRefNodeNodePathRef(e,e.reference,r):r.unlinkedRefNodes.push(e),e.children.forEach(i=>this.processChild(i,n??new J(this.bindingLoader,""),r))}processDtcProperty(e,r,n){e.propertyName?.name&&r.addProperty(new et(e,r)),e.children.forEach(i=>this.processChild(i,r,n))}processDeleteNode(e,r,n){if(e.nodeNameOrRef instanceof je&&e.nodeNameOrRef.value){if(e.parentNode?.parentNode)if(!r.hasNode(e.nodeNameOrRef.name,e.nodeNameOrRef.fullAddress))this._issues.push(Bt(5,e.nodeNameOrRef.firstToken,e.nodeNameOrRef.lastToken,e.nodeNameOrRef));else{r.deletes.push(e);let i=r.getNode(e.nodeNameOrRef.name,e.nodeNameOrRef.fullAddress);e.nodeNameOrRef.linksTo=i,r.deleteNode(e.nodeNameOrRef.name,e,e.nodeNameOrRef.fullAddress),i?.labels.forEach(s=>{n.labelsUsedCache.delete(s.label.value)})}}else if(e.nodeNameOrRef instanceof ie&&e.nodeNameOrRef.value){let i=n.resolvePath([`&${e.nodeNameOrRef.value}`]),s;i?(s=n.rootNode.getChild(i),r.deletes.push(e),e.nodeNameOrRef.linksTo=s,s?.labels.forEach(o=>{n.labelsUsedCache.delete(o.label.value)}),s?.linkedRefLabels.push(e.nodeNameOrRef),s?.parent?.deleteNode(s.name,e,s.address),e.parentNode instanceof De&&!e.parentNode.pathName&&n.globalDeletes.push(e)):(n.unlinkedDeletes.push(e),this._issues.push(Bt(3,e.nodeNameOrRef.firstToken,e.nodeNameOrRef.lastToken,e.nodeNameOrRef,{templateStrings:[e.nodeNameOrRef.value],severity:this.parser.plugin?gr.DiagnosticSeverity.Information:gr.DiagnosticSeverity.Error})))}else if(e.nodeNameOrRef instanceof it&&e.nodeNameOrRef.path&&!e.nodeNameOrRef.path.pathParts.some(i=>!i)){let i=n.rootNode,s=e.nodeNameOrRef.path.pathParts;for(let c=0;c<s.length&&s[c];c++){let l=s[c];if(l){let u=i?.getNode(l.name,l.fullAddress,!1);l.linksTo=u,u?.linkedNodeNamePaths.push(l),i=u}}let o=e.nodeNameOrRef.path.pathParts.find(c=>c&&!c.linksTo),a=e.nodeNameOrRef.path.pathParts.at(-1)?.linksTo;a||(n.unlinkedDeletes.push(e),o&&this._issues.push(Bt(8,o.firstToken,o.lastToken,o,{templateStrings:[o.toString(),`${e.nodeNameOrRef.path.pathParts.filter(c=>c?.linksTo).map(c=>c?.toString()).join("/")}`],severity:this.parser.plugin?gr.DiagnosticSeverity.Information:gr.DiagnosticSeverity.Error}))),r.deletes.push(e),a?.labels.forEach(c=>{n.labelsUsedCache.delete(c.label.value)}),a?.parent?.deleteNode(a.name,e,a.address),e.parentNode instanceof De&&!e.parentNode.pathName&&n.globalDeletes.push(e)}else n.unlinkedDeletes.push(e);e.children.forEach(i=>this.processChild(i,r,n))}processDeleteProperty(e,r,n){e.propertyName?.name&&!r.hasProperty(e.propertyName.name)?this._issues.push(Bt(1,e.propertyName.firstToken,e.propertyName.lastToken,e.propertyName)):e.propertyName?.name&&(r.deletes.push(e),r.deleteProperty(e.propertyName.name,e)),e.children.forEach(i=>this.processChild(i,r,n))}static#e(e,r,n){let i=n.get(r);i||(i=[],n.set(r,i)),i.push(e)}getIssues(e,r=new Map,n=i=>{if(!(i.raw.severity===gr.DiagnosticSeverity.Hint&&i.raw.virtual))return i.raw.severity===gr.DiagnosticSeverity.Error&&!this.isFullContext&&(i.raw.severity=gr.DiagnosticSeverity.Warning),i}){return e.forEach(i=>{let s=n(i);s&&t.#e(s.diagnostic(),s.raw.fsPath,r)}),r}async getSyntaxIssues(e=new Map,r=n=>{if(n.raw.severity===gr.DiagnosticSeverity.Error&&!this.isFullContext&&!ho(n.raw,n.raw.fsPath,!1)&&(n.raw.severity=gr.DiagnosticSeverity.Warning),!(n.raw.severity===gr.DiagnosticSeverity.Hint&&n.raw.virtual))return n}){return(await this.getAllStableParsers()).forEach(n=>this.getIssues(n.issues,e,r)),e}async getDiagnostics(){let e=new Map;try{await this.getSyntaxIssues(e);let r=await this.getContextIssues()??[];this.getIssues(r,e);let n=await this.getRuntime();return this.getIssues(n.typesIssues,e),e}catch(r){throw console.error(r),r}}async toFullString(){return`/dts-v1/;
297
+ `){let o=this.lineNumber,a=this.columnNumber,c=r.length;this.pushToken({tokens:[21],value:r,pos:{col:a-c,line:o,len:c,colEnd:a}}),r=""}else if(this.currentChar==="\\"){let o=this.lineNumber;if(r+=this.currentChar??"",this.move())o===this.lineNumber&&(r+=this.currentChar??"");else break}else r+=this.currentChar??"";if(!this.move())break}r+=e;let n=this.lineNumber,i=this.columnNumber+1,s=r.length;this.pushToken({tokens:[21],value:r,pos:{col:i-s,line:n,len:s,colEnd:i}}),this.move()}lexIt(){for(;!this.endOfFile;){for(;this.isWhiteSpace();)this.move();let e=this.getWord();e&&this.process(e)}}static{this.SINGLE_CHAR_TOKENS=new Map([["{",[2]],["}",[3]],["(",[42]],[")",[43]],["[",[11]],["]",[12]],[";",[1]],[":",[50]],["=",[0]],[">",[4]],["<",[5]],["!",[6]],["|",[8]],["^",[9]],["&",[40,7]],["~",[10]],["/",[13]],["\\",[14]],["+",[15]],["-",[16]],["*",[17]],["%",[18]],["?",[44]],[".",[45]],["_",[48]],["@",[49]],[",",[24]]])}static{this.KEYWORD_TOKENS=new Map([["true",38],["false",39],["#define",25],["#include",26],["#line",27],["#undef",28],["#error",29],["#pragma",30],["#defined",31],["#if",32],["#ifdef",33],["#ifndef",34],["#elif",35],["#else",36],["#endif",37]])}process(e){let r=this.isString(e);if(!r){let i=t.KEYWORD_TOKENS.get(e.toLowerCase());if(i&&(r=!0,this.pushToken({tokens:[i],value:e.toLowerCase(),pos:this.generatePos(e,e.toLowerCase())}),i===39||i===38)){let s=this.tokens.length-1;if(Kt(this.tokens[s-1],this.tokens[s]))r=!1,this.tokens.pop();else return!0}}if(r||(r=this.isDigit(e)||this.isHexDigit(e)||this.isLetters(e)),!r&&e.length===1){let i=t.SINGLE_CHAR_TOKENS.get(e);if(i)return r=!0,this.pushToken({tokens:i,value:e,pos:this.generatePos(e,e)}),!0}if(r||(r=this.isHash(e)||this.unknownToken(e)),!r)throw new Error(`Lexer is not complete!!! Could not find token for "${e}"`);let n=this._tokens[this._tokens.length-1];return r&&!n?.tokens.some(i=>i===21)&&n&&n.pos.len<e.length?this.process(e.slice(n.pos.len)):!0}pushToken(e){let r={tokens:e.tokens,pos:e.pos,value:e.value,fsPath:this.fsPath},n=this._tokens[this._tokens.length-1];r.prevToken=n,n&&(n.nextToken=r),this._tokens.push(r)}isLetters(e){let r=e[0]?.charCodeAt(0);if(t.isLetterCode(r)){let n="";for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);if(t.isLetterCode(s))n+=e[i];else break}return this.pushToken({tokens:[47],value:n,pos:this.generatePos(e,n)}),!0}return!1}isDigit(e){let r=e[0],n=r?.charCodeAt(0);return n>=48&&n<=57?(this.pushToken({tokens:[20,19],value:r,pos:this.generatePos(e,r)}),!0):!1}isHexDigit(e){let r=e[0],n=r?.charCodeAt(0);return n>=65&&n<=70||n>=97&&n<=102?(this.pushToken({tokens:[20,47],value:r,pos:this.generatePos(e,r)}),!0):!1}isHash(e){return e.startsWith("#")?(this.pushToken({tokens:[46],pos:this.generatePos(e,"#"),value:"#"}),!0):!1}unknownToken(e){return this.pushToken({tokens:[41],pos:this.generatePos(e," "),value:e}),!0}isString(e){if(this.inComment)return!1;let r=e[0];if(r==='"'||r==="'"){let n=e.length-1;if(this.columnNumber+1<n)throw new Error("Error while rewinding");return this.columnNumber-=n,this.getString(r),!0}return!1}generatePos(e,r){let n=this.columnNumber-e.length,i=r.length;return{line:this.lineNumber,col:n,len:i,colEnd:n+i}}};var rv=require("fs"),Ra=require("path"),al=q(U());var At=class extends te{constructor(e){super(e),this.semanticTokenType="keyword",this.semanticTokenModifiers="declaration"}};var e0=require("path"),op=q(U());var ni=class extends te{constructor(r,n){super();this.keyword=r;this.path=n;this.docSymbolsMeta={name:`Include ${n}`,kind:op.SymbolKind.File},this.addChild(r),this.addChild(n)}get resolvedPath(){return this._resolvedPath}set resolvedPath(r){this.docSymbolsMeta={name:`Include ${r}`,kind:op.SymbolKind.File},this._resolvedPath=r}},ka=class extends te{constructor(r,n,i){super(i);this._path=r;this.relative=n;this.docSymbolsMeta={name:(0,e0.basename)(this.path),kind:op.SymbolKind.File},this.semanticTokenType="string",this.semanticTokenModifiers="declaration"}get path(){return this.relative?this._path.slice(1,-1):this._path}};var t0=q(U());var vt=class extends ge{constructor(r,n){super(n);this.name=r;this.docSymbolsMeta={name:this.name.toString(),kind:t0.SymbolKind.Variable},this.semanticTokenType="macro",this.semanticTokenModifiers="declaration"}toString(){return this.name}};var ap=class extends te{constructor(r,n){super(n);this.operator=r;this.semanticTokenType="operator",this.semanticTokenModifiers="declaration"}toString(){return this.operator}};var r0=q(U());var Na=class extends At{toString(){return"..."}},ii=class extends te{constructor(r,n){super();this.functionName=r;this.params=n;this.addChild(r),this.params.forEach(i=>this.addChild(i))}getDocumentSymbols(r){return fe(this.fsPath,r)?[{name:this.functionName.name,kind:r0.SymbolKind.Function,range:ce(this),selectionRange:ce(this),children:this.params.flatMap(n=>n.getDocumentSymbols(r))}]:[]}toString(){return`${this.functionName}(${this.params.map(r=>r.toString()).join(",")})`}};var Ji=class t{constructor(){this.positionStack=[];this._issues=[];this.issueLengthPositionStack=[];this.moveEndOfLine=(e,r=!0,n=!1)=>{let i=e.pos.line;if(this.currentToken?.pos.line!==i||!fe(this.currentToken?.fsPath,e.fsPath))return;let s=this.currentToken,o=s;for(;this.currentToken?.pos.line===i&&fe(this.currentToken?.fsPath,e.fsPath);)o=this.moveToNextToken;return r&&this._issues.push(Y(22,s,o,null)),n&&o?.value==="\\"&&o.nextToken?this.moveEndOfLine(o.nextToken,r):o};this.parsing=new Promise(e=>{setTimeout(()=>{this.parse().then(e)})})}reset(){this.issueLengthPositionStack=[],this.positionStack=[],this._issues=[]}get issues(){return this._issues}get stable(){return this.parsing}get done(){return this.peekIndex()>=this.tokens.length}get moveToNextToken(){let e=this.currentToken;if(e)return this.moveStackIndex(),e}enqueueToStack(){this.issueLengthPositionStack.push(this._issues.length),this.positionStack.push(this.peekIndex())}popStack(){let e=this.issueLengthPositionStack.pop()??0;e!==this._issues.length&&this._issues.splice(e),this.positionStack.pop()}mergeStack(){let e=this.issueLengthPositionStack.pop(),r=this.positionStack.pop();if(r===void 0||e===void 0)throw new Error("Index out of bounds");this.positionStack[this.positionStack.length-1]=r}peekIndex(e=1){let r=this.positionStack.at(-1*e);if(r===void 0)throw new Error("Index out of bounds");return r}get currentToken(){return this.tokens.at(this.peekIndex())}get prevToken(){let e=this.peekIndex()-1;if(e!==-1)return this.tokens[e]}moveStackIndex(){let e=this.positionStack.length-1;if(this.positionStack[e]===void 0)throw new Error("Index out of bounds");this.positionStack[e]!==this.tokens.length&&this.positionStack[e]++}checkConcurrentTokens(e){this.enqueueToStack();let r=[];return e.every(n=>{let i=this.currentToken,s=n(i),o=!1;return s!=="no"&&i&&(r.push(i),this.moveToNextToken,o=Kt(i,this.currentToken)),s==="yes"&&o}),this.mergeStack(),r}consumeAnyConcurrentTokens(e){this.enqueueToStack();let r=[],n,i=!0;for(;e.some(s=>s(this.currentToken)==="yes"&&i);)r.push(this.currentToken),n=this.moveToNextToken,i=Kt(n,this.currentToken);return this.mergeStack(),r}getDocumentSymbols(e){return this.allAstItems.flatMap(r=>r.getDocumentSymbols(e))}getWorkspaceSymbols(){return this.allAstItems.flatMap(e=>e.getWorkspaceSymbols())}static push(e,r,n,i,s,o){if(!n||!i||!fe(n.fsPath,s)||!fe(i.fsPath,s))return;let a=i.pos.colEnd-n.pos.col;o.push({line:n.pos.line,char:n.pos.col,length:i===n?i.pos.len:a,tokenType:e,tokenModifiers:r})}buildSemanticTokens(e,r,n=[]){this.allAstItems.forEach(i=>{i.buildSemanticTokens((...s)=>t.push(...s,r,n))}),n.sort((i,s)=>i.line===s.line?i.char-s.char:i.line-s.line).forEach(i=>e.push(i.line,i.char,i.length,i.tokenType,i.tokenModifiers))}processCIdentifier(e,r,n=!1){this.enqueueToStack();let i=this.consumeAnyConcurrentTokens([19,47,48].map(Ue));if(!i.length){this.popStack();return}if(!i?.[0]?.value.match(/^[_A-Za-z]/)){this.popStack();return}let s=i.map(a=>a.value).join(""),o=new vt(s,me(i[0],i.at(-1)));if(n&&!e.has(o.name)){this.popStack();return}return!r&&o.firstToken!==o.lastToken&&o.name!=="defined"&&(e.get(o.name)||this._issues.push(Y(42,o.firstToken,o.lastToken,o))),this.mergeStack(),o}isOperator(){this.enqueueToStack();let e=this.moveToNextToken;if(!e){this.popStack();return}let r=e,n;if(H(e,40)?(n="&",H(this.currentToken,40)&&(n="&&",r=this.moveToNextToken)):H(e,6)?(n="!",H(this.currentToken,0)&&(n="!=",r=this.moveToNextToken)):H(e,10)?n="~":H(e,8)?(n="|",H(this.currentToken,8)&&(n="||",r=this.moveToNextToken)):H(e,9)?n="^":H(e,4)?(n=">",H(this.currentToken,4)?(n=">>",r=this.moveToNextToken):H(this.currentToken,0)&&(n=">=",r=this.moveToNextToken)):H(e,5)?(n="<",H(this.currentToken,5)?(n="<<",r=this.moveToNextToken):H(this.currentToken,0)&&(n="<=",r=this.moveToNextToken)):H(e,15)?n="+":H(e,16)?n="-":H(e,17)?n="*":H(e,13)?n="/":H(e,18)?n="%":H(e,46)?H(this.currentToken,46)&&(n="##",r=this.moveToNextToken):H(e,0)&&H(this.currentToken,0)&&(n="==",r=this.moveToNextToken),n){let i=new ap(n,me(e,r));return this.mergeStack(),i}this.popStack()}parseScopedBlock(e,r,n){this.enqueueToStack();let i=this.moveToNextToken;if(!i||!e(i)){this.popStack();return}let s=this.peekIndex(),o=()=>{this.positionStack[this.positionStack.length-1]=s},a=m=>m.flatMap(h=>"items"in h?a(h.items):h),c=[i],l=[],u=[];u[0]={rewind:o,tokens:[]};let d=this.currentToken;for(;d&&!r(d);){if(n?.(d)){let m=this.peekIndex()+1,h=()=>{this.positionStack[this.positionStack.length-1]=m};c.push(d),l.push(d),u[u.length]={rewind:h,tokens:[]}}else if(e(d)){let m=this.parseScopedBlock(e,r,n);m&&(c.push(m),u[u.length-1].tokens.push(...a(m.items))),d=this.currentToken;continue}else c.push(d),u[u.length-1].tokens.push(d);this.moveToNextToken,d=this.currentToken}let f=d;f&&r(f)&&(this.moveToNextToken,c.push(f));let p={startToken:i,items:c,splitTokens:u,endToken:f,separatorTokens:l};return this.mergeStack(),p}isFunctionCall(e){this.enqueueToStack();let r=this.processCIdentifier(e,!1);if(!r){this.popStack();return}if(!(e.get(r.name)?.macro.identifier instanceof ii)&&!Kt(r.lastToken,this.currentToken)){this.popStack();return}let i=this.processMacroCallParams();if(!i){this.popStack();return}if(r.name==="defined")i.length>1?this._issues.push(Y(44,r.firstToken,r.lastToken,r)):i.length<1&&this._issues.push(Y(45,r.firstToken,r.lastToken,r));else{let o=e.get(r.name)?.macro;o&&(o?.identifier instanceof ii?o.identifier.params.at(-1)instanceof Na||(i.length>o.identifier.params.length?this._issues.push(Y(44,r.firstToken,r.lastToken,r,{linkedTo:[o]})):i.length<o.identifier.params.length&&this._issues.push(Y(45,r.firstToken,r.lastToken,r,{linkedTo:[o]}))):this._issues.push(Y(43,r.firstToken,r.lastToken,r)))}let s=new Gt(r,i);return s.lastToken=this.prevToken,this.mergeStack(),s}processHex(){this.enqueueToStack();let e=this.checkConcurrentTokens([at("0"),at("x",{caseInsensitive:!0})]);if(e.length!==2){this.popStack();return}let r=this.consumeAnyConcurrentTokens([19,20].map(Ue));if(!r.length){this.popStack();return}let n=Number.parseInt(r.map(s=>s.value).join(""),16),i=new ir(n,me(e[0],r.at(-1)),16);return this.mergeStack(),i}processDec(e=!1){this.enqueueToStack();let r;e&&(H(this.currentToken,16)||H(this.currentToken,15))&&Kt(this.currentToken,this.currentToken?.nextToken)&&(r=this.moveToNextToken);let n=this.consumeAnyConcurrentTokens([19].map(Ue));if(!n.length){this.popStack();return}let i=Number.parseInt(n.map(o=>o.value).join(""),10);r&&H(r,16)&&(i=4294967295-i);let s=new ir(i,me(r??n[0],n.at(-1)),10);return this.mergeStack(),s}processEnclosedExpression(e,r){this.enqueueToStack();let n,i;if(H(this.currentToken,42)){let s;n=this.moveToNextToken,i=n;let o=this.processExpression(e,r,!0);return o&&(s=new nr(o,!0),o=new nr(s,!1),s.openBracket=n),H(this.currentToken,43)?(i=this.moveToNextToken,s&&(s.closeBracket=i)):n&&this._issues.push(Y(26,n,n,r)),this.mergeStack(),o}this.popStack()}processExpression(e,r,n=!1){this.enqueueToStack();let i,s;if(n&&(s=this.isOperator()),i=this.processEnclosedExpression(e,r)||this.isFunctionCall(e)||this.processCIdentifier(e,!1)||this.processHex()||this.processDec(!0),!i){this.popStack();return}if(s&&(i.operator=s),n){let o=this.isOperator();for(;o;){let a=this.processExpression(e,r,!0);a?i instanceof nr?i.addExpression(o,a):i=new nr(i,!1,{operator:o,expression:a}):this._issues.push(Y(27,o.firstToken,o.lastToken,r)),o=this.isOperator()}}return this.mergeStack(),i}processMacroCallParams(){if(!H(this.currentToken,42))return;let e=this.parseScopedBlock(n=>!!H(n,42),n=>!!H(n,43),n=>!!H(n,24));return e?.items.length===2&&H(e.endToken,43)?[]:e?.splitTokens.map((n,i)=>{if(n.tokens.length===0)return null;let s=new Pi(n.tokens.map((o,a)=>{let c=o.value;return o.pos.line===n.tokens.at(a+1)?.pos.line?c=c.padEnd(n.tokens[a+1].pos.col-o.pos.col," "):o.value==="\\"&&(c=c.slice(0,-1)),c}).join(""),me(n.tokens[0],n.tokens.at(-1)),i);return s.splitToken=e.separatorTokens.at(i),s})}};var Tn=class extends te{constructor(r){super();this.comments=r;this.disabled=!1;r.forEach(this.addChild.bind(this))}toString(){return this.comments.map(r=>r.toString()).join(`
298
+ `)}},vn=class extends te{constructor(r){super(r);this.disabled=!1;this.semanticTokenType="comment",this.semanticTokenModifiers="documentation"}toString(){let r,n=this.firstToken,i="";for(;n!==this.lastToken;)i+=n?.value.padStart(n.value.length+(r?n.pos.col-r.pos.colEnd:0)," "),r=n,n=n?.nextToken;n&&(i+=n?.value.padStart(n.value.length+(r?n.pos.col-r.pos.colEnd:0)," "));let s=i.match(/^\s*(?:(?:\/\/|\/\*+)\s*)?(.*?)\s*(?:\*\/)?\s*$/s);return s?s[1]:""}};var cp=class t extends Ji{constructor(r,n=()=>$r().requestTokens(this.fsPath,!0)){super();this.fsPath=r;this.getTokens=n;this.comments=[];this.tokens=[]}cleanUpComments(){let r=[];for(let n=0;n<this.tokens.length;n++){let i=t.processBlockComment(this.tokens,n)||t.processLineComment(this.tokens,n);i&&(n=i.index,r.push(...i.tokenUsed),this.comments.push(i.comment))}if(r.length>0){let n=new Set(r),i=[];for(let s=0;s<this.tokens.length;s++)n.has(s)||i.push(this.tokens[s]);this.tokens=i}}get allAstItems(){return this.comments}reset(){super.reset(),this.comments=[]}reparse(){return this.reset(),this.parse()}async parse(){this.tokens=this.getTokens(),this.cleanUpComments()}static processBlockComment(r,n){let i=[],s=()=>(i.push(n++),r[n]),o=()=>r[n],a=()=>r[n-1],c=o(),l=c;if(!c||!H(c,13)||(l=s(),!H(l,17)||c.pos.line!==l.pos.line||c.pos.col+1!==l.pos.col))return;let u=()=>!(!H(a(),17)||!H(o(),13)||!Kt(a(),o())),d=l.pos.line,f=c,p=[];l=s();do{if(o()?.pos.line!==d){let y=new vn(me(f,a()));p.push(y),d=o().pos.line??0,f=o()}l=s()}while(n<r.length&&!u());let m=new vn(me(f,o()));p.push(m);let h=new Tn(p);return s(),{comment:h,tokenUsed:i,index:n-1}}static processLineComment(r,n){let i=[];if(!H(r[n],13)||r.length===n+1||!H(r[n+1],13)||!Kt(r[n],r[n+1]))return;for(;r[n].pos.line===r.at(n+1)?.pos.line;)i.push(n++);return i.push(n++),{comment:new vn(me(r[i[0]],r[i.at(-1)])),tokenUsed:i,index:n-1}}};var n0=q(U());var lp=class extends te{constructor(r,n){super(r);this.content=n}toString(){let r=this.content.filter(n=>!H(n,14));return r.map((n,i)=>{let s=n.value;return n.pos.line===r.at(i+1)?.pos.line?s=s.padEnd(r[i+1].pos.col-n.pos.col," "):r.at(i+1)&&(s=s.padEnd(s.length+1," ")),s}).join("")}},rl=class extends te{constructor(r,n,i){super();this.keyword=r;this.identifier=n;this.content=i;this.addChild(r),this.addChild(this.identifier),this.content&&this.addChild(this.content)}get name(){return this.identifier instanceof vt?this.identifier.name:this.identifier.functionName.name}toString(){return this.toStringCache??=[this.identifier.toString(),...this.content?[this.content?.toString()]:[]].join(" "),this.toStringCache}toMarkupContent(){return{kind:n0.MarkupKind.Markdown,value:["```cpp",`#define ${this.toString()}`,"```"].join(`
299
+ `)}}};var il=class extends te{constructor(e){super(e)}},sl=class extends te{constructor(r,n){super();this.keyword=r;this.content=n;this.active=!1;this.addChild(r)}},ol=class extends sl{constructor(r,n,i){super(r,i);this.expression=n;this.addChild(n),this.addChild(i)}useBlock(r){return this.expression&&r.has(this.expression.name)}},up=class extends sl{constructor(r,n,i){super(r,i);this.expression=n;this.addChild(n),this.addChild(i)}useBlock(r){return this.expression?.isTrue(r)}},dp=class extends ol{useBlock(e){return this.expression&&!e.has(this.expression.name)}},fp=class extends sl{};var nl=(t,e)=>{let r=t,n=[];for(;r&&(n.push(r),r!==e);)r=r.nextToken;return n},On=class extends te{constructor(r,n,i){super();this.ifBlocks=r;this.endIf=n;this.elseOption=i;r.forEach(s=>this.addChild(s)),i&&this.addChild(i),this.addChild(n)}getInValidTokenRange(r){let n=this.ifBlocks.find(i=>i.useBlock(r));return n?n.active=!0:this.elseOption&&(this.elseOption.active=!0),this.getInValidTokenRangeWhenActiveBlock(n||this.elseOption)}get inactiveRanges(){let r=[],n=!!this.elseOption;this.ifBlocks.forEach((s,o)=>{if(s.active)return;let a=o===this.ifBlocks.length-1,c=s.firstToken,l=a?n?this.elseOption.firstToken:this.lastToken:s.content?.lastToken??this.ifBlocks[o+1].firstToken??s.lastToken;r.push(Ze.create(se(c),se(l)))});let i=r.length!==this.ifBlocks.length;if(this.elseOption&&i){let s=this.elseOption.firstToken,o=this.elseOption.content?.lastToken??this.endIf?.lastToken??this.lastToken;return r.push(Ze.create(se(s),se(o))),r}if(!i){let s=this.firstToken,o=this.lastToken;return[Ze.create(se(s),se(o))]}return r}getInValidTokenRangeWhenActiveBlock(r){let n=new WeakSet,i=!1;return this.ifBlocks.forEach(s=>{let o=s.expression?.lastToken??s.keyword.lastToken;nl(s.firstToken,o).forEach(a=>n.add(a)),!i&&s===r?i=!0:s.content&&nl(s.content.firstToken,s.content.lastToken).forEach(a=>n.add(a))}),this.elseOption&&(nl(this.elseOption.keyword.firstToken,this.elseOption.keyword.lastToken).forEach(s=>n.add(s)),i&&this.elseOption.content&&nl(this.elseOption.content.firstToken,this.elseOption.content.lastToken).forEach(s=>n.add(s))),this.endIf&&nl(this.endIf.firstToken,this.endIf.lastToken).forEach(s=>n.add(s)),n}};var Ea=class extends Ji{constructor(r,n,i,s,o){super();this.fsPath=r;this.incudes=n;this.getTokens=s;this.optimizeForFormatting=o;this.tokens=[];this.nodes=[];this._comments=[];this.dtsIncludes=[];this.macroSnapShot=new Map;this.macros=new Map;this.rangesToClean=new Set;this.macroStart=!1;i&&(Array.from(i).forEach(([a,c])=>this.macroSnapShot.set(a,c)),Array.from(i).forEach(([a,c])=>this.macros.set(a,c)))}get comments(){return this._comments}removeComments(r){this._comments=this._comments.filter(n=>!r.has(n))}get currentToken(){let r=this.prevToken,n=this.peekIndex(),i=this.tokens.at(n),s=hr(r,i)||!r||H(r,14)&&r.pos.line+1===i?.pos.line;if(!(this.macroStart&&!s))return this.macroStart&&H(i,14)?(this.moveStackIndex(),this.currentToken):i}reset(r){super.reset(),this.macros.clear(),r?(this.macroSnapShot.clear(),Array.from(r).forEach(([n,i])=>this.macroSnapShot.set(n,i)),Array.from(r).forEach(([n,i])=>this.macros.set(n,i))):Array.from(this.macroSnapShot).forEach(([n,i])=>this.macros.set(n,i)),this.nodes=[],this.dtsIncludes=[],this.rangesToClean=new Set}async reparse(r){let n=this.stable;return this.parsing=new Promise(i=>{n.then(()=>{if(r&&r.size===this.macroSnapShot.size){let s=Array.from(r);if(Array.from(this.macroSnapShot).every(([o,a],c)=>{let[l,u]=s[c];return l===o&&u.macro.toString()===a.macro.toString()})){console.log("header file cache hit",this.fsPath),i();return}}this.reset(r),this.parse().then(i)})}),this.parsing}async parse(){let r=new cp(this.fsPath,this.getTokens);if(await r.stable,this.tokens=r.tokens,this._comments=r.allAstItems,this.positionStack.push(0),this.tokens.length!==0){for(;!this.done;)await this.lineProcessor();if(this.rangesToClean.size&&!this.fsPath.endsWith(".h")&&(this.tokens=this.tokens.filter(n=>!this.rangesToClean.has(n))),this.positionStack.length!==1)throw new Error("Incorrect final stack size")}}async lineProcessor(){if(this.enqueueToStack(),!(!this.prevToken||this.prevToken.pos.line!==this.currentToken?.pos.line||!fe(this.prevToken.fsPath,this.currentToken.fsPath))){this.moveEndOfLine(this.prevToken,!1),this.mergeStack();return}let n=this.currentToken,i=await this.processInclude()||this.processDefinitions()||this.processUndef()||this.processError();this.processIfDefBlocks(),n&&this.moveEndOfLine(n,!!i),this.mergeStack()}addTokensToClean(r){for(let n=r.start;n<r.start+r.count;n++){let i=this.tokens[n];i&&this.rangesToClean.add(i)}}processDefinitions(){this.enqueueToStack();let r=this.peekIndex(),n=this.moveToNextToken;if(!n||!H(n,25))return this.popStack(),!1;this.macroStart=!0;let i=new At(me(n)),s=this.isFunctionDefinition()||this.processCIdentifier(this.macros,!0);if(!s)return this._issues.push(Y(30,i.firstToken,i.lastToken,i)),this.mergeStack(),this.macroStart=!1,!0;let o=this.consumeDefinitionContent(),a;o.length&&(a=new lp(me(o[0],o.at(-1)),o));let c=new rl(i,s,a);this.macros.set(c.name,{macro:c,resolver:Vw(c.toString())}),this.nodes.push(c);let l=this.peekIndex();return this.addTokensToClean({start:r,count:l-r}),this.mergeStack(),this.macroStart=!1,!0}processUndef(){this.enqueueToStack();let r=this.peekIndex(),n=this.moveToNextToken;if(!n||!H(n,28))return this.popStack(),!1;this.macroStart=!0;let i=new At(me(n)),s=this.processCIdentifier(this.macros,!0);if(!s)return this._issues.push(Y(30,i.firstToken,i.lastToken,i)),this.mergeStack(),this.macroStart=!1,!0;let o=new rl(i,s);this.macros.delete(s.name),this.nodes.push(o);let a=this.peekIndex();return this.addTokensToClean({start:r,count:a-r}),this.mergeStack(),this.macroStart=!1,!0}processError(){this.enqueueToStack();let r=this.peekIndex(),n=this.moveToNextToken;if(!n||!H(n,29))return this.popStack(),!1;this.moveEndOfLine(n,!1,!0);let i=this.peekIndex();return this.addTokensToClean({start:r,count:i-r}),this.mergeStack(),!0}consumeDefinitionContent(){let r=[];for(;this.currentToken;){let n=this.moveToNextToken;n&&r.push(n)}return r}isFunctionDefinition(){this.enqueueToStack();let r=this.processCIdentifier(this.macros,!0);if(!r){this.popStack();return}let n=this.moveToNextToken;if(!H(n,42)||!Kt(r.lastToken,n)){this.popStack();return}let i=[],s=this.processCIdentifier(this.macros,!0)||this.processVariadic();for(;s;)i.push(s),!H(this.currentToken,24)&&!H(this.currentToken,43)?this._issues.push(Y(28,s.firstToken,s.lastToken,s)):H(this.currentToken,43)||(n=this.moveToNextToken),s=this.processCIdentifier(this.macros,!0)||this.processVariadic();let o=new ii(r,i);if(H(this.currentToken,43))n=this.moveToNextToken,o.lastToken=n;else{o.lastToken=this.prevToken;let a=i.at(-1)??o;this._issues.push(Y(26,a.firstToken,a.lastToken,a))}return this.mergeStack(),o}processVariadic(){this.enqueueToStack();let r=this.checkConcurrentTokens([Ue(45),Ue(45),Ue(45)]);if(r.length!==3){this.popStack();return}let n=new Na(me(r[0],r.at(-1)));return this.mergeStack(),n}processIfDefBlocks(){let r=this.peekIndex(),n=this.parseScopedBlock(a=>!!a&&[33,34,32].some(c=>H(a,c))&&!hr(a.prevToken,a),a=>!!a&&[37].some(c=>H(a,c))&&!hr(a.prevToken,a),a=>!!a&&[36,35].some(c=>H(a,c))&&!hr(a.prevToken,a));if(!n)return;let i=this.processIfBlock(n);this.nodes.push(i);let s=i.getInValidTokenRange(this.macros);this.tokens=this.tokens.filter(a=>!s.has(a));let o=i.inactiveRanges;this._comments.forEach(a=>{o.some(c=>po(c,a.range))&&(a.disabled=!0)}),[...i.ifBlocks,...i.elseOption?[i.elseOption]:[]].forEach(a=>{!a.active&&a.content&&this._issues.push(Y(47,a.content.firstToken,a.content.lastToken,a.content,{severity:al.DiagnosticSeverity.Hint,tags:[al.DiagnosticTag.Unnecessary]}))}),this.positionStack[this.positionStack.length-1]=r}processIfBlock(r){this.enqueueToStack();let n=new At(me(r.startToken)),i=[],s;r.splitTokens.forEach((c,l)=>{c.rewind();let u=this.prevToken,d=l===r.splitTokens.length-1&&H(u,36),f=new At(me(u));this.macroStart=!0;let p,m;if(H(f.firstToken,33)||H(f.firstToken,34)?(m=this.processCIdentifier(this.macros,!0),p=m):(p=this.processExpression(this.macros,f,!0)||this.processCIdentifier(this.macros,!0),p instanceof vt&&p.name.toLowerCase()==="defined"&&(p=this.processExpression(this.macros,f,!0)||this.processCIdentifier(this.macros,!0))),this.macroStart=!1,d){let h=u,y=new At(me(h)),S;c.tokens.length&&(S=new il(me(c.tokens[0],c.tokens.at(-1)))),s=new fp(y,S??null)}else{p||this._issues.push(Y(31,f.firstToken,f.lastToken,f));let h,y=c.tokens.indexOf(p?.lastToken??n.lastToken)+1,S=c.tokens[y];y!==-1&&S&&(h=new il(me(S,c.tokens.at(-1)))),H(f.firstToken,33)?i.push(new ol(f,m??null,h??null)):H(f.firstToken,34)?i.push(new dp(f,m??null,h??null)):i.push(new up(f,p??null,h??null))}});let o;r.endToken?o=new At(me(r.endToken)):this._issues.push(Y(46,n.firstToken,n.lastToken,n));let a=new On(i,o??null,s);return this.mergeStack(),a}get allAstItems(){return[...this.dtsIncludes,...this.nodes,...this.comments]}resolveInclude(r){if(r.path.path)return r.path.relative?[(0,Ra.resolve)((0,Ra.dirname)(r.fsPath),r.path.path),...this.incudes.map(n=>(0,Ra.resolve)(n,r.path.path))].find(n=>(0,rv.existsSync)(n)):this.incudes.map(n=>(0,Ra.resolve)(n,r.path.path)).find(n=>(0,rv.existsSync)(n))}async processInclude(){this.enqueueToStack();let r=this.peekIndex(),n=this.currentToken;if(!n)return this.popStack(),!1;let i=n,s=n;if(H(n,26))this.moveToNextToken;else{let h=this.checkConcurrentTokens([Ue(13),at("include"),Ue(13)]);if(h.length!==3)return this.popStack(),!1;i=h[0],s=h.at(-1)}let o=i,a=new At(me(i,s));n=this.moveToNextToken;let c=n,l=!!H(n,21);if(!c||!l&&!H(n,5))return o&&this.moveEndOfLine(o),this.mergeStack(),!0;let u="";if(l)u=n?.value??"";else for(;this.currentToken?.pos.line===o.pos.line&&!H(this.currentToken,4);)u+=this.currentToken?.value??"",n=this.moveToNextToken;let d=new ka(u,l,me(c,n)),f=new ni(a,d);this.dtsIncludes.push(f),l||(this.currentToken?.pos.line!==o.pos.line||!H(this.currentToken,4)?this._issues.push(Y(12,f.firstToken,f.lastToken,f)):(n=this.moveToNextToken,d.lastToken=n)),this.mergeStack();let p=this.peekIndex(),m=this.resolveInclude(f);if(f.resolvedPath=m,m||this._issues.push(Y(36,f.path.firstToken,f.path.lastToken,f.path,{severity:al.DiagnosticSeverity.Warning})),m&&!this.optimizeForFormatting){$r().requestTokens(m,!0);let h=cl().getCPreprocessorParser(m,this.incudes,this.macros,this.fsPath);await h.stable,this._issues.push(...h.issues),this.macros.clear(),Array.from(h.macros).forEach(([y,S])=>this.macros.set(y,S)),m.endsWith(".h")?this.addTokensToClean({start:r,count:p-r}):(this.tokens=Qw(this.tokens,r,p,h.tokens),this.positionStack[this.positionStack.length-1]=r),this.nodes.push(...h.nodes),this.dtsIncludes.push(...h.dtsIncludes)}else this.addTokensToClean({start:r,count:p-r});return!0}};var nv,pp=class{constructor(){this.headerFiles=new Map;this.includeOwners=new WeakMap}getCPreprocessorParser(e,r,n,i){e=ft(e);let s=`${Array.from(n).map(l=>l[1].macro.toString()).join("::")}`,o=this.headerFiles.get(e)?.get(s);if(o)return o.reparse(n),o;console.log("No c-preprocessor cache",e);let a=new Ea(e,r,n),c=this.includeOwners.get(a)??new Set;return c.add(i),this.includeOwners.set(a,c),this.headerFiles.has(e)||this.headerFiles.set(e,new Map),this.headerFiles.get(e)?.set(s,a),a}reset(e){e=ft(e);let r=this.headerFiles.get(e);r&&Array.from(r).forEach(([n,i])=>{console.log("disposing c-preprocessor cache for",e),Array.from(this.includeOwners.get(i)??[]).forEach(this.reset.bind(this)),this.headerFiles.delete(e)})}};function cl(){return nv??=new pp,nv}function i0(){nv=new pp}var iv,hp=class t{constructor(){this.fileMap=new Map}static clone(e){let r=e.length;if(r===0)return[];let n=new Array(r),i;for(let s=0;s<r;s++){let o=e[s],a={tokens:o.tokens,pos:o.pos,value:o.value,fsPath:o.fsPath,prevToken:i,nextToken:void 0};i&&(i.nextToken=a),n[s]=a,i=a}return n}needsRenew(e,r){return e=ft(e),this.fileMap.get(e)?.text!==r}getDocument(e,r){return Lt.create(e,"devicetree",0,r??this.fileMap.get(e)?.text??(0,ll.readFileSync)(e).toString())}renewLexer(e,r){if(e=ft(e),cl().reset(e),!r&&!(0,ll.existsSync)(e))return[];try{r??=(0,ll.readFileSync)(e).toString();let n=new rn(r,e);return this.fileMap.set(e,n),t.clone(n.tokens)}catch{}return[]}requestTokens(e,r){e=ft(e);let n=this.fileMap.get(e)?.tokens;return!n&&r?[...this.renewLexer(e)]:t.clone(n??[])}reset(e){e=ft(e),cl().reset(e),this.fileMap.delete(e)}};function $r(){return iv??=new hp,iv}function s0(){iv=new hp}var Ei=class t{constructor(e){this.context=e;this.comments=[];this.references=[];this.unlinkedDeletes=[];this.unlinkedRefNodes=[];this.globalDeletes=[];this.rootNode=new J(this.context.bindingLoader,"/");this.labelsUsedCache=new Map;this.fileTopMostAstCache=new Map}fileTopMostAsts(e){let r=this.fileTopMostAstCache.get(e);if(r)return r;let n=[...this.rootNode.implementations,...this.references,...this.unlinkedDeletes,...this.unlinkedRefNodes,...this.globalDeletes,...this.context.overlayParsers.flatMap(i=>[...i.cPreprocessorParser.allAstItems,...i.unhandledStatements.children]),...this.context.parser.cPreprocessorParser.allAstItems,...this.context.parser.unhandledStatements.children].flatMap(i=>i.getTopMostAstNodeForFile(e));return this.fileTopMostAstCache.set(e,n),n}getDeepestAstNode(e,r){let n=this.fileTopMostAsts(e),i=$r().requestTokens(e,!1),s=n.find(o=>Qt(o,e,r)||Uw(i,o,r));if(!s){let o=this.context.allParsers.flatMap(l=>l.includes),a=(l,u)=>{let d=o.find(f=>fe(f.resolvedPath,l));return d&&this.context.getSortKeyFile(u,l)===void 0?a(d.lastToken.fsPath,se(d.lastToken)):d},c=a(e,r);c&&(s=n.at(-1)?.parentNode,e=c.fsPath,r=mp.Position.create(c.lastToken.pos.line,c.lastToken.pos.colEnd))}if(s instanceof ot){let a=this.rootNode.getReferenceBy(s)?.getDeepestAstNode(e,r);return a?{...a,runtime:this}:{item:null,runtime:this,ast:ti(s,e,r)}}else if(s instanceof nt&&s.path){let o=this.rootNode.getDeepestAstNode(e,r);return o?{...o,runtime:this}:void 0}else if(s instanceof Ce&&s.path){let o=t.getNodeFromPath(s.path.slice(1),this.rootNode)?.getDeepestAstNode(e,r);return o?{...o,runtime:this}:void 0}else if(s)return{runtime:this,item:null,ast:ti(s,e,r)}}static getNodeFromPath(e,r,n=!0){if(e.length===0)return r;let i=e[0].split("@"),s=i[0],a=i.at(1)?.split(",").map(u=>Number.parseInt(u,16)),c=e.slice(1),l=r.getNode(s,a,n);return l?t.getNodeFromPath(c,l,n):void 0}resolvePath(e,r){if(!e.at(0)?.startsWith("&"))return e;let n=this.labelsUsedCache.get(e[0].slice(1));return n||(r??=this.rootNode.allDescendantsLabels,r.find(s=>s.label.value===e.at(0)?.slice(1)&&s.parentNode instanceof De)?.lastLinkedTo?.path)}get issues(){return this.issuesCache??=[...this.labelIssues(),...this.includeIssues(),...this.rootNode.getIssues(this.context.macros)],this.issuesCache}includeIssues(){let e=new Map;for(let a of this.context.allParsers.flatMap(c=>c.includes)){if(!a.resolvedPath||!wt(a.resolvedPath))continue;let c=e.get(a.resolvedPath)??[];c.push(a),e.set(a.resolvedPath,c)}let r=new Set([...e.entries()].filter(([,a])=>a.length>1).map(([a])=>a)),n=new Map,i=a=>{for(let c of a.includes){let l=n.get(c.fsPath)??[];l.push(a.fsPath),n.set(c.fsPath,l),i(c)}},s=this.context.getFileTree();i(s.mainDtsPath);for(let a of s.overlays)i(a);function o(a,c=new Set){if(c.has(a))return!1;c.add(a);let l=n.get(a);if(!l)return!1;for(let u of l)if(r.has(u)||o(u,c))return!0;return!1}return[...e.values()].filter(a=>a.length>1).filter(a=>!o(a[0].resolvedPath)).map(([a,...c])=>Bt(11,a.firstToken,a.lastToken,a,{linkedTo:c,templateStrings:[`#include <${a.path.path}>`,c.map(l=>o0.default.basename(l.fsPath)).join(", ")],severity:mp.DiagnosticSeverity.Warning}))}labelIssues(){let e=[],r=new Map;return this.rootNode.allDescendantsLabelsMapped.forEach(n=>{r.has(n.label.label.value)?r.get(n.label.label.value)?.push(n):r.set(n.label.label.value,[n])}),Array.from(r).forEach(n=>{let i=n[1];if(i.length>1){let s=i.find(a=>a.owner instanceof J);if(!i.every(a=>a&&a.owner===s?.owner)||!s){let a=i[i.length-1].label;e.push(Bt(4,a.firstToken,a.lastToken,a,{linkedTo:i.slice(0,-1).map(c=>c.label),templateStrings:[i.at(0).label.label.value]}))}}}),e}get typesIssues(){let e=r=>[...r.nodeType?.getIssue(this,r)??[],...r.nodes.flatMap(n=>e(n))];return this.typesIssuesCache??=e(this.rootNode),this.typesIssuesCache}getOrderedNodeAst(e){return Hw(e.implementations,this.context)}};var ul=q(U());var a0=q(U());var gp=class extends te{constructor(r){super();this.values=r;this.docSymbolsMeta={name:"Values",kind:a0.SymbolKind.String},this.values.forEach(n=>this.addChild(n))}toString(){return this.values.map(r=>r?.toString()).join(",")}toJson(){return this.values.length===1?this.values[0]?.toJson():this.values.map(r=>r?.toJson())}};var c0=q(U());var yp=class extends te{constructor(r){super();this.keyword=r;this.addChild(r),this.docSymbolsMeta={name:"DTS Document version",kind:c0.SymbolKind.Function}}};var wi=class extends te{constructor(r,n){super();this.value=r;this.labels=n;this.labels.forEach(i=>{this.addChild(i)}),this.addChild(this.value)}toString(r){return`${this.labels.map(n=>n.toString()).join(" ")}${this.value?.toString(r)??"NULL"}`}toPrettyString(r){return`${this.labels.map(n=>n.toString()).join(" ")}${this.value?.toPrettyString(r)??"NULL"}`}};var l0=q(U());var Tp=class extends te{constructor(r,n,i){super();this.keyword=r;this.startAddress=n;this.endAddress=i;this.addChild(r),this.docSymbolsMeta={name:"Memreserve",kind:l0.SymbolKind.Function},this.addChild(n),this.addChild(i)}toString(){return`/memreserve/ 0x${this.startAddress?.value?.toString(16)} 0x${this.endAddress?.value?.toString(16)}`}};var u0=q(U());var vp=class extends te{constructor(r,n){super();this.keyword=r;this.bitsSize=n;this.addChild(r),this.docSymbolsMeta={name:"bits",kind:u0.SymbolKind.Function},this.addChild(n)}toString(){return`/bits/ ${this.bitsSize?.value?.toString()}`}};var xn=class extends Ji{constructor(r,n,i,s,o){super();this.fsPath=r;this.incudes=n;this.tokens=[];this.others=[];this.rootDocument=new De;this.unhandledStatements=new nt;this.injectedMacros=[];this.plugin=!1;this.#e=!1;this.cPreprocessorParser=new Ea(this.fsPath,this.incudes,i,s,o)}get issues(){return[...this._issues,...this.cPreprocessorParser.issues]}getFiles(){return[this.fsPath,...this.cPreprocessorParser.dtsIncludes.flatMap(r=>r.resolvedPath).filter(r=>!!r)]}reset(){super.reset(),this.others=[],this.rootDocument=new De,this._issues=[],this.unhandledStatements=new nt,this.#e=!1,this.plugin=!1}async reparse(){let r=performance.now(),n=this.stable;return this.parsing=new Promise(i=>{n.then(async()=>{this.reset(),await this.cPreprocessorParser.reparse(),await this.parse(),console.log("parsing",performance.now()-r),i()})}),this.parsing}async parse(){if(await this.cPreprocessorParser.stable,this.tokens=this.cPreprocessorParser.tokens,ft(this.fsPath).endsWith(".h")||(this.positionStack.push(0),this.tokens.length===0))return;let r=async()=>{if(!(this.isDtsDocumentVersion()||this.isMemreserve()||this.isPlugin()||this.isRootNodeDefinition(this.rootDocument)||this.isDeleteNode(this.rootDocument,"Ref")||this.processInjectPreProcessorMacros(this.cPreprocessorParser.macros)||this.isChildNode(this.rootDocument,"Ref")||this.isProperty(this.unhandledStatements)||this.isDeleteProperty(this.unhandledStatements)||this.isChildNode(this.unhandledStatements,"Name"))){let s=this.moveToNextToken;s&&(this._issues.push(Y(22,s,s,null)),this.reportExtraEndStatements())}};for(;!this.done;)await r();this.fsPath.endsWith(".dtsi")||(this.unhandledStatements.nodes.forEach(s=>{this._issues.push(Y(53,s.firstToken,s.lastToken,s))}),this.unhandledStatements.properties.forEach(s=>{this._issues.push(Y(32,s.firstToken,s.lastToken,s))}),this.unhandledStatements.deleteProperties.forEach(s=>{this._issues.push(Y(33,s.firstToken,s.lastToken,s))}));let n=this.allAstItems.flatMap(s=>[s,...s.allDescendants]),i=this.cPreprocessorParser.comments;if(i.length&&n.forEach(s=>{(s instanceof De||s instanceof Ee||s instanceof ni)&&Kw(s,i)}),this.positionStack.length!==1)throw new Error("Incorrect final stack size")}processInjectPreProcessorMacros(r){let n=this.peekIndex(),i=this.isFunctionCall(r)||this.processCIdentifier(r,!0,!0);return this.injectPreProcessorResults(r,i,n)}injectPreProcessorResults(r,n,i){let s=n?.resolve(r);if(n&&typeof s=="string"){s=xT(s);let o=Vf(n.fsPath,ce(n)),a=new Set;if(this.cPreprocessorParser.comments.forEach(l=>{Qt(n,n.fsPath,l.range.start)&&a.add(l)}),this.cPreprocessorParser.removeComments(a),this.injectedMacros.push(n),n instanceof vt&&s.includes(n.name)||n instanceof Gt&&s.includes(n.functionName.name))return!0;let c=new rn(s,o);return this.tokens.splice(i,this.peekIndex()-i,...c.tokens),this.positionStack[this.positionStack.length-1]=i,!0}}isRootNodeDefinition(r){this.enqueueToStack();let n=this.moveToNextToken,i=n;if(!n||!H(n,13))return this.popStack(),!1;if(i=this.moveToNextToken,!i||!H(i,2))return this.popStack(),!1;let s=new nt;s.openScope=i,r.addNodeChild(s),this.processNode(s,"Name");let o=this.nodeEnd(s)??i;return s.firstToken=n,s.lastToken=o,this.mergeStack(),!0}nodeEnd(r){let n=this.currentToken;if(H(n,3))this.moveToNextToken;else{let i=this.prevToken;return i&&this._issues.push(Y(3,i,i,r)),this.endStatement(r,!1)}return this.prevToken?.value==="}"&&(r.closeScope=this.prevToken),this.endStatement(r)}isNodeEnd(){return H(this.currentToken,3)||H(this.currentToken,1)}endStatement(r,n=!0){let i=this.currentToken;if(!H(i,1)){let s=this.prevToken;if(s&&n)return this._issues.push(Y(1,s,s,r)),s}return this.moveToNextToken,this.reportExtraEndStatements(),i}reportExtraEndStatements(){for(;H(this.currentToken,1);){let r=this.moveToNextToken;r&&this._issues.push(Y(23,r,r,null))}}processNode(r,n){if(this.done)return!1;let i=!1,s=!1;do{for(;this.processInjectPreProcessorMacros(this.cPreprocessorParser.macros););if(s=this.isChildNode(r,n)||this.isProperty(r)||this.isDeleteNode(r,n)||this.isDeleteProperty(r),!s&&!this.isNodeEnd()&&!this.done){let o=this.moveToNextToken;o&&(this._issues.push(Y(22,o,o,null)),this.reportExtraEndStatements())}else if(this.done)break;i=i||s}while(!this.isNodeEnd());return i}processOptionalLabelAssign(r=!1){let n=[],i=this.isLabelAssign(r);for(;i;)n.push(i),i=this.isLabelAssign(r);return n}isChildNode(r,n){this.enqueueToStack();let i;n==="Name"&&(i=this.isOmitIfNoRefNode());let s=this.processOptionalLabelAssign(),o,a,c=n==="Ref"?new ot(s):new Ce(s,i);if(n==="Ref"?(this.enqueueToStack(),a=this.processNodePathRef(c),!a||!H(this.currentToken,2)?(this.popStack(),a=void 0):this.mergeStack(),a??=this.isLabelRef(c)):n==="Name"&&(o=this.isNodeName()),!a&&!o){if(!H(this.currentToken,2))return this.popStack(),!1;c.firstToken=this.currentToken,this._issues.push(Y(n==="Name"?[7]:[10,48,11],c.firstToken,this.currentToken?.nextToken,c))}let l=!1;if(a&&c instanceof ot?(c.reference=a,l=!0):o&&c instanceof Ce&&(l=o.address!==void 0,c.name=o),H(this.currentToken,2)){c.openScope=this.moveToNextToken;let u=!1;do u=this.processNode(c,"Name");while(u);let d=this.nodeEnd(c);c.lastToken=d}else if(l){let u=a??o;u&&this._issues.push(Y(2,u.firstToken,u.lastToken,u))}else return this.popStack(),!1;return r.addNodeChild(c),this.mergeStack(),!0}processNodeAddress(r){let n=this.prevToken;this.enqueueToStack();let i=this.checkConcurrentTokens([at("0"),at("x",{caseInsensitive:!0})]);i.length!==2?(i=[],this.popStack()):(this._issues.push(Y(50,i[0],i[1],r,{severity:ul.DiagnosticSeverity.Warning})),n=i.at(-1),this.mergeStack());let s=this.consumeAnyConcurrentTokens([19,20,48].map(Ue)),o=l=>{l.length%8!==0&&(l=l.padStart(Math.ceil(l.length/8)*8,"0"));let u=[];for(let d=0;d<l.length;d+=8){let f=l.slice(d,d+8);u.push(parseInt(f,16)>>>0)}return u},a=s.length?o(s.filter(l=>l.value!=="_").map(l=>l.value).join("")):[NaN];return n&&(a.some(l=>Number.isNaN(l))?this._issues.push(Y(8,n,n,r)):!Number.isNaN(a)&&!Kt(n,s[0])&&!ki(s[0].fsPath)&&this._issues.push(Y(29,n,s[0],r,{inclusiveStart:!1,inclusiveEnd:!1}))),this.currentToken?.value.toUpperCase()==="ULL"&&(this._issues.push(Y(51,this.currentToken,this.currentToken,r,{severity:ul.DiagnosticSeverity.Warning})),this.moveToNextToken),new Yc(a,me(i.at(0)??s[0]??this.prevToken,this.prevToken))}processNodeAddresses(r){this.enqueueToStack();let n=this.checkConcurrentTokens([Ue(49)]);if(n.length){Kt(r.lastToken,n[0])||this._issues.push(Y(29,r.lastToken,n[0],r,{inclusiveStart:!1,inclusiveEnd:!1}));let i=[],s=()=>{this.processInjectPreProcessorMacros(this.cPreprocessorParser.macros),i.push(this.processNodeAddress(r)),H(this.currentToken,24)&&(this.prevToken&&!Kt(this.prevToken,this.currentToken)&&this._issues.push(Y(29,this.prevToken,this.currentToken,r,{inclusiveStart:!1,inclusiveEnd:!1})),this.moveToNextToken,s())};s();let o=this.currentToken;for(;!H(this.currentToken,2)&&!H(this.currentToken,1)&&!H(this.currentToken,3)&&!H(this.currentToken,13)&&hr(this.currentToken,i.at(-1)?.lastToken);)this.moveToNextToken;if(o&&o!==this.currentToken){this._issues.push(Y(52,o,this.currentToken,r));let a=new Yc([],me(o,this.prevToken));i.push(a)}return this.mergeStack(),i}this.popStack()}isNodeName(){this.enqueueToStack();let r=this.consumeAnyConcurrentTokens([19,47,24,45,48,15,16].map(Ue));if(!r.length){this.popStack();return}let n=r.map(a=>a.value).join(""),i=new je(n,me(r[0],r.at(-1))),s=this.processNodeAddresses(i);i.address=s;let o=["__overlay__","__fixups__","__local_fixups__","__symbols__","__overrides__","__dormant__"];return!zf(n)&&(!this.plugin||!o.includes(n)&&this.plugin)&&this._issues.push(Y(49,i.firstToken,i.lastToken,i)),this.mergeStack(),i}isPropertyName(){this.enqueueToStack();let r=this.consumeAnyConcurrentTokens([19,47,24,45,48,15,16,44,46].map(Ue));if(!r.length){this.popStack();return}let n=new Qe(r.map(i=>i.value).join(""),me(r[0],r.at(-1)));return this.mergeStack(),n}isLabelName(){this.enqueueToStack();let r=this.consumeAnyConcurrentTokens([19,47,48].map(Ue));if(!r.length){this.popStack();return}if(!zf(r?.[0].value)){this.popStack();return}let n=r.map(s=>s.value).join(""),i=new mr(n,me(r[0],r[r.length-1]));return this.mergeStack(),i}isLabelAssign(r){this.enqueueToStack();let n=this.consumeAnyConcurrentTokens([19,47,48].map(Ue));if(!n.length){this.popStack();return}if(!zf(n?.[0].value)){this.popStack();return}let i=n.map(c=>c.value).join(""),s=this.currentToken,o=s&&H(s,50),a=new Ps(new mr(i,me(n[0],n.at(-1))),me(n[0],o?s:n.at(-1)));if(o){let c=n.at(-1);c&&(s.pos.line!==a.firstToken.pos.line||s.pos.col!==c.pos.colEnd)&&this._issues.push(Y(29,c,s,a,{inclusiveStart:!1,inclusiveEnd:!1})),this.moveToNextToken}else if(r)this._issues.push(Y(24,a.firstToken,a.lastToken,a));else{this.popStack();return}return this.mergeStack(),a}isProperty(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(),i=this.isPropertyName();if(!i)return this.popStack(),!1;if(H(this.currentToken,2)||H(this.currentToken,49))return this.popStack(),!1;let s=new Ee(i,n),o;H(this.currentToken,0)?(s.assignOperatorToken=this.moveToNextToken,o=this.processValue(r),o?.values.filter(c=>!!c).length||this._issues.push(Y(0,s.firstToken,s.lastToken,s)),s.values=o??null):s.values=void 0;let a=this.endStatement(s);return s.lastToken=a,r.addNodeChild(s),this.mergeStack(),!0}isDtsDocumentVersion(){this.enqueueToStack();let r=this.checkConcurrentTokens([Ue(13),at("d"),at("ts"),Ue(16),at("v"),at("1")]);if(r.length!==6)return this.popStack(),!1;let n=r[0],i=n,s=new At;s.firstToken=n;let o=new yp(s);if(this.others.push(o),H(this.currentToken,13))i=this.moveToNextToken;else return s.lastToken=r.at(-1),this._issues.push(Y(21,o.firstToken,o.lastToken,o)),this.mergeStack(),!0;return s.lastToken=i,o.lastToken=this.endStatement(o),this.mergeStack(),!0}isMemreserve(){this.enqueueToStack();let r=this.checkConcurrentTokens([Ue(13),at("memreserve")]);if(r.length!==2)return this.popStack(),!1;let n=new At;n.firstToken=r[0];let s=r[0];H(this.currentToken,13)?(s=this.moveToNextToken,n.lastToken=s):(n.lastToken=r.at(-1),this._issues.push(Y(21,n.firstToken,n.lastToken,n)));let o=this.processHex()||this.processDec(),a=o&&(this.processHex()||this.processDec()),c=new Tp(n,o,a);if(this.others.push(c),o||this._issues.push(Y(37,n.firstToken,n.lastToken,n)),!a){let l=o??n;this._issues.push(Y(38,l.firstToken,l.lastToken,c))}return c.lastToken=this.endStatement(c),this.mergeStack(),!0}isPlugin(){this.enqueueToStack();let r=this.checkConcurrentTokens([Ue(13),at("plugin"),Ue(13)]);if(r.length!==3)return this.popStack(),!1;let n=new At(me(r[0],r.at(-1)));return n.lastToken=this.endStatement(n),this.mergeStack(),this.others.push(n),this.plugin=!0,!0}processBits(){this.enqueueToStack();let r=this.checkConcurrentTokens([Ue(13),at("b"),at("its")]);if(r.length!==3){this.popStack();return}let n=new At;n.firstToken=r[0];let s=r[0];H(this.currentToken,13)?(s=this.moveToNextToken,n.lastToken=s):(n.lastToken=r.at(-1),this._issues.push(Y(21,n.firstToken,n.lastToken,n)));let o=this.processDec(),a=new vp(n,o);return this.others.push(a),o?o.value!==8&&o.value!==16&&o.value!==32&&o.value!==64&&this._issues.push(Y(40,o.firstToken,o.lastToken,o)):this._issues.push(Y(39,n.firstToken,n.lastToken,n)),this._issues.push(Y(41,a.firstToken,a.lastToken,a,{severity:ul.DiagnosticSeverity.Warning})),this.mergeStack(),a}isOmitIfNoRefNode(){this.enqueueToStack();let r=this.checkConcurrentTokens([Ue(13),at("omit"),Ue(16),at("if"),Ue(16),at("no"),Ue(16),at("ref"),Ue(13)]);if(r.length!==9){this.popStack();return}let n=new At(me(r[0],r.at(-1)));return this.mergeStack(),n}isDeleteNode(r,n){this.enqueueToStack();let i=this.checkConcurrentTokens([Ue(13),at("d"),at("e"),at("lete",{allowPartial:!0}),Ue(16),at("node",{allowPartial:!0})]);if(!i.length)return this.popStack(),!1;let s=i[0],o=s,a=new At;if(a.firstToken=s,i.length===1&&!H(this.currentToken,2)){this._issues.push(Y(25,a.firstToken,a.lastToken,a)),a.lastToken=i.at(-1);let d=new Qr(a);return r.addNodeChild(d),this.mergeStack(),!0}let c=i.map(d=>d.value??"").join("");if(!"/delete-node/".startsWith(c)||c.endsWith("-"))return this.popStack(),!1;a.lastToken=i.at(-1),c!=="/delete-node"?this._issues.push(Y(c.startsWith("/delete-n")?34:25,a.firstToken,a.lastToken,a)):H(this.currentToken,13)?(o=this.moveToNextToken,a.lastToken=o):this._issues.push(Y(21,a.firstToken,a.lastToken,a));let l=new Qr(a);if(hr(a.lastToken,s)){let d=this.processNodePathRef(r);d&&n==="Name"&&this._issues.push(Y(7,d.firstToken,d.lastToken,d));let f=d?void 0:this.isLabelRef(r);f&&n==="Name"&&this._issues.push(Y(7,f.firstToken,f.lastToken,f));let p=d||f?void 0:this.isNodeName();p&&n==="Ref"&&this._issues.push(Y(10,p.firstToken,p.lastToken,p)),!d&&!p&&!f&&this._issues.push(Y([7,10],l.firstToken,l.lastToken,l)),l.nodeNameOrRef=d??f??p??null}else n==="Name"?this._issues.push(Y(7,a.firstToken,a.lastToken,a)):n==="Ref"&&this._issues.push(Y(10,a.firstToken,a.lastToken,a));let u=this.endStatement(l);return l.lastToken=u,r.addNodeChild(l),this.mergeStack(),!0}isDeleteProperty(r){this.enqueueToStack();let n=this.checkConcurrentTokens([Ue(13),at("d"),at("e"),at("lete",{allowPartial:!0}),Ue(16),at("property",{allowPartial:!0})]);if(!n.length)return this.popStack(),!1;let i=n[0],s=i,o=new At;if(o.firstToken=i,n.length===1&&!H(this.currentToken,2)){this._issues.push(Y(25,o.firstToken,o.lastToken,o)),o.lastToken=n.at(-1);let u=new dt(o);return r.addNodeChild(u),this.mergeStack(),!0}let a=n.map(u=>u.value??"").join("");if(!"/delete-property/".startsWith(a)||a.endsWith("-"))return this.popStack(),!1;o.lastToken=n.at(-1),a!=="/delete-property"?this._issues.push(Y(a.startsWith("/delete-p")?35:25,o.firstToken,o.lastToken,o)):H(this.currentToken,13)?(s=this.moveToNextToken,o.lastToken=s):this._issues.push(Y(21,o.firstToken,o.lastToken,o));let c=new dt(o);if(hr(o.lastToken,i)){let u=this.isPropertyName();u||this._issues.push(Y(6,c.firstToken,c.lastToken,c)),c.propertyName=u??null}else this._issues.push(Y(6,o.firstToken,o.lastToken,o));let l=this.endStatement(c);return c.lastToken=l,r.addNodeChild(c),this.mergeStack(),!0}isNodePathRef(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!0),i=this.processNodePathRef(r);if(!i){this.popStack();return}let s=[];this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&s.push(...this.processOptionalLabelAssign(!0));let o=new qr(n,i,s);return this.mergeStack(),o}processValue(r){this.enqueueToStack();let i=(()=>{let o=()=>(this.processStringValue()||this.isNodePathRef(r)||this.isLabelRefValue(r)||this.arrayValues(r)||this.processByteStringValue()||this.isExpressionValue(r))??null,a=o();if(!a)return[];let c=[a];for(;!H(this.currentToken,1);){let l=this.prevToken,u=this.currentToken,d,f=H(this.currentToken,24);if(f)d=this.currentToken,this.moveToNextToken;else if(!hr(this.prevToken,this.currentToken))break;let p=o();if(u&&p===null&&f){let h=new te(me(u,this.currentToken));this._issues.push(Y(0,h.firstToken,h.lastToken,h))}if(!f&&p===null)break;if(l&&!f&&p){let h=new te(me(l));this._issues.push(Y(28,h.firstToken,h.lastToken,h))}let m=c.at(-1);m&&(m.nextValueSeparator??=d),c.push(p)}return c})();if(i.length===0){this.popStack();return}return this.mergeStack(),new gp(i)}processStringValue(){this.enqueueToStack();let r=this.processOptionalLabelAssign(!0),n=this.consumeAnyConcurrentTokens([Ue(21)]);if(!n.length){this.popStack();return}if(n.some(u=>u.value===void 0))throw new Error("Token must have value");let i=n.map(u=>u.value).join(`
300
+ `),s=i,o=['"',"'"].some(u=>s.endsWith(u));o&&(s=s.slice(1,-1));let a=new ne(s,me(n[0],n.at(-1)));o||this._issues.push(Y(i.startsWith('"')?16:17,a.firstToken,a.lastToken,a));let c=[];this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&(c=this.processOptionalLabelAssign(!0));let l=new qr(r,a,c);return this.mergeStack(),l}arrayValues(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!0),i=this.processBits(),s=this.currentToken;if(H(s,5))this.moveToNextToken;else{this.popStack();return}let o=this.processArrayValues(r)??null;o.openBracket=s;let a=this.processOptionalLabelAssign(!0)??[],c=new qr(n,o,a,i);if(!H(this.currentToken,4))this._issues.push(Y(12,c.firstToken,c.lastToken,c));else{let u=this.moveToNextToken;o&&(o.closeBracket=u)}let l=[];return this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&(l=this.processOptionalLabelAssign(!0)),this.mergeStack(),c.endLabels.push(...l),c.firstToken=s,c.lastToken=this.prevToken,c}processByteStringValue(){this.enqueueToStack();let r=this.processOptionalLabelAssign(!0),n=this.moveToNextToken,i=n;if(!H(i,11)){this.popStack();return}let s=this.processLabeledValue(()=>this.processHexString()),o=this.processOptionalLabelAssign(!0)??[];s.forEach(u=>{let d=0;u.value&&u.value.firstToken===u.value.lastToken&&(d=u.value.firstToken.pos.len),d%2!==0&&this._issues.push(Y(15,u.firstToken,u.lastToken,u))});let a=new Lr(s??[]);a.openBracket=i,a.values.length===0&&(a.firstToken=n,this._issues.push(Y(14,a.firstToken,a.lastToken,a,{severity:ul.DiagnosticSeverity.Information})));let c=new qr(r,a,o);H(this.currentToken,12)?a.closeBracket=this.moveToNextToken:this._issues.push(Y(5,c.firstToken,c.lastToken,c));let l=[];return this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&(l=this.processOptionalLabelAssign(!0)),this.mergeStack(),c.endLabels.push(...l),c.firstToken=n,a.lastToken=this.prevToken,c}processLabeledValue(r){this.enqueueToStack();let n=r(),i=[];if(!n)return this.popStack(),[];for(;n;)i.push(n),n=r();if(i.length){let s=r();s&&i.push(s)}return this.mergeStack(),i}processArrayValues(r){this.enqueueToStack();let n=this.processLabeledValue(()=>{let s=()=>this.processRefValue(r,!1)||this.processLabeledHex(!1)||this.processLabeledDec(!1)||this.processLabeledExpression(!0,!1,r),o=this.peekIndex(),a=s();return a&&!this.cPreprocessorParser.optimizeForFormatting&&(a.value instanceof Gt&&a.value.params.every(c=>!!c)&&this.cPreprocessorParser.macros.has(a.value.functionName.name)||a.value instanceof vt&&this.cPreprocessorParser.macros.has(a.value.name))&&typeof a.value.evaluate(this.cPreprocessorParser.macros)=="string"?(this.injectPreProcessorResults(this.cPreprocessorParser.macros,a.value,o),s()):a}),i=new ut(n);return n.length===0&&(i.firstToken=this.currentToken),this.mergeStack(),i}processLabeledHex(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(r),i=this.processHex();if(!i){this.popStack();return}let s=new wi(i,n);return this.mergeStack(),s}processHexString(){this.enqueueToStack();let r=this.processOptionalLabelAssign(!1),n=this.checkConcurrentTokens([20,20].map(Ue));if(!n.length){this.popStack();return}let i=Number.parseInt(n.map(a=>a.value).join(""),16),s=new ir(i,me(n[0],n.at(-1)),16),o=new wi(s,r);return this.mergeStack(),o}processLabeledDec(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(r),i=this.processDec();if(!i){this.popStack();return}let s=new wi(i,n);return this.mergeStack(),s}processLabeledExpression(r=!0,n=r,i){this.enqueueToStack();let s=[];r&&(s=this.processOptionalLabelAssign(n));let o=this.processExpression(this.cPreprocessorParser.macros,i);if(!o){this.popStack();return}let a=new wi(o,s);return this.mergeStack(),a}isExpressionValue(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!1),i=this.processExpression(this.cPreprocessorParser.macros,r);if(!i){this.popStack();return}let s=this.processOptionalLabelAssign(!0),o=new qr(n,i,s);return this.mergeStack(),o}isLabelRef(r){this.enqueueToStack();let n=this.currentToken;if(!n||!H(n,40)){this.popStack();return}else this.moveToNextToken;let i=this.isLabelName();if(!i){let o=new ie(null);return this._issues.push(Y(18,n,n,r)),o.firstToken=n,this.mergeStack(),o}n&&(i.firstToken.pos.line!==n.pos.line||i.firstToken.pos.col!==n.pos.colEnd)&&this._issues.push(Y(29,n,i.firstToken,r,{inclusiveStart:!1,inclusiveEnd:!1}));let s=new ie(i);return s.firstToken=n,this.mergeStack(),s}isLabelRefValue(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!0),i=this.isLabelRef(r);if(!i){this.popStack();return}let s=[];this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&(s=this.processOptionalLabelAssign(!0));let o=new qr(n,i,s);return this.mergeStack(),o}processRefValue(r,n){this.enqueueToStack();let i=this.processOptionalLabelAssign(n),s=this.currentToken;if(!s||!H(s,40)){this.popStack();return}let o=this.processNodePathRef(r);if(o!==void 0){let l=new wi(o,i);return this.mergeStack(),l}let a=this.isLabelRef(r);if(a===void 0){this._issues.push(Y([18,9],s,s,r));let l=new wi(null,i);return l.firstToken=i.at(0)?.firstToken??s,this.mergeStack(),l}let c=new wi(a,i);return c.firstToken=i.at(0)?.firstToken??s,this.mergeStack(),c}processNodePath(r=!0,n=new ri){this.enqueueToStack();let i;if(H(this.currentToken,13))i=this.moveToNextToken;else{if(!r){this.popStack();return}this.prevToken&&this._issues.push(Y(19,this.prevToken,this.prevToken,n))}let s=this.isNodeName(),o=i??this.prevToken;if(!s&&o&&!r&&this._issues.push(Y(7,o,o,n)),!r||s?n.addPath(s??null,i?new te(me(i)):void 0):r&&!s&&i&&(n.addPath(new je("/",me(i))),n.firstToken=i),r&&!i&&n.children.length===0){this.mergeStack();return}return this.processNodePath(!1,n),this.mergeStack(),n}processNodePathRef(r){this.enqueueToStack();let n=this.moveToNextToken,i=n;if(!H(i,40)){this.popStack();return}let s=this.moveToNextToken;if(i=s,!H(i,2)){this.popStack();return}n&&!Kt(n,s)&&this._issues.push(Y(29,n,s,r,{inclusiveStart:!1,inclusiveEnd:!1}));let o=this.processNodePath(),a=new it(o??null),c=this.currentToken??this.prevToken,l=c;return o?.children.forEach((u,d)=>{if(d===o?.children.length-1&&u&&l&&!Kt(u.lastToken,l)){this._issues.push(Y(29,u.lastToken,l,r,{inclusiveStart:!1,inclusiveEnd:!1}));return}if(d===0&&s&&!Kt(s,u?.firstToken)){this._issues.push(Y(29,s,u?.firstToken,r,{inclusiveStart:!1,inclusiveEnd:!1}));return}let f=o?.children[d+1];u&&f&&!Kt(u.lastToken,f.firstToken)&&this._issues.push(Y(29,u.lastToken,f?.firstToken,r,{inclusiveStart:!1,inclusiveEnd:!1}))}),H(c,3)?this.moveToNextToken:this.prevToken&&this._issues.push(Y(3,this.prevToken,this.prevToken,r)),a.firstToken=n,a.lastToken=c??this.prevToken,this.mergeStack(),a}get includes(){return this.cPreprocessorParser.dtsIncludes}get allAstItems(){return[...this.cPreprocessorParser.allAstItems,...this.rootDocument.children,...this.others,...this.unhandledStatements.properties,...this.unhandledStatements.deleteProperties,...this.unhandledStatements.nodes]}#e;get latestSemanticTokensBuilt(){return this.#e}buildSemanticTokens(r,n){let i=[];this.injectedMacros.forEach(s=>{s.buildSemanticTokens((...o)=>Ji.push(...o,n,i))}),super.buildSemanticTokens(r,n,i),this.#e=!0}};var bp=class t{constructor(e,r,n){this.settings=e;this.formattingOptions=r;this.bindingLoader=n;this._issues=[];this.overlayParsers=[];this.overlays=[];this.ctxNames_=new Set;this.sortKeys=new WeakMap;this.staleFsPaths=new Set;let i={...e,ctxName:e.ctxName??(0,wa.basename)(e.dtsFile)};this.isFullContext=this.settings.dtsFile.toLowerCase().endsWith(".dts"),this.overlays=i.overlays,this.overlays.filter(dl.existsSync);let s=this.isFullContext&&n?.type==="Zephyr"?[(0,wa.join)((0,wa.dirname)(this.settings.dtsFile),"dts"),...i.includePaths]:i.includePaths;this.parser=new xn(i.dtsFile,s),this.ctxNames_.add(i.ctxName),this.id=Ki(i),this.parser.stable.then(()=>{this.overlayParsers=this.overlays?.map(o=>new xn(o,s,this.parser.cPreprocessorParser.macros))??[]})}get macros(){return this.allParsers.at(-1).cPreprocessorParser.macros}get ctxNames(){return Array.from(this.ctxNames_)}addCtxName(e){this.ctxNames_.add(e)}removeCtxName(e){this.ctxNames_.delete(e)}async getContextIssues(){return[...(await this.getRuntime()).issues,...this._issues]}getFileTree(){let e=new Map,r=n=>({fsPath:n,includes:(e.get(n)??[]).map(i=>r(i.resolvedPath??i.path))});return[...this.parser.includes,...this.overlayParsers.flatMap(n=>n.includes)].forEach(n=>{let i=e.get(n.fsPath);i||(i=[],e.set(n.fsPath,i)),i.push({path:n.path.path,resolvedPath:n.resolvedPath})}),{mainDtsPath:r(this.parser.fsPath),overlays:this.overlays.map(r)}}async stable(){await Promise.all([this.parser.stable,...this.overlayParsers.map(e=>e.stable)])}async getRuntime(){return await this.stable(),this._runtime??=this.evaluate(),this._runtime}getContextFiles(){return[...this.overlayParsers.flatMap(e=>e.getFiles()),...this.parser.getFiles()]}isInContext(e){return this.getContextFiles().some(r=>fe(r,e))}getFsPathParser(e){return this.allParsers.find(n=>n.getFiles().some(i=>fe(i,e)))}async getAllStableParsers(){return await this.stable(),this.allParsers}get allParsers(){return[this.parser,...this.overlayParsers]}async getDocumentLinks(e,r){if(!this.isInContext(e))return[];let i=(await this.getRuntime()).rootNode.allBindingsProperties.filter(s=>fe(s.ast.fsPath,e)&&s.ast.values&&(!r||Qt(s.ast.values,e,r))).flatMap(s=>s.ast.values?.values.flatMap(o=>{let c=s.parent?.nodeTypes.find(l=>o?.value instanceof ne&&l.compatible===o.value.value);return c&&c.bindingsPath?{range:ce(o.value),target:ue(c.bindingsPath)}:void 0})).filter(s=>!!s)??[];return[...[...this.parser.cPreprocessorParser.dtsIncludes,...this.overlayParsers.flatMap(s=>s.cPreprocessorParser.dtsIncludes)].filter(s=>fe(s.fsPath,e)&&(!r||Qt(s,e,r))).map(s=>{let o=this.parser.cPreprocessorParser.resolveInclude(s);if(o)return{range:ce(s.path),target:ue(o)}}).filter(s=>!!s)??[],...i]}linkPropertiesLabelsAndNodePaths(e){let r=s=>[...s.properties,...s.nodes.flatMap(r)],n=r(e.rootNode),i=e.rootNode.allDescendantsLabels;n.forEach(s=>s.ast.allDescendants.forEach(o=>{if(o instanceof ie){let a=e.resolvePath([`&${o.label?.value}`],i);if(a){let c=e.rootNode.getChild(a);o.linksTo=c,c?.linkedRefLabels.push(o)}else o.value&&this._issues.push(Bt(3,o.firstToken,o.lastToken,o,{templateStrings:[o.value],severity:this.parser.plugin?gr.DiagnosticSeverity.Information:gr.DiagnosticSeverity.Error}))}else o instanceof ri&&this.linkNodePath(o,e.rootNode)}))}linkNodePath(e,r){let n=r,i=e.pathParts;for(let s=0;s<i.length&&i[s];s++){let o=!1,a=i[s];if(a){let c=s===0&&a.name==="/"?r:n?.getNode(a.name,a.fullAddress,!1);a.linksTo=c,!o&&!c&&(o=!0,this._issues.push(Bt(8,a.firstToken,a.lastToken,a,{templateStrings:[a.toString(),`${e.pathParts.filter(l=>l?.linksTo).map(l=>l?.toString()).join("/")}`],severity:this.parser.plugin?gr.DiagnosticSeverity.Information:gr.DiagnosticSeverity.Error}))),c?.linkedNodeNamePaths.push(a),n=c}else break}}setStaleFsPath(e){this.staleFsPaths.add(e)}async reevaluate(e){this.setStaleFsPath(e);let r=new Set;return this.staleFsPaths.forEach(n=>{let i=this.getFsPathParser(n);i&&r.add(i)}),r.size?(this.sortKeys=new WeakMap,await Promise.all(Array.from(r).map(n=>n.reparse())),this._runtime=this.evaluate(),this._runtime):this._runtime}getSortKey(e,r=!1){if(e)return this.sortKeys.get(r?e.lastToken:e.firstToken)}async evaluate(){let e=performance.now();await this.stable();let r=new Ei(this);this.staleFsPaths.clear(),this._issues=[],this.parser.rootDocument.resetIssues(),this.processRoot(this.parser.rootDocument,r);for(let i=0;i<this.overlayParsers.length;i++)this.overlayParsers[i].rootDocument.resetIssues(),this.processRoot(this.overlayParsers[i].rootDocument,r);let n=await Promise.all(r.rootNode.defaultProperties.map(async i=>{let s=new rn(i.text,i.fsPath),o=new xn(i.fsPath,[],void 0,()=>s.tokens);return await o.stable,this.processRoot(o.rootDocument,r),o}));return r.comments=this.parser.cPreprocessorParser.allAstItems.filter(i=>i instanceof vn),[...this.allParsers,...n].flatMap(i=>i.tokens).forEach((i,s)=>this.sortKeys.set(i,s)),this.linkPropertiesLabelsAndNodePaths(r),this.reportNodeNameAndPropertyClashes(r),console.log(`(ID: ${this.id}) evaluate`,performance.now()-e),r}getSortKeyFile(e,r){let n=this.findTokenBeforePosition(e,r),i=n,s=i?this.sortKeys.get(i):void 0;for(;i&&!s;)i=i.nextToken,s=i?this.sortKeys.get(i):void 0;if(s!==void 0)return s;for(i=n,s=i?this.sortKeys.get(i):void 0;i&&!s;)i=i.prevToken,s=i?this.sortKeys.get(i):void 0;return s}findTokenBeforePosition(e,r){let n=this.allParsers.flatMap(i=>({parser:i,tokens:i.tokens}));for(let[i,s]of n.entries()){if(s.tokens.length===0&&fe(s.parser.fsPath,r)){let c=n.slice(0,i).reverse().find(l=>l.tokens.length);return i?c?.tokens[c.tokens.length-1]:void 0}let o=s.tokens.find((c,l)=>_s(c,r,e)&&(l===s.tokens.length-1||!c.nextToken||CT(c.nextToken,r,e)));if(o)return o;let a=s.parser.includes.find(c=>c.resolvedPath===r);if(a)return a.lastToken;if(s.parser.getFiles().some(c=>fe(c,r)))return s.tokens[s.tokens.length-1]}}reportNodeNameAndPropertyClashes(e){let r=n=>{n.properties.forEach(i=>{n.nodes.filter(o=>o.address===void 0&&o.name===i.ast.propertyName?.name&&o.definitions.at(-1)?.name).forEach(o=>{let a=o.definitions,c=a[a.length-1].name;this._issues.push(Bt(2,c.firstToken,c.lastToken,c,{linkedTo:[i.ast,...i.allReplaced.map(l=>l.ast)]}))})}),n.nodes.forEach(r)};r(e.rootNode)}processRoot(e,r){for(let n=0;n<e.children.length;n++){let i=e.children[n];this.processChild(i,r.rootNode,r)}}processChild(e,r,n){e instanceof De?this.processDtcBaseNode(e,r,n):e instanceof Ee?this.processDtcProperty(e,r,n):e instanceof Qr?this.processDeleteNode(e,r,n):e instanceof dt&&this.processDeleteProperty(e,r,n)}checkNodeUniqueNames(e,r){let n=(o,a)=>o.filter(c=>c.name===a.name&&(c.address===a.fullAddress&&c.address===void 0||qt(c.address??[],a.fullAddress??[])===0)).map(c=>c.issueAst),i=r.nodes.map(o=>{let a=o.definitions[0];return{name:o.name,address:o.address,issueAst:a.name??a}}),s=[];e.children.forEach(o=>{if(o instanceof Ce&&o.name){let a=n(s.map(c=>({name:c.name,address:c.fullAddress,issueAst:c})),o.name);a.length&&this._issues.push(Bt(2,o.name.firstToken,o.name.lastToken,o.name,{linkedTo:a})),s.push(o.name)}else if(o instanceof Qr&&o.nodeNameOrRef instanceof je){let a=o.nodeNameOrRef;n(i,a)&&(s=s.filter(c=>n(s.map(l=>({name:l.name,address:l.fullAddress,issueAst:l})),c).length))}})}getCompileCommands(){if(!(!this.settings.compileCommands||!(0,dl.existsSync)(this.settings.compileCommands)))return JSON.parse((0,dl.readFileSync)(this.settings.compileCommands).toString())}processDtcBaseNode(e,r,n){e instanceof nt?this.processDtcRootNode(e,n):e instanceof Ce?this.processDtcChildNode(e,r,n):e instanceof ot&&this.processDtcRefNode(e,n)}processDtcRootNode(e,r){r.rootNode.implementations.push(e),this.checkNodeUniqueNames(e,r.rootNode),e.children.forEach(n=>this.processChild(n,r.rootNode,r))}processDtcChildNode(e,r,n){if(e.name?.name){let i=e.path?n.resolvePath(e.path):void 0,o=(i?n.rootNode.getChild(i):void 0)??new J(this.bindingLoader,e.name.name,e.name.fullAddress,r);o.implementations.push(e),e.labels.forEach(a=>a.lastLinkedTo=o),r=o,this.checkNodeUniqueNames(e,o)}e.children.forEach(i=>this.processChild(i,r,n))}processDtcRefNodeLabelRef(e,r,n){let i,s=e.resolveNodePath??(e.pathName?n.resolvePath([e.pathName]):void 0);return s?(e.resolveNodePath??=[...s],i=n.rootNode.getChild(s),r.linksTo=i,e.labels.forEach(o=>o.lastLinkedTo=i),i?.linkedRefLabels.push(r),i?.implementations.push(e),e.labels.forEach(o=>{n.labelsUsedCache.set(o.label.value,s)}),i?(n.references.push(e),this.checkNodeUniqueNames(e,i)):n.unlinkedRefNodes.push(e)):(this._issues.push(Bt(3,r.firstToken,r.lastToken,r,{templateStrings:[r.label?.value??""],severity:this.parser.plugin?gr.DiagnosticSeverity.Information:gr.DiagnosticSeverity.Error})),n.unlinkedRefNodes.push(e)),i}processDtcRefNodeNodePathRef(e,r,n){let i;r.path&&this.linkNodePath(r.path,n.rootNode);let o=r.path?.pathParts.at(-1)?.linksTo?.path;return o?(e.resolveNodePath??=o,i=n.rootNode.getChild(o),e.labels.forEach(a=>a.lastLinkedTo=i),i?.implementations.push(e),e.labels.forEach(a=>{n.labelsUsedCache.set(a.label.value,o)}),i?(n.references.push(e),this.checkNodeUniqueNames(e,i)):n.unlinkedRefNodes.push(e)):n.unlinkedRefNodes.push(e),i}processDtcRefNode(e,r){let n;e.reference?e.reference instanceof ie?n=this.processDtcRefNodeLabelRef(e,e.reference,r):n=this.processDtcRefNodeNodePathRef(e,e.reference,r):r.unlinkedRefNodes.push(e),e.children.forEach(i=>this.processChild(i,n??new J(this.bindingLoader,""),r))}processDtcProperty(e,r,n){e.propertyName?.name&&r.addProperty(new et(e,r)),e.children.forEach(i=>this.processChild(i,r,n))}processDeleteNode(e,r,n){if(e.nodeNameOrRef instanceof je&&e.nodeNameOrRef.value){if(e.parentNode?.parentNode)if(!r.hasNode(e.nodeNameOrRef.name,e.nodeNameOrRef.fullAddress))this._issues.push(Bt(5,e.nodeNameOrRef.firstToken,e.nodeNameOrRef.lastToken,e.nodeNameOrRef));else{r.deletes.push(e);let i=r.getNode(e.nodeNameOrRef.name,e.nodeNameOrRef.fullAddress);e.nodeNameOrRef.linksTo=i,r.deleteNode(e.nodeNameOrRef.name,e,e.nodeNameOrRef.fullAddress),i?.labels.forEach(s=>{n.labelsUsedCache.delete(s.label.value)})}}else if(e.nodeNameOrRef instanceof ie&&e.nodeNameOrRef.value){let i=n.resolvePath([`&${e.nodeNameOrRef.value}`]),s;i?(s=n.rootNode.getChild(i),r.deletes.push(e),e.nodeNameOrRef.linksTo=s,s?.labels.forEach(o=>{n.labelsUsedCache.delete(o.label.value)}),s?.linkedRefLabels.push(e.nodeNameOrRef),s?.parent?.deleteNode(s.name,e,s.address),e.parentNode instanceof De&&!e.parentNode.pathName&&n.globalDeletes.push(e)):(n.unlinkedDeletes.push(e),this._issues.push(Bt(3,e.nodeNameOrRef.firstToken,e.nodeNameOrRef.lastToken,e.nodeNameOrRef,{templateStrings:[e.nodeNameOrRef.value],severity:this.parser.plugin?gr.DiagnosticSeverity.Information:gr.DiagnosticSeverity.Error})))}else if(e.nodeNameOrRef instanceof it&&e.nodeNameOrRef.path&&!e.nodeNameOrRef.path.pathParts.some(i=>!i)){let i=n.rootNode,s=e.nodeNameOrRef.path.pathParts;for(let c=0;c<s.length&&s[c];c++){let l=s[c];if(l){let u=i?.getNode(l.name,l.fullAddress,!1);l.linksTo=u,u?.linkedNodeNamePaths.push(l),i=u}}let o=e.nodeNameOrRef.path.pathParts.find(c=>c&&!c.linksTo),a=e.nodeNameOrRef.path.pathParts.at(-1)?.linksTo;a||(n.unlinkedDeletes.push(e),o&&this._issues.push(Bt(8,o.firstToken,o.lastToken,o,{templateStrings:[o.toString(),`${e.nodeNameOrRef.path.pathParts.filter(c=>c?.linksTo).map(c=>c?.toString()).join("/")}`],severity:this.parser.plugin?gr.DiagnosticSeverity.Information:gr.DiagnosticSeverity.Error}))),r.deletes.push(e),a?.labels.forEach(c=>{n.labelsUsedCache.delete(c.label.value)}),a?.parent?.deleteNode(a.name,e,a.address),e.parentNode instanceof De&&!e.parentNode.pathName&&n.globalDeletes.push(e)}else n.unlinkedDeletes.push(e);e.children.forEach(i=>this.processChild(i,r,n))}processDeleteProperty(e,r,n){e.propertyName?.name&&!r.hasProperty(e.propertyName.name)?this._issues.push(Bt(1,e.propertyName.firstToken,e.propertyName.lastToken,e.propertyName)):e.propertyName?.name&&(r.deletes.push(e),r.deleteProperty(e.propertyName.name,e)),e.children.forEach(i=>this.processChild(i,r,n))}static#e(e,r,n){let i=n.get(r);i||(i=[],n.set(r,i)),i.push(e)}getIssues(e,r=new Map,n=i=>{if(!(i.raw.severity===gr.DiagnosticSeverity.Hint&&i.raw.virtual))return i.raw.severity===gr.DiagnosticSeverity.Error&&!this.isFullContext&&(i.raw.severity=gr.DiagnosticSeverity.Warning),i}){return e.forEach(i=>{let s=n(i);s&&t.#e(s.diagnostic(),s.raw.fsPath,r)}),r}async getSyntaxIssues(e=new Map,r=n=>{if(n.raw.severity===gr.DiagnosticSeverity.Error&&!this.isFullContext&&!ho(n.raw,n.raw.fsPath,!1)&&(n.raw.severity=gr.DiagnosticSeverity.Warning),!(n.raw.severity===gr.DiagnosticSeverity.Hint&&n.raw.virtual))return n}){return(await this.getAllStableParsers()).forEach(n=>this.getIssues(n.issues,e,r)),e}async getDiagnostics(){let e=new Map;try{await this.getSyntaxIssues(e);let r=await this.getContextIssues()??[];this.getIssues(r,e);let n=await this.getRuntime();return this.getIssues(n.typesIssues,e),e}catch(r){throw console.error(r),r}}async toFullString(){return`/dts-v1/;
301
301
 
302
302
  ${(await this.getRuntime()).rootNode.toFullString((await this.getAllStableParsers()).at(-1).cPreprocessorParser.macros,this.settings.cwd)}`}async serialize(){let e={};return await this.stable,await this.getDiagnostics(),(await this?.getRuntime())?.rootNode.serialize(e,(await this.getAllStableParsers()).at(-1).cPreprocessorParser.macros),e}};var d0=require("fs"),Da=require("path"),It=q(U());function ZH(t){if(!t||!(t.ast instanceof ka))return[];let e=n=>n.flatMap(i=>{try{return(0,d0.readdirSync)(i,{withFileTypes:!0,recursive:!0}).filter(s=>s.name.toLowerCase().endsWith(".dtsi")||s.name.toLowerCase().endsWith(".h")).map(s=>({label:`${(0,Da.join)((0,Da.relative)(i,s.parentPath),s.name)}`,kind:It.CompletionItemKind.File}))}catch{return[]}});if(t.ast.relative)return e([(0,Da.dirname)(t.ast.fsPath)]);let r=t.runtime.context.settings.includePaths??[];return e(r)}var Sp=(t,e)=>[...t.labels.filter(e),...t.deletedNodes.filter(r=>!e(r.by)).flatMap(r=>Sp(r.node,e)),...t.nodes.flatMap(r=>Sp(r,e))],sv=(t,e)=>[...t.labels,...t.deletedNodes.filter(r=>!e(r.by)).flatMap(r=>sv(r.node,e)),...t.nodes.flatMap(r=>sv(r,e))];function eV(t,e){if(!t||!(t.item instanceof et)||!(t.ast instanceof ie))return[];let r=i=>sv(i,e),n=new Map;return r(t.runtime.rootNode).forEach(i=>n.set(i.label.value,i)),Array.from(n).map(([,i])=>({label:`${i.label.value}`,kind:It.CompletionItemKind.Method,documentation:i.lastLinkedTo?.toMarkupContent(t.runtime.context.macros)}))}function tV(t,e){if(!t||t.item!==null||!(t.ast instanceof ie)||!(t.ast.parentNode instanceof ot))return[];let r=n=>Sp(n,e).filter(i=>e(i));return[...Array.from(new Set(r(t.runtime.rootNode).map(n=>n.label.value))).map(n=>({label:n,insertText:t.ast.lastToken.nextToken?.value==="{"?n:`${n} {
303
303
  $1
304
304
  };`,kind:It.CompletionItemKind.Value,insertTextFormat:It.InsertTextFormat.Snippet}))]}function rV(t,e){let r=s=>s?s.parentNode instanceof ot||s.parentNode instanceof nt||s.parentNode instanceof Ce?!1:r(s.parentNode):!0;if(!t||t.item!==null||!Zt(t.ast)||!r(t.ast))return[];let n=s=>Sp(s,e).filter(o=>e(o));if(t.ast instanceof At)return n(t.runtime.rootNode).length?[{label:"/delete-node/",insertText:"/delete-node/ $1;",kind:It.CompletionItemKind.Keyword,insertTextFormat:It.InsertTextFormat.Snippet,sortText:"~",command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:t.runtime.rootNode.nodes.length?[{label:"/delete-node/ &{}",insertText:"/delete-node/ {/$1};",kind:It.CompletionItemKind.Keyword,insertTextFormat:It.InsertTextFormat.Snippet,sortText:"~",command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:[];let i=new Map;return n(t.runtime.rootNode).forEach(s=>i.set(s.label.value,s)),Array.from(i).map(([,s])=>({label:t.ast instanceof ie?`${s.label.value}`:`&${s.label.value}`,kind:It.CompletionItemKind.Variable,documentation:s.lastLinkedTo?.toMarkupContent(t.runtime.context.macros)}))}function nV(t,e){if(!t||!(t.item instanceof J)||t.item===null||t.beforeAst&&(!(t.beforeAst?.parentNode instanceof pr)||t.beforeAst?.parentNode instanceof dt))return[];let r=n=>[...n.nodes,...n.deletedNodes.filter(i=>!e(i.by)).map(i=>i.node)].flatMap(i=>({node:i,astNodes:i.implementations.filter(s=>s instanceof Ce)})).filter(i=>i.astNodes.some(e));return t.ast instanceof je||t.ast instanceof Qr||t.beforeAst?.parentNode instanceof Qr?r(t.item).map(n=>({label:`${n.astNodes.at(0)?.name?.toString()}`,kind:It.CompletionItemKind.Variable,documentation:n.node.toMarkupContent(t.runtime.context.macros)})):r(t.item).length?[{label:"/delete-node/",insertText:"/delete-node/ $1;",kind:It.CompletionItemKind.Keyword,insertTextFormat:It.InsertTextFormat.Snippet,sortText:"~",command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:[]}function iV(t,e){if(!t||!(t.item instanceof J)||t.beforeAst&&(!(t.beforeAst?.parentNode instanceof pr)||t.beforeAst?.parentNode instanceof Qr))return[];let r=n=>[...n.properties,...n.deletedProperties.filter(i=>!e(i.by)).map(i=>i.property)].flatMap(i=>[i,...i.allReplaced]).filter(i=>e(i.ast));if(t.ast instanceof Qe||t.ast instanceof dt||t.beforeAst?.parentNode instanceof dt){let n=new Map;return r(t.item).forEach(i=>n.set(i.name,i)),Array.from(n).map(([,i])=>({label:`${i.name}`,kind:It.CompletionItemKind.Variable,documentation:i.ast.toPrettyString(t.runtime.context.macros)}))}return r(t.item).length?[{label:"/delete-property/",insertText:"/delete-property/ $1;",kind:It.CompletionItemKind.Keyword,sortText:"~",insertTextFormat:It.InsertTextFormat.Snippet,command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:[]}function sV(t,e){let r=t?.ast instanceof ri?t.ast:t?.ast.parentNode;if(!t||!r||!(r instanceof ri))return[];let n=r.pathParts.slice(0,-1);if(n.some(o=>!o))return[];let i=n.map(o=>o.toString());return(()=>{let o=t.runtime.rootNode.getChildFromScope(["/",...i],e);return[...o?.nodes.filter(a=>!Zt(t.ast)||a.definitions.some(e))??[],...o?.deletedNodes.filter(a=>!e(a.by)).map(a=>a.node)??[]]})().map(o=>({label:`/${[...i,o.fullName].join("/")}`,kind:It.CompletionItemKind.Variable,documentation:o.toMarkupContent(t.runtime.context.macros)}))}function oV(t){return!t||!(t.item instanceof et&&t.item.ast.assignOperatorToken)||t.ast instanceof ne?[]:!mo(t?.ast)&&!(t.ast instanceof Ee&&t.item.ast.values===null)&&!mo(t.beforeAst)&&!mo(t.afterAst)?[]:t.item.parent.nodeType instanceof _t?Array.from([t.runtime.context.parser,...t.runtime.context.overlayParsers].at(-1)?.cPreprocessorParser.macros??[]).map(([,n])=>n.macro.identifier instanceof ii?{label:`${n.macro.identifier.toString()}`,insertText:`${n.macro.name}(${n.macro.identifier.params.map((i,s)=>i instanceof vt?`$${s+1}`:"").join(", ")})`,kind:It.CompletionItemKind.Function,sortText:`~${n.macro.name}`,insertTextFormat:It.InsertTextFormat.Snippet}:{label:n.macro.identifier.name,kind:It.CompletionItemKind.Variable,sortText:`~${n.macro.name}`}):[]}function aV(t,e){return!t?.item||!(t.ast instanceof Qe&&t.ast.parentNode instanceof Ee||t.ast instanceof nt)?[]:(t.item instanceof J?t.item:t.item.parent).nodes.filter(n=>{let i=n.definitions.at(-1);return i&&e(i)}).map(n=>n.name?.toString()).filter(n=>n).map(n=>({label:`${n}`,insertText:`${n} {
305
305
  $1
306
- };`,kind:It.CompletionItemKind.Class,sortText:`!${n}`,insertTextFormat:It.InsertTextFormat.Snippet}))}async function f0(t,e){return Et(t,e,(r,n)=>[...iV(r,n),...nV(r,n),...rV(r,n),...sV(r,n),...tV(r,n),...eV(r,n),...ZH(r),...oV(r),...aV(r,n)])}var th=q(U());var h0=require("child_process");var ov=t=>/[A-Za-z0-9_]/.test(t);function cV(t,e){let r=[];for(let n=0;n<e;n++){let i=t[n];i==="("?r.push(n):i===")"&&r.pop()}return r.length?r[r.length-1]:void 0}function p0(t,e){let r=1;for(let n=e+1;n<t.length;n++){let i=t[n];if(i==="(")r++;else if(i===")"&&(r--,r===0))return n}}function m0(t,e,r){let n=[],i=0,s=!1,o=!1,a=e;for(let f=e;f<r;f++){let p=t[f];if(p==="'"&&!o)s=!s;else if(p==='"'&&!s)o=!o;else if(!s&&!o){if(p==="(")i++;else if(p===")")i--;else if(p===","&&i===0){let m=a,h=f,y=m,S=h;for(;y<S&&/\s/.test(t[y]);)y++;for(;S>y&&/\s/.test(t[S-1]);)S--;n.push({start:m,end:h,text:t.slice(y,S)}),a=f+1}}}let c=a,l=r,u=c,d=l;for(;u<d&&/\s/.test(t[u]);)u++;for(;d>u&&/\s/.test(t[d-1]);)d--;return n.push({start:c,end:l,text:t.slice(u,d)}),n}function av(t){let e=t.trim(),r=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(e);if(!r)return{macro:e};let n=r[1],i=r[2],s=m0(i,0,i.length),o={macro:n,args:[]};return o.args=s.map(a=>{let c=av(a.text);return c.parent=o,c}),o}function Ji(t,e){let r=t.getText(),n=t.offsetAt(e),i=n,s=n;for(;i>0&&ov(r[i-1]);)i--;for(;s<r.length&&ov(r[s]);)s++;if(r[s]==="("){let y=p0(r,s);y!==void 0&&(s=y+1)}let o=r.slice(i,s),a=o.trim().length?av(o):void 0,c=cV(r,n);if(c===void 0)return a;let l=p0(r,c);if(l===void 0||!(c<n&&n<=l))return a;let u=c,d=u;for(;d>0&&ov(r[d-1]);)d--;let f=r.slice(d,u);if(!f)return a;let p=m0(r,c+1,l),m={macro:f,args:[]};m.args=p.map(y=>{let S=av(y.text);return S.parent=m,S});let h=-1;for(let y=0;y<p.length;y++){let S=p[y];if(n>=S.start&&n<=S.end){h=y;break}}if(h>=0){let y=m.args[h];return y.argIndexInParent=h,y}return m}function lV(t,e,r){let i=t.getText().split(/\r?\n/),s=new RegExp(`^\\s*#\\s*define\\s+(${e})\\b(\\s*\\([^)]*\\))?\\s*(.*)$`);for(let o=Math.min(r.line,i.length-1);o>=0;o--){let a=i[o],c=s.exec(a);if(c){let l=a.indexOf(c[0]),u=a.indexOf(c[3],l);return ht.create(o,u>=0?u:a.length)}}}async function ks(t,e,r,n){let i=g0(t,e,r);if(i)return i;let s=await dV(e,n,Ne(t.uri));if(s)return[s,r]}function g0(t,e,r){if(e.startsWith("DT_"))return;let n=lV(t,e,r);if(!n)return;let i=Ji(t,n);if(i)return[i,n]}var uV=(t,e)=>new Promise(r=>{let n=(0,h0.spawn)(t,e,{stdio:["ignore","pipe","pipe"]}),i="";n.stdout.on("data",s=>{i+=s.toString()}),n.on("close",s=>{r(s?"":i)})});async function dV(t,e,r){let n=e.getCompileCommands()?.find(s=>fe(s.file,r));if(!n)return;let i=`${n.command.replace(/-(o|c)\s+\S+/g,"")} -E -dM ${n.file}`;try{let[s,...o]=i.split(" "),a=await uV(s,o.filter(u=>!!u)),c=Lt.create(`macros://${n.file}`,"devicetree",0,a),l=g0(c,t,c.positionAt(a.length-1));if(l)return l[0]}catch(s){console.error(s)}}function Z(t){return t.toLowerCase().replace(/[@,-\.]/g,"_")}var fl=q(U());async function y0({macro:t,context:e}){if(t.macro&&"DT_ALIAS".startsWith(t.macro))return[{label:"DT_ALIAS(...)",insertText:"DT_ALIAS($1)",kind:fl.CompletionItemKind.Function,insertTextFormat:fl.InsertTextFormat.Snippet}];if(t.parent?.macro!=="DT_ALIAS"||t.argIndexInParent!==0)return[];let r=await e.getRuntime();return r.rootNode.getNode("aliases")?.properties.map(n=>{let i=n.ast.getFlatAstValues()?.at(0),s;return i instanceof ie?s=i.linksTo:i instanceof ri&&(s=i.pathParts.at(-1)?.linksTo),{label:Z(n.name),kind:fl.CompletionItemKind.Property,documentation:s?.toMarkupContent(r.context.macros)}})??[]}var pl=q(U());async function wr(t,e,r){if(!t)return;let i=t?.properties.find(s=>Z(s.name)===e)?.ast.getFlatAstValues();return i?.length===0?!0:i?.map(s=>{if(s instanceof it)return s.path?.pathParts.at(-1)?.linksTo;if(s instanceof ie)return s.linksTo;if(s instanceof ne)return s.value;if(s instanceof ge){let o=s.evaluate(r.macros);return typeof o=="number"?o:s.toString()}})}async function _p({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PROP"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?wr(o,s[1].macro,r):void 0}async function T0(t,e){let r=await _p(t,e);if(typeof r=="boolean")return;let n=r?.at(0);if(r?.length===1&&n instanceof J)return n}async function v0(t,e,r,n){if(r=typeof r=="number"?r:Le(r),typeof r!="number")return;let i=await wr(t,e,n);if(i===!0)return!0;if(!i)return;let s=i.at(r);if(s)return i.length===1&&i[0]instanceof J?i[0]:s}async function Pp({document:t,macro:e,context:r,position:n},i){if(!(e.macro!=="DT_PROP_BY_IDX"||e.args?.length!==3))return v0(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro,r)}async function b0(t,e){let r=await Pp(t,e);if(typeof r!="boolean"&&r instanceof J)return r}async function nn(t,{document:e,context:r,macro:n,position:i},s){return t||(await s({document:e,macro:n,context:r,position:i})??n.macro)}async function kp(t,e,r,n){return nn(await wr(t,e,r.context),r,n)}async function Ca({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_OR"||e.args?.length!==3)return;let[s,o,a]=e.args,c=await i({document:t,macro:s,context:r,position:n});return await kp(c,o.macro,{macro:a,document:t,context:r,position:n},i)}async function S0(t,e){let r=await Ca(t,e);if(r instanceof J)return r;if(typeof r=="boolean")return;let n=r?.at(0);if(r?.length===1&&n instanceof J)return n}async function _0(t){let e=t?.nodeType?.onBus,r=t?.parent?.nodeType?.bus;return t&&r?.length&&r?.some(n=>n===e)?t.parent??void 0:void 0}async function Np(t,e){let r=t.macro.args;if(t.macro.macro!=="DT_BUS"||r?.length!==1)return;let n=await e({...t,macro:r[0]});return await _0(n)}async function Rp(t,e){let r=(await t.getRuntime()).rootNode.getChild(["/","chosen"]);if(!r)return;let s=r?.properties.find(o=>Z(o.name)===e)?.ast.getFlatAstValues()?.at(0);if(s instanceof ie)return s.linksTo;if(s instanceof it)return s.path?.pathParts.at(-1)?.linksTo}async function Ep(t){let e=t.macro.args;if(!(t.macro.macro!=="DT_CHOSEN"||e?.length!==1))return await Rp(t.context,e[0].macro)}async function wp(t,e){let r=await e?.getRuntime();if(r){let n=Ei.getNodeFromPath(["aliases"],r.rootNode,!0),i=n?.properties.find(o=>Z(o.name)===t);if(!i)return;let s=i.ast.getFlatAstValues();return s?.[0]instanceof ne?n=r.rootNode.getChild(s[0].value.split("/")):s?.[0]instanceof ie?n=s[0].linksTo:s?.[0]instanceof it&&(n=s[0].path?.pathParts.at(-1)?.linksTo),n}}async function Dp({macro:t,context:e}){if(!(t.macro!=="DT_ALIAS"||t.args?.length!==1))return wp(t.args[0].macro,e)}async function P0(t,e){return t?.nodes.find(r=>Z(r.name)===e)}async function Cp({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_CHILD"||e.args?.length!==2)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return P0(s,e.args[1].macro)}var cv=(t,e)=>t.nodes.filter(r=>!r.disabled&&r.nodeType).flatMap(r=>[r.nodeType.compatible,...Array.from(r.nodeType.extends)].filter(n=>!!n).map(n=>Z(n)).includes(e)?[r,...cv(r,e)]:cv(r,e));async function k0(t,e){let r=await e?.getRuntime();if(r)return cv(r.rootNode,t)}async function lv({macro:t,context:e}){if(!(t.macro!=="DT_COMPAT_GET_ANY_STATUS_OKAY"||t.args?.length!==1))return k0(t.args[0].macro,e)}async function N0(t){return(await lv(t))?.at(0)}async function R0(t){return t?.parent?.parent??void 0}async function Ap({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_GPARENT"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return R0(s)}var uv=(t,e)=>t.nodes.filter(r=>r.nodeType).sort((r,n)=>r.disabled===n.disabled?0:r.disabled?1:-1).flatMap(r=>[r.nodeType.compatible,...Array.from(r.nodeType.extends)].filter(n=>!!n).map(n=>Z(n)).includes(e)?[r,...uv(r,e)]:uv(r,e));async function E0(t,e,r){let n=await r?.getRuntime();if(n)return uv(n.rootNode,e).at(t)}async function Ip({macro:t,context:e}){if(t.macro!=="DT_INST"||t.args?.length!==2)return;let r=Le(t.args[0].macro);if(typeof r=="number")return E0(r,t.args[1].macro,e)}async function w0(t,e){let r=await e?.getRuntime(),n=r?.resolvePath([`&${t.trim()}`]);if(r&&n)return Ei.getNodeFromPath(n.slice(1),r.rootNode,!0)}async function Op({macro:t,context:e}){if(!(t.macro!=="DT_NODELABEL"||t.args?.length!==1))return w0(t.args[0].macro,e)}async function D0(t){return t?.parent??void 0}async function xp({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PARENT"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return D0(s)}var C0=(t,e)=>{if(!e.length)return t;let r=e.splice(0,1)[0],n=t.nodes.find(i=>Z(i.fullName)===r);return n?C0(n,e):void 0};async function Mp(t,e){let r=await e?.getRuntime();if(r)return C0(r.rootNode,t)}async function Lp({macro:t,context:e}){let r=t.args;if(!(t.macro!=="DT_PATH"||!r?.length))return Mp(r.map(n=>n.macro),e)}async function qp({macro:t,context:e}){let r=t.args;if(!(t.macro!=="DT_ROOT"||r?.length))return(await e.getRuntime()).rootNode}async function Aa(t,e,r){let n=t?.properties.find(c=>Z(c.name)===e);if(!n)return;let i=n?.ast.quickValues?.at(r),s=n.parent.nodeType;if(Array.isArray(i)||!s||!(s instanceof _t))return;let a=s.properties.find(c=>c.getNameMatch(n.name))?.values(n).findIndex(c=>c===i)??-1;return a===-1?void 0:a}async function $p(t,e,r,n,i){return nn(await Aa(t,e,r),n,i)}async function Fp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_IDX_BY_IDX_OR"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Le(s[2].macro);if(typeof a=="number")return await $p(o,s[1].macro,a,{macro:s[3],document:t,context:r,position:n},i)}async function Bp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_IDX_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return await $p(o,s[1].macro,0,{macro:s[2],document:t,context:r,position:n},i)}async function Ns(t,e,r,n,i){let s=t?.properties.find(d=>Z(d.name)===e),o=s?.parent.nodeType;if(!o||!(o instanceof _t))return;if(typeof r=="string"){let d=s.nexusMapsTo.at(0)?.specifierSpace;if(r=(d?s.parent.getProperty(`${d}-names`)?.ast.quickValues:void 0)?.findIndex(p=>typeof p=="string"&&p.toLowerCase()===r)??-1,r===-1)return}let a=s.nexusMapsTo.at(r),l=a?.target.nodeType?.cellsValues?.find(d=>a.specifierSpace&&d.specifier===a.specifierSpace)?.values?.indexOf(n);if(l===void 0||l===-1)return;let u=a?.mappingValuesAst.at(l);if(u instanceof ge){let d=u.evaluate(i.macros);return typeof d!="number"?u.toString():d}}async function Ia(t,e,r,n,i,s){return nn(await Ns(t,e,r,n,i.context),i,s)}async function jp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_BY_IDX_OR"||s?.length!==5)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Le(s[2].macro);if(typeof a=="number")return Ia(o,s[1].macro,a,s[3].macro,{macro:s[4],document:t,context:r,position:n},i)}async function Up({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_BY_NAME_OR"||s?.length!==5)return;let o=await i({document:t,macro:s[0],context:r,position:n});return Ia(o,s[1].macro,s[2].macro,s[3].macro,{macro:s[4],document:t,context:r,position:n},i)}async function Di(t,e,r=0){let n=t?.properties.find(s=>Z(s.name)===e);if(r=typeof r=="number"?r:Le(r??"0"),typeof r!="number")return;let i=n?.ast.getFlatAstValues()?.at(r);if(i instanceof ie)return i.linksTo;if(i instanceof it)return i.path?.pathParts.at(-1)?.linksTo}async function Rs({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHANDLE"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return Di(o,s[1].macro,0)}async function Ci({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHANDLE_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return Di(o,s[1].macro,s.at(2)?.macro)}async function A0(t,e,r){let n=t?.properties.find(l=>Z(l.name)===e);if(!n)return;let i=n.parent.nodeType;if(!i||!(i instanceof _t))return;let s=n.nexusMapsTo.at(0)?.specifierSpace,a=(s?n.parent.getProperty(`${s}-names`)?.ast.quickValues:void 0)?.findIndex(l=>typeof l=="string"&&l.toLowerCase()===r)??-1;return a===-1?void 0:n.nexusMapsTo.at(a)?.target}async function Hp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHANDLE_BY_NAME"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return await A0(o,s[1].macro,s[2].macro)}async function Vp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_OR"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n});return Ia(o,s[1].macro,0,s[2].macro,{macro:s[3],document:t,context:r,position:n},i)}async function Wp({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_BY_PHANDLE_IDX_OR"||e.args?.length!==5)return;let s=await Di(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro);return kp(s,e.args[3].macro,{macro:e.args[4],document:t,context:r,position:n},i)}async function zp(t,e){if(!t)return;let r=t?.properties.find(n=>Z(n.name)===e);return r?.nexusMapsTo.length?r.nexusMapsTo.length:r?.ast.getFlatAstValues()?.length}async function I0(t,e,r,n){if(t)return nn(await zp(t,e),r,n)}async function Gp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PROP_LEN_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?I0(o,s[1].macro,{macro:s[2],document:t,context:r,position:n},i):void 0}async function Oa(t,e){if(!t)return;let n=t?.properties.find(i=>Z(i.name)===e)?.ast.getFlatAstValues();if(n?.length===1&&n[0]instanceof ne)return Z(n[0].value)}async function O0(t,e,r,n){if(t)return nn(await Oa(t,e),r,n)}async function Yp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_TOKEN_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return O0(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}async function Kp(t,e){if(!t)return;let n=t?.properties.find(i=>Z(i.name)===e)?.ast.getFlatAstValues();if(n?.length===1&&n[0]instanceof ne)return n[0].value}async function x0(t,e,r,n){if(t)return nn(await Kp(t,e),r,n)}async function Xp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UNQUOTED_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return x0(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}async function Jp(t,e){return(await Oa(t,e))?.toUpperCase()}async function M0(t,e,r,n){if(t)return nn(await Jp(t,e),r,n)}async function Qp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UPPER_TOKEN_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return M0(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}function si(t){return async(e,r)=>{let n=await t(e,r);if(n instanceof J)return n}}async function M({macro:t,document:e,context:r,position:n}){["DT_ALIAS","DT_NODELABEL"].some(a=>a===t.parent?.macro)||t.parent?.macro==="DT_CHILD"&&t.argIndexInParent===1?t=t.parent:t.parent?.macro==="DT_HAS_ALIAS"?(t=t.parent,t.macro="DT_ALIAS"):t.parent?.macro==="DT_PATH"&&(t.parent.args=t.parent.args?.slice(0,(t.argIndexInParent??0)+1)??[],t=t.parent);let s=await[Np,Ep,Dp,Cp,N0,Ap,Ip,Op,xp,Lp,Rs,Ci,Hp,b0,T0,S0,qp,si(Fp),si(Bp),si(jp),si(Up),si(Vp),si(Wp),si(Gp),si(Ca),si(Yp),si(Xp),si(Qp)].reduce((a,c)=>a.then(l=>l||c({macro:t,document:e,context:r,position:n},M)),Promise.resolve(void 0));if(s)return Array.isArray(s)?s.at(0):s;let o=await ks(e,t.macro,n,r);if(o)return M({document:e,macro:o[0],context:r,position:n})}async function L0({macro:t,document:e,context:r,position:n}){return t.macro&&t.macro&&"DT_CHILD".startsWith(t.macro)?[{label:"DT_CHILD(...)",insertText:"DT_CHILD($1, $2)",kind:pl.CompletionItemKind.Function,insertTextFormat:pl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_CHILD"||t.argIndexInParent!==1||!t.parent.args?.length?[]:(await M({document:e,macro:t.parent.args[0],context:r,position:n}))?.nodes.map(s=>({label:Z(s.fullName),kind:pl.CompletionItemKind.Class,documentation:s.toMarkupContent(r.macros)}))??[]}var hl=q(U());function q0({macro:t,context:e}){return t.macro&&"DT_COMPAT_GET_ANY_STATUS_OKAY".startsWith(t.macro)?[{label:"DT_COMPAT_GET_ANY_STATUS_OKAY(...)",insertText:"DT_COMPAT_GET_ANY_STATUS_OKAY($1)",kind:hl.CompletionItemKind.Function,insertTextFormat:hl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_COMPAT_GET_ANY_STATUS_OKAY"||t.argIndexInParent!==0?[]:e.bindingLoader?.getBindings().map(r=>({label:Z(r),kind:hl.CompletionItemKind.Property}))??[]}var ml=q(U());function $0({macro:t,context:e}){return t.macro&&"DT_INST".startsWith(t.macro)?[{label:"DT_INST(...)",insertText:"DT_INST($1, $2)",kind:ml.CompletionItemKind.Function,insertTextFormat:ml.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_INST"||t.argIndexInParent!==1?[]:e.bindingLoader?.getBindings().map(r=>({label:Z(r),kind:ml.CompletionItemKind.Property}))??[]}var gl=q(U());async function F0({macro:t,context:e}){if(t.macro&&"DT_NODELABEL".startsWith(t.macro))return[{label:"DT_NODELABEL(...)",insertText:"DT_NODELABEL($1)",kind:gl.CompletionItemKind.Function,insertTextFormat:gl.InsertTextFormat.Snippet}];let r=await e.getRuntime();return t.parent?.macro!=="DT_NODELABEL"||t.argIndexInParent!==0?[]:await Promise.all(r.rootNode.allDescendantsLabels.map(async n=>({label:n.label.value,kind:gl.CompletionItemKind.Property,documentation:n.lastLinkedTo?.toMarkupContent(r.context.macros)}))??[])}var yl=q(U());async function B0({macro:t,context:e}){return t.macro&&t.macro&&"DT_PATH".startsWith(t.macro)?[{label:"DT_PATH(...)",insertText:"DT_PATH($1)",kind:yl.CompletionItemKind.Function,insertTextFormat:yl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_PATH"||!t.parent.args?.length?[]:(await Mp(t.parent.args.slice(0,-1).map(n=>n.macro),e))?.nodes.map(n=>({label:Z(n.fullName),kind:yl.CompletionItemKind.Class,documentation:n.toMarkupContent(e.macros)}))??[]}var j0=q(U());async function U0({macro:t,context:e}){if(t.macro&&t.macro&&"DT_ROOT".startsWith(t.macro)){let r=await e.getRuntime();return[{label:"DT_ROOT",kind:j0.CompletionItemKind.Class,documentation:r.rootNode.toMarkupContent(r.context.macros)}]}return[]}var Zp=q(U());function H0({macro:t}){return t.macro&&t.macro&&"DT_SAME_NODE".startsWith(t.macro)?[{label:"DT_SAME_NODE(...)",insertText:"DT_SAME_NODE($1, $2)",kind:Zp.CompletionItemKind.Snippet,insertTextFormat:Zp.InsertTextFormat.Snippet}]:[]}var Tl=q(U());async function Q({macro:t,document:e,position:r,context:n},i,s,o,a,c=l=>M({document:e,macro:l,context:n,position:r})){if(t.macro&&t.macro&&i.startsWith(t.macro))return[{label:`${i}(...)`,insertText:`${i}(${Array(o).map((d,f)=>`${f+1}`).join(", ")})`,kind:Tl.CompletionItemKind.Function,insertTextFormat:Tl.InsertTextFormat.Snippet}];if(t.parent?.macro!==i||t.argIndexInParent!==s||!t.parent.args?.length)return[];let l=await c(t.parent.args[0]);return(a?l?.properties.filter(a):l?.properties)?.map(d=>({label:Z(d.name),kind:Tl.CompletionItemKind.Property,documentation:d.toPrettyString(n.macros)}))??[]}async function V0(t){return Q(t,"DT_ENUM_HAS_VALUE",1,3)}async function W0(t){return Q(t,"DT_ENUM_HAS_VALUE_BY_IDX",1,4)}async function z0(t){return Q(t,"DT_ENUM_IDX",1,2)}async function G0(t){return Q(t,"DT_ENUM_IDX_BY_IDX",1,3)}async function Y0(t){return Q(t,"DT_ENUM_IDX_BY_IDX_OR",1,4)}async function K0(t){return Q(t,"DT_ENUM_IDX_OR",1,3)}var X0=q(U());async function Qi({macro:t,document:e,context:r,position:n},i,s,o){if(t.parent?.macro!==i||t.argIndexInParent!==s||!t.parent.args?.length)return[];let c=(await M({document:e,macro:t.parent.args[0],context:r,position:n}))?.properties.find(f=>Z(f.name)===t.parent?.args?.at(1)?.macro),l=0;if(typeof o=="string"){let f=c?.nexusMapsTo.at(0)?.specifierSpace;if(l=(f?c.parent.getProperty(`${f}-names`)?.ast.quickValues:void 0)?.findIndex(m=>typeof m=="string"&&m.toLowerCase()===o)??-1,l===-1)return[]}let u=c?.nexusMapsTo.at(l);return u?.target.nodeType?.cellsValues?.find(f=>u.specifierSpace&&f.specifier===u.specifierSpace)?.values.map(f=>({label:Z(f),kind:X0.CompletionItemKind.Property}))??[]}async function J0(t){return t.macro.argIndexInParent===2?Qi(t,"DT_PHA",2,0):Q(t,"DT_PHA",1,3,e=>!!e.nexusMapsTo.length)}var Q0=q(U());async function fV({document:t,macro:e,position:r,context:n},i){if(e.parent?.macro!==i||!e.parent.args?.length)return[];let o=(await M({document:t,macro:e.parent.args[0],context:n,position:r}))?.properties.find(a=>Z(a.name)===e.parent?.args?.at(1)?.macro);return Array(o?.nexusMapsTo.length??0)?.map((a,c)=>({label:c.toString(),kind:Q0.CompletionItemKind.Property}))??[]}async function Z0(t){if(t.macro.argIndexInParent===2)return fV(t,"DT_PHA_BY_IDX");if(t.macro.argIndexInParent===3){let e=t.macro.parent?.args?Le(t.macro.parent.args[2].macro):void 0;return typeof e!="number"?[]:Qi(t,"DT_PHA_BY_IDX",3,e)}return Q(t,"DT_PHA_BY_IDX",1,3,e=>!!e.nexusMapsTo.length)}var eA=q(U());async function vl({document:t,macro:e,context:r,position:n},i){if(e.parent?.macro!==i||!e.parent.args?.length)return[];let o=(await M({document:t,macro:e.parent.args[0],context:r,position:n}))?.properties.find(l=>Z(l.name)===e.parent?.args?.at(1)?.macro),a=o?.nexusMapsTo.at(0)?.specifierSpace;return(a?o.parent.getProperty(`${a}-names`)?.ast.quickValues:void 0)?.filter(l=>typeof l=="string")?.map(l=>({label:l,kind:eA.CompletionItemKind.Property}))??[]}async function tA(t){let{macro:e}=t;return e.argIndexInParent===2?vl(t,"DT_PHA_BY_NAME"):e.argIndexInParent===3?e.parent?.args?.[2]?.macro?Qi(t,"DT_PHA_BY_NAME",3,e.parent.args[2].macro):[]:Q(t,"DT_PHA_BY_NAME",1,3,r=>!!r.nexusMapsTo.length)}async function rA(t){let{macro:e}=t;return e.argIndexInParent===2?vl(t,"DT_PHA_BY_NAME_OR"):e.argIndexInParent===3?e.parent?.args?.[2]?.macro?Qi(t,"DT_PHA_BY_NAME_OR",3,e.parent.args[2].macro):[]:Q(t,"DT_PHA_BY_NAME_OR",1,3,r=>!!r.nexusMapsTo.length)}async function nA(t){let{macro:e}=t;return e.argIndexInParent===2?Qi(t,"DT_PHA_OR",2,0):Q(t,"DT_PHA_OR",1,3,r=>!!r.nexusMapsTo.length)}async function eh(t){return Q(t,"DT_PHANDLE",1,2,e=>!!e.ast.getFlatAstValues()?.some(r=>r instanceof ie||r instanceof it))}async function xa(t){return Q(t,"DT_PHANDLE_BY_IDX",1,3,e=>!!e.ast.getFlatAstValues()?.some(r=>r instanceof ie||r instanceof it))}async function iA(t){let{macro:e}=t;return e.argIndexInParent===2?vl(t,"DT_PHANDLE_BY_NAME"):Q(t,"DT_PHANDLE_BY_NAME",1,3,r=>!!r.ast.getFlatAstValues()?.some(n=>n instanceof ie||n instanceof it))}async function sA(t){return Q(t,"DT_PROP",1,2,e=>!e.nexusMapsTo.length)}async function oA(t){return Q(t,"DT_PROP_BY_IDX",1,3,e=>!e.nexusMapsTo.length)}async function aA(t){let{macro:e}=t;return(e.argIndexInParent===1||e.argIndexInParent===2)&&e.parent?.macro==="DT_PROP_BY_PHANDLE_IDX"?xa({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE_BY_IDX"}:void 0}}):Q(t,"DT_PROP_BY_PHANDLE_IDX",3,4,r=>!r.nexusMapsTo.length,()=>Ci({...t,macro:{macro:"DT_PHANDLE_BY_IDX",args:e.parent?.args?.slice(0,3)}},M))}async function cA(t){let{macro:e}=t;return e.argIndexInParent===1&&e.parent?.macro==="DT_PROP_BY_PHANDLE"?eh({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE"}:void 0}}):Q(t,"DT_PROP_BY_PHANDLE",2,3,r=>!r.nexusMapsTo.length,()=>Rs({...t,macro:{macro:"DT_PHANDLE",args:e.parent?.args?.slice(0,2)}},M))}async function lA(t){let{macro:e}=t;return(e.argIndexInParent===1||e.argIndexInParent===2)&&e.parent?.macro==="DT_PROP_BY_PHANDLE_IDX_OR"?xa({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE_BY_IDX"}:void 0}}):Q(t,"DT_PROP_BY_PHANDLE_IDX_OR",3,5,r=>!r.nexusMapsTo.length,()=>Ci({...t,macro:{macro:"DT_PHANDLE_BY_IDX",args:e.parent?.args?.slice(0,3)}},M))}async function uA(t){return Q(t,"DT_PROP_HAS_IDX",1,3,e=>!e.nexusMapsTo.length)}async function dA(t){return Q(t,"DT_PROP_HAS_NAME",1,3,e=>!e.nexusMapsTo.length)}async function fA(t){return Q(t,"DT_PROP_LAST",1,2,e=>!e.nexusMapsTo.length)}async function pA(t){return Q(t,"DT_PROP_LEN",1,2,e=>!e.nexusMapsTo.length)}async function hA(t){return Q(t,"DT_PROP_LEN_OR",1,2,e=>!e.nexusMapsTo.length)}async function mA(t){return Q(t,"DT_PROP_OR",1,2,e=>!e.nexusMapsTo.length)}async function gA(t){return Q(t,"DT_STRING_TOKEN",1,2,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function yA(t){return Q(t,"DT_STRING_TOKEN_BY_IDX",1,3,e=>{let r=e.ast.getFlatAstValues();return!!r?.length&&r.every(n=>n instanceof ne)})}async function TA(t){return Q(t,"DT_STRING_TOKEN_OR",1,3,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function vA(t){return Q(t,"DT_STRING_UNQUOTED",1,2,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function bA(t){return Q(t,"DT_STRING_UNQUOTED_BY_IDX",1,3,e=>{let r=e.ast.getFlatAstValues();return!!r?.length&&r.every(n=>n instanceof ne)})}async function SA(t){return Q(t,"DT_STRING_UNQUOTED_OR",1,3,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function _A(t){return Q(t,"DT_STRING_UPPER_TOKEN",1,2,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function PA(t){return Q(t,"DT_STRING_UPPER_TOKEN_BY_IDX",1,3,e=>{let r=e.ast.getFlatAstValues();return!!r?.length&&r.every(n=>n instanceof ne)})}async function kA(t){return Q(t,"DT_STRING_UPPER_TOKEN_OR",1,3,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}var bl=q(U());async function NA({macro:t,context:e}){return t.parent?.macro==="DT_ON_BUS"&&t.argIndexInParent===1?e.bindingLoader?.getBusTypes().map(r=>({label:Z(r),kind:bl.CompletionItemKind.Enum}))??[]:t.macro&&"DT_ON_BUS".startsWith(t.macro)?[{label:"DT_ON_BUS(...)",insertText:"DT_ON_BUS($1, $2)",kind:bl.CompletionItemKind.Function,insertTextFormat:bl.InsertTextFormat.Snippet}]:[]}async function RA(t){return Q(t,"DT_CHOSEN",0,1,void 0,async()=>(await t.context.getRuntime()).rootNode.getChild(["/","chosen"]))}async function EA(t){return Q(t,"DT_HAS_CHOSEN",0,1,void 0,async()=>(await t.context.getRuntime()).rootNode.getChild(["/","chosen"]))}var pV=["DT_BUS","DT_CHILD_NUM","DT_CHILD_NUM_STATUS_OKAY","DT_GPARENT","DT_HAS_ALIAS","DT_NODE_CHILD_IDX","DT_NODE_FULL_NAME","DT_NODE_FULL_NAME_TOKEN","DT_NODE_FULL_NAME_UNQUOTED","DT_NODE_FULL_NAME_UPPER_TOKEN","DT_NODE_HASH","DT_NODE_PATH","DT_NODELABEL_STRING_ARRAY","DT_PARENT"];async function wA(t,e,r){if(!r)return[];let n=Ji(r,t.position);return n?(await Promise.all([NA,RA,EA,y0,L0,q0,$0,hV,F0,B0,U0,H0,W0,V0,G0,Y0,z0,K0,Z0,tA,rA,J0,xa,iA,eh,nA,oA,cA,aA,lA,sA,uA,dA,fA,pA,hA,mA,gA,yA,TA,vA,bA,SA,_A,PA,kA].flatMap(async i=>await i({document:r,context:e,macro:n,position:t.position})))).flat():[]}function hV({macro:t}){return t.macro?pV.filter(e=>e.startsWith(t.macro)).map(e=>({label:`${e}(...)`,insertText:`${e}($1)`,kind:th.CompletionItemKind.Function,insertTextFormat:th.InsertTextFormat.Snippet})):[]}var Mn=q(U());function mV(t){if(!t||t.item===null||!(t.ast instanceof Qe))return[];let e=n=>n.replacedBy?e(n.replacedBy):n,r=n=>{let i=n.parent.deletedProperties.find(s=>s.property===n)?.by;return[n.ast,...n.allReplaced.map(s=>s.ast),...i?[i]:[]].map(s=>{let o=fr(s.fsPath);if(o)return Mn.Location.create(ue(o.fsPath),o.range);if(s instanceof Ee)return Mn.Location.create(ue(s.fsPath),ce(s.propertyName??s));if(s instanceof dt)return Mn.Location.create(ue(s.fsPath),ce(s.propertyName??s))}).filter(s=>s)};if(t.item instanceof et&&t.ast instanceof Qe)return r(e(t.item));if(t.item instanceof J&&t.ast instanceof Qe&&t.ast.parentNode instanceof dt){let n=t.item.deletedProperties.find(i=>i.by===t.ast.parentNode)?.property;if(n)return r(n)}return[]}function gV(t){if(!t)return[];let e=r=>{let i=t.runtime.rootNode.getNode("aliases")?.properties.filter(o=>{let a=o.ast.quickValues;if(a?.length===1&&typeof a[0]=="string"&&t.runtime.rootNode.getChild(a[0].split("/"))===r)return!0}).map(o=>o.ast)??[],s=r.parent?.deletedNodes.filter(o=>o.node===r&&(o.by.nodeNameOrRef instanceof je?o.by.nodeNameOrRef!==t.ast:!r.linkedRefLabels.some(a=>a!==t.ast))).map(o=>o.by.nodeNameOrRef)??[];return[...i,...r.linkedRefLabels,...r.linkedNodeNamePaths,...r.definitions,...s].map(o=>{let a=o&&fr(o?.fsPath);if(a)return Mn.Location.create(ue(a.fsPath),a.range);if(o instanceof nt)return Mn.Location.create(ue(o.fsPath),ce(o.name??o));if(o instanceof Ce)return Mn.Location.create(ue(o.fsPath),ce(o.name??o));if(o instanceof je)return Mn.Location.create(ue(o.fsPath),ce(o));if(o instanceof je)return Mn.Location.create(ue(o.fsPath),ce(o));if(o instanceof ie)return Mn.Location.create(ue(o.fsPath),ce(o.label??o));if(o instanceof Ee)return Mn.Location.create(ue((o.values??o)?.fsPath),ce(o.values??o))}).filter(o=>o)};if(t.item instanceof J&&!Zt(t.ast))return e(t.item);if(t.ast instanceof mr&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return e(t.ast.parentNode.linksTo);if(t.ast instanceof je&&t.ast.linksTo)return Zt(t.ast)?[...e(t.ast.linksTo),Mn.Location.create(ue(t.ast.fsPath),ce(t.ast))]:e(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof et&&t.item.parent.name==="aliases"){let r=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(r)return e(r)}return[]}async function DA(t,e){return Et(t,e,r=>[...gV(r),...mV(r)])}var Zi=q(U());function CA(t){if(!t||t.item===null||!(t.ast instanceof Qe))return[];let e=n=>n.replacedBy?e(n.replacedBy):n,r=n=>[n.ast,...n.allReplaced.map(i=>i.ast),n.parent.deletedProperties.find(i=>i.property===n)?.by??[]].map(i=>{if((i instanceof Ee||i instanceof dt)&&i.propertyName)return Zi.Location.create(ue(i.fsPath),ce(i.propertyName))}).filter(i=>i);if(t.item instanceof et&&t.ast instanceof Qe)return r(e(t.item));if(t.item instanceof J&&t.ast instanceof Qe&&t.ast.parentNode instanceof dt){let n=t.item.deletedProperties.find(i=>i.by===t.ast.parentNode)?.property;if(n)return r(n)}return[]}function AA(t,e){if(!e||!(e.ast instanceof mr))return[];"newName"in t&&(e.ast.parentNode instanceof ie&&t.newName.startsWith("&")?t.newName=t.newName.slice(1):e.ast.parentNode instanceof Ps&&t.newName.endsWith(":")&&(t.newName=t.newName.slice(0,-1)));let r=e.ast.value,n=i=>[...i.implementations.filter(s=>s instanceof Ce||s instanceof ot).flatMap(s=>s.labels.map(o=>o.label)),...i.linkedRefLabels.map(s=>s.label)].filter(s=>s?.value===r).map(s=>{if(s)return Zi.Location.create(ue(s.fsPath),ce(s))}).filter(s=>s);return e.item instanceof J&&!Zt(e.ast)?n(e.item):e.ast instanceof mr&&e.ast.parentNode instanceof ie&&e.ast.parentNode.linksTo?n(e.ast.parentNode.linksTo):[]}function IA(t){if(!t||!(t.ast instanceof je)||t.ast instanceof je&&t.ast.linksTo===t.runtime.rootNode)return[];let e=r=>{let i=t.runtime.rootNode.getNode("aliases")?.properties.filter(o=>{let a=o.ast.quickValues;if(a?.length===1&&typeof a[0]=="string"){let c=t.runtime.rootNode.getChild(a[0].split("/"));if(c?.isChildOf(r)||c===r)return!0}}).map(o=>o.ast)??[],s=r.parent?.deletedNodes.filter(o=>o.node===r&&o.by.nodeNameOrRef!==t.ast).map(o=>o.by.nodeNameOrRef)??[];return[...i,...r.linkedNodeNamePaths,...r.definitions,...s].map(o=>{if(o instanceof Ce&&o.name)return Zi.Location.create(ue(o.fsPath),ce(o.name));if(o instanceof je)return Zi.Location.create(ue(o.fsPath),ce(o));if(o instanceof Ee&&o.values?.values[0]?.value&&o.values?.values[0]?.value instanceof ne){let a=o.values.values[0].value,c=ce(a),l=a.value.split("/"),u=r.path,d=l.slice(0,u.length-1).join("/").length+1,f=a.value.length-l.slice(0,u.length).join("/").length;return c.start.character+=1+d,c.end.character-=1+f,Zi.Location.create(ue(o.values.values[0].fsPath),c)}}).filter(o=>o)};return t.item instanceof J&&!Zt(t.ast)?e(t.item):t.ast instanceof je&&t.ast.linksTo?Zt(t.ast)?[...e(t.ast.linksTo),Zi.Location.create(ue(t.ast.fsPath),ce(t.ast))]:e(t.ast.linksTo):[]}async function OA(t,e){let r={};return(await Et(t,e,i=>[...IA(i),...AA(t,i),...CA(i)])).forEach(i=>{r[i.uri]??=[],r[i.uri].push(Zi.TextEdit.replace(i.range,t.newName))}),{changes:r}}async function xA(t,e){let r=await Et(t,e,n=>[...IA(n),...AA(t,n),...CA(n)]);if(r.some(n=>e?.settings.lockRenameEdits?.some(i=>Ne(n.uri).startsWith(i))))throw new Error('Path is locked by user setting "lockRenameEdits"');if(r.some(n=>ki(n.uri)))throw new Error("Item was generated using a MACRO.");return{defaultBehavior:!!r.length}}var La=q(U());var Ma=t=>t.implementations.map(e=>{let r=fr(e.fsPath);return r?La.Location.create(ue(r.fsPath),r.range):La.Location.create(ue(e.fsPath),ce(e))}).filter(e=>e),MA=t=>t.replacedBy?MA(t.replacedBy):t,rh=t=>[t.ast,...t.allReplaced.map(e=>e.ast)].map(e=>{let r=fr(e.fsPath);return r?La.Location.create(ue(r.fsPath),r.range):La.Location.create(ue(e.fsPath),ce(e.propertyName??e))}).filter(e=>e);function yV(t){if(!t||t.item===null||!(t.ast instanceof Qe))return[];if(t.item instanceof et&&t.ast instanceof Qe)return rh(MA(t.item));if(t.item instanceof J&&t.ast instanceof Qe&&t.ast.parentNode instanceof dt){let e=t.item.deletedProperties.find(r=>r.by===t.ast.parentNode)?.property;if(e)return rh(e)}return[]}function TV(t){if(!t)return[];if(t.item instanceof J&&!Zt(t.ast))return Ma(t.item);if(t.ast instanceof mr&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return Ma(t.ast.parentNode.linksTo);if(t.ast instanceof je&&t.ast.linksTo)return Ma(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof et&&t.item.parent.name==="aliases"){let e=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(e)return Ma(e)}return[]}function vV(t){if(t?.ast instanceof vt||t?.ast instanceof Pi){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t.ast instanceof vt?t.ast.name:t.ast.value);if(e)return[La.Location.create(ue(e.macro.fsPath),ce(e.macro.identifier))]}return[]}async function LA(t,e){return Et(t,e,r=>[...TV(r),...yV(r),...vV(r)])}var bV=["DT_PROP","DT_PROP_LEN","DT_PROP_LEN_OR","DT_PROP_HAS_IDX","DT_PROP_HAS_NAME","DT_PROP_BY_IDX","DT_PROP_LAST","DT_PROP_OR","DT_ENUM_IDX_BY_IDX","DT_ENUM_IDX","DT_ENUM_IDX_BY_IDX_OR","DT_ENUM_IDX_OR","DT_ENUM_HAS_VALUE_BY_IDX","DT_ENUM_HAS_VALUE","DT_STRING_TOKEN","DT_STRING_TOKEN_OR","DT_STRING_UPPER_TOKEN","DT_STRING_UPPER_TOKEN_OR","DT_STRING_UNQUOTED","DT_STRING_UNQUOTED_OR","DT_STRING_TOKEN_BY_IDX","DT_STRING_UPPER_TOKEN_BY_IDX","DT_STRING_UNQUOTED_BY_IDX","DT_PROP_BY_PHANDLE_IDX","DT_PROP_BY_PHANDLE_IDX_OR","DT_PROP_BY_PHANDLE","DT_PHA_BY_IDX","DT_PHA_BY_IDX_OR","DT_PHA","DT_PHA_OR","DT_PHA_BY_NAME","DT_PHA_BY_NAME_OR","DT_PHANDLE_BY_NAME","DT_PHANDLE_BY_IDX","DT_PHANDLE"];async function nh({macro:t,document:e,context:r,position:n}){if(bV.some(i=>i===t.parent?.macro)&&t.argIndexInParent===1&&t.parent?.args?.[0])return(await M({document:e,context:r,position:n,macro:t.parent.args[0]}))?.properties.find(s=>Z(s.name)===t.macro);if(["DT_PROP_BY_PHANDLE"].some(i=>i===t.parent?.macro)&&t.argIndexInParent===2&&t.parent?.args?.[0]&&t.parent?.args?.[1])return(await Rs({document:e,context:r,position:n,macro:{macro:"DT_PHANDLE",args:t.parent.args.slice(0,2)}},M))?.properties.find(s=>Z(s.name)===t.macro);if(["DT_PROP_BY_PHANDLE_IDX","DT_PROP_BY_PHANDLE_IDX_OR"].some(i=>i===t.parent?.macro)&&t.argIndexInParent===3&&t.parent?.args?.[0]&&t.parent?.args?.[1]&&t.parent?.args?.[3])return(await Ci({document:e,context:r,position:n,macro:{macro:"DT_PHANDLE_BY_IDX",args:t.parent.args.slice(0,3)}},M))?.properties.find(s=>Z(s.name)===t.macro);if(["DT_CHOSEN","DT_HAS_CHOSEN"].some(i=>i===t.parent?.macro)&&t.argIndexInParent===0&&t.parent?.args?.[0])return(await r.getRuntime()).rootNode.getChild(["/","chosen"])?.properties.find(i=>Z(i.name)===t.macro)}async function qA(t,e,r){if(!r)return;let n=Ji(r,t.position);return $A(n,t.position,e,r)}async function $A(t,e,r,n){if(!t?.macro)return;let i=await M({document:n,macro:t,context:r,position:e});if(i)return Ma(i);let s=await nh({document:n,macro:t,context:r,position:e});if(s)return rh(s);let o=await ks(n,t.macro,e,r);if(o)return $A(o[0],o[1],r,n)}var Es=q(U());var qa=t=>{let e=t.definitions.at(0),r=e&&fr(e.fsPath);return r?Es.Location.create(ue(r.fsPath),r.range):e?Es.Location.create(ue(e.fsPath),ce(e)):void 0},ih=t=>t.replaces?ih(t.replaces):t,FA=t=>{let e=ih(t),r=fr(e.ast.fsPath);return r?Es.Location.create(ue(r.fsPath),r.range):e?Es.Location.create(ue(e.ast.fsPath),ce(e.ast)):void 0};function SV(t){if(!t||t.item===null||!(t.ast instanceof Qe))return;let e=r=>{let n=fr(r.ast.fsPath);return n?Es.Location.create(ue(n.fsPath),n.range):Es.Location.create(ue(r.ast.fsPath),ce(r.ast.propertyName??r.ast))};if(t.item instanceof et&&t.ast instanceof Qe)return e(ih(t.item));if(t.item instanceof J&&t.ast instanceof Qe&&t.ast.parentNode instanceof dt){let r=t.item.deletedProperties.find(n=>n.by===t.ast.parentNode)?.property;if(r)return e(ih(r))}}function _V(t){if(t){if(t.item instanceof J&&!Zt(t.ast))return qa(t.item);if(t.ast instanceof mr&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return qa(t.ast.parentNode.linksTo);if(t.ast instanceof je&&t.ast.linksTo)return qa(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof et&&t.item.parent.name==="aliases"){let e=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(e)return qa(e)}}}function PV(t){if(t?.ast instanceof vt||t?.ast instanceof Pi){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t.ast instanceof vt?t.ast.name:t.ast.value);if(e)return Es.Location.create(ue(e.macro.fsPath),ce(e.macro.identifier))}}async function BA(t,e){return(await Et(t,e,r=>[_V(r)||SV(r)||PV(r)])).at(0)}async function jA(t,e,r){if(!r)return;let n=Ji(r,t.position);return UA(n,t.position,e,r)}async function UA(t,e,r,n){if(!t?.macro)return;let i=await M({document:n,macro:t,context:r,position:e});if(i)return qa(i);let s=await nh({document:n,macro:t,context:r,position:e});if(s)return FA(s);let o=await ks(n,t.macro,e,r);if(o)return UA(o[0],o[1],r,n)}var de=q(U());var kV=(t,e,r,n,i)=>{switch(r){case 1:return[{title:"Add semicolon",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(n.range.end.line,n.range.end.character),";")]}}}];case 2:return[{title:"Add open curly",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(n.range.end.line,n.range.end.character)," {")]}}}];case 29:return[{title:"Remove white space",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(de.Range.create(de.Position.create(n.range.start.line,t.pos.colEnd),de.Position.create(n.range.end.line,e.pos.col)),"")]}}}];case 3:return[{title:"Add close curly",diagnostics:[n],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(n.range.end.line,n.range.end.character),"}")]}}}];case 19:return[{title:"Add '/'",diagnostics:[n],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(n.range.end.line,n.range.end.character),"/")]}}}];case 28:return[{title:"Add comma",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(n.range.end.line,n.range.end.character),",")]}}}];case 21:return[{title:"Add '/'",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(n.range.end.line,n.range.end.character),"/")]}}}];case 23:return[{title:"Remove ';'",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.del(n.range)]}}}];case 34:return[{title:"Complete Keyword '/delete-node/",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(n.range,"/delete-node/")]}}}];case 35:return[{title:"Complete Keyword '/delete-property/",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(n.range,"/delete-property/")]}}}];case 25:return[{title:"Complete Keyword '/delete-property/",diagnostics:[n],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(n.range,"/delete-property/")]}}},{title:"Complete Keyword '/delete-node/",diagnostics:[n],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(n.range,"/delete-node/")]}}}];case 12:return[{title:"Add '>'",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(n.range.end.line,n.range.end.character),">")]}}}];default:return}},NV=(t,e,r,n,i)=>{if(!n?.length)return[];switch(t){case 0:return[{title:i??`Add Property "${n[0].newText.split("=",1)[0].replace(";","").trim()}"`,diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 27:return[{title:i??"Remove Property",diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 26:return[{title:i??"TODO",diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 36:return[{title:i??"TODO",diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 25:return n?[{title:i??"TODO",diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}]:[];default:return}},RV=(t,e,r,n)=>r?.length?[{title:n??"TODO",diagnostics:[t],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[e]:r}}}]:[];function HA(t){let e=t.context.diagnostics.flatMap(a=>{let c=a.data;if(c?.virtual)return[];switch(c?.type){case"FormattingIssues":return RV(a,t.textDocument.uri,c.edit?Array.isArray(c.edit)?c.edit:[c.edit]:void 0,c.codeActionTitle);case"SyntaxIssue":return c?.items.flatMap(l=>kV(c.firstToken,c.lastToken,l,a,t.textDocument.uri));case"StandardTypeIssue":return c?.items.flatMap(l=>NV(l,a,t.textDocument.uri,c.edit?Array.isArray(c.edit)?c.edit:[c.edit]:void 0,c.codeActionTitle))}}).filter(a=>!!a),r=e.filter(a=>a.kind===de.CodeActionKind.SourceFixAll),n=e.filter(a=>a.title.startsWith("Add Property")),i=e.filter(a=>a.kind!==de.CodeActionKind.SourceFixAll),s=r.flatMap(a=>a.edit?.changes?.[t.textDocument.uri]??[]),o=new Map;return n.forEach(a=>{let c=a.edit.changes[t.textDocument.uri][0],l=c.range.start.line,u=c.range.start.character;o.has(`${l}:${u}`)||o.set(`${l}:${u}`,[]),o.get(`${l}:${u}`)?.push(c)}),[...i,...r.map(a=>({...a,kind:de.CodeActionKind.QuickFix})),...s.length?[{title:"Fix All",kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[t.textDocument.uri]:s}}}]:[],...Array.from(o.values()).flatMap(a=>a.length>1?{title:"Add All Missing Properties",kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[t.textDocument.uri]:a}}}:[])]}var ee=q(U());function VA(t,e){return t.line<e.line?-1:t.line>e.line?1:t.character<e.character?-1:t.character>e.character?1:0}var Sl=(t,e)=>e.some(r=>VA(t,r.start)>=0&&VA(t,r.end)<=0),EV=async(t,e,r)=>{let n=ht.create(t.pos.line,t.pos.col),i=r.find(s=>Qt(s,e,n));if(i)return ti(i,e,n)},bn=(t,e)=>{let r=ht.create(e.length-1,e.at(-1)?.length??0),n=[],i;return t.filter(o=>(o instanceof Tn||o instanceof vn)&&/^dts-format (on|off)$/.test(o.toString().trim())).sort((o,a)=>o.firstToken.pos.line-a.firstToken.pos.line).forEach(o=>{let a=o.toString().trim();if(a==="dts-format off")i={start:ht.create(o.firstToken.pos.line,o instanceof Tn?o.firstToken.pos.colEnd:0)};else if(a==="dts-format on"&&i){let c=ht.create(o.lastToken.pos.line,o instanceof Tn?o.lastToken.pos.colEnd-1:e[o.lastToken.pos.line-1].length);n.push(Ze.create(i.start,c)),i=void 0}}),i&&n.push(Ze.create(i.start,r)),n},$a=async(t,e,r)=>(await dv(t,e,r))?.allAstItems,dv=async(t,e,r)=>{if(e!==r){let n=new xn(t,[],void 0,()=>new rn(r,t).tokens,!0);return await n.stable,n}},Sn=(t,e,r)=>{let n=t.length?r.filter(i=>(Array.isArray(i.raw.edit)?i.raw.edit:i.raw.edit?[i.raw.edit]:void 0)?.every(o=>!Sl(o.range.start,t)&&!Sl(o.range.end,t))):r;return"range"in e&&(n=n.filter(i=>po(e.range,i.raw.range))),n},Fa=(t,e)=>async r=>{let n=t.filter(a=>!(a instanceof ni)&&!(a instanceof vn)&&!(a instanceof Tn)&&!(a instanceof On)),i=await EV(r.firstToken,e,n);if(!i||i===r||r.allDescendants.some(a=>a===i))return{level:0};let s=ba(i);return{level:Sa(e,s),inAst:i}},Fr=(t,e)=>{if(t.insertSpaces)return"".padStart(e," ");let r=Math.floor(e/t.tabSize),n=e%t.tabSize;return`${"".padStart(r," ")}${"".padStart(n," ")}`},Ln=(t,e,r="")=>`${"".padStart(t*e.length,e)}${r}`,WA=t=>{let e=t.parentNode;if(!(!e||!(e instanceof ge)))return!(e instanceof nr)||!e.openBracket?WA(e):e};function vo(t,e,r,n,i,s,o=!1){if(!o&&hr(e.firstToken,t.firstToken))return n[e.firstToken.pos.line].slice(0,e.firstToken.pos.col).replace(/^\s+/,f=>f.replace(/\t/g," ".repeat(r.tabSize))).length-r.tabSize*i;let a=WA(e);if(!a)return s;let l=vo(t,a,r,n,i,s);return!o&&hr(e.firstToken,a.firstToken)?l+=e.firstToken.pos.col-a.firstToken.pos.col:a instanceof nr&&a.openBracket&&++l,l}var oi=(t,e,r)=>t[e]??r,sh=t=>({baseFormattingRules:oi(t,"baseFormattingRules",!0),removeMacroMultiline:oi(t,"removeMacroMultiline",!0),wrapLongLines:oi(t,"wrapLongLines",!0),indentExpressions:oi(t,"indentExpressions",!0),removeEmptyReferences:oi(t,"removeEmptyReferences",!0),removeEmptyRoots:oi(t,"removeEmptyRoots",!1),removeEmptyNodes:oi(t,"removeEmptyNodes",!1),removeDuplicateProperties:oi(t,"removeDuplicateProperties",!0),sortNodesAndProperties:oi(t,"sortNodesAndProperties",!1),sortNodesNodesBy:oi(t,"sortNodesNodesBy","none"),sortPropertiesAlphabetically:oi(t,"sortPropertiesAlphabetically",!1)});var $t=q(U());function ws(t,e,r,n){if(!hr(t,e)){let o=e.prevToken;for(;t!==o;){if(o&&hr(t,o)&&ws(t,o,r,n))return!0;o=o?.prevToken}return null}return n[t.pos.line].slice(0,e.pos.colEnd).replace(/^\s+/,o=>o.replace(/\t/g," ".repeat(r.tabSize))).length>r.wordWrapColumn}async function fv(t,e,r,n,i,s,o=[]){let a=n.split(`
306
+ };`,kind:It.CompletionItemKind.Class,sortText:`!${n}`,insertTextFormat:It.InsertTextFormat.Snippet}))}async function f0(t,e){return Et(t,e,(r,n)=>[...iV(r,n),...nV(r,n),...rV(r,n),...sV(r,n),...tV(r,n),...eV(r,n),...ZH(r),...oV(r),...aV(r,n)])}var th=q(U());var h0=require("child_process");var ov=t=>/[A-Za-z0-9_]/.test(t);function cV(t,e){let r=[];for(let n=0;n<e;n++){let i=t[n];i==="("?r.push(n):i===")"&&r.pop()}return r.length?r[r.length-1]:void 0}function p0(t,e){let r=1;for(let n=e+1;n<t.length;n++){let i=t[n];if(i==="(")r++;else if(i===")"&&(r--,r===0))return n}}function m0(t,e,r){let n=[],i=0,s=!1,o=!1,a=e;for(let f=e;f<r;f++){let p=t[f];if(p==="'"&&!o)s=!s;else if(p==='"'&&!s)o=!o;else if(!s&&!o){if(p==="(")i++;else if(p===")")i--;else if(p===","&&i===0){let m=a,h=f,y=m,S=h;for(;y<S&&/\s/.test(t[y]);)y++;for(;S>y&&/\s/.test(t[S-1]);)S--;n.push({start:m,end:h,text:t.slice(y,S)}),a=f+1}}}let c=a,l=r,u=c,d=l;for(;u<d&&/\s/.test(t[u]);)u++;for(;d>u&&/\s/.test(t[d-1]);)d--;return n.push({start:c,end:l,text:t.slice(u,d)}),n}function av(t){let e=t.trim(),r=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(e);if(!r)return{macro:e};let n=r[1],i=r[2],s=m0(i,0,i.length),o={macro:n,args:[]};return o.args=s.map(a=>{let c=av(a.text);return c.parent=o,c}),o}function Qi(t,e){let r=t.getText(),n=t.offsetAt(e),i=n,s=n;for(;i>0&&ov(r[i-1]);)i--;for(;s<r.length&&ov(r[s]);)s++;if(r[s]==="("){let y=p0(r,s);y!==void 0&&(s=y+1)}let o=r.slice(i,s),a=o.trim().length?av(o):void 0,c=cV(r,n);if(c===void 0)return a;let l=p0(r,c);if(l===void 0||!(c<n&&n<=l))return a;let u=c,d=u;for(;d>0&&ov(r[d-1]);)d--;let f=r.slice(d,u);if(!f)return a;let p=m0(r,c+1,l),m={macro:f,args:[]};m.args=p.map(y=>{let S=av(y.text);return S.parent=m,S});let h=-1;for(let y=0;y<p.length;y++){let S=p[y];if(n>=S.start&&n<=S.end){h=y;break}}if(h>=0){let y=m.args[h];return y.argIndexInParent=h,y}return m}function lV(t,e,r){let i=t.getText().split(/\r?\n/),s=new RegExp(`^\\s*#\\s*define\\s+(${e})\\b(\\s*\\([^)]*\\))?\\s*(.*)$`);for(let o=Math.min(r.line,i.length-1);o>=0;o--){let a=i[o],c=s.exec(a);if(c){let l=a.indexOf(c[0]),u=a.indexOf(c[3],l);return ht.create(o,u>=0?u:a.length)}}}async function ks(t,e,r,n){let i=g0(t,e,r);if(i)return i;let s=await dV(e,n,Ne(t.uri));if(s)return[s,r]}function g0(t,e,r){if(e.startsWith("DT_"))return;let n=lV(t,e,r);if(!n)return;let i=Qi(t,n);if(i)return[i,n]}var uV=(t,e)=>new Promise(r=>{let n=(0,h0.spawn)(t,e,{stdio:["ignore","pipe","pipe"]}),i="";n.stdout.on("data",s=>{i+=s.toString()}),n.on("close",s=>{r(s?"":i)})});async function dV(t,e,r){let n=e.getCompileCommands()?.find(s=>fe(s.file,r));if(!n)return;let i=`${n.command.replace(/-(o|c)\s+\S+/g,"")} -E -dM ${n.file}`;try{let[s,...o]=i.split(" "),a=await uV(s,o.filter(u=>!!u)),c=Lt.create(`macros://${n.file}`,"devicetree",0,a),l=g0(c,t,c.positionAt(a.length-1));if(l)return l[0]}catch(s){console.error(s)}}function Z(t){return t.toLowerCase().replace(/[@,-\.]/g,"_")}var fl=q(U());async function y0({macro:t,context:e}){if(t.macro&&"DT_ALIAS".startsWith(t.macro))return[{label:"DT_ALIAS(...)",insertText:"DT_ALIAS($1)",kind:fl.CompletionItemKind.Function,insertTextFormat:fl.InsertTextFormat.Snippet}];if(t.parent?.macro!=="DT_ALIAS"||t.argIndexInParent!==0)return[];let r=await e.getRuntime();return r.rootNode.getNode("aliases")?.properties.map(n=>{let i=n.ast.getFlatAstValues()?.at(0),s;return i instanceof ie?s=i.linksTo:i instanceof ri&&(s=i.pathParts.at(-1)?.linksTo),{label:Z(n.name),kind:fl.CompletionItemKind.Property,documentation:s?.toMarkupContent(r.context.macros)}})??[]}var pl=q(U());async function wr(t,e,r){if(!t)return;let i=t?.properties.find(s=>Z(s.name)===e)?.ast.getFlatAstValues();return i?.length===0?!0:i?.map(s=>{if(s instanceof it)return s.path?.pathParts.at(-1)?.linksTo;if(s instanceof ie)return s.linksTo;if(s instanceof ne)return s.value;if(s instanceof ge){let o=s.evaluate(r.macros);return typeof o=="number"?o:s.toString()}})}async function _p({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PROP"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?wr(o,s[1].macro,r):void 0}async function T0(t,e){let r=await _p(t,e);if(typeof r=="boolean")return;let n=r?.at(0);if(r?.length===1&&n instanceof J)return n}async function v0(t,e,r,n){if(r=typeof r=="number"?r:Le(r),typeof r!="number")return;let i=await wr(t,e,n);if(i===!0)return!0;if(!i)return;let s=i.at(r);if(s)return i.length===1&&i[0]instanceof J?i[0]:s}async function Pp({document:t,macro:e,context:r,position:n},i){if(!(e.macro!=="DT_PROP_BY_IDX"||e.args?.length!==3))return v0(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro,r)}async function b0(t,e){let r=await Pp(t,e);if(typeof r!="boolean"&&r instanceof J)return r}async function nn(t,{document:e,context:r,macro:n,position:i},s){return t||(await s({document:e,macro:n,context:r,position:i})??n.macro)}async function kp(t,e,r,n){return nn(await wr(t,e,r.context),r,n)}async function Ca({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_OR"||e.args?.length!==3)return;let[s,o,a]=e.args,c=await i({document:t,macro:s,context:r,position:n});return await kp(c,o.macro,{macro:a,document:t,context:r,position:n},i)}async function S0(t,e){let r=await Ca(t,e);if(r instanceof J)return r;if(typeof r=="boolean")return;let n=r?.at(0);if(r?.length===1&&n instanceof J)return n}async function _0(t){let e=t?.nodeType?.onBus,r=t?.parent?.nodeType?.bus;return t&&r?.length&&r?.some(n=>n===e)?t.parent??void 0:void 0}async function Np(t,e){let r=t.macro.args;if(t.macro.macro!=="DT_BUS"||r?.length!==1)return;let n=await e({...t,macro:r[0]});return await _0(n)}async function Rp(t,e){let r=(await t.getRuntime()).rootNode.getChild(["/","chosen"]);if(!r)return;let s=r?.properties.find(o=>Z(o.name)===e)?.ast.getFlatAstValues()?.at(0);if(s instanceof ie)return s.linksTo;if(s instanceof it)return s.path?.pathParts.at(-1)?.linksTo}async function Ep(t){let e=t.macro.args;if(!(t.macro.macro!=="DT_CHOSEN"||e?.length!==1))return await Rp(t.context,e[0].macro)}async function wp(t,e){let r=await e?.getRuntime();if(r){let n=Ei.getNodeFromPath(["aliases"],r.rootNode,!0),i=n?.properties.find(o=>Z(o.name)===t);if(!i)return;let s=i.ast.getFlatAstValues();return s?.[0]instanceof ne?n=r.rootNode.getChild(s[0].value.split("/")):s?.[0]instanceof ie?n=s[0].linksTo:s?.[0]instanceof it&&(n=s[0].path?.pathParts.at(-1)?.linksTo),n}}async function Dp({macro:t,context:e}){if(!(t.macro!=="DT_ALIAS"||t.args?.length!==1))return wp(t.args[0].macro,e)}async function P0(t,e){return t?.nodes.find(r=>Z(r.name)===e)}async function Cp({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_CHILD"||e.args?.length!==2)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return P0(s,e.args[1].macro)}var cv=(t,e)=>t.nodes.filter(r=>!r.disabled&&r.nodeType).flatMap(r=>[r.nodeType.compatible,...Array.from(r.nodeType.extends)].filter(n=>!!n).map(n=>Z(n)).includes(e)?[r,...cv(r,e)]:cv(r,e));async function k0(t,e){let r=await e?.getRuntime();if(r)return cv(r.rootNode,t)}async function lv({macro:t,context:e}){if(!(t.macro!=="DT_COMPAT_GET_ANY_STATUS_OKAY"||t.args?.length!==1))return k0(t.args[0].macro,e)}async function N0(t){return(await lv(t))?.at(0)}async function R0(t){return t?.parent?.parent??void 0}async function Ap({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_GPARENT"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return R0(s)}var uv=(t,e)=>t.nodes.filter(r=>r.nodeType).sort((r,n)=>r.disabled===n.disabled?0:r.disabled?1:-1).flatMap(r=>[r.nodeType.compatible,...Array.from(r.nodeType.extends)].filter(n=>!!n).map(n=>Z(n)).includes(e)?[r,...uv(r,e)]:uv(r,e));async function E0(t,e,r){let n=await r?.getRuntime();if(n)return uv(n.rootNode,e).at(t)}async function Ip({macro:t,context:e}){if(t.macro!=="DT_INST"||t.args?.length!==2)return;let r=Le(t.args[0].macro);if(typeof r=="number")return E0(r,t.args[1].macro,e)}async function w0(t,e){let r=await e?.getRuntime(),n=r?.resolvePath([`&${t.trim()}`]);if(r&&n)return Ei.getNodeFromPath(n.slice(1),r.rootNode,!0)}async function Op({macro:t,context:e}){if(!(t.macro!=="DT_NODELABEL"||t.args?.length!==1))return w0(t.args[0].macro,e)}async function D0(t){return t?.parent??void 0}async function xp({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PARENT"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return D0(s)}var C0=(t,e)=>{if(!e.length)return t;let r=e.splice(0,1)[0],n=t.nodes.find(i=>Z(i.fullName)===r);return n?C0(n,e):void 0};async function Mp(t,e){let r=await e?.getRuntime();if(r)return C0(r.rootNode,t)}async function Lp({macro:t,context:e}){let r=t.args;if(!(t.macro!=="DT_PATH"||!r?.length))return Mp(r.map(n=>n.macro),e)}async function qp({macro:t,context:e}){let r=t.args;if(!(t.macro!=="DT_ROOT"||r?.length))return(await e.getRuntime()).rootNode}async function Aa(t,e,r){let n=t?.properties.find(c=>Z(c.name)===e);if(!n)return;let i=n?.ast.quickValues?.at(r),s=n.parent.nodeType;if(Array.isArray(i)||!s||!(s instanceof _t))return;let a=s.properties.find(c=>c.getNameMatch(n.name))?.values(n).findIndex(c=>c===i)??-1;return a===-1?void 0:a}async function $p(t,e,r,n,i){return nn(await Aa(t,e,r),n,i)}async function Fp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_IDX_BY_IDX_OR"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Le(s[2].macro);if(typeof a=="number")return await $p(o,s[1].macro,a,{macro:s[3],document:t,context:r,position:n},i)}async function Bp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_IDX_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return await $p(o,s[1].macro,0,{macro:s[2],document:t,context:r,position:n},i)}async function Ns(t,e,r,n,i){let s=t?.properties.find(d=>Z(d.name)===e),o=s?.parent.nodeType;if(!o||!(o instanceof _t))return;if(typeof r=="string"){let d=s.nexusMapsTo.at(0)?.specifierSpace;if(r=(d?s.parent.getProperty(`${d}-names`)?.ast.quickValues:void 0)?.findIndex(p=>typeof p=="string"&&p.toLowerCase()===r)??-1,r===-1)return}let a=s.nexusMapsTo.at(r),l=a?.target.nodeType?.cellsValues?.find(d=>a.specifierSpace&&d.specifier===a.specifierSpace)?.values?.indexOf(n);if(l===void 0||l===-1)return;let u=a?.mappingValuesAst.at(l);if(u instanceof ge){let d=u.evaluate(i.macros);return typeof d!="number"?u.toString():d}}async function Ia(t,e,r,n,i,s){return nn(await Ns(t,e,r,n,i.context),i,s)}async function jp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_BY_IDX_OR"||s?.length!==5)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Le(s[2].macro);if(typeof a=="number")return Ia(o,s[1].macro,a,s[3].macro,{macro:s[4],document:t,context:r,position:n},i)}async function Up({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_BY_NAME_OR"||s?.length!==5)return;let o=await i({document:t,macro:s[0],context:r,position:n});return Ia(o,s[1].macro,s[2].macro,s[3].macro,{macro:s[4],document:t,context:r,position:n},i)}async function Di(t,e,r=0){let n=t?.properties.find(s=>Z(s.name)===e);if(r=typeof r=="number"?r:Le(r??"0"),typeof r!="number")return;let i=n?.ast.getFlatAstValues()?.at(r);if(i instanceof ie)return i.linksTo;if(i instanceof it)return i.path?.pathParts.at(-1)?.linksTo}async function Rs({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHANDLE"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return Di(o,s[1].macro,0)}async function Ci({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHANDLE_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return Di(o,s[1].macro,s.at(2)?.macro)}async function A0(t,e,r){let n=t?.properties.find(l=>Z(l.name)===e);if(!n)return;let i=n.parent.nodeType;if(!i||!(i instanceof _t))return;let s=n.nexusMapsTo.at(0)?.specifierSpace,a=(s?n.parent.getProperty(`${s}-names`)?.ast.quickValues:void 0)?.findIndex(l=>typeof l=="string"&&l.toLowerCase()===r)??-1;return a===-1?void 0:n.nexusMapsTo.at(a)?.target}async function Hp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHANDLE_BY_NAME"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return await A0(o,s[1].macro,s[2].macro)}async function Vp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_OR"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n});return Ia(o,s[1].macro,0,s[2].macro,{macro:s[3],document:t,context:r,position:n},i)}async function Wp({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_BY_PHANDLE_IDX_OR"||e.args?.length!==5)return;let s=await Di(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro);return kp(s,e.args[3].macro,{macro:e.args[4],document:t,context:r,position:n},i)}async function zp(t,e){if(!t)return;let r=t?.properties.find(n=>Z(n.name)===e);return r?.nexusMapsTo.length?r.nexusMapsTo.length:r?.ast.getFlatAstValues()?.length}async function I0(t,e,r,n){if(t)return nn(await zp(t,e),r,n)}async function Gp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PROP_LEN_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?I0(o,s[1].macro,{macro:s[2],document:t,context:r,position:n},i):void 0}async function Oa(t,e){if(!t)return;let n=t?.properties.find(i=>Z(i.name)===e)?.ast.getFlatAstValues();if(n?.length===1&&n[0]instanceof ne)return Z(n[0].value)}async function O0(t,e,r,n){if(t)return nn(await Oa(t,e),r,n)}async function Yp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_TOKEN_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return O0(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}async function Kp(t,e){if(!t)return;let n=t?.properties.find(i=>Z(i.name)===e)?.ast.getFlatAstValues();if(n?.length===1&&n[0]instanceof ne)return n[0].value}async function x0(t,e,r,n){if(t)return nn(await Kp(t,e),r,n)}async function Xp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UNQUOTED_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return x0(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}async function Jp(t,e){return(await Oa(t,e))?.toUpperCase()}async function M0(t,e,r,n){if(t)return nn(await Jp(t,e),r,n)}async function Qp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UPPER_TOKEN_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return M0(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}function si(t){return async(e,r)=>{let n=await t(e,r);if(n instanceof J)return n}}async function M({macro:t,document:e,context:r,position:n}){["DT_ALIAS","DT_NODELABEL"].some(a=>a===t.parent?.macro)||t.parent?.macro==="DT_CHILD"&&t.argIndexInParent===1?t=t.parent:t.parent?.macro==="DT_HAS_ALIAS"?(t=t.parent,t.macro="DT_ALIAS"):t.parent?.macro==="DT_PATH"&&(t.parent.args=t.parent.args?.slice(0,(t.argIndexInParent??0)+1)??[],t=t.parent);let s=await[Np,Ep,Dp,Cp,N0,Ap,Ip,Op,xp,Lp,Rs,Ci,Hp,b0,T0,S0,qp,si(Fp),si(Bp),si(jp),si(Up),si(Vp),si(Wp),si(Gp),si(Ca),si(Yp),si(Xp),si(Qp)].reduce((a,c)=>a.then(l=>l||c({macro:t,document:e,context:r,position:n},M)),Promise.resolve(void 0));if(s)return Array.isArray(s)?s.at(0):s;let o=await ks(e,t.macro,n,r);if(o)return M({document:e,macro:o[0],context:r,position:n})}async function L0({macro:t,document:e,context:r,position:n}){return t.macro&&t.macro&&"DT_CHILD".startsWith(t.macro)?[{label:"DT_CHILD(...)",insertText:"DT_CHILD($1, $2)",kind:pl.CompletionItemKind.Function,insertTextFormat:pl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_CHILD"||t.argIndexInParent!==1||!t.parent.args?.length?[]:(await M({document:e,macro:t.parent.args[0],context:r,position:n}))?.nodes.map(s=>({label:Z(s.fullName),kind:pl.CompletionItemKind.Class,documentation:s.toMarkupContent(r.macros)}))??[]}var hl=q(U());function q0({macro:t,context:e}){return t.macro&&"DT_COMPAT_GET_ANY_STATUS_OKAY".startsWith(t.macro)?[{label:"DT_COMPAT_GET_ANY_STATUS_OKAY(...)",insertText:"DT_COMPAT_GET_ANY_STATUS_OKAY($1)",kind:hl.CompletionItemKind.Function,insertTextFormat:hl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_COMPAT_GET_ANY_STATUS_OKAY"||t.argIndexInParent!==0?[]:e.bindingLoader?.getBindings().map(r=>({label:Z(r),kind:hl.CompletionItemKind.Property}))??[]}var ml=q(U());function $0({macro:t,context:e}){return t.macro&&"DT_INST".startsWith(t.macro)?[{label:"DT_INST(...)",insertText:"DT_INST($1, $2)",kind:ml.CompletionItemKind.Function,insertTextFormat:ml.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_INST"||t.argIndexInParent!==1?[]:e.bindingLoader?.getBindings().map(r=>({label:Z(r),kind:ml.CompletionItemKind.Property}))??[]}var gl=q(U());async function F0({macro:t,context:e}){if(t.macro&&"DT_NODELABEL".startsWith(t.macro))return[{label:"DT_NODELABEL(...)",insertText:"DT_NODELABEL($1)",kind:gl.CompletionItemKind.Function,insertTextFormat:gl.InsertTextFormat.Snippet}];let r=await e.getRuntime();return t.parent?.macro!=="DT_NODELABEL"||t.argIndexInParent!==0?[]:await Promise.all(r.rootNode.allDescendantsLabels.map(async n=>({label:n.label.value,kind:gl.CompletionItemKind.Property,documentation:n.lastLinkedTo?.toMarkupContent(r.context.macros)}))??[])}var yl=q(U());async function B0({macro:t,context:e}){return t.macro&&t.macro&&"DT_PATH".startsWith(t.macro)?[{label:"DT_PATH(...)",insertText:"DT_PATH($1)",kind:yl.CompletionItemKind.Function,insertTextFormat:yl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_PATH"||!t.parent.args?.length?[]:(await Mp(t.parent.args.slice(0,-1).map(n=>n.macro),e))?.nodes.map(n=>({label:Z(n.fullName),kind:yl.CompletionItemKind.Class,documentation:n.toMarkupContent(e.macros)}))??[]}var j0=q(U());async function U0({macro:t,context:e}){if(t.macro&&t.macro&&"DT_ROOT".startsWith(t.macro)){let r=await e.getRuntime();return[{label:"DT_ROOT",kind:j0.CompletionItemKind.Class,documentation:r.rootNode.toMarkupContent(r.context.macros)}]}return[]}var Zp=q(U());function H0({macro:t}){return t.macro&&t.macro&&"DT_SAME_NODE".startsWith(t.macro)?[{label:"DT_SAME_NODE(...)",insertText:"DT_SAME_NODE($1, $2)",kind:Zp.CompletionItemKind.Snippet,insertTextFormat:Zp.InsertTextFormat.Snippet}]:[]}var Tl=q(U());async function Q({macro:t,document:e,position:r,context:n},i,s,o,a,c=l=>M({document:e,macro:l,context:n,position:r})){if(t.macro&&t.macro&&i.startsWith(t.macro))return[{label:`${i}(...)`,insertText:`${i}(${Array(o).map((d,f)=>`${f+1}`).join(", ")})`,kind:Tl.CompletionItemKind.Function,insertTextFormat:Tl.InsertTextFormat.Snippet}];if(t.parent?.macro!==i||t.argIndexInParent!==s||!t.parent.args?.length)return[];let l=await c(t.parent.args[0]);return(a?l?.properties.filter(a):l?.properties)?.map(d=>({label:Z(d.name),kind:Tl.CompletionItemKind.Property,documentation:d.toPrettyString(n.macros)}))??[]}async function V0(t){return Q(t,"DT_ENUM_HAS_VALUE",1,3)}async function W0(t){return Q(t,"DT_ENUM_HAS_VALUE_BY_IDX",1,4)}async function z0(t){return Q(t,"DT_ENUM_IDX",1,2)}async function G0(t){return Q(t,"DT_ENUM_IDX_BY_IDX",1,3)}async function Y0(t){return Q(t,"DT_ENUM_IDX_BY_IDX_OR",1,4)}async function K0(t){return Q(t,"DT_ENUM_IDX_OR",1,3)}var X0=q(U());async function Zi({macro:t,document:e,context:r,position:n},i,s,o){if(t.parent?.macro!==i||t.argIndexInParent!==s||!t.parent.args?.length)return[];let c=(await M({document:e,macro:t.parent.args[0],context:r,position:n}))?.properties.find(f=>Z(f.name)===t.parent?.args?.at(1)?.macro),l=0;if(typeof o=="string"){let f=c?.nexusMapsTo.at(0)?.specifierSpace;if(l=(f?c.parent.getProperty(`${f}-names`)?.ast.quickValues:void 0)?.findIndex(m=>typeof m=="string"&&m.toLowerCase()===o)??-1,l===-1)return[]}let u=c?.nexusMapsTo.at(l);return u?.target.nodeType?.cellsValues?.find(f=>u.specifierSpace&&f.specifier===u.specifierSpace)?.values.map(f=>({label:Z(f),kind:X0.CompletionItemKind.Property}))??[]}async function J0(t){return t.macro.argIndexInParent===2?Zi(t,"DT_PHA",2,0):Q(t,"DT_PHA",1,3,e=>!!e.nexusMapsTo.length)}var Q0=q(U());async function fV({document:t,macro:e,position:r,context:n},i){if(e.parent?.macro!==i||!e.parent.args?.length)return[];let o=(await M({document:t,macro:e.parent.args[0],context:n,position:r}))?.properties.find(a=>Z(a.name)===e.parent?.args?.at(1)?.macro);return Array(o?.nexusMapsTo.length??0)?.map((a,c)=>({label:c.toString(),kind:Q0.CompletionItemKind.Property}))??[]}async function Z0(t){if(t.macro.argIndexInParent===2)return fV(t,"DT_PHA_BY_IDX");if(t.macro.argIndexInParent===3){let e=t.macro.parent?.args?Le(t.macro.parent.args[2].macro):void 0;return typeof e!="number"?[]:Zi(t,"DT_PHA_BY_IDX",3,e)}return Q(t,"DT_PHA_BY_IDX",1,3,e=>!!e.nexusMapsTo.length)}var eA=q(U());async function vl({document:t,macro:e,context:r,position:n},i){if(e.parent?.macro!==i||!e.parent.args?.length)return[];let o=(await M({document:t,macro:e.parent.args[0],context:r,position:n}))?.properties.find(l=>Z(l.name)===e.parent?.args?.at(1)?.macro),a=o?.nexusMapsTo.at(0)?.specifierSpace;return(a?o.parent.getProperty(`${a}-names`)?.ast.quickValues:void 0)?.filter(l=>typeof l=="string")?.map(l=>({label:l,kind:eA.CompletionItemKind.Property}))??[]}async function tA(t){let{macro:e}=t;return e.argIndexInParent===2?vl(t,"DT_PHA_BY_NAME"):e.argIndexInParent===3?e.parent?.args?.[2]?.macro?Zi(t,"DT_PHA_BY_NAME",3,e.parent.args[2].macro):[]:Q(t,"DT_PHA_BY_NAME",1,3,r=>!!r.nexusMapsTo.length)}async function rA(t){let{macro:e}=t;return e.argIndexInParent===2?vl(t,"DT_PHA_BY_NAME_OR"):e.argIndexInParent===3?e.parent?.args?.[2]?.macro?Zi(t,"DT_PHA_BY_NAME_OR",3,e.parent.args[2].macro):[]:Q(t,"DT_PHA_BY_NAME_OR",1,3,r=>!!r.nexusMapsTo.length)}async function nA(t){let{macro:e}=t;return e.argIndexInParent===2?Zi(t,"DT_PHA_OR",2,0):Q(t,"DT_PHA_OR",1,3,r=>!!r.nexusMapsTo.length)}async function eh(t){return Q(t,"DT_PHANDLE",1,2,e=>!!e.ast.getFlatAstValues()?.some(r=>r instanceof ie||r instanceof it))}async function xa(t){return Q(t,"DT_PHANDLE_BY_IDX",1,3,e=>!!e.ast.getFlatAstValues()?.some(r=>r instanceof ie||r instanceof it))}async function iA(t){let{macro:e}=t;return e.argIndexInParent===2?vl(t,"DT_PHANDLE_BY_NAME"):Q(t,"DT_PHANDLE_BY_NAME",1,3,r=>!!r.ast.getFlatAstValues()?.some(n=>n instanceof ie||n instanceof it))}async function sA(t){return Q(t,"DT_PROP",1,2,e=>!e.nexusMapsTo.length)}async function oA(t){return Q(t,"DT_PROP_BY_IDX",1,3,e=>!e.nexusMapsTo.length)}async function aA(t){let{macro:e}=t;return(e.argIndexInParent===1||e.argIndexInParent===2)&&e.parent?.macro==="DT_PROP_BY_PHANDLE_IDX"?xa({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE_BY_IDX"}:void 0}}):Q(t,"DT_PROP_BY_PHANDLE_IDX",3,4,r=>!r.nexusMapsTo.length,()=>Ci({...t,macro:{macro:"DT_PHANDLE_BY_IDX",args:e.parent?.args?.slice(0,3)}},M))}async function cA(t){let{macro:e}=t;return e.argIndexInParent===1&&e.parent?.macro==="DT_PROP_BY_PHANDLE"?eh({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE"}:void 0}}):Q(t,"DT_PROP_BY_PHANDLE",2,3,r=>!r.nexusMapsTo.length,()=>Rs({...t,macro:{macro:"DT_PHANDLE",args:e.parent?.args?.slice(0,2)}},M))}async function lA(t){let{macro:e}=t;return(e.argIndexInParent===1||e.argIndexInParent===2)&&e.parent?.macro==="DT_PROP_BY_PHANDLE_IDX_OR"?xa({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE_BY_IDX"}:void 0}}):Q(t,"DT_PROP_BY_PHANDLE_IDX_OR",3,5,r=>!r.nexusMapsTo.length,()=>Ci({...t,macro:{macro:"DT_PHANDLE_BY_IDX",args:e.parent?.args?.slice(0,3)}},M))}async function uA(t){return Q(t,"DT_PROP_HAS_IDX",1,3,e=>!e.nexusMapsTo.length)}async function dA(t){return Q(t,"DT_PROP_HAS_NAME",1,3,e=>!e.nexusMapsTo.length)}async function fA(t){return Q(t,"DT_PROP_LAST",1,2,e=>!e.nexusMapsTo.length)}async function pA(t){return Q(t,"DT_PROP_LEN",1,2,e=>!e.nexusMapsTo.length)}async function hA(t){return Q(t,"DT_PROP_LEN_OR",1,2,e=>!e.nexusMapsTo.length)}async function mA(t){return Q(t,"DT_PROP_OR",1,2,e=>!e.nexusMapsTo.length)}async function gA(t){return Q(t,"DT_STRING_TOKEN",1,2,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function yA(t){return Q(t,"DT_STRING_TOKEN_BY_IDX",1,3,e=>{let r=e.ast.getFlatAstValues();return!!r?.length&&r.every(n=>n instanceof ne)})}async function TA(t){return Q(t,"DT_STRING_TOKEN_OR",1,3,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function vA(t){return Q(t,"DT_STRING_UNQUOTED",1,2,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function bA(t){return Q(t,"DT_STRING_UNQUOTED_BY_IDX",1,3,e=>{let r=e.ast.getFlatAstValues();return!!r?.length&&r.every(n=>n instanceof ne)})}async function SA(t){return Q(t,"DT_STRING_UNQUOTED_OR",1,3,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function _A(t){return Q(t,"DT_STRING_UPPER_TOKEN",1,2,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function PA(t){return Q(t,"DT_STRING_UPPER_TOKEN_BY_IDX",1,3,e=>{let r=e.ast.getFlatAstValues();return!!r?.length&&r.every(n=>n instanceof ne)})}async function kA(t){return Q(t,"DT_STRING_UPPER_TOKEN_OR",1,3,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}var bl=q(U());async function NA({macro:t,context:e}){return t.parent?.macro==="DT_ON_BUS"&&t.argIndexInParent===1?e.bindingLoader?.getBusTypes().map(r=>({label:Z(r),kind:bl.CompletionItemKind.Enum}))??[]:t.macro&&"DT_ON_BUS".startsWith(t.macro)?[{label:"DT_ON_BUS(...)",insertText:"DT_ON_BUS($1, $2)",kind:bl.CompletionItemKind.Function,insertTextFormat:bl.InsertTextFormat.Snippet}]:[]}async function RA(t){return Q(t,"DT_CHOSEN",0,1,void 0,async()=>(await t.context.getRuntime()).rootNode.getChild(["/","chosen"]))}async function EA(t){return Q(t,"DT_HAS_CHOSEN",0,1,void 0,async()=>(await t.context.getRuntime()).rootNode.getChild(["/","chosen"]))}var pV=["DT_BUS","DT_CHILD_NUM","DT_CHILD_NUM_STATUS_OKAY","DT_GPARENT","DT_HAS_ALIAS","DT_NODE_CHILD_IDX","DT_NODE_FULL_NAME","DT_NODE_FULL_NAME_TOKEN","DT_NODE_FULL_NAME_UNQUOTED","DT_NODE_FULL_NAME_UPPER_TOKEN","DT_NODE_HASH","DT_NODE_PATH","DT_NODELABEL_STRING_ARRAY","DT_PARENT"];async function wA(t,e,r){if(!r)return[];let n=Qi(r,t.position);return n?(await Promise.all([NA,RA,EA,y0,L0,q0,$0,hV,F0,B0,U0,H0,W0,V0,G0,Y0,z0,K0,Z0,tA,rA,J0,xa,iA,eh,nA,oA,cA,aA,lA,sA,uA,dA,fA,pA,hA,mA,gA,yA,TA,vA,bA,SA,_A,PA,kA].flatMap(async i=>await i({document:r,context:e,macro:n,position:t.position})))).flat():[]}function hV({macro:t}){return t.macro?pV.filter(e=>e.startsWith(t.macro)).map(e=>({label:`${e}(...)`,insertText:`${e}($1)`,kind:th.CompletionItemKind.Function,insertTextFormat:th.InsertTextFormat.Snippet})):[]}var Mn=q(U());function mV(t){if(!t||t.item===null||!(t.ast instanceof Qe))return[];let e=n=>n.replacedBy?e(n.replacedBy):n,r=n=>{let i=n.parent.deletedProperties.find(s=>s.property===n)?.by;return[n.ast,...n.allReplaced.map(s=>s.ast),...i?[i]:[]].map(s=>{let o=fr(s.fsPath);if(o)return Mn.Location.create(ue(o.fsPath),o.range);if(s instanceof Ee)return Mn.Location.create(ue(s.fsPath),ce(s.propertyName??s));if(s instanceof dt)return Mn.Location.create(ue(s.fsPath),ce(s.propertyName??s))}).filter(s=>s)};if(t.item instanceof et&&t.ast instanceof Qe)return r(e(t.item));if(t.item instanceof J&&t.ast instanceof Qe&&t.ast.parentNode instanceof dt){let n=t.item.deletedProperties.find(i=>i.by===t.ast.parentNode)?.property;if(n)return r(n)}return[]}function gV(t){if(!t)return[];let e=r=>{let i=t.runtime.rootNode.getNode("aliases")?.properties.filter(o=>{let a=o.ast.quickValues;if(a?.length===1&&typeof a[0]=="string"&&t.runtime.rootNode.getChild(a[0].split("/"))===r)return!0}).map(o=>o.ast)??[],s=r.parent?.deletedNodes.filter(o=>o.node===r&&(o.by.nodeNameOrRef instanceof je?o.by.nodeNameOrRef!==t.ast:!r.linkedRefLabels.some(a=>a!==t.ast))).map(o=>o.by.nodeNameOrRef)??[];return[...i,...r.linkedRefLabels,...r.linkedNodeNamePaths,...r.definitions,...s].map(o=>{let a=o&&fr(o?.fsPath);if(a)return Mn.Location.create(ue(a.fsPath),a.range);if(o instanceof nt)return Mn.Location.create(ue(o.fsPath),ce(o.name??o));if(o instanceof Ce)return Mn.Location.create(ue(o.fsPath),ce(o.name??o));if(o instanceof je)return Mn.Location.create(ue(o.fsPath),ce(o));if(o instanceof je)return Mn.Location.create(ue(o.fsPath),ce(o));if(o instanceof ie)return Mn.Location.create(ue(o.fsPath),ce(o.label??o));if(o instanceof Ee)return Mn.Location.create(ue((o.values??o)?.fsPath),ce(o.values??o))}).filter(o=>o)};if(t.item instanceof J&&!Zt(t.ast))return e(t.item);if(t.ast instanceof mr&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return e(t.ast.parentNode.linksTo);if(t.ast instanceof je&&t.ast.linksTo)return Zt(t.ast)?[...e(t.ast.linksTo),Mn.Location.create(ue(t.ast.fsPath),ce(t.ast))]:e(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof et&&t.item.parent.name==="aliases"){let r=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(r)return e(r)}return[]}async function DA(t,e){return Et(t,e,r=>[...gV(r),...mV(r)])}var es=q(U());function CA(t){if(!t||t.item===null||!(t.ast instanceof Qe))return[];let e=n=>n.replacedBy?e(n.replacedBy):n,r=n=>[n.ast,...n.allReplaced.map(i=>i.ast),n.parent.deletedProperties.find(i=>i.property===n)?.by??[]].map(i=>{if((i instanceof Ee||i instanceof dt)&&i.propertyName)return es.Location.create(ue(i.fsPath),ce(i.propertyName))}).filter(i=>i);if(t.item instanceof et&&t.ast instanceof Qe)return r(e(t.item));if(t.item instanceof J&&t.ast instanceof Qe&&t.ast.parentNode instanceof dt){let n=t.item.deletedProperties.find(i=>i.by===t.ast.parentNode)?.property;if(n)return r(n)}return[]}function AA(t,e){if(!e||!(e.ast instanceof mr))return[];"newName"in t&&(e.ast.parentNode instanceof ie&&t.newName.startsWith("&")?t.newName=t.newName.slice(1):e.ast.parentNode instanceof Ps&&t.newName.endsWith(":")&&(t.newName=t.newName.slice(0,-1)));let r=e.ast.value,n=i=>[...i.implementations.filter(s=>s instanceof Ce||s instanceof ot).flatMap(s=>s.labels.map(o=>o.label)),...i.linkedRefLabels.map(s=>s.label)].filter(s=>s?.value===r).map(s=>{if(s)return es.Location.create(ue(s.fsPath),ce(s))}).filter(s=>s);return e.item instanceof J&&!Zt(e.ast)?n(e.item):e.ast instanceof mr&&e.ast.parentNode instanceof ie&&e.ast.parentNode.linksTo?n(e.ast.parentNode.linksTo):[]}function IA(t){if(!t||!(t.ast instanceof je)||t.ast instanceof je&&t.ast.linksTo===t.runtime.rootNode)return[];let e=r=>{let i=t.runtime.rootNode.getNode("aliases")?.properties.filter(o=>{let a=o.ast.quickValues;if(a?.length===1&&typeof a[0]=="string"){let c=t.runtime.rootNode.getChild(a[0].split("/"));if(c?.isChildOf(r)||c===r)return!0}}).map(o=>o.ast)??[],s=r.parent?.deletedNodes.filter(o=>o.node===r&&o.by.nodeNameOrRef!==t.ast).map(o=>o.by.nodeNameOrRef)??[];return[...i,...r.linkedNodeNamePaths,...r.definitions,...s].map(o=>{if(o instanceof Ce&&o.name)return es.Location.create(ue(o.fsPath),ce(o.name));if(o instanceof je)return es.Location.create(ue(o.fsPath),ce(o));if(o instanceof Ee&&o.values?.values[0]?.value&&o.values?.values[0]?.value instanceof ne){let a=o.values.values[0].value,c=ce(a),l=a.value.split("/"),u=r.path,d=l.slice(0,u.length-1).join("/").length+1,f=a.value.length-l.slice(0,u.length).join("/").length;return c.start.character+=1+d,c.end.character-=1+f,es.Location.create(ue(o.values.values[0].fsPath),c)}}).filter(o=>o)};return t.item instanceof J&&!Zt(t.ast)?e(t.item):t.ast instanceof je&&t.ast.linksTo?Zt(t.ast)?[...e(t.ast.linksTo),es.Location.create(ue(t.ast.fsPath),ce(t.ast))]:e(t.ast.linksTo):[]}async function OA(t,e){let r={};return(await Et(t,e,i=>[...IA(i),...AA(t,i),...CA(i)])).forEach(i=>{r[i.uri]??=[],r[i.uri].push(es.TextEdit.replace(i.range,t.newName))}),{changes:r}}async function xA(t,e){let r=await Et(t,e,n=>[...IA(n),...AA(t,n),...CA(n)]);if(r.some(n=>e?.settings.lockRenameEdits?.some(i=>Ne(n.uri).startsWith(i))))throw new Error('Path is locked by user setting "lockRenameEdits"');if(r.some(n=>ki(n.uri)))throw new Error("Item was generated using a MACRO.");return{defaultBehavior:!!r.length}}var La=q(U());var Ma=t=>t.implementations.map(e=>{let r=fr(e.fsPath);return r?La.Location.create(ue(r.fsPath),r.range):La.Location.create(ue(e.fsPath),ce(e))}).filter(e=>e),MA=t=>t.replacedBy?MA(t.replacedBy):t,rh=t=>[t.ast,...t.allReplaced.map(e=>e.ast)].map(e=>{let r=fr(e.fsPath);return r?La.Location.create(ue(r.fsPath),r.range):La.Location.create(ue(e.fsPath),ce(e.propertyName??e))}).filter(e=>e);function yV(t){if(!t||t.item===null||!(t.ast instanceof Qe))return[];if(t.item instanceof et&&t.ast instanceof Qe)return rh(MA(t.item));if(t.item instanceof J&&t.ast instanceof Qe&&t.ast.parentNode instanceof dt){let e=t.item.deletedProperties.find(r=>r.by===t.ast.parentNode)?.property;if(e)return rh(e)}return[]}function TV(t){if(!t)return[];if(t.item instanceof J&&!Zt(t.ast))return Ma(t.item);if(t.ast instanceof mr&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return Ma(t.ast.parentNode.linksTo);if(t.ast instanceof je&&t.ast.linksTo)return Ma(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof et&&t.item.parent.name==="aliases"){let e=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(e)return Ma(e)}return[]}function vV(t){if(t?.ast instanceof vt||t?.ast instanceof Pi){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t.ast instanceof vt?t.ast.name:t.ast.value);if(e)return[La.Location.create(ue(e.macro.fsPath),ce(e.macro.identifier))]}return[]}async function LA(t,e){return Et(t,e,r=>[...TV(r),...yV(r),...vV(r)])}var bV=["DT_PROP","DT_PROP_LEN","DT_PROP_LEN_OR","DT_PROP_HAS_IDX","DT_PROP_HAS_NAME","DT_PROP_BY_IDX","DT_PROP_LAST","DT_PROP_OR","DT_ENUM_IDX_BY_IDX","DT_ENUM_IDX","DT_ENUM_IDX_BY_IDX_OR","DT_ENUM_IDX_OR","DT_ENUM_HAS_VALUE_BY_IDX","DT_ENUM_HAS_VALUE","DT_STRING_TOKEN","DT_STRING_TOKEN_OR","DT_STRING_UPPER_TOKEN","DT_STRING_UPPER_TOKEN_OR","DT_STRING_UNQUOTED","DT_STRING_UNQUOTED_OR","DT_STRING_TOKEN_BY_IDX","DT_STRING_UPPER_TOKEN_BY_IDX","DT_STRING_UNQUOTED_BY_IDX","DT_PROP_BY_PHANDLE_IDX","DT_PROP_BY_PHANDLE_IDX_OR","DT_PROP_BY_PHANDLE","DT_PHA_BY_IDX","DT_PHA_BY_IDX_OR","DT_PHA","DT_PHA_OR","DT_PHA_BY_NAME","DT_PHA_BY_NAME_OR","DT_PHANDLE_BY_NAME","DT_PHANDLE_BY_IDX","DT_PHANDLE"];async function nh({macro:t,document:e,context:r,position:n}){if(bV.some(i=>i===t.parent?.macro)&&t.argIndexInParent===1&&t.parent?.args?.[0])return(await M({document:e,context:r,position:n,macro:t.parent.args[0]}))?.properties.find(s=>Z(s.name)===t.macro);if(["DT_PROP_BY_PHANDLE"].some(i=>i===t.parent?.macro)&&t.argIndexInParent===2&&t.parent?.args?.[0]&&t.parent?.args?.[1])return(await Rs({document:e,context:r,position:n,macro:{macro:"DT_PHANDLE",args:t.parent.args.slice(0,2)}},M))?.properties.find(s=>Z(s.name)===t.macro);if(["DT_PROP_BY_PHANDLE_IDX","DT_PROP_BY_PHANDLE_IDX_OR"].some(i=>i===t.parent?.macro)&&t.argIndexInParent===3&&t.parent?.args?.[0]&&t.parent?.args?.[1]&&t.parent?.args?.[3])return(await Ci({document:e,context:r,position:n,macro:{macro:"DT_PHANDLE_BY_IDX",args:t.parent.args.slice(0,3)}},M))?.properties.find(s=>Z(s.name)===t.macro);if(["DT_CHOSEN","DT_HAS_CHOSEN"].some(i=>i===t.parent?.macro)&&t.argIndexInParent===0&&t.parent?.args?.[0])return(await r.getRuntime()).rootNode.getChild(["/","chosen"])?.properties.find(i=>Z(i.name)===t.macro)}async function qA(t,e,r){if(!r)return;let n=Qi(r,t.position);return $A(n,t.position,e,r)}async function $A(t,e,r,n){if(!t?.macro)return;let i=await M({document:n,macro:t,context:r,position:e});if(i)return Ma(i);let s=await nh({document:n,macro:t,context:r,position:e});if(s)return rh(s);let o=await ks(n,t.macro,e,r);if(o)return $A(o[0],o[1],r,n)}var Es=q(U());var qa=t=>{let e=t.definitions.at(0),r=e&&fr(e.fsPath);return r?Es.Location.create(ue(r.fsPath),r.range):e?Es.Location.create(ue(e.fsPath),ce(e)):void 0},ih=t=>t.replaces?ih(t.replaces):t,FA=t=>{let e=ih(t),r=fr(e.ast.fsPath);return r?Es.Location.create(ue(r.fsPath),r.range):e?Es.Location.create(ue(e.ast.fsPath),ce(e.ast)):void 0};function SV(t){if(!t||t.item===null||!(t.ast instanceof Qe))return;let e=r=>{let n=fr(r.ast.fsPath);return n?Es.Location.create(ue(n.fsPath),n.range):Es.Location.create(ue(r.ast.fsPath),ce(r.ast.propertyName??r.ast))};if(t.item instanceof et&&t.ast instanceof Qe)return e(ih(t.item));if(t.item instanceof J&&t.ast instanceof Qe&&t.ast.parentNode instanceof dt){let r=t.item.deletedProperties.find(n=>n.by===t.ast.parentNode)?.property;if(r)return e(ih(r))}}function _V(t){if(t){if(t.item instanceof J&&!Zt(t.ast))return qa(t.item);if(t.ast instanceof mr&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return qa(t.ast.parentNode.linksTo);if(t.ast instanceof je&&t.ast.linksTo)return qa(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof et&&t.item.parent.name==="aliases"){let e=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(e)return qa(e)}}}function PV(t){if(t?.ast instanceof vt||t?.ast instanceof Pi){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t.ast instanceof vt?t.ast.name:t.ast.value);if(e)return Es.Location.create(ue(e.macro.fsPath),ce(e.macro.identifier))}}async function BA(t,e){return(await Et(t,e,r=>[_V(r)||SV(r)||PV(r)])).at(0)}async function jA(t,e,r){if(!r)return;let n=Qi(r,t.position);return UA(n,t.position,e,r)}async function UA(t,e,r,n){if(!t?.macro)return;let i=await M({document:n,macro:t,context:r,position:e});if(i)return qa(i);let s=await nh({document:n,macro:t,context:r,position:e});if(s)return FA(s);let o=await ks(n,t.macro,e,r);if(o)return UA(o[0],o[1],r,n)}var de=q(U());var kV=(t,e,r,n,i)=>{switch(r){case 1:return[{title:"Add semicolon",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(n.range.end.line,n.range.end.character),";")]}}}];case 2:return[{title:"Add open curly",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(n.range.end.line,n.range.end.character)," {")]}}}];case 29:return[{title:"Remove white space",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(de.Range.create(de.Position.create(n.range.start.line,t.pos.colEnd),de.Position.create(n.range.end.line,e.pos.col)),"")]}}}];case 3:return[{title:"Add close curly",diagnostics:[n],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(n.range.end.line,n.range.end.character),"}")]}}}];case 19:return[{title:"Add '/'",diagnostics:[n],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(n.range.end.line,n.range.end.character),"/")]}}}];case 28:return[{title:"Add comma",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(n.range.end.line,n.range.end.character),",")]}}}];case 21:return[{title:"Add '/'",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(n.range.end.line,n.range.end.character),"/")]}}}];case 23:return[{title:"Remove ';'",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.del(n.range)]}}}];case 34:return[{title:"Complete Keyword '/delete-node/",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(n.range,"/delete-node/")]}}}];case 35:return[{title:"Complete Keyword '/delete-property/",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(n.range,"/delete-property/")]}}}];case 25:return[{title:"Complete Keyword '/delete-property/",diagnostics:[n],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(n.range,"/delete-property/")]}}},{title:"Complete Keyword '/delete-node/",diagnostics:[n],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.replace(n.range,"/delete-node/")]}}}];case 12:return[{title:"Add '>'",diagnostics:[n],kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[de.TextEdit.insert(de.Position.create(n.range.end.line,n.range.end.character),">")]}}}];default:return}},NV=(t,e,r,n,i)=>{if(!n?.length)return[];switch(t){case 0:return[{title:i??`Add Property "${n[0].newText.split("=",1)[0].replace(";","").trim()}"`,diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 27:return[{title:i??"Remove Property",diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 26:return[{title:i??"TODO",diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 36:return[{title:i??"TODO",diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 25:return n?[{title:i??"TODO",diagnostics:[e],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}]:[];default:return}},RV=(t,e,r,n)=>r?.length?[{title:n??"TODO",diagnostics:[t],kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[e]:r}}}]:[];function HA(t){let e=t.context.diagnostics.flatMap(a=>{let c=a.data;if(c?.virtual)return[];switch(c?.type){case"FormattingIssues":return RV(a,t.textDocument.uri,c.edit?Array.isArray(c.edit)?c.edit:[c.edit]:void 0,c.codeActionTitle);case"SyntaxIssue":return c?.items.flatMap(l=>kV(c.firstToken,c.lastToken,l,a,t.textDocument.uri));case"StandardTypeIssue":return c?.items.flatMap(l=>NV(l,a,t.textDocument.uri,c.edit?Array.isArray(c.edit)?c.edit:[c.edit]:void 0,c.codeActionTitle))}}).filter(a=>!!a),r=e.filter(a=>a.kind===de.CodeActionKind.SourceFixAll),n=e.filter(a=>a.title.startsWith("Add Property")),i=e.filter(a=>a.kind!==de.CodeActionKind.SourceFixAll),s=r.flatMap(a=>a.edit?.changes?.[t.textDocument.uri]??[]),o=new Map;return n.forEach(a=>{let c=a.edit.changes[t.textDocument.uri][0],l=c.range.start.line,u=c.range.start.character;o.has(`${l}:${u}`)||o.set(`${l}:${u}`,[]),o.get(`${l}:${u}`)?.push(c)}),[...i,...r.map(a=>({...a,kind:de.CodeActionKind.QuickFix})),...s.length?[{title:"Fix All",kind:de.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[t.textDocument.uri]:s}}}]:[],...Array.from(o.values()).flatMap(a=>a.length>1?{title:"Add All Missing Properties",kind:de.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[t.textDocument.uri]:a}}}:[])]}var ee=q(U());function VA(t,e){return t.line<e.line?-1:t.line>e.line?1:t.character<e.character?-1:t.character>e.character?1:0}var Sl=(t,e)=>e.some(r=>VA(t,r.start)>=0&&VA(t,r.end)<=0),EV=async(t,e,r)=>{let n=ht.create(t.pos.line,t.pos.col),i=r.find(s=>Qt(s,e,n));if(i)return ti(i,e,n)},bn=(t,e)=>{let r=ht.create(e.length-1,e.at(-1)?.length??0),n=[],i;return t.filter(o=>(o instanceof Tn||o instanceof vn)&&/^dts-format (on|off)$/.test(o.toString().trim())).sort((o,a)=>o.firstToken.pos.line-a.firstToken.pos.line).forEach(o=>{let a=o.toString().trim();if(a==="dts-format off")i={start:ht.create(o.firstToken.pos.line,o instanceof Tn?o.firstToken.pos.colEnd:0)};else if(a==="dts-format on"&&i){let c=ht.create(o.lastToken.pos.line,o instanceof Tn?o.lastToken.pos.colEnd-1:e[o.lastToken.pos.line-1].length);n.push(Ze.create(i.start,c)),i=void 0}}),i&&n.push(Ze.create(i.start,r)),n},$a=async(t,e,r)=>(await dv(t,e,r))?.allAstItems,dv=async(t,e,r)=>{if(e!==r){let n=new xn(t,[],void 0,()=>new rn(r,t).tokens,!0);return await n.stable,n}},Sn=(t,e,r)=>{let n=t.length?r.filter(i=>(Array.isArray(i.raw.edit)?i.raw.edit:i.raw.edit?[i.raw.edit]:void 0)?.every(o=>!Sl(o.range.start,t)&&!Sl(o.range.end,t))):r;return"range"in e&&(n=n.filter(i=>po(e.range,i.raw.range))),n},Fa=(t,e)=>async r=>{let n=t.filter(a=>!(a instanceof ni)&&!(a instanceof vn)&&!(a instanceof Tn)&&!(a instanceof On)),i=await EV(r.firstToken,e,n);if(!i||i===r||r.allDescendants.some(a=>a===i))return{level:0};let s=ba(i);return{level:Sa(e,s),inAst:i}},Fr=(t,e)=>{if(t.insertSpaces)return"".padStart(e," ");let r=Math.floor(e/t.tabSize),n=e%t.tabSize;return`${"".padStart(r," ")}${"".padStart(n," ")}`},Ln=(t,e,r="")=>`${"".padStart(t*e.length,e)}${r}`,WA=t=>{let e=t.parentNode;if(!(!e||!(e instanceof ge)))return!(e instanceof nr)||!e.openBracket?WA(e):e};function vo(t,e,r,n,i,s,o=!1){if(!o&&hr(e.firstToken,t.firstToken))return n[e.firstToken.pos.line].slice(0,e.firstToken.pos.col).replace(/^\s+/,f=>f.replace(/\t/g," ".repeat(r.tabSize))).length-r.tabSize*i;let a=WA(e);if(!a)return s;let l=vo(t,a,r,n,i,s);return!o&&hr(e.firstToken,a.firstToken)?l+=e.firstToken.pos.col-a.firstToken.pos.col:a instanceof nr&&a.openBracket&&++l,l}var oi=(t,e,r)=>t[e]??r,sh=t=>({baseFormattingRules:oi(t,"baseFormattingRules",!0),removeMacroMultiline:oi(t,"removeMacroMultiline",!0),wrapLongLines:oi(t,"wrapLongLines",!0),indentExpressions:oi(t,"indentExpressions",!0),removeEmptyReferences:oi(t,"removeEmptyReferences",!0),removeEmptyRoots:oi(t,"removeEmptyRoots",!1),removeEmptyNodes:oi(t,"removeEmptyNodes",!1),removeDuplicateProperties:oi(t,"removeDuplicateProperties",!0),sortNodesAndProperties:oi(t,"sortNodesAndProperties",!1),sortNodesNodesBy:oi(t,"sortNodesNodesBy","none"),sortPropertiesAlphabetically:oi(t,"sortPropertiesAlphabetically",!1)});var $t=q(U());function ws(t,e,r,n){if(!hr(t,e)){let o=e.prevToken;for(;t!==o;){if(o&&hr(t,o)&&ws(t,o,r,n))return!0;o=o?.prevToken}return null}return n[t.pos.line].slice(0,e.pos.colEnd).replace(/^\s+/,o=>o.replace(/\t/g," ".repeat(r.tabSize))).length>r.wordWrapColumn}async function fv(t,e,r,n,i,s,o=[]){let a=n.split(`
307
307
  `),c=bn(e,a),l=n;o.push(...await wV(t,e,r,a,s));let u=Sn(c,t,o);switch(l=Zr(Lt.create(r,"devicetree",0,n),u),i){case"New Text":return l;case"File Diagnostics":return u}}async function wV(t,e,r,n,i){let s=Fa(e,r);return(await Promise.all(e.flatMap(async a=>await GA(t,a,r,s,n,i)))).flat()}var GA=async(t,e,r,n,i,s,o=0)=>{let a=t.options.tabSize,c=t.options.insertSpaces,l=c?" ".repeat(a):" ",u={tabSize:a,insertSpaces:c,singleIndent:l,wordWrapColumn:t.options.wordWrapColumn};return e instanceof De?DV(t,e,r,o,u,s,i,n):e instanceof Ee?AV(e,o,u,s,i,l):[]},DV=async(t,e,r,n,i,s,o,a)=>{let c=[];if(e instanceof Ce||e instanceof ot){let l=await CV(e.labels,n,i,o,i.singleIndent);if(l.length>0)c.push(...l);else{let u=e instanceof Ce?e.name:e.reference;u&&ws(u.firstToken,e.openScope??u.lastToken,i,o)&&c.push(ze(8,r,se(u.firstToken,!1),{edit:[$t.TextEdit.replace($t.Range.create(se(u.firstToken.prevToken),se(u.firstToken,!1)),`
308
308
  ${Ln(n,i.singleIndent)}`)],codeActionTitle:`Move ...${u.toString()}... to a new line`}))}}return c.push(...(await Promise.all(e.children.flatMap(l=>GA(t,l,r,a,o,s,n+1)))).flat()),c},CV=(t,e,r,n,i)=>{let s=t.findIndex(c=>ws(c.firstToken,c.lastToken,r,n));if(s===-1)return[];let o=t[s],a=t.find((c,l)=>l>s&&c.firstToken.pos.line!==o.lastToken.pos.line);return[ze(8,o.firstToken.fsPath,se(o.firstToken,!1),{edit:[$t.TextEdit.replace($t.Range.create(se(o.firstToken.prevToken),se(o.firstToken,!1)),`
309
309
  ${Ln(e,i)}`),...a?[$t.TextEdit.replace($t.Range.create(se(a.firstToken.prevToken),se(a.firstToken,!1))," ")]:[]],codeActionTitle:`Move ...${o.toString()}... to a new line`})]},AV=(t,e,r,n,i,s)=>ws(t.firstToken,t.lastToken,r,i)===!1?[]:t.values?IV(t.propertyName?.name.length??0,t.values,e,r,n,i,s,t.lastToken):[],IV=(t,e,r,n,i,s,o,a)=>{for(let[c,l]of e.values.entries()){if(!l)continue;let u=OV(t,l,e.values,c,r,n,i,s,o,c===e.values.length-1&&l.lastToken.nextToken===a?a:void 0);if(u)return u}return[]},oh=t=>t instanceof ut||t instanceof Lr&&t.openBracket?t.openBracket??t.firstToken:t.firstToken,OV=(t,e,r,n,i,s,o,a,c,l)=>{let u=e.nextValueSeparator??l??e.lastToken,d=ws(e.firstToken,u,s,a);if(d===!1)return;if(d===null){let v=e.value;return v instanceof ut||v instanceof Lr?zA(e,t,v,i,s,o,a,c,u):v instanceof ge?ah(e,t,v,i,s,o,a,c):[]}let f=a[e.firstToken.pos.line].substring(0,e.firstToken.pos.col),p=s.insertSpaces?t+3:Math.trunc((t+3)/s.tabSize),m=s.insertSpaces?0:(t+3)%s.tabSize,h=p+m+(s.insertSpaces?i*s.tabSize:i),y=f.trimStart()!==""?(s.insertSpaces?i*s.tabSize:i)+t+3:h;if(e.firstToken.pos.col===y){let v=e.value;return v instanceof ut||v instanceof Lr?zA(e,t,v,i,s,o,a,c,u):v instanceof ge?ah(e,t,v,i,s,o,a,c):void 0}let S=r.slice(n).find(v=>v?.firstToken.pos.line!==e.firstToken.pos.line);return[ze(8,e.firstToken.fsPath,se(e.firstToken,!1),{edit:[$t.TextEdit.replace($t.Range.create(se(e.firstToken.prevToken),se(e.firstToken,!1)),`
@@ -314,23 +314,23 @@ ${Ln(n,a,Fr(i,$))}`),...j?[$t.TextEdit.replace($t.Range.create(se(j.expression.f
314
314
  `),a=bn(e,o),c=n,l=await xV(t,o,e,r,s),u=Sn(a,t,l);switch(c=Zr(Lt.create(r,"devicetree",0,n),u),i){case"New Text":return c;case"File Diagnostics":return u}}async function xV(t,e,r,n,i){let s=Fa(r,n);return(await Promise.all(r.flatMap(async a=>await YA(t,e,a,n,s,i)))).flat()}var YA=async(t,e,r,n,i,s,o=0)=>{let a=t.options.tabSize,c=t.options.insertSpaces,l=c?" ".repeat(a):" ",u={tabSize:a,insertSpaces:c,singleIndent:l,wordWrapColumn:t.options.wordWrapColumn};return r instanceof De?MV(t,e,r,n,o,s,i):r instanceof Ee?LV(r,o,u,e,l):[]},MV=async(t,e,r,n,i,s,o)=>{let a=[];return a.push(...(await Promise.all(r.children.flatMap(c=>YA(t,e,c,n,o,s,i+1)))).flat()),a},LV=(t,e,r,n,i)=>t.firstToken.pos.line===t.lastToken.pos.line?[]:t.values?qV(t.propertyName?.name.length??0,t.values,e,r,n,i):[],qV=(t,e,r,n,i,s)=>e.values.flatMap(o=>o?$V(t,o,r,n,i,s):[]),$V=(t,e,r,n,i,s)=>{let o=e.value;return o instanceof ut?BV(e,t,o,r,n,i,s)??[]:o instanceof Gt?ch(e,t,o,n,i,s,r):[]},ch=(t,e,r,n,i,s,o)=>{let a=vo(t,r,n,i,o,e+4);return r.params.flatMap(c=>FV(c,n,i,s,o,a+r.functionName.name.length+1))},FV=(t,e,r,n,i,s)=>{if(!t)return[];let o=t.firstToken.value==="\\"?t.firstToken.nextToken:t.firstToken;if(!o||o.pos.line===o.prevToken?.pos.line)return[];let a=r[o?.pos.line].slice(0,o.pos.col),c=Ln(i,n,Fr(e,s));if(a===c)return[];let l=ai.Position.create(o.pos.line,0),u=ai.Position.create(o.pos.line,o.pos.col),d=ai.Range.create(l,u),f=ai.TextEdit.replace(d,c);return[ze(5,t.fsPath,l,{edit:f,codeActionTitle:"Fix indentation",templateStrings:[c.replaceAll(" ","\xB7").replaceAll(" ","\u2192")]},u)]},BV=(t,e,r,n,i,s,o)=>{for(let[a,c]of r.values.entries()){if(c.value instanceof nr){let u=new Map;return c.value.allDescendants.forEach(f=>{f instanceof ge&&!(f.parentNode instanceof Gt)&&u.set(f.firstToken,f)}),Array.from(u.values()).flatMap(f=>jV(t,e,f,i,s,o,n))}if(c.value instanceof Gt)return ch(t,e,c.value,i,s,o,n)}return[]},jV=(t,e,r,n,i,s,o)=>{if(r.firstToken.pos.line===r.firstToken.prevToken?.pos.line)return r instanceof Gt?ch(t,e,r,n,i,s,o):[];let a=vo(t,r,n,i,o,e+4);if(!a)return[];let c=Ln(o,s,Fr(n,a));if(i[r.firstToken.pos.line].slice(0,r.firstToken.pos.col)===c)return r instanceof Gt?ch(t,e,r,n,i,s,o):[];let u=ai.Position.create(r.firstToken.pos.line,0),d=ai.Position.create(r.firstToken.pos.line,r.firstToken.pos.col),f=ai.Range.create(u,d),p=ai.TextEdit.replace(f,c);return[ze(5,r.fsPath,u,{edit:p,codeActionTitle:"Fix indentation",templateStrings:[c.replaceAll(" ","\xB7").replaceAll(" ","\u2192")]},d)]};var KA=q(U());async function hv(t,e,r,n,i,s){let o=n.split(`
315
315
  `),a=bn(e,o),c=n,l=await UV(e,s),u=Sn(a,t,l);switch(c=Zr(Lt.create(r,"devicetree",0,n),u),i){case"New Text":return c;case"File Diagnostics":return u}}async function UV(t,e){return(await Promise.all(t.flatMap(r=>[r,...r.allDescendants]).flatMap(async r=>{if(e.removeEmptyReferences&&r instanceof ot&&!r.labels.length&&r.openScope?.nextToken===r.closeScope||e.removeEmptyNodes&&r instanceof Ce&&!r.labels.length&&r.openScope?.nextToken===r.closeScope||e.removeEmptyRoots&&r instanceof nt&&r.openScope?.nextToken===r.closeScope){let n=r.topComment?.firstToken??r.firstToken,i=r.endComment?.lastToken??r.lastToken;return n.prevToken?.prevToken&&(n.prevToken.prevToken.nextToken=void 0),i.nextToken&&(i.nextToken=void 0),[ze(13,r.fsPath,se(n,!1),{edit:KA.TextEdit.del(sr(n.prevToken,i,!n.prevToken)),codeActionTitle:"Delete node"},se(i))]}}))).flat().filter(r=>!!r)}var mv=q(U());async function gv(t,e,r,n,i,s){let o=n.split(`
316
316
  `),a=bn(e,o),c=n,l=await HV(e,s),u=Sn(a,t,l);switch(c=Zr(Lt.create(r,"devicetree",0,n),u),i){case"New Text":return c;case"File Diagnostics":return u}}async function HV(t,e){return(await Promise.all(t.flatMap(r=>[r,...r.allDescendants]).flatMap(async r=>{if(e.removeEmptyReferences&&r instanceof De){let n=new Map;return r.children.forEach((i,s)=>{if(i instanceof Ee){let o=i.propertyName.name,a=n.get(o);a||(a=[],n.set(o,a));let c;for(let l=s+1;l<r.children.length;l++){let u=r.children[l];if(u instanceof Ee&&u.propertyName.name===o)break;if(u instanceof dt){c=u;break}}a.push({property:i,delete:c})}}),Array.from(n.values()).flatMap(i=>{if(i.length>1)return i.slice(0,-1).flatMap(s=>{let o=s.property.topComment?.firstToken??s.property.firstToken,a=s.property.endComment?.lastToken??s.property.lastToken,c=[];if(c.push(mv.TextEdit.del(sr(o.prevToken,a,!o.prevToken))),s.delete){let l=s.delete.firstToken,u=s.delete.lastToken;c.push(mv.TextEdit.del(sr(l.prevToken,u,!l.prevToken)))}return ze(14,s.property.fsPath,se(o,!1),{edit:c,codeActionTitle:"Delete property"},se(a))})})}}))).flat().filter(r=>!!r)}async function lh(t,e,r,n,i,s,o){let a=n.split(`
317
- `),c=bn(e,a),l=e.flatMap(d=>d instanceof De?QA(t,d,r,s,o,a,c):[]),u=Zr(Lt.create(r,"devicetree",0,n),Sn(c,t,l));if(l.flatMap(d=>d.raw.edit).filter(d=>!!d).length){let d=new xn(r,[],void 0,()=>new rn(u,r).tokens,!0);switch(await d.stable,i){case"New Text":return lh(t,d.allAstItems,r,u,"New Text",d.includes,d.cPreprocessorParser.allAstItems.filter(f=>f instanceof On));case"File Diagnostics":return l}}switch(i){case"New Text":return u;case"File Diagnostics":return l}}function QA(t,e,r,n,i,s,o){if(i.some(f=>Qt(e,r,ht.create(f.firstToken.pos.line,f.firstToken.pos.col))||Qt(e,r,ht.create(f.lastToken.pos.line,f.lastToken.pos.colEnd))))return[];let a=[{prop:[],nodes:[],asFound:[]}],c=[],l=n.filter(f=>Qt(e,r,ht.create(f.firstToken.pos.line,f.firstToken.pos.col)));e.children.forEach(f=>{let p=l.filter(m=>Ss(f.firstToken,r,ht.create(m.firstToken.pos.line,m.firstToken.pos.col)));p.length!==l.length&&l.length&&(a.push({prop:[],nodes:[],asFound:[]}),l=p),f instanceof Ee?(a.at(-1)?.prop.push(f),a.at(-1)?.asFound.push(f)):f instanceof Ce?(a.at(-1)?.nodes.push(f),a.at(-1)?.asFound.push(f)):f instanceof pr&&a.push({prop:[],nodes:[],asFound:[]})});let u=f=>({start:f.topComment??f,end:f.endComment??f}),d=sh(t.options);return a.forEach(f=>{let p=[...f.prop].sort((N,$)=>VV(N,$,d.sortPropertiesAlphabetically)),m=d.sortNodesNodesBy?[...f.nodes].sort((N,$)=>d.sortNodesNodesBy==="name"?N.name?.value.localeCompare($.name?.value??"")??0:d.sortNodesNodesBy==="address"?qt(N.name?.address?.at(0)?.address??[0],$.name?.address?.at(0)?.address??[0]):0):[...f.nodes],h=[...p,...m];if(!h.length||h.every((N,$)=>!h.at($+1)||Ss(N.lastToken,r,ht.create(h.at($+1).firstToken.pos.line,h.at($+1).firstToken.pos.col))))return;let{start:y}=u(f.asFound[0]),S=ht.create(y.firstToken.prevToken?.pos.line??y.firstToken.pos.line,y.firstToken.prevToken?.pos.colEnd??y.firstToken.pos.col),v=h.map(N=>{let{start:$,end:j}=u(N),L=$.firstToken.prevToken?.pos.line??$.firstToken.pos.line,ye=$.firstToken.prevToken?.pos.colEnd??$.firstToken.pos.col,qe=j.lastToken.pos.line,pe=j.lastToken?.pos.colEnd,Pe=L===qe,ur="";if(Pe)ur=s[L].slice(ye,pe);else{let _r=s.slice(L,qe+1);_r[0]=_r[0].slice(ye),_r[_r.length-1]=_r[_r.length-1].slice(0,pe),ur=_r.join(`
317
+ `),c=bn(e,a),l=e.flatMap(d=>d instanceof De?QA(t,d,r,s,o,a,c):[]),u=Zr(Lt.create(r,"devicetree",0,n),Sn(c,t,l));if(l.flatMap(d=>d.raw.edit).filter(d=>!!d).length){let d=new xn(r,[],void 0,()=>new rn(u,r).tokens,!0);switch(await d.stable,i){case"New Text":return lh(t,d.allAstItems,r,u,"New Text",d.includes,d.cPreprocessorParser.allAstItems.filter(f=>f instanceof On));case"File Diagnostics":return l}}switch(i){case"New Text":return u;case"File Diagnostics":return l}}function QA(t,e,r,n,i,s,o){if(i.some(f=>Qt(e,r,ht.create(f.firstToken.pos.line,f.firstToken.pos.col))||Qt(e,r,ht.create(f.lastToken.pos.line,f.lastToken.pos.colEnd))))return[];let a=[{prop:[],nodes:[],asFound:[]}],c=[],l=n.filter(f=>Qt(e,r,ht.create(f.firstToken.pos.line,f.firstToken.pos.col)));e.children.forEach(f=>{let p=l.filter(m=>_s(f.firstToken,r,ht.create(m.firstToken.pos.line,m.firstToken.pos.col)));p.length!==l.length&&l.length&&(a.push({prop:[],nodes:[],asFound:[]}),l=p),f instanceof Ee?(a.at(-1)?.prop.push(f),a.at(-1)?.asFound.push(f)):f instanceof Ce?(a.at(-1)?.nodes.push(f),a.at(-1)?.asFound.push(f)):f instanceof pr&&a.push({prop:[],nodes:[],asFound:[]})});let u=f=>({start:f.topComment??f,end:f.endComment??f}),d=sh(t.options);return a.forEach(f=>{let p=[...f.prop].sort((N,$)=>VV(N,$,d.sortPropertiesAlphabetically)),m=d.sortNodesNodesBy?[...f.nodes].sort((N,$)=>d.sortNodesNodesBy==="name"?N.name?.value.localeCompare($.name?.value??"")??0:d.sortNodesNodesBy==="address"?qt(N.name?.address?.at(0)?.address??[0],$.name?.address?.at(0)?.address??[0]):0):[...f.nodes],h=[...p,...m];if(!h.length||h.every((N,$)=>!h.at($+1)||_s(N.lastToken,r,ht.create(h.at($+1).firstToken.pos.line,h.at($+1).firstToken.pos.col))))return;let{start:y}=u(f.asFound[0]),S=ht.create(y.firstToken.prevToken?.pos.line??y.firstToken.pos.line,y.firstToken.prevToken?.pos.colEnd??y.firstToken.pos.col),v=h.map(N=>{let{start:$,end:j}=u(N),L=$.firstToken.prevToken?.pos.line??$.firstToken.pos.line,ye=$.firstToken.prevToken?.pos.colEnd??$.firstToken.pos.col,qe=j.lastToken.pos.line,pe=j.lastToken?.pos.colEnd,Pe=L===qe,ur="";if(Pe)ur=s[L].slice(ye,pe);else{let _r=s.slice(L,qe+1);_r[0]=_r[0].slice(ye),_r[_r.length-1]=_r[_r.length-1].slice(0,pe),ur=_r.join(`
318
318
  `)}return{delete:Ni.del(Ze.create(ht.create(L,ye),ht.create(qe,pe))),insert:Ni.insert(S,ur),item:N,text:ur}}),b=o.length?v.filter(N=>!Sl(N.delete.range.start,o)&&!Sl(N.delete.range.end,o)):v,P=e instanceof ot?e.reference:e instanceof Ce||e instanceof nt?e.name:void 0;b.length&&c.push(ze(15,r,se(P?.firstToken??e.firstToken,!1),{edit:v.length===b.length?[...b.map(N=>N.delete),Ni.insert(S,b.map(N=>N.text).join(""))]:[],codeActionTitle:`Sort child items. Expected order: ${h.map(N=>N instanceof Ee?`${N.propertyName.name}`:`${N.path?.at(-1)} { ... };`).join(", ")}`},se(P?.lastToken??e.openScope??e.firstToken)))}),c.length?c:e.children.flatMap(f=>f instanceof De?QA(t,f,r,n,i,s,o):[])}var XA={compatible:0,reg:1,ranges:2,status:99};function JA(t){return XA.hasOwnProperty(t)?XA[t]:t.includes(",")?4:3}function VV(t,e,r){let n=JA(t.propertyName?.name??""),i=JA(e.propertyName?.name??"");return n!==i?n-i:r?t.propertyName.name.localeCompare(e.propertyName.name):0}var ZA=(t,e,r)=>!!t.split(`
319
319
  `).find(n=>n.replace(/^\s+/,i=>i.replace(/\t/g," ".repeat(e))).trimEnd().length>r);async function Ai(t,e,r,n,i=[],s=[]){let o=Ne(t.textDocument.uri);n??=new rn(e,o).tokens;let a=[...n],c=new xn(o,[],void 0,()=>n,!0);await c.stable,t.options.tabSize??=8,t.options.insertSpaces??=!1;let l=c.issues.filter(m=>ho(m.raw,o,!1));if(l?.length)throw new ee.ResponseError(ee.ErrorCodes.InternalError,"Unable to format. File has syntax issues.",l.map(m=>m.diagnostic()));let u=typeof t.options.wordWrapColumn=="number"?t.options.wordWrapColumn:100,d=[];if(r==="File Diagnostics")d=await eI({...t,options:{...t.options,wordWrapColumn:u}},c,i,s,a,e);else if(r==="New Text"){let m=[{removeMacroMultiline:!0,removeEmptyReferences:!0,removeDuplicateProperties:!0,baseFormattingRules:!1,wrapLongLines:!1,indentExpressions:!1},{baseFormattingRules:!0,wrapLongLines:!1,indentExpressions:!1,removeMacroMultiline:!1,removeEmptyReferences:!1,removeEmptyNodes:!1,removeEmptyRoots:!1,removeDuplicateProperties:!1},{wrapLongLines:!0,indentExpressions:!1,baseFormattingRules:!1,removeMacroMultiline:!1,removeEmptyReferences:!1,removeEmptyNodes:!1,removeEmptyRoots:!1,removeDuplicateProperties:!1},{indentExpressions:!0,wrapLongLines:!1,baseFormattingRules:!1,removeMacroMultiline:!1,removeEmptyReferences:!1,removeEmptyNodes:!1,removeEmptyRoots:!1,removeDuplicateProperties:!1}],h=Lt.create(o,"devicetree",0,e);for(let y of m){let S=await eI({...t,options:{wordWrapColumn:u,...t.options,...y}},c,i,s,a,e);if(!S.length)continue;let v=Zr(h,S);return Ai(t,v,r)}}let f=sh(t.options);if(r==="New Text"){let m=e;if(f.removeMacroMultiline&&(m=await tI({...t,options:{...t.options,wordWrapColumn:u}},o,e,c,r)),f.removeDuplicateProperties){let h="";do{h=m;let y=await $a(o,e,h)??c.allAstItems;m=await gv({...t,options:{...t.options,wordWrapColumn:u}},y,o,m,r,f)}while(m!==h)}if(f.sortNodesAndProperties){let h="";do{h=m;let y=await dv(o,e,h)??c;m=await lh({...t,options:{...t.options,wordWrapColumn:u}},y.allAstItems,o,m,r,y.includes,i)}while(m!==h)}if(f.removeEmptyReferences||f.removeEmptyRoots||f.removeEmptyNodes){let h="";do{h=m;let y=await $a(o,e,h)??c.allAstItems;m=await hv({...t,options:{...t.options,wordWrapColumn:u}},y,o,m,r,f)}while(m!==h)}if(f.baseFormattingRules){let h=await $a(o,e,m)??c.allAstItems,y=await rI({...t,options:{...t.options,wordWrapColumn:u}},h,c.includes,i,o,m,r,f,d);d=[],m=y}if(f.indentExpressions){let h=await $a(o,e,m)??c.allAstItems;m=await pv({...t,options:{...t.options,wordWrapColumn:u}},h,o,m,r,f)}if(f.wrapLongLines&&ZA(m,t.options.tabSize,u)){let h="";do{h=m;let y=await $a(o,e,h)??c.allAstItems;m=await fv({...t,options:{...t.options,wordWrapColumn:u}},y,o,h,"New Text",f,[...d])}while(h!==m)}return m}let p=[];if(f.removeMacroMultiline){let m=await tI({...t,options:{...t.options,wordWrapColumn:u}},o,e,c,r);p.push(...m)}if(f.removeDuplicateProperties){let m=await gv({...t,options:{...t.options,wordWrapColumn:u}},c.allAstItems,o,e,r,f);p.push(...m)}if(f.sortNodesAndProperties){let m=await lh({...t,options:{...t.options,wordWrapColumn:u}},c.allAstItems,o,e,r,c.includes,i);p.push(...m)}if(f.removeEmptyReferences||f.removeEmptyRoots||f.removeEmptyNodes){let m=await hv({...t,options:{...t.options,wordWrapColumn:u}},c.allAstItems,o,e,r,f);p.push(...m)}if(f.baseFormattingRules){let m=await rI({...t,options:{...t.options,wordWrapColumn:u}},c.allAstItems,c.includes,i,o,e,r,f,[...d]);p.push(...m)}if(f.indentExpressions){let m=await pv({...t,options:{...t.options,wordWrapColumn:u}},c.allAstItems,o,e,r,f);p.push(...m)}return f.wrapLongLines&&ZA(e,t.options.tabSize,u)&&p.push(...await fv({...t,options:{...t.options,wordWrapColumn:u}},c.allAstItems,o,e,r,f,[...d])),p.filter(m=>!m.raw.virtual)}var eI=async(t,e,r,n,i,s)=>{let o=e.cPreprocessorParser.allAstItems.filter(u=>u instanceof On),a=[...o.flatMap(u=>{let d=u.ifBlocks.find(p=>p.active),f=u.ifBlocks.filter(p=>!p.active).map(p=>({block:u,branch:p}));return d&&u.elseOption&&f.push({block:u,branch:u.elseOption}),f})];"range"in t?(a=a.filter(u=>po(t.range,u.block.range)),r.push(...o.filter(u=>po(t.range,u.range)))):r.push(...o);let c=u=>{let d=u.block.getInValidTokenRangeWhenActiveBlock(u.branch),f=i.filter(m=>!d.has(m)),p=u.block.range;return n.push(u.branch),Ai({...t,range:p,options:{...t.options,sortNodesAndProperties:!1}},s,"File Diagnostics",f,r,n)},l=[];return await a.reduce((u,d)=>u.then(async()=>{l.push(...await c(d))}),Promise.resolve()),l};async function tI(t,e,r,n,i){let s=r.split(`
320
320
  `),o=[],a=new Set;Array.from(n.cPreprocessorParser.macros.values()).filter(d=>d.macro.firstToken.pos.line!==d.macro.lastToken.pos.line).forEach(d=>{Array.from({length:d.macro.lastToken.pos.line-d.macro.firstToken.pos.line+1},(f,p)=>d.macro.firstToken.pos.line+p).forEach(f=>a.add(f))}),s.forEach((d,f)=>{if(d.trimEnd().endsWith("\\")&&!a.has(f)){let p=d.slice(0,d.lastIndexOf("\\")-1).trimEnd(),m=ee.Range.create(ee.Position.create(f,p.length),ee.Position.create(f,d.length));o.push(ze(12,e,m.start,{edit:ee.TextEdit.del(m),codeActionTitle:"Remove \\"},m.end))}});let c=bn(n.allAstItems,s),l=Sn(c,t,o),u=Zr(Lt.create(e,"devicetree",0,r),l);switch(i){case"New Text":return u;case"File Diagnostics":return o}}async function rI(t,e,r,n,i,s,o,a,c=[]){let l=s.split(`
321
321
  `),u=bn(e,l),d=s;c.push(...await WV(t,e,r,n,i,l,a));let f=Sn(u,t,c);switch(d=Zr(Lt.create(i,"devicetree",0,s),f),o){case"New Text":return d;case"File Diagnostics":return f}}async function WV(t,e,r,n,i,s,o){let a=Fa(e,i),c=(await Promise.all(e.flatMap(async u=>await sI(t,u,i,a,s,r,n,o)))).flat();if(t.options.insertFinalNewline&&s.at(-1)?.trim()!==""){let u=ee.TextEdit.insert(ee.Position.create(s.length,s[s.length-1].length),`
322
322
  `);c.push(ze(4,i,ee.Position.create(s.length,0),{edit:u,codeActionTitle:"Insert new line"}))}if(t.options.trimFinalNewlines){let u=0;for(;s.at(-(1+u))?.trim()==="";)u++;if(u>1){let d=s.length-1,f=ee.TextEdit.del(ee.Range.create(ee.Position.create(s.length-u,0),ee.Position.create(d,0)));c.push(ze(3,i,ee.Position.create(d,0),{edit:f,codeActionTitle:"Remove trailing EOF lines"}))}}let l=c.flatMap(u=>u.raw.edit).filter(u=>!!u);if(t.options.trimTrailingWhitespace){let u=zV(s,l,i);c.push(...u)}return c}var zV=(t,e,r)=>{let n=[];return t.forEach((i,s)=>{let o=i.endsWith("\r")?i.slice(0,-1):i,a=o.trimEnd();if(a.length!==o.length){let c=ee.Range.create(ee.Position.create(s,a.length),ee.Position.create(s,o.length));e.some(l=>Yw(c,l.range))||n.push(ze(2,r,c.start,{edit:ee.TextEdit.del(c),codeActionTitle:"Remove whitespace"},c.end))}}),n},dh=(t,e=1,r=!1,n=t.prevToken)=>{if(n){let i=t.pos.line-n.pos.line,s=i-e;if(s&&(i!==2&&e!==0||e===0||r)){let o=ee.Position.create(n.pos.line,n.pos.colEnd),a=ee.Position.create(t.pos.line,e?0:t.pos.col),c=ee.TextEdit.replace(ee.Range.create(o,a),`
323
323
  `.repeat(e));return ze(1,t.fsPath,o,{edit:c,codeActionTitle:s<0?"Insert new lines":"Remove unnecessary new lines",templateStrings:[e.toString()]},a)}}else if(t.pos.line){let i=ee.Position.create(0,0),s=ee.Position.create(t.pos.line,0),o=ee.TextEdit.del(ee.Range.create(i,s));return ze(1,t.fsPath,i,{edit:o,codeActionTitle:"Remove unnecessary new lines",templateStrings:["0"]},s)}},nI=(t,e,r,n="",i=1)=>{let s=t.pos.line===t.prevToken?.pos.line;if(t.prevToken&&s){let o=ee.Position.create(t.prevToken.pos.line,t.prevToken.pos.colEnd),a=ee.Position.create(t.pos.line,t.pos.col),c=ee.TextEdit.replace(ee.Range.create(o,a),`${`
324
- `.repeat(i)}${"".padStart(e*r.length,r)}${n}`);return ze(0,t.fsPath,o,{edit:c,codeActionTitle:"Move to new line"},a)}},Tv=(t,e,r,n,i="")=>{let s=Ln(e,r,i),o=ee.Position.create(t.pos.line,0),a=ee.Position.create(t.pos.line,t.pos.col),c=ee.Range.create(o,a),l=oW(n,c);if(s===l)return[];let u=ee.TextEdit.replace(c,s);return[ze(5,t.fsPath,o,{edit:u,codeActionTitle:"Fix indentation",templateStrings:[s.replaceAll(" ","\xB7").replaceAll(" ","\u2192")]},a)]},Dt=(t,e,r=1,n=!1)=>{if(!t.nextToken)return[];if(t.nextToken?.pos.line!==t.pos.line){if(n)return[];let c=dh(t.nextToken,0);if(!c)throw new Error("remove new LinesEdit must be defined");return r&&(c.raw.edit.newText=`${" ".repeat(r)}${c.raw.edit.newText}`),[c]}if(r===0){if(t.nextToken.pos.col===t.pos.colEnd)return[];let c=ee.Position.create(t.pos.line,t.pos.colEnd),l=ee.Position.create(t.nextToken.pos.line,t.nextToken.pos.col),u=ee.TextEdit.del(ee.Range.create(c,l));return[ze(1,t.fsPath,c,{edit:u,codeActionTitle:"Remove space(s)",templateStrings:["0"]},l)]}if(t.pos.colEnd===t.nextToken.pos.col){let c=ee.Position.create(t.nextToken.pos.line,t.nextToken.pos.col),l=ee.TextEdit.insert(c," ".repeat(r));return[ze(1,t.fsPath,c,{edit:l,codeActionTitle:"Insert Space(s)",templateStrings:[r.toString()]})]}let i=t.nextToken.pos.col-t.pos.colEnd;if(i===r&&e[t.pos.line].slice(t.pos.colEnd,t.nextToken.pos.col)===" ".repeat(r))return[];let s=ee.Position.create(t.pos.line,t.pos.colEnd),o=ee.Position.create(t.nextToken.pos.line,t.nextToken.pos.col),a=ee.TextEdit.replace(ee.Range.create(s,o)," ".repeat(r));return[ze(1,t.fsPath,s,{edit:a,codeActionTitle:i>r?"Remove space(s)":"Insert space(s)",templateStrings:[r.toString()]},o)]},_l=(t,e,r,n,i)=>t.slice(1).flatMap(s=>i&&s.firstToken.prevToken||s.firstToken.pos.line===s.firstToken.prevToken?.pos.line?Dt(s.firstToken.prevToken,e):Br(s.firstToken,r,n,e,void 0,1,!0)),GV=async(t,e,r,n,i,s,o,a,c,l)=>{let u=[],d=e.topComment||e.firstToken.prevToken?.value==="{"&&!e.topComment?1:vv(e.firstToken,n);if(u.push(...Br(e.firstToken,s,o,c,void 0,d,!0)),e instanceof Ce||e instanceof ot)if(u.push(..._l(e.labels,c,s,o,!1)),e instanceof Ce){e.name?.address?.length&&e.name.address.every(p=>p.toString()!=="")&&e.name.address.forEach(p=>{let m=c[p.firstToken.pos.line].slice(p.firstToken.pos.col,p.lastToken.pos.colEnd),h=m.toLowerCase(),y=h.match(/^(?:0x)?([0-9a-f]+)(?:ull)?$/i)?.at(1),S=[];h.startsWith("0x")&&S.push(10),h.endsWith("ull")&&S.push(11),y!==m&&S.push(9),y&&S.length&&u.push(ze(S,p.fsPath,se(p.firstToken,!1),{edit:ee.TextEdit.replace(ce(p),y),codeActionTitle:`Change to '${y}'`},se(p.lastToken)))}),e.labels.length&&e.name&&(e.name.firstToken.pos.line!==e.name.firstToken.prevToken?.pos.line?u.push(...Br(e.name.firstToken,s,o,c,void 0,1,!0)):u.push(...Dt(e.name.firstToken.prevToken,c)));let f=e.name&&e.openScope?Dt(e.name.lastToken,c):[];u.push(...f)}else{e.labels.length&&e.reference?.firstToken.prevToken&&u.push(...Dt(e.reference.firstToken.prevToken,c));let f=e.reference&&e.openScope?Dt(e.reference.lastToken,c):[];u.push(...f)}else e instanceof nt&&e.firstToken.value==="/"&&e.openScope&&u.push(...Dt(e.firstToken,c,1));return u.push(...(await Promise.all(e.children.flatMap(f=>sI(t,f,i,l,c,r,n,a,s+1)))).flat()),e.closeScope&&(e.openScope&&e.closeScope.prevToken===e.openScope?u.push(...Dt(e.openScope,c,0)):u.push(...Br(e.closeScope,s,o,c,void 0,1,!0))),e.lastToken.value===";"&&e.closeScope&&u.push(...fh(e.closeScope,e.lastToken)),u},YV=(t,e,r,n,i,s,o)=>{let a=[];if(a.push(..._l(e.labels,o,r,n.singleIndent,!0)),e.labels.length&&e.value?.firstToken.prevToken&&a.push(...Dt(e.value.firstToken.prevToken,o)),e.value instanceof ir){let c=o[e.value.firstToken.pos.line].slice(e.value.firstToken.pos.col,e.value.lastToken.pos.colEnd),l=c.toLowerCase();l!==c&&a.push(ze(9,e.value.fsPath,se(e.value.firstToken,!1),{edit:ee.TextEdit.replace(ce(e.value),l),codeActionTitle:`Change to '${l}'`},se(e.value.lastToken)))}if(e.firstToken.prevToken)if(e.firstToken.pos.line!==e.firstToken.prevToken?.pos.line&&e.firstToken.prevToken!==s){let c=dh(e.firstToken,1,!0);c&&a.push(c),a.push(...Tv(e.firstToken,r,n.singleIndent,o,Fr(n,t+4)))}else a.push(...Dt(e.firstToken.prevToken,o,s&&e.firstToken.prevToken===s?0:1));return e.value instanceof ge&&a.push(...uh(e.value,o,r,n,i,t+4)),a},KV=(t,e,r,n,i,s)=>{let o=[];return e instanceof ut||e instanceof Lr?e.openBracket&&e.openBracket?.nextToken===e.closeBracket?o.push(...Dt(e.openBracket,s,0)):(o.push(...e.values.flatMap(a=>YV(t,a,r,n,i,e.openBracket,s))),e.closeBracket?.prevToken&&(e.values.at(-1)?.lastToken===e.closeBracket?.prevToken||e.closeBracket?.prevToken.value==="/"&&e.closeBracket?.prevToken?.prevToken?.value==="*"?o.push(...Dt(e.closeBracket.prevToken,s,0)):o.push(...Br(e.closeBracket,r,n.singleIndent,s,Fr(n,t+3),1,!0)))):e instanceof ge&&o.push(...uh(e,s,r,n,i,t)),o},uh=(t,e,r,n,i,s)=>t instanceof Gt?XV(t,e):t instanceof nr?JV(t,e,r,n,i,s):[],XV=(t,e)=>{let r=[];return r.push(...Dt(t.functionName.lastToken,e,0)),t.lastToken.value===")"&&t.lastToken.prevToken&&r.push(...Dt(t.lastToken.prevToken,e,0)),r},JV=(t,e,r,n,i,s)=>{let o=[];if(t.openBracket&&t.openBracket.nextToken&&o.push(...Dt(t.openBracket,e,0)),o.push(...uh(t.expression,e,r,n,i,s)),t.join?.forEach(a=>{a.operator.firstToken.prevToken&&o.push(...Dt(a.operator.firstToken.prevToken,e)),a.expression.firstToken.prevToken?.pos.line===a.expression.firstToken.pos.line?o.push(...Dt(a.expression.firstToken.prevToken,e)):o.push(...Br(a.expression.firstToken,r,n.singleIndent,e,Fr(n,s),void 0,void 0,!i.indentExpressions)),o.push(...uh(a.expression,e,r,n,i,s))}),!t.join?.length&&!(t.expression instanceof nr)&&(t.expression instanceof Gt||t.expression instanceof vt)){let a=[];if(t.openBracket){let c=ee.Position.create(t.openBracket.pos.line,t.openBracket.pos.col),l=ee.Position.create(t.openBracket.pos.line,t.openBracket.pos.colEnd);a.push(ee.TextEdit.del(ee.Range.create(c,l)))}if(t.closeBracket){let c=ee.Position.create(t.closeBracket.pos.line,t.closeBracket.pos.col),l=ee.Position.create(t.closeBracket.pos.line,t.closeBracket.pos.colEnd);a.push(ee.TextEdit.del(ee.Range.create(c,l)))}o.push(ze(7,t.fsPath,a[0].range.start,{edit:a,codeActionTitle:"Remove (...)"},a[a.length-1].range.end))}return t.closeBracket&&t.closeBracket.prevToken&&o.push(...Dt(t.closeBracket.prevToken,e,0)),o},QV=(t,e,r,n,i,s)=>{let o=[];return o.push(..._l(e.startLabels,s,r,n.singleIndent,!0)),o.push(...KV(t,e.value,r,n,i,s)),o.push(..._l(e.endLabels,s,r,n.singleIndent,!0)),o},ZV=(t,e,r,n,i,s,o)=>{let a=[];return e.values.forEach((c,l)=>{if(!c)return[];let u=c.firstToken.prevToken,d=l?e.values.at(l-1):void 0;if(u)if(u.pos.line===c.firstToken.pos.line)if(u.value===","&&d?.lastToken.pos.line!==c.firstToken.pos.line&&u.prevToken?.pos.line!==c.firstToken.pos.line){let f=nI(c.firstToken,r,n.singleIndent,Fr(n,t+3));f&&a.push(f)}else a.push(...Dt(u,s,1));else if(o&&c.firstToken.prevToken===o)a.push(...Dt(o,s));else{let f=dh(c.firstToken,1,!0);f&&a.push(f),a.push(...Tv(c.firstToken,r,n.singleIndent,s,Fr(n,t+3)))}a.push(...QV(t,c,r,n,i,s)),c.nextValueSeparator&&a.push(...fh(c.lastToken,c.nextValueSeparator))}),a},eW=(t,e,r,n,i)=>{let s=[],{force:o,newLines:a}=iI(t,t.firstToken);return s.push(...Br(t.firstToken,e,r.singleIndent,i,void 0,a,o)),s.push(..._l(t.labels,i,e,r.singleIndent,!0)),t.labels.length&&t.propertyName?.firstToken.prevToken&&s.push(...Dt(t.propertyName.firstToken.prevToken,i)),t.values&&(t.propertyName&&s.push(...Dt(t.propertyName?.lastToken,i)),s.push(...ZV(t.propertyName?.name.length??0,t.values,e,r,n,i,t.assignOperatorToken))),t.lastToken.value===";"&&s.push(...fh(t.children[t.children.length-1].lastToken,t.lastToken)),s},Br=(t,e,r,n,i,s,o,a=!0)=>{let c=[],l=nI(t,e,r,i,s);if(l)c.push(l);else{let u=dh(t,s,o);u&&c.push(u),a&&c.push(...Tv(t,e,r,n,i))}return c},fh=(t,e)=>{if(t.pos.line===e.pos.line&&t.pos.colEnd+1===e.pos.colEnd)return[];if(t.nextToken===e){let s=ee.Position.create(t.pos.line,t.pos.colEnd),o=ee.Position.create(e.pos.line,e.pos.col),a=ee.TextEdit.del(ee.Range.create(s,o));return[ze(1,t.fsPath,s,{edit:a,codeActionTitle:"Remove white space",templateStrings:["0"]},o)]}let r=ee.Position.create(t.pos.line,t.pos.colEnd),n=ee.Position.create(e.pos.line,e.pos.colEnd),i=[ee.TextEdit.insert(r,e.value),ee.TextEdit.del(ee.Range.create(ee.Position.create(e.prevToken?.pos.line??e.pos.line,e.prevToken?.pos.colEnd??e.pos.col),n))];return[ze(6,t.fsPath,r,{edit:i,codeActionTitle:"Move token",templateStrings:[e.value]},n)]},tW=(t,e,r,n)=>{let i=[];i.push(...Br(t.firstToken,e,r,n));let s=Dt(t.keyword.lastToken,n);return i.push(...s),t.lastToken.value===";"&&i.push(...fh(t.children[t.children.length-1].lastToken,t.lastToken)),i},rW=(t,e,r,n)=>{if(!fe(t.fsPath,e))return[];let i=[];i.push(...Br(t.firstToken,0,r,n));let s=Dt(t.keyword.lastToken,n);return i.push(...s),i},nW=(t,e,r,n,i,s)=>t.comments.length===1&&t.firstToken.pos.line===t.firstToken.prevToken?.pos.line?[]:t.comments.flatMap((o,a)=>iW(o,t,e,r,n,i,a?a===t.comments.length-1?"last":"comment":"first",s)),yv=(t,e,r="")=>{let n=e?LT(e):void 0;if(!n)return r;let i=mo(e),s=n.propertyName?.name.length??0;return`${`${Fr(t,s+(i?4:3)+(r.length-r.trimStart().length))}`}${r.trimStart()}`},vv=(t,e)=>{let r=e.flatMap(n=>[...n.ifBlocks.map(i=>i.expression?.lastToken.nextToken),n.elseOption?.lastToken.nextToken]).some(n=>n===t);return t.prevToken?.value==="{"||r?1:2},iI=(t,e)=>{let r=t.parentNode instanceof De?t.parentNode:void 0,n=r?.children.indexOf(t)??-1;if(n===0&&r?.openScope===e.prevToken)return{newLines:1,force:!0};let i=n>0&&r?.children[n-1];return i instanceof De&&t.firstToken.prevToken===(i.endComment??i).lastToken?{newLines:2,force:!0}:{newLines:void 0,force:void 0}},iW=(t,e,r,n,i,s,o,a)=>{if(!t.firstToken.prevToken)return Br(t.firstToken,n?.level??0,i,s);if(t.firstToken.pos.line===t.firstToken.prevToken?.pos.line)return Dt(t.firstToken.prevToken,s,1);if(n===void 0)return[];let c,l;if(o==="first"&&!e.astBeforeComment&&e.astAfterComment instanceof De)c=!0,l=vv(e.firstToken,r);else if(o==="first"&&!e.astBeforeComment&&e.astAfterComment instanceof Ee){let{force:m,newLines:h}=iI(e.astAfterComment,e.firstToken);c=m,l=h}let u=e.astAfterComment instanceof ni?0:n.level,d=[],f="",p=t.toString();switch(o==="last"&&p.trim()!==""&&t.lastToken.prevToken&&(o="comment",d.push(...Br(t.lastToken.prevToken,u,i,s,yv(a,n?.inAst," ")))),o){case"comment":f=t.firstToken.value==="*"?" ":" * ";break;case"first":break;case"last":f=" ";break}return n?.inAst instanceof De?d.push(...Br(t.firstToken,u,i,s,f,l,c)):d.push(...Br(t.firstToken,u,i,s,yv(a,n?.inAst,f),l,c)),d},sW=(t,e,r,n,i,s)=>{if(!t.firstToken.prevToken)return Br(t.firstToken,r?.level??0,n,i);if(t.firstToken.pos.line===t.firstToken.prevToken.pos.line)return[];let a,c;return!t.astBeforeComment&&t.astAfterComment instanceof De&&(a=!0,c=vv(t.firstToken,e)),Br(t.firstToken,r?.level??0,n,i,yv(s,r?.inAst),c,a)},sI=async(t,e,r,n,i,s,o,a,c=0)=>{let l=t.options.tabSize,u=t.options.insertSpaces,d=u?" ".repeat(l):" ",f={tabSize:l,insertSpaces:u,singleIndent:d,wordWrapColumn:t.options.wordWrapColumn};return e instanceof De?GV(t,e,s,o,r,c,d,a,i,n):e instanceof Ee?eW(e,c,f,a,i):e instanceof pr?tW(e,c,d,i):e instanceof ni?rW(e,r,d,i):e instanceof vn&&!e.disabled?sW(e,o,await n(e),d,i,f):e instanceof Tn&&!e.disabled?nW(e,o,await n(e),d,i,f):[]};function oW(t,e){let r=t[e.start.line],n=t[e.end.line];if(e.start.line===e.end.line)return r.substring(e.start.character,e.end.character);let i=t.slice(e.start.line+1,e.end.line);return[r.substring(e.start.character),...i,n.substring(0,e.end.character)].join(`
325
- `)}var hh=q(U());var ph=t=>!t||t instanceof Ee?!1:t instanceof qr||ph(t.parentNode);function aW(t){if(!t||!(t.item instanceof et&&t.item.ast.assignOperatorToken))return[];let e=ph(t?.ast);if(!e&&!(t.ast instanceof Ee&&t.item.ast.values===null)&&!ph(t.beforeAst)&&!ph(t.afterAst))return[];let r=-1;if(t.item.ast.values===null?r=0:r=(t.item.ast.values?.values.findIndex(i=>i&&$T(i,t.beforeAst))??-1)+1,r===-1&&(r=0),t.item.name==="compatible"){let s=t.item.parent.nodeTypes.filter(c=>c).at(-1),o=t.item.ast.quickValues,a;return o?.some(c=>!!c)&&s instanceof _t&&s.extends.size&&(a=Array.from(s.extends).filter(c=>!o||!o.includes(c))),o?.filter(c=>c)?.length&&!a?[]:(a??=t.runtime.context.bindingLoader?.getBindings()??[],a.filter(c=>!o||!o.includes(c)).map(c=>{let l=[];if(t.runtime.context.settings.autoAddMissingPropertiesOnCompletion){let u=ba(t.ast);if(u&&t.item?.parent&&t.runtime.context.bindingLoader?.type==="Zephyr"){let d=t.item.parent,f=t.runtime.context.bindingLoader.getZephyrContextBinding()?.find(h=>h.compatible===c);Object.values(f?.properties??{}).filter(h=>h.required).filter(h=>t.item?.parent?.properties.every(y=>y.name!==h.name)).forEach(h=>{let y=Zc(h.type)[0],S=Gf(d,u,h.name,y,t.runtime);S&&l.push(S)})}}return{label:`"${c}"`,documentation:t.runtime.context.bindingLoader?.getBindingDocumentation(c),textEdit:hh.TextEdit.replace(t.ast.range,`"${c}"`),additionalTextEdits:l,kind:hh.CompletionItemKind.Variable,insertText:e?c:`"${c}"`}}))}let n=t.item.parent.nodeType;return n instanceof _t?n.properties.find(i=>i.name===t.item?.name)?.getPropertyCompletionItems(t.item,r,e)??[]:[]}function cW(t){if(!t||!(t.item instanceof et&&t.ast instanceof Qe&&t.item.ast.values==null||t.item instanceof J)||Zt(t.ast)||t.beforeAst?.parentNode instanceof pr)return[];let e=r=>r.nodeType?.getPropertyListCompletionItems(r)??[];return t.item instanceof et?e(t.item.parent):e(t.item)}async function oI(t,e){return Et(t,e,r=>[...aW(r),...cW(r)])}var mh=q(U());async function lW(t){if(t?.ast instanceof vt||t?.ast instanceof Pi){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t?.ast instanceof vt?t.ast.name:t.ast.value);if(e){let r=Jc(t.ast),n=(await t.runtime.context.getAllStableParsers()).at(-1);if(r){let i=r?.evaluate(n.cPreprocessorParser.macros);return{contents:{kind:mh.MarkupKind.Markdown,value:["```cpp",`#define ${e.macro.toString()} // = ${i}${typeof i=="number"?` (0x${i.toString(16)})`:""}`,"```"].join(`
324
+ `.repeat(i)}${"".padStart(e*r.length,r)}${n}`);return ze(0,t.fsPath,o,{edit:c,codeActionTitle:"Move to new line"},a)}},Tv=(t,e,r,n,i="")=>{let s=Ln(e,r,i),o=ee.Position.create(t.pos.line,0),a=ee.Position.create(t.pos.line,t.pos.col),c=ee.Range.create(o,a),l=o2(n,c);if(s===l)return[];let u=ee.TextEdit.replace(c,s);return[ze(5,t.fsPath,o,{edit:u,codeActionTitle:"Fix indentation",templateStrings:[s.replaceAll(" ","\xB7").replaceAll(" ","\u2192")]},a)]},Dt=(t,e,r=1,n=!1)=>{if(!t.nextToken)return[];if(t.nextToken?.pos.line!==t.pos.line){if(n)return[];let c=dh(t.nextToken,0);if(!c)throw new Error("remove new LinesEdit must be defined");return r&&(c.raw.edit.newText=`${" ".repeat(r)}${c.raw.edit.newText}`),[c]}if(r===0){if(t.nextToken.pos.col===t.pos.colEnd)return[];let c=ee.Position.create(t.pos.line,t.pos.colEnd),l=ee.Position.create(t.nextToken.pos.line,t.nextToken.pos.col),u=ee.TextEdit.del(ee.Range.create(c,l));return[ze(1,t.fsPath,c,{edit:u,codeActionTitle:"Remove space(s)",templateStrings:["0"]},l)]}if(t.pos.colEnd===t.nextToken.pos.col){let c=ee.Position.create(t.nextToken.pos.line,t.nextToken.pos.col),l=ee.TextEdit.insert(c," ".repeat(r));return[ze(1,t.fsPath,c,{edit:l,codeActionTitle:"Insert Space(s)",templateStrings:[r.toString()]})]}let i=t.nextToken.pos.col-t.pos.colEnd;if(i===r&&e[t.pos.line].slice(t.pos.colEnd,t.nextToken.pos.col)===" ".repeat(r))return[];let s=ee.Position.create(t.pos.line,t.pos.colEnd),o=ee.Position.create(t.nextToken.pos.line,t.nextToken.pos.col),a=ee.TextEdit.replace(ee.Range.create(s,o)," ".repeat(r));return[ze(1,t.fsPath,s,{edit:a,codeActionTitle:i>r?"Remove space(s)":"Insert space(s)",templateStrings:[r.toString()]},o)]},_l=(t,e,r,n,i)=>t.slice(1).flatMap(s=>i&&s.firstToken.prevToken||s.firstToken.pos.line===s.firstToken.prevToken?.pos.line?Dt(s.firstToken.prevToken,e):Br(s.firstToken,r,n,e,void 0,1,!0)),GV=async(t,e,r,n,i,s,o,a,c,l)=>{let u=[],d=e.topComment||e.firstToken.prevToken?.value==="{"&&!e.topComment?1:vv(e.firstToken,n);if(u.push(...Br(e.firstToken,s,o,c,void 0,d,!0)),e instanceof Ce||e instanceof ot)if(u.push(..._l(e.labels,c,s,o,!1)),e instanceof Ce){e.name?.address?.length&&e.name.address.every(p=>p.toString()!=="")&&e.name.address.forEach(p=>{let m=c[p.firstToken.pos.line].slice(p.firstToken.pos.col,p.lastToken.pos.colEnd),h=m.toLowerCase(),y=h.match(/^(?:0x)?([0-9a-f]+)(?:ull)?$/i)?.at(1),S=[];h.startsWith("0x")&&S.push(10),h.endsWith("ull")&&S.push(11),y!==m&&S.push(9),y&&S.length&&u.push(ze(S,p.fsPath,se(p.firstToken,!1),{edit:ee.TextEdit.replace(ce(p),y),codeActionTitle:`Change to '${y}'`},se(p.lastToken)))}),e.labels.length&&e.name&&(e.name.firstToken.pos.line!==e.name.firstToken.prevToken?.pos.line?u.push(...Br(e.name.firstToken,s,o,c,void 0,1,!0)):u.push(...Dt(e.name.firstToken.prevToken,c)));let f=e.name&&e.openScope?Dt(e.name.lastToken,c):[];u.push(...f)}else{e.labels.length&&e.reference?.firstToken.prevToken&&u.push(...Dt(e.reference.firstToken.prevToken,c));let f=e.reference&&e.openScope?Dt(e.reference.lastToken,c):[];u.push(...f)}else e instanceof nt&&e.firstToken.value==="/"&&e.openScope&&u.push(...Dt(e.firstToken,c,1));return u.push(...(await Promise.all(e.children.flatMap(f=>sI(t,f,i,l,c,r,n,a,s+1)))).flat()),e.closeScope&&(e.openScope&&e.closeScope.prevToken===e.openScope?u.push(...Dt(e.openScope,c,0)):u.push(...Br(e.closeScope,s,o,c,void 0,1,!0))),e.lastToken.value===";"&&e.closeScope&&u.push(...fh(e.closeScope,e.lastToken)),u},YV=(t,e,r,n,i,s,o)=>{let a=[];if(a.push(..._l(e.labels,o,r,n.singleIndent,!0)),e.labels.length&&e.value?.firstToken.prevToken&&a.push(...Dt(e.value.firstToken.prevToken,o)),e.value instanceof ir){let c=o[e.value.firstToken.pos.line].slice(e.value.firstToken.pos.col,e.value.lastToken.pos.colEnd),l=c.toLowerCase();l!==c&&a.push(ze(9,e.value.fsPath,se(e.value.firstToken,!1),{edit:ee.TextEdit.replace(ce(e.value),l),codeActionTitle:`Change to '${l}'`},se(e.value.lastToken)))}if(e.firstToken.prevToken)if(e.firstToken.pos.line!==e.firstToken.prevToken?.pos.line&&e.firstToken.prevToken!==s){let c=dh(e.firstToken,1,!0);c&&a.push(c),a.push(...Tv(e.firstToken,r,n.singleIndent,o,Fr(n,t+4)))}else a.push(...Dt(e.firstToken.prevToken,o,s&&e.firstToken.prevToken===s?0:1));return e.value instanceof ge&&a.push(...uh(e.value,o,r,n,i,t+4)),a},KV=(t,e,r,n,i,s)=>{let o=[];return e instanceof ut||e instanceof Lr?e.openBracket&&e.openBracket?.nextToken===e.closeBracket?o.push(...Dt(e.openBracket,s,0)):(o.push(...e.values.flatMap(a=>YV(t,a,r,n,i,e.openBracket,s))),e.closeBracket?.prevToken&&(e.values.at(-1)?.lastToken===e.closeBracket?.prevToken||e.closeBracket?.prevToken.value==="/"&&e.closeBracket?.prevToken?.prevToken?.value==="*"?o.push(...Dt(e.closeBracket.prevToken,s,0)):o.push(...Br(e.closeBracket,r,n.singleIndent,s,Fr(n,t+3),1,!0)))):e instanceof ge&&o.push(...uh(e,s,r,n,i,t)),o},uh=(t,e,r,n,i,s)=>t instanceof Gt?XV(t,e):t instanceof nr?JV(t,e,r,n,i,s):[],XV=(t,e)=>{let r=[];return r.push(...Dt(t.functionName.lastToken,e,0)),t.lastToken.value===")"&&t.lastToken.prevToken&&r.push(...Dt(t.lastToken.prevToken,e,0)),r},JV=(t,e,r,n,i,s)=>{let o=[];if(t.openBracket&&t.openBracket.nextToken&&o.push(...Dt(t.openBracket,e,0)),o.push(...uh(t.expression,e,r,n,i,s)),t.join?.forEach(a=>{a.operator.firstToken.prevToken&&o.push(...Dt(a.operator.firstToken.prevToken,e)),a.expression.firstToken.prevToken?.pos.line===a.expression.firstToken.pos.line?o.push(...Dt(a.expression.firstToken.prevToken,e)):o.push(...Br(a.expression.firstToken,r,n.singleIndent,e,Fr(n,s),void 0,void 0,!i.indentExpressions)),o.push(...uh(a.expression,e,r,n,i,s))}),!t.join?.length&&!(t.expression instanceof nr)&&(t.expression instanceof Gt||t.expression instanceof vt)){let a=[];if(t.openBracket){let c=ee.Position.create(t.openBracket.pos.line,t.openBracket.pos.col),l=ee.Position.create(t.openBracket.pos.line,t.openBracket.pos.colEnd);a.push(ee.TextEdit.del(ee.Range.create(c,l)))}if(t.closeBracket){let c=ee.Position.create(t.closeBracket.pos.line,t.closeBracket.pos.col),l=ee.Position.create(t.closeBracket.pos.line,t.closeBracket.pos.colEnd);a.push(ee.TextEdit.del(ee.Range.create(c,l)))}o.push(ze(7,t.fsPath,a[0].range.start,{edit:a,codeActionTitle:"Remove (...)"},a[a.length-1].range.end))}return t.closeBracket&&t.closeBracket.prevToken&&o.push(...Dt(t.closeBracket.prevToken,e,0)),o},QV=(t,e,r,n,i,s)=>{let o=[];return o.push(..._l(e.startLabels,s,r,n.singleIndent,!0)),o.push(...KV(t,e.value,r,n,i,s)),o.push(..._l(e.endLabels,s,r,n.singleIndent,!0)),o},ZV=(t,e,r,n,i,s,o)=>{let a=[];return e.values.forEach((c,l)=>{if(!c)return[];let u=c.firstToken.prevToken,d=l?e.values.at(l-1):void 0;if(u)if(u.pos.line===c.firstToken.pos.line)if(u.value===","&&d?.lastToken.pos.line!==c.firstToken.pos.line&&u.prevToken?.pos.line!==c.firstToken.pos.line){let f=nI(c.firstToken,r,n.singleIndent,Fr(n,t+3));f&&a.push(f)}else a.push(...Dt(u,s,1));else if(o&&c.firstToken.prevToken===o)a.push(...Dt(o,s));else{let f=dh(c.firstToken,1,!0);f&&a.push(f),a.push(...Tv(c.firstToken,r,n.singleIndent,s,Fr(n,t+3)))}a.push(...QV(t,c,r,n,i,s)),c.nextValueSeparator&&a.push(...fh(c.lastToken,c.nextValueSeparator))}),a},e2=(t,e,r,n,i)=>{let s=[],{force:o,newLines:a}=iI(t,t.firstToken);return s.push(...Br(t.firstToken,e,r.singleIndent,i,void 0,a,o)),s.push(..._l(t.labels,i,e,r.singleIndent,!0)),t.labels.length&&t.propertyName?.firstToken.prevToken&&s.push(...Dt(t.propertyName.firstToken.prevToken,i)),t.values&&(t.propertyName&&s.push(...Dt(t.propertyName?.lastToken,i)),s.push(...ZV(t.propertyName?.name.length??0,t.values,e,r,n,i,t.assignOperatorToken))),t.lastToken.value===";"&&s.push(...fh(t.children[t.children.length-1].lastToken,t.lastToken)),s},Br=(t,e,r,n,i,s,o,a=!0)=>{let c=[],l=nI(t,e,r,i,s);if(l)c.push(l);else{let u=dh(t,s,o);u&&c.push(u),a&&c.push(...Tv(t,e,r,n,i))}return c},fh=(t,e)=>{if(t.pos.line===e.pos.line&&t.pos.colEnd+1===e.pos.colEnd)return[];if(t.nextToken===e){let s=ee.Position.create(t.pos.line,t.pos.colEnd),o=ee.Position.create(e.pos.line,e.pos.col),a=ee.TextEdit.del(ee.Range.create(s,o));return[ze(1,t.fsPath,s,{edit:a,codeActionTitle:"Remove white space",templateStrings:["0"]},o)]}let r=ee.Position.create(t.pos.line,t.pos.colEnd),n=ee.Position.create(e.pos.line,e.pos.colEnd),i=[ee.TextEdit.insert(r,e.value),ee.TextEdit.del(ee.Range.create(ee.Position.create(e.prevToken?.pos.line??e.pos.line,e.prevToken?.pos.colEnd??e.pos.col),n))];return[ze(6,t.fsPath,r,{edit:i,codeActionTitle:"Move token",templateStrings:[e.value]},n)]},t2=(t,e,r,n)=>{let i=[];i.push(...Br(t.firstToken,e,r,n));let s=Dt(t.keyword.lastToken,n);return i.push(...s),t.lastToken.value===";"&&i.push(...fh(t.children[t.children.length-1].lastToken,t.lastToken)),i},r2=(t,e,r,n)=>{if(!fe(t.fsPath,e))return[];let i=[];i.push(...Br(t.firstToken,0,r,n));let s=Dt(t.keyword.lastToken,n);return i.push(...s),i},n2=(t,e,r,n,i,s)=>t.comments.length===1&&t.firstToken.pos.line===t.firstToken.prevToken?.pos.line?[]:t.comments.flatMap((o,a)=>i2(o,t,e,r,n,i,a?a===t.comments.length-1?"last":"comment":"first",s)),yv=(t,e,r="")=>{let n=e?LT(e):void 0;if(!n)return r;let i=mo(e),s=n.propertyName?.name.length??0;return`${`${Fr(t,s+(i?4:3)+(r.length-r.trimStart().length))}`}${r.trimStart()}`},vv=(t,e)=>{let r=e.flatMap(n=>[...n.ifBlocks.map(i=>i.expression?.lastToken.nextToken),n.elseOption?.lastToken.nextToken]).some(n=>n===t);return t.prevToken?.value==="{"||r?1:2},iI=(t,e)=>{let r=t.parentNode instanceof De?t.parentNode:void 0,n=r?.children.indexOf(t)??-1;if(n===0&&r?.openScope===e.prevToken)return{newLines:1,force:!0};let i=n>0&&r?.children[n-1];return i instanceof De&&t.firstToken.prevToken===(i.endComment??i).lastToken?{newLines:2,force:!0}:{newLines:void 0,force:void 0}},i2=(t,e,r,n,i,s,o,a)=>{if(!t.firstToken.prevToken)return Br(t.firstToken,n?.level??0,i,s);if(t.firstToken.pos.line===t.firstToken.prevToken?.pos.line)return Dt(t.firstToken.prevToken,s,1);if(n===void 0)return[];let c,l;if(o==="first"&&!e.astBeforeComment&&e.astAfterComment instanceof De)c=!0,l=vv(e.firstToken,r);else if(o==="first"&&!e.astBeforeComment&&e.astAfterComment instanceof Ee){let{force:m,newLines:h}=iI(e.astAfterComment,e.firstToken);c=m,l=h}let u=e.astAfterComment instanceof ni?0:n.level,d=[],f="",p=t.toString();switch(o==="last"&&p.trim()!==""&&t.lastToken.prevToken&&(o="comment",d.push(...Br(t.lastToken.prevToken,u,i,s,yv(a,n?.inAst," ")))),o){case"comment":f=t.firstToken.value==="*"?" ":" * ";break;case"first":break;case"last":f=" ";break}return n?.inAst instanceof De?d.push(...Br(t.firstToken,u,i,s,f,l,c)):d.push(...Br(t.firstToken,u,i,s,yv(a,n?.inAst,f),l,c)),d},s2=(t,e,r,n,i,s)=>{if(!t.firstToken.prevToken)return Br(t.firstToken,r?.level??0,n,i);if(t.firstToken.pos.line===t.firstToken.prevToken.pos.line)return[];let a,c;return!t.astBeforeComment&&t.astAfterComment instanceof De&&(a=!0,c=vv(t.firstToken,e)),Br(t.firstToken,r?.level??0,n,i,yv(s,r?.inAst),c,a)},sI=async(t,e,r,n,i,s,o,a,c=0)=>{let l=t.options.tabSize,u=t.options.insertSpaces,d=u?" ".repeat(l):" ",f={tabSize:l,insertSpaces:u,singleIndent:d,wordWrapColumn:t.options.wordWrapColumn};return e instanceof De?GV(t,e,s,o,r,c,d,a,i,n):e instanceof Ee?e2(e,c,f,a,i):e instanceof pr?t2(e,c,d,i):e instanceof ni?r2(e,r,d,i):e instanceof vn&&!e.disabled?s2(e,o,await n(e),d,i,f):e instanceof Tn&&!e.disabled?n2(e,o,await n(e),d,i,f):[]};function o2(t,e){let r=t[e.start.line],n=t[e.end.line];if(e.start.line===e.end.line)return r.substring(e.start.character,e.end.character);let i=t.slice(e.start.line+1,e.end.line);return[r.substring(e.start.character),...i,n.substring(0,e.end.character)].join(`
325
+ `)}var hh=q(U());var ph=t=>!t||t instanceof Ee?!1:t instanceof qr||ph(t.parentNode);function a2(t){if(!t||!(t.item instanceof et&&t.item.ast.assignOperatorToken))return[];let e=ph(t?.ast);if(!e&&!(t.ast instanceof Ee&&t.item.ast.values===null)&&!ph(t.beforeAst)&&!ph(t.afterAst))return[];let r=-1;if(t.item.ast.values===null?r=0:r=(t.item.ast.values?.values.findIndex(i=>i&&$T(i,t.beforeAst))??-1)+1,r===-1&&(r=0),t.item.name==="compatible"){let s=t.item.parent.nodeTypes.filter(c=>c).at(-1),o=t.item.ast.quickValues,a;return o?.some(c=>!!c)&&s instanceof _t&&s.extends.size&&(a=Array.from(s.extends).filter(c=>!o||!o.includes(c))),o?.filter(c=>c)?.length&&!a?[]:(a??=t.runtime.context.bindingLoader?.getBindings()??[],a.filter(c=>!o||!o.includes(c)).map(c=>{let l=[];if(t.runtime.context.settings.autoAddMissingPropertiesOnCompletion){let u=ba(t.ast);if(u&&t.item?.parent&&t.runtime.context.bindingLoader?.type==="Zephyr"){let d=t.item.parent,f=t.runtime.context.bindingLoader.getZephyrContextBinding()?.find(h=>h.compatible===c);Object.values(f?.properties??{}).filter(h=>h.required).filter(h=>t.item?.parent?.properties.every(y=>y.name!==h.name)).forEach(h=>{let y=Zc(h.type)[0],S=Gf(d,u,h.name,y,t.runtime);S&&l.push(S)})}}return{label:`"${c}"`,documentation:t.runtime.context.bindingLoader?.getBindingDocumentation(c),textEdit:hh.TextEdit.replace(t.ast.range,`"${c}"`),additionalTextEdits:l,kind:hh.CompletionItemKind.Variable,insertText:e?c:`"${c}"`}}))}let n=t.item.parent.nodeType;return n instanceof _t?n.properties.find(i=>i.name===t.item?.name)?.getPropertyCompletionItems(t.item,r,e)??[]:[]}function c2(t){if(!t||!(t.item instanceof et&&t.ast instanceof Qe&&t.item.ast.values==null||t.item instanceof J)||Zt(t.ast)||t.beforeAst?.parentNode instanceof pr)return[];let e=r=>r.nodeType?.getPropertyListCompletionItems(r)??[];return t.item instanceof et?e(t.item.parent):e(t.item)}async function oI(t,e){return Et(t,e,r=>[...a2(r),...c2(r)])}var mh=q(U());async function l2(t){if(t?.ast instanceof vt||t?.ast instanceof Pi){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t?.ast instanceof vt?t.ast.name:t.ast.value);if(e){let r=Jc(t.ast),n=(await t.runtime.context.getAllStableParsers()).at(-1);if(r){let i=r?.evaluate(n.cPreprocessorParser.macros);return{contents:{kind:mh.MarkupKind.Markdown,value:["```cpp",`#define ${e.macro.toString()} // = ${i}${typeof i=="number"?` (0x${i.toString(16)})`:""}`,"```"].join(`
326
326
  `)},range:ce(t.ast)}}return{contents:{kind:mh.MarkupKind.Markdown,value:["```cpp",`#define ${e.macro.toString()} // = ${t.ast?.evaluate(n.cPreprocessorParser.macros)}`,"```"].join(`
327
- `)},range:ce(t.ast)}}}}async function uW(t){if(!t)return;let e=(await t.runtime.context.getAllStableParsers()).at(-1);if(t?.ast instanceof je){let r=t.ast.linksTo;if(r)return{contents:r.toMarkupContent(e.cPreprocessorParser.macros),range:ce(t.ast)}}if(t?.ast.parentNode instanceof ie){let r=t.ast.parentNode.linksTo;if(r)return{contents:r.toMarkupContent(e.cPreprocessorParser.macros),range:ce(t.ast)}}if(t?.ast instanceof ne&&t.item instanceof et&&t.item.parent.name==="aliases"){let r=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(r)return{contents:r.toMarkupContent(e.cPreprocessorParser.macros),range:ce(t.ast)}}if(t?.item instanceof J)return{contents:t.item.toMarkupContent(e.cPreprocessorParser.macros),range:ce(t.ast)}}function dW(t){if(t?.item instanceof et&&t.ast instanceof Qe){let e=t.item.onHover(),r=t.item.parent.nodeType?.getOnPropertyHover(t.item.name);if(e||r)return{contents:{kind:mh.MarkupKind.Markdown,value:`${e?.value??""}
328
- ${r?.value??""}`},range:ce(t.ast)}}}function aI(t,e){return Et(t,e,async r=>[await uW(r)||dW(r)||await lW(r)])}async function cI(t){let e=await Dp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function lI(t){let e=await Cp(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var fI=q(U());async function uI(t){return t?.nodes.length??0}async function dI({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_CHILD_NUM"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return uI(s)}async function pI(t){let e=await dI(t,M);return e!==void 0?{contents:{kind:fI.MarkupKind.Markdown,value:e.toString()}}:void 0}async function hI(t){let e=await lv(t);if(e)return e?.length?{contents:{kind:Ri.Markdown,value:e.map((r,n)=>{let i=r.toMarkupContent(t.context.macros);return`## Node ${n+1}
327
+ `)},range:ce(t.ast)}}}}async function u2(t){if(!t)return;let e=(await t.runtime.context.getAllStableParsers()).at(-1);if(t?.ast instanceof je){let r=t.ast.linksTo;if(r)return{contents:r.toMarkupContent(e.cPreprocessorParser.macros),range:ce(t.ast)}}if(t?.ast.parentNode instanceof ie){let r=t.ast.parentNode.linksTo;if(r)return{contents:r.toMarkupContent(e.cPreprocessorParser.macros),range:ce(t.ast)}}if(t?.ast instanceof ne&&t.item instanceof et&&t.item.parent.name==="aliases"){let r=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(r)return{contents:r.toMarkupContent(e.cPreprocessorParser.macros),range:ce(t.ast)}}if(t?.item instanceof J)return{contents:t.item.toMarkupContent(e.cPreprocessorParser.macros),range:ce(t.ast)}}function d2(t){if(t?.item instanceof et&&t.ast instanceof Qe){let e=t.item.onHover(),r=t.item.parent.nodeType?.getOnPropertyHover(t.item.name);if(e||r)return{contents:{kind:mh.MarkupKind.Markdown,value:`${e?.value??""}
328
+ ${r?.value??""}`},range:ce(t.ast)}}}function aI(t,e){return Et(t,e,async r=>[await u2(r)||d2(r)||await l2(r)])}async function cI(t){let e=await Dp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function lI(t){let e=await Cp(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var fI=q(U());async function uI(t){return t?.nodes.length??0}async function dI({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_CHILD_NUM"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return uI(s)}async function pI(t){let e=await dI(t,M);return e!==void 0?{contents:{kind:fI.MarkupKind.Markdown,value:e.toString()}}:void 0}async function hI(t){let e=await lv(t);if(e)return e?.length?{contents:{kind:Ri.Markdown,value:e.map((r,n)=>{let i=r.toMarkupContent(t.context.macros);return`## Node ${n+1}
329
329
 
330
330
  ${i.value}
331
331
  `}).join(`
332
332
 
333
- `)}}:{contents:{kind:Ri.Markdown,value:`No node matched compat ${t.macro.args[0].macro}`}}}async function mI(t){let e=await Ap(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function gI(t,e){return!!await wp(t,e)}async function yI({macro:t,context:e}){if(!(t.macro!=="DT_HAS_ALIAS"||t.args?.length!==1))return gI(t.args[0].macro,e)}async function TI(t){let e=await yI(t);if(e!==void 0)return{contents:{kind:Ri.Markdown,value:e?"1":"0"}}}var bI=q(U());async function Pl(t,e){if(t)switch(e){case"Unquoted":return t.fullName;case"Quoted":return`"${t.fullName}"`;case"Token":return Z(t.fullName);case"Upper Token":return Z(t.fullName).toUpperCase()}}async function vI({document:t,macro:e,context:r,position:n},i){if(e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});switch(e.macro){case"DT_NODE_FULL_NAME":return Pl(s,"Quoted");case"DT_NODE_FULL_NAME_TOKEN":return Pl(s,"Token");case"DT_NODE_FULL_NAME_UNQUOTED":return Pl(s,"Unquoted");case"DT_NODE_FULL_NAME_UPPER_TOKEN":return Pl(s,"Upper Token")}}async function SI(t){let e=await vI(t,M);if(e)return{contents:{kind:bI.MarkupKind.Markdown,value:e}}}var kI=q(U());async function _I(t){return t?.pathString}async function PI({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_NODE_PATH"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return _I(s)}async function NI(t){let e=await PI(t,M);if(e)return{contents:{kind:kI.MarkupKind.Markdown,value:`"${e}"`}}}async function RI(t){let e=await Op(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var DI=q(U());async function EI(t){return t?.labels.map(e=>e.label)}async function wI({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_NODELABEL_STRING_ARRAY"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return EI(s)}async function CI(t){let e=await wI(t,M);if(e)return{contents:{kind:DI.MarkupKind.Markdown,value:`{ ${e.map(r=>`"${r}"`).join(", ")} }`}}}async function AI(t){let e=await xp(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function II(t){let e=await Lp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var xI=q(U());async function OI({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_SAME_NODE"||e.args?.length!==2)return;if(await r?.getRuntime()){let o=await i({document:t,macro:e.args[0],context:r,position:n}),a=await i({document:t,macro:e.args[1],context:r,position:n});return!!a&&!!o&&a===o}}async function MI(t){let e=await OI(t,M);if(e!==void 0)return{contents:{kind:xI.MarkupKind.Markdown,value:e?"1":"0"}}}var qI=q(U());async function LI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_IDX_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Le(s[2].macro);if(typeof a=="number")return await Aa(o,s[1].macro,a)}async function $I(t){let e=await LI(t,M);return e?{contents:{kind:qI.MarkupKind.Markdown,value:e.toString()}}:void 0}var BI=q(U());async function FI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_BY_IDX"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Le(s[2].macro);if(typeof a=="number")return Ns(o,s[1].macro,a,s[3].macro,r)}async function jI(t){let e=await FI(t,M);return e?{contents:{kind:BI.MarkupKind.Markdown,value:e.toString()}}:void 0}async function UI(t){let e=await Ci(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function HI(t){let e=await Hp(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var kl=q(U());async function mt(t,e){if(e){if(typeof e=="boolean")return{contents:{kind:kl.MarkupKind.Markdown,value:e?"1":"0"}};if(typeof e=="string")return{contents:{kind:kl.MarkupKind.Markdown,value:e}};if(e instanceof J)return{contents:e.toMarkupContent(t.macros)};if(e.length===1&&e[0]instanceof J)return{contents:e[0].toMarkupContent(t.macros)};if(e.every(r=>typeof r=="number"))return{contents:{kind:kl.MarkupKind.Markdown,value:e.length===1?e[0].toString():`{${e.join(", ")}}`}};if(e.every(r=>typeof r=="string"))return{contents:{kind:kl.MarkupKind.Markdown,value:e.length===1?`"${e[0]}"`:`{${e.map(r=>`"${r}"`).join(", ")}}`}}}}async function VI(t){let e=await _p(t,M);return mt(t.context,e)}var bv=q(U());async function WI(t){let e=await Pp(t,M);if(e===!0)return{contents:{kind:bv.MarkupKind.Markdown,value:"1"}};if(e)return e instanceof J?{contents:e.toMarkupContent(t.context.macros)}:{contents:{kind:bv.MarkupKind.Markdown,value:e.toString()}}}async function zI(t){let e=await Ca(t,M);return mt(t.context,e)}async function GI({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_BY_PHANDLE_IDX"||e.args?.length!==4)return;let s=await Di(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro);return await wr(s,e.args[3].macro,r)}async function YI(t){return mt(t.context,await GI(t,M))}async function KI(t){let e=await qp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var QI=q(U());async function XI(t){return t?.nodes.filter(e=>!e.disabled).length??0}async function JI({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_CHILD_NUM_STATUS_OKAY"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return XI(s)}async function ZI(t){let e=await JI(t,M);return e!==void 0?{contents:{kind:QI.MarkupKind.Markdown,value:e.toString()}}:void 0}async function eO(t){let e=await Rs(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var rO=q(U());async function tO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return Ns(o,s[1].macro,0,s[2].macro,r)}async function nO(t){let e=await tO(t,M);return e?{contents:{kind:rO.MarkupKind.Markdown,value:e.toString()}}:void 0}var iO=q(U());async function sO(t){let e=await jp(t,M);return e instanceof J?mt(t.context,e):e?{contents:{kind:iO.MarkupKind.Markdown,value:e.toString()}}:void 0}var aO=q(U());async function oO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_BY_NAME"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n});return Ns(o,s[1].macro,s[2].macro,s[3].macro,r)}async function cO(t){let e=await oO(t,M);return e?{contents:{kind:aO.MarkupKind.Markdown,value:e.toString()}}:void 0}var lO=q(U());async function uO(t){let e=await Up(t,M);return e instanceof J?mt(t.context,e):e?{contents:{kind:lO.MarkupKind.Markdown,value:e.toString()}}:void 0}var dO=q(U());async function fO(t){let e=await Vp(t,M);return e instanceof J?mt(t.context,e):e?{contents:{kind:dO.MarkupKind.Markdown,value:e.toString()}}:void 0}var pO=q(U());async function hO(t){let e=await Fp(t,M);return e instanceof J?mt(t.context,e):e?{contents:{kind:pO.MarkupKind.Markdown,value:e.toString()}}:void 0}var gO=q(U());async function mO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_IDX"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return await Aa(o,s[1].macro,0)}async function yO(t){let e=await mO(t,M);return e?{contents:{kind:gO.MarkupKind.Markdown,value:e.toString()}}:void 0}var TO=q(U());async function vO(t){let e=await Bp(t,M);return e instanceof J?mt(t.context,e):e?{contents:{kind:TO.MarkupKind.Markdown,value:e.toString()}}:void 0}async function bO({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_BY_PHANDLE"||e.args?.length!==3)return;let s=await Di(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro);return wr(s,e.args[2].macro,r)}async function SO(t){return mt(t.context,await bO(t,M))}async function _O(t){return mt(t.context,await Wp(t,M))}var NO=q(U());var PO=q(require("util"));async function gh(t,e,r,n){let i=t?.properties.find(o=>Z(o.name)===e);if(!i)return;let s=i?.ast.quickValues?.at(r);if(s!==void 0)return PO.default.isDeepStrictEqual(Le(n),s)}async function kO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_HAS_VALUE"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return await gh(o,s[1].macro,0,s[2].macro)}async function RO(t){let e=await kO(t,M);return e!==void 0?{contents:{kind:NO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}var wO=q(U());async function EO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_HAS_VALUE_BY_IDX"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Le(s[2].macro);if(typeof a=="number")return await gh(o,s[1].macro,a,s[3].macro)}async function DO(t){let e=await EO(t,M);return e!==void 0?{contents:{kind:wO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}var IO=q(U());async function CO(t,e,r,n){let i=await wr(t,e,n);if(i===void 0)return!1;if(r=typeof r=="number"?r:Le(r??"0"),typeof r=="number")return Array.isArray(i)?i.length<r:r===0}async function AO({document:t,macro:e,context:r,position:n},i){let s=e.args;return e.macro!=="DT_PROP_HAS_IDX"||s?.length!==3?void 0:!!await CO(await i({document:t,macro:s[0],context:r,position:n}),s[1].macro,s[2].macro,r)}async function OO(t){let e=await AO(t,M);return e===void 0?void 0:{contents:{kind:IO.MarkupKind.Markdown,value:e?"1":"0"}}}var LO=q(U());async function xO(t,e,r,n){let i=t?.properties.find(u=>Z(u.name)===e),s=i?.parent.nodeType;if(!s||!(s instanceof _t)||await wr(t,e,n)===void 0)return;let a=i.nexusMapsTo.at(0)?.specifierSpace,l=(a?i.parent.getProperty(`${a}-names`)?.ast.quickValues:void 0)?.findIndex(u=>typeof u=="string"&&u.toLowerCase()===r)??-1;return l===-1?void 0:l}async function MO({document:t,macro:e,context:r,position:n},i){let s=e.args;return e.macro!=="DT_PROP_HAS_NAME"||s?.length!==3?void 0:!!await xO(await i({document:t,macro:s[0],context:r,position:n}),s[1].macro,s[2].macro,r)}async function qO(t){let e=await MO(t,M);return e===void 0?void 0:{contents:{kind:LO.MarkupKind.Markdown,value:e?"1":"0"}}}async function $O(t){let e=await Ip(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var BO=q(U());async function FO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PROP_LEN"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?zp(o,s[1].macro):void 0}async function jO(t){let e=await FO(t,M);return e?{contents:{kind:BO.MarkupKind.Markdown,value:e.toString()}}:void 0}var UO=q(U());async function HO(t){let e=await Gp(t,M);return e instanceof J?mt(t.context,e):e?{contents:{kind:UO.MarkupKind.Markdown,value:e.toString()}}:void 0}var Sv=q(U());async function VO(t,e,r){let n=await wr(t,e,r);if(n===!0)return!0;if(!n)return;let i=n.at(-1);if(i)return n.length===1&&n[0]instanceof J?n[0]:i}async function WO({document:t,macro:e,context:r,position:n},i){if(!(e.macro!=="DT_PROP_LAST"||e.args?.length!==2))return VO(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,r)}async function zO(t){let e=await WO(t,M);if(e===!0)return{contents:{kind:Sv.MarkupKind.Markdown,value:"1"}};if(e)return e instanceof J?{contents:e.toMarkupContent(t.context.macros)}:{contents:{kind:Sv.MarkupKind.Markdown,value:e.toString()}}}var YO=q(U());async function GO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_TOKEN"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?Oa(o,s[1].macro):void 0}async function KO(t){let e=await GO(t,M);if(e)return{contents:{kind:YO.MarkupKind.Markdown,value:e.toString()}}}var JO=q(U());async function yh(t,e,r){if(!t)return;let i=t?.properties.find(s=>Z(s.name)===e)?.ast.getFlatAstValues();if(!(!i||i.length<=1)&&i[r]instanceof ne)return Z(i[r].value)}async function XO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_TOKEN_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Le(s[2].macro);if(typeof a=="number")return o?yh(o,s[1].macro,a):void 0}async function QO(t){let e=await XO(t,M);if(e)return{contents:{kind:JO.MarkupKind.Markdown,value:e.toString()}}}var ZO=q(U());async function ex(t){let e=await Yp(t,M);if(e)return e instanceof J?mt(t.context,e):{contents:{kind:ZO.MarkupKind.Markdown,value:e.toString()}}}var nx=q(U());async function tx(t,e,r){if(!t)return;let i=t?.properties.find(s=>Z(s.name)===e)?.ast.getFlatAstValues();if(!(!i||i.length<=1)&&i[r]instanceof ne)return i[r].value}async function rx({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UNQUOTED_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Le(s[2].macro);if(typeof a=="number")return o?tx(o,s[1].macro,a):void 0}async function ix(t){let e=await rx(t,M);if(e)return{contents:{kind:nx.MarkupKind.Markdown,value:e.toString()}}}var ox=q(U());async function sx({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UNQUOTED"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?Kp(o,s[1].macro):void 0}async function ax(t){let e=await sx(t,M);if(e)return{contents:{kind:ox.MarkupKind.Markdown,value:e.toString()}}}var cx=q(U());async function lx(t){let e=await Xp(t,M);if(e)return e instanceof J?mt(t.context,e):{contents:{kind:cx.MarkupKind.Markdown,value:e.toString()}}}var fx=q(U());async function ux(t,e,r){return(await yh(t,e,r))?.toUpperCase()}async function dx({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UPPER_TOKEN_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Le(s[2].macro);if(typeof a=="number")return o?ux(o,s[1].macro,a):void 0}async function px(t){let e=await dx(t,M);if(e)return{contents:{kind:fx.MarkupKind.Markdown,value:e.toString()}}}var mx=q(U());async function hx({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UPPER_TOKEN"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?Jp(o,s[1].macro):void 0}async function gx(t){let e=await hx(t,M);if(e)return{contents:{kind:mx.MarkupKind.Markdown,value:e.toString()}}}var yx=q(U());async function Tx(t){let e=await Qp(t,M);if(e)return e instanceof J?mt(t.context,e):{contents:{kind:yx.MarkupKind.Markdown,value:e.toString()}}}async function vx(t){let e=await Np(t,M);return e?{contents:e.toMarkupContent(t.context.macros)}:void 0}var _x=q(U());async function bx(t,e){if(!t)return;let r=t.nodeType?.onBus;return r?Z(r)===e:!1}async function Sx(t,e){let r=t.macro.args;if(t.macro.macro!=="DT_ON_BUS"||r?.length!==2)return;let n=await e({...t,macro:r[0]});return await bx(n,r[1].macro)}async function Px(t){let e=await Sx(t,M);return e!==void 0?{contents:{kind:_x.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}async function kx(t){let e=await Ep(t);return e?{contents:e.toMarkupContent(t.context.macros)}:void 0}var Ex=q(U());async function Nx(t,e){return!!await Rp(t,e)}async function Rx(t){let e=t.macro.args;if(!(t.macro.macro!=="DT_HAS_CHOSEN"||e?.length!==1))return await Nx(t.context,e[0].macro)}async function wx(t){let e=await Rx(t);return e!==void 0?{contents:{kind:Ex.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}async function fW(t){return[vx,Px,kx,wx,cI,lI,pI,ZI,hI,mI,TI,$O,KI,II,NI,SI,RI,CI,AI,MI].reduce((e,r)=>e.then(n=>n||r(t)),Promise.resolve(void 0))}async function pW(t){return[DO,RO,$I,hO,yO,vO,jI,sO,cO,uO,nO,UI,HI,eO,fO,WI,SO,YI,_O,OO,qO,VI,zO,jO,HO,zI,QO,KO,ex,ix,ax,lx,px,gx,Tx].reduce((e,r)=>e.then(n=>n||r(t)),Promise.resolve(void 0))}async function Dx(t,e,r){if(r)try{let n=Ji(r,t.position);return await Cx(n,t.position,e,r)}catch{}}async function Cx(t,e,r,n){if(!t?.macro)return;let i=await fW({position:e,context:r,document:n,macro:t})||await pW({position:e,context:r,document:n,macro:t});if(i)return i;let s=await M({document:n,macro:t,context:r,position:e});if(s)return{contents:s.toMarkupContent(r.macros)};let o=await ks(n,t.macro,e,r);if(o)return Cx(o[0],o[1],r,n)}var bc=require("path"),IP=require("fs");var _v=(t,e,r)=>{let n=t instanceof RegExp?Ax(t,r):t,i=e instanceof RegExp?Ax(e,r):e,s=n!==null&&i!=null&&hW(n,i,r);return s&&{start:s[0],end:s[1],pre:r.slice(0,s[0]),body:r.slice(s[0]+n.length,s[1]),post:r.slice(s[1]+i.length)}},Ax=(t,e)=>{let r=e.match(t);return r?r[0]:null},hW=(t,e,r)=>{let n,i,s,o,a,c=r.indexOf(t),l=r.indexOf(e,c+1),u=c;if(c>=0&&l>0){if(t===e)return[c,l];for(n=[],s=r.length;u>=0&&!a;){if(u===c)n.push(u),c=r.indexOf(t,u+1);else if(n.length===1){let d=n.pop();d!==void 0&&(a=[d,l])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=l),l=r.indexOf(e,u+1);u=c<l&&c>=0?c:l}n.length&&o!==void 0&&(a=[s,o])}return a};var Ix="\0SLASH"+Math.random()+"\0",Ox="\0OPEN"+Math.random()+"\0",Rv="\0CLOSE"+Math.random()+"\0",xx="\0COMMA"+Math.random()+"\0",Mx="\0PERIOD"+Math.random()+"\0",mW=new RegExp(Ix,"g"),gW=new RegExp(Ox,"g"),yW=new RegExp(Rv,"g"),TW=new RegExp(xx,"g"),vW=new RegExp(Mx,"g"),bW=/\\\\/g,SW=/\\{/g,_W=/\\}/g,PW=/\\,/g,kW=/\\\./g,NW=1e5,RW=4e6,EW=1e3,wW=1e3;function Pv(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function DW(t){return t.replace(bW,Ix).replace(SW,Ox).replace(_W,Rv).replace(PW,xx).replace(kW,Mx)}function CW(t){return t.replace(mW,"\\").replace(gW,"{").replace(yW,"}").replace(TW,",").replace(vW,".")}function kv(t,e){for(let r=0;r<e.length;r++)t.push(e[r])}function AW(t){let e=[],r="";for(;;){let n=_v("{","}",t);if(!n){let c=t.split(",");return c[0]=r+c[0],kv(e,c),e}let{pre:i,body:s,post:o}=n,a=i.split(",");if(a[0]=r+a[0],a[a.length-1]+="{"+s+"}",!o.length)return kv(e,a),e;r=a.pop(),kv(e,a),t=o}}function Lx(t,e={}){if(!t)return[];let{max:r=NW,maxLength:n=RW,maxDepth:i=EW,maxRewrites:s=wW}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),Nv(DW(t),r,n,i,0,s,!0).map(CW)}function IW(t){return"{"+t+"}"}function OW(t){return/^-?0\d/.test(t)}function xW(t,e){return t<=e}function MW(t,e){return t>=e}function Nl(t,e,r,n,i,s){let o=[],a=0;for(let c=0;c<t.length;c++)for(let l=0;l<r.length;l++){if(o.length>=n)return o;let u=t[c]+e+r[l];if(!(s&&!u)){if(a+u.length>i)return o;o.push(u),a+=u.length}}return o}function LW(t,e,r,n){let i=t.split(/\.\./),s=[];if(i[0]===void 0||i[1]===void 0)return s;let o=Pv(i[0]),a=Pv(i[1]),c=Math.max(i[0].length,i[1].length),l=i.length===3&&i[2]!==void 0?Math.max(Math.abs(Pv(i[2])),1):1,u=xW;a<o&&(l*=-1,u=MW);let f=i.some(OW),p=0;for(let m=o;u(m,a)&&s.length<r;m+=l){let h;if(e)h=String.fromCharCode(m),h==="\\"&&(h="");else if(h=String(m),f){let y=c-h.length;if(y>0){let S=new Array(y+1).join("0");m<0?h="-"+S+h.slice(1):h=S+h}}if(p+h.length>n)break;s.push(h),p+=h.length}return s}function Nv(t,e,r,n,i,s,o){if(i>n)return[t];let a=[""],c=0,l=!1,u=!0;for(;;){let d=_v("{","}",t);if(!d)return Nl(a,t,[""],e,r,l);let f=d.pre;if(/\$$/.test(f)){if(a=Nl(a,f+"{"+d.body+"}",[""],e,r,l&&!d.post.length),u=!1,!d.post.length)break;t=d.post;continue}let p=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(d.body),m=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(d.body),h=p||m,y=d.body.indexOf(",")>=0;if(!h&&!y){if(c<s&&d.post.match(/,(?!,).*\}/)){c++,t=d.pre+"{"+d.body+Rv+d.post,o=!0;continue}return Nl(a,f+"{"+d.body+"}"+d.post,[""],e,r,l)}u&&(l=o&&!h,u=!1);let S;if(h)S=LW(d.body,m,e,r);else{let v=AW(d.body);if(v.length===1&&v[0]!==void 0&&(v=Nv(v[0],e,r,n,i+1,s,!1).map(IW),v.length===1)){if(a=Nl(a,f+v[0],[""],e,r,l&&!d.post.length),!d.post.length)break;t=d.post;continue}let b=l&&!d.post.length&&!f;for(let N=0;b&&N<a.length;N++)a[N]&&(b=!1);S=[];let P=0;e:for(let N=0;N<v.length;N++){let $=Nv(v[N],e,r,n,i+1,s,!1);for(let j=0;j<$.length;j++){let L=$[j];if(!(b&&!L)){if(S.length>=e||P+L.length>r)break e;S.push(L),P+=L.length}}}}if(a=Nl(a,f,S,e,r,l&&!d.post.length),!d.post.length)break;t=d.post}return a}var Rl=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")};var qW={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},El=t=>t.replace(/[[\]\\-]/g,"\\$&"),$W=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),qx=t=>t.join(""),$x=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=r+1,o=!1,a=!1,c=!1,l=!1,u=r,d="";e:for(;s<t.length;){let h=t.charAt(s);if((h==="!"||h==="^")&&s===r+1){l=!0,s++;continue}if(h==="]"&&o&&!c){u=s+1;break}if(o=!0,h==="\\"&&!c){c=!0,s++;continue}if(h==="["&&!c){for(let[y,[S,v,b]]of Object.entries(qW))if(t.startsWith(y,s)){if(d)return["$.",!1,t.length-r,!0];s+=y.length,b?i.push(S):n.push(S),a=a||v;continue e}}if(c=!1,d){h>d?n.push(El(d)+"-"+El(h)):h===d&&n.push(El(h)),d="",s++;continue}if(t.startsWith("-]",s+1)){n.push(El(h+"-")),s+=2;continue}if(t.startsWith("-",s+1)){d=h,s+=2;continue}n.push(El(h)),s++}if(u<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,t.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!l){let h=n[0].length===2?n[0].slice(-1):n[0];return[$W(h),!1,u-r,!1]}let f="["+(l?"^":"")+qx(n)+"]",p="["+(l?"":"^")+qx(i)+"]";return[n.length&&i.length?"("+f+"|"+p+")":n.length?f:p,a,u-r,!0]};var ci=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!0}={})=>r?e?t.replace(/\[([^/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):e?t.replace(/\[([^/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");var sn,FW=new Set(["!","?","+","*","@"]),Ev=t=>FW.has(t),Fx=t=>Ev(t.type),BW=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),jW=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),UW=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),Bx=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),HW="(?!(?:^|/)\\.\\.?(?:$|/))",Th="(?!\\.)",VW=new Set(["[","."]),WW=new Set(["..","."]),zW=new Set("().*{}+?[]^$\\!"),GW=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),wv="[^/]",jx=wv+"*?",Ux=wv+"+?",YW=0,bo=class{type;#e;#r;#n=!1;#t=[];#s;#m;#u;#f=!1;#a;#p;#d=!1;id=++YW;get depth(){return(this.#s?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#s?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(e,r,n={}){this.type=e,e&&(this.#r=!0),this.#s=r,this.#e=this.#s?this.#s.#e:this,this.#a=this.#e===this?n:this.#e.#a,this.#u=this.#e===this?[]:this.#e.#u,e==="!"&&!this.#e.#f&&this.#u.push(this),this.#m=this.#s?this.#s.#t.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#p!==void 0?this.#p:this.type?this.#p=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#p=this.#t.map(e=>String(e)).join("")}#l(){if(this!==this.#e)throw new Error("should only call on root");if(this.#f)return this;this.toString(),this.#f=!0;let e;for(;e=this.#u.pop();){if(e.type!=="!")continue;let r=e,n=r.#s;for(;n;){for(let i=r.#m+1;!n.type&&i<n.#t.length;i++)for(let s of e.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#t[i])}r=n,n=r.#s}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof sn&&r.#s===this))throw new Error("invalid part: "+r);this.#t.push(r)}}toJSON(){let e=this.type===null?this.#t.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#t.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#f&&this.#s?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#s?.isStart())return!1;if(this.#m===0)return!0;let e=this.#s;for(let r=0;r<this.#m;r++){let n=e.#t[r];if(!(n instanceof sn&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#s?.type==="!")return!0;if(!this.#s?.isEnd())return!1;if(!this.type)return this.#s?.isEnd();let e=this.#s?this.#s.#t.length:0;return this.#m===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let r=new sn(this.type,e);for(let n of this.#t)r.copyIn(n);return r}static#o(e,r,n,i,s){let o=i.maxExtglobRecursion??2,a=!1,c=!1,l=-1,u=!1;if(r.type===null){let h=n,y="";for(;h<e.length;){let S=e.charAt(h++);if(a||S==="\\"){a=!a,y+=S;continue}if(c){h===l+1?(S==="^"||S==="!")&&(u=!0):S==="]"&&!(h===l+2&&u)&&(c=!1),y+=S;continue}else if(S==="["){c=!0,l=h,u=!1,y+=S;continue}if(!i.noext&&Ev(S)&&e.charAt(h)==="("&&s<=o){r.push(y),y="";let b=new sn(S,r);h=sn.#o(e,b,h,i,s+1),r.push(b);continue}y+=S}return r.push(y),h}let d=n+1,f=new sn(null,r),p=[],m="";for(;d<e.length;){let h=e.charAt(d++);if(a||h==="\\"){a=!a,m+=h;continue}if(c){d===l+1?(h==="^"||h==="!")&&(u=!0):h==="]"&&!(d===l+2&&u)&&(c=!1),m+=h;continue}else if(h==="["){c=!0,l=d,u=!1,m+=h;continue}if(!i.noext&&Ev(h)&&e.charAt(d)==="("&&(s<=o||r&&r.#g(h))){let S=r&&r.#g(h)?0:1;f.push(m),m="";let v=new sn(h,f);f.push(v),d=sn.#o(e,v,d,i,s+S);continue}if(h==="|"){f.push(m),m="",p.push(f),f=new sn(null,r);continue}if(h===")")return m===""&&r.#t.length===0&&(r.#d=!0),f.push(m),m="",r.push(...p,f),d;m+=h}return r.type=null,r.#r=void 0,r.#t=[e.substring(n-1)],d}#b(e){return this.#_(e,jW)}#_(e,r=BW){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let n=e.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#g(n.type,r)}#g(e,r=UW){return!!r.get(this.type)?.includes(e)}#y(e,r){let n=e.#t[0],i=new sn(null,n,this.options);i.#t.push(""),n.push(i),this.#R(e,r)}#R(e,r){let n=e.#t[0];this.#t.splice(r,1,...n.#t);for(let i of n.#t)typeof i=="object"&&(i.#s=this);this.#p=void 0}#T(e){return!!Bx.get(this.type)?.has(e)}#P(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let r=e.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#T(r.type)}#k(e){let r=Bx.get(this.type),n=e.#t[0],i=r?.get(n.type);if(!i)return!1;this.#t=n.#t;for(let s of this.#t)typeof s=="object"&&(s.#s=this);this.type=i,this.#p=void 0,this.#d=!1}static fromGlob(e,r={}){let n=new sn(null,void 0,r);return sn.#o(e,n,0,r,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[r,n,i,s]=this.toRegExpSource();if(!(i||this.#r||this.#a.nocase&&!this.#a.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#a.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:e})}get options(){return this.#a}toRegExpSource(e){let r=e??!!this.#a.dot;if(this.#e===this&&(this.#h(),this.#l()),!Fx(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(p=>typeof p!="string"),l=this.#t.map(p=>{let[m,h,y,S]=typeof p=="string"?sn.#S(p,this.#r,c):p.toRegExpSource(e);return this.#r=this.#r||y,this.#n=this.#n||S,m}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&WW.has(this.#t[0]))){let m=VW,h=r&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),y=!r&&!e&&m.has(l.charAt(0));u=h?HW:y?Th:""}let d="";return this.isEnd()&&this.#e.#f&&this.#s?.type==="!"&&(d="(?:$|\\/)"),[u+l+d,ci(l),this.#r=!!this.#r,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#v(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),l=this;return l.#t=[c],l.type=null,l.#r=void 0,[c,ci(this.toString()),!1,!1]}let o=!n||e||r||!Th?"":this.#v(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#d)a=(this.isStart()&&!r?Th:"")+Ux;else{let c=this.type==="!"?"))"+(this.isStart()&&!r&&!e?Th:"")+jx+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+c}return[a,ci(s),this.#r=!!this.#r,this.#n]}#h(){if(Fx(this)){let e=0,r=!1;do{r=!0;for(let n=0;n<this.#t.length;n++){let i=this.#t[n];typeof i=="object"&&(i.#h(),this.#_(i)?(r=!1,this.#R(i,n)):this.#b(i)?(r=!1,this.#y(i,n)):this.#P(i)&&(r=!1,this.#k(i)))}}while(!r&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#h();this.#p=void 0}#v(e){return this.#t.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=r.toRegExpSource(e);return this.#n=this.#n||o,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#S(e,r,n=!1){let i=!1,s="",o=!1,a=!1;for(let c=0;c<e.length;c++){let l=e.charAt(c);if(i){i=!1,s+=(zW.has(l)?"\\":"")+l;continue}if(l==="*"){if(a)continue;a=!0,s+=n&&/^[*]+$/.test(e)?Ux:jx,r=!0;continue}else a=!1;if(l==="\\"){c===e.length-1?s+="\\\\":i=!0;continue}if(l==="["){let[u,d,f,p]=$x(e,c);if(f){s+=u,o=o||d,c+=f-1,r=r||p;continue}}if(l==="?"){s+=wv,r=!0;continue}s+=GW(l)}return[s,ci(e),!!r,o]}};sn=bo;var Ba=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!1}={})=>r?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");var jr=(t,e,r={})=>(Rl(e),!r.nocomment&&e.charAt(0)==="#"?!1:new _n(e,r).match(t)),KW=/^\*+([^+@!?*[(]*)$/,XW=t=>e=>!e.startsWith(".")&&e.endsWith(t),JW=t=>e=>e.endsWith(t),QW=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),ZW=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),e2=/^\*+\.\*+$/,t2=t=>!t.startsWith(".")&&t.includes("."),r2=t=>t!=="."&&t!==".."&&t.includes("."),n2=/^\.\*+$/,i2=t=>t!=="."&&t!==".."&&t.startsWith("."),s2=/^\*+$/,o2=t=>t.length!==0&&!t.startsWith("."),a2=t=>t.length!==0&&t!=="."&&t!=="..",c2=/^\?+([^+@!?*[(]*)?$/,l2=([t,e=""])=>{let r=Wx([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},u2=([t,e=""])=>{let r=zx([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},d2=([t,e=""])=>{let r=zx([t]);return e?n=>r(n)&&n.endsWith(e):r},f2=([t,e=""])=>{let r=Wx([t]);return e?n=>r(n)&&n.endsWith(e):r},Wx=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},zx=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},Gx=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Hx={win32:{sep:"\\"},posix:{sep:"/"}},p2=Gx==="win32"?Hx.win32.sep:Hx.posix.sep;jr.sep=p2;var jt=Symbol("globstar **");jr.GLOBSTAR=jt;var h2="[^/]",m2=h2+"*?",g2="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",y2="(?:(?!(?:\\/|^)\\.).)*?",T2=(t,e={})=>r=>jr(r,t,e);jr.filter=T2;var qn=(t,e={})=>Object.assign({},t,e),v2=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return jr;let e=jr;return Object.assign((n,i,s={})=>e(n,i,qn(t,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,qn(t,s))}static defaults(i){return e.defaults(qn(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,qn(t,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,qn(t,s))}},unescape:(n,i={})=>e.unescape(n,qn(t,i)),escape:(n,i={})=>e.escape(n,qn(t,i)),filter:(n,i={})=>e.filter(n,qn(t,i)),defaults:n=>e.defaults(qn(t,n)),makeRe:(n,i={})=>e.makeRe(n,qn(t,i)),braceExpand:(n,i={})=>e.braceExpand(n,qn(t,i)),match:(n,i,s={})=>e.match(n,i,qn(t,s)),sep:e.sep,GLOBSTAR:jt})};jr.defaults=v2;var Yx=(t,e={})=>(Rl(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:Lx(t,{max:e.braceExpandMax}));jr.braceExpand=Yx;var b2=(t,e={})=>new _n(t,e).makeRe();jr.makeRe=b2;var S2=(t,e,r={})=>{let n=new _n(e,r);return t=t.filter(i=>n.match(i)),n.options.nonull&&!t.length&&t.push(e),t};jr.match=S2;var Vx=/[?*]|[+@!]\(.*?\)|\[|\]/,_2=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),_n=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,r={}){Rl(e),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=e,this.platform=r.platform||Gx,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let r of e)if(typeof r!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!Vx.test(s[2]))&&!Vx.test(s[3]),l=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(u=>this.parse(u))];if(l)return[s[0],...s.slice(1).map(u=>this.parse(u))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n of e)for(let i=0;i<n.length;i++)n[i]==="**"&&(n[i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):r>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(e){return e.map(r=>(r=r.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(r=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(r=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(r=!0,e.splice(n-1,2),n-=2)}}while(r);return e.length===0?[""]:e}firstPhasePreProcess(e){let r=!1;do{r=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let a=n[i+1],c=n[i+2],l=n[i+3];if(a!==".."||!c||c==="."||c===".."||!l||l==="."||l==="..")continue;r=!0,n.splice(i,1);let u=n.slice(0);u[i]="**",e.push(u),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){r=!0;let c=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...c),n.length===0&&n.push(""),s-=2}}}}while(r);return e}secondPhasePreProcess(e){for(let r=0;r<e.length-1;r++)for(let n=r+1;n<e.length;n++){let i=this.partsMatch(e[r],e[n],!this.preserveMultipleSlashes);if(i){e[r]=[],e[n]=i;break}}return e.filter(r=>r.length)}partsMatch(e,r,n=!1){let i=0,s=0,o=[],a="";for(;i<e.length&&s<r.length;)if(e[i]===r[s])o.push(a==="b"?r[s]:e[i]),i++,s++;else if(n&&e[i]==="**"&&r[s]===e[i+1])o.push(e[i]),i++;else if(n&&r[s]==="**"&&e[i]===r[s+1])o.push(r[s]),s++;else if(e[i]==="*"&&r[s]&&(this.options.dot||!r[s].startsWith("."))&&r[s]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,s++}else if(r[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(r[s]),i++,s++}else return!1;return e.length===r.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,r=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=e.slice(n)),this.negate=r}matchOne(e,r,n=!1){let i=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),c=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),l=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),u=!l&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),d=c?3:a?0:void 0,f=u?3:l?0:void 0;if(typeof d=="number"&&typeof f=="number"){let[p,m]=[e[d],r[f]];p.toLowerCase()===m.toLowerCase()&&(r[f]=p,s=f,i=d)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),r.includes(jt)?this.#e(e,r,n,i,s):this.#n(e,r,n,i,s)}#e(e,r,n,i,s){let o=r.indexOf(jt,s),a=r.lastIndexOf(jt),[c,l,u]=n?[r.slice(s,o),r.slice(o+1),[]]:[r.slice(s,o),r.slice(o+1,a),r.slice(a+1)];if(c.length){let v=e.slice(i,i+c.length);if(!this.#n(v,c,n,0,0))return!1;i+=c.length,s+=c.length}let d=0;if(u.length){if(u.length+i>e.length)return!1;let v=e.length-u.length;if(this.#n(e,u,n,v,0))d=u.length;else{if(e[e.length-1]!==""||i+u.length===e.length||(v--,!this.#n(e,u,n,v,0)))return!1;d=u.length+1}}if(!l.length){let v=!!d;for(let b=i;b<e.length-d;b++){let P=String(e[b]);if(v=!0,P==="."||P===".."||!this.options.dot&&P.startsWith("."))return!1}return n||v}let f=[[[],0]],p=f[0],m=0,h=[0];for(let v of l)v===jt?(h.push(m),p=[[],0],f.push(p)):(p[0].push(v),m++);let y=f.length-1,S=e.length-d;for(let v of f)v[1]=S-(h[y--]+v[0].length);return!!this.#r(e,f,i,0,n,0,!!d)}#r(e,r,n,i,s,o,a){let c=r[i];if(!c){for(let d=n;d<e.length;d++){a=!0;let f=e[d];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return a}let[l,u]=c;for(;n<=u;){if(this.#n(e.slice(0,n+l.length),l,s,n,0)&&o<this.maxGlobstarRecursion){let p=this.#r(e,r,n+l.length,i+1,s,o+1,a);if(p!==!1)return p}let f=e[n];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;n++}return s||null}#n(e,r,n,i,s){let o,a,c,l;for(o=i,a=s,l=e.length,c=r.length;o<l&&a<c;o++,a++){this.debug("matchOne loop");let u=r[a],d=e[o];if(this.debug(r,u,d),u===!1||u===jt)return!1;let f;if(typeof u=="string"?(f=d===u,this.debug("string match",u,d,f)):(f=u.test(d),this.debug("pattern match",u,d,f)),!f)return!1}if(o===l&&a===c)return!0;if(o===l)return n;if(a===c)return o===l-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return Yx(this.pattern,this.options)}parse(e){Rl(e);let r=this.options;if(e==="**")return jt;if(e==="")return"";let n,i=null;(n=e.match(s2))?i=r.dot?a2:o2:(n=e.match(KW))?i=(r.nocase?r.dot?ZW:QW:r.dot?JW:XW)(n[1]):(n=e.match(c2))?i=(r.nocase?r.dot?u2:l2:r.dot?d2:f2)(n):(n=e.match(e2))?i=r.dot?r2:t2:(n=e.match(n2))&&(i=i2);let s=bo.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?m2:r.dot?g2:y2,i=new Set(r.nocase?["i"]:[]),s=e.map(c=>{let l=c.map(d=>{if(d instanceof RegExp)for(let f of d.flags.split(""))i.add(f);return typeof d=="string"?_2(d):d===jt?jt:d._src});l.forEach((d,f)=>{let p=l[f+1],m=l[f-1];d!==jt||m===jt||(m===void 0?p!==void 0&&p!==jt?l[f+1]="(?:\\/|"+n+"\\/)?"+p:l[f]=n:p===void 0?l[f-1]=m+"(?:\\/|\\/"+n+")?":p!==jt&&(l[f-1]=m+"(?:\\/|\\/"+n+"\\/)"+p,l[f+1]=jt))});let u=l.filter(d=>d!==jt);if(this.partial&&u.length>=1){let d=[];for(let f=1;f<=u.length;f++)d.push(u.slice(0,f).join("/"));return"(?:"+d.join("|")+")"}return u.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a of s){let c=i;if(n.matchBase&&a.length===1&&(c=[o]),this.matchOne(c,a,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return jr.defaults(e).Minimatch}};jr.AST=bo;jr.Minimatch=_n;jr.escape=Ba;jr.unescape=ci;var TM=require("node:url");var bh=require("node:diagnostics_channel"),yr=(0,bh.channel)("lru-cache:metrics"),wl=(0,bh.tracingChannel)("lru-cache"),P2=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Dv=()=>yr.hasSubscribers||wl.hasSubscribers,Xx=new Set,Kx=typeof process=="object"&&process?process:{},k2=(t,e,r,n)=>{typeof Kx.emitWarning=="function"?Kx.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)},N2=t=>!Xx.has(t),Ds=t=>!!t&&t===Math.floor(t)&&t>0&&isFinite(t),Jx=t=>Ds(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?vh:null:null,vh=class extends Array{constructor(t){super(t),this.fill(0)}},R2=class Dl{heap;length;static#e=!1;static create(e){let r=Jx(e);if(!r)return[];Dl.#e=!0;let n=new Dl(e,r);return Dl.#e=!1,n}constructor(e,r){if(!Dl.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Cl=class Qx{#e;#r;#n;#t;#s;#m;#u;#f;get perf(){return this.#f}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#a;#p;#d;#l;#o;#b;#_;#g;#y;#R;#T;#P;#k;#h;#v;#S;#w;#i;#A;static unsafeExposeInternals(e){return{starts:e.#k,ttls:e.#h,autopurgeTimers:e.#v,sizes:e.#P,keyMap:e.#d,keyList:e.#l,valList:e.#o,next:e.#b,prev:e.#_,get head(){return e.#g},get tail(){return e.#y},free:e.#R,isBackgroundFetch:r=>e.#c(r),backgroundFetch:(r,n,i,s)=>e.#q(r,n,i,s),moveToTail:r=>e.#Y(r),indexes:r=>e.#D(r),rindexes:r=>e.#C(r),isStale:r=>e.#N(r)}}get max(){return this.#e}get maxSize(){return this.#r}get calculatedSize(){return this.#p}get size(){return this.#a}get fetchMethod(){return this.#m}get memoMethod(){return this.#u}get dispose(){return this.#n}get onInsert(){return this.#t}get disposeAfter(){return this.#s}constructor(e){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:c,dispose:l,onInsert:u,disposeAfter:d,noDisposeOnSet:f,noUpdateTTL:p,maxSize:m=0,maxEntrySize:h=0,sizeCalculation:y,fetchMethod:S,memoMethod:v,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:P,allowStaleOnFetchRejection:N,allowStaleOnFetchAbort:$,ignoreFetchAbort:j,backgroundFetchSize:L=1,perf:ye}=e;if(this.backgroundFetchSize=L,ye!==void 0&&typeof ye?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#f=ye??P2,r!==0&&!Ds(r))throw new TypeError("max option must be a nonnegative integer");let qe=r?Jx(r):Array;if(!qe)throw new Error("invalid max value: "+r);if(this.#e=r,this.#r=m,this.maxEntrySize=h||this.#r,this.sizeCalculation=y,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(v!==void 0&&typeof v!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#u=v,S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#m=S,this.#w=!!S,this.#d=new Map,this.#l=Array.from({length:r}).fill(void 0),this.#o=Array.from({length:r}).fill(void 0),this.#b=new qe(r),this.#_=new qe(r),this.#g=0,this.#y=0,this.#R=R2.create(r),this.#a=0,this.#p=0,typeof l=="function"&&(this.#n=l),typeof u=="function"&&(this.#t=u),typeof d=="function"?(this.#s=d,this.#T=[]):(this.#s=void 0,this.#T=void 0),this.#S=!!this.#n,this.#A=!!this.#t,this.#i=!!this.#s,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!N,this.allowStaleOnFetchAbort=!!$,this.ignoreFetchAbort=!!j,this.maxEntrySize!==0){if(this.#r!==0&&!Ds(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!Ds(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#V()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!P,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=Ds(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!Ds(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#I()}if(this.#e===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#r){let pe="LRU_CACHE_UNBOUNDED";N2(pe)&&(Xx.add(pe),k2("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",pe,Qx))}}getRemainingTTL(e){return this.#d.has(e)?1/0:0}#I(){let e=new vh(this.#e),r=new vh(this.#e);this.#h=e,this.#k=r;let n=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#v=n,this.#F=(c,l,u=this.#f.now())=>{r[c]=l!==0?u:0,e[c]=l,i(c,l)},this.#E=c=>{r[c]=e[c]!==0?this.#f.now():0,i(c,e[c])};let i=this.ttlAutopurge?(c,l)=>{if(n?.[c]&&(clearTimeout(n[c]),n[c]=void 0),l&&l!==0&&n){let u=setTimeout(()=>{this.#N(c)?(this.#$(this.#l[c],"expire"),n[c]=void 0):i(c,a(c))},l+1);u.unref&&u.unref(),n[c]=u}}:()=>{};this.#O=(c,l)=>{if(e[l]){let u=e[l],d=r[l];if(!u||!d)return;c.ttl=u,c.start=d,c.now=s||o();let f=c.now-d;c.remainingTTL=u-f}};let s=0,o=()=>{let c=this.#f.now();if(this.ttlResolution>0){s=c;let l=setTimeout(()=>s=0,this.ttlResolution);l.unref&&l.unref()}return c};this.getRemainingTTL=c=>{let l=this.#d.get(c);return l===void 0?0:a(l)};let a=c=>{let l=e[c],u=r[c];if(!l||!u)return 1/0;let d=(s||o())-u;return l-d};this.#N=c=>{let l=r[c],u=e[c];return!!u&&!!l&&(s||o())-l>u}}#E=()=>{};#O=()=>{};#F=()=>{};#N=()=>!1;#V(){let e=new vh(this.#e);this.#p=0,this.#P=e,this.#M=r=>{this.#p-=e[r],e[r]=0},this.#B=(r,n,i,s)=>{if(!Ds(i)){if(this.#c(n))return this.backgroundFetchSize;if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,r),!Ds(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return i},this.#x=(r,n,i)=>{if(e[r]=n,this.#r){let s=this.#r-e[r];for(;this.#p>s;)this.#H(!0)}this.#p+=e[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#p)}}#M=e=>{};#x=(e,r,n)=>{};#B=(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#D({allowStale:e=this.allowStale}={}){if(this.#a)for(let r=this.#y;this.#j(r)&&((e||!this.#N(r))&&(yield r),r!==this.#g);)r=this.#_[r]}*#C({allowStale:e=this.allowStale}={}){if(this.#a)for(let r=this.#g;this.#j(r)&&((e||!this.#N(r))&&(yield r),r!==this.#y);)r=this.#b[r]}#j(e){return e!==void 0&&this.#d.get(this.#l[e])===e}*entries(){for(let e of this.#D())this.#o[e]!==void 0&&this.#l[e]!==void 0&&!this.#c(this.#o[e])&&(yield[this.#l[e],this.#o[e]])}*rentries(){for(let e of this.#C())this.#o[e]!==void 0&&this.#l[e]!==void 0&&!this.#c(this.#o[e])&&(yield[this.#l[e],this.#o[e]])}*keys(){for(let e of this.#D()){let r=this.#l[e];r!==void 0&&!this.#c(this.#o[e])&&(yield r)}}*rkeys(){for(let e of this.#C()){let r=this.#l[e];r!==void 0&&!this.#c(this.#o[e])&&(yield r)}}*values(){for(let e of this.#D())this.#o[e]!==void 0&&!this.#c(this.#o[e])&&(yield this.#o[e])}*rvalues(){for(let e of this.#C())this.#o[e]!==void 0&&!this.#c(this.#o[e])&&(yield this.#o[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#D()){let i=this.#o[n],s=this.#c(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#l[n],this))return this.#G(this.#l[n],r)}}forEach(e,r=this){for(let n of this.#D()){let i=this.#o[n],s=this.#c(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#l[n],this)}}rforEach(e,r=this){for(let n of this.#C()){let i=this.#o[n],s=this.#c(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#l[n],this)}}purgeStale(){let e=!1;for(let r of this.#C({allowStale:!0}))this.#N(r)&&(this.#$(this.#l[r],"expire"),e=!0);return e}info(e){let r=this.#d.get(e);if(r===void 0)return;let n=this.#o[r],i=this.#c(n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(this.#h&&this.#k){let o=this.#h[r],a=this.#k[r];if(o&&a){let c=o-(this.#f.now()-a);s.ttl=c,s.start=Date.now()}}return this.#P&&(s.size=this.#P[r]),s}dump(){let e=[];for(let r of this.#D({allowStale:!0})){let n=this.#l[r],i=this.#o[r],s=this.#c(i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let o={value:s};if(this.#h&&this.#k){o.ttl=this.#h[r];let a=this.#f.now()-this.#k[r];o.start=Math.floor(Date.now()-a)}this.#P&&(o.size=this.#P[r]),e.unshift([n,o])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let i=Date.now()-n.start;n.start=this.#f.now()-i}this.#L(r,n.value,n)}}set(e,r,n={}){let{status:i=yr.hasSubscribers?{}:void 0}=n;n.status=i,i&&(i.op="set",i.key=e,r!==void 0&&(i.value=r),i.cache=this);let s=this.#L(e,r,n);return i&&yr.hasSubscribers&&yr.publish(i),s}#L(e,r,n,i){let{ttl:s=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:l}=n,u=this.#c(r);if(r===void 0)return l&&(l.set="deleted"),this.delete(e),this;let{noUpdateTTL:d=this.noUpdateTTL}=n;l&&!u&&(l.value=r);let f=this.#B(e,r,n.size||0,c,l);if(this.maxEntrySize&&f>this.maxEntrySize)return this.#$(e,"set"),l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this;let p=this.#a===0?void 0:this.#d.get(e);if(p===void 0)p=this.#a===0?this.#y:this.#R.length!==0?this.#R.pop():this.#a===this.#e?this.#H(!1):this.#a,this.#l[p]=e,this.#o[p]=r,this.#d.set(e,p),this.#b[this.#y]=p,this.#_[p]=this.#y,this.#y=p,this.#a++,this.#x(p,f,l),l&&(l.set="add"),d=!1,this.#A&&!u&&this.#t?.(r,e,"add");else{this.#Y(p);let m=this.#o[p];if(r!==m){if(!a)if(this.#c(m)){m!==i&&m.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:h}=m;h!==void 0&&h!==r&&(this.#S&&this.#n?.(h,e,"set"),this.#i&&this.#T?.push([h,e,"set"]))}else this.#S&&this.#n?.(m,e,"set"),this.#i&&this.#T?.push([m,e,"set"]);if(this.#M(p),this.#x(p,f,l),this.#o[p]=r,!u){let h=m&&this.#c(m)?m.__staleWhileFetching:m,y=h===void 0?"add":r!==h?"replace":"update";l&&(l.set=y,h!==void 0&&(l.oldValue=h)),this.#A&&this.onInsert?.(r,e,y)}}else u||(l&&(l.set="update"),this.#A&&this.onInsert?.(r,e,"update"))}if(s!==0&&!this.#h&&this.#I(),this.#h&&(d||this.#F(p,s,o),l&&this.#O(l,p)),!a&&this.#i&&this.#T){let m=this.#T,h;for(;h=m?.shift();)this.#s?.(...h)}return this}pop(){try{for(;this.#a;){let e=this.#o[this.#g];if(this.#H(!0),this.#c(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#i&&this.#T){let e=this.#T,r;for(;r=e?.shift();)this.#s?.(...r)}}}#H(e){let r=this.#g,n=this.#l[r],i=this.#o[r],s=this.#c(i);s&&i.__abortController.abort(new Error("evicted"));let o=s?i.__staleWhileFetching:i;return(this.#S||this.#i)&&o!==void 0&&(this.#S&&this.#n?.(o,n,"evict"),this.#i&&this.#T?.push([o,n,"evict"])),this.#M(r),this.#v?.[r]&&(clearTimeout(this.#v[r]),this.#v[r]=void 0),e&&(this.#l[r]=void 0,this.#o[r]=void 0,this.#R.push(r)),this.#a===1?(this.#g=this.#y=0,this.#R.length=0):this.#g=this.#b[r],this.#d.delete(n),this.#a--,r}has(e,r={}){let{status:n=yr.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="has",n.key=e,n.cache=this);let i=this.#K(e,r);return yr.hasSubscribers&&yr.publish(n),i}#K(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,s=this.#d.get(e);if(s!==void 0){let o=this.#o[s];if(this.#c(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#N(s))i&&(i.has="stale",this.#O(i,s));else return n&&this.#E(s),i&&(i.has="hit",this.#O(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{status:n=Dv()?{}:void 0}=r;n&&(n.op="peek",n.key=e,n.cache=this),r.status=n;let i=this.#W(e,r);return yr.hasSubscribers&&yr.publish(n),i}#W(e,r){let{status:n,allowStale:i=this.allowStale}=r,s=this.#d.get(e);if(s===void 0||!i&&this.#N(s)){n&&(n.peek=s===void 0?"miss":"stale");return}let o=this.#o[s],a=this.#c(o)?o.__staleWhileFetching:o;return n&&(a!==void 0?(n.peek="hit",n.value=a):n.peek="miss"),a}#q(e,r,n,i){let s=r===void 0?void 0:this.#o[r];if(this.#c(s))return s;let o=new AbortController,{signal:a}=n;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let c={signal:o.signal,options:n,context:i},l=(h,y=!1)=>{let{aborted:S}=o.signal,v=n.ignoreFetchAbort&&h!==void 0,b=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&h!==void 0);if(n.status&&(S&&!y?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,v&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),S&&!v&&!y)return d(o.signal.reason,b);let P=p,N=this.#o[r];return(N===p||N===void 0&&v&&y)&&(h===void 0?P.__staleWhileFetching!==void 0?this.#o[r]=P.__staleWhileFetching:this.#$(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.#L(e,h,c.options,P))),h},u=h=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=h),d(h,!1)),d=(h,y)=>{let{aborted:S}=o.signal,v=S&&n.allowStaleOnFetchAbort,b=v||n.allowStaleOnFetchRejection,P=b||n.noDeleteOnFetchRejection,N=p;if(this.#o[r]===p&&(!P||!y&&N.__staleWhileFetching===void 0?this.#$(e,"fetch"):v||(this.#o[r]=N.__staleWhileFetching)),b)return n.status&&N.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),N.__staleWhileFetching;if(N.__returned===N)throw h},f=(h,y)=>{let S=this.#m?.(e,s,c);o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(h(void 0),n.allowStaleOnFetchAbort&&(h=v=>l(v,!0)))}),S&&S instanceof Promise?S.then(v=>h(v===void 0?void 0:v),y):S!==void 0&&h(S)};n.status&&(n.status.fetchDispatched=!0);let p=new Promise(f).then(l,u),m=Object.assign(p,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return r===void 0?(this.#L(e,m,{...c.options,status:void 0}),r=this.#d.get(e)):this.#o[r]=m,m}#c(e){if(!this.#w)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof AbortController}fetch(e,r={}){let n=wl.hasSubscribers,{status:i=Dv()?{}:void 0}=r;r.status=i,i&&r.context&&(i.context=r.context);let s=this.#z(e,r);return i&&n&&(i.trace=!0,wl.tracePromise(()=>s,i).catch(()=>{})),s}async#z(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:c=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:h,forceRefresh:y=!1,status:S,signal:v}=r;if(S&&(S.op="fetch",S.key=e,y&&(S.forceRefresh=!0),S.cache=this),!this.#w)return S&&(S.fetch="get"),this.#G(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:S});let b={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:a,size:c,sizeCalculation:l,noUpdateTTL:u,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:m,ignoreFetchAbort:p,status:S,signal:v},P=this.#d.get(e);if(P===void 0){S&&(S.fetch="miss");let N=this.#q(e,P,b,h);return N.__returned=N}else{let N=this.#o[P];if(this.#c(N)){let ye=n&&N.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",ye&&(S.returnedStale=!0)),ye?N.__staleWhileFetching:N.__returned=N}let $=this.#N(P);if(!y&&!$)return S&&(S.fetch="hit"),this.#Y(P),i&&this.#E(P),S&&this.#O(S,P),N;let j=this.#q(e,P,b,h),L=j.__staleWhileFetching!==void 0&&n;return S&&(S.fetch=$?"stale":"refresh",L&&$&&(S.returnedStale=!0)),L?j.__staleWhileFetching:j.__returned=j}}forceFetch(e,r={}){let n=wl.hasSubscribers,{status:i=Dv()?{}:void 0}=r;r.status=i,i&&r.context&&(i.context=r.context);let s=this.#U(e,r);return i&&n&&(i.trace=!0,wl.tracePromise(()=>s,i).catch(()=>{})),s}async#U(e,r={}){let n=await this.#z(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let{status:n=yr.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="memo",n.key=e,r.context&&(n.context=r.context),n.cache=this);let i=this.#Q(e,r);return n&&(n.value=i),yr.hasSubscribers&&yr.publish(n),i}#Q(e,r={}){let n=this.#u;if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,status:s,forceRefresh:o,...a}=r;s&&o&&(s.forceRefresh=!0);let c=this.#G(e,a),l=o||c===void 0;if(s&&(s.memo=l?"miss":"hit",l||(s.value=c)),!l)return c;let u=n(e,c,{options:a,context:i});return s&&(s.value=u),this.#L(e,u,a),u}get(e,r={}){let{status:n=yr.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="get",n.key=e,n.cache=this);let i=this.#G(e,r);return n&&(i!==void 0&&(n.value=i),yr.hasSubscribers&&yr.publish(n)),i}#G(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=r,a=this.#d.get(e);if(a===void 0){o&&(o.get="miss");return}let c=this.#o[a],l=this.#c(c);return o&&this.#O(o,a),this.#N(a)?l?(o&&(o.get="stale-fetching"),n&&c.__staleWhileFetching!==void 0?(o&&(o.returnedStale=!0),c.__staleWhileFetching):void 0):(s||this.#$(e,"expire"),o&&(o.get="stale"),n?(o&&(o.returnedStale=!0),c):void 0):(o&&(o.get=l?"fetching":"hit"),this.#Y(a),i&&this.#E(a),l?c.__staleWhileFetching:c)}#X(e,r){this.#_[r]=e,this.#b[e]=r}#Y(e){e!==this.#y&&(e===this.#g?this.#g=this.#b[e]:this.#X(this.#_[e],this.#b[e]),this.#X(this.#y,e),this.#y=e)}delete(e){return this.#$(e,"delete")}#$(e,r){yr.hasSubscribers&&yr.publish({op:"delete",delete:r,key:e,cache:this});let n=!1;if(this.#a!==0){let i=this.#d.get(e);if(i!==void 0)if(this.#v?.[i]&&(clearTimeout(this.#v[i]),this.#v[i]=void 0),n=!0,this.#a===1)this.#J(r);else{this.#M(i);let s=this.#o[i];if(this.#c(s)?s.__abortController.abort(new Error("deleted")):(this.#S||this.#i)&&(this.#S&&this.#n?.(s,e,r),this.#i&&this.#T?.push([s,e,r])),this.#d.delete(e),this.#l[i]=void 0,this.#o[i]=void 0,i===this.#y)this.#y=this.#_[i];else if(i===this.#g)this.#g=this.#b[i];else{let o=this.#_[i];this.#b[o]=this.#b[i];let a=this.#b[i];this.#_[a]=this.#_[i]}this.#a--,this.#R.push(i)}}if(this.#i&&this.#T?.length){let i=this.#T,s;for(;s=i?.shift();)this.#s?.(...s)}return n}clear(){return this.#J("delete")}#J(e){for(let r of this.#C({allowStale:!0})){let n=this.#o[r];if(this.#c(n))n.__abortController.abort(new Error("deleted"));else{let i=this.#l[r];this.#S&&this.#n?.(n,i,e),this.#i&&this.#T?.push([n,i,e])}}if(this.#d.clear(),this.#o.fill(void 0),this.#l.fill(void 0),this.#h&&this.#k){this.#h.fill(0),this.#k.fill(0);for(let r of this.#v??[])r!==void 0&&clearTimeout(r);this.#v?.fill(void 0)}if(this.#P&&this.#P.fill(0),this.#g=0,this.#y=0,this.#R.length=0,this.#p=0,this.#a=0,this.#i&&this.#T){let r=this.#T,n;for(;n=r?.shift();)this.#s?.(...n)}}};var Ha=require("node:path"),cM=require("node:url"),xi=require("fs"),L2=q(require("node:fs"),1),Is=require("node:fs/promises");var Eh=require("node:events"),Lv=q(require("node:stream"),1),nM=require("node:string_decoder"),Zx=typeof process=="object"&&process?process:{stdout:null,stderr:null},E2=t=>!!t&&typeof t=="object"&&(t instanceof As||t instanceof Lv.default||w2(t)||D2(t)),w2=t=>!!t&&typeof t=="object"&&t instanceof Eh.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==Lv.default.Writable.prototype.pipe,D2=t=>!!t&&typeof t=="object"&&t instanceof Eh.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",es=Symbol("EOF"),ts=Symbol("maybeEmitEnd"),Cs=Symbol("emittedEnd"),Sh=Symbol("emittingEnd"),Al=Symbol("emittedError"),_h=Symbol("closed"),eM=Symbol("read"),Ph=Symbol("flush"),tM=Symbol("flushChunk"),li=Symbol("encoding"),ja=Symbol("decoder"),or=Symbol("flowing"),Il=Symbol("paused"),Ua=Symbol("resume"),ar=Symbol("buffer"),Ur=Symbol("pipes"),cr=Symbol("bufferLength"),Cv=Symbol("bufferPush"),kh=Symbol("bufferShift"),Dr=Symbol("objectMode"),Ut=Symbol("destroyed"),Av=Symbol("error"),Iv=Symbol("emitData"),rM=Symbol("emitEnd"),Ov=Symbol("emitEnd2"),Ii=Symbol("async"),xv=Symbol("abort"),Nh=Symbol("aborted"),Ol=Symbol("signal"),So=Symbol("dataListeners"),Pn=Symbol("discarded"),xl=t=>Promise.resolve().then(t),C2=t=>t(),A2=t=>t==="end"||t==="finish"||t==="prefinish",I2=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,O2=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Rh=class{src;dest;opts;ondrain;constructor(e,r,n){this.src=e,this.dest=r,this.opts=n,this.ondrain=()=>e[Ua](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Mv=class extends Rh{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,r,n){super(e,r,n),this.proxyErrors=i=>this.dest.emit("error",i),e.on("error",this.proxyErrors)}},x2=t=>!!t.objectMode,M2=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",As=class extends Eh.EventEmitter{[or]=!1;[Il]=!1;[Ur]=[];[ar]=[];[Dr];[li];[Ii];[ja];[es]=!1;[Cs]=!1;[Sh]=!1;[_h]=!1;[Al]=null;[cr]=0;[Ut]=!1;[Ol];[Nh]=!1;[So]=0;[Pn]=!1;writable=!0;readable=!0;constructor(...e){let r=e[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");x2(r)?(this[Dr]=!0,this[li]=null):M2(r)?(this[li]=r.encoding,this[Dr]=!1):(this[Dr]=!1,this[li]=null),this[Ii]=!!r.async,this[ja]=this[li]?new nM.StringDecoder(this[li]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[ar]}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Ur]});let{signal:n}=r;n&&(this[Ol]=n,n.aborted?this[xv]():n.addEventListener("abort",()=>this[xv]()))}get bufferLength(){return this[cr]}get encoding(){return this[li]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Dr]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ii]}set async(e){this[Ii]=this[Ii]||!!e}[xv](){this[Nh]=!0,this.emit("abort",this[Ol]?.reason),this.destroy(this[Ol]?.reason)}get aborted(){return this[Nh]}set aborted(e){}write(e,r,n){if(this[Nh])return!1;if(this[es])throw new Error("write after end");if(this[Ut])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(n=r,r="utf8"),r||(r="utf8");let i=this[Ii]?xl:C2;if(!this[Dr]&&!Buffer.isBuffer(e)){if(O2(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(I2(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Dr]?(this[or]&&this[cr]!==0&&this[Ph](!0),this[or]?this.emit("data",e):this[Cv](e),this[cr]!==0&&this.emit("readable"),n&&i(n),this[or]):e.length?(typeof e=="string"&&!(r===this[li]&&!this[ja]?.lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[li]&&(e=this[ja].write(e)),this[or]&&this[cr]!==0&&this[Ph](!0),this[or]?this.emit("data",e):this[Cv](e),this[cr]!==0&&this.emit("readable"),n&&i(n),this[or]):(this[cr]!==0&&this.emit("readable"),n&&i(n),this[or])}read(e){if(this[Ut])return null;if(this[Pn]=!1,this[cr]===0||e===0||e&&e>this[cr])return this[ts](),null;this[Dr]&&(e=null),this[ar].length>1&&!this[Dr]&&(this[ar]=[this[li]?this[ar].join(""):Buffer.concat(this[ar],this[cr])]);let r=this[eM](e||null,this[ar][0]);return this[ts](),r}[eM](e,r){if(this[Dr])this[kh]();else{let n=r;e===n.length||e===null?this[kh]():typeof n=="string"?(this[ar][0]=n.slice(e),r=n.slice(0,e),this[cr]-=e):(this[ar][0]=n.subarray(e),r=n.subarray(0,e),this[cr]-=e)}return this.emit("data",r),!this[ar].length&&!this[es]&&this.emit("drain"),r}end(e,r,n){return typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r="utf8"),e!==void 0&&this.write(e,r),n&&this.once("end",n),this[es]=!0,this.writable=!1,(this[or]||!this[Il])&&this[ts](),this}[Ua](){this[Ut]||(!this[So]&&!this[Ur].length&&(this[Pn]=!0),this[Il]=!1,this[or]=!0,this.emit("resume"),this[ar].length?this[Ph]():this[es]?this[ts]():this.emit("drain"))}resume(){return this[Ua]()}pause(){this[or]=!1,this[Il]=!0,this[Pn]=!1}get destroyed(){return this[Ut]}get flowing(){return this[or]}get paused(){return this[Il]}[Cv](e){this[Dr]?this[cr]+=1:this[cr]+=e.length,this[ar].push(e)}[kh](){return this[Dr]?this[cr]-=1:this[cr]-=this[ar][0].length,this[ar].shift()}[Ph](e=!1){do;while(this[tM](this[kh]())&&this[ar].length);!e&&!this[ar].length&&!this[es]&&this.emit("drain")}[tM](e){return this.emit("data",e),this[or]}pipe(e,r){if(this[Ut])return e;this[Pn]=!1;let n=this[Cs];return r=r||{},e===Zx.stdout||e===Zx.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,n?r.end&&e.end():(this[Ur].push(r.proxyErrors?new Mv(this,e,r):new Rh(this,e,r)),this[Ii]?xl(()=>this[Ua]()):this[Ua]()),e}unpipe(e){let r=this[Ur].find(n=>n.dest===e);r&&(this[Ur].length===1?(this[or]&&this[So]===0&&(this[or]=!1),this[Ur]=[]):this[Ur].splice(this[Ur].indexOf(r),1),r.unpipe())}addListener(e,r){return this.on(e,r)}on(e,r){let n=super.on(e,r);if(e==="data")this[Pn]=!1,this[So]++,!this[Ur].length&&!this[or]&&this[Ua]();else if(e==="readable"&&this[cr]!==0)super.emit("readable");else if(A2(e)&&this[Cs])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Al]){let i=r;this[Ii]?xl(()=>i.call(this,this[Al])):i.call(this,this[Al])}return n}removeListener(e,r){return this.off(e,r)}off(e,r){let n=super.off(e,r);return e==="data"&&(this[So]=this.listeners("data").length,this[So]===0&&!this[Pn]&&!this[Ur].length&&(this[or]=!1)),n}removeAllListeners(e){let r=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[So]=0,!this[Pn]&&!this[Ur].length&&(this[or]=!1)),r}get emittedEnd(){return this[Cs]}[ts](){!this[Sh]&&!this[Cs]&&!this[Ut]&&this[ar].length===0&&this[es]&&(this[Sh]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[_h]&&this.emit("close"),this[Sh]=!1)}emit(e,...r){let n=r[0];if(e!=="error"&&e!=="close"&&e!==Ut&&this[Ut])return!1;if(e==="data")return!this[Dr]&&!n?!1:this[Ii]?(xl(()=>this[Iv](n)),!0):this[Iv](n);if(e==="end")return this[rM]();if(e==="close"){if(this[_h]=!0,!this[Cs]&&!this[Ut])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Al]=n,super.emit(Av,n);let s=!this[Ol]||this.listeners("error").length?super.emit("error",n):!1;return this[ts](),s}else if(e==="resume"){let s=super.emit("resume");return this[ts](),s}else if(e==="finish"||e==="prefinish"){let s=super.emit(e);return this.removeAllListeners(e),s}let i=super.emit(e,...r);return this[ts](),i}[Iv](e){for(let n of this[Ur])n.dest.write(e)===!1&&this.pause();let r=this[Pn]?!1:super.emit("data",e);return this[ts](),r}[rM](){return this[Cs]?!1:(this[Cs]=!0,this.readable=!1,this[Ii]?(xl(()=>this[Ov]()),!0):this[Ov]())}[Ov](){if(this[ja]){let r=this[ja].end();if(r){for(let n of this[Ur])n.dest.write(r);this[Pn]||super.emit("data",r)}}for(let r of this[Ur])r.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Dr]||(e.dataLength=0);let r=this.promise();return this.on("data",n=>{e.push(n),this[Dr]||(e.dataLength+=n.length)}),await r,e}async concat(){if(this[Dr])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[li]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,r)=>{this.on(Ut,()=>r(new Error("stream destroyed"))),this.on("error",n=>r(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Pn]=!1;let e=!1,r=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return r();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[es])return r();let s,o,a=d=>{this.off("data",c),this.off("end",l),this.off(Ut,u),r(),o(d)},c=d=>{this.off("error",a),this.off("end",l),this.off(Ut,u),this.pause(),s({value:d,done:!!this[es]})},l=()=>{this.off("error",a),this.off("data",c),this.off(Ut,u),r(),s({done:!0,value:void 0})},u=()=>a(new Error("stream destroyed"));return new Promise((d,f)=>{o=f,s=d,this.once(Ut,u),this.once("error",a),this.once("end",l),this.once("data",c)})},throw:r,return:r,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[Pn]=!1;let e=!1,r=()=>(this.pause(),this.off(Av,r),this.off(Ut,r),this.off("end",r),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return r();let i=this.read();return i===null?r():{done:!1,value:i}};return this.once("end",r),this.once(Av,r),this.once(Ut,r),{next:n,throw:r,return:r,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[Ut])return e?this.emit("error",e):this.emit(Ut),this;this[Ut]=!0,this[Pn]=!0,this[ar].length=0,this[cr]=0;let r=this;return typeof r.close=="function"&&!this[_h]&&r.close(),e?this.emit("error",e):this.emit(Ut),this}static get isStream(){return E2}};var q2=xi.realpathSync.native,Ll={lstatSync:xi.lstatSync,readdir:xi.readdir,readdirSync:xi.readdirSync,readlinkSync:xi.readlinkSync,realpathSync:q2,promises:{lstat:Is.lstat,readdir:Is.readdir,readlink:Is.readlink,realpath:Is.realpath}},lM=t=>!t||t===Ll||t===L2?Ll:{...Ll,...t,promises:{...Ll.promises,...t.promises||{}}},uM=/^\\\\\?\\([a-z]:)\\?$/i,$2=t=>t.replace(/\//g,"\\").replace(uM,"$1\\"),F2=/[\\\/]/,Fn=0,dM=1,fM=2,Oi=4,pM=6,hM=8,_o=10,mM=12,$n=15,Ml=~$n,qv=16,iM=32,ql=64,ui=128,wh=256,Ch=512,sM=ql|ui|Ch,B2=1023,$v=t=>t.isFile()?hM:t.isDirectory()?Oi:t.isSymbolicLink()?_o:t.isCharacterDevice()?fM:t.isBlockDevice()?pM:t.isSocket()?mM:t.isFIFO()?dM:Fn,oM=new Cl({max:2**12}),$l=t=>{let e=oM.get(t);if(e)return e;let r=t.normalize("NFKD");return oM.set(t,r),r},aM=new Cl({max:2**12}),Dh=t=>{let e=aM.get(t);if(e)return e;let r=$l(t.toLowerCase());return aM.set(t,r),r},Ah=class extends Cl{constructor(){super({max:256})}},Fv=class extends Cl{constructor(e=16*1024){super({maxSize:e,sizeCalculation:r=>r.length+1})}},gM=Symbol("PathScurry setAsCwd"),Cr=class{name;root;roots;parent;nocase;isCWD=!1;#e;#r;get dev(){return this.#r}#n;get mode(){return this.#n}#t;get nlink(){return this.#t}#s;get uid(){return this.#s}#m;get gid(){return this.#m}#u;get rdev(){return this.#u}#f;get blksize(){return this.#f}#a;get ino(){return this.#a}#p;get size(){return this.#p}#d;get blocks(){return this.#d}#l;get atimeMs(){return this.#l}#o;get mtimeMs(){return this.#o}#b;get ctimeMs(){return this.#b}#_;get birthtimeMs(){return this.#_}#g;get atime(){return this.#g}#y;get mtime(){return this.#y}#R;get ctime(){return this.#R}#T;get birthtime(){return this.#T}#P;#k;#h;#v;#S;#w;#i;#A;#I;#E;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,r=Fn,n,i,s,o,a){this.name=e,this.#P=s?Dh(e):$l(e),this.#i=r&B2,this.nocase=s,this.roots=i,this.root=n||this,this.#A=o,this.#h=a.fullpath,this.#S=a.relative,this.#w=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=lM(a.fs)}depth(){return this.#k!==void 0?this.#k:this.parent?this.#k=this.parent.depth()+1:this.#k=0}childrenCache(){return this.#A}resolve(e){if(!e)return this;let r=this.getRootString(e),i=e.substring(r.length).split(this.splitSep);return r?this.getRoot(r).#O(i):this.#O(i)}#O(e){let r=this;for(let n of e)r=r.child(n);return r}children(){let e=this.#A.get(this);if(e)return e;let r=Object.assign([],{provisional:0});return this.#A.set(this,r),this.#i&=~qv,r}child(e,r){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let n=this.children(),i=this.nocase?Dh(e):$l(e);for(let c of n)if(c.#P===i)return c;let s=this.parent?this.sep:"",o=this.#h?this.#h+s+e:void 0,a=this.newChild(e,Fn,{...r,parent:this,fullpath:o});return this.canReaddir()||(a.#i|=ui),n.push(a),a}relative(){if(this.isCWD)return"";if(this.#S!==void 0)return this.#S;let e=this.name,r=this.parent;if(!r)return this.#S=this.name;let n=r.relative();return n+(!n||!r.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let e=this.name,r=this.parent;if(!r)return this.#w=this.fullpathPosix();let n=r.relativePosix();return n+(!n||!r.parent?"":"/")+e}fullpath(){if(this.#h!==void 0)return this.#h;let e=this.name,r=this.parent;if(!r)return this.#h=this.name;let i=r.fullpath()+(r.parent?this.sep:"")+e;return this.#h=i}fullpathPosix(){if(this.#v!==void 0)return this.#v;if(this.sep==="/")return this.#v=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#v=`//?/${i}`:this.#v=i}let e=this.parent,r=e.fullpathPosix(),n=r+(!r||!e.parent?"":"/")+this.name;return this.#v=n}isUnknown(){return(this.#i&$n)===Fn}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#i&$n)===hM}isDirectory(){return(this.#i&$n)===Oi}isCharacterDevice(){return(this.#i&$n)===fM}isBlockDevice(){return(this.#i&$n)===pM}isFIFO(){return(this.#i&$n)===dM}isSocket(){return(this.#i&$n)===mM}isSymbolicLink(){return(this.#i&_o)===_o}lstatCached(){return this.#i&iM?this:void 0}readlinkCached(){return this.#I}realpathCached(){return this.#E}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#I)return!0;if(!this.parent)return!1;let e=this.#i&$n;return!(e!==Fn&&e!==_o||this.#i&wh||this.#i&ui)}calledReaddir(){return!!(this.#i&qv)}isENOENT(){return!!(this.#i&ui)}isNamed(e){return this.nocase?this.#P===Dh(e):this.#P===$l(e)}async readlink(){let e=this.#I;if(e)return e;if(this.canReadlink()&&this.parent)try{let r=await this.#e.promises.readlink(this.fullpath()),n=(await this.parent.realpath())?.resolve(r);if(n)return this.#I=n}catch(r){this.#C(r.code);return}}readlinkSync(){let e=this.#I;if(e)return e;if(this.canReadlink()&&this.parent)try{let r=this.#e.readlinkSync(this.fullpath()),n=this.parent.realpathSync()?.resolve(r);if(n)return this.#I=n}catch(r){this.#C(r.code);return}}#F(e){this.#i|=qv;for(let r=e.provisional;r<e.length;r++){let n=e[r];n&&n.#N()}}#N(){this.#i&ui||(this.#i=(this.#i|ui)&Ml,this.#V())}#V(){let e=this.children();e.provisional=0;for(let r of e)r.#N()}#M(){this.#i|=Ch,this.#x()}#x(){if(this.#i&ql)return;let e=this.#i;(e&$n)===Oi&&(e&=Ml),this.#i=e|ql,this.#V()}#B(e=""){e==="ENOTDIR"||e==="EPERM"?this.#x():e==="ENOENT"?this.#N():this.children().provisional=0}#D(e=""){e==="ENOTDIR"?this.parent.#x():e==="ENOENT"&&this.#N()}#C(e=""){let r=this.#i;r|=wh,e==="ENOENT"&&(r|=ui),(e==="EINVAL"||e==="UNKNOWN")&&(r&=Ml),this.#i=r,e==="ENOTDIR"&&this.parent&&this.parent.#x()}#j(e,r){return this.#H(e,r)||this.#L(e,r)}#L(e,r){let n=$v(e),i=this.newChild(e.name,n,{parent:this}),s=i.#i&$n;return s!==Oi&&s!==_o&&s!==Fn&&(i.#i|=ql),r.unshift(i),r.provisional++,i}#H(e,r){for(let n=r.provisional;n<r.length;n++){let i=r[n];if((this.nocase?Dh(e.name):$l(e.name))===i.#P)return this.#K(e,i,n,r)}}#K(e,r,n,i){let s=r.name;return r.#i=r.#i&Ml|$v(e),s!==e.name&&(r.name=e.name),n!==i.provisional&&(n===i.length-1?i.pop():i.splice(n,1),i.unshift(r)),i.provisional++,r}async lstat(){if((this.#i&ui)===0)try{return this.#W(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#D(e.code)}}lstatSync(){if((this.#i&ui)===0)try{return this.#W(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#D(e.code)}}#W(e){let{atime:r,atimeMs:n,birthtime:i,birthtimeMs:s,blksize:o,blocks:a,ctime:c,ctimeMs:l,dev:u,gid:d,ino:f,mode:p,mtime:m,mtimeMs:h,nlink:y,rdev:S,size:v,uid:b}=e;this.#g=r,this.#l=n,this.#T=i,this.#_=s,this.#f=o,this.#d=a,this.#R=c,this.#b=l,this.#r=u,this.#m=d,this.#a=f,this.#n=p,this.#y=m,this.#o=h,this.#t=y,this.#u=S,this.#p=v,this.#s=b;let P=$v(e);this.#i=this.#i&Ml|P|iM,P!==Fn&&P!==Oi&&P!==_o&&(this.#i|=ql)}#q=[];#c=!1;#z(e){this.#c=!1;let r=this.#q.slice();this.#q.length=0,r.forEach(n=>n(null,e))}readdirCB(e,r=!1){if(!this.canReaddir()){r?e(null,[]):queueMicrotask(()=>e(null,[]));return}let n=this.children();if(this.calledReaddir()){let s=n.slice(0,n.provisional);r?e(null,s):queueMicrotask(()=>e(null,s));return}if(this.#q.push(e),this.#c)return;this.#c=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(s,o)=>{if(s)this.#B(s.code),n.provisional=0;else{for(let a of o)this.#j(a,n);this.#F(n)}this.#z(n.slice(0,n.provisional))})}#U;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let r=this.fullpath();if(this.#U)await this.#U;else{let n=()=>{};this.#U=new Promise(i=>n=i);try{for(let i of await this.#e.promises.readdir(r,{withFileTypes:!0}))this.#j(i,e);this.#F(e)}catch(i){this.#B(i.code),e.provisional=0}this.#U=void 0,n()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let r=this.fullpath();try{for(let n of this.#e.readdirSync(r,{withFileTypes:!0}))this.#j(n,e);this.#F(e)}catch(n){this.#B(n.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#i&sM)return!1;let e=$n&this.#i;return e===Fn||e===Oi||e===_o}shouldWalk(e,r){return(this.#i&Oi)===Oi&&!(this.#i&sM)&&!e.has(this)&&(!r||r(this))}async realpath(){if(this.#E)return this.#E;if(!((Ch|wh|ui)&this.#i))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#E=this.resolve(e)}catch{this.#M()}}realpathSync(){if(this.#E)return this.#E;if(!((Ch|wh|ui)&this.#i))try{let e=this.#e.realpathSync(this.fullpath());return this.#E=this.resolve(e)}catch{this.#M()}}[gM](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let r=new Set([]),n=[],i=this;for(;i&&i.parent;)r.add(i),i.#S=n.join(this.sep),i.#w=n.join("/"),i=i.parent,n.push("..");for(i=e;i&&i.parent&&!r.has(i);)i.#S=void 0,i.#w=void 0,i=i.parent}},Ih=class t extends Cr{sep="\\";splitSep=F2;constructor(e,r=Fn,n,i,s,o,a){super(e,r,n,i,s,o,a)}newChild(e,r=Fn,n={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(e){return Ha.win32.parse(e).root}getRoot(e){if(e=$2(e.toUpperCase()),e===this.root.name)return this.root;for(let[r,n]of Object.entries(this.roots))if(this.sameRoot(e,r))return this.roots[e]=n;return this.roots[e]=new Va(e,this).root}sameRoot(e,r=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(uM,"$1\\"),e===r}},Oh=class t extends Cr{splitSep="/";sep="/";constructor(e,r=Fn,n,i,s,o,a){super(e,r,n,i,s,o,a)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,r=Fn,n={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}},xh=class{root;rootPath;roots;cwd;#e;#r;#n;nocase;#t;constructor(e=process.cwd(),r,n,{nocase:i,childrenCacheSize:s=16*1024,fs:o=Ll}={}){this.#t=lM(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,cM.fileURLToPath)(e));let a=r.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new Ah,this.#r=new Ah,this.#n=new Fv(s);let c=a.substring(this.rootPath.length).split(n);if(c.length===1&&!c[0]&&c.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let l=this.root,u=c.length-1,d=r.sep,f=this.rootPath,p=!1;for(let m of c){let h=u--;l=l.child(m,{relative:new Array(h).fill("..").join(d),relativePosix:new Array(h).fill("..").join("/"),fullpath:f+=(p?"":d)+m}),p=!0}this.cwd=l}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let r="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(r=r?`${o}/${r}`:o,this.isAbsolute(o)))break}let n=this.#e.get(r);if(n!==void 0)return n;let i=this.cwd.resolve(r).fullpath();return this.#e.set(r,i),i}resolvePosix(...e){let r="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(r=r?`${o}/${r}`:o,this.isAbsolute(o)))break}let n=this.#r.get(r);if(n!==void 0)return n;let i=this.cwd.resolve(r).fullpathPosix();return this.#r.set(r,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,r={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e,e=this.cwd);let{withFileTypes:n}=r;if(e.canReaddir()){let i=await e.readdir();return n?i:i.map(s=>s.name)}else return[]}readdirSync(e=this.cwd,r={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e,e=this.cwd);let{withFileTypes:n=!0}=r;return e.canReaddir()?n?e.readdirSync():e.readdirSync().map(i=>i.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e.withFileTypes,e=this.cwd);let n=await e.readlink();return r?n:n?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e.withFileTypes,e=this.cwd);let n=e.readlinkSync();return r?n:n?.fullpath()}async realpath(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e.withFileTypes,e=this.cwd);let n=await e.realpath();return r?n:n?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e.withFileTypes,e=this.cwd);let n=e.realpathSync();return r?n:n?.fullpath()}async walk(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=[];(!s||s(e))&&a.push(n?e:e.fullpath());let c=new Set,l=(d,f)=>{c.add(d),d.readdirCB((p,m)=>{if(p)return f(p);let h=m.length;if(!h)return f();let y=()=>{--h===0&&f()};for(let S of m)(!s||s(S))&&a.push(n?S:S.fullpath()),i&&S.isSymbolicLink()?S.realpath().then(v=>v?.isUnknown()?v.lstat():v).then(v=>v?.shouldWalk(c,o)?l(v,y):y()):S.shouldWalk(c,o)?l(S,y):y()},!0)},u=e;return new Promise((d,f)=>{l(u,p=>{if(p)return f(p);d(a)})})}walkSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=[];(!s||s(e))&&a.push(n?e:e.fullpath());let c=new Set([e]);for(let l of c){let u=l.readdirSync();for(let d of u){(!s||s(d))&&a.push(n?d:d.fullpath());let f=d;if(d.isSymbolicLink()){if(!(i&&(f=d.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(c,o)&&c.add(f)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,r={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e,e=this.cwd),this.stream(e,r)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r;(!s||s(e))&&(yield n?e:e.fullpath());let a=new Set([e]);for(let c of a){let l=c.readdirSync();for(let u of l){(!s||s(u))&&(yield n?u:u.fullpath());let d=u;if(u.isSymbolicLink()){if(!(i&&(d=u.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(a,o)&&a.add(d)}}}stream(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=new As({objectMode:!0});(!s||s(e))&&a.write(n?e:e.fullpath());let c=new Set,l=[e],u=0,d=()=>{let f=!1;for(;!f;){let p=l.shift();if(!p){u===0&&a.end();return}u++,c.add(p);let m=(y,S,v=!1)=>{if(y)return a.emit("error",y);if(i&&!v){let b=[];for(let P of S)P.isSymbolicLink()&&b.push(P.realpath().then(N=>N?.isUnknown()?N.lstat():N));if(b.length){Promise.all(b).then(()=>m(null,S,!0));return}}for(let b of S)b&&(!s||s(b))&&(a.write(n?b:b.fullpath())||(f=!0));u--;for(let b of S){let P=b.realpathCached()||b;P.shouldWalk(c,o)&&l.push(P)}f&&!a.flowing?a.once("drain",d):h||d()},h=!0;p.readdirCB(m,!0),h=!1}};return d(),a}streamSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=new As({objectMode:!0}),c=new Set;(!s||s(e))&&a.write(n?e:e.fullpath());let l=[e],u=0,d=()=>{let f=!1;for(;!f;){let p=l.shift();if(!p){u===0&&a.end();return}u++,c.add(p);let m=p.readdirSync();for(let h of m)(!s||s(h))&&(a.write(n?h:h.fullpath())||(f=!0));u--;for(let h of m){let y=h;if(h.isSymbolicLink()){if(!(i&&(y=h.realpathSync())))continue;y.isUnknown()&&y.lstatSync()}y.shouldWalk(c,o)&&l.push(y)}}f&&!a.flowing&&a.once("drain",d)};return d(),a}chdir(e=this.cwd){let r=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[gM](r)}},Va=class extends xh{sep="\\";constructor(e=process.cwd(),r={}){let{nocase:n=!0}=r;super(e,Ha.win32,"\\",{...r,nocase:n}),this.nocase=n;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return Ha.win32.parse(e).root.toUpperCase()}newRoot(e){return new Ih(this.rootPath,Oi,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Wa=class extends xh{sep="/";constructor(e=process.cwd(),r={}){let{nocase:n=!1}=r;super(e,Ha.posix,"/",{...r,nocase:n}),this.nocase=n}parseRootPath(e){return"/"}newRoot(e){return new Oh(this.rootPath,Oi,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Fl=class extends Wa{constructor(e=process.cwd(),r={}){let{nocase:n=!0}=r;super(e,{...r,nocase:n})}},WEe=process.platform==="win32"?Ih:Oh,yM=process.platform==="win32"?Va:process.platform==="darwin"?Fl:Wa;var j2=t=>t.length>=1,U2=t=>t.length>=1,za=class t{#e;#r;#n;length;#t;#s;#m;#u;#f;#a;#p=!0;constructor(e,r,n,i){if(!j2(e))throw new TypeError("empty pattern list");if(!U2(r))throw new TypeError("empty glob list");if(r.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,n<0||n>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#r=r,this.#n=n,this.#t=i,this.#n===0){if(this.isUNC()){let[s,o,a,c,...l]=this.#e,[u,d,f,p,...m]=this.#r;l[0]===""&&(l.shift(),m.shift());let h=[s,o,a,c,""].join("/"),y=[u,d,f,p,""].join("/");this.#e=[h,...l],this.#r=[y,...m],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...o]=this.#e,[a,...c]=this.#r;o[0]===""&&(o.shift(),c.shift());let l=s+"/",u=a+"/";this.#e=[l,...o],this.#r=[u,...c],this.length=this.#e.length}}}pattern(){return this.#e[this.#n]}isString(){return typeof this.#e[this.#n]=="string"}isGlobstar(){return this.#e[this.#n]===jt}isRegExp(){return this.#e[this.#n]instanceof RegExp}globString(){return this.#m=this.#m||(this.#n===0?this.isAbsolute()?this.#r[0]+this.#r.slice(1).join("/"):this.#r.join("/"):this.#r.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#s!==void 0?this.#s:this.hasMore()?(this.#s=new t(this.#e,this.#r,this.#n+1,this.#t),this.#s.#a=this.#a,this.#s.#f=this.#f,this.#s.#u=this.#u,this.#s):this.#s=null}isUNC(){let e=this.#e;return this.#f!==void 0?this.#f:this.#f=this.#t==="win32"&&this.#n===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#u!==void 0?this.#u:this.#u=this.#t==="win32"&&this.#n===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#a!==void 0?this.#a:this.#a=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#n===0?e:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#p)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#p?!1:(this.#p=!1,!0)}};var H2=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ga=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:r,nocase:n,noext:i,noglobstar:s,platform:o=H2}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:r,nocase:n,noext:i,noglobstar:s,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of e)this.add(a)}add(e){let r=new _n(e,this.mmopts);for(let n=0;n<r.set.length;n++){let i=r.set[n],s=r.globParts[n];if(!i||!s)throw new Error("invalid pattern object");for(;i[0]==="."&&s[0]===".";)i.shift(),s.shift();let o=new za(i,s,0,this.platform),a=new _n(o.globString(),this.mmopts),c=s[s.length-1]==="**",l=o.isAbsolute();l?this.absolute.push(a):this.relative.push(a),c&&(l?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(e){let r=e.fullpath(),n=`${r}/`,i=e.relative()||".",s=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(s))return!0;for(let o of this.absolute)if(o.match(r)||o.match(n))return!0;return!1}childrenIgnored(e){let r=e.fullpath()+"/",n=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(n))return!0;for(let i of this.absoluteChildren)if(i.match(r))return!0;return!1}};var Bv=class t{store;constructor(e=new Map){this.store=e}copy(){return new t(new Map(this.store))}hasWalked(e,r){return this.store.get(e.fullpath())?.has(r.globString())}storeWalked(e,r){let n=e.fullpath(),i=this.store.get(n);i?i.add(r.globString()):this.store.set(n,new Set([r.globString()]))}},jv=class{store=new Map;add(e,r,n){let i=(r?2:0)|(n?1:0),s=this.store.get(e);this.store.set(e,s===void 0?i:i&s)}entries(){return[...this.store.entries()].map(([e,r])=>[e,!!(r&2),!!(r&1)])}},Uv=class{store=new Map;add(e,r){if(!e.canReaddir())return;let n=this.store.get(e);n?n.find(i=>i.globString()===r.globString())||n.push(r):this.store.set(e,[r])}get(e){let r=this.store.get(e);if(!r)throw new Error("attempting to walk unknown path");return r}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},Bl=class t{hasWalkedCache;matches=new jv;subwalks=new Uv;patterns;follow;dot;opts;constructor(e,r){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=r?r.copy():new Bv}processPatterns(e,r){this.patterns=r;let n=r.map(i=>[e,i]);for(let[i,s]of n){this.hasWalkedCache.storeWalked(i,s);let o=s.root(),a=s.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let d=s.rest();if(d)s=d;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let c,l,u=!1;for(;typeof(c=s.pattern())=="string"&&(l=s.rest());)i=i.resolve(c),s=l,u=!0;if(c=s.pattern(),l=s.rest(),u){if(this.hasWalkedCache.hasWalked(i,s))continue;this.hasWalkedCache.storeWalked(i,s)}if(typeof c=="string"){let d=c===".."||c===""||c===".";this.matches.add(i.resolve(c),a,d);continue}else if(c===jt){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let d=l?.pattern(),f=l?.rest();if(!l||(d===""||d===".")&&!f)this.matches.add(i,a,d===""||d===".");else if(d===".."){let p=i.parent||i;f?this.hasWalkedCache.hasWalked(p,f)||this.subwalks.add(p,f):this.matches.add(p,a,!0)}}else c instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new t(this.opts,this.hasWalkedCache)}filterEntries(e,r){let n=this.subwalks.get(e),i=this.child();for(let s of r)for(let o of n){let a=o.isAbsolute(),c=o.pattern(),l=o.rest();c===jt?i.testGlobstar(s,o,l,a):c instanceof RegExp?i.testRegExp(s,c,l,a):i.testString(s,c,l,a)}return i}testGlobstar(e,r,n,i){if((this.dot||!e.name.startsWith("."))&&(r.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,r):e.isSymbolicLink()&&(n&&r.checkFollowGlobstar()?this.subwalks.add(e,n):r.markFollowGlobstar()&&this.subwalks.add(e,r)))),n){let s=n.pattern();if(typeof s=="string"&&s!==".."&&s!==""&&s!==".")this.testString(e,s,n.rest(),i);else if(s===".."){let o=e.parent||e;this.subwalks.add(o,n)}else s instanceof RegExp&&this.testRegExp(e,s,n.rest(),i)}}testRegExp(e,r,n,i){r.test(e.name)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}testString(e,r,n,i){e.isNamed(r)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}};var V2=(t,e)=>typeof t=="string"?new Ga([t],e):Array.isArray(t)?new Ga(t,e):t,Mh=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#r;#n;signal;maxDepth;includeChildMatches;constructor(e,r,n){if(this.patterns=e,this.path=r,this.opts=n,this.#n=!n.posix&&n.platform==="win32"?"\\":"/",this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#r=V2(n.ignore??[],n),!this.includeChildMatches&&typeof this.#r.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#r?.ignored?.(e)}#s(e){return!!this.#r?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||await e.realpath(),!n)return;e=n}let s=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let o=await s.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(s,r)}matchCheckTest(e,r){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!r||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#t(e)?e:void 0}matchCheckSync(e,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||e.realpathSync(),!n)return;e=n}let s=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let o=s.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(s,r)}matchFinish(e,r){if(this.#t(e))return;if(!this.includeChildMatches&&this.#r?.add){let s=`${e.relativePosix()}/**`;this.#r.add(s)}let n=this.opts.absolute===void 0?r:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let s=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(s+i)}else{let s=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!s.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(s?o+s+i:"."+i)}}async match(e,r,n){let i=await this.matchCheck(e,n);i&&this.matchFinish(i,r)}matchSync(e,r,n){let i=this.matchCheckSync(e,n);i&&this.matchFinish(i,r)}walkCB(e,r,n){this.signal?.aborted&&n(),this.walkCB2(e,r,new Bl(this.opts),n)}walkCB2(e,r,n,i){if(this.#s(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,r,n,i));return}n.processPatterns(e,r);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of n.matches.entries())this.#t(a)||(s++,this.match(a,c,l).then(()=>o()));for(let a of n.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;s++;let c=a.readdirCached();a.calledReaddir()?this.walkCB3(a,c,n,o):a.readdirCB((l,u)=>this.walkCB3(a,u,n,o),!0)}o()}walkCB3(e,r,n,i){n=n.filterEntries(e,r);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of n.matches.entries())this.#t(a)||(s++,this.match(a,c,l).then(()=>o()));for(let[a,c]of n.subwalks.entries())s++,this.walkCB2(a,c,n.child(),o);o()}walkCBSync(e,r,n){this.signal?.aborted&&n(),this.walkCB2Sync(e,r,new Bl(this.opts),n)}walkCB2Sync(e,r,n,i){if(this.#s(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,r,n,i));return}n.processPatterns(e,r);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of n.matches.entries())this.#t(a)||this.matchSync(a,c,l);for(let a of n.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;s++;let c=a.readdirSync();this.walkCB3Sync(a,c,n,o)}o()}walkCB3Sync(e,r,n,i){n=n.filterEntries(e,r);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of n.matches.entries())this.#t(a)||this.matchSync(a,c,l);for(let[a,c]of n.subwalks.entries())s++,this.walkCB2Sync(a,c,n.child(),o);o()}},jl=class extends Mh{matches=new Set;constructor(e,r,n){super(e,r,n)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,r)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?r(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},Ul=class extends Mh{results;constructor(e,r,n){super(e,r,n),this.results=new As({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var W2=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",di=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,r){if(!r)throw new TypeError("glob options required");if(this.withFileTypes=!!r.withFileTypes,this.signal=r.signal,this.follow=!!r.follow,this.dot=!!r.dot,this.dotRelative=!!r.dotRelative,this.nodir=!!r.nodir,this.mark=!!r.mark,r.cwd?(r.cwd instanceof URL||r.cwd.startsWith("file://"))&&(r.cwd=(0,TM.fileURLToPath)(r.cwd)):this.cwd="",this.cwd=r.cwd||"",this.root=r.root,this.magicalBraces=!!r.magicalBraces,this.nobrace=!!r.nobrace,this.noext=!!r.noext,this.realpath=!!r.realpath,this.absolute=r.absolute,this.includeChildMatches=r.includeChildMatches!==!1,this.noglobstar=!!r.noglobstar,this.matchBase=!!r.matchBase,this.maxDepth=typeof r.maxDepth=="number"?r.maxDepth:1/0,this.stat=!!r.stat,this.ignore=r.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(c=>c.replace(/\\/g,"/"))),this.matchBase){if(r.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(c=>c.includes("/")?c:`./**/${c}`)}if(this.pattern=e,this.platform=r.platform||W2,this.opts={...r,platform:this.platform},r.scurry){if(this.scurry=r.scurry,r.nocase!==void 0&&r.nocase!==r.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let c=r.platform==="win32"?Va:r.platform==="darwin"?Fl:r.platform?Wa:yM;this.scurry=new c(this.cwd,{nocase:r.nocase,fs:r.fs})}this.nocase=this.scurry.nocase;let n=this.platform==="darwin"||this.platform==="win32",i={...r,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},s=this.pattern.map(c=>new _n(c,i)),[o,a]=s.reduce((c,l)=>(c[0].push(...l.set),c[1].push(...l.globParts),c),[[],[]]);this.patterns=o.map((c,l)=>{let u=a[l];if(!u)throw new Error("invalid pattern object");return new za(c,u,0,this.platform)})}async walk(){return[...await new jl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new jl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new Ul(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new Ul(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var Hv=(t,e={})=>{Array.isArray(t)||(t=[t]);for(let r of t)if(new _n(r,e).hasMagic())return!0;return!1};function Lh(t,e={}){return new di(t,e).streamSync()}function bM(t,e={}){return new di(t,e).stream()}function SM(t,e={}){return new di(t,e).walkSync()}async function vM(t,e={}){return new di(t,e).walk()}function qh(t,e={}){return new di(t,e).iterateSync()}function _M(t,e={}){return new di(t,e).iterate()}var z2=Lh,G2=Object.assign(bM,{sync:Lh}),Y2=qh,K2=Object.assign(_M,{sync:qh}),X2=Object.assign(SM,{stream:Lh,iterate:qh}),Po=Object.assign(vM,{glob:vM,globSync:SM,sync:X2,globStream:bM,stream:G2,globStreamSync:Lh,streamSync:z2,globIterate:_M,iterate:K2,globIterateSync:qh,iterateSync:Y2,Glob:di,hasMagic:Hv,escape:Ba,unescape:ci});Po.glob=Po;var OP=q(kS()),SB=q(TB());var AP={};Sj(AP,{$id:()=>hQ,$schema:()=>pQ,default:()=>vQ,definitions:()=>gQ,properties:()=>TQ,title:()=>mQ,type:()=>yQ});var pQ="http://json-schema.org/draft-07/schema#",hQ="http://json-schema.org/draft-07/schema#",mQ="Core schema meta-schema",gQ={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},yQ=["object","boolean"],TQ={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},vQ={$schema:pQ,$id:hQ,title:mQ,definitions:gQ,type:yQ,properties:TQ,default:!0};var kn=q(U());var yg=class extends Qc{constructor(r,n){super();this.ajv=r;this.schemaKey=n;this.validate=this.ajv.getSchema(this.schemaKey)}getIssue(r,n){let i=[];if(n.disabled){let o=n.getProperty("status");return n.implementations.forEach(a=>i.push(x(21,a.firstToken,a.lastToken,a,{severity:kn.DiagnosticSeverity.Hint,linkedTo:[...o?.ast?[o?.ast]:[]],tags:[kn.DiagnosticTag.Unnecessary]}))),i}let s=J.toJson(n);try{this.validate?(this.validate(s),this.validate.errors&&(this.validate.errors.forEach(o=>i.push(...bQ(r,o,n,this.schemaKey))),console.log(this.schemaKey,`${n.pathString}`,this.validate.errors,s))):console.log("no validate")}catch(o){console.log(this.schemaKey,`${n.pathString}`,this.schemaKey,o)}return i}getOnPropertyHover(r){let n=(this.validate?.schema).properties?.[r];if(n&&typeof n=="object"&&"description"in n)return{kind:kn.MarkupKind.Markdown,value:[...n.description?["### Description",Array.isArray(n.description)?n.description.join(`
333
+ `)}}:{contents:{kind:Ri.Markdown,value:`No node matched compat ${t.macro.args[0].macro}`}}}async function mI(t){let e=await Ap(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function gI(t,e){return!!await wp(t,e)}async function yI({macro:t,context:e}){if(!(t.macro!=="DT_HAS_ALIAS"||t.args?.length!==1))return gI(t.args[0].macro,e)}async function TI(t){let e=await yI(t);if(e!==void 0)return{contents:{kind:Ri.Markdown,value:e?"1":"0"}}}var bI=q(U());async function Pl(t,e){if(t)switch(e){case"Unquoted":return t.fullName;case"Quoted":return`"${t.fullName}"`;case"Token":return Z(t.fullName);case"Upper Token":return Z(t.fullName).toUpperCase()}}async function vI({document:t,macro:e,context:r,position:n},i){if(e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});switch(e.macro){case"DT_NODE_FULL_NAME":return Pl(s,"Quoted");case"DT_NODE_FULL_NAME_TOKEN":return Pl(s,"Token");case"DT_NODE_FULL_NAME_UNQUOTED":return Pl(s,"Unquoted");case"DT_NODE_FULL_NAME_UPPER_TOKEN":return Pl(s,"Upper Token")}}async function SI(t){let e=await vI(t,M);if(e)return{contents:{kind:bI.MarkupKind.Markdown,value:e}}}var kI=q(U());async function _I(t){return t?.pathString}async function PI({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_NODE_PATH"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return _I(s)}async function NI(t){let e=await PI(t,M);if(e)return{contents:{kind:kI.MarkupKind.Markdown,value:`"${e}"`}}}async function RI(t){let e=await Op(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var DI=q(U());async function EI(t){return t?.labels.map(e=>e.label)}async function wI({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_NODELABEL_STRING_ARRAY"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return EI(s)}async function CI(t){let e=await wI(t,M);if(e)return{contents:{kind:DI.MarkupKind.Markdown,value:`{ ${e.map(r=>`"${r}"`).join(", ")} }`}}}async function AI(t){let e=await xp(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function II(t){let e=await Lp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var xI=q(U());async function OI({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_SAME_NODE"||e.args?.length!==2)return;if(await r?.getRuntime()){let o=await i({document:t,macro:e.args[0],context:r,position:n}),a=await i({document:t,macro:e.args[1],context:r,position:n});return!!a&&!!o&&a===o}}async function MI(t){let e=await OI(t,M);if(e!==void 0)return{contents:{kind:xI.MarkupKind.Markdown,value:e?"1":"0"}}}var qI=q(U());async function LI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_IDX_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Le(s[2].macro);if(typeof a=="number")return await Aa(o,s[1].macro,a)}async function $I(t){let e=await LI(t,M);return e?{contents:{kind:qI.MarkupKind.Markdown,value:e.toString()}}:void 0}var BI=q(U());async function FI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_BY_IDX"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Le(s[2].macro);if(typeof a=="number")return Ns(o,s[1].macro,a,s[3].macro,r)}async function jI(t){let e=await FI(t,M);return e?{contents:{kind:BI.MarkupKind.Markdown,value:e.toString()}}:void 0}async function UI(t){let e=await Ci(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function HI(t){let e=await Hp(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var kl=q(U());async function mt(t,e){if(e){if(typeof e=="boolean")return{contents:{kind:kl.MarkupKind.Markdown,value:e?"1":"0"}};if(typeof e=="string")return{contents:{kind:kl.MarkupKind.Markdown,value:e}};if(e instanceof J)return{contents:e.toMarkupContent(t.macros)};if(e.length===1&&e[0]instanceof J)return{contents:e[0].toMarkupContent(t.macros)};if(e.every(r=>typeof r=="number"))return{contents:{kind:kl.MarkupKind.Markdown,value:e.length===1?e[0].toString():`{${e.join(", ")}}`}};if(e.every(r=>typeof r=="string"))return{contents:{kind:kl.MarkupKind.Markdown,value:e.length===1?`"${e[0]}"`:`{${e.map(r=>`"${r}"`).join(", ")}}`}}}}async function VI(t){let e=await _p(t,M);return mt(t.context,e)}var bv=q(U());async function WI(t){let e=await Pp(t,M);if(e===!0)return{contents:{kind:bv.MarkupKind.Markdown,value:"1"}};if(e)return e instanceof J?{contents:e.toMarkupContent(t.context.macros)}:{contents:{kind:bv.MarkupKind.Markdown,value:e.toString()}}}async function zI(t){let e=await Ca(t,M);return mt(t.context,e)}async function GI({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_BY_PHANDLE_IDX"||e.args?.length!==4)return;let s=await Di(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro);return await wr(s,e.args[3].macro,r)}async function YI(t){return mt(t.context,await GI(t,M))}async function KI(t){let e=await qp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var QI=q(U());async function XI(t){return t?.nodes.filter(e=>!e.disabled).length??0}async function JI({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_CHILD_NUM_STATUS_OKAY"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return XI(s)}async function ZI(t){let e=await JI(t,M);return e!==void 0?{contents:{kind:QI.MarkupKind.Markdown,value:e.toString()}}:void 0}async function eO(t){let e=await Rs(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var rO=q(U());async function tO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return Ns(o,s[1].macro,0,s[2].macro,r)}async function nO(t){let e=await tO(t,M);return e?{contents:{kind:rO.MarkupKind.Markdown,value:e.toString()}}:void 0}var iO=q(U());async function sO(t){let e=await jp(t,M);return e instanceof J?mt(t.context,e):e?{contents:{kind:iO.MarkupKind.Markdown,value:e.toString()}}:void 0}var aO=q(U());async function oO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_BY_NAME"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n});return Ns(o,s[1].macro,s[2].macro,s[3].macro,r)}async function cO(t){let e=await oO(t,M);return e?{contents:{kind:aO.MarkupKind.Markdown,value:e.toString()}}:void 0}var lO=q(U());async function uO(t){let e=await Up(t,M);return e instanceof J?mt(t.context,e):e?{contents:{kind:lO.MarkupKind.Markdown,value:e.toString()}}:void 0}var dO=q(U());async function fO(t){let e=await Vp(t,M);return e instanceof J?mt(t.context,e):e?{contents:{kind:dO.MarkupKind.Markdown,value:e.toString()}}:void 0}var pO=q(U());async function hO(t){let e=await Fp(t,M);return e instanceof J?mt(t.context,e):e?{contents:{kind:pO.MarkupKind.Markdown,value:e.toString()}}:void 0}var gO=q(U());async function mO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_IDX"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return await Aa(o,s[1].macro,0)}async function yO(t){let e=await mO(t,M);return e?{contents:{kind:gO.MarkupKind.Markdown,value:e.toString()}}:void 0}var TO=q(U());async function vO(t){let e=await Bp(t,M);return e instanceof J?mt(t.context,e):e?{contents:{kind:TO.MarkupKind.Markdown,value:e.toString()}}:void 0}async function bO({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_BY_PHANDLE"||e.args?.length!==3)return;let s=await Di(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro);return wr(s,e.args[2].macro,r)}async function SO(t){return mt(t.context,await bO(t,M))}async function _O(t){return mt(t.context,await Wp(t,M))}var NO=q(U());var PO=q(require("util"));async function gh(t,e,r,n){let i=t?.properties.find(o=>Z(o.name)===e);if(!i)return;let s=i?.ast.quickValues?.at(r);if(s!==void 0)return PO.default.isDeepStrictEqual(Le(n),s)}async function kO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_HAS_VALUE"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return await gh(o,s[1].macro,0,s[2].macro)}async function RO(t){let e=await kO(t,M);return e!==void 0?{contents:{kind:NO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}var wO=q(U());async function EO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_HAS_VALUE_BY_IDX"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Le(s[2].macro);if(typeof a=="number")return await gh(o,s[1].macro,a,s[3].macro)}async function DO(t){let e=await EO(t,M);return e!==void 0?{contents:{kind:wO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}var IO=q(U());async function CO(t,e,r,n){let i=await wr(t,e,n);if(i===void 0)return!1;if(r=typeof r=="number"?r:Le(r??"0"),typeof r=="number")return Array.isArray(i)?i.length<r:r===0}async function AO({document:t,macro:e,context:r,position:n},i){let s=e.args;return e.macro!=="DT_PROP_HAS_IDX"||s?.length!==3?void 0:!!await CO(await i({document:t,macro:s[0],context:r,position:n}),s[1].macro,s[2].macro,r)}async function OO(t){let e=await AO(t,M);return e===void 0?void 0:{contents:{kind:IO.MarkupKind.Markdown,value:e?"1":"0"}}}var LO=q(U());async function xO(t,e,r,n){let i=t?.properties.find(u=>Z(u.name)===e),s=i?.parent.nodeType;if(!s||!(s instanceof _t)||await wr(t,e,n)===void 0)return;let a=i.nexusMapsTo.at(0)?.specifierSpace,l=(a?i.parent.getProperty(`${a}-names`)?.ast.quickValues:void 0)?.findIndex(u=>typeof u=="string"&&u.toLowerCase()===r)??-1;return l===-1?void 0:l}async function MO({document:t,macro:e,context:r,position:n},i){let s=e.args;return e.macro!=="DT_PROP_HAS_NAME"||s?.length!==3?void 0:!!await xO(await i({document:t,macro:s[0],context:r,position:n}),s[1].macro,s[2].macro,r)}async function qO(t){let e=await MO(t,M);return e===void 0?void 0:{contents:{kind:LO.MarkupKind.Markdown,value:e?"1":"0"}}}async function $O(t){let e=await Ip(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var BO=q(U());async function FO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PROP_LEN"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?zp(o,s[1].macro):void 0}async function jO(t){let e=await FO(t,M);return e?{contents:{kind:BO.MarkupKind.Markdown,value:e.toString()}}:void 0}var UO=q(U());async function HO(t){let e=await Gp(t,M);return e instanceof J?mt(t.context,e):e?{contents:{kind:UO.MarkupKind.Markdown,value:e.toString()}}:void 0}var Sv=q(U());async function VO(t,e,r){let n=await wr(t,e,r);if(n===!0)return!0;if(!n)return;let i=n.at(-1);if(i)return n.length===1&&n[0]instanceof J?n[0]:i}async function WO({document:t,macro:e,context:r,position:n},i){if(!(e.macro!=="DT_PROP_LAST"||e.args?.length!==2))return VO(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,r)}async function zO(t){let e=await WO(t,M);if(e===!0)return{contents:{kind:Sv.MarkupKind.Markdown,value:"1"}};if(e)return e instanceof J?{contents:e.toMarkupContent(t.context.macros)}:{contents:{kind:Sv.MarkupKind.Markdown,value:e.toString()}}}var YO=q(U());async function GO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_TOKEN"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?Oa(o,s[1].macro):void 0}async function KO(t){let e=await GO(t,M);if(e)return{contents:{kind:YO.MarkupKind.Markdown,value:e.toString()}}}var JO=q(U());async function yh(t,e,r){if(!t)return;let i=t?.properties.find(s=>Z(s.name)===e)?.ast.getFlatAstValues();if(!(!i||i.length<=1)&&i[r]instanceof ne)return Z(i[r].value)}async function XO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_TOKEN_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Le(s[2].macro);if(typeof a=="number")return o?yh(o,s[1].macro,a):void 0}async function QO(t){let e=await XO(t,M);if(e)return{contents:{kind:JO.MarkupKind.Markdown,value:e.toString()}}}var ZO=q(U());async function ex(t){let e=await Yp(t,M);if(e)return e instanceof J?mt(t.context,e):{contents:{kind:ZO.MarkupKind.Markdown,value:e.toString()}}}var nx=q(U());async function tx(t,e,r){if(!t)return;let i=t?.properties.find(s=>Z(s.name)===e)?.ast.getFlatAstValues();if(!(!i||i.length<=1)&&i[r]instanceof ne)return i[r].value}async function rx({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UNQUOTED_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Le(s[2].macro);if(typeof a=="number")return o?tx(o,s[1].macro,a):void 0}async function ix(t){let e=await rx(t,M);if(e)return{contents:{kind:nx.MarkupKind.Markdown,value:e.toString()}}}var ox=q(U());async function sx({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UNQUOTED"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?Kp(o,s[1].macro):void 0}async function ax(t){let e=await sx(t,M);if(e)return{contents:{kind:ox.MarkupKind.Markdown,value:e.toString()}}}var cx=q(U());async function lx(t){let e=await Xp(t,M);if(e)return e instanceof J?mt(t.context,e):{contents:{kind:cx.MarkupKind.Markdown,value:e.toString()}}}var fx=q(U());async function ux(t,e,r){return(await yh(t,e,r))?.toUpperCase()}async function dx({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UPPER_TOKEN_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Le(s[2].macro);if(typeof a=="number")return o?ux(o,s[1].macro,a):void 0}async function px(t){let e=await dx(t,M);if(e)return{contents:{kind:fx.MarkupKind.Markdown,value:e.toString()}}}var mx=q(U());async function hx({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UPPER_TOKEN"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?Jp(o,s[1].macro):void 0}async function gx(t){let e=await hx(t,M);if(e)return{contents:{kind:mx.MarkupKind.Markdown,value:e.toString()}}}var yx=q(U());async function Tx(t){let e=await Qp(t,M);if(e)return e instanceof J?mt(t.context,e):{contents:{kind:yx.MarkupKind.Markdown,value:e.toString()}}}async function vx(t){let e=await Np(t,M);return e?{contents:e.toMarkupContent(t.context.macros)}:void 0}var _x=q(U());async function bx(t,e){if(!t)return;let r=t.nodeType?.onBus;return r?Z(r)===e:!1}async function Sx(t,e){let r=t.macro.args;if(t.macro.macro!=="DT_ON_BUS"||r?.length!==2)return;let n=await e({...t,macro:r[0]});return await bx(n,r[1].macro)}async function Px(t){let e=await Sx(t,M);return e!==void 0?{contents:{kind:_x.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}async function kx(t){let e=await Ep(t);return e?{contents:e.toMarkupContent(t.context.macros)}:void 0}var Ex=q(U());async function Nx(t,e){return!!await Rp(t,e)}async function Rx(t){let e=t.macro.args;if(!(t.macro.macro!=="DT_HAS_CHOSEN"||e?.length!==1))return await Nx(t.context,e[0].macro)}async function wx(t){let e=await Rx(t);return e!==void 0?{contents:{kind:Ex.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}async function f2(t){return[vx,Px,kx,wx,cI,lI,pI,ZI,hI,mI,TI,$O,KI,II,NI,SI,RI,CI,AI,MI].reduce((e,r)=>e.then(n=>n||r(t)),Promise.resolve(void 0))}async function p2(t){return[DO,RO,$I,hO,yO,vO,jI,sO,cO,uO,nO,UI,HI,eO,fO,WI,SO,YI,_O,OO,qO,VI,zO,jO,HO,zI,QO,KO,ex,ix,ax,lx,px,gx,Tx].reduce((e,r)=>e.then(n=>n||r(t)),Promise.resolve(void 0))}async function Dx(t,e,r){if(r)try{let n=Qi(r,t.position);return await Cx(n,t.position,e,r)}catch{}}async function Cx(t,e,r,n){if(!t?.macro)return;let i=await f2({position:e,context:r,document:n,macro:t})||await p2({position:e,context:r,document:n,macro:t});if(i)return i;let s=await M({document:n,macro:t,context:r,position:e});if(s)return{contents:s.toMarkupContent(r.macros)};let o=await ks(n,t.macro,e,r);if(o)return Cx(o[0],o[1],r,n)}var bc=require("path"),IP=require("fs");var _v=(t,e,r)=>{let n=t instanceof RegExp?Ax(t,r):t,i=e instanceof RegExp?Ax(e,r):e,s=n!==null&&i!=null&&h2(n,i,r);return s&&{start:s[0],end:s[1],pre:r.slice(0,s[0]),body:r.slice(s[0]+n.length,s[1]),post:r.slice(s[1]+i.length)}},Ax=(t,e)=>{let r=e.match(t);return r?r[0]:null},h2=(t,e,r)=>{let n,i,s,o,a,c=r.indexOf(t),l=r.indexOf(e,c+1),u=c;if(c>=0&&l>0){if(t===e)return[c,l];for(n=[],s=r.length;u>=0&&!a;){if(u===c)n.push(u),c=r.indexOf(t,u+1);else if(n.length===1){let d=n.pop();d!==void 0&&(a=[d,l])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=l),l=r.indexOf(e,u+1);u=c<l&&c>=0?c:l}n.length&&o!==void 0&&(a=[s,o])}return a};var Ix="\0SLASH"+Math.random()+"\0",Ox="\0OPEN"+Math.random()+"\0",Rv="\0CLOSE"+Math.random()+"\0",xx="\0COMMA"+Math.random()+"\0",Mx="\0PERIOD"+Math.random()+"\0",m2=new RegExp(Ix,"g"),g2=new RegExp(Ox,"g"),y2=new RegExp(Rv,"g"),T2=new RegExp(xx,"g"),v2=new RegExp(Mx,"g"),b2=/\\\\/g,S2=/\\{/g,_2=/\\}/g,P2=/\\,/g,k2=/\\\./g,N2=1e5,R2=4e6,E2=1e3,w2=1e3;function Pv(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function D2(t){return t.replace(b2,Ix).replace(S2,Ox).replace(_2,Rv).replace(P2,xx).replace(k2,Mx)}function C2(t){return t.replace(m2,"\\").replace(g2,"{").replace(y2,"}").replace(T2,",").replace(v2,".")}function kv(t,e){for(let r=0;r<e.length;r++)t.push(e[r])}function A2(t){let e=[],r="";for(;;){let n=_v("{","}",t);if(!n){let c=t.split(",");return c[0]=r+c[0],kv(e,c),e}let{pre:i,body:s,post:o}=n,a=i.split(",");if(a[0]=r+a[0],a[a.length-1]+="{"+s+"}",!o.length)return kv(e,a),e;r=a.pop(),kv(e,a),t=o}}function Lx(t,e={}){if(!t)return[];let{max:r=N2,maxLength:n=R2,maxDepth:i=E2,maxRewrites:s=w2}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),Nv(D2(t),r,n,i,0,s,!0).map(C2)}function I2(t){return"{"+t+"}"}function O2(t){return/^-?0\d/.test(t)}function x2(t,e){return t<=e}function M2(t,e){return t>=e}function Nl(t,e,r,n,i,s){let o=[],a=0;for(let c=0;c<t.length;c++)for(let l=0;l<r.length;l++){if(o.length>=n)return o;let u=t[c]+e+r[l];if(!(s&&!u)){if(a+u.length>i)return o;o.push(u),a+=u.length}}return o}function L2(t,e,r,n){let i=t.split(/\.\./),s=[];if(i[0]===void 0||i[1]===void 0)return s;let o=Pv(i[0]),a=Pv(i[1]),c=Math.max(i[0].length,i[1].length),l=i.length===3&&i[2]!==void 0?Math.max(Math.abs(Pv(i[2])),1):1,u=x2;a<o&&(l*=-1,u=M2);let f=i.some(O2),p=0;for(let m=o;u(m,a)&&s.length<r;m+=l){let h;if(e)h=String.fromCharCode(m),h==="\\"&&(h="");else if(h=String(m),f){let y=c-h.length;if(y>0){let S=new Array(y+1).join("0");m<0?h="-"+S+h.slice(1):h=S+h}}if(p+h.length>n)break;s.push(h),p+=h.length}return s}function Nv(t,e,r,n,i,s,o){if(i>n)return[t];let a=[""],c=0,l=!1,u=!0;for(;;){let d=_v("{","}",t);if(!d)return Nl(a,t,[""],e,r,l);let f=d.pre;if(/\$$/.test(f)){if(a=Nl(a,f+"{"+d.body+"}",[""],e,r,l&&!d.post.length),u=!1,!d.post.length)break;t=d.post;continue}let p=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(d.body),m=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(d.body),h=p||m,y=d.body.indexOf(",")>=0;if(!h&&!y){if(c<s&&d.post.match(/,(?!,).*\}/)){c++,t=d.pre+"{"+d.body+Rv+d.post,o=!0;continue}return Nl(a,f+"{"+d.body+"}"+d.post,[""],e,r,l)}u&&(l=o&&!h,u=!1);let S;if(h)S=L2(d.body,m,e,r);else{let v=A2(d.body);if(v.length===1&&v[0]!==void 0&&(v=Nv(v[0],e,r,n,i+1,s,!1).map(I2),v.length===1)){if(a=Nl(a,f+v[0],[""],e,r,l&&!d.post.length),!d.post.length)break;t=d.post;continue}let b=l&&!d.post.length&&!f;for(let N=0;b&&N<a.length;N++)a[N]&&(b=!1);S=[];let P=0;e:for(let N=0;N<v.length;N++){let $=Nv(v[N],e,r,n,i+1,s,!1);for(let j=0;j<$.length;j++){let L=$[j];if(!(b&&!L)){if(S.length>=e||P+L.length>r)break e;S.push(L),P+=L.length}}}}if(a=Nl(a,f,S,e,r,l&&!d.post.length),!d.post.length)break;t=d.post}return a}var Rl=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")};var q2={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},El=t=>t.replace(/[[\]\\-]/g,"\\$&"),$2=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),qx=t=>t.join(""),$x=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=r+1,o=!1,a=!1,c=!1,l=!1,u=r,d="";e:for(;s<t.length;){let h=t.charAt(s);if((h==="!"||h==="^")&&s===r+1){l=!0,s++;continue}if(h==="]"&&o&&!c){u=s+1;break}if(o=!0,h==="\\"&&!c){c=!0,s++;continue}if(h==="["&&!c){for(let[y,[S,v,b]]of Object.entries(q2))if(t.startsWith(y,s)){if(d)return["$.",!1,t.length-r,!0];s+=y.length,b?i.push(S):n.push(S),a=a||v;continue e}}if(c=!1,d){h>d?n.push(El(d)+"-"+El(h)):h===d&&n.push(El(h)),d="",s++;continue}if(t.startsWith("-]",s+1)){n.push(El(h+"-")),s+=2;continue}if(t.startsWith("-",s+1)){d=h,s+=2;continue}n.push(El(h)),s++}if(u<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,t.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!l){let h=n[0].length===2?n[0].slice(-1):n[0];return[$2(h),!1,u-r,!1]}let f="["+(l?"^":"")+qx(n)+"]",p="["+(l?"":"^")+qx(i)+"]";return[n.length&&i.length?"("+f+"|"+p+")":n.length?f:p,a,u-r,!0]};var ci=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!0}={})=>r?e?t.replace(/\[([^/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):e?t.replace(/\[([^/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");var sn,F2=new Set(["!","?","+","*","@"]),Ev=t=>F2.has(t),Fx=t=>Ev(t.type),B2=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),j2=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),U2=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),Bx=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),H2="(?!(?:^|/)\\.\\.?(?:$|/))",Th="(?!\\.)",V2=new Set(["[","."]),W2=new Set(["..","."]),z2=new Set("().*{}+?[]^$\\!"),G2=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),wv="[^/]",jx=wv+"*?",Ux=wv+"+?",Y2=0,bo=class{type;#e;#r;#n=!1;#t=[];#s;#m;#u;#f=!1;#a;#p;#d=!1;id=++Y2;get depth(){return(this.#s?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#s?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(e,r,n={}){this.type=e,e&&(this.#r=!0),this.#s=r,this.#e=this.#s?this.#s.#e:this,this.#a=this.#e===this?n:this.#e.#a,this.#u=this.#e===this?[]:this.#e.#u,e==="!"&&!this.#e.#f&&this.#u.push(this),this.#m=this.#s?this.#s.#t.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#p!==void 0?this.#p:this.type?this.#p=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#p=this.#t.map(e=>String(e)).join("")}#l(){if(this!==this.#e)throw new Error("should only call on root");if(this.#f)return this;this.toString(),this.#f=!0;let e;for(;e=this.#u.pop();){if(e.type!=="!")continue;let r=e,n=r.#s;for(;n;){for(let i=r.#m+1;!n.type&&i<n.#t.length;i++)for(let s of e.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#t[i])}r=n,n=r.#s}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof sn&&r.#s===this))throw new Error("invalid part: "+r);this.#t.push(r)}}toJSON(){let e=this.type===null?this.#t.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#t.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#f&&this.#s?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#s?.isStart())return!1;if(this.#m===0)return!0;let e=this.#s;for(let r=0;r<this.#m;r++){let n=e.#t[r];if(!(n instanceof sn&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#s?.type==="!")return!0;if(!this.#s?.isEnd())return!1;if(!this.type)return this.#s?.isEnd();let e=this.#s?this.#s.#t.length:0;return this.#m===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let r=new sn(this.type,e);for(let n of this.#t)r.copyIn(n);return r}static#o(e,r,n,i,s){let o=i.maxExtglobRecursion??2,a=!1,c=!1,l=-1,u=!1;if(r.type===null){let h=n,y="";for(;h<e.length;){let S=e.charAt(h++);if(a||S==="\\"){a=!a,y+=S;continue}if(c){h===l+1?(S==="^"||S==="!")&&(u=!0):S==="]"&&!(h===l+2&&u)&&(c=!1),y+=S;continue}else if(S==="["){c=!0,l=h,u=!1,y+=S;continue}if(!i.noext&&Ev(S)&&e.charAt(h)==="("&&s<=o){r.push(y),y="";let b=new sn(S,r);h=sn.#o(e,b,h,i,s+1),r.push(b);continue}y+=S}return r.push(y),h}let d=n+1,f=new sn(null,r),p=[],m="";for(;d<e.length;){let h=e.charAt(d++);if(a||h==="\\"){a=!a,m+=h;continue}if(c){d===l+1?(h==="^"||h==="!")&&(u=!0):h==="]"&&!(d===l+2&&u)&&(c=!1),m+=h;continue}else if(h==="["){c=!0,l=d,u=!1,m+=h;continue}if(!i.noext&&Ev(h)&&e.charAt(d)==="("&&(s<=o||r&&r.#g(h))){let S=r&&r.#g(h)?0:1;f.push(m),m="";let v=new sn(h,f);f.push(v),d=sn.#o(e,v,d,i,s+S);continue}if(h==="|"){f.push(m),m="",p.push(f),f=new sn(null,r);continue}if(h===")")return m===""&&r.#t.length===0&&(r.#d=!0),f.push(m),m="",r.push(...p,f),d;m+=h}return r.type=null,r.#r=void 0,r.#t=[e.substring(n-1)],d}#b(e){return this.#_(e,j2)}#_(e,r=B2){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let n=e.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#g(n.type,r)}#g(e,r=U2){return!!r.get(this.type)?.includes(e)}#y(e,r){let n=e.#t[0],i=new sn(null,n,this.options);i.#t.push(""),n.push(i),this.#R(e,r)}#R(e,r){let n=e.#t[0];this.#t.splice(r,1,...n.#t);for(let i of n.#t)typeof i=="object"&&(i.#s=this);this.#p=void 0}#T(e){return!!Bx.get(this.type)?.has(e)}#P(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let r=e.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#T(r.type)}#k(e){let r=Bx.get(this.type),n=e.#t[0],i=r?.get(n.type);if(!i)return!1;this.#t=n.#t;for(let s of this.#t)typeof s=="object"&&(s.#s=this);this.type=i,this.#p=void 0,this.#d=!1}static fromGlob(e,r={}){let n=new sn(null,void 0,r);return sn.#o(e,n,0,r,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[r,n,i,s]=this.toRegExpSource();if(!(i||this.#r||this.#a.nocase&&!this.#a.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#a.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:e})}get options(){return this.#a}toRegExpSource(e){let r=e??!!this.#a.dot;if(this.#e===this&&(this.#h(),this.#l()),!Fx(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(p=>typeof p!="string"),l=this.#t.map(p=>{let[m,h,y,S]=typeof p=="string"?sn.#S(p,this.#r,c):p.toRegExpSource(e);return this.#r=this.#r||y,this.#n=this.#n||S,m}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&W2.has(this.#t[0]))){let m=V2,h=r&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),y=!r&&!e&&m.has(l.charAt(0));u=h?H2:y?Th:""}let d="";return this.isEnd()&&this.#e.#f&&this.#s?.type==="!"&&(d="(?:$|\\/)"),[u+l+d,ci(l),this.#r=!!this.#r,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#v(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),l=this;return l.#t=[c],l.type=null,l.#r=void 0,[c,ci(this.toString()),!1,!1]}let o=!n||e||r||!Th?"":this.#v(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#d)a=(this.isStart()&&!r?Th:"")+Ux;else{let c=this.type==="!"?"))"+(this.isStart()&&!r&&!e?Th:"")+jx+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+c}return[a,ci(s),this.#r=!!this.#r,this.#n]}#h(){if(Fx(this)){let e=0,r=!1;do{r=!0;for(let n=0;n<this.#t.length;n++){let i=this.#t[n];typeof i=="object"&&(i.#h(),this.#_(i)?(r=!1,this.#R(i,n)):this.#b(i)?(r=!1,this.#y(i,n)):this.#P(i)&&(r=!1,this.#k(i)))}}while(!r&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#h();this.#p=void 0}#v(e){return this.#t.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=r.toRegExpSource(e);return this.#n=this.#n||o,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#S(e,r,n=!1){let i=!1,s="",o=!1,a=!1;for(let c=0;c<e.length;c++){let l=e.charAt(c);if(i){i=!1,s+=(z2.has(l)?"\\":"")+l;continue}if(l==="*"){if(a)continue;a=!0,s+=n&&/^[*]+$/.test(e)?Ux:jx,r=!0;continue}else a=!1;if(l==="\\"){c===e.length-1?s+="\\\\":i=!0;continue}if(l==="["){let[u,d,f,p]=$x(e,c);if(f){s+=u,o=o||d,c+=f-1,r=r||p;continue}}if(l==="?"){s+=wv,r=!0;continue}s+=G2(l)}return[s,ci(e),!!r,o]}};sn=bo;var Ba=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!1}={})=>r?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");var jr=(t,e,r={})=>(Rl(e),!r.nocomment&&e.charAt(0)==="#"?!1:new _n(e,r).match(t)),K2=/^\*+([^+@!?*[(]*)$/,X2=t=>e=>!e.startsWith(".")&&e.endsWith(t),J2=t=>e=>e.endsWith(t),Q2=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),Z2=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),eW=/^\*+\.\*+$/,tW=t=>!t.startsWith(".")&&t.includes("."),rW=t=>t!=="."&&t!==".."&&t.includes("."),nW=/^\.\*+$/,iW=t=>t!=="."&&t!==".."&&t.startsWith("."),sW=/^\*+$/,oW=t=>t.length!==0&&!t.startsWith("."),aW=t=>t.length!==0&&t!=="."&&t!=="..",cW=/^\?+([^+@!?*[(]*)?$/,lW=([t,e=""])=>{let r=Wx([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},uW=([t,e=""])=>{let r=zx([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},dW=([t,e=""])=>{let r=zx([t]);return e?n=>r(n)&&n.endsWith(e):r},fW=([t,e=""])=>{let r=Wx([t]);return e?n=>r(n)&&n.endsWith(e):r},Wx=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},zx=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},Gx=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Hx={win32:{sep:"\\"},posix:{sep:"/"}},pW=Gx==="win32"?Hx.win32.sep:Hx.posix.sep;jr.sep=pW;var jt=Symbol("globstar **");jr.GLOBSTAR=jt;var hW="[^/]",mW=hW+"*?",gW="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",yW="(?:(?!(?:\\/|^)\\.).)*?",TW=(t,e={})=>r=>jr(r,t,e);jr.filter=TW;var qn=(t,e={})=>Object.assign({},t,e),vW=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return jr;let e=jr;return Object.assign((n,i,s={})=>e(n,i,qn(t,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,qn(t,s))}static defaults(i){return e.defaults(qn(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,qn(t,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,qn(t,s))}},unescape:(n,i={})=>e.unescape(n,qn(t,i)),escape:(n,i={})=>e.escape(n,qn(t,i)),filter:(n,i={})=>e.filter(n,qn(t,i)),defaults:n=>e.defaults(qn(t,n)),makeRe:(n,i={})=>e.makeRe(n,qn(t,i)),braceExpand:(n,i={})=>e.braceExpand(n,qn(t,i)),match:(n,i,s={})=>e.match(n,i,qn(t,s)),sep:e.sep,GLOBSTAR:jt})};jr.defaults=vW;var Yx=(t,e={})=>(Rl(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:Lx(t,{max:e.braceExpandMax}));jr.braceExpand=Yx;var bW=(t,e={})=>new _n(t,e).makeRe();jr.makeRe=bW;var SW=(t,e,r={})=>{let n=new _n(e,r);return t=t.filter(i=>n.match(i)),n.options.nonull&&!t.length&&t.push(e),t};jr.match=SW;var Vx=/[?*]|[+@!]\(.*?\)|\[|\]/,_W=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),_n=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,r={}){Rl(e),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=e,this.platform=r.platform||Gx,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let r of e)if(typeof r!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!Vx.test(s[2]))&&!Vx.test(s[3]),l=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(u=>this.parse(u))];if(l)return[s[0],...s.slice(1).map(u=>this.parse(u))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n of e)for(let i=0;i<n.length;i++)n[i]==="**"&&(n[i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):r>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(e){return e.map(r=>(r=r.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(r=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(r=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(r=!0,e.splice(n-1,2),n-=2)}}while(r);return e.length===0?[""]:e}firstPhasePreProcess(e){let r=!1;do{r=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let a=n[i+1],c=n[i+2],l=n[i+3];if(a!==".."||!c||c==="."||c===".."||!l||l==="."||l==="..")continue;r=!0,n.splice(i,1);let u=n.slice(0);u[i]="**",e.push(u),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){r=!0;let c=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...c),n.length===0&&n.push(""),s-=2}}}}while(r);return e}secondPhasePreProcess(e){for(let r=0;r<e.length-1;r++)for(let n=r+1;n<e.length;n++){let i=this.partsMatch(e[r],e[n],!this.preserveMultipleSlashes);if(i){e[r]=[],e[n]=i;break}}return e.filter(r=>r.length)}partsMatch(e,r,n=!1){let i=0,s=0,o=[],a="";for(;i<e.length&&s<r.length;)if(e[i]===r[s])o.push(a==="b"?r[s]:e[i]),i++,s++;else if(n&&e[i]==="**"&&r[s]===e[i+1])o.push(e[i]),i++;else if(n&&r[s]==="**"&&e[i]===r[s+1])o.push(r[s]),s++;else if(e[i]==="*"&&r[s]&&(this.options.dot||!r[s].startsWith("."))&&r[s]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,s++}else if(r[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(r[s]),i++,s++}else return!1;return e.length===r.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,r=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=e.slice(n)),this.negate=r}matchOne(e,r,n=!1){let i=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),c=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),l=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),u=!l&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),d=c?3:a?0:void 0,f=u?3:l?0:void 0;if(typeof d=="number"&&typeof f=="number"){let[p,m]=[e[d],r[f]];p.toLowerCase()===m.toLowerCase()&&(r[f]=p,s=f,i=d)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),r.includes(jt)?this.#e(e,r,n,i,s):this.#n(e,r,n,i,s)}#e(e,r,n,i,s){let o=r.indexOf(jt,s),a=r.lastIndexOf(jt),[c,l,u]=n?[r.slice(s,o),r.slice(o+1),[]]:[r.slice(s,o),r.slice(o+1,a),r.slice(a+1)];if(c.length){let v=e.slice(i,i+c.length);if(!this.#n(v,c,n,0,0))return!1;i+=c.length,s+=c.length}let d=0;if(u.length){if(u.length+i>e.length)return!1;let v=e.length-u.length;if(this.#n(e,u,n,v,0))d=u.length;else{if(e[e.length-1]!==""||i+u.length===e.length||(v--,!this.#n(e,u,n,v,0)))return!1;d=u.length+1}}if(!l.length){let v=!!d;for(let b=i;b<e.length-d;b++){let P=String(e[b]);if(v=!0,P==="."||P===".."||!this.options.dot&&P.startsWith("."))return!1}return n||v}let f=[[[],0]],p=f[0],m=0,h=[0];for(let v of l)v===jt?(h.push(m),p=[[],0],f.push(p)):(p[0].push(v),m++);let y=f.length-1,S=e.length-d;for(let v of f)v[1]=S-(h[y--]+v[0].length);return!!this.#r(e,f,i,0,n,0,!!d)}#r(e,r,n,i,s,o,a){let c=r[i];if(!c){for(let d=n;d<e.length;d++){a=!0;let f=e[d];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return a}let[l,u]=c;for(;n<=u;){if(this.#n(e.slice(0,n+l.length),l,s,n,0)&&o<this.maxGlobstarRecursion){let p=this.#r(e,r,n+l.length,i+1,s,o+1,a);if(p!==!1)return p}let f=e[n];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;n++}return s||null}#n(e,r,n,i,s){let o,a,c,l;for(o=i,a=s,l=e.length,c=r.length;o<l&&a<c;o++,a++){this.debug("matchOne loop");let u=r[a],d=e[o];if(this.debug(r,u,d),u===!1||u===jt)return!1;let f;if(typeof u=="string"?(f=d===u,this.debug("string match",u,d,f)):(f=u.test(d),this.debug("pattern match",u,d,f)),!f)return!1}if(o===l&&a===c)return!0;if(o===l)return n;if(a===c)return o===l-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return Yx(this.pattern,this.options)}parse(e){Rl(e);let r=this.options;if(e==="**")return jt;if(e==="")return"";let n,i=null;(n=e.match(sW))?i=r.dot?aW:oW:(n=e.match(K2))?i=(r.nocase?r.dot?Z2:Q2:r.dot?J2:X2)(n[1]):(n=e.match(cW))?i=(r.nocase?r.dot?uW:lW:r.dot?dW:fW)(n):(n=e.match(eW))?i=r.dot?rW:tW:(n=e.match(nW))&&(i=iW);let s=bo.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?mW:r.dot?gW:yW,i=new Set(r.nocase?["i"]:[]),s=e.map(c=>{let l=c.map(d=>{if(d instanceof RegExp)for(let f of d.flags.split(""))i.add(f);return typeof d=="string"?_W(d):d===jt?jt:d._src});l.forEach((d,f)=>{let p=l[f+1],m=l[f-1];d!==jt||m===jt||(m===void 0?p!==void 0&&p!==jt?l[f+1]="(?:\\/|"+n+"\\/)?"+p:l[f]=n:p===void 0?l[f-1]=m+"(?:\\/|\\/"+n+")?":p!==jt&&(l[f-1]=m+"(?:\\/|\\/"+n+"\\/)"+p,l[f+1]=jt))});let u=l.filter(d=>d!==jt);if(this.partial&&u.length>=1){let d=[];for(let f=1;f<=u.length;f++)d.push(u.slice(0,f).join("/"));return"(?:"+d.join("|")+")"}return u.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a of s){let c=i;if(n.matchBase&&a.length===1&&(c=[o]),this.matchOne(c,a,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return jr.defaults(e).Minimatch}};jr.AST=bo;jr.Minimatch=_n;jr.escape=Ba;jr.unescape=ci;var TM=require("node:url");var bh=require("node:diagnostics_channel"),yr=(0,bh.channel)("lru-cache:metrics"),wl=(0,bh.tracingChannel)("lru-cache"),PW=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Dv=()=>yr.hasSubscribers||wl.hasSubscribers,Xx=new Set,Kx=typeof process=="object"&&process?process:{},kW=(t,e,r,n)=>{typeof Kx.emitWarning=="function"?Kx.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)},NW=t=>!Xx.has(t),Ds=t=>!!t&&t===Math.floor(t)&&t>0&&isFinite(t),Jx=t=>Ds(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?vh:null:null,vh=class extends Array{constructor(t){super(t),this.fill(0)}},RW=class Dl{heap;length;static#e=!1;static create(e){let r=Jx(e);if(!r)return[];Dl.#e=!0;let n=new Dl(e,r);return Dl.#e=!1,n}constructor(e,r){if(!Dl.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Cl=class Qx{#e;#r;#n;#t;#s;#m;#u;#f;get perf(){return this.#f}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#a;#p;#d;#l;#o;#b;#_;#g;#y;#R;#T;#P;#k;#h;#v;#S;#w;#i;#A;static unsafeExposeInternals(e){return{starts:e.#k,ttls:e.#h,autopurgeTimers:e.#v,sizes:e.#P,keyMap:e.#d,keyList:e.#l,valList:e.#o,next:e.#b,prev:e.#_,get head(){return e.#g},get tail(){return e.#y},free:e.#R,isBackgroundFetch:r=>e.#c(r),backgroundFetch:(r,n,i,s)=>e.#q(r,n,i,s),moveToTail:r=>e.#Y(r),indexes:r=>e.#D(r),rindexes:r=>e.#C(r),isStale:r=>e.#N(r)}}get max(){return this.#e}get maxSize(){return this.#r}get calculatedSize(){return this.#p}get size(){return this.#a}get fetchMethod(){return this.#m}get memoMethod(){return this.#u}get dispose(){return this.#n}get onInsert(){return this.#t}get disposeAfter(){return this.#s}constructor(e){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:c,dispose:l,onInsert:u,disposeAfter:d,noDisposeOnSet:f,noUpdateTTL:p,maxSize:m=0,maxEntrySize:h=0,sizeCalculation:y,fetchMethod:S,memoMethod:v,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:P,allowStaleOnFetchRejection:N,allowStaleOnFetchAbort:$,ignoreFetchAbort:j,backgroundFetchSize:L=1,perf:ye}=e;if(this.backgroundFetchSize=L,ye!==void 0&&typeof ye?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#f=ye??PW,r!==0&&!Ds(r))throw new TypeError("max option must be a nonnegative integer");let qe=r?Jx(r):Array;if(!qe)throw new Error("invalid max value: "+r);if(this.#e=r,this.#r=m,this.maxEntrySize=h||this.#r,this.sizeCalculation=y,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(v!==void 0&&typeof v!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#u=v,S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#m=S,this.#w=!!S,this.#d=new Map,this.#l=Array.from({length:r}).fill(void 0),this.#o=Array.from({length:r}).fill(void 0),this.#b=new qe(r),this.#_=new qe(r),this.#g=0,this.#y=0,this.#R=RW.create(r),this.#a=0,this.#p=0,typeof l=="function"&&(this.#n=l),typeof u=="function"&&(this.#t=u),typeof d=="function"?(this.#s=d,this.#T=[]):(this.#s=void 0,this.#T=void 0),this.#S=!!this.#n,this.#A=!!this.#t,this.#i=!!this.#s,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!N,this.allowStaleOnFetchAbort=!!$,this.ignoreFetchAbort=!!j,this.maxEntrySize!==0){if(this.#r!==0&&!Ds(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!Ds(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#V()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!P,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=Ds(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!Ds(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#I()}if(this.#e===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#r){let pe="LRU_CACHE_UNBOUNDED";NW(pe)&&(Xx.add(pe),kW("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",pe,Qx))}}getRemainingTTL(e){return this.#d.has(e)?1/0:0}#I(){let e=new vh(this.#e),r=new vh(this.#e);this.#h=e,this.#k=r;let n=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#v=n,this.#F=(c,l,u=this.#f.now())=>{r[c]=l!==0?u:0,e[c]=l,i(c,l)},this.#E=c=>{r[c]=e[c]!==0?this.#f.now():0,i(c,e[c])};let i=this.ttlAutopurge?(c,l)=>{if(n?.[c]&&(clearTimeout(n[c]),n[c]=void 0),l&&l!==0&&n){let u=setTimeout(()=>{this.#N(c)?(this.#$(this.#l[c],"expire"),n[c]=void 0):i(c,a(c))},l+1);u.unref&&u.unref(),n[c]=u}}:()=>{};this.#O=(c,l)=>{if(e[l]){let u=e[l],d=r[l];if(!u||!d)return;c.ttl=u,c.start=d,c.now=s||o();let f=c.now-d;c.remainingTTL=u-f}};let s=0,o=()=>{let c=this.#f.now();if(this.ttlResolution>0){s=c;let l=setTimeout(()=>s=0,this.ttlResolution);l.unref&&l.unref()}return c};this.getRemainingTTL=c=>{let l=this.#d.get(c);return l===void 0?0:a(l)};let a=c=>{let l=e[c],u=r[c];if(!l||!u)return 1/0;let d=(s||o())-u;return l-d};this.#N=c=>{let l=r[c],u=e[c];return!!u&&!!l&&(s||o())-l>u}}#E=()=>{};#O=()=>{};#F=()=>{};#N=()=>!1;#V(){let e=new vh(this.#e);this.#p=0,this.#P=e,this.#M=r=>{this.#p-=e[r],e[r]=0},this.#B=(r,n,i,s)=>{if(!Ds(i)){if(this.#c(n))return this.backgroundFetchSize;if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,r),!Ds(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return i},this.#x=(r,n,i)=>{if(e[r]=n,this.#r){let s=this.#r-e[r];for(;this.#p>s;)this.#H(!0)}this.#p+=e[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#p)}}#M=e=>{};#x=(e,r,n)=>{};#B=(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#D({allowStale:e=this.allowStale}={}){if(this.#a)for(let r=this.#y;this.#j(r)&&((e||!this.#N(r))&&(yield r),r!==this.#g);)r=this.#_[r]}*#C({allowStale:e=this.allowStale}={}){if(this.#a)for(let r=this.#g;this.#j(r)&&((e||!this.#N(r))&&(yield r),r!==this.#y);)r=this.#b[r]}#j(e){return e!==void 0&&this.#d.get(this.#l[e])===e}*entries(){for(let e of this.#D())this.#o[e]!==void 0&&this.#l[e]!==void 0&&!this.#c(this.#o[e])&&(yield[this.#l[e],this.#o[e]])}*rentries(){for(let e of this.#C())this.#o[e]!==void 0&&this.#l[e]!==void 0&&!this.#c(this.#o[e])&&(yield[this.#l[e],this.#o[e]])}*keys(){for(let e of this.#D()){let r=this.#l[e];r!==void 0&&!this.#c(this.#o[e])&&(yield r)}}*rkeys(){for(let e of this.#C()){let r=this.#l[e];r!==void 0&&!this.#c(this.#o[e])&&(yield r)}}*values(){for(let e of this.#D())this.#o[e]!==void 0&&!this.#c(this.#o[e])&&(yield this.#o[e])}*rvalues(){for(let e of this.#C())this.#o[e]!==void 0&&!this.#c(this.#o[e])&&(yield this.#o[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#D()){let i=this.#o[n],s=this.#c(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#l[n],this))return this.#G(this.#l[n],r)}}forEach(e,r=this){for(let n of this.#D()){let i=this.#o[n],s=this.#c(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#l[n],this)}}rforEach(e,r=this){for(let n of this.#C()){let i=this.#o[n],s=this.#c(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#l[n],this)}}purgeStale(){let e=!1;for(let r of this.#C({allowStale:!0}))this.#N(r)&&(this.#$(this.#l[r],"expire"),e=!0);return e}info(e){let r=this.#d.get(e);if(r===void 0)return;let n=this.#o[r],i=this.#c(n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(this.#h&&this.#k){let o=this.#h[r],a=this.#k[r];if(o&&a){let c=o-(this.#f.now()-a);s.ttl=c,s.start=Date.now()}}return this.#P&&(s.size=this.#P[r]),s}dump(){let e=[];for(let r of this.#D({allowStale:!0})){let n=this.#l[r],i=this.#o[r],s=this.#c(i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let o={value:s};if(this.#h&&this.#k){o.ttl=this.#h[r];let a=this.#f.now()-this.#k[r];o.start=Math.floor(Date.now()-a)}this.#P&&(o.size=this.#P[r]),e.unshift([n,o])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let i=Date.now()-n.start;n.start=this.#f.now()-i}this.#L(r,n.value,n)}}set(e,r,n={}){let{status:i=yr.hasSubscribers?{}:void 0}=n;n.status=i,i&&(i.op="set",i.key=e,r!==void 0&&(i.value=r),i.cache=this);let s=this.#L(e,r,n);return i&&yr.hasSubscribers&&yr.publish(i),s}#L(e,r,n,i){let{ttl:s=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:l}=n,u=this.#c(r);if(r===void 0)return l&&(l.set="deleted"),this.delete(e),this;let{noUpdateTTL:d=this.noUpdateTTL}=n;l&&!u&&(l.value=r);let f=this.#B(e,r,n.size||0,c,l);if(this.maxEntrySize&&f>this.maxEntrySize)return this.#$(e,"set"),l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this;let p=this.#a===0?void 0:this.#d.get(e);if(p===void 0)p=this.#a===0?this.#y:this.#R.length!==0?this.#R.pop():this.#a===this.#e?this.#H(!1):this.#a,this.#l[p]=e,this.#o[p]=r,this.#d.set(e,p),this.#b[this.#y]=p,this.#_[p]=this.#y,this.#y=p,this.#a++,this.#x(p,f,l),l&&(l.set="add"),d=!1,this.#A&&!u&&this.#t?.(r,e,"add");else{this.#Y(p);let m=this.#o[p];if(r!==m){if(!a)if(this.#c(m)){m!==i&&m.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:h}=m;h!==void 0&&h!==r&&(this.#S&&this.#n?.(h,e,"set"),this.#i&&this.#T?.push([h,e,"set"]))}else this.#S&&this.#n?.(m,e,"set"),this.#i&&this.#T?.push([m,e,"set"]);if(this.#M(p),this.#x(p,f,l),this.#o[p]=r,!u){let h=m&&this.#c(m)?m.__staleWhileFetching:m,y=h===void 0?"add":r!==h?"replace":"update";l&&(l.set=y,h!==void 0&&(l.oldValue=h)),this.#A&&this.onInsert?.(r,e,y)}}else u||(l&&(l.set="update"),this.#A&&this.onInsert?.(r,e,"update"))}if(s!==0&&!this.#h&&this.#I(),this.#h&&(d||this.#F(p,s,o),l&&this.#O(l,p)),!a&&this.#i&&this.#T){let m=this.#T,h;for(;h=m?.shift();)this.#s?.(...h)}return this}pop(){try{for(;this.#a;){let e=this.#o[this.#g];if(this.#H(!0),this.#c(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#i&&this.#T){let e=this.#T,r;for(;r=e?.shift();)this.#s?.(...r)}}}#H(e){let r=this.#g,n=this.#l[r],i=this.#o[r],s=this.#c(i);s&&i.__abortController.abort(new Error("evicted"));let o=s?i.__staleWhileFetching:i;return(this.#S||this.#i)&&o!==void 0&&(this.#S&&this.#n?.(o,n,"evict"),this.#i&&this.#T?.push([o,n,"evict"])),this.#M(r),this.#v?.[r]&&(clearTimeout(this.#v[r]),this.#v[r]=void 0),e&&(this.#l[r]=void 0,this.#o[r]=void 0,this.#R.push(r)),this.#a===1?(this.#g=this.#y=0,this.#R.length=0):this.#g=this.#b[r],this.#d.delete(n),this.#a--,r}has(e,r={}){let{status:n=yr.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="has",n.key=e,n.cache=this);let i=this.#K(e,r);return yr.hasSubscribers&&yr.publish(n),i}#K(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,s=this.#d.get(e);if(s!==void 0){let o=this.#o[s];if(this.#c(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#N(s))i&&(i.has="stale",this.#O(i,s));else return n&&this.#E(s),i&&(i.has="hit",this.#O(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{status:n=Dv()?{}:void 0}=r;n&&(n.op="peek",n.key=e,n.cache=this),r.status=n;let i=this.#W(e,r);return yr.hasSubscribers&&yr.publish(n),i}#W(e,r){let{status:n,allowStale:i=this.allowStale}=r,s=this.#d.get(e);if(s===void 0||!i&&this.#N(s)){n&&(n.peek=s===void 0?"miss":"stale");return}let o=this.#o[s],a=this.#c(o)?o.__staleWhileFetching:o;return n&&(a!==void 0?(n.peek="hit",n.value=a):n.peek="miss"),a}#q(e,r,n,i){let s=r===void 0?void 0:this.#o[r];if(this.#c(s))return s;let o=new AbortController,{signal:a}=n;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let c={signal:o.signal,options:n,context:i},l=(h,y=!1)=>{let{aborted:S}=o.signal,v=n.ignoreFetchAbort&&h!==void 0,b=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&h!==void 0);if(n.status&&(S&&!y?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,v&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),S&&!v&&!y)return d(o.signal.reason,b);let P=p,N=this.#o[r];return(N===p||N===void 0&&v&&y)&&(h===void 0?P.__staleWhileFetching!==void 0?this.#o[r]=P.__staleWhileFetching:this.#$(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.#L(e,h,c.options,P))),h},u=h=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=h),d(h,!1)),d=(h,y)=>{let{aborted:S}=o.signal,v=S&&n.allowStaleOnFetchAbort,b=v||n.allowStaleOnFetchRejection,P=b||n.noDeleteOnFetchRejection,N=p;if(this.#o[r]===p&&(!P||!y&&N.__staleWhileFetching===void 0?this.#$(e,"fetch"):v||(this.#o[r]=N.__staleWhileFetching)),b)return n.status&&N.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),N.__staleWhileFetching;if(N.__returned===N)throw h},f=(h,y)=>{let S=this.#m?.(e,s,c);o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(h(void 0),n.allowStaleOnFetchAbort&&(h=v=>l(v,!0)))}),S&&S instanceof Promise?S.then(v=>h(v===void 0?void 0:v),y):S!==void 0&&h(S)};n.status&&(n.status.fetchDispatched=!0);let p=new Promise(f).then(l,u),m=Object.assign(p,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return r===void 0?(this.#L(e,m,{...c.options,status:void 0}),r=this.#d.get(e)):this.#o[r]=m,m}#c(e){if(!this.#w)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof AbortController}fetch(e,r={}){let n=wl.hasSubscribers,{status:i=Dv()?{}:void 0}=r;r.status=i,i&&r.context&&(i.context=r.context);let s=this.#z(e,r);return i&&n&&(i.trace=!0,wl.tracePromise(()=>s,i).catch(()=>{})),s}async#z(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:c=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:h,forceRefresh:y=!1,status:S,signal:v}=r;if(S&&(S.op="fetch",S.key=e,y&&(S.forceRefresh=!0),S.cache=this),!this.#w)return S&&(S.fetch="get"),this.#G(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:S});let b={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:a,size:c,sizeCalculation:l,noUpdateTTL:u,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:m,ignoreFetchAbort:p,status:S,signal:v},P=this.#d.get(e);if(P===void 0){S&&(S.fetch="miss");let N=this.#q(e,P,b,h);return N.__returned=N}else{let N=this.#o[P];if(this.#c(N)){let ye=n&&N.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",ye&&(S.returnedStale=!0)),ye?N.__staleWhileFetching:N.__returned=N}let $=this.#N(P);if(!y&&!$)return S&&(S.fetch="hit"),this.#Y(P),i&&this.#E(P),S&&this.#O(S,P),N;let j=this.#q(e,P,b,h),L=j.__staleWhileFetching!==void 0&&n;return S&&(S.fetch=$?"stale":"refresh",L&&$&&(S.returnedStale=!0)),L?j.__staleWhileFetching:j.__returned=j}}forceFetch(e,r={}){let n=wl.hasSubscribers,{status:i=Dv()?{}:void 0}=r;r.status=i,i&&r.context&&(i.context=r.context);let s=this.#U(e,r);return i&&n&&(i.trace=!0,wl.tracePromise(()=>s,i).catch(()=>{})),s}async#U(e,r={}){let n=await this.#z(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let{status:n=yr.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="memo",n.key=e,r.context&&(n.context=r.context),n.cache=this);let i=this.#Q(e,r);return n&&(n.value=i),yr.hasSubscribers&&yr.publish(n),i}#Q(e,r={}){let n=this.#u;if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,status:s,forceRefresh:o,...a}=r;s&&o&&(s.forceRefresh=!0);let c=this.#G(e,a),l=o||c===void 0;if(s&&(s.memo=l?"miss":"hit",l||(s.value=c)),!l)return c;let u=n(e,c,{options:a,context:i});return s&&(s.value=u),this.#L(e,u,a),u}get(e,r={}){let{status:n=yr.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="get",n.key=e,n.cache=this);let i=this.#G(e,r);return n&&(i!==void 0&&(n.value=i),yr.hasSubscribers&&yr.publish(n)),i}#G(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=r,a=this.#d.get(e);if(a===void 0){o&&(o.get="miss");return}let c=this.#o[a],l=this.#c(c);return o&&this.#O(o,a),this.#N(a)?l?(o&&(o.get="stale-fetching"),n&&c.__staleWhileFetching!==void 0?(o&&(o.returnedStale=!0),c.__staleWhileFetching):void 0):(s||this.#$(e,"expire"),o&&(o.get="stale"),n?(o&&(o.returnedStale=!0),c):void 0):(o&&(o.get=l?"fetching":"hit"),this.#Y(a),i&&this.#E(a),l?c.__staleWhileFetching:c)}#X(e,r){this.#_[r]=e,this.#b[e]=r}#Y(e){e!==this.#y&&(e===this.#g?this.#g=this.#b[e]:this.#X(this.#_[e],this.#b[e]),this.#X(this.#y,e),this.#y=e)}delete(e){return this.#$(e,"delete")}#$(e,r){yr.hasSubscribers&&yr.publish({op:"delete",delete:r,key:e,cache:this});let n=!1;if(this.#a!==0){let i=this.#d.get(e);if(i!==void 0)if(this.#v?.[i]&&(clearTimeout(this.#v[i]),this.#v[i]=void 0),n=!0,this.#a===1)this.#J(r);else{this.#M(i);let s=this.#o[i];if(this.#c(s)?s.__abortController.abort(new Error("deleted")):(this.#S||this.#i)&&(this.#S&&this.#n?.(s,e,r),this.#i&&this.#T?.push([s,e,r])),this.#d.delete(e),this.#l[i]=void 0,this.#o[i]=void 0,i===this.#y)this.#y=this.#_[i];else if(i===this.#g)this.#g=this.#b[i];else{let o=this.#_[i];this.#b[o]=this.#b[i];let a=this.#b[i];this.#_[a]=this.#_[i]}this.#a--,this.#R.push(i)}}if(this.#i&&this.#T?.length){let i=this.#T,s;for(;s=i?.shift();)this.#s?.(...s)}return n}clear(){return this.#J("delete")}#J(e){for(let r of this.#C({allowStale:!0})){let n=this.#o[r];if(this.#c(n))n.__abortController.abort(new Error("deleted"));else{let i=this.#l[r];this.#S&&this.#n?.(n,i,e),this.#i&&this.#T?.push([n,i,e])}}if(this.#d.clear(),this.#o.fill(void 0),this.#l.fill(void 0),this.#h&&this.#k){this.#h.fill(0),this.#k.fill(0);for(let r of this.#v??[])r!==void 0&&clearTimeout(r);this.#v?.fill(void 0)}if(this.#P&&this.#P.fill(0),this.#g=0,this.#y=0,this.#R.length=0,this.#p=0,this.#a=0,this.#i&&this.#T){let r=this.#T,n;for(;n=r?.shift();)this.#s?.(...n)}}};var Ha=require("node:path"),cM=require("node:url"),xi=require("fs"),LW=q(require("node:fs"),1),Is=require("node:fs/promises");var Eh=require("node:events"),Lv=q(require("node:stream"),1),nM=require("node:string_decoder"),Zx=typeof process=="object"&&process?process:{stdout:null,stderr:null},EW=t=>!!t&&typeof t=="object"&&(t instanceof As||t instanceof Lv.default||wW(t)||DW(t)),wW=t=>!!t&&typeof t=="object"&&t instanceof Eh.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==Lv.default.Writable.prototype.pipe,DW=t=>!!t&&typeof t=="object"&&t instanceof Eh.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",ts=Symbol("EOF"),rs=Symbol("maybeEmitEnd"),Cs=Symbol("emittedEnd"),Sh=Symbol("emittingEnd"),Al=Symbol("emittedError"),_h=Symbol("closed"),eM=Symbol("read"),Ph=Symbol("flush"),tM=Symbol("flushChunk"),li=Symbol("encoding"),ja=Symbol("decoder"),or=Symbol("flowing"),Il=Symbol("paused"),Ua=Symbol("resume"),ar=Symbol("buffer"),Ur=Symbol("pipes"),cr=Symbol("bufferLength"),Cv=Symbol("bufferPush"),kh=Symbol("bufferShift"),Dr=Symbol("objectMode"),Ut=Symbol("destroyed"),Av=Symbol("error"),Iv=Symbol("emitData"),rM=Symbol("emitEnd"),Ov=Symbol("emitEnd2"),Ii=Symbol("async"),xv=Symbol("abort"),Nh=Symbol("aborted"),Ol=Symbol("signal"),So=Symbol("dataListeners"),Pn=Symbol("discarded"),xl=t=>Promise.resolve().then(t),CW=t=>t(),AW=t=>t==="end"||t==="finish"||t==="prefinish",IW=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,OW=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Rh=class{src;dest;opts;ondrain;constructor(e,r,n){this.src=e,this.dest=r,this.opts=n,this.ondrain=()=>e[Ua](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Mv=class extends Rh{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,r,n){super(e,r,n),this.proxyErrors=i=>this.dest.emit("error",i),e.on("error",this.proxyErrors)}},xW=t=>!!t.objectMode,MW=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",As=class extends Eh.EventEmitter{[or]=!1;[Il]=!1;[Ur]=[];[ar]=[];[Dr];[li];[Ii];[ja];[ts]=!1;[Cs]=!1;[Sh]=!1;[_h]=!1;[Al]=null;[cr]=0;[Ut]=!1;[Ol];[Nh]=!1;[So]=0;[Pn]=!1;writable=!0;readable=!0;constructor(...e){let r=e[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");xW(r)?(this[Dr]=!0,this[li]=null):MW(r)?(this[li]=r.encoding,this[Dr]=!1):(this[Dr]=!1,this[li]=null),this[Ii]=!!r.async,this[ja]=this[li]?new nM.StringDecoder(this[li]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[ar]}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Ur]});let{signal:n}=r;n&&(this[Ol]=n,n.aborted?this[xv]():n.addEventListener("abort",()=>this[xv]()))}get bufferLength(){return this[cr]}get encoding(){return this[li]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Dr]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ii]}set async(e){this[Ii]=this[Ii]||!!e}[xv](){this[Nh]=!0,this.emit("abort",this[Ol]?.reason),this.destroy(this[Ol]?.reason)}get aborted(){return this[Nh]}set aborted(e){}write(e,r,n){if(this[Nh])return!1;if(this[ts])throw new Error("write after end");if(this[Ut])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(n=r,r="utf8"),r||(r="utf8");let i=this[Ii]?xl:CW;if(!this[Dr]&&!Buffer.isBuffer(e)){if(OW(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(IW(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Dr]?(this[or]&&this[cr]!==0&&this[Ph](!0),this[or]?this.emit("data",e):this[Cv](e),this[cr]!==0&&this.emit("readable"),n&&i(n),this[or]):e.length?(typeof e=="string"&&!(r===this[li]&&!this[ja]?.lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[li]&&(e=this[ja].write(e)),this[or]&&this[cr]!==0&&this[Ph](!0),this[or]?this.emit("data",e):this[Cv](e),this[cr]!==0&&this.emit("readable"),n&&i(n),this[or]):(this[cr]!==0&&this.emit("readable"),n&&i(n),this[or])}read(e){if(this[Ut])return null;if(this[Pn]=!1,this[cr]===0||e===0||e&&e>this[cr])return this[rs](),null;this[Dr]&&(e=null),this[ar].length>1&&!this[Dr]&&(this[ar]=[this[li]?this[ar].join(""):Buffer.concat(this[ar],this[cr])]);let r=this[eM](e||null,this[ar][0]);return this[rs](),r}[eM](e,r){if(this[Dr])this[kh]();else{let n=r;e===n.length||e===null?this[kh]():typeof n=="string"?(this[ar][0]=n.slice(e),r=n.slice(0,e),this[cr]-=e):(this[ar][0]=n.subarray(e),r=n.subarray(0,e),this[cr]-=e)}return this.emit("data",r),!this[ar].length&&!this[ts]&&this.emit("drain"),r}end(e,r,n){return typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r="utf8"),e!==void 0&&this.write(e,r),n&&this.once("end",n),this[ts]=!0,this.writable=!1,(this[or]||!this[Il])&&this[rs](),this}[Ua](){this[Ut]||(!this[So]&&!this[Ur].length&&(this[Pn]=!0),this[Il]=!1,this[or]=!0,this.emit("resume"),this[ar].length?this[Ph]():this[ts]?this[rs]():this.emit("drain"))}resume(){return this[Ua]()}pause(){this[or]=!1,this[Il]=!0,this[Pn]=!1}get destroyed(){return this[Ut]}get flowing(){return this[or]}get paused(){return this[Il]}[Cv](e){this[Dr]?this[cr]+=1:this[cr]+=e.length,this[ar].push(e)}[kh](){return this[Dr]?this[cr]-=1:this[cr]-=this[ar][0].length,this[ar].shift()}[Ph](e=!1){do;while(this[tM](this[kh]())&&this[ar].length);!e&&!this[ar].length&&!this[ts]&&this.emit("drain")}[tM](e){return this.emit("data",e),this[or]}pipe(e,r){if(this[Ut])return e;this[Pn]=!1;let n=this[Cs];return r=r||{},e===Zx.stdout||e===Zx.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,n?r.end&&e.end():(this[Ur].push(r.proxyErrors?new Mv(this,e,r):new Rh(this,e,r)),this[Ii]?xl(()=>this[Ua]()):this[Ua]()),e}unpipe(e){let r=this[Ur].find(n=>n.dest===e);r&&(this[Ur].length===1?(this[or]&&this[So]===0&&(this[or]=!1),this[Ur]=[]):this[Ur].splice(this[Ur].indexOf(r),1),r.unpipe())}addListener(e,r){return this.on(e,r)}on(e,r){let n=super.on(e,r);if(e==="data")this[Pn]=!1,this[So]++,!this[Ur].length&&!this[or]&&this[Ua]();else if(e==="readable"&&this[cr]!==0)super.emit("readable");else if(AW(e)&&this[Cs])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Al]){let i=r;this[Ii]?xl(()=>i.call(this,this[Al])):i.call(this,this[Al])}return n}removeListener(e,r){return this.off(e,r)}off(e,r){let n=super.off(e,r);return e==="data"&&(this[So]=this.listeners("data").length,this[So]===0&&!this[Pn]&&!this[Ur].length&&(this[or]=!1)),n}removeAllListeners(e){let r=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[So]=0,!this[Pn]&&!this[Ur].length&&(this[or]=!1)),r}get emittedEnd(){return this[Cs]}[rs](){!this[Sh]&&!this[Cs]&&!this[Ut]&&this[ar].length===0&&this[ts]&&(this[Sh]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[_h]&&this.emit("close"),this[Sh]=!1)}emit(e,...r){let n=r[0];if(e!=="error"&&e!=="close"&&e!==Ut&&this[Ut])return!1;if(e==="data")return!this[Dr]&&!n?!1:this[Ii]?(xl(()=>this[Iv](n)),!0):this[Iv](n);if(e==="end")return this[rM]();if(e==="close"){if(this[_h]=!0,!this[Cs]&&!this[Ut])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Al]=n,super.emit(Av,n);let s=!this[Ol]||this.listeners("error").length?super.emit("error",n):!1;return this[rs](),s}else if(e==="resume"){let s=super.emit("resume");return this[rs](),s}else if(e==="finish"||e==="prefinish"){let s=super.emit(e);return this.removeAllListeners(e),s}let i=super.emit(e,...r);return this[rs](),i}[Iv](e){for(let n of this[Ur])n.dest.write(e)===!1&&this.pause();let r=this[Pn]?!1:super.emit("data",e);return this[rs](),r}[rM](){return this[Cs]?!1:(this[Cs]=!0,this.readable=!1,this[Ii]?(xl(()=>this[Ov]()),!0):this[Ov]())}[Ov](){if(this[ja]){let r=this[ja].end();if(r){for(let n of this[Ur])n.dest.write(r);this[Pn]||super.emit("data",r)}}for(let r of this[Ur])r.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Dr]||(e.dataLength=0);let r=this.promise();return this.on("data",n=>{e.push(n),this[Dr]||(e.dataLength+=n.length)}),await r,e}async concat(){if(this[Dr])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[li]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,r)=>{this.on(Ut,()=>r(new Error("stream destroyed"))),this.on("error",n=>r(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Pn]=!1;let e=!1,r=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return r();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[ts])return r();let s,o,a=d=>{this.off("data",c),this.off("end",l),this.off(Ut,u),r(),o(d)},c=d=>{this.off("error",a),this.off("end",l),this.off(Ut,u),this.pause(),s({value:d,done:!!this[ts]})},l=()=>{this.off("error",a),this.off("data",c),this.off(Ut,u),r(),s({done:!0,value:void 0})},u=()=>a(new Error("stream destroyed"));return new Promise((d,f)=>{o=f,s=d,this.once(Ut,u),this.once("error",a),this.once("end",l),this.once("data",c)})},throw:r,return:r,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[Pn]=!1;let e=!1,r=()=>(this.pause(),this.off(Av,r),this.off(Ut,r),this.off("end",r),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return r();let i=this.read();return i===null?r():{done:!1,value:i}};return this.once("end",r),this.once(Av,r),this.once(Ut,r),{next:n,throw:r,return:r,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[Ut])return e?this.emit("error",e):this.emit(Ut),this;this[Ut]=!0,this[Pn]=!0,this[ar].length=0,this[cr]=0;let r=this;return typeof r.close=="function"&&!this[_h]&&r.close(),e?this.emit("error",e):this.emit(Ut),this}static get isStream(){return EW}};var qW=xi.realpathSync.native,Ll={lstatSync:xi.lstatSync,readdir:xi.readdir,readdirSync:xi.readdirSync,readlinkSync:xi.readlinkSync,realpathSync:qW,promises:{lstat:Is.lstat,readdir:Is.readdir,readlink:Is.readlink,realpath:Is.realpath}},lM=t=>!t||t===Ll||t===LW?Ll:{...Ll,...t,promises:{...Ll.promises,...t.promises||{}}},uM=/^\\\\\?\\([a-z]:)\\?$/i,$W=t=>t.replace(/\//g,"\\").replace(uM,"$1\\"),FW=/[\\\/]/,Fn=0,dM=1,fM=2,Oi=4,pM=6,hM=8,_o=10,mM=12,$n=15,Ml=~$n,qv=16,iM=32,ql=64,ui=128,wh=256,Ch=512,sM=ql|ui|Ch,BW=1023,$v=t=>t.isFile()?hM:t.isDirectory()?Oi:t.isSymbolicLink()?_o:t.isCharacterDevice()?fM:t.isBlockDevice()?pM:t.isSocket()?mM:t.isFIFO()?dM:Fn,oM=new Cl({max:2**12}),$l=t=>{let e=oM.get(t);if(e)return e;let r=t.normalize("NFKD");return oM.set(t,r),r},aM=new Cl({max:2**12}),Dh=t=>{let e=aM.get(t);if(e)return e;let r=$l(t.toLowerCase());return aM.set(t,r),r},Ah=class extends Cl{constructor(){super({max:256})}},Fv=class extends Cl{constructor(e=16*1024){super({maxSize:e,sizeCalculation:r=>r.length+1})}},gM=Symbol("PathScurry setAsCwd"),Cr=class{name;root;roots;parent;nocase;isCWD=!1;#e;#r;get dev(){return this.#r}#n;get mode(){return this.#n}#t;get nlink(){return this.#t}#s;get uid(){return this.#s}#m;get gid(){return this.#m}#u;get rdev(){return this.#u}#f;get blksize(){return this.#f}#a;get ino(){return this.#a}#p;get size(){return this.#p}#d;get blocks(){return this.#d}#l;get atimeMs(){return this.#l}#o;get mtimeMs(){return this.#o}#b;get ctimeMs(){return this.#b}#_;get birthtimeMs(){return this.#_}#g;get atime(){return this.#g}#y;get mtime(){return this.#y}#R;get ctime(){return this.#R}#T;get birthtime(){return this.#T}#P;#k;#h;#v;#S;#w;#i;#A;#I;#E;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,r=Fn,n,i,s,o,a){this.name=e,this.#P=s?Dh(e):$l(e),this.#i=r&BW,this.nocase=s,this.roots=i,this.root=n||this,this.#A=o,this.#h=a.fullpath,this.#S=a.relative,this.#w=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=lM(a.fs)}depth(){return this.#k!==void 0?this.#k:this.parent?this.#k=this.parent.depth()+1:this.#k=0}childrenCache(){return this.#A}resolve(e){if(!e)return this;let r=this.getRootString(e),i=e.substring(r.length).split(this.splitSep);return r?this.getRoot(r).#O(i):this.#O(i)}#O(e){let r=this;for(let n of e)r=r.child(n);return r}children(){let e=this.#A.get(this);if(e)return e;let r=Object.assign([],{provisional:0});return this.#A.set(this,r),this.#i&=~qv,r}child(e,r){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let n=this.children(),i=this.nocase?Dh(e):$l(e);for(let c of n)if(c.#P===i)return c;let s=this.parent?this.sep:"",o=this.#h?this.#h+s+e:void 0,a=this.newChild(e,Fn,{...r,parent:this,fullpath:o});return this.canReaddir()||(a.#i|=ui),n.push(a),a}relative(){if(this.isCWD)return"";if(this.#S!==void 0)return this.#S;let e=this.name,r=this.parent;if(!r)return this.#S=this.name;let n=r.relative();return n+(!n||!r.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let e=this.name,r=this.parent;if(!r)return this.#w=this.fullpathPosix();let n=r.relativePosix();return n+(!n||!r.parent?"":"/")+e}fullpath(){if(this.#h!==void 0)return this.#h;let e=this.name,r=this.parent;if(!r)return this.#h=this.name;let i=r.fullpath()+(r.parent?this.sep:"")+e;return this.#h=i}fullpathPosix(){if(this.#v!==void 0)return this.#v;if(this.sep==="/")return this.#v=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#v=`//?/${i}`:this.#v=i}let e=this.parent,r=e.fullpathPosix(),n=r+(!r||!e.parent?"":"/")+this.name;return this.#v=n}isUnknown(){return(this.#i&$n)===Fn}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#i&$n)===hM}isDirectory(){return(this.#i&$n)===Oi}isCharacterDevice(){return(this.#i&$n)===fM}isBlockDevice(){return(this.#i&$n)===pM}isFIFO(){return(this.#i&$n)===dM}isSocket(){return(this.#i&$n)===mM}isSymbolicLink(){return(this.#i&_o)===_o}lstatCached(){return this.#i&iM?this:void 0}readlinkCached(){return this.#I}realpathCached(){return this.#E}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#I)return!0;if(!this.parent)return!1;let e=this.#i&$n;return!(e!==Fn&&e!==_o||this.#i&wh||this.#i&ui)}calledReaddir(){return!!(this.#i&qv)}isENOENT(){return!!(this.#i&ui)}isNamed(e){return this.nocase?this.#P===Dh(e):this.#P===$l(e)}async readlink(){let e=this.#I;if(e)return e;if(this.canReadlink()&&this.parent)try{let r=await this.#e.promises.readlink(this.fullpath()),n=(await this.parent.realpath())?.resolve(r);if(n)return this.#I=n}catch(r){this.#C(r.code);return}}readlinkSync(){let e=this.#I;if(e)return e;if(this.canReadlink()&&this.parent)try{let r=this.#e.readlinkSync(this.fullpath()),n=this.parent.realpathSync()?.resolve(r);if(n)return this.#I=n}catch(r){this.#C(r.code);return}}#F(e){this.#i|=qv;for(let r=e.provisional;r<e.length;r++){let n=e[r];n&&n.#N()}}#N(){this.#i&ui||(this.#i=(this.#i|ui)&Ml,this.#V())}#V(){let e=this.children();e.provisional=0;for(let r of e)r.#N()}#M(){this.#i|=Ch,this.#x()}#x(){if(this.#i&ql)return;let e=this.#i;(e&$n)===Oi&&(e&=Ml),this.#i=e|ql,this.#V()}#B(e=""){e==="ENOTDIR"||e==="EPERM"?this.#x():e==="ENOENT"?this.#N():this.children().provisional=0}#D(e=""){e==="ENOTDIR"?this.parent.#x():e==="ENOENT"&&this.#N()}#C(e=""){let r=this.#i;r|=wh,e==="ENOENT"&&(r|=ui),(e==="EINVAL"||e==="UNKNOWN")&&(r&=Ml),this.#i=r,e==="ENOTDIR"&&this.parent&&this.parent.#x()}#j(e,r){return this.#H(e,r)||this.#L(e,r)}#L(e,r){let n=$v(e),i=this.newChild(e.name,n,{parent:this}),s=i.#i&$n;return s!==Oi&&s!==_o&&s!==Fn&&(i.#i|=ql),r.unshift(i),r.provisional++,i}#H(e,r){for(let n=r.provisional;n<r.length;n++){let i=r[n];if((this.nocase?Dh(e.name):$l(e.name))===i.#P)return this.#K(e,i,n,r)}}#K(e,r,n,i){let s=r.name;return r.#i=r.#i&Ml|$v(e),s!==e.name&&(r.name=e.name),n!==i.provisional&&(n===i.length-1?i.pop():i.splice(n,1),i.unshift(r)),i.provisional++,r}async lstat(){if((this.#i&ui)===0)try{return this.#W(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#D(e.code)}}lstatSync(){if((this.#i&ui)===0)try{return this.#W(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#D(e.code)}}#W(e){let{atime:r,atimeMs:n,birthtime:i,birthtimeMs:s,blksize:o,blocks:a,ctime:c,ctimeMs:l,dev:u,gid:d,ino:f,mode:p,mtime:m,mtimeMs:h,nlink:y,rdev:S,size:v,uid:b}=e;this.#g=r,this.#l=n,this.#T=i,this.#_=s,this.#f=o,this.#d=a,this.#R=c,this.#b=l,this.#r=u,this.#m=d,this.#a=f,this.#n=p,this.#y=m,this.#o=h,this.#t=y,this.#u=S,this.#p=v,this.#s=b;let P=$v(e);this.#i=this.#i&Ml|P|iM,P!==Fn&&P!==Oi&&P!==_o&&(this.#i|=ql)}#q=[];#c=!1;#z(e){this.#c=!1;let r=this.#q.slice();this.#q.length=0,r.forEach(n=>n(null,e))}readdirCB(e,r=!1){if(!this.canReaddir()){r?e(null,[]):queueMicrotask(()=>e(null,[]));return}let n=this.children();if(this.calledReaddir()){let s=n.slice(0,n.provisional);r?e(null,s):queueMicrotask(()=>e(null,s));return}if(this.#q.push(e),this.#c)return;this.#c=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(s,o)=>{if(s)this.#B(s.code),n.provisional=0;else{for(let a of o)this.#j(a,n);this.#F(n)}this.#z(n.slice(0,n.provisional))})}#U;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let r=this.fullpath();if(this.#U)await this.#U;else{let n=()=>{};this.#U=new Promise(i=>n=i);try{for(let i of await this.#e.promises.readdir(r,{withFileTypes:!0}))this.#j(i,e);this.#F(e)}catch(i){this.#B(i.code),e.provisional=0}this.#U=void 0,n()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let r=this.fullpath();try{for(let n of this.#e.readdirSync(r,{withFileTypes:!0}))this.#j(n,e);this.#F(e)}catch(n){this.#B(n.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#i&sM)return!1;let e=$n&this.#i;return e===Fn||e===Oi||e===_o}shouldWalk(e,r){return(this.#i&Oi)===Oi&&!(this.#i&sM)&&!e.has(this)&&(!r||r(this))}async realpath(){if(this.#E)return this.#E;if(!((Ch|wh|ui)&this.#i))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#E=this.resolve(e)}catch{this.#M()}}realpathSync(){if(this.#E)return this.#E;if(!((Ch|wh|ui)&this.#i))try{let e=this.#e.realpathSync(this.fullpath());return this.#E=this.resolve(e)}catch{this.#M()}}[gM](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let r=new Set([]),n=[],i=this;for(;i&&i.parent;)r.add(i),i.#S=n.join(this.sep),i.#w=n.join("/"),i=i.parent,n.push("..");for(i=e;i&&i.parent&&!r.has(i);)i.#S=void 0,i.#w=void 0,i=i.parent}},Ih=class t extends Cr{sep="\\";splitSep=FW;constructor(e,r=Fn,n,i,s,o,a){super(e,r,n,i,s,o,a)}newChild(e,r=Fn,n={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(e){return Ha.win32.parse(e).root}getRoot(e){if(e=$W(e.toUpperCase()),e===this.root.name)return this.root;for(let[r,n]of Object.entries(this.roots))if(this.sameRoot(e,r))return this.roots[e]=n;return this.roots[e]=new Va(e,this).root}sameRoot(e,r=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(uM,"$1\\"),e===r}},Oh=class t extends Cr{splitSep="/";sep="/";constructor(e,r=Fn,n,i,s,o,a){super(e,r,n,i,s,o,a)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,r=Fn,n={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}},xh=class{root;rootPath;roots;cwd;#e;#r;#n;nocase;#t;constructor(e=process.cwd(),r,n,{nocase:i,childrenCacheSize:s=16*1024,fs:o=Ll}={}){this.#t=lM(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,cM.fileURLToPath)(e));let a=r.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new Ah,this.#r=new Ah,this.#n=new Fv(s);let c=a.substring(this.rootPath.length).split(n);if(c.length===1&&!c[0]&&c.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let l=this.root,u=c.length-1,d=r.sep,f=this.rootPath,p=!1;for(let m of c){let h=u--;l=l.child(m,{relative:new Array(h).fill("..").join(d),relativePosix:new Array(h).fill("..").join("/"),fullpath:f+=(p?"":d)+m}),p=!0}this.cwd=l}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let r="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(r=r?`${o}/${r}`:o,this.isAbsolute(o)))break}let n=this.#e.get(r);if(n!==void 0)return n;let i=this.cwd.resolve(r).fullpath();return this.#e.set(r,i),i}resolvePosix(...e){let r="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(r=r?`${o}/${r}`:o,this.isAbsolute(o)))break}let n=this.#r.get(r);if(n!==void 0)return n;let i=this.cwd.resolve(r).fullpathPosix();return this.#r.set(r,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,r={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e,e=this.cwd);let{withFileTypes:n}=r;if(e.canReaddir()){let i=await e.readdir();return n?i:i.map(s=>s.name)}else return[]}readdirSync(e=this.cwd,r={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e,e=this.cwd);let{withFileTypes:n=!0}=r;return e.canReaddir()?n?e.readdirSync():e.readdirSync().map(i=>i.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e.withFileTypes,e=this.cwd);let n=await e.readlink();return r?n:n?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e.withFileTypes,e=this.cwd);let n=e.readlinkSync();return r?n:n?.fullpath()}async realpath(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e.withFileTypes,e=this.cwd);let n=await e.realpath();return r?n:n?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e.withFileTypes,e=this.cwd);let n=e.realpathSync();return r?n:n?.fullpath()}async walk(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=[];(!s||s(e))&&a.push(n?e:e.fullpath());let c=new Set,l=(d,f)=>{c.add(d),d.readdirCB((p,m)=>{if(p)return f(p);let h=m.length;if(!h)return f();let y=()=>{--h===0&&f()};for(let S of m)(!s||s(S))&&a.push(n?S:S.fullpath()),i&&S.isSymbolicLink()?S.realpath().then(v=>v?.isUnknown()?v.lstat():v).then(v=>v?.shouldWalk(c,o)?l(v,y):y()):S.shouldWalk(c,o)?l(S,y):y()},!0)},u=e;return new Promise((d,f)=>{l(u,p=>{if(p)return f(p);d(a)})})}walkSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=[];(!s||s(e))&&a.push(n?e:e.fullpath());let c=new Set([e]);for(let l of c){let u=l.readdirSync();for(let d of u){(!s||s(d))&&a.push(n?d:d.fullpath());let f=d;if(d.isSymbolicLink()){if(!(i&&(f=d.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(c,o)&&c.add(f)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,r={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e,e=this.cwd),this.stream(e,r)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r;(!s||s(e))&&(yield n?e:e.fullpath());let a=new Set([e]);for(let c of a){let l=c.readdirSync();for(let u of l){(!s||s(u))&&(yield n?u:u.fullpath());let d=u;if(u.isSymbolicLink()){if(!(i&&(d=u.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(a,o)&&a.add(d)}}}stream(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=new As({objectMode:!0});(!s||s(e))&&a.write(n?e:e.fullpath());let c=new Set,l=[e],u=0,d=()=>{let f=!1;for(;!f;){let p=l.shift();if(!p){u===0&&a.end();return}u++,c.add(p);let m=(y,S,v=!1)=>{if(y)return a.emit("error",y);if(i&&!v){let b=[];for(let P of S)P.isSymbolicLink()&&b.push(P.realpath().then(N=>N?.isUnknown()?N.lstat():N));if(b.length){Promise.all(b).then(()=>m(null,S,!0));return}}for(let b of S)b&&(!s||s(b))&&(a.write(n?b:b.fullpath())||(f=!0));u--;for(let b of S){let P=b.realpathCached()||b;P.shouldWalk(c,o)&&l.push(P)}f&&!a.flowing?a.once("drain",d):h||d()},h=!0;p.readdirCB(m,!0),h=!1}};return d(),a}streamSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Cr||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=new As({objectMode:!0}),c=new Set;(!s||s(e))&&a.write(n?e:e.fullpath());let l=[e],u=0,d=()=>{let f=!1;for(;!f;){let p=l.shift();if(!p){u===0&&a.end();return}u++,c.add(p);let m=p.readdirSync();for(let h of m)(!s||s(h))&&(a.write(n?h:h.fullpath())||(f=!0));u--;for(let h of m){let y=h;if(h.isSymbolicLink()){if(!(i&&(y=h.realpathSync())))continue;y.isUnknown()&&y.lstatSync()}y.shouldWalk(c,o)&&l.push(y)}}f&&!a.flowing&&a.once("drain",d)};return d(),a}chdir(e=this.cwd){let r=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[gM](r)}},Va=class extends xh{sep="\\";constructor(e=process.cwd(),r={}){let{nocase:n=!0}=r;super(e,Ha.win32,"\\",{...r,nocase:n}),this.nocase=n;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return Ha.win32.parse(e).root.toUpperCase()}newRoot(e){return new Ih(this.rootPath,Oi,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Wa=class extends xh{sep="/";constructor(e=process.cwd(),r={}){let{nocase:n=!1}=r;super(e,Ha.posix,"/",{...r,nocase:n}),this.nocase=n}parseRootPath(e){return"/"}newRoot(e){return new Oh(this.rootPath,Oi,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Fl=class extends Wa{constructor(e=process.cwd(),r={}){let{nocase:n=!0}=r;super(e,{...r,nocase:n})}},WEe=process.platform==="win32"?Ih:Oh,yM=process.platform==="win32"?Va:process.platform==="darwin"?Fl:Wa;var jW=t=>t.length>=1,UW=t=>t.length>=1,za=class t{#e;#r;#n;length;#t;#s;#m;#u;#f;#a;#p=!0;constructor(e,r,n,i){if(!jW(e))throw new TypeError("empty pattern list");if(!UW(r))throw new TypeError("empty glob list");if(r.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,n<0||n>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#r=r,this.#n=n,this.#t=i,this.#n===0){if(this.isUNC()){let[s,o,a,c,...l]=this.#e,[u,d,f,p,...m]=this.#r;l[0]===""&&(l.shift(),m.shift());let h=[s,o,a,c,""].join("/"),y=[u,d,f,p,""].join("/");this.#e=[h,...l],this.#r=[y,...m],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...o]=this.#e,[a,...c]=this.#r;o[0]===""&&(o.shift(),c.shift());let l=s+"/",u=a+"/";this.#e=[l,...o],this.#r=[u,...c],this.length=this.#e.length}}}pattern(){return this.#e[this.#n]}isString(){return typeof this.#e[this.#n]=="string"}isGlobstar(){return this.#e[this.#n]===jt}isRegExp(){return this.#e[this.#n]instanceof RegExp}globString(){return this.#m=this.#m||(this.#n===0?this.isAbsolute()?this.#r[0]+this.#r.slice(1).join("/"):this.#r.join("/"):this.#r.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#s!==void 0?this.#s:this.hasMore()?(this.#s=new t(this.#e,this.#r,this.#n+1,this.#t),this.#s.#a=this.#a,this.#s.#f=this.#f,this.#s.#u=this.#u,this.#s):this.#s=null}isUNC(){let e=this.#e;return this.#f!==void 0?this.#f:this.#f=this.#t==="win32"&&this.#n===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#u!==void 0?this.#u:this.#u=this.#t==="win32"&&this.#n===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#a!==void 0?this.#a:this.#a=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#n===0?e:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#p)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#p?!1:(this.#p=!1,!0)}};var HW=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ga=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:r,nocase:n,noext:i,noglobstar:s,platform:o=HW}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:r,nocase:n,noext:i,noglobstar:s,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of e)this.add(a)}add(e){let r=new _n(e,this.mmopts);for(let n=0;n<r.set.length;n++){let i=r.set[n],s=r.globParts[n];if(!i||!s)throw new Error("invalid pattern object");for(;i[0]==="."&&s[0]===".";)i.shift(),s.shift();let o=new za(i,s,0,this.platform),a=new _n(o.globString(),this.mmopts),c=s[s.length-1]==="**",l=o.isAbsolute();l?this.absolute.push(a):this.relative.push(a),c&&(l?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(e){let r=e.fullpath(),n=`${r}/`,i=e.relative()||".",s=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(s))return!0;for(let o of this.absolute)if(o.match(r)||o.match(n))return!0;return!1}childrenIgnored(e){let r=e.fullpath()+"/",n=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(n))return!0;for(let i of this.absoluteChildren)if(i.match(r))return!0;return!1}};var Bv=class t{store;constructor(e=new Map){this.store=e}copy(){return new t(new Map(this.store))}hasWalked(e,r){return this.store.get(e.fullpath())?.has(r.globString())}storeWalked(e,r){let n=e.fullpath(),i=this.store.get(n);i?i.add(r.globString()):this.store.set(n,new Set([r.globString()]))}},jv=class{store=new Map;add(e,r,n){let i=(r?2:0)|(n?1:0),s=this.store.get(e);this.store.set(e,s===void 0?i:i&s)}entries(){return[...this.store.entries()].map(([e,r])=>[e,!!(r&2),!!(r&1)])}},Uv=class{store=new Map;add(e,r){if(!e.canReaddir())return;let n=this.store.get(e);n?n.find(i=>i.globString()===r.globString())||n.push(r):this.store.set(e,[r])}get(e){let r=this.store.get(e);if(!r)throw new Error("attempting to walk unknown path");return r}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},Bl=class t{hasWalkedCache;matches=new jv;subwalks=new Uv;patterns;follow;dot;opts;constructor(e,r){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=r?r.copy():new Bv}processPatterns(e,r){this.patterns=r;let n=r.map(i=>[e,i]);for(let[i,s]of n){this.hasWalkedCache.storeWalked(i,s);let o=s.root(),a=s.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let d=s.rest();if(d)s=d;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let c,l,u=!1;for(;typeof(c=s.pattern())=="string"&&(l=s.rest());)i=i.resolve(c),s=l,u=!0;if(c=s.pattern(),l=s.rest(),u){if(this.hasWalkedCache.hasWalked(i,s))continue;this.hasWalkedCache.storeWalked(i,s)}if(typeof c=="string"){let d=c===".."||c===""||c===".";this.matches.add(i.resolve(c),a,d);continue}else if(c===jt){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let d=l?.pattern(),f=l?.rest();if(!l||(d===""||d===".")&&!f)this.matches.add(i,a,d===""||d===".");else if(d===".."){let p=i.parent||i;f?this.hasWalkedCache.hasWalked(p,f)||this.subwalks.add(p,f):this.matches.add(p,a,!0)}}else c instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new t(this.opts,this.hasWalkedCache)}filterEntries(e,r){let n=this.subwalks.get(e),i=this.child();for(let s of r)for(let o of n){let a=o.isAbsolute(),c=o.pattern(),l=o.rest();c===jt?i.testGlobstar(s,o,l,a):c instanceof RegExp?i.testRegExp(s,c,l,a):i.testString(s,c,l,a)}return i}testGlobstar(e,r,n,i){if((this.dot||!e.name.startsWith("."))&&(r.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,r):e.isSymbolicLink()&&(n&&r.checkFollowGlobstar()?this.subwalks.add(e,n):r.markFollowGlobstar()&&this.subwalks.add(e,r)))),n){let s=n.pattern();if(typeof s=="string"&&s!==".."&&s!==""&&s!==".")this.testString(e,s,n.rest(),i);else if(s===".."){let o=e.parent||e;this.subwalks.add(o,n)}else s instanceof RegExp&&this.testRegExp(e,s,n.rest(),i)}}testRegExp(e,r,n,i){r.test(e.name)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}testString(e,r,n,i){e.isNamed(r)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}};var VW=(t,e)=>typeof t=="string"?new Ga([t],e):Array.isArray(t)?new Ga(t,e):t,Mh=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#r;#n;signal;maxDepth;includeChildMatches;constructor(e,r,n){if(this.patterns=e,this.path=r,this.opts=n,this.#n=!n.posix&&n.platform==="win32"?"\\":"/",this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#r=VW(n.ignore??[],n),!this.includeChildMatches&&typeof this.#r.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#r?.ignored?.(e)}#s(e){return!!this.#r?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||await e.realpath(),!n)return;e=n}let s=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let o=await s.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(s,r)}matchCheckTest(e,r){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!r||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#t(e)?e:void 0}matchCheckSync(e,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||e.realpathSync(),!n)return;e=n}let s=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let o=s.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(s,r)}matchFinish(e,r){if(this.#t(e))return;if(!this.includeChildMatches&&this.#r?.add){let s=`${e.relativePosix()}/**`;this.#r.add(s)}let n=this.opts.absolute===void 0?r:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let s=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(s+i)}else{let s=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!s.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(s?o+s+i:"."+i)}}async match(e,r,n){let i=await this.matchCheck(e,n);i&&this.matchFinish(i,r)}matchSync(e,r,n){let i=this.matchCheckSync(e,n);i&&this.matchFinish(i,r)}walkCB(e,r,n){this.signal?.aborted&&n(),this.walkCB2(e,r,new Bl(this.opts),n)}walkCB2(e,r,n,i){if(this.#s(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,r,n,i));return}n.processPatterns(e,r);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of n.matches.entries())this.#t(a)||(s++,this.match(a,c,l).then(()=>o()));for(let a of n.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;s++;let c=a.readdirCached();a.calledReaddir()?this.walkCB3(a,c,n,o):a.readdirCB((l,u)=>this.walkCB3(a,u,n,o),!0)}o()}walkCB3(e,r,n,i){n=n.filterEntries(e,r);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of n.matches.entries())this.#t(a)||(s++,this.match(a,c,l).then(()=>o()));for(let[a,c]of n.subwalks.entries())s++,this.walkCB2(a,c,n.child(),o);o()}walkCBSync(e,r,n){this.signal?.aborted&&n(),this.walkCB2Sync(e,r,new Bl(this.opts),n)}walkCB2Sync(e,r,n,i){if(this.#s(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,r,n,i));return}n.processPatterns(e,r);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of n.matches.entries())this.#t(a)||this.matchSync(a,c,l);for(let a of n.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;s++;let c=a.readdirSync();this.walkCB3Sync(a,c,n,o)}o()}walkCB3Sync(e,r,n,i){n=n.filterEntries(e,r);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of n.matches.entries())this.#t(a)||this.matchSync(a,c,l);for(let[a,c]of n.subwalks.entries())s++,this.walkCB2Sync(a,c,n.child(),o);o()}},jl=class extends Mh{matches=new Set;constructor(e,r,n){super(e,r,n)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,r)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?r(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},Ul=class extends Mh{results;constructor(e,r,n){super(e,r,n),this.results=new As({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var WW=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",di=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,r){if(!r)throw new TypeError("glob options required");if(this.withFileTypes=!!r.withFileTypes,this.signal=r.signal,this.follow=!!r.follow,this.dot=!!r.dot,this.dotRelative=!!r.dotRelative,this.nodir=!!r.nodir,this.mark=!!r.mark,r.cwd?(r.cwd instanceof URL||r.cwd.startsWith("file://"))&&(r.cwd=(0,TM.fileURLToPath)(r.cwd)):this.cwd="",this.cwd=r.cwd||"",this.root=r.root,this.magicalBraces=!!r.magicalBraces,this.nobrace=!!r.nobrace,this.noext=!!r.noext,this.realpath=!!r.realpath,this.absolute=r.absolute,this.includeChildMatches=r.includeChildMatches!==!1,this.noglobstar=!!r.noglobstar,this.matchBase=!!r.matchBase,this.maxDepth=typeof r.maxDepth=="number"?r.maxDepth:1/0,this.stat=!!r.stat,this.ignore=r.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(c=>c.replace(/\\/g,"/"))),this.matchBase){if(r.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(c=>c.includes("/")?c:`./**/${c}`)}if(this.pattern=e,this.platform=r.platform||WW,this.opts={...r,platform:this.platform},r.scurry){if(this.scurry=r.scurry,r.nocase!==void 0&&r.nocase!==r.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let c=r.platform==="win32"?Va:r.platform==="darwin"?Fl:r.platform?Wa:yM;this.scurry=new c(this.cwd,{nocase:r.nocase,fs:r.fs})}this.nocase=this.scurry.nocase;let n=this.platform==="darwin"||this.platform==="win32",i={...r,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},s=this.pattern.map(c=>new _n(c,i)),[o,a]=s.reduce((c,l)=>(c[0].push(...l.set),c[1].push(...l.globParts),c),[[],[]]);this.patterns=o.map((c,l)=>{let u=a[l];if(!u)throw new Error("invalid pattern object");return new za(c,u,0,this.platform)})}async walk(){return[...await new jl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new jl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new Ul(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new Ul(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var Hv=(t,e={})=>{Array.isArray(t)||(t=[t]);for(let r of t)if(new _n(r,e).hasMagic())return!0;return!1};function Lh(t,e={}){return new di(t,e).streamSync()}function bM(t,e={}){return new di(t,e).stream()}function SM(t,e={}){return new di(t,e).walkSync()}async function vM(t,e={}){return new di(t,e).walk()}function qh(t,e={}){return new di(t,e).iterateSync()}function _M(t,e={}){return new di(t,e).iterate()}var zW=Lh,GW=Object.assign(bM,{sync:Lh}),YW=qh,KW=Object.assign(_M,{sync:qh}),XW=Object.assign(SM,{stream:Lh,iterate:qh}),Po=Object.assign(vM,{glob:vM,globSync:SM,sync:XW,globStream:bM,stream:GW,globStreamSync:Lh,streamSync:zW,globIterate:_M,iterate:KW,globIterateSync:qh,iterateSync:YW,Glob:di,hasMagic:Hv,escape:Ba,unescape:ci});Po.glob=Po;var OP=q(kS()),SB=q(TB());var AP={};Sj(AP,{$id:()=>hQ,$schema:()=>pQ,default:()=>vQ,definitions:()=>gQ,properties:()=>TQ,title:()=>mQ,type:()=>yQ});var pQ="http://json-schema.org/draft-07/schema#",hQ="http://json-schema.org/draft-07/schema#",mQ="Core schema meta-schema",gQ={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},yQ=["object","boolean"],TQ={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},vQ={$schema:pQ,$id:hQ,title:mQ,definitions:gQ,type:yQ,properties:TQ,default:!0};var kn=q(U());var yg=class extends Qc{constructor(r,n){super();this.ajv=r;this.schemaKey=n;this.validate=this.ajv.getSchema(this.schemaKey)}getIssue(r,n){let i=[];if(n.disabled){let o=n.getProperty("status");return n.implementations.forEach(a=>i.push(x(21,a.firstToken,a.lastToken,a,{severity:kn.DiagnosticSeverity.Hint,linkedTo:[...o?.ast?[o?.ast]:[]],tags:[kn.DiagnosticTag.Unnecessary]}))),i}let s=J.toJson(n);try{this.validate?(this.validate(s),this.validate.errors&&(this.validate.errors.forEach(o=>i.push(...bQ(r,o,n,this.schemaKey))),console.log(this.schemaKey,`${n.pathString}`,this.validate.errors,s))):console.log("no validate")}catch(o){console.log(this.schemaKey,`${n.pathString}`,this.schemaKey,o)}return i}getOnPropertyHover(r){let n=(this.validate?.schema).properties?.[r];if(n&&typeof n=="object"&&"description"in n)return{kind:kn.MarkupKind.Markdown,value:[...n.description?["### Description",Array.isArray(n.description)?n.description.join(`
334
334
 
335
335
  `):n.description]:[]].join(`
336
336
  `)}}getSignatureHelp(){}getPropertyListCompletionItems(r){let n=Object.keys((this.validate?.schema).properties),i=(this.validate?.schema).required;return n.map(s=>{let o=r&&i.some(l=>l===s),a=!!r.properties.some(l=>s===l.name),c="a";return o?c=a?"Y":"!":c=a?"Z":"B",{label:`${s}`,kind:kn.CompletionItemKind.Property,sortText:`${c}${s}`}})??[]}},bQ=(t,e,r,n)=>{if(r.hasOmitIfNoRef()&&!r.isReferenced())return[];let i=SQ(r,e.instancePath),s=i.node;if(e.keyword==="additionalProperties"){let a=s.getProperty(e.params.additionalProperty);return a?[x(25,a.ast.firstToken,a.ast.lastToken,a.ast,{templateStrings:[`Node "${s.name}" ${e.message}: ${a.name}`],edit:kn.TextEdit.del(sr(a.ast.firstToken.prevToken,a.ast.lastToken,!1)),codeActionTitle:"Remove property"})]:[]}else if(e.keyword==="type"){let a=s.getProperty(e.instancePath.split("/")[1]);return a?[x(25,a.ast.firstToken,a.ast.lastToken,a.ast,{templateStrings:[`"${a.name}" ${e.message??"NO MESSAGE"}`]})]:(console.warn("unable to find property in node",e),[])}else if(e.keyword==="required"){let a=e.params.missingProperty,c=t.getOrderedNodeAst(s),l=Yf(c);return c.map((u,d)=>{let f=l[d],p=u.openScope??f.lastToken;return x(0,f.firstToken,f.lastToken,f,{templateStrings:[a],edit:kn.TextEdit.insert(kn.Position.create(p.pos.line,p.pos.col+1),`
@@ -341,10 +341,10 @@ ${n}`]})]:[]}else if(e.keyword==="maxItems"||e.keyword==="minItems"){let a=s.get
341
341
  ${JSON.stringify(e)}
342
342
  ${n}`]})];let o=i.node.implementations[0]instanceof nt?i.node.implementations[0]:i.node.implementations[0].identifierAst??i.node.implementations[0];return[x(25,o.firstToken,o.lastToken,o,{templateStrings:[`${e.message??"NO MESSAGE"}:
343
343
  ${JSON.stringify(e)}
344
- ${n}`]})]},SQ=(t,e)=>vB(t,e.split("/").filter(r=>r)),vB=(t,e)=>{if(e.length===0)return{node:t,remainingInstancePath:""};let r=e[0].split("@"),n=r[0],i=r.at(1)?.split(",").map(o=>Number.parseInt(o,16)),s=t.getNode(n,i);return s?vB(s,e.slice(1)):{node:t,property:t.getProperty(e[0]),remainingInstancePath:e.slice(1).join("/")}};var xP=class t{constructor(){this.schemaIdValidators=new Map;this.ajvMap=new Map}static getNodeCompatible(e){let n=e.getProperty("compatible")?.ast.values;if(!n?.values.some(i=>!(i?.value instanceof ne)))return n?.values.map(i=>(i?.value).value)}parseMetaSchema(e,r){Po.sync("**/*.yaml",{cwd:e}).forEach(i=>{i=(0,bc.resolve)(e,i);try{let s=OP.default.parse((0,IP.readFileSync)(i,"utf-8"));r.addMetaSchema(s),this.schemaIdValidators.set(s.$id,i)}catch{}})}parseBindings(e,r){Po.sync("**/*.yaml",{cwd:e}).forEach(i=>{i=(0,bc.resolve)(e,i);try{let s=OP.default.parse((0,IP.readFileSync)(i,"utf-8"));r.addSchema(s),this.schemaIdValidators.set(s.$id,i)}catch(s){console.warn(i,s.message)}})}getNodeTypes(e,r,n){let i=`${e.join(";")}::${r.join(";")}`,s=this.ajvMap.get(i);return s||(s=new SB.default({strict:!1,strictSchema:!1,strictNumbers:!1}),s.addMetaSchema(AP),this.ajvMap.set(i,s),e.forEach(c=>this.parseMetaSchema(c,s)),r.forEach(c=>this.parseBindings(c,s))),t.getNodeCompatible(n)?.map(c=>{try{let l=Array.from(this.schemaIdValidators.keys()).find(f=>(0,bc.basename)(f)===`${c}.yaml#`);if(!l)return;let u=new yg(s,l);u.bindingsPath=this.schemaIdValidators.get(l),u.compatible=c;let d=s.getSchema(l);return u.description=(d?.schema).description,u.examples=(d?.schema).examples,u.maintainers=(d?.schema).maintainers,u}catch(l){console.warn(l.message)}}).filter(c=>c)??[]}getBindings(){return Array.from(this.schemaIdValidators.keys())}getBindingDocumentation(e,r,n){let i=`${e.join(";")}::${r.join(";")}`,s=this.ajvMap.get(i);if(!s)return;let o=Array.from(this.schemaIdValidators.keys()).find(d=>(0,bc.basename)(d)===`${n}.yaml#`);if(!o)return;let a=s.getSchema(o);if(!a)return;let c=a.schema.description,l=a.schema.examples,u=a.schema.maintainers;return{kind:Ri.Markdown,value:[...u?["### Maintainers",...u??[]]:[],...c?["### Description",_s(c)]:[],...l?["### Examples","```devicetree",...l??[],"```"]:[]].join(`
345
- `)}}},bB,Tg=()=>(bB??=new xP,bB);var Js=q(require("path")),Ju=require("fs"),wB=q(require("path")),DB=q(kS());var pn=q(U());var _B=()=>{let t=new W("nonposted-mmio",V("EMPTY"),"optional");return t.description=["Specifies that direct children of this bus should use non-posted memory accesses (i.e. a non-posted mapping mode) for MMIO ranges."],t};function PB(){let t=tn();t.noMismatchPropertiesAllowed=!0,t.compatible="simple-bus";let e=t.properties.find(n=>n.name==="compatible");e.required=()=>"required";let r=t.properties.find(n=>n.name==="ranges");return r.required=()=>"required",t.addProperty(_B()),t}var kB=(t,e)=>{switch(t){case"string":return typeof e=="string"?e:void 0;case"int":return typeof e=="number"?e:void 0;case"boolean":return;case"array":return Array.isArray(e)&&e.every(r=>typeof r=="number")?e:void 0;case"uint8-array":return Array.isArray(e)&&e.every(r=>typeof r=="number")?e:void 0;case"string-array":return Array.isArray(e)&&e.every(r=>typeof r=="string")?e:void 0;case"phandle":return;case"phandles":return;case"phandle-array":return;case"path":return;case"compound":return}},vg=(t,e)=>{if(Object.entries(e.properties??{}).forEach(([r,n])=>{n.name=r}),e.extends??=[],e=e.include.reduce((r,n)=>{let i=t.find(s=>(0,Js.basename)(s.filePath)===n.name);if(i){let s=n["property-blocklist"],o=n["property-allowlist"];e.extends?.push(...r.include.map(c=>(0,Js.basename)(c.name,".yaml")));let a=n["child-binding"];return r.include=r.include.filter(c=>c!==n),CB(t,i,r,s,o,a)??r}return console.warn(`Unable to find ${n.name}`),r},e),e["child-binding"]){let r=AB(e["child-binding"].include);e["child-binding"].include=r,e["child-binding"].rawInclude=[...r],e["child-binding"]=vg(t,e["child-binding"]),e["child-binding"]&&(e["child-binding"].isChildBinding=!0,e["child-binding"].filePath=e.filePath)}if(!e.include.length)return e},NB=t=>Array.isArray(t)?t:t?[t]:[],CB=(t,e,r,n=[],i,s)=>{let o=vg(t,e),a=vg(t,r);if(!o||!a)return;let c=new Set;Object.keys(o?.properties??{}).forEach(p=>c.add(p)),Object.keys(a?.properties??{}).forEach(p=>c.add(p));let l={};Array.from(c).forEach(p=>{let m=n?.some(y=>y===p)||i&&!i.some(y=>y===p)?void 0:o.properties?.[p]??void 0,h=a.properties?.[p]??void 0;(m||h)&&(l={...l,[p]:{...m??{},...h}})}),a.properties=l,a.extends??=[],a.extends.push(...o.extends??[]);let u=new Set;return Object.keys(o).filter(p=>p.endsWith("-cells")).forEach(p=>u.add(p)),Object.keys(o).filter(p=>p.endsWith("-cells")).forEach(p=>u.add(p)),Array.from(u).forEach(p=>{let m=o[p]??[],h=a[p]??[];a[p]=Array.from([...m,...h])}),(o.class||a.class)&&(a.class=[...new Set([...NB(a.class),...NB(o.class)])]),a.bus?a.bus.push(...o.bus??[]):a.bus=o.bus,o["child-binding"]&&(a["child-binding"]??={filePath:a.filePath,include:[],rawInclude:[],isChildBinding:!0},CB(t,o["child-binding"],a["child-binding"]??{filePath:a.filePath,include:[],rawInclude:[],isChildBinding:!0},s?.["property-blocklist"],s?.["property-allowlist"],s?.["child-binding"])),a},AB=t=>t?typeof t=="string"?[{name:t}]:t.map(e=>typeof e!="string"?e:{name:e}):[],MP=class t{constructor(){this.typeCache=new Map;this.contextBindings=new Map;this.processedFolders=new Set;this.zephyrBindingCache=new Map;this.vendorPrefixMap=new Map}static getCompatibleKeys(e,r){return!r||!r.nodeType?.bus?.length?[e]:[...r.nodeType.bus.map(n=>`${e}::${n}`),e]}getBaseZephyrType(e){let r=e.split(":");return Array.from(this.zephyrBindingCache.keys()).filter(i=>r.some(s=>i.startsWith(s))).flatMap(i=>this.zephyrBindingCache.get(i)).find(i=>i.filePath.endsWith(`${Js.default.sep}base.yaml`))}getBaseNodeType(e,r){let n=this.getBaseZephyrType(r),i=n?bg(n,e):void 0;if(i){i.warnMismatchProperties=!1;let s=i.properties.find(o=>o.name==="compatible");s&&(s.required=()=>"optional")}return i}static getNodeCompatible(e){let i=e.getProperty("compatible")?.ast.values?.values.filter(s=>s&&s.value instanceof ne);if(i?.length)return i.map(s=>s?.value?{name:s.value.value,ast:s.value}:void 0)}getNodeTypes(e,r){let n=t.getNodeCompatible(e)?.filter(a=>!!a),i=n?.flatMap(a=>t.getCompatibleKeys(a.name,e.parent).map(c=>this.typeCache.get(r)?.get(c)?.(e)).filter(c=>!!c))??[];if(!i.length){let a;if(e.pathString==="/zephyr,user"){let c={},l={properties:c,filePath:"",include:[],rawInclude:[],isChildBinding:!1},u=(d,f)=>{c[d]={name:d,type:f}};e.properties.forEach(d=>{if(d.name.endsWith("-gpios")){u(d.name,"phandle-array");return}let f=d.ast.values?.values.map(m=>m?.value),p=f?.filter(m=>!!m);if(f===void 0||p===void 0)u(d.name,"boolean");else if(p.every(m=>m instanceof ne))u(d.name,f.length>1?"string-array":"string");else if(p.every(m=>m instanceof Lr))u(d.name,"uint8-array");else if(p.every(m=>m instanceof ut)){let m=p.flatMap(h=>h.values);m.every(h=>h.value instanceof ge)?u(d.name,m.length>1?"array":"int"):m.every(h=>h.value instanceof ie||h.value instanceof it)?u(d.name,m.length>1?"phandles":"phandle"):u(d.name,"phandle-array")}else u(d.name,"compound")}),a=bg(l,e)}if(a){a.warnMismatchProperties=!1;let c=a.properties.find(l=>l.name==="compatible");c&&(c.required=()=>"optional")}return{type:[a??To(e)],issues:[]}}let s=this.getBusTypes(),o=n?.flatMap(a=>{let c=t.getCompatibleKeys(a.name,e.parent).some(l=>this.typeCache.get(r)?.has(l));if(!c){let l=s.filter(u=>this.typeCache.get(r)?.has(`${a.name}::${u}`));if(l.length)return x(37,a.ast.firstToken,a.ast.lastToken,a.ast,{templateStrings:l})}return c?[]:[x(32,a.ast.firstToken,a.ast.lastToken,a.ast,{severity:pn.DiagnosticSeverity.Hint,tags:[pn.DiagnosticTag.Unnecessary],templateStrings:[a.name]})]})??[];return{type:i.length?i:[To(e)],issues:o}}processVendorPrefix(e){let r=Js.default.join(e,"vendor-prefixes.txt");if(!(0,Ju.existsSync)(r))return;let n=(0,Ju.readFileSync)(r,"utf-8"),i=/^(?!#)(\S+)\s+(.+)$/gm;Array.from(n.matchAll(i),s=>[s[1].trim(),s[2].trim()]).forEach(([s,o])=>{this.vendorPrefixMap.set(s,o)})}loadTypeAndCache(e,r){e=Array.isArray(e)?e:[e];let n=e.filter(a=>this.processedFolders.has(a)).flatMap(a=>Array.from(this.zephyrBindingCache.entries()).flatMap(([c,l])=>c.startsWith(a)?[l]:[]));n.push(...e.filter(a=>!this.processedFolders.has(a)).flatMap(a=>(this.processVendorPrefix(a),this.processedFolders.add(a),Po.sync("**/*.yaml",{cwd:a,ignore:"test/*"}).map(l=>{if(l=(0,Js.resolve)(a,l),this.zephyrBindingCache.has(l))return this.zephyrBindingCache.get(l);try{let u=DB.default.parse((0,Ju.readFileSync)(l,"utf-8")),d=AB(u?.include),f={...u,bus:u.bus?Array.isArray(u.bus)?u.bus:[u.bus]:void 0,include:d,rawInclude:[...d],filePath:l};return this.zephyrBindingCache.set(l,f),f}catch(u){console.warn(u)}}).filter(l=>!!l))));let i=n.map(a=>vg(n,a)).filter(a=>!!a&&!a.include.length),s=this.typeCache.get(r);s||(s=new Map,this.typeCache.set(r,s));let o=this.contextBindings.get(r);if(o||(o=new Map,this.contextBindings.set(r,o)),i.forEach(a=>{o.set(a.compatible??"",a)}),_Q(i,s,this.vendorPrefixMap),!s.has("simple-bus")){let a=this.getBaseZephyrType(r);if(a){let c=PQ(a);s.set("simple-bus",()=>c)}}}getBindings(e){return Array.from(this.typeCache.get(e)?.keys()??[]).map(r=>r.split("::",1)[0])}getBindingVendorString(e){let r=e.split(",",1)[0];return this.vendorPrefixMap.get(r)}getBindingDocumentation(e,r){let n=this.contextBindings.get(e)?.get(r);if(!n)return;let i=this.getBindingVendorString(n.compatible??"");return{kind:pn.MarkupKind.Markdown,value:[...i?["### Vendor",...i?[i]:[]]:[],...n.title?["### Title",_s(n.title)]:[],...n.description?["### Description",_s(n.description)]:[]].join(`
346
- `)}}getZephyrContextBinding(e){return Array.from(this.contextBindings.get(e)?.values()??[])}getBusTypes(){let e=Array.from(this.zephyrBindingCache.values()).flatMap(r=>r.bus?.filter(n=>!!n)??[]).filter(r=>!!r);return Array.from(new Set(e))}getDocumentLinks(e,r){let n=this.zephyrBindingCache.get(Ne(e.uri));if(!n)return[];let i=e.getText();return IB(n).map(a=>{let l=new RegExp(a.name).exec(i);if(l){let u=e.positionAt(l.index),d=e.positionAt(l.index+l[0].length),f=Array.from(this.zephyrBindingCache.keys()).find(p=>p.endsWith(`${wB.default.sep}${a.name}`)&&r.some(m=>p.startsWith(m)));return f?{range:pn.Range.create(u,d),target:ue(f)}:void 0}}).filter(a=>!!a)}resetCache(e){this.typeCache.delete(e)}};function IB(t){return[...t.rawInclude,...t["child-binding"]?IB(t["child-binding"]):[]].flat()}var RB,Bi=()=>(RB??=new MP,RB),_Q=(t,e,r)=>t.forEach(n=>{n.compatible&&e.set(n["on-bus"]?`${n.compatible}::${n["on-bus"]}`:n.compatible,i=>bg(n,i,r))}),bg=(t,e,r)=>{let n=To(e);n.compatible=t.compatible,n.title=t.title,n.description=t.description,n.bindingsPath=t.filePath,n.zephyrBinding=t,n.bus=typeof t.bus=="string"?[t.bus]:Array.from(new Set(t.bus)),n.onBus=t["on-bus"],n.class=typeof t.class=="string"?[t.class]:Array.isArray(t.class)?t.class:void 0,t.extends?.forEach(o=>n.extends.add(o)),n.warnMismatchProperties=!0,r&&t.compatible?.includes(",")&&(n.vendor=r?.get(t.compatible.split(",",1)[0]));let s=Object.keys(t).filter(o=>o.endsWith("-cells")).map(o=>({specifier:o.replace(/-cells$/,""),values:t[o]}));if(n.cellsValues=s,Object.entries(t.properties??{}).forEach(([o,a])=>{OB(n,o,a)}),t["child-binding"]){let o=t["child-binding"];n.childNodeType=a=>{let c=bg(o,a);return c.hasParentBinding=!0,c}}return n},PQ=t=>{let e=PB();e.bus=typeof t.bus=="string"?[t.bus]:Array.from(new Set(t.bus)),e.onBus=t["on-bus"],t.extends?.forEach(i=>e.extends.add(i)),e.warnMismatchProperties=!0;let n=Object.keys(t).filter(i=>i.endsWith("-cells")).map(i=>({specifier:i.replace(/-cells$/,""),values:t[i]}));return e.cellsValues=n,Object.entries(t.properties??{}).forEach(([i,s])=>{OB(e,i,s)}),e},OB=(t,e,r)=>{let n=t.properties.find(i=>i.getNameMatch(e));if(n&&typeof n.name=="string"){n.name!=="reg"?n.required=()=>r.required?"required":"optional":r.required&&(n.required=()=>"required"),n.values=()=>r.enum??[],n.constValue=kB(r.type,r.const),n.bindingType=r.type;let i=n.additionalTypeCheck;n.additionalTypeCheck=(s,o)=>[...EB(r,e,n)(s,o),...i?.(s,o)??[]]}else{let i=r.type==="compound"?n?.type:Zc(r.type);i??=Zc(r.type);let s=new W(e,i,r.required?"required":"optional",void 0,r.enum);s.additionalTypeCheck=(o,a)=>{let c=[...n?.additionalTypeCheck?.(o,a)??[],...EB(r,e,s)(o,a)];return s.signatureArgs??=n?.signatureArgs,s.signatureArgsCyclic??=!!n?.signatureArgsCyclic,c},s.description=r.description?[r.description]:n?.description,s.bindingType=r.type,s.constValue=kB(r.type,r.const),t.addProperty(s)}},EB=(t,e,r)=>{let n=t;return(i,s)=>{let o=i.parent.root,a=[];if(n.const){let d=i.ast.getFlatAstValues();if(d?.length==1&&d.every(f=>f instanceof ge)){let f=d.map(h=>h.evaluate(s)),p=Array.isArray(n.const)?n.const:[n.const];if(!(p.length===f.length&&f.every((h,y)=>typeof h=="number"&&Number.isNaN(h)||p[y]===h))){let h=i.ast.values??i.ast;a.push(x(24,h.firstToken,h.lastToken,h,{templateStrings:[`Binding expects property "${i.name}" be of type "${n.type}" with value: ${n.const}`]}))}}}n.deprecated&&a.push(x(14,i.ast.firstToken,i.ast.lastToken,i.ast,{severity:pn.DiagnosticSeverity.Warning,tags:[pn.DiagnosticTag.Deprecated],templateStrings:[i.name]})),(n.type==="int"||n.type==="array"&&(n.min!==void 0||n.max!==void 0))&&i.ast.getFlatAstValues()?.forEach(f=>{if(!(f instanceof ge))return;let p=f.evaluate(s);typeof p=="number"&&(n.min!==void 0&&p<n.min&&a.push(x(41,f.firstToken,f.lastToken,f,{templateStrings:[n.min.toString()]})),n.max!==void 0&&p>n.max&&a.push(x(42,f.firstToken,f.lastToken,f,{templateStrings:[n.max.toString()]})))});let c=n["min-len"],l=n["max-len"];if((c!==void 0||l!==void 0)&&(n.type==="array"||n.type==="string-array"||n.type==="uint8-array"||n.type==="phandles")){let d=i.ast.getFlatAstValues();d&&c!==void 0&&d.length<c&&a.push(x(43,i.ast.propertyName.firstToken,i.ast.propertyName.lastToken,i.ast,{templateStrings:[i.name,c.toString()]})),d&&l!==void 0&&d.length>l&&d.slice(l).forEach(f=>{f&&a.push(x(44,f.firstToken,f.lastToken,i.ast,{templateStrings:[i.name,l.toString()]}))})}if((n.type==="phandle"||n.type==="phandles"||n.type==="path")&&He(i.ast.values)?.forEach(f=>{An(f,o)||a.push(x(22,f.firstToken,f.lastToken,f))}),n.type==="path"&&i.ast.values?.values.at(0)?.value instanceof ne){let d=i.ast.values?.values.at(0)?.value,f=[];d.value.split("/").every(p=>{let m=o.getNode(p);return m?f.push(p):a.push(x(23,d.firstToken,d.lastToken,d,{templateStrings:[p,`/${f.join("/")}`]})),!m})}let u=i.name.match(/^(.*)-(\d+)$/);if(n.type==="phandles"&&u){let d="";e.endsWith("-gpios")?d="gpio":d=n["specifier-space"]??u[1];let f=Number.parseInt(u[2],10),p=i.parent.getProperty(`${d}-names`);p&&(p.ast.quickValues?.at(f)||a.push(x(33,i.ast.firstToken,i.ast.lastToken,i.ast,{severity:pn.DiagnosticSeverity.Warning,linkedTo:[p.ast],templateStrings:[i.name,f.toString()]})))}if(n.type==="phandle-array"){let d=He(i.ast.values),f=0,p=[],m=0;for(;d&&f<d.length;){let h=d.at(f),y=An(h,o),S=h;if(!y){let pe=h??i.ast;a.push(x(22,pe.firstToken,pe.lastToken,pe));break}let v="";e.endsWith("-gpios")?v="gpio":v=n["specifier-space"]??e.slice(0,-1);let b=y.getProperty(`#${v}-cells`);if(!b){a.push(x(16,i.ast.firstToken,i.ast.lastToken,i.ast,{linkedTo:[...y.nodeNameOrLabelRef],templateStrings:[i.name,`#${v}-cells`,`/${y.path.slice(1).join("/")}`]}));break}let P=b?Ge(b,0,0,s)??0:0,N=y.nodeType?.cellsValues?.find(pe=>pe.specifier===v)?.values;if(p.push([`${m}_phandle`,...N?.map(pe=>`${m}_${pe}`)??[],...Array.from({length:P-(N?.length??0)},(pe,Pe)=>`${m}_cell${P-(N?.length??0)?Pe:""}`)]),1+P>d.length-f){let pe=h??i.ast;a.push(x(19,pe.firstToken,pe.lastToken,pe,{templateStrings:[i.name,`<${p.at(-1).join(" ")}>`]}));break}f+=1+P;let $=d.slice(f-P,f),j={mappingValuesAst:$,specifierSpace:v,cellCount:P,target:y};i.nexusMapsTo.push(j);let L=y.getProperty(`${v}-map`);if(L){let pe=y.getNexusMapEntryMatch(v,s,$);pe?.match?j.mapItem=pe.match:a.push(x(31,pe.entry.firstToken,pe.entry.lastToken,pe.entry,{linkedTo:[L.ast]}))}$.every(pe=>pe instanceof ge)&&y.spesifierNexusMapping.push({expressions:$,node:i.parent,property:i,specifierSpace:v});let ye=i.parent.getProperty(`${v}-names`);h&&ye&&(ye.ast.quickValues?.at(m)||a.push(x(33,h.firstToken,d[f-1]?.lastToken,i.ast,{severity:pn.DiagnosticSeverity.Warning,linkedTo:[ye.ast],templateStrings:[i.name,m.toString()]})));let qe=n["max-len"];S&&qe&&m>=qe&&a.push(x(44,S.firstToken,(j.mappingValuesAst.at(-1)??S).lastToken,i.ast,{templateStrings:[i.name,qe.toString()]})),m++}(n["min-len"]!==void 0||n["max-len"]!==void 0)&&n["min-len"]!==void 0&&i.nexusMapsTo.length<n["min-len"]&&a.push(x(43,i.ast.propertyName.firstToken,i.ast.propertyName.lastToken,i.ast,{templateStrings:[i.name,n["min-len"].toString()]})),p.push([`${m}_phandle`,`${m}_cell...`]),r.signatureArgs=p.map(h=>h.map(y=>pn.ParameterInformation.create(y)))}return a}};var Qu=new Map,xB=(t,e)=>{let r=t.zephyrBindings.join(":");return e==="Zephyr"&&(Qu.set(r,(Qu.get(r)??0)+1),Bi().loadTypeAndCache(t.zephyrBindings,r)),{files:t,type:e,getNodeTypes:n=>{switch(e){case"Zephyr":return Bi().getNodeTypes(n,r);case"DevicetreeOrg":return{type:Tg().getNodeTypes(t.deviceOrgBindingsMetaSchema,t.deviceOrgTreeBindings,n),issues:[]}}},getBindings:()=>{switch(e){case"Zephyr":return Bi().getBindings(r);case"DevicetreeOrg":return Tg().getBindings()}},getBindingVendorString:n=>{if(e==="Zephyr")return Bi().getBindingVendorString(n)},getBindingDocumentation:n=>{switch(e){case"Zephyr":return Bi().getBindingDocumentation(r,n);case"DevicetreeOrg":return Tg().getBindingDocumentation(t.deviceOrgBindingsMetaSchema,t.deviceOrgTreeBindings,n)}},getZephyrContextBinding:()=>{if(e==="Zephyr")return Bi().getZephyrContextBinding(r)},getBusTypes:()=>{switch(e){case"Zephyr":return Bi().getBusTypes();case"DevicetreeOrg":return[]}},getDocumentLinks(n){if(!n)return[];switch(e){case"Zephyr":return Bi().getDocumentLinks(n,t.zephyrBindings);case"DevicetreeOrg":return[]}},dispose:()=>{if(e==="Zephyr"){let n=Qu.get(r)??0;n<=1?(Qu.delete(r),Bi().resetCache(r)):Qu.set(r,n-1)}}}};var Sg=q(U());var kQ=t=>!t.lastToken.prevToken||!t.lastToken.prevToken.prevToken?[]:[{startLine:t.firstToken.pos.line,startCharacter:t.firstToken.pos.col,endLine:t.lastToken.prevToken.prevToken.pos.line,endCharacter:t.lastToken.prevToken.prevToken.pos.col,kind:Sg.FoldingRangeKind.Comment}],LP=t=>!t.openScope||!t.closeScope?.prevToken?t.nodes.flatMap(LP):[{startLine:t.openScope.pos.line,startCharacter:t.openScope.pos.col,endLine:t.closeScope.prevToken.pos.line,endCharacter:t.closeScope.prevToken.pos.col,kind:Sg.FoldingRangeKind.Region},...t.nodes.flatMap(LP)],NQ=t=>{let e=[];return[...t.ifBlocks.map(r=>({start:(r.expression??r.keyword).lastToken,end:r.content?.lastToken??(r.expression??r.keyword).lastToken})),t.elseOption?{start:t.elseOption.keyword.lastToken,end:t.elseOption.content?.lastToken}:null].forEach(r=>{!r||!r.end||e.push({startLine:r.start.pos.line,startCharacter:r.start.pos.col,endLine:r.end.pos.line,endCharacter:r.end.pos.colEnd,kind:Sg.FoldingRangeKind.Region})}),e},RQ=t=>t instanceof De?LP(t):t instanceof On?NQ(t):t instanceof Tn?kQ(t):[];function MB(t,e){return e.allAstItems.flatMap(r=>[r,...r.allDescendants]).filter(r=>fe(r.fsPath,t)).flatMap(RQ)}var qB=require("fs"),$B=require("path"),Mr=q(U());function EQ(t){if(!t||!(t.ast instanceof je)&&!(t.ast instanceof mr))return[];let e=r=>r.nodeType?.bindingsPath?[Mr.Location.create(ue(r.nodeType.bindingsPath),Mr.Range.create(Mr.Position.create(0,0),Mr.Position.create(0,0)))]:[];return t.item instanceof J&&!Zt(t.ast)?e(t.item):t.ast instanceof mr&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo?e(t.ast.parentNode.linksTo):t.ast instanceof je&&t.ast.linksTo?e(t.ast.linksTo):[]}function wQ(t){if(!t||!t.item||!(t.ast instanceof Qe)||t.runtime.context.bindingLoader?.type!=="Zephyr")return[];let e=t.item instanceof et?t.item.parent:t.item,r=e.nodeType instanceof _t?e.nodeType.zephyrBinding:void 0;if(!r)return[];let n=LB(t.ast.name,r);if(n)return[Mr.Location.create(ue(r.filePath),n)];let i=(t.runtime.context.bindingLoader?.getZephyrContextBinding?.()??[]).filter(s=>r.extends?.some(o=>(0,$B.basename)(s.filePath)===`${o}.yaml`));for(let s of i){let o=LB(t.ast.name,s);if(o)return[Mr.Location.create(ue(s.filePath),o)]}return[Mr.Location.create(ue(r.filePath),Mr.Range.create(Mr.Position.create(0,0),Mr.Position.create(0,0)))]}async function FB(t,e){return Et(t,e,r=>[...EQ(r),...wQ(r)])}function LB(t,e){let r=e.filePath,n=(0,qB.readFileSync)(r,"utf8");return DQ(n,new RegExp(`(${t}|"${t}")\\s*:`))}function DQ(t,e){let r=t.match(e);if(!r)return;let n=r.index;if(n===void 0)return;let i=t.slice(0,n),s=i.split(`
344
+ ${n}`]})]},SQ=(t,e)=>vB(t,e.split("/").filter(r=>r)),vB=(t,e)=>{if(e.length===0)return{node:t,remainingInstancePath:""};let r=e[0].split("@"),n=r[0],i=r.at(1)?.split(",").map(o=>Number.parseInt(o,16)),s=t.getNode(n,i);return s?vB(s,e.slice(1)):{node:t,property:t.getProperty(e[0]),remainingInstancePath:e.slice(1).join("/")}};var xP=class t{constructor(){this.schemaIdValidators=new Map;this.ajvMap=new Map}static getNodeCompatible(e){let n=e.getProperty("compatible")?.ast.values;if(!n?.values.some(i=>!(i?.value instanceof ne)))return n?.values.map(i=>(i?.value).value)}parseMetaSchema(e,r){Po.sync("**/*.yaml",{cwd:e}).forEach(i=>{i=(0,bc.resolve)(e,i);try{let s=OP.default.parse((0,IP.readFileSync)(i,"utf-8"));r.addMetaSchema(s),this.schemaIdValidators.set(s.$id,i)}catch{}})}parseBindings(e,r){Po.sync("**/*.yaml",{cwd:e}).forEach(i=>{i=(0,bc.resolve)(e,i);try{let s=OP.default.parse((0,IP.readFileSync)(i,"utf-8"));r.addSchema(s),this.schemaIdValidators.set(s.$id,i)}catch(s){console.warn(i,s.message)}})}getNodeTypes(e,r,n){let i=`${e.join(";")}::${r.join(";")}`,s=this.ajvMap.get(i);return s||(s=new SB.default({strict:!1,strictSchema:!1,strictNumbers:!1}),s.addMetaSchema(AP),this.ajvMap.set(i,s),e.forEach(c=>this.parseMetaSchema(c,s)),r.forEach(c=>this.parseBindings(c,s))),t.getNodeCompatible(n)?.map(c=>{try{let l=Array.from(this.schemaIdValidators.keys()).find(f=>(0,bc.basename)(f)===`${c}.yaml#`);if(!l)return;let u=new yg(s,l);u.bindingsPath=this.schemaIdValidators.get(l),u.compatible=c;let d=s.getSchema(l);return u.description=(d?.schema).description,u.examples=(d?.schema).examples,u.maintainers=(d?.schema).maintainers,u}catch(l){console.warn(l.message)}}).filter(c=>c)??[]}getBindings(){return Array.from(this.schemaIdValidators.keys())}getBindingDocumentation(e,r,n){let i=`${e.join(";")}::${r.join(";")}`,s=this.ajvMap.get(i);if(!s)return;let o=Array.from(this.schemaIdValidators.keys()).find(d=>(0,bc.basename)(d)===`${n}.yaml#`);if(!o)return;let a=s.getSchema(o);if(!a)return;let c=a.schema.description,l=a.schema.examples,u=a.schema.maintainers;return{kind:Ri.Markdown,value:[...u?["### Maintainers",...u??[]]:[],...c?["### Description",Xi(c)]:[],...l?["### Examples","```devicetree",...l??[],"```"]:[]].join(`
345
+ `)}}},bB,Tg=()=>(bB??=new xP,bB);var Js=q(require("path")),Ju=require("fs"),wB=q(require("path")),DB=q(kS());var pn=q(U());var _B=()=>{let t=new W("nonposted-mmio",V("EMPTY"),"optional");return t.description=["Specifies that direct children of this bus should use non-posted memory accesses (i.e. a non-posted mapping mode) for MMIO ranges."],t};function PB(){let t=tn();t.noMismatchPropertiesAllowed=!0,t.compatible="simple-bus";let e=t.properties.find(n=>n.name==="compatible");e.required=()=>"required";let r=t.properties.find(n=>n.name==="ranges");return r.required=()=>"required",t.addProperty(_B()),t}var kB=(t,e)=>{switch(t){case"string":return typeof e=="string"?e:void 0;case"int":return typeof e=="number"?e:void 0;case"boolean":return;case"array":return Array.isArray(e)&&e.every(r=>typeof r=="number")?e:void 0;case"uint8-array":return Array.isArray(e)&&e.every(r=>typeof r=="number")?e:void 0;case"string-array":return Array.isArray(e)&&e.every(r=>typeof r=="string")?e:void 0;case"phandle":return;case"phandles":return;case"phandle-array":return;case"path":return;case"compound":return}},vg=(t,e)=>{if(Object.entries(e.properties??{}).forEach(([r,n])=>{n.name=r}),e.extends??=[],e=e.include.reduce((r,n)=>{let i=t.find(s=>(0,Js.basename)(s.filePath)===n.name);if(i){let s=n["property-blocklist"],o=n["property-allowlist"];e.extends?.push(...r.include.map(c=>(0,Js.basename)(c.name,".yaml")));let a=n["child-binding"];return r.include=r.include.filter(c=>c!==n),CB(t,i,r,s,o,a)??r}return console.warn(`Unable to find ${n.name}`),r},e),e["child-binding"]){let r=AB(e["child-binding"].include);e["child-binding"].include=r,e["child-binding"].rawInclude=[...r],e["child-binding"]=vg(t,e["child-binding"]),e["child-binding"]&&(e["child-binding"].isChildBinding=!0,e["child-binding"].filePath=e.filePath)}if(!e.include.length)return e},NB=t=>Array.isArray(t)?t:t?[t]:[],CB=(t,e,r,n=[],i,s)=>{let o=vg(t,e),a=vg(t,r);if(!o||!a)return;let c=new Set;Object.keys(o?.properties??{}).forEach(p=>c.add(p)),Object.keys(a?.properties??{}).forEach(p=>c.add(p));let l={};Array.from(c).forEach(p=>{let m=n?.some(y=>y===p)||i&&!i.some(y=>y===p)?void 0:o.properties?.[p]??void 0,h=a.properties?.[p]??void 0;(m||h)&&(l={...l,[p]:{...m??{},...h}})}),a.properties=l,a.extends??=[],a.extends.push(...o.extends??[]);let u=new Set;return Object.keys(o).filter(p=>p.endsWith("-cells")).forEach(p=>u.add(p)),Object.keys(o).filter(p=>p.endsWith("-cells")).forEach(p=>u.add(p)),Array.from(u).forEach(p=>{let m=o[p]??[],h=a[p]??[];a[p]=Array.from([...m,...h])}),(o.class||a.class)&&(a.class=[...new Set([...NB(a.class),...NB(o.class)])]),a.bus?a.bus.push(...o.bus??[]):a.bus=o.bus,o["child-binding"]&&(a["child-binding"]??={filePath:a.filePath,include:[],rawInclude:[],isChildBinding:!0},CB(t,o["child-binding"],a["child-binding"]??{filePath:a.filePath,include:[],rawInclude:[],isChildBinding:!0},s?.["property-blocklist"],s?.["property-allowlist"],s?.["child-binding"])),a},AB=t=>t?typeof t=="string"?[{name:t}]:t.map(e=>typeof e!="string"?e:{name:e}):[],MP=class t{constructor(){this.typeCache=new Map;this.contextBindings=new Map;this.processedFolders=new Set;this.zephyrBindingCache=new Map;this.vendorPrefixMap=new Map}static getCompatibleKeys(e,r){return!r||!r.nodeType?.bus?.length?[e]:[...r.nodeType.bus.map(n=>`${e}::${n}`),e]}getBaseZephyrType(e){let r=e.split(":");return Array.from(this.zephyrBindingCache.keys()).filter(i=>r.some(s=>i.startsWith(s))).flatMap(i=>this.zephyrBindingCache.get(i)).find(i=>i.filePath.endsWith(`${Js.default.sep}base.yaml`))}getBaseNodeType(e,r){let n=this.getBaseZephyrType(r),i=n?bg(n,e):void 0;if(i){i.warnMismatchProperties=!1;let s=i.properties.find(o=>o.name==="compatible");s&&(s.required=()=>"optional")}return i}static getNodeCompatible(e){let i=e.getProperty("compatible")?.ast.values?.values.filter(s=>s&&s.value instanceof ne);if(i?.length)return i.map(s=>s?.value?{name:s.value.value,ast:s.value}:void 0)}getNodeTypes(e,r){let n=t.getNodeCompatible(e)?.filter(a=>!!a),i=n?.flatMap(a=>t.getCompatibleKeys(a.name,e.parent).map(c=>this.typeCache.get(r)?.get(c)?.(e)).filter(c=>!!c))??[];if(!i.length){let a;if(e.pathString==="/zephyr,user"){let c={},l={properties:c,filePath:"",include:[],rawInclude:[],isChildBinding:!1},u=(d,f)=>{c[d]={name:d,type:f}};e.properties.forEach(d=>{if(d.name.endsWith("-gpios")){u(d.name,"phandle-array");return}let f=d.ast.values?.values.map(m=>m?.value),p=f?.filter(m=>!!m);if(f===void 0||p===void 0)u(d.name,"boolean");else if(p.every(m=>m instanceof ne))u(d.name,f.length>1?"string-array":"string");else if(p.every(m=>m instanceof Lr))u(d.name,"uint8-array");else if(p.every(m=>m instanceof ut)){let m=p.flatMap(h=>h.values);m.every(h=>h.value instanceof ge)?u(d.name,m.length>1?"array":"int"):m.every(h=>h.value instanceof ie||h.value instanceof it)?u(d.name,m.length>1?"phandles":"phandle"):u(d.name,"phandle-array")}else u(d.name,"compound")}),a=bg(l,e)}if(a){a.warnMismatchProperties=!1;let c=a.properties.find(l=>l.name==="compatible");c&&(c.required=()=>"optional")}return{type:[a??To(e)],issues:[]}}let s=this.getBusTypes(),o=n?.flatMap(a=>{let c=t.getCompatibleKeys(a.name,e.parent).some(l=>this.typeCache.get(r)?.has(l));if(!c){let l=s.filter(u=>this.typeCache.get(r)?.has(`${a.name}::${u}`));if(l.length)return x(37,a.ast.firstToken,a.ast.lastToken,a.ast,{templateStrings:l})}return c?[]:[x(32,a.ast.firstToken,a.ast.lastToken,a.ast,{severity:pn.DiagnosticSeverity.Hint,tags:[pn.DiagnosticTag.Unnecessary],templateStrings:[a.name]})]})??[];return{type:i.length?i:[To(e)],issues:o}}processVendorPrefix(e){let r=Js.default.join(e,"vendor-prefixes.txt");if(!(0,Ju.existsSync)(r))return;let n=(0,Ju.readFileSync)(r,"utf-8"),i=/^(?!#)(\S+)\s+(.+)$/gm;Array.from(n.matchAll(i),s=>[s[1].trim(),s[2].trim()]).forEach(([s,o])=>{this.vendorPrefixMap.set(s,o)})}loadTypeAndCache(e,r){e=Array.isArray(e)?e:[e];let n=e.filter(a=>this.processedFolders.has(a)).flatMap(a=>Array.from(this.zephyrBindingCache.entries()).flatMap(([c,l])=>c.startsWith(a)?[l]:[]));n.push(...e.filter(a=>!this.processedFolders.has(a)).flatMap(a=>(this.processVendorPrefix(a),this.processedFolders.add(a),Po.sync("**/*.yaml",{cwd:a,ignore:"test/*"}).map(l=>{if(l=(0,Js.resolve)(a,l),this.zephyrBindingCache.has(l))return this.zephyrBindingCache.get(l);try{let u=DB.default.parse((0,Ju.readFileSync)(l,"utf-8")),d=AB(u?.include),f={...u,bus:u.bus?Array.isArray(u.bus)?u.bus:[u.bus]:void 0,include:d,rawInclude:[...d],filePath:l};return this.zephyrBindingCache.set(l,f),f}catch(u){console.warn(u)}}).filter(l=>!!l))));let i=n.map(a=>vg(n,a)).filter(a=>!!a&&!a.include.length),s=this.typeCache.get(r);s||(s=new Map,this.typeCache.set(r,s));let o=this.contextBindings.get(r);if(o||(o=new Map,this.contextBindings.set(r,o)),i.forEach(a=>{o.set(a.compatible??"",a)}),_Q(i,s,this.vendorPrefixMap),!s.has("simple-bus")){let a=this.getBaseZephyrType(r);if(a){let c=PQ(a);s.set("simple-bus",()=>c)}}}getBindings(e){return Array.from(this.typeCache.get(e)?.keys()??[]).map(r=>r.split("::",1)[0])}getBindingVendorString(e){let r=e.split(",",1)[0];return this.vendorPrefixMap.get(r)}getBindingDocumentation(e,r){let n=this.contextBindings.get(e)?.get(r);if(!n)return;let i=this.getBindingVendorString(n.compatible??"");return{kind:pn.MarkupKind.Markdown,value:[...i?["### Vendor",...i?[i]:[]]:[],...n.title?["### Title",Xi(n.title)]:[],...n.description?["### Description",Xi(n.description)]:[],...n.examples?["### Examples",...n.examples.map(Xi)]:[]].join(`
346
+ `)}}getZephyrContextBinding(e){return Array.from(this.contextBindings.get(e)?.values()??[])}getBusTypes(){let e=Array.from(this.zephyrBindingCache.values()).flatMap(r=>r.bus?.filter(n=>!!n)??[]).filter(r=>!!r);return Array.from(new Set(e))}getDocumentLinks(e,r){let n=this.zephyrBindingCache.get(Ne(e.uri));if(!n)return[];let i=e.getText();return IB(n).map(a=>{let l=new RegExp(a.name).exec(i);if(l){let u=e.positionAt(l.index),d=e.positionAt(l.index+l[0].length),f=Array.from(this.zephyrBindingCache.keys()).find(p=>p.endsWith(`${wB.default.sep}${a.name}`)&&r.some(m=>p.startsWith(m)));return f?{range:pn.Range.create(u,d),target:ue(f)}:void 0}}).filter(a=>!!a)}resetCache(e){this.typeCache.delete(e)}};function IB(t){return[...t.rawInclude,...t["child-binding"]?IB(t["child-binding"]):[]].flat()}var RB,Bi=()=>(RB??=new MP,RB),_Q=(t,e,r)=>t.forEach(n=>{n.compatible&&e.set(n["on-bus"]?`${n.compatible}::${n["on-bus"]}`:n.compatible,i=>bg(n,i,r))}),bg=(t,e,r)=>{let n=To(e);n.compatible=t.compatible,n.title=t.title,n.description=t.description,n.examples=t.examples,n.bindingsPath=t.filePath,n.zephyrBinding=t,n.bus=typeof t.bus=="string"?[t.bus]:Array.from(new Set(t.bus)),n.onBus=t["on-bus"],n.class=typeof t.class=="string"?[t.class]:Array.isArray(t.class)?t.class:void 0,t.extends?.forEach(o=>n.extends.add(o)),n.warnMismatchProperties=!0,r&&t.compatible?.includes(",")&&(n.vendor=r?.get(t.compatible.split(",",1)[0]));let s=Object.keys(t).filter(o=>o.endsWith("-cells")).map(o=>({specifier:o.replace(/-cells$/,""),values:t[o]}));if(n.cellsValues=s,Object.entries(t.properties??{}).forEach(([o,a])=>{OB(n,o,a)}),t["child-binding"]){let o=t["child-binding"];n.childNodeType=a=>{let c=bg(o,a);return c.hasParentBinding=!0,c}}return n},PQ=t=>{let e=PB();e.bus=typeof t.bus=="string"?[t.bus]:Array.from(new Set(t.bus)),e.onBus=t["on-bus"],t.extends?.forEach(i=>e.extends.add(i)),e.warnMismatchProperties=!0;let n=Object.keys(t).filter(i=>i.endsWith("-cells")).map(i=>({specifier:i.replace(/-cells$/,""),values:t[i]}));return e.cellsValues=n,Object.entries(t.properties??{}).forEach(([i,s])=>{OB(e,i,s)}),e},OB=(t,e,r)=>{let n=t.properties.find(i=>i.getNameMatch(e));if(n&&typeof n.name=="string"){n.name!=="reg"?n.required=()=>r.required?"required":"optional":r.required&&(n.required=()=>"required"),n.values=()=>r.enum??[],n.constValue=kB(r.type,r.const),n.bindingType=r.type;let i=n.additionalTypeCheck;n.additionalTypeCheck=(s,o)=>[...EB(r,e,n)(s,o),...i?.(s,o)??[]]}else{let i=r.type==="compound"?n?.type:Zc(r.type);i??=Zc(r.type);let s=new W(e,i,r.required?"required":"optional",void 0,r.enum);s.additionalTypeCheck=(o,a)=>{let c=[...n?.additionalTypeCheck?.(o,a)??[],...EB(r,e,s)(o,a)];return s.signatureArgs??=n?.signatureArgs,s.signatureArgsCyclic??=!!n?.signatureArgsCyclic,c},s.description=r.description?[r.description]:n?.description,s.bindingType=r.type,s.constValue=kB(r.type,r.const),t.addProperty(s)}},EB=(t,e,r)=>{let n=t;return(i,s)=>{let o=i.parent.root,a=[];if(n.const){let d=i.ast.getFlatAstValues();if(d?.length==1&&d.every(f=>f instanceof ge)){let f=d.map(h=>h.evaluate(s)),p=Array.isArray(n.const)?n.const:[n.const];if(!(p.length===f.length&&f.every((h,y)=>typeof h=="number"&&Number.isNaN(h)||p[y]===h))){let h=i.ast.values??i.ast;a.push(x(24,h.firstToken,h.lastToken,h,{templateStrings:[`Binding expects property "${i.name}" be of type "${n.type}" with value: ${n.const}`]}))}}}n.deprecated&&a.push(x(14,i.ast.firstToken,i.ast.lastToken,i.ast,{severity:pn.DiagnosticSeverity.Warning,tags:[pn.DiagnosticTag.Deprecated],templateStrings:[i.name]})),(n.type==="int"||n.type==="array"&&(n.min!==void 0||n.max!==void 0))&&i.ast.getFlatAstValues()?.forEach(f=>{if(!(f instanceof ge))return;let p=f.evaluate(s);typeof p=="number"&&(n.min!==void 0&&p<n.min&&a.push(x(41,f.firstToken,f.lastToken,f,{templateStrings:[n.min.toString()]})),n.max!==void 0&&p>n.max&&a.push(x(42,f.firstToken,f.lastToken,f,{templateStrings:[n.max.toString()]})))});let c=n["min-len"],l=n["max-len"];if((c!==void 0||l!==void 0)&&(n.type==="array"||n.type==="string-array"||n.type==="uint8-array"||n.type==="phandles")){let d=i.ast.getFlatAstValues();d&&c!==void 0&&d.length<c&&a.push(x(43,i.ast.propertyName.firstToken,i.ast.propertyName.lastToken,i.ast,{templateStrings:[i.name,c.toString()]})),d&&l!==void 0&&d.length>l&&d.slice(l).forEach(f=>{f&&a.push(x(44,f.firstToken,f.lastToken,i.ast,{templateStrings:[i.name,l.toString()]}))})}if((n.type==="phandle"||n.type==="phandles"||n.type==="path")&&He(i.ast.values)?.forEach(f=>{An(f,o)||a.push(x(22,f.firstToken,f.lastToken,f))}),n.type==="path"&&i.ast.values?.values.at(0)?.value instanceof ne){let d=i.ast.values?.values.at(0)?.value,f=[];d.value.split("/").every(p=>{let m=o.getNode(p);return m?f.push(p):a.push(x(23,d.firstToken,d.lastToken,d,{templateStrings:[p,`/${f.join("/")}`]})),!m})}let u=i.name.match(/^(.*)-(\d+)$/);if(n.type==="phandles"&&u){let d="";e.endsWith("-gpios")?d="gpio":d=n["specifier-space"]??u[1];let f=Number.parseInt(u[2],10),p=i.parent.getProperty(`${d}-names`);p&&(p.ast.quickValues?.at(f)||a.push(x(33,i.ast.firstToken,i.ast.lastToken,i.ast,{severity:pn.DiagnosticSeverity.Warning,linkedTo:[p.ast],templateStrings:[i.name,f.toString()]})))}if(n.type==="phandle-array"){let d=He(i.ast.values),f=0,p=[],m=0;for(;d&&f<d.length;){let h=d.at(f),y=An(h,o),S=h;if(!y){let pe=h??i.ast;a.push(x(22,pe.firstToken,pe.lastToken,pe));break}let v="";e.endsWith("-gpios")?v="gpio":v=n["specifier-space"]??e.slice(0,-1);let b=y.getProperty(`#${v}-cells`);if(!b){a.push(x(16,i.ast.firstToken,i.ast.lastToken,i.ast,{linkedTo:[...y.nodeNameOrLabelRef],templateStrings:[i.name,`#${v}-cells`,`/${y.path.slice(1).join("/")}`]}));break}let P=b?Ge(b,0,0,s)??0:0,N=y.nodeType?.cellsValues?.find(pe=>pe.specifier===v)?.values;if(p.push([`${m}_phandle`,...N?.map(pe=>`${m}_${pe}`)??[],...Array.from({length:P-(N?.length??0)},(pe,Pe)=>`${m}_cell${P-(N?.length??0)?Pe:""}`)]),1+P>d.length-f){let pe=h??i.ast;a.push(x(19,pe.firstToken,pe.lastToken,pe,{templateStrings:[i.name,`<${p.at(-1).join(" ")}>`]}));break}f+=1+P;let $=d.slice(f-P,f),j={mappingValuesAst:$,specifierSpace:v,cellCount:P,target:y};i.nexusMapsTo.push(j);let L=y.getProperty(`${v}-map`);if(L){let pe=y.getNexusMapEntryMatch(v,s,$);pe?.match?j.mapItem=pe.match:a.push(x(31,pe.entry.firstToken,pe.entry.lastToken,pe.entry,{linkedTo:[L.ast]}))}$.every(pe=>pe instanceof ge)&&y.spesifierNexusMapping.push({expressions:$,node:i.parent,property:i,specifierSpace:v});let ye=i.parent.getProperty(`${v}-names`);h&&ye&&(ye.ast.quickValues?.at(m)||a.push(x(33,h.firstToken,d[f-1]?.lastToken,i.ast,{severity:pn.DiagnosticSeverity.Warning,linkedTo:[ye.ast],templateStrings:[i.name,m.toString()]})));let qe=n["max-len"];S&&qe&&m>=qe&&a.push(x(44,S.firstToken,(j.mappingValuesAst.at(-1)??S).lastToken,i.ast,{templateStrings:[i.name,qe.toString()]})),m++}(n["min-len"]!==void 0||n["max-len"]!==void 0)&&n["min-len"]!==void 0&&i.nexusMapsTo.length<n["min-len"]&&a.push(x(43,i.ast.propertyName.firstToken,i.ast.propertyName.lastToken,i.ast,{templateStrings:[i.name,n["min-len"].toString()]})),p.push([`${m}_phandle`,`${m}_cell...`]),r.signatureArgs=p.map(h=>h.map(y=>pn.ParameterInformation.create(y)))}return a}};var Qu=new Map,xB=(t,e)=>{let r=t.zephyrBindings.join(":");return e==="Zephyr"&&(Qu.set(r,(Qu.get(r)??0)+1),Bi().loadTypeAndCache(t.zephyrBindings,r)),{files:t,type:e,getNodeTypes:n=>{switch(e){case"Zephyr":return Bi().getNodeTypes(n,r);case"DevicetreeOrg":return{type:Tg().getNodeTypes(t.deviceOrgBindingsMetaSchema,t.deviceOrgTreeBindings,n),issues:[]}}},getBindings:()=>{switch(e){case"Zephyr":return Bi().getBindings(r);case"DevicetreeOrg":return Tg().getBindings()}},getBindingVendorString:n=>{if(e==="Zephyr")return Bi().getBindingVendorString(n)},getBindingDocumentation:n=>{switch(e){case"Zephyr":return Bi().getBindingDocumentation(r,n);case"DevicetreeOrg":return Tg().getBindingDocumentation(t.deviceOrgBindingsMetaSchema,t.deviceOrgTreeBindings,n)}},getZephyrContextBinding:()=>{if(e==="Zephyr")return Bi().getZephyrContextBinding(r)},getBusTypes:()=>{switch(e){case"Zephyr":return Bi().getBusTypes();case"DevicetreeOrg":return[]}},getDocumentLinks(n){if(!n)return[];switch(e){case"Zephyr":return Bi().getDocumentLinks(n,t.zephyrBindings);case"DevicetreeOrg":return[]}},dispose:()=>{if(e==="Zephyr"){let n=Qu.get(r)??0;n<=1?(Qu.delete(r),Bi().resetCache(r)):Qu.set(r,n-1)}}}};var Sg=q(U());var kQ=t=>!t.lastToken.prevToken||!t.lastToken.prevToken.prevToken?[]:[{startLine:t.firstToken.pos.line,startCharacter:t.firstToken.pos.col,endLine:t.lastToken.prevToken.prevToken.pos.line,endCharacter:t.lastToken.prevToken.prevToken.pos.col,kind:Sg.FoldingRangeKind.Comment}],LP=t=>!t.openScope||!t.closeScope?.prevToken?t.nodes.flatMap(LP):[{startLine:t.openScope.pos.line,startCharacter:t.openScope.pos.col,endLine:t.closeScope.prevToken.pos.line,endCharacter:t.closeScope.prevToken.pos.col,kind:Sg.FoldingRangeKind.Region},...t.nodes.flatMap(LP)],NQ=t=>{let e=[];return[...t.ifBlocks.map(r=>({start:(r.expression??r.keyword).lastToken,end:r.content?.lastToken??(r.expression??r.keyword).lastToken})),t.elseOption?{start:t.elseOption.keyword.lastToken,end:t.elseOption.content?.lastToken}:null].forEach(r=>{!r||!r.end||e.push({startLine:r.start.pos.line,startCharacter:r.start.pos.col,endLine:r.end.pos.line,endCharacter:r.end.pos.colEnd,kind:Sg.FoldingRangeKind.Region})}),e},RQ=t=>t instanceof De?LP(t):t instanceof On?NQ(t):t instanceof Tn?kQ(t):[];function MB(t,e){return e.allAstItems.flatMap(r=>[r,...r.allDescendants]).filter(r=>fe(r.fsPath,t)).flatMap(RQ)}var qB=require("fs"),$B=require("path"),Mr=q(U());function EQ(t){if(!t||!(t.ast instanceof je)&&!(t.ast instanceof mr)&&!(t.ast instanceof ie))return[];let e=r=>r.nodeType?.bindingsPath?[Mr.Location.create(ue(r.nodeType.bindingsPath),Mr.Range.create(Mr.Position.create(0,0),Mr.Position.create(0,0)))]:[];return t.item instanceof J&&!Zt(t.ast)?e(t.item):t.ast instanceof mr&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo?e(t.ast.parentNode.linksTo):t.ast instanceof je&&t.ast.linksTo?e(t.ast.linksTo):[]}function wQ(t){if(!t||!t.item||!(t.ast instanceof Qe)||t.runtime.context.bindingLoader?.type!=="Zephyr")return[];let e=t.item instanceof et?t.item.parent:t.item,r=e.nodeType instanceof _t?e.nodeType.zephyrBinding:void 0;if(!r)return[];let n=LB(t.ast.name,r);if(n)return[Mr.Location.create(ue(r.filePath),n)];let i=(t.runtime.context.bindingLoader?.getZephyrContextBinding?.()??[]).filter(s=>r.extends?.some(o=>(0,$B.basename)(s.filePath)===`${o}.yaml`));for(let s of i){let o=LB(t.ast.name,s);if(o)return[Mr.Location.create(ue(s.filePath),o)]}return[Mr.Location.create(ue(r.filePath),Mr.Range.create(Mr.Position.create(0,0),Mr.Position.create(0,0)))]}async function FB(t,e){return Et(t,e,r=>[...EQ(r),...wQ(r)])}function LB(t,e){let r=e.filePath,n=(0,qB.readFileSync)(r,"utf8");return DQ(n,new RegExp(`(${t}|"${t}")\\s*:`))}function DQ(t,e){let r=t.match(e);if(!r)return;let n=r.index;if(n===void 0)return;let i=t.slice(0,n),s=i.split(`
347
347
  `).length-1,o=i.lastIndexOf(`
348
348
  `),a=o===-1?n+1:n-o,c=a+r[0].length;return Mr.Range.create(Mr.Position.create(s,a),Mr.Position.create(s,c))}var Sc=require("fs");var CQ=(t,e)=>{let r=(0,Sc.readFileSync)(t).toString();if($r().needsRenew(t,r))$r().renewLexer(t,r),e(t);else return console.log("file changed event has the same text, skipping.",t)},_g=class{constructor(e,r,n){this.file=e;this.cb=r;this.isFileDirty=n}#e=0;watch(){if(this.count++,this.count===1){console.log("create watch for",this.file);let e=this.file,r=this.cb;this.onChange=()=>{if(console.log("onChange - file watcher",e),this.isFileDirty()){console.log("onChange - file is dirty, skipping");return}CQ(e,r)},(0,Sc.watchFile)(e,this.onChange)}}unwatch(){this.count===1&&(console.log("dispose watch for",this.file),(0,Sc.unwatchFile)(this.file,this.onChange),this.onChange=void 0),this.count--}get count(){return this.#e}set count(e){this.#e=e,e<0&&(this.#e=0,console.warn("unwatching an un watched file",this.file))}};var Vt=q(require("path")),qP=require("fs");var Ti=t=>{if(t)return Array.isArray(t)?t:[t]},AQ=t=>({...t,deviceOrgBindingsMetaSchema:Ti(t.deviceOrgBindingsMetaSchema),deviceOrgTreeBindings:Ti(t.deviceOrgTreeBindings),includePaths:Ti(t.includePaths),lockRenameEdits:Ti(t.lockRenameEdits),zephyrBindings:Ti(t.zephyrBindings),overlays:Ti(t.overlays)}),BB=t=>({...t,defaultDeviceOrgBindingsMetaSchema:Ti(t.defaultDeviceOrgBindingsMetaSchema),defaultDeviceOrgTreeBindings:Ti(t.defaultDeviceOrgTreeBindings),defaultIncludePaths:Ti(t.defaultIncludePaths),defaultLockRenameEdits:Ti(t.defaultLockRenameEdits),defaultZephyrBindings:Ti(t.defaultZephyrBindings),contexts:t.contexts?.map(AQ)}),zn=async(t,e=[],r)=>{let n=r?e.map(s=>Ne(s.uri)).sort((s,o)=>s.split(Vt.sep).length-o.split(Vt.sep).length).find(s=>Ww(s,r)):void 0;return[...e.at(0)?[{replace:"${workspaceFolder}",fsPath:n??Ne(e[0].uri)}]:[],...e.map(s=>({replace:`\${workspaceFolder:${s.name}}`,fsPath:Ne(s.uri)}))].forEach(s=>t=t.replaceAll(s.replace,s.fsPath)),t},Qs={defaultBindingType:"Zephyr",defaultZephyrBindings:[],defaultIncludePaths:[],defaultDeviceOrgBindingsMetaSchema:[],defaultDeviceOrgTreeBindings:[],contexts:[],defaultLockRenameEdits:[],allowAdhocContexts:!0,autoChangeContext:!0,defaultShowFormattingErrorAsDiagnostics:!0,disableFileWatchers:!1,autoAddMissingPropertiesOnCompletion:!0},$P=async(t,e,r)=>{let n=await zn(t.cwd??"${workspaceFolder}",r,t.dtsFile)??e.cwd,i=await Promise.all((t.includePaths??e.defaultIncludePaths).map(p=>zn(p,r,t.dtsFile))),s=await Promise.all((t.zephyrBindings??e.defaultZephyrBindings).map(p=>zn(p,r,t.dtsFile))),o=t.bindingType??e.defaultBindingType,a=await Promise.all((t.deviceOrgTreeBindings??e.defaultDeviceOrgTreeBindings).map(p=>zn(p,r,t.dtsFile))),c=await Promise.all((t.deviceOrgBindingsMetaSchema??e.defaultDeviceOrgBindingsMetaSchema).map(p=>zn(p,r,t.dtsFile))),l=await Promise.all((t.lockRenameEdits??e.defaultLockRenameEdits).map(p=>zn(p,r,t.dtsFile)));if(n&&o==="Zephyr"&&(!s||s.length===0)&&(s=["./zephyr/dts/bindings"]),!t.dtsFile){console.log("Context is missing dtsFile, skipping...");return}let u=t.dtsFile,d=t.overlays??[],f=t.compileCommands;return n&&(s=s.map(p=>(0,Vt.resolve)(n,p)).filter(p=>(0,qP.existsSync)(p)),a=a?.map(p=>(0,Vt.resolve)(n,p)),c=c.map(p=>(0,Vt.resolve)(n,p)),i=i.map(p=>(0,Vt.resolve)(n,p)),u=(0,Vt.resolve)(n,u),d=d.map(p=>(0,Vt.resolve)(n,p)),l=l.map(p=>(0,Vt.resolve)(n,p)),f=f?(0,Vt.resolve)(n,f):void 0),{ctxName:t.ctxName??(0,Vt.basename)(u),cwd:n?ft(n):void 0,includePaths:i.map(ft),zephyrBindings:s.map(ft),bindingType:o,deviceOrgTreeBindings:a.map(ft),deviceOrgBindingsMetaSchema:c.map(ft),dtsFile:ft(u),overlays:d.map(ft),lockRenameEdits:l.map(ft),compileCommands:f?ft(f):void 0,showFormattingErrorAsDiagnostics:t.showFormattingErrorAsDiagnostics??e.defaultShowFormattingErrorAsDiagnostics,disableFileWatchers:t.disableFileWatchers??e.disableFileWatchers,autoAddMissingPropertiesOnCompletion:t.autoAddMissingPropertiesOnCompletion??e.autoAddMissingPropertiesOnCompletion}},Zu=async(t,e)=>{let r=t.cwd?await zn(t.cwd,e):void 0,n=t.defaultBindingType,i=t.defaultDeviceOrgBindingsMetaSchema=await Promise.all((t.defaultDeviceOrgBindingsMetaSchema??[]).map(d=>zn(d,e))),s=t.defaultDeviceOrgTreeBindings=await Promise.all((t.defaultDeviceOrgTreeBindings??[]).map(d=>zn(d,e))),o=t.defaultIncludePaths=await Promise.all((t.defaultIncludePaths??[]).map(d=>zn(d,e))),a=t.defaultZephyrBindings=await Promise.all((t.defaultZephyrBindings??[]).map(d=>zn(d,e))),c=t.defaultLockRenameEdits=await Promise.all((t.defaultLockRenameEdits??[]).map(d=>zn(d,e)));r&&(o=t.defaultIncludePaths=(t.defaultIncludePaths??[]).map(d=>(0,Vt.resolve)(r,d)),n==="Zephyr"&&!t.defaultZephyrBindings&&(a=["./zephyr/dts/bindings"]),a=a.map(d=>(0,Vt.resolve)(r,d)),i=i.map(d=>(0,Vt.resolve)(r,d)),s=(t.defaultDeviceOrgTreeBindings??[]).map(d=>(0,Vt.resolve)(r,d)),c=c.map(d=>(0,Vt.resolve)(r,d)));let l={cwd:r,defaultDeviceOrgBindingsMetaSchema:i,defaultDeviceOrgTreeBindings:s,defaultIncludePaths:o,defaultZephyrBindings:a,defaultLockRenameEdits:c,defaultBindingType:n,autoChangeContext:t.autoChangeContext??Qs.autoChangeContext,allowAdhocContexts:t.allowAdhocContexts??Qs.allowAdhocContexts,defaultShowFormattingErrorAsDiagnostics:t.defaultShowFormattingErrorAsDiagnostics??Qs.defaultShowFormattingErrorAsDiagnostics,disableFileWatchers:t.disableFileWatchers??!1,autoAddMissingPropertiesOnCompletion:t.autoAddMissingPropertiesOnCompletion??!0},u=(await Promise.all(t.contexts?.map(d=>$P(d,l,e))??[])).filter(d=>!!d).filter(d=>[d.dtsFile,...d.overlays].every(f=>(0,qP.existsSync)(f)&&Vt.default.isAbsolute(f)));return{...l,contexts:u}};var jB=t=>`DT_PROP(${FP(t.parent)}, ${t.name.replaceAll("-","_")}))`,UB=t=>t.parent.labels.map(e=>`DT_PROP(DT_NODELABEL(${e.label.toString()}), ${t.name.replaceAll("-","_")})`);var FP=t=>`DT_PATH(${t.path.slice(1).map(e=>e.replace("@","_").replaceAll("-","_")).join(",")})`,HB=t=>t.labels.map(e=>`DT_NODELABEL(${e.label.toString()})`),VB=t=>{let e=[];return Ei.getNodeFromPath(["aliases"],t.root)?.properties.filter(i=>{if(i.ast.quickValues?.at(0)===t.pathString)return!0;let s=i.ast.values?.values.at(0)?.value;if(s instanceof ie&&s.linksTo===t||s instanceof it&&s.path?.pathParts.at(-1)?.linksTo===t)return!0})?.forEach(i=>e.push(`DT_ALIAS(${i.name.replaceAll("-","_")})`)),e};function IQ(t,e){if(!t||!(t.item instanceof et)||!(t.ast instanceof Qe))return[];let r=[];return e.settings.bindingType==="Zephyr"&&(r.push({type:"dt_zephyr_macro_prop_node_path",data:jB(t.item)}),UB(t.item).forEach(n=>{r.push({type:"dt_zephyr_macro_prop_node_label",data:n})})),r}function OQ(t,e){if(!t||t.item===null)return[];let r;if(t.item instanceof J?r=t.item:t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo?r=t.ast.parentNode.linksTo:t.ast instanceof je&&t.ast.linksTo&&(r=t.ast.linksTo),!r)return[];let n=[{type:"path",data:r.pathString}];return e.settings.bindingType==="Zephyr"&&(HB(r).forEach(i=>{n.push({type:"dt_zephyr_macro_node_label",data:i})}),n.push({type:"dt_zephyr_macro_node_path",data:FP(r)}),VB(r).forEach(i=>{n.push({type:"dt_zephyr_macro_prop_node_alias",data:i})})),n}async function WB(t,e){return e?Et(t,e,r=>[...OQ(r,e),...IQ(r,e)]):[]}var zB=q(U());function xQ(t){return!t||!(t.item instanceof et)?void 0:t.item.parent.nodeType?.getSignatureHelp?.(t.item,t.ast,t.beforeAst,t.afterAst)}async function MQ(t){let e=Jc(t?.ast);if(!e||!e.params.length||!t?.ast||t.ast===e.functionName)return;let n=(await t.runtime.context.getAllStableParsers()).at(-1).cPreprocessorParser.macros.get(e.functionName.name)?.macro.identifier;if(!n||!(n instanceof ii))return;let i=n.params.map(o=>({label:o instanceof vt?o.name:"..."})),s=e.params.find(o=>o&&(t.ast===o||o.isAncestorOf(t.ast)));return s??=t.afterAst?e.params.find(o=>o&&(t.afterAst===o||o.isAncestorOf(t.afterAst))):void 0,s??=t.beforeAst?e.params.find(o=>o&&(t.beforeAst===o||o.isAncestorOf(t.beforeAst))):void 0,{signatures:[zB.SignatureInformation.create(`${e.functionName.name}(${i.map(o=>o.label).join(", ")})`,void 0,...i.flat())],activeSignature:0,activeParameter:s?e.params.indexOf(s):void 0}}async function GB(t,e){if(e)return(await Et(t,e,async r=>[await MQ(r)||xQ(r)])).at(0)}var YB=require("timers"),KB=require("events");var BP=class extends KB.EventEmitter{constructor(e=3e3,r=1e3){super(),this.thresholdBytes=e*1024*1024,this.interval=(0,YB.setInterval)(()=>{let n=process.memoryUsage().heapUsed;n>this.thresholdBytes&&this.emit("thresholdExceeded",{usedMb:(n/1024/1024).toFixed(2),thresholdMb:e})},r)}stop(){clearInterval(this.interval)}},LQ=new BP(3e3),XB=()=>{LQ.on("thresholdExceeded",({usedMb:t,thresholdMb:e})=>{console.warn(`[HeapMonitor] Heap usage exceeded ${e}MB: ${t}MB used`),s0(),i0()})};var JB=t=>`0x${t.map((e,r)=>e.toString(16).padStart(r?8:0,"0")).join("")}`;function QB(t,e){let r=e.nodePath,n=e.labels.at(0);e.disabled&&(n+=" <DISABLED>");let i=e.nodePath.split("/").pop()??e.nodePath,s=n?`${n} (${i})`:i,o=t.children.filter(a=>{let c=ei(e.start,e.size),l=ei(a.start,a.size),u=qt(e.start,a.start)>=0,d=qt(c,l)<=0,f=qt(e.start,a.start)===0&&qt(e.size,a.size)===0;return u&&d&&!f});if(o.length>0){for(let a of o)QB(a,e);return}t.children.push({name:s,start:e.start,size:e.size,children:[],path:r,disabled:e.disabled})}function qQ(t){let e={};for(let r of t){let n={name:r.name,children:[],path:r.path};for(let i of r.partitions)QB(n,i);e[r.name]=n}return e}function ZB(t,e="",r=!0){let n={};for(let d of t.children){let f=`${d.start}-${d.size}`;n[f]||(n[f]=[]),n[f].push(d)}let i="",s=e?r?"\u2514\u2500 ":"\u251C\u2500 ":"",o=[];"start"in t&&t.start.length&&o.push(`start: ${JB(t.start)}`),"size"in t&&t.size.length&&o.push(`size: ${JB(t.size)}`);let a=o.length>0?`[${o.join(", ")}]`:"",c=t.name;i+=`${e}${s}${c} ${a}
349
349
  `;let l=e+(r?" ":"\u2502 "),u=Object.keys(n);return u.forEach((d,f)=>{let p=n[d],m=Array.from(new Set(p.map(v=>v.name))).join(", "),h={};p.forEach(v=>{v.children.forEach(b=>{let P=`${b.start}-${b.size}-${b.name}`;h[P]=b})});let y=Object.values(h),S={name:m,start:p[0].start,size:p[0].size,children:y,path:t.path};i+=ZB(S,l,f===u.length-1)}),i}function ej(t){return qQ(t)}function tj(t){return Object.values(t).map(e=>ZB(e)).join(`
350
- `)}var xe=[],le,Zs,kg=new WeakMap,ed=new Map;XB();var Rg=new Map,nj=t=>{t.settings.disableFileWatchers||t.getContextFiles().forEach(e=>{ed.has(e)||ed.set(e,new _g(e,XP,()=>{let r=od(e),n=Rg.get(e);return!r||n===void 0?!1:n!==r.version})),ed.get(e)?.watch()})},GP=async t=>{let e=xe.indexOf(t);if(e===-1)return;rd(t,void 0,!0),kg.delete(t),console.log(`(ID: ${t.id}) cleaning Context for [${t.ctxNames.join(",")}]`);let r=await eo(t);if(X.sendNotification("devicetree/contextDeleted",{ctxNames:t.ctxNames.map(n=>n.toString()),id:t.id,...t.getFileTree(),settings:t.settings,active:le===t,type:r.type}),xe.splice(e,1),await ZP(),t===le&&(le=void 0,xe.length)){let n=Zs?Er(xe,{fsPath:Zs}):void 0;n??=xe[0],console.log("Active context was deleted. Forcing active to",n.id),await Sr({id:n.id},!0)}t.settings.disableFileWatchers||t.getContextFiles().map(n=>{ed.get(n)?.unwatch()}),setTimeout(async()=>{await Me();let n=new Set(xe.flatMap(i=>i.getContextFiles()));t.getContextFiles().map(i=>{n.has(i)||$r().reset(i)})},2e3),t.bindingLoader?.dispose()},$Q=t=>{let e=kg.get(t);if(!e?.abort.signal.aborted)return Promise.all([e?.promise,t.getRuntime()])},Me=async()=>{await Promise.all(xe.map($Q))},YP=async(t,e)=>(await ij(e)).indexOf(t)!==-1,ij=async t=>{let e=await sj(t);return xe.filter(r=>!e.some(n=>n===r))},sj=async t=>{let e=await zP(t);return xe.filter(r=>e.contexts.find(n=>Ki(n)===r.id))},FQ=async t=>{let e=await WQ(t);return xe.filter(r=>e.contexts.find(n=>Ki(n)===r.id))},BQ=async(t,e)=>(await FQ(e)).indexOf(t)!==-1,jQ=async(t,e)=>{if(t===e)return!0;let r=(await t.getAllStableParsers()).flatMap(i=>i.cPreprocessorParser.dtsIncludes).filter(i=>i.resolvedPath),n=(await e.getAllStableParsers()).flatMap(i=>i.cPreprocessorParser.dtsIncludes).filter(i=>i.resolvedPath);return n.some(i=>fe(i.resolvedPath,t.parser.fsPath))&&r.length?r.every(i=>n.some(s=>s.resolvedPath===i.resolvedPath&&s.firstToken.pos.col===i.firstToken.pos.col&&s.firstToken.pos.len===i.firstToken.pos.len&&s.firstToken.pos.line===i.firstToken.pos.line&&s.lastToken.pos.col===i.lastToken.pos.col&&s.lastToken.pos.len===i.lastToken.pos.len&&s.lastToken.pos.line===i.lastToken.pos.line)):e.getContextFiles().some(i=>fe(i,t.parser.fsPath))},UQ=async t=>{if(!await YP(t))return;let e=await ij(),r=await sj(),n=await Wf(e);if(xe.indexOf(t)===-1)return;let i=await Promise.all(n.flatMap(a=>[...r,...e.filter(c=>c!==a.context)].map(async c=>({context:a.context,same:await jQ(a.context,c)})))),s=t.getContextFiles(),o=n.filter(a=>i.some(c=>c.context===a.context&&c.same)||a.context!==t&&fe(a.context.parser.fsPath,t.parser.fsPath)&&s.some(c=>c&&a.files.indexOf(c)!==-1)).map(a=>a.context);o.length&&await Promise.all(o.map(GP))},X=(0,Re.createConnection)(Re.ProposedFeatures.all),lr=new Re.TextDocuments(Lt),KP=!1,Ng=!1,oj=!1,aj=!1,cj=!1,jP=!1,UP=!1,HP=!1,VP;X.onInitialize(async t=>{VP=t.workspaceFolders??[],X.console.log(`[Server(${process.pid}) ${VP?.at(0)?.uri} Version 0.14.1 ] Started and initialize received`);let e=t.capabilities;KP=!!(e.workspace&&e.workspace.configuration),Ng=!!(e.workspace&&e.workspace.workspaceFolders),oj=!!e.workspace?.diagnostics?.refreshSupport,aj=!!e.workspace?.semanticTokens?.refreshSupport,jP=!!e.textDocument?.semanticTokens?.dynamicRegistration,UP=!!e.textDocument?.formatting?.dynamicRegistration,HP=!!e.textDocument?.rangeFormatting?.dynamicRegistration,cj=!!e.workspace?.foldingRange?.refreshSupport;let r={capabilities:{typeDefinitionProvider:!0,workspaceSymbolProvider:!0,textDocumentSync:Re.TextDocumentSyncKind.Incremental,renameProvider:{prepareProvider:!0},completionProvider:{resolveProvider:!0,triggerCharacters:["&","="," ",'"',"(",","]},codeActionProvider:{codeActionKinds:[Re.CodeActionKind.QuickFix,Re.CodeActionKind.SourceFixAll]},documentSymbolProvider:!0,documentLinkProvider:{resolveProvider:!1},foldingRangeProvider:!0,definitionProvider:!0,declarationProvider:!0,referencesProvider:!0,hoverProvider:!0,signatureHelpProvider:{triggerCharacters:["<","("],retriggerCharacters:[" ",","]}}};return jP||(r.capabilities.semanticTokensProvider={legend:{tokenTypes:Wc,tokenModifiers:zc},full:!0}),UP||(r.capabilities.documentFormattingProvider=!0),HP||(r.capabilities.documentRangeFormattingProvider=!0),Ng&&(r.capabilities.workspace={workspaceFolders:{changeNotifications:!0,supported:!0}}),await pj(t.initializationOptions),r});var WP,HQ={tabSize:8,insertSpaces:!1,trimTrailingWhitespace:!0,insertFinalNewline:!0,wordWrapColumn:100},lj=t=>({tabSize:t?.["editor.tabSize"],insertSpaces:t?.["editor.insertSpaces"],trimFinalNewlines:t?.["files.trimFinalNewlines"],trimTrailingWhitespace:t?.["files.trimTrailingWhitespace"],insertFinalNewline:t?.["editor.insertFinalNewline"],wordWrapColumn:t?.["editor.wordWrapColumn"],removeMacroMultiline:t?.["editor.removeMacroMultiline"],wrapLongLines:t?.["editor.wrapLongLines"],indentExpressions:t?.["editor.indentExpressions"],removeEmptyReferences:t?.["editor.removeEmptyReferences"],removeEmptyNodes:t?.["editor.removeEmptyNodes"],removeEmptyRoots:t?.["editor.removeEmptyRoots"],sortNodesAndProperties:t?.["editor.sortNodesAndProperties"]});X.onInitialized(async()=>{if(jP&&await X.client.register(Re.SemanticTokensRegistrationType.type,{documentSelector:[{scheme:"file",language:"devicetree"}],legend:{tokenTypes:Wc,tokenModifiers:zc},full:!0}),UP&&await X.client.register(Re.DocumentFormattingRequest.type,{documentSelector:[{scheme:"file",language:"devicetree"}]}),HP&&await X.client.register(Re.DocumentRangeFormattingRequest.type,{documentSelector:[{scheme:"file",language:"devicetree"}]}),KP&&(X.client.register(Re.DidChangeConfigurationNotification.type,{}),!WP)){let t=await X.workspace.getConfiguration("editor").catch(()=>{}),e=await X.workspace.getConfiguration("files").catch(()=>{}),r=await X.workspace.getConfiguration("[devicetree]").catch(()=>{}),n=lj(r);(t||e||n)&&(WP={...t,...e,...n})}Ng&&X.workspace.onDidChangeWorkspaceFolders(async t=>{X.console.log("Workspace folder change event received"),await sd()})});X.onRequest("workspace/workspaceFolders",async()=>VP??null);var VQ=async t=>{let e=uj();return e={...Qs,...e},Zu(e,t??await id())},zP=async t=>{let e=GQ();return e={...Qs,...e},Zu(e,t??await id())},WQ=async t=>{let e=YQ();return e={...Qs,...e},Zu(e,t??await id())},nd=async t=>{let e=zQ();return e={...Qs,...e},Zu(e,t??await id())},id=async()=>Ng?await X.workspace.getWorkspaceFolders()??[]:[],rj=async t=>{let e=Er(xe,{id:Ki(t)});if(e)return e.ctxNames.includes(t.ctxName)||console.log(`(ID: ${e.id}) Adding name ${t.ctxName} for [${e.ctxNames.join(",")}]`),e.addCtxName(t.ctxName),e;let r=Ki(t);console.log(`(ID: ${r}) New context [${t.ctxName}]`),console.log(`(ID: ${r}) Settings: ${JSON.stringify(t,void 0," ")}`);let n=(0,Pc.join)((0,Pc.dirname)(t.dtsFile),"dts","bindings"),i=new bp(t,WP??HQ,t.bindingType?xB({zephyrBindings:t.zephyrBindings?[n,...t.zephyrBindings]:[n],deviceOrgBindingsMetaSchema:t.deviceOrgBindingsMetaSchema??[],deviceOrgTreeBindings:t.deviceOrgTreeBindings??[]},t.bindingType):void 0);xe.push(i);let s=performance.now();await i.stable(),console.log(`(ID: ${r}) New context took ${performance.now()-s}ms to start [${t.ctxName}]`),nj(i);let o=await eo(i);return X.sendNotification("devicetree/contextCreated",{ctxNames:i.ctxNames.map(a=>a.toString()),id:i.id,...i.getFileTree(),settings:i.settings,active:i===le,type:o.type}),await UQ(i),await ZP(),i},sd=async()=>{let t=await zP(),e=await nd();e.allowAdhocContexts||(e=await zP());let r=e.contexts.map(Ki),n=xe.filter(i=>!r.includes(i.id));await Promise.all(n.map(GP)),await t.contexts?.reduce((i,s)=>i.then(async()=>{await rj(s)}),Promise.resolve()),e.allowAdhocContexts&&await(await VQ()).contexts?.reduce((s,o)=>s.then(async()=>{Er(xe,{fsPath:o.dtsFile})||await rj(o)}),Promise.resolve()),setTimeout(async()=>{Zs?await Sr({fsPath:Zs}):!le&&xe.length&&(console.log(`No active context using first context (ID: ${xe[0].id}) [${xe[0].ctxNames.join(",")}]`),await Sr({id:xe[0].id}))})},hn,as,td=new Map,_c=new Map,zQ=()=>!as&&!hn?void 0:{...Object.fromEntries(Object.entries(as??{}).filter(([,r])=>r!==void 0)),...hn,contexts:[...hn?.contexts??[],...Array.from(_c.values()),...Array.from(td.values())]},uj=()=>!as&&!hn?void 0:{...as,...hn,contexts:[...Array.from(td.values())]},GQ=()=>!as&&!hn?void 0:{...as,...hn,contexts:[...hn?.contexts??[],...Array.from(_c.values())]},YQ=()=>!as&&!hn?void 0:{...hn,contexts:[...hn?.contexts??[]]};function KQ(t){let e={...t};for(let r in e)e[r]===null&&delete e[r];return e}var dj=async()=>{let t=await nd();console.log("Resolved settings",JSON.stringify(t,void 0," ")),X.sendNotification("devicetree/settingsChanged",t),await sd(),Me().then(()=>{oj&&X.languages.diagnostics.refresh()})},XQ=async()=>{let t=le?.getContextFiles();await Promise.all(Array.from(lr.keys()).filter(wt).map(async e=>{t?.some(r=>fe(r,Ne(e)))||await X.sendDiagnostics({uri:e,version:lr.get(e)?.version,diagnostics:[{severity:Re.DiagnosticSeverity.Information,range:Re.Range.create(Re.Position.create(0,0),Re.Position.create(0,0)),message:"File not in active context",source:"devicetree"}]})}))},XP=async t=>{let e=OT(xe,t);if(e.length)e.sort((r,n)=>r===le?-1:n===le?1:0).forEach(r=>{kg.get(r)?.abort.abort(),le===r&&X.sendNotification("devicetree/activeContextBusyNotification",r.id),X.sendNotification("devicetree/contextBusyNotification",r.id);let n=new AbortController,i=new Promise(s=>{setTimeout(async()=>{if(r.setStaleFsPath(t),n.signal.aborted){console.log("Abort parsing due to new request"),s();return}let o=performance.now(),a=le===r,c=a?fj(r):[],l=r.getContextFiles();if(await r.reevaluate(t),nj(r),l.forEach(p=>ed.get(p)?.unwatch()),a&&ek(r)?.length&&(JP(r).then(p=>{let m=p.items.map(h=>({uri:h.uri,version:h.version??void 0,diagnostics:h.items}));rd(r,c.filter(h=>m.every(y=>y.uri!==h.uri))),m.forEach(h=>{X.sendDiagnostics(h)}),ad.set(r,!0)}),Zs)){let p=r.getFsPathParser(Zs);p&&setTimeout(()=>{p.latestSemanticTokensBuilt||X.languages.semanticTokens.refresh()},50)}let u=await eo(r),d=r.getFileTree(),f={ctxNames:r.ctxNames.map(p=>p.toString()),id:r.id,...d,settings:r.settings,active:a,type:u.type};le===r&&X.sendNotification("devicetree/activeContextStableNotification",f),X.sendNotification("devicetree/contextStableNotification",f),s(),console.log("reevaluate",performance.now()-o)})});kg.set(r,{abort:n,promise:i})});else{if((await nd()).allowAdhocContexts===!1)return;await sd(),await Sr({fsPath:t})}},JQ=t=>lr.keys().find(e=>fe(Ne(e),t)),od=t=>{let e=JQ(t);if(e)return lr.get(e)},fj=t=>t.getContextFiles().map(e=>({uri:ue(e),version:od(e)?.version,diagnostics:[]})),ad=new WeakMap,rd=async(t,e=fj(t),r=!1)=>{if(!r&&t!==le)return;let n=performance.now();await Promise.all(e.filter(i=>t===le||!le?.getContextFiles().some(s=>fe(Ne(i.uri),s))).map(i=>X.sendDiagnostics({uri:i.uri,version:lr.get(i.uri)?.version,diagnostics:[]}))),ad.delete(t),console.log(`(ID: ${t.id})`,"clear workspace diagnostics",`[${t.ctxNames.join(",")}]`,performance.now()-n)},Pg=new Map,QQ=async t=>{let e=Pg.get(t);if(e||!KP)return e;Pg.delete(t);let r=await X.workspace.getConfiguration({scopeUri:ue(t),section:"[devicetree]"}).catch(()=>{});if(r){let n=lj(r);return Pg.set(t,n),n}},JP=async t=>{await t.stable();let e=performance.now(),r=await t.getDiagnostics(),n=await Promise.all(t.getContextFiles().map(async i=>{let s=od(i),o=[];if(s&&t.settings.showFormattingErrorAsDiagnostics){let a=await QQ(i);o.push(...(await Ai({textDocument:s,options:{...t.formattingOptions,...a}},s.getText(),"File Diagnostics").catch(()=>[])).map(c=>c.diagnostic()))}return{uri:ue(i),kind:Re.DocumentDiagnosticReportKind.Full,items:[...r.get(i)??[],...o],version:s?.version??null}}));return console.log(`(ID: ${t.id})`,"workspace diagnostics",`[${t.ctxNames.join(",")}]`,performance.now()-e),{items:[...n]}},QP=async t=>{let{items:e}=await JP(t);e.map(r=>({uri:r.uri,version:r.version??void 0,diagnostics:r.items})).forEach(async r=>{X.sendDiagnostics(r)}),ad.set(t,!0)},ZP=async()=>{let t=await Promise.all(xe.map(e=>eo(e)));console.log("======== Context List ========"),t.forEach(e=>{console.log(`(ID: ${e.ctx.id}) [${e.ctx.ctxNames.join(",")}]`,`[${e.type}]`,le===e.ctx?" [ACTIVE]":"")}),console.log("==============================")},eo=async(t,e)=>{let r=await YP(t,e),n=!r&&await BQ(t,e);return{ctx:t,type:r?"Ad Hoc":n?"User":"3rd Party"}},Sr=async(t,e=!1)=>{if("fsPath"in t){if(!wt(t.fsPath))return!1;Zs=t.fsPath,console.log("Active File Uri",Zs)}let r=await nd();if(le&&!e&&!r.autoChangeContext||(await Me(),!e&&le?.getContextFiles().find(o=>"fsPath"in t&&fe(o,t.fsPath))))return!1;let n=le,i=Er(xe,t),s=n!==i;return s&&(n&&rd(n),le=i,i?(eo(i).then(async o=>{let a=i.getFileTree();!i||i!==le&&!xe.includes(i)||X.sendNotification("devicetree/newActiveContext",{ctxNames:i.ctxNames.map(c=>c.toString()),id:i.id,...a,settings:i.settings,active:le===i,type:o.type})}),ek(i)?.length&&QP(i),await ZP()):X.sendNotification("devicetree/newActiveContext",void 0)),cj&&X.languages.foldingRange.refresh(),aj&&X.languages.semanticTokens.refresh(),s};lr.listen(X);var ek=t=>t?.getContextFiles()?.filter(e=>od(e));lr.onDidSave(t=>{Rg.set(Ne(t.document.uri),t.document.version)});lr.onDidClose(async t=>{let e=Ne(t.document.uri);if(!wt(e))return;Rg.delete(e);let r=OT(xe,e);if(r.length===0){td.delete(e),X.sendDiagnostics({uri:t.document.uri,version:lr.get(t.document.uri)?.version,diagnostics:[]});return}await Promise.all(r.map(async n=>{!!ek(n)?.filter(s=>s!==e).length?le?.getContextFiles().some(s=>fe(s,e))?le?.getContextFiles().some(s=>fe(s,e))&&(await rd(le),await QP(le)):X.sendDiagnostics({uri:t.document.uri,version:lr.get(t.document.uri)?.version,diagnostics:[]}):await YP(n)?(await GP(n),td.delete(n.settings.dtsFile)):rd(n)}))});lr.onDidOpen(async t=>{let e=Ne(t.document.uri);if(!wt(e))return;Rg.set(e,t.document.version),await Me(),XQ();let r=Er(xe,{fsPath:e});if(console.log("onDidOpen",r?.id,e),r)r!==le?await Sr({id:r.id}):r===le&&(!ad.get(r)||r.getContextFiles().some(n=>!fe(n,e)))&&await QP(r);else{let n={ctxName:(0,Pc.basename)(e),dtsFile:e};td.set(e,n),await XP(e)}});lr.onDidChangeContent(async t=>{let e=Ne(t.document.uri);if(!wt(e))return;let r=t.document.getText(),n=$r();n.needsRenew(e,r)&&(console.log("Content changed",e),n.renewLexer(e,r),await XP(e))});var pj=async t=>{t?.settings?.devicetree&&(hn=BB(KQ(t.settings.devicetree)),hn=Object.fromEntries(Object.entries(hn??{}).filter(([,e])=>e!==void 0)),console.log("Configuration changed",JSON.stringify(t,void 0," ")),await dj())};X.onDidChangeConfiguration(async t=>{await pj(t)});X.listen();X.languages.diagnostics.onWorkspace(async()=>{await Me();let t=le;return t?JP(t).finally(()=>{ad.set(t,!0)}):{items:[]}});X.onDidChangeWatchedFiles(t=>{X.console.log("We received a file change event")});X.onCompletion(async t=>{let e=Ne(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&le&&le.bindingLoader?.type==="Zephyr")return wA(t,le,lr.get(t.textDocument.uri));if(!wt(e))return[];await Me(),Sr({fsPath:e});let r=Wr(e);return r?[...await f0(t,r),...await oI(t,r)]:[]});X.onCompletionResolve(t=>t);var Wr=t=>{let e=uj();return Er(xe,{fsPath:t},le,e?.preferredContext)};X.onDocumentSymbol(async t=>{let e=Ne(t.textDocument.uri);if(!wt(e))return null;await Me();let r=Wr(e);return r?r.getFsPathParser(e)?.getDocumentSymbols(e):[]});X.onWorkspaceSymbol(async()=>{await Me();let t=le;return t?(await t.getAllStableParsers()).flatMap(e=>e.getWorkspaceSymbols()):[]});X.languages.semanticTokens.on(async t=>{let e=Ne(t.textDocument.uri);if(!wt(e))return{data:[]};try{await Me();let r=Wr(e),n=new Re.SemanticTokensBuilder,i=r?.isInContext(e);return!r||!i?{data:[]}:((await r.getAllStableParsers()).forEach(s=>s.buildSemanticTokens(n,e)),n.build())}catch(r){throw console.log(r),r}});X.onDocumentLinks(async t=>{await Me();let e=Ne(t.textDocument.uri);return wt(e)?Wr(e)?.getDocumentLinks(e):e.endsWith(".yaml")&&le?le.bindingLoader?.getDocumentLinks?.(lr.get(t.textDocument.uri))??[]:null});X.onPrepareRename(async t=>{let e=Ne(t.textDocument.uri);if(!wt(e))return;await Me(),Sr({fsPath:e});let r=Wr(e);return xA(t,r)});X.onRenameRequest(async t=>{let e=Ne(t.textDocument.uri);if(!wt(e))return;await Me(),Sr({fsPath:e});let r=Wr(e);return OA(t,r)});X.onReferences(async t=>{let e=Ne(t.textDocument.uri);if(!wt(e))return;await Me(),Sr({fsPath:e});let r=Wr(e);return DA(t,r)});X.onDefinition(async t=>{let e=Ne(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&le&&le.bindingLoader?.type==="Zephyr")return qA(t,le,lr.get(t.textDocument.uri));if(!wt(e))return;await Me(),Sr({fsPath:e});let r=Wr(e),n=(await r?.getDocumentLinks(e,t.position))?.filter(i=>i.target).map(i=>Re.Location.create(i.target,i.range))??[];return n.length?n:LA(t,r)});X.onDeclaration(async t=>{let e=Ne(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&le&&le.bindingLoader?.type==="Zephyr")return jA(t,le,lr.get(t.textDocument.uri));if(!wt(e))return;await Me(),Sr({fsPath:e});let r=Wr(e);return BA(t,r)});X.onCodeAction(async t=>{let e=Ne(t.textDocument.uri);if(wt(e))return HA(t)});var hj=async t=>{if(!wt(t.textDocument.uri))return;let e=Ne(t.textDocument.uri);if(!wt(e))return;await Me(),Sr({fsPath:e});let r=Wr(e);if(!r)return[];if((await r.getSyntaxIssues(void 0,l=>ho(l.raw,e,!1)?l:void 0)).get(e)?.length)return[];let i=lr.get(t.textDocument.uri)??$r().getDocument(e),s=i.getText();Pg.set(e,t.options);let o=await Ai({...t,options:{...r.formattingOptions,...t.options}},s,"New Text").catch(()=>s);if(o===s)return[];let a=i.lineCount-1,c=i.getText({start:{line:a,character:0},end:{line:a+1,character:0}}).length;return[Re.TextEdit.replace(Re.Range.create(Re.Position.create(0,0),Re.Position.create(i.lineCount,c)),o)]};X.onDocumentRangeFormatting(hj);X.onDocumentFormatting(hj);X.onHover(async t=>{let e=Ne(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&le&&le.bindingLoader?.type==="Zephyr")return Dx(t,le,lr.get(t.textDocument.uri));if(!wt(e))return;await Me();let r=Wr(e);return(await aI(t,r)).at(0)});X.onFoldingRanges(async t=>{let e=Ne(t.textDocument.uri);if(!wt(e))return;await Me();let r=Wr(e),n=r?.isInContext(e);if(!r||!n)return[];let i=(await r.getAllStableParsers()).find(s=>s.getFiles().some(o=>o===e));return i?MB(e,i):[]});X.onTypeDefinition(async t=>{let e=Ne(t.textDocument.uri);if(!wt(e))return;await Me(),Sr({fsPath:e});let r=Wr(e);return FB(t,r)});X.onSignatureHelp(async t=>{let e=Ne(t.textDocument.uri);if(!wt(e))return;await Me(),Sr({fsPath:e});let r=Wr(e);return GB(t,r)});X.onRequest("devicetree/getContexts",async()=>(await Me(),Promise.all(xe.map(async t=>{let e=await eo(t);return{ctxNames:t.ctxNames.map(r=>r.toString()),id:t.id,...t.getFileTree(),settings:t.settings,active:le===t,type:e.type}}))));X.onRequest("devicetree/setActive",async t=>(await Me(),console.log("devicetree/setActive",t),await Sr(t,!0)));X.onRequest("devicetree/getActiveContext",async()=>{if(await Me(),console.log("devicetree/getActiveContext"),!le)return;let t=await eo(le);return le?{ctxNames:le.ctxNames.map(e=>e.toString()),id:le.id,...le.getFileTree(),settings:le.settings,active:!0,type:t.type}:void 0});X.onRequest("devicetree/setDefaultSettings",async t=>{await Me(),as=Object.fromEntries(Object.entries(t??{}).filter(([,e])=>e!==void 0)),console.log("Integration Settings",as),await dj()});X.onRequest("devicetree/requestContext",async t=>{await Me();let e=await id(),r=await nd(e),n=await $P(t,r,e);if(!n)throw console.log("Failed to resolve context",t),new Error("Failed to resolve context");console.log("devicetree/requestContext",n);let i=Ki(n),s=Array.from(_c).find(([,c])=>c.ctxName===t.ctxName);if(s){let c=s[0].split(":",1)[0];Er(xe,{name:n.ctxName.toString()})?.removeCtxName(n.ctxName),console.log(`Removing integration context with ID ${c} and name ${t.ctxName}`),_c.delete(s[0])}_c.set(`${i}:${t.ctxName}`,t),await sd();let o=xe.find(c=>c.id===i);if(!o)throw new Error("Failed to create context");let a=await eo(o,e);return{ctxNames:o.ctxNames.map(c=>c.toString()),id:i,...o.getFileTree(),settings:o.settings,active:!0,type:a.type}});X.onRequest("devicetree/removeContext",async({id:t,name:e})=>{await Me(),_c.delete(`${t}:${e}`);let r=Er(xe,{id:t});if(r){if(r.removeCtxName(e),r.ctxNames.length){console.log("Context will not be deleted as it is still in use by others");return}await sd()}});X.onRequest("devicetree/compiledDtsOutput",async t=>{if(await Me(),!t)return;let e=Er(xe,{id:t});if(!e||!e.settings.dtsFile){console.log("Context or DTS file not found for ID",t);return}let r=await e.toFullString();return Ai({textDocument:{uri:ue(e.settings.dtsFile)},options:e.formattingOptions},r,"New Text").catch(()=>r)});X.onRequest("devicetree/serializedContext",async t=>{if(await Me(),!t)return;let e=Er(xe,{id:t}),r=performance.now();return e?.serialize().finally(()=>{console.info("serializedContext",performance.now()-r)})});X.onRequest("devicetree/activePath",async t=>{if(await Me(),!le)return;let e=r=>{if(r?.item)return r.item instanceof J?{nodePath:r.item.pathString}:{nodePath:r.item.parent.pathString,propertyName:r.item.name}};return(await Et(t,le,r=>[e(r)])).at(0)});X.onRequest("devicetree/customActions",async t=>(await Me(),WB(t,le)));X.onRequest("devicetree/activeFsPath",async t=>{await Me(),Sr({fsPath:t})});X.onRequest("devicetree/formattingText",async t=>{let e=Ne(t.textDocument.uri),r=od(e)??$r().getDocument(e,t.text),n=await Ai(t,r.getText(),"New Text");return{text:n,diagnostics:(await Ai(t,r.getText(),"File Diagnostics")).map(i=>i.diagnostic()),nonActionableDiagnostics:(await Ai(t,n,"File Diagnostics")).map(i=>i.diagnostic())}});X.onRequest("devicetree/formatTextEdits",async t=>{await Me();let e=$r().getDocument(Ne(t.textDocument.uri),t.text),r=e.positionAt(e.getText().length),n=Re.TextEdit.replace(Re.Range.create(Re.Position.create(0,0),r),""),i=MT(e,t.edits),s=await Ai({...t},i,"New Text").catch(()=>i);return n.newText=s,n});X.onRequest("devicetree/diagnosticIssues",async({uri:t,full:e})=>{await Me();let r=Ne(t);Sr({fsPath:r});let n=Wr(r);if(!n)return[];let i=e?(await n.getDiagnostics()).get(r):(await n.getSyntaxIssues(void 0,s=>ho(s.raw,r,!!e)?s:void 0)).get(r);if(i?.length)return i});X.onRequest("devicetree/evalMacros",async({macros:t,ctxId:e})=>{await Me();let r=Er(xe,{id:e});return r?t.map(n=>{let i=Gc(n,r.macros),s=Le(i);return{macro:n,evaluated:typeof s=="number"?s:i}}):[]});X.onRequest("devicetree/memoryViews",async({ctxId:t})=>{let e=Er(xe,{id:t});if(!e)return;await e?.stable();let r=await e.getRuntime(),n=r.rootNode.getMemoryViews(r.context.macros).sort((o,a)=>{let c=qt(o.start,a.start);return c===0?qt(a.size,o.size):c}),i=new Map;n.forEach(o=>{let a=i.get(o.name),c={nodePath:o.nodePath,labels:o.labels,start:o.start,size:o.size,disabled:o.disabled};a?a.partitions.push(c):i.set(o.name,{name:o.name,partitions:[c],path:o.nodePath})});let s=ej(Array.from(i.values()));return{trees:s,treeStr:tj(s)}});X.onRequest("devicetree/zephyrTypeBindings",async t=>{if(await Me(),!t)return;let e=Er(xe,{id:t});return e?.bindingLoader?.getZephyrContextBinding()?.map(r=>({...r,vendor:r.compatible&&e?.bindingLoader?.getBindingVendorString(r.compatible)}))});X.onRequest("devicetree/contextMacroNames",async t=>{if(await Me(),!t)return;let e=Er(xe,{id:t});return Array.from(e?.macros.keys()??[])});X.onRequest("devicetree/locationScopedInformation",async t=>{await Me();let e=Er(xe,{id:t.id}),r=Ne(t.textDocument.uri);if(!(!e||!e.isInContext(r)))return new Promise(async n=>{let i=await e.getRuntime(),s=await Et(t,e,(o,a)=>{let c=i.context.macros,l={};if(!o?.item)return i.rootNode.serialize(l,c,a),[{inNode:!1,inScope:l,parentNode:i.rootNode.pathString}];let u=null;return o.item instanceof J?u=o.item:u=o.item?.parent,u.serialize(l,i.context.macros,a),[{inNode:!0,inScope:l,parentNode:u.pathString}]});n(s[0])})});
350
+ `)}var xe=[],le,Zs,kg=new WeakMap,ed=new Map;XB();var Rg=new Map,nj=t=>{t.settings.disableFileWatchers||t.getContextFiles().forEach(e=>{ed.has(e)||ed.set(e,new _g(e,XP,()=>{let r=od(e),n=Rg.get(e);return!r||n===void 0?!1:n!==r.version})),ed.get(e)?.watch()})},GP=async t=>{let e=xe.indexOf(t);if(e===-1)return;rd(t,void 0,!0),kg.delete(t),console.log(`(ID: ${t.id}) cleaning Context for [${t.ctxNames.join(",")}]`);let r=await eo(t);if(X.sendNotification("devicetree/contextDeleted",{ctxNames:t.ctxNames.map(n=>n.toString()),id:t.id,...t.getFileTree(),settings:t.settings,active:le===t,type:r.type}),xe.splice(e,1),await ZP(),t===le&&(le=void 0,xe.length)){let n=Zs?Er(xe,{fsPath:Zs}):void 0;n??=xe[0],console.log("Active context was deleted. Forcing active to",n.id),await Sr({id:n.id},!0)}t.settings.disableFileWatchers||t.getContextFiles().map(n=>{ed.get(n)?.unwatch()}),setTimeout(async()=>{await Me();let n=new Set(xe.flatMap(i=>i.getContextFiles()));t.getContextFiles().map(i=>{n.has(i)||$r().reset(i)})},2e3),t.bindingLoader?.dispose()},$Q=t=>{let e=kg.get(t);if(!e?.abort.signal.aborted)return Promise.all([e?.promise,t.getRuntime()])},Me=async()=>{await Promise.all(xe.map($Q))},YP=async(t,e)=>(await ij(e)).indexOf(t)!==-1,ij=async t=>{let e=await sj(t);return xe.filter(r=>!e.some(n=>n===r))},sj=async t=>{let e=await zP(t);return xe.filter(r=>e.contexts.find(n=>Ki(n)===r.id))},FQ=async t=>{let e=await WQ(t);return xe.filter(r=>e.contexts.find(n=>Ki(n)===r.id))},BQ=async(t,e)=>(await FQ(e)).indexOf(t)!==-1,jQ=async(t,e)=>{if(t===e)return!0;let r=(await t.getAllStableParsers()).flatMap(i=>i.cPreprocessorParser.dtsIncludes).filter(i=>i.resolvedPath),n=(await e.getAllStableParsers()).flatMap(i=>i.cPreprocessorParser.dtsIncludes).filter(i=>i.resolvedPath);return n.some(i=>fe(i.resolvedPath,t.parser.fsPath))&&r.length?r.every(i=>n.some(s=>s.resolvedPath===i.resolvedPath&&s.firstToken.pos.col===i.firstToken.pos.col&&s.firstToken.pos.len===i.firstToken.pos.len&&s.firstToken.pos.line===i.firstToken.pos.line&&s.lastToken.pos.col===i.lastToken.pos.col&&s.lastToken.pos.len===i.lastToken.pos.len&&s.lastToken.pos.line===i.lastToken.pos.line)):e.getContextFiles().some(i=>fe(i,t.parser.fsPath))},UQ=async t=>{if(!await YP(t))return;let e=await ij(),r=await sj(),n=await Wf(e);if(xe.indexOf(t)===-1)return;let i=await Promise.all(n.flatMap(a=>[...r,...e.filter(c=>c!==a.context)].map(async c=>({context:a.context,same:await jQ(a.context,c)})))),s=t.getContextFiles(),o=n.filter(a=>i.some(c=>c.context===a.context&&c.same)||a.context!==t&&fe(a.context.parser.fsPath,t.parser.fsPath)&&s.some(c=>c&&a.files.indexOf(c)!==-1)).map(a=>a.context);o.length&&await Promise.all(o.map(GP))},X=(0,Re.createConnection)(Re.ProposedFeatures.all),lr=new Re.TextDocuments(Lt),KP=!1,Ng=!1,oj=!1,aj=!1,cj=!1,jP=!1,UP=!1,HP=!1,VP;X.onInitialize(async t=>{VP=t.workspaceFolders??[],X.console.log(`[Server(${process.pid}) ${VP?.at(0)?.uri} Version 0.14.2 ] Started and initialize received`);let e=t.capabilities;KP=!!(e.workspace&&e.workspace.configuration),Ng=!!(e.workspace&&e.workspace.workspaceFolders),oj=!!e.workspace?.diagnostics?.refreshSupport,aj=!!e.workspace?.semanticTokens?.refreshSupport,jP=!!e.textDocument?.semanticTokens?.dynamicRegistration,UP=!!e.textDocument?.formatting?.dynamicRegistration,HP=!!e.textDocument?.rangeFormatting?.dynamicRegistration,cj=!!e.workspace?.foldingRange?.refreshSupport;let r={capabilities:{typeDefinitionProvider:!0,workspaceSymbolProvider:!0,textDocumentSync:Re.TextDocumentSyncKind.Incremental,renameProvider:{prepareProvider:!0},completionProvider:{resolveProvider:!0,triggerCharacters:["&","="," ",'"',"(",","]},codeActionProvider:{codeActionKinds:[Re.CodeActionKind.QuickFix,Re.CodeActionKind.SourceFixAll]},documentSymbolProvider:!0,documentLinkProvider:{resolveProvider:!1},foldingRangeProvider:!0,definitionProvider:!0,declarationProvider:!0,referencesProvider:!0,hoverProvider:!0,signatureHelpProvider:{triggerCharacters:["<","("],retriggerCharacters:[" ",","]}}};return jP||(r.capabilities.semanticTokensProvider={legend:{tokenTypes:Wc,tokenModifiers:zc},full:!0}),UP||(r.capabilities.documentFormattingProvider=!0),HP||(r.capabilities.documentRangeFormattingProvider=!0),Ng&&(r.capabilities.workspace={workspaceFolders:{changeNotifications:!0,supported:!0}}),await pj(t.initializationOptions),r});var WP,HQ={tabSize:8,insertSpaces:!1,trimTrailingWhitespace:!0,insertFinalNewline:!0,wordWrapColumn:100},lj=t=>({tabSize:t?.["editor.tabSize"],insertSpaces:t?.["editor.insertSpaces"],trimFinalNewlines:t?.["files.trimFinalNewlines"],trimTrailingWhitespace:t?.["files.trimTrailingWhitespace"],insertFinalNewline:t?.["editor.insertFinalNewline"],wordWrapColumn:t?.["editor.wordWrapColumn"],removeMacroMultiline:t?.["editor.removeMacroMultiline"],wrapLongLines:t?.["editor.wrapLongLines"],indentExpressions:t?.["editor.indentExpressions"],removeEmptyReferences:t?.["editor.removeEmptyReferences"],removeEmptyNodes:t?.["editor.removeEmptyNodes"],removeEmptyRoots:t?.["editor.removeEmptyRoots"],sortNodesAndProperties:t?.["editor.sortNodesAndProperties"]});X.onInitialized(async()=>{if(jP&&await X.client.register(Re.SemanticTokensRegistrationType.type,{documentSelector:[{scheme:"file",language:"devicetree"}],legend:{tokenTypes:Wc,tokenModifiers:zc},full:!0}),UP&&await X.client.register(Re.DocumentFormattingRequest.type,{documentSelector:[{scheme:"file",language:"devicetree"}]}),HP&&await X.client.register(Re.DocumentRangeFormattingRequest.type,{documentSelector:[{scheme:"file",language:"devicetree"}]}),KP&&(X.client.register(Re.DidChangeConfigurationNotification.type,{}),!WP)){let t=await X.workspace.getConfiguration("editor").catch(()=>{}),e=await X.workspace.getConfiguration("files").catch(()=>{}),r=await X.workspace.getConfiguration("[devicetree]").catch(()=>{}),n=lj(r);(t||e||n)&&(WP={...t,...e,...n})}Ng&&X.workspace.onDidChangeWorkspaceFolders(async t=>{X.console.log("Workspace folder change event received"),await sd()})});X.onRequest("workspace/workspaceFolders",async()=>VP??null);var VQ=async t=>{let e=uj();return e={...Qs,...e},Zu(e,t??await id())},zP=async t=>{let e=GQ();return e={...Qs,...e},Zu(e,t??await id())},WQ=async t=>{let e=YQ();return e={...Qs,...e},Zu(e,t??await id())},nd=async t=>{let e=zQ();return e={...Qs,...e},Zu(e,t??await id())},id=async()=>Ng?await X.workspace.getWorkspaceFolders()??[]:[],rj=async t=>{let e=Er(xe,{id:Ki(t)});if(e)return e.ctxNames.includes(t.ctxName)||console.log(`(ID: ${e.id}) Adding name ${t.ctxName} for [${e.ctxNames.join(",")}]`),e.addCtxName(t.ctxName),e;let r=Ki(t);console.log(`(ID: ${r}) New context [${t.ctxName}]`),console.log(`(ID: ${r}) Settings: ${JSON.stringify(t,void 0," ")}`);let n=(0,Pc.join)((0,Pc.dirname)(t.dtsFile),"dts","bindings"),i=new bp(t,WP??HQ,t.bindingType?xB({zephyrBindings:t.zephyrBindings?[n,...t.zephyrBindings]:[n],deviceOrgBindingsMetaSchema:t.deviceOrgBindingsMetaSchema??[],deviceOrgTreeBindings:t.deviceOrgTreeBindings??[]},t.bindingType):void 0);xe.push(i);let s=performance.now();await i.stable(),console.log(`(ID: ${r}) New context took ${performance.now()-s}ms to start [${t.ctxName}]`),nj(i);let o=await eo(i);return X.sendNotification("devicetree/contextCreated",{ctxNames:i.ctxNames.map(a=>a.toString()),id:i.id,...i.getFileTree(),settings:i.settings,active:i===le,type:o.type}),await UQ(i),await ZP(),i},sd=async()=>{let t=await zP(),e=await nd();e.allowAdhocContexts||(e=await zP());let r=e.contexts.map(Ki),n=xe.filter(i=>!r.includes(i.id));await Promise.all(n.map(GP)),await t.contexts?.reduce((i,s)=>i.then(async()=>{await rj(s)}),Promise.resolve()),e.allowAdhocContexts&&await(await VQ()).contexts?.reduce((s,o)=>s.then(async()=>{Er(xe,{fsPath:o.dtsFile})||await rj(o)}),Promise.resolve()),setTimeout(async()=>{Zs?await Sr({fsPath:Zs}):!le&&xe.length&&(console.log(`No active context using first context (ID: ${xe[0].id}) [${xe[0].ctxNames.join(",")}]`),await Sr({id:xe[0].id}))})},hn,cs,td=new Map,_c=new Map,zQ=()=>!cs&&!hn?void 0:{...Object.fromEntries(Object.entries(cs??{}).filter(([,r])=>r!==void 0)),...hn,contexts:[...hn?.contexts??[],...Array.from(_c.values()),...Array.from(td.values())]},uj=()=>!cs&&!hn?void 0:{...cs,...hn,contexts:[...Array.from(td.values())]},GQ=()=>!cs&&!hn?void 0:{...cs,...hn,contexts:[...hn?.contexts??[],...Array.from(_c.values())]},YQ=()=>!cs&&!hn?void 0:{...hn,contexts:[...hn?.contexts??[]]};function KQ(t){let e={...t};for(let r in e)e[r]===null&&delete e[r];return e}var dj=async()=>{let t=await nd();console.log("Resolved settings",JSON.stringify(t,void 0," ")),X.sendNotification("devicetree/settingsChanged",t),await sd(),Me().then(()=>{oj&&X.languages.diagnostics.refresh()})},XQ=async()=>{let t=le?.getContextFiles();await Promise.all(Array.from(lr.keys()).filter(wt).map(async e=>{t?.some(r=>fe(r,Ne(e)))||await X.sendDiagnostics({uri:e,version:lr.get(e)?.version,diagnostics:[{severity:Re.DiagnosticSeverity.Information,range:Re.Range.create(Re.Position.create(0,0),Re.Position.create(0,0)),message:"File not in active context",source:"devicetree"}]})}))},XP=async t=>{let e=OT(xe,t);if(e.length)e.sort((r,n)=>r===le?-1:n===le?1:0).forEach(r=>{kg.get(r)?.abort.abort(),le===r&&X.sendNotification("devicetree/activeContextBusyNotification",r.id),X.sendNotification("devicetree/contextBusyNotification",r.id);let n=new AbortController,i=new Promise(s=>{setTimeout(async()=>{if(r.setStaleFsPath(t),n.signal.aborted){console.log("Abort parsing due to new request"),s();return}let o=performance.now(),a=le===r,c=a?fj(r):[],l=r.getContextFiles();if(await r.reevaluate(t),nj(r),l.forEach(p=>ed.get(p)?.unwatch()),a&&ek(r)?.length&&(JP(r).then(p=>{let m=p.items.map(h=>({uri:h.uri,version:h.version??void 0,diagnostics:h.items}));rd(r,c.filter(h=>m.every(y=>y.uri!==h.uri))),m.forEach(h=>{X.sendDiagnostics(h)}),ad.set(r,!0)}),Zs)){let p=r.getFsPathParser(Zs);p&&setTimeout(()=>{p.latestSemanticTokensBuilt||X.languages.semanticTokens.refresh()},50)}let u=await eo(r),d=r.getFileTree(),f={ctxNames:r.ctxNames.map(p=>p.toString()),id:r.id,...d,settings:r.settings,active:a,type:u.type};le===r&&X.sendNotification("devicetree/activeContextStableNotification",f),X.sendNotification("devicetree/contextStableNotification",f),s(),console.log("reevaluate",performance.now()-o)})});kg.set(r,{abort:n,promise:i})});else{if((await nd()).allowAdhocContexts===!1)return;await sd(),await Sr({fsPath:t})}},JQ=t=>lr.keys().find(e=>fe(Ne(e),t)),od=t=>{let e=JQ(t);if(e)return lr.get(e)},fj=t=>t.getContextFiles().map(e=>({uri:ue(e),version:od(e)?.version,diagnostics:[]})),ad=new WeakMap,rd=async(t,e=fj(t),r=!1)=>{if(!r&&t!==le)return;let n=performance.now();await Promise.all(e.filter(i=>t===le||!le?.getContextFiles().some(s=>fe(Ne(i.uri),s))).map(i=>X.sendDiagnostics({uri:i.uri,version:lr.get(i.uri)?.version,diagnostics:[]}))),ad.delete(t),console.log(`(ID: ${t.id})`,"clear workspace diagnostics",`[${t.ctxNames.join(",")}]`,performance.now()-n)},Pg=new Map,QQ=async t=>{let e=Pg.get(t);if(e||!KP)return e;Pg.delete(t);let r=await X.workspace.getConfiguration({scopeUri:ue(t),section:"[devicetree]"}).catch(()=>{});if(r){let n=lj(r);return Pg.set(t,n),n}},JP=async t=>{await t.stable();let e=performance.now(),r=await t.getDiagnostics(),n=await Promise.all(t.getContextFiles().map(async i=>{let s=od(i),o=[];if(s&&t.settings.showFormattingErrorAsDiagnostics){let a=await QQ(i);o.push(...(await Ai({textDocument:s,options:{...t.formattingOptions,...a}},s.getText(),"File Diagnostics").catch(()=>[])).map(c=>c.diagnostic()))}return{uri:ue(i),kind:Re.DocumentDiagnosticReportKind.Full,items:[...r.get(i)??[],...o],version:s?.version??null}}));return console.log(`(ID: ${t.id})`,"workspace diagnostics",`[${t.ctxNames.join(",")}]`,performance.now()-e),{items:[...n]}},QP=async t=>{let{items:e}=await JP(t);e.map(r=>({uri:r.uri,version:r.version??void 0,diagnostics:r.items})).forEach(async r=>{X.sendDiagnostics(r)}),ad.set(t,!0)},ZP=async()=>{let t=await Promise.all(xe.map(e=>eo(e)));console.log("======== Context List ========"),t.forEach(e=>{console.log(`(ID: ${e.ctx.id}) [${e.ctx.ctxNames.join(",")}]`,`[${e.type}]`,le===e.ctx?" [ACTIVE]":"")}),console.log("==============================")},eo=async(t,e)=>{let r=await YP(t,e),n=!r&&await BQ(t,e);return{ctx:t,type:r?"Ad Hoc":n?"User":"3rd Party"}},Sr=async(t,e=!1)=>{if("fsPath"in t){if(!wt(t.fsPath))return!1;Zs=t.fsPath,console.log("Active File Uri",Zs)}let r=await nd();if(le&&!e&&!r.autoChangeContext||(await Me(),!e&&le?.getContextFiles().find(o=>"fsPath"in t&&fe(o,t.fsPath))))return!1;let n=le,i=Er(xe,t),s=n!==i;return s&&(n&&rd(n),le=i,i?(eo(i).then(async o=>{let a=i.getFileTree();!i||i!==le&&!xe.includes(i)||X.sendNotification("devicetree/newActiveContext",{ctxNames:i.ctxNames.map(c=>c.toString()),id:i.id,...a,settings:i.settings,active:le===i,type:o.type})}),ek(i)?.length&&QP(i),await ZP()):X.sendNotification("devicetree/newActiveContext",void 0)),cj&&X.languages.foldingRange.refresh(),aj&&X.languages.semanticTokens.refresh(),s};lr.listen(X);var ek=t=>t?.getContextFiles()?.filter(e=>od(e));lr.onDidSave(t=>{Rg.set(Ne(t.document.uri),t.document.version)});lr.onDidClose(async t=>{let e=Ne(t.document.uri);if(!wt(e))return;Rg.delete(e);let r=OT(xe,e);if(r.length===0){td.delete(e),X.sendDiagnostics({uri:t.document.uri,version:lr.get(t.document.uri)?.version,diagnostics:[]});return}await Promise.all(r.map(async n=>{!!ek(n)?.filter(s=>s!==e).length?le?.getContextFiles().some(s=>fe(s,e))?le?.getContextFiles().some(s=>fe(s,e))&&(await rd(le),await QP(le)):X.sendDiagnostics({uri:t.document.uri,version:lr.get(t.document.uri)?.version,diagnostics:[]}):await YP(n)?(await GP(n),td.delete(n.settings.dtsFile)):rd(n)}))});lr.onDidOpen(async t=>{let e=Ne(t.document.uri);if(!wt(e))return;Rg.set(e,t.document.version),await Me(),XQ();let r=Er(xe,{fsPath:e});if(console.log("onDidOpen",r?.id,e),r)r!==le?await Sr({id:r.id}):r===le&&(!ad.get(r)||r.getContextFiles().some(n=>!fe(n,e)))&&await QP(r);else{let n={ctxName:(0,Pc.basename)(e),dtsFile:e};td.set(e,n),await XP(e)}});lr.onDidChangeContent(async t=>{let e=Ne(t.document.uri);if(!wt(e))return;let r=t.document.getText(),n=$r();n.needsRenew(e,r)&&(console.log("Content changed",e),n.renewLexer(e,r),await XP(e))});var pj=async t=>{t?.settings?.devicetree&&(hn=BB(KQ(t.settings.devicetree)),hn=Object.fromEntries(Object.entries(hn??{}).filter(([,e])=>e!==void 0)),console.log("Configuration changed",JSON.stringify(t,void 0," ")),await dj())};X.onDidChangeConfiguration(async t=>{await pj(t)});X.listen();X.languages.diagnostics.onWorkspace(async()=>{await Me();let t=le;return t?JP(t).finally(()=>{ad.set(t,!0)}):{items:[]}});X.onDidChangeWatchedFiles(t=>{X.console.log("We received a file change event")});X.onCompletion(async t=>{let e=Ne(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&le&&le.bindingLoader?.type==="Zephyr")return wA(t,le,lr.get(t.textDocument.uri));if(!wt(e))return[];await Me(),Sr({fsPath:e});let r=Wr(e);return r?[...await f0(t,r),...await oI(t,r)]:[]});X.onCompletionResolve(t=>t);var Wr=t=>{let e=uj();return Er(xe,{fsPath:t},le,e?.preferredContext)};X.onDocumentSymbol(async t=>{let e=Ne(t.textDocument.uri);if(!wt(e))return null;await Me();let r=Wr(e);return r?r.getFsPathParser(e)?.getDocumentSymbols(e):[]});X.onWorkspaceSymbol(async()=>{await Me();let t=le;return t?(await t.getAllStableParsers()).flatMap(e=>e.getWorkspaceSymbols()):[]});X.languages.semanticTokens.on(async t=>{let e=Ne(t.textDocument.uri);if(!wt(e))return{data:[]};try{await Me();let r=Wr(e),n=new Re.SemanticTokensBuilder,i=r?.isInContext(e);return!r||!i?{data:[]}:((await r.getAllStableParsers()).forEach(s=>s.buildSemanticTokens(n,e)),n.build())}catch(r){throw console.log(r),r}});X.onDocumentLinks(async t=>{await Me();let e=Ne(t.textDocument.uri);return wt(e)?Wr(e)?.getDocumentLinks(e):e.endsWith(".yaml")&&le?le.bindingLoader?.getDocumentLinks?.(lr.get(t.textDocument.uri))??[]:null});X.onPrepareRename(async t=>{let e=Ne(t.textDocument.uri);if(!wt(e))return;await Me(),Sr({fsPath:e});let r=Wr(e);return xA(t,r)});X.onRenameRequest(async t=>{let e=Ne(t.textDocument.uri);if(!wt(e))return;await Me(),Sr({fsPath:e});let r=Wr(e);return OA(t,r)});X.onReferences(async t=>{let e=Ne(t.textDocument.uri);if(!wt(e))return;await Me(),Sr({fsPath:e});let r=Wr(e);return DA(t,r)});X.onDefinition(async t=>{let e=Ne(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&le&&le.bindingLoader?.type==="Zephyr")return qA(t,le,lr.get(t.textDocument.uri));if(!wt(e))return;await Me(),Sr({fsPath:e});let r=Wr(e),n=(await r?.getDocumentLinks(e,t.position))?.filter(i=>i.target).map(i=>Re.Location.create(i.target,i.range))??[];return n.length?n:LA(t,r)});X.onDeclaration(async t=>{let e=Ne(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&le&&le.bindingLoader?.type==="Zephyr")return jA(t,le,lr.get(t.textDocument.uri));if(!wt(e))return;await Me(),Sr({fsPath:e});let r=Wr(e);return BA(t,r)});X.onCodeAction(async t=>{let e=Ne(t.textDocument.uri);if(wt(e))return HA(t)});var hj=async t=>{if(!wt(t.textDocument.uri))return;let e=Ne(t.textDocument.uri);if(!wt(e))return;await Me(),Sr({fsPath:e});let r=Wr(e);if(!r)return[];if((await r.getSyntaxIssues(void 0,l=>ho(l.raw,e,!1)?l:void 0)).get(e)?.length)return[];let i=lr.get(t.textDocument.uri)??$r().getDocument(e),s=i.getText();Pg.set(e,t.options);let o=await Ai({...t,options:{...r.formattingOptions,...t.options}},s,"New Text").catch(()=>s);if(o===s)return[];let a=i.lineCount-1,c=i.getText({start:{line:a,character:0},end:{line:a+1,character:0}}).length;return[Re.TextEdit.replace(Re.Range.create(Re.Position.create(0,0),Re.Position.create(i.lineCount,c)),o)]};X.onDocumentRangeFormatting(hj);X.onDocumentFormatting(hj);X.onHover(async t=>{let e=Ne(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&le&&le.bindingLoader?.type==="Zephyr")return Dx(t,le,lr.get(t.textDocument.uri));if(!wt(e))return;await Me();let r=Wr(e);return(await aI(t,r)).at(0)});X.onFoldingRanges(async t=>{let e=Ne(t.textDocument.uri);if(!wt(e))return;await Me();let r=Wr(e),n=r?.isInContext(e);if(!r||!n)return[];let i=(await r.getAllStableParsers()).find(s=>s.getFiles().some(o=>o===e));return i?MB(e,i):[]});X.onTypeDefinition(async t=>{let e=Ne(t.textDocument.uri);if(!wt(e))return;await Me(),Sr({fsPath:e});let r=Wr(e);return FB(t,r)});X.onSignatureHelp(async t=>{let e=Ne(t.textDocument.uri);if(!wt(e))return;await Me(),Sr({fsPath:e});let r=Wr(e);return GB(t,r)});X.onRequest("devicetree/getContexts",async()=>(await Me(),Promise.all(xe.map(async t=>{let e=await eo(t);return{ctxNames:t.ctxNames.map(r=>r.toString()),id:t.id,...t.getFileTree(),settings:t.settings,active:le===t,type:e.type}}))));X.onRequest("devicetree/setActive",async t=>(await Me(),console.log("devicetree/setActive",t),await Sr(t,!0)));X.onRequest("devicetree/getActiveContext",async()=>{if(await Me(),console.log("devicetree/getActiveContext"),!le)return;let t=await eo(le);return le?{ctxNames:le.ctxNames.map(e=>e.toString()),id:le.id,...le.getFileTree(),settings:le.settings,active:!0,type:t.type}:void 0});X.onRequest("devicetree/setDefaultSettings",async t=>{await Me(),cs=Object.fromEntries(Object.entries(t??{}).filter(([,e])=>e!==void 0)),console.log("Integration Settings",cs),await dj()});X.onRequest("devicetree/requestContext",async t=>{await Me();let e=await id(),r=await nd(e),n=await $P(t,r,e);if(!n)throw console.log("Failed to resolve context",t),new Error("Failed to resolve context");console.log("devicetree/requestContext",n);let i=Ki(n),s=Array.from(_c).find(([,c])=>c.ctxName===t.ctxName);if(s){let c=s[0].split(":",1)[0];Er(xe,{name:n.ctxName.toString()})?.removeCtxName(n.ctxName),console.log(`Removing integration context with ID ${c} and name ${t.ctxName}`),_c.delete(s[0])}_c.set(`${i}:${t.ctxName}`,t),await sd();let o=xe.find(c=>c.id===i);if(!o)throw new Error("Failed to create context");let a=await eo(o,e);return{ctxNames:o.ctxNames.map(c=>c.toString()),id:i,...o.getFileTree(),settings:o.settings,active:!0,type:a.type}});X.onRequest("devicetree/removeContext",async({id:t,name:e})=>{await Me(),_c.delete(`${t}:${e}`);let r=Er(xe,{id:t});if(r){if(r.removeCtxName(e),r.ctxNames.length){console.log("Context will not be deleted as it is still in use by others");return}await sd()}});X.onRequest("devicetree/compiledDtsOutput",async t=>{if(await Me(),!t)return;let e=Er(xe,{id:t});if(!e||!e.settings.dtsFile){console.log("Context or DTS file not found for ID",t);return}let r=await e.toFullString();return Ai({textDocument:{uri:ue(e.settings.dtsFile)},options:e.formattingOptions},r,"New Text").catch(()=>r)});X.onRequest("devicetree/serializedContext",async t=>{if(await Me(),!t)return;let e=Er(xe,{id:t}),r=performance.now();return e?.serialize().finally(()=>{console.info("serializedContext",performance.now()-r)})});X.onRequest("devicetree/activePath",async t=>{if(await Me(),!le)return;let e=r=>{if(r?.item)return r.item instanceof J?{nodePath:r.item.pathString}:{nodePath:r.item.parent.pathString,propertyName:r.item.name}};return(await Et(t,le,r=>[e(r)])).at(0)});X.onRequest("devicetree/customActions",async t=>(await Me(),WB(t,le)));X.onRequest("devicetree/activeFsPath",async t=>{await Me(),Sr({fsPath:t})});X.onRequest("devicetree/formattingText",async t=>{let e=Ne(t.textDocument.uri),r=od(e)??$r().getDocument(e,t.text),n=await Ai(t,r.getText(),"New Text");return{text:n,diagnostics:(await Ai(t,r.getText(),"File Diagnostics")).map(i=>i.diagnostic()),nonActionableDiagnostics:(await Ai(t,n,"File Diagnostics")).map(i=>i.diagnostic())}});X.onRequest("devicetree/formatTextEdits",async t=>{await Me();let e=$r().getDocument(Ne(t.textDocument.uri),t.text),r=e.positionAt(e.getText().length),n=Re.TextEdit.replace(Re.Range.create(Re.Position.create(0,0),r),""),i=MT(e,t.edits),s=await Ai({...t},i,"New Text").catch(()=>i);return n.newText=s,n});X.onRequest("devicetree/diagnosticIssues",async({uri:t,full:e})=>{await Me();let r=Ne(t);Sr({fsPath:r});let n=Wr(r);if(!n)return[];let i=e?(await n.getDiagnostics()).get(r):(await n.getSyntaxIssues(void 0,s=>ho(s.raw,r,!!e)?s:void 0)).get(r);if(i?.length)return i});X.onRequest("devicetree/evalMacros",async({macros:t,ctxId:e})=>{await Me();let r=Er(xe,{id:e});return r?t.map(n=>{let i=Gc(n,r.macros),s=Le(i);return{macro:n,evaluated:typeof s=="number"?s:i}}):[]});X.onRequest("devicetree/memoryViews",async({ctxId:t})=>{let e=Er(xe,{id:t});if(!e)return;await e?.stable();let r=await e.getRuntime(),n=r.rootNode.getMemoryViews(r.context.macros).sort((o,a)=>{let c=qt(o.start,a.start);return c===0?qt(a.size,o.size):c}),i=new Map;n.forEach(o=>{let a=i.get(o.name),c={nodePath:o.nodePath,labels:o.labels,start:o.start,size:o.size,disabled:o.disabled};a?a.partitions.push(c):i.set(o.name,{name:o.name,partitions:[c],path:o.nodePath})});let s=ej(Array.from(i.values()));return{trees:s,treeStr:tj(s)}});X.onRequest("devicetree/zephyrTypeBindings",async t=>{if(await Me(),!t)return;let e=Er(xe,{id:t});return e?.bindingLoader?.getZephyrContextBinding()?.map(r=>({...r,vendor:r.compatible&&e?.bindingLoader?.getBindingVendorString(r.compatible)}))});X.onRequest("devicetree/contextMacroNames",async t=>{if(await Me(),!t)return;let e=Er(xe,{id:t});return Array.from(e?.macros.keys()??[])});X.onRequest("devicetree/locationScopedInformation",async t=>{await Me();let e=Er(xe,{id:t.id}),r=Ne(t.textDocument.uri);if(!(!e||!e.isInContext(r)))return new Promise(async n=>{let i=await e.getRuntime(),s=await Et(t,e,(o,a)=>{let c=i.context.macros,l={};if(!o?.item)return i.rootNode.serialize(l,c,a),[{inNode:!1,inScope:l,parentNode:i.rootNode.pathString}];let u=null;return o.item instanceof J?u=o.item:u=o.item?.parent,u.serialize(l,i.context.macros,a),[{inNode:!0,inScope:l,parentNode:u.pathString}]});n(s[0])})});