devicetree-language-server 0.7.3 → 0.7.5
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/THIRD_PARTY_LICENSES.txt +1 -1
- package/dist/server.js +141 -141
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var xB=Object.create;var Hm=Object.defineProperty;var LB=Object.getOwnPropertyDescriptor;var qB=Object.getOwnPropertyNames;var $B=Object.getPrototypeOf,BB=Object.prototype.hasOwnProperty;var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),FB=(t,e)=>{for(var r in e)Hm(t,r,{get:e[r],enumerable:!0})},jB=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of qB(e))!BB.call(t,i)&&i!==r&&Hm(t,i,{get:()=>e[i],enumerable:!(n=LB(e,i))||n.enumerable});return t};var $=(t,e,r)=>(r=t!=null?xB($B(t)):{},jB(e||!t||!t.__esModule?Hm(r,"default",{value:t,enumerable:!0}):r,t));var Ku=R(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.thenable=Lt.typedArray=Lt.stringArray=Lt.array=Lt.func=Lt.error=Lt.number=Lt.string=Lt.boolean=void 0;function UB(t){return t===!0||t===!1}Lt.boolean=UB;function nk(t){return typeof t=="string"||t instanceof String}Lt.string=nk;function HB(t){return typeof t=="number"||t instanceof Number}Lt.number=HB;function VB(t){return t instanceof Error}Lt.error=VB;function ik(t){return typeof t=="function"}Lt.func=ik;function sk(t){return Array.isArray(t)}Lt.array=sk;function zB(t){return sk(t)&&t.every(e=>nk(e))}Lt.stringArray=zB;function WB(t,e){return Array.isArray(t)&&t.every(e)}Lt.typedArray=WB;function GB(t){return t&&ik(t.then)}Lt.thenable=GB});var wo=R(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.stringArray=ar.array=ar.func=ar.error=ar.number=ar.string=ar.boolean=void 0;function KB(t){return t===!0||t===!1}ar.boolean=KB;function ok(t){return typeof t=="string"||t instanceof String}ar.string=ok;function YB(t){return typeof t=="number"||t instanceof Number}ar.number=YB;function XB(t){return t instanceof Error}ar.error=XB;function JB(t){return typeof t=="function"}ar.func=JB;function ak(t){return Array.isArray(t)}ar.array=ak;function QB(t){return ak(t)&&t.every(e=>ok(e))}ar.stringArray=QB});var hg=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 Fs=wo(),Vm;(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})(Vm||(ae.ErrorCodes=Vm={}));var zm=class t extends Error{constructor(e,r,n){super(r),this.code=Fs.number(e)?e:Vm.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=zm;var Er=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=Er;Er.auto=new Er("auto");Er.byPosition=new Er("byPosition");Er.byName=new Er("byName");var mt=class{constructor(e,r){this.method=e,this.numberOfParams=r}get parameterStructures(){return Er.auto}};ae.AbstractMessageSignature=mt;var Wm=class extends mt{constructor(e){super(e,0)}};ae.RequestType0=Wm;var Gm=class extends mt{constructor(e,r=Er.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ae.RequestType=Gm;var Km=class extends mt{constructor(e,r=Er.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ae.RequestType1=Km;var Ym=class extends mt{constructor(e){super(e,2)}};ae.RequestType2=Ym;var Xm=class extends mt{constructor(e){super(e,3)}};ae.RequestType3=Xm;var Jm=class extends mt{constructor(e){super(e,4)}};ae.RequestType4=Jm;var Qm=class extends mt{constructor(e){super(e,5)}};ae.RequestType5=Qm;var Zm=class extends mt{constructor(e){super(e,6)}};ae.RequestType6=Zm;var eg=class extends mt{constructor(e){super(e,7)}};ae.RequestType7=eg;var tg=class extends mt{constructor(e){super(e,8)}};ae.RequestType8=tg;var rg=class extends mt{constructor(e){super(e,9)}};ae.RequestType9=rg;var ng=class extends mt{constructor(e,r=Er.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ae.NotificationType=ng;var ig=class extends mt{constructor(e){super(e,0)}};ae.NotificationType0=ig;var sg=class extends mt{constructor(e,r=Er.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ae.NotificationType1=sg;var og=class extends mt{constructor(e){super(e,2)}};ae.NotificationType2=og;var ag=class extends mt{constructor(e){super(e,3)}};ae.NotificationType3=ag;var cg=class extends mt{constructor(e){super(e,4)}};ae.NotificationType4=cg;var lg=class extends mt{constructor(e){super(e,5)}};ae.NotificationType5=lg;var ug=class extends mt{constructor(e){super(e,6)}};ae.NotificationType6=ug;var dg=class extends mt{constructor(e){super(e,7)}};ae.NotificationType7=dg;var fg=class extends mt{constructor(e){super(e,8)}};ae.NotificationType8=fg;var pg=class extends mt{constructor(e){super(e,9)}};ae.NotificationType9=pg;var ck;(function(t){function e(i){let s=i;return s&&Fs.string(s.method)&&(Fs.string(s.id)||Fs.number(s.id))}t.isRequest=e;function r(i){let s=i;return s&&Fs.string(s.method)&&i.id===void 0}t.isNotification=r;function n(i){let s=i;return s&&(s.result!==void 0||!!s.error)&&(Fs.string(s.id)||Fs.number(s.id)||s.id===null)}t.isResponse=n})(ck||(ae.Message=ck={}))});var gg=R(Gi=>{"use strict";var lk;Object.defineProperty(Gi,"__esModule",{value:!0});Gi.LRUCache=Gi.LinkedMap=Gi.Touch=void 0;var cr;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(cr||(Gi.Touch=cr={}));var Yu=class{constructor(){this[lk]="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=cr.None){let n=this._map.get(e);if(n)return r!==cr.None&&this.touch(n,r),n.value}set(e,r,n=cr.None){let i=this._map.get(e);if(i)i.value=r,n!==cr.None&&this.touch(i,n);else{switch(i={key:e,value:r,next:void 0,previous:void 0},n){case cr.None:this.addItemLast(i);break;case cr.First:this.addItemFirst(i);break;case cr.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}[(lk=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!==cr.First&&r!==cr.Last)){if(r===cr.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===cr.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)}};Gi.LinkedMap=Yu;var mg=class extends Yu{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=cr.AsNew){return super.get(e,r)}peek(e){return super.get(e,cr.None)}set(e,r){return super.set(e,r,cr.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};Gi.LRUCache=mg});var dk=R(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.Disposable=void 0;var uk;(function(t){function e(r){return{dispose:r}}t.create=e})(uk||(Xu.Disposable=uk={}))});var Ki=R(vg=>{"use strict";Object.defineProperty(vg,"__esModule",{value:!0});var yg;function Tg(){if(yg===void 0)throw new Error("No runtime abstraction layer installed");return yg}(function(t){function e(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");yg=r}t.install=e})(Tg||(Tg={}));vg.default=Tg});var Co=R(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.Emitter=Eo.Event=void 0;var ZB=Ki(),fk;(function(t){let e={dispose(){}};t.None=function(){return e}})(fk||(Eo.Event=fk={}));var bg=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,ZB.default)().console.error(a)}return r}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},Ju=class t{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,r,n)=>{this._callbacks||(this._callbacks=new bg),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)}};Eo.Emitter=Ju;Ju._noop=function(){}});var ed=R(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.CancellationTokenSource=Do.CancellationToken=void 0;var eF=Ki(),tF=wo(),Sg=Co(),Qu;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Sg.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Sg.Event.None});function e(r){let n=r;return n&&(n===t.None||n===t.Cancelled||tF.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}t.is=e})(Qu||(Do.CancellationToken=Qu={}));var rF=Object.freeze(function(t,e){let r=(0,eF.default)().timer.setTimeout(t.bind(e),0);return{dispose(){r.dispose()}}}),Zu=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?rF:(this._emitter||(this._emitter=new Sg.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},_g=class{get token(){return this._token||(this._token=new Zu),this._token}cancel(){this._token?this._token.cancel():this._token=Qu.Cancelled}dispose(){this._token?this._token instanceof Zu&&this._token.dispose():this._token=Qu.None}};Do.CancellationTokenSource=_g});var pk=R(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.SharedArrayReceiverStrategy=Ao.SharedArraySenderStrategy=void 0;var nF=ed(),cc;(function(t){t.Continue=0,t.Cancelled=1})(cc||(cc={}));var kg=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()}};Ao.SharedArraySenderStrategy=kg;var Ng=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")}},Rg=class{constructor(e){this.token=new Ng(e)}cancel(){}dispose(){}},Pg=class{constructor(){this.kind="request"}createCancellationTokenSource(e){let r=e.$cancellationData;return r===void 0?new nF.CancellationTokenSource:new Rg(r)}};Ao.SharedArrayReceiverStrategy=Pg});var Eg=R(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});td.Semaphore=void 0;var iF=Ki(),wg=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,iF.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()}}};td.Semaphore=wg});var mk=R(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.ReadableStreamMessageReader=Yi.AbstractMessageReader=Yi.MessageReader=void 0;var Dg=Ki(),Io=wo(),Cg=Co(),sF=Eg(),hk;(function(t){function e(r){let n=r;return n&&Io.func(n.listen)&&Io.func(n.dispose)&&Io.func(n.onError)&&Io.func(n.onClose)&&Io.func(n.onPartialMessage)}t.is=e})(hk||(Yi.MessageReader=hk={}));var rd=class{constructor(){this.errorEmitter=new Cg.Emitter,this.closeEmitter=new Cg.Emitter,this.partialMessageEmitter=new Cg.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: ${Io.string(e.message)?e.message:"unknown"}`)}};Yi.AbstractMessageReader=rd;var Ag;(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,Dg.default)().applicationJson.decoder,c.set(a.name,a)),{charset:n,contentDecoder:s,contentDecoders:o,contentTypeDecoder:a,contentTypeDecoders:c}}t.fromOptions=e})(Ag||(Ag={}));var Ig=class extends rd{constructor(e,r){super(),this.readable=e,this.options=Ag.fromOptions(r),this.buffer=(0,Dg.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new sF.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,
|
|
4
|
-
`,
|
|
5
|
-
`,
|
|
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}};
|
|
7
|
-
${JSON.stringify(P.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.");else{let L=P.id,
|
|
8
|
-
${JSON.stringify(P,null,4)}`);let L=P;if(kt.string(L.id)||kt.number(L.id)){let
|
|
2
|
+
"use strict";var $B=Object.create;var Xm=Object.defineProperty;var BB=Object.getOwnPropertyDescriptor;var FB=Object.getOwnPropertyNames;var jB=Object.getPrototypeOf,UB=Object.prototype.hasOwnProperty;var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),HB=(t,e)=>{for(var r in e)Xm(t,r,{get:e[r],enumerable:!0})},VB=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of FB(e))!UB.call(t,i)&&i!==r&&Xm(t,i,{get:()=>e[i],enumerable:!(n=BB(e,i))||n.enumerable});return t};var $=(t,e,r)=>(r=t!=null?$B(jB(t)):{},VB(e||!t||!t.__esModule?Xm(r,"default",{value:t,enumerable:!0}):r,t));var Ju=R(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.thenable=qt.typedArray=qt.stringArray=qt.array=qt.func=qt.error=qt.number=qt.string=qt.boolean=void 0;function zB(t){return t===!0||t===!1}qt.boolean=zB;function ck(t){return typeof t=="string"||t instanceof String}qt.string=ck;function WB(t){return typeof t=="number"||t instanceof Number}qt.number=WB;function GB(t){return t instanceof Error}qt.error=GB;function lk(t){return typeof t=="function"}qt.func=lk;function uk(t){return Array.isArray(t)}qt.array=uk;function KB(t){return uk(t)&&t.every(e=>ck(e))}qt.stringArray=KB;function YB(t,e){return Array.isArray(t)&&t.every(e)}qt.typedArray=YB;function XB(t){return t&&lk(t.then)}qt.thenable=XB});var Ao=R(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.stringArray=cr.array=cr.func=cr.error=cr.number=cr.string=cr.boolean=void 0;function JB(t){return t===!0||t===!1}cr.boolean=JB;function dk(t){return typeof t=="string"||t instanceof String}cr.string=dk;function QB(t){return typeof t=="number"||t instanceof Number}cr.number=QB;function ZB(t){return t instanceof Error}cr.error=ZB;function eF(t){return typeof t=="function"}cr.func=eF;function fk(t){return Array.isArray(t)}cr.array=fk;function tF(t){return fk(t)&&t.every(e=>dk(e))}cr.stringArray=tF});var Sg=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 Us=Ao(),Jm;(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})(Jm||(ae.ErrorCodes=Jm={}));var Qm=class t extends Error{constructor(e,r,n){super(r),this.code=Us.number(e)?e:Jm.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=Qm;var Dr=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=Dr;Dr.auto=new Dr("auto");Dr.byPosition=new Dr("byPosition");Dr.byName=new Dr("byName");var mt=class{constructor(e,r){this.method=e,this.numberOfParams=r}get parameterStructures(){return Dr.auto}};ae.AbstractMessageSignature=mt;var Zm=class extends mt{constructor(e){super(e,0)}};ae.RequestType0=Zm;var eg=class extends mt{constructor(e,r=Dr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ae.RequestType=eg;var tg=class extends mt{constructor(e,r=Dr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ae.RequestType1=tg;var rg=class extends mt{constructor(e){super(e,2)}};ae.RequestType2=rg;var ng=class extends mt{constructor(e){super(e,3)}};ae.RequestType3=ng;var ig=class extends mt{constructor(e){super(e,4)}};ae.RequestType4=ig;var sg=class extends mt{constructor(e){super(e,5)}};ae.RequestType5=sg;var og=class extends mt{constructor(e){super(e,6)}};ae.RequestType6=og;var ag=class extends mt{constructor(e){super(e,7)}};ae.RequestType7=ag;var cg=class extends mt{constructor(e){super(e,8)}};ae.RequestType8=cg;var lg=class extends mt{constructor(e){super(e,9)}};ae.RequestType9=lg;var ug=class extends mt{constructor(e,r=Dr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ae.NotificationType=ug;var dg=class extends mt{constructor(e){super(e,0)}};ae.NotificationType0=dg;var fg=class extends mt{constructor(e,r=Dr.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ae.NotificationType1=fg;var pg=class extends mt{constructor(e){super(e,2)}};ae.NotificationType2=pg;var hg=class extends mt{constructor(e){super(e,3)}};ae.NotificationType3=hg;var mg=class extends mt{constructor(e){super(e,4)}};ae.NotificationType4=mg;var gg=class extends mt{constructor(e){super(e,5)}};ae.NotificationType5=gg;var yg=class extends mt{constructor(e){super(e,6)}};ae.NotificationType6=yg;var Tg=class extends mt{constructor(e){super(e,7)}};ae.NotificationType7=Tg;var vg=class extends mt{constructor(e){super(e,8)}};ae.NotificationType8=vg;var bg=class extends mt{constructor(e){super(e,9)}};ae.NotificationType9=bg;var pk;(function(t){function e(i){let s=i;return s&&Us.string(s.method)&&(Us.string(s.id)||Us.number(s.id))}t.isRequest=e;function r(i){let s=i;return s&&Us.string(s.method)&&i.id===void 0}t.isNotification=r;function n(i){let s=i;return s&&(s.result!==void 0||!!s.error)&&(Us.string(s.id)||Us.number(s.id)||s.id===null)}t.isResponse=n})(pk||(ae.Message=pk={}))});var kg=R(Yi=>{"use strict";var hk;Object.defineProperty(Yi,"__esModule",{value:!0});Yi.LRUCache=Yi.LinkedMap=Yi.Touch=void 0;var lr;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(lr||(Yi.Touch=lr={}));var Qu=class{constructor(){this[hk]="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=lr.None){let n=this._map.get(e);if(n)return r!==lr.None&&this.touch(n,r),n.value}set(e,r,n=lr.None){let i=this._map.get(e);if(i)i.value=r,n!==lr.None&&this.touch(i,n);else{switch(i={key:e,value:r,next:void 0,previous:void 0},n){case lr.None:this.addItemLast(i);break;case lr.First:this.addItemFirst(i);break;case lr.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}[(hk=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!==lr.First&&r!==lr.Last)){if(r===lr.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===lr.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)}};Yi.LinkedMap=Qu;var _g=class extends Qu{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=lr.AsNew){return super.get(e,r)}peek(e){return super.get(e,lr.None)}set(e,r){return super.set(e,r,lr.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};Yi.LRUCache=_g});var gk=R(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.Disposable=void 0;var mk;(function(t){function e(r){return{dispose:r}}t.create=e})(mk||(Zu.Disposable=mk={}))});var Xi=R(Pg=>{"use strict";Object.defineProperty(Pg,"__esModule",{value:!0});var Ng;function Rg(){if(Ng===void 0)throw new Error("No runtime abstraction layer installed");return Ng}(function(t){function e(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");Ng=r}t.install=e})(Rg||(Rg={}));Pg.default=Rg});var Oo=R(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.Emitter=Io.Event=void 0;var rF=Xi(),yk;(function(t){let e={dispose(){}};t.None=function(){return e}})(yk||(Io.Event=yk={}));var wg=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,rF.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 wg),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)}};Io.Emitter=ed;ed._noop=function(){}});var nd=R(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.CancellationTokenSource=Mo.CancellationToken=void 0;var nF=Xi(),iF=Ao(),Eg=Oo(),td;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Eg.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Eg.Event.None});function e(r){let n=r;return n&&(n===t.None||n===t.Cancelled||iF.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}t.is=e})(td||(Mo.CancellationToken=td={}));var sF=Object.freeze(function(t,e){let r=(0,nF.default)().timer.setTimeout(t.bind(e),0);return{dispose(){r.dispose()}}}),rd=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?sF:(this._emitter||(this._emitter=new Eg.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},Cg=class{get token(){return this._token||(this._token=new rd),this._token}cancel(){this._token?this._token.cancel():this._token=td.Cancelled}dispose(){this._token?this._token instanceof rd&&this._token.dispose():this._token=td.None}};Mo.CancellationTokenSource=Cg});var Tk=R(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.SharedArrayReceiverStrategy=xo.SharedArraySenderStrategy=void 0;var oF=nd(),dc;(function(t){t.Continue=0,t.Cancelled=1})(dc||(dc={}));var Dg=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]=dc.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,dc.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};xo.SharedArraySenderStrategy=Dg;var Ag=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===dc.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},Ig=class{constructor(e){this.token=new Ag(e)}cancel(){}dispose(){}},Og=class{constructor(){this.kind="request"}createCancellationTokenSource(e){let r=e.$cancellationData;return r===void 0?new oF.CancellationTokenSource:new Ig(r)}};xo.SharedArrayReceiverStrategy=Og});var xg=R(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});id.Semaphore=void 0;var aF=Xi(),Mg=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,aF.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()}}};id.Semaphore=Mg});var bk=R(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.ReadableStreamMessageReader=Ji.AbstractMessageReader=Ji.MessageReader=void 0;var qg=Xi(),Lo=Ao(),Lg=Oo(),cF=xg(),vk;(function(t){function e(r){let n=r;return n&&Lo.func(n.listen)&&Lo.func(n.dispose)&&Lo.func(n.onError)&&Lo.func(n.onClose)&&Lo.func(n.onPartialMessage)}t.is=e})(vk||(Ji.MessageReader=vk={}));var sd=class{constructor(){this.errorEmitter=new Lg.Emitter,this.closeEmitter=new Lg.Emitter,this.partialMessageEmitter=new Lg.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: ${Lo.string(e.message)?e.message:"unknown"}`)}};Ji.AbstractMessageReader=sd;var $g;(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,qg.default)().applicationJson.decoder,c.set(a.name,a)),{charset:n,contentDecoder:s,contentDecoders:o,contentTypeDecoder:a,contentTypeDecoders:c}}t.fromOptions=e})($g||($g={}));var Bg=class extends sd{constructor(e,r){super(),this.readable=e,this.options=$g.fromOptions(r),this.buffer=(0,qg.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new cF.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,qg.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))}};Ji.ReadableStreamMessageReader=Bg});var Rk=R(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Qi.WriteableStreamMessageWriter=Qi.AbstractMessageWriter=Qi.MessageWriter=void 0;var Sk=Xi(),fc=Ao(),lF=xg(),_k=Oo(),uF="Content-Length: ",kk=`\r
|
|
4
|
+
`,Nk;(function(t){function e(r){let n=r;return n&&fc.func(n.dispose)&&fc.func(n.onClose)&&fc.func(n.onError)&&fc.func(n.write)}t.is=e})(Nk||(Qi.MessageWriter=Nk={}));var od=class{constructor(){this.errorEmitter=new _k.Emitter,this.closeEmitter=new _k.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: ${fc.string(e.message)?e.message:"unknown"}`)}};Qi.AbstractMessageWriter=od;var Fg;(function(t){function e(r){return r===void 0||typeof r=="string"?{charset:r??"utf-8",contentTypeEncoder:(0,Sk.default)().applicationJson.encoder}:{charset:r.charset??"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:r.contentTypeEncoder??(0,Sk.default)().applicationJson.encoder}}t.fromOptions=e})(Fg||(Fg={}));var jg=class extends od{constructor(e,r){super(),this.writable=e,this.options=Fg.fromOptions(r),this.errorCount=0,this.writeSemaphore=new lF.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(uF,n.byteLength.toString(),kk),i.push(kk),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()}};Qi.WriteableStreamMessageWriter=jg});var Pk=R(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.AbstractMessageBuffer=void 0;var dF=13,fF=10,pF=`\r
|
|
5
|
+
`,Ug=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 dF:switch(r){case 0:r=1;break;case 2:r=3;break;default:r=0}break;case fF: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(pF);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}};ad.AbstractMessageBuffer=Ug});var Ak=R(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.createMessageConnection=ye.ConnectionOptions=ye.MessageStrategy=ye.CancellationStrategy=ye.CancellationSenderStrategy=ye.CancellationReceiverStrategy=ye.RequestCancellationReceiverStrategy=ye.IdCancellationReceiverStrategy=ye.ConnectionStrategy=ye.ConnectionError=ye.ConnectionErrors=ye.LogTraceNotification=ye.SetTraceNotification=ye.TraceFormat=ye.TraceValues=ye.Trace=ye.NullLogger=ye.ProgressType=ye.ProgressToken=void 0;var wk=Xi(),kt=Ao(),de=Sg(),Ek=kg(),pc=Oo(),Hg=nd(),gc;(function(t){t.type=new de.NotificationType("$/cancelRequest")})(gc||(gc={}));var Vg;(function(t){function e(r){return typeof r=="string"||typeof r=="number"}t.is=e})(Vg||(ye.ProgressToken=Vg={}));var hc;(function(t){t.type=new de.NotificationType("$/progress")})(hc||(hc={}));var zg=class{constructor(){}};ye.ProgressType=zg;var Wg;(function(t){function e(r){return kt.func(r)}t.is=e})(Wg||(Wg={}));ye.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var ze;(function(t){t[t.Off=0]="Off",t[t.Messages=1]="Messages",t[t.Compact=2]="Compact",t[t.Verbose=3]="Verbose"})(ze||(ye.Trace=ze={}));var Ck;(function(t){t.Off="off",t.Messages="messages",t.Compact="compact",t.Verbose="verbose"})(Ck||(ye.TraceValues=Ck={}));(function(t){function e(n){if(!kt.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})(ze||(ye.Trace=ze={}));var Gr;(function(t){t.Text="text",t.JSON="json"})(Gr||(ye.TraceFormat=Gr={}));(function(t){function e(r){return kt.string(r)?(r=r.toLowerCase(),r==="json"?t.JSON:t.Text):t.Text}t.fromString=e})(Gr||(ye.TraceFormat=Gr={}));var Gg;(function(t){t.type=new de.NotificationType("$/setTrace")})(Gg||(ye.SetTraceNotification=Gg={}));var cd;(function(t){t.type=new de.NotificationType("$/logTrace")})(cd||(ye.LogTraceNotification=cd={}));var mc;(function(t){t[t.Closed=1]="Closed",t[t.Disposed=2]="Disposed",t[t.AlreadyListening=3]="AlreadyListening"})(mc||(ye.ConnectionErrors=mc={}));var qo=class t extends Error{constructor(e,r){super(r),this.code=e,Object.setPrototypeOf(this,t.prototype)}};ye.ConnectionError=qo;var Kg;(function(t){function e(r){let n=r;return n&&kt.func(n.cancelUndispatched)}t.is=e})(Kg||(ye.ConnectionStrategy=Kg={}));var ld;(function(t){function e(r){let n=r;return n&&(n.kind===void 0||n.kind==="id")&&kt.func(n.createCancellationTokenSource)&&(n.dispose===void 0||kt.func(n.dispose))}t.is=e})(ld||(ye.IdCancellationReceiverStrategy=ld={}));var Yg;(function(t){function e(r){let n=r;return n&&n.kind==="request"&&kt.func(n.createCancellationTokenSource)&&(n.dispose===void 0||kt.func(n.dispose))}t.is=e})(Yg||(ye.RequestCancellationReceiverStrategy=Yg={}));var ud;(function(t){t.Message=Object.freeze({createCancellationTokenSource(r){return new Hg.CancellationTokenSource}});function e(r){return ld.is(r)||Yg.is(r)}t.is=e})(ud||(ye.CancellationReceiverStrategy=ud={}));var dd;(function(t){t.Message=Object.freeze({sendCancellation(r,n){return r.sendNotification(gc.type,{id:n})},cleanup(r){}});function e(r){let n=r;return n&&kt.func(n.sendCancellation)&&kt.func(n.cleanup)}t.is=e})(dd||(ye.CancellationSenderStrategy=dd={}));var fd;(function(t){t.Message=Object.freeze({receiver:ud.Message,sender:dd.Message});function e(r){let n=r;return n&&ud.is(n.receiver)&&dd.is(n.sender)}t.is=e})(fd||(ye.CancellationStrategy=fd={}));var pd;(function(t){function e(r){let n=r;return n&&kt.func(n.handleMessage)}t.is=e})(pd||(ye.MessageStrategy=pd={}));var Dk;(function(t){function e(r){let n=r;return n&&(fd.is(n.cancellationStrategy)||Kg.is(n.connectionStrategy)||pd.is(n.messageStrategy))}t.is=e})(Dk||(ye.ConnectionOptions=Dk={}));var qn;(function(t){t[t.New=1]="New",t[t.Listening=2]="Listening",t[t.Closed=3]="Closed",t[t.Disposed=4]="Disposed"})(qn||(qn={}));function hF(t,e,r,n){let i=r!==void 0?r:ye.NullLogger,s=0,o=0,a=0,c="2.0",l,u=new Map,d,f=new Map,p=new Map,m,h=new Ek.LinkedMap,T=new Map,b=new Set,_=new Map,v=ze.Off,N=Gr.Text,C,H=qn.New,M=new pc.Emitter,F=new pc.Emitter,De=new pc.Emitter,lt=new pc.Emitter,Ht=new pc.Emitter,Ne=n&&n.cancellationStrategy?n.cancellationStrategy:fd.Message;function an(P){if(P===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+P.toString()}function Gi(P){return P===null?"res-unknown-"+(++a).toString():"res-"+P.toString()}function xu(){return"not-"+(++o).toString()}function Ym(P,L){de.Message.isRequest(L)?P.set(an(L.id),L):de.Message.isResponse(L)?P.set(Gi(L.id),L):P.set(xu(),L)}function Lu(P){}function sc(){return H===qn.Listening}function Bs(){return H===qn.Closed}function Ri(){return H===qn.Disposed}function Po(){(H===qn.New||H===qn.Listening)&&(H=qn.Closed,F.fire(void 0))}function Fs(P){M.fire([P,void 0,void 0])}function qu(P){M.fire(P)}t.onClose(Po),t.onError(Fs),e.onClose(Po),e.onError(qu);function oc(){m||h.size===0||(m=(0,wk.default)().timer.setImmediate(()=>{m=void 0,$u()}))}function ac(P){de.Message.isRequest(P)?Fu(P):de.Message.isNotification(P)?Uu(P):de.Message.isResponse(P)?ju(P):wo(P)}function $u(){if(h.size===0)return;let P=h.shift();try{let L=n?.messageStrategy;pd.is(L)?L.handleMessage(P,ac):ac(P)}finally{oc()}}let Bu=P=>{try{if(de.Message.isNotification(P)&&P.method===gc.type.method){let L=P.params.id,G=an(L),re=h.get(G);if(de.Message.isRequest(re)){let Ke=n?.connectionStrategy,ht=Ke&&Ke.cancelUndispatched?Ke.cancelUndispatched(re,Lu):void 0;if(ht&&(ht.error!==void 0||ht.result!==void 0)){h.delete(G),_.delete(L),ht.id=re.id,js(ht,P.method,Date.now()),e.write(ht).catch(()=>i.error("Sending response for canceled message failed."));return}}let et=_.get(L);if(et!==void 0){et.cancel(),Eo(P);return}else b.add(L)}Ym(h,P)}finally{oc()}};function Fu(P){if(Ri())return;function L(Re,it,je){let wt={jsonrpc:c,id:P.id};Re instanceof de.ResponseError?wt.error=Re.toJson():wt.result=Re===void 0?null:Re,js(wt,it,je),e.write(wt).catch(()=>i.error("Sending response failed."))}function G(Re,it,je){let wt={jsonrpc:c,id:P.id,error:Re.toJson()};js(wt,it,je),e.write(wt).catch(()=>i.error("Sending response failed."))}function re(Re,it,je){Re===void 0&&(Re=null);let wt={jsonrpc:c,id:P.id,result:Re};js(wt,it,je),e.write(wt).catch(()=>i.error("Sending response failed."))}zu(P);let et=u.get(P.method),Ke,ht;et&&(Ke=et.type,ht=et.handler);let bt=Date.now();if(ht||l){let Re=P.id??String(Date.now()),it=ld.is(Ne.receiver)?Ne.receiver.createCancellationTokenSource(Re):Ne.receiver.createCancellationTokenSource(P);P.id!==null&&b.has(P.id)&&it.cancel(),P.id!==null&&_.set(Re,it);try{let je;if(ht)if(P.params===void 0){if(Ke!==void 0&&Ke.numberOfParams!==0){G(new de.ResponseError(de.ErrorCodes.InvalidParams,`Request ${P.method} defines ${Ke.numberOfParams} params but received none.`),P.method,bt);return}je=ht(it.token)}else if(Array.isArray(P.params)){if(Ke!==void 0&&Ke.parameterStructures===de.ParameterStructures.byName){G(new de.ResponseError(de.ErrorCodes.InvalidParams,`Request ${P.method} defines parameters by name but received parameters by position`),P.method,bt);return}je=ht(...P.params,it.token)}else{if(Ke!==void 0&&Ke.parameterStructures===de.ParameterStructures.byPosition){G(new de.ResponseError(de.ErrorCodes.InvalidParams,`Request ${P.method} defines parameters by position but received parameters by name`),P.method,bt);return}je=ht(P.params,it.token)}else l&&(je=l(P.method,P.params,it.token));let wt=je;je?wt.then?wt.then(Wt=>{_.delete(Re),L(Wt,P.method,bt)},Wt=>{_.delete(Re),Wt instanceof de.ResponseError?G(Wt,P.method,bt):Wt&&kt.string(Wt.message)?G(new de.ResponseError(de.ErrorCodes.InternalError,`Request ${P.method} failed with message: ${Wt.message}`),P.method,bt):G(new de.ResponseError(de.ErrorCodes.InternalError,`Request ${P.method} failed unexpectedly without providing any details.`),P.method,bt)}):(_.delete(Re),L(je,P.method,bt)):(_.delete(Re),re(je,P.method,bt))}catch(je){_.delete(Re),je instanceof de.ResponseError?L(je,P.method,bt):je&&kt.string(je.message)?G(new de.ResponseError(de.ErrorCodes.InternalError,`Request ${P.method} failed with message: ${je.message}`),P.method,bt):G(new de.ResponseError(de.ErrorCodes.InternalError,`Request ${P.method} failed unexpectedly without providing any details.`),P.method,bt)}}else G(new de.ResponseError(de.ErrorCodes.MethodNotFound,`Unhandled method ${P.method}`),P.method,bt)}function ju(P){if(!Ri())if(P.id===null)P.error?i.error(`Received response message without id: Error is:
|
|
7
|
+
${JSON.stringify(P.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.");else{let L=P.id,G=T.get(L);if(Wu(P,G),G!==void 0){T.delete(L);try{if(P.error){let re=P.error;G.reject(new de.ResponseError(re.code,re.message,re.data))}else if(P.result!==void 0)G.resolve(P.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 Uu(P){if(Ri())return;let L,G;if(P.method===gc.type.method){let re=P.params.id;b.delete(re),Eo(P);return}else{let re=f.get(P.method);re&&(G=re.handler,L=re.type)}if(G||d)try{if(Eo(P),G)if(P.params===void 0)L!==void 0&&L.numberOfParams!==0&&L.parameterStructures!==de.ParameterStructures.byName&&i.error(`Notification ${P.method} defines ${L.numberOfParams} params but received none.`),G();else if(Array.isArray(P.params)){let re=P.params;P.method===hc.type.method&&re.length===2&&Vg.is(re[0])?G({token:re[0],value:re[1]}):(L!==void 0&&(L.parameterStructures===de.ParameterStructures.byName&&i.error(`Notification ${P.method} defines parameters by name but received parameters by position`),L.numberOfParams!==P.params.length&&i.error(`Notification ${P.method} defines ${L.numberOfParams} params but received ${re.length} arguments`)),G(...re))}else L!==void 0&&L.parameterStructures===de.ParameterStructures.byPosition&&i.error(`Notification ${P.method} defines parameters by position but received parameters by name`),G(P.params);else d&&d(P.method,P.params)}catch(re){re.message?i.error(`Notification handler '${P.method}' failed with message: ${re.message}`):i.error(`Notification handler '${P.method}' failed unexpectedly.`)}else De.fire(P)}function wo(P){if(!P){i.error("Received empty message.");return}i.error(`Received message which is neither a response nor a notification message:
|
|
8
|
+
${JSON.stringify(P,null,4)}`);let L=P;if(kt.string(L.id)||kt.number(L.id)){let G=L.id,re=T.get(G);re&&re.reject(new Error("The received response has neither a result nor an error property."))}}function Mn(P){if(P!=null)switch(v){case ze.Verbose:return JSON.stringify(P,null,4);case ze.Compact:return JSON.stringify(P);default:return}}function Hu(P){if(!(v===ze.Off||!C))if(N===Gr.Text){let L;(v===ze.Verbose||v===ze.Compact)&&P.params&&(L=`Params: ${Mn(P.params)}
|
|
9
9
|
|
|
10
|
-
`),C.log(`Sending request '${P.method} - (${P.id})'.`,L)}else
|
|
10
|
+
`),C.log(`Sending request '${P.method} - (${P.id})'.`,L)}else Pi("send-request",P)}function Vu(P){if(!(v===ze.Off||!C))if(N===Gr.Text){let L;(v===ze.Verbose||v===ze.Compact)&&(P.params?L=`Params: ${Mn(P.params)}
|
|
11
11
|
|
|
12
12
|
`:L=`No parameters provided.
|
|
13
13
|
|
|
14
|
-
`),C.log(`Sending notification '${P.method}'.`,L)}else
|
|
14
|
+
`),C.log(`Sending notification '${P.method}'.`,L)}else Pi("send-notification",P)}function js(P,L,G){if(!(v===ze.Off||!C))if(N===Gr.Text){let re;(v===ze.Verbose||v===ze.Compact)&&(P.error&&P.error.data?re=`Error data: ${Mn(P.error.data)}
|
|
15
15
|
|
|
16
|
-
`:P.result?re=`Result: ${
|
|
16
|
+
`:P.result?re=`Result: ${Mn(P.result)}
|
|
17
17
|
|
|
18
18
|
`:P.error===void 0&&(re=`No result returned.
|
|
19
19
|
|
|
20
|
-
`)),C.log(`Sending response '${L} - (${P.id})'. Processing request took ${Date.now()-
|
|
20
|
+
`)),C.log(`Sending response '${L} - (${P.id})'. Processing request took ${Date.now()-G}ms`,re)}else Pi("send-response",P)}function zu(P){if(!(v===ze.Off||!C))if(N===Gr.Text){let L;(v===ze.Verbose||v===ze.Compact)&&P.params&&(L=`Params: ${Mn(P.params)}
|
|
21
21
|
|
|
22
|
-
`),C.log(`Received request '${P.method} - (${P.id})'.`,L)}else
|
|
22
|
+
`),C.log(`Received request '${P.method} - (${P.id})'.`,L)}else Pi("receive-request",P)}function Eo(P){if(!(v===ze.Off||!C||P.method===cd.type.method))if(N===Gr.Text){let L;(v===ze.Verbose||v===ze.Compact)&&(P.params?L=`Params: ${Mn(P.params)}
|
|
23
23
|
|
|
24
24
|
`:L=`No parameters provided.
|
|
25
25
|
|
|
26
|
-
`),C.log(`Received notification '${P.method}'.`,L)}else
|
|
26
|
+
`),C.log(`Received notification '${P.method}'.`,L)}else Pi("receive-notification",P)}function Wu(P,L){if(!(v===ze.Off||!C))if(N===Gr.Text){let G;if((v===ze.Verbose||v===ze.Compact)&&(P.error&&P.error.data?G=`Error data: ${Mn(P.error.data)}
|
|
27
27
|
|
|
28
|
-
`:P.result?
|
|
28
|
+
`:P.result?G=`Result: ${Mn(P.result)}
|
|
29
29
|
|
|
30
|
-
`:P.error===void 0&&(
|
|
30
|
+
`:P.error===void 0&&(G=`No result returned.
|
|
31
31
|
|
|
32
|
-
`)),L){let re=P.error?` Request failed: ${P.error.message} (${P.error.code}).`:"";C.log(`Received response '${L.method} - (${P.id})' in ${Date.now()-L.timerStart}ms.${re}`,K)}else C.log(`Received response ${P.id} without active response promise.`,K)}else _i("receive-response",P)}function _i(P,L){if(!C||v===ze.Off)return;let K={isLSPMessage:!0,type:P,message:L,timestamp:Date.now()};C.log(K)}function Wi(){if(qs())throw new Oo(fc.Closed,"Connection is closed.");if(Si())throw new Oo(fc.Disposed,"Connection is disposed.")}function Vu(){if(rc())throw new Oo(fc.AlreadyListening,"Connection is already listening")}function zu(){if(!rc())throw new Error("Call listen() first.")}function ei(P){return P===void 0?null:P}function sc(P){if(P!==null)return P}function oc(P){return P!=null&&!Array.isArray(P)&&typeof P=="object"}function Ro(P,L){switch(P){case de.ParameterStructures.auto:return oc(L)?sc(L):[ei(L)];case de.ParameterStructures.byName:if(!oc(L))throw new Error("Received parameters by name but param is not an object literal.");return sc(L);case de.ParameterStructures.byPosition:return[ei(L)];default:throw new Error(`Unknown parameter structure ${P.toString()}`)}}function ac(P,L){let K,re=P.numberOfParams;switch(re){case 0:K=void 0;break;case 1:K=Ro(P.parameterStructures,L[0]);break;default:K=[];for(let Ze=0;Ze<L.length&&Ze<re;Ze++)K.push(ei(L[Ze]));if(L.length<re)for(let Ze=L.length;Ze<re;Ze++)K.push(null);break}return K}let ki={sendNotification:(P,...L)=>{Wi();let K,re;if(kt.string(P)){K=P;let Ge=L[0],ht=0,bt=de.ParameterStructures.auto;de.ParameterStructures.is(Ge)&&(ht=1,bt=Ge);let Re=L.length,nt=Re-ht;switch(nt){case 0:re=void 0;break;case 1:re=Ro(bt,L[ht]);break;default:if(bt===de.ParameterStructures.byName)throw new Error(`Received ${nt} parameters for 'by Name' notification parameter structure.`);re=L.slice(ht,Re).map(je=>ei(je));break}}else{let Ge=L;K=P.method,re=ac(P,Ge)}let Ze={jsonrpc:c,method:K,params:re};return ju(Ze),e.write(Ze).catch(Ge=>{throw i.error("Sending notification failed."),Ge})},onNotification:(P,L)=>{Wi();let K;return kt.func(P)?d=P:L&&(kt.string(P)?(K=P,f.set(P,{type:void 0,handler:L})):(K=P.method,f.set(P.method,{type:P,handler:L}))),{dispose:()=>{K!==void 0?f.delete(K):d=void 0}}},onProgress:(P,L,K)=>{if(p.has(L))throw new Error(`Progress handler for token ${L} already registered`);return p.set(L,K),{dispose:()=>{p.delete(L)}}},sendProgress:(P,L,K)=>ki.sendNotification(dc.type,{token:L,value:K}),onUnhandledProgress:lt.event,sendRequest:(P,...L)=>{Wi(),zu();let K,re,Ze;if(kt.string(P)){K=P;let Re=L[0],nt=L[L.length-1],je=0,Pt=de.ParameterStructures.auto;de.ParameterStructures.is(Re)&&(je=1,Pt=Re);let Wt=L.length;Lg.CancellationToken.is(nt)&&(Wt=Wt-1,Ze=nt);let Vr=Wt-je;switch(Vr){case 0:re=void 0;break;case 1:re=Ro(Pt,L[je]);break;default:if(Pt===de.ParameterStructures.byName)throw new Error(`Received ${Vr} parameters for 'by Name' request parameter structure.`);re=L.slice(je,Wt).map(Wu=>ei(Wu));break}}else{let Re=L;K=P.method,re=ac(P,Re);let nt=P.numberOfParams;Ze=Lg.CancellationToken.is(Re[nt])?Re[nt]:void 0}let Ge=s++,ht;Ze&&(ht=Ze.onCancellationRequested(()=>{let Re=Ne.sender.sendCancellation(ki,Ge);return Re===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${Ge}`),Promise.resolve()):Re.catch(()=>{i.log(`Sending cancellation messages for id ${Ge} failed`)})}));let bt={jsonrpc:c,id:Ge,method:K,params:re};return Fu(bt),typeof Ne.sender.enableCancellation=="function"&&Ne.sender.enableCancellation(bt),new Promise(async(Re,nt)=>{let je=Vr=>{Re(Vr),Ne.sender.cleanup(Ge),ht?.dispose()},Pt=Vr=>{nt(Vr),Ne.sender.cleanup(Ge),ht?.dispose()},Wt={method:K,timerStart:Date.now(),resolve:je,reject:Pt};try{await e.write(bt),T.set(Ge,Wt)}catch(Vr){throw i.error("Sending request failed."),Wt.reject(new de.ResponseError(de.ErrorCodes.MessageWriteError,Vr.message?Vr.message:"Unknown reason")),Vr}})},onRequest:(P,L)=>{Wi();let K=null;return Bg.is(P)?(K=void 0,l=P):kt.string(P)?(K=null,L!==void 0&&(K=P,u.set(P,{handler:L,type:void 0}))):L!==void 0&&(K=P.method,u.set(P.method,{type:P,handler:L})),{dispose:()=>{K!==null&&(K!==void 0?u.delete(K):l=void 0)}}},hasPendingResponse:()=>T.size>0,trace:async(P,L,K)=>{let re=!1,Ze=zr.Text;K!==void 0&&(kt.boolean(K)?re=K:(re=K.sendNotification||!1,Ze=K.traceFormat||zr.Text)),v=P,N=Ze,v===ze.Off?C=void 0:C=L,re&&!qs()&&!Si()&&await ki.sendNotification(Fg.type,{value:ze.toString(P)})},onError:M.event,onClose:F.event,onUnhandledNotification:De.event,onDispose:Ht.event,end:()=>{e.end()},dispose:()=>{if(Si())return;H=Mn.Disposed,Ht.fire(void 0);let P=new de.ResponseError(de.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let L of T.values())L.reject(P);T=new Map,S=new Map,b=new Set,h=new kk.LinkedMap,kt.func(e.dispose)&&e.dispose(),kt.func(t.dispose)&&t.dispose()},listen:()=>{Wi(),Vu(),H=Mn.Listening,t.listen(Lu)},inspect:()=>{(0,_k.default)().console.log("inspect")}};return ki.onNotification(sd.type,P=>{if(v===ze.Off||!C)return;let L=v===ze.Verbose||v===ze.Compact;C.log(P.message,L?P.verbose:void 0)}),ki.onNotification(dc.type,P=>{let L=p.get(P.token);L?L(P.value):lt.fire(P)}),ki}ye.createMessageConnection=dF});var dd=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 dt=hg();Object.defineProperty(O,"Message",{enumerable:!0,get:function(){return dt.Message}});Object.defineProperty(O,"RequestType",{enumerable:!0,get:function(){return dt.RequestType}});Object.defineProperty(O,"RequestType0",{enumerable:!0,get:function(){return dt.RequestType0}});Object.defineProperty(O,"RequestType1",{enumerable:!0,get:function(){return dt.RequestType1}});Object.defineProperty(O,"RequestType2",{enumerable:!0,get:function(){return dt.RequestType2}});Object.defineProperty(O,"RequestType3",{enumerable:!0,get:function(){return dt.RequestType3}});Object.defineProperty(O,"RequestType4",{enumerable:!0,get:function(){return dt.RequestType4}});Object.defineProperty(O,"RequestType5",{enumerable:!0,get:function(){return dt.RequestType5}});Object.defineProperty(O,"RequestType6",{enumerable:!0,get:function(){return dt.RequestType6}});Object.defineProperty(O,"RequestType7",{enumerable:!0,get:function(){return dt.RequestType7}});Object.defineProperty(O,"RequestType8",{enumerable:!0,get:function(){return dt.RequestType8}});Object.defineProperty(O,"RequestType9",{enumerable:!0,get:function(){return dt.RequestType9}});Object.defineProperty(O,"ResponseError",{enumerable:!0,get:function(){return dt.ResponseError}});Object.defineProperty(O,"ErrorCodes",{enumerable:!0,get:function(){return dt.ErrorCodes}});Object.defineProperty(O,"NotificationType",{enumerable:!0,get:function(){return dt.NotificationType}});Object.defineProperty(O,"NotificationType0",{enumerable:!0,get:function(){return dt.NotificationType0}});Object.defineProperty(O,"NotificationType1",{enumerable:!0,get:function(){return dt.NotificationType1}});Object.defineProperty(O,"NotificationType2",{enumerable:!0,get:function(){return dt.NotificationType2}});Object.defineProperty(O,"NotificationType3",{enumerable:!0,get:function(){return dt.NotificationType3}});Object.defineProperty(O,"NotificationType4",{enumerable:!0,get:function(){return dt.NotificationType4}});Object.defineProperty(O,"NotificationType5",{enumerable:!0,get:function(){return dt.NotificationType5}});Object.defineProperty(O,"NotificationType6",{enumerable:!0,get:function(){return dt.NotificationType6}});Object.defineProperty(O,"NotificationType7",{enumerable:!0,get:function(){return dt.NotificationType7}});Object.defineProperty(O,"NotificationType8",{enumerable:!0,get:function(){return dt.NotificationType8}});Object.defineProperty(O,"NotificationType9",{enumerable:!0,get:function(){return dt.NotificationType9}});Object.defineProperty(O,"ParameterStructures",{enumerable:!0,get:function(){return dt.ParameterStructures}});var Hg=gg();Object.defineProperty(O,"LinkedMap",{enumerable:!0,get:function(){return Hg.LinkedMap}});Object.defineProperty(O,"LRUCache",{enumerable:!0,get:function(){return Hg.LRUCache}});Object.defineProperty(O,"Touch",{enumerable:!0,get:function(){return Hg.Touch}});var fF=dk();Object.defineProperty(O,"Disposable",{enumerable:!0,get:function(){return fF.Disposable}});var wk=Co();Object.defineProperty(O,"Event",{enumerable:!0,get:function(){return wk.Event}});Object.defineProperty(O,"Emitter",{enumerable:!0,get:function(){return wk.Emitter}});var Ek=ed();Object.defineProperty(O,"CancellationTokenSource",{enumerable:!0,get:function(){return Ek.CancellationTokenSource}});Object.defineProperty(O,"CancellationToken",{enumerable:!0,get:function(){return Ek.CancellationToken}});var Ck=pk();Object.defineProperty(O,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return Ck.SharedArraySenderStrategy}});Object.defineProperty(O,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return Ck.SharedArrayReceiverStrategy}});var Vg=mk();Object.defineProperty(O,"MessageReader",{enumerable:!0,get:function(){return Vg.MessageReader}});Object.defineProperty(O,"AbstractMessageReader",{enumerable:!0,get:function(){return Vg.AbstractMessageReader}});Object.defineProperty(O,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return Vg.ReadableStreamMessageReader}});var zg=bk();Object.defineProperty(O,"MessageWriter",{enumerable:!0,get:function(){return zg.MessageWriter}});Object.defineProperty(O,"AbstractMessageWriter",{enumerable:!0,get:function(){return zg.AbstractMessageWriter}});Object.defineProperty(O,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return zg.WriteableStreamMessageWriter}});var pF=Sk();Object.defineProperty(O,"AbstractMessageBuffer",{enumerable:!0,get:function(){return pF.AbstractMessageBuffer}});var Zt=Pk();Object.defineProperty(O,"ConnectionStrategy",{enumerable:!0,get:function(){return Zt.ConnectionStrategy}});Object.defineProperty(O,"ConnectionOptions",{enumerable:!0,get:function(){return Zt.ConnectionOptions}});Object.defineProperty(O,"NullLogger",{enumerable:!0,get:function(){return Zt.NullLogger}});Object.defineProperty(O,"createMessageConnection",{enumerable:!0,get:function(){return Zt.createMessageConnection}});Object.defineProperty(O,"ProgressToken",{enumerable:!0,get:function(){return Zt.ProgressToken}});Object.defineProperty(O,"ProgressType",{enumerable:!0,get:function(){return Zt.ProgressType}});Object.defineProperty(O,"Trace",{enumerable:!0,get:function(){return Zt.Trace}});Object.defineProperty(O,"TraceValues",{enumerable:!0,get:function(){return Zt.TraceValues}});Object.defineProperty(O,"TraceFormat",{enumerable:!0,get:function(){return Zt.TraceFormat}});Object.defineProperty(O,"SetTraceNotification",{enumerable:!0,get:function(){return Zt.SetTraceNotification}});Object.defineProperty(O,"LogTraceNotification",{enumerable:!0,get:function(){return Zt.LogTraceNotification}});Object.defineProperty(O,"ConnectionErrors",{enumerable:!0,get:function(){return Zt.ConnectionErrors}});Object.defineProperty(O,"ConnectionError",{enumerable:!0,get:function(){return Zt.ConnectionError}});Object.defineProperty(O,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return Zt.CancellationReceiverStrategy}});Object.defineProperty(O,"CancellationSenderStrategy",{enumerable:!0,get:function(){return Zt.CancellationSenderStrategy}});Object.defineProperty(O,"CancellationStrategy",{enumerable:!0,get:function(){return Zt.CancellationStrategy}});Object.defineProperty(O,"MessageStrategy",{enumerable:!0,get:function(){return Zt.MessageStrategy}});var hF=Ki();O.RAL=hF.default});var Ik=R(Yg=>{"use strict";Object.defineProperty(Yg,"__esModule",{value:!0});var Dk=require("util"),Ri=dd(),fd=class t extends Ri.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 Dk.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)}};fd.emptyBuffer=Buffer.allocUnsafe(0);var Wg=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),Ri.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),Ri.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),Ri.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),Ri.Disposable.create(()=>this.stream.off("data",e))}},Gg=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),Ri.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),Ri.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),Ri.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()}},Ak=Object.freeze({messageBuffer:Object.freeze({create:t=>new fd(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 Dk.TextDecoder(e.charset).decode(t)))}catch(r){return Promise.reject(r)}}})}),stream:Object.freeze({asReadableStream:t=>new Wg(t),asWritableStream:t=>new Gg(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 Kg(){return Ak}(function(t){function e(){Ri.RAL.install(Ak)}t.install=e})(Kg||(Kg={}));Yg.default=Kg});var Hs=R(Ie=>{"use strict";var mF=Ie&&Ie.__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]}),gF=Ie&&Ie.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mF(e,t,r)};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.createMessageConnection=Ie.createServerSocketTransport=Ie.createClientSocketTransport=Ie.createServerPipeTransport=Ie.createClientPipeTransport=Ie.generateRandomPipeName=Ie.StreamMessageWriter=Ie.StreamMessageReader=Ie.SocketMessageWriter=Ie.SocketMessageReader=Ie.PortMessageWriter=Ie.PortMessageReader=Ie.IPCMessageWriter=Ie.IPCMessageReader=void 0;var Mo=Ik();Mo.default.install();var Ok=require("path"),yF=require("os"),TF=require("crypto"),md=require("net"),Wr=dd();gF(dd(),Ie);var Xg=class extends Wr.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),Wr.Disposable.create(()=>this.process.off("message",e))}};Ie.IPCMessageReader=Xg;var Jg=class extends Wr.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(){}};Ie.IPCMessageWriter=Jg;var Qg=class extends Wr.AbstractMessageReader{constructor(e){super(),this.onData=new Wr.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)}};Ie.PortMessageReader=Qg;var Zg=class extends Wr.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(){}};Ie.PortMessageWriter=Zg;var js=class extends Wr.ReadableStreamMessageReader{constructor(e,r="utf-8"){super((0,Mo.default)().stream.asReadableStream(e),r)}};Ie.SocketMessageReader=js;var Us=class extends Wr.WriteableStreamMessageWriter{constructor(e,r){super((0,Mo.default)().stream.asWritableStream(e),r),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};Ie.SocketMessageWriter=Us;var pd=class extends Wr.ReadableStreamMessageReader{constructor(e,r){super((0,Mo.default)().stream.asReadableStream(e),r)}};Ie.StreamMessageReader=pd;var hd=class extends Wr.WriteableStreamMessageWriter{constructor(e,r){super((0,Mo.default)().stream.asWritableStream(e),r)}};Ie.StreamMessageWriter=hd;var Mk=process.env.XDG_RUNTIME_DIR,vF=new Map([["linux",107],["darwin",103]]);function bF(){let t=(0,TF.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${t}-sock`;let e;Mk?e=Ok.join(Mk,`vscode-ipc-${t}.sock`):e=Ok.join(yF.tmpdir(),`vscode-${t}.sock`);let r=vF.get(process.platform);return r!==void 0&&e.length>r&&(0,Mo.default)().console.warn(`WARNING: IPC handle "${e}" is longer than ${r} characters.`),e}Ie.generateRandomPipeName=bF;function SF(t,e="utf-8"){let r,n=new Promise((i,s)=>{r=i});return new Promise((i,s)=>{let o=(0,md.createServer)(a=>{o.close(),r([new js(a,e),new Us(a,e)])});o.on("error",s),o.listen(t,()=>{o.removeListener("error",s),i({onConnected:()=>n})})})}Ie.createClientPipeTransport=SF;function _F(t,e="utf-8"){let r=(0,md.createConnection)(t);return[new js(r,e),new Us(r,e)]}Ie.createServerPipeTransport=_F;function kF(t,e="utf-8"){let r,n=new Promise((i,s)=>{r=i});return new Promise((i,s)=>{let o=(0,md.createServer)(a=>{o.close(),r([new js(a,e),new Us(a,e)])});o.on("error",s),o.listen(t,"127.0.0.1",()=>{o.removeListener("error",s),i({onConnected:()=>n})})})}Ie.createClientSocketTransport=kF;function NF(t,e="utf-8"){let r=(0,md.createConnection)(t,"127.0.0.1");return[new js(r,e),new Us(r,e)]}Ie.createServerSocketTransport=NF;function RF(t){let e=t;return e.read!==void 0&&e.addListener!==void 0}function PF(t){let e=t;return e.write!==void 0&&e.addListener!==void 0}function wF(t,e,r,n){r||(r=Wr.NullLogger);let i=RF(t)?new pd(t):t,s=PF(e)?new hd(e):e;return Wr.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Wr.createMessageConnection)(i,s,r,n)}Ie.createMessageConnection=wF});var ey=R(($6,xk)=>{"use strict";xk.exports=Hs()});var yd=R((Lk,gd)=>{(function(t){if(typeof gd=="object"&&typeof gd.exports=="object"){var e=t(require,Lk);e!==void 0&&(gd.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(y){function w(E){return typeof E=="string"}y.is=w})(r||(e.DocumentUri=r={}));var n;(function(y){function w(E){return typeof E=="string"}y.is=w})(n||(e.URI=n={}));var i;(function(y){y.MIN_VALUE=-2147483648,y.MAX_VALUE=2147483647;function w(E){return typeof E=="number"&&y.MIN_VALUE<=E&&E<=y.MAX_VALUE}y.is=w})(i||(e.integer=i={}));var s;(function(y){y.MIN_VALUE=0,y.MAX_VALUE=2147483647;function w(E){return typeof E=="number"&&y.MIN_VALUE<=E&&E<=y.MAX_VALUE}y.is=w})(s||(e.uinteger=s={}));var o;(function(y){function w(_,g){return _===Number.MAX_VALUE&&(_=s.MAX_VALUE),g===Number.MAX_VALUE&&(g=s.MAX_VALUE),{line:_,character:g}}y.create=w;function E(_){var g=_;return A.objectLiteral(g)&&A.uinteger(g.line)&&A.uinteger(g.character)}y.is=E})(o||(e.Position=o={}));var a;(function(y){function w(_,g,D,q){if(A.uinteger(_)&&A.uinteger(g)&&A.uinteger(D)&&A.uinteger(q))return{start:o.create(_,g),end:o.create(D,q)};if(o.is(_)&&o.is(g))return{start:_,end:g};throw new Error("Range#create called with invalid arguments[".concat(_,", ").concat(g,", ").concat(D,", ").concat(q,"]"))}y.create=w;function E(_){var g=_;return A.objectLiteral(g)&&o.is(g.start)&&o.is(g.end)}y.is=E})(a||(e.Range=a={}));var c;(function(y){function w(_,g){return{uri:_,range:g}}y.create=w;function E(_){var g=_;return A.objectLiteral(g)&&a.is(g.range)&&(A.string(g.uri)||A.undefined(g.uri))}y.is=E})(c||(e.Location=c={}));var l;(function(y){function w(_,g,D,q){return{targetUri:_,targetRange:g,targetSelectionRange:D,originSelectionRange:q}}y.create=w;function E(_){var g=_;return A.objectLiteral(g)&&a.is(g.targetRange)&&A.string(g.targetUri)&&a.is(g.targetSelectionRange)&&(a.is(g.originSelectionRange)||A.undefined(g.originSelectionRange))}y.is=E})(l||(e.LocationLink=l={}));var u;(function(y){function w(_,g,D,q){return{red:_,green:g,blue:D,alpha:q}}y.create=w;function E(_){var g=_;return A.objectLiteral(g)&&A.numberRange(g.red,0,1)&&A.numberRange(g.green,0,1)&&A.numberRange(g.blue,0,1)&&A.numberRange(g.alpha,0,1)}y.is=E})(u||(e.Color=u={}));var d;(function(y){function w(_,g){return{range:_,color:g}}y.create=w;function E(_){var g=_;return A.objectLiteral(g)&&a.is(g.range)&&u.is(g.color)}y.is=E})(d||(e.ColorInformation=d={}));var f;(function(y){function w(_,g,D){return{label:_,textEdit:g,additionalTextEdits:D}}y.create=w;function E(_){var g=_;return A.objectLiteral(g)&&A.string(g.label)&&(A.undefined(g.textEdit)||C.is(g))&&(A.undefined(g.additionalTextEdits)||A.typedArray(g.additionalTextEdits,C.is))}y.is=E})(f||(e.ColorPresentation=f={}));var p;(function(y){y.Comment="comment",y.Imports="imports",y.Region="region"})(p||(e.FoldingRangeKind=p={}));var m;(function(y){function w(_,g,D,q,ge,wt){var ut={startLine:_,endLine:g};return A.defined(D)&&(ut.startCharacter=D),A.defined(q)&&(ut.endCharacter=q),A.defined(ge)&&(ut.kind=ge),A.defined(wt)&&(ut.collapsedText=wt),ut}y.create=w;function E(_){var g=_;return A.objectLiteral(g)&&A.uinteger(g.startLine)&&A.uinteger(g.startLine)&&(A.undefined(g.startCharacter)||A.uinteger(g.startCharacter))&&(A.undefined(g.endCharacter)||A.uinteger(g.endCharacter))&&(A.undefined(g.kind)||A.string(g.kind))}y.is=E})(m||(e.FoldingRange=m={}));var h;(function(y){function w(_,g){return{location:_,message:g}}y.create=w;function E(_){var g=_;return A.defined(g)&&c.is(g.location)&&A.string(g.message)}y.is=E})(h||(e.DiagnosticRelatedInformation=h={}));var T;(function(y){y.Error=1,y.Warning=2,y.Information=3,y.Hint=4})(T||(e.DiagnosticSeverity=T={}));var b;(function(y){y.Unnecessary=1,y.Deprecated=2})(b||(e.DiagnosticTag=b={}));var S;(function(y){function w(E){var _=E;return A.objectLiteral(_)&&A.string(_.href)}y.is=w})(S||(e.CodeDescription=S={}));var v;(function(y){function w(_,g,D,q,ge,wt){var ut={range:_,message:g};return A.defined(D)&&(ut.severity=D),A.defined(q)&&(ut.code=q),A.defined(ge)&&(ut.source=ge),A.defined(wt)&&(ut.relatedInformation=wt),ut}y.create=w;function E(_){var g,D=_;return A.defined(D)&&a.is(D.range)&&A.string(D.message)&&(A.number(D.severity)||A.undefined(D.severity))&&(A.integer(D.code)||A.string(D.code)||A.undefined(D.code))&&(A.undefined(D.codeDescription)||A.string((g=D.codeDescription)===null||g===void 0?void 0:g.href))&&(A.string(D.source)||A.undefined(D.source))&&(A.undefined(D.relatedInformation)||A.typedArray(D.relatedInformation,h.is))}y.is=E})(v||(e.Diagnostic=v={}));var N;(function(y){function w(_,g){for(var D=[],q=2;q<arguments.length;q++)D[q-2]=arguments[q];var ge={title:_,command:g};return A.defined(D)&&D.length>0&&(ge.arguments=D),ge}y.create=w;function E(_){var g=_;return A.defined(g)&&A.string(g.title)&&A.string(g.command)}y.is=E})(N||(e.Command=N={}));var C;(function(y){function w(D,q){return{range:D,newText:q}}y.replace=w;function E(D,q){return{range:{start:D,end:D},newText:q}}y.insert=E;function _(D){return{range:D,newText:""}}y.del=_;function g(D){var q=D;return A.objectLiteral(q)&&A.string(q.newText)&&a.is(q.range)}y.is=g})(C||(e.TextEdit=C={}));var H;(function(y){function w(_,g,D){var q={label:_};return g!==void 0&&(q.needsConfirmation=g),D!==void 0&&(q.description=D),q}y.create=w;function E(_){var g=_;return A.objectLiteral(g)&&A.string(g.label)&&(A.boolean(g.needsConfirmation)||g.needsConfirmation===void 0)&&(A.string(g.description)||g.description===void 0)}y.is=E})(H||(e.ChangeAnnotation=H={}));var M;(function(y){function w(E){var _=E;return A.string(_)}y.is=w})(M||(e.ChangeAnnotationIdentifier=M={}));var F;(function(y){function w(D,q,ge){return{range:D,newText:q,annotationId:ge}}y.replace=w;function E(D,q,ge){return{range:{start:D,end:D},newText:q,annotationId:ge}}y.insert=E;function _(D,q){return{range:D,newText:"",annotationId:q}}y.del=_;function g(D){var q=D;return C.is(q)&&(H.is(q.annotationId)||M.is(q.annotationId))}y.is=g})(F||(e.AnnotatedTextEdit=F={}));var De;(function(y){function w(_,g){return{textDocument:_,edits:g}}y.create=w;function E(_){var g=_;return A.defined(g)&&qs.is(g.textDocument)&&Array.isArray(g.edits)}y.is=E})(De||(e.TextDocumentEdit=De={}));var lt;(function(y){function w(_,g,D){var q={kind:"create",uri:_};return g!==void 0&&(g.overwrite!==void 0||g.ignoreIfExists!==void 0)&&(q.options=g),D!==void 0&&(q.annotationId=D),q}y.create=w;function E(_){var g=_;return g&&g.kind==="create"&&A.string(g.uri)&&(g.options===void 0||(g.options.overwrite===void 0||A.boolean(g.options.overwrite))&&(g.options.ignoreIfExists===void 0||A.boolean(g.options.ignoreIfExists)))&&(g.annotationId===void 0||M.is(g.annotationId))}y.is=E})(lt||(e.CreateFile=lt={}));var Ht;(function(y){function w(_,g,D,q){var ge={kind:"rename",oldUri:_,newUri:g};return D!==void 0&&(D.overwrite!==void 0||D.ignoreIfExists!==void 0)&&(ge.options=D),q!==void 0&&(ge.annotationId=q),ge}y.create=w;function E(_){var g=_;return g&&g.kind==="rename"&&A.string(g.oldUri)&&A.string(g.newUri)&&(g.options===void 0||(g.options.overwrite===void 0||A.boolean(g.options.overwrite))&&(g.options.ignoreIfExists===void 0||A.boolean(g.options.ignoreIfExists)))&&(g.annotationId===void 0||M.is(g.annotationId))}y.is=E})(Ht||(e.RenameFile=Ht={}));var Ne;(function(y){function w(_,g,D){var q={kind:"delete",uri:_};return g!==void 0&&(g.recursive!==void 0||g.ignoreIfNotExists!==void 0)&&(q.options=g),D!==void 0&&(q.annotationId=D),q}y.create=w;function E(_){var g=_;return g&&g.kind==="delete"&&A.string(g.uri)&&(g.options===void 0||(g.options.recursive===void 0||A.boolean(g.options.recursive))&&(g.options.ignoreIfNotExists===void 0||A.boolean(g.options.ignoreIfNotExists)))&&(g.annotationId===void 0||M.is(g.annotationId))}y.is=E})(Ne||(e.DeleteFile=Ne={}));var tn;(function(y){function w(E){var _=E;return _&&(_.changes!==void 0||_.documentChanges!==void 0)&&(_.documentChanges===void 0||_.documentChanges.every(function(g){return A.string(g.kind)?lt.is(g)||Ht.is(g)||Ne.is(g):De.is(g)}))}y.is=w})(tn||(e.WorkspaceEdit=tn={}));var zi=function(){function y(w,E){this.edits=w,this.changeAnnotations=E}return y.prototype.insert=function(w,E,_){var g,D;if(_===void 0?g=C.insert(w,E):M.is(_)?(D=_,g=F.insert(w,E,_)):(this.assertChangeAnnotations(this.changeAnnotations),D=this.changeAnnotations.manage(_),g=F.insert(w,E,D)),this.edits.push(g),D!==void 0)return D},y.prototype.replace=function(w,E,_){var g,D;if(_===void 0?g=C.replace(w,E):M.is(_)?(D=_,g=F.replace(w,E,_)):(this.assertChangeAnnotations(this.changeAnnotations),D=this.changeAnnotations.manage(_),g=F.replace(w,E,D)),this.edits.push(g),D!==void 0)return D},y.prototype.delete=function(w,E){var _,g;if(E===void 0?_=C.del(w):M.is(E)?(g=E,_=F.del(w,E)):(this.assertChangeAnnotations(this.changeAnnotations),g=this.changeAnnotations.manage(E),_=F.del(w,g)),this.edits.push(_),g!==void 0)return g},y.prototype.add=function(w){this.edits.push(w)},y.prototype.all=function(){return this.edits},y.prototype.clear=function(){this.edits.splice(0,this.edits.length)},y.prototype.assertChangeAnnotations=function(w){if(w===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},y}(),Iu=function(){function y(w){this._annotations=w===void 0?Object.create(null):w,this._counter=0,this._size=0}return y.prototype.all=function(){return this._annotations},Object.defineProperty(y.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),y.prototype.manage=function(w,E){var _;if(M.is(w)?_=w:(_=this.nextId(),E=w),this._annotations[_]!==void 0)throw new Error("Id ".concat(_," is already in use."));if(E===void 0)throw new Error("No annotation provided for id ".concat(_));return this._annotations[_]=E,this._size++,_},y.prototype.nextId=function(){return this._counter++,this._counter.toString()},y}(),Um=function(){function y(w){var E=this;this._textEditChanges=Object.create(null),w!==void 0?(this._workspaceEdit=w,w.documentChanges?(this._changeAnnotations=new Iu(w.changeAnnotations),w.changeAnnotations=this._changeAnnotations.all(),w.documentChanges.forEach(function(_){if(De.is(_)){var g=new zi(_.edits,E._changeAnnotations);E._textEditChanges[_.textDocument.uri]=g}})):w.changes&&Object.keys(w.changes).forEach(function(_){var g=new zi(w.changes[_]);E._textEditChanges[_]=g})):this._workspaceEdit={}}return Object.defineProperty(y.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}),y.prototype.getTextEditChange=function(w){if(qs.is(w)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var E={uri:w.uri,version:w.version},_=this._textEditChanges[E.uri];if(!_){var g=[],D={textDocument:E,edits:g};this._workspaceEdit.documentChanges.push(D),_=new zi(g,this._changeAnnotations),this._textEditChanges[E.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 zi(g),this._textEditChanges[w]=_}return _}},y.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Iu,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},y.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},y.prototype.createFile=function(w,E,_){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;H.is(E)||M.is(E)?g=E:_=E;var D,q;if(g===void 0?D=lt.create(w,_):(q=M.is(g)?g:this._changeAnnotations.manage(g),D=lt.create(w,_,q)),this._workspaceEdit.documentChanges.push(D),q!==void 0)return q},y.prototype.renameFile=function(w,E,_,g){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var D;H.is(_)||M.is(_)?D=_:g=_;var q,ge;if(D===void 0?q=Ht.create(w,E,g):(ge=M.is(D)?D:this._changeAnnotations.manage(D),q=Ht.create(w,E,g,ge)),this._workspaceEdit.documentChanges.push(q),ge!==void 0)return ge},y.prototype.deleteFile=function(w,E,_){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;H.is(E)||M.is(E)?g=E:_=E;var D,q;if(g===void 0?D=Ne.create(w,_):(q=M.is(g)?g:this._changeAnnotations.manage(g),D=Ne.create(w,_,q)),this._workspaceEdit.documentChanges.push(D),q!==void 0)return q},y}();e.WorkspaceChange=Um;var Ou;(function(y){function w(_){return{uri:_}}y.create=w;function E(_){var g=_;return A.defined(g)&&A.string(g.uri)}y.is=E})(Ou||(e.TextDocumentIdentifier=Ou={}));var rc;(function(y){function w(_,g){return{uri:_,version:g}}y.create=w;function E(_){var g=_;return A.defined(g)&&A.string(g.uri)&&A.integer(g.version)}y.is=E})(rc||(e.VersionedTextDocumentIdentifier=rc={}));var qs;(function(y){function w(_,g){return{uri:_,version:g}}y.create=w;function E(_){var g=_;return A.defined(g)&&A.string(g.uri)&&(g.version===null||A.integer(g.version))}y.is=E})(qs||(e.OptionalVersionedTextDocumentIdentifier=qs={}));var Si;(function(y){function w(_,g,D,q){return{uri:_,languageId:g,version:D,text:q}}y.create=w;function E(_){var g=_;return A.defined(g)&&A.string(g.uri)&&A.string(g.languageId)&&A.integer(g.version)&&A.string(g.text)}y.is=E})(Si||(e.TextDocumentItem=Si={}));var _o;(function(y){y.PlainText="plaintext",y.Markdown="markdown";function w(E){var _=E;return _===y.PlainText||_===y.Markdown}y.is=w})(_o||(e.MarkupKind=_o={}));var $s;(function(y){function w(E){var _=E;return A.objectLiteral(E)&&_o.is(_.kind)&&A.string(_.value)}y.is=w})($s||(e.MarkupContent=$s={}));var Mu;(function(y){y.Text=1,y.Method=2,y.Function=3,y.Constructor=4,y.Field=5,y.Variable=6,y.Class=7,y.Interface=8,y.Module=9,y.Property=10,y.Unit=11,y.Value=12,y.Enum=13,y.Keyword=14,y.Snippet=15,y.Color=16,y.File=17,y.Reference=18,y.Folder=19,y.EnumMember=20,y.Constant=21,y.Struct=22,y.Event=23,y.Operator=24,y.TypeParameter=25})(Mu||(e.CompletionItemKind=Mu={}));var nc;(function(y){y.PlainText=1,y.Snippet=2})(nc||(e.InsertTextFormat=nc={}));var ic;(function(y){y.Deprecated=1})(ic||(e.CompletionItemTag=ic={}));var xu;(function(y){function w(_,g,D){return{newText:_,insert:g,replace:D}}y.create=w;function E(_){var g=_;return g&&A.string(g.newText)&&a.is(g.insert)&&a.is(g.replace)}y.is=E})(xu||(e.InsertReplaceEdit=xu={}));var Lu;(function(y){y.asIs=1,y.adjustIndentation=2})(Lu||(e.InsertTextMode=Lu={}));var qu;(function(y){function w(E){var _=E;return _&&(A.string(_.detail)||_.detail===void 0)&&(A.string(_.description)||_.description===void 0)}y.is=w})(qu||(e.CompletionItemLabelDetails=qu={}));var $u;(function(y){function w(E){return{label:E}}y.create=w})($u||(e.CompletionItem=$u={}));var Bu;(function(y){function w(E,_){return{items:E||[],isIncomplete:!!_}}y.create=w})(Bu||(e.CompletionList=Bu={}));var ko;(function(y){function w(_){return _.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}y.fromPlainText=w;function E(_){var g=_;return A.string(g)||A.objectLiteral(g)&&A.string(g.language)&&A.string(g.value)}y.is=E})(ko||(e.MarkedString=ko={}));var An;(function(y){function w(E){var _=E;return!!_&&A.objectLiteral(_)&&($s.is(_.contents)||ko.is(_.contents)||A.typedArray(_.contents,ko.is))&&(E.range===void 0||a.is(E.range))}y.is=w})(An||(e.Hover=An={}));var Fu;(function(y){function w(E,_){return _?{label:E,documentation:_}:{label:E}}y.create=w})(Fu||(e.ParameterInformation=Fu={}));var ju;(function(y){function w(E,_){for(var g=[],D=2;D<arguments.length;D++)g[D-2]=arguments[D];var q={label:E};return A.defined(_)&&(q.documentation=_),A.defined(g)?q.parameters=g:q.parameters=[],q}y.create=w})(ju||(e.SignatureInformation=ju={}));var Bs;(function(y){y.Text=1,y.Read=2,y.Write=3})(Bs||(e.DocumentHighlightKind=Bs={}));var Uu;(function(y){function w(E,_){var g={range:E};return A.number(_)&&(g.kind=_),g}y.create=w})(Uu||(e.DocumentHighlight=Uu={}));var No;(function(y){y.File=1,y.Module=2,y.Namespace=3,y.Package=4,y.Class=5,y.Method=6,y.Property=7,y.Field=8,y.Constructor=9,y.Enum=10,y.Interface=11,y.Function=12,y.Variable=13,y.Constant=14,y.String=15,y.Number=16,y.Boolean=17,y.Array=18,y.Object=19,y.Key=20,y.Null=21,y.EnumMember=22,y.Struct=23,y.Event=24,y.Operator=25,y.TypeParameter=26})(No||(e.SymbolKind=No={}));var Hu;(function(y){y.Deprecated=1})(Hu||(e.SymbolTag=Hu={}));var _i;(function(y){function w(E,_,g,D,q){var ge={name:E,kind:_,location:{uri:D,range:g}};return q&&(ge.containerName=q),ge}y.create=w})(_i||(e.SymbolInformation=_i={}));var Wi;(function(y){function w(E,_,g,D){return D!==void 0?{name:E,kind:_,location:{uri:g,range:D}}:{name:E,kind:_,location:{uri:g}}}y.create=w})(Wi||(e.WorkspaceSymbol=Wi={}));var Vu;(function(y){function w(_,g,D,q,ge,wt){var ut={name:_,detail:g,kind:D,range:q,selectionRange:ge};return wt!==void 0&&(ut.children=wt),ut}y.create=w;function E(_){var g=_;return g&&A.string(g.name)&&A.number(g.kind)&&a.is(g.range)&&a.is(g.selectionRange)&&(g.detail===void 0||A.string(g.detail))&&(g.deprecated===void 0||A.boolean(g.deprecated))&&(g.children===void 0||Array.isArray(g.children))&&(g.tags===void 0||Array.isArray(g.tags))}y.is=E})(Vu||(e.DocumentSymbol=Vu={}));var zu;(function(y){y.Empty="",y.QuickFix="quickfix",y.Refactor="refactor",y.RefactorExtract="refactor.extract",y.RefactorInline="refactor.inline",y.RefactorRewrite="refactor.rewrite",y.Source="source",y.SourceOrganizeImports="source.organizeImports",y.SourceFixAll="source.fixAll"})(zu||(e.CodeActionKind=zu={}));var ei;(function(y){y.Invoked=1,y.Automatic=2})(ei||(e.CodeActionTriggerKind=ei={}));var sc;(function(y){function w(_,g,D){var q={diagnostics:_};return g!=null&&(q.only=g),D!=null&&(q.triggerKind=D),q}y.create=w;function E(_){var g=_;return A.defined(g)&&A.typedArray(g.diagnostics,v.is)&&(g.only===void 0||A.typedArray(g.only,A.string))&&(g.triggerKind===void 0||g.triggerKind===ei.Invoked||g.triggerKind===ei.Automatic)}y.is=E})(sc||(e.CodeActionContext=sc={}));var oc;(function(y){function w(_,g,D){var q={title:_},ge=!0;return typeof g=="string"?(ge=!1,q.kind=g):N.is(g)?q.command=g:q.edit=g,ge&&D!==void 0&&(q.kind=D),q}y.create=w;function E(_){var g=_;return g&&A.string(g.title)&&(g.diagnostics===void 0||A.typedArray(g.diagnostics,v.is))&&(g.kind===void 0||A.string(g.kind))&&(g.edit!==void 0||g.command!==void 0)&&(g.command===void 0||N.is(g.command))&&(g.isPreferred===void 0||A.boolean(g.isPreferred))&&(g.edit===void 0||tn.is(g.edit))}y.is=E})(oc||(e.CodeAction=oc={}));var Ro;(function(y){function w(_,g){var D={range:_};return A.defined(g)&&(D.data=g),D}y.create=w;function E(_){var g=_;return A.defined(g)&&a.is(g.range)&&(A.undefined(g.command)||N.is(g.command))}y.is=E})(Ro||(e.CodeLens=Ro={}));var ac;(function(y){function w(_,g){return{tabSize:_,insertSpaces:g}}y.create=w;function E(_){var g=_;return A.defined(g)&&A.uinteger(g.tabSize)&&A.boolean(g.insertSpaces)}y.is=E})(ac||(e.FormattingOptions=ac={}));var ki;(function(y){function w(_,g,D){return{range:_,target:g,data:D}}y.create=w;function E(_){var g=_;return A.defined(g)&&a.is(g.range)&&(A.undefined(g.target)||A.string(g.target))}y.is=E})(ki||(e.DocumentLink=ki={}));var P;(function(y){function w(_,g){return{range:_,parent:g}}y.create=w;function E(_){var g=_;return A.objectLiteral(g)&&a.is(g.range)&&(g.parent===void 0||y.is(g.parent))}y.is=E})(P||(e.SelectionRange=P={}));var L;(function(y){y.namespace="namespace",y.type="type",y.class="class",y.enum="enum",y.interface="interface",y.struct="struct",y.typeParameter="typeParameter",y.parameter="parameter",y.variable="variable",y.property="property",y.enumMember="enumMember",y.event="event",y.function="function",y.method="method",y.macro="macro",y.keyword="keyword",y.modifier="modifier",y.comment="comment",y.string="string",y.number="number",y.regexp="regexp",y.operator="operator",y.decorator="decorator"})(L||(e.SemanticTokenTypes=L={}));var K;(function(y){y.declaration="declaration",y.definition="definition",y.readonly="readonly",y.static="static",y.deprecated="deprecated",y.abstract="abstract",y.async="async",y.modification="modification",y.documentation="documentation",y.defaultLibrary="defaultLibrary"})(K||(e.SemanticTokenModifiers=K={}));var re;(function(y){function w(E){var _=E;return A.objectLiteral(_)&&(_.resultId===void 0||typeof _.resultId=="string")&&Array.isArray(_.data)&&(_.data.length===0||typeof _.data[0]=="number")}y.is=w})(re||(e.SemanticTokens=re={}));var Ze;(function(y){function w(_,g){return{range:_,text:g}}y.create=w;function E(_){var g=_;return g!=null&&a.is(g.range)&&A.string(g.text)}y.is=E})(Ze||(e.InlineValueText=Ze={}));var Ge;(function(y){function w(_,g,D){return{range:_,variableName:g,caseSensitiveLookup:D}}y.create=w;function E(_){var g=_;return g!=null&&a.is(g.range)&&A.boolean(g.caseSensitiveLookup)&&(A.string(g.variableName)||g.variableName===void 0)}y.is=E})(Ge||(e.InlineValueVariableLookup=Ge={}));var ht;(function(y){function w(_,g){return{range:_,expression:g}}y.create=w;function E(_){var g=_;return g!=null&&a.is(g.range)&&(A.string(g.expression)||g.expression===void 0)}y.is=E})(ht||(e.InlineValueEvaluatableExpression=ht={}));var bt;(function(y){function w(_,g){return{frameId:_,stoppedLocation:g}}y.create=w;function E(_){var g=_;return A.defined(g)&&a.is(_.stoppedLocation)}y.is=E})(bt||(e.InlineValueContext=bt={}));var Re;(function(y){y.Type=1,y.Parameter=2;function w(E){return E===1||E===2}y.is=w})(Re||(e.InlayHintKind=Re={}));var nt;(function(y){function w(_){return{value:_}}y.create=w;function E(_){var g=_;return A.objectLiteral(g)&&(g.tooltip===void 0||A.string(g.tooltip)||$s.is(g.tooltip))&&(g.location===void 0||c.is(g.location))&&(g.command===void 0||N.is(g.command))}y.is=E})(nt||(e.InlayHintLabelPart=nt={}));var je;(function(y){function w(_,g,D){var q={position:_,label:g};return D!==void 0&&(q.kind=D),q}y.create=w;function E(_){var g=_;return A.objectLiteral(g)&&o.is(g.position)&&(A.string(g.label)||A.typedArray(g.label,nt.is))&&(g.kind===void 0||Re.is(g.kind))&&g.textEdits===void 0||A.typedArray(g.textEdits,C.is)&&(g.tooltip===void 0||A.string(g.tooltip)||$s.is(g.tooltip))&&(g.paddingLeft===void 0||A.boolean(g.paddingLeft))&&(g.paddingRight===void 0||A.boolean(g.paddingRight))}y.is=E})(je||(e.InlayHint=je={}));var Pt;(function(y){function w(E){return{kind:"snippet",value:E}}y.createSnippet=w})(Pt||(e.StringValue=Pt={}));var Wt;(function(y){function w(E,_,g,D){return{insertText:E,filterText:_,range:g,command:D}}y.create=w})(Wt||(e.InlineCompletionItem=Wt={}));var Vr;(function(y){function w(E){return{items:E}}y.create=w})(Vr||(e.InlineCompletionList=Vr={}));var Wu;(function(y){y.Invoked=0,y.Automatic=1})(Wu||(e.InlineCompletionTriggerKind=Wu={}));var Q_;(function(y){function w(E,_){return{range:E,text:_}}y.create=w})(Q_||(e.SelectedCompletionInfo=Q_={}));var Z_;(function(y){function w(E,_){return{triggerKind:E,selectedCompletionInfo:_}}y.create=w})(Z_||(e.InlineCompletionContext=Z_={}));var ek;(function(y){function w(E){var _=E;return A.objectLiteral(_)&&n.is(_.uri)&&A.string(_.name)}y.is=w})(ek||(e.WorkspaceFolder=ek={})),e.EOL=[`
|
|
32
|
+
`)),L){let re=P.error?` Request failed: ${P.error.message} (${P.error.code}).`:"";C.log(`Received response '${L.method} - (${P.id})' in ${Date.now()-L.timerStart}ms.${re}`,G)}else C.log(`Received response ${P.id} without active response promise.`,G)}else Pi("receive-response",P)}function Pi(P,L){if(!C||v===ze.Off)return;let G={isLSPMessage:!0,type:P,message:L,timestamp:Date.now()};C.log(G)}function Ki(){if(Bs())throw new qo(mc.Closed,"Connection is closed.");if(Ri())throw new qo(mc.Disposed,"Connection is disposed.")}function Gu(){if(sc())throw new qo(mc.AlreadyListening,"Connection is already listening")}function Ku(){if(!sc())throw new Error("Call listen() first.")}function ii(P){return P===void 0?null:P}function cc(P){if(P!==null)return P}function lc(P){return P!=null&&!Array.isArray(P)&&typeof P=="object"}function Co(P,L){switch(P){case de.ParameterStructures.auto:return lc(L)?cc(L):[ii(L)];case de.ParameterStructures.byName:if(!lc(L))throw new Error("Received parameters by name but param is not an object literal.");return cc(L);case de.ParameterStructures.byPosition:return[ii(L)];default:throw new Error(`Unknown parameter structure ${P.toString()}`)}}function uc(P,L){let G,re=P.numberOfParams;switch(re){case 0:G=void 0;break;case 1:G=Co(P.parameterStructures,L[0]);break;default:G=[];for(let et=0;et<L.length&&et<re;et++)G.push(ii(L[et]));if(L.length<re)for(let et=L.length;et<re;et++)G.push(null);break}return G}let wi={sendNotification:(P,...L)=>{Ki();let G,re;if(kt.string(P)){G=P;let Ke=L[0],ht=0,bt=de.ParameterStructures.auto;de.ParameterStructures.is(Ke)&&(ht=1,bt=Ke);let Re=L.length,it=Re-ht;switch(it){case 0:re=void 0;break;case 1:re=Co(bt,L[ht]);break;default:if(bt===de.ParameterStructures.byName)throw new Error(`Received ${it} parameters for 'by Name' notification parameter structure.`);re=L.slice(ht,Re).map(je=>ii(je));break}}else{let Ke=L;G=P.method,re=uc(P,Ke)}let et={jsonrpc:c,method:G,params:re};return Vu(et),e.write(et).catch(Ke=>{throw i.error("Sending notification failed."),Ke})},onNotification:(P,L)=>{Ki();let G;return kt.func(P)?d=P:L&&(kt.string(P)?(G=P,f.set(P,{type:void 0,handler:L})):(G=P.method,f.set(P.method,{type:P,handler:L}))),{dispose:()=>{G!==void 0?f.delete(G):d=void 0}}},onProgress:(P,L,G)=>{if(p.has(L))throw new Error(`Progress handler for token ${L} already registered`);return p.set(L,G),{dispose:()=>{p.delete(L)}}},sendProgress:(P,L,G)=>wi.sendNotification(hc.type,{token:L,value:G}),onUnhandledProgress:lt.event,sendRequest:(P,...L)=>{Ki(),Ku();let G,re,et;if(kt.string(P)){G=P;let Re=L[0],it=L[L.length-1],je=0,wt=de.ParameterStructures.auto;de.ParameterStructures.is(Re)&&(je=1,wt=Re);let Wt=L.length;Hg.CancellationToken.is(it)&&(Wt=Wt-1,et=it);let Wr=Wt-je;switch(Wr){case 0:re=void 0;break;case 1:re=Co(wt,L[je]);break;default:if(wt===de.ParameterStructures.byName)throw new Error(`Received ${Wr} parameters for 'by Name' request parameter structure.`);re=L.slice(je,Wt).map(Yu=>ii(Yu));break}}else{let Re=L;G=P.method,re=uc(P,Re);let it=P.numberOfParams;et=Hg.CancellationToken.is(Re[it])?Re[it]:void 0}let Ke=s++,ht;et&&(ht=et.onCancellationRequested(()=>{let Re=Ne.sender.sendCancellation(wi,Ke);return Re===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${Ke}`),Promise.resolve()):Re.catch(()=>{i.log(`Sending cancellation messages for id ${Ke} failed`)})}));let bt={jsonrpc:c,id:Ke,method:G,params:re};return Hu(bt),typeof Ne.sender.enableCancellation=="function"&&Ne.sender.enableCancellation(bt),new Promise(async(Re,it)=>{let je=Wr=>{Re(Wr),Ne.sender.cleanup(Ke),ht?.dispose()},wt=Wr=>{it(Wr),Ne.sender.cleanup(Ke),ht?.dispose()},Wt={method:G,timerStart:Date.now(),resolve:je,reject:wt};try{await e.write(bt),T.set(Ke,Wt)}catch(Wr){throw i.error("Sending request failed."),Wt.reject(new de.ResponseError(de.ErrorCodes.MessageWriteError,Wr.message?Wr.message:"Unknown reason")),Wr}})},onRequest:(P,L)=>{Ki();let G=null;return Wg.is(P)?(G=void 0,l=P):kt.string(P)?(G=null,L!==void 0&&(G=P,u.set(P,{handler:L,type:void 0}))):L!==void 0&&(G=P.method,u.set(P.method,{type:P,handler:L})),{dispose:()=>{G!==null&&(G!==void 0?u.delete(G):l=void 0)}}},hasPendingResponse:()=>T.size>0,trace:async(P,L,G)=>{let re=!1,et=Gr.Text;G!==void 0&&(kt.boolean(G)?re=G:(re=G.sendNotification||!1,et=G.traceFormat||Gr.Text)),v=P,N=et,v===ze.Off?C=void 0:C=L,re&&!Bs()&&!Ri()&&await wi.sendNotification(Gg.type,{value:ze.toString(P)})},onError:M.event,onClose:F.event,onUnhandledNotification:De.event,onDispose:Ht.event,end:()=>{e.end()},dispose:()=>{if(Ri())return;H=qn.Disposed,Ht.fire(void 0);let P=new de.ResponseError(de.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let L of T.values())L.reject(P);T=new Map,_=new Map,b=new Set,h=new Ek.LinkedMap,kt.func(e.dispose)&&e.dispose(),kt.func(t.dispose)&&t.dispose()},listen:()=>{Ki(),Gu(),H=qn.Listening,t.listen(Bu)},inspect:()=>{(0,wk.default)().console.log("inspect")}};return wi.onNotification(cd.type,P=>{if(v===ze.Off||!C)return;let L=v===ze.Verbose||v===ze.Compact;C.log(P.message,L?P.verbose:void 0)}),wi.onNotification(hc.type,P=>{let L=p.get(P.token);L?L(P.value):lt.fire(P)}),wi}ye.createMessageConnection=hF});var hd=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 dt=Sg();Object.defineProperty(O,"Message",{enumerable:!0,get:function(){return dt.Message}});Object.defineProperty(O,"RequestType",{enumerable:!0,get:function(){return dt.RequestType}});Object.defineProperty(O,"RequestType0",{enumerable:!0,get:function(){return dt.RequestType0}});Object.defineProperty(O,"RequestType1",{enumerable:!0,get:function(){return dt.RequestType1}});Object.defineProperty(O,"RequestType2",{enumerable:!0,get:function(){return dt.RequestType2}});Object.defineProperty(O,"RequestType3",{enumerable:!0,get:function(){return dt.RequestType3}});Object.defineProperty(O,"RequestType4",{enumerable:!0,get:function(){return dt.RequestType4}});Object.defineProperty(O,"RequestType5",{enumerable:!0,get:function(){return dt.RequestType5}});Object.defineProperty(O,"RequestType6",{enumerable:!0,get:function(){return dt.RequestType6}});Object.defineProperty(O,"RequestType7",{enumerable:!0,get:function(){return dt.RequestType7}});Object.defineProperty(O,"RequestType8",{enumerable:!0,get:function(){return dt.RequestType8}});Object.defineProperty(O,"RequestType9",{enumerable:!0,get:function(){return dt.RequestType9}});Object.defineProperty(O,"ResponseError",{enumerable:!0,get:function(){return dt.ResponseError}});Object.defineProperty(O,"ErrorCodes",{enumerable:!0,get:function(){return dt.ErrorCodes}});Object.defineProperty(O,"NotificationType",{enumerable:!0,get:function(){return dt.NotificationType}});Object.defineProperty(O,"NotificationType0",{enumerable:!0,get:function(){return dt.NotificationType0}});Object.defineProperty(O,"NotificationType1",{enumerable:!0,get:function(){return dt.NotificationType1}});Object.defineProperty(O,"NotificationType2",{enumerable:!0,get:function(){return dt.NotificationType2}});Object.defineProperty(O,"NotificationType3",{enumerable:!0,get:function(){return dt.NotificationType3}});Object.defineProperty(O,"NotificationType4",{enumerable:!0,get:function(){return dt.NotificationType4}});Object.defineProperty(O,"NotificationType5",{enumerable:!0,get:function(){return dt.NotificationType5}});Object.defineProperty(O,"NotificationType6",{enumerable:!0,get:function(){return dt.NotificationType6}});Object.defineProperty(O,"NotificationType7",{enumerable:!0,get:function(){return dt.NotificationType7}});Object.defineProperty(O,"NotificationType8",{enumerable:!0,get:function(){return dt.NotificationType8}});Object.defineProperty(O,"NotificationType9",{enumerable:!0,get:function(){return dt.NotificationType9}});Object.defineProperty(O,"ParameterStructures",{enumerable:!0,get:function(){return dt.ParameterStructures}});var Xg=kg();Object.defineProperty(O,"LinkedMap",{enumerable:!0,get:function(){return Xg.LinkedMap}});Object.defineProperty(O,"LRUCache",{enumerable:!0,get:function(){return Xg.LRUCache}});Object.defineProperty(O,"Touch",{enumerable:!0,get:function(){return Xg.Touch}});var mF=gk();Object.defineProperty(O,"Disposable",{enumerable:!0,get:function(){return mF.Disposable}});var Ik=Oo();Object.defineProperty(O,"Event",{enumerable:!0,get:function(){return Ik.Event}});Object.defineProperty(O,"Emitter",{enumerable:!0,get:function(){return Ik.Emitter}});var Ok=nd();Object.defineProperty(O,"CancellationTokenSource",{enumerable:!0,get:function(){return Ok.CancellationTokenSource}});Object.defineProperty(O,"CancellationToken",{enumerable:!0,get:function(){return Ok.CancellationToken}});var Mk=Tk();Object.defineProperty(O,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return Mk.SharedArraySenderStrategy}});Object.defineProperty(O,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return Mk.SharedArrayReceiverStrategy}});var Jg=bk();Object.defineProperty(O,"MessageReader",{enumerable:!0,get:function(){return Jg.MessageReader}});Object.defineProperty(O,"AbstractMessageReader",{enumerable:!0,get:function(){return Jg.AbstractMessageReader}});Object.defineProperty(O,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return Jg.ReadableStreamMessageReader}});var Qg=Rk();Object.defineProperty(O,"MessageWriter",{enumerable:!0,get:function(){return Qg.MessageWriter}});Object.defineProperty(O,"AbstractMessageWriter",{enumerable:!0,get:function(){return Qg.AbstractMessageWriter}});Object.defineProperty(O,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return Qg.WriteableStreamMessageWriter}});var gF=Pk();Object.defineProperty(O,"AbstractMessageBuffer",{enumerable:!0,get:function(){return gF.AbstractMessageBuffer}});var er=Ak();Object.defineProperty(O,"ConnectionStrategy",{enumerable:!0,get:function(){return er.ConnectionStrategy}});Object.defineProperty(O,"ConnectionOptions",{enumerable:!0,get:function(){return er.ConnectionOptions}});Object.defineProperty(O,"NullLogger",{enumerable:!0,get:function(){return er.NullLogger}});Object.defineProperty(O,"createMessageConnection",{enumerable:!0,get:function(){return er.createMessageConnection}});Object.defineProperty(O,"ProgressToken",{enumerable:!0,get:function(){return er.ProgressToken}});Object.defineProperty(O,"ProgressType",{enumerable:!0,get:function(){return er.ProgressType}});Object.defineProperty(O,"Trace",{enumerable:!0,get:function(){return er.Trace}});Object.defineProperty(O,"TraceValues",{enumerable:!0,get:function(){return er.TraceValues}});Object.defineProperty(O,"TraceFormat",{enumerable:!0,get:function(){return er.TraceFormat}});Object.defineProperty(O,"SetTraceNotification",{enumerable:!0,get:function(){return er.SetTraceNotification}});Object.defineProperty(O,"LogTraceNotification",{enumerable:!0,get:function(){return er.LogTraceNotification}});Object.defineProperty(O,"ConnectionErrors",{enumerable:!0,get:function(){return er.ConnectionErrors}});Object.defineProperty(O,"ConnectionError",{enumerable:!0,get:function(){return er.ConnectionError}});Object.defineProperty(O,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return er.CancellationReceiverStrategy}});Object.defineProperty(O,"CancellationSenderStrategy",{enumerable:!0,get:function(){return er.CancellationSenderStrategy}});Object.defineProperty(O,"CancellationStrategy",{enumerable:!0,get:function(){return er.CancellationStrategy}});Object.defineProperty(O,"MessageStrategy",{enumerable:!0,get:function(){return er.MessageStrategy}});var yF=Xi();O.RAL=yF.default});var qk=R(ry=>{"use strict";Object.defineProperty(ry,"__esModule",{value:!0});var xk=require("util"),Ci=hd(),md=class t extends Ci.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 xk.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)}};md.emptyBuffer=Buffer.allocUnsafe(0);var Zg=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),Ci.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),Ci.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),Ci.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),Ci.Disposable.create(()=>this.stream.off("data",e))}},ey=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),Ci.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),Ci.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),Ci.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()}},Lk=Object.freeze({messageBuffer:Object.freeze({create:t=>new md(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 xk.TextDecoder(e.charset).decode(t)))}catch(r){return Promise.reject(r)}}})}),stream:Object.freeze({asReadableStream:t=>new Zg(t),asWritableStream:t=>new ey(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 ty(){return Lk}(function(t){function e(){Ci.RAL.install(Lk)}t.install=e})(ty||(ty={}));ry.default=ty});var zs=R(Ie=>{"use strict";var TF=Ie&&Ie.__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]}),vF=Ie&&Ie.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&TF(e,t,r)};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.createMessageConnection=Ie.createServerSocketTransport=Ie.createClientSocketTransport=Ie.createServerPipeTransport=Ie.createClientPipeTransport=Ie.generateRandomPipeName=Ie.StreamMessageWriter=Ie.StreamMessageReader=Ie.SocketMessageWriter=Ie.SocketMessageReader=Ie.PortMessageWriter=Ie.PortMessageReader=Ie.IPCMessageWriter=Ie.IPCMessageReader=void 0;var $o=qk();$o.default.install();var $k=require("path"),bF=require("os"),SF=require("crypto"),Td=require("net"),Kr=hd();vF(hd(),Ie);var ny=class extends Kr.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),Kr.Disposable.create(()=>this.process.off("message",e))}};Ie.IPCMessageReader=ny;var iy=class extends Kr.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(){}};Ie.IPCMessageWriter=iy;var sy=class extends Kr.AbstractMessageReader{constructor(e){super(),this.onData=new Kr.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)}};Ie.PortMessageReader=sy;var oy=class extends Kr.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(){}};Ie.PortMessageWriter=oy;var Hs=class extends Kr.ReadableStreamMessageReader{constructor(e,r="utf-8"){super((0,$o.default)().stream.asReadableStream(e),r)}};Ie.SocketMessageReader=Hs;var Vs=class extends Kr.WriteableStreamMessageWriter{constructor(e,r){super((0,$o.default)().stream.asWritableStream(e),r),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};Ie.SocketMessageWriter=Vs;var gd=class extends Kr.ReadableStreamMessageReader{constructor(e,r){super((0,$o.default)().stream.asReadableStream(e),r)}};Ie.StreamMessageReader=gd;var yd=class extends Kr.WriteableStreamMessageWriter{constructor(e,r){super((0,$o.default)().stream.asWritableStream(e),r)}};Ie.StreamMessageWriter=yd;var Bk=process.env.XDG_RUNTIME_DIR,_F=new Map([["linux",107],["darwin",103]]);function kF(){let t=(0,SF.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${t}-sock`;let e;Bk?e=$k.join(Bk,`vscode-ipc-${t}.sock`):e=$k.join(bF.tmpdir(),`vscode-${t}.sock`);let r=_F.get(process.platform);return r!==void 0&&e.length>r&&(0,$o.default)().console.warn(`WARNING: IPC handle "${e}" is longer than ${r} characters.`),e}Ie.generateRandomPipeName=kF;function NF(t,e="utf-8"){let r,n=new Promise((i,s)=>{r=i});return new Promise((i,s)=>{let o=(0,Td.createServer)(a=>{o.close(),r([new Hs(a,e),new Vs(a,e)])});o.on("error",s),o.listen(t,()=>{o.removeListener("error",s),i({onConnected:()=>n})})})}Ie.createClientPipeTransport=NF;function RF(t,e="utf-8"){let r=(0,Td.createConnection)(t);return[new Hs(r,e),new Vs(r,e)]}Ie.createServerPipeTransport=RF;function PF(t,e="utf-8"){let r,n=new Promise((i,s)=>{r=i});return new Promise((i,s)=>{let o=(0,Td.createServer)(a=>{o.close(),r([new Hs(a,e),new Vs(a,e)])});o.on("error",s),o.listen(t,"127.0.0.1",()=>{o.removeListener("error",s),i({onConnected:()=>n})})})}Ie.createClientSocketTransport=PF;function wF(t,e="utf-8"){let r=(0,Td.createConnection)(t,"127.0.0.1");return[new Hs(r,e),new Vs(r,e)]}Ie.createServerSocketTransport=wF;function EF(t){let e=t;return e.read!==void 0&&e.addListener!==void 0}function CF(t){let e=t;return e.write!==void 0&&e.addListener!==void 0}function DF(t,e,r,n){r||(r=Kr.NullLogger);let i=EF(t)?new gd(t):t,s=CF(e)?new yd(e):e;return Kr.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Kr.createMessageConnection)(i,s,r,n)}Ie.createMessageConnection=DF});var ay=R((F6,Fk)=>{"use strict";Fk.exports=zs()});var bd=R((jk,vd)=>{(function(t){if(typeof vd=="object"&&typeof vd.exports=="object"){var e=t(require,jk);e!==void 0&&(vd.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(y){function w(E){return typeof E=="string"}y.is=w})(r||(e.DocumentUri=r={}));var n;(function(y){function w(E){return typeof E=="string"}y.is=w})(n||(e.URI=n={}));var i;(function(y){y.MIN_VALUE=-2147483648,y.MAX_VALUE=2147483647;function w(E){return typeof E=="number"&&y.MIN_VALUE<=E&&E<=y.MAX_VALUE}y.is=w})(i||(e.integer=i={}));var s;(function(y){y.MIN_VALUE=0,y.MAX_VALUE=2147483647;function w(E){return typeof E=="number"&&y.MIN_VALUE<=E&&E<=y.MAX_VALUE}y.is=w})(s||(e.uinteger=s={}));var o;(function(y){function w(S,g){return S===Number.MAX_VALUE&&(S=s.MAX_VALUE),g===Number.MAX_VALUE&&(g=s.MAX_VALUE),{line:S,character:g}}y.create=w;function E(S){var g=S;return A.objectLiteral(g)&&A.uinteger(g.line)&&A.uinteger(g.character)}y.is=E})(o||(e.Position=o={}));var a;(function(y){function w(S,g,D,q){if(A.uinteger(S)&&A.uinteger(g)&&A.uinteger(D)&&A.uinteger(q))return{start:o.create(S,g),end:o.create(D,q)};if(o.is(S)&&o.is(g))return{start:S,end:g};throw new Error("Range#create called with invalid arguments[".concat(S,", ").concat(g,", ").concat(D,", ").concat(q,"]"))}y.create=w;function E(S){var g=S;return A.objectLiteral(g)&&o.is(g.start)&&o.is(g.end)}y.is=E})(a||(e.Range=a={}));var c;(function(y){function w(S,g){return{uri:S,range:g}}y.create=w;function E(S){var g=S;return A.objectLiteral(g)&&a.is(g.range)&&(A.string(g.uri)||A.undefined(g.uri))}y.is=E})(c||(e.Location=c={}));var l;(function(y){function w(S,g,D,q){return{targetUri:S,targetRange:g,targetSelectionRange:D,originSelectionRange:q}}y.create=w;function E(S){var g=S;return A.objectLiteral(g)&&a.is(g.targetRange)&&A.string(g.targetUri)&&a.is(g.targetSelectionRange)&&(a.is(g.originSelectionRange)||A.undefined(g.originSelectionRange))}y.is=E})(l||(e.LocationLink=l={}));var u;(function(y){function w(S,g,D,q){return{red:S,green:g,blue:D,alpha:q}}y.create=w;function E(S){var g=S;return A.objectLiteral(g)&&A.numberRange(g.red,0,1)&&A.numberRange(g.green,0,1)&&A.numberRange(g.blue,0,1)&&A.numberRange(g.alpha,0,1)}y.is=E})(u||(e.Color=u={}));var d;(function(y){function w(S,g){return{range:S,color:g}}y.create=w;function E(S){var g=S;return A.objectLiteral(g)&&a.is(g.range)&&u.is(g.color)}y.is=E})(d||(e.ColorInformation=d={}));var f;(function(y){function w(S,g,D){return{label:S,textEdit:g,additionalTextEdits:D}}y.create=w;function E(S){var g=S;return A.objectLiteral(g)&&A.string(g.label)&&(A.undefined(g.textEdit)||C.is(g))&&(A.undefined(g.additionalTextEdits)||A.typedArray(g.additionalTextEdits,C.is))}y.is=E})(f||(e.ColorPresentation=f={}));var p;(function(y){y.Comment="comment",y.Imports="imports",y.Region="region"})(p||(e.FoldingRangeKind=p={}));var m;(function(y){function w(S,g,D,q,ge,Et){var ut={startLine:S,endLine:g};return A.defined(D)&&(ut.startCharacter=D),A.defined(q)&&(ut.endCharacter=q),A.defined(ge)&&(ut.kind=ge),A.defined(Et)&&(ut.collapsedText=Et),ut}y.create=w;function E(S){var g=S;return A.objectLiteral(g)&&A.uinteger(g.startLine)&&A.uinteger(g.startLine)&&(A.undefined(g.startCharacter)||A.uinteger(g.startCharacter))&&(A.undefined(g.endCharacter)||A.uinteger(g.endCharacter))&&(A.undefined(g.kind)||A.string(g.kind))}y.is=E})(m||(e.FoldingRange=m={}));var h;(function(y){function w(S,g){return{location:S,message:g}}y.create=w;function E(S){var g=S;return A.defined(g)&&c.is(g.location)&&A.string(g.message)}y.is=E})(h||(e.DiagnosticRelatedInformation=h={}));var T;(function(y){y.Error=1,y.Warning=2,y.Information=3,y.Hint=4})(T||(e.DiagnosticSeverity=T={}));var b;(function(y){y.Unnecessary=1,y.Deprecated=2})(b||(e.DiagnosticTag=b={}));var _;(function(y){function w(E){var S=E;return A.objectLiteral(S)&&A.string(S.href)}y.is=w})(_||(e.CodeDescription=_={}));var v;(function(y){function w(S,g,D,q,ge,Et){var ut={range:S,message:g};return A.defined(D)&&(ut.severity=D),A.defined(q)&&(ut.code=q),A.defined(ge)&&(ut.source=ge),A.defined(Et)&&(ut.relatedInformation=Et),ut}y.create=w;function E(S){var g,D=S;return A.defined(D)&&a.is(D.range)&&A.string(D.message)&&(A.number(D.severity)||A.undefined(D.severity))&&(A.integer(D.code)||A.string(D.code)||A.undefined(D.code))&&(A.undefined(D.codeDescription)||A.string((g=D.codeDescription)===null||g===void 0?void 0:g.href))&&(A.string(D.source)||A.undefined(D.source))&&(A.undefined(D.relatedInformation)||A.typedArray(D.relatedInformation,h.is))}y.is=E})(v||(e.Diagnostic=v={}));var N;(function(y){function w(S,g){for(var D=[],q=2;q<arguments.length;q++)D[q-2]=arguments[q];var ge={title:S,command:g};return A.defined(D)&&D.length>0&&(ge.arguments=D),ge}y.create=w;function E(S){var g=S;return A.defined(g)&&A.string(g.title)&&A.string(g.command)}y.is=E})(N||(e.Command=N={}));var C;(function(y){function w(D,q){return{range:D,newText:q}}y.replace=w;function E(D,q){return{range:{start:D,end:D},newText:q}}y.insert=E;function S(D){return{range:D,newText:""}}y.del=S;function g(D){var q=D;return A.objectLiteral(q)&&A.string(q.newText)&&a.is(q.range)}y.is=g})(C||(e.TextEdit=C={}));var H;(function(y){function w(S,g,D){var q={label:S};return g!==void 0&&(q.needsConfirmation=g),D!==void 0&&(q.description=D),q}y.create=w;function E(S){var g=S;return A.objectLiteral(g)&&A.string(g.label)&&(A.boolean(g.needsConfirmation)||g.needsConfirmation===void 0)&&(A.string(g.description)||g.description===void 0)}y.is=E})(H||(e.ChangeAnnotation=H={}));var M;(function(y){function w(E){var S=E;return A.string(S)}y.is=w})(M||(e.ChangeAnnotationIdentifier=M={}));var F;(function(y){function w(D,q,ge){return{range:D,newText:q,annotationId:ge}}y.replace=w;function E(D,q,ge){return{range:{start:D,end:D},newText:q,annotationId:ge}}y.insert=E;function S(D,q){return{range:D,newText:"",annotationId:q}}y.del=S;function g(D){var q=D;return C.is(q)&&(H.is(q.annotationId)||M.is(q.annotationId))}y.is=g})(F||(e.AnnotatedTextEdit=F={}));var De;(function(y){function w(S,g){return{textDocument:S,edits:g}}y.create=w;function E(S){var g=S;return A.defined(g)&&Bs.is(g.textDocument)&&Array.isArray(g.edits)}y.is=E})(De||(e.TextDocumentEdit=De={}));var lt;(function(y){function w(S,g,D){var q={kind:"create",uri:S};return g!==void 0&&(g.overwrite!==void 0||g.ignoreIfExists!==void 0)&&(q.options=g),D!==void 0&&(q.annotationId=D),q}y.create=w;function E(S){var g=S;return g&&g.kind==="create"&&A.string(g.uri)&&(g.options===void 0||(g.options.overwrite===void 0||A.boolean(g.options.overwrite))&&(g.options.ignoreIfExists===void 0||A.boolean(g.options.ignoreIfExists)))&&(g.annotationId===void 0||M.is(g.annotationId))}y.is=E})(lt||(e.CreateFile=lt={}));var Ht;(function(y){function w(S,g,D,q){var ge={kind:"rename",oldUri:S,newUri:g};return D!==void 0&&(D.overwrite!==void 0||D.ignoreIfExists!==void 0)&&(ge.options=D),q!==void 0&&(ge.annotationId=q),ge}y.create=w;function E(S){var g=S;return g&&g.kind==="rename"&&A.string(g.oldUri)&&A.string(g.newUri)&&(g.options===void 0||(g.options.overwrite===void 0||A.boolean(g.options.overwrite))&&(g.options.ignoreIfExists===void 0||A.boolean(g.options.ignoreIfExists)))&&(g.annotationId===void 0||M.is(g.annotationId))}y.is=E})(Ht||(e.RenameFile=Ht={}));var Ne;(function(y){function w(S,g,D){var q={kind:"delete",uri:S};return g!==void 0&&(g.recursive!==void 0||g.ignoreIfNotExists!==void 0)&&(q.options=g),D!==void 0&&(q.annotationId=D),q}y.create=w;function E(S){var g=S;return g&&g.kind==="delete"&&A.string(g.uri)&&(g.options===void 0||(g.options.recursive===void 0||A.boolean(g.options.recursive))&&(g.options.ignoreIfNotExists===void 0||A.boolean(g.options.ignoreIfNotExists)))&&(g.annotationId===void 0||M.is(g.annotationId))}y.is=E})(Ne||(e.DeleteFile=Ne={}));var an;(function(y){function w(E){var S=E;return S&&(S.changes!==void 0||S.documentChanges!==void 0)&&(S.documentChanges===void 0||S.documentChanges.every(function(g){return A.string(g.kind)?lt.is(g)||Ht.is(g)||Ne.is(g):De.is(g)}))}y.is=w})(an||(e.WorkspaceEdit=an={}));var Gi=function(){function y(w,E){this.edits=w,this.changeAnnotations=E}return y.prototype.insert=function(w,E,S){var g,D;if(S===void 0?g=C.insert(w,E):M.is(S)?(D=S,g=F.insert(w,E,S)):(this.assertChangeAnnotations(this.changeAnnotations),D=this.changeAnnotations.manage(S),g=F.insert(w,E,D)),this.edits.push(g),D!==void 0)return D},y.prototype.replace=function(w,E,S){var g,D;if(S===void 0?g=C.replace(w,E):M.is(S)?(D=S,g=F.replace(w,E,S)):(this.assertChangeAnnotations(this.changeAnnotations),D=this.changeAnnotations.manage(S),g=F.replace(w,E,D)),this.edits.push(g),D!==void 0)return D},y.prototype.delete=function(w,E){var S,g;if(E===void 0?S=C.del(w):M.is(E)?(g=E,S=F.del(w,E)):(this.assertChangeAnnotations(this.changeAnnotations),g=this.changeAnnotations.manage(E),S=F.del(w,g)),this.edits.push(S),g!==void 0)return g},y.prototype.add=function(w){this.edits.push(w)},y.prototype.all=function(){return this.edits},y.prototype.clear=function(){this.edits.splice(0,this.edits.length)},y.prototype.assertChangeAnnotations=function(w){if(w===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},y}(),xu=function(){function y(w){this._annotations=w===void 0?Object.create(null):w,this._counter=0,this._size=0}return y.prototype.all=function(){return this._annotations},Object.defineProperty(y.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),y.prototype.manage=function(w,E){var S;if(M.is(w)?S=w:(S=this.nextId(),E=w),this._annotations[S]!==void 0)throw new Error("Id ".concat(S," is already in use."));if(E===void 0)throw new Error("No annotation provided for id ".concat(S));return this._annotations[S]=E,this._size++,S},y.prototype.nextId=function(){return this._counter++,this._counter.toString()},y}(),Ym=function(){function y(w){var E=this;this._textEditChanges=Object.create(null),w!==void 0?(this._workspaceEdit=w,w.documentChanges?(this._changeAnnotations=new xu(w.changeAnnotations),w.changeAnnotations=this._changeAnnotations.all(),w.documentChanges.forEach(function(S){if(De.is(S)){var g=new Gi(S.edits,E._changeAnnotations);E._textEditChanges[S.textDocument.uri]=g}})):w.changes&&Object.keys(w.changes).forEach(function(S){var g=new Gi(w.changes[S]);E._textEditChanges[S]=g})):this._workspaceEdit={}}return Object.defineProperty(y.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}),y.prototype.getTextEditChange=function(w){if(Bs.is(w)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var E={uri:w.uri,version:w.version},S=this._textEditChanges[E.uri];if(!S){var g=[],D={textDocument:E,edits:g};this._workspaceEdit.documentChanges.push(D),S=new Gi(g,this._changeAnnotations),this._textEditChanges[E.uri]=S}return S}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var S=this._textEditChanges[w];if(!S){var g=[];this._workspaceEdit.changes[w]=g,S=new Gi(g),this._textEditChanges[w]=S}return S}},y.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new xu,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},y.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},y.prototype.createFile=function(w,E,S){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;H.is(E)||M.is(E)?g=E:S=E;var D,q;if(g===void 0?D=lt.create(w,S):(q=M.is(g)?g:this._changeAnnotations.manage(g),D=lt.create(w,S,q)),this._workspaceEdit.documentChanges.push(D),q!==void 0)return q},y.prototype.renameFile=function(w,E,S,g){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var D;H.is(S)||M.is(S)?D=S:g=S;var q,ge;if(D===void 0?q=Ht.create(w,E,g):(ge=M.is(D)?D:this._changeAnnotations.manage(D),q=Ht.create(w,E,g,ge)),this._workspaceEdit.documentChanges.push(q),ge!==void 0)return ge},y.prototype.deleteFile=function(w,E,S){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;H.is(E)||M.is(E)?g=E:S=E;var D,q;if(g===void 0?D=Ne.create(w,S):(q=M.is(g)?g:this._changeAnnotations.manage(g),D=Ne.create(w,S,q)),this._workspaceEdit.documentChanges.push(D),q!==void 0)return q},y}();e.WorkspaceChange=Ym;var Lu;(function(y){function w(S){return{uri:S}}y.create=w;function E(S){var g=S;return A.defined(g)&&A.string(g.uri)}y.is=E})(Lu||(e.TextDocumentIdentifier=Lu={}));var sc;(function(y){function w(S,g){return{uri:S,version:g}}y.create=w;function E(S){var g=S;return A.defined(g)&&A.string(g.uri)&&A.integer(g.version)}y.is=E})(sc||(e.VersionedTextDocumentIdentifier=sc={}));var Bs;(function(y){function w(S,g){return{uri:S,version:g}}y.create=w;function E(S){var g=S;return A.defined(g)&&A.string(g.uri)&&(g.version===null||A.integer(g.version))}y.is=E})(Bs||(e.OptionalVersionedTextDocumentIdentifier=Bs={}));var Ri;(function(y){function w(S,g,D,q){return{uri:S,languageId:g,version:D,text:q}}y.create=w;function E(S){var g=S;return A.defined(g)&&A.string(g.uri)&&A.string(g.languageId)&&A.integer(g.version)&&A.string(g.text)}y.is=E})(Ri||(e.TextDocumentItem=Ri={}));var Po;(function(y){y.PlainText="plaintext",y.Markdown="markdown";function w(E){var S=E;return S===y.PlainText||S===y.Markdown}y.is=w})(Po||(e.MarkupKind=Po={}));var Fs;(function(y){function w(E){var S=E;return A.objectLiteral(E)&&Po.is(S.kind)&&A.string(S.value)}y.is=w})(Fs||(e.MarkupContent=Fs={}));var qu;(function(y){y.Text=1,y.Method=2,y.Function=3,y.Constructor=4,y.Field=5,y.Variable=6,y.Class=7,y.Interface=8,y.Module=9,y.Property=10,y.Unit=11,y.Value=12,y.Enum=13,y.Keyword=14,y.Snippet=15,y.Color=16,y.File=17,y.Reference=18,y.Folder=19,y.EnumMember=20,y.Constant=21,y.Struct=22,y.Event=23,y.Operator=24,y.TypeParameter=25})(qu||(e.CompletionItemKind=qu={}));var oc;(function(y){y.PlainText=1,y.Snippet=2})(oc||(e.InsertTextFormat=oc={}));var ac;(function(y){y.Deprecated=1})(ac||(e.CompletionItemTag=ac={}));var $u;(function(y){function w(S,g,D){return{newText:S,insert:g,replace:D}}y.create=w;function E(S){var g=S;return g&&A.string(g.newText)&&a.is(g.insert)&&a.is(g.replace)}y.is=E})($u||(e.InsertReplaceEdit=$u={}));var Bu;(function(y){y.asIs=1,y.adjustIndentation=2})(Bu||(e.InsertTextMode=Bu={}));var Fu;(function(y){function w(E){var S=E;return S&&(A.string(S.detail)||S.detail===void 0)&&(A.string(S.description)||S.description===void 0)}y.is=w})(Fu||(e.CompletionItemLabelDetails=Fu={}));var ju;(function(y){function w(E){return{label:E}}y.create=w})(ju||(e.CompletionItem=ju={}));var Uu;(function(y){function w(E,S){return{items:E||[],isIncomplete:!!S}}y.create=w})(Uu||(e.CompletionList=Uu={}));var wo;(function(y){function w(S){return S.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}y.fromPlainText=w;function E(S){var g=S;return A.string(g)||A.objectLiteral(g)&&A.string(g.language)&&A.string(g.value)}y.is=E})(wo||(e.MarkedString=wo={}));var Mn;(function(y){function w(E){var S=E;return!!S&&A.objectLiteral(S)&&(Fs.is(S.contents)||wo.is(S.contents)||A.typedArray(S.contents,wo.is))&&(E.range===void 0||a.is(E.range))}y.is=w})(Mn||(e.Hover=Mn={}));var Hu;(function(y){function w(E,S){return S?{label:E,documentation:S}:{label:E}}y.create=w})(Hu||(e.ParameterInformation=Hu={}));var Vu;(function(y){function w(E,S){for(var g=[],D=2;D<arguments.length;D++)g[D-2]=arguments[D];var q={label:E};return A.defined(S)&&(q.documentation=S),A.defined(g)?q.parameters=g:q.parameters=[],q}y.create=w})(Vu||(e.SignatureInformation=Vu={}));var js;(function(y){y.Text=1,y.Read=2,y.Write=3})(js||(e.DocumentHighlightKind=js={}));var zu;(function(y){function w(E,S){var g={range:E};return A.number(S)&&(g.kind=S),g}y.create=w})(zu||(e.DocumentHighlight=zu={}));var Eo;(function(y){y.File=1,y.Module=2,y.Namespace=3,y.Package=4,y.Class=5,y.Method=6,y.Property=7,y.Field=8,y.Constructor=9,y.Enum=10,y.Interface=11,y.Function=12,y.Variable=13,y.Constant=14,y.String=15,y.Number=16,y.Boolean=17,y.Array=18,y.Object=19,y.Key=20,y.Null=21,y.EnumMember=22,y.Struct=23,y.Event=24,y.Operator=25,y.TypeParameter=26})(Eo||(e.SymbolKind=Eo={}));var Wu;(function(y){y.Deprecated=1})(Wu||(e.SymbolTag=Wu={}));var Pi;(function(y){function w(E,S,g,D,q){var ge={name:E,kind:S,location:{uri:D,range:g}};return q&&(ge.containerName=q),ge}y.create=w})(Pi||(e.SymbolInformation=Pi={}));var Ki;(function(y){function w(E,S,g,D){return D!==void 0?{name:E,kind:S,location:{uri:g,range:D}}:{name:E,kind:S,location:{uri:g}}}y.create=w})(Ki||(e.WorkspaceSymbol=Ki={}));var Gu;(function(y){function w(S,g,D,q,ge,Et){var ut={name:S,detail:g,kind:D,range:q,selectionRange:ge};return Et!==void 0&&(ut.children=Et),ut}y.create=w;function E(S){var g=S;return g&&A.string(g.name)&&A.number(g.kind)&&a.is(g.range)&&a.is(g.selectionRange)&&(g.detail===void 0||A.string(g.detail))&&(g.deprecated===void 0||A.boolean(g.deprecated))&&(g.children===void 0||Array.isArray(g.children))&&(g.tags===void 0||Array.isArray(g.tags))}y.is=E})(Gu||(e.DocumentSymbol=Gu={}));var Ku;(function(y){y.Empty="",y.QuickFix="quickfix",y.Refactor="refactor",y.RefactorExtract="refactor.extract",y.RefactorInline="refactor.inline",y.RefactorRewrite="refactor.rewrite",y.Source="source",y.SourceOrganizeImports="source.organizeImports",y.SourceFixAll="source.fixAll"})(Ku||(e.CodeActionKind=Ku={}));var ii;(function(y){y.Invoked=1,y.Automatic=2})(ii||(e.CodeActionTriggerKind=ii={}));var cc;(function(y){function w(S,g,D){var q={diagnostics:S};return g!=null&&(q.only=g),D!=null&&(q.triggerKind=D),q}y.create=w;function E(S){var g=S;return A.defined(g)&&A.typedArray(g.diagnostics,v.is)&&(g.only===void 0||A.typedArray(g.only,A.string))&&(g.triggerKind===void 0||g.triggerKind===ii.Invoked||g.triggerKind===ii.Automatic)}y.is=E})(cc||(e.CodeActionContext=cc={}));var lc;(function(y){function w(S,g,D){var q={title:S},ge=!0;return typeof g=="string"?(ge=!1,q.kind=g):N.is(g)?q.command=g:q.edit=g,ge&&D!==void 0&&(q.kind=D),q}y.create=w;function E(S){var g=S;return g&&A.string(g.title)&&(g.diagnostics===void 0||A.typedArray(g.diagnostics,v.is))&&(g.kind===void 0||A.string(g.kind))&&(g.edit!==void 0||g.command!==void 0)&&(g.command===void 0||N.is(g.command))&&(g.isPreferred===void 0||A.boolean(g.isPreferred))&&(g.edit===void 0||an.is(g.edit))}y.is=E})(lc||(e.CodeAction=lc={}));var Co;(function(y){function w(S,g){var D={range:S};return A.defined(g)&&(D.data=g),D}y.create=w;function E(S){var g=S;return A.defined(g)&&a.is(g.range)&&(A.undefined(g.command)||N.is(g.command))}y.is=E})(Co||(e.CodeLens=Co={}));var uc;(function(y){function w(S,g){return{tabSize:S,insertSpaces:g}}y.create=w;function E(S){var g=S;return A.defined(g)&&A.uinteger(g.tabSize)&&A.boolean(g.insertSpaces)}y.is=E})(uc||(e.FormattingOptions=uc={}));var wi;(function(y){function w(S,g,D){return{range:S,target:g,data:D}}y.create=w;function E(S){var g=S;return A.defined(g)&&a.is(g.range)&&(A.undefined(g.target)||A.string(g.target))}y.is=E})(wi||(e.DocumentLink=wi={}));var P;(function(y){function w(S,g){return{range:S,parent:g}}y.create=w;function E(S){var g=S;return A.objectLiteral(g)&&a.is(g.range)&&(g.parent===void 0||y.is(g.parent))}y.is=E})(P||(e.SelectionRange=P={}));var L;(function(y){y.namespace="namespace",y.type="type",y.class="class",y.enum="enum",y.interface="interface",y.struct="struct",y.typeParameter="typeParameter",y.parameter="parameter",y.variable="variable",y.property="property",y.enumMember="enumMember",y.event="event",y.function="function",y.method="method",y.macro="macro",y.keyword="keyword",y.modifier="modifier",y.comment="comment",y.string="string",y.number="number",y.regexp="regexp",y.operator="operator",y.decorator="decorator"})(L||(e.SemanticTokenTypes=L={}));var G;(function(y){y.declaration="declaration",y.definition="definition",y.readonly="readonly",y.static="static",y.deprecated="deprecated",y.abstract="abstract",y.async="async",y.modification="modification",y.documentation="documentation",y.defaultLibrary="defaultLibrary"})(G||(e.SemanticTokenModifiers=G={}));var re;(function(y){function w(E){var S=E;return A.objectLiteral(S)&&(S.resultId===void 0||typeof S.resultId=="string")&&Array.isArray(S.data)&&(S.data.length===0||typeof S.data[0]=="number")}y.is=w})(re||(e.SemanticTokens=re={}));var et;(function(y){function w(S,g){return{range:S,text:g}}y.create=w;function E(S){var g=S;return g!=null&&a.is(g.range)&&A.string(g.text)}y.is=E})(et||(e.InlineValueText=et={}));var Ke;(function(y){function w(S,g,D){return{range:S,variableName:g,caseSensitiveLookup:D}}y.create=w;function E(S){var g=S;return g!=null&&a.is(g.range)&&A.boolean(g.caseSensitiveLookup)&&(A.string(g.variableName)||g.variableName===void 0)}y.is=E})(Ke||(e.InlineValueVariableLookup=Ke={}));var ht;(function(y){function w(S,g){return{range:S,expression:g}}y.create=w;function E(S){var g=S;return g!=null&&a.is(g.range)&&(A.string(g.expression)||g.expression===void 0)}y.is=E})(ht||(e.InlineValueEvaluatableExpression=ht={}));var bt;(function(y){function w(S,g){return{frameId:S,stoppedLocation:g}}y.create=w;function E(S){var g=S;return A.defined(g)&&a.is(S.stoppedLocation)}y.is=E})(bt||(e.InlineValueContext=bt={}));var Re;(function(y){y.Type=1,y.Parameter=2;function w(E){return E===1||E===2}y.is=w})(Re||(e.InlayHintKind=Re={}));var it;(function(y){function w(S){return{value:S}}y.create=w;function E(S){var g=S;return A.objectLiteral(g)&&(g.tooltip===void 0||A.string(g.tooltip)||Fs.is(g.tooltip))&&(g.location===void 0||c.is(g.location))&&(g.command===void 0||N.is(g.command))}y.is=E})(it||(e.InlayHintLabelPart=it={}));var je;(function(y){function w(S,g,D){var q={position:S,label:g};return D!==void 0&&(q.kind=D),q}y.create=w;function E(S){var g=S;return A.objectLiteral(g)&&o.is(g.position)&&(A.string(g.label)||A.typedArray(g.label,it.is))&&(g.kind===void 0||Re.is(g.kind))&&g.textEdits===void 0||A.typedArray(g.textEdits,C.is)&&(g.tooltip===void 0||A.string(g.tooltip)||Fs.is(g.tooltip))&&(g.paddingLeft===void 0||A.boolean(g.paddingLeft))&&(g.paddingRight===void 0||A.boolean(g.paddingRight))}y.is=E})(je||(e.InlayHint=je={}));var wt;(function(y){function w(E){return{kind:"snippet",value:E}}y.createSnippet=w})(wt||(e.StringValue=wt={}));var Wt;(function(y){function w(E,S,g,D){return{insertText:E,filterText:S,range:g,command:D}}y.create=w})(Wt||(e.InlineCompletionItem=Wt={}));var Wr;(function(y){function w(E){return{items:E}}y.create=w})(Wr||(e.InlineCompletionList=Wr={}));var Yu;(function(y){y.Invoked=0,y.Automatic=1})(Yu||(e.InlineCompletionTriggerKind=Yu={}));var nk;(function(y){function w(E,S){return{range:E,text:S}}y.create=w})(nk||(e.SelectedCompletionInfo=nk={}));var ik;(function(y){function w(E,S){return{triggerKind:E,selectedCompletionInfo:S}}y.create=w})(ik||(e.InlineCompletionContext=ik={}));var sk;(function(y){function w(E){var S=E;return A.objectLiteral(S)&&n.is(S.uri)&&A.string(S.name)}y.is=w})(sk||(e.WorkspaceFolder=sk={})),e.EOL=[`
|
|
33
33
|
`,`\r
|
|
34
|
-
`,"\r"];var
|
|
34
|
+
`,"\r"];var ok;(function(y){function w(D,q,ge,Et){return new qB(D,q,ge,Et)}y.create=w;function E(D){var q=D;return!!(A.defined(q)&&A.string(q.uri)&&(A.undefined(q.languageId)||A.string(q.languageId))&&A.uinteger(q.lineCount)&&A.func(q.getText)&&A.func(q.positionAt)&&A.func(q.offsetAt))}y.is=E;function S(D,q){for(var ge=D.getText(),Et=g(q,function(Do,Xu){var ak=Do.range.start.line-Xu.range.start.line;return ak===0?Do.range.start.character-Xu.range.start.character:ak}),ut=ge.length,xn=Et.length-1;xn>=0;xn--){var Ln=Et[xn],Ei=D.offsetAt(Ln.range.start),Ae=D.offsetAt(Ln.range.end);if(Ae<=ut)ge=ge.substring(0,Ei)+Ln.newText+ge.substring(Ae,ge.length);else throw new Error("Overlapping edit");ut=Ei}return ge}y.applyEdits=S;function g(D,q){if(D.length<=1)return D;var ge=D.length/2|0,Et=D.slice(0,ge),ut=D.slice(ge);g(Et,q),g(ut,q);for(var xn=0,Ln=0,Ei=0;xn<Et.length&&Ln<ut.length;){var Ae=q(Et[xn],ut[Ln]);Ae<=0?D[Ei++]=Et[xn++]:D[Ei++]=ut[Ln++]}for(;xn<Et.length;)D[Ei++]=Et[xn++];for(;Ln<ut.length;)D[Ei++]=ut[Ln++];return D}})(ok||(e.TextDocument=ok={}));var qB=function(){function y(w,E,S,g){this._uri=w,this._languageId=E,this._version=S,this._content=g,this._lineOffsets=void 0}return Object.defineProperty(y.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),y.prototype.getText=function(w){if(w){var E=this.offsetAt(w.start),S=this.offsetAt(w.end);return this._content.substring(E,S)}return this._content},y.prototype.update=function(w,E){this._content=w.text,this._version=E,this._lineOffsets=void 0},y.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var w=[],E=this._content,S=!0,g=0;g<E.length;g++){S&&(w.push(g),S=!1);var D=E.charAt(g);S=D==="\r"||D===`
|
|
35
35
|
`,D==="\r"&&g+1<E.length&&E.charAt(g+1)===`
|
|
36
|
-
`&&g++}_&&E.length>0&&w.push(E.length),this._lineOffsets=w}return this._lineOffsets},y.prototype.positionAt=function(w){w=Math.max(Math.min(w,this._content.length),0);var E=this.getLineOffsets(),_=0,g=E.length;if(g===0)return o.create(0,w);for(;_<g;){var D=Math.floor((_+g)/2);E[D]>w?g=D:_=D+1}var q=_-1;return o.create(q,w-E[q])},y.prototype.offsetAt=function(w){var E=this.getLineOffsets();if(w.line>=E.length)return this._content.length;if(w.line<0)return 0;var _=E[w.line],g=w.line+1<E.length?E[w.line+1]:this._content.length;return Math.max(Math.min(_+w.character,g),_)},Object.defineProperty(y.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),y}(),A;(function(y){var w=Object.prototype.toString;function E(Ae){return typeof Ae<"u"}y.defined=E;function _(Ae){return typeof Ae>"u"}y.undefined=_;function g(Ae){return Ae===!0||Ae===!1}y.boolean=g;function D(Ae){return w.call(Ae)==="[object String]"}y.string=D;function q(Ae){return w.call(Ae)==="[object Number]"}y.number=q;function ge(Ae,Po,Gu){return w.call(Ae)==="[object Number]"&&Po<=Ae&&Ae<=Gu}y.numberRange=ge;function wt(Ae){return w.call(Ae)==="[object Number]"&&-2147483648<=Ae&&Ae<=2147483647}y.integer=wt;function ut(Ae){return w.call(Ae)==="[object Number]"&&0<=Ae&&Ae<=2147483647}y.uinteger=ut;function In(Ae){return w.call(Ae)==="[object Function]"}y.func=In;function On(Ae){return Ae!==null&&typeof Ae=="object"}y.objectLiteral=On;function Ni(Ae,Po){return Array.isArray(Ae)&&Ae.every(Po)}y.typedArray=Ni})(A||(A={}))})});var St=R(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.ProtocolNotificationType=Cr.ProtocolNotificationType0=Cr.ProtocolRequestType=Cr.ProtocolRequestType0=Cr.RegistrationType=Cr.MessageDirection=void 0;var xo=Hs(),qk;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(qk||(Cr.MessageDirection=qk={}));var ty=class{constructor(e){this.method=e}};Cr.RegistrationType=ty;var ry=class extends xo.RequestType0{constructor(e){super(e)}};Cr.ProtocolRequestType0=ry;var ny=class extends xo.RequestType{constructor(e){super(e,xo.ParameterStructures.byName)}};Cr.ProtocolRequestType=ny;var iy=class extends xo.NotificationType0{constructor(e){super(e)}};Cr.ProtocolNotificationType0=iy;var sy=class extends xo.NotificationType{constructor(e){super(e,xo.ParameterStructures.byName)}};Cr.ProtocolNotificationType=sy});var Td=R(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.objectLiteral=qt.typedArray=qt.stringArray=qt.array=qt.func=qt.error=qt.number=qt.string=qt.boolean=void 0;function EF(t){return t===!0||t===!1}qt.boolean=EF;function $k(t){return typeof t=="string"||t instanceof String}qt.string=$k;function CF(t){return typeof t=="number"||t instanceof Number}qt.number=CF;function DF(t){return t instanceof Error}qt.error=DF;function AF(t){return typeof t=="function"}qt.func=AF;function Bk(t){return Array.isArray(t)}qt.array=Bk;function IF(t){return Bk(t)&&t.every(e=>$k(e))}qt.stringArray=IF;function OF(t,e){return Array.isArray(t)&&t.every(e)}qt.typedArray=OF;function MF(t){return t!==null&&typeof t=="object"}qt.objectLiteral=MF});var Uk=R(vd=>{"use strict";Object.defineProperty(vd,"__esModule",{value:!0});vd.ImplementationRequest=void 0;var Fk=St(),jk;(function(t){t.method="textDocument/implementation",t.messageDirection=Fk.MessageDirection.clientToServer,t.type=new Fk.ProtocolRequestType(t.method)})(jk||(vd.ImplementationRequest=jk={}))});var zk=R(bd=>{"use strict";Object.defineProperty(bd,"__esModule",{value:!0});bd.TypeDefinitionRequest=void 0;var Hk=St(),Vk;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=Hk.MessageDirection.clientToServer,t.type=new Hk.ProtocolRequestType(t.method)})(Vk||(bd.TypeDefinitionRequest=Vk={}))});var Kk=R(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.DidChangeWorkspaceFoldersNotification=Lo.WorkspaceFoldersRequest=void 0;var Sd=St(),Wk;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=Sd.MessageDirection.serverToClient,t.type=new Sd.ProtocolRequestType0(t.method)})(Wk||(Lo.WorkspaceFoldersRequest=Wk={}));var Gk;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=Sd.MessageDirection.clientToServer,t.type=new Sd.ProtocolNotificationType(t.method)})(Gk||(Lo.DidChangeWorkspaceFoldersNotification=Gk={}))});var Jk=R(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});_d.ConfigurationRequest=void 0;var Yk=St(),Xk;(function(t){t.method="workspace/configuration",t.messageDirection=Yk.MessageDirection.serverToClient,t.type=new Yk.ProtocolRequestType(t.method)})(Xk||(_d.ConfigurationRequest=Xk={}))});var eN=R(qo=>{"use strict";Object.defineProperty(qo,"__esModule",{value:!0});qo.ColorPresentationRequest=qo.DocumentColorRequest=void 0;var kd=St(),Qk;(function(t){t.method="textDocument/documentColor",t.messageDirection=kd.MessageDirection.clientToServer,t.type=new kd.ProtocolRequestType(t.method)})(Qk||(qo.DocumentColorRequest=Qk={}));var Zk;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=kd.MessageDirection.clientToServer,t.type=new kd.ProtocolRequestType(t.method)})(Zk||(qo.ColorPresentationRequest=Zk={}))});var nN=R($o=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});$o.FoldingRangeRefreshRequest=$o.FoldingRangeRequest=void 0;var Nd=St(),tN;(function(t){t.method="textDocument/foldingRange",t.messageDirection=Nd.MessageDirection.clientToServer,t.type=new Nd.ProtocolRequestType(t.method)})(tN||($o.FoldingRangeRequest=tN={}));var rN;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=Nd.MessageDirection.serverToClient,t.type=new Nd.ProtocolRequestType0(t.method)})(rN||($o.FoldingRangeRefreshRequest=rN={}))});var oN=R(Rd=>{"use strict";Object.defineProperty(Rd,"__esModule",{value:!0});Rd.DeclarationRequest=void 0;var iN=St(),sN;(function(t){t.method="textDocument/declaration",t.messageDirection=iN.MessageDirection.clientToServer,t.type=new iN.ProtocolRequestType(t.method)})(sN||(Rd.DeclarationRequest=sN={}))});var lN=R(Pd=>{"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});Pd.SelectionRangeRequest=void 0;var aN=St(),cN;(function(t){t.method="textDocument/selectionRange",t.messageDirection=aN.MessageDirection.clientToServer,t.type=new aN.ProtocolRequestType(t.method)})(cN||(Pd.SelectionRangeRequest=cN={}))});var pN=R(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.WorkDoneProgressCancelNotification=Ji.WorkDoneProgressCreateRequest=Ji.WorkDoneProgress=void 0;var xF=Hs(),wd=St(),uN;(function(t){t.type=new xF.ProgressType;function e(r){return r===t.type}t.is=e})(uN||(Ji.WorkDoneProgress=uN={}));var dN;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=wd.MessageDirection.serverToClient,t.type=new wd.ProtocolRequestType(t.method)})(dN||(Ji.WorkDoneProgressCreateRequest=dN={}));var fN;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=wd.MessageDirection.clientToServer,t.type=new wd.ProtocolNotificationType(t.method)})(fN||(Ji.WorkDoneProgressCancelNotification=fN={}))});var yN=R(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Qi.CallHierarchyOutgoingCallsRequest=Qi.CallHierarchyIncomingCallsRequest=Qi.CallHierarchyPrepareRequest=void 0;var Bo=St(),hN;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=Bo.MessageDirection.clientToServer,t.type=new Bo.ProtocolRequestType(t.method)})(hN||(Qi.CallHierarchyPrepareRequest=hN={}));var mN;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=Bo.MessageDirection.clientToServer,t.type=new Bo.ProtocolRequestType(t.method)})(mN||(Qi.CallHierarchyIncomingCallsRequest=mN={}));var gN;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=Bo.MessageDirection.clientToServer,t.type=new Bo.ProtocolRequestType(t.method)})(gN||(Qi.CallHierarchyOutgoingCallsRequest=gN={}))});var kN=R(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.SemanticTokensRefreshRequest=Dr.SemanticTokensRangeRequest=Dr.SemanticTokensDeltaRequest=Dr.SemanticTokensRequest=Dr.SemanticTokensRegistrationType=Dr.TokenFormat=void 0;var Pi=St(),TN;(function(t){t.Relative="relative"})(TN||(Dr.TokenFormat=TN={}));var hc;(function(t){t.method="textDocument/semanticTokens",t.type=new Pi.RegistrationType(t.method)})(hc||(Dr.SemanticTokensRegistrationType=hc={}));var vN;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=Pi.MessageDirection.clientToServer,t.type=new Pi.ProtocolRequestType(t.method),t.registrationMethod=hc.method})(vN||(Dr.SemanticTokensRequest=vN={}));var bN;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=Pi.MessageDirection.clientToServer,t.type=new Pi.ProtocolRequestType(t.method),t.registrationMethod=hc.method})(bN||(Dr.SemanticTokensDeltaRequest=bN={}));var SN;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=Pi.MessageDirection.clientToServer,t.type=new Pi.ProtocolRequestType(t.method),t.registrationMethod=hc.method})(SN||(Dr.SemanticTokensRangeRequest=SN={}));var _N;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=Pi.MessageDirection.serverToClient,t.type=new Pi.ProtocolRequestType0(t.method)})(_N||(Dr.SemanticTokensRefreshRequest=_N={}))});var PN=R(Ed=>{"use strict";Object.defineProperty(Ed,"__esModule",{value:!0});Ed.ShowDocumentRequest=void 0;var NN=St(),RN;(function(t){t.method="window/showDocument",t.messageDirection=NN.MessageDirection.serverToClient,t.type=new NN.ProtocolRequestType(t.method)})(RN||(Ed.ShowDocumentRequest=RN={}))});var CN=R(Cd=>{"use strict";Object.defineProperty(Cd,"__esModule",{value:!0});Cd.LinkedEditingRangeRequest=void 0;var wN=St(),EN;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=wN.MessageDirection.clientToServer,t.type=new wN.ProtocolRequestType(t.method)})(EN||(Cd.LinkedEditingRangeRequest=EN={}))});var qN=R(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.WillDeleteFilesRequest=lr.DidDeleteFilesNotification=lr.DidRenameFilesNotification=lr.WillRenameFilesRequest=lr.DidCreateFilesNotification=lr.WillCreateFilesRequest=lr.FileOperationPatternKind=void 0;var rn=St(),DN;(function(t){t.file="file",t.folder="folder"})(DN||(lr.FileOperationPatternKind=DN={}));var AN;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=rn.MessageDirection.clientToServer,t.type=new rn.ProtocolRequestType(t.method)})(AN||(lr.WillCreateFilesRequest=AN={}));var IN;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=rn.MessageDirection.clientToServer,t.type=new rn.ProtocolNotificationType(t.method)})(IN||(lr.DidCreateFilesNotification=IN={}));var ON;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=rn.MessageDirection.clientToServer,t.type=new rn.ProtocolRequestType(t.method)})(ON||(lr.WillRenameFilesRequest=ON={}));var MN;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=rn.MessageDirection.clientToServer,t.type=new rn.ProtocolNotificationType(t.method)})(MN||(lr.DidRenameFilesNotification=MN={}));var xN;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=rn.MessageDirection.clientToServer,t.type=new rn.ProtocolNotificationType(t.method)})(xN||(lr.DidDeleteFilesNotification=xN={}));var LN;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=rn.MessageDirection.clientToServer,t.type=new rn.ProtocolRequestType(t.method)})(LN||(lr.WillDeleteFilesRequest=LN={}))});var UN=R(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.MonikerRequest=Zi.MonikerKind=Zi.UniquenessLevel=void 0;var $N=St(),BN;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(BN||(Zi.UniquenessLevel=BN={}));var FN;(function(t){t.$import="import",t.$export="export",t.local="local"})(FN||(Zi.MonikerKind=FN={}));var jN;(function(t){t.method="textDocument/moniker",t.messageDirection=$N.MessageDirection.clientToServer,t.type=new $N.ProtocolRequestType(t.method)})(jN||(Zi.MonikerRequest=jN={}))});var WN=R(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.TypeHierarchySubtypesRequest=es.TypeHierarchySupertypesRequest=es.TypeHierarchyPrepareRequest=void 0;var Fo=St(),HN;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=Fo.MessageDirection.clientToServer,t.type=new Fo.ProtocolRequestType(t.method)})(HN||(es.TypeHierarchyPrepareRequest=HN={}));var VN;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=Fo.MessageDirection.clientToServer,t.type=new Fo.ProtocolRequestType(t.method)})(VN||(es.TypeHierarchySupertypesRequest=VN={}));var zN;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=Fo.MessageDirection.clientToServer,t.type=new Fo.ProtocolRequestType(t.method)})(zN||(es.TypeHierarchySubtypesRequest=zN={}))});var YN=R(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.InlineValueRefreshRequest=jo.InlineValueRequest=void 0;var Dd=St(),GN;(function(t){t.method="textDocument/inlineValue",t.messageDirection=Dd.MessageDirection.clientToServer,t.type=new Dd.ProtocolRequestType(t.method)})(GN||(jo.InlineValueRequest=GN={}));var KN;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=Dd.MessageDirection.serverToClient,t.type=new Dd.ProtocolRequestType0(t.method)})(KN||(jo.InlineValueRefreshRequest=KN={}))});var ZN=R(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.InlayHintRefreshRequest=ts.InlayHintResolveRequest=ts.InlayHintRequest=void 0;var Uo=St(),XN;(function(t){t.method="textDocument/inlayHint",t.messageDirection=Uo.MessageDirection.clientToServer,t.type=new Uo.ProtocolRequestType(t.method)})(XN||(ts.InlayHintRequest=XN={}));var JN;(function(t){t.method="inlayHint/resolve",t.messageDirection=Uo.MessageDirection.clientToServer,t.type=new Uo.ProtocolRequestType(t.method)})(JN||(ts.InlayHintResolveRequest=JN={}));var QN;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=Uo.MessageDirection.serverToClient,t.type=new Uo.ProtocolRequestType0(t.method)})(QN||(ts.InlayHintRefreshRequest=QN={}))});var oR=R(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.DiagnosticRefreshRequest=nn.WorkspaceDiagnosticRequest=nn.DocumentDiagnosticRequest=nn.DocumentDiagnosticReportKind=nn.DiagnosticServerCancellationData=void 0;var sR=Hs(),LF=Td(),Ho=St(),eR;(function(t){function e(r){let n=r;return n&&LF.boolean(n.retriggerRequest)}t.is=e})(eR||(nn.DiagnosticServerCancellationData=eR={}));var tR;(function(t){t.Full="full",t.Unchanged="unchanged"})(tR||(nn.DocumentDiagnosticReportKind=tR={}));var rR;(function(t){t.method="textDocument/diagnostic",t.messageDirection=Ho.MessageDirection.clientToServer,t.type=new Ho.ProtocolRequestType(t.method),t.partialResult=new sR.ProgressType})(rR||(nn.DocumentDiagnosticRequest=rR={}));var nR;(function(t){t.method="workspace/diagnostic",t.messageDirection=Ho.MessageDirection.clientToServer,t.type=new Ho.ProtocolRequestType(t.method),t.partialResult=new sR.ProgressType})(nR||(nn.WorkspaceDiagnosticRequest=nR={}));var iR;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=Ho.MessageDirection.serverToClient,t.type=new Ho.ProtocolRequestType0(t.method)})(iR||(nn.DiagnosticRefreshRequest=iR={}))});var pR=R(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.DidCloseNotebookDocumentNotification=Et.DidSaveNotebookDocumentNotification=Et.DidChangeNotebookDocumentNotification=Et.NotebookCellArrayChange=Et.DidOpenNotebookDocumentNotification=Et.NotebookDocumentSyncRegistrationType=Et.NotebookDocument=Et.NotebookCell=Et.ExecutionSummary=Et.NotebookCellKind=void 0;var mc=yd(),xn=Td(),ti=St(),oy;(function(t){t.Markup=1,t.Code=2;function e(r){return r===1||r===2}t.is=e})(oy||(Et.NotebookCellKind=oy={}));var ay;(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 xn.objectLiteral(s)&&mc.uinteger.is(s.executionOrder)&&(s.success===void 0||xn.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})(ay||(Et.ExecutionSummary=ay={}));var Ad;(function(t){function e(s,o){return{kind:s,document:o}}t.create=e;function r(s){let o=s;return xn.objectLiteral(o)&&oy.is(o.kind)&&mc.DocumentUri.is(o.document)&&(o.metadata===void 0||xn.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)&&!ay.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(xn.objectLiteral(s)&&xn.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}})(Ad||(Et.NotebookCell=Ad={}));var aR;(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 xn.objectLiteral(i)&&xn.string(i.uri)&&mc.integer.is(i.version)&&xn.typedArray(i.cells,Ad.is)}t.is=r})(aR||(Et.NotebookDocument=aR={}));var Vo;(function(t){t.method="notebookDocument/sync",t.messageDirection=ti.MessageDirection.clientToServer,t.type=new ti.RegistrationType(t.method)})(Vo||(Et.NotebookDocumentSyncRegistrationType=Vo={}));var cR;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=ti.MessageDirection.clientToServer,t.type=new ti.ProtocolNotificationType(t.method),t.registrationMethod=Vo.method})(cR||(Et.DidOpenNotebookDocumentNotification=cR={}));var lR;(function(t){function e(n){let i=n;return xn.objectLiteral(i)&&mc.uinteger.is(i.start)&&mc.uinteger.is(i.deleteCount)&&(i.cells===void 0||xn.typedArray(i.cells,Ad.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})(lR||(Et.NotebookCellArrayChange=lR={}));var uR;(function(t){t.method="notebookDocument/didChange",t.messageDirection=ti.MessageDirection.clientToServer,t.type=new ti.ProtocolNotificationType(t.method),t.registrationMethod=Vo.method})(uR||(Et.DidChangeNotebookDocumentNotification=uR={}));var dR;(function(t){t.method="notebookDocument/didSave",t.messageDirection=ti.MessageDirection.clientToServer,t.type=new ti.ProtocolNotificationType(t.method),t.registrationMethod=Vo.method})(dR||(Et.DidSaveNotebookDocumentNotification=dR={}));var fR;(function(t){t.method="notebookDocument/didClose",t.messageDirection=ti.MessageDirection.clientToServer,t.type=new ti.ProtocolNotificationType(t.method),t.registrationMethod=Vo.method})(fR||(Et.DidCloseNotebookDocumentNotification=fR={}))});var gR=R(Id=>{"use strict";Object.defineProperty(Id,"__esModule",{value:!0});Id.InlineCompletionRequest=void 0;var hR=St(),mR;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=hR.MessageDirection.clientToServer,t.type=new hR.ProtocolRequestType(t.method)})(mR||(Id.InlineCompletionRequest=mR={}))});var CP=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 V=St(),yR=yd(),Gt=Td(),qF=Uk();Object.defineProperty(k,"ImplementationRequest",{enumerable:!0,get:function(){return qF.ImplementationRequest}});var $F=zk();Object.defineProperty(k,"TypeDefinitionRequest",{enumerable:!0,get:function(){return $F.TypeDefinitionRequest}});var RP=Kk();Object.defineProperty(k,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return RP.WorkspaceFoldersRequest}});Object.defineProperty(k,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return RP.DidChangeWorkspaceFoldersNotification}});var BF=Jk();Object.defineProperty(k,"ConfigurationRequest",{enumerable:!0,get:function(){return BF.ConfigurationRequest}});var PP=eN();Object.defineProperty(k,"DocumentColorRequest",{enumerable:!0,get:function(){return PP.DocumentColorRequest}});Object.defineProperty(k,"ColorPresentationRequest",{enumerable:!0,get:function(){return PP.ColorPresentationRequest}});var wP=nN();Object.defineProperty(k,"FoldingRangeRequest",{enumerable:!0,get:function(){return wP.FoldingRangeRequest}});Object.defineProperty(k,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return wP.FoldingRangeRefreshRequest}});var FF=oN();Object.defineProperty(k,"DeclarationRequest",{enumerable:!0,get:function(){return FF.DeclarationRequest}});var jF=lN();Object.defineProperty(k,"SelectionRangeRequest",{enumerable:!0,get:function(){return jF.SelectionRangeRequest}});var fy=pN();Object.defineProperty(k,"WorkDoneProgress",{enumerable:!0,get:function(){return fy.WorkDoneProgress}});Object.defineProperty(k,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return fy.WorkDoneProgressCreateRequest}});Object.defineProperty(k,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return fy.WorkDoneProgressCancelNotification}});var py=yN();Object.defineProperty(k,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return py.CallHierarchyIncomingCallsRequest}});Object.defineProperty(k,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return py.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(k,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return py.CallHierarchyPrepareRequest}});var zo=kN();Object.defineProperty(k,"TokenFormat",{enumerable:!0,get:function(){return zo.TokenFormat}});Object.defineProperty(k,"SemanticTokensRequest",{enumerable:!0,get:function(){return zo.SemanticTokensRequest}});Object.defineProperty(k,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return zo.SemanticTokensDeltaRequest}});Object.defineProperty(k,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return zo.SemanticTokensRangeRequest}});Object.defineProperty(k,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return zo.SemanticTokensRefreshRequest}});Object.defineProperty(k,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return zo.SemanticTokensRegistrationType}});var UF=PN();Object.defineProperty(k,"ShowDocumentRequest",{enumerable:!0,get:function(){return UF.ShowDocumentRequest}});var HF=CN();Object.defineProperty(k,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return HF.LinkedEditingRangeRequest}});var Vs=qN();Object.defineProperty(k,"FileOperationPatternKind",{enumerable:!0,get:function(){return Vs.FileOperationPatternKind}});Object.defineProperty(k,"DidCreateFilesNotification",{enumerable:!0,get:function(){return Vs.DidCreateFilesNotification}});Object.defineProperty(k,"WillCreateFilesRequest",{enumerable:!0,get:function(){return Vs.WillCreateFilesRequest}});Object.defineProperty(k,"DidRenameFilesNotification",{enumerable:!0,get:function(){return Vs.DidRenameFilesNotification}});Object.defineProperty(k,"WillRenameFilesRequest",{enumerable:!0,get:function(){return Vs.WillRenameFilesRequest}});Object.defineProperty(k,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return Vs.DidDeleteFilesNotification}});Object.defineProperty(k,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return Vs.WillDeleteFilesRequest}});var hy=UN();Object.defineProperty(k,"UniquenessLevel",{enumerable:!0,get:function(){return hy.UniquenessLevel}});Object.defineProperty(k,"MonikerKind",{enumerable:!0,get:function(){return hy.MonikerKind}});Object.defineProperty(k,"MonikerRequest",{enumerable:!0,get:function(){return hy.MonikerRequest}});var my=WN();Object.defineProperty(k,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return my.TypeHierarchyPrepareRequest}});Object.defineProperty(k,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return my.TypeHierarchySubtypesRequest}});Object.defineProperty(k,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return my.TypeHierarchySupertypesRequest}});var EP=YN();Object.defineProperty(k,"InlineValueRequest",{enumerable:!0,get:function(){return EP.InlineValueRequest}});Object.defineProperty(k,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return EP.InlineValueRefreshRequest}});var gy=ZN();Object.defineProperty(k,"InlayHintRequest",{enumerable:!0,get:function(){return gy.InlayHintRequest}});Object.defineProperty(k,"InlayHintResolveRequest",{enumerable:!0,get:function(){return gy.InlayHintResolveRequest}});Object.defineProperty(k,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return gy.InlayHintRefreshRequest}});var gc=oR();Object.defineProperty(k,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return gc.DiagnosticServerCancellationData}});Object.defineProperty(k,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return gc.DocumentDiagnosticReportKind}});Object.defineProperty(k,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return gc.DocumentDiagnosticRequest}});Object.defineProperty(k,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return gc.WorkspaceDiagnosticRequest}});Object.defineProperty(k,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return gc.DiagnosticRefreshRequest}});var ri=pR();Object.defineProperty(k,"NotebookCellKind",{enumerable:!0,get:function(){return ri.NotebookCellKind}});Object.defineProperty(k,"ExecutionSummary",{enumerable:!0,get:function(){return ri.ExecutionSummary}});Object.defineProperty(k,"NotebookCell",{enumerable:!0,get:function(){return ri.NotebookCell}});Object.defineProperty(k,"NotebookDocument",{enumerable:!0,get:function(){return ri.NotebookDocument}});Object.defineProperty(k,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return ri.NotebookDocumentSyncRegistrationType}});Object.defineProperty(k,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return ri.DidOpenNotebookDocumentNotification}});Object.defineProperty(k,"NotebookCellArrayChange",{enumerable:!0,get:function(){return ri.NotebookCellArrayChange}});Object.defineProperty(k,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return ri.DidChangeNotebookDocumentNotification}});Object.defineProperty(k,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return ri.DidSaveNotebookDocumentNotification}});Object.defineProperty(k,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return ri.DidCloseNotebookDocumentNotification}});var VF=gR();Object.defineProperty(k,"InlineCompletionRequest",{enumerable:!0,get:function(){return VF.InlineCompletionRequest}});var cy;(function(t){function e(r){let n=r;return Gt.string(n)||Gt.string(n.language)||Gt.string(n.scheme)||Gt.string(n.pattern)}t.is=e})(cy||(k.TextDocumentFilter=cy={}));var ly;(function(t){function e(r){let n=r;return Gt.objectLiteral(n)&&(Gt.string(n.notebookType)||Gt.string(n.scheme)||Gt.string(n.pattern))}t.is=e})(ly||(k.NotebookDocumentFilter=ly={}));var uy;(function(t){function e(r){let n=r;return Gt.objectLiteral(n)&&(Gt.string(n.notebook)||ly.is(n.notebook))&&(n.language===void 0||Gt.string(n.language))}t.is=e})(uy||(k.NotebookCellTextDocumentFilter=uy={}));var dy;(function(t){function e(r){if(!Array.isArray(r))return!1;for(let n of r)if(!Gt.string(n)&&!cy.is(n)&&!uy.is(n))return!1;return!0}t.is=e})(dy||(k.DocumentSelector=dy={}));var TR;(function(t){t.method="client/registerCapability",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType(t.method)})(TR||(k.RegistrationRequest=TR={}));var vR;(function(t){t.method="client/unregisterCapability",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType(t.method)})(vR||(k.UnregistrationRequest=vR={}));var bR;(function(t){t.Create="create",t.Rename="rename",t.Delete="delete"})(bR||(k.ResourceOperationKind=bR={}));var SR;(function(t){t.Abort="abort",t.Transactional="transactional",t.TextOnlyTransactional="textOnlyTransactional",t.Undo="undo"})(SR||(k.FailureHandlingKind=SR={}));var _R;(function(t){t.UTF8="utf-8",t.UTF16="utf-16",t.UTF32="utf-32"})(_R||(k.PositionEncodingKind=_R={}));var kR;(function(t){function e(r){let n=r;return n&&Gt.string(n.id)&&n.id.length>0}t.hasId=e})(kR||(k.StaticRegistrationOptions=kR={}));var NR;(function(t){function e(r){let n=r;return n&&(n.documentSelector===null||dy.is(n.documentSelector))}t.is=e})(NR||(k.TextDocumentRegistrationOptions=NR={}));var RR;(function(t){function e(n){let i=n;return Gt.objectLiteral(i)&&(i.workDoneProgress===void 0||Gt.boolean(i.workDoneProgress))}t.is=e;function r(n){let i=n;return i&&Gt.boolean(i.workDoneProgress)}t.hasWorkDoneProgress=r})(RR||(k.WorkDoneProgressOptions=RR={}));var PR;(function(t){t.method="initialize",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(PR||(k.InitializeRequest=PR={}));var wR;(function(t){t.unknownProtocolVersion=1})(wR||(k.InitializeErrorCodes=wR={}));var ER;(function(t){t.method="initialized",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(ER||(k.InitializedNotification=ER={}));var CR;(function(t){t.method="shutdown",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType0(t.method)})(CR||(k.ShutdownRequest=CR={}));var DR;(function(t){t.method="exit",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType0(t.method)})(DR||(k.ExitNotification=DR={}));var AR;(function(t){t.method="workspace/didChangeConfiguration",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(AR||(k.DidChangeConfigurationNotification=AR={}));var IR;(function(t){t.Error=1,t.Warning=2,t.Info=3,t.Log=4,t.Debug=5})(IR||(k.MessageType=IR={}));var OR;(function(t){t.method="window/showMessage",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolNotificationType(t.method)})(OR||(k.ShowMessageNotification=OR={}));var MR;(function(t){t.method="window/showMessageRequest",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType(t.method)})(MR||(k.ShowMessageRequest=MR={}));var xR;(function(t){t.method="window/logMessage",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolNotificationType(t.method)})(xR||(k.LogMessageNotification=xR={}));var LR;(function(t){t.method="telemetry/event",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolNotificationType(t.method)})(LR||(k.TelemetryEventNotification=LR={}));var qR;(function(t){t.None=0,t.Full=1,t.Incremental=2})(qR||(k.TextDocumentSyncKind=qR={}));var $R;(function(t){t.method="textDocument/didOpen",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})($R||(k.DidOpenTextDocumentNotification=$R={}));var BR;(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})(BR||(k.TextDocumentContentChangeEvent=BR={}));var FR;(function(t){t.method="textDocument/didChange",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(FR||(k.DidChangeTextDocumentNotification=FR={}));var jR;(function(t){t.method="textDocument/didClose",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(jR||(k.DidCloseTextDocumentNotification=jR={}));var UR;(function(t){t.method="textDocument/didSave",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(UR||(k.DidSaveTextDocumentNotification=UR={}));var HR;(function(t){t.Manual=1,t.AfterDelay=2,t.FocusOut=3})(HR||(k.TextDocumentSaveReason=HR={}));var VR;(function(t){t.method="textDocument/willSave",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(VR||(k.WillSaveTextDocumentNotification=VR={}));var zR;(function(t){t.method="textDocument/willSaveWaitUntil",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(zR||(k.WillSaveTextDocumentWaitUntilRequest=zR={}));var WR;(function(t){t.method="workspace/didChangeWatchedFiles",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(WR||(k.DidChangeWatchedFilesNotification=WR={}));var GR;(function(t){t.Created=1,t.Changed=2,t.Deleted=3})(GR||(k.FileChangeType=GR={}));var KR;(function(t){function e(r){let n=r;return Gt.objectLiteral(n)&&(yR.URI.is(n.baseUri)||yR.WorkspaceFolder.is(n.baseUri))&&Gt.string(n.pattern)}t.is=e})(KR||(k.RelativePattern=KR={}));var YR;(function(t){t.Create=1,t.Change=2,t.Delete=4})(YR||(k.WatchKind=YR={}));var XR;(function(t){t.method="textDocument/publishDiagnostics",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolNotificationType(t.method)})(XR||(k.PublishDiagnosticsNotification=XR={}));var JR;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.TriggerForIncompleteCompletions=3})(JR||(k.CompletionTriggerKind=JR={}));var QR;(function(t){t.method="textDocument/completion",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(QR||(k.CompletionRequest=QR={}));var ZR;(function(t){t.method="completionItem/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(ZR||(k.CompletionResolveRequest=ZR={}));var eP;(function(t){t.method="textDocument/hover",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(eP||(k.HoverRequest=eP={}));var tP;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.ContentChange=3})(tP||(k.SignatureHelpTriggerKind=tP={}));var rP;(function(t){t.method="textDocument/signatureHelp",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(rP||(k.SignatureHelpRequest=rP={}));var nP;(function(t){t.method="textDocument/definition",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(nP||(k.DefinitionRequest=nP={}));var iP;(function(t){t.method="textDocument/references",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(iP||(k.ReferencesRequest=iP={}));var sP;(function(t){t.method="textDocument/documentHighlight",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(sP||(k.DocumentHighlightRequest=sP={}));var oP;(function(t){t.method="textDocument/documentSymbol",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(oP||(k.DocumentSymbolRequest=oP={}));var aP;(function(t){t.method="textDocument/codeAction",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(aP||(k.CodeActionRequest=aP={}));var cP;(function(t){t.method="codeAction/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(cP||(k.CodeActionResolveRequest=cP={}));var lP;(function(t){t.method="workspace/symbol",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(lP||(k.WorkspaceSymbolRequest=lP={}));var uP;(function(t){t.method="workspaceSymbol/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(uP||(k.WorkspaceSymbolResolveRequest=uP={}));var dP;(function(t){t.method="textDocument/codeLens",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(dP||(k.CodeLensRequest=dP={}));var fP;(function(t){t.method="codeLens/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(fP||(k.CodeLensResolveRequest=fP={}));var pP;(function(t){t.method="workspace/codeLens/refresh",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType0(t.method)})(pP||(k.CodeLensRefreshRequest=pP={}));var hP;(function(t){t.method="textDocument/documentLink",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(hP||(k.DocumentLinkRequest=hP={}));var mP;(function(t){t.method="documentLink/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(mP||(k.DocumentLinkResolveRequest=mP={}));var gP;(function(t){t.method="textDocument/formatting",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(gP||(k.DocumentFormattingRequest=gP={}));var yP;(function(t){t.method="textDocument/rangeFormatting",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(yP||(k.DocumentRangeFormattingRequest=yP={}));var TP;(function(t){t.method="textDocument/rangesFormatting",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(TP||(k.DocumentRangesFormattingRequest=TP={}));var vP;(function(t){t.method="textDocument/onTypeFormatting",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(vP||(k.DocumentOnTypeFormattingRequest=vP={}));var bP;(function(t){t.Identifier=1})(bP||(k.PrepareSupportDefaultBehavior=bP={}));var SP;(function(t){t.method="textDocument/rename",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(SP||(k.RenameRequest=SP={}));var _P;(function(t){t.method="textDocument/prepareRename",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(_P||(k.PrepareRenameRequest=_P={}));var kP;(function(t){t.method="workspace/executeCommand",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(kP||(k.ExecuteCommandRequest=kP={}));var NP;(function(t){t.method="workspace/applyEdit",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType("workspace/applyEdit")})(NP||(k.ApplyWorkspaceEditRequest=NP={}))});var AP=R(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});Od.createProtocolConnection=void 0;var DP=Hs();function zF(t,e,r,n){return DP.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,DP.createMessageConnection)(t,e,r,n)}Od.createProtocolConnection=zF});var OP=R(Ar=>{"use strict";var WF=Ar&&Ar.__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]}),Md=Ar&&Ar.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&WF(e,t,r)};Object.defineProperty(Ar,"__esModule",{value:!0});Ar.LSPErrorCodes=Ar.createProtocolConnection=void 0;Md(Hs(),Ar);Md(yd(),Ar);Md(St(),Ar);Md(CP(),Ar);var GF=AP();Object.defineProperty(Ar,"createProtocolConnection",{enumerable:!0,get:function(){return GF.createProtocolConnection}});var IP;(function(t){t.lspReservedErrorRangeStart=-32899,t.RequestFailed=-32803,t.ServerCancelled=-32802,t.ContentModified=-32801,t.RequestCancelled=-32800,t.lspReservedErrorRangeEnd=-32800})(IP||(Ar.LSPErrorCodes=IP={}))});var At=R(ni=>{"use strict";var KF=ni&&ni.__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]}),MP=ni&&ni.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&KF(e,t,r)};Object.defineProperty(ni,"__esModule",{value:!0});ni.createProtocolConnection=void 0;var YF=ey();MP(ey(),ni);MP(OP(),ni);function XF(t,e,r,n){return(0,YF.createMessageConnection)(t,e,r,n)}ni.createProtocolConnection=XF});var yy=R(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.generateUuid=sn.parse=sn.isUUID=sn.v4=sn.empty=void 0;var yc=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},Tc=class t extends yc{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(""))}};Tc._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];Tc._timeHighBits=["8","9","a","b"];sn.empty=new yc("00000000-0000-0000-0000-000000000000");function xP(){return new Tc}sn.v4=xP;var JF=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function LP(t){return JF.test(t)}sn.isUUID=LP;function QF(t){if(!LP(t))throw new Error("invalid uuid");return new yc(t)}sn.parse=QF;function ZF(){return xP().asHex()}sn.generateUuid=ZF});var qP=R(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.attachPartialResult=ns.ProgressFeature=ns.attachWorkDone=void 0;var rs=At(),ej=yy(),zs=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(rs.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(rs.WorkDoneProgress.type,this._token,n)}done(){t.Instances.delete(this._token),this._connection.sendProgress(rs.WorkDoneProgress.type,this._token,{kind:"end"})}};zs.Instances=new Map;var xd=class extends zs{constructor(e,r){super(e,r),this._source=new rs.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},vc=class{constructor(){}begin(){}report(){}done(){}},Ld=class extends vc{constructor(){super(),this._source=new rs.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function tj(t,e){if(e===void 0||e.workDoneToken===void 0)return new vc;let r=e.workDoneToken;return delete e.workDoneToken,new zs(t,r)}ns.attachWorkDone=tj;var rj=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(rs.WorkDoneProgressCancelNotification.type,r=>{let n=zs.Instances.get(r.token);(n instanceof xd||n instanceof Ld)&&n.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new vc:new zs(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,ej.generateUuid)();return this.connection.sendRequest(rs.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new xd(this.connection,e))}else return Promise.resolve(new Ld)}};ns.ProgressFeature=rj;var Ty;(function(t){t.type=new rs.ProgressType})(Ty||(Ty={}));var vy=class{constructor(e,r){this._connection=e,this._token=r}report(e){this._connection.sendProgress(Ty.type,this._token,e)}};function nj(t,e){if(e===void 0||e.partialResultToken===void 0)return;let r=e.partialResultToken;return delete e.partialResultToken,new vy(t,r)}ns.attachPartialResult=nj});var $P=R(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.ConfigurationFeature=void 0;var ij=At(),sj=Ku(),oj=t=>class extends t{getConfiguration(e){return e?sj.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(ij.ConfigurationRequest.type,r).then(n=>Array.isArray(n)?Array.isArray(e)?n:n[0]:Array.isArray(e)?[]:null)}};qd.ConfigurationFeature=oj});var BP=R(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.WorkspaceFoldersFeature=void 0;var $d=At(),aj=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let r=e.workspace;r&&r.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new $d.Emitter,this.connection.onNotification($d.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($d.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($d.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};Bd.WorkspaceFoldersFeature=aj});var FP=R(Fd=>{"use strict";Object.defineProperty(Fd,"__esModule",{value:!0});Fd.CallHierarchyFeature=void 0;var by=At(),cj=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(by.CallHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onIncomingCalls:e=>{let r=by.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onOutgoingCalls:e=>{let r=by.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Fd.CallHierarchyFeature=cj});var _y=R(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.SemanticTokensBuilder=is.SemanticTokensDiff=is.SemanticTokensFeature=void 0;var jd=At(),lj=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(jd.SemanticTokensRefreshRequest.type),on:e=>{let r=jd.SemanticTokensRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onDelta:e=>{let r=jd.SemanticTokensDeltaRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onRange:e=>{let r=jd.SemanticTokensRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};is.SemanticTokensFeature=lj;var Ud=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}]:[]}};is.SemanticTokensDiff=Ud;var Sy=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 Ud(this._prevData,this._data).computeDiff()}:this.build()}};is.SemanticTokensBuilder=Sy});var jP=R(Hd=>{"use strict";Object.defineProperty(Hd,"__esModule",{value:!0});Hd.ShowDocumentFeature=void 0;var uj=At(),dj=t=>class extends t{showDocument(e){return this.connection.sendRequest(uj.ShowDocumentRequest.type,e)}};Hd.ShowDocumentFeature=dj});var UP=R(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});Vd.FileOperationsFeature=void 0;var Wo=At(),fj=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(Wo.DidCreateFilesNotification.type,r=>{e(r)})}onDidRenameFiles(e){return this.connection.onNotification(Wo.DidRenameFilesNotification.type,r=>{e(r)})}onDidDeleteFiles(e){return this.connection.onNotification(Wo.DidDeleteFilesNotification.type,r=>{e(r)})}onWillCreateFiles(e){return this.connection.onRequest(Wo.WillCreateFilesRequest.type,(r,n)=>e(r,n))}onWillRenameFiles(e){return this.connection.onRequest(Wo.WillRenameFilesRequest.type,(r,n)=>e(r,n))}onWillDeleteFiles(e){return this.connection.onRequest(Wo.WillDeleteFilesRequest.type,(r,n)=>e(r,n))}};Vd.FileOperationsFeature=fj});var HP=R(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});zd.LinkedEditingRangeFeature=void 0;var pj=At(),hj=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(pj.LinkedEditingRangeRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0))}};zd.LinkedEditingRangeFeature=hj});var VP=R(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.TypeHierarchyFeature=void 0;var ky=At(),mj=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(ky.TypeHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onSupertypes:e=>{let r=ky.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onSubtypes:e=>{let r=ky.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Wd.TypeHierarchyFeature=mj});var WP=R(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});Gd.InlineValueFeature=void 0;var zP=At(),gj=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest(zP.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(zP.InlineValueRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};Gd.InlineValueFeature=gj});var KP=R(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.FoldingRangeFeature=void 0;var GP=At(),yj=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(GP.FoldingRangeRefreshRequest.type),on:e=>{let r=GP.FoldingRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Kd.FoldingRangeFeature=yj});var YP=R(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});Yd.InlayHintFeature=void 0;var Ny=At(),Tj=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(Ny.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(Ny.InlayHintRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r))),resolve:e=>this.connection.onRequest(Ny.InlayHintResolveRequest.type,(r,n)=>e(r,n))}}};Yd.InlayHintFeature=Tj});var XP=R(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});Xd.DiagnosticFeature=void 0;var bc=At(),vj=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(bc.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(bc.DocumentDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(bc.DocumentDiagnosticRequest.partialResult,r))),onWorkspace:e=>this.connection.onRequest(bc.WorkspaceDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(bc.WorkspaceDiagnosticRequest.partialResult,r)))}}};Xd.DiagnosticFeature=vj});var Py=R(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});Jd.TextDocuments=void 0;var Ws=At(),Ry=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new Ws.Emitter,this._onDidOpen=new Ws.Emitter,this._onDidClose=new Ws.Emitter,this._onDidSave=new Ws.Emitter,this._onWillSave=new Ws.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=Ws.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}))})),Ws.Disposable.create(()=>{r.forEach(n=>n.dispose())})}};Jd.TextDocuments=Ry});var Ey=R(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0});Go.NotebookDocuments=Go.NotebookSyncFeature=void 0;var on=At(),JP=Py(),bj=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(on.DidOpenNotebookDocumentNotification.type,r=>{e(r)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(on.DidChangeNotebookDocumentNotification.type,r=>{e(r)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(on.DidSaveNotebookDocumentNotification.type,r=>{e(r)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(on.DidCloseNotebookDocumentNotification.type,r=>{e(r)})}}};Go.NotebookSyncFeature=bj;var Qd=class t{onDidOpenTextDocument(e){return this.openHandler=e,on.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,on.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,on.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}};Qd.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var wy=class{constructor(e){e instanceof JP.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new JP.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new on.Emitter,this._onDidChange=new on.Emitter,this._onDidSave=new on.Emitter,this._onDidClose=new on.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 Qd,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 b=c.cells;if(b.structure!==void 0){let S=b.structure.array;if(s.cells.splice(S.start,S.deleteCount,...S.cells!==void 0?S.cells:[]),b.structure.didOpen!==void 0)for(let v of b.structure.didOpen)r.openTextDocument({textDocument:v}),l.push(v.uri);if(b.structure.didClose)for(let v of b.structure.didClose)r.closeTextDocument({textDocument:v}),u.push(v.uri)}if(b.data!==void 0){let S=new Map(b.data.map(v=>[v.document,v]));for(let v=0;v<=s.cells.length;v++){let N=S.get(s.cells[v].document);if(N!==void 0){let C=s.cells.splice(v,1,N);if(d.push({old:C[0],new:N}),S.delete(N.document),S.size===0)break}}}if(b.textContent!==void 0)for(let S of b.textContent)r.changeTextDocument({textDocument:S.document,contentChanges:S.changes}),f.push(S.document.uri)}this.updateCellMap(s);let p={notebookDocument:s};a&&(p.metadata={old:o,new:s.metadata});let m=[];for(let b of l)m.push(this.getNotebookCell(b));let h=[];for(let b of u)h.push(this.getNotebookCell(b));let T=[];for(let b of f)T.push(this.getNotebookCell(b));(m.length>0||h.length>0||d.length>0||T.length>0)&&(p.cells={added:m,removed:h,changed:{data:d,textContent:T}}),(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)}})),on.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let r of e.cells)this.notebookCellMap.set(r.document,[r,e])}};Go.NotebookDocuments=wy});var QP=R(Zd=>{"use strict";Object.defineProperty(Zd,"__esModule",{value:!0});Zd.MonikerFeature=void 0;var Sj=At(),_j=t=>class extends t{get moniker(){return{on:e=>{let r=Sj.MonikerRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Zd.MonikerFeature=_j});var My=R(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.createConnection=Ue.combineFeatures=Ue.combineNotebooksFeatures=Ue.combineLanguagesFeatures=Ue.combineWorkspaceFeatures=Ue.combineWindowFeatures=Ue.combineClientFeatures=Ue.combineTracerFeatures=Ue.combineTelemetryFeatures=Ue.combineConsoleFeatures=Ue._NotebooksImpl=Ue._LanguagesImpl=Ue.BulkUnregistration=Ue.BulkRegistration=Ue.ErrorMessageTracker=void 0;var Y=At(),an=Ku(),Dy=yy(),me=qP(),kj=$P(),Nj=BP(),Rj=FP(),Pj=_y(),wj=jP(),Ej=UP(),Cj=HP(),Dj=VP(),Aj=WP(),Ij=KP(),Oj=YP(),Mj=XP(),xj=Ey(),Lj=QP();function Cy(t){if(t!==null)return t}var Ay=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)})}};Ue.ErrorMessageTracker=Ay;var ef=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(Y.MessageType.Error,e)}warn(e){this.send(Y.MessageType.Warning,e)}info(e){this.send(Y.MessageType.Info,e)}log(e){this.send(Y.MessageType.Log,e)}debug(e){this.send(Y.MessageType.Debug,e)}send(e,r){this._rawConnection&&this._rawConnection.sendNotification(Y.LogMessageNotification.type,{type:e,message:r}).catch(()=>{(0,Y.RAL)().console.error("Sending log message failed")})}},Iy=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}showErrorMessage(e,...r){let n={type:Y.MessageType.Error,message:e,actions:r};return this.connection.sendRequest(Y.ShowMessageRequest.type,n).then(Cy)}showWarningMessage(e,...r){let n={type:Y.MessageType.Warning,message:e,actions:r};return this.connection.sendRequest(Y.ShowMessageRequest.type,n).then(Cy)}showInformationMessage(e,...r){let n={type:Y.MessageType.Info,message:e,actions:r};return this.connection.sendRequest(Y.ShowMessageRequest.type,n).then(Cy)}},ZP=(0,wj.ShowDocumentFeature)((0,me.ProgressFeature)(Iy)),ew;(function(t){function e(){return new tf}t.create=e})(ew||(Ue.BulkRegistration=ew={}));var tf=class{constructor(){this._registrations=[],this._registered=new Set}add(e,r){let n=an.string(e)?e:e.method;if(this._registered.has(n))throw new Error(`${n} is already added to this registration`);let i=Dy.generateUuid();this._registrations.push({id:i,method:n,registerOptions:r||{}}),this._registered.add(n)}asRegistrationParams(){return{registrations:this._registrations}}},tw;(function(t){function e(){return new Sc(void 0,[])}t.create=e})(tw||(Ue.BulkUnregistration=tw={}));var Sc=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(Y.UnregistrationRequest.type,r).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){let r=an.string(e)?e:e.method,n=this._unregistrations.get(r);if(!n)return!1;let i={unregisterations:[n]};return this._connection.sendRequest(Y.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(r)},s=>{this._connection.console.info(`Un-registering request handler for ${n.id} failed.`)}),!0}},rf=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 tf?this.registerMany(e):e instanceof Sc?this.registerSingle1(e,r,n):this.registerSingle2(e,r)}registerSingle1(e,r,n){let i=an.string(r)?r:r.method,s=Dy.generateUuid(),o={registrations:[{id:s,method:i,registerOptions:n||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(Y.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=an.string(e)?e:e.method,i=Dy.generateUuid(),s={registrations:[{id:i,method:n,registerOptions:r||{}}]};return this.connection.sendRequest(Y.RegistrationRequest.type,s).then(o=>Y.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(Y.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(Y.RegistrationRequest.type,r).then(()=>new Sc(this._connection,r.registrations.map(n=>({id:n.id,method:n.method}))),n=>(this.connection.console.info("Bulk registration failed."),Promise.reject(n)))}},Oy=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(Y.ApplyWorkspaceEditRequest.type,n)}},rw=(0,Ej.FileOperationsFeature)((0,Nj.WorkspaceFoldersFeature)((0,kj.ConfigurationFeature)(Oy))),nf=class{constructor(){this._trace=Y.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!==Y.Trace.Off&&this.connection.sendNotification(Y.LogTraceNotification.type,{message:e,verbose:this._trace===Y.Trace.Verbose?r:void 0}).catch(()=>{})}},sf=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(Y.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}},of=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,me.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,me.attachPartialResult)(this.connection,r)}};Ue._LanguagesImpl=of;var nw=(0,Ij.FoldingRangeFeature)((0,Lj.MonikerFeature)((0,Mj.DiagnosticFeature)((0,Oj.InlayHintFeature)((0,Aj.InlineValueFeature)((0,Dj.TypeHierarchyFeature)((0,Cj.LinkedEditingRangeFeature)((0,Pj.SemanticTokensFeature)((0,Rj.CallHierarchyFeature)(of))))))))),af=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,me.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,me.attachPartialResult)(this.connection,r)}};Ue._NotebooksImpl=af;var iw=(0,xj.NotebookSyncFeature)(af);function sw(t,e){return function(r){return e(t(r))}}Ue.combineConsoleFeatures=sw;function ow(t,e){return function(r){return e(t(r))}}Ue.combineTelemetryFeatures=ow;function aw(t,e){return function(r){return e(t(r))}}Ue.combineTracerFeatures=aw;function cw(t,e){return function(r){return e(t(r))}}Ue.combineClientFeatures=cw;function lw(t,e){return function(r){return e(t(r))}}Ue.combineWindowFeatures=lw;function uw(t,e){return function(r){return e(t(r))}}Ue.combineWorkspaceFeatures=uw;function dw(t,e){return function(r){return e(t(r))}}Ue.combineLanguagesFeatures=dw;function fw(t,e){return function(r){return e(t(r))}}Ue.combineNotebooksFeatures=fw;function qj(t,e){function r(i,s,o){return i&&s?o(i,s):i||s}return{__brand:"features",console:r(t.console,e.console,sw),tracer:r(t.tracer,e.tracer,aw),telemetry:r(t.telemetry,e.telemetry,ow),client:r(t.client,e.client,cw),window:r(t.window,e.window,lw),workspace:r(t.workspace,e.workspace,uw),languages:r(t.languages,e.languages,dw),notebooks:r(t.notebooks,e.notebooks,fw)}}Ue.combineFeatures=qj;function $j(t,e,r){let n=r&&r.console?new(r.console(ef)):new ef,i=t(n);n.rawAttach(i);let s=r&&r.tracer?new(r.tracer(nf)):new nf,o=r&&r.telemetry?new(r.telemetry(sf)):new sf,a=r&&r.client?new(r.client(rf)):new rf,c=r&&r.window?new(r.window(ZP)):new ZP,l=r&&r.workspace?new(r.workspace(rw)):new rw,u=r&&r.languages?new(r.languages(nw)):new nw,d=r&&r.notebooks?new(r.notebooks(iw)):new iw,f=[n,s,o,a,c,l,u,d];function p(S){return S instanceof Promise?S:an.thenable(S)?new Promise((v,N)=>{S.then(C=>v(C),C=>N(C))}):Promise.resolve(S)}let m,h,T,b={listen:()=>i.listen(),sendRequest:(S,...v)=>i.sendRequest(an.string(S)?S:S.method,...v),onRequest:(S,v)=>i.onRequest(S,v),sendNotification:(S,v)=>{let N=an.string(S)?S:S.method;return i.sendNotification(N,v)},onNotification:(S,v)=>i.onNotification(S,v),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:S=>(h=S,{dispose:()=>{h=void 0}}),onInitialized:S=>i.onNotification(Y.InitializedNotification.type,S),onShutdown:S=>(m=S,{dispose:()=>{m=void 0}}),onExit:S=>(T=S,{dispose:()=>{T=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:S=>i.onNotification(Y.DidChangeConfigurationNotification.type,S),onDidChangeWatchedFiles:S=>i.onNotification(Y.DidChangeWatchedFilesNotification.type,S),__textDocumentSync:void 0,onDidOpenTextDocument:S=>i.onNotification(Y.DidOpenTextDocumentNotification.type,S),onDidChangeTextDocument:S=>i.onNotification(Y.DidChangeTextDocumentNotification.type,S),onDidCloseTextDocument:S=>i.onNotification(Y.DidCloseTextDocumentNotification.type,S),onWillSaveTextDocument:S=>i.onNotification(Y.WillSaveTextDocumentNotification.type,S),onWillSaveTextDocumentWaitUntil:S=>i.onRequest(Y.WillSaveTextDocumentWaitUntilRequest.type,S),onDidSaveTextDocument:S=>i.onNotification(Y.DidSaveTextDocumentNotification.type,S),sendDiagnostics:S=>i.sendNotification(Y.PublishDiagnosticsNotification.type,S),onHover:S=>i.onRequest(Y.HoverRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),void 0)),onCompletion:S=>i.onRequest(Y.CompletionRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onCompletionResolve:S=>i.onRequest(Y.CompletionResolveRequest.type,S),onSignatureHelp:S=>i.onRequest(Y.SignatureHelpRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),void 0)),onDeclaration:S=>i.onRequest(Y.DeclarationRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onDefinition:S=>i.onRequest(Y.DefinitionRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onTypeDefinition:S=>i.onRequest(Y.TypeDefinitionRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onImplementation:S=>i.onRequest(Y.ImplementationRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onReferences:S=>i.onRequest(Y.ReferencesRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onDocumentHighlight:S=>i.onRequest(Y.DocumentHighlightRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onDocumentSymbol:S=>i.onRequest(Y.DocumentSymbolRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onWorkspaceSymbol:S=>i.onRequest(Y.WorkspaceSymbolRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onWorkspaceSymbolResolve:S=>i.onRequest(Y.WorkspaceSymbolResolveRequest.type,S),onCodeAction:S=>i.onRequest(Y.CodeActionRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onCodeActionResolve:S=>i.onRequest(Y.CodeActionResolveRequest.type,(v,N)=>S(v,N)),onCodeLens:S=>i.onRequest(Y.CodeLensRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onCodeLensResolve:S=>i.onRequest(Y.CodeLensResolveRequest.type,(v,N)=>S(v,N)),onDocumentFormatting:S=>i.onRequest(Y.DocumentFormattingRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),void 0)),onDocumentRangeFormatting:S=>i.onRequest(Y.DocumentRangeFormattingRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),void 0)),onDocumentOnTypeFormatting:S=>i.onRequest(Y.DocumentOnTypeFormattingRequest.type,(v,N)=>S(v,N)),onRenameRequest:S=>i.onRequest(Y.RenameRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),void 0)),onPrepareRename:S=>i.onRequest(Y.PrepareRenameRequest.type,(v,N)=>S(v,N)),onDocumentLinks:S=>i.onRequest(Y.DocumentLinkRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onDocumentLinkResolve:S=>i.onRequest(Y.DocumentLinkResolveRequest.type,(v,N)=>S(v,N)),onDocumentColor:S=>i.onRequest(Y.DocumentColorRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onColorPresentation:S=>i.onRequest(Y.ColorPresentationRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onFoldingRanges:S=>i.onRequest(Y.FoldingRangeRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onSelectionRanges:S=>i.onRequest(Y.SelectionRangeRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onExecuteCommand:S=>i.onRequest(Y.ExecuteCommandRequest.type,(v,N)=>S(v,N,(0,me.attachWorkDone)(i,v),void 0)),dispose:()=>i.dispose()};for(let S of f)S.attach(b);return i.onRequest(Y.InitializeRequest.type,S=>{e.initialize(S),an.string(S.trace)&&(s.trace=Y.Trace.fromString(S.trace));for(let v of f)v.initialize(S.capabilities);if(h){let v=h(S,new Y.CancellationTokenSource().token,(0,me.attachWorkDone)(i,S),void 0);return p(v).then(N=>{if(N instanceof Y.ResponseError)return N;let C=N;C||(C={capabilities:{}});let H=C.capabilities;H||(H={},C.capabilities=H),H.textDocumentSync===void 0||H.textDocumentSync===null?H.textDocumentSync=an.number(b.__textDocumentSync)?b.__textDocumentSync:Y.TextDocumentSyncKind.None:!an.number(H.textDocumentSync)&&!an.number(H.textDocumentSync.change)&&(H.textDocumentSync.change=an.number(b.__textDocumentSync)?b.__textDocumentSync:Y.TextDocumentSyncKind.None);for(let M of f)M.fillServerCapabilities(H);return C})}else{let v={capabilities:{textDocumentSync:Y.TextDocumentSyncKind.None}};for(let N of f)N.fillServerCapabilities(v.capabilities);return v}}),i.onRequest(Y.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,m)return m(new Y.CancellationTokenSource().token)}),i.onNotification(Y.ExitNotification.type,()=>{try{T&&T()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(Y.SetTraceNotification.type,S=>{s.trace=Y.Trace.fromString(S.value)}),b}Ue.createConnection=$j});var pw=R(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.resolveModulePath=Ir.FileSystem=Ir.resolveGlobalYarnPath=Ir.resolveGlobalNodePath=Ir.resolve=Ir.uriToFilePath=void 0;var Bj=require("url"),Ln=require("path"),xy=require("fs"),By=require("child_process");function Fj(t){let e=Bj.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 Ln.normalize(r.join("/"))}Ir.uriToFilePath=Fj;function Ly(){return process.platform==="win32"}function cf(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&&xy.existsSync(e)&&(l[i]?l[i]=e+Ln.delimiter+l[i]:l[i]=e,n&&n(`NODE_PATH value is: ${l[i]}`)),l.ELECTRON_RUN_AS_NODE="1";try{let u=(0,By.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)}})}Ir.resolve=cf;function qy(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};Ly()&&(e="npm.cmd",n.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let s=(0,By.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?Ly()?Ln.join(o,"node_modules"):Ln.join(o,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}Ir.resolveGlobalNodePath=qy;function jj(t){let e="yarn",r={encoding:"utf8"};Ly()&&(e="yarn.cmd",r.shell=!0);let n=()=>{};try{process.on("SIGPIPE",n);let i=(0,By.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 Ln.join(c.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",n)}}Ir.resolveGlobalYarnPath=jj;var $y;(function(t){let e;function r(){return e!==void 0||(process.platform==="win32"?e=!1:e=!xy.existsSync(__filename.toUpperCase())||!xy.existsSync(__filename.toLowerCase())),e}t.isCaseSensitive=r;function n(i,s){return r()?Ln.normalize(s).indexOf(Ln.normalize(i))===0:Ln.normalize(s).toLowerCase().indexOf(Ln.normalize(i).toLowerCase())===0}t.isParent=n})($y||(Ir.FileSystem=$y={}));function Uj(t,e,r,n){return r?(Ln.isAbsolute(r)||(r=Ln.join(t,r)),cf(e,r,r,n).then(i=>$y.isParent(r,i)?i:Promise.reject(new Error(`Failed to load ${e} from node path location.`))).then(void 0,i=>cf(e,qy(n),t,n))):cf(e,qy(n),t,n)}Ir.resolveModulePath=Uj});var Fy=R((WQ,hw)=>{"use strict";hw.exports=At()});var mw=R(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});lf.InlineCompletionFeature=void 0;var Hj=At(),Vj=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(Hj.InlineCompletionRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};lf.InlineCompletionFeature=Vj});var Tw=R(ur=>{"use strict";var zj=ur&&ur.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yw=ur&&ur.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zj(e,t,r)};Object.defineProperty(ur,"__esModule",{value:!0});ur.ProposedFeatures=ur.NotebookDocuments=ur.TextDocuments=ur.SemanticTokensBuilder=void 0;var Wj=_y();Object.defineProperty(ur,"SemanticTokensBuilder",{enumerable:!0,get:function(){return Wj.SemanticTokensBuilder}});var Gj=mw();yw(At(),ur);var Kj=Py();Object.defineProperty(ur,"TextDocuments",{enumerable:!0,get:function(){return Kj.TextDocuments}});var Yj=Ey();Object.defineProperty(ur,"NotebookDocuments",{enumerable:!0,get:function(){return Yj.NotebookDocuments}});yw(My(),ur);var gw;(function(t){t.all={__brand:"features",languages:Gj.InlineCompletionFeature}})(gw||(ur.ProposedFeatures=gw={}))});var U=R(cn=>{"use strict";var Xj=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]}),_w=cn&&cn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Xj(e,t,r)};Object.defineProperty(cn,"__esModule",{value:!0});cn.createConnection=cn.Files=void 0;var vw=require("node:util"),jy=Ku(),Jj=My(),_c=pw(),Gs=Fy();_w(Fy(),cn);_w(Tw(),cn);var bw;(function(t){t.uriToFilePath=_c.uriToFilePath,t.resolveGlobalNodePath=_c.resolveGlobalNodePath,t.resolveGlobalYarnPath=_c.resolveGlobalYarnPath,t.resolve=_c.resolve,t.resolveModulePath=_c.resolveModulePath})(bw||(cn.Files=bw={}));var Sw;function uf(){if(Sw!==void 0)try{Sw.end()}catch{}}var Ko=!1,kw;function Qj(){let t="--clientProcessId";function e(r){try{let n=parseInt(r);isNaN(n)||(kw=setInterval(()=>{try{process.kill(n,0)}catch{uf(),process.exit(Ko?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])}}}Qj();var Zj={initialize:t=>{let e=t.processId;jy.number(e)&&kw===void 0&&setInterval(()=>{try{process.kill(e,0)}catch{process.exit(Ko?0:1)}},3e3)},get shutdownReceived(){return Ko},set shutdownReceived(t){Ko=t},exit:t=>{uf(),process.exit(t)}};function eU(t,e,r,n){let i,s,o,a;return t!==void 0&&t.__brand==="features"&&(i=t,t=e,e=r,r=n),Gs.ConnectionStrategy.is(t)||Gs.ConnectionOptions.is(t)?a=t:(s=t,o=e,a=r),tU(s,o,a,i)}cn.createConnection=eU;function tU(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 Gs.IPCMessageReader(process),e=new Gs.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,Gs.createServerSocketTransport)(c);t=d[0],e=d[1]}else if(l){let d=(0,Gs.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(jy.func(t.read)&&jy.func(t.on)){let c=t;c.on("end",()=>{uf(),process.exit(Ko?0:1)}),c.on("close",()=>{uf(),process.exit(Ko?0:1)})}let a=c=>{let l=(0,Gs.createProtocolConnection)(t,e,c,r);return i&&rU(c),l};return(0,Jj.createConnection)(a,Zj,n)}function rU(t){function e(n){return n.map(i=>typeof i=="string"?i:(0,vw.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,vw.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
|
|
38
|
-
`)}};
|
|
39
|
-
`)?
|
|
36
|
+
`&&g++}S&&E.length>0&&w.push(E.length),this._lineOffsets=w}return this._lineOffsets},y.prototype.positionAt=function(w){w=Math.max(Math.min(w,this._content.length),0);var E=this.getLineOffsets(),S=0,g=E.length;if(g===0)return o.create(0,w);for(;S<g;){var D=Math.floor((S+g)/2);E[D]>w?g=D:S=D+1}var q=S-1;return o.create(q,w-E[q])},y.prototype.offsetAt=function(w){var E=this.getLineOffsets();if(w.line>=E.length)return this._content.length;if(w.line<0)return 0;var S=E[w.line],g=w.line+1<E.length?E[w.line+1]:this._content.length;return Math.max(Math.min(S+w.character,g),S)},Object.defineProperty(y.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),y}(),A;(function(y){var w=Object.prototype.toString;function E(Ae){return typeof Ae<"u"}y.defined=E;function S(Ae){return typeof Ae>"u"}y.undefined=S;function g(Ae){return Ae===!0||Ae===!1}y.boolean=g;function D(Ae){return w.call(Ae)==="[object String]"}y.string=D;function q(Ae){return w.call(Ae)==="[object Number]"}y.number=q;function ge(Ae,Do,Xu){return w.call(Ae)==="[object Number]"&&Do<=Ae&&Ae<=Xu}y.numberRange=ge;function Et(Ae){return w.call(Ae)==="[object Number]"&&-2147483648<=Ae&&Ae<=2147483647}y.integer=Et;function ut(Ae){return w.call(Ae)==="[object Number]"&&0<=Ae&&Ae<=2147483647}y.uinteger=ut;function xn(Ae){return w.call(Ae)==="[object Function]"}y.func=xn;function Ln(Ae){return Ae!==null&&typeof Ae=="object"}y.objectLiteral=Ln;function Ei(Ae,Do){return Array.isArray(Ae)&&Ae.every(Do)}y.typedArray=Ei})(A||(A={}))})});var St=R(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.ProtocolNotificationType=Ar.ProtocolNotificationType0=Ar.ProtocolRequestType=Ar.ProtocolRequestType0=Ar.RegistrationType=Ar.MessageDirection=void 0;var Bo=zs(),Uk;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(Uk||(Ar.MessageDirection=Uk={}));var cy=class{constructor(e){this.method=e}};Ar.RegistrationType=cy;var ly=class extends Bo.RequestType0{constructor(e){super(e)}};Ar.ProtocolRequestType0=ly;var uy=class extends Bo.RequestType{constructor(e){super(e,Bo.ParameterStructures.byName)}};Ar.ProtocolRequestType=uy;var dy=class extends Bo.NotificationType0{constructor(e){super(e)}};Ar.ProtocolNotificationType0=dy;var fy=class extends Bo.NotificationType{constructor(e){super(e,Bo.ParameterStructures.byName)}};Ar.ProtocolNotificationType=fy});var Sd=R($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.objectLiteral=$t.typedArray=$t.stringArray=$t.array=$t.func=$t.error=$t.number=$t.string=$t.boolean=void 0;function AF(t){return t===!0||t===!1}$t.boolean=AF;function Hk(t){return typeof t=="string"||t instanceof String}$t.string=Hk;function IF(t){return typeof t=="number"||t instanceof Number}$t.number=IF;function OF(t){return t instanceof Error}$t.error=OF;function MF(t){return typeof t=="function"}$t.func=MF;function Vk(t){return Array.isArray(t)}$t.array=Vk;function xF(t){return Vk(t)&&t.every(e=>Hk(e))}$t.stringArray=xF;function LF(t,e){return Array.isArray(t)&&t.every(e)}$t.typedArray=LF;function qF(t){return t!==null&&typeof t=="object"}$t.objectLiteral=qF});var Gk=R(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});_d.ImplementationRequest=void 0;var zk=St(),Wk;(function(t){t.method="textDocument/implementation",t.messageDirection=zk.MessageDirection.clientToServer,t.type=new zk.ProtocolRequestType(t.method)})(Wk||(_d.ImplementationRequest=Wk={}))});var Xk=R(kd=>{"use strict";Object.defineProperty(kd,"__esModule",{value:!0});kd.TypeDefinitionRequest=void 0;var Kk=St(),Yk;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=Kk.MessageDirection.clientToServer,t.type=new Kk.ProtocolRequestType(t.method)})(Yk||(kd.TypeDefinitionRequest=Yk={}))});var Zk=R(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.DidChangeWorkspaceFoldersNotification=Fo.WorkspaceFoldersRequest=void 0;var Nd=St(),Jk;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=Nd.MessageDirection.serverToClient,t.type=new Nd.ProtocolRequestType0(t.method)})(Jk||(Fo.WorkspaceFoldersRequest=Jk={}));var Qk;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=Nd.MessageDirection.clientToServer,t.type=new Nd.ProtocolNotificationType(t.method)})(Qk||(Fo.DidChangeWorkspaceFoldersNotification=Qk={}))});var rN=R(Rd=>{"use strict";Object.defineProperty(Rd,"__esModule",{value:!0});Rd.ConfigurationRequest=void 0;var eN=St(),tN;(function(t){t.method="workspace/configuration",t.messageDirection=eN.MessageDirection.serverToClient,t.type=new eN.ProtocolRequestType(t.method)})(tN||(Rd.ConfigurationRequest=tN={}))});var sN=R(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.ColorPresentationRequest=jo.DocumentColorRequest=void 0;var Pd=St(),nN;(function(t){t.method="textDocument/documentColor",t.messageDirection=Pd.MessageDirection.clientToServer,t.type=new Pd.ProtocolRequestType(t.method)})(nN||(jo.DocumentColorRequest=nN={}));var iN;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=Pd.MessageDirection.clientToServer,t.type=new Pd.ProtocolRequestType(t.method)})(iN||(jo.ColorPresentationRequest=iN={}))});var cN=R(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.FoldingRangeRefreshRequest=Uo.FoldingRangeRequest=void 0;var wd=St(),oN;(function(t){t.method="textDocument/foldingRange",t.messageDirection=wd.MessageDirection.clientToServer,t.type=new wd.ProtocolRequestType(t.method)})(oN||(Uo.FoldingRangeRequest=oN={}));var aN;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=wd.MessageDirection.serverToClient,t.type=new wd.ProtocolRequestType0(t.method)})(aN||(Uo.FoldingRangeRefreshRequest=aN={}))});var dN=R(Ed=>{"use strict";Object.defineProperty(Ed,"__esModule",{value:!0});Ed.DeclarationRequest=void 0;var lN=St(),uN;(function(t){t.method="textDocument/declaration",t.messageDirection=lN.MessageDirection.clientToServer,t.type=new lN.ProtocolRequestType(t.method)})(uN||(Ed.DeclarationRequest=uN={}))});var hN=R(Cd=>{"use strict";Object.defineProperty(Cd,"__esModule",{value:!0});Cd.SelectionRangeRequest=void 0;var fN=St(),pN;(function(t){t.method="textDocument/selectionRange",t.messageDirection=fN.MessageDirection.clientToServer,t.type=new fN.ProtocolRequestType(t.method)})(pN||(Cd.SelectionRangeRequest=pN={}))});var TN=R(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.WorkDoneProgressCancelNotification=Zi.WorkDoneProgressCreateRequest=Zi.WorkDoneProgress=void 0;var $F=zs(),Dd=St(),mN;(function(t){t.type=new $F.ProgressType;function e(r){return r===t.type}t.is=e})(mN||(Zi.WorkDoneProgress=mN={}));var gN;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=Dd.MessageDirection.serverToClient,t.type=new Dd.ProtocolRequestType(t.method)})(gN||(Zi.WorkDoneProgressCreateRequest=gN={}));var yN;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=Dd.MessageDirection.clientToServer,t.type=new Dd.ProtocolNotificationType(t.method)})(yN||(Zi.WorkDoneProgressCancelNotification=yN={}))});var _N=R(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.CallHierarchyOutgoingCallsRequest=es.CallHierarchyIncomingCallsRequest=es.CallHierarchyPrepareRequest=void 0;var Ho=St(),vN;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=Ho.MessageDirection.clientToServer,t.type=new Ho.ProtocolRequestType(t.method)})(vN||(es.CallHierarchyPrepareRequest=vN={}));var bN;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=Ho.MessageDirection.clientToServer,t.type=new Ho.ProtocolRequestType(t.method)})(bN||(es.CallHierarchyIncomingCallsRequest=bN={}));var SN;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=Ho.MessageDirection.clientToServer,t.type=new Ho.ProtocolRequestType(t.method)})(SN||(es.CallHierarchyOutgoingCallsRequest=SN={}))});var EN=R(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.SemanticTokensRefreshRequest=Ir.SemanticTokensRangeRequest=Ir.SemanticTokensDeltaRequest=Ir.SemanticTokensRequest=Ir.SemanticTokensRegistrationType=Ir.TokenFormat=void 0;var Di=St(),kN;(function(t){t.Relative="relative"})(kN||(Ir.TokenFormat=kN={}));var yc;(function(t){t.method="textDocument/semanticTokens",t.type=new Di.RegistrationType(t.method)})(yc||(Ir.SemanticTokensRegistrationType=yc={}));var NN;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=Di.MessageDirection.clientToServer,t.type=new Di.ProtocolRequestType(t.method),t.registrationMethod=yc.method})(NN||(Ir.SemanticTokensRequest=NN={}));var RN;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=Di.MessageDirection.clientToServer,t.type=new Di.ProtocolRequestType(t.method),t.registrationMethod=yc.method})(RN||(Ir.SemanticTokensDeltaRequest=RN={}));var PN;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=Di.MessageDirection.clientToServer,t.type=new Di.ProtocolRequestType(t.method),t.registrationMethod=yc.method})(PN||(Ir.SemanticTokensRangeRequest=PN={}));var wN;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=Di.MessageDirection.serverToClient,t.type=new Di.ProtocolRequestType0(t.method)})(wN||(Ir.SemanticTokensRefreshRequest=wN={}))});var AN=R(Ad=>{"use strict";Object.defineProperty(Ad,"__esModule",{value:!0});Ad.ShowDocumentRequest=void 0;var CN=St(),DN;(function(t){t.method="window/showDocument",t.messageDirection=CN.MessageDirection.serverToClient,t.type=new CN.ProtocolRequestType(t.method)})(DN||(Ad.ShowDocumentRequest=DN={}))});var MN=R(Id=>{"use strict";Object.defineProperty(Id,"__esModule",{value:!0});Id.LinkedEditingRangeRequest=void 0;var IN=St(),ON;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=IN.MessageDirection.clientToServer,t.type=new IN.ProtocolRequestType(t.method)})(ON||(Id.LinkedEditingRangeRequest=ON={}))});var UN=R(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.WillDeleteFilesRequest=ur.DidDeleteFilesNotification=ur.DidRenameFilesNotification=ur.WillRenameFilesRequest=ur.DidCreateFilesNotification=ur.WillCreateFilesRequest=ur.FileOperationPatternKind=void 0;var cn=St(),xN;(function(t){t.file="file",t.folder="folder"})(xN||(ur.FileOperationPatternKind=xN={}));var LN;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=cn.MessageDirection.clientToServer,t.type=new cn.ProtocolRequestType(t.method)})(LN||(ur.WillCreateFilesRequest=LN={}));var qN;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=cn.MessageDirection.clientToServer,t.type=new cn.ProtocolNotificationType(t.method)})(qN||(ur.DidCreateFilesNotification=qN={}));var $N;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=cn.MessageDirection.clientToServer,t.type=new cn.ProtocolRequestType(t.method)})($N||(ur.WillRenameFilesRequest=$N={}));var BN;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=cn.MessageDirection.clientToServer,t.type=new cn.ProtocolNotificationType(t.method)})(BN||(ur.DidRenameFilesNotification=BN={}));var FN;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=cn.MessageDirection.clientToServer,t.type=new cn.ProtocolNotificationType(t.method)})(FN||(ur.DidDeleteFilesNotification=FN={}));var jN;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=cn.MessageDirection.clientToServer,t.type=new cn.ProtocolRequestType(t.method)})(jN||(ur.WillDeleteFilesRequest=jN={}))});var GN=R(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.MonikerRequest=ts.MonikerKind=ts.UniquenessLevel=void 0;var HN=St(),VN;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(VN||(ts.UniquenessLevel=VN={}));var zN;(function(t){t.$import="import",t.$export="export",t.local="local"})(zN||(ts.MonikerKind=zN={}));var WN;(function(t){t.method="textDocument/moniker",t.messageDirection=HN.MessageDirection.clientToServer,t.type=new HN.ProtocolRequestType(t.method)})(WN||(ts.MonikerRequest=WN={}))});var JN=R(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});rs.TypeHierarchySubtypesRequest=rs.TypeHierarchySupertypesRequest=rs.TypeHierarchyPrepareRequest=void 0;var Vo=St(),KN;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=Vo.MessageDirection.clientToServer,t.type=new Vo.ProtocolRequestType(t.method)})(KN||(rs.TypeHierarchyPrepareRequest=KN={}));var YN;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=Vo.MessageDirection.clientToServer,t.type=new Vo.ProtocolRequestType(t.method)})(YN||(rs.TypeHierarchySupertypesRequest=YN={}));var XN;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=Vo.MessageDirection.clientToServer,t.type=new Vo.ProtocolRequestType(t.method)})(XN||(rs.TypeHierarchySubtypesRequest=XN={}))});var eR=R(zo=>{"use strict";Object.defineProperty(zo,"__esModule",{value:!0});zo.InlineValueRefreshRequest=zo.InlineValueRequest=void 0;var Od=St(),QN;(function(t){t.method="textDocument/inlineValue",t.messageDirection=Od.MessageDirection.clientToServer,t.type=new Od.ProtocolRequestType(t.method)})(QN||(zo.InlineValueRequest=QN={}));var ZN;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=Od.MessageDirection.serverToClient,t.type=new Od.ProtocolRequestType0(t.method)})(ZN||(zo.InlineValueRefreshRequest=ZN={}))});var iR=R(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.InlayHintRefreshRequest=ns.InlayHintResolveRequest=ns.InlayHintRequest=void 0;var Wo=St(),tR;(function(t){t.method="textDocument/inlayHint",t.messageDirection=Wo.MessageDirection.clientToServer,t.type=new Wo.ProtocolRequestType(t.method)})(tR||(ns.InlayHintRequest=tR={}));var rR;(function(t){t.method="inlayHint/resolve",t.messageDirection=Wo.MessageDirection.clientToServer,t.type=new Wo.ProtocolRequestType(t.method)})(rR||(ns.InlayHintResolveRequest=rR={}));var nR;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=Wo.MessageDirection.serverToClient,t.type=new Wo.ProtocolRequestType0(t.method)})(nR||(ns.InlayHintRefreshRequest=nR={}))});var dR=R(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.DiagnosticRefreshRequest=ln.WorkspaceDiagnosticRequest=ln.DocumentDiagnosticRequest=ln.DocumentDiagnosticReportKind=ln.DiagnosticServerCancellationData=void 0;var uR=zs(),BF=Sd(),Go=St(),sR;(function(t){function e(r){let n=r;return n&&BF.boolean(n.retriggerRequest)}t.is=e})(sR||(ln.DiagnosticServerCancellationData=sR={}));var oR;(function(t){t.Full="full",t.Unchanged="unchanged"})(oR||(ln.DocumentDiagnosticReportKind=oR={}));var aR;(function(t){t.method="textDocument/diagnostic",t.messageDirection=Go.MessageDirection.clientToServer,t.type=new Go.ProtocolRequestType(t.method),t.partialResult=new uR.ProgressType})(aR||(ln.DocumentDiagnosticRequest=aR={}));var cR;(function(t){t.method="workspace/diagnostic",t.messageDirection=Go.MessageDirection.clientToServer,t.type=new Go.ProtocolRequestType(t.method),t.partialResult=new uR.ProgressType})(cR||(ln.WorkspaceDiagnosticRequest=cR={}));var lR;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=Go.MessageDirection.serverToClient,t.type=new Go.ProtocolRequestType0(t.method)})(lR||(ln.DiagnosticRefreshRequest=lR={}))});var TR=R(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.DidCloseNotebookDocumentNotification=Ct.DidSaveNotebookDocumentNotification=Ct.DidChangeNotebookDocumentNotification=Ct.NotebookCellArrayChange=Ct.DidOpenNotebookDocumentNotification=Ct.NotebookDocumentSyncRegistrationType=Ct.NotebookDocument=Ct.NotebookCell=Ct.ExecutionSummary=Ct.NotebookCellKind=void 0;var Tc=bd(),$n=Sd(),si=St(),py;(function(t){t.Markup=1,t.Code=2;function e(r){return r===1||r===2}t.is=e})(py||(Ct.NotebookCellKind=py={}));var hy;(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 $n.objectLiteral(s)&&Tc.uinteger.is(s.executionOrder)&&(s.success===void 0||$n.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})(hy||(Ct.ExecutionSummary=hy={}));var Md;(function(t){function e(s,o){return{kind:s,document:o}}t.create=e;function r(s){let o=s;return $n.objectLiteral(o)&&py.is(o.kind)&&Tc.DocumentUri.is(o.document)&&(o.metadata===void 0||$n.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)&&!hy.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($n.objectLiteral(s)&&$n.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}})(Md||(Ct.NotebookCell=Md={}));var fR;(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 $n.objectLiteral(i)&&$n.string(i.uri)&&Tc.integer.is(i.version)&&$n.typedArray(i.cells,Md.is)}t.is=r})(fR||(Ct.NotebookDocument=fR={}));var Ko;(function(t){t.method="notebookDocument/sync",t.messageDirection=si.MessageDirection.clientToServer,t.type=new si.RegistrationType(t.method)})(Ko||(Ct.NotebookDocumentSyncRegistrationType=Ko={}));var pR;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=si.MessageDirection.clientToServer,t.type=new si.ProtocolNotificationType(t.method),t.registrationMethod=Ko.method})(pR||(Ct.DidOpenNotebookDocumentNotification=pR={}));var hR;(function(t){function e(n){let i=n;return $n.objectLiteral(i)&&Tc.uinteger.is(i.start)&&Tc.uinteger.is(i.deleteCount)&&(i.cells===void 0||$n.typedArray(i.cells,Md.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})(hR||(Ct.NotebookCellArrayChange=hR={}));var mR;(function(t){t.method="notebookDocument/didChange",t.messageDirection=si.MessageDirection.clientToServer,t.type=new si.ProtocolNotificationType(t.method),t.registrationMethod=Ko.method})(mR||(Ct.DidChangeNotebookDocumentNotification=mR={}));var gR;(function(t){t.method="notebookDocument/didSave",t.messageDirection=si.MessageDirection.clientToServer,t.type=new si.ProtocolNotificationType(t.method),t.registrationMethod=Ko.method})(gR||(Ct.DidSaveNotebookDocumentNotification=gR={}));var yR;(function(t){t.method="notebookDocument/didClose",t.messageDirection=si.MessageDirection.clientToServer,t.type=new si.ProtocolNotificationType(t.method),t.registrationMethod=Ko.method})(yR||(Ct.DidCloseNotebookDocumentNotification=yR={}))});var SR=R(xd=>{"use strict";Object.defineProperty(xd,"__esModule",{value:!0});xd.InlineCompletionRequest=void 0;var vR=St(),bR;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=vR.MessageDirection.clientToServer,t.type=new vR.ProtocolRequestType(t.method)})(bR||(xd.InlineCompletionRequest=bR={}))});var MP=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 V=St(),_R=bd(),Gt=Sd(),FF=Gk();Object.defineProperty(k,"ImplementationRequest",{enumerable:!0,get:function(){return FF.ImplementationRequest}});var jF=Xk();Object.defineProperty(k,"TypeDefinitionRequest",{enumerable:!0,get:function(){return jF.TypeDefinitionRequest}});var DP=Zk();Object.defineProperty(k,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return DP.WorkspaceFoldersRequest}});Object.defineProperty(k,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return DP.DidChangeWorkspaceFoldersNotification}});var UF=rN();Object.defineProperty(k,"ConfigurationRequest",{enumerable:!0,get:function(){return UF.ConfigurationRequest}});var AP=sN();Object.defineProperty(k,"DocumentColorRequest",{enumerable:!0,get:function(){return AP.DocumentColorRequest}});Object.defineProperty(k,"ColorPresentationRequest",{enumerable:!0,get:function(){return AP.ColorPresentationRequest}});var IP=cN();Object.defineProperty(k,"FoldingRangeRequest",{enumerable:!0,get:function(){return IP.FoldingRangeRequest}});Object.defineProperty(k,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return IP.FoldingRangeRefreshRequest}});var HF=dN();Object.defineProperty(k,"DeclarationRequest",{enumerable:!0,get:function(){return HF.DeclarationRequest}});var VF=hN();Object.defineProperty(k,"SelectionRangeRequest",{enumerable:!0,get:function(){return VF.SelectionRangeRequest}});var vy=TN();Object.defineProperty(k,"WorkDoneProgress",{enumerable:!0,get:function(){return vy.WorkDoneProgress}});Object.defineProperty(k,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return vy.WorkDoneProgressCreateRequest}});Object.defineProperty(k,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return vy.WorkDoneProgressCancelNotification}});var by=_N();Object.defineProperty(k,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return by.CallHierarchyIncomingCallsRequest}});Object.defineProperty(k,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return by.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(k,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return by.CallHierarchyPrepareRequest}});var Yo=EN();Object.defineProperty(k,"TokenFormat",{enumerable:!0,get:function(){return Yo.TokenFormat}});Object.defineProperty(k,"SemanticTokensRequest",{enumerable:!0,get:function(){return Yo.SemanticTokensRequest}});Object.defineProperty(k,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return Yo.SemanticTokensDeltaRequest}});Object.defineProperty(k,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return Yo.SemanticTokensRangeRequest}});Object.defineProperty(k,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return Yo.SemanticTokensRefreshRequest}});Object.defineProperty(k,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return Yo.SemanticTokensRegistrationType}});var zF=AN();Object.defineProperty(k,"ShowDocumentRequest",{enumerable:!0,get:function(){return zF.ShowDocumentRequest}});var WF=MN();Object.defineProperty(k,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return WF.LinkedEditingRangeRequest}});var Ws=UN();Object.defineProperty(k,"FileOperationPatternKind",{enumerable:!0,get:function(){return Ws.FileOperationPatternKind}});Object.defineProperty(k,"DidCreateFilesNotification",{enumerable:!0,get:function(){return Ws.DidCreateFilesNotification}});Object.defineProperty(k,"WillCreateFilesRequest",{enumerable:!0,get:function(){return Ws.WillCreateFilesRequest}});Object.defineProperty(k,"DidRenameFilesNotification",{enumerable:!0,get:function(){return Ws.DidRenameFilesNotification}});Object.defineProperty(k,"WillRenameFilesRequest",{enumerable:!0,get:function(){return Ws.WillRenameFilesRequest}});Object.defineProperty(k,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return Ws.DidDeleteFilesNotification}});Object.defineProperty(k,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return Ws.WillDeleteFilesRequest}});var Sy=GN();Object.defineProperty(k,"UniquenessLevel",{enumerable:!0,get:function(){return Sy.UniquenessLevel}});Object.defineProperty(k,"MonikerKind",{enumerable:!0,get:function(){return Sy.MonikerKind}});Object.defineProperty(k,"MonikerRequest",{enumerable:!0,get:function(){return Sy.MonikerRequest}});var _y=JN();Object.defineProperty(k,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return _y.TypeHierarchyPrepareRequest}});Object.defineProperty(k,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return _y.TypeHierarchySubtypesRequest}});Object.defineProperty(k,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return _y.TypeHierarchySupertypesRequest}});var OP=eR();Object.defineProperty(k,"InlineValueRequest",{enumerable:!0,get:function(){return OP.InlineValueRequest}});Object.defineProperty(k,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return OP.InlineValueRefreshRequest}});var ky=iR();Object.defineProperty(k,"InlayHintRequest",{enumerable:!0,get:function(){return ky.InlayHintRequest}});Object.defineProperty(k,"InlayHintResolveRequest",{enumerable:!0,get:function(){return ky.InlayHintResolveRequest}});Object.defineProperty(k,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return ky.InlayHintRefreshRequest}});var vc=dR();Object.defineProperty(k,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return vc.DiagnosticServerCancellationData}});Object.defineProperty(k,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return vc.DocumentDiagnosticReportKind}});Object.defineProperty(k,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return vc.DocumentDiagnosticRequest}});Object.defineProperty(k,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return vc.WorkspaceDiagnosticRequest}});Object.defineProperty(k,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return vc.DiagnosticRefreshRequest}});var oi=TR();Object.defineProperty(k,"NotebookCellKind",{enumerable:!0,get:function(){return oi.NotebookCellKind}});Object.defineProperty(k,"ExecutionSummary",{enumerable:!0,get:function(){return oi.ExecutionSummary}});Object.defineProperty(k,"NotebookCell",{enumerable:!0,get:function(){return oi.NotebookCell}});Object.defineProperty(k,"NotebookDocument",{enumerable:!0,get:function(){return oi.NotebookDocument}});Object.defineProperty(k,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return oi.NotebookDocumentSyncRegistrationType}});Object.defineProperty(k,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return oi.DidOpenNotebookDocumentNotification}});Object.defineProperty(k,"NotebookCellArrayChange",{enumerable:!0,get:function(){return oi.NotebookCellArrayChange}});Object.defineProperty(k,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return oi.DidChangeNotebookDocumentNotification}});Object.defineProperty(k,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return oi.DidSaveNotebookDocumentNotification}});Object.defineProperty(k,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return oi.DidCloseNotebookDocumentNotification}});var GF=SR();Object.defineProperty(k,"InlineCompletionRequest",{enumerable:!0,get:function(){return GF.InlineCompletionRequest}});var my;(function(t){function e(r){let n=r;return Gt.string(n)||Gt.string(n.language)||Gt.string(n.scheme)||Gt.string(n.pattern)}t.is=e})(my||(k.TextDocumentFilter=my={}));var gy;(function(t){function e(r){let n=r;return Gt.objectLiteral(n)&&(Gt.string(n.notebookType)||Gt.string(n.scheme)||Gt.string(n.pattern))}t.is=e})(gy||(k.NotebookDocumentFilter=gy={}));var yy;(function(t){function e(r){let n=r;return Gt.objectLiteral(n)&&(Gt.string(n.notebook)||gy.is(n.notebook))&&(n.language===void 0||Gt.string(n.language))}t.is=e})(yy||(k.NotebookCellTextDocumentFilter=yy={}));var Ty;(function(t){function e(r){if(!Array.isArray(r))return!1;for(let n of r)if(!Gt.string(n)&&!my.is(n)&&!yy.is(n))return!1;return!0}t.is=e})(Ty||(k.DocumentSelector=Ty={}));var kR;(function(t){t.method="client/registerCapability",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType(t.method)})(kR||(k.RegistrationRequest=kR={}));var NR;(function(t){t.method="client/unregisterCapability",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType(t.method)})(NR||(k.UnregistrationRequest=NR={}));var RR;(function(t){t.Create="create",t.Rename="rename",t.Delete="delete"})(RR||(k.ResourceOperationKind=RR={}));var PR;(function(t){t.Abort="abort",t.Transactional="transactional",t.TextOnlyTransactional="textOnlyTransactional",t.Undo="undo"})(PR||(k.FailureHandlingKind=PR={}));var wR;(function(t){t.UTF8="utf-8",t.UTF16="utf-16",t.UTF32="utf-32"})(wR||(k.PositionEncodingKind=wR={}));var ER;(function(t){function e(r){let n=r;return n&&Gt.string(n.id)&&n.id.length>0}t.hasId=e})(ER||(k.StaticRegistrationOptions=ER={}));var CR;(function(t){function e(r){let n=r;return n&&(n.documentSelector===null||Ty.is(n.documentSelector))}t.is=e})(CR||(k.TextDocumentRegistrationOptions=CR={}));var DR;(function(t){function e(n){let i=n;return Gt.objectLiteral(i)&&(i.workDoneProgress===void 0||Gt.boolean(i.workDoneProgress))}t.is=e;function r(n){let i=n;return i&&Gt.boolean(i.workDoneProgress)}t.hasWorkDoneProgress=r})(DR||(k.WorkDoneProgressOptions=DR={}));var AR;(function(t){t.method="initialize",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(AR||(k.InitializeRequest=AR={}));var IR;(function(t){t.unknownProtocolVersion=1})(IR||(k.InitializeErrorCodes=IR={}));var OR;(function(t){t.method="initialized",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(OR||(k.InitializedNotification=OR={}));var MR;(function(t){t.method="shutdown",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType0(t.method)})(MR||(k.ShutdownRequest=MR={}));var xR;(function(t){t.method="exit",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType0(t.method)})(xR||(k.ExitNotification=xR={}));var LR;(function(t){t.method="workspace/didChangeConfiguration",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(LR||(k.DidChangeConfigurationNotification=LR={}));var qR;(function(t){t.Error=1,t.Warning=2,t.Info=3,t.Log=4,t.Debug=5})(qR||(k.MessageType=qR={}));var $R;(function(t){t.method="window/showMessage",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolNotificationType(t.method)})($R||(k.ShowMessageNotification=$R={}));var BR;(function(t){t.method="window/showMessageRequest",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType(t.method)})(BR||(k.ShowMessageRequest=BR={}));var FR;(function(t){t.method="window/logMessage",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolNotificationType(t.method)})(FR||(k.LogMessageNotification=FR={}));var jR;(function(t){t.method="telemetry/event",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolNotificationType(t.method)})(jR||(k.TelemetryEventNotification=jR={}));var UR;(function(t){t.None=0,t.Full=1,t.Incremental=2})(UR||(k.TextDocumentSyncKind=UR={}));var HR;(function(t){t.method="textDocument/didOpen",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(HR||(k.DidOpenTextDocumentNotification=HR={}));var VR;(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})(VR||(k.TextDocumentContentChangeEvent=VR={}));var zR;(function(t){t.method="textDocument/didChange",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(zR||(k.DidChangeTextDocumentNotification=zR={}));var WR;(function(t){t.method="textDocument/didClose",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(WR||(k.DidCloseTextDocumentNotification=WR={}));var GR;(function(t){t.method="textDocument/didSave",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(GR||(k.DidSaveTextDocumentNotification=GR={}));var KR;(function(t){t.Manual=1,t.AfterDelay=2,t.FocusOut=3})(KR||(k.TextDocumentSaveReason=KR={}));var YR;(function(t){t.method="textDocument/willSave",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(YR||(k.WillSaveTextDocumentNotification=YR={}));var XR;(function(t){t.method="textDocument/willSaveWaitUntil",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(XR||(k.WillSaveTextDocumentWaitUntilRequest=XR={}));var JR;(function(t){t.method="workspace/didChangeWatchedFiles",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(JR||(k.DidChangeWatchedFilesNotification=JR={}));var QR;(function(t){t.Created=1,t.Changed=2,t.Deleted=3})(QR||(k.FileChangeType=QR={}));var ZR;(function(t){function e(r){let n=r;return Gt.objectLiteral(n)&&(_R.URI.is(n.baseUri)||_R.WorkspaceFolder.is(n.baseUri))&&Gt.string(n.pattern)}t.is=e})(ZR||(k.RelativePattern=ZR={}));var eP;(function(t){t.Create=1,t.Change=2,t.Delete=4})(eP||(k.WatchKind=eP={}));var tP;(function(t){t.method="textDocument/publishDiagnostics",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolNotificationType(t.method)})(tP||(k.PublishDiagnosticsNotification=tP={}));var rP;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.TriggerForIncompleteCompletions=3})(rP||(k.CompletionTriggerKind=rP={}));var nP;(function(t){t.method="textDocument/completion",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(nP||(k.CompletionRequest=nP={}));var iP;(function(t){t.method="completionItem/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(iP||(k.CompletionResolveRequest=iP={}));var sP;(function(t){t.method="textDocument/hover",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(sP||(k.HoverRequest=sP={}));var oP;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.ContentChange=3})(oP||(k.SignatureHelpTriggerKind=oP={}));var aP;(function(t){t.method="textDocument/signatureHelp",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(aP||(k.SignatureHelpRequest=aP={}));var cP;(function(t){t.method="textDocument/definition",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(cP||(k.DefinitionRequest=cP={}));var lP;(function(t){t.method="textDocument/references",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(lP||(k.ReferencesRequest=lP={}));var uP;(function(t){t.method="textDocument/documentHighlight",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(uP||(k.DocumentHighlightRequest=uP={}));var dP;(function(t){t.method="textDocument/documentSymbol",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(dP||(k.DocumentSymbolRequest=dP={}));var fP;(function(t){t.method="textDocument/codeAction",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(fP||(k.CodeActionRequest=fP={}));var pP;(function(t){t.method="codeAction/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(pP||(k.CodeActionResolveRequest=pP={}));var hP;(function(t){t.method="workspace/symbol",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(hP||(k.WorkspaceSymbolRequest=hP={}));var mP;(function(t){t.method="workspaceSymbol/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(mP||(k.WorkspaceSymbolResolveRequest=mP={}));var gP;(function(t){t.method="textDocument/codeLens",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(gP||(k.CodeLensRequest=gP={}));var yP;(function(t){t.method="codeLens/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(yP||(k.CodeLensResolveRequest=yP={}));var TP;(function(t){t.method="workspace/codeLens/refresh",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType0(t.method)})(TP||(k.CodeLensRefreshRequest=TP={}));var vP;(function(t){t.method="textDocument/documentLink",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(vP||(k.DocumentLinkRequest=vP={}));var bP;(function(t){t.method="documentLink/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(bP||(k.DocumentLinkResolveRequest=bP={}));var SP;(function(t){t.method="textDocument/formatting",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(SP||(k.DocumentFormattingRequest=SP={}));var _P;(function(t){t.method="textDocument/rangeFormatting",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(_P||(k.DocumentRangeFormattingRequest=_P={}));var kP;(function(t){t.method="textDocument/rangesFormatting",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(kP||(k.DocumentRangesFormattingRequest=kP={}));var NP;(function(t){t.method="textDocument/onTypeFormatting",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(NP||(k.DocumentOnTypeFormattingRequest=NP={}));var RP;(function(t){t.Identifier=1})(RP||(k.PrepareSupportDefaultBehavior=RP={}));var PP;(function(t){t.method="textDocument/rename",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(PP||(k.RenameRequest=PP={}));var wP;(function(t){t.method="textDocument/prepareRename",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(wP||(k.PrepareRenameRequest=wP={}));var EP;(function(t){t.method="workspace/executeCommand",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(EP||(k.ExecuteCommandRequest=EP={}));var CP;(function(t){t.method="workspace/applyEdit",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType("workspace/applyEdit")})(CP||(k.ApplyWorkspaceEditRequest=CP={}))});var LP=R(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0});Ld.createProtocolConnection=void 0;var xP=zs();function KF(t,e,r,n){return xP.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,xP.createMessageConnection)(t,e,r,n)}Ld.createProtocolConnection=KF});var $P=R(Or=>{"use strict";var YF=Or&&Or.__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]}),qd=Or&&Or.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&YF(e,t,r)};Object.defineProperty(Or,"__esModule",{value:!0});Or.LSPErrorCodes=Or.createProtocolConnection=void 0;qd(zs(),Or);qd(bd(),Or);qd(St(),Or);qd(MP(),Or);var XF=LP();Object.defineProperty(Or,"createProtocolConnection",{enumerable:!0,get:function(){return XF.createProtocolConnection}});var qP;(function(t){t.lspReservedErrorRangeStart=-32899,t.RequestFailed=-32803,t.ServerCancelled=-32802,t.ContentModified=-32801,t.RequestCancelled=-32800,t.lspReservedErrorRangeEnd=-32800})(qP||(Or.LSPErrorCodes=qP={}))});var At=R(ai=>{"use strict";var JF=ai&&ai.__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]}),BP=ai&&ai.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&JF(e,t,r)};Object.defineProperty(ai,"__esModule",{value:!0});ai.createProtocolConnection=void 0;var QF=ay();BP(ay(),ai);BP($P(),ai);function ZF(t,e,r,n){return(0,QF.createMessageConnection)(t,e,r,n)}ai.createProtocolConnection=ZF});var Ny=R(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.generateUuid=un.parse=un.isUUID=un.v4=un.empty=void 0;var bc=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},Sc=class t extends bc{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(""))}};Sc._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];Sc._timeHighBits=["8","9","a","b"];un.empty=new bc("00000000-0000-0000-0000-000000000000");function FP(){return new Sc}un.v4=FP;var ej=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function jP(t){return ej.test(t)}un.isUUID=jP;function tj(t){if(!jP(t))throw new Error("invalid uuid");return new bc(t)}un.parse=tj;function rj(){return FP().asHex()}un.generateUuid=rj});var UP=R(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});ss.attachPartialResult=ss.ProgressFeature=ss.attachWorkDone=void 0;var is=At(),nj=Ny(),Gs=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(is.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(is.WorkDoneProgress.type,this._token,n)}done(){t.Instances.delete(this._token),this._connection.sendProgress(is.WorkDoneProgress.type,this._token,{kind:"end"})}};Gs.Instances=new Map;var $d=class extends Gs{constructor(e,r){super(e,r),this._source=new is.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},_c=class{constructor(){}begin(){}report(){}done(){}},Bd=class extends _c{constructor(){super(),this._source=new is.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function ij(t,e){if(e===void 0||e.workDoneToken===void 0)return new _c;let r=e.workDoneToken;return delete e.workDoneToken,new Gs(t,r)}ss.attachWorkDone=ij;var sj=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(is.WorkDoneProgressCancelNotification.type,r=>{let n=Gs.Instances.get(r.token);(n instanceof $d||n instanceof Bd)&&n.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new _c:new Gs(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,nj.generateUuid)();return this.connection.sendRequest(is.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new $d(this.connection,e))}else return Promise.resolve(new Bd)}};ss.ProgressFeature=sj;var Ry;(function(t){t.type=new is.ProgressType})(Ry||(Ry={}));var Py=class{constructor(e,r){this._connection=e,this._token=r}report(e){this._connection.sendProgress(Ry.type,this._token,e)}};function oj(t,e){if(e===void 0||e.partialResultToken===void 0)return;let r=e.partialResultToken;return delete e.partialResultToken,new Py(t,r)}ss.attachPartialResult=oj});var HP=R(Fd=>{"use strict";Object.defineProperty(Fd,"__esModule",{value:!0});Fd.ConfigurationFeature=void 0;var aj=At(),cj=Ju(),lj=t=>class extends t{getConfiguration(e){return e?cj.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(aj.ConfigurationRequest.type,r).then(n=>Array.isArray(n)?Array.isArray(e)?n:n[0]:Array.isArray(e)?[]:null)}};Fd.ConfigurationFeature=lj});var VP=R(Ud=>{"use strict";Object.defineProperty(Ud,"__esModule",{value:!0});Ud.WorkspaceFoldersFeature=void 0;var jd=At(),uj=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let r=e.workspace;r&&r.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new jd.Emitter,this.connection.onNotification(jd.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(jd.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(jd.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};Ud.WorkspaceFoldersFeature=uj});var zP=R(Hd=>{"use strict";Object.defineProperty(Hd,"__esModule",{value:!0});Hd.CallHierarchyFeature=void 0;var wy=At(),dj=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(wy.CallHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onIncomingCalls:e=>{let r=wy.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onOutgoingCalls:e=>{let r=wy.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Hd.CallHierarchyFeature=dj});var Cy=R(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.SemanticTokensBuilder=os.SemanticTokensDiff=os.SemanticTokensFeature=void 0;var Vd=At(),fj=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(Vd.SemanticTokensRefreshRequest.type),on:e=>{let r=Vd.SemanticTokensRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onDelta:e=>{let r=Vd.SemanticTokensDeltaRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onRange:e=>{let r=Vd.SemanticTokensRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};os.SemanticTokensFeature=fj;var zd=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}]:[]}};os.SemanticTokensDiff=zd;var Ey=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 zd(this._prevData,this._data).computeDiff()}:this.build()}};os.SemanticTokensBuilder=Ey});var WP=R(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.ShowDocumentFeature=void 0;var pj=At(),hj=t=>class extends t{showDocument(e){return this.connection.sendRequest(pj.ShowDocumentRequest.type,e)}};Wd.ShowDocumentFeature=hj});var GP=R(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});Gd.FileOperationsFeature=void 0;var Xo=At(),mj=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(Xo.DidCreateFilesNotification.type,r=>{e(r)})}onDidRenameFiles(e){return this.connection.onNotification(Xo.DidRenameFilesNotification.type,r=>{e(r)})}onDidDeleteFiles(e){return this.connection.onNotification(Xo.DidDeleteFilesNotification.type,r=>{e(r)})}onWillCreateFiles(e){return this.connection.onRequest(Xo.WillCreateFilesRequest.type,(r,n)=>e(r,n))}onWillRenameFiles(e){return this.connection.onRequest(Xo.WillRenameFilesRequest.type,(r,n)=>e(r,n))}onWillDeleteFiles(e){return this.connection.onRequest(Xo.WillDeleteFilesRequest.type,(r,n)=>e(r,n))}};Gd.FileOperationsFeature=mj});var KP=R(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.LinkedEditingRangeFeature=void 0;var gj=At(),yj=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(gj.LinkedEditingRangeRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0))}};Kd.LinkedEditingRangeFeature=yj});var YP=R(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});Yd.TypeHierarchyFeature=void 0;var Dy=At(),Tj=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(Dy.TypeHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onSupertypes:e=>{let r=Dy.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onSubtypes:e=>{let r=Dy.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Yd.TypeHierarchyFeature=Tj});var JP=R(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});Xd.InlineValueFeature=void 0;var XP=At(),vj=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest(XP.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(XP.InlineValueRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};Xd.InlineValueFeature=vj});var ZP=R(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});Jd.FoldingRangeFeature=void 0;var QP=At(),bj=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(QP.FoldingRangeRefreshRequest.type),on:e=>{let r=QP.FoldingRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};Jd.FoldingRangeFeature=bj});var ew=R(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.InlayHintFeature=void 0;var Ay=At(),Sj=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(Ay.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(Ay.InlayHintRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r))),resolve:e=>this.connection.onRequest(Ay.InlayHintResolveRequest.type,(r,n)=>e(r,n))}}};Qd.InlayHintFeature=Sj});var tw=R(Zd=>{"use strict";Object.defineProperty(Zd,"__esModule",{value:!0});Zd.DiagnosticFeature=void 0;var kc=At(),_j=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(kc.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(kc.DocumentDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(kc.DocumentDiagnosticRequest.partialResult,r))),onWorkspace:e=>this.connection.onRequest(kc.WorkspaceDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(kc.WorkspaceDiagnosticRequest.partialResult,r)))}}};Zd.DiagnosticFeature=_j});var Oy=R(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.TextDocuments=void 0;var Ks=At(),Iy=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new Ks.Emitter,this._onDidOpen=new Ks.Emitter,this._onDidClose=new Ks.Emitter,this._onDidSave=new Ks.Emitter,this._onWillSave=new Ks.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=Ks.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}))})),Ks.Disposable.create(()=>{r.forEach(n=>n.dispose())})}};ef.TextDocuments=Iy});var xy=R(Jo=>{"use strict";Object.defineProperty(Jo,"__esModule",{value:!0});Jo.NotebookDocuments=Jo.NotebookSyncFeature=void 0;var dn=At(),rw=Oy(),kj=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(dn.DidOpenNotebookDocumentNotification.type,r=>{e(r)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(dn.DidChangeNotebookDocumentNotification.type,r=>{e(r)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(dn.DidSaveNotebookDocumentNotification.type,r=>{e(r)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(dn.DidCloseNotebookDocumentNotification.type,r=>{e(r)})}}};Jo.NotebookSyncFeature=kj;var tf=class t{onDidOpenTextDocument(e){return this.openHandler=e,dn.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,dn.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,dn.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}};tf.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var My=class{constructor(e){e instanceof rw.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new rw.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new dn.Emitter,this._onDidChange=new dn.Emitter,this._onDidSave=new dn.Emitter,this._onDidClose=new dn.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 tf,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 b=c.cells;if(b.structure!==void 0){let _=b.structure.array;if(s.cells.splice(_.start,_.deleteCount,..._.cells!==void 0?_.cells:[]),b.structure.didOpen!==void 0)for(let v of b.structure.didOpen)r.openTextDocument({textDocument:v}),l.push(v.uri);if(b.structure.didClose)for(let v of b.structure.didClose)r.closeTextDocument({textDocument:v}),u.push(v.uri)}if(b.data!==void 0){let _=new Map(b.data.map(v=>[v.document,v]));for(let v=0;v<=s.cells.length;v++){let N=_.get(s.cells[v].document);if(N!==void 0){let C=s.cells.splice(v,1,N);if(d.push({old:C[0],new:N}),_.delete(N.document),_.size===0)break}}}if(b.textContent!==void 0)for(let _ of b.textContent)r.changeTextDocument({textDocument:_.document,contentChanges:_.changes}),f.push(_.document.uri)}this.updateCellMap(s);let p={notebookDocument:s};a&&(p.metadata={old:o,new:s.metadata});let m=[];for(let b of l)m.push(this.getNotebookCell(b));let h=[];for(let b of u)h.push(this.getNotebookCell(b));let T=[];for(let b of f)T.push(this.getNotebookCell(b));(m.length>0||h.length>0||d.length>0||T.length>0)&&(p.cells={added:m,removed:h,changed:{data:d,textContent:T}}),(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)}})),dn.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let r of e.cells)this.notebookCellMap.set(r.document,[r,e])}};Jo.NotebookDocuments=My});var nw=R(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});rf.MonikerFeature=void 0;var Nj=At(),Rj=t=>class extends t{get moniker(){return{on:e=>{let r=Nj.MonikerRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};rf.MonikerFeature=Rj});var jy=R(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.createConnection=Ue.combineFeatures=Ue.combineNotebooksFeatures=Ue.combineLanguagesFeatures=Ue.combineWorkspaceFeatures=Ue.combineWindowFeatures=Ue.combineClientFeatures=Ue.combineTracerFeatures=Ue.combineTelemetryFeatures=Ue.combineConsoleFeatures=Ue._NotebooksImpl=Ue._LanguagesImpl=Ue.BulkUnregistration=Ue.BulkRegistration=Ue.ErrorMessageTracker=void 0;var K=At(),fn=Ju(),qy=Ny(),me=UP(),Pj=HP(),wj=VP(),Ej=zP(),Cj=Cy(),Dj=WP(),Aj=GP(),Ij=KP(),Oj=YP(),Mj=JP(),xj=ZP(),Lj=ew(),qj=tw(),$j=xy(),Bj=nw();function Ly(t){if(t!==null)return t}var $y=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)})}};Ue.ErrorMessageTracker=$y;var nf=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")})}},By=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(Ly)}showWarningMessage(e,...r){let n={type:K.MessageType.Warning,message:e,actions:r};return this.connection.sendRequest(K.ShowMessageRequest.type,n).then(Ly)}showInformationMessage(e,...r){let n={type:K.MessageType.Info,message:e,actions:r};return this.connection.sendRequest(K.ShowMessageRequest.type,n).then(Ly)}},iw=(0,Dj.ShowDocumentFeature)((0,me.ProgressFeature)(By)),sw;(function(t){function e(){return new sf}t.create=e})(sw||(Ue.BulkRegistration=sw={}));var sf=class{constructor(){this._registrations=[],this._registered=new Set}add(e,r){let n=fn.string(e)?e:e.method;if(this._registered.has(n))throw new Error(`${n} is already added to this registration`);let i=qy.generateUuid();this._registrations.push({id:i,method:n,registerOptions:r||{}}),this._registered.add(n)}asRegistrationParams(){return{registrations:this._registrations}}},ow;(function(t){function e(){return new Nc(void 0,[])}t.create=e})(ow||(Ue.BulkUnregistration=ow={}));var Nc=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=fn.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 sf?this.registerMany(e):e instanceof Nc?this.registerSingle1(e,r,n):this.registerSingle2(e,r)}registerSingle1(e,r,n){let i=fn.string(r)?r:r.method,s=qy.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=fn.string(e)?e:e.method,i=qy.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 Nc(this._connection,r.registrations.map(n=>({id:n.id,method:n.method}))),n=>(this.connection.console.info("Bulk registration failed."),Promise.reject(n)))}},Fy=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)}},aw=(0,Aj.FileOperationsFeature)((0,wj.WorkspaceFoldersFeature)((0,Pj.ConfigurationFeature)(Fy))),af=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(()=>{})}},cf=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,me.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,me.attachPartialResult)(this.connection,r)}};Ue._LanguagesImpl=lf;var cw=(0,xj.FoldingRangeFeature)((0,Bj.MonikerFeature)((0,qj.DiagnosticFeature)((0,Lj.InlayHintFeature)((0,Mj.InlineValueFeature)((0,Oj.TypeHierarchyFeature)((0,Ij.LinkedEditingRangeFeature)((0,Cj.SemanticTokensFeature)((0,Ej.CallHierarchyFeature)(lf))))))))),uf=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,me.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,me.attachPartialResult)(this.connection,r)}};Ue._NotebooksImpl=uf;var lw=(0,$j.NotebookSyncFeature)(uf);function uw(t,e){return function(r){return e(t(r))}}Ue.combineConsoleFeatures=uw;function dw(t,e){return function(r){return e(t(r))}}Ue.combineTelemetryFeatures=dw;function fw(t,e){return function(r){return e(t(r))}}Ue.combineTracerFeatures=fw;function pw(t,e){return function(r){return e(t(r))}}Ue.combineClientFeatures=pw;function hw(t,e){return function(r){return e(t(r))}}Ue.combineWindowFeatures=hw;function mw(t,e){return function(r){return e(t(r))}}Ue.combineWorkspaceFeatures=mw;function gw(t,e){return function(r){return e(t(r))}}Ue.combineLanguagesFeatures=gw;function yw(t,e){return function(r){return e(t(r))}}Ue.combineNotebooksFeatures=yw;function Fj(t,e){function r(i,s,o){return i&&s?o(i,s):i||s}return{__brand:"features",console:r(t.console,e.console,uw),tracer:r(t.tracer,e.tracer,fw),telemetry:r(t.telemetry,e.telemetry,dw),client:r(t.client,e.client,pw),window:r(t.window,e.window,hw),workspace:r(t.workspace,e.workspace,mw),languages:r(t.languages,e.languages,gw),notebooks:r(t.notebooks,e.notebooks,yw)}}Ue.combineFeatures=Fj;function jj(t,e,r){let n=r&&r.console?new(r.console(nf)):new nf,i=t(n);n.rawAttach(i);let s=r&&r.tracer?new(r.tracer(af)):new af,o=r&&r.telemetry?new(r.telemetry(cf)):new cf,a=r&&r.client?new(r.client(of)):new of,c=r&&r.window?new(r.window(iw)):new iw,l=r&&r.workspace?new(r.workspace(aw)):new aw,u=r&&r.languages?new(r.languages(cw)):new cw,d=r&&r.notebooks?new(r.notebooks(lw)):new lw,f=[n,s,o,a,c,l,u,d];function p(_){return _ instanceof Promise?_:fn.thenable(_)?new Promise((v,N)=>{_.then(C=>v(C),C=>N(C))}):Promise.resolve(_)}let m,h,T,b={listen:()=>i.listen(),sendRequest:(_,...v)=>i.sendRequest(fn.string(_)?_:_.method,...v),onRequest:(_,v)=>i.onRequest(_,v),sendNotification:(_,v)=>{let N=fn.string(_)?_:_.method;return i.sendNotification(N,v)},onNotification:(_,v)=>i.onNotification(_,v),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:_=>(h=_,{dispose:()=>{h=void 0}}),onInitialized:_=>i.onNotification(K.InitializedNotification.type,_),onShutdown:_=>(m=_,{dispose:()=>{m=void 0}}),onExit:_=>(T=_,{dispose:()=>{T=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:_=>i.onNotification(K.DidChangeConfigurationNotification.type,_),onDidChangeWatchedFiles:_=>i.onNotification(K.DidChangeWatchedFilesNotification.type,_),__textDocumentSync:void 0,onDidOpenTextDocument:_=>i.onNotification(K.DidOpenTextDocumentNotification.type,_),onDidChangeTextDocument:_=>i.onNotification(K.DidChangeTextDocumentNotification.type,_),onDidCloseTextDocument:_=>i.onNotification(K.DidCloseTextDocumentNotification.type,_),onWillSaveTextDocument:_=>i.onNotification(K.WillSaveTextDocumentNotification.type,_),onWillSaveTextDocumentWaitUntil:_=>i.onRequest(K.WillSaveTextDocumentWaitUntilRequest.type,_),onDidSaveTextDocument:_=>i.onNotification(K.DidSaveTextDocumentNotification.type,_),sendDiagnostics:_=>i.sendNotification(K.PublishDiagnosticsNotification.type,_),onHover:_=>i.onRequest(K.HoverRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),void 0)),onCompletion:_=>i.onRequest(K.CompletionRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onCompletionResolve:_=>i.onRequest(K.CompletionResolveRequest.type,_),onSignatureHelp:_=>i.onRequest(K.SignatureHelpRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),void 0)),onDeclaration:_=>i.onRequest(K.DeclarationRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onDefinition:_=>i.onRequest(K.DefinitionRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onTypeDefinition:_=>i.onRequest(K.TypeDefinitionRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onImplementation:_=>i.onRequest(K.ImplementationRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onReferences:_=>i.onRequest(K.ReferencesRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onDocumentHighlight:_=>i.onRequest(K.DocumentHighlightRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onDocumentSymbol:_=>i.onRequest(K.DocumentSymbolRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onWorkspaceSymbol:_=>i.onRequest(K.WorkspaceSymbolRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onWorkspaceSymbolResolve:_=>i.onRequest(K.WorkspaceSymbolResolveRequest.type,_),onCodeAction:_=>i.onRequest(K.CodeActionRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onCodeActionResolve:_=>i.onRequest(K.CodeActionResolveRequest.type,(v,N)=>_(v,N)),onCodeLens:_=>i.onRequest(K.CodeLensRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onCodeLensResolve:_=>i.onRequest(K.CodeLensResolveRequest.type,(v,N)=>_(v,N)),onDocumentFormatting:_=>i.onRequest(K.DocumentFormattingRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),void 0)),onDocumentRangeFormatting:_=>i.onRequest(K.DocumentRangeFormattingRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),void 0)),onDocumentOnTypeFormatting:_=>i.onRequest(K.DocumentOnTypeFormattingRequest.type,(v,N)=>_(v,N)),onRenameRequest:_=>i.onRequest(K.RenameRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),void 0)),onPrepareRename:_=>i.onRequest(K.PrepareRenameRequest.type,(v,N)=>_(v,N)),onDocumentLinks:_=>i.onRequest(K.DocumentLinkRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onDocumentLinkResolve:_=>i.onRequest(K.DocumentLinkResolveRequest.type,(v,N)=>_(v,N)),onDocumentColor:_=>i.onRequest(K.DocumentColorRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onColorPresentation:_=>i.onRequest(K.ColorPresentationRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onFoldingRanges:_=>i.onRequest(K.FoldingRangeRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onSelectionRanges:_=>i.onRequest(K.SelectionRangeRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onExecuteCommand:_=>i.onRequest(K.ExecuteCommandRequest.type,(v,N)=>_(v,N,(0,me.attachWorkDone)(i,v),void 0)),dispose:()=>i.dispose()};for(let _ of f)_.attach(b);return i.onRequest(K.InitializeRequest.type,_=>{e.initialize(_),fn.string(_.trace)&&(s.trace=K.Trace.fromString(_.trace));for(let v of f)v.initialize(_.capabilities);if(h){let v=h(_,new K.CancellationTokenSource().token,(0,me.attachWorkDone)(i,_),void 0);return p(v).then(N=>{if(N instanceof K.ResponseError)return N;let C=N;C||(C={capabilities:{}});let H=C.capabilities;H||(H={},C.capabilities=H),H.textDocumentSync===void 0||H.textDocumentSync===null?H.textDocumentSync=fn.number(b.__textDocumentSync)?b.__textDocumentSync:K.TextDocumentSyncKind.None:!fn.number(H.textDocumentSync)&&!fn.number(H.textDocumentSync.change)&&(H.textDocumentSync.change=fn.number(b.__textDocumentSync)?b.__textDocumentSync:K.TextDocumentSyncKind.None);for(let M of f)M.fillServerCapabilities(H);return C})}else{let v={capabilities:{textDocumentSync:K.TextDocumentSyncKind.None}};for(let N of f)N.fillServerCapabilities(v.capabilities);return v}}),i.onRequest(K.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,m)return m(new K.CancellationTokenSource().token)}),i.onNotification(K.ExitNotification.type,()=>{try{T&&T()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(K.SetTraceNotification.type,_=>{s.trace=K.Trace.fromString(_.value)}),b}Ue.createConnection=jj});var Tw=R(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.resolveModulePath=Mr.FileSystem=Mr.resolveGlobalYarnPath=Mr.resolveGlobalNodePath=Mr.resolve=Mr.uriToFilePath=void 0;var Uj=require("url"),Bn=require("path"),Uy=require("fs"),Wy=require("child_process");function Hj(t){let e=Uj.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 Bn.normalize(r.join("/"))}Mr.uriToFilePath=Hj;function Hy(){return process.platform==="win32"}function df(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&&Uy.existsSync(e)&&(l[i]?l[i]=e+Bn.delimiter+l[i]:l[i]=e,n&&n(`NODE_PATH value is: ${l[i]}`)),l.ELECTRON_RUN_AS_NODE="1";try{let u=(0,Wy.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)}})}Mr.resolve=df;function Vy(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};Hy()&&(e="npm.cmd",n.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let s=(0,Wy.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?Hy()?Bn.join(o,"node_modules"):Bn.join(o,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}Mr.resolveGlobalNodePath=Vy;function Vj(t){let e="yarn",r={encoding:"utf8"};Hy()&&(e="yarn.cmd",r.shell=!0);let n=()=>{};try{process.on("SIGPIPE",n);let i=(0,Wy.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 Bn.join(c.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",n)}}Mr.resolveGlobalYarnPath=Vj;var zy;(function(t){let e;function r(){return e!==void 0||(process.platform==="win32"?e=!1:e=!Uy.existsSync(__filename.toUpperCase())||!Uy.existsSync(__filename.toLowerCase())),e}t.isCaseSensitive=r;function n(i,s){return r()?Bn.normalize(s).indexOf(Bn.normalize(i))===0:Bn.normalize(s).toLowerCase().indexOf(Bn.normalize(i).toLowerCase())===0}t.isParent=n})(zy||(Mr.FileSystem=zy={}));function zj(t,e,r,n){return r?(Bn.isAbsolute(r)||(r=Bn.join(t,r)),df(e,r,r,n).then(i=>zy.isParent(r,i)?i:Promise.reject(new Error(`Failed to load ${e} from node path location.`))).then(void 0,i=>df(e,Vy(n),t,n))):df(e,Vy(n),t,n)}Mr.resolveModulePath=zj});var Gy=R((KQ,vw)=>{"use strict";vw.exports=At()});var bw=R(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});ff.InlineCompletionFeature=void 0;var Wj=At(),Gj=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(Wj.InlineCompletionRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};ff.InlineCompletionFeature=Gj});var kw=R(dr=>{"use strict";var Kj=dr&&dr.__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]}),_w=dr&&dr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Kj(e,t,r)};Object.defineProperty(dr,"__esModule",{value:!0});dr.ProposedFeatures=dr.NotebookDocuments=dr.TextDocuments=dr.SemanticTokensBuilder=void 0;var Yj=Cy();Object.defineProperty(dr,"SemanticTokensBuilder",{enumerable:!0,get:function(){return Yj.SemanticTokensBuilder}});var Xj=bw();_w(At(),dr);var Jj=Oy();Object.defineProperty(dr,"TextDocuments",{enumerable:!0,get:function(){return Jj.TextDocuments}});var Qj=xy();Object.defineProperty(dr,"NotebookDocuments",{enumerable:!0,get:function(){return Qj.NotebookDocuments}});_w(jy(),dr);var Sw;(function(t){t.all={__brand:"features",languages:Xj.InlineCompletionFeature}})(Sw||(dr.ProposedFeatures=Sw={}))});var j=R(pn=>{"use strict";var Zj=pn&&pn.__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]}),ww=pn&&pn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Zj(e,t,r)};Object.defineProperty(pn,"__esModule",{value:!0});pn.createConnection=pn.Files=void 0;var Nw=require("node:util"),Ky=Ju(),eU=jy(),Rc=Tw(),Ys=Gy();ww(Gy(),pn);ww(kw(),pn);var Rw;(function(t){t.uriToFilePath=Rc.uriToFilePath,t.resolveGlobalNodePath=Rc.resolveGlobalNodePath,t.resolveGlobalYarnPath=Rc.resolveGlobalYarnPath,t.resolve=Rc.resolve,t.resolveModulePath=Rc.resolveModulePath})(Rw||(pn.Files=Rw={}));var Pw;function pf(){if(Pw!==void 0)try{Pw.end()}catch{}}var Qo=!1,Ew;function tU(){let t="--clientProcessId";function e(r){try{let n=parseInt(r);isNaN(n)||(Ew=setInterval(()=>{try{process.kill(n,0)}catch{pf(),process.exit(Qo?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])}}}tU();var rU={initialize:t=>{let e=t.processId;Ky.number(e)&&Ew===void 0&&setInterval(()=>{try{process.kill(e,0)}catch{process.exit(Qo?0:1)}},3e3)},get shutdownReceived(){return Qo},set shutdownReceived(t){Qo=t},exit:t=>{pf(),process.exit(t)}};function nU(t,e,r,n){let i,s,o,a;return t!==void 0&&t.__brand==="features"&&(i=t,t=e,e=r,r=n),Ys.ConnectionStrategy.is(t)||Ys.ConnectionOptions.is(t)?a=t:(s=t,o=e,a=r),iU(s,o,a,i)}pn.createConnection=nU;function iU(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 Ys.IPCMessageReader(process),e=new Ys.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,Ys.createServerSocketTransport)(c);t=d[0],e=d[1]}else if(l){let d=(0,Ys.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(Ky.func(t.read)&&Ky.func(t.on)){let c=t;c.on("end",()=>{pf(),process.exit(Qo?0:1)}),c.on("close",()=>{pf(),process.exit(Qo?0:1)})}let a=c=>{let l=(0,Ys.createProtocolConnection)(t,e,c,r);return i&&sU(c),l};return(0,eU.createConnection)(a,rU,n)}function sU(t){function e(n){return n.map(i=>typeof i=="string"?i:(0,Nw.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,Nw.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 Dw=R((ZQ,Cw)=>{"use strict";Cw.exports=j()});var qe=R(ir=>{"use strict";var tv=Symbol.for("yaml.alias"),aM=Symbol.for("yaml.document"),dh=Symbol.for("yaml.map"),cM=Symbol.for("yaml.pair"),rv=Symbol.for("yaml.scalar"),fh=Symbol.for("yaml.seq"),ji=Symbol.for("yaml.node.type"),XV=t=>!!t&&typeof t=="object"&&t[ji]===tv,JV=t=>!!t&&typeof t=="object"&&t[ji]===aM,QV=t=>!!t&&typeof t=="object"&&t[ji]===dh,ZV=t=>!!t&&typeof t=="object"&&t[ji]===cM,lM=t=>!!t&&typeof t=="object"&&t[ji]===rv,ez=t=>!!t&&typeof t=="object"&&t[ji]===fh;function uM(t){if(t&&typeof t=="object")switch(t[ji]){case dh:case fh:return!0}return!1}function tz(t){if(t&&typeof t=="object")switch(t[ji]){case tv:case dh:case rv:case fh:return!0}return!1}var rz=t=>(lM(t)||uM(t))&&!!t.anchor;ir.ALIAS=tv;ir.DOC=aM;ir.MAP=dh;ir.NODE_TYPE=ji;ir.PAIR=cM;ir.SCALAR=rv;ir.SEQ=fh;ir.hasAnchor=rz;ir.isAlias=XV;ir.isCollection=uM;ir.isDocument=JV;ir.isMap=QV;ir.isNode=tz;ir.isPair=ZV;ir.isScalar=lM;ir.isSeq=ez});var Tl=R(nv=>{"use strict";var zt=qe(),Fr=Symbol("break visit"),dM=Symbol("skip children"),vi=Symbol("remove node");function ph(t,e){let r=fM(e);zt.isDocument(t)?Aa(null,t.contents,r,Object.freeze([t]))===vi&&(t.contents=null):Aa(null,t,r,Object.freeze([]))}ph.BREAK=Fr;ph.SKIP=dM;ph.REMOVE=vi;function Aa(t,e,r,n){let i=pM(t,e,r,n);if(zt.isNode(i)||zt.isPair(i))return hM(t,n,i),Aa(t,i,r,n);if(typeof i!="symbol"){if(zt.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s<e.items.length;++s){let o=Aa(s,e.items[s],r,n);if(typeof o=="number")s=o-1;else{if(o===Fr)return Fr;o===vi&&(e.items.splice(s,1),s-=1)}}}else if(zt.isPair(e)){n=Object.freeze(n.concat(e));let s=Aa("key",e.key,r,n);if(s===Fr)return Fr;s===vi&&(e.key=null);let o=Aa("value",e.value,r,n);if(o===Fr)return Fr;o===vi&&(e.value=null)}}return i}async function hh(t,e){let r=fM(e);zt.isDocument(t)?await Ia(null,t.contents,r,Object.freeze([t]))===vi&&(t.contents=null):await Ia(null,t,r,Object.freeze([]))}hh.BREAK=Fr;hh.SKIP=dM;hh.REMOVE=vi;async function Ia(t,e,r,n){let i=await pM(t,e,r,n);if(zt.isNode(i)||zt.isPair(i))return hM(t,n,i),Ia(t,i,r,n);if(typeof i!="symbol"){if(zt.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s<e.items.length;++s){let o=await Ia(s,e.items[s],r,n);if(typeof o=="number")s=o-1;else{if(o===Fr)return Fr;o===vi&&(e.items.splice(s,1),s-=1)}}}else if(zt.isPair(e)){n=Object.freeze(n.concat(e));let s=await Ia("key",e.key,r,n);if(s===Fr)return Fr;s===vi&&(e.key=null);let o=await Ia("value",e.value,r,n);if(o===Fr)return Fr;o===vi&&(e.value=null)}}return i}function fM(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 pM(t,e,r,n){if(typeof r=="function")return r(t,e,n);if(zt.isMap(e))return r.Map?.(t,e,n);if(zt.isSeq(e))return r.Seq?.(t,e,n);if(zt.isPair(e))return r.Pair?.(t,e,n);if(zt.isScalar(e))return r.Scalar?.(t,e,n);if(zt.isAlias(e))return r.Alias?.(t,e,n)}function hM(t,e,r){let n=e[e.length-1];if(zt.isCollection(n))n.items[t]=r;else if(zt.isPair(n))t==="key"?n.key=r:n.value=r;else if(zt.isDocument(n))n.contents=r;else{let i=zt.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}nv.visit=ph;nv.visitAsync=hh});var iv=R(gM=>{"use strict";var mM=qe(),nz=Tl(),iz={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},sz=t=>t.replace(/[!,[\]{}]/g,e=>iz[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+sz(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&&mM.isNode(e.contents)){let s={};nz.visit(e.contents,(o,a)=>{mM.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
|
+
`)}};vl.defaultYaml={explicit:!1,version:"1.2"};vl.defaultTags={"!!":"tag:yaml.org,2002:"};gM.Directives=vl});var mh=R(bl=>{"use strict";var yM=qe(),oz=Tl();function az(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 TM(t){let e=new Set;return oz.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function vM(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function cz(t,e){let r=[],n=new Map,i=null;return{onAnchor:s=>{r.push(s),i||(i=TM(t));let o=vM(e,i);return i.add(o),o},setAnchors:()=>{for(let s of r){let o=n.get(s);if(typeof o=="object"&&o.anchor&&(yM.isScalar(o.node)||yM.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}}bl.anchorIsValid=az;bl.anchorNames=TM;bl.createNodeAnchors=cz;bl.findNewAnchor=vM});var sv=R(bM=>{"use strict";function Sl(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=Sl(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=Sl(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=Sl(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=Sl(t,n,i,s);o===void 0?delete n[i]:o!==s&&(n[i]=o)}return t.call(e,r,n)}bM.applyReviver=Sl});var vs=R(_M=>{"use strict";var lz=qe();function SM(t,e,r){if(Array.isArray(t))return t.map((n,i)=>SM(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!lz.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=SM});var gh=R(NM=>{"use strict";var uz=sv(),kM=qe(),dz=vs(),ov=class{constructor(e){Object.defineProperty(this,kM.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(!kM.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=dz.toJS(this,"",o);if(typeof i=="function")for(let{count:c,res:l}of o.anchors.values())i(l,c);return typeof s=="function"?uz.applyReviver(s,{"":a},"",a):a}};NM.NodeBase=ov});var _l=R(PM=>{"use strict";var fz=mh(),RM=Tl(),yh=qe(),pz=gh(),hz=vs(),av=class extends pz.NodeBase{constructor(e){super(yh.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let r;return RM.visit(e,{Node:(n,i)=>{if(i===this)return RM.visit.BREAK;i.anchor===this.source&&(r=i)}}),r}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:s}=r,o=this.resolve(i);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||(hz.toJS(o,null,r),a=n.get(o)),!a||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=Th(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(fz.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 Th(t,e,r){if(yh.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(yh.isCollection(e)){let n=0;for(let i of e.items){let s=Th(t,i,r);s>n&&(n=s)}return n}else if(yh.isPair(e)){let n=Th(t,e.key,r),i=Th(t,e.value,r);return Math.max(n,i)}return 1}PM.Alias=av});var jt=R(cv=>{"use strict";var mz=qe(),gz=gh(),yz=vs(),Tz=t=>!t||typeof t!="function"&&typeof t!="object",bs=class extends gz.NodeBase{constructor(e){super(mz.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:yz.toJS(this.value,e,r)}toString(){return String(this.value)}};bs.BLOCK_FOLDED="BLOCK_FOLDED";bs.BLOCK_LITERAL="BLOCK_LITERAL";bs.PLAIN="PLAIN";bs.QUOTE_DOUBLE="QUOTE_DOUBLE";bs.QUOTE_SINGLE="QUOTE_SINGLE";cv.Scalar=bs;cv.isScalarValue=Tz});var kl=R(EM=>{"use strict";var vz=_l(),so=qe(),wM=jt(),bz="tag:yaml.org,2002:";function Sz(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 _z(t,e,r){if(so.isDocument(t)&&(t=t.contents),so.isNode(t))return t;if(so.isPair(t)){let d=r.schema[so.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 vz.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=bz+e.slice(2));let l=Sz(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new wM.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?o[so.MAP]:Symbol.iterator in Object(t)?o[so.SEQ]:o[so.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 wM.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}EM.createNode=_z});var bh=R(vh=>{"use strict";var kz=kl(),bi=qe(),Nz=gh();function lv(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 kz.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 CM=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,uv=class extends Nz.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=>bi.isNode(n)||bi.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(CM(e))this.add(r);else{let[n,...i]=e,s=this.get(n,!0);if(bi.isCollection(s))s.addIn(i,r);else if(s===void 0&&this.schema)this.set(n,lv(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(bi.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&&bi.isScalar(s)?s.value:s:bi.isCollection(s)?s.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!bi.isPair(r))return!1;let n=r.value;return n==null||e&&bi.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 bi.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(bi.isCollection(s))s.setIn(i,r);else if(s===void 0&&this.schema)this.set(n,lv(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};vh.Collection=uv;vh.collectionFromPath=lv;vh.isEmptyPath=CM});var Nl=R(Sh=>{"use strict";var Rz=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function dv(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Pz=(t,e,r)=>t.endsWith(`
|
|
39
|
+
`)?dv(r,e):r.includes(`
|
|
40
40
|
`)?`
|
|
41
|
-
`+
|
|
42
|
-
`)r===
|
|
41
|
+
`+dv(r,e):(t.endsWith(" ")?"":" ")+r;Sh.indentComment=dv;Sh.lineComment=Pz;Sh.stringifyComment=Rz});var AM=R(Rl=>{"use strict";var wz="flow",fv="block",_h="quoted";function Ez(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:s=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return t;i<s&&(s=0);let c=Math.max(1+s,1+i-e.length);if(t.length<=c)return t;let l=[],u={},d=i-e.length;typeof n=="number"&&(n>i-Math.max(2,s)?l.push(0):d=i-n);let f,p,m=!1,h=-1,T=-1,b=-1;r===fv&&(h=DM(t,h,e.length),h!==-1&&(d=h+c));for(let v;v=t[h+=1];){if(r===_h&&v==="\\"){switch(T=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(v===`
|
|
42
|
+
`)r===fv&&(h=DM(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(v===" "&&p&&p!==" "&&p!==`
|
|
43
43
|
`&&p!==" "){let N=t[h+1];N&&N!==" "&&N!==`
|
|
44
|
-
`&&N!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===
|
|
45
|
-
${e}${t.slice(0,C)}`:(r===
|
|
46
|
-
${e}${t.slice(N+1,C)}`)}return
|
|
47
|
-
`);n=e,i=e+1,s=t[i]}return n}
|
|
48
|
-
`){if(s-o>n)return!0;if(o=s+1,i-o<=n)return!1}return!0}function
|
|
44
|
+
`&&N!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===_h){for(;p===" "||p===" ";)p=v,v=t[h+=1],m=!0;let N=h>b+1?h-2:T-1;if(u[N])return t;l.push(N),u[N]=!0,d=N+c,f=void 0}else m=!0}p=v}if(m&&a&&a(),l.length===0)return t;o&&o();let _=t.slice(0,l[0]);for(let v=0;v<l.length;++v){let N=l[v],C=l[v+1]||t.length;N===0?_=`
|
|
45
|
+
${e}${t.slice(0,C)}`:(r===_h&&u[N]&&(_+=`${t[N]}\\`),_+=`
|
|
46
|
+
${e}${t.slice(N+1,C)}`)}return _}function DM(t,e,r){let n=e,i=e+1,s=t[i];for(;s===" "||s===" ";)if(e<i+r)s=t[++e];else{do s=t[++e];while(s&&s!==`
|
|
47
|
+
`);n=e,i=e+1,s=t[i]}return n}Rl.FOLD_BLOCK=fv;Rl.FOLD_FLOW=wz;Rl.FOLD_QUOTED=_h;Rl.foldFlowLines=Ez});var wl=R(IM=>{"use strict";var Jn=jt(),Ss=AM(),Nh=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Rh=t=>/^(%|---|\.\.\.)/m.test(t);function Cz(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let s=0,o=0;s<i;++s)if(t[s]===`
|
|
48
|
+
`){if(s-o>n)return!0;if(o=s+1,i-o<=n)return!1}return!0}function Pl(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(Rh(t)?" ":""),o="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(o+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{o+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length<i)c+=1;else{for(o+=r.slice(a,c)+`
|
|
49
49
|
|
|
50
50
|
`;r[c+2]==="\\"&&r[c+3]==="n"&&r[c+4]!=='"';)o+=`
|
|
51
|
-
`,c+=2;o+=s,r[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+r.slice(a):r,n?o:
|
|
52
|
-
`)||/[ \t]\n|\n[ \t]/.test(t))return
|
|
53
|
-
${r}`)+"'";return e.implicitKey?n:
|
|
51
|
+
`,c+=2;o+=s,r[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+r.slice(a):r,n?o:Ss.foldFlowLines(o,s,Ss.FOLD_QUOTED,Nh(e,!1))}function pv(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
|
52
|
+
`)||/[ \t]\n|\n[ \t]/.test(t))return Pl(t,e);let r=e.indent||(Rh(t)?" ":""),n="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
53
|
+
${r}`)+"'";return e.implicitKey?n:Ss.foldFlowLines(n,r,Ss.FOLD_FLOW,Nh(e,!1))}function Oa(t,e){let{singleQuote:r}=e.options,n;if(r===!1)n=Pl;else{let i=t.includes('"'),s=t.includes("'");i&&!s?n=pv:s&&!i?n=Pl:n=r?pv:Pl}return n(t,e)}var hv;try{hv=new RegExp(`(^|(?<!
|
|
54
54
|
))
|
|
55
55
|
+(?!
|
|
56
|
-
|$)`,"g")}catch{
|
|
56
|
+
|$)`,"g")}catch{hv=/\n+(?!\n|$)/g}function kh({comment:t,type:e,value:r},n,i,s){let{blockQuote:o,commentString:a,lineWidth:c}=n.options;if(!o||/\n[\t ]+$/.test(r)||/^\s*$/.test(r))return Oa(r,n);let l=n.indent||(n.forceBlockIndent||Rh(r)?" ":""),u=o==="literal"?!0:o==="folded"||e===Jn.Scalar.BLOCK_FOLDED?!1:e===Jn.Scalar.BLOCK_LITERAL?!0:!Cz(r,c,l.length);if(!r)return u?`|
|
|
57
57
|
`:`>
|
|
58
58
|
`;let d,f;for(f=r.length;f>0;--f){let C=r[f-1];if(C!==`
|
|
59
59
|
`&&C!==" "&&C!==" ")break}let p=r.substring(f),m=p.indexOf(`
|
|
60
60
|
`);m===-1?d="-":r===p||m!==p.length-1?(d="+",s&&s()):d="",p&&(r=r.slice(0,-p.length),p[p.length-1]===`
|
|
61
|
-
`&&(p=p.slice(0,-1)),p=p.replace(
|
|
62
|
-
`)b=T;else break}let
|
|
63
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),H=!1,M=
|
|
61
|
+
`&&(p=p.slice(0,-1)),p=p.replace(hv,`$&${l}`));let h=!1,T,b=-1;for(T=0;T<r.length;++T){let C=r[T];if(C===" ")h=!0;else if(C===`
|
|
62
|
+
`)b=T;else break}let _=r.substring(0,b<T?b+1:T);_&&(r=r.substring(_.length),_=_.replace(/\n+/g,`$&${l}`));let N=(h?l?"2":"1":"")+d;if(t&&(N+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!u){let C=r.replace(/\n+/g,`
|
|
63
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),H=!1,M=Nh(n,!0);o!=="folded"&&e!==Jn.Scalar.BLOCK_FOLDED&&(M.onOverflow=()=>{H=!0});let F=Ss.foldFlowLines(`${_}${C}${p}`,l,Ss.FOLD_BLOCK,M);if(!H)return`>${N}
|
|
64
64
|
${l}${F}`}return r=r.replace(/\n+/g,`$&${l}`),`|${N}
|
|
65
|
-
${l}${
|
|
66
|
-
`)||u&&/[[\]{},]/.test(s))return
|
|
67
|
-
`)?
|
|
68
|
-
`))return
|
|
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
|
|
70
|
-
${e.indent}${a}`:a}
|
|
71
|
-
${a}:`):(T=`${T}:`,f&&(T+=
|
|
72
|
-
`:"",
|
|
73
|
-
${
|
|
65
|
+
${l}${_}${r}${p}`}function Dz(t,e,r,n){let{type:i,value:s}=t,{actualString:o,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&s.includes(`
|
|
66
|
+
`)||u&&/[[\]{},]/.test(s))return Oa(s,e);if(!s||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||u||!s.includes(`
|
|
67
|
+
`)?Oa(s,e):kh(t,e,r,n);if(!a&&!u&&i!==Jn.Scalar.PLAIN&&s.includes(`
|
|
68
|
+
`))return kh(t,e,r,n);if(Rh(s)){if(c==="")return e.forceBlockIndent=!0,kh(t,e,r,n);if(a&&c===l)return Oa(s,e)}let d=s.replace(/\n+/g,`$&
|
|
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 Oa(s,e)}return a?d:Ss.foldFlowLines(d,c,Ss.FOLD_FLOW,Nh(e,!1))}function Az(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!==Jn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=Jn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Jn.Scalar.BLOCK_FOLDED:case Jn.Scalar.BLOCK_LITERAL:return i||s?Oa(o.value,e):kh(o,e,r,n);case Jn.Scalar.QUOTE_DOUBLE:return Pl(o.value,e);case Jn.Scalar.QUOTE_SINGLE:return pv(o.value,e);case Jn.Scalar.PLAIN:return Dz(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}IM.stringifyString=Az});var El=R(mv=>{"use strict";var Iz=mh(),_s=qe(),Oz=Nl(),Mz=wl();function xz(t,e){let r=Object.assign({blockQuote:!0,commentString:Oz.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,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 Lz(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(_s.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??typeof n;throw new Error(`Tag not resolved for ${i} value`)}return r}function qz(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],s=(_s.isScalar(t)||_s.isCollection(t))&&t.anchor;s&&Iz.anchorIsValid(s)&&(r.add(s),i.push(`&${s}`));let o=t.tag?t.tag:e.default?null:e.tag;return o&&i.push(n.directives.tagString(o)),i.join(" ")}function $z(t,e,r,n){if(_s.isPair(t))return t.toString(e,r,n);if(_s.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=_s.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i||(i=Lz(e.doc.schema.tags,s));let o=qz(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):_s.isScalar(s)?Mz.stringifyString(s,e,r,n):s.toString(e,r,n);return o?_s.isScalar(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
70
|
+
${e.indent}${a}`:a}mv.createStringifyContext=xz;mv.stringify=$z});var LM=R(xM=>{"use strict";var Ui=qe(),OM=jt(),MM=El(),Cl=Nl();function Bz({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=Ui.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Ui.isCollection(t)||!Ui.isNode(t)&&typeof t=="object"){let M="With simple keys, collection cannot be used as a key value";throw new Error(M)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||Ui.isCollection(t)||(Ui.isScalar(t)?t.type===OM.Scalar.BLOCK_FOLDED||t.type===OM.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!s),indent:a+c});let m=!1,h=!1,T=MM.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&T.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(),T===""?"?":p?`? ${T}`:T}else if(s&&!d||e==null&&p)return T=`? ${T}`,f&&!m?T+=Cl.lineComment(T,r.indent,l(f)):h&&i&&i(),T;m&&(f=null),p?(f&&(T+=Cl.lineComment(T,r.indent,l(f))),T=`? ${T}
|
|
71
|
+
${a}:`):(T=`${T}:`,f&&(T+=Cl.lineComment(T,r.indent,l(f))));let b,_,v;Ui.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,v=e.comment):(b=!1,_=null,v=null,e&&typeof e=="object"&&(e=o.createNode(e))),r.implicitKey=!1,!p&&!f&&Ui.isScalar(e)&&(r.indentAtStart=T.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&Ui.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let N=!1,C=MM.stringify(e,r,()=>N=!0,()=>h=!0),H=" ";if(f||b||_){if(H=b?`
|
|
72
|
+
`:"",_){let M=l(_);H+=`
|
|
73
|
+
${Cl.indentComment(M,r.indent)}`}C===""&&!r.inFlow?H===`
|
|
74
74
|
`&&(H=`
|
|
75
75
|
|
|
76
76
|
`):H+=`
|
|
77
|
-
${r.indent}`}else if(!p&&
|
|
77
|
+
${r.indent}`}else if(!p&&Ui.isCollection(e)){let M=C[0],F=C.indexOf(`
|
|
78
78
|
`),De=F!==-1,lt=r.inFlow??e.flow??e.items.length===0;if(De||!lt){let Ht=!1;if(De&&(M==="&"||M==="!")){let Ne=C.indexOf(" ");M==="&"&&Ne!==-1&&Ne<F&&C[Ne+1]==="!"&&(Ne=C.indexOf(" ",Ne+1)),(Ne===-1||F<Ne)&&(Ht=!0)}Ht||(H=`
|
|
79
79
|
${r.indent}`)}}else(C===""||C[0]===`
|
|
80
|
-
`)&&(H="");return T+=H+C,r.inFlow?N&&n&&n():v&&!N?T+=
|
|
80
|
+
`)&&(H="");return T+=H+C,r.inFlow?N&&n&&n():v&&!N?T+=Cl.lineComment(T,r.indent,l(v)):h&&i&&i(),T}xM.stringifyPair=Bz});var yv=R(gv=>{"use strict";function Fz(t,...e){t==="debug"&&console.log(...e)}function jz(t,e){(t==="debug"||t==="warn")&&(typeof process<"u"&&process.emitWarning?process.emitWarning(e):console.warn(e))}gv.debug=Fz;gv.warn=jz});var Ch=R(Eh=>{"use strict";var Dl=qe(),qM=jt(),Ph="<<",wh={identify:t=>t===Ph||typeof t=="symbol"&&t.description===Ph,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new qM.Scalar(Symbol(Ph)),{addToJSMap:$M}),stringify:()=>Ph},Uz=(t,e)=>(wh.identify(e)||Dl.isScalar(e)&&(!e.type||e.type===qM.Scalar.PLAIN)&&wh.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===wh.tag&&r.default);function $M(t,e,r){if(r=t&&Dl.isAlias(r)?r.resolve(t.doc):r,Dl.isSeq(r))for(let n of r.items)Tv(t,e,n);else if(Array.isArray(r))for(let n of r)Tv(t,e,n);else Tv(t,e,r)}function Tv(t,e,r){let n=t&&Dl.isAlias(r)?r.resolve(t.doc):r;if(!Dl.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}Eh.addMergeToJSMap=$M;Eh.isMergeKey=Uz;Eh.merge=wh});var bv=R(jM=>{"use strict";var Hz=yv(),BM=Ch(),Vz=El(),FM=qe(),vv=vs();function zz(t,e,{key:r,value:n}){if(FM.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(BM.isMergeKey(t,r))BM.addMergeToJSMap(t,e,n);else{let i=vv.toJS(r,"",t);if(e instanceof Map)e.set(i,vv.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let s=Wz(r,i,t),o=vv.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 Wz(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(FM.isNode(t)&&r?.doc){let n=Vz.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)+'..."'),Hz.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)}jM.addPairToJSMap=zz});var ks=R(Sv=>{"use strict";var UM=kl(),Gz=LM(),Kz=bv(),Dh=qe();function Yz(t,e,r){let n=UM.createNode(t,void 0,r),i=UM.createNode(e,void 0,r);return new Ah(n,i)}var Ah=class t{constructor(e,r=null){Object.defineProperty(this,Dh.NODE_TYPE,{value:Dh.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Dh.isNode(r)&&(r=r.clone(e)),Dh.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Kz.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Gz.stringifyPair(this,e,r,n):JSON.stringify(this)}};Sv.Pair=Ah;Sv.createPair=Yz});var _v=R(VM=>{"use strict";var oo=qe(),HM=El(),Ih=Nl();function Xz(t,e,r){return(e.inFlow??t.flow?Qz:Jz)(t,e,r)}function Jz({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],T=null;if(oo.isNode(h))!d&&h.spaceBefore&&f.push(""),Oh(r,f,h.commentBefore,d),h.comment&&(T=h.comment);else if(oo.isPair(h)){let _=oo.isNode(h.key)?h.key:null;_&&(!d&&_.spaceBefore&&f.push(""),Oh(r,f,_.commentBefore,d))}d=!1;let b=HM.stringify(h,u,()=>T=null,()=>d=!0);T&&(b+=Ih.lineComment(b,s,l(T))),d&&T&&(d=!1),f.push(n+b)}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?`
|
|
81
81
|
${c}${h}`:`
|
|
82
82
|
`}}return t?(p+=`
|
|
83
|
-
`+
|
|
83
|
+
`+Ih.indentComment(l(t),c),a&&a()):d&&o&&o(),p}function Qz({items:t},e,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:s,flowCollectionPadding:o,options:{commentString:a}}=e;n+=s;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let m=0;m<t.length;++m){let h=t[m],T=null;if(oo.isNode(h))h.spaceBefore&&d.push(""),Oh(e,d,h.commentBefore,!1),h.comment&&(T=h.comment);else if(oo.isPair(h)){let _=oo.isNode(h.key)?h.key:null;_&&(_.spaceBefore&&d.push(""),Oh(e,d,_.commentBefore,!1),_.comment&&(l=!0));let v=oo.isNode(h.value)?h.value:null;v?(v.comment&&(T=v.comment),v.commentBefore&&(l=!0)):h.value==null&&_?.comment&&(T=_.comment)}T&&(l=!0);let b=HM.stringify(h,c,()=>T=null);m<t.length-1&&(b+=","),T&&(b+=Ih.lineComment(b,n,a(T))),!l&&(d.length>u||b.includes(`
|
|
84
84
|
`))&&(l=!0),d.push(b),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,T)=>h+T.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?`
|
|
85
85
|
${s}${i}${h}`:`
|
|
86
86
|
`;return`${m}
|
|
87
|
-
${i}${p}`}else return`${f}${o}${d.join(" ")}${o}${p}`}function
|
|
88
|
-
`:" ")}return
|
|
87
|
+
${i}${p}`}else return`${f}${o}${d.join(" ")}${o}${p}`}function Oh({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let s=Ih.indentComment(e(n),t);r.push(s.trimStart())}}VM.stringifyCollection=Xz});var Rs=R(Nv=>{"use strict";var Zz=_v(),eW=bv(),tW=bh(),Ns=qe(),Mh=ks(),rW=jt();function Al(t,e){let r=Ns.isScalar(e)?e.value:e;for(let n of t)if(Ns.isPair(n)&&(n.key===e||n.key===r||Ns.isScalar(n.key)&&n.key.value===r))return n}var kv=class extends tW.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ns.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:s}=n,o=new this(e),a=(c,l)=>{if(typeof s=="function")l=s.call(r,c,l);else if(Array.isArray(s)&&!s.includes(c))return;(l!==void 0||i)&&o.items.push(Mh.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,r){let n;Ns.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Mh.Pair(e,e?.value):n=new Mh.Pair(e.key,e.value);let i=Al(this.items,n.key),s=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Ns.isScalar(i.value)&&rW.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(s){let o=this.items.findIndex(a=>s(n,a)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let r=Al(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=Al(this.items,e)?.value;return(!r&&Ns.isScalar(i)?i.value:i)??void 0}has(e){return!!Al(this.items,e)}set(e,r){this.add(new Mh.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let s of this.items)eW.addPairToJSMap(r,i,s);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Ns.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Zz.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};Nv.YAMLMap=kv;Nv.findPair=Al});var Ma=R(WM=>{"use strict";var nW=qe(),zM=Rs(),iW={collection:"map",default:!0,nodeClass:zM.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return nW.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>zM.YAMLMap.from(t,e,r)};WM.map=iW});var Ps=R(GM=>{"use strict";var sW=kl(),oW=_v(),aW=bh(),Lh=qe(),cW=jt(),lW=vs(),Rv=class extends aW.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Lh.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=xh(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=xh(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Lh.isScalar(i)?i.value:i}has(e){let r=xh(e);return typeof r=="number"&&r<this.items.length}set(e,r){let n=xh(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[n];Lh.isScalar(i)&&cW.isScalarValue(r)?i.value=r:this.items[n]=r}toJSON(e,r){let n=[];r?.onCreate&&r.onCreate(n);let i=0;for(let s of this.items)n.push(lW.toJS(s,String(i++),r));return n}toString(e,r,n){return e?oW.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:r}):JSON.stringify(this)}static from(e,r,n){let{replacer:i}=n,s=new this(e);if(r&&Symbol.iterator in Object(r)){let o=0;for(let a of r){if(typeof i=="function"){let c=r instanceof Set?a:String(o++);a=i.call(r,c,a)}s.items.push(sW.createNode(a,void 0,n))}}return s}};function xh(t){let e=Lh.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}GM.YAMLSeq=Rv});var xa=R(YM=>{"use strict";var uW=qe(),KM=Ps(),dW={collection:"seq",default:!0,nodeClass:KM.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return uW.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>KM.YAMLSeq.from(t,e,r)};YM.seq=dW});var Il=R(XM=>{"use strict";var fW=wl(),pW={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),fW.stringifyString(t,e,r,n)}};XM.string=pW});var qh=R(ZM=>{"use strict";var JM=jt(),QM={identify:t=>t==null,createNode:()=>new JM.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new JM.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&QM.test.test(t)?t:e.options.nullStr};ZM.nullTag=QM});var Pv=R(tx=>{"use strict";var hW=jt(),ex={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new hW.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&ex.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};tx.boolTag=ex});var La=R(rx=>{"use strict";function mW({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let s=JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^\d/.test(s)){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let a=e-(s.length-o-1);for(;a-- >0;)s+="0"}return s}rx.stringifyNumber=mW});var Ev=R($h=>{"use strict";var gW=jt(),wv=La(),yW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:wv.stringifyNumber},TW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():wv.stringifyNumber(t)}},vW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new gW.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:wv.stringifyNumber};$h.float=vW;$h.floatExp=TW;$h.floatNaN=yW});var Dv=R(Fh=>{"use strict";var nx=La(),Bh=t=>typeof t=="bigint"||Number.isInteger(t),Cv=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function ix(t,e,r){let{value:n}=t;return Bh(n)&&n>=0?r+n.toString(e):nx.stringifyNumber(t)}var bW={identify:t=>Bh(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>Cv(t,2,8,r),stringify:t=>ix(t,8,"0o")},SW={identify:Bh,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>Cv(t,0,10,r),stringify:nx.stringifyNumber},_W={identify:t=>Bh(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>Cv(t,2,16,r),stringify:t=>ix(t,16,"0x")};Fh.int=SW;Fh.intHex=_W;Fh.intOct=bW});var ox=R(sx=>{"use strict";var kW=Ma(),NW=qh(),RW=xa(),PW=Il(),wW=Pv(),Av=Ev(),Iv=Dv(),EW=[kW.map,RW.seq,PW.string,NW.nullTag,wW.boolTag,Iv.intOct,Iv.int,Iv.intHex,Av.floatNaN,Av.floatExp,Av.float];sx.schema=EW});var lx=R(cx=>{"use strict";var CW=jt(),DW=Ma(),AW=xa();function ax(t){return typeof t=="bigint"||Number.isInteger(t)}var jh=({value:t})=>JSON.stringify(t),IW=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:jh},{identify:t=>t==null,createNode:()=>new CW.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:jh},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:jh},{identify:ax,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>ax(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:jh}],OW={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},MW=[DW.map,AW.seq].concat(IW,OW);cx.schema=MW});var Mv=R(ux=>{"use strict";var Ov=jt(),xW=wl(),LW={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Buffer=="function")return Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i<r.length;++i)n[i]=r.charCodeAt(i);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:r},n,i,s){let o=r,a;if(typeof Buffer=="function")a=o instanceof Buffer?o.toString("base64"):Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e||(e=Ov.Scalar.BLOCK_LITERAL),e!==Ov.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),l=Math.ceil(a.length/c),u=new Array(l);for(let d=0,f=0;d<l;++d,f+=c)u[d]=a.substr(f,c);a=u.join(e===Ov.Scalar.BLOCK_LITERAL?`
|
|
88
|
+
`:" ")}return xW.stringifyString({comment:t,type:e,value:a},n,i,s)}};ux.binary=LW});var Vh=R(Hh=>{"use strict";var Uh=qe(),xv=ks(),qW=jt(),$W=Ps();function dx(t,e){if(Uh.isSeq(t))for(let r=0;r<t.items.length;++r){let n=t.items[r];if(!Uh.isPair(n)){if(Uh.isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new xv.Pair(new qW.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
|
|
89
89
|
${i.key.commentBefore}`:n.commentBefore),n.comment){let s=i.value??i.key;s.comment=s.comment?`${n.comment}
|
|
90
|
-
${s.comment}`:n.comment}n=i}t.items[r]=xh.isPair(n)?n:new Dv.Pair(n)}}else e("Expected a sequence for this tag");return t}function lx(t,e,r){let{replacer:n}=r,i=new LW.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let s=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(s++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)a=l[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;i.items.push(Dv.createPair(a,c,r))}return i}var qW={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:cx,createNode:lx};Lh.createPairs=lx;Lh.pairs=qW;Lh.resolvePairs=cx});var Ov=R(Iv=>{"use strict";var ux=qe(),Av=ys(),Dl=ks(),$W=Ns(),dx=qh(),no=class t extends $W.YAMLSeq{constructor(){super(),this.add=Dl.YAMLMap.prototype.add.bind(this),this.delete=Dl.YAMLMap.prototype.delete.bind(this),this.get=Dl.YAMLMap.prototype.get.bind(this),this.has=Dl.YAMLMap.prototype.has.bind(this),this.set=Dl.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let s,o;if(ux.isPair(i)?(s=Av.toJS(i.key,"",r),o=Av.toJS(i.value,s,r)):s=Av.toJS(i,"",r),n.has(s))throw new Error("Ordered maps must not include duplicate keys");n.set(s,o)}return n}static from(e,r,n){let i=dx.createPairs(e,r,n),s=new this;return s.items=i.items,s}};no.tag="tag:yaml.org,2002:omap";var BW={collection:"seq",identify:t=>t instanceof Map,nodeClass:no,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=dx.resolvePairs(t,e),n=[];for(let{key:i}of r.items)ux.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new no,r)},createNode:(t,e,r)=>no.from(t,e,r)};Iv.YAMLOMap=no;Iv.omap=BW});var gx=R(Mv=>{"use strict";var fx=jt();function px({value:t,source:e},r){return e&&(t?hx:mx).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var hx={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new fx.Scalar(!0),stringify:px},mx={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new fx.Scalar(!1),stringify:px};Mv.falseTag=mx;Mv.trueTag=hx});var yx=R($h=>{"use strict";var FW=jt(),xv=Oa(),jW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:xv.stringifyNumber},UW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():xv.stringifyNumber(t)}},HW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new FW.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:xv.stringifyNumber};$h.float=HW;$h.floatExp=UW;$h.floatNaN=jW});var vx=R(Il=>{"use strict";var Tx=Oa(),Al=t=>typeof t=="bigint"||Number.isInteger(t);function Bh(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return i==="-"?BigInt(-1)*o:o}let s=parseInt(t,r);return i==="-"?-1*s:s}function Lv(t,e,r){let{value:n}=t;if(Al(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return Tx.stringifyNumber(t)}var VW={identify:Al,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Bh(t,2,2,r),stringify:t=>Lv(t,2,"0b")},zW={identify:Al,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Bh(t,1,8,r),stringify:t=>Lv(t,8,"0")},WW={identify:Al,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Bh(t,0,10,r),stringify:Tx.stringifyNumber},GW={identify:Al,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Bh(t,2,16,r),stringify:t=>Lv(t,16,"0x")};Il.int=WW;Il.intBin=VW;Il.intHex=GW;Il.intOct=zW});var $v=R(qv=>{"use strict";var Uh=qe(),Fh=Ss(),jh=ks(),io=class t extends jh.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Uh.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Fh.Pair(e.key,null):r=new Fh.Pair(e,null),jh.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=jh.findPair(this.items,e);return!r&&Uh.isPair(n)?Uh.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=jh.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Fh.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,s=new this(e);if(r&&Symbol.iterator in Object(r))for(let o of r)typeof i=="function"&&(o=i.call(r,o,o)),s.items.push(Fh.createPair(o,null,n));return s}};io.tag="tag:yaml.org,2002:set";var KW={collection:"map",identify:t=>t instanceof Set,nodeClass:io,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>io.from(t,e,r),resolve(t,e){if(Uh.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new io,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};qv.YAMLSet=io;qv.set=KW});var Fv=R(Hh=>{"use strict";var YW=Oa();function Bv(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=o=>e?BigInt(o):Number(o),s=n.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return r==="-"?i(-1)*s:s}function bx(t){let{value:e}=t,r=o=>o;if(typeof e=="bigint")r=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return YW.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),s=[e%i];return e<60?s.unshift(0):(e=(e-s[0])/i,s.unshift(e%i),e>=60&&(e=(e-s[0])/i,s.unshift(e))),n+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var XW={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>Bv(t,r),stringify:bx},JW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Bv(t,!1),stringify:bx},Sx={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Sx.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,s,o,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,s||0,o||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=Bv(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t.toISOString().replace(/(T00:00:00)?\.000Z$/,"")};Hh.floatTime=JW;Hh.intTime=XW;Hh.timestamp=Sx});var Nx=R(kx=>{"use strict";var QW=Aa(),ZW=Dh(),e2=Ia(),t2=Cl(),r2=Cv(),_x=gx(),jv=yx(),Vh=vx(),n2=_h(),i2=Ov(),s2=qh(),o2=$v(),Uv=Fv(),a2=[QW.map,e2.seq,t2.string,ZW.nullTag,_x.trueTag,_x.falseTag,Vh.intBin,Vh.intOct,Vh.int,Vh.intHex,jv.floatNaN,jv.floatExp,jv.float,r2.binary,n2.merge,i2.omap,s2.pairs,o2.set,Uv.intTime,Uv.floatTime,Uv.timestamp];kx.schema=a2});var Mx=R(zv=>{"use strict";var Ex=Aa(),c2=Dh(),Cx=Ia(),l2=Cl(),u2=Sv(),Hv=kv(),Vv=Rv(),d2=nx(),f2=ox(),Dx=Cv(),Ol=_h(),Ax=Ov(),Ix=qh(),Rx=Nx(),Ox=$v(),zh=Fv(),Px=new Map([["core",d2.schema],["failsafe",[Ex.map,Cx.seq,l2.string]],["json",f2.schema],["yaml11",Rx.schema],["yaml-1.1",Rx.schema]]),wx={binary:Dx.binary,bool:u2.boolTag,float:Hv.float,floatExp:Hv.floatExp,floatNaN:Hv.floatNaN,floatTime:zh.floatTime,int:Vv.int,intHex:Vv.intHex,intOct:Vv.intOct,intTime:zh.intTime,map:Ex.map,merge:Ol.merge,null:c2.nullTag,omap:Ax.omap,pairs:Ix.pairs,seq:Cx.seq,set:Ox.set,timestamp:zh.timestamp},p2={"tag:yaml.org,2002:binary":Dx.binary,"tag:yaml.org,2002:merge":Ol.merge,"tag:yaml.org,2002:omap":Ax.omap,"tag:yaml.org,2002:pairs":Ix.pairs,"tag:yaml.org,2002:set":Ox.set,"tag:yaml.org,2002:timestamp":zh.timestamp};function h2(t,e,r){let n=Px.get(e);if(n&&!t)return r&&!n.includes(Ol.merge)?n.concat(Ol.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let s=Array.from(Px.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(let s of t)i=i.concat(s);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Ol.merge)),i.reduce((s,o)=>{let a=typeof o=="string"?wx[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(wx).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return s.includes(a)||s.push(a),s},[])}zv.coreKnownTags=p2;zv.getTags=h2});var Kv=R(xx=>{"use strict";var Wv=qe(),m2=Aa(),g2=Ia(),y2=Cl(),Wh=Mx(),T2=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Gv=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?Wh.getTags(e,"compat"):e?Wh.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?Wh.coreKnownTags:{},this.tags=Wh.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,Wv.MAP,{value:m2.map}),Object.defineProperty(this,Wv.SCALAR,{value:y2.string}),Object.defineProperty(this,Wv.SEQ,{value:g2.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?T2:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};xx.Schema=Gv});var qx=R(Lx=>{"use strict";var v2=qe(),Yv=Rl(),Ml=Sl();function b2(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=Yv.createStringifyContext(t,e),{commentString:s}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=s(t.commentBefore);r.unshift(Ml.indentComment(c,""))}let o=!1,a=null;if(t.contents){if(v2.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=s(t.contents.commentBefore);r.push(Ml.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>o=!0,l=Yv.stringify(t.contents,i,()=>a=null,c);a&&(l+=Ml.lineComment(l,"",s(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(Yv.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
|
|
91
|
-
`)?(r.push("..."),r.push(
|
|
90
|
+
${s.comment}`:n.comment}n=i}t.items[r]=Uh.isPair(n)?n:new xv.Pair(n)}}else e("Expected a sequence for this tag");return t}function fx(t,e,r){let{replacer:n}=r,i=new $W.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let s=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(s++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)a=l[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;i.items.push(xv.createPair(a,c,r))}return i}var BW={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:dx,createNode:fx};Hh.createPairs=fx;Hh.pairs=BW;Hh.resolvePairs=dx});var $v=R(qv=>{"use strict";var px=qe(),Lv=vs(),Ol=Rs(),FW=Ps(),hx=Vh(),ao=class t extends FW.YAMLSeq{constructor(){super(),this.add=Ol.YAMLMap.prototype.add.bind(this),this.delete=Ol.YAMLMap.prototype.delete.bind(this),this.get=Ol.YAMLMap.prototype.get.bind(this),this.has=Ol.YAMLMap.prototype.has.bind(this),this.set=Ol.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let s,o;if(px.isPair(i)?(s=Lv.toJS(i.key,"",r),o=Lv.toJS(i.value,s,r)):s=Lv.toJS(i,"",r),n.has(s))throw new Error("Ordered maps must not include duplicate keys");n.set(s,o)}return n}static from(e,r,n){let i=hx.createPairs(e,r,n),s=new this;return s.items=i.items,s}};ao.tag="tag:yaml.org,2002:omap";var jW={collection:"seq",identify:t=>t instanceof Map,nodeClass:ao,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=hx.resolvePairs(t,e),n=[];for(let{key:i}of r.items)px.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ao,r)},createNode:(t,e,r)=>ao.from(t,e,r)};qv.YAMLOMap=ao;qv.omap=jW});var vx=R(Bv=>{"use strict";var mx=jt();function gx({value:t,source:e},r){return e&&(t?yx:Tx).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var yx={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new mx.Scalar(!0),stringify:gx},Tx={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new mx.Scalar(!1),stringify:gx};Bv.falseTag=Tx;Bv.trueTag=yx});var bx=R(zh=>{"use strict";var UW=jt(),Fv=La(),HW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Fv.stringifyNumber},VW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Fv.stringifyNumber(t)}},zW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new UW.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:Fv.stringifyNumber};zh.float=zW;zh.floatExp=VW;zh.floatNaN=HW});var _x=R(xl=>{"use strict";var Sx=La(),Ml=t=>typeof t=="bigint"||Number.isInteger(t);function Wh(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return i==="-"?BigInt(-1)*o:o}let s=parseInt(t,r);return i==="-"?-1*s:s}function jv(t,e,r){let{value:n}=t;if(Ml(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return Sx.stringifyNumber(t)}var WW={identify:Ml,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Wh(t,2,2,r),stringify:t=>jv(t,2,"0b")},GW={identify:Ml,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Wh(t,1,8,r),stringify:t=>jv(t,8,"0")},KW={identify:Ml,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Wh(t,0,10,r),stringify:Sx.stringifyNumber},YW={identify:Ml,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Wh(t,2,16,r),stringify:t=>jv(t,16,"0x")};xl.int=KW;xl.intBin=WW;xl.intHex=YW;xl.intOct=GW});var Hv=R(Uv=>{"use strict";var Yh=qe(),Gh=ks(),Kh=Rs(),co=class t extends Kh.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Yh.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Gh.Pair(e.key,null):r=new Gh.Pair(e,null),Kh.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Kh.findPair(this.items,e);return!r&&Yh.isPair(n)?Yh.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=Kh.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Gh.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,s=new this(e);if(r&&Symbol.iterator in Object(r))for(let o of r)typeof i=="function"&&(o=i.call(r,o,o)),s.items.push(Gh.createPair(o,null,n));return s}};co.tag="tag:yaml.org,2002:set";var XW={collection:"map",identify:t=>t instanceof Set,nodeClass:co,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>co.from(t,e,r),resolve(t,e){if(Yh.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new co,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Uv.YAMLSet=co;Uv.set=XW});var zv=R(Xh=>{"use strict";var JW=La();function Vv(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=o=>e?BigInt(o):Number(o),s=n.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return r==="-"?i(-1)*s:s}function kx(t){let{value:e}=t,r=o=>o;if(typeof e=="bigint")r=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return JW.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),s=[e%i];return e<60?s.unshift(0):(e=(e-s[0])/i,s.unshift(e%i),e>=60&&(e=(e-s[0])/i,s.unshift(e))),n+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var QW={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>Vv(t,r),stringify:kx},ZW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Vv(t,!1),stringify:kx},Nx={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Nx.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,s,o,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,s||0,o||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=Vv(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t.toISOString().replace(/(T00:00:00)?\.000Z$/,"")};Xh.floatTime=ZW;Xh.intTime=QW;Xh.timestamp=Nx});var wx=R(Px=>{"use strict";var e2=Ma(),t2=qh(),r2=xa(),n2=Il(),i2=Mv(),Rx=vx(),Wv=bx(),Jh=_x(),s2=Ch(),o2=$v(),a2=Vh(),c2=Hv(),Gv=zv(),l2=[e2.map,r2.seq,n2.string,t2.nullTag,Rx.trueTag,Rx.falseTag,Jh.intBin,Jh.intOct,Jh.int,Jh.intHex,Wv.floatNaN,Wv.floatExp,Wv.float,i2.binary,s2.merge,o2.omap,a2.pairs,c2.set,Gv.intTime,Gv.floatTime,Gv.timestamp];Px.schema=l2});var qx=R(Xv=>{"use strict";var Ax=Ma(),u2=qh(),Ix=xa(),d2=Il(),f2=Pv(),Kv=Ev(),Yv=Dv(),p2=ox(),h2=lx(),Ox=Mv(),Ll=Ch(),Mx=$v(),xx=Vh(),Ex=wx(),Lx=Hv(),Qh=zv(),Cx=new Map([["core",p2.schema],["failsafe",[Ax.map,Ix.seq,d2.string]],["json",h2.schema],["yaml11",Ex.schema],["yaml-1.1",Ex.schema]]),Dx={binary:Ox.binary,bool:f2.boolTag,float:Kv.float,floatExp:Kv.floatExp,floatNaN:Kv.floatNaN,floatTime:Qh.floatTime,int:Yv.int,intHex:Yv.intHex,intOct:Yv.intOct,intTime:Qh.intTime,map:Ax.map,merge:Ll.merge,null:u2.nullTag,omap:Mx.omap,pairs:xx.pairs,seq:Ix.seq,set:Lx.set,timestamp:Qh.timestamp},m2={"tag:yaml.org,2002:binary":Ox.binary,"tag:yaml.org,2002:merge":Ll.merge,"tag:yaml.org,2002:omap":Mx.omap,"tag:yaml.org,2002:pairs":xx.pairs,"tag:yaml.org,2002:set":Lx.set,"tag:yaml.org,2002:timestamp":Qh.timestamp};function g2(t,e,r){let n=Cx.get(e);if(n&&!t)return r&&!n.includes(Ll.merge)?n.concat(Ll.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let s=Array.from(Cx.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(let s of t)i=i.concat(s);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Ll.merge)),i.reduce((s,o)=>{let a=typeof o=="string"?Dx[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(Dx).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return s.includes(a)||s.push(a),s},[])}Xv.coreKnownTags=m2;Xv.getTags=g2});var Zv=R($x=>{"use strict";var Jv=qe(),y2=Ma(),T2=xa(),v2=Il(),Zh=qx(),b2=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Qv=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?Zh.getTags(e,"compat"):e?Zh.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?Zh.coreKnownTags:{},this.tags=Zh.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,Jv.MAP,{value:y2.map}),Object.defineProperty(this,Jv.SCALAR,{value:v2.string}),Object.defineProperty(this,Jv.SEQ,{value:T2.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?b2:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};$x.Schema=Qv});var Fx=R(Bx=>{"use strict";var S2=qe(),eb=El(),ql=Nl();function _2(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=eb.createStringifyContext(t,e),{commentString:s}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=s(t.commentBefore);r.unshift(ql.indentComment(c,""))}let o=!1,a=null;if(t.contents){if(S2.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=s(t.contents.commentBefore);r.push(ql.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>o=!0,l=eb.stringify(t.contents,i,()=>a=null,c);a&&(l+=ql.lineComment(l,"",s(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(eb.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
|
|
91
|
+
`)?(r.push("..."),r.push(ql.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||a)&&r[r.length-1]!==""&&r.push(""),r.push(ql.indentComment(s(c),"")))}return r.join(`
|
|
92
92
|
`)+`
|
|
93
|
-
`}
|
|
93
|
+
`}Bx.stringifyDocument=_2});var $l=R(jx=>{"use strict";var k2=_l(),qa=bh(),Rn=qe(),N2=ks(),R2=vs(),P2=Zv(),w2=Fx(),tb=mh(),E2=sv(),C2=kl(),rb=iv(),nb=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Rn.NODE_TYPE,{value:Rn.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=s;let{version:o}=s;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new rb.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[Rn.NODE_TYPE]:{value:Rn.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Rn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){$a(this.contents)&&this.contents.add(e)}addIn(e,r){$a(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=tb.anchorNames(this);e.anchor=!r||n.has(r)?tb.findNewAnchor(r||"a",n):r}return new k2.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let T=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(T).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=tb.createNodeAnchors(this,o||"a"),m={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=C2.createNode(e,u,m);return a&&Rn.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),s=this.createNode(r,null,n);return new N2.Pair(i,s)}delete(e){return $a(this.contents)?this.contents.delete(e):!1}deleteIn(e){return qa.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):$a(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return Rn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return qa.isEmptyPath(e)?!r&&Rn.isScalar(this.contents)?this.contents.value:this.contents:Rn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Rn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return qa.isEmptyPath(e)?this.contents!==void 0:Rn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=qa.collectionFromPath(this.schema,[e],r):$a(this.contents)&&this.contents.set(e,r)}setIn(e,r){qa.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=qa.collectionFromPath(this.schema,Array.from(e),r):$a(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new rb.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new rb.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new P2.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:s,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=R2.toJS(this.contents,r??"",a);if(typeof s=="function")for(let{count:l,res:u}of a.anchors.values())s(u,l);return typeof o=="function"?E2.applyReviver(o,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return w2.stringifyDocument(this,e)}};function $a(t){if(Rn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}jx.Document=nb});var jl=R(Fl=>{"use strict";var Bl=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},ib=class extends Bl{constructor(e,r,n){super("YAMLParseError",e,r,n)}},sb=class extends Bl{constructor(e,r,n){super("YAMLWarning",e,r,n)}},D2=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let s=i-1,o=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(s>=60&&o.length>80){let a=Math.min(s-39,o.length-79);o="\u2026"+o.substring(a),s-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(o.substring(0,s))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
94
94
|
`),o=a+o}if(/[^ ]/.test(o)){let a=1,c=r.linePos[1];c&&c.line===n&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-s)));let l=" ".repeat(s)+"^".repeat(a);r.message+=`:
|
|
95
95
|
|
|
96
96
|
${o}
|
|
97
97
|
${l}
|
|
98
|
-
`}};
|
|
99
|
-
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(
|
|
100
|
-
`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||
|
|
101
|
-
`+v.comment:
|
|
102
|
-
`+H.comment:l.comment=H.comment),d=H.end;continue}!o&&r.options.strict&&
|
|
103
|
-
`+M:F.comment=M,H.comment=H.comment.substring(M.length+1)}}if(!o&&!N&&!H.found){let M=C?t(r,C,H,i):e(r,H.end,N,null,H,i);l.items.push(M),d=M.range[2],
|
|
104
|
-
`+De.comment:F.comment=De.comment);let Ht=new
|
|
105
|
-
`+T.comment:l.comment=T.comment),l.range=[n.offset,h,T.offset]}else l.range=[n.offset,h,h];return l}
|
|
98
|
+
`}};Fl.YAMLError=Bl;Fl.YAMLParseError=ib;Fl.YAMLWarning=sb;Fl.prettifyError=D2});var Ul=R(Ux=>{"use strict";function A2(t,{flow:e,indicator:r,next:n,offset:i,onError:s,parentIndent:o,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,T=null,b=null,_=null,v=null,N=null,C=null;for(let F of t)switch(m&&(F.type!=="space"&&F.type!=="newline"&&F.type!=="comma"&&s(F.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&F.type!=="comment"&&F.type!=="newline"&&s(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),F.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&F.source.includes(" ")&&(h=F),u=!0;break;case"comment":{u||s(F,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let De=F.source.substring(1)||" ";d?d+=f+De:d=De,f="",l=!1;break}case"newline":l?d?d+=F.source:c=!0:f+=F.source,l=!0,p=!0,(T||b)&&(_=F),u=!0;break;case"anchor":T&&s(F,"MULTIPLE_ANCHORS","A node can have at most one anchor"),F.source.endsWith(":")&&s(F.offset+F.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),T=F,C===null&&(C=F.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&s(F,"MULTIPLE_TAGS","A node can have at most one tag"),b=F,C===null&&(C=F.offset),l=!1,u=!1,m=!0;break}case r:(T||b)&&s(F,"BAD_PROP_ORDER",`Anchors and tags must be after the ${F.source} indicator`),N&&s(F,"UNEXPECTED_TOKEN",`Unexpected ${F.source} in ${e??"collection"}`),N=F,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){v&&s(F,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),v=F,l=!1,u=!1;break}default:s(F,"UNEXPECTED_TOKEN",`Unexpected ${F.type} token`),l=!1,u=!1}let H=t[t.length-1],M=H?H.offset+H.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&s(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=o||n?.type==="block-map"||n?.type==="block-seq")&&s(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:v,found:N,spaceBefore:c,comment:d,hasNewline:p,anchor:T,tag:b,newlineAfterProp:_,end:M,start:C??M}}Ux.resolveProps=A2});var em=R(Hx=>{"use strict";function ob(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
99
|
+
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(ob(e.key)||ob(e.value))return!0}return!1;default:return!0}}Hx.containsNewline=ob});var ab=R(Vx=>{"use strict";var I2=em();function O2(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&I2.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Vx.flowIndentCheck=O2});var cb=R(Wx=>{"use strict";var zx=qe();function M2(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(s,o)=>s===o||zx.isScalar(s)&&zx.isScalar(o)&&s.value===o.value;return e.some(s=>i(s.key,r))}Wx.mapIncludes=M2});var Qx=R(Jx=>{"use strict";var Gx=ks(),x2=Rs(),Kx=Ul(),L2=em(),Yx=ab(),q2=cb(),Xx="All mapping items must start at the same column";function $2({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=s?.nodeClass??x2.YAMLMap,a=new o(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=Kx.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),T=!h.found;if(T){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",Xx)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=`
|
|
100
|
+
`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||L2.containsNewline(f))&&i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(c,"BAD_INDENT",Xx);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&Yx.flowIndentCheck(n.indent,f,i),r.atKey=!1,q2.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let v=Kx.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=v.end,v.found){T&&(m?.type==="block-map"&&!v.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start<v.found.offset-1024&&i(_.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let N=m?t(r,m,v,i):e(r,c,p,null,v,i);r.schema.compat&&Yx.flowIndentCheck(n.indent,m,i),c=N.range[2];let C=new Gx.Pair(_,N);r.options.keepSourceTokens&&(C.srcToken=u),a.items.push(C)}else{T&&i(_.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),v.comment&&(_.comment?_.comment+=`
|
|
101
|
+
`+v.comment:_.comment=v.comment);let N=new Gx.Pair(_);r.options.keepSourceTokens&&(N.srcToken=u),a.items.push(N)}}return l&&l<c&&i(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[n.offset,c,l??c],a}Jx.resolveBlockMap=$2});var eL=R(Zx=>{"use strict";var B2=Ps(),F2=Ul(),j2=ab();function U2({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=s?.nodeClass??B2.YAMLSeq,a=new o(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=F2.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d&&d.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&j2.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}Zx.resolveBlockSeq=U2});var Ba=R(tL=>{"use strict";function H2(t,e,r,n){let i="";if(t){let s=!1,o="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":s=!0;break;case"comment":{r&&!s&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=o+u:i=u,o="";break}case"newline":i&&(o+=c),s=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}tL.resolveEnd=H2});var sL=R(iL=>{"use strict";var V2=qe(),z2=ks(),rL=Rs(),W2=Ps(),G2=Ba(),nL=Ul(),K2=em(),Y2=cb(),lb="Block collections are not allowed within flow collections",ub=t=>t&&(t.type==="block-map"||t.type==="block-seq");function X2({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=n.start.source==="{",a=o?"flow map":"flow sequence",c=s?.nodeClass??(o?rL.YAMLMap:W2.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let T=0;T<n.items.length;++T){let b=n.items[T],{start:_,key:v,sep:N,value:C}=b,H=nL.resolveProps(_,{flow:a,indicator:"explicit-key-ind",next:v??N?.[0],offset:d,onError:i,parentIndent:n.indent,startOnNewline:!1});if(!H.found){if(!H.anchor&&!H.tag&&!N&&!C){T===0&&H.comma?i(H.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):T<n.items.length-1&&i(H.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),H.comment&&(l.comment?l.comment+=`
|
|
102
|
+
`+H.comment:l.comment=H.comment),d=H.end;continue}!o&&r.options.strict&&K2.containsNewline(v)&&i(v,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(T===0)H.comma&&i(H.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(H.comma||i(H.start,"MISSING_CHAR",`Missing , between ${a} items`),H.comment){let M="";e:for(let F of _)switch(F.type){case"comma":case"space":break;case"comment":M=F.source.substring(1);break e;default:break e}if(M){let F=l.items[l.items.length-1];V2.isPair(F)&&(F=F.value??F.key),F.comment?F.comment+=`
|
|
103
|
+
`+M:F.comment=M,H.comment=H.comment.substring(M.length+1)}}if(!o&&!N&&!H.found){let M=C?t(r,C,H,i):e(r,H.end,N,null,H,i);l.items.push(M),d=M.range[2],ub(C)&&i(M.range,"BLOCK_IN_FLOW",lb)}else{r.atKey=!0;let M=H.end,F=v?t(r,v,H,i):e(r,M,_,null,H,i);ub(v)&&i(F.range,"BLOCK_IN_FLOW",lb),r.atKey=!1;let De=nL.resolveProps(N??[],{flow:a,indicator:"map-value-ind",next:C,offset:F.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if(De.found){if(!o&&!H.found&&r.options.strict){if(N)for(let Ne of N){if(Ne===De.found)break;if(Ne.type==="newline"){i(Ne,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}H.start<De.found.offset-1024&&i(De.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else C&&("source"in C&&C.source&&C.source[0]===":"?i(C,"MISSING_CHAR",`Missing space after : in ${a}`):i(De.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let lt=C?t(r,C,De,i):De.found?e(r,De.end,N,null,De,i):null;lt?ub(C)&&i(lt.range,"BLOCK_IN_FLOW",lb):De.comment&&(F.comment?F.comment+=`
|
|
104
|
+
`+De.comment:F.comment=De.comment);let Ht=new z2.Pair(F,lt);if(r.options.keepSourceTokens&&(Ht.srcToken=b),o){let Ne=l;Y2.mapIncludes(r,Ne.items,F)&&i(M,"DUPLICATE_KEY","Map keys must be unique"),Ne.items.push(Ht)}else{let Ne=new rL.YAMLMap(r.schema);Ne.flow=!0,Ne.items.push(Ht);let an=(lt??F).range;Ne.range=[F.range[0],an[1],an[2]],l.items.push(Ne)}d=lt?lt.range[2]:De.end}}let f=o?"}":"]",[p,...m]=n.end,h=d;if(p&&p.source===f)h=p.offset+p.source.length;else{let T=a[0].toUpperCase()+a.substring(1),b=u?`${T} must end with a ${f}`:`${T} in block collection must be sufficiently indented and end with a ${f}`;i(d,u?"MISSING_CHAR":"BAD_INDENT",b),p&&p.source.length!==1&&m.unshift(p)}if(m.length>0){let T=G2.resolveEnd(m,h,r.options.strict,i);T.comment&&(l.comment?l.comment+=`
|
|
105
|
+
`+T.comment:l.comment=T.comment),l.range=[n.offset,h,T.offset]}else l.range=[n.offset,h,h];return l}iL.resolveFlowCollection=X2});var aL=R(oL=>{"use strict";var J2=qe(),Q2=jt(),Z2=Rs(),eG=Ps(),tG=Qx(),rG=eL(),nG=sL();function db(t,e,r,n,i,s){let o=r.type==="block-map"?tG.resolveBlockMap(t,e,r,n,s):r.type==="block-seq"?rG.resolveBlockSeq(t,e,r,n,s):nG.resolveFlowCollection(t,e,r,n,s),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function iG(t,e,r,n,i){let s=n.tag,o=s?e.directives.tagName(s.source,f=>i(s,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&s?f.offset>s.offset?f:s:f??s;m&&(!p||p.offset<m.offset)&&i(m,"MISSING_CHAR","Missing newline after block sequence props")}let a=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!s||!o||o==="!"||o===Z2.YAMLMap.tagName&&a==="map"||o===eG.YAMLSeq.tagName&&a==="seq")return db(t,e,r,i,o);let c=e.schema.tags.find(f=>f.tag===o&&f.collection===a);if(!c){let f=e.schema.knownTags[o];if(f&&f.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?.collection?i(s,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),db(t,e,r,i,o)}let l=db(t,e,r,i,o,c),u=c.resolve?.(l,f=>i(s,"TAG_RESOLVE_FAILED",f),e.options)??l,d=J2.isNode(u)?u:new Q2.Scalar(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}oL.composeCollection=iG});var pb=R(cL=>{"use strict";var fb=jt();function sG(t,e,r){let n=e.offset,i=oG(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let s=i.mode===">"?fb.Scalar.BLOCK_FOLDED:fb.Scalar.BLOCK_LITERAL,o=e.source?aG(e.source):[],a=o.length;for(let h=o.length-1;h>=0;--h){let T=o[h][1];if(T===""||T==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&o.length>0?`
|
|
106
106
|
`.repeat(Math.max(1,o.length-1)):"",T=n+i.length;return e.source&&(T+=e.source.length),{value:h,type:s,comment:i.comment,range:[n,T,T]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let h=0;h<a;++h){let[T,b]=o[h];if(b===""||b==="\r")i.indent===0&&T.length>c&&(c=T.length);else{T.length<c&&r(l+T.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(c=T.length),u=h,c===0&&!t.atRoot&&r(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=T.length+b.length+1}for(let h=o.length-1;h>=a;--h)o[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;h<u;++h)d+=o[h][0].slice(c)+`
|
|
107
|
-
`;for(let h=u;h<a;++h){let[T,b]=o[h];l+=T.length+b.length+1;let
|
|
107
|
+
`;for(let h=u;h<a;++h){let[T,b]=o[h];l+=T.length+b.length+1;let _=b[b.length-1]==="\r";if(_&&(b=b.slice(0,-1)),b&&T.length<c){let N=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;r(l-b.length-(_?2:1),"BAD_INDENT",N),T=""}s===fb.Scalar.BLOCK_LITERAL?(d+=f+T.slice(c)+b,f=`
|
|
108
108
|
`):T.length>c||b[0]===" "?(f===" "?f=`
|
|
109
109
|
`:!p&&f===`
|
|
110
110
|
`&&(f=`
|
|
@@ -117,89 +117,69 @@ ${l}
|
|
|
117
117
|
`+o[h][0].slice(c);d[d.length-1]!==`
|
|
118
118
|
`&&(d+=`
|
|
119
119
|
`);break;default:d+=`
|
|
120
|
-
`}let m=n+i.length+e.source.length;return{value:d,type:s,comment:i.comment,range:[n,m,m]}}function
|
|
120
|
+
`}let m=n+i.length+e.source.length;return{value:d,type:s,comment:i.comment,range:[n,m,m]}}function oG({offset:t,props:e},r,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],s=i[0],o=0,a="",c=-1;for(let f=1;f<i.length;++f){let p=i[f];if(!a&&(p==="-"||p==="+"))a=p;else{let m=Number(p);!o&&m?o=m:c===-1&&(c=t+f)}}c!==-1&&n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,u="",d=i.length;for(let f=1;f<e.length;++f){let p=e[f];switch(p.type){case"space":l=!0;case"newline":d+=p.source.length;break;case"comment":r&&!l&&n(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=p.source.length,u=p.source.substring(1);break;case"error":n(p,"UNEXPECTED_TOKEN",p.message),d+=p.source.length;break;default:{let m=`Unexpected token in block scalar header: ${p.type}`;n(p,"UNEXPECTED_TOKEN",m);let h=p.source;h&&typeof h=="string"&&(d+=h.length)}}}return{mode:s,indent:o,chomp:a,comment:u,length:d}}function aG(t){let e=t.split(/\n( *)/),r=e[0],n=r.match(/^( *)/),s=[n?.[1]?[n[1],r.slice(n[1].length)]:["",r]];for(let o=1;o<e.length;o+=2)s.push([e[o],e[o+1]]);return s}cL.resolveBlockScalar=sG});var mb=R(uL=>{"use strict";var hb=jt(),cG=Ba();function lG(t,e,r){let{offset:n,type:i,source:s,end:o}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=hb.Scalar.PLAIN,c=uG(s,l);break;case"single-quoted-scalar":a=hb.Scalar.QUOTE_SINGLE,c=dG(s,l);break;case"double-quoted-scalar":a=hb.Scalar.QUOTE_DOUBLE,c=fG(s,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+s.length,n+s.length]}}let u=n+s.length,d=cG.resolveEnd(o,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function uG(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),lL(t)}function dG(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),lL(t.slice(1,-1)).replace(/''/g,"'")}function lL(t){let e,r;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
121
121
|
`,"sy"),r=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
122
122
|
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,r=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(t);if(!n)return t;let i=n[1],s=" ",o=e.lastIndex;for(r.lastIndex=o;n=r.exec(t);)n[1]===""?s===`
|
|
123
123
|
`?i+=s:s=`
|
|
124
|
-
`:(i+=s+n[1],s=" "),o=r.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,n=a.exec(t),i+s+(n?.[1]??"")}function
|
|
124
|
+
`:(i+=s+n[1],s=" "),o=r.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,n=a.exec(t),i+s+(n?.[1]??"")}function fG(t,e){let r="";for(let n=1;n<t.length-1;++n){let i=t[n];if(!(i==="\r"&&t[n+1]===`
|
|
125
125
|
`))if(i===`
|
|
126
|
-
`){let{fold:s,offset:o}=
|
|
126
|
+
`){let{fold:s,offset:o}=pG(t,n);r+=s,n=o}else if(i==="\\"){let s=t[++n],o=hG[s];if(o)r+=o;else if(s===`
|
|
127
127
|
`)for(s=t[n+1];s===" "||s===" ";)s=t[++n+1];else if(s==="\r"&&t[n+1]===`
|
|
128
|
-
`)for(s=t[++n+1];s===" "||s===" ";)s=t[++n+1];else if(s==="x"||s==="u"||s==="U"){let a={x:2,u:4,U:8}[s];r+=
|
|
128
|
+
`)for(s=t[++n+1];s===" "||s===" ";)s=t[++n+1];else if(s==="x"||s==="u"||s==="U"){let a={x:2,u:4,U:8}[s];r+=mG(t,n+1,a,e),n+=a}else{let a=t.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),r+=a}}else if(i===" "||i===" "){let s=n,o=t[n+1];for(;o===" "||o===" ";)o=t[++n+1];o!==`
|
|
129
129
|
`&&!(o==="\r"&&t[n+2]===`
|
|
130
|
-
`)&&(r+=n>s?t.slice(s,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function
|
|
130
|
+
`)&&(r+=n>s?t.slice(s,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function pG(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===`
|
|
131
131
|
`||n==="\r")&&!(n==="\r"&&t[e+2]!==`
|
|
132
132
|
`);)n===`
|
|
133
133
|
`&&(r+=`
|
|
134
|
-
`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var
|
|
135
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
134
|
+
`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var hG={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
135
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function mG(t,e,r,n){let i=t.substr(e,r),o=i.length===r&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){let a=t.substr(e-2,r+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}uL.resolveFlowScalar=lG});var pL=R(fL=>{"use strict";var lo=qe(),dL=jt(),gG=pb(),yG=mb();function TG(t,e,r,n){let{value:i,type:s,comment:o,range:a}=e.type==="block-scalar"?gG.resolveBlockScalar(t,e,n):yG.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[lo.SCALAR]:c?l=vG(t.schema,i,c,r,n):e.type==="scalar"?l=bG(t,i,e,n):l=t.schema[lo.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=lo.isScalar(d)?d:new dL.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new dL.Scalar(i)}return u.range=a,u.source=i,s&&(u.type=s),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function vG(t,e,r,n,i){if(r==="!")return t[lo.SCALAR];let s=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)s.push(a);else return a;for(let a of s)if(a.test?.test(e))return a;let o=t.knownTags[r];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[lo.SCALAR])}function bG({atKey:t,directives:e,schema:r},n,i,s){let o=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[lo.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[lo.SCALAR];if(o.tag!==a.tag){let c=e.tagString(o.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;s(i,"TAG_RESOLVE_FAILED",u,!0)}}return o}fL.composeScalar=TG});var mL=R(hL=>{"use strict";function SG(t,e,r){if(e){r===null&&(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}hL.emptyScalarPosition=SG});var TL=R(yb=>{"use strict";var _G=_l(),kG=qe(),NG=aL(),gL=pL(),RG=Ba(),PG=mL(),wG={composeNode:yL,composeEmptyNode:gb};function yL(t,e,r,n){let i=t.atKey,{spaceBefore:s,comment:o,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=EG(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=gL.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":l=NG.composeCollection(wG,t,e,r,n),a&&(l.anchor=a.source.substring(1));break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),l=gb(t,e.offset,void 0,null,r,n),u=!1}}return a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!kG.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function gb(t,e,r,n,{spaceBefore:i,comment:s,anchor:o,tag:a,end:c},l){let u={type:"scalar",offset:PG.emptyScalarPosition(e,r,n),indent:-1,source:""},d=gL.composeScalar(t,u,a,l);return o&&(d.anchor=o.source.substring(1),d.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),s&&(d.comment=s,d.range[2]=c),d}function EG({options:t},{offset:e,source:r,end:n},i){let s=new _G.Alias(r.substring(1));s.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+r.length,a=RG.resolveEnd(n,o,t.strict,i);return s.range=[e,o,a.offset],a.comment&&(s.comment=a.comment),s}yb.composeEmptyNode=gb;yb.composeNode=yL});var SL=R(bL=>{"use strict";var CG=$l(),vL=TL(),DG=Ba(),AG=Ul();function IG(t,e,{offset:r,start:n,value:i,end:s},o){let a=Object.assign({_directives:e},t),c=new CG.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=AG.resolveProps(n,{indicator:"doc-start",next:i??s?.[0],offset:r,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?vL.composeNode(l,i,u,o):vL.composeEmptyNode(l,u.end,n,null,u,o);let d=c.contents.range[2],f=DG.resolveEnd(s,d,!1,o);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}bL.composeDoc=IG});var vb=R(NL=>{"use strict";var OG=iv(),MG=$l(),Hl=jl(),_L=qe(),xG=SL(),LG=Ba();function Vl(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function kL(t){let e="",r=!1,n=!1;for(let i=0;i<t.length;++i){let s=t[i];switch(s[0]){case"#":e+=(e===""?"":n?`
|
|
136
136
|
|
|
137
137
|
`:`
|
|
138
|
-
`)+(s.substring(1)||" "),r=!0,n=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var
|
|
139
|
-
${n}`:n;else if(i||e.directives.docStart||!s)e.commentBefore=n;else if(
|
|
138
|
+
`)+(s.substring(1)||" "),r=!0,n=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var Tb=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,s)=>{let o=Vl(r);s?this.warnings.push(new Hl.YAMLWarning(o,n,i)):this.errors.push(new Hl.YAMLParseError(o,n,i))},this.directives=new OG.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=kL(this.prelude);if(n){let s=e.contents;if(r)e.comment=e.comment?`${e.comment}
|
|
139
|
+
${n}`:n;else if(i||e.directives.docStart||!s)e.commentBefore=n;else if(_L.isCollection(s)&&!s.flow&&s.items.length>0){let o=s.items[0];_L.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${n}
|
|
140
140
|
${a}`:n}else{let o=s.commentBefore;s.commentBefore=o?`${n}
|
|
141
|
-
${o}`:n}}r?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
142
|
-
${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new
|
|
141
|
+
${o}`:n}}r?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:kL(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,r=!1,n=-1){for(let i of e)yield*this.next(i);yield*this.end(r,n)}*next(e){switch(process.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(r,n,i)=>{let s=Vl(e);s[0]+=r,this.onError(s,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=xG.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Hl.YAMLParseError(Vl(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Hl.YAMLParseError(Vl(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=LG.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
|
|
142
|
+
${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Hl.YAMLParseError(Vl(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new MG.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};NL.Composer=Tb});var wL=R(tm=>{"use strict";var qG=pb(),$G=mb(),BG=jl(),RL=wl();function FG(t,e=!0,r){if(t){let n=(i,s,o)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,s,o);else throw new BG.YAMLParseError([a,a+1],s,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return $G.resolveFlowScalar(t,e,n);case"block-scalar":return qG.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function jG(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:s=-1,type:o="PLAIN"}=e,a=RL.stringifyString({type:o,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:`
|
|
143
143
|
`}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
|
|
144
144
|
`),u=a.substring(0,l),d=a.substring(l+1)+`
|
|
145
|
-
`,f=[{type:"block-scalar-header",offset:s,indent:n,source:u}];return
|
|
146
|
-
`}),{type:"block-scalar",offset:s,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:s,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:s,indent:n,source:a,end:c};default:return{type:"scalar",offset:s,indent:n,source:a,end:c}}}function
|
|
145
|
+
`,f=[{type:"block-scalar-header",offset:s,indent:n,source:u}];return PL(f,c)||f.push({type:"newline",offset:-1,indent:n,source:`
|
|
146
|
+
`}),{type:"block-scalar",offset:s,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:s,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:s,indent:n,source:a,end:c};default:return{type:"scalar",offset:s,indent:n,source:a,end:c}}}function UG(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:s=!1,type:o}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=RL.stringifyString({type:o,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":HG(t,c);break;case'"':bb(t,c,"double-quoted-scalar");break;case"'":bb(t,c,"single-quoted-scalar");break;default:bb(t,c,"scalar")}}function HG(t,e){let r=e.indexOf(`
|
|
147
147
|
`),n=e.substring(0,r),i=e.substring(r+1)+`
|
|
148
|
-
`;if(t.type==="block-scalar"){let s=t.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=n,t.source=i}else{let{offset:s}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:s,indent:o,source:n}];
|
|
149
|
-
`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:i})}}function
|
|
150
|
-
`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(t))s!=="type"&&s!=="offset"&&delete t[s];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}
|
|
148
|
+
`;if(t.type==="block-scalar"){let s=t.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=n,t.source=i}else{let{offset:s}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:s,indent:o,source:n}];PL(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
|
149
|
+
`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:i})}}function PL(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function bb(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let s of n)s.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
|
|
150
|
+
`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(t))s!=="type"&&s!=="offset"&&delete t[s];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}tm.createScalarToken=jG;tm.resolveAsScalar=FG;tm.setScalarValue=UG});var CL=R(EL=>{"use strict";var VG=t=>"type"in t?nm(t):rm(t);function nm(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=nm(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=rm(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=rm(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=rm(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function rm({start:t,key:e,sep:r,value:n}){let i="";for(let s of t)i+=s.source;if(e&&(i+=nm(e)),r)for(let s of r)i+=s.source;return n&&(i+=nm(n)),i}EL.stringify=VG});var OL=R(IL=>{"use strict";var Sb=Symbol("break visit"),zG=Symbol("skip children"),DL=Symbol("remove item");function uo(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),AL(Object.freeze([]),t,e)}uo.BREAK=Sb;uo.SKIP=zG;uo.REMOVE=DL;uo.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let s=r?.[n];if(s&&"items"in s)r=s.items[i];else return}return r};uo.parentCollection=(t,e)=>{let r=uo.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function AL(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let s=e[i];if(s&&"items"in s){for(let o=0;o<s.items.length;++o){let a=AL(Object.freeze(t.concat([[i,o]])),s.items[o],r);if(typeof a=="number")o=a-1;else{if(a===Sb)return Sb;a===DL&&(s.items.splice(o,1),o-=1)}}typeof n=="function"&&i==="key"&&(n=n(e,t))}}return typeof n=="function"?n(e,t):n}IL.visit=uo});var im=R(jr=>{"use strict";var _b=wL(),WG=CL(),GG=OL(),kb="\uFEFF",Nb="",Rb="",Pb="",KG=t=>!!t&&"items"in t,YG=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function XG(t){switch(t){case kb:return"<BOM>";case Nb:return"<DOC>";case Rb:return"<FLOW_END>";case Pb:return"<SCALAR>";default:return JSON.stringify(t)}}function JG(t){switch(t){case kb:return"byte-order-mark";case Nb:return"doc-mode";case Rb:return"flow-error-end";case Pb:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
151
151
|
`:case`\r
|
|
152
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}
|
|
153
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
154
|
-
\r `),
|
|
152
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}jr.createScalarToken=_b.createScalarToken;jr.resolveAsScalar=_b.resolveAsScalar;jr.setScalarValue=_b.setScalarValue;jr.stringify=WG.stringify;jr.visit=GG.visit;jr.BOM=kb;jr.DOCUMENT=Nb;jr.FLOW_END=Rb;jr.SCALAR=Pb;jr.isCollection=KG;jr.isScalar=YG;jr.prettyToken=XG;jr.tokenType=JG});var Cb=R(xL=>{"use strict";var zl=im();function Qn(t){switch(t){case void 0:case" ":case`
|
|
153
|
+
`:case"\r":case" ":return!0;default:return!1}}var ML=new Set("0123456789ABCDEFabcdef"),QG=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),sm=new Set(",[]{}"),ZG=new Set(` ,[]{}
|
|
154
|
+
\r `),wb=t=>!t||ZG.has(t),Eb=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===`
|
|
155
155
|
`?!0:r==="\r"?this.buffer[e+1]===`
|
|
156
156
|
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+e];if(r==="\r"){let i=this.buffer[n+e+1];if(i===`
|
|
157
157
|
`||!i&&!this.atEnd)return e+n+1}return r===`
|
|
158
|
-
`||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&
|
|
159
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===
|
|
158
|
+
`||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Qn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
159
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===zl.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let r=e.length,n=e.indexOf("#");for(;n!==-1;){let s=e[n-1];if(s===" "||s===" "){r=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let s=e[r-1];if(s===" "||s===" ")r-=1;else break}let i=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-r),yield*this.pushNewline(),"stream"}return yield zl.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&Qn(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,r==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Qn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Qn(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(wb),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&i[0]!=="#"||n===0&&(i.startsWith("---")||i.startsWith("..."))&&Qn(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield zl.FLOW_END,yield*this.parseLineStart();let s=0;for(;i[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),i[s]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(wb),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||Qn(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),r=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;r!==-1&&this.buffer[r+1]==="'";)r=this.buffer.indexOf("'",r+2);else for(;r!==-1;){let s=0;for(;this.buffer[r-1-s]==="\\";)s+=1;if(s%2===0)break;r=this.buffer.indexOf('"',r+1)}let n=this.buffer.substring(0,r),i=n.indexOf(`
|
|
160
160
|
`,this.pos);if(i!==-1){for(;i!==-1;){let s=this.continueScalar(i+1);if(s===-1)break;i=n.indexOf(`
|
|
161
|
-
`,s)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>
|
|
161
|
+
`,s)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Qn(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let s=this.pos;n=this.buffer[s];++s)switch(n){case" ":r+=1;break;case`
|
|
162
162
|
`:e=s,r=0;break;case"\r":{let o=this.buffer[s+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
163
163
|
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(e+1);if(s===-1)break;e=this.buffer.indexOf(`
|
|
164
164
|
`,s)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
|
|
165
165
|
`;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let s=e-1,o=this.buffer[s];o==="\r"&&(o=this.buffer[--s]);let a=s;for(;o===" ";)o=this.buffer[--s];if(o===`
|
|
166
|
-
`&&s>=this.pos&&s+1+r>a)e=s;else break}while(!0);return yield
|
|
166
|
+
`&&s>=this.pos&&s+1+r>a)e=s;else break}while(!0);return yield zl.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let s=this.buffer[n+1];if(Qn(s)||e&&sm.has(s))break;r=n}else if(Qn(i)){let s=this.buffer[n+1];if(i==="\r"&&(s===`
|
|
167
167
|
`?(n+=1,i=`
|
|
168
|
-
`,s=this.buffer[n+1]):r=n),s==="#"||e&&
|
|
169
|
-
`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&
|
|
168
|
+
`,s=this.buffer[n+1]):r=n),s==="#"||e&&sm.has(s))break;if(i===`
|
|
169
|
+
`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&sm.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield zl.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(wb))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,r=this.charAt(1);if(Qn(r)||e&&sm.has(r))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Qn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(QG.has(r))r=this.buffer[++e];else if(r==="%"&&ML.has(this.buffer[e+1])&&ML.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
170
170
|
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
171
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};
|
|
171
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};xL.Lexer=Eb});var Ab=R(LL=>{"use strict";var Db=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r<n;){let s=r+n>>1;this.lineStarts[s]<e?r=s+1:n=s}if(this.lineStarts[r]===e)return{line:r+1,col:1};if(r===0)return{line:0,col:e};let i=this.lineStarts[r-1];return{line:r,col:e-i+1}}}};LL.LineCounter=Db});var Ob=R(jL=>{"use strict";var qL=im(),eK=Cb();function fo(t,e){for(let r=0;r<t.length;++r)if(t[r].type===e)return!0;return!1}function $L(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function FL(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function om(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function Fa(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function BL(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!fo(e.start,"explicit-key-ind")&&!fo(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,FL(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var Ib=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new eK.Lexer,this.onNewLine=e}*parse(e,r=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,r))yield*this.next(n);r||(yield*this.end())}*next(e){if(this.source=e,process.env.LOG_TOKENS&&console.log("|",qL.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let r=qL.tokenType(e);if(r)if(r==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=r,yield*this.step(),r){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&BL(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&$L(i.start)===-1&&(r.indent===0||i.start.every(s=>s.type!=="comment"||s.indent<r.indent))&&(n.type==="document"?n.end=i.start:n.items.push({start:i.start}),r.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{$L(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let r=om(this.peek(2)),n=Fa(r),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let r=this.source.indexOf(`
|
|
172
172
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
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)){Array.prototype.push.apply(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(
|
|
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)){Array.prototype.push.apply(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(fo(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(FL(r.key)&&!fo(r.sep,"newline")){let o=Fa(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(fo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let o=Fa(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]}):fo(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){n&&o.type!=="block-seq"&&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)){Array.prototype.push.apply(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||fo(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&&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=Fa(i);BL(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=Zh(e),n=qa(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=Zh(e),n=qa(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;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};$L.Parser=wb});var HL=R(Vl=>{"use strict";var BL=hb(),ZG=xl(),Hl=$l(),eK=fv(),tK=qe(),rK=Pb(),FL=Eb();function jL(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new rK.LineCounter||null,prettyErrors:e}}function nK(t,e={}){let{lineCounter:r,prettyErrors:n}=jL(e),i=new FL.Parser(r?.addNewLine),s=new BL.Composer(e),o=Array.from(s.compose(i.parse(t)));if(n&&r)for(let a of o)a.errors.forEach(Hl.prettifyError(t,r)),a.warnings.forEach(Hl.prettifyError(t,r));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function UL(t,e={}){let{lineCounter:r,prettyErrors:n}=jL(e),i=new FL.Parser(r?.addNewLine),s=new BL.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 Hl.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(o.errors.forEach(Hl.prettifyError(t,r)),o.warnings.forEach(Hl.prettifyError(t,r))),o}function iK(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=UL(t,r);if(!i)return null;if(i.warnings.forEach(s=>eK.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 sK(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 tK.isDocument(t)&&!n?t.toString(r):new ZG.Document(t,n,r).toString(r)}Vl.parse=iK;Vl.parseAllDocuments=nK;Vl.parseDocument=UL;Vl.stringify=sK});var Db=R(Ye=>{"use strict";var oK=hb(),aK=xl(),cK=Kv(),Cb=$l(),lK=vl(),Rs=qe(),uK=Ss(),dK=jt(),fK=ks(),pK=Ns(),hK=Jh(),mK=Nb(),gK=Pb(),yK=Eb(),em=HL(),VL=ml();Ye.Composer=oK.Composer;Ye.Document=aK.Document;Ye.Schema=cK.Schema;Ye.YAMLError=Cb.YAMLError;Ye.YAMLParseError=Cb.YAMLParseError;Ye.YAMLWarning=Cb.YAMLWarning;Ye.Alias=lK.Alias;Ye.isAlias=Rs.isAlias;Ye.isCollection=Rs.isCollection;Ye.isDocument=Rs.isDocument;Ye.isMap=Rs.isMap;Ye.isNode=Rs.isNode;Ye.isPair=Rs.isPair;Ye.isScalar=Rs.isScalar;Ye.isSeq=Rs.isSeq;Ye.Pair=uK.Pair;Ye.Scalar=dK.Scalar;Ye.YAMLMap=fK.YAMLMap;Ye.YAMLSeq=pK.YAMLSeq;Ye.CST=hK;Ye.Lexer=mK.Lexer;Ye.LineCounter=gK.LineCounter;Ye.Parser=yK.Parser;Ye.parse=em.parse;Ye.parseAllDocuments=em.parseAllDocuments;Ye.parseDocument=em.parseDocument;Ye.stringify=em.stringify;Ye.visit=VL.visit;Ye.visitAsync=VL.visitAsync});var Gl=R(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.regexpCode=Fe.getEsmExportName=Fe.getProperty=Fe.safeStringify=Fe.stringify=Fe.strConcat=Fe.addCodeArg=Fe.str=Fe._=Fe.nil=Fe._Code=Fe.Name=Fe.IDENTIFIER=Fe._CodeOrName=void 0;var zl=class{};Fe._CodeOrName=zl;Fe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var co=class extends zl{constructor(e){if(super(),!Fe.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}}};Fe.Name=co;var kn=class extends zl{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),{})}};Fe._Code=kn;Fe.nil=new kn("");function zL(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Ib(r,e[n]),r.push(t[++n]);return new kn(r)}Fe._=zL;var Ab=new kn("+");function WL(t,...e){let r=[Wl(t[0])],n=0;for(;n<e.length;)r.push(Ab),Ib(r,e[n]),r.push(Ab,Wl(t[++n]));return TK(r),new kn(r)}Fe.str=WL;function Ib(t,e){e instanceof kn?t.push(...e._items):e instanceof co?t.push(e):t.push(SK(e))}Fe.addCodeArg=Ib;function TK(t){let e=1;for(;e<t.length-1;){if(t[e]===Ab){let r=vK(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function vK(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 bK(t,e){return e.emptyStr()?t:t.emptyStr()?e:WL`${t}${e}`}Fe.strConcat=bK;function SK(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Wl(Array.isArray(t)?t.join(","):t)}function _K(t){return new kn(Wl(t))}Fe.stringify=_K;function Wl(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Fe.safeStringify=Wl;function kK(t){return typeof t=="string"&&Fe.IDENTIFIER.test(t)?new kn(`.${t}`):zL`[${t}]`}Fe.getProperty=kK;function NK(t){if(typeof t=="string"&&Fe.IDENTIFIER.test(t))return new kn(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Fe.getEsmExportName=NK;function RK(t){return new kn(t.toString())}Fe.regexpCode=RK});var xb=R(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.ValueScope=jr.ValueScopeName=jr.Scope=jr.varKinds=jr.UsedValueState=void 0;var Fr=Gl(),Ob=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},tm;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(tm||(jr.UsedValueState=tm={}));jr.varKinds={const:new Fr.Name("const"),let:new Fr.Name("let"),var:new Fr.Name("var")};var rm=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Fr.Name?e:this.name(e)}name(e){return new Fr.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}}};jr.Scope=rm;var nm=class extends Fr.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Fr._)`.${new Fr.Name(r)}[${n}]`}};jr.ValueScopeName=nm;var PK=(0,Fr._)`\n`,Mb=class extends rm{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?PK:Fr.nil}}get(){return this._scope}name(e){return new nm(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,Fr._)`${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=Fr.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,tm.Started);let u=r(l);if(u){let d=this.opts.es5?jr.varKinds.var:jr.varKinds.const;s=(0,Fr._)`${s}${d} ${l} = ${u};${this.opts._n}`}else if(u=i?.(l))s=(0,Fr._)`${s}${u}${this.opts._n}`;else throw new Ob(l);c.set(l,tm.Completed)})}return s}};jr.ValueScope=Mb});var Te=R(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.or=be.and=be.not=be.CodeGen=be.operators=be.varKinds=be.ValueScopeName=be.ValueScope=be.Scope=be.Name=be.regexpCode=be.stringify=be.getProperty=be.nil=be.strConcat=be.str=be._=void 0;var Oe=Gl(),Yn=xb(),Ps=Gl();Object.defineProperty(be,"_",{enumerable:!0,get:function(){return Ps._}});Object.defineProperty(be,"str",{enumerable:!0,get:function(){return Ps.str}});Object.defineProperty(be,"strConcat",{enumerable:!0,get:function(){return Ps.strConcat}});Object.defineProperty(be,"nil",{enumerable:!0,get:function(){return Ps.nil}});Object.defineProperty(be,"getProperty",{enumerable:!0,get:function(){return Ps.getProperty}});Object.defineProperty(be,"stringify",{enumerable:!0,get:function(){return Ps.stringify}});Object.defineProperty(be,"regexpCode",{enumerable:!0,get:function(){return Ps.regexpCode}});Object.defineProperty(be,"Name",{enumerable:!0,get:function(){return Ps.Name}});var am=xb();Object.defineProperty(be,"Scope",{enumerable:!0,get:function(){return am.Scope}});Object.defineProperty(be,"ValueScope",{enumerable:!0,get:function(){return am.ValueScope}});Object.defineProperty(be,"ValueScopeName",{enumerable:!0,get:function(){return am.ValueScopeName}});Object.defineProperty(be,"varKinds",{enumerable:!0,get:function(){return am.varKinds}});be.operators={GT:new Oe._Code(">"),GTE:new Oe._Code(">="),LT:new Oe._Code("<"),LTE:new Oe._Code("<="),EQ:new Oe._Code("==="),NEQ:new Oe._Code("!=="),NOT:new Oe._Code("!"),OR:new Oe._Code("||"),AND:new Oe._Code("&&"),ADD:new Oe._Code("+")};var ji=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Lb=class extends ji{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Yn.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=Ba(this.rhs,e,r)),this}get names(){return this.rhs instanceof Oe._CodeOrName?this.rhs.names:{}}},im=class extends ji{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 Oe.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Ba(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Oe.Name?{}:{...this.lhs.names};return om(e,this.rhs)}},qb=class extends im{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},$b=class extends ji{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Bb=class extends ji{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Fb=class extends ji{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},jb=class extends ji{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=Ba(this.code,e,r),this}get names(){return this.code instanceof Oe._CodeOrName?this.code.names:{}}},Kl=class extends ji{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)||(wK(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>fo(e,r.names),{})}},Ui=class extends Kl{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Ub=class extends Kl{},$a=class extends Ui{};$a.kind="else";var lo=class t extends Ui{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 $a(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(GL(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=Ba(this.condition,e,r),this}get names(){let e=super.names;return om(e,this.condition),this.else&&fo(e,this.else.names),e}};lo.kind="if";var uo=class extends Ui{};uo.kind="for";var Hb=class extends uo{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=Ba(this.iteration,e,r),this}get names(){return fo(super.names,this.iteration.names)}},Vb=class extends uo{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?Yn.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=om(super.names,this.from);return om(e,this.to)}},sm=class extends uo{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=Ba(this.iterable,e,r),this}get names(){return fo(super.names,this.iterable.names)}},Yl=class extends Ui{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)}};Yl.kind="func";var Xl=class extends Kl{render(e){return"return "+super.render(e)}};Xl.kind="return";var zb=class extends Ui{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&&fo(e,this.catch.names),this.finally&&fo(e,this.finally.names),e}},Jl=class extends Ui{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Jl.kind="catch";var Ql=class extends Ui{render(e){return"finally"+super.render(e)}};Ql.kind="finally";var Wb=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
176
|
-
`:""},this._extScope=e,this._scope=new Yn.Scope({parent:e}),this._nodes=[new Ub]}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 Lb(e,s,n)),s}const(e,r,n){return this._def(Yn.varKinds.const,e,r,n)}let(e,r,n){return this._def(Yn.varKinds.let,e,r,n)}var(e,r,n){return this._def(Yn.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new im(e,r,n))}add(e,r){return this._leafNode(new qb(e,be.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Oe.nil&&this._leafNode(new jb(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,Oe.addCodeArg)(r,i));return r.push("}"),new Oe._Code(r)}if(e,r,n){if(this._blockNode(new lo(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 lo(e))}else(){return this._elseNode(new $a)}endIf(){return this._endBlockNode(lo,$a)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Hb(e),r)}forRange(e,r,n,i,s=this.opts.es5?Yn.varKinds.var:Yn.varKinds.let){let o=this._scope.toName(e);return this._for(new Vb(s,o,r,n),()=>i(o))}forOf(e,r,n,i=Yn.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=r instanceof Oe.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Oe._)`${o}.length`,a=>{this.var(s,(0,Oe._)`${o}[${a}]`),n(s)})}return this._for(new sm("of",i,s,r),()=>n(s))}forIn(e,r,n,i=this.opts.es5?Yn.varKinds.var:Yn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Oe._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new sm("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(uo)}label(e){return this._leafNode(new $b(e))}break(e){return this._leafNode(new Bb(e))}return(e){let r=new Xl;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Xl)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new zb;if(this._blockNode(i),this.code(e),r){let s=this.name("e");this._currNode=i.catch=new Jl(s),r(s)}return n&&(this._currNode=i.finally=new Ql,this.code(n)),this._endBlockNode(Jl,Ql)}throw(e){return this._leafNode(new Fb(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=Oe.nil,n,i){return this._blockNode(new Yl(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Yl)}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 lo))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}};be.CodeGen=Wb;function fo(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function om(t,e){return e instanceof Oe._CodeOrName?fo(t,e.names):t}function Ba(t,e,r){if(t instanceof Oe.Name)return n(t);if(!i(t))return t;return new Oe._Code(t._items.reduce((s,o)=>(o instanceof Oe.Name&&(o=n(o)),o instanceof Oe._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 Oe._Code&&s._items.some(o=>o instanceof Oe.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function wK(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function GL(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Oe._)`!${Gb(t)}`}be.not=GL;var EK=KL(be.operators.AND);function CK(...t){return t.reduce(EK)}be.and=CK;var DK=KL(be.operators.OR);function AK(...t){return t.reduce(DK)}be.or=AK;function KL(t){return(e,r)=>e===Oe.nil?r:r===Oe.nil?e:(0,Oe._)`${Gb(e)} ${t} ${Gb(r)}`}function Gb(t){return t instanceof Oe.Name?t:(0,Oe._)`(${t})`}});var Ee=R(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.checkStrictMode=ke.getErrorPath=ke.Type=ke.useFunc=ke.setEvaluated=ke.evaluatedPropsToName=ke.mergeEvaluated=ke.eachItem=ke.unescapeJsonPointer=ke.escapeJsonPointer=ke.escapeFragment=ke.unescapeFragment=ke.schemaRefOrVal=ke.schemaHasRulesButRef=ke.schemaHasRules=ke.checkUnknownRules=ke.alwaysValidSchema=ke.toHash=void 0;var ct=Te(),IK=Gl();function OK(t){let e={};for(let r of t)e[r]=!0;return e}ke.toHash=OK;function MK(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(JL(t,e),!QL(e,t.self.RULES.all))}ke.alwaysValidSchema=MK;function JL(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]||tq(t,`unknown keyword: "${s}"`)}ke.checkUnknownRules=JL;function QL(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}ke.schemaHasRules=QL;function xK(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}ke.schemaHasRulesButRef=xK;function LK({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ct._)`${r}`}return(0,ct._)`${t}${e}${(0,ct.getProperty)(n)}`}ke.schemaRefOrVal=LK;function qK(t){return ZL(decodeURIComponent(t))}ke.unescapeFragment=qK;function $K(t){return encodeURIComponent(Yb(t))}ke.escapeFragment=$K;function Yb(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}ke.escapeJsonPointer=Yb;function ZL(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}ke.unescapeJsonPointer=ZL;function BK(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}ke.eachItem=BK;function YL({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,s,o,a)=>{let c=o===void 0?s:o instanceof ct.Name?(s instanceof ct.Name?t(i,s,o):e(i,s,o),o):s instanceof ct.Name?(e(i,o,s),s):r(s,o);return a===ct.Name&&!(c instanceof ct.Name)?n(i,c):c}}ke.mergeEvaluated={props:YL({mergeNames:(t,e,r)=>t.if((0,ct._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,ct._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,ct._)`${r} || {}`).code((0,ct._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,ct._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,ct._)`${r} || {}`),Xb(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:eq}),items:YL({mergeNames:(t,e,r)=>t.if((0,ct._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,ct._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,ct._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,ct._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function eq(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,ct._)`{}`);return e!==void 0&&Xb(t,r,e),r}ke.evaluatedPropsToName=eq;function Xb(t,e,r){Object.keys(r).forEach(n=>t.assign((0,ct._)`${e}${(0,ct.getProperty)(n)}`,!0))}ke.setEvaluated=Xb;var XL={};function FK(t,e){return t.scopeValue("func",{ref:e,code:XL[e.code]||(XL[e.code]=new IK._Code(e.code))})}ke.useFunc=FK;var Kb;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Kb||(ke.Type=Kb={}));function jK(t,e,r){if(t instanceof ct.Name){let n=e===Kb.Num;return r?n?(0,ct._)`"[" + ${t} + "]"`:(0,ct._)`"['" + ${t} + "']"`:n?(0,ct._)`"/" + ${t}`:(0,ct._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ct.getProperty)(t).toString():"/"+Yb(t)}ke.getErrorPath=jK;function tq(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}ke.checkStrictMode=tq});var Nn=R(Jb=>{"use strict";Object.defineProperty(Jb,"__esModule",{value:!0});var gr=Te(),UK={data:new gr.Name("data"),valCxt:new gr.Name("valCxt"),instancePath:new gr.Name("instancePath"),parentData:new gr.Name("parentData"),parentDataProperty:new gr.Name("parentDataProperty"),rootData:new gr.Name("rootData"),dynamicAnchors:new gr.Name("dynamicAnchors"),vErrors:new gr.Name("vErrors"),errors:new gr.Name("errors"),this:new gr.Name("this"),self:new gr.Name("self"),scope:new gr.Name("scope"),json:new gr.Name("json"),jsonPos:new gr.Name("jsonPos"),jsonLen:new gr.Name("jsonLen"),jsonPart:new gr.Name("jsonPart")};Jb.default=UK});var Zl=R(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.extendErrors=yr.resetErrorsCount=yr.reportExtraError=yr.reportError=yr.keyword$DataError=yr.keywordError=void 0;var $e=Te(),cm=Ee(),Rr=Nn();yr.keywordError={message:({keyword:t})=>(0,$e.str)`must pass "${t}" keyword validation`};yr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,$e.str)`"${t}" keyword must be ${e} ($data)`:(0,$e.str)`"${t}" keyword is invalid ($data)`};function HK(t,e=yr.keywordError,r,n){let{it:i}=t,{gen:s,compositeRule:o,allErrors:a}=i,c=iq(t,e,r);n??(o||a)?rq(s,c):nq(i,(0,$e._)`[${c}]`)}yr.reportError=HK;function VK(t,e=yr.keywordError,r){let{it:n}=t,{gen:i,compositeRule:s,allErrors:o}=n,a=iq(t,e,r);rq(i,a),s||o||nq(n,Rr.default.vErrors)}yr.reportExtraError=VK;function zK(t,e){t.assign(Rr.default.errors,e),t.if((0,$e._)`${Rr.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,$e._)`${Rr.default.vErrors}.length`,e),()=>t.assign(Rr.default.vErrors,null)))}yr.resetErrorsCount=zK;function WK({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,Rr.default.errors,a=>{t.const(o,(0,$e._)`${Rr.default.vErrors}[${a}]`),t.if((0,$e._)`${o}.instancePath === undefined`,()=>t.assign((0,$e._)`${o}.instancePath`,(0,$e.strConcat)(Rr.default.instancePath,s.errorPath))),t.assign((0,$e._)`${o}.schemaPath`,(0,$e.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,$e._)`${o}.schema`,r),t.assign((0,$e._)`${o}.data`,n))})}yr.extendErrors=WK;function rq(t,e){let r=t.const("err",e);t.if((0,$e._)`${Rr.default.vErrors} === null`,()=>t.assign(Rr.default.vErrors,(0,$e._)`[${r}]`),(0,$e._)`${Rr.default.vErrors}.push(${r})`),t.code((0,$e._)`${Rr.default.errors}++`)}function nq(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,$e._)`new ${t.ValidationError}(${e})`):(r.assign((0,$e._)`${n}.errors`,e),r.return(!1))}var po={keyword:new $e.Name("keyword"),schemaPath:new $e.Name("schemaPath"),params:new $e.Name("params"),propertyName:new $e.Name("propertyName"),message:new $e.Name("message"),schema:new $e.Name("schema"),parentSchema:new $e.Name("parentSchema")};function iq(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,$e._)`{}`:GK(t,e,r)}function GK(t,e,r={}){let{gen:n,it:i}=t,s=[KK(i,r),YK(t,r)];return XK(t,e,s),n.object(...s)}function KK({errorPath:t},{instancePath:e}){let r=e?(0,$e.str)`${t}${(0,cm.getErrorPath)(e,cm.Type.Str)}`:t;return[Rr.default.instancePath,(0,$e.strConcat)(Rr.default.instancePath,r)]}function YK({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,$e.str)`${e}/${t}`;return r&&(i=(0,$e.str)`${i}${(0,cm.getErrorPath)(r,cm.Type.Str)}`),[po.schemaPath,i]}function XK(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([po.keyword,i],[po.params,typeof e=="function"?e(t):e||(0,$e._)`{}`]),c.messages&&n.push([po.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([po.schema,o],[po.parentSchema,(0,$e._)`${u}${d}`],[Rr.default.data,s]),l&&n.push([po.propertyName,l])}});var oq=R(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.boolOrEmptySchema=Fa.topBoolOrEmptySchema=void 0;var JK=Zl(),QK=Te(),ZK=Nn(),eY={message:"boolean schema is false"};function tY(t){let{gen:e,schema:r,validateName:n}=t;r===!1?sq(t,!1):typeof r=="object"&&r.$async===!0?e.return(ZK.default.data):(e.assign((0,QK._)`${n}.errors`,null),e.return(!0))}Fa.topBoolOrEmptySchema=tY;function rY(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),sq(t)):r.var(e,!0)}Fa.boolOrEmptySchema=rY;function sq(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,JK.reportError)(i,eY,void 0,e)}});var Qb=R(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});ja.getRules=ja.isJSONType=void 0;var nY=["string","number","integer","boolean","null","object","array"],iY=new Set(nY);function sY(t){return typeof t=="string"&&iY.has(t)}ja.isJSONType=sY;function oY(){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:{}}}ja.getRules=oY});var Zb=R(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});ws.shouldUseRule=ws.shouldUseGroup=ws.schemaHasRulesForType=void 0;function aY({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&aq(t,n)}ws.schemaHasRulesForType=aY;function aq(t,e){return e.rules.some(r=>cq(t,r))}ws.shouldUseGroup=aq;function cq(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))}ws.shouldUseRule=cq});var eu=R(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.reportTypeError=Tr.checkDataTypes=Tr.checkDataType=Tr.coerceAndCheckDataType=Tr.getJSONTypes=Tr.getSchemaTypes=Tr.DataType=void 0;var cY=Qb(),lY=Zb(),uY=Zl(),ve=Te(),lq=Ee(),Ua;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Ua||(Tr.DataType=Ua={}));function dY(t){let e=uq(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}Tr.getSchemaTypes=dY;function uq(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(cY.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Tr.getJSONTypes=uq;function fY(t,e){let{gen:r,data:n,opts:i}=t,s=pY(e,i.coerceTypes),o=e.length>0&&!(s.length===0&&e.length===1&&(0,lY.schemaHasRulesForType)(t,e[0]));if(o){let a=tS(e,n,i.strictNumbers,Ua.Wrong);r.if(a,()=>{s.length?hY(t,e,s):rS(t)})}return o}Tr.coerceAndCheckDataType=fY;var dq=new Set(["string","number","integer","boolean","null"]);function pY(t,e){return e?t.filter(r=>dq.has(r)||e==="array"&&r==="array"):[]}function hY(t,e,r){let{gen:n,data:i,opts:s}=t,o=n.let("dataType",(0,ve._)`typeof ${i}`),a=n.let("coerced",(0,ve._)`undefined`);s.coerceTypes==="array"&&n.if((0,ve._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,ve._)`${i}[0]`).assign(o,(0,ve._)`typeof ${i}`).if(tS(e,i,s.strictNumbers),()=>n.assign(a,i))),n.if((0,ve._)`${a} !== undefined`);for(let l of r)(dq.has(l)||l==="array"&&s.coerceTypes==="array")&&c(l);n.else(),rS(t),n.endIf(),n.if((0,ve._)`${a} !== undefined`,()=>{n.assign(i,a),mY(t,a)});function c(l){switch(l){case"string":n.elseIf((0,ve._)`${o} == "number" || ${o} == "boolean"`).assign(a,(0,ve._)`"" + ${i}`).elseIf((0,ve._)`${i} === null`).assign(a,(0,ve._)`""`);return;case"number":n.elseIf((0,ve._)`${o} == "boolean" || ${i} === null
|
|
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=Fa(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=Fa(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;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};jL.Parser=Ib});var WL=R(Gl=>{"use strict";var UL=vb(),tK=$l(),Wl=jl(),rK=yv(),nK=qe(),iK=Ab(),HL=Ob();function VL(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new iK.LineCounter||null,prettyErrors:e}}function sK(t,e={}){let{lineCounter:r,prettyErrors:n}=VL(e),i=new HL.Parser(r?.addNewLine),s=new UL.Composer(e),o=Array.from(s.compose(i.parse(t)));if(n&&r)for(let a of o)a.errors.forEach(Wl.prettifyError(t,r)),a.warnings.forEach(Wl.prettifyError(t,r));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function zL(t,e={}){let{lineCounter:r,prettyErrors:n}=VL(e),i=new HL.Parser(r?.addNewLine),s=new UL.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 Wl.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(o.errors.forEach(Wl.prettifyError(t,r)),o.warnings.forEach(Wl.prettifyError(t,r))),o}function oK(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=zL(t,r);if(!i)return null;if(i.warnings.forEach(s=>rK.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 aK(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 nK.isDocument(t)&&!n?t.toString(r):new tK.Document(t,n,r).toString(r)}Gl.parse=oK;Gl.parseAllDocuments=sK;Gl.parseDocument=zL;Gl.stringify=aK});var xb=R(Qe=>{"use strict";var cK=vb(),lK=$l(),uK=Zv(),Mb=jl(),dK=_l(),ws=qe(),fK=ks(),pK=jt(),hK=Rs(),mK=Ps(),gK=im(),yK=Cb(),TK=Ab(),vK=Ob(),am=WL(),GL=Tl();Qe.Composer=cK.Composer;Qe.Document=lK.Document;Qe.Schema=uK.Schema;Qe.YAMLError=Mb.YAMLError;Qe.YAMLParseError=Mb.YAMLParseError;Qe.YAMLWarning=Mb.YAMLWarning;Qe.Alias=dK.Alias;Qe.isAlias=ws.isAlias;Qe.isCollection=ws.isCollection;Qe.isDocument=ws.isDocument;Qe.isMap=ws.isMap;Qe.isNode=ws.isNode;Qe.isPair=ws.isPair;Qe.isScalar=ws.isScalar;Qe.isSeq=ws.isSeq;Qe.Pair=fK.Pair;Qe.Scalar=pK.Scalar;Qe.YAMLMap=hK.YAMLMap;Qe.YAMLSeq=mK.YAMLSeq;Qe.CST=gK;Qe.Lexer=yK.Lexer;Qe.LineCounter=TK.LineCounter;Qe.Parser=vK.Parser;Qe.parse=am.parse;Qe.parseAllDocuments=am.parseAllDocuments;Qe.parseDocument=am.parseDocument;Qe.stringify=am.stringify;Qe.visit=GL.visit;Qe.visitAsync=GL.visitAsync});var Xl=R(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.regexpCode=Fe.getEsmExportName=Fe.getProperty=Fe.safeStringify=Fe.stringify=Fe.strConcat=Fe.addCodeArg=Fe.str=Fe._=Fe.nil=Fe._Code=Fe.Name=Fe.IDENTIFIER=Fe._CodeOrName=void 0;var Kl=class{};Fe._CodeOrName=Kl;Fe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var po=class extends Kl{constructor(e){if(super(),!Fe.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}}};Fe.Name=po;var Pn=class extends Kl{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 po&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Fe._Code=Pn;Fe.nil=new Pn("");function KL(t,...e){let r=[t[0]],n=0;for(;n<e.length;)qb(r,e[n]),r.push(t[++n]);return new Pn(r)}Fe._=KL;var Lb=new Pn("+");function YL(t,...e){let r=[Yl(t[0])],n=0;for(;n<e.length;)r.push(Lb),qb(r,e[n]),r.push(Lb,Yl(t[++n]));return bK(r),new Pn(r)}Fe.str=YL;function qb(t,e){e instanceof Pn?t.push(...e._items):e instanceof po?t.push(e):t.push(kK(e))}Fe.addCodeArg=qb;function bK(t){let e=1;for(;e<t.length-1;){if(t[e]===Lb){let r=SK(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function SK(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof po||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 po))return`"${t}${e.slice(1)}`}function _K(t,e){return e.emptyStr()?t:t.emptyStr()?e:YL`${t}${e}`}Fe.strConcat=_K;function kK(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Yl(Array.isArray(t)?t.join(","):t)}function NK(t){return new Pn(Yl(t))}Fe.stringify=NK;function Yl(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Fe.safeStringify=Yl;function RK(t){return typeof t=="string"&&Fe.IDENTIFIER.test(t)?new Pn(`.${t}`):KL`[${t}]`}Fe.getProperty=RK;function PK(t){if(typeof t=="string"&&Fe.IDENTIFIER.test(t))return new Pn(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Fe.getEsmExportName=PK;function wK(t){return new Pn(t.toString())}Fe.regexpCode=wK});var Fb=R(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.ValueScope=Hr.ValueScopeName=Hr.Scope=Hr.varKinds=Hr.UsedValueState=void 0;var Ur=Xl(),$b=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},cm;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(cm||(Hr.UsedValueState=cm={}));Hr.varKinds={const:new Ur.Name("const"),let:new Ur.Name("let"),var:new Ur.Name("var")};var lm=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Ur.Name?e:this.name(e)}name(e){return new Ur.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}}};Hr.Scope=lm;var um=class extends Ur.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Ur._)`.${new Ur.Name(r)}[${n}]`}};Hr.ValueScopeName=um;var EK=(0,Ur._)`\n`,Bb=class extends lm{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?EK:Ur.nil}}get(){return this._scope}name(e){return new um(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,Ur._)`${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=Ur.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,cm.Started);let u=r(l);if(u){let d=this.opts.es5?Hr.varKinds.var:Hr.varKinds.const;s=(0,Ur._)`${s}${d} ${l} = ${u};${this.opts._n}`}else if(u=i?.(l))s=(0,Ur._)`${s}${u}${this.opts._n}`;else throw new $b(l);c.set(l,cm.Completed)})}return s}};Hr.ValueScope=Bb});var Te=R(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.or=_e.and=_e.not=_e.CodeGen=_e.operators=_e.varKinds=_e.ValueScopeName=_e.ValueScope=_e.Scope=_e.Name=_e.regexpCode=_e.stringify=_e.getProperty=_e.nil=_e.strConcat=_e.str=_e._=void 0;var Oe=Xl(),Zn=Fb(),Es=Xl();Object.defineProperty(_e,"_",{enumerable:!0,get:function(){return Es._}});Object.defineProperty(_e,"str",{enumerable:!0,get:function(){return Es.str}});Object.defineProperty(_e,"strConcat",{enumerable:!0,get:function(){return Es.strConcat}});Object.defineProperty(_e,"nil",{enumerable:!0,get:function(){return Es.nil}});Object.defineProperty(_e,"getProperty",{enumerable:!0,get:function(){return Es.getProperty}});Object.defineProperty(_e,"stringify",{enumerable:!0,get:function(){return Es.stringify}});Object.defineProperty(_e,"regexpCode",{enumerable:!0,get:function(){return Es.regexpCode}});Object.defineProperty(_e,"Name",{enumerable:!0,get:function(){return Es.Name}});var hm=Fb();Object.defineProperty(_e,"Scope",{enumerable:!0,get:function(){return hm.Scope}});Object.defineProperty(_e,"ValueScope",{enumerable:!0,get:function(){return hm.ValueScope}});Object.defineProperty(_e,"ValueScopeName",{enumerable:!0,get:function(){return hm.ValueScopeName}});Object.defineProperty(_e,"varKinds",{enumerable:!0,get:function(){return hm.varKinds}});_e.operators={GT:new Oe._Code(">"),GTE:new Oe._Code(">="),LT:new Oe._Code("<"),LTE:new Oe._Code("<="),EQ:new Oe._Code("==="),NEQ:new Oe._Code("!=="),NOT:new Oe._Code("!"),OR:new Oe._Code("||"),AND:new Oe._Code("&&"),ADD:new Oe._Code("+")};var Hi=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},jb=class extends Hi{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Zn.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=Ua(this.rhs,e,r)),this}get names(){return this.rhs instanceof Oe._CodeOrName?this.rhs.names:{}}},dm=class extends Hi{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 Oe.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Ua(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Oe.Name?{}:{...this.lhs.names};return pm(e,this.rhs)}},Ub=class extends dm{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Hb=class extends Hi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Vb=class extends Hi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},zb=class extends Hi{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Wb=class extends Hi{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=Ua(this.code,e,r),this}get names(){return this.code instanceof Oe._CodeOrName?this.code.names:{}}},Jl=class extends Hi{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)||(CK(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>go(e,r.names),{})}},Vi=class extends Jl{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Gb=class extends Jl{},ja=class extends Vi{};ja.kind="else";var ho=class t extends Vi{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 ja(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(XL(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=Ua(this.condition,e,r),this}get names(){let e=super.names;return pm(e,this.condition),this.else&&go(e,this.else.names),e}};ho.kind="if";var mo=class extends Vi{};mo.kind="for";var Kb=class extends mo{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=Ua(this.iteration,e,r),this}get names(){return go(super.names,this.iteration.names)}},Yb=class extends mo{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?Zn.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=pm(super.names,this.from);return pm(e,this.to)}},fm=class extends mo{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=Ua(this.iterable,e,r),this}get names(){return go(super.names,this.iterable.names)}},Ql=class extends Vi{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)}};Ql.kind="func";var Zl=class extends Jl{render(e){return"return "+super.render(e)}};Zl.kind="return";var Xb=class extends Vi{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&&go(e,this.catch.names),this.finally&&go(e,this.finally.names),e}},eu=class extends Vi{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};eu.kind="catch";var tu=class extends Vi{render(e){return"finally"+super.render(e)}};tu.kind="finally";var Jb=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
176
|
+
`:""},this._extScope=e,this._scope=new Zn.Scope({parent:e}),this._nodes=[new Gb]}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 jb(e,s,n)),s}const(e,r,n){return this._def(Zn.varKinds.const,e,r,n)}let(e,r,n){return this._def(Zn.varKinds.let,e,r,n)}var(e,r,n){return this._def(Zn.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new dm(e,r,n))}add(e,r){return this._leafNode(new Ub(e,_e.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Oe.nil&&this._leafNode(new Wb(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,Oe.addCodeArg)(r,i));return r.push("}"),new Oe._Code(r)}if(e,r,n){if(this._blockNode(new ho(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 ho(e))}else(){return this._elseNode(new ja)}endIf(){return this._endBlockNode(ho,ja)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Kb(e),r)}forRange(e,r,n,i,s=this.opts.es5?Zn.varKinds.var:Zn.varKinds.let){let o=this._scope.toName(e);return this._for(new Yb(s,o,r,n),()=>i(o))}forOf(e,r,n,i=Zn.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=r instanceof Oe.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Oe._)`${o}.length`,a=>{this.var(s,(0,Oe._)`${o}[${a}]`),n(s)})}return this._for(new fm("of",i,s,r),()=>n(s))}forIn(e,r,n,i=this.opts.es5?Zn.varKinds.var:Zn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Oe._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new fm("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(mo)}label(e){return this._leafNode(new Hb(e))}break(e){return this._leafNode(new Vb(e))}return(e){let r=new Zl;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Zl)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new Xb;if(this._blockNode(i),this.code(e),r){let s=this.name("e");this._currNode=i.catch=new eu(s),r(s)}return n&&(this._currNode=i.finally=new tu,this.code(n)),this._endBlockNode(eu,tu)}throw(e){return this._leafNode(new zb(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=Oe.nil,n,i){return this._blockNode(new Ql(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Ql)}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 ho))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}};_e.CodeGen=Jb;function go(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function pm(t,e){return e instanceof Oe._CodeOrName?go(t,e.names):t}function Ua(t,e,r){if(t instanceof Oe.Name)return n(t);if(!i(t))return t;return new Oe._Code(t._items.reduce((s,o)=>(o instanceof Oe.Name&&(o=n(o)),o instanceof Oe._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 Oe._Code&&s._items.some(o=>o instanceof Oe.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function CK(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function XL(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Oe._)`!${Qb(t)}`}_e.not=XL;var DK=JL(_e.operators.AND);function AK(...t){return t.reduce(DK)}_e.and=AK;var IK=JL(_e.operators.OR);function OK(...t){return t.reduce(IK)}_e.or=OK;function JL(t){return(e,r)=>e===Oe.nil?r:r===Oe.nil?e:(0,Oe._)`${Qb(e)} ${t} ${Qb(r)}`}function Qb(t){return t instanceof Oe.Name?t:(0,Oe._)`(${t})`}});var Ee=R(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.checkStrictMode=ke.getErrorPath=ke.Type=ke.useFunc=ke.setEvaluated=ke.evaluatedPropsToName=ke.mergeEvaluated=ke.eachItem=ke.unescapeJsonPointer=ke.escapeJsonPointer=ke.escapeFragment=ke.unescapeFragment=ke.schemaRefOrVal=ke.schemaHasRulesButRef=ke.schemaHasRules=ke.checkUnknownRules=ke.alwaysValidSchema=ke.toHash=void 0;var ct=Te(),MK=Xl();function xK(t){let e={};for(let r of t)e[r]=!0;return e}ke.toHash=xK;function LK(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(eq(t,e),!tq(e,t.self.RULES.all))}ke.alwaysValidSchema=LK;function eq(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]||iq(t,`unknown keyword: "${s}"`)}ke.checkUnknownRules=eq;function tq(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}ke.schemaHasRules=tq;function qK(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}ke.schemaHasRulesButRef=qK;function $K({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ct._)`${r}`}return(0,ct._)`${t}${e}${(0,ct.getProperty)(n)}`}ke.schemaRefOrVal=$K;function BK(t){return rq(decodeURIComponent(t))}ke.unescapeFragment=BK;function FK(t){return encodeURIComponent(eS(t))}ke.escapeFragment=FK;function eS(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}ke.escapeJsonPointer=eS;function rq(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}ke.unescapeJsonPointer=rq;function jK(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}ke.eachItem=jK;function QL({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,s,o,a)=>{let c=o===void 0?s:o instanceof ct.Name?(s instanceof ct.Name?t(i,s,o):e(i,s,o),o):s instanceof ct.Name?(e(i,o,s),s):r(s,o);return a===ct.Name&&!(c instanceof ct.Name)?n(i,c):c}}ke.mergeEvaluated={props:QL({mergeNames:(t,e,r)=>t.if((0,ct._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,ct._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,ct._)`${r} || {}`).code((0,ct._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,ct._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,ct._)`${r} || {}`),tS(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:nq}),items:QL({mergeNames:(t,e,r)=>t.if((0,ct._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,ct._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,ct._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,ct._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function nq(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,ct._)`{}`);return e!==void 0&&tS(t,r,e),r}ke.evaluatedPropsToName=nq;function tS(t,e,r){Object.keys(r).forEach(n=>t.assign((0,ct._)`${e}${(0,ct.getProperty)(n)}`,!0))}ke.setEvaluated=tS;var ZL={};function UK(t,e){return t.scopeValue("func",{ref:e,code:ZL[e.code]||(ZL[e.code]=new MK._Code(e.code))})}ke.useFunc=UK;var Zb;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Zb||(ke.Type=Zb={}));function HK(t,e,r){if(t instanceof ct.Name){let n=e===Zb.Num;return r?n?(0,ct._)`"[" + ${t} + "]"`:(0,ct._)`"['" + ${t} + "']"`:n?(0,ct._)`"/" + ${t}`:(0,ct._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ct.getProperty)(t).toString():"/"+eS(t)}ke.getErrorPath=HK;function iq(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}ke.checkStrictMode=iq});var wn=R(rS=>{"use strict";Object.defineProperty(rS,"__esModule",{value:!0});var Tr=Te(),VK={data:new Tr.Name("data"),valCxt:new Tr.Name("valCxt"),instancePath:new Tr.Name("instancePath"),parentData:new Tr.Name("parentData"),parentDataProperty:new Tr.Name("parentDataProperty"),rootData:new Tr.Name("rootData"),dynamicAnchors:new Tr.Name("dynamicAnchors"),vErrors:new Tr.Name("vErrors"),errors:new Tr.Name("errors"),this:new Tr.Name("this"),self:new Tr.Name("self"),scope:new Tr.Name("scope"),json:new Tr.Name("json"),jsonPos:new Tr.Name("jsonPos"),jsonLen:new Tr.Name("jsonLen"),jsonPart:new Tr.Name("jsonPart")};rS.default=VK});var ru=R(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.extendErrors=vr.resetErrorsCount=vr.reportExtraError=vr.reportError=vr.keyword$DataError=vr.keywordError=void 0;var $e=Te(),mm=Ee(),wr=wn();vr.keywordError={message:({keyword:t})=>(0,$e.str)`must pass "${t}" keyword validation`};vr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,$e.str)`"${t}" keyword must be ${e} ($data)`:(0,$e.str)`"${t}" keyword is invalid ($data)`};function zK(t,e=vr.keywordError,r,n){let{it:i}=t,{gen:s,compositeRule:o,allErrors:a}=i,c=aq(t,e,r);n??(o||a)?sq(s,c):oq(i,(0,$e._)`[${c}]`)}vr.reportError=zK;function WK(t,e=vr.keywordError,r){let{it:n}=t,{gen:i,compositeRule:s,allErrors:o}=n,a=aq(t,e,r);sq(i,a),s||o||oq(n,wr.default.vErrors)}vr.reportExtraError=WK;function GK(t,e){t.assign(wr.default.errors,e),t.if((0,$e._)`${wr.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,$e._)`${wr.default.vErrors}.length`,e),()=>t.assign(wr.default.vErrors,null)))}vr.resetErrorsCount=GK;function KK({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,wr.default.errors,a=>{t.const(o,(0,$e._)`${wr.default.vErrors}[${a}]`),t.if((0,$e._)`${o}.instancePath === undefined`,()=>t.assign((0,$e._)`${o}.instancePath`,(0,$e.strConcat)(wr.default.instancePath,s.errorPath))),t.assign((0,$e._)`${o}.schemaPath`,(0,$e.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,$e._)`${o}.schema`,r),t.assign((0,$e._)`${o}.data`,n))})}vr.extendErrors=KK;function sq(t,e){let r=t.const("err",e);t.if((0,$e._)`${wr.default.vErrors} === null`,()=>t.assign(wr.default.vErrors,(0,$e._)`[${r}]`),(0,$e._)`${wr.default.vErrors}.push(${r})`),t.code((0,$e._)`${wr.default.errors}++`)}function oq(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,$e._)`new ${t.ValidationError}(${e})`):(r.assign((0,$e._)`${n}.errors`,e),r.return(!1))}var yo={keyword:new $e.Name("keyword"),schemaPath:new $e.Name("schemaPath"),params:new $e.Name("params"),propertyName:new $e.Name("propertyName"),message:new $e.Name("message"),schema:new $e.Name("schema"),parentSchema:new $e.Name("parentSchema")};function aq(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,$e._)`{}`:YK(t,e,r)}function YK(t,e,r={}){let{gen:n,it:i}=t,s=[XK(i,r),JK(t,r)];return QK(t,e,s),n.object(...s)}function XK({errorPath:t},{instancePath:e}){let r=e?(0,$e.str)`${t}${(0,mm.getErrorPath)(e,mm.Type.Str)}`:t;return[wr.default.instancePath,(0,$e.strConcat)(wr.default.instancePath,r)]}function JK({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,$e.str)`${e}/${t}`;return r&&(i=(0,$e.str)`${i}${(0,mm.getErrorPath)(r,mm.Type.Str)}`),[yo.schemaPath,i]}function QK(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([yo.keyword,i],[yo.params,typeof e=="function"?e(t):e||(0,$e._)`{}`]),c.messages&&n.push([yo.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([yo.schema,o],[yo.parentSchema,(0,$e._)`${u}${d}`],[wr.default.data,s]),l&&n.push([yo.propertyName,l])}});var lq=R(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.boolOrEmptySchema=Ha.topBoolOrEmptySchema=void 0;var ZK=ru(),eY=Te(),tY=wn(),rY={message:"boolean schema is false"};function nY(t){let{gen:e,schema:r,validateName:n}=t;r===!1?cq(t,!1):typeof r=="object"&&r.$async===!0?e.return(tY.default.data):(e.assign((0,eY._)`${n}.errors`,null),e.return(!0))}Ha.topBoolOrEmptySchema=nY;function iY(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),cq(t)):r.var(e,!0)}Ha.boolOrEmptySchema=iY;function cq(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,ZK.reportError)(i,rY,void 0,e)}});var nS=R(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});Va.getRules=Va.isJSONType=void 0;var sY=["string","number","integer","boolean","null","object","array"],oY=new Set(sY);function aY(t){return typeof t=="string"&&oY.has(t)}Va.isJSONType=aY;function cY(){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:{}}}Va.getRules=cY});var iS=R(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});Cs.shouldUseRule=Cs.shouldUseGroup=Cs.schemaHasRulesForType=void 0;function lY({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&uq(t,n)}Cs.schemaHasRulesForType=lY;function uq(t,e){return e.rules.some(r=>dq(t,r))}Cs.shouldUseGroup=uq;function dq(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))}Cs.shouldUseRule=dq});var nu=R(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.reportTypeError=br.checkDataTypes=br.checkDataType=br.coerceAndCheckDataType=br.getJSONTypes=br.getSchemaTypes=br.DataType=void 0;var uY=nS(),dY=iS(),fY=ru(),ve=Te(),fq=Ee(),za;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(za||(br.DataType=za={}));function pY(t){let e=pq(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}br.getSchemaTypes=pY;function pq(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(uY.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}br.getJSONTypes=pq;function hY(t,e){let{gen:r,data:n,opts:i}=t,s=mY(e,i.coerceTypes),o=e.length>0&&!(s.length===0&&e.length===1&&(0,dY.schemaHasRulesForType)(t,e[0]));if(o){let a=oS(e,n,i.strictNumbers,za.Wrong);r.if(a,()=>{s.length?gY(t,e,s):aS(t)})}return o}br.coerceAndCheckDataType=hY;var hq=new Set(["string","number","integer","boolean","null"]);function mY(t,e){return e?t.filter(r=>hq.has(r)||e==="array"&&r==="array"):[]}function gY(t,e,r){let{gen:n,data:i,opts:s}=t,o=n.let("dataType",(0,ve._)`typeof ${i}`),a=n.let("coerced",(0,ve._)`undefined`);s.coerceTypes==="array"&&n.if((0,ve._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,ve._)`${i}[0]`).assign(o,(0,ve._)`typeof ${i}`).if(oS(e,i,s.strictNumbers),()=>n.assign(a,i))),n.if((0,ve._)`${a} !== undefined`);for(let l of r)(hq.has(l)||l==="array"&&s.coerceTypes==="array")&&c(l);n.else(),aS(t),n.endIf(),n.if((0,ve._)`${a} !== undefined`,()=>{n.assign(i,a),yY(t,a)});function c(l){switch(l){case"string":n.elseIf((0,ve._)`${o} == "number" || ${o} == "boolean"`).assign(a,(0,ve._)`"" + ${i}`).elseIf((0,ve._)`${i} === null`).assign(a,(0,ve._)`""`);return;case"number":n.elseIf((0,ve._)`${o} == "boolean" || ${i} === null
|
|
177
177
|
|| (${o} == "string" && ${i} && ${i} == +${i})`).assign(a,(0,ve._)`+${i}`);return;case"integer":n.elseIf((0,ve._)`${o} === "boolean" || ${i} === null
|
|
178
178
|
|| (${o} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(a,(0,ve._)`+${i}`);return;case"boolean":n.elseIf((0,ve._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(a,!1).elseIf((0,ve._)`${i} === "true" || ${i} === 1`).assign(a,!0);return;case"null":n.elseIf((0,ve._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(a,null);return;case"array":n.elseIf((0,ve._)`${o} === "string" || ${o} === "number"
|
|
179
|
-
|| ${o} === "boolean" || ${i} === null`).assign(a,(0,ve._)`[${i}]`)}}}function mY({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,ve._)`${e} !== undefined`,()=>t.assign((0,ve._)`${e}[${r}]`,n))}function eS(t,e,r,n=Ua.Correct){let i=n===Ua.Correct?ve.operators.EQ:ve.operators.NEQ,s;switch(t){case"null":return(0,ve._)`${e} ${i} null`;case"array":s=(0,ve._)`Array.isArray(${e})`;break;case"object":s=(0,ve._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=o((0,ve._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=o();break;default:return(0,ve._)`typeof ${e} ${i} ${t}`}return n===Ua.Correct?s:(0,ve.not)(s);function o(a=ve.nil){return(0,ve.and)((0,ve._)`typeof ${e} == "number"`,a,r?(0,ve._)`isFinite(${e})`:ve.nil)}}Tr.checkDataType=eS;function tS(t,e,r,n){if(t.length===1)return eS(t[0],e,r,n);let i,s=(0,lq.toHash)(t);if(s.array&&s.object){let o=(0,ve._)`typeof ${e} != "object"`;i=s.null?o:(0,ve._)`!${e} || ${o}`,delete s.null,delete s.array,delete s.object}else i=ve.nil;s.number&&delete s.integer;for(let o in s)i=(0,ve.and)(i,eS(o,e,r,n));return i}Tr.checkDataTypes=tS;var gY={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,ve._)`{type: ${t}}`:(0,ve._)`{type: ${e}}`};function rS(t){let e=yY(t);(0,uY.reportError)(e,gY)}Tr.reportTypeError=rS;function yY(t){let{gen:e,data:r,schema:n}=t,i=(0,lq.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var pq=R(lm=>{"use strict";Object.defineProperty(lm,"__esModule",{value:!0});lm.assignDefaults=void 0;var Ha=Te(),TY=Ee();function vY(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)fq(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,s)=>fq(t,s,i.default))}lm.assignDefaults=vY;function fq(t,e,r){let{gen:n,compositeRule:i,data:s,opts:o}=t;if(r===void 0)return;let a=(0,Ha._)`${s}${(0,Ha.getProperty)(e)}`;if(i){(0,TY.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Ha._)`${a} === undefined`;o.useDefaults==="empty"&&(c=(0,Ha._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,Ha._)`${a} = ${(0,Ha.stringify)(r)}`)}});var Rn=R(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.validateUnion=rt.validateArray=rt.usePattern=rt.callValidateCode=rt.schemaProperties=rt.allSchemaProperties=rt.noPropertyInData=rt.propertyInData=rt.isOwnProperty=rt.hasPropFunc=rt.reportMissingProp=rt.checkMissingProp=rt.checkReportMissingProp=void 0;var Tt=Te(),nS=Ee(),Es=Nn(),bY=Ee();function SY(t,e){let{gen:r,data:n,it:i}=t;r.if(sS(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Tt._)`${e}`},!0),t.error()})}rt.checkReportMissingProp=SY;function _Y({gen:t,data:e,it:{opts:r}},n,i){return(0,Tt.or)(...n.map(s=>(0,Tt.and)(sS(t,e,s,r.ownProperties),(0,Tt._)`${i} = ${s}`)))}rt.checkMissingProp=_Y;function kY(t,e){t.setParams({missingProperty:e},!0),t.error()}rt.reportMissingProp=kY;function hq(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Tt._)`Object.prototype.hasOwnProperty`})}rt.hasPropFunc=hq;function iS(t,e,r){return(0,Tt._)`${hq(t)}.call(${e}, ${r})`}rt.isOwnProperty=iS;function NY(t,e,r,n){let i=(0,Tt._)`${e}${(0,Tt.getProperty)(r)} !== undefined`;return n?(0,Tt._)`${i} && ${iS(t,e,r)}`:i}rt.propertyInData=NY;function sS(t,e,r,n){let i=(0,Tt._)`${e}${(0,Tt.getProperty)(r)} === undefined`;return n?(0,Tt.or)(i,(0,Tt.not)(iS(t,e,r))):i}rt.noPropertyInData=sS;function mq(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}rt.allSchemaProperties=mq;function RY(t,e){return mq(e).filter(r=>!(0,nS.alwaysValidSchema)(t,e[r]))}rt.schemaProperties=RY;function PY({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:s},it:o},a,c,l){let u=l?(0,Tt._)`${t}, ${e}, ${n}${i}`:e,d=[[Es.default.instancePath,(0,Tt.strConcat)(Es.default.instancePath,s)],[Es.default.parentData,o.parentData],[Es.default.parentDataProperty,o.parentDataProperty],[Es.default.rootData,Es.default.rootData]];o.opts.dynamicRef&&d.push([Es.default.dynamicAnchors,Es.default.dynamicAnchors]);let f=(0,Tt._)`${u}, ${r.object(...d)}`;return c!==Tt.nil?(0,Tt._)`${a}.call(${c}, ${f})`:(0,Tt._)`${a}(${f})`}rt.callValidateCode=PY;var wY=(0,Tt._)`new RegExp`;function EY({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,Tt._)`${i.code==="new RegExp"?wY:(0,bY.useFunc)(t,i)}(${r}, ${n})`})}rt.usePattern=EY;function CY(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,Tt._)`${r}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:n,dataProp:l,dataPropType:nS.Type.Num},s),e.if((0,Tt.not)(s),a)})}}rt.validateArray=CY;function DY(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,nS.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,Tt._)`${o} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,Tt.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}rt.validateUnion=DY});var Tq=R(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.validateKeywordUsage=yi.validSchemaType=yi.funcKeywordCode=yi.macroKeywordCode=void 0;var Pr=Te(),ho=Nn(),AY=Rn(),IY=Zl();function OY(t,e){let{gen:r,keyword:n,schema:i,parentSchema:s,it:o}=t,a=e.macro.call(o.self,i,s,o),c=yq(r,n,a);o.opts.validateSchema!==!1&&o.self.validateSchema(a,!0);let l=r.name("valid");t.subschema({schema:a,schemaPath:Pr.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}yi.macroKeywordCode=OY;function MY(t,e){var r;let{gen:n,keyword:i,schema:s,parentSchema:o,$data:a,it:c}=t;LY(c,e);let l=!a&&e.compile?e.compile.call(c.self,s,o,c):e.validate,u=yq(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&&gq(t),T(()=>t.error());else{let b=e.async?p():m();e.modifying&&gq(t),T(()=>xY(t,b))}}function p(){let b=n.let("ruleErrs",null);return n.try(()=>h((0,Pr._)`await `),S=>n.assign(d,!1).if((0,Pr._)`${S} instanceof ${c.ValidationError}`,()=>n.assign(b,(0,Pr._)`${S}.errors`),()=>n.throw(S))),b}function m(){let b=(0,Pr._)`${u}.errors`;return n.assign(b,null),h(Pr.nil),b}function h(b=e.async?(0,Pr._)`await `:Pr.nil){let S=c.opts.passContext?ho.default.this:ho.default.self,v=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Pr._)`${b}${(0,AY.callValidateCode)(t,u,S,v)}`,e.modifying)}function T(b){var S;n.if((0,Pr.not)((S=e.valid)!==null&&S!==void 0?S:d),b)}}yi.funcKeywordCode=MY;function gq(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Pr._)`${n.parentData}[${n.parentDataProperty}]`))}function xY(t,e){let{gen:r}=t;r.if((0,Pr._)`Array.isArray(${e})`,()=>{r.assign(ho.default.vErrors,(0,Pr._)`${ho.default.vErrors} === null ? ${e} : ${ho.default.vErrors}.concat(${e})`).assign(ho.default.errors,(0,Pr._)`${ho.default.vErrors}.length`),(0,IY.extendErrors)(t)},()=>t.error())}function LY({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function yq(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,Pr.stringify)(r)})}function qY(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")}yi.validSchemaType=qY;function $Y({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)}}yi.validateKeywordUsage=$Y});var bq=R(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});Cs.extendSubschemaMode=Cs.extendSubschemaData=Cs.getSubschema=void 0;var Ti=Te(),vq=Ee();function BY(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,Ti._)`${t.schemaPath}${(0,Ti.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Ti._)`${t.schemaPath}${(0,Ti.getProperty)(e)}${(0,Ti.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,vq.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')}Cs.getSubschema=BY;function FY(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,Ti._)`${e.data}${(0,Ti.getProperty)(r)}`,!0);c(f),t.errorPath=(0,Ti.str)`${l}${(0,vq.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ti._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let l=i instanceof Ti.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]}}Cs.extendSubschemaData=FY;function jY(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}Cs.extendSubschemaMode=jY});var oS=R((iPe,Sq)=>{"use strict";Sq.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 kq=R((sPe,_q)=>{"use strict";var Ds=_q.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(){};um(e,n,i,t,"",t)};Ds.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ds.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ds.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ds.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 um(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 Ds.arrayKeywords)for(var f=0;f<d.length;f++)um(t,e,r,d[f],i+"/"+u+"/"+f,s,i,u,n,f)}else if(u in Ds.propsKeywords){if(d&&typeof d=="object")for(var p in d)um(t,e,r,d[p],i+"/"+u+"/"+UY(p),s,i,u,n,p)}else(u in Ds.keywords||t.allKeys&&!(u in Ds.skipKeywords))&&um(t,e,r,d,i+"/"+u,s,i,u,n)}r(n,i,s,o,a,c,l)}}function UY(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var tu=R(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.getSchemaRefs=Ur.resolveUrl=Ur.normalizeId=Ur._getFullPath=Ur.getFullPath=Ur.inlineRef=void 0;var HY=Ee(),VY=oS(),zY=kq(),WY=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function GY(t,e=!0){return typeof t=="boolean"?!0:e===!0?!aS(t):e?Nq(t)<=e:!1}Ur.inlineRef=GY;var KY=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function aS(t){for(let e in t){if(KY.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(aS)||typeof r=="object"&&aS(r))return!0}return!1}function Nq(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!WY.has(r)&&(typeof t[r]=="object"&&(0,HY.eachItem)(t[r],n=>e+=Nq(n)),e===1/0))return 1/0}return e}function Rq(t,e="",r){r!==!1&&(e=Va(e));let n=t.parse(e);return Pq(t,n)}Ur.getFullPath=Rq;function Pq(t,e){return t.serialize(e).split("#")[0]+"#"}Ur._getFullPath=Pq;var YY=/#\/?$/;function Va(t){return t?t.replace(YY,""):""}Ur.normalizeId=Va;function XY(t,e,r){return r=Va(r),t.resolve(e,r)}Ur.resolveUrl=XY;var JY=/^[a-z_][-a-z0-9._]*$/i;function QY(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=Va(t[r]||e),s={"":i},o=Rq(n,i,!1),a={},c=new Set;return zY(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=o+f,T=s[m];typeof d[r]=="string"&&(T=b.call(this,d[r])),S.call(this,d.$anchor),S.call(this,d.$dynamicAnchor),s[f]=T;function b(v){let N=this.opts.uriResolver.resolve;if(v=Va(T?N(T,v):v),c.has(v))throw u(v);c.add(v);let C=this.refs[v];return typeof C=="string"&&(C=this.refs[C]),typeof C=="object"?l(d,C.schema,v):v!==Va(h)&&(v[0]==="#"?(l(d,a[v],v),a[v]=d):this.refs[v]=h),v}function S(v){if(typeof v=="string"){if(!JY.test(v))throw new Error(`invalid anchor "${v}"`);b.call(this,`#${v}`)}}}),a;function l(d,f,p){if(f!==void 0&&!VY(d,f))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ur.getSchemaRefs=QY});var iu=R(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.getData=As.KeywordCxt=As.validateFunctionCode=void 0;var Aq=oq(),wq=eu(),lS=Zb(),dm=eu(),ZY=pq(),nu=Tq(),cS=bq(),se=Te(),he=Nn(),e3=tu(),Hi=Ee(),ru=Zl();function t3(t){if(Mq(t)&&(xq(t),Oq(t))){i3(t);return}Iq(t,()=>(0,Aq.topBoolOrEmptySchema)(t))}As.validateFunctionCode=t3;function Iq({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},s){i.code.es5?t.func(e,(0,se._)`${he.default.data}, ${he.default.valCxt}`,n.$async,()=>{t.code((0,se._)`"use strict"; ${Eq(r,i)}`),n3(t,i),t.code(s)}):t.func(e,(0,se._)`${he.default.data}, ${r3(i)}`,n.$async,()=>t.code(Eq(r,i)).code(s))}function r3(t){return(0,se._)`{${he.default.instancePath}="", ${he.default.parentData}, ${he.default.parentDataProperty}, ${he.default.rootData}=${he.default.data}${t.dynamicRef?(0,se._)`, ${he.default.dynamicAnchors}={}`:se.nil}}={}`}function n3(t,e){t.if(he.default.valCxt,()=>{t.var(he.default.instancePath,(0,se._)`${he.default.valCxt}.${he.default.instancePath}`),t.var(he.default.parentData,(0,se._)`${he.default.valCxt}.${he.default.parentData}`),t.var(he.default.parentDataProperty,(0,se._)`${he.default.valCxt}.${he.default.parentDataProperty}`),t.var(he.default.rootData,(0,se._)`${he.default.valCxt}.${he.default.rootData}`),e.dynamicRef&&t.var(he.default.dynamicAnchors,(0,se._)`${he.default.valCxt}.${he.default.dynamicAnchors}`)},()=>{t.var(he.default.instancePath,(0,se._)`""`),t.var(he.default.parentData,(0,se._)`undefined`),t.var(he.default.parentDataProperty,(0,se._)`undefined`),t.var(he.default.rootData,he.default.data),e.dynamicRef&&t.var(he.default.dynamicAnchors,(0,se._)`{}`)})}function i3(t){let{schema:e,opts:r,gen:n}=t;Iq(t,()=>{r.$comment&&e.$comment&&qq(t),l3(t),n.let(he.default.vErrors,null),n.let(he.default.errors,0),r.unevaluated&&s3(t),Lq(t),f3(t)})}function s3(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,se._)`${r}.evaluated`),e.if((0,se._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,se._)`${t.evaluated}.props`,(0,se._)`undefined`)),e.if((0,se._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,se._)`${t.evaluated}.items`,(0,se._)`undefined`))}function Eq(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,se._)`/*# sourceURL=${r} */`:se.nil}function o3(t,e){if(Mq(t)&&(xq(t),Oq(t))){a3(t,e);return}(0,Aq.boolOrEmptySchema)(t,e)}function Oq({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 Mq(t){return typeof t.schema!="boolean"}function a3(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&qq(t),u3(t),d3(t);let s=n.const("_errs",he.default.errors);Lq(t,s),n.var(e,(0,se._)`${s} === ${he.default.errors}`)}function xq(t){(0,Hi.checkUnknownRules)(t),c3(t)}function Lq(t,e){if(t.opts.jtd)return Cq(t,[],!1,e);let r=(0,wq.getSchemaTypes)(t.schema),n=(0,wq.coerceAndCheckDataType)(t,r);Cq(t,r,!n,e)}function c3(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Hi.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function l3(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Hi.checkStrictMode)(t,"default is ignored in the schema root")}function u3(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,e3.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function d3(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function qq({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let s=r.$comment;if(i.$comment===!0)t.code((0,se._)`${he.default.self}.logger.log(${s})`);else if(typeof i.$comment=="function"){let o=(0,se.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,se._)`${he.default.self}.opts.$comment(${s}, ${o}, ${a}.schema)`)}}function f3(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:s}=t;r.$async?e.if((0,se._)`${he.default.errors} === 0`,()=>e.return(he.default.data),()=>e.throw((0,se._)`new ${i}(${he.default.vErrors})`)):(e.assign((0,se._)`${n}.errors`,he.default.vErrors),s.unevaluated&&p3(t),e.return((0,se._)`${he.default.errors} === 0`))}function p3({gen:t,evaluated:e,props:r,items:n}){r instanceof se.Name&&t.assign((0,se._)`${e}.props`,r),n instanceof se.Name&&t.assign((0,se._)`${e}.items`,n)}function Cq(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,Hi.schemaHasRulesButRef)(s,u))){i.block(()=>Bq(t,"$ref",u.all.$ref.definition));return}c.jtd||h3(t,e),i.block(()=>{for(let f of u.rules)d(f);d(u.post)});function d(f){(0,lS.shouldUseGroup)(s,f)&&(f.type?(i.if((0,dm.checkDataType)(f.type,o,c.strictNumbers)),Dq(t,f),e.length===1&&e[0]===f.type&&r&&(i.else(),(0,dm.reportTypeError)(t)),i.endIf()):Dq(t,f),a||i.if((0,se._)`${he.default.errors} === ${n||0}`))}}function Dq(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,ZY.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,lS.shouldUseRule)(n,s)&&Bq(t,s.keyword,s.definition,e.type)})}function h3(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(m3(t,e),t.opts.allowUnionTypes||g3(t,e),y3(t,t.dataTypes))}function m3(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{$q(t.dataTypes,r)||uS(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),v3(t,e)}}function g3(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&uS(t,"use allowUnionTypes to allow union type keyword")}function y3(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,lS.shouldUseRule)(t.schema,i)){let{type:s}=i.definition;s.length&&!s.some(o=>T3(e,o))&&uS(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function T3(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function $q(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function v3(t,e){let r=[];for(let n of t.dataTypes)$q(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function uS(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Hi.checkStrictMode)(t,e,t.opts.strictTypes)}var fm=class{constructor(e,r,n){if((0,nu.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,Hi.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",Fq(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,nu.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",he.default.errors))}result(e,r,n){this.failResult((0,se.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,se.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,se._)`${r} !== undefined && (${(0,se.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?ru.reportExtraError:ru.reportError)(this,this.def.error,r)}$dataError(){(0,ru.reportError)(this,this.def.$dataError||ru.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ru.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=se.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=se.nil,r=se.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:s,def:o}=this;n.if((0,se.or)((0,se._)`${i} === undefined`,r)),e!==se.nil&&n.assign(e,!0),(s.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==se.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:s}=this;return(0,se.or)(o(),a());function o(){if(n.length){if(!(r instanceof se.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,se._)`${(0,dm.checkDataTypes)(c,r,s.opts.strictNumbers,dm.DataType.Wrong)}`}return se.nil}function a(){if(i.validateSchema){let c=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,se._)`!${c}(${r})`}return se.nil}}subschema(e,r){let n=(0,cS.getSubschema)(this.it,e);(0,cS.extendSubschemaData)(n,this.it,e),(0,cS.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return o3(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Hi.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Hi.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,se.Name)),!0}};As.KeywordCxt=fm;function Bq(t,e,r,n){let i=new fm(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,nu.funcKeywordCode)(i,r):"macro"in r?(0,nu.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,nu.funcKeywordCode)(i,r)}var b3=/^\/(?:[^~]|~0|~1)*$/,S3=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Fq(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,s;if(t==="")return he.default.rootData;if(t[0]==="/"){if(!b3.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,s=he.default.rootData}else{let l=S3.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,se._)`${s}${(0,se.getProperty)((0,Hi.unescapeJsonPointer)(l))}`,o=(0,se._)`${o} && ${s}`);return o;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${e}`}}As.getData=Fq});var pm=R(fS=>{"use strict";Object.defineProperty(fS,"__esModule",{value:!0});var dS=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};fS.default=dS});var su=R(mS=>{"use strict";Object.defineProperty(mS,"__esModule",{value:!0});var pS=tu(),hS=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,pS.resolveUrl)(e,r,n),this.missingSchema=(0,pS.normalizeId)((0,pS.getFullPath)(e,this.missingRef))}};mS.default=hS});var ou=R(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.resolveSchema=Pn.getCompilingSchema=Pn.resolveRef=Pn.compileSchema=Pn.SchemaEnv=void 0;var Xn=Te(),_3=pm(),mo=Nn(),Jn=tu(),jq=Ee(),k3=iu(),za=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,Jn.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Pn.SchemaEnv=za;function yS(t){let e=Uq.call(this,t);if(e)return e;let r=(0,Jn.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new Xn.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),a;t.$async&&(a=o.scopeValue("Error",{ref:_3.default,code:(0,Xn._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");t.validateName=c;let l={gen:o,allErrors:this.opts.allErrors,data:mo.default.data,parentData:mo.default.parentData,parentDataProperty:mo.default.parentDataProperty,dataNames:[mo.default.data],dataPathArr:[Xn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Xn.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Xn.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Xn._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,k3.validateFunctionCode)(l),o.optimize(this.opts.code.optimize);let d=o.toString();u=`${o.scopeRefs(mo.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${mo.default.self}`,`${mo.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 Xn.Name?void 0:m,items:h instanceof Xn.Name?void 0:h,dynamicProps:m instanceof Xn.Name,dynamicItems:h instanceof Xn.Name},p.source&&(p.source.evaluated=(0,Xn.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)}}Pn.compileSchema=yS;function N3(t,e,r){var n;r=(0,Jn.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let s=w3.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 za({schema:o,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=R3.call(this,s)}Pn.resolveRef=N3;function R3(t){return(0,Jn.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:yS.call(this,t)}function Uq(t){for(let e of this._compilations)if(P3(e,t))return e}Pn.getCompilingSchema=Uq;function P3(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function w3(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||hm.call(this,t,e)}function hm(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Jn._getFullPath)(this.opts.uriResolver,r),i=(0,Jn.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return gS.call(this,r,t);let s=(0,Jn.normalizeId)(n),o=this.refs[s]||this.schemas[s];if(typeof o=="string"){let a=hm.call(this,t,o);return typeof a?.schema!="object"?void 0:gS.call(this,r,a)}if(typeof o?.schema=="object"){if(o.validate||yS.call(this,o),s===(0,Jn.normalizeId)(e)){let{schema:a}=o,{schemaId:c}=this.opts,l=a[c];return l&&(i=(0,Jn.resolveUrl)(this.opts.uriResolver,i,l)),new za({schema:a,schemaId:c,root:t,baseId:i})}return gS.call(this,r,o)}}Pn.resolveSchema=hm;var E3=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function gS(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,jq.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!E3.has(a)&&l&&(e=(0,Jn.resolveUrl)(this.opts.uriResolver,e,l))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,jq.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Jn.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=hm.call(this,n,a)}let{schemaId:o}=this.opts;if(s=s||new za({schema:r,schemaId:o,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var Hq=R((dPe,C3)=>{C3.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 zq=R((fPe,Vq)=>{"use strict";var D3={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Vq.exports={HEX:D3}});var Zq=R((pPe,Qq)=>{"use strict";var{HEX:A3}=zq(),I3=/^(?:(?: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;function Yq(t){if(Jq(t,".")<3)return{host:t,isIPV4:!1};let e=t.match(I3)||[],[r]=e;return r?{host:M3(r,"."),isIPV4:!0}:{host:t,isIPV4:!1}}function TS(t,e=!1){let r="",n=!0;for(let i of t){if(A3[i]===void 0)return;i!=="0"&&n===!0&&(n=!1),n||(r+=i)}return e&&r.length===0&&(r="0"),r}function O3(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],s=!1,o=!1,a=!1;function c(){if(i.length){if(s===!1){let l=TS(i);if(l!==void 0)n.push(l);else return r.error=!0,!1}i.length=0}return!0}for(let l=0;l<t.length;l++){let u=t[l];if(!(u==="["||u==="]"))if(u===":"){if(o===!0&&(a=!0),!c())break;if(e++,n.push(":"),e>7){r.error=!0;break}l-1>=0&&t[l-1]===":"&&(o=!0);continue}else if(u==="%"){if(!c())break;s=!0}else{i.push(u);continue}}return i.length&&(s?r.zone=i.join(""):a?n.push(i.join("")):n.push(TS(i))),r.address=n.join(""),r}function Xq(t){if(Jq(t,":")<2)return{host:t,isIPV6:!1};let e=O3(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,escapedHost:n,isIPV6:!0}}}function M3(t,e){let r="",n=!0,i=t.length;for(let s=0;s<i;s++){let o=t[s];o==="0"&&n?(s+1<=i&&t[s+1]===e||s+1===i)&&(r+=o,n=!1):(o===e?n=!0:n=!1,r+=o)}return r}function Jq(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}var Wq=/^\.\.?\//u,Gq=/^\/\.(?:\/|$)/u,Kq=/^\/\.\.(?:\/|$)/u,x3=/^\/?(?:.|\n)*?(?=\/|$)/u;function L3(t){let e=[];for(;t.length;)if(t.match(Wq))t=t.replace(Wq,"");else if(t.match(Gq))t=t.replace(Gq,"/");else if(t.match(Kq))t=t.replace(Kq,"/"),e.pop();else if(t==="."||t==="..")t="";else{let r=t.match(x3);if(r){let n=r[0];t=t.slice(n.length),e.push(n)}else throw new Error("Unexpected dot segment condition")}return e.join("")}function q3(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function $3(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host),n=Yq(r);if(n.isIPV4)r=n.host;else{let i=Xq(n.host);i.isIPV6===!0?r=`[${i.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}Qq.exports={recomposeAuthority:$3,normalizeComponentEncoding:q3,removeDotSegments:L3,normalizeIPv4:Yq,normalizeIPv6:Xq,stringArrayToHexStripped:TS}});var s1=R((hPe,i1)=>{"use strict";var B3=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,F3=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function e1(t){return typeof t.secure=="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}function t1(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function r1(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 j3(t){return t.secure=e1(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function U3(t){if((t.port===(e1(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,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function H3(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(F3);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,s=vS[i];t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function V3(t,e){let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,s=vS[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 z3(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!B3.test(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function W3(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var n1={scheme:"http",domainHost:!0,parse:t1,serialize:r1},G3={scheme:"https",domainHost:n1.domainHost,parse:t1,serialize:r1},mm={scheme:"ws",domainHost:!0,parse:j3,serialize:U3},K3={scheme:"wss",domainHost:mm.domainHost,parse:mm.parse,serialize:mm.serialize},Y3={scheme:"urn",parse:H3,serialize:V3,skipNormalize:!0},X3={scheme:"urn:uuid",parse:z3,serialize:W3,skipNormalize:!0},vS={http:n1,https:G3,ws:mm,wss:K3,urn:Y3,"urn:uuid":X3};i1.exports=vS});var a1=R((mPe,ym)=>{"use strict";var{normalizeIPv6:J3,normalizeIPv4:Q3,removeDotSegments:au,recomposeAuthority:Z3,normalizeComponentEncoding:gm}=Zq(),bS=s1();function eX(t,e){return typeof t=="string"?t=vi(Vi(t,e),e):typeof t=="object"&&(t=Vi(vi(t,e),e)),t}function tX(t,e,r){let n=Object.assign({scheme:"null"},r),i=o1(Vi(t,n),Vi(e,n),n,!0);return vi(i,{...n,skipEscape:!0})}function o1(t,e,r,n){let i={};return n||(t=Vi(vi(t,r),r),e=Vi(vi(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=au(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=au(e.path||""),i.query=e.query):(e.path?(e.path.charAt(0)==="/"?i.path=au(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=au(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 rX(t,e,r){return typeof t=="string"?(t=unescape(t),t=vi(gm(Vi(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=vi(gm(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=vi(gm(Vi(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=vi(gm(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function vi(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=[],s=bS[(n.scheme||r.scheme||"").toLowerCase()];s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let o=Z3(r);if(o!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(o),r.path&&r.path.charAt(0)!=="/"&&i.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=au(a)),o===void 0&&(a=a.replace(/^\/\//u,"/%2F")),i.push(a)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var nX=Array.from({length:127},(t,e)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(e)));function iX(t){let e=0;for(let r=0,n=t.length;r<n;++r)if(e=t.charCodeAt(r),e>126||nX[e])return!0;return!1}var sX=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Vi(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=t.indexOf("%")!==-1,s=!1;r.reference==="suffix"&&(t=(r.scheme?r.scheme+":":"")+"//"+t);let o=t.match(sX);if(o){if(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]),n.host){let c=Q3(n.host);if(c.isIPV4===!1){let l=J3(c.host);n.host=l.host.toLowerCase(),s=l.isIPV6}else n.host=c.host,s=!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 a=bS[(r.scheme||n.scheme||"").toLowerCase()];if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&s===!1&&iX(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(c){n.error=n.error||"Host's domain name can not be converted to ASCII: "+c}(!a||a&&!a.skipNormalize)&&(i&&n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),i&&n.host!==void 0&&(n.host=unescape(n.host)),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var SS={SCHEMES:bS,normalize:eX,resolve:tX,resolveComponents:o1,equal:rX,serialize:vi,parse:Vi};ym.exports=SS;ym.exports.default=SS;ym.exports.fastUri=SS});var l1=R(_S=>{"use strict";Object.defineProperty(_S,"__esModule",{value:!0});var c1=a1();c1.code='require("ajv/dist/runtime/uri").default';_S.default=c1});var y1=R(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.CodeGen=ir.Name=ir.nil=ir.stringify=ir.str=ir._=ir.KeywordCxt=void 0;var oX=iu();Object.defineProperty(ir,"KeywordCxt",{enumerable:!0,get:function(){return oX.KeywordCxt}});var Wa=Te();Object.defineProperty(ir,"_",{enumerable:!0,get:function(){return Wa._}});Object.defineProperty(ir,"str",{enumerable:!0,get:function(){return Wa.str}});Object.defineProperty(ir,"stringify",{enumerable:!0,get:function(){return Wa.stringify}});Object.defineProperty(ir,"nil",{enumerable:!0,get:function(){return Wa.nil}});Object.defineProperty(ir,"Name",{enumerable:!0,get:function(){return Wa.Name}});Object.defineProperty(ir,"CodeGen",{enumerable:!0,get:function(){return Wa.CodeGen}});var aX=pm(),h1=su(),cX=Qb(),cu=ou(),lX=Te(),lu=tu(),Tm=eu(),NS=Ee(),u1=Hq(),uX=l1(),m1=(t,e)=>new RegExp(t,e);m1.code="new RegExp";var dX=["removeAdditional","useDefaults","coerceTypes"],fX=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),pX={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."},hX={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},d1=200;function mX(t){var e,r,n,i,s,o,a,c,l,u,d,f,p,m,h,T,b,S,v,N,C,H,M,F,De;let lt=t.strict,Ht=(e=t.code)===null||e===void 0?void 0:e.optimize,Ne=Ht===!0||Ht===void 0?1:Ht||0,tn=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:m1,zi=(i=t.uriResolver)!==null&&i!==void 0?i:uX.default;return{strictSchema:(o=(s=t.strictSchema)!==null&&s!==void 0?s:lt)!==null&&o!==void 0?o:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:lt)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=t.strictTypes)!==null&&l!==void 0?l:lt)!==null&&u!==void 0?u:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:lt)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:lt)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:Ne,regExp:tn}:{optimize:Ne,regExp:tn},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:d1,loopEnum:(T=t.loopEnum)!==null&&T!==void 0?T:d1,meta:(b=t.meta)!==null&&b!==void 0?b:!0,messages:(S=t.messages)!==null&&S!==void 0?S:!0,inlineRefs:(v=t.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(N=t.schemaId)!==null&&N!==void 0?N:"$id",addUsedSchema:(C=t.addUsedSchema)!==null&&C!==void 0?C:!0,validateSchema:(H=t.validateSchema)!==null&&H!==void 0?H:!0,validateFormats:(M=t.validateFormats)!==null&&M!==void 0?M:!0,unicodeRegExp:(F=t.unicodeRegExp)!==null&&F!==void 0?F:!0,int32range:(De=t.int32range)!==null&&De!==void 0?De:!0,uriResolver:zi}}var uu=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...mX(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new lX.ValueScope({scope:{},prefixes:fX,es5:r,lines:n}),this.logger=SX(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,cX.getRules)(),f1.call(this,pX,e,"NOT SUPPORTED"),f1.call(this,hX,e,"DEPRECATED","warn"),this._metaOpts=vX.call(this),e.formats&&yX.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&TX.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),gX.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=u1;n==="id"&&(i={...u1},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 h1.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,lu.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=p1.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new cu.SchemaEnv({schema:{},schemaId:n});if(r=cu.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=p1.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,lu.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(kX.call(this,n,r),!r)return(0,NS.eachItem)(n,s=>kS.call(this,s)),this;RX.call(this,r);let i={...r,type:(0,Tm.getJSONTypes)(r.type),schemaType:(0,Tm.getJSONTypes)(r.schemaType)};return(0,NS.eachItem)(n,i.type.length===0?s=>kS.call(this,s,i):s=>i.type.forEach(o=>kS.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]=g1(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,lu.normalizeId)(o||n);let l=lu.getSchemaRefs.call(this,e,n);return c=new cu.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):cu.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{cu.compileSchema.call(this,e)}finally{this.opts=r}}};uu.ValidationError=aX.default;uu.MissingRefError=h1.default;ir.default=uu;function f1(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 p1(t){return t=(0,lu.normalizeId)(t),this.schemas[t]||this.refs[t]}function gX(){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 yX(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function TX(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 vX(){let t={...this.opts};for(let e of dX)delete t[e];return t}var bX={log(){},warn(){},error(){}};function SX(t){if(t===!1)return bX;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 _X=/^[a-z_$][a-z0-9_$:-]*$/i;function kX(t,e){let{RULES:r}=this;if((0,NS.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!_X.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 kS(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,Tm.getJSONTypes)(e.type),schemaType:(0,Tm.getJSONTypes)(e.schemaType)}};e.before?NX.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 NX(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 RX(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=g1(e)),t.validateSchema=this.compile(e,!0))}var PX={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function g1(t){return{anyOf:[t,PX]}}});var T1=R(RS=>{"use strict";Object.defineProperty(RS,"__esModule",{value:!0});var wX={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};RS.default=wX});var Sm=R(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.callRef=go.getValidate=void 0;var EX=su(),v1=Rn(),Hr=Te(),Ga=Nn(),b1=ou(),vm=Ee(),CX={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=b1.resolveRef.call(c,l,i,r);if(u===void 0)throw new EX.default(n.opts.uriResolver,i,r);if(u instanceof b1.SchemaEnv)return f(u);return p(u);function d(){if(s===l)return bm(t,o,s,s.$async);let m=e.scopeValue("root",{ref:l});return bm(t,(0,Hr._)`${m}.validate`,l,l.$async)}function f(m){let h=S1(t,m);bm(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Hr.stringify)(m)}:{ref:m}),T=e.name("valid"),b=t.subschema({schema:m,dataTypes:[],schemaPath:Hr.nil,topSchemaRef:h,errSchemaPath:r},T);t.mergeEvaluated(b),t.ok(T)}}};function S1(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Hr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}go.getValidate=S1;function bm(t,e,r,n){let{gen:i,it:s}=t,{allErrors:o,schemaEnv:a,opts:c}=s,l=c.passContext?Ga.default.this:Hr.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,Hr._)`await ${(0,v1.callValidateCode)(t,e,l)}`),p(e),o||i.assign(m,!0)},h=>{i.if((0,Hr._)`!(${h} instanceof ${s.ValidationError})`,()=>i.throw(h)),f(h),o||i.assign(m,!1)}),t.ok(m)}function d(){t.result((0,v1.callValidateCode)(t,e,l),()=>p(e),()=>f(e))}function f(m){let h=(0,Hr._)`${m}.errors`;i.assign(Ga.default.vErrors,(0,Hr._)`${Ga.default.vErrors} === null ? ${h} : ${Ga.default.vErrors}.concat(${h})`),i.assign(Ga.default.errors,(0,Hr._)`${Ga.default.vErrors}.length`)}function p(m){var h;if(!s.opts.unevaluated)return;let T=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(T&&!T.dynamicProps)T.props!==void 0&&(s.props=vm.mergeEvaluated.props(i,T.props,s.props));else{let b=i.var("props",(0,Hr._)`${m}.evaluated.props`);s.props=vm.mergeEvaluated.props(i,b,s.props,Hr.Name)}if(s.items!==!0)if(T&&!T.dynamicItems)T.items!==void 0&&(s.items=vm.mergeEvaluated.items(i,T.items,s.items));else{let b=i.var("items",(0,Hr._)`${m}.evaluated.items`);s.items=vm.mergeEvaluated.items(i,b,s.items,Hr.Name)}}}go.callRef=bm;go.default=CX});var _1=R(PS=>{"use strict";Object.defineProperty(PS,"__esModule",{value:!0});var DX=T1(),AX=Sm(),IX=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",DX.default,AX.default];PS.default=IX});var k1=R(wS=>{"use strict";Object.defineProperty(wS,"__esModule",{value:!0});var _m=Te(),Is=_m.operators,km={maximum:{okStr:"<=",ok:Is.LTE,fail:Is.GT},minimum:{okStr:">=",ok:Is.GTE,fail:Is.LT},exclusiveMaximum:{okStr:"<",ok:Is.LT,fail:Is.GTE},exclusiveMinimum:{okStr:">",ok:Is.GT,fail:Is.LTE}},OX={message:({keyword:t,schemaCode:e})=>(0,_m.str)`must be ${km[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,_m._)`{comparison: ${km[t].okStr}, limit: ${e}}`},MX={keyword:Object.keys(km),type:"number",schemaType:"number",$data:!0,error:OX,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,_m._)`${r} ${km[e].fail} ${n} || isNaN(${r})`)}};wS.default=MX});var N1=R(ES=>{"use strict";Object.defineProperty(ES,"__esModule",{value:!0});var du=Te(),xX={message:({schemaCode:t})=>(0,du.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,du._)`{multipleOf: ${t}}`},LX={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:xX,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,s=i.opts.multipleOfPrecision,o=e.let("res"),a=s?(0,du._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,du._)`${o} !== parseInt(${o})`;t.fail$data((0,du._)`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};ES.default=LX});var P1=R(CS=>{"use strict";Object.defineProperty(CS,"__esModule",{value:!0});function R1(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}CS.default=R1;R1.code='require("ajv/dist/runtime/ucs2length").default'});var w1=R(DS=>{"use strict";Object.defineProperty(DS,"__esModule",{value:!0});var yo=Te(),qX=Ee(),$X=P1(),BX={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,yo.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,yo._)`{limit: ${t}}`},FX={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:BX,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,s=e==="maxLength"?yo.operators.GT:yo.operators.LT,o=i.opts.unicode===!1?(0,yo._)`${r}.length`:(0,yo._)`${(0,qX.useFunc)(t.gen,$X.default)}(${r})`;t.fail$data((0,yo._)`${o} ${s} ${n}`)}};DS.default=FX});var E1=R(AS=>{"use strict";Object.defineProperty(AS,"__esModule",{value:!0});var jX=Rn(),Nm=Te(),UX={message:({schemaCode:t})=>(0,Nm.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Nm._)`{pattern: ${t}}`},HX={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:UX,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:s}=t,o=s.opts.unicodeRegExp?"u":"",a=r?(0,Nm._)`(new RegExp(${i}, ${o}))`:(0,jX.usePattern)(t,n);t.fail$data((0,Nm._)`!${a}.test(${e})`)}};AS.default=HX});var C1=R(IS=>{"use strict";Object.defineProperty(IS,"__esModule",{value:!0});var fu=Te(),VX={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,fu.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,fu._)`{limit: ${t}}`},zX={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:VX,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?fu.operators.GT:fu.operators.LT;t.fail$data((0,fu._)`Object.keys(${r}).length ${i} ${n}`)}};IS.default=zX});var D1=R(OS=>{"use strict";Object.defineProperty(OS,"__esModule",{value:!0});var pu=Rn(),hu=Te(),WX=Ee(),GX={message:({params:{missingProperty:t}})=>(0,hu.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,hu._)`{missingProperty: ${t}}`},KX={keyword:"required",type:"object",schemaType:"array",$data:!0,error:GX,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 T=o.schemaEnv.baseId+o.errSchemaPath,b=`required property "${h}" is not defined at "${T}" (strictRequired)`;(0,WX.checkStrictMode)(o,b,o.opts.strictRequired)}}function l(){if(c||s)t.block$data(hu.nil,d);else for(let p of r)(0,pu.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,pu.checkMissingProp)(t,r,p)),(0,pu.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,pu.noPropertyInData)(e,i,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(m,(0,pu.propertyInData)(e,i,p,a.ownProperties)),e.if((0,hu.not)(m),()=>{t.error(),e.break()})},hu.nil)}}};OS.default=KX});var A1=R(MS=>{"use strict";Object.defineProperty(MS,"__esModule",{value:!0});var mu=Te(),YX={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,mu.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,mu._)`{limit: ${t}}`},XX={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:YX,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?mu.operators.GT:mu.operators.LT;t.fail$data((0,mu._)`${r}.length ${i} ${n}`)}};MS.default=XX});var Rm=R(xS=>{"use strict";Object.defineProperty(xS,"__esModule",{value:!0});var I1=oS();I1.code='require("ajv/dist/runtime/equal").default';xS.default=I1});var O1=R(qS=>{"use strict";Object.defineProperty(qS,"__esModule",{value:!0});var LS=eu(),sr=Te(),JX=Ee(),QX=Rm(),ZX={message:({params:{i:t,j:e}})=>(0,sr.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,sr._)`{i: ${t}, j: ${e}}`},e4={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:ZX,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,LS.getSchemaTypes)(s.items):[];t.block$data(c,u,(0,sr._)`${o} === false`),t.ok(c);function u(){let m=e.let("i",(0,sr._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,sr._)`${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 T=e.name("item"),b=(0,LS.checkDataTypes)(l,T,a.opts.strictNumbers,LS.DataType.Wrong),S=e.const("indices",(0,sr._)`{}`);e.for((0,sr._)`;${m}--;`,()=>{e.let(T,(0,sr._)`${r}[${m}]`),e.if(b,(0,sr._)`continue`),l.length>1&&e.if((0,sr._)`typeof ${T} == "string"`,(0,sr._)`${T} += "_"`),e.if((0,sr._)`typeof ${S}[${T}] == "number"`,()=>{e.assign(h,(0,sr._)`${S}[${T}]`),t.error(),e.assign(c,!1).break()}).code((0,sr._)`${S}[${T}] = ${m}`)})}function p(m,h){let T=(0,JX.useFunc)(e,QX.default),b=e.name("outer");e.label(b).for((0,sr._)`;${m}--;`,()=>e.for((0,sr._)`${h} = ${m}; ${h}--;`,()=>e.if((0,sr._)`${T}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(b)})))}}};qS.default=e4});var M1=R(BS=>{"use strict";Object.defineProperty(BS,"__esModule",{value:!0});var $S=Te(),t4=Ee(),r4=Rm(),n4={message:"must be equal to constant",params:({schemaCode:t})=>(0,$S._)`{allowedValue: ${t}}`},i4={keyword:"const",$data:!0,error:n4,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,$S._)`!${(0,t4.useFunc)(e,r4.default)}(${r}, ${i})`):t.fail((0,$S._)`${s} !== ${r}`)}};BS.default=i4});var x1=R(FS=>{"use strict";Object.defineProperty(FS,"__esModule",{value:!0});var gu=Te(),s4=Ee(),o4=Rm(),a4={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,gu._)`{allowedValues: ${t}}`},c4={keyword:"enum",schemaType:"array",$data:!0,error:a4,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,s4.useFunc)(e,o4.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,gu.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,gu._)`${l()}(${r}, ${p})`,()=>e.assign(u,!0).break()))}function f(p,m){let h=i[m];return typeof h=="object"&&h!==null?(0,gu._)`${l()}(${r}, ${p}[${m}])`:(0,gu._)`${r} === ${h}`}}};FS.default=c4});var L1=R(jS=>{"use strict";Object.defineProperty(jS,"__esModule",{value:!0});var l4=k1(),u4=N1(),d4=w1(),f4=E1(),p4=C1(),h4=D1(),m4=A1(),g4=O1(),y4=M1(),T4=x1(),v4=[l4.default,u4.default,d4.default,f4.default,p4.default,h4.default,m4.default,g4.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},y4.default,T4.default];jS.default=v4});var HS=R(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.validateAdditionalItems=void 0;var To=Te(),US=Ee(),b4={message:({params:{len:t}})=>(0,To.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,To._)`{limit: ${t}}`},S4={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:b4,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,US.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}q1(t,n)}};function q1(t,e){let{gen:r,schema:n,data:i,keyword:s,it:o}=t;o.items=!0;let a=r.const("len",(0,To._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,To._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,US.alwaysValidSchema)(o,n)){let l=r.var("valid",(0,To._)`${a} <= ${e.length}`);r.if((0,To.not)(l),()=>c(l)),t.ok(l)}function c(l){r.forRange("i",e.length,a,u=>{t.subschema({keyword:s,dataProp:u,dataPropType:US.Type.Num},l),o.allErrors||r.if((0,To.not)(l),()=>r.break())})}}yu.validateAdditionalItems=q1;yu.default=S4});var VS=R(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.validateTuple=void 0;var $1=Te(),Pm=Ee(),_4=Rn(),k4={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return B1(t,"additionalItems",e);r.items=!0,!(0,Pm.alwaysValidSchema)(r,e)&&t.ok((0,_4.validateArray)(t))}};function B1(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=Pm.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),l=n.const("len",(0,$1._)`${s}.length`);r.forEach((d,f)=>{(0,Pm.alwaysValidSchema)(a,d)||(n.if((0,$1._)`${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 T=`"${o}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,Pm.checkStrictMode)(a,T,f.strictTuples)}}}Tu.validateTuple=B1;Tu.default=k4});var F1=R(zS=>{"use strict";Object.defineProperty(zS,"__esModule",{value:!0});var N4=VS(),R4={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,N4.validateTuple)(t,"items")};zS.default=R4});var U1=R(WS=>{"use strict";Object.defineProperty(WS,"__esModule",{value:!0});var j1=Te(),P4=Ee(),w4=Rn(),E4=HS(),C4={message:({params:{len:t}})=>(0,j1.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,j1._)`{limit: ${t}}`},D4={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:C4,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,P4.alwaysValidSchema)(n,e)&&(i?(0,E4.validateAdditionalItems)(t,i):t.ok((0,w4.validateArray)(t)))}};WS.default=D4});var H1=R(GS=>{"use strict";Object.defineProperty(GS,"__esModule",{value:!0});var wn=Te(),wm=Ee(),A4={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}}`},I4={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:A4,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,wm.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){(0,wm.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,wm.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"),T=e.let("count",0);p(h,()=>e.if(h,()=>m(T)))}function p(h,T){e.forRange("i",0,u,b=>{t.subschema({keyword:"contains",dataProp:b,dataPropType:wm.Type.Num,compositeRule:!0},h),T()})}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)))}}};GS.default=I4});var Em=R(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.validateSchemaDeps=bi.validatePropertyDeps=bi.error=void 0;var KS=Te(),O4=Ee(),vu=Rn();bi.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,KS.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,KS._)`{property: ${t},
|
|
179
|
+
|| ${o} === "boolean" || ${i} === null`).assign(a,(0,ve._)`[${i}]`)}}}function yY({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,ve._)`${e} !== undefined`,()=>t.assign((0,ve._)`${e}[${r}]`,n))}function sS(t,e,r,n=za.Correct){let i=n===za.Correct?ve.operators.EQ:ve.operators.NEQ,s;switch(t){case"null":return(0,ve._)`${e} ${i} null`;case"array":s=(0,ve._)`Array.isArray(${e})`;break;case"object":s=(0,ve._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=o((0,ve._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=o();break;default:return(0,ve._)`typeof ${e} ${i} ${t}`}return n===za.Correct?s:(0,ve.not)(s);function o(a=ve.nil){return(0,ve.and)((0,ve._)`typeof ${e} == "number"`,a,r?(0,ve._)`isFinite(${e})`:ve.nil)}}br.checkDataType=sS;function oS(t,e,r,n){if(t.length===1)return sS(t[0],e,r,n);let i,s=(0,fq.toHash)(t);if(s.array&&s.object){let o=(0,ve._)`typeof ${e} != "object"`;i=s.null?o:(0,ve._)`!${e} || ${o}`,delete s.null,delete s.array,delete s.object}else i=ve.nil;s.number&&delete s.integer;for(let o in s)i=(0,ve.and)(i,sS(o,e,r,n));return i}br.checkDataTypes=oS;var TY={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,ve._)`{type: ${t}}`:(0,ve._)`{type: ${e}}`};function aS(t){let e=vY(t);(0,fY.reportError)(e,TY)}br.reportTypeError=aS;function vY(t){let{gen:e,data:r,schema:n}=t,i=(0,fq.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var gq=R(gm=>{"use strict";Object.defineProperty(gm,"__esModule",{value:!0});gm.assignDefaults=void 0;var Wa=Te(),bY=Ee();function SY(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)mq(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,s)=>mq(t,s,i.default))}gm.assignDefaults=SY;function mq(t,e,r){let{gen:n,compositeRule:i,data:s,opts:o}=t;if(r===void 0)return;let a=(0,Wa._)`${s}${(0,Wa.getProperty)(e)}`;if(i){(0,bY.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Wa._)`${a} === undefined`;o.useDefaults==="empty"&&(c=(0,Wa._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,Wa._)`${a} = ${(0,Wa.stringify)(r)}`)}});var En=R(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.validateUnion=nt.validateArray=nt.usePattern=nt.callValidateCode=nt.schemaProperties=nt.allSchemaProperties=nt.noPropertyInData=nt.propertyInData=nt.isOwnProperty=nt.hasPropFunc=nt.reportMissingProp=nt.checkMissingProp=nt.checkReportMissingProp=void 0;var Tt=Te(),cS=Ee(),Ds=wn(),_Y=Ee();function kY(t,e){let{gen:r,data:n,it:i}=t;r.if(uS(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Tt._)`${e}`},!0),t.error()})}nt.checkReportMissingProp=kY;function NY({gen:t,data:e,it:{opts:r}},n,i){return(0,Tt.or)(...n.map(s=>(0,Tt.and)(uS(t,e,s,r.ownProperties),(0,Tt._)`${i} = ${s}`)))}nt.checkMissingProp=NY;function RY(t,e){t.setParams({missingProperty:e},!0),t.error()}nt.reportMissingProp=RY;function yq(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Tt._)`Object.prototype.hasOwnProperty`})}nt.hasPropFunc=yq;function lS(t,e,r){return(0,Tt._)`${yq(t)}.call(${e}, ${r})`}nt.isOwnProperty=lS;function PY(t,e,r,n){let i=(0,Tt._)`${e}${(0,Tt.getProperty)(r)} !== undefined`;return n?(0,Tt._)`${i} && ${lS(t,e,r)}`:i}nt.propertyInData=PY;function uS(t,e,r,n){let i=(0,Tt._)`${e}${(0,Tt.getProperty)(r)} === undefined`;return n?(0,Tt.or)(i,(0,Tt.not)(lS(t,e,r))):i}nt.noPropertyInData=uS;function Tq(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}nt.allSchemaProperties=Tq;function wY(t,e){return Tq(e).filter(r=>!(0,cS.alwaysValidSchema)(t,e[r]))}nt.schemaProperties=wY;function EY({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:s},it:o},a,c,l){let u=l?(0,Tt._)`${t}, ${e}, ${n}${i}`:e,d=[[Ds.default.instancePath,(0,Tt.strConcat)(Ds.default.instancePath,s)],[Ds.default.parentData,o.parentData],[Ds.default.parentDataProperty,o.parentDataProperty],[Ds.default.rootData,Ds.default.rootData]];o.opts.dynamicRef&&d.push([Ds.default.dynamicAnchors,Ds.default.dynamicAnchors]);let f=(0,Tt._)`${u}, ${r.object(...d)}`;return c!==Tt.nil?(0,Tt._)`${a}.call(${c}, ${f})`:(0,Tt._)`${a}(${f})`}nt.callValidateCode=EY;var CY=(0,Tt._)`new RegExp`;function DY({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,Tt._)`${i.code==="new RegExp"?CY:(0,_Y.useFunc)(t,i)}(${r}, ${n})`})}nt.usePattern=DY;function AY(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,Tt._)`${r}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:n,dataProp:l,dataPropType:cS.Type.Num},s),e.if((0,Tt.not)(s),a)})}}nt.validateArray=AY;function IY(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,cS.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,Tt._)`${o} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,Tt.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}nt.validateUnion=IY});var Sq=R(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.validateKeywordUsage=Si.validSchemaType=Si.funcKeywordCode=Si.macroKeywordCode=void 0;var Er=Te(),To=wn(),OY=En(),MY=ru();function xY(t,e){let{gen:r,keyword:n,schema:i,parentSchema:s,it:o}=t,a=e.macro.call(o.self,i,s,o),c=bq(r,n,a);o.opts.validateSchema!==!1&&o.self.validateSchema(a,!0);let l=r.name("valid");t.subschema({schema:a,schemaPath:Er.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}Si.macroKeywordCode=xY;function LY(t,e){var r;let{gen:n,keyword:i,schema:s,parentSchema:o,$data:a,it:c}=t;$Y(c,e);let l=!a&&e.compile?e.compile.call(c.self,s,o,c):e.validate,u=bq(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&&vq(t),T(()=>t.error());else{let b=e.async?p():m();e.modifying&&vq(t),T(()=>qY(t,b))}}function p(){let b=n.let("ruleErrs",null);return n.try(()=>h((0,Er._)`await `),_=>n.assign(d,!1).if((0,Er._)`${_} instanceof ${c.ValidationError}`,()=>n.assign(b,(0,Er._)`${_}.errors`),()=>n.throw(_))),b}function m(){let b=(0,Er._)`${u}.errors`;return n.assign(b,null),h(Er.nil),b}function h(b=e.async?(0,Er._)`await `:Er.nil){let _=c.opts.passContext?To.default.this:To.default.self,v=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Er._)`${b}${(0,OY.callValidateCode)(t,u,_,v)}`,e.modifying)}function T(b){var _;n.if((0,Er.not)((_=e.valid)!==null&&_!==void 0?_:d),b)}}Si.funcKeywordCode=LY;function vq(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Er._)`${n.parentData}[${n.parentDataProperty}]`))}function qY(t,e){let{gen:r}=t;r.if((0,Er._)`Array.isArray(${e})`,()=>{r.assign(To.default.vErrors,(0,Er._)`${To.default.vErrors} === null ? ${e} : ${To.default.vErrors}.concat(${e})`).assign(To.default.errors,(0,Er._)`${To.default.vErrors}.length`),(0,MY.extendErrors)(t)},()=>t.error())}function $Y({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function bq(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,Er.stringify)(r)})}function BY(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")}Si.validSchemaType=BY;function FY({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)}}Si.validateKeywordUsage=FY});var kq=R(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.extendSubschemaMode=As.extendSubschemaData=As.getSubschema=void 0;var _i=Te(),_q=Ee();function jY(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,_q.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')}As.getSubschema=jY;function UY(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,_q.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]}}As.extendSubschemaData=UY;function HY(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}As.extendSubschemaMode=HY});var dS=R((RPe,Nq)=>{"use strict";Nq.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 Pq=R((PPe,Rq)=>{"use strict";var Is=Rq.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(){};ym(e,n,i,t,"",t)};Is.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Is.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Is.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Is.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 ym(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 Is.arrayKeywords)for(var f=0;f<d.length;f++)ym(t,e,r,d[f],i+"/"+u+"/"+f,s,i,u,n,f)}else if(u in Is.propsKeywords){if(d&&typeof d=="object")for(var p in d)ym(t,e,r,d[p],i+"/"+u+"/"+VY(p),s,i,u,n,p)}else(u in Is.keywords||t.allKeys&&!(u in Is.skipKeywords))&&ym(t,e,r,d,i+"/"+u,s,i,u,n)}r(n,i,s,o,a,c,l)}}function VY(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var iu=R(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.getSchemaRefs=Vr.resolveUrl=Vr.normalizeId=Vr._getFullPath=Vr.getFullPath=Vr.inlineRef=void 0;var zY=Ee(),WY=dS(),GY=Pq(),KY=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function YY(t,e=!0){return typeof t=="boolean"?!0:e===!0?!fS(t):e?wq(t)<=e:!1}Vr.inlineRef=YY;var XY=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function fS(t){for(let e in t){if(XY.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(fS)||typeof r=="object"&&fS(r))return!0}return!1}function wq(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!KY.has(r)&&(typeof t[r]=="object"&&(0,zY.eachItem)(t[r],n=>e+=wq(n)),e===1/0))return 1/0}return e}function Eq(t,e="",r){r!==!1&&(e=Ga(e));let n=t.parse(e);return Cq(t,n)}Vr.getFullPath=Eq;function Cq(t,e){return t.serialize(e).split("#")[0]+"#"}Vr._getFullPath=Cq;var JY=/#\/?$/;function Ga(t){return t?t.replace(JY,""):""}Vr.normalizeId=Ga;function QY(t,e,r){return r=Ga(r),t.resolve(e,r)}Vr.resolveUrl=QY;var ZY=/^[a-z_][-a-z0-9._]*$/i;function e3(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=Ga(t[r]||e),s={"":i},o=Eq(n,i,!1),a={},c=new Set;return GY(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=o+f,T=s[m];typeof d[r]=="string"&&(T=b.call(this,d[r])),_.call(this,d.$anchor),_.call(this,d.$dynamicAnchor),s[f]=T;function b(v){let N=this.opts.uriResolver.resolve;if(v=Ga(T?N(T,v):v),c.has(v))throw u(v);c.add(v);let C=this.refs[v];return typeof C=="string"&&(C=this.refs[C]),typeof C=="object"?l(d,C.schema,v):v!==Ga(h)&&(v[0]==="#"?(l(d,a[v],v),a[v]=d):this.refs[v]=h),v}function _(v){if(typeof v=="string"){if(!ZY.test(v))throw new Error(`invalid anchor "${v}"`);b.call(this,`#${v}`)}}}),a;function l(d,f,p){if(f!==void 0&&!WY(d,f))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Vr.getSchemaRefs=e3});var au=R(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.getData=Os.KeywordCxt=Os.validateFunctionCode=void 0;var Mq=lq(),Dq=nu(),hS=iS(),Tm=nu(),t3=gq(),ou=Sq(),pS=kq(),se=Te(),he=wn(),r3=iu(),zi=Ee(),su=ru();function n3(t){if(qq(t)&&($q(t),Lq(t))){o3(t);return}xq(t,()=>(0,Mq.topBoolOrEmptySchema)(t))}Os.validateFunctionCode=n3;function xq({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},s){i.code.es5?t.func(e,(0,se._)`${he.default.data}, ${he.default.valCxt}`,n.$async,()=>{t.code((0,se._)`"use strict"; ${Aq(r,i)}`),s3(t,i),t.code(s)}):t.func(e,(0,se._)`${he.default.data}, ${i3(i)}`,n.$async,()=>t.code(Aq(r,i)).code(s))}function i3(t){return(0,se._)`{${he.default.instancePath}="", ${he.default.parentData}, ${he.default.parentDataProperty}, ${he.default.rootData}=${he.default.data}${t.dynamicRef?(0,se._)`, ${he.default.dynamicAnchors}={}`:se.nil}}={}`}function s3(t,e){t.if(he.default.valCxt,()=>{t.var(he.default.instancePath,(0,se._)`${he.default.valCxt}.${he.default.instancePath}`),t.var(he.default.parentData,(0,se._)`${he.default.valCxt}.${he.default.parentData}`),t.var(he.default.parentDataProperty,(0,se._)`${he.default.valCxt}.${he.default.parentDataProperty}`),t.var(he.default.rootData,(0,se._)`${he.default.valCxt}.${he.default.rootData}`),e.dynamicRef&&t.var(he.default.dynamicAnchors,(0,se._)`${he.default.valCxt}.${he.default.dynamicAnchors}`)},()=>{t.var(he.default.instancePath,(0,se._)`""`),t.var(he.default.parentData,(0,se._)`undefined`),t.var(he.default.parentDataProperty,(0,se._)`undefined`),t.var(he.default.rootData,he.default.data),e.dynamicRef&&t.var(he.default.dynamicAnchors,(0,se._)`{}`)})}function o3(t){let{schema:e,opts:r,gen:n}=t;xq(t,()=>{r.$comment&&e.$comment&&Fq(t),d3(t),n.let(he.default.vErrors,null),n.let(he.default.errors,0),r.unevaluated&&a3(t),Bq(t),h3(t)})}function a3(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,se._)`${r}.evaluated`),e.if((0,se._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,se._)`${t.evaluated}.props`,(0,se._)`undefined`)),e.if((0,se._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,se._)`${t.evaluated}.items`,(0,se._)`undefined`))}function Aq(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,se._)`/*# sourceURL=${r} */`:se.nil}function c3(t,e){if(qq(t)&&($q(t),Lq(t))){l3(t,e);return}(0,Mq.boolOrEmptySchema)(t,e)}function Lq({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 qq(t){return typeof t.schema!="boolean"}function l3(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&Fq(t),f3(t),p3(t);let s=n.const("_errs",he.default.errors);Bq(t,s),n.var(e,(0,se._)`${s} === ${he.default.errors}`)}function $q(t){(0,zi.checkUnknownRules)(t),u3(t)}function Bq(t,e){if(t.opts.jtd)return Iq(t,[],!1,e);let r=(0,Dq.getSchemaTypes)(t.schema),n=(0,Dq.coerceAndCheckDataType)(t,r);Iq(t,r,!n,e)}function u3(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,zi.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function d3(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,zi.checkStrictMode)(t,"default is ignored in the schema root")}function f3(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,r3.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function p3(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Fq({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let s=r.$comment;if(i.$comment===!0)t.code((0,se._)`${he.default.self}.logger.log(${s})`);else if(typeof i.$comment=="function"){let o=(0,se.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,se._)`${he.default.self}.opts.$comment(${s}, ${o}, ${a}.schema)`)}}function h3(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:s}=t;r.$async?e.if((0,se._)`${he.default.errors} === 0`,()=>e.return(he.default.data),()=>e.throw((0,se._)`new ${i}(${he.default.vErrors})`)):(e.assign((0,se._)`${n}.errors`,he.default.vErrors),s.unevaluated&&m3(t),e.return((0,se._)`${he.default.errors} === 0`))}function m3({gen:t,evaluated:e,props:r,items:n}){r instanceof se.Name&&t.assign((0,se._)`${e}.props`,r),n instanceof se.Name&&t.assign((0,se._)`${e}.items`,n)}function Iq(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,zi.schemaHasRulesButRef)(s,u))){i.block(()=>Uq(t,"$ref",u.all.$ref.definition));return}c.jtd||g3(t,e),i.block(()=>{for(let f of u.rules)d(f);d(u.post)});function d(f){(0,hS.shouldUseGroup)(s,f)&&(f.type?(i.if((0,Tm.checkDataType)(f.type,o,c.strictNumbers)),Oq(t,f),e.length===1&&e[0]===f.type&&r&&(i.else(),(0,Tm.reportTypeError)(t)),i.endIf()):Oq(t,f),a||i.if((0,se._)`${he.default.errors} === ${n||0}`))}}function Oq(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,t3.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,hS.shouldUseRule)(n,s)&&Uq(t,s.keyword,s.definition,e.type)})}function g3(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(y3(t,e),t.opts.allowUnionTypes||T3(t,e),v3(t,t.dataTypes))}function y3(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{jq(t.dataTypes,r)||mS(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),S3(t,e)}}function T3(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&mS(t,"use allowUnionTypes to allow union type keyword")}function v3(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,hS.shouldUseRule)(t.schema,i)){let{type:s}=i.definition;s.length&&!s.some(o=>b3(e,o))&&mS(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function b3(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function jq(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function S3(t,e){let r=[];for(let n of t.dataTypes)jq(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function mS(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,zi.checkStrictMode)(t,e,t.opts.strictTypes)}var vm=class{constructor(e,r,n){if((0,ou.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,zi.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",Hq(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,ou.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",he.default.errors))}result(e,r,n){this.failResult((0,se.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,se.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,se._)`${r} !== undefined && (${(0,se.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?su.reportExtraError:su.reportError)(this,this.def.error,r)}$dataError(){(0,su.reportError)(this,this.def.$dataError||su.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,su.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=se.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=se.nil,r=se.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:s,def:o}=this;n.if((0,se.or)((0,se._)`${i} === undefined`,r)),e!==se.nil&&n.assign(e,!0),(s.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==se.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:s}=this;return(0,se.or)(o(),a());function o(){if(n.length){if(!(r instanceof se.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,se._)`${(0,Tm.checkDataTypes)(c,r,s.opts.strictNumbers,Tm.DataType.Wrong)}`}return se.nil}function a(){if(i.validateSchema){let c=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,se._)`!${c}(${r})`}return se.nil}}subschema(e,r){let n=(0,pS.getSubschema)(this.it,e);(0,pS.extendSubschemaData)(n,this.it,e),(0,pS.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return c3(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=zi.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=zi.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,se.Name)),!0}};Os.KeywordCxt=vm;function Uq(t,e,r,n){let i=new vm(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,ou.funcKeywordCode)(i,r):"macro"in r?(0,ou.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,ou.funcKeywordCode)(i,r)}var _3=/^\/(?:[^~]|~0|~1)*$/,k3=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Hq(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,s;if(t==="")return he.default.rootData;if(t[0]==="/"){if(!_3.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,s=he.default.rootData}else{let l=k3.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,se._)`${s}${(0,se.getProperty)((0,zi.unescapeJsonPointer)(l))}`,o=(0,se._)`${o} && ${s}`);return o;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${e}`}}Os.getData=Hq});var bm=R(yS=>{"use strict";Object.defineProperty(yS,"__esModule",{value:!0});var gS=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};yS.default=gS});var cu=R(bS=>{"use strict";Object.defineProperty(bS,"__esModule",{value:!0});var TS=iu(),vS=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,TS.resolveUrl)(e,r,n),this.missingSchema=(0,TS.normalizeId)((0,TS.getFullPath)(e,this.missingRef))}};bS.default=vS});var lu=R(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.resolveSchema=Cn.getCompilingSchema=Cn.resolveRef=Cn.compileSchema=Cn.SchemaEnv=void 0;var ei=Te(),N3=bm(),vo=wn(),ti=iu(),Vq=Ee(),R3=au(),Ka=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,ti.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Cn.SchemaEnv=Ka;function _S(t){let e=zq.call(this,t);if(e)return e;let r=(0,ti.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new ei.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),a;t.$async&&(a=o.scopeValue("Error",{ref:N3.default,code:(0,ei._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");t.validateName=c;let l={gen:o,allErrors:this.opts.allErrors,data:vo.default.data,parentData:vo.default.parentData,parentDataProperty:vo.default.parentDataProperty,dataNames:[vo.default.data],dataPathArr:[ei.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,ei.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:ei.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ei._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,R3.validateFunctionCode)(l),o.optimize(this.opts.code.optimize);let d=o.toString();u=`${o.scopeRefs(vo.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${vo.default.self}`,`${vo.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 ei.Name?void 0:m,items:h instanceof ei.Name?void 0:h,dynamicProps:m instanceof ei.Name,dynamicItems:h instanceof ei.Name},p.source&&(p.source.evaluated=(0,ei.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)}}Cn.compileSchema=_S;function P3(t,e,r){var n;r=(0,ti.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let s=C3.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 Ka({schema:o,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=w3.call(this,s)}Cn.resolveRef=P3;function w3(t){return(0,ti.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:_S.call(this,t)}function zq(t){for(let e of this._compilations)if(E3(e,t))return e}Cn.getCompilingSchema=zq;function E3(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function C3(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Sm.call(this,t,e)}function Sm(t,e){let r=this.opts.uriResolver.parse(e),n=(0,ti._getFullPath)(this.opts.uriResolver,r),i=(0,ti.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return SS.call(this,r,t);let s=(0,ti.normalizeId)(n),o=this.refs[s]||this.schemas[s];if(typeof o=="string"){let a=Sm.call(this,t,o);return typeof a?.schema!="object"?void 0:SS.call(this,r,a)}if(typeof o?.schema=="object"){if(o.validate||_S.call(this,o),s===(0,ti.normalizeId)(e)){let{schema:a}=o,{schemaId:c}=this.opts,l=a[c];return l&&(i=(0,ti.resolveUrl)(this.opts.uriResolver,i,l)),new Ka({schema:a,schemaId:c,root:t,baseId:i})}return SS.call(this,r,o)}}Cn.resolveSchema=Sm;var D3=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function SS(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,Vq.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!D3.has(a)&&l&&(e=(0,ti.resolveUrl)(this.opts.uriResolver,e,l))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Vq.schemaHasRulesButRef)(r,this.RULES)){let a=(0,ti.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=Sm.call(this,n,a)}let{schemaId:o}=this.opts;if(s=s||new Ka({schema:r,schemaId:o,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var Wq=R((IPe,A3)=>{A3.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 Kq=R((OPe,Gq)=>{"use strict";var I3={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Gq.exports={HEX:I3}});var r1=R((MPe,t1)=>{"use strict";var{HEX:O3}=Kq(),M3=/^(?:(?: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;function Qq(t){if(e1(t,".")<3)return{host:t,isIPV4:!1};let e=t.match(M3)||[],[r]=e;return r?{host:L3(r,"."),isIPV4:!0}:{host:t,isIPV4:!1}}function kS(t,e=!1){let r="",n=!0;for(let i of t){if(O3[i]===void 0)return;i!=="0"&&n===!0&&(n=!1),n||(r+=i)}return e&&r.length===0&&(r="0"),r}function x3(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],s=!1,o=!1,a=!1;function c(){if(i.length){if(s===!1){let l=kS(i);if(l!==void 0)n.push(l);else return r.error=!0,!1}i.length=0}return!0}for(let l=0;l<t.length;l++){let u=t[l];if(!(u==="["||u==="]"))if(u===":"){if(o===!0&&(a=!0),!c())break;if(e++,n.push(":"),e>7){r.error=!0;break}l-1>=0&&t[l-1]===":"&&(o=!0);continue}else if(u==="%"){if(!c())break;s=!0}else{i.push(u);continue}}return i.length&&(s?r.zone=i.join(""):a?n.push(i.join("")):n.push(kS(i))),r.address=n.join(""),r}function Zq(t){if(e1(t,":")<2)return{host:t,isIPV6:!1};let e=x3(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,escapedHost:n,isIPV6:!0}}}function L3(t,e){let r="",n=!0,i=t.length;for(let s=0;s<i;s++){let o=t[s];o==="0"&&n?(s+1<=i&&t[s+1]===e||s+1===i)&&(r+=o,n=!1):(o===e?n=!0:n=!1,r+=o)}return r}function e1(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}var Yq=/^\.\.?\//u,Xq=/^\/\.(?:\/|$)/u,Jq=/^\/\.\.(?:\/|$)/u,q3=/^\/?(?:.|\n)*?(?=\/|$)/u;function $3(t){let e=[];for(;t.length;)if(t.match(Yq))t=t.replace(Yq,"");else if(t.match(Xq))t=t.replace(Xq,"/");else if(t.match(Jq))t=t.replace(Jq,"/"),e.pop();else if(t==="."||t==="..")t="";else{let r=t.match(q3);if(r){let n=r[0];t=t.slice(n.length),e.push(n)}else throw new Error("Unexpected dot segment condition")}return e.join("")}function B3(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function F3(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host),n=Qq(r);if(n.isIPV4)r=n.host;else{let i=Zq(n.host);i.isIPV6===!0?r=`[${i.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}t1.exports={recomposeAuthority:F3,normalizeComponentEncoding:B3,removeDotSegments:$3,normalizeIPv4:Qq,normalizeIPv6:Zq,stringArrayToHexStripped:kS}});var c1=R((xPe,a1)=>{"use strict";var j3=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,U3=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function n1(t){return typeof t.secure=="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}function i1(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function s1(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 H3(t){return t.secure=n1(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function V3(t){if((t.port===(n1(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,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function z3(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(U3);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,s=NS[i];t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function W3(t,e){let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,s=NS[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 G3(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!j3.test(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function K3(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var o1={scheme:"http",domainHost:!0,parse:i1,serialize:s1},Y3={scheme:"https",domainHost:o1.domainHost,parse:i1,serialize:s1},_m={scheme:"ws",domainHost:!0,parse:H3,serialize:V3},X3={scheme:"wss",domainHost:_m.domainHost,parse:_m.parse,serialize:_m.serialize},J3={scheme:"urn",parse:z3,serialize:W3,skipNormalize:!0},Q3={scheme:"urn:uuid",parse:G3,serialize:K3,skipNormalize:!0},NS={http:o1,https:Y3,ws:_m,wss:X3,urn:J3,"urn:uuid":Q3};a1.exports=NS});var u1=R((LPe,Nm)=>{"use strict";var{normalizeIPv6:Z3,normalizeIPv4:eX,removeDotSegments:uu,recomposeAuthority:tX,normalizeComponentEncoding:km}=r1(),RS=c1();function rX(t,e){return typeof t=="string"?t=ki(Wi(t,e),e):typeof t=="object"&&(t=Wi(ki(t,e),e)),t}function nX(t,e,r){let n=Object.assign({scheme:"null"},r),i=l1(Wi(t,n),Wi(e,n),n,!0);return ki(i,{...n,skipEscape:!0})}function l1(t,e,r,n){let i={};return n||(t=Wi(ki(t,r),r),e=Wi(ki(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=uu(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=uu(e.path||""),i.query=e.query):(e.path?(e.path.charAt(0)==="/"?i.path=uu(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=uu(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 iX(t,e,r){return typeof t=="string"?(t=unescape(t),t=ki(km(Wi(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=ki(km(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=ki(km(Wi(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=ki(km(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function ki(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=[],s=RS[(n.scheme||r.scheme||"").toLowerCase()];s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let o=tX(r);if(o!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(o),r.path&&r.path.charAt(0)!=="/"&&i.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=uu(a)),o===void 0&&(a=a.replace(/^\/\//u,"/%2F")),i.push(a)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var sX=Array.from({length:127},(t,e)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(e)));function oX(t){let e=0;for(let r=0,n=t.length;r<n;++r)if(e=t.charCodeAt(r),e>126||sX[e])return!0;return!1}var aX=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Wi(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=t.indexOf("%")!==-1,s=!1;r.reference==="suffix"&&(t=(r.scheme?r.scheme+":":"")+"//"+t);let o=t.match(aX);if(o){if(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]),n.host){let c=eX(n.host);if(c.isIPV4===!1){let l=Z3(c.host);n.host=l.host.toLowerCase(),s=l.isIPV6}else n.host=c.host,s=!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 a=RS[(r.scheme||n.scheme||"").toLowerCase()];if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&s===!1&&oX(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(c){n.error=n.error||"Host's domain name can not be converted to ASCII: "+c}(!a||a&&!a.skipNormalize)&&(i&&n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),i&&n.host!==void 0&&(n.host=unescape(n.host)),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var PS={SCHEMES:RS,normalize:rX,resolve:nX,resolveComponents:l1,equal:iX,serialize:ki,parse:Wi};Nm.exports=PS;Nm.exports.default=PS;Nm.exports.fastUri=PS});var f1=R(wS=>{"use strict";Object.defineProperty(wS,"__esModule",{value:!0});var d1=u1();d1.code='require("ajv/dist/runtime/uri").default';wS.default=d1});var b1=R(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.CodeGen=sr.Name=sr.nil=sr.stringify=sr.str=sr._=sr.KeywordCxt=void 0;var cX=au();Object.defineProperty(sr,"KeywordCxt",{enumerable:!0,get:function(){return cX.KeywordCxt}});var Ya=Te();Object.defineProperty(sr,"_",{enumerable:!0,get:function(){return Ya._}});Object.defineProperty(sr,"str",{enumerable:!0,get:function(){return Ya.str}});Object.defineProperty(sr,"stringify",{enumerable:!0,get:function(){return Ya.stringify}});Object.defineProperty(sr,"nil",{enumerable:!0,get:function(){return Ya.nil}});Object.defineProperty(sr,"Name",{enumerable:!0,get:function(){return Ya.Name}});Object.defineProperty(sr,"CodeGen",{enumerable:!0,get:function(){return Ya.CodeGen}});var lX=bm(),y1=cu(),uX=nS(),du=lu(),dX=Te(),fu=iu(),Rm=nu(),CS=Ee(),p1=Wq(),fX=f1(),T1=(t,e)=>new RegExp(t,e);T1.code="new RegExp";var pX=["removeAdditional","useDefaults","coerceTypes"],hX=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),mX={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."},gX={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},h1=200;function yX(t){var e,r,n,i,s,o,a,c,l,u,d,f,p,m,h,T,b,_,v,N,C,H,M,F,De;let lt=t.strict,Ht=(e=t.code)===null||e===void 0?void 0:e.optimize,Ne=Ht===!0||Ht===void 0?1:Ht||0,an=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:T1,Gi=(i=t.uriResolver)!==null&&i!==void 0?i:fX.default;return{strictSchema:(o=(s=t.strictSchema)!==null&&s!==void 0?s:lt)!==null&&o!==void 0?o:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:lt)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=t.strictTypes)!==null&&l!==void 0?l:lt)!==null&&u!==void 0?u:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:lt)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:lt)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:Ne,regExp:an}:{optimize:Ne,regExp:an},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:h1,loopEnum:(T=t.loopEnum)!==null&&T!==void 0?T:h1,meta:(b=t.meta)!==null&&b!==void 0?b:!0,messages:(_=t.messages)!==null&&_!==void 0?_:!0,inlineRefs:(v=t.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(N=t.schemaId)!==null&&N!==void 0?N:"$id",addUsedSchema:(C=t.addUsedSchema)!==null&&C!==void 0?C:!0,validateSchema:(H=t.validateSchema)!==null&&H!==void 0?H:!0,validateFormats:(M=t.validateFormats)!==null&&M!==void 0?M:!0,unicodeRegExp:(F=t.unicodeRegExp)!==null&&F!==void 0?F:!0,int32range:(De=t.int32range)!==null&&De!==void 0?De:!0,uriResolver:Gi}}var pu=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...yX(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new dX.ValueScope({scope:{},prefixes:hX,es5:r,lines:n}),this.logger=kX(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,uX.getRules)(),m1.call(this,mX,e,"NOT SUPPORTED"),m1.call(this,gX,e,"DEPRECATED","warn"),this._metaOpts=SX.call(this),e.formats&&vX.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&bX.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),TX.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=p1;n==="id"&&(i={...p1},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 y1.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,fu.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=g1.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new du.SchemaEnv({schema:{},schemaId:n});if(r=du.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=g1.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,fu.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(RX.call(this,n,r),!r)return(0,CS.eachItem)(n,s=>ES.call(this,s)),this;wX.call(this,r);let i={...r,type:(0,Rm.getJSONTypes)(r.type),schemaType:(0,Rm.getJSONTypes)(r.schemaType)};return(0,CS.eachItem)(n,i.type.length===0?s=>ES.call(this,s,i):s=>i.type.forEach(o=>ES.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]=v1(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,fu.normalizeId)(o||n);let l=fu.getSchemaRefs.call(this,e,n);return c=new du.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):du.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{du.compileSchema.call(this,e)}finally{this.opts=r}}};pu.ValidationError=lX.default;pu.MissingRefError=y1.default;sr.default=pu;function m1(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 g1(t){return t=(0,fu.normalizeId)(t),this.schemas[t]||this.refs[t]}function TX(){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 vX(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function bX(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 SX(){let t={...this.opts};for(let e of pX)delete t[e];return t}var _X={log(){},warn(){},error(){}};function kX(t){if(t===!1)return _X;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 NX=/^[a-z_$][a-z0-9_$:-]*$/i;function RX(t,e){let{RULES:r}=this;if((0,CS.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!NX.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 ES(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,Rm.getJSONTypes)(e.type),schemaType:(0,Rm.getJSONTypes)(e.schemaType)}};e.before?PX.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 PX(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 wX(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=v1(e)),t.validateSchema=this.compile(e,!0))}var EX={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function v1(t){return{anyOf:[t,EX]}}});var S1=R(DS=>{"use strict";Object.defineProperty(DS,"__esModule",{value:!0});var CX={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};DS.default=CX});var Em=R(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.callRef=bo.getValidate=void 0;var DX=cu(),_1=En(),zr=Te(),Xa=wn(),k1=lu(),Pm=Ee(),AX={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=k1.resolveRef.call(c,l,i,r);if(u===void 0)throw new DX.default(n.opts.uriResolver,i,r);if(u instanceof k1.SchemaEnv)return f(u);return p(u);function d(){if(s===l)return wm(t,o,s,s.$async);let m=e.scopeValue("root",{ref:l});return wm(t,(0,zr._)`${m}.validate`,l,l.$async)}function f(m){let h=N1(t,m);wm(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,zr.stringify)(m)}:{ref:m}),T=e.name("valid"),b=t.subschema({schema:m,dataTypes:[],schemaPath:zr.nil,topSchemaRef:h,errSchemaPath:r},T);t.mergeEvaluated(b),t.ok(T)}}};function N1(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,zr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}bo.getValidate=N1;function wm(t,e,r,n){let{gen:i,it:s}=t,{allErrors:o,schemaEnv:a,opts:c}=s,l=c.passContext?Xa.default.this:zr.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,zr._)`await ${(0,_1.callValidateCode)(t,e,l)}`),p(e),o||i.assign(m,!0)},h=>{i.if((0,zr._)`!(${h} instanceof ${s.ValidationError})`,()=>i.throw(h)),f(h),o||i.assign(m,!1)}),t.ok(m)}function d(){t.result((0,_1.callValidateCode)(t,e,l),()=>p(e),()=>f(e))}function f(m){let h=(0,zr._)`${m}.errors`;i.assign(Xa.default.vErrors,(0,zr._)`${Xa.default.vErrors} === null ? ${h} : ${Xa.default.vErrors}.concat(${h})`),i.assign(Xa.default.errors,(0,zr._)`${Xa.default.vErrors}.length`)}function p(m){var h;if(!s.opts.unevaluated)return;let T=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(T&&!T.dynamicProps)T.props!==void 0&&(s.props=Pm.mergeEvaluated.props(i,T.props,s.props));else{let b=i.var("props",(0,zr._)`${m}.evaluated.props`);s.props=Pm.mergeEvaluated.props(i,b,s.props,zr.Name)}if(s.items!==!0)if(T&&!T.dynamicItems)T.items!==void 0&&(s.items=Pm.mergeEvaluated.items(i,T.items,s.items));else{let b=i.var("items",(0,zr._)`${m}.evaluated.items`);s.items=Pm.mergeEvaluated.items(i,b,s.items,zr.Name)}}}bo.callRef=wm;bo.default=AX});var R1=R(AS=>{"use strict";Object.defineProperty(AS,"__esModule",{value:!0});var IX=S1(),OX=Em(),MX=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",IX.default,OX.default];AS.default=MX});var P1=R(IS=>{"use strict";Object.defineProperty(IS,"__esModule",{value:!0});var Cm=Te(),Ms=Cm.operators,Dm={maximum:{okStr:"<=",ok:Ms.LTE,fail:Ms.GT},minimum:{okStr:">=",ok:Ms.GTE,fail:Ms.LT},exclusiveMaximum:{okStr:"<",ok:Ms.LT,fail:Ms.GTE},exclusiveMinimum:{okStr:">",ok:Ms.GT,fail:Ms.LTE}},xX={message:({keyword:t,schemaCode:e})=>(0,Cm.str)`must be ${Dm[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Cm._)`{comparison: ${Dm[t].okStr}, limit: ${e}}`},LX={keyword:Object.keys(Dm),type:"number",schemaType:"number",$data:!0,error:xX,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Cm._)`${r} ${Dm[e].fail} ${n} || isNaN(${r})`)}};IS.default=LX});var w1=R(OS=>{"use strict";Object.defineProperty(OS,"__esModule",{value:!0});var hu=Te(),qX={message:({schemaCode:t})=>(0,hu.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,hu._)`{multipleOf: ${t}}`},$X={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:qX,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,s=i.opts.multipleOfPrecision,o=e.let("res"),a=s?(0,hu._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,hu._)`${o} !== parseInt(${o})`;t.fail$data((0,hu._)`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};OS.default=$X});var C1=R(MS=>{"use strict";Object.defineProperty(MS,"__esModule",{value:!0});function E1(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}MS.default=E1;E1.code='require("ajv/dist/runtime/ucs2length").default'});var D1=R(xS=>{"use strict";Object.defineProperty(xS,"__esModule",{value:!0});var So=Te(),BX=Ee(),FX=C1(),jX={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,So.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,So._)`{limit: ${t}}`},UX={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:jX,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,s=e==="maxLength"?So.operators.GT:So.operators.LT,o=i.opts.unicode===!1?(0,So._)`${r}.length`:(0,So._)`${(0,BX.useFunc)(t.gen,FX.default)}(${r})`;t.fail$data((0,So._)`${o} ${s} ${n}`)}};xS.default=UX});var A1=R(LS=>{"use strict";Object.defineProperty(LS,"__esModule",{value:!0});var HX=En(),Am=Te(),VX={message:({schemaCode:t})=>(0,Am.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Am._)`{pattern: ${t}}`},zX={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:VX,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:s}=t,o=s.opts.unicodeRegExp?"u":"",a=r?(0,Am._)`(new RegExp(${i}, ${o}))`:(0,HX.usePattern)(t,n);t.fail$data((0,Am._)`!${a}.test(${e})`)}};LS.default=zX});var I1=R(qS=>{"use strict";Object.defineProperty(qS,"__esModule",{value:!0});var mu=Te(),WX={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,mu.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,mu._)`{limit: ${t}}`},GX={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:WX,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?mu.operators.GT:mu.operators.LT;t.fail$data((0,mu._)`Object.keys(${r}).length ${i} ${n}`)}};qS.default=GX});var O1=R($S=>{"use strict";Object.defineProperty($S,"__esModule",{value:!0});var gu=En(),yu=Te(),KX=Ee(),YX={message:({params:{missingProperty:t}})=>(0,yu.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,yu._)`{missingProperty: ${t}}`},XX={keyword:"required",type:"object",schemaType:"array",$data:!0,error:YX,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 T=o.schemaEnv.baseId+o.errSchemaPath,b=`required property "${h}" is not defined at "${T}" (strictRequired)`;(0,KX.checkStrictMode)(o,b,o.opts.strictRequired)}}function l(){if(c||s)t.block$data(yu.nil,d);else for(let p of r)(0,gu.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,gu.checkMissingProp)(t,r,p)),(0,gu.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,gu.noPropertyInData)(e,i,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(m,(0,gu.propertyInData)(e,i,p,a.ownProperties)),e.if((0,yu.not)(m),()=>{t.error(),e.break()})},yu.nil)}}};$S.default=XX});var M1=R(BS=>{"use strict";Object.defineProperty(BS,"__esModule",{value:!0});var Tu=Te(),JX={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Tu.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Tu._)`{limit: ${t}}`},QX={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:JX,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?Tu.operators.GT:Tu.operators.LT;t.fail$data((0,Tu._)`${r}.length ${i} ${n}`)}};BS.default=QX});var Im=R(FS=>{"use strict";Object.defineProperty(FS,"__esModule",{value:!0});var x1=dS();x1.code='require("ajv/dist/runtime/equal").default';FS.default=x1});var L1=R(US=>{"use strict";Object.defineProperty(US,"__esModule",{value:!0});var jS=nu(),or=Te(),ZX=Ee(),e4=Im(),t4={message:({params:{i:t,j:e}})=>(0,or.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,or._)`{i: ${t}, j: ${e}}`},r4={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:t4,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,jS.getSchemaTypes)(s.items):[];t.block$data(c,u,(0,or._)`${o} === false`),t.ok(c);function u(){let m=e.let("i",(0,or._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,or._)`${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 T=e.name("item"),b=(0,jS.checkDataTypes)(l,T,a.opts.strictNumbers,jS.DataType.Wrong),_=e.const("indices",(0,or._)`{}`);e.for((0,or._)`;${m}--;`,()=>{e.let(T,(0,or._)`${r}[${m}]`),e.if(b,(0,or._)`continue`),l.length>1&&e.if((0,or._)`typeof ${T} == "string"`,(0,or._)`${T} += "_"`),e.if((0,or._)`typeof ${_}[${T}] == "number"`,()=>{e.assign(h,(0,or._)`${_}[${T}]`),t.error(),e.assign(c,!1).break()}).code((0,or._)`${_}[${T}] = ${m}`)})}function p(m,h){let T=(0,ZX.useFunc)(e,e4.default),b=e.name("outer");e.label(b).for((0,or._)`;${m}--;`,()=>e.for((0,or._)`${h} = ${m}; ${h}--;`,()=>e.if((0,or._)`${T}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(b)})))}}};US.default=r4});var q1=R(VS=>{"use strict";Object.defineProperty(VS,"__esModule",{value:!0});var HS=Te(),n4=Ee(),i4=Im(),s4={message:"must be equal to constant",params:({schemaCode:t})=>(0,HS._)`{allowedValue: ${t}}`},o4={keyword:"const",$data:!0,error:s4,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,HS._)`!${(0,n4.useFunc)(e,i4.default)}(${r}, ${i})`):t.fail((0,HS._)`${s} !== ${r}`)}};VS.default=o4});var $1=R(zS=>{"use strict";Object.defineProperty(zS,"__esModule",{value:!0});var vu=Te(),a4=Ee(),c4=Im(),l4={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,vu._)`{allowedValues: ${t}}`},u4={keyword:"enum",schemaType:"array",$data:!0,error:l4,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,a4.useFunc)(e,c4.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,vu.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,vu._)`${l()}(${r}, ${p})`,()=>e.assign(u,!0).break()))}function f(p,m){let h=i[m];return typeof h=="object"&&h!==null?(0,vu._)`${l()}(${r}, ${p}[${m}])`:(0,vu._)`${r} === ${h}`}}};zS.default=u4});var B1=R(WS=>{"use strict";Object.defineProperty(WS,"__esModule",{value:!0});var d4=P1(),f4=w1(),p4=D1(),h4=A1(),m4=I1(),g4=O1(),y4=M1(),T4=L1(),v4=q1(),b4=$1(),S4=[d4.default,f4.default,p4.default,h4.default,m4.default,g4.default,y4.default,T4.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},v4.default,b4.default];WS.default=S4});var KS=R(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});bu.validateAdditionalItems=void 0;var _o=Te(),GS=Ee(),_4={message:({params:{len:t}})=>(0,_o.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,_o._)`{limit: ${t}}`},k4={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:_4,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,GS.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}F1(t,n)}};function F1(t,e){let{gen:r,schema:n,data:i,keyword:s,it:o}=t;o.items=!0;let a=r.const("len",(0,_o._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,_o._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,GS.alwaysValidSchema)(o,n)){let l=r.var("valid",(0,_o._)`${a} <= ${e.length}`);r.if((0,_o.not)(l),()=>c(l)),t.ok(l)}function c(l){r.forRange("i",e.length,a,u=>{t.subschema({keyword:s,dataProp:u,dataPropType:GS.Type.Num},l),o.allErrors||r.if((0,_o.not)(l),()=>r.break())})}}bu.validateAdditionalItems=F1;bu.default=k4});var YS=R(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.validateTuple=void 0;var j1=Te(),Om=Ee(),N4=En(),R4={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return U1(t,"additionalItems",e);r.items=!0,!(0,Om.alwaysValidSchema)(r,e)&&t.ok((0,N4.validateArray)(t))}};function U1(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=Om.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),l=n.const("len",(0,j1._)`${s}.length`);r.forEach((d,f)=>{(0,Om.alwaysValidSchema)(a,d)||(n.if((0,j1._)`${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 T=`"${o}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,Om.checkStrictMode)(a,T,f.strictTuples)}}}Su.validateTuple=U1;Su.default=R4});var H1=R(XS=>{"use strict";Object.defineProperty(XS,"__esModule",{value:!0});var P4=YS(),w4={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,P4.validateTuple)(t,"items")};XS.default=w4});var z1=R(JS=>{"use strict";Object.defineProperty(JS,"__esModule",{value:!0});var V1=Te(),E4=Ee(),C4=En(),D4=KS(),A4={message:({params:{len:t}})=>(0,V1.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,V1._)`{limit: ${t}}`},I4={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:A4,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,E4.alwaysValidSchema)(n,e)&&(i?(0,D4.validateAdditionalItems)(t,i):t.ok((0,C4.validateArray)(t)))}};JS.default=I4});var W1=R(QS=>{"use strict";Object.defineProperty(QS,"__esModule",{value:!0});var Dn=Te(),Mm=Ee(),O4={message:({params:{min:t,max:e}})=>e===void 0?(0,Dn.str)`must contain at least ${t} valid item(s)`:(0,Dn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Dn._)`{minContains: ${t}}`:(0,Dn._)`{minContains: ${t}, maxContains: ${e}}`},M4={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:O4,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,Dn._)`${i}.length`);if(t.setParams({min:o,max:a}),a===void 0&&o===0){(0,Mm.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){(0,Mm.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Mm.alwaysValidSchema)(s,r)){let h=(0,Dn._)`${u} >= ${o}`;a!==void 0&&(h=(0,Dn._)`${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,Dn._)`${i}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),T=e.let("count",0);p(h,()=>e.if(h,()=>m(T)))}function p(h,T){e.forRange("i",0,u,b=>{t.subschema({keyword:"contains",dataProp:b,dataPropType:Mm.Type.Num,compositeRule:!0},h),T()})}function m(h){e.code((0,Dn._)`${h}++`),a===void 0?e.if((0,Dn._)`${h} >= ${o}`,()=>e.assign(d,!0).break()):(e.if((0,Dn._)`${h} > ${a}`,()=>e.assign(d,!1).break()),o===1?e.assign(d,!0):e.if((0,Dn._)`${h} >= ${o}`,()=>e.assign(d,!0)))}}};QS.default=M4});var xm=R(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.validateSchemaDeps=Ni.validatePropertyDeps=Ni.error=void 0;var ZS=Te(),x4=Ee(),_u=En();Ni.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,ZS.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,ZS._)`{property: ${t},
|
|
180
180
|
missingProperty: ${n},
|
|
181
181
|
depsCount: ${e},
|
|
182
|
-
deps: ${r}}`};var M4={keyword:"dependencies",type:"object",schemaType:"object",error:bi.error,code(t){let[e,r]=x4(t);V1(t,e),z1(t,r)}};function x4({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 V1(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,vu.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,vu.checkReportMissingProp)(t,l)}):(r.if((0,KS._)`${c} && (${(0,vu.checkMissingProp)(t,a,s)})`),(0,vu.reportMissingProp)(t,s),r.else())}}bi.validatePropertyDeps=V1;function z1(t,e=t.schema){let{gen:r,data:n,keyword:i,it:s}=t,o=r.name("valid");for(let a in e)(0,O4.alwaysValidSchema)(s,e[a])||(r.if((0,vu.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))}bi.validateSchemaDeps=z1;bi.default=M4});var G1=R(YS=>{"use strict";Object.defineProperty(YS,"__esModule",{value:!0});var W1=Te(),L4=Ee(),q4={message:"property name must be valid",params:({params:t})=>(0,W1._)`{propertyName: ${t.propertyName}}`},$4={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:q4,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,L4.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,W1.not)(s),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(s)}};YS.default=$4});var JS=R(XS=>{"use strict";Object.defineProperty(XS,"__esModule",{value:!0});var Cm=Rn(),Qn=Te(),B4=Nn(),Dm=Ee(),F4={message:"must NOT have additional properties",params:({params:t})=>(0,Qn._)`{additionalProperty: ${t.additionalProperty}}`},j4={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:F4,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,Dm.alwaysValidSchema)(o,r))return;let l=(0,Cm.allSchemaProperties)(n.properties),u=(0,Cm.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Qn._)`${s} === ${B4.default.errors}`);function d(){e.forIn("key",i,T=>{!l.length&&!u.length?m(T):e.if(f(T),()=>m(T))})}function f(T){let b;if(l.length>8){let S=(0,Dm.schemaRefOrVal)(o,n.properties,"properties");b=(0,Cm.isOwnProperty)(e,S,T)}else l.length?b=(0,Qn.or)(...l.map(S=>(0,Qn._)`${T} === ${S}`)):b=Qn.nil;return u.length&&(b=(0,Qn.or)(b,...u.map(S=>(0,Qn._)`${(0,Cm.usePattern)(t,S)}.test(${T})`))),(0,Qn.not)(b)}function p(T){e.code((0,Qn._)`delete ${i}[${T}]`)}function m(T){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(T);return}if(r===!1){t.setParams({additionalProperty:T}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,Dm.alwaysValidSchema)(o,r)){let b=e.name("valid");c.removeAdditional==="failing"?(h(T,b,!1),e.if((0,Qn.not)(b),()=>{t.reset(),p(T)})):(h(T,b),a||e.if((0,Qn.not)(b),()=>e.break()))}}function h(T,b,S){let v={keyword:"additionalProperties",dataProp:T,dataPropType:Dm.Type.Str};S===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,b)}}};XS.default=j4});var X1=R(ZS=>{"use strict";Object.defineProperty(ZS,"__esModule",{value:!0});var U4=iu(),K1=Rn(),QS=Ee(),Y1=JS(),H4={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&&Y1.default.code(new U4.KeywordCxt(s,Y1.default,"additionalProperties"));let o=(0,K1.allSchemaProperties)(r);for(let d of o)s.definedProperties.add(d);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=QS.mergeEvaluated.props(e,(0,QS.toHash)(o),s.props));let a=o.filter(d=>!(0,QS.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,K1.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)}}};ZS.default=H4});var e$=R(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});var J1=Rn(),Am=Te(),Q1=Ee(),Z1=Ee(),V4={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,J1.allSchemaProperties)(r),c=a.filter(h=>(0,Q1.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 Am.Name)&&(s.props=(0,Z1.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 T in l)new RegExp(h).test(T)&&(0,Q1.checkStrictMode)(s,`property ${T} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,T=>{e.if((0,Am._)`${(0,J1.usePattern)(t,h)}.test(${T})`,()=>{let b=c.includes(h);b||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:T,dataPropType:Z1.Type.Str},u),s.opts.unevaluated&&d!==!0?e.assign((0,Am._)`${d}[${T}]`,!0):!b&&!s.allErrors&&e.if((0,Am.not)(u),()=>e.break())})})}}};e_.default=V4});var t$=R(t_=>{"use strict";Object.defineProperty(t_,"__esModule",{value:!0});var z4=Ee(),W4={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,z4.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"}};t_.default=W4});var r$=R(r_=>{"use strict";Object.defineProperty(r_,"__esModule",{value:!0});var G4=Rn(),K4={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:G4.validateUnion,error:{message:"must match a schema in anyOf"}};r_.default=K4});var n$=R(n_=>{"use strict";Object.defineProperty(n_,"__esModule",{value:!0});var Im=Te(),Y4=Ee(),X4={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Im._)`{passingSchemas: ${t.passing}}`},J4={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:X4,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,Y4.alwaysValidSchema)(i,u)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Im._)`${c} && ${o}`).assign(o,!1).assign(a,(0,Im._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(a,d),f&&t.mergeEvaluated(f,Im.Name)})})}}};n_.default=J4});var i$=R(i_=>{"use strict";Object.defineProperty(i_,"__esModule",{value:!0});var Q4=Ee(),Z4={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,Q4.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(a)})}};i_.default=Z4});var a$=R(s_=>{"use strict";Object.defineProperty(s_,"__esModule",{value:!0});var Om=Te(),o$=Ee(),e9={message:({params:t})=>(0,Om.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Om._)`{failingKeyword: ${t.ifClause}}`},t9={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:e9,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,o$.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=s$(n,"then"),s=s$(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,Om.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,Om._)`${u}`):t.setParams({ifClause:u})}}}};function s$(t,e){let r=t.schema[e];return r!==void 0&&!(0,o$.alwaysValidSchema)(t,r)}s_.default=t9});var c$=R(o_=>{"use strict";Object.defineProperty(o_,"__esModule",{value:!0});var r9=Ee(),n9={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,r9.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};o_.default=n9});var l$=R(a_=>{"use strict";Object.defineProperty(a_,"__esModule",{value:!0});var i9=HS(),s9=F1(),o9=VS(),a9=U1(),c9=H1(),l9=Em(),u9=G1(),d9=JS(),f9=X1(),p9=e$(),h9=t$(),m9=r$(),g9=n$(),y9=i$(),T9=a$(),v9=c$();function b9(t=!1){let e=[h9.default,m9.default,g9.default,y9.default,T9.default,v9.default,u9.default,d9.default,l9.default,f9.default,p9.default];return t?e.push(s9.default,a9.default):e.push(i9.default,o9.default),e.push(c9.default),e}a_.default=b9});var u$=R(c_=>{"use strict";Object.defineProperty(c_,"__esModule",{value:!0});var xt=Te(),S9={message:({schemaCode:t})=>(0,xt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,xt._)`{format: ${t}}`},_9={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:S9,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,xt._)`${m}[${o}]`),T=r.let("fType"),b=r.let("format");r.if((0,xt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(T,(0,xt._)`${h}.type || "string"`).assign(b,(0,xt._)`${h}.validate`),()=>r.assign(T,(0,xt._)`"string"`).assign(b,h)),t.fail$data((0,xt.or)(S(),v()));function S(){return c.strictSchema===!1?xt.nil:(0,xt._)`${o} && !${b}`}function v(){let N=u.$async?(0,xt._)`(${h}.async ? await ${b}(${n}) : ${b}(${n}))`:(0,xt._)`${b}(${n})`,C=(0,xt._)`(typeof ${b} == "function" ? ${N} : ${b}.test(${n}))`;return(0,xt._)`${b} && ${b} !== true && ${T} === ${e} && !${C}`}}function p(){let m=d.formats[s];if(!m){S();return}if(m===!0)return;let[h,T,b]=v(m);h===e&&t.pass(N());function S(){if(c.strictSchema===!1){d.logger.warn(C());return}throw new Error(C());function C(){return`unknown format "${s}" ignored in schema at path "${l}"`}}function v(C){let H=C instanceof RegExp?(0,xt.regexpCode)(C):c.code.formats?(0,xt._)`${c.code.formats}${(0,xt.getProperty)(s)}`:void 0,M=r.scopeValue("formats",{key:s,ref:C,code:H});return typeof C=="object"&&!(C instanceof RegExp)?[C.type||"string",C.validate,(0,xt._)`${M}.validate`]:["string",C,M]}function N(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,xt._)`await ${b}(${n})`}return typeof T=="function"?(0,xt._)`${b}(${n})`:(0,xt._)`${b}.test(${n})`}}}};c_.default=_9});var d$=R(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var k9=u$(),N9=[k9.default];l_.default=N9});var f$=R(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});Ka.contentVocabulary=Ka.metadataVocabulary=void 0;Ka.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Ka.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var h$=R(u_=>{"use strict";Object.defineProperty(u_,"__esModule",{value:!0});var R9=_1(),P9=L1(),w9=l$(),E9=d$(),p$=f$(),C9=[R9.default,P9.default,(0,w9.default)(),E9.default,p$.metadataVocabulary,p$.contentVocabulary];u_.default=C9});var f_=R(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});bu.dynamicAnchor=void 0;var d_=Te(),D9=Nn(),m$=ou(),A9=Sm(),I9={keyword:"$dynamicAnchor",schemaType:"string",code:t=>g$(t,t.schema)};function g$(t,e){let{gen:r,it:n}=t;n.schemaEnv.root.dynamicAnchors[e]=!0;let i=(0,d_._)`${D9.default.dynamicAnchors}${(0,d_.getProperty)(e)}`,s=n.errSchemaPath==="#"?n.validateName:O9(t);r.if((0,d_._)`!${i}`,()=>r.assign(i,s))}bu.dynamicAnchor=g$;function O9(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 m$.SchemaEnv({schema:r,schemaId:c,root:i,baseId:s,localRefs:o,meta:a});return m$.compileSchema.call(n,l),(0,A9.getValidate)(t,l)}bu.default=I9});var p_=R(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.dynamicRef=void 0;var y$=Te(),M9=Nn(),T$=Sm(),x9={keyword:"$dynamicRef",schemaType:"string",code:t=>v$(t,t.schema)};function v$(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,y$._)`${M9.default.dynamicAnchors}${(0,y$.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,T$.callRef)(t,c),r.let(l,!0)}):()=>(0,T$.callRef)(t,c)}}Su.dynamicRef=v$;Su.default=x9});var b$=R(h_=>{"use strict";Object.defineProperty(h_,"__esModule",{value:!0});var L9=f_(),q9=Ee(),$9={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,L9.dynamicAnchor)(t,""):(0,q9.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}};h_.default=$9});var S$=R(m_=>{"use strict";Object.defineProperty(m_,"__esModule",{value:!0});var B9=p_(),F9={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,B9.dynamicRef)(t,t.schema)};m_.default=F9});var _$=R(g_=>{"use strict";Object.defineProperty(g_,"__esModule",{value:!0});var j9=f_(),U9=p_(),H9=b$(),V9=S$(),z9=[j9.default,U9.default,H9.default,V9.default];g_.default=z9});var N$=R(y_=>{"use strict";Object.defineProperty(y_,"__esModule",{value:!0});var k$=Em(),W9={keyword:"dependentRequired",type:"object",schemaType:"object",error:k$.error,code:t=>(0,k$.validatePropertyDeps)(t)};y_.default=W9});var R$=R(T_=>{"use strict";Object.defineProperty(T_,"__esModule",{value:!0});var G9=Em(),K9={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,G9.validateSchemaDeps)(t)};T_.default=K9});var P$=R(v_=>{"use strict";Object.defineProperty(v_,"__esModule",{value:!0});var Y9=Ee(),X9={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:e,it:r}){e.contains===void 0&&(0,Y9.checkStrictMode)(r,`"${t}" without "contains" is ignored`)}};v_.default=X9});var w$=R(b_=>{"use strict";Object.defineProperty(b_,"__esModule",{value:!0});var J9=N$(),Q9=R$(),Z9=P$(),eJ=[J9.default,Q9.default,Z9.default];b_.default=eJ});var C$=R(S_=>{"use strict";Object.defineProperty(S_,"__esModule",{value:!0});var Os=Te(),E$=Ee(),tJ=Nn(),rJ={message:"must NOT have unevaluated properties",params:({params:t})=>(0,Os._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},nJ={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:rJ,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 Os.Name?e.if((0,Os._)`${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,Os._)`${i} === ${tJ.default.errors}`);function c(d){if(r===!1){t.setParams({unevaluatedProperty:d}),t.error(),o||e.break();return}if(!(0,E$.alwaysValidSchema)(s,r)){let f=e.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:E$.Type.Str},f),o||e.if((0,Os.not)(f),()=>e.break())}}function l(d,f){return(0,Os._)`!${d} || !${d}[${f}]`}function u(d,f){let p=[];for(let m in d)d[m]===!0&&p.push((0,Os._)`${f} !== ${m}`);return(0,Os.and)(...p)}}};S_.default=nJ});var A$=R(__=>{"use strict";Object.defineProperty(__,"__esModule",{value:!0});var vo=Te(),D$=Ee(),iJ={message:({params:{len:t}})=>(0,vo.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,vo._)`{limit: ${t}}`},sJ={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:iJ,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,vo._)`${n}.length`);if(r===!1)t.setParams({len:s}),t.fail((0,vo._)`${o} > ${s}`);else if(typeof r=="object"&&!(0,D$.alwaysValidSchema)(i,r)){let c=e.var("valid",(0,vo._)`${o} <= ${s}`);e.if((0,vo.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:D$.Type.Num},c),i.allErrors||e.if((0,vo.not)(c),()=>e.break())})}}};__.default=sJ});var I$=R(k_=>{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});var oJ=C$(),aJ=A$(),cJ=[oJ.default,aJ.default];k_.default=cJ});var M$=R(Mm=>{"use strict";Object.defineProperty(Mm,"__esModule",{value:!0});Mm.DiscrError=void 0;var O$;(function(t){t.Tag="tag",t.Mapping="mapping"})(O$||(Mm.DiscrError=O$={}))});var L$=R(R_=>{"use strict";Object.defineProperty(R_,"__esModule",{value:!0});var Ya=Te(),N_=M$(),x$=ou(),lJ=su(),uJ=Ee(),dJ={message:({params:{discrError:t,tagName:e}})=>t===N_.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Ya._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},fJ={keyword:"discriminator",type:"object",schemaType:"object",error:dJ,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,Ya._)`${r}${(0,Ya.getProperty)(a)}`);e.if((0,Ya._)`typeof ${l} == "string"`,()=>u(),()=>t.error(!1,{discrError:N_.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,Ya._)`${l} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:N_.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,Ya.Name),m}function f(){var p;let m={},h=b(i),T=!0;for(let N=0;N<o.length;N++){let C=o[N];if(C?.$ref&&!(0,uJ.schemaHasRulesButRef)(C,s.self.RULES)){let M=C.$ref;if(C=x$.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,M),C instanceof x$.SchemaEnv&&(C=C.schema),C===void 0)throw new lJ.default(s.opts.uriResolver,s.baseId,M)}let H=(p=C?.properties)===null||p===void 0?void 0:p[a];if(typeof H!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);T=T&&(h||b(C)),S(H,N)}if(!T)throw new Error(`discriminator: "${a}" must be required`);return m;function b({required:N}){return Array.isArray(N)&&N.includes(a)}function S(N,C){if(N.const)v(N.const,C);else if(N.enum)for(let H of N.enum)v(H,C);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function v(N,C){if(typeof N!="string"||N in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[N]=C}}}};R_.default=fJ});var q$=R((mwe,pJ)=>{pJ.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 $$=R((gwe,hJ)=>{hJ.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 B$=R((ywe,mJ)=>{mJ.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 F$=R((Twe,gJ)=>{gJ.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 j$=R((vwe,yJ)=>{yJ.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 U$=R((bwe,TJ)=>{TJ.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 H$=R((Swe,vJ)=>{vJ.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 V$=R(P_=>{"use strict";Object.defineProperty(P_,"__esModule",{value:!0});var bJ=q$(),SJ=$$(),_J=B$(),kJ=F$(),NJ=j$(),RJ=U$(),PJ=H$(),wJ=["/properties"];function EJ(t){return[bJ,SJ,_J,kJ,e(this,NJ),RJ,e(this,PJ)].forEach(r=>this.addMetaSchema(r,void 0,!1)),this;function e(r,n){return t?r.$dataMetaSchema(n,wJ):n}}P_.default=EJ});var z$=R((vt,E_)=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.MissingRefError=vt.ValidationError=vt.CodeGen=vt.Name=vt.nil=vt.stringify=vt.str=vt._=vt.KeywordCxt=vt.Ajv2019=void 0;var CJ=y1(),DJ=h$(),AJ=_$(),IJ=w$(),OJ=I$(),MJ=L$(),xJ=V$(),w_="https://json-schema.org/draft/2019-09/schema",Xa=class extends CJ.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(AJ.default),DJ.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(IJ.default),this.addVocabulary(OJ.default),this.opts.discriminator&&this.addKeyword(MJ.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:r}=this.opts;r&&(xJ.default.call(this,e),this.refs["http://json-schema.org/schema"]=w_)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(w_)?w_:void 0)}};vt.Ajv2019=Xa;E_.exports=vt=Xa;E_.exports.Ajv2019=Xa;Object.defineProperty(vt,"__esModule",{value:!0});vt.default=Xa;var LJ=iu();Object.defineProperty(vt,"KeywordCxt",{enumerable:!0,get:function(){return LJ.KeywordCxt}});var Ja=Te();Object.defineProperty(vt,"_",{enumerable:!0,get:function(){return Ja._}});Object.defineProperty(vt,"str",{enumerable:!0,get:function(){return Ja.str}});Object.defineProperty(vt,"stringify",{enumerable:!0,get:function(){return Ja.stringify}});Object.defineProperty(vt,"nil",{enumerable:!0,get:function(){return Ja.nil}});Object.defineProperty(vt,"Name",{enumerable:!0,get:function(){return Ja.Name}});Object.defineProperty(vt,"CodeGen",{enumerable:!0,get:function(){return Ja.CodeGen}});var qJ=pm();Object.defineProperty(vt,"ValidationError",{enumerable:!0,get:function(){return qJ.default}});var $J=su();Object.defineProperty(vt,"MissingRefError",{enumerable:!0,get:function(){return $J.default}})});var tc=require("path"),We=$(Rw());var df=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=ww(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=Pw(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=Pw(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{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],i=e.line+1<r.length?r[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}},qn;(function(t){function e(i,s,o,a){return new df(i,s,o,a)}t.create=e;function r(i,s,o){if(i instanceof df)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=Uy(s.map(nU),(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})(qn||(qn={}));function Uy(t,e){if(t.length<=1)return t;let r=t.length/2|0,n=t.slice(0,r),i=t.slice(r);Uy(n,e),Uy(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 Pw(t,e,r=0){let n=e?[r]:[];for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);(s===13||s===10)&&(s===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,n.push(r+i+1))}return n}function ww(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 nU(t){let e=ww(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var ff=["namespace","class","enum","interface","struct","typeParameter","type","parameter","variable","property","enumMember","decorator","event","function","method","macro","label","comment","string","keyword","number","regexp","operator"],pf=["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"];var Vy=$(require("url")),Cw=require("crypto"),Xo=require("path"),er=$(U());var Hy=$(U());var Or=$(U());var Z=class{constructor(e){this._children=[];this.syntaxIssues=[];this.resetableIssues=[];this._firstToken=e?.start,this._lastToken=e?.end}get issues(){return[...this.syntaxIssues,...this.resetableIssues]}resetIssues(){this.resetableIssues=[],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 uri(){return this.firstToken.uri}getTopMostAstNodeForFile(e){return pe(e,this.uri)?[this]:this.children.flatMap(r=>r.getTopMostAstNodeForFile(e))}getDocumentSymbols(e){if(!this.docSymbolsMeta)return this.children.flatMap(n=>n.getDocumentSymbols(e)??[]);if(!pe(this.uri,e))return[];let r=fe(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(![Or.SymbolKind.File,Or.SymbolKind.Class,Or.SymbolKind.Constant].some(i=>i===e))return[];let r=Mr(this.uri),n=r?.range??fe(this);return[{location:Or.Location.create(ue(r?.docUri??this.uri),n),name:this.docSymbolsMeta.name?this.docSymbolsMeta.name:"__UNSET__",kind:this.docSymbolsMeta.kind},...this.children.flatMap(i=>i.getWorkspaceSymbols()??[]).filter(i=>i.kind===Or.SymbolKind.File||i.kind===Or.SymbolKind.Class||i.kind===Or.SymbolKind.Constant)]}buildSemanticTokens(e){this._children.forEach(r=>r.buildSemanticTokens(e)),!(!this.semanticTokenType||!this.semanticTokenModifiers)&&e(wi(this.semanticTokenType),Ei(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 Or.Range.create(Or.Position.create(this.firstToken.pos.line,this.firstToken.pos.col),Or.Position.create(this.lastToken.pos.line,this.lastToken.pos.colEnd))}get serializeUri(){return ue(this.uri)}serialize(e){return{uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var Se=class extends Z{get firstToken(){return this.operator?this.operator.firstToken:super.firstToken}toJson(){return-1}#e;resolve(e){return this.#e??=hf(this.toString(),e),this.#e}#t;evaluate(e){return this.#t??=Ce(`${this.operator?this.operator.toString():""}${this.resolve(e)}`),this.#t}#n;isTrue(e){return this.#n??=Ce(`!!(${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),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},ln=class t extends Se{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 Se?i.resolve(r):i.toString()).join(" ")})`;return Ce(`!!(${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 ii=class extends Se{constructor(r,n,i){super(n);this.value=r;this.docSymbolsMeta={name:`param${i+1}`,kind:Hy.SymbolKind.Variable},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}toString(){return this.value}},un=class extends Se{constructor(r,n){super();this.functionName=r;this.params=n;this.addChild(r),this.params.forEach(i=>this.addChild(i))}getDocumentSymbols(r){return pe(this.uri,r)?[{name:this.functionName.name,kind:Hy.SymbolKind.Function,range:fe(this),selectionRange:fe(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?Ce(`!!(${this.operator}${n})`):n}return super.isTrue(r)}};var Gr=(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 _e=(t,e=!0)=>er.Position.create(t.pos.line,e?t.pos.colEnd:t.pos.col),fe=t=>Gr(t.firstToken,t.lastToken),wi=t=>ff.findIndex(e=>e===t),Ei=t=>pf.findIndex(e=>e===t),zy=(t,e,r)=>!pe(t.uri,e)||r.line<t.pos.line?!1:r.line>t.pos.line?!0:r.character>=t.pos.colEnd,sU=(t,e,r)=>pe(t.uri,e)?r.line<t.pos.line?!0:r.line>t.pos.line?!1:r.character<t.pos.col:!1,br=(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)&&pe(t.uri,e))},yf=(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)},Dw=(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&&pe(t.uri,e))},Aw=(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 $n=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].reverse().find(s=>br(s,e,r));return n},kc=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].find(s=>sU(s.lastToken,e,r));return n===t?void 0:n},Nc=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].reverse().find(s=>zy(s.firstToken,e,r));return n===t?void 0:n},Tf="#virtual#",Wy=t=>t.includes(Tf),Mr=t=>{if(!Wy(t))return;let[e,r]=t.split(Tf),[n,i]=r.split("-"),[s,o]=n.split(":"),[a,c]=i.split(":");return{docUri:e,range:er.Range.create(er.Position.create(Number.parseInt(s),Number.parseInt(o)),er.Position.create(Number.parseInt(a),Number.parseInt(c)))}},Gy=t=>{let e=Mr(t.uri);e&&(t.range=e.range,t.uri=e?.docUri,t.virtual=!0,t.linkedTo=t.linkedTo.map(({range:r,uri:n})=>{let i=Mr(n);return{range:i?.range??r,uri:i?.docUri??n,templateStrings:[]}}))},G=(t,e,r=e,n,{severity:i=er.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l,inclusiveStart:u,inclusiveEnd:d}={severity:er.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[]})=>{let f={issues:Array.isArray(t)?t:[t],range:Gr(e,r,u,d),uri:e.uri,severity:i,linkedTo:s.map(({range:h,uri:T})=>({range:h,uri:T,templateStrings:[]})),tags:o,templateStrings:a,edit:c,codeActionTitle:l};Gy(f);let p,m=()=>(p??={severity:f.severity,range:f.range,message:f.issues?f.issues.map(lU).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}},$t=(t,e,r,n,{severity:i=er.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l,linkedToTemplateStrings:u=[]}={severity:er.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[],linkedToTemplateStrings:[]})=>{let d={issues:Array.isArray(t)?t:[t],range:Gr(e,r),uri:e.uri,severity:i,linkedTo:s.map(({range:m,uri:h},T)=>({range:m,uri:h,templateStrings:u.at(T)??[]})),tags:o,templateStrings:a,edit:c,codeActionTitle:l};Gy(d);let f,p=()=>(f??={severity:d.severity,range:d.range,message:uU(d),source:"devicetree",tags:d.tags,relatedInformation:[...d.linkedTo.map(m=>({message:d.issues.map(h=>dU(h,m.templateStrings)).join(" or "),location:{uri:ue(m.uri),range:m.range}}))]},f);return n?.resetableIssues.push(p),{raw:d,diagnostic:p}},B=(t,e,r,n,{severity:i=er.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l}={severity:er.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[]})=>{let u={issues:Array.isArray(t)?t:[t],range:Gr(e,r),severity:i,uri:e.uri,linkedTo:s.map(({range:p,uri:m})=>({range:p,uri:m,templateStrings:[]})),tags:o,templateStrings:a,edit:c,codeActionTitle:l};Gy(u);let d,f=()=>(d??={severity:u.severity,range:u.range,message:fU(u),relatedInformation:[...u.linkedTo.map(p=>({message:u.issues.map(pU).join(" or "),location:{uri:ue(p.uri),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 n?.resetableIssues.push(f),{raw:u,diagnostic:f}};function Bt(t,e,r,{severity:n=er.DiagnosticSeverity.Warning,linkedTo:i=[],tags:s,templateStrings:o=[],edit:a,codeActionTitle:c}={severity:er.DiagnosticSeverity.Warning,linkedTo:[],templateStrings:[],edit:[],codeActionTitle:void 0},l=r){let u={issues:Array.isArray(t)?t:[t],range:er.Range.create(r,l),severity:n,uri:e,linkedTo:i.map(({range:p,uri:m})=>({range:p,uri:m,templateStrings:[]})),tags:s,templateStrings:o,edit:a,codeActionTitle:c},d;return{raw:u,diagnostic:()=>(d??={severity:u.severity,range:u.range,message:hU(u),relatedInformation:[...u.linkedTo.map(p=>({message:u.issues.map(mU).join(" or "),location:{uri:ue(p.uri),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 Iw=(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 Nt(t,e,r){let n=Pe(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=>br(u,n,t.position));return c&&(o={runtime:s,item:null,ast:$n(c,n,t.position)},a=Number.MAX_SAFE_INTEGER),o||(o=s.getDeepestAstNode(n,t.position),a=e.getSortKey(o?.ast)),console.log(`search: ${performance.now()-i}ms`),r(o,u=>{let d=t.position;if(pe(u.uri,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 oe(t,e){return{start:t,end:e??t}}var j=(t,e)=>t?.tokens.some(r=>r===e),et=(t,e)=>r=>r?.value&&(e?.caseInsensitive?t.toLowerCase()===r.value.toLowerCase():t===r.value)?"yes":e?.allowPartial?oU(t)(r):"no",Me=t=>e=>e?.tokens.some(r=>r===t)?"yes":"no",oU=t=>e=>e?.value&&t.startsWith(e.value)?"partial":"no",Kr=(t,e)=>!!t&&!!e&&t.pos.line===e.pos.line&&pe(t.uri,e.uri),Ft=(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&&Kr(t,e),vf=t=>t.map((e,r)=>({index:r,context:e,files:e.getContextFiles()})),fn=(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=>pe(s,e.uri))?r:vf(t).sort(s=>s.context.id===n?-1:0).find(s=>s.files.some(o=>pe(o,e.uri)))?.context},Ky=(t,e)=>vf(t).filter(n=>n.files.some(i=>pe(i,e))).map(n=>n.context),Ow=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;return a.forEach((u,d)=>{let f=new RegExp(`\\b${u}\\b`,"g");l=l.replace(f,c[d])}),l=l.replace(/__VA_ARGS__/g,c.slice(a.length).join(", ")),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)=>{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 aU(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 cU=0,hf=(t,e)=>{let r=o=>o.replace(/(\w+)\s*##\s*(\w+)/g,(a,c,l)=>c+l),n=o=>o.replace(/#(\w+)/g,(a,c)=>`"${c}"`),i=t,s;do s=i,i=r(s),i=n(i),i=i.replace(/\b(\w+)\(([^()]*(?:\([^()]*\)[^()]*)*)\)|\b(\w+)\b/g,(o,a,c,l)=>{if(a==="defined"){let u=c.split(",").map(d=>d.trim());return u[0]?e.get(u[0])?.resolver:u}else if(a&&typeof e.get(a)?.resolver=="function"){let u=aU(c).map(d=>d.trim()).map(d=>d==="__COUNTER__"?(cU++).toString():d);return(e.get(a)?.resolver)(...u)}else if(l&&typeof e.get(l)?.resolver=="string")return e.get(l)?.resolver;return o});while(i!==s);return i};function Yy(t){return t.replace(/'(.)'/g,(e,r)=>r.charCodeAt(0).toString()).replace(/(0x[a-f\d]+|\d+)[ul]*/gi,"$1")}function Ce(t){try{return(0,eval)(Yy(t))}catch{}return t}var ue=t=>Vy.default.pathToFileURL(t).toString(),Pe=t=>it(Vy.default.fileURLToPath(t)),Mw=(t,e)=>{let r=(0,Xo.relative)(t,e);return!!r&&!r.startsWith("..")&&!(0,Xo.isAbsolute)(r)},pe=(t,e)=>!t||!e?!1:t===e,it=t=>(0,Xo.normalize)(process.platform==="win32"?t.toLowerCase():t),Ci=t=>(0,Cw.createHash)("sha256").update([it(t.dtsFile),...t.includePaths.map(it),...t.overlays.map(it),t.bindingType,...t.zephyrBindings.map(it),...t.deviceOrgBindingsMetaSchema.map(it),...t.deviceOrgTreeBindings.map(it),`showFormattingErrorAsDiagnostics-${t.showFormattingErrorAsDiagnostics}`].join(":")).digest("hex"),lU=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"}},uU=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]}".`}}).join(" or "),dU=(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]}".`;default:return"TODO"}},fU=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 should be used on bus type${t.templateStrings.length?"s":""}: ${t.templateStrings.join(" or ")}`}}).join(" or ").replace("INTRO",`Property "${t.templateStrings[0]}"`).replaceAll("INTRO ",""),pU=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"}},hU=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}`}}).join(" or "),mU=t=>"TODO",dn=(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},ss=(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},gU=(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},yU=(t,e)=>ss(t,e),xw=(t,e)=>{let r=[];for(let n of t){let i=n.childAddress,s=n.length,o=ss(i,s);if(dn(e,i)>=0&&dn(e,o)<0){let a=gU(e,i),c=n.parentAddress,l=yU(c,a),u=ss(c,s);r.push({start:l,end:u,range:Gr(n.rangeTokens.start,n.rangeTokens.end),uri:n.rangeTokens.start.uri})}}return r};function Lw(t){return Array.isArray(t)&&Array.isArray(t[0])}function Rc(t){return!t||t instanceof un?t:Rc(t.parentNode)}function Xy(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 Ew(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 qw(t,e){return Ew(t.end,e.start)>0&&Ew(t.start,e.end)<0}var $w=(t,e)=>{let r=Bw(t,e),n=Fw(t,e);r&&(t.topComment=r),n&&(t.endComment=n)},Bw=(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=Bw(r,e);return n&&(n.astAfterComment=t,r.astAfterComment=void 0),n??r},Fw=(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=Fw(r,e);return n&&(n.astBeforeComment=t,r.astBeforeComment=void 0),n??r},Ks=(t,e,r)=>{let n=[42,44,45,36];return r||n.push(52,32,53,8,49),t.severity===er.DiagnosticSeverity.Error&&pe(t.uri,e)&&!n.some(i=>t.issues.includes(i))};function bf(t){let e=t?.charAt(0);return!!e&&(e>="A"&&e<="Z"||e>="a"&&e<="z")}var jc=require("fs"),oD=require("path"),Js=$(U());var Bn=$(U());var zw=$(U());var jw=$(U());var ne=class extends Z{constructor(r,n){super(n);this.value=r;this.semanticTokenType="string",this.semanticTokenModifiers="declaration",this.docSymbolsMeta={name:this.value,kind:jw.SymbolKind.String}}toString(){return`"${this.value.toString()}"`}toJson(){return this.value}serialize(){return{type:"STRING",value:this.value,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var Hw=$(U());var Uw=$(U());var Kt=class extends Se{constructor(r,n,i=10){super(n);this.value=r;this.radix=i;this.docSymbolsMeta={name:this.value.toString(),kind:Uw.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,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var Ct=class extends Z{constructor(r){super();this.values=r;this.docSymbolsMeta={name:"Cell Array",kind:Hw.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 Kt)){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),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var Vw=$(U());var pn=class extends Z{constructor(r){super();this.values=r;this.docSymbolsMeta={name:"Byte String Value",kind:Vw.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?{value:r.value.toString(16),range:r.value.range,evaluated:r.value.value}:null),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var tt=class extends Z{constructor(r,n){super(n);this.name=r;this.semanticTokenType="property",this.semanticTokenModifiers="declaration"}toString(){return this.name}serialize(){return{value:this.name,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},Xe=class extends Z{constructor(r,n=[]){super();this.propertyName=r;this.labels=n;this._values=void 0;this.docSymbolsMeta={name:this.propertyName?.name??"Unknown",kind:zw.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 Ct?r.value.values.map(n=>n.value instanceof Kt?n.value.value:NaN):r.value instanceof pn?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 Ct?r.value.values.map(n=>n.value):r.value instanceof pn?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){return`${this.propertyName?.toString()??"__UNSET__"}${this.assignOperatorToken?` = ${this._values?.values.map(n=>n?.toPrettyString(r)??"NULL").join(", ")??"NULL"}`:""};`}serialize(r){return{name:this.propertyName?.serialize()??null,values:this.values?.values.map(n=>n?.value?.serialize(r)??null)??null,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var Ww=$(U());var Sr=class extends Z{constructor(r,n){super();this.keyword=n;this.addChild(n),this.docSymbolsMeta={name:r,kind:Ww.SymbolKind.Function}}};var xr=class extends Sr{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 yt=class extends Sr{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 Gw=$(U());var ie=class extends Z{constructor(r){super();this.label=r;this.docSymbolsMeta={name:`&${this.label?.value??"NULL"}`,kind:Gw.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,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var Je=class t extends Z{constructor(){super()}get path(){if(!this.pathName)return["__UNDEFINED__"];if(!this.parentNode||this instanceof It)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 xr)}addNodeChild(e){this.addChild(e)}},It=class extends Je{constructor(){super(),this.docSymbolsMeta={name:"/",kind:Bn.SymbolKind.Class}}get properties(){return this.children.filter(e=>e instanceof Xe)}get name(){return new xe("/",oe(this.firstToken))}get deleteProperties(){return this.children.filter(e=>e instanceof yt)}get nodes(){return this.children.filter(e=>e instanceof Ke)}get pathName(){return"/"}serialize(e){return{type:"ROOT",properties:this.properties.map(r=>r.serialize(e)),nodes:this.nodes.map(r=>r.serialize(e)),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},dr=class extends Je{constructor(r=[]){super();this.labels=r;this._reference=null;this.docSymbolsMeta={name:"DTC Name",kind:Bn.SymbolKind.Class},r.forEach(n=>{super.addChild(n)})}get serializeIssues(){return[...this.issues,...this.reference?.issues??[]].map(r=>r())}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:Bn.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 Ke)}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 Xe)}get deleteProperties(){return this.children.filter(r=>r instanceof yt)}serialize(r){return{type:"REF",name:this.reference?.serialize()??null,properties:this.properties.map(n=>n.serialize(r)),nodes:this.nodes.map(n=>n.serialize(r)),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},Ke=class t extends Je{constructor(r=[],n){super();this.labels=r;this.omitIfNoRef=n;this._name=null;this.docSymbolsMeta={name:"DTC Name",kind:Bn.SymbolKind.Class},n&&this.addChild(n),r.forEach(i=>{this.addChild(i)})}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:Bn.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 Xe)}get deleteProperties(){return this.children.filter(r=>r instanceof yt)}serialize(r){return{type:"CHILD",name:this.name?.serialize()??null,properties:this.properties.map(n=>n.serialize(r)),nodes:this.nodes.map(n=>n.serialize(r)),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},Pc=class extends Z{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,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},xe=class extends Z{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(wi("type"),Ei("declaration"),i,i),this.address!==void 0&&this.address.forEach(s=>{r(wi("decorator"),Ei("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,uri:this.serializeUri,range:Bn.Range.create(Bn.Position.create(r.pos.line,r.pos.col),Bn.Position.create(r.pos.line,r.pos.colEnd)),issues:this.serializeIssues},address:this.address?.map(n=>n.serialize())??null,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var sD=require("path"),yn=$(U());var _r=class extends Z{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 Vt=t=>t instanceof Sr?!0:t instanceof Je?!1:t.parentNode?Vt(t.parentNode):!1;var Jy=t=>{if(t instanceof Xe)return t;if(!(t instanceof Je))return t.parentNode?Jy(t.parentNode):void 0},Ys=t=>!t||t instanceof Xe?!1:t instanceof _r||Ys(t.parentNode),Jo=t=>[...t.map(e=>{if(e instanceof Ke||e instanceof It)return e.name;if(e instanceof dr)return e.reference})].filter(e=>!!e),Qy=(t,e)=>e?e.parentNode===t||Qy(t,e.parentNode):!1;var Dt=$(U());var Kw=$(U());var Fn=class extends Z{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 xe?n.buildSemanticTokens(r):r(wi("operator"),Ei("declaration"),n.firstToken,n.lastToken)})}},st=class extends Z{constructor(r){super();this.path=r;this.docSymbolsMeta={name:`/${this.path?.toString()??""}`,kind:Kw.SymbolKind.Namespace},this.addChild(r)}toString(){return`&${this.path?.toString()??"NULL"}`}toJson(){return-1}serialize(){return{type:"NODE_PATH",nodePath:this.path?.toString()??null,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var W=$(U());var Yw=require("path"),Sf=$(U());var Di=class extends Z{constructor(r,n){super();this.keyword=r;this.path=n;this.docSymbolsMeta={name:`Include ${n}`,kind:Sf.SymbolKind.File},this.addChild(r),this.addChild(n)}get resolvedPath(){return this._resolvedPath}set resolvedPath(r){this.docSymbolsMeta={name:`Include ${r}`,kind:Sf.SymbolKind.File},this._resolvedPath=r}},Qo=class extends Z{constructor(r,n,i){super(i);this._path=r;this.relative=n;this.docSymbolsMeta={name:(0,Yw.basename)(this.path),kind:Sf.SymbolKind.File},this.semanticTokenType="string",this.semanticTokenModifiers="declaration"}get path(){return this.relative?this._path.slice(1,-1):this._path}};var hn=class extends Z{constructor(r){super();this.comments=r;this.disabled=!1;r.forEach(this.addChild.bind(this))}toString(){return this.comments.map(r=>r.toString()).join(`
|
|
183
|
-
`)}},mn=class extends Z{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 Xw=$(U());var ft=class extends Se{constructor(r,n){super(n);this.name=r;this.docSymbolsMeta={name:this.name.toString(),kind:Xw.SymbolKind.Variable},this.semanticTokenType="macro",this.semanticTokenModifiers="declaration"}toString(){return this.name}};var xc=$(U());var Zy=$(U());var os=class extends Z{constructor(r,n){super(n);this.label=r;this.docSymbolsMeta={name:this.label.value,kind:Zy.SymbolKind.Constant},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration",this.addChild(r)}toString(){return`${this.label.toString()}:`}},tr=class extends Z{constructor(r,n){super(n);this.value=r;this.docSymbolsMeta={name:this.value,kind:Zy.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(wi("type"),Ei("declaration"),this.firstToken,this.lastToken)}toString(){return`${this.value}`}};var pt=class extends Z{constructor(e){super(e),this.semanticTokenType="keyword",this.semanticTokenModifiers="declaration"}};var Jw=$(U());var _f=class extends Z{constructor(r){super();this.values=r;this.docSymbolsMeta={name:"Values",kind:Jw.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 Qw=$(U());var kf=class extends Z{constructor(r){super();this.keyword=r;this.addChild(r),this.docSymbolsMeta={name:"DTS Document version",kind:Qw.SymbolKind.Function}}};var si=class extends Z{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 Nf=class extends Z{constructor(r,n){super(n);this.operator=r;this.semanticTokenType="operator",this.semanticTokenModifiers="declaration"}toString(){return this.operator}};var Zw=$(U());var Zo=class extends pt{toString(){return"..."}},oi=class extends Z{constructor(r,n){super();this.functionName=r;this.params=n;this.addChild(r),this.params.forEach(i=>this.addChild(i))}getDocumentSymbols(r){return pe(this.uri,r)?[{name:this.functionName.name,kind:Zw.SymbolKind.Function,range:fe(this),selectionRange:fe(this),children:this.params.flatMap(n=>n.getDocumentSymbols(r))}]:[]}toString(){return`${this.functionName}(${this.params.map(r=>r.toString()).join(",")})`}};var Ai=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||!pe(this.currentToken?.uri,e.uri))return;let s=this.currentToken,o=s;for(;this.currentToken?.pos.line===i&&pe(this.currentToken?.uri,e.uri);)o=this.moveToNextToken;return r&&this._issues.push(G(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=Ft(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=Ft(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||!pe(n.uri,s)||!pe(i.uri,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(Me));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 ft(s,oe(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(G(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(j(e,40)?(n="&",j(this.currentToken,40)&&(n="&&",r=this.moveToNextToken)):j(e,6)?(n="!",j(this.currentToken,0)&&(n="!=",r=this.moveToNextToken)):j(e,10)?n="~":j(e,8)?(n="|",j(this.currentToken,8)&&(n="||",r=this.moveToNextToken)):j(e,9)?n="^":j(e,4)?(n=">",j(this.currentToken,4)?(n=">>",r=this.moveToNextToken):j(this.currentToken,0)&&(n=">=",r=this.moveToNextToken)):j(e,5)?(n="<",j(this.currentToken,5)?(n="<<",r=this.moveToNextToken):j(this.currentToken,0)&&(n="<=",r=this.moveToNextToken)):j(e,15)?n="+":j(e,16)?n="-":j(e,17)?n="*":j(e,13)?n="/":j(e,18)?n="%":j(e,46)?j(this.currentToken,46)&&(n="##",r=this.moveToNextToken):j(e,0)&&j(this.currentToken,0)&&(n="==",r=this.moveToNextToken),n){let i=new Nf(n,oe(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(!Ft(r.lastToken,this.currentToken)){this.popStack();return}let n=this.processMacroCallParams();if(!n){this.popStack();return}if(r.name==="defined")n.length>1?this._issues.push(G(44,r.firstToken,r.lastToken,r)):n.length<1&&this._issues.push(G(45,r.firstToken,r.lastToken,r));else{let s=e.get(r.name)?.macro;s&&(s?.identifier instanceof oi?s.identifier.params.at(-1)instanceof Zo||(n.length>s.identifier.params.length?this._issues.push(G(44,r.firstToken,r.lastToken,r,{linkedTo:[s]})):n.length<s.identifier.params.length&&this._issues.push(G(45,r.firstToken,r.lastToken,r,{linkedTo:[s]}))):this._issues.push(G(43,r.firstToken,r.lastToken,r)))}let i=new un(r,n);return i.lastToken=this.prevToken,this.mergeStack(),i}processHex(){this.enqueueToStack();let e=this.checkConcurrentTokens([et("0"),et("x",{caseInsensitive:!0})]);if(e.length!==2){this.popStack();return}let r=this.consumeAnyConcurrentTokens([19,20].map(Me));if(!r.length){this.popStack();return}let n=Number.parseInt(r.map(s=>s.value).join(""),16),i=new Kt(n,oe(e[0],r.at(-1)),16);return this.mergeStack(),i}processDec(e=!1){this.enqueueToStack();let r;e&&(j(this.currentToken,16)||j(this.currentToken,15))&&Ft(this.currentToken,this.currentToken?.nextToken)&&(r=this.moveToNextToken);let n=this.consumeAnyConcurrentTokens([19].map(Me));if(!n.length){this.popStack();return}let i=Number.parseInt(n.map(o=>o.value).join(""),10);r&&j(r,16)&&(i=4294967295-i);let s=new Kt(i,oe(r??n[0],n.at(-1)),10);return this.mergeStack(),s}processEnclosedExpression(e,r){this.enqueueToStack();let n,i;if(j(this.currentToken,42)){let s;n=this.moveToNextToken,i=n;let o=this.processExpression(e,r,!0);return o&&(s=new ln(o,!0),o=new ln(s,!1),s.openBracket=n),j(this.currentToken,43)?(i=this.moveToNextToken,s&&(s.closeBracket=i)):n&&this._issues.push(G(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 ln?i.addExpression(o,a):i=new ln(i,!1,{operator:o,expression:a}):this._issues.push(G(27,o.firstToken,o.lastToken,r)),o=this.isOperator()}}return this.mergeStack(),i}processMacroCallParams(){if(!j(this.currentToken,42))return;let e=this.parseScopedBlock(n=>!!j(n,42),n=>!!j(n,43),n=>!!j(n,24));return e?.items.length===2&&j(e.endToken,43)?[]:e?.splitTokens.map((n,i)=>{if(n.tokens.length===0)return null;let s=new ii(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(""),oe(n.tokens[0],n.tokens.at(-1)),i);return s.splitToken=e.separatorTokens.at(i),s})}};var mT=require("fs"),ia=require("path"),Mc=$(U());var Ec=require("fs");var ai=class t{constructor(e,r){this.text=e;this.uri=r;this.inComment=!1;this.lineNumber=0;this.columnNumber=0;this._tokens=[];let n=this.text.replace(/\r\n/g,`
|
|
184
|
-
`).trimEnd();this.lines=n.split(`
|
|
185
|
-
`);for(let i=0;i<this.lines.length;i++)this.lines[i]+=`
|
|
186
|
-
`;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===`
|
|
187
|
-
`){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(Ft(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,uri:this.uri},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){let r="#";return e.startsWith(r)?(this.pushToken({tokens:[46],pos:this.generatePos(e,r),value:r}),!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 eT,Rf=class{constructor(){this.headerFiles=new Map;this.includeOwners=new WeakMap}getCPreprocessorParser(e,r,n,i){e=it(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 cpreprocess 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=it(e);let r=this.headerFiles.get(e);r&&Array.from(r).forEach(n=>{n[1]&&(console.log("disposing cpreprocessor cache for",e),Array.from(this.includeOwners.get(n[1])??[]).forEach(this.reset.bind(this)),this.headerFiles.delete(e))})}};function wc(){return eT??=new Rf,eT}function eE(){eT=new Rf}var tT,Pf=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,uri:o.uri,prevToken:i,nextToken:void 0};i&&(i.nextToken=a),n[s]=a,i=a}return n}needsRenew(e,r){return e=it(e),this.fileMap.get(e)?.text!==r}getDocument(e,r){return qn.create(e,"devicetree",0,r??this.fileMap.get(e)?.text??(0,Ec.readFileSync)(e).toString())}renewLexer(e,r){if(e=it(e),wc().reset(e),!r&&!(0,Ec.existsSync)(e))return[];try{r??=(0,Ec.readFileSync)(e).toString();let n=new ai(r,e);return this.fileMap.set(e,n),t.clone(n.tokens)}catch{}return[]}requestTokens(e,r){e=it(e);let n=this.fileMap.get(e)?.tokens;return!n&&r?[...this.renewLexer(e)]:t.clone(n??[])}reset(e){e=it(e),wc().reset(e),this.fileMap.delete(e)}};function Yr(){return tT??=new Pf,tT}function tE(){tT=new Pf}var wf=class t extends Ai{constructor(r,n=()=>Yr().requestTokens(this.uri,!0)){super();this.uri=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||!j(c,13)||(l=s(),!j(l,17)||c.pos.line!==l.pos.line||c.pos.col+1!==l.pos.col))return;let u=()=>!(!j(a(),17)||!j(o(),13)||!Ft(a(),o())),d=l.pos.line,f=c,p=[];l=s();do{if(o()?.pos.line!==d){let T=new mn(oe(f,a()));p.push(T),d=o().pos.line??0,f=o()}l=s()}while(n<r.length&&!u());let m=new mn(oe(f,o()));p.push(m);let h=new hn(p);return s(),{comment:h,tokenUsed:i,index:n-1}}static processLineComment(r,n){let i=[];if(!j(r[n],13)||r.length===n+1||!j(r[n+1],13)||!Ft(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 mn(oe(r[i[0]],r[i.at(-1)])),tokenUsed:i,index:n-1}}};var rE=$(U());var Ef=class extends Z{constructor(r,n){super(r);this.content=n}toString(){let r=this.content.filter(n=>!j(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("")}},Cc=class extends Z{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 ft?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:rE.MarkupKind.Markdown,value:["```cpp",`#define ${this.toString()}`,"```"].join(`
|
|
188
|
-
`)}}};var nE;(function(t){function e(r){return typeof r=="string"}t.is=e})(nE||(nE={}));var rT;(function(t){function e(r){return typeof r=="string"}t.is=e})(rT||(rT={}));var iE;(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(iE||(iE={}));var Cf;(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(Cf||(Cf={}));var Xr;(function(t){function e(n,i){return n===Number.MAX_VALUE&&(n=Cf.MAX_VALUE),i===Number.MAX_VALUE&&(i=Cf.MAX_VALUE),{line:n,character:i}}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&I.uinteger(i.line)&&I.uinteger(i.character)}t.is=r})(Xr||(Xr={}));var ot;(function(t){function e(n,i,s,o){if(I.uinteger(n)&&I.uinteger(i)&&I.uinteger(s)&&I.uinteger(o))return{start:Xr.create(n,i),end:Xr.create(s,o)};if(Xr.is(n)&&Xr.is(i))return{start:n,end:i};throw new Error(`Range#create called with invalid arguments[${n}, ${i}, ${s}, ${o}]`)}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&Xr.is(i.start)&&Xr.is(i.end)}t.is=r})(ot||(ot={}));var Df;(function(t){function e(n,i){return{uri:n,range:i}}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&ot.is(i.range)&&(I.string(i.uri)||I.undefined(i.uri))}t.is=r})(Df||(Df={}));var sE;(function(t){function e(n,i,s,o){return{targetUri:n,targetRange:i,targetSelectionRange:s,originSelectionRange:o}}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&ot.is(i.targetRange)&&I.string(i.targetUri)&&ot.is(i.targetSelectionRange)&&(ot.is(i.originSelectionRange)||I.undefined(i.originSelectionRange))}t.is=r})(sE||(sE={}));var nT;(function(t){function e(n,i,s,o){return{red:n,green:i,blue:s,alpha:o}}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&I.numberRange(i.red,0,1)&&I.numberRange(i.green,0,1)&&I.numberRange(i.blue,0,1)&&I.numberRange(i.alpha,0,1)}t.is=r})(nT||(nT={}));var oE;(function(t){function e(n,i){return{range:n,color:i}}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&ot.is(i.range)&&nT.is(i.color)}t.is=r})(oE||(oE={}));var aE;(function(t){function e(n,i,s){return{label:n,textEdit:i,additionalTextEdits:s}}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&I.string(i.label)&&(I.undefined(i.textEdit)||ra.is(i))&&(I.undefined(i.additionalTextEdits)||I.typedArray(i.additionalTextEdits,ra.is))}t.is=r})(aE||(aE={}));var cE;(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(cE||(cE={}));var lE;(function(t){function e(n,i,s,o,a,c){let l={startLine:n,endLine:i};return I.defined(s)&&(l.startCharacter=s),I.defined(o)&&(l.endCharacter=o),I.defined(a)&&(l.kind=a),I.defined(c)&&(l.collapsedText=c),l}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&I.uinteger(i.startLine)&&I.uinteger(i.startLine)&&(I.undefined(i.startCharacter)||I.uinteger(i.startCharacter))&&(I.undefined(i.endCharacter)||I.uinteger(i.endCharacter))&&(I.undefined(i.kind)||I.string(i.kind))}t.is=r})(lE||(lE={}));var iT;(function(t){function e(n,i){return{location:n,message:i}}t.create=e;function r(n){let i=n;return I.defined(i)&&Df.is(i.location)&&I.string(i.message)}t.is=r})(iT||(iT={}));var uE;(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(uE||(uE={}));var dE;(function(t){t.Unnecessary=1,t.Deprecated=2})(dE||(dE={}));var fE;(function(t){function e(r){let n=r;return I.objectLiteral(n)&&I.string(n.href)}t.is=e})(fE||(fE={}));var Af;(function(t){function e(n,i,s,o,a,c){let l={range:n,message:i};return I.defined(s)&&(l.severity=s),I.defined(o)&&(l.code=o),I.defined(a)&&(l.source=a),I.defined(c)&&(l.relatedInformation=c),l}t.create=e;function r(n){var i;let s=n;return I.defined(s)&&ot.is(s.range)&&I.string(s.message)&&(I.number(s.severity)||I.undefined(s.severity))&&(I.integer(s.code)||I.string(s.code)||I.undefined(s.code))&&(I.undefined(s.codeDescription)||I.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(I.string(s.source)||I.undefined(s.source))&&(I.undefined(s.relatedInformation)||I.typedArray(s.relatedInformation,iT.is))}t.is=r})(Af||(Af={}));var ta;(function(t){function e(n,i,...s){let o={title:n,command:i};return I.defined(s)&&s.length>0&&(o.arguments=s),o}t.create=e;function r(n){let i=n;return I.defined(i)&&I.string(i.title)&&I.string(i.command)}t.is=r})(ta||(ta={}));var ra;(function(t){function e(s,o){return{range:s,newText:o}}t.replace=e;function r(s,o){return{range:{start:s,end:s},newText:o}}t.insert=r;function n(s){return{range:s,newText:""}}t.del=n;function i(s){let o=s;return I.objectLiteral(o)&&I.string(o.newText)&&ot.is(o.range)}t.is=i})(ra||(ra={}));var sT;(function(t){function e(n,i,s){let o={label:n};return i!==void 0&&(o.needsConfirmation=i),s!==void 0&&(o.description=s),o}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&I.string(i.label)&&(I.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(I.string(i.description)||i.description===void 0)}t.is=r})(sT||(sT={}));var na;(function(t){function e(r){let n=r;return I.string(n)}t.is=e})(na||(na={}));var pE;(function(t){function e(s,o,a){return{range:s,newText:o,annotationId:a}}t.replace=e;function r(s,o,a){return{range:{start:s,end:s},newText:o,annotationId:a}}t.insert=r;function n(s,o){return{range:s,newText:"",annotationId:o}}t.del=n;function i(s){let o=s;return ra.is(o)&&(sT.is(o.annotationId)||na.is(o.annotationId))}t.is=i})(pE||(pE={}));var oT;(function(t){function e(n,i){return{textDocument:n,edits:i}}t.create=e;function r(n){let i=n;return I.defined(i)&&dT.is(i.textDocument)&&Array.isArray(i.edits)}t.is=r})(oT||(oT={}));var aT;(function(t){function e(n,i,s){let o={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}t.create=e;function r(n){let i=n;return i&&i.kind==="create"&&I.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||I.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||I.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||na.is(i.annotationId))}t.is=r})(aT||(aT={}));var cT;(function(t){function e(n,i,s,o){let a={kind:"rename",oldUri:n,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(a.options=s),o!==void 0&&(a.annotationId=o),a}t.create=e;function r(n){let i=n;return i&&i.kind==="rename"&&I.string(i.oldUri)&&I.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||I.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||I.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||na.is(i.annotationId))}t.is=r})(cT||(cT={}));var lT;(function(t){function e(n,i,s){let o={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}t.create=e;function r(n){let i=n;return i&&i.kind==="delete"&&I.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||I.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||I.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||na.is(i.annotationId))}t.is=r})(lT||(lT={}));var uT;(function(t){function e(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(i=>I.string(i.kind)?aT.is(i)||cT.is(i)||lT.is(i):oT.is(i)))}t.is=e})(uT||(uT={}));var hE;(function(t){function e(n){return{uri:n}}t.create=e;function r(n){let i=n;return I.defined(i)&&I.string(i.uri)}t.is=r})(hE||(hE={}));var mE;(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return I.defined(i)&&I.string(i.uri)&&I.integer(i.version)}t.is=r})(mE||(mE={}));var dT;(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return I.defined(i)&&I.string(i.uri)&&(i.version===null||I.integer(i.version))}t.is=r})(dT||(dT={}));var gE;(function(t){function e(n,i,s,o){return{uri:n,languageId:i,version:s,text:o}}t.create=e;function r(n){let i=n;return I.defined(i)&&I.string(i.uri)&&I.string(i.languageId)&&I.integer(i.version)&&I.string(i.text)}t.is=r})(gE||(gE={}));var as;(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(r){let n=r;return n===t.PlainText||n===t.Markdown}t.is=e})(as||(as={}));var Dc;(function(t){function e(r){let n=r;return I.objectLiteral(r)&&as.is(n.kind)&&I.string(n.value)}t.is=e})(Dc||(Dc={}));var yE;(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})(yE||(yE={}));var TE;(function(t){t.PlainText=1,t.Snippet=2})(TE||(TE={}));var vE;(function(t){t.Deprecated=1})(vE||(vE={}));var bE;(function(t){function e(n,i,s){return{newText:n,insert:i,replace:s}}t.create=e;function r(n){let i=n;return i&&I.string(i.newText)&&ot.is(i.insert)&&ot.is(i.replace)}t.is=r})(bE||(bE={}));var SE;(function(t){t.asIs=1,t.adjustIndentation=2})(SE||(SE={}));var _E;(function(t){function e(r){let n=r;return n&&(I.string(n.detail)||n.detail===void 0)&&(I.string(n.description)||n.description===void 0)}t.is=e})(_E||(_E={}));var kE;(function(t){function e(r){return{label:r}}t.create=e})(kE||(kE={}));var NE;(function(t){function e(r,n){return{items:r||[],isIncomplete:!!n}}t.create=e})(NE||(NE={}));var If;(function(t){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function r(n){let i=n;return I.string(i)||I.objectLiteral(i)&&I.string(i.language)&&I.string(i.value)}t.is=r})(If||(If={}));var RE;(function(t){function e(r){let n=r;return!!n&&I.objectLiteral(n)&&(Dc.is(n.contents)||If.is(n.contents)||I.typedArray(n.contents,If.is))&&(r.range===void 0||ot.is(r.range))}t.is=e})(RE||(RE={}));var Lr;(function(t){function e(r,n){return n?{label:r,documentation:n}:{label:r}}t.create=e})(Lr||(Lr={}));var PE;(function(t){function e(r,n,...i){let s={label:r};return I.defined(n)&&(s.documentation=n),I.defined(i)?s.parameters=i:s.parameters=[],s}t.create=e})(PE||(PE={}));var wE;(function(t){t.Text=1,t.Read=2,t.Write=3})(wE||(wE={}));var EE;(function(t){function e(r,n){let i={range:r};return I.number(n)&&(i.kind=n),i}t.create=e})(EE||(EE={}));var CE;(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})(CE||(CE={}));var DE;(function(t){t.Deprecated=1})(DE||(DE={}));var AE;(function(t){function e(r,n,i,s,o){let a={name:r,kind:n,location:{uri:s,range:i}};return o&&(a.containerName=o),a}t.create=e})(AE||(AE={}));var IE;(function(t){function e(r,n,i,s){return s!==void 0?{name:r,kind:n,location:{uri:i,range:s}}:{name:r,kind:n,location:{uri:i}}}t.create=e})(IE||(IE={}));var OE;(function(t){function e(n,i,s,o,a,c){let l={name:n,detail:i,kind:s,range:o,selectionRange:a};return c!==void 0&&(l.children=c),l}t.create=e;function r(n){let i=n;return i&&I.string(i.name)&&I.number(i.kind)&&ot.is(i.range)&&ot.is(i.selectionRange)&&(i.detail===void 0||I.string(i.detail))&&(i.deprecated===void 0||I.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=r})(OE||(OE={}));var ME;(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"})(ME||(ME={}));var Of;(function(t){t.Invoked=1,t.Automatic=2})(Of||(Of={}));var xE;(function(t){function e(n,i,s){let o={diagnostics:n};return i!=null&&(o.only=i),s!=null&&(o.triggerKind=s),o}t.create=e;function r(n){let i=n;return I.defined(i)&&I.typedArray(i.diagnostics,Af.is)&&(i.only===void 0||I.typedArray(i.only,I.string))&&(i.triggerKind===void 0||i.triggerKind===Of.Invoked||i.triggerKind===Of.Automatic)}t.is=r})(xE||(xE={}));var LE;(function(t){function e(n,i,s){let o={title:n},a=!0;return typeof i=="string"?(a=!1,o.kind=i):ta.is(i)?o.command=i:o.edit=i,a&&s!==void 0&&(o.kind=s),o}t.create=e;function r(n){let i=n;return i&&I.string(i.title)&&(i.diagnostics===void 0||I.typedArray(i.diagnostics,Af.is))&&(i.kind===void 0||I.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||ta.is(i.command))&&(i.isPreferred===void 0||I.boolean(i.isPreferred))&&(i.edit===void 0||uT.is(i.edit))}t.is=r})(LE||(LE={}));var qE;(function(t){function e(n,i){let s={range:n};return I.defined(i)&&(s.data=i),s}t.create=e;function r(n){let i=n;return I.defined(i)&&ot.is(i.range)&&(I.undefined(i.command)||ta.is(i.command))}t.is=r})(qE||(qE={}));var $E;(function(t){function e(n,i){return{tabSize:n,insertSpaces:i}}t.create=e;function r(n){let i=n;return I.defined(i)&&I.uinteger(i.tabSize)&&I.boolean(i.insertSpaces)}t.is=r})($E||($E={}));var BE;(function(t){function e(n,i,s){return{range:n,target:i,data:s}}t.create=e;function r(n){let i=n;return I.defined(i)&&ot.is(i.range)&&(I.undefined(i.target)||I.string(i.target))}t.is=r})(BE||(BE={}));var FE;(function(t){function e(n,i){return{range:n,parent:i}}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&ot.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=r})(FE||(FE={}));var jE;(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"})(jE||(jE={}));var UE;(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"})(UE||(UE={}));var HE;(function(t){function e(r){let n=r;return I.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}t.is=e})(HE||(HE={}));var VE;(function(t){function e(n,i){return{range:n,text:i}}t.create=e;function r(n){let i=n;return i!=null&&ot.is(i.range)&&I.string(i.text)}t.is=r})(VE||(VE={}));var zE;(function(t){function e(n,i,s){return{range:n,variableName:i,caseSensitiveLookup:s}}t.create=e;function r(n){let i=n;return i!=null&&ot.is(i.range)&&I.boolean(i.caseSensitiveLookup)&&(I.string(i.variableName)||i.variableName===void 0)}t.is=r})(zE||(zE={}));var WE;(function(t){function e(n,i){return{range:n,expression:i}}t.create=e;function r(n){let i=n;return i!=null&&ot.is(i.range)&&(I.string(i.expression)||i.expression===void 0)}t.is=r})(WE||(WE={}));var GE;(function(t){function e(n,i){return{frameId:n,stoppedLocation:i}}t.create=e;function r(n){let i=n;return I.defined(i)&&ot.is(n.stoppedLocation)}t.is=r})(GE||(GE={}));var fT;(function(t){t.Type=1,t.Parameter=2;function e(r){return r===1||r===2}t.is=e})(fT||(fT={}));var pT;(function(t){function e(n){return{value:n}}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&(i.tooltip===void 0||I.string(i.tooltip)||Dc.is(i.tooltip))&&(i.location===void 0||Df.is(i.location))&&(i.command===void 0||ta.is(i.command))}t.is=r})(pT||(pT={}));var KE;(function(t){function e(n,i,s){let o={position:n,label:i};return s!==void 0&&(o.kind=s),o}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&Xr.is(i.position)&&(I.string(i.label)||I.typedArray(i.label,pT.is))&&(i.kind===void 0||fT.is(i.kind))&&i.textEdits===void 0||I.typedArray(i.textEdits,ra.is)&&(i.tooltip===void 0||I.string(i.tooltip)||Dc.is(i.tooltip))&&(i.paddingLeft===void 0||I.boolean(i.paddingLeft))&&(i.paddingRight===void 0||I.boolean(i.paddingRight))}t.is=r})(KE||(KE={}));var YE;(function(t){function e(r){return{kind:"snippet",value:r}}t.createSnippet=e})(YE||(YE={}));var XE;(function(t){function e(r,n,i,s){return{insertText:r,filterText:n,range:i,command:s}}t.create=e})(XE||(XE={}));var JE;(function(t){function e(r){return{items:r}}t.create=e})(JE||(JE={}));var QE;(function(t){t.Invoked=0,t.Automatic=1})(QE||(QE={}));var ZE;(function(t){function e(r,n){return{range:r,text:n}}t.create=e})(ZE||(ZE={}));var eC;(function(t){function e(r,n){return{triggerKind:r,selectedCompletionInfo:n}}t.create=e})(eC||(eC={}));var tC;(function(t){function e(r){let n=r;return I.objectLiteral(n)&&rT.is(n.uri)&&I.string(n.name)}t.is=e})(tC||(tC={}));var rC;(function(t){function e(s,o,a,c){return new hT(s,o,a,c)}t.create=e;function r(s){let o=s;return!!(I.defined(o)&&I.string(o.uri)&&(I.undefined(o.languageId)||I.string(o.languageId))&&I.uinteger(o.lineCount)&&I.func(o.getText)&&I.func(o.positionAt)&&I.func(o.offsetAt))}t.is=r;function n(s,o){let a=s.getText(),c=i(o,(u,d)=>{let f=u.range.start.line-d.range.start.line;return f===0?u.range.start.character-d.range.start.character:f}),l=a.length;for(let u=c.length-1;u>=0;u--){let d=c[u],f=s.offsetAt(d.range.start),p=s.offsetAt(d.range.end);if(p<=l)a=a.substring(0,f)+d.newText+a.substring(p,a.length);else throw new Error("Overlapping edit");l=f}return a}t.applyEdits=n;function i(s,o){if(s.length<=1)return s;let a=s.length/2|0,c=s.slice(0,a),l=s.slice(a);i(c,o),i(l,o);let u=0,d=0,f=0;for(;u<c.length&&d<l.length;)o(c[u],l[d])<=0?s[f++]=c[u++]:s[f++]=l[d++];for(;u<c.length;)s[f++]=c[u++];for(;d<l.length;)s[f++]=l[d++];return s}})(rC||(rC={}));var hT=class{constructor(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content}update(e,r){this._content=e.text,this._version=r,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],r=this._content,n=!0;for(let i=0;i<r.length;i++){n&&(e.push(i),n=!1);let s=r.charAt(i);n=s==="\r"||s===`
|
|
189
|
-
`,s==="\r"&&i+1<r.length&&r.charAt(i+1)===`
|
|
190
|
-
`&&i++}n&&r.length>0&&e.push(r.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return Xr.create(0,e);for(;n<i;){let o=Math.floor((n+i)/2);r[o]>e?i=o:n=o+1}let s=n-1;return Xr.create(s,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],i=e.line+1<r.length?r[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)}get lineCount(){return this.getLineOffsets().length}},I;(function(t){let e=Object.prototype.toString;function r(p){return typeof p<"u"}t.defined=r;function n(p){return typeof p>"u"}t.undefined=n;function i(p){return p===!0||p===!1}t.boolean=i;function s(p){return e.call(p)==="[object String]"}t.string=s;function o(p){return e.call(p)==="[object Number]"}t.number=o;function a(p,m,h){return e.call(p)==="[object Number]"&&m<=p&&p<=h}t.numberRange=a;function c(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}t.integer=c;function l(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}t.uinteger=l;function u(p){return e.call(p)==="[object Function]"}t.func=u;function d(p){return p!==null&&typeof p=="object"}t.objectLiteral=d;function f(p,m){return Array.isArray(p)&&p.every(m)}t.typedArray=f})(I||(I={}));var Xs=class extends Z{constructor(e){super(e)}},Ac=class extends Z{constructor(r,n){super();this.keyword=r;this.content=n;this.active=!1;this.addChild(r)}},Ic=class extends Ac{constructor(r,n,i){super(r,i);this.identifier=n;this.addChild(n),this.addChild(i)}useBlock(r){return this.identifier&&r.has(this.identifier.name)}},Mf=class extends Ac{constructor(r,n,i){super(r,i);this.expression=n;this.addChild(n),this.addChild(i)}useBlock(r){return this.expression?.isTrue(r)}},xf=class extends Ic{useBlock(e){return this.identifier&&!e.has(this.identifier.name)}},Oc=class extends Ac{};var ci=class extends Z{constructor(r,n,i){super();this.ifDef=r;this.endIf=n;this.elseOption=i;this.addChild(r),i&&this.addChild(i),this.addChild(n)}get inactiveRanges(){if(this.elseOption&&!this.elseOption.active){let r=this.elseOption.firstToken,n=this.elseOption.content?.lastToken??this.endIf?.firstToken??this.lastToken;return[ot.create(_e(r),_e(n))]}if(!this.ifDef.active){let r=this.ifDef.firstToken,n=this.ifDef.content?this.ifDef.content?.lastToken:this.elseOption?this.elseOption.firstToken:this.endIf?.lastToken;return[ot.create(_e(r),_e(n??this.ifDef.lastToken))]}return[]}getInValidTokenRange(r,n){let i=o=>n.findIndex(a=>a===o);if(!this.ifDef.identifier)return[{start:i(this.firstToken),end:i(this.lastToken)}];let s=this.ifDef.useBlock(r);return s?this.ifDef.active=!0:this.elseOption&&(this.elseOption.active=!0),this.getInValidTokenRangeWhenActiveBlock(s?this.ifDef:this.elseOption,n)}getInValidTokenRangeWhenActiveBlock(r,n){let i=[],s=c=>n.findIndex(l=>l===c),o=(this.ifDef.identifier??this.ifDef.keyword).lastToken;i.push({start:s(this.ifDef.firstToken),end:s(o)});let a=this.ifDef===r;return!a&&this.ifDef.content&&i.push({start:s(this.ifDef.content.firstToken),end:s(this.ifDef.content.lastToken)}),this.elseOption&&(i.push({start:s(this.elseOption.firstToken),end:s(this.elseOption.keyword.lastToken)}),a&&this.elseOption.content&&i.push({start:s(this.elseOption.content.firstToken),end:s(this.elseOption.content.lastToken)})),this.endIf&&i.push({start:s(this.endIf.firstToken),end:s(this.endIf.lastToken)}),i}},jn=class extends Z{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,n){let i=this.ifBlocks.find(s=>s.useBlock(r));return i?i.active=!0:this.elseOption&&(this.elseOption.active=!0),this.getInValidTokenRangeWhenActiveBlock(i||this.elseOption,n)}get inactiveRanges(){let r=[],n=!!this.elseOption;if(this.ifBlocks.forEach((o,a)=>{if(o.active)return;let c=a===this.ifBlocks.length-1,l=o.firstToken,u=c?n?this.elseOption.firstToken:this.lastToken:o.content?.lastToken??this.ifBlocks[a+1].firstToken??o.lastToken;r.push(ot.create(_e(l),_e(u)))}),this.elseOption&&r.length){let o=this.elseOption.firstToken,a=this.elseOption.content?.lastToken??this.endIf?.lastToken??this.lastToken;return[ot.create(_e(o),_e(a))]}let i=this.firstToken,s=this.lastToken;return[ot.create(_e(i),_e(s))]}getInValidTokenRangeWhenActiveBlock(r,n){let i=[],s=a=>n.findIndex(c=>c===a),o=!1;return this.ifBlocks.forEach(a=>{let c=a.expression?.lastToken??a.keyword.lastToken;i.push({start:s(a.firstToken),end:s(c)}),!o&&a===r?o=!0:a.content&&i.push({start:s(a.content.firstToken),end:s(a.content.lastToken)})}),this.elseOption&&(i.push({start:s(this.elseOption.keyword.firstToken),end:s(this.elseOption.keyword.lastToken)}),o&&this.elseOption.content&&i.push({start:s(this.elseOption.content.firstToken),end:s(this.elseOption.content.lastToken)})),this.endIf&&i.push({start:s(this.endIf.firstToken),end:s(this.endIf.lastToken)}),i}};var ea=class extends Ai{constructor(r,n,i,s,o){super();this.uri=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.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=Kr(r,this.tokens.at(this.peekIndex()))||!r||j(r,14)&&r.pos.line+1===this.tokens.at(this.peekIndex())?.pos.line;if(!(this.macroStart&&!n))return this.macroStart&&j(this.tokens.at(this.peekIndex()),14)?(this.moveStackIndex(),this.currentToken):this.tokens.at(this.peekIndex())}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=[]}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.uri),i();return}}this.reset(r),this.parse().then(i)})}),this.parsing}async parse(){let r=new wf(this.uri,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.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||!pe(this.prevToken.uri,this.currentToken.uri))){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()}processDefinitions(){this.enqueueToStack();let r=this.peekIndex(),n=this.moveToNextToken;if(!n||!j(n,25))return this.popStack(),!1;this.macroStart=!0;let i=new pt(oe(n)),s=this.isFunctionDefinition()||this.processCIdentifier(this.macros,!0);if(!s)return this._issues.push(G(30,i.firstToken,i.lastToken,i)),this.mergeStack(),this.macroStart=!1,!0;let o=this.consumeDefinitionContent(),a;o.length&&(a=new Ef(oe(o[0],o.at(-1)),o));let c=new Cc(i,s,a);this.macros.set(c.name,{macro:c,resolver:Ow(c.toString())}),this.nodes.push(c);let l=this.peekIndex();return this.tokens.splice(r,l-r),this.positionStack[this.positionStack.length-1]=r,this.mergeStack(),this.macroStart=!1,!0}processUndef(){this.enqueueToStack();let r=this.peekIndex(),n=this.moveToNextToken;if(!n||!j(n,28))return this.popStack(),!1;this.macroStart=!0;let i=new pt(oe(n)),s=this.processCIdentifier(this.macros,!0);if(!s)return this._issues.push(G(30,i.firstToken,i.lastToken,i)),this.mergeStack(),this.macroStart=!1,!0;let o=new Cc(i,s);this.macros.delete(s.name),this.nodes.push(o);let a=this.peekIndex();return this.tokens.splice(r,a-r),this.positionStack[this.positionStack.length-1]=r,this.mergeStack(),this.macroStart=!1,!0}processError(){this.enqueueToStack();let r=this.peekIndex(),n=this.moveToNextToken;if(!n||!j(n,29))return this.popStack(),!1;this.moveEndOfLine(n,!1,!0);let i=this.peekIndex();return this.tokens.splice(r,i-r),this.positionStack[this.positionStack.length-1]=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(!j(n,42)||!Ft(r.lastToken,n)){this.popStack();return}let i=[],s=this.processCIdentifier(this.macros,!0)||this.processVariadic();for(;s;)i.push(s),!j(this.currentToken,24)&&!j(this.currentToken,43)?this._issues.push(G(28,s.firstToken,s.lastToken,s)):j(this.currentToken,43)||(n=this.moveToNextToken),s=this.processCIdentifier(this.macros,!0)||this.processVariadic();let o=new oi(r,i);if(j(this.currentToken,43))n=this.moveToNextToken,o.lastToken=n;else{o.lastToken=this.prevToken;let a=i.at(-1)??o;this._issues.push(G(26,a.firstToken,a.lastToken,a))}return this.mergeStack(),o}processVariadic(){this.enqueueToStack();let r=this.checkConcurrentTokens([Me(45),Me(45),Me(45)]);if(r.length!==3){this.popStack();return}let n=new Zo(oe(r[0],r.at(-1)));return this.mergeStack(),n}processIfDefBlocks(){let r=this.peekIndex(),n=this.parseScopedBlock(a=>!!a&&[33,34,32].some(c=>j(a,c))&&!Kr(a.prevToken,a),a=>!!a&&[37].some(c=>j(a,c))&&!Kr(a.prevToken,a),a=>!!a&&[36,35].some(c=>j(a,c))&&!Kr(a.prevToken,a));if(!n)return;let i;j(n.startToken,32)?i=this.processIfBlock(n,(a,c,l)=>new Mf(a,c??null,l)):i=this.processIfDefBlock(n,(a,c,l)=>j(n.startToken,33)?new Ic(a,c??null,l):new xf(a,c??null,l)),this.nodes.push(i),i.getInValidTokenRange(this.macros,this.tokens).reverse().forEach(a=>{this.tokens.splice(a.start,a.end-a.start+1)});let o=i.inactiveRanges;this._comments.forEach(a=>{o.some(c=>yf(c,a.range))&&(a.disabled=!0)}),[...i instanceof jn?i.ifBlocks:[i.ifDef],...i.elseOption?[i.elseOption]:[]].forEach(a=>{!a.active&&a.content&&this._issues.push(G(47,a.content.firstToken,a.content.lastToken,a.content,{severity:Mc.DiagnosticSeverity.Hint,tags:[Mc.DiagnosticTag.Unnecessary]}))}),this.positionStack[this.positionStack.length-1]=r}processIfDefBlock(r,n){this.enqueueToStack(),this.macroStart=!0;let i=new pt(oe(r.startToken));r.splitTokens[0].rewind();let s=this.processCIdentifier(this.macros,!0);s||this._issues.push(G(31,i.firstToken,i.lastToken,i)),this.macroStart=!1;let o,a=r.splitTokens[0].tokens.indexOf(s?.lastToken??i.lastToken)+1,c=r.splitTokens[0].tokens[a];a&&c&&(o=new Xs(oe(c,r.splitTokens[0].tokens.at(-1))));let l=n(i,s??null,o??null),u;if(r.splitTokens.length>1){let p=r.separatorTokens[0],m=new pt(oe(p)),h;r.splitTokens[1].tokens.length&&(h=new Xs(oe(r.splitTokens[1].tokens[0],r.splitTokens[1].tokens.at(-1)))),u=new Oc(m,h??null)}let d;r.endToken?d=new pt(oe(r.endToken)):this._issues.push(G(46,i.firstToken,i.lastToken,i));let f=new ci(l,d??null,u);return this.mergeStack(),f}processIfBlock(r,n){this.enqueueToStack();let i=new pt(oe(r.startToken)),s=[],o;r.splitTokens.forEach((l,u)=>{l.rewind();let d=this.prevToken,f=new pt(oe(d));this.macroStart=!0;let p=this.processExpression(this.macros,f,!0)||this.processCIdentifier(this.macros,!0);if(p instanceof ft&&p.name.toLowerCase()==="defined"&&(p=this.processExpression(this.macros,f,!0)||this.processCIdentifier(this.macros,!0)),this.macroStart=!1,u===r.splitTokens.length-1&&j(d,36)){let h=d,T=new pt(oe(h)),b;l.tokens.length&&(b=new Xs(oe(l.tokens[0],l.tokens.at(-1)))),o=new Oc(T,b??null)}else{p||this._issues.push(G(31,i.firstToken,i.lastToken,i));let h,T=r.splitTokens[0].tokens.indexOf(p?.lastToken??i.lastToken)+1,b=r.splitTokens[0].tokens[T];T&&b&&(h=new Xs(oe(b,r.splitTokens[u].tokens.at(-1))));let S=n(f,p??null,h??null);s.push(S)}});let a;r.endToken?a=new pt(oe(r.endToken)):this._issues.push(G(46,i.firstToken,i.lastToken,i));let c=new jn(s,a??null,o);return this.mergeStack(),c}get allAstItems(){return[...this.dtsIncludes,...this.nodes,...this.comments]}resolveInclude(r){if(r.path.path)return r.path.relative?[(0,ia.resolve)((0,ia.dirname)(r.uri),r.path.path),...this.incudes.map(n=>(0,ia.resolve)(n,r.path.path))].find(n=>(0,mT.existsSync)(n)):this.incudes.map(n=>(0,ia.resolve)(n,r.path.path)).find(n=>(0,mT.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(j(n,26))this.moveToNextToken;else{let h=this.checkConcurrentTokens([Me(13),et("include"),Me(13)]);if(h.length!==3)return this.popStack(),!1;i=h[0],s=h.at(-1)}let o=i,a=new pt(oe(i,s));n=this.moveToNextToken;let c=n,l=!!j(n,21);if(!c||!l&&!j(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&&!j(this.currentToken,4);)u+=this.currentToken?.value??"",n=this.moveToNextToken;let d=new Qo(u,l,oe(c,n)),f=new Di(a,d);this.dtsIncludes.push(f),l||(this.currentToken?.pos.line!==o.pos.line||!j(this.currentToken,4)?this._issues.push(G(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(G(36,f.path.firstToken,f.path.lastToken,f.path,{severity:Mc.DiagnosticSeverity.Warning})),m&&!this.optimizeForFormatting){Yr().requestTokens(m,!0);let h=wc().getCPreprocessorParser(m,this.incudes,this.macros,this.uri);await h.stable,this._issues.push(...h.issues),this.macros.clear(),Array.from(h.macros).forEach(([T,b])=>this.macros.set(T,b)),m.endsWith(".h")?this.tokens.splice(r,p-r):this.tokens.splice(r,p-r,...h.tokens),this.nodes.push(...h.nodes),this.dtsIncludes.push(...h.dtsIncludes)}else this.tokens.splice(r,p-r);return this.positionStack[this.positionStack.length-1]=r,!0}};var nC=$(U());var Lf=class extends Z{constructor(r,n,i){super();this.keyword=r;this.startAddress=n;this.endAddress=i;this.addChild(r),this.docSymbolsMeta={name:"Memreserve",kind:nC.SymbolKind.Function},this.addChild(n),this.addChild(i)}toString(){return`/memreserve/ 0x${this.startAddress?.value?.toString(16)} 0x${this.endAddress?.value?.toString(16)}`}};var iC=$(U());var qf=class extends Z{constructor(r,n){super();this.keyword=r;this.bitsSize=n;this.addChild(r),this.docSymbolsMeta={name:"bits",kind:iC.SymbolKind.Function},this.addChild(n)}toString(){return`/bits/ ${this.bitsSize?.value?.toString()}`}};var Ii=class extends Ai{constructor(r,n,i,s,o){super();this.uri=r;this.incudes=n;this.tokens=[];this.others=[];this.rootDocument=new Je;this.unhandledStatements=new It;this.injectedMacros=[];this.cPreprocessorParser=new ea(this.uri,this.incudes,i,s,o)}get issues(){return[...this._issues,...this.cPreprocessorParser.issues]}getFiles(){return[this.uri,...this.cPreprocessorParser.dtsIncludes.flatMap(r=>r.resolvedPath).filter(r=>!!r)]}reset(){super.reset(),this.others=[],this.rootDocument=new Je,this._issues=[],this.unhandledStatements=new It}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,it(this.uri).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(G(22,s,s,null)),this.reportExtraEndStatements())}};for(;!this.done;)await r();this.uri.endsWith(".dtsi")||(this.unhandledStatements.nodes.forEach(s=>{this._issues.push(G(53,s.firstToken,s.lastToken,s))}),this.unhandledStatements.properties.forEach(s=>{this._issues.push(G(32,s.firstToken,s.lastToken,s))}),this.unhandledStatements.deleteProperties.forEach(s=>{this._issues.push(G(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 Je||s instanceof Xe)&&$w(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=Yy(s);let o=`${n.uri}${Tf}${n.firstToken.pos.line}:${n.firstToken.pos.col}-${n.lastToken.pos.line}:${n.firstToken.pos.col}`,a=new Set;if(this.cPreprocessorParser.comments.forEach(l=>{br(n,n.uri,l.range.start)&&a.add(l)}),this.cPreprocessorParser.removeComments(a),this.injectedMacros.push(n),n instanceof ft&&s.includes(n.name)||n instanceof un&&s.includes(n.functionName.name))return!0;let c=new ai(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||!j(n,13))return this.popStack(),!1;if(i=this.moveToNextToken,!i||!j(i,2))return this.popStack(),!1;let s=new It;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(j(n,3))this.moveToNextToken;else{let i=this.prevToken;return i&&this._issues.push(G(3,i,i,r)),this.endStatement(r,!1)}return this.prevToken?.value==="}"&&(r.closeScope=this.prevToken),this.endStatement(r)}isNodeEnd(){return j(this.currentToken,3)||j(this.currentToken,1)}endStatement(r,n=!0){let i=this.currentToken;if(!j(i,1)){let s=this.prevToken;if(s&&n)return this._issues.push(G(1,s,s,r)),s}return this.moveToNextToken,this.reportExtraEndStatements(),i}reportExtraEndStatements(){for(;j(this.currentToken,1);){let r=this.moveToNextToken;r&&this._issues.push(G(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(G(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 dr(s):new Ke(s,i);if(n==="Ref"?(this.enqueueToStack(),a=this.processNodePathRef(c),!a||!j(this.currentToken,2)?(this.popStack(),a=void 0):this.mergeStack(),a??=this.isLabelRef(c)):n==="Name"&&(o=this.isNodeName()),!a&&!o){if(!j(this.currentToken,2))return this.popStack(),!1;c.firstToken=this.currentToken,this._issues.push(G(n==="Name"?[7]:[10,48,11],c.firstToken,this.currentToken?.nextToken,c))}let l=!1;if(a&&c instanceof dr?(c.reference=a,l=!0):o&&c instanceof Ke&&(l=o.address!==void 0,c.name=o),j(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(G(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([et("0"),et("x",{caseInsensitive:!0})]);i.length!==2?(i=[],this.popStack()):(this._issues.push(G(50,i[0],i[1],r,{severity:xc.DiagnosticSeverity.Warning})),n=i.at(-1),this.mergeStack());let s=this.consumeAnyConcurrentTokens([19,20,48].map(Me)),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(G(8,n,n,r)):!Number.isNaN(a)&&!Ft(n,s[0])&&this._issues.push(G(29,n,s[0],r,{inclusiveStart:!1,inclusiveEnd:!1}))),this.currentToken?.value.toUpperCase()==="ULL"&&(this._issues.push(G(51,this.currentToken,this.currentToken,r,{severity:xc.DiagnosticSeverity.Warning})),this.moveToNextToken),new Pc(a,oe(i.at(0)??s[0]??this.prevToken,this.prevToken))}processNodeAddresses(r){this.enqueueToStack();let n=this.checkConcurrentTokens([Me(49)]);if(n.length){Ft(r.lastToken,n[0])||this._issues.push(G(29,r.lastToken,n[0],r,{inclusiveStart:!1,inclusiveEnd:!1}));let i=[],s=()=>{i.push(this.processNodeAddress(r)),j(this.currentToken,24)&&(this.prevToken&&!Ft(this.prevToken,this.currentToken)&&this._issues.push(G(29,this.prevToken,this.currentToken,r,{inclusiveStart:!1,inclusiveEnd:!1})),this.moveToNextToken,s())};s();let o=this.currentToken;for(;!j(this.currentToken,2)&&!j(this.currentToken,1)&&!j(this.currentToken,3)&&!j(this.currentToken,13)&&Kr(this.currentToken,i.at(-1)?.lastToken);)this.moveToNextToken;if(o&&o!==this.currentToken){this._issues.push(G(52,o,this.currentToken,r));let a=new Pc([],oe(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(Me));if(!r.length){this.popStack();return}let n=r.map(o=>o.value).join(""),i=new xe(n,oe(r[0],r.at(-1))),s=this.processNodeAddresses(i);return i.address=s,bf(n)||this._issues.push(G(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(Me));if(!r.length){this.popStack();return}let n=new tt(r.map(i=>i.value).join(""),oe(r[0],r.at(-1)));return this.mergeStack(),n}isLabelName(){this.enqueueToStack();let r=this.consumeAnyConcurrentTokens([19,47,48].map(Me));if(!r.length){this.popStack();return}if(!bf(r?.[0].value)){this.popStack();return}let n=r.map(s=>s.value).join(""),i=new tr(n,oe(r[0],r[r.length-1]));return this.mergeStack(),i}isLabelAssign(r){this.enqueueToStack();let n=this.consumeAnyConcurrentTokens([19,47,48].map(Me));if(!n.length){this.popStack();return}if(!bf(n?.[0].value)){this.popStack();return}let i=n.map(c=>c.value).join(""),s=this.currentToken,o=s&&j(s,50),a=new os(new tr(i,oe(n[0],n.at(-1))),oe(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(G(29,c,s,a,{inclusiveStart:!1,inclusiveEnd:!1})),this.moveToNextToken}else if(r)this._issues.push(G(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(j(this.currentToken,2)||j(this.currentToken,49))return this.popStack(),!1;let s=new Xe(i,n),o;j(this.currentToken,0)?(s.assignOperatorToken=this.moveToNextToken,o=this.processValue(r),o?.values.filter(c=>!!c).length||this._issues.push(G(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([Me(13),et("d"),et("ts"),Me(16),et("v"),et("1")]);if(r.length!==6)return this.popStack(),!1;let n=r[0],i=n,s=new pt;s.firstToken=n;let o=new kf(s);if(this.others.push(o),j(this.currentToken,13))i=this.moveToNextToken;else return s.lastToken=r.at(-1),this._issues.push(G(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([Me(13),et("memreserve")]);if(r.length!==2)return this.popStack(),!1;let n=new pt;n.firstToken=r[0];let s=r[0];j(this.currentToken,13)?(s=this.moveToNextToken,n.lastToken=s):(n.lastToken=r.at(-1),this._issues.push(G(21,n.firstToken,n.lastToken,n)));let o=this.processHex()||this.processDec(),a=o&&(this.processHex()||this.processDec()),c=new Lf(n,o,a);if(this.others.push(c),o||this._issues.push(G(37,n.firstToken,n.lastToken,n)),!a){let l=o??n;this._issues.push(G(38,l.firstToken,l.lastToken,c))}return c.lastToken=this.endStatement(c),this.mergeStack(),!0}isPlugin(){this.enqueueToStack();let r=this.checkConcurrentTokens([Me(13),et("plugin"),Me(13)]);if(r.length!==3)return this.popStack(),!1;let n=new pt(oe(r[0],r.at(-1)));return n.lastToken=this.endStatement(n),this.mergeStack(),this.others.push(n),!0}processBits(){this.enqueueToStack();let r=this.checkConcurrentTokens([Me(13),et("b"),et("its")]);if(r.length!==3){this.popStack();return}let n=new pt;n.firstToken=r[0];let s=r[0];j(this.currentToken,13)?(s=this.moveToNextToken,n.lastToken=s):(n.lastToken=r.at(-1),this._issues.push(G(21,n.firstToken,n.lastToken,n)));let o=this.processDec(),a=new qf(n,o);return this.others.push(a),o?o.value!==8&&o.value!==16&&o.value!==32&&o.value!==64&&this._issues.push(G(40,o.firstToken,o.lastToken,o)):this._issues.push(G(39,n.firstToken,n.lastToken,n)),this._issues.push(G(41,a.firstToken,a.lastToken,a,{severity:xc.DiagnosticSeverity.Warning})),this.mergeStack(),a}isOmitIfNoRefNode(){this.enqueueToStack();let r=this.checkConcurrentTokens([Me(13),et("omit"),Me(16),et("if"),Me(16),et("no"),Me(16),et("ref"),Me(13)]);if(r.length!==9){this.popStack();return}let n=new pt(oe(r[0],r.at(-1)));return this.mergeStack(),n}isDeleteNode(r,n){this.enqueueToStack();let i=this.checkConcurrentTokens([Me(13),et("d"),et("e"),et("lete",{allowPartial:!0}),Me(16),et("node",{allowPartial:!0})]);if(!i.length)return this.popStack(),!1;let s=i[0],o=s,a=new pt;if(a.firstToken=s,i.length===1&&!j(this.currentToken,2)){this._issues.push(G(25,a.firstToken,a.lastToken,a)),a.lastToken=i.at(-1);let d=new xr(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(G(c.startsWith("/delete-n")?34:25,a.firstToken,a.lastToken,a)):j(this.currentToken,13)?(o=this.moveToNextToken,a.lastToken=o):this._issues.push(G(21,a.firstToken,a.lastToken,a));let l=new xr(a);if(Kr(a.lastToken,s)){let d=this.processNodePathRef(r);d&&n==="Name"&&this._issues.push(G(7,d.firstToken,d.lastToken,d));let f=d?void 0:this.isLabelRef(r);f&&n==="Name"&&this._issues.push(G(7,f.firstToken,f.lastToken,f));let p=d||f?void 0:this.isNodeName();p&&n==="Ref"&&this._issues.push(G(10,p.firstToken,p.lastToken,p)),!d&&!p&&!f&&this._issues.push(G([7,10],l.firstToken,l.lastToken,l)),l.nodeNameOrRef=d??f??p??null}else n==="Name"?this._issues.push(G(7,a.firstToken,a.lastToken,a)):n==="Ref"&&this._issues.push(G(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([Me(13),et("d"),et("e"),et("lete",{allowPartial:!0}),Me(16),et("property",{allowPartial:!0})]);if(!n.length)return this.popStack(),!1;let i=n[0],s=i,o=new pt;if(o.firstToken=i,n.length===1&&!j(this.currentToken,2)){this._issues.push(G(25,o.firstToken,o.lastToken,o)),o.lastToken=n.at(-1);let u=new yt(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(G(a.startsWith("/delete-p")?35:25,o.firstToken,o.lastToken,o)):j(this.currentToken,13)?(s=this.moveToNextToken,o.lastToken=s):this._issues.push(G(21,o.firstToken,o.lastToken,o));let c=new yt(o);if(Kr(o.lastToken,i)){let u=this.isPropertyName();u||this._issues.push(G(6,c.firstToken,c.lastToken,c)),c.propertyName=u??null}else this._issues.push(G(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 _r(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(;!j(this.currentToken,1);){let l=this.prevToken,u=this.currentToken,d,f=j(this.currentToken,24);if(f)d=this.currentToken,this.moveToNextToken;else if(!Kr(this.prevToken,this.currentToken))break;let p=o();if(u&&p===null&&f){let h=new Z(oe(u,this.currentToken));this._issues.push(G(0,h.firstToken,h.lastToken,h))}if(!f&&p===null)break;if(l&&!f&&p){let h=new Z(oe(l));this._issues.push(G(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 _f(i)}processStringValue(){this.enqueueToStack();let r=this.processOptionalLabelAssign(!0),n=this.consumeAnyConcurrentTokens([Me(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(`
|
|
191
|
-
`),s=i,o=['"',"'"].some(u=>s.endsWith(u));o&&(s=s.slice(1,-1));let a=new ne(s,oe(n[0],n.at(-1)));o||this._issues.push(G(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 _r(r,a,c);return this.mergeStack(),l}arrayValues(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!0),i=this.processBits(),s=this.currentToken;if(j(s,5))this.moveToNextToken;else{this.popStack();return}let o=this.processArrayValues(r)??null;o.openBracket=s;let a=this.processOptionalLabelAssign(!0)??[],c=new _r(n,o,a,i);if(!j(this.currentToken,4))this._issues.push(G(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(!j(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(G(15,u.firstToken,u.lastToken,u))});let a=new pn(s??[]);a.openBracket=i,a.values.length===0&&(a.firstToken=n,this._issues.push(G(14,a.firstToken,a.lastToken,a,{severity:xc.DiagnosticSeverity.Information})));let c=new _r(r,a,o);j(this.currentToken,12)?a.closeBracket=this.moveToNextToken:this._issues.push(G(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 un&&a.value.params.every(c=>!!c)&&this.cPreprocessorParser.macros.has(a.value.functionName.name)||a.value instanceof ft&&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 Ct(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 si(i,n);return this.mergeStack(),s}processHexString(){this.enqueueToStack();let r=this.processOptionalLabelAssign(!1),n=this.checkConcurrentTokens([20,20].map(Me));if(!n.length){this.popStack();return}let i=Number.parseInt(n.map(a=>a.value).join(""),16),s=new Kt(i,oe(n[0],n.at(-1)),16),o=new si(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 si(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 si(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 _r(n,i,s);return this.mergeStack(),o}isLabelRef(r){this.enqueueToStack();let n=this.currentToken;if(!n||!j(n,40)){this.popStack();return}else this.moveToNextToken;let i=this.isLabelName();if(!i){let o=new ie(null);return this._issues.push(G(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(G(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 _r(n,i,s);return this.mergeStack(),o}processRefValue(r,n){this.enqueueToStack();let i=this.processOptionalLabelAssign(n),s=this.currentToken;if(!s||!j(s,40)){this.popStack();return}let o=this.processNodePathRef(r);if(o!==void 0){let l=new si(o,i);return this.mergeStack(),l}let a=this.isLabelRef(r);if(a===void 0){this._issues.push(G([18,9],s,s,r));let l=new si(null,i);return l.firstToken=i.at(0)?.firstToken??s,this.mergeStack(),l}let c=new si(a,i);return c.firstToken=i.at(0)?.firstToken??s,this.mergeStack(),c}processNodePath(r=!0,n=new Fn){this.enqueueToStack();let i;if(j(this.currentToken,13))i=this.moveToNextToken;else{if(!r){this.popStack();return}this.prevToken&&this._issues.push(G(19,this.prevToken,this.prevToken,n))}let s=this.isNodeName(),o=i??this.prevToken;if(!s&&o&&!r&&this._issues.push(G(7,o,o,n)),!r||s?n.addPath(s??null,i?new Z(oe(i)):void 0):r&&!s&&i&&(n.addPath(new xe("/",oe(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(!j(i,40)){this.popStack();return}let s=this.moveToNextToken;if(i=s,!j(i,2)){this.popStack();return}n&&!Ft(n,s)&&this._issues.push(G(29,n,s,r,{inclusiveStart:!1,inclusiveEnd:!1}));let o=this.processNodePath(),a=new st(o??null),c=this.currentToken??this.prevToken,l=c;return o?.children.forEach((u,d)=>{if(d===o?.children.length-1&&u&&l&&!Ft(u.lastToken,l)){this._issues.push(G(29,u.lastToken,l,r,{inclusiveStart:!1,inclusiveEnd:!1}));return}if(d===0&&s&&!Ft(s,u?.firstToken)){this._issues.push(G(29,s,u?.firstToken,r,{inclusiveStart:!1,inclusiveEnd:!1}));return}let f=o?.children[d+1];u&&f&&!Ft(u.lastToken,f.firstToken)&&this._issues.push(G(29,u.lastToken,f?.firstToken,r,{inclusiveStart:!1,inclusiveEnd:!1}))}),j(c,3)?this.moveToNextToken:this.prevToken&&this._issues.push(G(3,this.prevToken,this.prevToken,r)),a.firstToken=n,a.lastToken=c??this.prevToken,this.mergeStack(),a}get includes(){return this.allAstItems.filter(r=>r instanceof Di)}get allAstItems(){return[...this.cPreprocessorParser.allAstItems,...this.rootDocument.children,...this.others,...this.unhandledStatements.properties,...this.unhandledStatements.deleteProperties,...this.unhandledStatements.nodes]}buildSemanticTokens(r,n){let i=[];this.injectedMacros.forEach(s=>{s.buildSemanticTokens((...o)=>Ai.push(...o,n,i))}),super.buildSemanticTokens(r,n,i)}};var TU=async(t,e,r)=>{let n=W.Position.create(t.pos.line,t.pos.col),i=r.find(s=>br(s,e,n));if(i)return $n(i,e,n)},TT=t=>{if(t)return t instanceof Je?t:TT(t?.parentNode)},sa=(t,e,r=0)=>{if(!e||!e.parentNode?.uri)return r;let n=TT(e.parentNode);return sa(t,n,r+1)},cC=(t,e)=>async r=>{let n=t.filter(a=>!(a instanceof Di)&&!(a instanceof mn)&&!(a instanceof hn)&&!(a instanceof ci)&&!(a instanceof jn)),i=await TU(r.firstToken,e,n);if(!i||i===r||r.allDescendants.some(a=>a===i))return{level:0};let s=TT(i);return{level:sa(e,s),inAst:i}},gT=(t,e,r)=>!!t.split(`
|
|
192
|
-
`).find(n=>n.replace(/^\s+/,i=>i.replace(/\t/g," ".repeat(e))).trimEnd().length>r);async function oa(t,e,r,n={runBaseCheck:!0,runLongLineCheck:!0},i,s=[],o=[]){let a=Pe(t.textDocument.uri);i??=new ai(e,a).tokens;let c=[...i],l=new Ii(a,[],void 0,()=>i,!0);await l.stable;let u=l.issues.filter(m=>Ks(m.raw,a,!1));if(u?.length)throw new W.ResponseError(W.ErrorCodes.InternalError,"Unable to format. File has syntax issues.",u.map(m=>m.diagnostic()));let d=typeof t.options.wordWrapColumn=="number"?t.options.wordWrapColumn:100,f=await vU({...t,options:{...t.options,wordWrapColumn:d}},l,s,o,c,e,n);if(r==="New Text"){let m=e;if(n.runBaseCheck){let h=await yT({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,l.includes,s,a,e,r,n,f);f=[],m=h}if(gT(m,t.options.tabSize,d)){let h="";do{h=m;let T=l.allAstItems;if(h!==e){let b=new Ii(a,[],void 0,()=>new ai(h,a).tokens,!0);await b.stable,T=b.allAstItems}m=await $f({...t,options:{...t.options,wordWrapColumn:d}},T,a,h,r,n,[...f])}while(h!==m)}return m}if(r==="Both"){let m=e,h=[];if(n.runBaseCheck){let T=await yT({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,l.includes,s,a,e,r,n,[...f]);m=T.text,h.push(...T.diagnostic)}if(gT(m,t.options.tabSize,d)){h.push(...await $f({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,a,e,"File Diagnostics",n,[...f]));let T="";do{T=m;let b=l.allAstItems;if(T!==e){let S=new Ii(a,[],void 0,()=>new ai(T,a).tokens,!0);await S.stable,b=S.allAstItems}m=await $f({...t,options:{...t.options,wordWrapColumn:d}},b,a,T,"New Text",n,[...f])}while(T!==m)}return{text:m,diagnostic:h}}let p=[];if(n.runBaseCheck){let m=await yT({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,l.includes,s,a,e,r,n,[...f]);p.push(...m)}return gT(e,t.options.tabSize,d)&&p.push(...await $f({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,a,e,r,n,[...f])),p}var vU=async(t,e,r,n,i,s,o)=>{let a=e.cPreprocessorParser.allAstItems.filter(m=>m instanceof ci),c=e.cPreprocessorParser.allAstItems.filter(m=>m instanceof jn),l=a.filter(m=>r.every(h=>m.firstToken.pos.line!==h.firstToken.pos.line)),u=c.filter(m=>r.every(h=>m.firstToken.pos.line!==h.firstToken.pos.line));r.push(...l),r.push(...u);let d=[...a.map(m=>m.ifDef.active?m.elseOption?{block:m,branch:m.elseOption}:void 0:{block:m,branch:m.ifDef}),...c.flatMap(m=>{let h=m.ifBlocks.find(b=>b.active),T=m.ifBlocks.filter(b=>!b.active).map(b=>({block:m,branch:b}));return!h&&m.elseOption&&T.push({block:m,branch:m.elseOption}),T})].filter(m=>!!m),f=m=>{let h=m.block.getInValidTokenRangeWhenActiveBlock(m.branch,i).reverse(),T=[...i];h.forEach(S=>{T.splice(S.start,S.end-S.start+1)});let b=m.block.range;return n.push(m.branch),oa({...t,range:b},s,"File Diagnostics",o,T,r,n)},p=[];return await d.filter(m=>n.every(h=>h.firstToken.pos.line!==m.block.firstToken.pos.line)).reduce((m,h)=>m.then(async()=>{p.push(...await f(h))}),Promise.resolve()),p},lC=(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=>!oC(o.range.start,t)&&!oC(o.range.end,t))):r;return"range"in e&&(n=n.filter(i=>yf(e.range,i.raw.range))),n};async function yT(t,e,r,n,i,s,o,a,c=[]){let l=s.split(`
|
|
193
|
-
`),u=uC(e,l),d=s;c.push(...await bU(t,e,r,n,i,l,a));let f=lC(u,t,c);switch(d=Xy(qn.create(i,"devicetree",0,s),f.flatMap(p=>p.raw.edit).filter(p=>!!p)),o){case"New Text":return d;case"File Diagnostics":return f;case"Both":return{text:d,diagnostic:f}}}async function bU(t,e,r,n,i,s,o){let a=cC(e,i),c=(await Promise.all(e.flatMap(async u=>await hC(t,u,i,a,s,r,n,o)))).flat();if(t.options.insertFinalNewline&&s.at(-1)?.trim()!==""){let u=W.TextEdit.insert(W.Position.create(s.length,s[s.length-1].length),`
|
|
194
|
-
`);c.push(Bt(4,i,W.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=W.TextEdit.del(W.Range.create(W.Position.create(s.length-u,0),W.Position.create(s.length-1,0)));c.push(Bt(3,i,W.Position.create(s.length,0),{edit:d,codeActionTitle:"Remove trailing EOF lines"}))}}let l=c.flatMap(u=>u.raw.edit).filter(u=>!!u);if(t.options.trimTrailingWhitespace){let u=SU(s,l,i);c.push(...u)}return c}var uC=(t,e)=>{let r=W.Position.create(e.length-1,e.at(-1)?.length??0),n=[],i;return t.filter(o=>(o instanceof hn||o instanceof mn)&&/^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:W.Position.create(o.firstToken.pos.line,o instanceof hn?o.firstToken.pos.colEnd:0)};else if(a==="dts-format on"&&i){let c=W.Position.create(o.lastToken.pos.line,o instanceof hn?o.lastToken.pos.colEnd-1:e[o.lastToken.pos.line-1].length);n.push(W.Range.create(i.start,c)),i=void 0}}),i&&n.push(W.Range.create(i.start,r)),n};function sC(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 oC=(t,e)=>e.some(r=>sC(t,r.start)>=0&&sC(t,r.end)<=0),SU=(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=W.Range.create(W.Position.create(s,a.length),W.Position.create(s,o.length));e.some(l=>qw(c,l.range))||n.push(Bt(2,r,c.start,{edit:W.TextEdit.del(c),codeActionTitle:"Remove whitespace"},c.end))}}),n},Uf=(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=W.Position.create(n.pos.line,n.pos.colEnd),a=W.Position.create(t.pos.line,e?0:t.pos.col),c=W.TextEdit.replace(W.Range.create(o,a),`
|
|
195
|
-
`.repeat(e));return Bt(1,t.uri,o,{edit:c,codeActionTitle:s<0?"Insert new lines":"Remove unnecessary new lines",templateStrings:[e.toString()]},a)}}else if(t.pos.line){let i=W.Position.create(0,0),s=W.Position.create(t.pos.line,0),o=W.TextEdit.del(W.Range.create(i,s));return Bt(1,t.uri,i,{edit:o,codeActionTitle:"Remove unnecessary new lines",templateStrings:["0"]},s)}},dC=(t,e,r,n="",i=1)=>{let s=t.pos.line===t.prevToken?.pos.line;if(t.prevToken&&s){let o=W.Position.create(t.prevToken.pos.line,t.prevToken.pos.colEnd),a=W.Position.create(t.pos.line,t.pos.col),c=W.TextEdit.replace(W.Range.create(o,a),`${`
|
|
196
|
-
`.repeat(i)}${"".padStart(e*r.length,r)}${n}`);return Bt(0,t.uri,o,{edit:c,codeActionTitle:"Move to new line"},a)}},Lc=(t,e,r)=>`${"".padStart(t*e.length,e)}${r}`,vT=(t,e,r,n,i="")=>{let s=Lc(e,r,i),o=W.Position.create(t.pos.line,0),a=W.Position.create(t.pos.line,t.pos.col),c=W.Range.create(o,a),l=xU(n,c);if(s===l)return[];let u=W.TextEdit.replace(c,s);return[Bt(5,t.uri,o,{edit:u,codeActionTitle:"Fix indentation",templateStrings:[s.replaceAll(" ","\xB7").replaceAll(" ","\u2192")]},a)]},_t=(t,e,r=1,n=!1)=>{if(!t.nextToken)return[];if(t.nextToken?.pos.line!==t.pos.line){if(n)return[];let c=Uf(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=W.Position.create(t.pos.line,t.pos.colEnd),l=W.Position.create(t.nextToken.pos.line,t.nextToken.pos.col),u=W.TextEdit.del(W.Range.create(c,l));return[Bt(1,t.uri,c,{edit:u,codeActionTitle:"Remove space(s)",templateStrings:["0"]},l)]}if(t.pos.colEnd===t.nextToken.pos.col){let c=W.Position.create(t.nextToken.pos.line,t.nextToken.pos.col),l=W.TextEdit.insert(c," ".repeat(r));return[Bt(1,t.uri,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=W.Position.create(t.pos.line,t.pos.colEnd),o=W.Position.create(t.nextToken.pos.line,t.nextToken.pos.col),a=W.TextEdit.replace(W.Range.create(s,o)," ".repeat(r));return[Bt(1,t.uri,s,{edit:a,codeActionTitle:i>r?"Remove space(s)":"Insert space(s)",templateStrings:[r.toString()]},o)]},qc=(t,e)=>t.slice(1).flatMap(r=>r.firstToken.prevToken?_t(r.firstToken.prevToken,e):[]),_U=async(t,e,r,n,i,s,o,a,c,l)=>{let u=[],d=e.topComment||e.firstToken.prevToken?.value==="{"&&!e.topComment?1:bT(e.firstToken,n);if(u.push(...Jr(e.firstToken,s,o,c,void 0,d,!0)),e instanceof Ke||e instanceof dr)if(u.push(...qc(e.labels,c)),e instanceof Ke){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();h!==m&&u.push(Bt(9,p.uri,_e(p.firstToken,!1),{edit:W.TextEdit.replace(fe(p),h),codeActionTitle:`Change to '${h}'`},_e(p.lastToken)))}),e.labels.length&&e.name&&e.name.firstToken.prevToken&&u.push(..._t(e.name.firstToken.prevToken,c));let f=e.name&&e.openScope?_t(e.name.lastToken,c):[];u.push(...f)}else{e.labels.length&&e.reference?.firstToken.prevToken&&u.push(..._t(e.reference.firstToken.prevToken,c));let f=e.reference&&e.openScope?_t(e.reference.lastToken,c):[];u.push(...f)}else e instanceof It&&e.firstToken.value==="/"&&e.openScope&&u.push(..._t(e.firstToken,c,1));return u.push(...(await Promise.all(e.children.flatMap(f=>hC(t,f,i,l,c,r,n,a,s+1)))).flat()),e.closeScope&&(e.openScope&&e.closeScope.prevToken===e.openScope?u.push(..._t(e.openScope,c,0)):u.push(...Jr(e.closeScope,s,o,c,void 0,1,!0))),e.lastToken.value===";"&&e.closeScope&&u.push(...Hf(e.closeScope,e.lastToken)),u},kU=(t,e,r,n,i,s)=>{let o=[];if(o.push(...qc(e.labels,s)),e.labels.length&&e.value?.firstToken.prevToken&&o.push(..._t(e.value.firstToken.prevToken,s)),e.value instanceof Kt){let a=s[e.value.firstToken.pos.line].slice(e.value.firstToken.pos.col,e.value.lastToken.pos.colEnd),c=a.toLowerCase();c!==a&&o.push(Bt(9,e.value.uri,_e(e.value.firstToken,!1),{edit:W.TextEdit.replace(fe(e.value),c),codeActionTitle:`Change to '${c}'`},_e(e.value.lastToken)))}if(e.firstToken.prevToken)if(e.firstToken.pos.line!==e.firstToken.prevToken?.pos.line&&e.firstToken.prevToken!==i){let a=Uf(e.firstToken,1,!0);a&&o.push(a),o.push(...vT(e.firstToken,r,n.singleIndent,s,Oi(n,t+4)))}else o.push(..._t(e.firstToken.prevToken,s,i&&e.firstToken.prevToken===i?0:1));return e.value instanceof Se&&o.push(...Bf(e.value,s,r,n,t+4)),o},NU=(t,e,r,n,i)=>{let s=[];return e instanceof Ct||e instanceof pn?e.openBracket&&e.openBracket?.nextToken===e.closeBracket?s.push(..._t(e.openBracket,i,0)):(s.push(...e.values.flatMap(o=>kU(t,o,r,n,e.openBracket,i))),e.closeBracket?.prevToken&&(e.values.at(-1)?.lastToken===e.closeBracket?.prevToken||e.closeBracket?.prevToken.value==="/"&&e.closeBracket?.prevToken?.prevToken?.value==="*"?s.push(..._t(e.closeBracket.prevToken,i,e.closeBracket.prevToken===e.values.at(-1)?.lastToken?0:1)):s.push(...Jr(e.closeBracket,r,n.singleIndent,i)))):e instanceof Se&&s.push(...Bf(e,i,r,n,t)),s},Bf=(t,e,r,n,i)=>t instanceof un?RU(t,e):t instanceof ln?PU(t,e,r,n,i):[],RU=(t,e)=>{let r=[];return r.push(..._t(t.functionName.lastToken,e,0)),t.lastToken.value===")"&&t.lastToken.prevToken&&r.push(..._t(t.lastToken.prevToken,e,0)),r},PU=(t,e,r,n,i)=>{let s=[];if(t.openBracket&&t.openBracket.nextToken&&s.push(..._t(t.openBracket,e,0)),s.push(...Bf(t.expression,e,r,n,i)),t.join?.forEach(o=>{o.operator.firstToken.prevToken&&s.push(..._t(o.operator.firstToken.prevToken,e)),o.expression.firstToken.prevToken?.pos.line===o.expression.firstToken.pos.line?s.push(..._t(o.expression.firstToken.prevToken,e)):s.push(...Jr(o.expression.firstToken,r,n.singleIndent,e,Oi(n,i))),s.push(...Bf(o.expression,e,r,n,i))}),!t.join?.length&&!(t.expression instanceof ln)&&(t.expression instanceof un||t.expression instanceof ft)){let o=[];if(t.openBracket){let a=W.Position.create(t.openBracket.pos.line,t.openBracket.pos.col),c=W.Position.create(t.openBracket.pos.line,t.openBracket.pos.colEnd);o.push(W.TextEdit.del(W.Range.create(a,c)))}if(t.closeBracket){let a=W.Position.create(t.closeBracket.pos.line,t.closeBracket.pos.col),c=W.Position.create(t.closeBracket.pos.line,t.closeBracket.pos.colEnd);o.push(W.TextEdit.del(W.Range.create(a,c)))}s.push(Bt(7,t.uri,o[0].range.start,{edit:o,codeActionTitle:"Remove (...)"},o[o.length-1].range.end))}return t.closeBracket&&t.closeBracket.prevToken&&s.push(..._t(t.closeBracket.prevToken,e,0)),s},wU=(t,e,r,n,i)=>{let s=[];return s.push(...qc(e.startLabels,i)),s.push(...NU(t,e.value,r,n,i)),s.push(...qc(e.endLabels,i)),s},Oi=(t,e)=>{if(t.insertSpaces)return"".padStart(e," ");let r=Math.floor(e/t.tabSize),n=e%t.tabSize;return`${"".padStart(r," ")}${"".padStart(n," ")}`},EU=(t,e,r,n,i,s,o)=>{let a=[];return r.values.forEach((c,l)=>{if(!c)return[];let u=c.firstToken.prevToken,d=l?r.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=dC(c.firstToken,n,i.singleIndent,Oi(i,t+3));f&&a.push(f)}else a.push(..._t(u,s,1));else if(o&&c.firstToken.prevToken===o)a.push(..._t(o,s));else{let f=Uf(c.firstToken,1,!0);f&&a.push(f),a.push(...vT(c.firstToken,n,i.singleIndent,s,Oi(i,t+3)))}a.push(...wU(t,c,n,i,s)),c.nextValueSeparator&&a.push(...Hf(c.lastToken,c.nextValueSeparator))}),a},CU=(t,e,r,n)=>{let i=[],{force:s,newLines:o}=pC(t,t.firstToken);return i.push(...Jr(t.firstToken,e,r.singleIndent,n,void 0,o,s)),i.push(...qc(t.labels,n)),t.labels.length&&t.propertyName?.firstToken.prevToken&&i.push(..._t(t.propertyName.firstToken.prevToken,n)),t.values&&(t.propertyName&&i.push(..._t(t.propertyName?.lastToken,n)),i.push(...EU(t.propertyName?.name.length??0,t.propertyName?.name??"",t.values,e,r,n,t.assignOperatorToken))),t.lastToken.value===";"&&i.push(...Hf(t.children[t.children.length-1].lastToken,t.lastToken)),i},Jr=(t,e,r,n,i,s,o)=>{let a=[],c=dC(t,e,r,i,s);if(c)a.push(c);else{let l=Uf(t,s,o);l&&a.push(l),a.push(...vT(t,e,r,n,i))}return a},Hf=(t,e)=>{if(t.pos.line===e.pos.line&&t.pos.colEnd+1===e.pos.colEnd)return[];if(t.nextToken===e){let s=W.Position.create(t.pos.line,t.pos.colEnd),o=W.Position.create(e.pos.line,e.pos.col),a=W.TextEdit.del(W.Range.create(s,o));return[Bt(1,t.uri,s,{edit:a,codeActionTitle:"Remove white space",templateStrings:["0"]},o)]}let r=W.Position.create(t.pos.line,t.pos.colEnd),n=W.Position.create(e.pos.line,e.pos.colEnd),i=[W.TextEdit.insert(r,e.value),W.TextEdit.del(W.Range.create(W.Position.create(e.prevToken?.pos.line??e.pos.line,e.prevToken?.pos.colEnd??e.pos.col),n))];return[Bt(6,t.uri,r,{edit:i,codeActionTitle:"Move token",templateStrings:[e.value]},n)]},DU=(t,e,r,n)=>{let i=[];i.push(...Jr(t.firstToken,e,r,n));let s=_t(t.keyword.lastToken,n);return i.push(...s),t.lastToken.value===";"&&i.push(...Hf(t.children[t.children.length-1].lastToken,t.lastToken)),i},AU=(t,e,r,n,i)=>{if(r===void 0)return[];if(!pe(t.uri,e))return[];let s=[];s.push(...Jr(t.firstToken,r.level,n,i));let o=_t(t.keyword.lastToken,i);return s.push(...o),s},IU=(t,e,r,n,i,s)=>t.comments.length===1&&t.firstToken.pos.line===t.firstToken.prevToken?.pos.line?[]:t.comments.flatMap((o,a)=>OU(o,t,e,r,n,i,a?a===t.comments.length-1?"last":"comment":"first",s)),fC=(t,e,r="")=>{let n=e?Jy(e):void 0;if(!n)return r;let i=Ys(e),s=n.propertyName?.name.length??0;return`${`${Oi(t,s+(i?4:3)+(r.length-r.trimStart().length))}`}${r.trimStart()}`},bT=(t,e)=>{let r=e.flatMap(n=>n instanceof ci?[n.ifDef.identifier?.lastToken.nextToken,n.elseOption?.keyword.lastToken.nextToken]:[...n.ifBlocks.map(i=>i.expression?.lastToken.nextToken),n.elseOption?.lastToken.nextToken]).some(n=>n===t);return t.prevToken?.value==="{"||r?1:2},pC=(t,e)=>{let r=t.parentNode instanceof Je?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 Je&&t.firstToken.prevToken===(i.endComment??i).lastToken?{newLines:2,force:!0}:{newLines:void 0,force:void 0}},OU=(t,e,r,n,i,s,o,a)=>{if(!t.firstToken.prevToken)return Jr(t.firstToken,n?.level??0,i,s);if(t.firstToken.pos.line===t.firstToken.prevToken?.pos.line)return _t(t.firstToken.prevToken,s,1);if(n===void 0)return[];let c,l;if(o==="first"&&!e.astBeforeComment&&e.astAfterComment instanceof Je)c=!0,l=bT(e.firstToken,r);else if(o==="first"&&!e.astBeforeComment&&e.astAfterComment instanceof Xe){let{force:p,newLines:m}=pC(e.astAfterComment,e.firstToken);c=p,l=m}let u=[],d="",f=t.toString();switch(o==="last"&&f.trim()!==""&&t.lastToken.prevToken&&(o="comment",u.push(...Jr(t.lastToken.prevToken,n?.level??0,i,s," "))),o){case"comment":d=t.firstToken.value==="*"?" ":" * ";break;case"first":break;case"last":d=" ";break}return n?.inAst instanceof Je?u.push(...Jr(t.firstToken,n?.level??0,i,s,d,l,c)):u.push(...Jr(t.firstToken,n?.level??0,i,s,fC(a,n?.inAst,d),l,c)),u},MU=(t,e,r,n,i,s)=>{if(!t.firstToken.prevToken)return Jr(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 Je&&(a=!0,c=bT(t.firstToken,e)),Jr(t.firstToken,r?.level??0,n,i,fC(s,r?.inAst),c,a)},hC=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 Je?_U(t,e,s,o,r,c,d,a,i,n):e instanceof Xe?CU(e,c,f,i):e instanceof Sr?DU(e,c,d,i):e instanceof Di?AU(e,r,await n(e),d,i):e instanceof mn&&!e.disabled?MU(e,o,await n(e),d,i,f):e instanceof hn&&!e.disabled?IU(e,o,await n(e),d,i,f):[]};function xU(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(`
|
|
197
|
-
`)}function Vf(t,e,r,n){return Kr(t,e)?n[t.pos.line].slice(0,e.pos.colEnd).replace(/^\s+/,o=>o.replace(/\t/g," ".repeat(r.tabSize))).length>r.wordWrapColumn:null}async function $f(t,e,r,n,i,s,o=[]){let a=n.split(`
|
|
198
|
-
`),c=uC(e,a),l=n;o.push(...await LU(t,e,r,a,s));let u=lC(c,t,o);switch(l=Xy(qn.create(r,"devicetree",0,n),u.flatMap(d=>d.raw.edit).filter(d=>!!d)),i){case"New Text":return l;case"File Diagnostics":return u;case"Both":return{text:l,diagnostic:u}}}async function LU(t,e,r,n,i){let s=cC(e,r);return(await Promise.all(e.flatMap(async a=>await mC(t,a,r,s,n,i)))).flat()}var mC=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 Je?qU(t,e,r,o,s,i,n):e instanceof Xe?$U(e,o,u,i,l):[]},qU=async(t,e,r,n,i,s,o)=>{let a=[];return a.push(...(await Promise.all(e.children.flatMap(c=>mC(t,c,r,o,s,i,n+1)))).flat()),a},$U=(t,e,r,n,i)=>Vf(t.firstToken,t.lastToken,r,n)===!1?[]:t.values?BU(t.propertyName?.name.length??0,t.values,e,r,n,i,t.lastToken):[],BU=(t,e,r,n,i,s,o)=>{for(let[a,c]of e.values.entries()){if(!c)continue;let l=FU(t,c,e.values,a,r,n,i,s,a===e.values.length-1&&c.lastToken.nextToken===o?o:void 0);if(l)return l}return[]},Ff=t=>t instanceof Ct||t instanceof pn&&t.openBracket?t.openBracket??t.firstToken:t.firstToken,FU=(t,e,r,n,i,s,o,a,c)=>{let l=e.nextValueSeparator??c,u=Vf(e.firstToken,e.nextValueSeparator?e.nextValueSeparator:l??e.lastToken,s,o);if(u===!1)return;if(u===null){let b=e.value;return b instanceof Ct||b instanceof pn?aC(t,b,i,s,o,a,l):b instanceof Se?jf(t,b,i,s,o,a):[]}let d=o[e.firstToken.pos.line].substring(0,e.firstToken.pos.col),f=Math.trunc((t+3)/s.tabSize),p=(t+3)%s.tabSize,m=f+p+i,h=d.trimStart()!==""?i+t+3:m;if(e.firstToken.pos.col===h){let b=e.value;return b instanceof Ct||b instanceof pn?aC(t,b,i,s,o,a,l):b instanceof Se?jf(t,b,i,s,o,a):void 0}let T=r.slice(n).find(b=>b?.firstToken.pos.line!==e.firstToken.pos.line);return[Bt(8,e.firstToken.uri,_e(e.firstToken,!1),{edit:[W.TextEdit.replace(W.Range.create(_e(e.firstToken.prevToken),_e(e.firstToken,!1)),`
|
|
199
|
-
${Lc(i,a,Oi(s,t+3))}`),...T?[W.TextEdit.replace(W.Range.create(_e(Ff(T).prevToken),_e(Ff(T),!1))," ")]:[]],codeActionTitle:`Move ...${e.toString()}... to a new line`},_e(e.lastToken))]},aC=(t,e,r,n,i,s,o)=>{for(let[a,c]of e.values.entries()){if(Vf(c.firstToken,a===e.values.length-1?o??c.lastToken:c.lastToken,n,i)===!1)continue;if(c.value instanceof ln)return jf(t,c.value,r,n,i,s,a!==0);if(a===0)return[];let d=e.values.slice(a).find(f=>f?.firstToken.pos.line!==c.firstToken.pos.line);return[Bt(8,c.firstToken.uri,_e(c.firstToken,!1),{edit:[W.TextEdit.replace(W.Range.create(_e(c.firstToken.prevToken),_e(c.firstToken,!1)),`
|
|
200
|
-
${Lc(r,s,Oi(n,t+4))}`),...d?[W.TextEdit.replace(W.Range.create(_e(Ff(d).prevToken),_e(Ff(d),!1))," ")]:[]],codeActionTitle:`Move ...${c.toString()}... to a new line`},_e(c.lastToken))]}},jf=(t,e,r,n,i,s,o=!1,a=0)=>{let c=i[e.firstToken.pos.line].substring(0,e.firstToken.pos.col),l=Math.trunc((t+4)/n.tabSize),u=(t+4)%n.tabSize,d=l+u+r,f=c.trimStart()!==""?r+t+4:d;if(o&&e.firstToken.pos.col!==f)return[Bt(8,e.firstToken.uri,_e(e.firstToken,!1),{edit:[W.TextEdit.replace(W.Range.create(_e(e.firstToken.prevToken),_e(e.firstToken,!1)),`
|
|
201
|
-
${Lc(r,s,Oi(n,t+4))}`)],codeActionTitle:`Move ...${e.toString()}... to a new line`},_e(e.lastToken))];if(!(e instanceof ln))return[];let p=e.flatJoin;for(let[m,h]of p.entries()){let T=Vf(h.expression.firstToken,p?.at(m+1)?.operator.lastToken??e.expression.lastToken,n,i);if(T===!1)continue;if(T===null)return jf(t,h.expression,r,n,i,s,m!==0,a+1);let b=p.slice(m).find(S=>S.expression.firstToken.pos.line!==h.expression.firstToken.pos.line);return[Bt(8,h.expression.firstToken.uri,_e(h.expression.firstToken,!1),{edit:[W.TextEdit.replace(W.Range.create(_e(h.expression.firstToken.prevToken),_e(h.expression.firstToken,!1)),`
|
|
202
|
-
${Lc(r,s,Oi(n,t+4))}`),...b?[W.TextEdit.replace(W.Range.create(_e(b.expression.firstToken.prevToken),_e(b.expression.firstToken,!1))," ")]:[]],codeActionTitle:`Move ...${h.expression.toString()}... to a new line`},_e(h.expression.lastToken))]}};function jU(t){switch(t){case"EMPTY":return"EMPTY";case"U32":return"U32";case"U64":return"U64";case"STRING":return"STRING";case"PROP_ENCODED_ARRAY":return"PROP_ENCODED_ARRAY";case"STRINGLIST":return"STRINGLIST";case"BYTESTRING":return"BYTESTRING";case"ANY":return"ANY";case"UNKNOWN":return"UNKNOWN"}}var X=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:Dt.MarkupKind.Markdown,value:["### Type","**DTS native type** ",`${this.type.map(e=>e.types.map(jU).join(" or ")).join(",")}
|
|
182
|
+
deps: ${r}}`};var L4={keyword:"dependencies",type:"object",schemaType:"object",error:Ni.error,code(t){let[e,r]=q4(t);G1(t,e),K1(t,r)}};function q4({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 G1(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,_u.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,_u.checkReportMissingProp)(t,l)}):(r.if((0,ZS._)`${c} && (${(0,_u.checkMissingProp)(t,a,s)})`),(0,_u.reportMissingProp)(t,s),r.else())}}Ni.validatePropertyDeps=G1;function K1(t,e=t.schema){let{gen:r,data:n,keyword:i,it:s}=t,o=r.name("valid");for(let a in e)(0,x4.alwaysValidSchema)(s,e[a])||(r.if((0,_u.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))}Ni.validateSchemaDeps=K1;Ni.default=L4});var X1=R(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});var Y1=Te(),$4=Ee(),B4={message:"property name must be valid",params:({params:t})=>(0,Y1._)`{propertyName: ${t.propertyName}}`},F4={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:B4,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,$4.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,Y1.not)(s),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(s)}};e_.default=F4});var r_=R(t_=>{"use strict";Object.defineProperty(t_,"__esModule",{value:!0});var Lm=En(),ri=Te(),j4=wn(),qm=Ee(),U4={message:"must NOT have additional properties",params:({params:t})=>(0,ri._)`{additionalProperty: ${t.additionalProperty}}`},H4={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:U4,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,qm.alwaysValidSchema)(o,r))return;let l=(0,Lm.allSchemaProperties)(n.properties),u=(0,Lm.allSchemaProperties)(n.patternProperties);d(),t.ok((0,ri._)`${s} === ${j4.default.errors}`);function d(){e.forIn("key",i,T=>{!l.length&&!u.length?m(T):e.if(f(T),()=>m(T))})}function f(T){let b;if(l.length>8){let _=(0,qm.schemaRefOrVal)(o,n.properties,"properties");b=(0,Lm.isOwnProperty)(e,_,T)}else l.length?b=(0,ri.or)(...l.map(_=>(0,ri._)`${T} === ${_}`)):b=ri.nil;return u.length&&(b=(0,ri.or)(b,...u.map(_=>(0,ri._)`${(0,Lm.usePattern)(t,_)}.test(${T})`))),(0,ri.not)(b)}function p(T){e.code((0,ri._)`delete ${i}[${T}]`)}function m(T){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(T);return}if(r===!1){t.setParams({additionalProperty:T}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,qm.alwaysValidSchema)(o,r)){let b=e.name("valid");c.removeAdditional==="failing"?(h(T,b,!1),e.if((0,ri.not)(b),()=>{t.reset(),p(T)})):(h(T,b),a||e.if((0,ri.not)(b),()=>e.break()))}}function h(T,b,_){let v={keyword:"additionalProperties",dataProp:T,dataPropType:qm.Type.Str};_===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,b)}}};t_.default=H4});var Z1=R(i_=>{"use strict";Object.defineProperty(i_,"__esModule",{value:!0});var V4=au(),J1=En(),n_=Ee(),Q1=r_(),z4={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&&Q1.default.code(new V4.KeywordCxt(s,Q1.default,"additionalProperties"));let o=(0,J1.allSchemaProperties)(r);for(let d of o)s.definedProperties.add(d);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=n_.mergeEvaluated.props(e,(0,n_.toHash)(o),s.props));let a=o.filter(d=>!(0,n_.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,J1.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)}}};i_.default=z4});var n$=R(s_=>{"use strict";Object.defineProperty(s_,"__esModule",{value:!0});var e$=En(),$m=Te(),t$=Ee(),r$=Ee(),W4={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,e$.allSchemaProperties)(r),c=a.filter(h=>(0,t$.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 $m.Name)&&(s.props=(0,r$.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 T in l)new RegExp(h).test(T)&&(0,t$.checkStrictMode)(s,`property ${T} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,T=>{e.if((0,$m._)`${(0,e$.usePattern)(t,h)}.test(${T})`,()=>{let b=c.includes(h);b||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:T,dataPropType:r$.Type.Str},u),s.opts.unevaluated&&d!==!0?e.assign((0,$m._)`${d}[${T}]`,!0):!b&&!s.allErrors&&e.if((0,$m.not)(u),()=>e.break())})})}}};s_.default=W4});var i$=R(o_=>{"use strict";Object.defineProperty(o_,"__esModule",{value:!0});var G4=Ee(),K4={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,G4.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"}};o_.default=K4});var s$=R(a_=>{"use strict";Object.defineProperty(a_,"__esModule",{value:!0});var Y4=En(),X4={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Y4.validateUnion,error:{message:"must match a schema in anyOf"}};a_.default=X4});var o$=R(c_=>{"use strict";Object.defineProperty(c_,"__esModule",{value:!0});var Bm=Te(),J4=Ee(),Q4={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Bm._)`{passingSchemas: ${t.passing}}`},Z4={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Q4,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,J4.alwaysValidSchema)(i,u)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Bm._)`${c} && ${o}`).assign(o,!1).assign(a,(0,Bm._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(a,d),f&&t.mergeEvaluated(f,Bm.Name)})})}}};c_.default=Z4});var a$=R(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var e9=Ee(),t9={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,e9.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(a)})}};l_.default=t9});var u$=R(u_=>{"use strict";Object.defineProperty(u_,"__esModule",{value:!0});var Fm=Te(),l$=Ee(),r9={message:({params:t})=>(0,Fm.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Fm._)`{failingKeyword: ${t.ifClause}}`},n9={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:r9,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,l$.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=c$(n,"then"),s=c$(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,Fm.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,Fm._)`${u}`):t.setParams({ifClause:u})}}}};function c$(t,e){let r=t.schema[e];return r!==void 0&&!(0,l$.alwaysValidSchema)(t,r)}u_.default=n9});var d$=R(d_=>{"use strict";Object.defineProperty(d_,"__esModule",{value:!0});var i9=Ee(),s9={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,i9.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};d_.default=s9});var f$=R(f_=>{"use strict";Object.defineProperty(f_,"__esModule",{value:!0});var o9=KS(),a9=H1(),c9=YS(),l9=z1(),u9=W1(),d9=xm(),f9=X1(),p9=r_(),h9=Z1(),m9=n$(),g9=i$(),y9=s$(),T9=o$(),v9=a$(),b9=u$(),S9=d$();function _9(t=!1){let e=[g9.default,y9.default,T9.default,v9.default,b9.default,S9.default,f9.default,p9.default,d9.default,h9.default,m9.default];return t?e.push(a9.default,l9.default):e.push(o9.default,c9.default),e.push(u9.default),e}f_.default=_9});var p$=R(p_=>{"use strict";Object.defineProperty(p_,"__esModule",{value:!0});var Lt=Te(),k9={message:({schemaCode:t})=>(0,Lt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Lt._)`{format: ${t}}`},N9={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:k9,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,Lt._)`${m}[${o}]`),T=r.let("fType"),b=r.let("format");r.if((0,Lt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(T,(0,Lt._)`${h}.type || "string"`).assign(b,(0,Lt._)`${h}.validate`),()=>r.assign(T,(0,Lt._)`"string"`).assign(b,h)),t.fail$data((0,Lt.or)(_(),v()));function _(){return c.strictSchema===!1?Lt.nil:(0,Lt._)`${o} && !${b}`}function v(){let N=u.$async?(0,Lt._)`(${h}.async ? await ${b}(${n}) : ${b}(${n}))`:(0,Lt._)`${b}(${n})`,C=(0,Lt._)`(typeof ${b} == "function" ? ${N} : ${b}.test(${n}))`;return(0,Lt._)`${b} && ${b} !== true && ${T} === ${e} && !${C}`}}function p(){let m=d.formats[s];if(!m){_();return}if(m===!0)return;let[h,T,b]=v(m);h===e&&t.pass(N());function _(){if(c.strictSchema===!1){d.logger.warn(C());return}throw new Error(C());function C(){return`unknown format "${s}" ignored in schema at path "${l}"`}}function v(C){let H=C instanceof RegExp?(0,Lt.regexpCode)(C):c.code.formats?(0,Lt._)`${c.code.formats}${(0,Lt.getProperty)(s)}`:void 0,M=r.scopeValue("formats",{key:s,ref:C,code:H});return typeof C=="object"&&!(C instanceof RegExp)?[C.type||"string",C.validate,(0,Lt._)`${M}.validate`]:["string",C,M]}function N(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Lt._)`await ${b}(${n})`}return typeof T=="function"?(0,Lt._)`${b}(${n})`:(0,Lt._)`${b}.test(${n})`}}}};p_.default=N9});var h$=R(h_=>{"use strict";Object.defineProperty(h_,"__esModule",{value:!0});var R9=p$(),P9=[R9.default];h_.default=P9});var m$=R(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});Ja.contentVocabulary=Ja.metadataVocabulary=void 0;Ja.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Ja.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var y$=R(m_=>{"use strict";Object.defineProperty(m_,"__esModule",{value:!0});var w9=R1(),E9=B1(),C9=f$(),D9=h$(),g$=m$(),A9=[w9.default,E9.default,(0,C9.default)(),D9.default,g$.metadataVocabulary,g$.contentVocabulary];m_.default=A9});var y_=R(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.dynamicAnchor=void 0;var g_=Te(),I9=wn(),T$=lu(),O9=Em(),M9={keyword:"$dynamicAnchor",schemaType:"string",code:t=>v$(t,t.schema)};function v$(t,e){let{gen:r,it:n}=t;n.schemaEnv.root.dynamicAnchors[e]=!0;let i=(0,g_._)`${I9.default.dynamicAnchors}${(0,g_.getProperty)(e)}`,s=n.errSchemaPath==="#"?n.validateName:x9(t);r.if((0,g_._)`!${i}`,()=>r.assign(i,s))}ku.dynamicAnchor=v$;function x9(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 T$.SchemaEnv({schema:r,schemaId:c,root:i,baseId:s,localRefs:o,meta:a});return T$.compileSchema.call(n,l),(0,O9.getValidate)(t,l)}ku.default=M9});var T_=R(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.dynamicRef=void 0;var b$=Te(),L9=wn(),S$=Em(),q9={keyword:"$dynamicRef",schemaType:"string",code:t=>_$(t,t.schema)};function _$(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,b$._)`${L9.default.dynamicAnchors}${(0,b$.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,S$.callRef)(t,c),r.let(l,!0)}):()=>(0,S$.callRef)(t,c)}}Nu.dynamicRef=_$;Nu.default=q9});var k$=R(v_=>{"use strict";Object.defineProperty(v_,"__esModule",{value:!0});var $9=y_(),B9=Ee(),F9={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,$9.dynamicAnchor)(t,""):(0,B9.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}};v_.default=F9});var N$=R(b_=>{"use strict";Object.defineProperty(b_,"__esModule",{value:!0});var j9=T_(),U9={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,j9.dynamicRef)(t,t.schema)};b_.default=U9});var R$=R(S_=>{"use strict";Object.defineProperty(S_,"__esModule",{value:!0});var H9=y_(),V9=T_(),z9=k$(),W9=N$(),G9=[H9.default,V9.default,z9.default,W9.default];S_.default=G9});var w$=R(__=>{"use strict";Object.defineProperty(__,"__esModule",{value:!0});var P$=xm(),K9={keyword:"dependentRequired",type:"object",schemaType:"object",error:P$.error,code:t=>(0,P$.validatePropertyDeps)(t)};__.default=K9});var E$=R(k_=>{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});var Y9=xm(),X9={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,Y9.validateSchemaDeps)(t)};k_.default=X9});var C$=R(N_=>{"use strict";Object.defineProperty(N_,"__esModule",{value:!0});var J9=Ee(),Q9={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:e,it:r}){e.contains===void 0&&(0,J9.checkStrictMode)(r,`"${t}" without "contains" is ignored`)}};N_.default=Q9});var D$=R(R_=>{"use strict";Object.defineProperty(R_,"__esModule",{value:!0});var Z9=w$(),eJ=E$(),tJ=C$(),rJ=[Z9.default,eJ.default,tJ.default];R_.default=rJ});var I$=R(P_=>{"use strict";Object.defineProperty(P_,"__esModule",{value:!0});var xs=Te(),A$=Ee(),nJ=wn(),iJ={message:"must NOT have unevaluated properties",params:({params:t})=>(0,xs._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},sJ={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:iJ,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} === ${nJ.default.errors}`);function c(d){if(r===!1){t.setParams({unevaluatedProperty:d}),t.error(),o||e.break();return}if(!(0,A$.alwaysValidSchema)(s,r)){let f=e.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:A$.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)}}};P_.default=sJ});var M$=R(w_=>{"use strict";Object.defineProperty(w_,"__esModule",{value:!0});var ko=Te(),O$=Ee(),oJ={message:({params:{len:t}})=>(0,ko.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,ko._)`{limit: ${t}}`},aJ={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:oJ,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,ko._)`${n}.length`);if(r===!1)t.setParams({len:s}),t.fail((0,ko._)`${o} > ${s}`);else if(typeof r=="object"&&!(0,O$.alwaysValidSchema)(i,r)){let c=e.var("valid",(0,ko._)`${o} <= ${s}`);e.if((0,ko.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:O$.Type.Num},c),i.allErrors||e.if((0,ko.not)(c),()=>e.break())})}}};w_.default=aJ});var x$=R(E_=>{"use strict";Object.defineProperty(E_,"__esModule",{value:!0});var cJ=I$(),lJ=M$(),uJ=[cJ.default,lJ.default];E_.default=uJ});var q$=R(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});jm.DiscrError=void 0;var L$;(function(t){t.Tag="tag",t.Mapping="mapping"})(L$||(jm.DiscrError=L$={}))});var B$=R(D_=>{"use strict";Object.defineProperty(D_,"__esModule",{value:!0});var Qa=Te(),C_=q$(),$$=lu(),dJ=cu(),fJ=Ee(),pJ={message:({params:{discrError:t,tagName:e}})=>t===C_.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Qa._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},hJ={keyword:"discriminator",type:"object",schemaType:"object",error:pJ,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,Qa._)`${r}${(0,Qa.getProperty)(a)}`);e.if((0,Qa._)`typeof ${l} == "string"`,()=>u(),()=>t.error(!1,{discrError:C_.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,Qa._)`${l} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:C_.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,Qa.Name),m}function f(){var p;let m={},h=b(i),T=!0;for(let N=0;N<o.length;N++){let C=o[N];if(C?.$ref&&!(0,fJ.schemaHasRulesButRef)(C,s.self.RULES)){let M=C.$ref;if(C=$$.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,M),C instanceof $$.SchemaEnv&&(C=C.schema),C===void 0)throw new dJ.default(s.opts.uriResolver,s.baseId,M)}let H=(p=C?.properties)===null||p===void 0?void 0:p[a];if(typeof H!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);T=T&&(h||b(C)),_(H,N)}if(!T)throw new Error(`discriminator: "${a}" must be required`);return m;function b({required:N}){return Array.isArray(N)&&N.includes(a)}function _(N,C){if(N.const)v(N.const,C);else if(N.enum)for(let H of N.enum)v(H,C);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function v(N,C){if(typeof N!="string"||N in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[N]=C}}}};D_.default=hJ});var F$=R((Lwe,mJ)=>{mJ.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 j$=R((qwe,gJ)=>{gJ.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 U$=R(($we,yJ)=>{yJ.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 H$=R((Bwe,TJ)=>{TJ.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 V$=R((Fwe,vJ)=>{vJ.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 z$=R((jwe,bJ)=>{bJ.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 W$=R((Uwe,SJ)=>{SJ.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 G$=R(A_=>{"use strict";Object.defineProperty(A_,"__esModule",{value:!0});var _J=F$(),kJ=j$(),NJ=U$(),RJ=H$(),PJ=V$(),wJ=z$(),EJ=W$(),CJ=["/properties"];function DJ(t){return[_J,kJ,NJ,RJ,e(this,PJ),wJ,e(this,EJ)].forEach(r=>this.addMetaSchema(r,void 0,!1)),this;function e(r,n){return t?r.$dataMetaSchema(n,CJ):n}}A_.default=DJ});var K$=R((vt,O_)=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.MissingRefError=vt.ValidationError=vt.CodeGen=vt.Name=vt.nil=vt.stringify=vt.str=vt._=vt.KeywordCxt=vt.Ajv2019=void 0;var AJ=b1(),IJ=y$(),OJ=R$(),MJ=D$(),xJ=x$(),LJ=B$(),qJ=G$(),I_="https://json-schema.org/draft/2019-09/schema",Za=class extends AJ.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(OJ.default),IJ.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(MJ.default),this.addVocabulary(xJ.default),this.opts.discriminator&&this.addKeyword(LJ.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:r}=this.opts;r&&(qJ.default.call(this,e),this.refs["http://json-schema.org/schema"]=I_)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(I_)?I_:void 0)}};vt.Ajv2019=Za;O_.exports=vt=Za;O_.exports.Ajv2019=Za;Object.defineProperty(vt,"__esModule",{value:!0});vt.default=Za;var $J=au();Object.defineProperty(vt,"KeywordCxt",{enumerable:!0,get:function(){return $J.KeywordCxt}});var ec=Te();Object.defineProperty(vt,"_",{enumerable:!0,get:function(){return ec._}});Object.defineProperty(vt,"str",{enumerable:!0,get:function(){return ec.str}});Object.defineProperty(vt,"stringify",{enumerable:!0,get:function(){return ec.stringify}});Object.defineProperty(vt,"nil",{enumerable:!0,get:function(){return ec.nil}});Object.defineProperty(vt,"Name",{enumerable:!0,get:function(){return ec.Name}});Object.defineProperty(vt,"CodeGen",{enumerable:!0,get:function(){return ec.CodeGen}});var BJ=bm();Object.defineProperty(vt,"ValidationError",{enumerable:!0,get:function(){return BJ.default}});var FJ=cu();Object.defineProperty(vt,"MissingRefError",{enumerable:!0,get:function(){return FJ.default}})});var ic=require("path"),Ge=$(Dw());var hf=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=Iw(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=Aw(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=Aw(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{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],i=e.line+1<r.length?r[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}},hn;(function(t){function e(i,s,o,a){return new hf(i,s,o,a)}t.create=e;function r(i,s,o){if(i instanceof hf)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=Yy(s.map(oU),(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})(hn||(hn={}));function Yy(t,e){if(t.length<=1)return t;let r=t.length/2|0,n=t.slice(0,r),i=t.slice(r);Yy(n,e),Yy(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 Aw(t,e,r=0){let n=e?[r]:[];for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);(s===13||s===10)&&(s===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,n.push(r+i+1))}return n}function Iw(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 oU(t){let e=Iw(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var mf=["namespace","class","enum","interface","struct","typeParameter","type","parameter","variable","property","enumMember","decorator","event","function","method","macro","label","comment","string","keyword","number","regexp","operator"],gf=["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"];var Jy=$(require("url")),Uw=require("crypto"),ea=require("path"),tr=$(j());var Xy=$(j());var xr=$(j());var Q=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 uri(){return this.firstToken.uri}getTopMostAstNodeForFile(e){return pe(e,this.uri)?[this]:this.children.flatMap(r=>r.getTopMostAstNodeForFile(e))}getDocumentSymbols(e){if(!this.docSymbolsMeta)return this.children.flatMap(n=>n.getDocumentSymbols(e)??[]);if(!pe(this.uri,e))return[];let r=fe(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(![xr.SymbolKind.File,xr.SymbolKind.Class,xr.SymbolKind.Constant].some(i=>i===e))return[];let r=Lr(this.uri),n=r?.range??fe(this);return[{location:xr.Location.create(ue(r?.docUri??this.uri),n),name:this.docSymbolsMeta.name?this.docSymbolsMeta.name:"__UNSET__",kind:this.docSymbolsMeta.kind},...this.children.flatMap(i=>i.getWorkspaceSymbols()??[]).filter(i=>i.kind===xr.SymbolKind.File||i.kind===xr.SymbolKind.Class||i.kind===xr.SymbolKind.Constant)]}buildSemanticTokens(e){this._children.forEach(r=>r.buildSemanticTokens(e)),!(!this.semanticTokenType||!this.semanticTokenModifiers)&&e(Ai(this.semanticTokenType),Ii(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 xr.Range.create(xr.Position.create(this.firstToken.pos.line,this.firstToken.pos.col),xr.Position.create(this.lastToken.pos.line,this.lastToken.pos.colEnd))}get serializeUri(){return ue(this.uri)}serialize(e){return{uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var be=class extends Q{get firstToken(){return this.operator?this.operator.firstToken:super.firstToken}toJson(){return-1}#e;resolve(e){return this.#e??=yf(this.toString(),e),this.#e}#t;evaluate(e){return this.#t??=Ce(`${this.operator?this.operator.toString():""}${this.resolve(e)}`),this.#t}#n;isTrue(e){return this.#n??=Ce(`!!(${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),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},Yr=class t extends be{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 be?i.resolve(r):i.toString()).join(" ")})`;return Ce(`!!(${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 ci=class extends be{constructor(r,n,i){super(n);this.value=r;this.docSymbolsMeta={name:`param${i+1}`,kind:Xy.SymbolKind.Variable},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}toString(){return this.value}},mn=class extends be{constructor(r,n){super();this.functionName=r;this.params=n;this.addChild(r),this.params.forEach(i=>this.addChild(i))}getDocumentSymbols(r){return pe(this.uri,r)?[{name:this.functionName.name,kind:Xy.SymbolKind.Function,range:fe(this),selectionRange:fe(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?Ce(`!!(${this.operator}${n})`):n}return super.isTrue(r)}};var Fn=$(j());var qw=$(j());var Ow=$(j());var ne=class extends Q{constructor(r,n){super(n);this.value=r;this.semanticTokenType="string",this.semanticTokenModifiers="declaration",this.docSymbolsMeta={name:this.value,kind:Ow.SymbolKind.String}}toString(){return`"${this.value.toString()}"`}toJson(){return this.value}serialize(){return{type:"STRING",value:this.value,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var xw=$(j());var Mw=$(j());var Kt=class extends be{constructor(r,n,i=10){super(n);this.value=r;this.radix=i;this.docSymbolsMeta={name:this.value.toString(),kind:Mw.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,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var Nt=class extends Q{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 Kt)){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),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var Lw=$(j());var Xr=class extends Q{constructor(r){super();this.values=r;this.docSymbolsMeta={name:"Byte String Value",kind:Lw.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?{value:r.value.toString(16),range:r.value.range,evaluated:r.value.value}:null),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var tt=class extends Q{constructor(r,n){super(n);this.name=r;this.semanticTokenType="property",this.semanticTokenModifiers="declaration"}toString(){return this.name}serialize(){return{value:this.name,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},Ye=class extends Q{constructor(r,n=[]){super();this.propertyName=r;this.labels=n;this._values=void 0;this.docSymbolsMeta={name:this.propertyName?.name??"Unknown",kind:qw.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 Nt?r.value.values.map(n=>n.value instanceof Kt?n.value.value:NaN):r.value instanceof Xr?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 Nt?r.value.values.map(n=>n.value):r.value instanceof Xr?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){return`${this.propertyName?.toString()??"__UNSET__"}${this.assignOperatorToken?` = ${this._values?.values.map(n=>n?.toPrettyString(r)??"NULL").join(", ")??"NULL"}`:""};`}serialize(r){return{name:this.propertyName?.serialize()??null,values:this.values?.values.map(n=>n?.value?.serialize(r)??null)??null,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var $w=$(j());var _r=class extends Q{constructor(r,n){super();this.keyword=n;this.addChild(n),this.docSymbolsMeta={name:r,kind:$w.SymbolKind.Function}}};var qr=class extends _r{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 gt=class extends _r{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 Bw=$(j());var ie=class extends Q{constructor(r){super();this.label=r;this.docSymbolsMeta={name:`&${this.label?.value??"NULL"}`,kind:Bw.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,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var We=class t extends Q{constructor(){super()}get path(){if(!this.pathName)return["__UNDEFINED__"];if(!this.parentNode||this instanceof It)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)}},It=class extends We{constructor(){super(),this.docSymbolsMeta={name:"/",kind:Fn.SymbolKind.Class}}get properties(){return this.children.filter(e=>e instanceof Ye)}get name(){return new Me("/",oe(this.firstToken))}get deleteProperties(){return this.children.filter(e=>e instanceof gt)}get nodes(){return this.children.filter(e=>e instanceof Xe)}get pathName(){return"/"}serialize(e){return{type:"ROOT",properties:this.properties.map(r=>r.serialize(e)),nodes:this.nodes.map(r=>r.serialize(e)),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},fr=class extends We{constructor(r=[]){super();this.labels=r;this._reference=null;this.docSymbolsMeta={name:"DTC Name",kind:Fn.SymbolKind.Class},r.forEach(n=>{super.addChild(n)})}get serializeIssues(){return[...this.issues,...this.reference?.issues??[]].map(r=>r())}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:Fn.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 Xe)}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 Ye)}get deleteProperties(){return this.children.filter(r=>r instanceof gt)}serialize(r){return{type:"REF",name:this.reference?.serialize()??null,properties:this.properties.map(n=>n.serialize(r)),nodes:this.nodes.map(n=>n.serialize(r)),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},Xe=class t extends We{constructor(r=[],n){super();this.labels=r;this.omitIfNoRef=n;this._name=null;this.docSymbolsMeta={name:"DTC Name",kind:Fn.SymbolKind.Class},n&&this.addChild(n),r.forEach(i=>{this.addChild(i)})}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:Fn.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 Ye)}get deleteProperties(){return this.children.filter(r=>r instanceof gt)}serialize(r){return{type:"CHILD",name:this.name?.serialize()??null,properties:this.properties.map(n=>n.serialize(r)),nodes:this.nodes.map(n=>n.serialize(r)),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},Pc=class extends Q{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,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},Me=class extends Q{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(Ai("type"),Ii("declaration"),i,i),this.address!==void 0&&this.address.forEach(s=>{r(Ai("decorator"),Ii("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,uri:this.serializeUri,range:Fn.Range.create(Fn.Position.create(r.pos.line,r.pos.col),Fn.Position.create(r.pos.line,r.pos.colEnd)),issues:this.serializeIssues},address:this.address?.map(n=>n.serialize())??null,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var Jr=(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)=>tr.Position.create(t.pos.line,e?t.pos.colEnd:t.pos.col),fe=t=>Jr(t.firstToken,t.lastToken),Ai=t=>mf.findIndex(e=>e===t),Ii=t=>gf.findIndex(e=>e===t),Qy=(t,e,r)=>!pe(t.uri,e)||r.line<t.pos.line?!1:r.line>t.pos.line?!0:r.character>=t.pos.colEnd,aU=(t,e,r)=>pe(t.uri,e)?r.line<t.pos.line?!0:r.line>t.pos.line?!1:r.character<t.pos.col:!1,kr=(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)&&pe(t.uri,e))},bf=(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)},Hw=(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&&pe(t.uri,e))},Vw=(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 jn=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].reverse().find(s=>kr(s,e,r));return n},wc=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].find(s=>aU(s.lastToken,e,r));return n===t?void 0:n},Ec=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].reverse().find(s=>Qy(s.firstToken,e,r));return n===t?void 0:n},Sf="#virtual#",Zy=t=>t.includes(Sf),Lr=t=>{if(!Zy(t))return;let[e,r]=t.split(Sf),[n,i]=r.split("-"),[s,o]=n.split(":"),[a,c]=i.split(":");return{docUri:e,range:tr.Range.create(tr.Position.create(Number.parseInt(s),Number.parseInt(o)),tr.Position.create(Number.parseInt(a),Number.parseInt(c)))}},eT=t=>{let e=Lr(t.uri);e&&(t.range=e.range,t.uri=e?.docUri,t.virtual=!0,t.linkedTo=t.linkedTo.map(({range:r,uri:n})=>{let i=Lr(n);return{range:i?.range??r,uri:i?.docUri??n,templateStrings:[]}}))},W=(t,e,r=e,n,{severity:i=tr.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l,inclusiveStart:u,inclusiveEnd:d}={severity:tr.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[]})=>{let f={issues:Array.isArray(t)?t:[t],range:Jr(e,r,u,d),uri:e.uri,severity:i,linkedTo:s.map(({range:h,uri:T})=>({range:h,uri:T,templateStrings:[]})),tags:o,templateStrings:a,edit:c,codeActionTitle:l};eT(f);let p,m=()=>(p??={severity:f.severity,range:f.range,message:f.issues?f.issues.map(dU).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=tr.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l,linkedToTemplateStrings:u=[]}={severity:tr.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[],linkedToTemplateStrings:[]})=>{let d={issues:Array.isArray(t)?t:[t],range:Jr(e,r),uri:e.uri,severity:i,linkedTo:s.map(({range:m,uri:h},T)=>({range:m,uri:h,templateStrings:u.at(T)??[]})),tags:o,templateStrings:a,edit:c,codeActionTitle:l};eT(d);let f,p=()=>(f??={severity:d.severity,range:d.range,message:fU(d),source:"devicetree",tags:d.tags,relatedInformation:[...d.linkedTo.map(m=>({message:d.issues.map(h=>pU(h,m.templateStrings)).join(" or "),location:{uri:ue(m.uri),range:m.range}}))]},f);return n?.resettableIssues.push(p),{raw:d,diagnostic:p}},B=(t,e,r,n,{severity:i=tr.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l}={severity:tr.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[]})=>{let u={issues:Array.isArray(t)?t:[t],range:Jr(e,r),severity:i,uri:e.uri,linkedTo:s.map(({range:p,uri:m})=>({range:p,uri:m,templateStrings:[]})),tags:o,templateStrings:a,edit:c,codeActionTitle:l};eT(u);let d,f=()=>(d??={severity:u.severity,range:u.range,message:hU(u),relatedInformation:[...u.linkedTo.map(p=>({message:u.issues.map(mU).join(" or "),location:{uri:ue(p.uri),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 n?.resettableIssues.push(f),{raw:u,diagnostic:f}};function Ot(t,e,r,{severity:n=tr.DiagnosticSeverity.Warning,linkedTo:i=[],tags:s,templateStrings:o=[],edit:a,codeActionTitle:c}={severity:tr.DiagnosticSeverity.Warning,linkedTo:[],templateStrings:[],edit:[],codeActionTitle:void 0},l=r){let u={issues:Array.isArray(t)?t:[t],range:tr.Range.create(r,l),severity:n,uri:e,linkedTo:i.map(({range:p,uri:m})=>({range:p,uri:m,templateStrings:[]})),tags:s,templateStrings:o,edit:a,codeActionTitle:c},d;return{raw:u,diagnostic:()=>(d??={severity:u.severity,range:u.range,message:gU(u),relatedInformation:[...u.linkedTo.map(p=>({message:u.issues.map(yU).join(" or "),location:{uri:ue(p.uri),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 zw=(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 Rt(t,e,r){let n=Pe(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=>kr(u,n,t.position));return c&&(o={runtime:s,item:null,ast:jn(c,n,t.position)},a=Number.MAX_SAFE_INTEGER),o||(o=s.getDeepestAstNode(n,t.position),a=e.getSortKey(o?.ast)),console.log(`search: ${performance.now()-i}ms`),r(o,u=>{let d=t.position;if(pe(u.uri,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 oe(t,e){return{start:t,end:e??t}}var U=(t,e)=>t?.tokens.some(r=>r===e),rt=(t,e)=>r=>r?.value&&(e?.caseInsensitive?t.toLowerCase()===r.value.toLowerCase():t===r.value)?"yes":e?.allowPartial?cU(t)(r):"no",xe=t=>e=>e?.tokens.some(r=>r===t)?"yes":"no",cU=t=>e=>e?.value&&t.startsWith(e.value)?"partial":"no",Qr=(t,e)=>!!t&&!!e&&t.pos.line===e.pos.line&&pe(t.uri,e.uri),Ft=(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&&Qr(t,e),_f=t=>t.map((e,r)=>({index:r,context:e,files:e.getContextFiles()})),yn=(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=>pe(s,e.uri))?r:_f(t).sort(s=>s.context.id===n?-1:0).find(s=>s.files.some(o=>pe(o,e.uri)))?.context},tT=(t,e)=>_f(t).filter(n=>n.files.some(i=>pe(i,e))).map(n=>n.context),Ww=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;return a.forEach((u,d)=>{let f=new RegExp(`\\b${u}\\b`,"g");l=l.replace(f,c[d])}),l=l.replace(/__VA_ARGS__/g,c.slice(a.length).join(", ")),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)=>{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 lU(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 uU=0,yf=(t,e)=>{let r=o=>o.replace(/(\w+)\s*##\s*(\w+)/g,(a,c,l)=>c+l),n=o=>o.replace(/#(\w+)/g,(a,c)=>`"${c}"`),i=t,s;do s=i,i=r(s),i=n(i),i=i.replace(/\b(\w+)\(([^()]*(?:\([^()]*\)[^()]*)*)\)|\b(\w+)\b/g,(o,a,c,l)=>{if(a==="defined"){let u=c.split(",").map(d=>d.trim());return u[0]?e.get(u[0])?.resolver:u}else if(a&&typeof e.get(a)?.resolver=="function"){let u=lU(c).map(d=>d.trim()).map(d=>d==="__COUNTER__"?(uU++).toString():d);return(e.get(a)?.resolver)(...u)}else if(l&&typeof e.get(l)?.resolver=="string")return e.get(l)?.resolver;return o});while(i!==s);return i};function rT(t){return t.replace(/'(.)'/g,(e,r)=>r.charCodeAt(0).toString()).replace(/(0x[a-f\d]+|\d+)[ul]*/gi,"$1")}function Ce(t){try{return(0,eval)(rT(t))}catch{}return t}var ue=t=>Jy.default.pathToFileURL(t).toString(),Pe=t=>st(Jy.default.fileURLToPath(t)),Gw=(t,e)=>{let r=(0,ea.relative)(t,e);return!!r&&!r.startsWith("..")&&!(0,ea.isAbsolute)(r)},pe=(t,e)=>!t||!e?!1:t===e,st=t=>(0,ea.normalize)(process.platform==="win32"?t.toLowerCase():t),Oi=t=>(0,Uw.createHash)("sha256").update([st(t.dtsFile),...t.includePaths.map(st),...t.overlays.map(st),t.bindingType,...t.zephyrBindings.map(st),...t.deviceOrgBindingsMetaSchema.map(st),...t.deviceOrgTreeBindings.map(st),`showFormattingErrorAsDiagnostics-${t.showFormattingErrorAsDiagnostics}`].join(":")).digest("hex"),dU=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"}},fU=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]}".`}}).join(" or "),pU=(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]}".`;default:return"TODO"}},hU=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 should be used on bus type${t.templateStrings.length?"s":""}: ${t.templateStrings.join(" or ")}`}}).join(" or ").replace("INTRO",`Property "${t.templateStrings[0]}"`).replaceAll("INTRO ",""),mU=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"}},gU=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}`}}).join(" or "),yU=t=>"TODO",gn=(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},as=(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},TU=(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},vU=(t,e)=>as(t,e),Kw=(t,e)=>{let r=[];for(let n of t){let i=n.childAddress,s=n.length,o=as(i,s);if(gn(e,i)>=0&&gn(e,o)<0){let a=TU(e,i),c=n.parentAddress,l=vU(c,a),u=as(c,s);r.push({start:l,end:u,range:Jr(n.rangeTokens.start,n.rangeTokens.end),uri:n.rangeTokens.start.uri})}}return r};function Yw(t){return Array.isArray(t)&&Array.isArray(t[0])}function Cc(t){return!t||t instanceof mn?t:Cc(t.parentNode)}function kf(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 Xw(t,e){return Fw(t.end,e.start)>0&&Fw(t.start,e.end)<0}var Jw=(t,e)=>{let r=Qw(t,e),n=Zw(t,e);r&&(t.topComment=r),n&&(t.endComment=n)},Qw=(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=Qw(r,e);return n&&(n.astAfterComment=t,r.astAfterComment=void 0),n??r},Zw=(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=Zw(r,e);return n&&(n.astBeforeComment=t,r.astBeforeComment=void 0),n??r},Xs=(t,e,r)=>{let n=[42,44,45,36];return r||n.push(52,32,53,8,49),t.severity===tr.DiagnosticSeverity.Error&&pe(t.uri,e)&&!n.some(i=>t.issues.includes(i))};function Nf(t){let e=t?.charAt(0);return!!e&&(e>="A"&&e<="Z"||e>="a"&&e<="z")}var Rf=t=>{if(t)return t instanceof We?t:Rf(t?.parentNode)},Js=(t,e,r=0)=>{if(!e||!e.parentNode?.uri)return r;let n=Rf(e.parentNode);return Js(t,n,r+1)};var Uc=require("fs"),tD=require("path"),eo=$(j());var VC=require("path"),vn=$(j());var Nr=class extends Q{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 Vt=t=>t instanceof _r?!0:t instanceof We?!1:t.parentNode?Vt(t.parentNode):!1;var nT=t=>{if(t instanceof Ye)return t;if(!(t instanceof We))return t.parentNode?nT(t.parentNode):void 0},Qs=t=>!t||t instanceof Ye?!1:t instanceof Nr||Qs(t.parentNode),ta=t=>[...t.map(e=>{if(e instanceof Xe||e instanceof It)return e.name;if(e instanceof fr)return e.reference})].filter(e=>!!e),iT=(t,e)=>e?e.parentNode===t||iT(t,e.parentNode):!1;var Dt=$(j());var eE=$(j());var Un=class extends Q{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 Me?n.buildSemanticTokens(r):r(Ai("operator"),Ii("declaration"),n.firstToken,n.lastToken)})}},ot=class extends Q{constructor(r){super();this.path=r;this.docSymbolsMeta={name:`/${this.path?.toString()??""}`,kind:eE.SymbolKind.Namespace},this.addChild(r)}toString(){return`&${this.path?.toString()??"NULL"}`}toJson(){return-1}serialize(){return{type:"NODE_PATH",nodePath:this.path?.toString()??null,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};function bU(t){switch(t){case"EMPTY":return"EMPTY";case"U32":return"U32";case"U64":return"U64";case"STRING":return"STRING";case"PROP_ENCODED_ARRAY":return"PROP_ENCODED_ARRAY";case"STRINGLIST":return"STRINGLIST";case"BYTESTRING":return"BYTESTRING";case"ANY":return"ANY";case"UNKNOWN":return"UNKNOWN"}}var Y=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:Dt.MarkupKind.Markdown,value:["### Type","**DTS native type** ",`${this.type.map(e=>e.types.map(bU).join(" or ")).join(",")}
|
|
203
183
|
|
|
204
184
|
`,...this.bindingType?["**Binding type** ",`${this.bindingType}
|
|
205
185
|
|
|
@@ -208,9 +188,9 @@ ${Lc(r,s,Oi(n,t+4))}`),...b?[W.TextEdit.replace(W.Range.create(_e(b.expression.f
|
|
|
208
188
|
`)]:[],...this.examples?["### Example",this.examples.join(`
|
|
209
189
|
|
|
210
190
|
`)]:[]].join(`
|
|
211
|
-
`)});this.signatureArgsCyclic=!1;typeof n!="function"?this.required=()=>n:this.required=n,typeof s!="function"?(this.allowedValues=s,this.values=()=>s===void 0?i?[i]:[]:i&&s.indexOf(i)===-1?[i,...s]:s):this.values=s}getNameMatch(e){return typeof this.name=="string"?this.name===e:this.name.test(e)}validateProperty(e,r,n,i){let s=this.required(r);if(i){if(s==="omitted")return[B(11,i.ast.firstToken,i.ast.lastToken,i.ast,{templateStrings:[n]})]}else{if(s==="required"){let l=e.getOrderedNodeAst(r),u=
|
|
212
|
-
${"".padEnd(
|
|
213
|
-
`)};`,this.description,...a.flat())],activeSignature:0,activeParameter:d}}return o.signatureArgsCyclic&&d&&(d=d%a.length),{signatures:[Dt.SignatureInformation.create(`${r.name} = <${a.map(f=>f.label).join(" ")}>;`,this.description,...a)],activeSignature:0,activeParameter:d}}getPropertyListCompletionItems(r){return this.properties.filter(n=>!n.hideAutoComplete&&n.required(r)!=="omitted"&&typeof n.name=="string").map(n=>{let i=r&&n.required(r),s=!!r.properties.some(a=>n.getNameMatch(a.name)),o="a";return i==="required"?o=s?"Y":"!":o=s?"Z":"B",{label:`${n.name}`,kind:Dt.CompletionItemKind.Property,sortText:`${o}${n.name}`}})??[]}};var Le=t=>{if(!t?.values.some(e=>!(e?.value instanceof Ct)))return t?.values.flatMap(e=>e.value.values.map(r=>r.value))??[]};var Be=(t,e,r,n)=>{let i=t.ast.values?.values.at(e)?.value;if(i instanceof Ct){let s=i.values.at(r);if(s?.value instanceof Se){let o=s.value.evaluate(n);if(typeof o=="number")return o}}},gn=(t,e,r=0)=>{if(t instanceof _r){if(t?.value instanceof Ct){let n=t.value.values.at(r);if(n?.value instanceof Kt)return e.getPhandle(n.value.value);if(n?.value instanceof ie)return n.value.linksTo;if(n?.value instanceof st)return n.value.path?.pathParts.at(-1)?.linksTo}}else{if(t instanceof Kt)return e.getPhandle(t.value);if(t instanceof ie)return t.linksTo;if(t instanceof st)return t.path?.pathParts.at(-1)?.linksTo}},z=t=>Array.isArray(t)?[{types:t}]:[{types:[t]}];var gC=()=>{let t=new X("compatible",z("STRINGLIST"));return t.description=["The compatible property value consists of one or more strings that define the specific programming model for the device. This list of strings should be used by a client program for device driver selection. The property value consists of a concatenated list of null terminated strings, from most specific to most general. They allow a device to express its compatibility with a family of similar devices, potentially allowing a single device driver to match against several devices.",'The recommended format is "manufacturer, model", where manufacturer is a string describing the name of the manufacturer (such as a stock ticker symbol), and model specifies the model number.',"The compatible string should consist only of lowercase letters, digits and dashes, and should start with a letter. A single comma is typically only used following a vendor prefix. Underscores should not be used."],t.examples=['```devicetree\ncompatible = "fsl,mpc8641", "ns16550";\n```',"In this example, an operating system would first try to locate a device driver that supported fsl, mpc8641. If a driver was not found, it would then try to locate a driver that supported the more general ns 16550 device type."],t};var zf=$(U());var yC=()=>{let t=new X("device_type",z("STRING"),"optional",void 0,e=>e.parent.name==="cpu"||e.parent.name==="memory"?[e.parent.name]:[],e=>{if(e.parent.name==="cpu"||e.parent.name==="memory"){let r=e.ast.values?.values.at(0)?.value;if(r instanceof ne&&r.value!==e.parent.name)return[B(e.parent.name==="cpu"?12:13,e.ast.firstToken,e.ast.lastToken,e.ast,{templateStrings:[e.name]})]}return t.required(e.parent)!=="required"?[B(14,e.ast.firstToken,e.ast.lastToken,e.ast,{severity:zf.DiagnosticSeverity.Hint,tags:[zf.DiagnosticTag.Deprecated],templateStrings:[e.name]})]:[]});return t.description=["The device_type property was used in IEEE 1275 to describe the device's FCode programming model. Because DTSpec does not have FCode, new use of the property is deprecated, and it should be included only on cpu and memory nodes for compatibility with IEEE 1275-derived devicetrees."],t};var TC=()=>{let t=new X("#interrupt-cells",z("U32"));return t.description=["The #interrupt-cells property defines the number of cells required to encode an interrupt specifier for an interrupt domain."],t};var vC=()=>{let t=new X("interrupt-controller",z("EMPTY"),"optional");return t.description=["The presence of an interrupt-controller property defines a node as an interrupt controller node."],t};var bC=()=>{let t=new X("interrupt-parent",z("U32"));return t.description=["Because the hierarchy of the nodes in the interrupt tree might not match the devicetree, the interrupt-parent property is available to make the definition of an interrupt parent explicit. The value is the phandle to the interrupt parent. If this property is missing from a device, its interrupt parent is assumed to be its devicetree parent."],t};var ST=$(U());var SC=()=>{let t=new X("interrupts",z("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,r)=>{let n=[],i=Le(e.ast.values);if(!i)return n;let s=e.parent;if(s.getProperty("interrupts-extended"))return n;let o=s.interruptsParent;if(!o?.parentInterruptNode){if(!o?.interruptParent)return n.push(B(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...e.parent.nodeNameOrLabelRef],templateStrings:[e.name,"interrupt-parent",e.parent.pathString]})),n;let h=o.interruptParent.ast.values?.values.at(0)?.value??o.interruptParent.ast;return n.push(B(17,h.firstToken,h.lastToken,h)),n}let{parentInterruptNode:a}=o,c=a.getProperty("#interrupt-cells");if(!c)return n.push(B(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...a.nodeNameOrLabelRef],templateStrings:[e.name,"#interrupt-cells",a.pathString]})),n;let l=Be(c,0,0,r);if(!l)return n;let u=[...Array.from({length:l},()=>"Interrupt")],d=a.bindingLoader?.type?a.nodeType?.cellsValues?.find(h=>h.specifier==="interrupt"):void 0;d?(u=d.values,t.signatureArgs=d.values.map(h=>ST.ParameterInformation.create(h))):t.signatureArgs=u.map(h=>ST.ParameterInformation.create(h));let f=a.getProperty("interrupt-map"),p=s.parent?.getProperty("#address-cells");if(f&&!p){let h=e.ast.propertyName??e.ast;n.push(B(16,h.firstToken,h.lastToken,h,{linkedTo:[...e.parent.nodeNameOrLabelRef],templateStrings:[e.name,"#address-cells",s.parent?.pathString??"/"]}))}if(!c)return n.push(B(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...a.nodeNameOrLabelRef],templateStrings:[e.name,"#interrupt-cells",a.pathString]})),n;let m=0;for(;m<i.length;){let h=i.length-m;if(l>h){let v=i[i.length-1];return n.push(B(19,v.firstToken,v.lastToken,v,{templateStrings:[e.name,`<${u.join(" ")}> `]})),n}let T=i.slice(m,m+l),b=s.mappedReg(r)?.at(0)?.startAddress,S={mappingValuesAst:T,target:a};if(e.nexusMapsTo.push(S),f&&b){let v=a.getNexusMapEntryMatch("interrupt",r,T,b);v?.match?S.mapItem=v.match:n.push(B(31,v.entry.firstToken,v.entry.lastToken,v.entry,{linkedTo:[f.ast]}))}T.every(v=>v instanceof Se)&&a.interrupControlerMapping.push({expressions:T,node:s,property:e}),m+=l}return n});return t.description=["The interrupts property of a device node defines the interrupt or interrupts that are generated by the device.The value of the interrupts property consists of an arbitrary number of interrupt specifiers. The format of an interrupt specifier is defined by the binding of the interrupt domain root.","interrupts is overridden by the interrupts-extended property and normally only one or the other should be used."],t.examples=["A common definition of an interrupt specifier in an open PIC-compatible interrupt domain consists of two cells; an interrupt number and level/sense information. See the following example, which defines a single interrupt specifier, with an interrupt number of OxA and level/sense encoding of 8.","```devicetree\ninterrupts = <0xA 8>;\n```"],t};var Bc=$(U());var _C=()=>{let t=new X("interrupts-extended",z("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,r)=>{let n=[],i=e.parent,s=i.getProperty("interrupts");s&&n.push(B(15,s.ast.firstToken,s.ast.lastToken,s.ast,{severity:Bc.DiagnosticSeverity.Warning,linkedTo:[e.ast],templateStrings:[s.name,"is ignored when 'interrupts-extended' is used"]}));let o=i.getProperty("interrupt-parent");o&&n.push(B(15,o.ast.firstToken,o.ast.lastToken,o.ast,{severity:Bc.DiagnosticSeverity.Warning,linkedTo:[e.ast],templateStrings:[o.name,"is ignored when 'interrupts-extended' is used"]}));let a=i.root,c=Le(e.ast.values);if(!c?.length)return[];let l=0,u=0,d=[];for(;l<c.length;){let f=gn(c[l],a);if(!f){let C=c[l];return n.push(B(17,C.firstToken,C.lastToken,C)),n}let p=f.getProperty("#interrupt-cells");if(!p){n.push(B(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...f.nodeNameOrLabelRef],templateStrings:[e.name,"#interrupt-cells",f.pathString]}));break}let m=Be(p,0,0,r);if(m==null)return n;let h=c.length-l-1,T=f.bindingLoader?.type?f.nodeType?.cellsValues?.find(C=>C.specifier==="interrupt"):void 0;if(T?d.push(["phandle",...T.values]):d.push(["phandle",...Array.from({length:m},()=>"interrupt")]),m>h){let C=c[c.length-1];return n.push(B(19,C.firstToken,C.lastToken,C,{templateStrings:[e.name,`<${d.at(-1).join(" ")}>`]})),n}let b=c.slice(l+1,l+1+m),S=f.getProperty("interrupt-map"),v={mappingValuesAst:b,target:f};e.nexusMapsTo.push(v);let N=i.mappedReg(r)?.at(0)?.startAddress;if(S&&N){let C=f.getNexusMapEntryMatch("interrupt",r,b,N);C?.match?v.mapItem=C.match:n.push(B(31,C.entry.firstToken,C.entry.lastToken,C.entry,{linkedTo:[S.ast]}))}b.every(C=>C instanceof Se)&&f.interrupControlerMapping.push({expressions:b,node:i,property:e}),l+=m+1,u++}return d.push([`${u}_phandle`,`${u}_interrupt...`]),t.signatureArgs=d.map(f=>f.map(p=>Bc.ParameterInformation.create(p))),n});return t.description=["The interrupts-extended property lists the interrupts) generated by a device. interrupts-extended should be used instead of interrupts when a device is connected to multiple interrupt controllers as it encodes a parent phandle with each interrupt specifier.","The interrupts and interrupts-extended properties are mutually exclusive. A device node should use one or the other, but not both. Using both is only permissible when required for compatibility with software that does not understand interrupts-extended. If both interrupts-extended and interrupts are present then interrupts-extended takes precedence."],t.examples=["This example shows how a device with two interrupt outputs connected to two separate interrupt controllers would describe the connection using an interrupts-extended property. pic is an interrupt controller with an #interrupt-cells specifier of 2, while gic is an interrupt controller with an #interrupts-cells specifier of 1.","```devicetree\ninterrupts-extended = <&pic OXA 8>, <&gic Oxda>;\n```"],t};var kC=()=>{let t=new X("dma-noncoherent",z("EMPTY"));return t.description=["For architectures which are by default coherent for 1/O, the dma-noncoherent property is used to indicate a device is not capable of coherent DMA operations. Some architectures have non-coherent DMA by default and this property is not applicable."],t};var NC=()=>{let t=new X("dma-coherent",z("EMPTY"));return t.description=["For architectures which are by default non-coherent for I/O, the dma-coherent property is used to indicate a device is capable of coherent DMA operations. Some architectures have coherent DMA by default and this property is not applicable."],t};var RC=$(U());var PC=()=>{let t=new X("dma-ranges",z(["EMPTY","PROP_ENCODED_ARRAY"]),"optional",void 0,void 0,(e,r)=>{let n=[],i=e.parent.sizeCells(r),s=e.parent.addressCells(r),o=e.parent.parentAddressCells(r),a=[...Array.from({length:s},(l,u)=>`child-bus-address${s>1?u:""}`),...Array.from({length:o},(l,u)=>`parent-bus-address${o>1?u:""}`),...Array.from({length:i},(l,u)=>`length${i>1?u:""}`)];t.signatureArgs=a.map(l=>RC.ParameterInformation.create(l)),t.signatureArgsCyclic=!0;let c=Le(e.ast.values);if(!c?.length)return[];if(c.length===0||c.length%(s+o+i)!==0){let l=c.at(c.length-c.length%(s+o+i))??e.ast;n.push(B(19,l.firstToken,l.lastToken,l,{templateStrings:[e.name,`<${[...Array.from({length:s},()=>"child-bus-address"),...Array.from({length:o},()=>"parent-bus-address"),...Array.from({length:i},()=>"length")].join(" ")}>`]}))}return n});return t.description=["The dma-ranges property is used to describe the direct memory access (DMA) structure of a memory-mapped bus whose devicetree parent can be accessed from DMA operations originating from the bus. It provides a means of defining a mapping or translation between the physical address space of the bus and the physical address space of the parent of the bus.","The format of the value of the dma-ranges property is an arbitrary number of triplets of (child-bus-address, parent-bus-address, length). Each triplet specified describes a contiguous DMA address range.","- The child-bus-address is a physical address within the child bus' address space. The number of cells to represent the address depends on the bus and can be determined from the #address-cells of this node (the node in which the dma-ranges property appears).","- The parent-bus-address is a physical address within the parent bus' address space. The number of cells to represent the parent address is bus dependent and can be determined from the #address-cells property of the node that defines the parent's address space.","- The length specifies the size of the range in the child's address space. The number of cells to represent the size can be determined from the #size-cells of this node (the node in which the dma-ranges property appears)."],t};var Fc=$(U());var Wf=()=>{let t=new X("ranges",z(["EMPTY","PROP_ENCODED_ARRAY"]),"optional",void 0,void 0,(e,r)=>{let n=[],i=e.parent.sizeCells(r),s=e.parent.addressCells(r),o=e.parent.parentAddressCells(r),a=[...Array.from({length:s},(l,u)=>`child-bus-address${s>1?u:""}`),...Array.from({length:o},(l,u)=>`parent-bus-address${o>1?u:""}`),...Array.from({length:i},(l,u)=>`length${i>1?u:""}`)];t.signatureArgs=a.map(l=>Fc.ParameterInformation.create(l)),t.signatureArgsCyclic=!0;let c=Le(e.ast.values);if(!c?.length)return[];if(c.length===0||c.length%(s+o+i)!==0){let l=c.at(c.length-c.length%(s+o+i))??e.ast;n.push(B(19,l.firstToken,l.lastToken,l,{templateStrings:[e.name,`<${[...Array.from({length:s},()=>"child-bus-address"),...Array.from({length:o},()=>"parent-bus-address"),...Array.from({length:o},()=>"length")].join(" ")}>`]}))}return n.length===0&&e.parent.nodes.forEach(l=>{let u=l.getProperty("reg");u&&l.mappedReg(r)?.forEach(d=>{if(d.missingMapping){let f=l.parent?.getProperty("ranges");n.push(B(35,d.regRangeTokens.start,d.regRangeTokens.end,e.ast,{severity:Fc.DiagnosticSeverity.Warning,linkedTo:f?[f.ast]:[]}));return}!d?.mappingEnd||!d.mappedAst||d.inMappingRange||n.push(B(29,d.regRangeTokens.start,d.regRangeTokens.end,e.ast,{severity:Fc.DiagnosticSeverity.Warning,linkedTo:[d.mappedAst],templateStrings:[u.name,`0x${d.endAddress.map((f,p)=>f.toString(16).padStart(p?8:0,"0")).join("")}`,`0x${d.mappingEnd.map((f,p)=>f.toString(16).padStart(p?8:0,"0")).join("")}`]}))})}),n});return t.description=["The ranges property provides a means of defining a mapping or translation between the address space of the bus (the child address space) and the address space of the bus node's parent (the parent address space).","The format of the value of the ranges property is an arbitrary number of triplets of (child-bus-address, parent-bus-address, length)","- The child-bus-address is a physical address within the child bus' address space. The number of cells to represent the address is bus dependent and can be determined from the #address-cells of this node (the node in which the ranges property appears).","- The parent-bus-address is a physical address within the parent bus' address space. The number of cells to represent the parent address is bus dependent and can be determined from the #address-cells property of the node that defines the parent's address space.","- The length specifies the size of the range in the child's address space. The number of cells to represent the size can be determined from the #size-cells of this node (the node in which the ranges property appears).","If the property is defined with an < empty> value, it specifies that the parent and child address space is identical, and no address translation is required.","If the property is not present in a bus node, it is assumed that no mapping exists between children of the node and the parent address space."],t.examples=["Address Translation Example:",["```devicetree",`soc {
|
|
191
|
+
`)});this.signatureArgsCyclic=!1;typeof n!="function"?this.required=()=>n:this.required=n,typeof s!="function"?(this.allowedValues=s,this.values=()=>s===void 0?i?[i]:[]:i&&s.indexOf(i)===-1?[i,...s]:s):this.values=s}getNameMatch(e){return typeof this.name=="string"?this.name===e:this.name.test(e)}validateProperty(e,r,n,i){let s=this.required(r);if(i){if(s==="omitted")return[B(11,i.ast.firstToken,i.ast.lastToken,i.ast,{templateStrings:[n]})]}else{if(s==="required"){let l=e.getOrderedNodeAst(r),u=ta(l),d="";if(this.type.length===1&&this.type[0].types.length===1)switch(this.type[0].types[0]){case"U32":case"U64":case"PROP_ENCODED_ARRAY":d=` = <${n==="reg"&&r.address?r.address.map(f=>`0x${f.toString(16)}`).join(" "):""}>`;break;case"STRING":case"STRINGLIST":d=' = ""';break;case"BYTESTRING":d=" = []";break}return[...l.map((f,p)=>{let m=f.openScope??u[p].lastToken,h=u[p];return B(0,h.firstToken,h.lastToken,h,{templateStrings:[n],edit:Dt.TextEdit.insert(Dt.Position.create(m.pos.line,m.pos.col+1),`
|
|
192
|
+
${"".padEnd(Js(u[p].uri,f),e.context.formattingOptions.insertSpaces?" ".repeat(e.context.formattingOptions.tabSize):" ")}${n}${d};`)})})]}return[]}let o=SU(i),a=[],c=(l,u,d)=>{if(d??=i.ast,!(l.some(p=>p==u)||l.some(p=>p=="STRINGLIST")&&(u==="STRING"||u==="STRINGLIST")||l.some(p=>p=="PROP_ENCODED_ARRAY")&&(u==="U32"||u==="U64"))){let p=[];l.forEach(m=>{switch(m){case"EMPTY":p.push(1);break;case"STRING":p.push(2);break;case"STRINGLIST":p.push(3);break;case"U32":p.push(5);break;case"U64":p.push(6);break;case"PROP_ENCODED_ARRAY":p.push(7);break}}),p.length&&a.push(B(p,d.firstToken,d.lastToken,d,{templateStrings:[i.name]}))}};if(this.type[0].types.some(l=>l==="ANY"))return[];if(this.type.length>1){let l=this.type;if(!this.list&&this.type.length!==o.length){let u=i.ast.values??i.ast;a.push(B(4,u.firstToken,u.lastToken,u,{templateStrings:[n,this.type.length.toString()]}))}else o.forEach((u,d)=>{if(l[0].types.every(f=>f!==u)){let f=i.ast.values?.values[d]??i.ast;a.push(B(3,f.firstToken,f.lastToken,f))}})}else{if(this.type[0].types.some(u=>u==="STRINGLIST"))o.some(u=>c(["STRINGLIST"],u,i.ast.values?.values[0]?.value));else if(this.list||this.type.length===1&&this.type[0].types.filter(u=>u!=="EMPTY").every(u=>u==="PROP_ENCODED_ARRAY"))o.some(u=>c(this.type[0].types,u,i.ast.values?.values[0]?.value));else if(o.length>1&&this.type[0].types.some(u=>u!=="EMPTY")){let u=i.ast.propertyName??i.ast;a.push(B(8,u.firstToken,u.lastToken,u,{linkedTo:(i.ast.values?.values.slice(1)??[]).filter(d=>!!d),templateStrings:[i.name]}))}else o.length===1&&c(this.type[0].types,o[0],i.ast.values?.values[0]?.value);let l=this.values(i);if(a.length===0&&(a.push(...this.additionalTypeCheck?.(i,e.context.macros)??[]),l.length&&this.type[0].types.some(u=>u==="STRING"))){let u=i.ast.values?.values[0]?.value;if(!l.some(d=>u.value===d)){let d=i.ast.values?.values[0]?.value??i.ast;a.push(B(9,d.firstToken,d.lastToken,d,{templateStrings:[this.values(i).map(f=>`'${f}'`).join(" or ")]}))}}}return a}getPropertyCompletionItems(e,r,n){let i=this.type.at(r);return i?.types.some(s=>s==="STRING")?e.ast.values?.values&&e.ast.values.values?.length>1?[]:this.values(e).map(s=>({label:`"${s}"`,kind:Dt.CompletionItemKind.Variable,sortText:s===this.def?`A${s}`:`Z${s}`,insertText:n?`${s}`:`"${s}"`})):i?.types.some(s=>s==="U32"||s==="U64")?this.values(e).map(s=>({label:`<${s}>`,kind:Dt.CompletionItemKind.Variable,sortText:s===this.def?`A${s}`:`Z${s}`,insertText:n?`${s}`:`<${s}>`})):[]}},SU=t=>t.ast.values?t.ast.values.values.map(e=>_U(e)):["EMPTY"],_U=t=>t?t.value instanceof ne?"STRING":t.value instanceof Nt?t.value.values.length===1?"U32":t.value.values.length===2?"U64":"PROP_ENCODED_ARRAY":t.value instanceof ie||t.value instanceof ot?"U32":"BYTESTRING":"UNKNOWN",Dc=class{constructor(){this.extends=new Set}},Pt=class extends Dc{constructor(r=()=>[]){super();this.additionalValidations=r;this.#e=[];this.noMismatchPropertiesAllowed=!1;this.warnMismatchProperties=!1}#e;#t;getIssue(r,n){let i=[];if(n.disabled){let a=n.getProperty("status");return[...n.definitions,...n.referencedBy].forEach(c=>i.push(B(21,c.firstToken,c.lastToken,c,{severity:Dt.DiagnosticSeverity.Hint,linkedTo:[...a?.ast?[a?.ast]:[]],tags:[Dt.DiagnosticTag.Unnecessary]}))),i}let s=new Set,o=this.properties.flatMap(a=>{if(a.name==="reg"&&a.required(n)==="required"&&!n.address&&n.properties.find(u=>u.name==="reg")){let u=n.regArray(r.context.macros)?.at(0)?.startAddress.map(f=>f.toString(16)).join(","),d=n.definitions.at(-1).name??n.definitions.at(-1);i.push(B(36,d.firstToken,d.lastToken,d,{linkedTo:n.definitions.slice(0,-1).map(f=>f.name??f),edit:u?n.definitions.filter(f=>!!f.name).map(f=>Dt.TextEdit.insert(Dt.Position.create(f.name.lastToken.pos.line,f.name.lastToken.pos.colEnd),`@${u}`)):void 0,codeActionTitle:"Add Node Address"}))}if(typeof a.name=="string"){let u=n.getProperty(a.name);return u&&s.add(u),a.validateProperty(r,n,a.name,u)}let c=n.properties.filter(u=>a.getNameMatch(u.name));c.forEach(u=>s.add(u));let l=this.properties.filter(u=>u!==a)??[];return l.length&&c.some(u=>l.some(d=>d.getNameMatch(u.name)))?[]:c.flatMap(u=>a.validateProperty(r,n,u.name,u))});return s.size!==n.properties.length&&(this.noMismatchPropertiesAllowed||this.warnMismatchProperties)&&n.properties.filter(c=>!s.has(c)).forEach(c=>{r.context.bindingLoader?.type==="Zephyr"&&c.name.endsWith("-controller")||i.push(B(this.warnMismatchProperties?34:27,c.ast.firstToken,c.ast.lastToken,c.ast,{severity:this.warnMismatchProperties?Dt.DiagnosticSeverity.Warning:Dt.DiagnosticSeverity.Error,templateStrings:[c.name],edit:Dt.TextEdit.del(Jr(c.ast.firstToken.prevToken,c.ast.lastToken,!1))}))}),[...i,...o,...this.additionalValidations(r,n)]}get properties(){return this.#e}addProperty(r){Array.isArray(r)?r.forEach(n=>this.#e.push(n)):this.#e.push(r),this.#e.sort((n,i)=>typeof n.name=="string"&&typeof i.name=="string"||typeof n.name!="string"&&typeof i.name!="string"?0:typeof n.name=="string"?-1:1)}get childNodeType(){return this.#t}set childNodeType(r){r&&(this.#t=n=>{let i=r(n);return i.bindingsPath=this.bindingsPath,i})}getOnPropertyHover(r){let n=this.properties.find(i=>i.getNameMatch(r));return n?.onHover.bind(n)()}getSignatureHelp(r,n,i,s){let o=this.properties.find(f=>f.getNameMatch(r.name)),a=o?.signatureArgs;if(!o||!a)return;let c=r.getArgumentIndex(i),l=r.getArgumentIndex(s),d=r.getArgumentIndex(n)??l??(c!==void 0?c+1:void 0);if(Yw(a)){let f=0;if(d!==void 0){let p=d,m=d?a.findIndex(h=>f<=p&&h.length+f>p?!0:(f+=h.length,!1)):void 0;m!==void 0&&(m>1&&(d=d-a.slice(0,m-1).reduce((h,T)=>h+T.length,0)),a=a.slice(m?m-1:0,m+2))}return{signatures:[Dt.SignatureInformation.create(`${r.name} = ${a.map(p=>`<${p.map(m=>m.label).join(" ")}>`).join(`,
|
|
193
|
+
`)};`,this.description,...a.flat())],activeSignature:0,activeParameter:d}}return o.signatureArgsCyclic&&d&&(d=d%a.length),{signatures:[Dt.SignatureInformation.create(`${r.name} = <${a.map(f=>f.label).join(" ")}>;`,this.description,...a)],activeSignature:0,activeParameter:d}}getPropertyListCompletionItems(r){return this.properties.filter(n=>!n.hideAutoComplete&&n.required(r)!=="omitted"&&typeof n.name=="string").map(n=>{let i=r&&n.required(r),s=!!r.properties.some(a=>n.getNameMatch(a.name)),o="a";return i==="required"?o=s?"Y":"!":o=s?"Z":"B",{label:`${n.name}`,kind:Dt.CompletionItemKind.Property,sortText:`${o}${n.name}`}})??[]}};var Le=t=>{if(!t?.values.some(e=>!(e?.value instanceof Nt)))return t?.values.flatMap(e=>e.value.values.map(r=>r.value))??[]};var Be=(t,e,r,n)=>{let i=t.ast.values?.values.at(e)?.value;if(i instanceof Nt){let s=i.values.at(r);if(s?.value instanceof be){let o=s.value.evaluate(n);if(typeof o=="number")return o}}},Tn=(t,e,r=0)=>{if(t instanceof Nr){if(t?.value instanceof Nt){let n=t.value.values.at(r);if(n?.value instanceof Kt)return e.getPhandle(n.value.value);if(n?.value instanceof ie)return n.value.linksTo;if(n?.value instanceof ot)return n.value.path?.pathParts.at(-1)?.linksTo}}else{if(t instanceof Kt)return e.getPhandle(t.value);if(t instanceof ie)return t.linksTo;if(t instanceof ot)return t.path?.pathParts.at(-1)?.linksTo}},z=t=>Array.isArray(t)?[{types:t}]:[{types:[t]}];var tE=()=>{let t=new Y("compatible",z("STRINGLIST"));return t.description=["The compatible property value consists of one or more strings that define the specific programming model for the device. This list of strings should be used by a client program for device driver selection. The property value consists of a concatenated list of null terminated strings, from most specific to most general. They allow a device to express its compatibility with a family of similar devices, potentially allowing a single device driver to match against several devices.",'The recommended format is "manufacturer, model", where manufacturer is a string describing the name of the manufacturer (such as a stock ticker symbol), and model specifies the model number.',"The compatible string should consist only of lowercase letters, digits and dashes, and should start with a letter. A single comma is typically only used following a vendor prefix. Underscores should not be used."],t.examples=['```devicetree\ncompatible = "fsl,mpc8641", "ns16550";\n```',"In this example, an operating system would first try to locate a device driver that supported fsl, mpc8641. If a driver was not found, it would then try to locate a driver that supported the more general ns 16550 device type."],t};var Pf=$(j());var rE=()=>{let t=new Y("device_type",z("STRING"),"optional",void 0,e=>e.parent.name==="cpu"||e.parent.name==="memory"?[e.parent.name]:[],e=>{if(e.parent.name==="cpu"||e.parent.name==="memory"){let r=e.ast.values?.values.at(0)?.value;if(r instanceof ne&&r.value!==e.parent.name)return[B(e.parent.name==="cpu"?12:13,e.ast.firstToken,e.ast.lastToken,e.ast,{templateStrings:[e.name]})]}return t.required(e.parent)!=="required"?[B(14,e.ast.firstToken,e.ast.lastToken,e.ast,{severity:Pf.DiagnosticSeverity.Hint,tags:[Pf.DiagnosticTag.Deprecated],templateStrings:[e.name]})]:[]});return t.description=["The device_type property was used in IEEE 1275 to describe the device's FCode programming model. Because DTSpec does not have FCode, new use of the property is deprecated, and it should be included only on cpu and memory nodes for compatibility with IEEE 1275-derived devicetrees."],t};var nE=()=>{let t=new Y("#interrupt-cells",z("U32"));return t.description=["The #interrupt-cells property defines the number of cells required to encode an interrupt specifier for an interrupt domain."],t};var iE=()=>{let t=new Y("interrupt-controller",z("EMPTY"),"optional");return t.description=["The presence of an interrupt-controller property defines a node as an interrupt controller node."],t};var sE=()=>{let t=new Y("interrupt-parent",z("U32"));return t.description=["Because the hierarchy of the nodes in the interrupt tree might not match the devicetree, the interrupt-parent property is available to make the definition of an interrupt parent explicit. The value is the phandle to the interrupt parent. If this property is missing from a device, its interrupt parent is assumed to be its devicetree parent."],t};var sT=$(j());var oE=()=>{let t=new Y("interrupts",z("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,r)=>{let n=[],i=Le(e.ast.values);if(!i)return n;let s=e.parent;if(s.getProperty("interrupts-extended"))return n;let o=s.interruptsParent;if(!o?.parentInterruptNode){if(!o?.interruptParent)return n.push(B(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...e.parent.nodeNameOrLabelRef],templateStrings:[e.name,"interrupt-parent",e.parent.pathString]})),n;let h=o.interruptParent.ast.values?.values.at(0)?.value??o.interruptParent.ast;return n.push(B(17,h.firstToken,h.lastToken,h)),n}let{parentInterruptNode:a}=o,c=a.getProperty("#interrupt-cells");if(!c)return n.push(B(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...a.nodeNameOrLabelRef],templateStrings:[e.name,"#interrupt-cells",a.pathString]})),n;let l=Be(c,0,0,r);if(!l)return n;let u=[...Array.from({length:l},()=>"Interrupt")],d=a.bindingLoader?.type?a.nodeType?.cellsValues?.find(h=>h.specifier==="interrupt"):void 0;d?(u=d.values,t.signatureArgs=d.values.map(h=>sT.ParameterInformation.create(h))):t.signatureArgs=u.map(h=>sT.ParameterInformation.create(h));let f=a.getProperty("interrupt-map"),p=s.parent?.getProperty("#address-cells");if(f&&!p){let h=e.ast.propertyName??e.ast;n.push(B(16,h.firstToken,h.lastToken,h,{linkedTo:[...e.parent.nodeNameOrLabelRef],templateStrings:[e.name,"#address-cells",s.parent?.pathString??"/"]}))}if(!c)return n.push(B(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...a.nodeNameOrLabelRef],templateStrings:[e.name,"#interrupt-cells",a.pathString]})),n;let m=0;for(;m<i.length;){let h=i.length-m;if(l>h){let v=i[i.length-1];return n.push(B(19,v.firstToken,v.lastToken,v,{templateStrings:[e.name,`<${u.join(" ")}> `]})),n}let T=i.slice(m,m+l),b=s.mappedReg(r)?.at(0)?.startAddress,_={mappingValuesAst:T,target:a};if(e.nexusMapsTo.push(_),f&&b){let v=a.getNexusMapEntryMatch("interrupt",r,T,b);v?.match?_.mapItem=v.match:n.push(B(31,v.entry.firstToken,v.entry.lastToken,v.entry,{linkedTo:[f.ast]}))}T.every(v=>v instanceof be)&&a.interrupControlerMapping.push({expressions:T,node:s,property:e}),m+=l}return n});return t.description=["The interrupts property of a device node defines the interrupt or interrupts that are generated by the device.The value of the interrupts property consists of an arbitrary number of interrupt specifiers. The format of an interrupt specifier is defined by the binding of the interrupt domain root.","interrupts is overridden by the interrupts-extended property and normally only one or the other should be used."],t.examples=["A common definition of an interrupt specifier in an open PIC-compatible interrupt domain consists of two cells; an interrupt number and level/sense information. See the following example, which defines a single interrupt specifier, with an interrupt number of OxA and level/sense encoding of 8.","```devicetree\ninterrupts = <0xA 8>;\n```"],t};var Ac=$(j());var aE=()=>{let t=new Y("interrupts-extended",z("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,r)=>{let n=[],i=e.parent,s=i.getProperty("interrupts");s&&n.push(B(15,s.ast.firstToken,s.ast.lastToken,s.ast,{severity:Ac.DiagnosticSeverity.Warning,linkedTo:[e.ast],templateStrings:[s.name,"is ignored when 'interrupts-extended' is used"]}));let o=i.getProperty("interrupt-parent");o&&n.push(B(15,o.ast.firstToken,o.ast.lastToken,o.ast,{severity:Ac.DiagnosticSeverity.Warning,linkedTo:[e.ast],templateStrings:[o.name,"is ignored when 'interrupts-extended' is used"]}));let a=i.root,c=Le(e.ast.values);if(!c?.length)return[];let l=0,u=0,d=[];for(;l<c.length;){let f=Tn(c[l],a);if(!f){let C=c[l];return n.push(B(17,C.firstToken,C.lastToken,C)),n}let p=f.getProperty("#interrupt-cells");if(!p){n.push(B(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...f.nodeNameOrLabelRef],templateStrings:[e.name,"#interrupt-cells",f.pathString]}));break}let m=Be(p,0,0,r);if(m==null)return n;let h=c.length-l-1,T=f.bindingLoader?.type?f.nodeType?.cellsValues?.find(C=>C.specifier==="interrupt"):void 0;if(T?d.push(["phandle",...T.values]):d.push(["phandle",...Array.from({length:m},()=>"interrupt")]),m>h){let C=c[c.length-1];return n.push(B(19,C.firstToken,C.lastToken,C,{templateStrings:[e.name,`<${d.at(-1).join(" ")}>`]})),n}let b=c.slice(l+1,l+1+m),_=f.getProperty("interrupt-map"),v={mappingValuesAst:b,target:f};e.nexusMapsTo.push(v);let N=i.mappedReg(r)?.at(0)?.startAddress;if(_&&N){let C=f.getNexusMapEntryMatch("interrupt",r,b,N);C?.match?v.mapItem=C.match:n.push(B(31,C.entry.firstToken,C.entry.lastToken,C.entry,{linkedTo:[_.ast]}))}b.every(C=>C instanceof be)&&f.interrupControlerMapping.push({expressions:b,node:i,property:e}),l+=m+1,u++}return d.push([`${u}_phandle`,`${u}_interrupt...`]),t.signatureArgs=d.map(f=>f.map(p=>Ac.ParameterInformation.create(p))),n});return t.description=["The interrupts-extended property lists the interrupts) generated by a device. interrupts-extended should be used instead of interrupts when a device is connected to multiple interrupt controllers as it encodes a parent phandle with each interrupt specifier.","The interrupts and interrupts-extended properties are mutually exclusive. A device node should use one or the other, but not both. Using both is only permissible when required for compatibility with software that does not understand interrupts-extended. If both interrupts-extended and interrupts are present then interrupts-extended takes precedence."],t.examples=["This example shows how a device with two interrupt outputs connected to two separate interrupt controllers would describe the connection using an interrupts-extended property. pic is an interrupt controller with an #interrupt-cells specifier of 2, while gic is an interrupt controller with an #interrupts-cells specifier of 1.","```devicetree\ninterrupts-extended = <&pic OXA 8>, <&gic Oxda>;\n```"],t};var cE=()=>{let t=new Y("dma-noncoherent",z("EMPTY"));return t.description=["For architectures which are by default coherent for 1/O, the dma-noncoherent property is used to indicate a device is not capable of coherent DMA operations. Some architectures have non-coherent DMA by default and this property is not applicable."],t};var lE=()=>{let t=new Y("dma-coherent",z("EMPTY"));return t.description=["For architectures which are by default non-coherent for I/O, the dma-coherent property is used to indicate a device is capable of coherent DMA operations. Some architectures have coherent DMA by default and this property is not applicable."],t};var uE=$(j());var dE=()=>{let t=new Y("dma-ranges",z(["EMPTY","PROP_ENCODED_ARRAY"]),"optional",void 0,void 0,(e,r)=>{let n=[],i=e.parent.sizeCells(r),s=e.parent.addressCells(r),o=e.parent.parentAddressCells(r),a=[...Array.from({length:s},(l,u)=>`child-bus-address${s>1?u:""}`),...Array.from({length:o},(l,u)=>`parent-bus-address${o>1?u:""}`),...Array.from({length:i},(l,u)=>`length${i>1?u:""}`)];t.signatureArgs=a.map(l=>uE.ParameterInformation.create(l)),t.signatureArgsCyclic=!0;let c=Le(e.ast.values);if(!c?.length)return[];if(c.length===0||c.length%(s+o+i)!==0){let l=c.at(c.length-c.length%(s+o+i))??e.ast;n.push(B(19,l.firstToken,l.lastToken,l,{templateStrings:[e.name,`<${[...Array.from({length:s},()=>"child-bus-address"),...Array.from({length:o},()=>"parent-bus-address"),...Array.from({length:i},()=>"length")].join(" ")}>`]}))}return n});return t.description=["The dma-ranges property is used to describe the direct memory access (DMA) structure of a memory-mapped bus whose devicetree parent can be accessed from DMA operations originating from the bus. It provides a means of defining a mapping or translation between the physical address space of the bus and the physical address space of the parent of the bus.","The format of the value of the dma-ranges property is an arbitrary number of triplets of (child-bus-address, parent-bus-address, length). Each triplet specified describes a contiguous DMA address range.","- The child-bus-address is a physical address within the child bus' address space. The number of cells to represent the address depends on the bus and can be determined from the #address-cells of this node (the node in which the dma-ranges property appears).","- The parent-bus-address is a physical address within the parent bus' address space. The number of cells to represent the parent address is bus dependent and can be determined from the #address-cells property of the node that defines the parent's address space.","- The length specifies the size of the range in the child's address space. The number of cells to represent the size can be determined from the #size-cells of this node (the node in which the dma-ranges property appears)."],t};var Ic=$(j());var wf=()=>{let t=new Y("ranges",z(["EMPTY","PROP_ENCODED_ARRAY"]),"optional",void 0,void 0,(e,r)=>{let n=[],i=e.parent.sizeCells(r),s=e.parent.addressCells(r),o=e.parent.parentAddressCells(r),a=[...Array.from({length:s},(l,u)=>`child-bus-address${s>1?u:""}`),...Array.from({length:o},(l,u)=>`parent-bus-address${o>1?u:""}`),...Array.from({length:i},(l,u)=>`length${i>1?u:""}`)];t.signatureArgs=a.map(l=>Ic.ParameterInformation.create(l)),t.signatureArgsCyclic=!0;let c=Le(e.ast.values);if(!c?.length)return[];if(c.length===0||c.length%(s+o+i)!==0){let l=c.at(c.length-c.length%(s+o+i))??e.ast;n.push(B(19,l.firstToken,l.lastToken,l,{templateStrings:[e.name,`<${[...Array.from({length:s},()=>"child-bus-address"),...Array.from({length:o},()=>"parent-bus-address"),...Array.from({length:o},()=>"length")].join(" ")}>`]}))}return n.length===0&&e.parent.nodes.forEach(l=>{let u=l.getProperty("reg");u&&l.mappedReg(r)?.forEach(d=>{if(d.missingMapping){let f=l.parent?.getProperty("ranges");n.push(B(35,d.regRangeTokens.start,d.regRangeTokens.end,e.ast,{severity:Ic.DiagnosticSeverity.Warning,linkedTo:f?[f.ast]:[]}));return}!d?.mappingEnd||!d.mappedAst||d.inMappingRange||n.push(B(29,d.regRangeTokens.start,d.regRangeTokens.end,e.ast,{severity:Ic.DiagnosticSeverity.Warning,linkedTo:[d.mappedAst],templateStrings:[u.name,`0x${d.endAddress.map((f,p)=>f.toString(16).padStart(p?8:0,"0")).join("")}`,`0x${d.mappingEnd.map((f,p)=>f.toString(16).padStart(p?8:0,"0")).join("")}`]}))})}),n});return t.description=["The ranges property provides a means of defining a mapping or translation between the address space of the bus (the child address space) and the address space of the bus node's parent (the parent address space).","The format of the value of the ranges property is an arbitrary number of triplets of (child-bus-address, parent-bus-address, length)","- The child-bus-address is a physical address within the child bus' address space. The number of cells to represent the address is bus dependent and can be determined from the #address-cells of this node (the node in which the ranges property appears).","- The parent-bus-address is a physical address within the parent bus' address space. The number of cells to represent the parent address is bus dependent and can be determined from the #address-cells property of the node that defines the parent's address space.","- The length specifies the size of the range in the child's address space. The number of cells to represent the size can be determined from the #size-cells of this node (the node in which the ranges property appears).","If the property is defined with an < empty> value, it specifies that the parent and child address space is identical, and no address translation is required.","If the property is not present in a bus node, it is assumed that no mapping exists between children of the node and the parent address space."],t.examples=["Address Translation Example:",["```devicetree",`soc {
|
|
214
194
|
compatible = "simple-bus";
|
|
215
195
|
#address-cells = <1>;
|
|
216
196
|
#size-cells = <1>;
|
|
@@ -225,7 +205,7 @@ ${"".padEnd(sa(u[p].uri,f),e.context.formattingOptions.insertSpaces?" ".repeat(e
|
|
|
225
205
|
};
|
|
226
206
|
};`,"```"].join(`
|
|
227
207
|
`),"The soc node specifies a ranges property of",["```devicetree","<Ox0 Oxe0000000 0x00100000>;","```"].join(`
|
|
228
|
-
`),"This property value specifies that for a 1024 KB range of address space, a child node addressed at physical OxO maps to a parent address of physical 0xe0000000. With this mapping, the serial device node can be addressed by a load or store at address 0xe0004600, an offset of 0x4600 (specified in reg) plus the 0xe0000000 mapping specified in ranges."],t};var
|
|
208
|
+
`),"This property value specifies that for a 1024 KB range of address space, a child node addressed at physical OxO maps to a parent address of physical 0xe0000000. With this mapping, the serial device node can be addressed by a load or store at address 0xe0004600, an offset of 0x4600 (specified in reg) plus the 0xe0000000 mapping specified in ranges."],t};var fE=()=>{let t=new Y("virtual-reg",z("U32"));return t.description=["The virtual-res property specifies an effective address that maps to the first physical address specified in the reg property of the device node. This property enables boot programs to provide client programs with virtual-to-physical mappings that have been set up."],t};var pE=$(j());var hE=()=>{let t=new Y("reg",z("PROP_ENCODED_ARRAY"),e=>e.address!==void 0?"required":"omitted",void 0,void 0,(e,r)=>{let n=[],i=e.parent.parentSizeCells(r),s=e.parent.parentAddressCells(r),o=[...Array.from({length:s},(l,u)=>`address${s>1?u:""}`),...Array.from({length:i},(l,u)=>`size${i>1?u:""}`)];t.signatureArgs=o.map(l=>pE.ParameterInformation.create(l)),t.signatureArgsCyclic=!0;let a=Le(e.ast.values);if(!a)return[];if(a.length===0||a.length%(i+s)!==0){let l=a.at(a.length-a.length%(i+s))??e.ast;return n.push(B(19,l.firstToken,l.lastToken,l,{templateStrings:[e.name,`<${[...Array.from({length:s},()=>"address"),...Array.from({length:i},()=>"size")].join(" ")}>`]})),n}let c=a.slice(0,s).map((l,u)=>Be(e,0,u,r)??0);if(e.parent.address&&gn(e.parent.address,c)!==0){let l=e.ast.values?.values.at(0)?.value?.values?.at(0),u=e.ast.values?.values.at(0)?.value?.values?.at(s-1),f=(l&&u?new Q(oe(l.firstToken,u.lastToken)):void 0)??e.ast.values??e.ast;n.push(B(10,f.firstToken,f.lastToken,f,{templateStrings:[e.name]}))}return n});return t.examples=["Suppose a device within a system-on-a-chip had two blocks of registers, a 32-byte block at offset 0x3000 in the SOC and a 256-byte block at offset OxFE00. The reg property would be encoded as follows (assuming #address-cells and #size-cells values of 1):","```devicetree\nreg = <0x3000 0x20 0xFE00 0x100>;\n```"],t};var Ef=()=>new Y("#size-cells",z("U32"),"optional",1);var Cf=()=>{let t=new Y("#address-cells",z("U32"),"optional",2);return t.description=["The #address-cells and #size-cells properties may be used in any device node that has children in the devicetree hierarchy and describes how child device nodes should be addressed. The #address-cells property defines the number of <u32> cells used to encode the address field in a child node's reg property. The #size-cells property defines the number of <u32 > cells used to encode the size field in a child node's reg property.","The #address-cells and #size-cells properties are not inherited from ancestors in the devicetree. They shall be explicitly defined.","A DTSpec-compliant boot program shall supply #address-cells and #size-cells on all nodes that have children.","If missing, a client program should assume a default value of 2 for #address-cells, and a value of 1 for #size-cells."],t.examples=["See the following devicetree excerpt:",["```devicetree",`SOC {
|
|
229
209
|
#address-cells = <1>;
|
|
230
210
|
#size-cells = <1>;
|
|
231
211
|
serial@4600 {
|
|
@@ -236,8 +216,8 @@ ${"".padEnd(sa(u[p].uri,f),e.context.formattingOptions.insertSpaces?" ".repeat(e
|
|
|
236
216
|
interrupt-parent = <&ipic>;
|
|
237
217
|
};
|
|
238
218
|
};`,"```"].join(`
|
|
239
|
-
`),"In this example, the #address-cells and #size-cells properties of the soc node are both set to 1. This setting specifies that one cell is required to represent an address and one cell is required to represent the size of nodes that are children of this node.","The serial device reg property necessarily follows this specification set in the parent (soc) node\u2014 the address is represented by a single cell (0x4600), and the size is represented by a single cell (0x100)."],t};var
|
|
240
|
-
The lack of a status property should betreated as if the property existed with the value of "okay"`],t};var
|
|
219
|
+
`),"In this example, the #address-cells and #size-cells properties of the soc node are both set to 1. This setting specifies that one cell is required to represent an address and one cell is required to represent the size of nodes that are children of this node.","The serial device reg property necessarily follows this specification set in the parent (soc) node\u2014 the address is represented by a single cell (0x4600), and the size is represented by a single cell (0x100)."],t};var mE=()=>{let t=new Y("status",z("STRING"),"optional","okay",["okay","disabled","reserved","fail","fail-sss"]);return t.description=[`The status property indicates the operational status of a device.
|
|
220
|
+
The lack of a status property should betreated as if the property existed with the value of "okay"`],t};var gE=()=>{let t=new Y("phandle",z("U32"),"optional",void 0,void 0,(e,r)=>{let n=Be(e,0,0,r);if(n){let i=e.parent.root.getAllPhandle(n);if(i.length>1&&i.at(-1)===e.parent){let s=e.ast.values?.values.at(0)??e.ast;return[B(18,s.firstToken,s.lastToken,s,{linkedTo:i.slice(0,-1).flatMap(o=>o.getProperty("phandle")?.ast).filter(o=>!!o),templateStrings:[e.name]})]}}return[]});return t.description=["The phandle property specifies a numerical identifier for a node that is unique within the devicetree. The phandle property value is used by other nodes that need to refer to the node associated with the property."],t.examples=["See the following devicetree excerpt:",["```devicetree",`pic@10000000 {
|
|
241
221
|
phandle = <1>;
|
|
242
222
|
interrupt-controller;
|
|
243
223
|
reg = <0x10000000 0x100>;
|
|
@@ -245,68 +225,88 @@ ${"".padEnd(sa(u[p].uri,f),e.context.formattingOptions.insertSpaces?" ".repeat(e
|
|
|
245
225
|
`),"A phandle value of 1 is defined. Another device node could reference the pic node with a phandle value of 1:",["```devicetree",`another-device-node {
|
|
246
226
|
interrupt-parent = <1>;
|
|
247
227
|
};`,"```"].join(`
|
|
248
|
-
`)],t};var IC=()=>{let t=new X("model",z("STRING"));return t.description=["The model property value is a <string> that specifies the manufacturer's model number of the device.",'The recommended format is: "manufacturer, model" , where manufacturer is a string describing the name of the manufacturer (such as a stock ticker symbol), and model specifies the model number.'],t.examples=['```devicetree\nmodel = "{sl, MPC8349EMITX" ;\n```'],t};var Yf=$(U());var OC=()=>{let t=new X("name",z("STRING"),"optional",void 0,void 0,e=>[B(14,e.ast.firstToken,e.ast.lastToken,e.ast,{severity:Yf.DiagnosticSeverity.Warning,tags:[Yf.DiagnosticTag.Deprecated],templateStrings:[e.name]})]);return t.hideAutoComplete=!0,t};var MC=$(U());var xC=()=>{let t=new X("interrupt-map",z("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,r)=>{let n=[],i=e.parent,s=e.parent.root,o=Le(e.ast.values);if(!o?.length)return[];i.getProperty("#address-cells")||n.push(B(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...e.parent.nodeNameOrLabelRef],templateStrings:[e.name,"#address-cells",i.pathString]}));let c=i.getProperty("#interrupt-cells");if(!c)return n.push(B(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...i.nodeNameOrLabelRef],templateStrings:[e.name,"#interrupt-cells",`/${i.path.slice(1).join("/")}`]})),n;let l=i.addressCells(r),u=Be(c,0,0,r),d={};if(u==null)return n;let f=0,p=[],m=0,h=0;for(;f<o.length;){if(p.push([...Array.from({length:l},(M,F)=>`${m}_ChildAddr${l>1?F:""}`),...Array.from({length:u},(M,F)=>`${m}_ChildIntrpt${u>1?F:""}`),`${m}_IntrptParent`,`${m}_ParentAddr...`,`${m}_ParentIntrpt...`]),f+l+u>=o.length){let M=f+l+u,F=o[o.length-1];n.push(B(20,F.firstToken,F.lastToken,F,{templateStrings:[e.name,`after the last value of ${p.at(-1).slice((o.length-h)%M===0?M:(o.length-h)%M).join(" ")}`]}));break}let T=new Z(oe(o.at(f).firstToken,o.at(l+u+f-1).lastToken)),b="";for(let M=f;M<l+u+f;M++){let F=o[M];b+=`${F instanceof Se?F.evaluate(r).toString():F.toString()}:`}d[b]??=[],d[b].push(T),f+=l+u;let S=l+u+1;if(o.length<f+1){let M=o[o.length-1];n.push(B(20,M.firstToken,M.lastToken,M,{templateStrings:[e.name,`after the last value of ${p.at(-1).slice((o.length-h)%S===0?S:(o.length-h)%S).join(" ")}`]}));break}let v=gn(o[f],s);if(!v){let M=o[f];n.push(B(17,M.firstToken,M.lastToken,M));break}let N=v.addressCells(r),C=v.getProperty("#interrupt-cells");if(!C){let M=o[f];n.push(B(16,M.firstToken,M.lastToken,M,{linkedTo:[...v.nodeNameOrLabelRef],templateStrings:[e.name,"#interrupt-cells",`/${i.path.slice(1).join("/")}`]}));break}f++;let H=Be(C,0,0,r);if(H==null)break;if(p.splice(-1,1,[...Array.from({length:l},(M,F)=>`${m}_ChildAddr${l>1?F:""}`),...Array.from({length:u},(M,F)=>`${m}_ChildIntrpt${u>1?F:""}`),`${m}_IntrptParent`,...Array.from({length:N},(M,F)=>`${m}_ParentAddr${N>1?F:""}`),...Array.from({length:H},(M,F)=>`${m}_ParentIntrpt${H>1?F:""}`)]),f+=N+H,o.length<f){let M=l+u+1+N+H,F=o[o.length-1];n.push(B(20,F.firstToken,F.lastToken,F,{templateStrings:[e.name,`after the last value of ${p.at(-1).slice((o.length-h)%M===0?M:(o.length-h)%M).join(" ")}`]}));break}h=f,m++}if(p.push([...Array.from({length:l},(T,b)=>`${m}_ChildAddr${l>1?b:""}`),...Array.from({length:u},(T,b)=>`${m}_ChildIntrpt${u>1?b:""}`),`${m}_IntrptParent`,`${m}_ParentAddr...`,`${m}_ParentIntrpt...`]),t.signatureArgs=p.map(T=>T.map(b=>MC.ParameterInformation.create(b))),!e.ast.values)return[];for(let T=0;T<e.ast.values.values.length;T++){let b=e.ast.values.values.at(T);if(b&&(n.length||u==null||!(b.value instanceof Ct)))return n}return Object.values(d).forEach(T=>{if(T.length>1){let b=T[T.length-1];n.push(B(30,b.firstToken,b.lastToken,b,{linkedTo:T.slice(0,-1)}))}}),n});return t.description=["An interrupt-map is a property on a nexus node that bridges one interrupt domain with a set of parent interrupt domains and specifies how interrupt specifiers in the child domain are mapped to their respective parent domains.","The interrupt map is a table where each row is a mapping entry consisting of five components: child unit address, child interrupt specifier, interrupt-parent, parent unit address, parent interrupt specifier.","- child unit address: The unit address of the child node being mapped. The number of 32-bit cells required to specify this is described by the #address-cells property of the bus node on which the child is located.","- child interrupt specifier: The interrupt specifier of the child node being mapped. The number of 32-bit cells required to specify this component is described by the #interrupt-cells property of this node-the nexus node containing the interrupt-map property.","- interrupt-parent: A single <phandle > value that points to the interrupt parent to which the child domain is being mapped.","- parent unit address: The unit address in the domain of the interrupt parent. The number of 32-bit cells required to specify this address is described by the #address-cells property of the node pointed to by the interrupt-parent field.","- parent interrupt specifier: The interrupt specifier in the parent domain. The number of 32-bit cells required to specify this component is described by the #interrupt-cells property of the node pointed to by the interrupt-parent field.","Lookups are performed on the interrupt mapping table by matching a unit-address/interrupt specifier pair against the child components in the interrupt-map. Because some fields in the unit interrupt specifier may not be relevant, a mask is applied before the lookup is done. This mask is defined in the interrupt-map-mask property","Note: Both the child node and the interrupt parent node are required to have #address-cells and #interrupt-cells properties defined. If a unit address component is not required ,#address-cells shall be explicitly defined to be zero."],t};var LC=()=>{let t=new X("interrupt-map-mask",z("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,r)=>{let n=[],i=e.parent,s=Le(e.ast.values);if(!s?.length)return[];let o=i.getProperty("#interrupt-cells");if(!o)return n;let a=i.addressCells(r),c=Be(o,0,0,r);if(c==null)return n;let l=[...Array.from({length:a},(u,d)=>`AddressMask${a>1?d:""}`),...Array.from({length:c},(u,d)=>`InterruptMask${c>1?d:""}`)];if(t.signatureArgs=l.map(u=>Lr.create(u)),s.length!==a+c){let u=e.ast.values??e.ast;return n.push(B(19,u.firstToken,u.lastToken,u,{templateStrings:[e.name,`<${[...Array.from({length:a},()=>"AddressMask"),...Array.from({length:c},()=>"InterruptMask")].join(" ")}>`]})),n}return n});return t.description=["An interrupt-map-mask property is specified for a nexus node in the interrupt tree. This property specifies a mask that is ANDed with the incoming unit interrupt specifier being looked up in the table specified in the interrupt-mapproperty."],t};var qC=$(U());var $C=()=>{let t=new X(/^(?!interrupt-|no-).*?-map$/,z("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,r)=>{let n=e.name.split("-map",1)[0],i=[],s=e.parent,o=e.parent.root,a=s.getProperty(`#${n}-cells`);if(!a)return i.push(B(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...s.nodeNameOrLabelRef],templateStrings:[e.name,`#${n}-cells`,`/${s.path.slice(1).join("/")}`]})),i;let c=Be(a,0,0,r);if(c==null)return i;let l=Le(e.ast.values);if(!l?.length)return[];let u={},d=0,f=0,p=[],m=0;for(;d<l.length;){if(p.push([...Array.from({length:c},(N,C)=>`${m}_Interrupt${c>1?C:""}`),`${m}_SpecifierParent`,`${m}_ParentSpecifier...`]),d+c>=l.length){let N=d+c,C=l[l.length-1];i.push(B(20,C.firstToken,C.lastToken,C,{templateStrings:[e.name,`after the last value of ${p.at(-1).slice((l.length-f)%N===0?N:(l.length-f)%N).join(" ")}`]}));break}let h=new Z(oe(l.at(d).firstToken,l.at(c+d-1)?.lastToken)),T="";for(let N=d;N<c+d;N++){let C=l[N];T+=`${C instanceof Se?C.evaluate(r).toString():C.toString()}:`}if(u[T]??=[],u[T].push(h),d+=c,l.length<d+1){let N=c+1,C=l[l.length-1];i.push(B(20,C.firstToken,C.lastToken,C,{templateStrings:[e.name,`after the last value of ${p.at(-1).slice((l.length-f)%N===0?N:(l.length-f)%N).join(" ")}`]}));break}let b=gn(l[d],o);if(!b){let N=l[d];i.push(B(17,N.firstToken,N.lastToken,N));break}let S=b.getProperty(`#${n}-cells`);if(!S){let N=l[d];return i.push(B(16,N.firstToken,N.lastToken,N,{linkedTo:[...b.nodeNameOrLabelRef],templateStrings:[e.name,`#${n}-cells`,`/${s.path.slice(1).join("/")}`]})),i}d++;let v=Be(S,0,0,r);if(v==null)break;if(p.splice(-1,1,[...Array.from({length:c},(N,C)=>`${m}_ChildSpecifier${c>1?C:""}`),`${m}_SpecifierParent`,...Array.from({length:v},(N,C)=>`${m}_ParentSpecifier${v>1?C:""}`)]),d+=v,l.length<d){let N=c+1+v,C=l[l.length-1];i.push(B(20,C.firstToken,C.lastToken,C,{templateStrings:[e.name,`after the last value of ${p.at(-1).slice((l.length-f)%N===0?N:(l.length-f)%N).join(" ")}`]}));break}f=d,m++}return p.push([...Array.from({length:c},(h,T)=>`${m}_Interrupt${c>1?T:""}`),`${m}_SpecifierParent`,`${m}_ParentSpecifier...`]),t.signatureArgs=p.map(h=>h.map(T=>qC.ParameterInformation.create(T))),Object.values(u).forEach(h=>{if(h.length>1){let T=h[h.length-1];i.push(B(30,T.firstToken,T.lastToken,T,{linkedTo:h.slice(0,-1)}))}}),i});return t.description=["A `\u2039specifier>-map` is a property in a nexus node that bridges one specifier domain with a set of parent specifier domains and describes how specifiers in the child domain are mapped to their respective parent domains.","The map is a table where each row is a mapping entry consisting of three components: child specifier, specifier parent, and parent specifier.","- child specifier The specifier of the child node being mapped. The number of 32-bit cells required to specify this component is described by the `#<specifier>-cells` property of this node-the nexus node containing the \u2039specifier>-map property.","- Specifier parent A single <phandle > value that points to the specifier parent to which the child domain is being mapped.","- Parent specifier: The specifier in the parent domain. The number of 32-bit cells required to specify this component is described by the `#<specifier>-cells` property of the specifier parent node.","Lookups are performed on the mapping table by matching a specifier against the child specifier in the map. Because some fields in the specifier may not be relevant or need to be modified, a mask is applied before the lookup is done. This mask is defined in the `<specifier>-map-mask` property","Similarly, when the specifier is mapped, some fields in the unit specifier may need to be kept unmodified and passed through from the child node to the parent node. In this case, a `<specifier>-map-pass-thru` property may be specified to apply a mask to the child specifier and copy any bits that match to the parent unit specifier."],t.list=!0,t};var BC=()=>{let t=new X(/^(?!interrupt-).*?-map-mask$/,z("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,r)=>{let n=[],i=e.parent,s=Le(e.ast.values);if(!s?.length)return[];let o=e.name.split("-map",1)[0],a=i.getProperty(`#${o}-cells`);if(!a)return n;let c=Be(a,0,0,r);if(c==null)return n;let l=[...Array.from({length:c},(u,d)=>`mask${c>1?d:""}`)];if(t.signatureArgs=l.map(u=>Lr.create(u)),s.length!==c){let u=e.ast.values??e.ast;return n.push(B(19,u.firstToken,u.lastToken,u,{templateStrings:[e.name,`<${[...Array.from({length:c},()=>"mask")].join(" ")}>`]})),n}return n});return t.description=["A `<specifier>-map-mask` property may be specified for a nexus node. This property specifies a mask that is ANDed with the child unit specifier being looked up in the table specified in the `<specifier>-map` property. If this propertyis notspecified, the maskis assumedto be a mask with all bits set."],t};var FC=()=>{let t=new X(/^(?!interrupt-).*?-map-pass-thru$/,z("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,r)=>{let n=[],i=e.parent,s=Le(e.ast.values);if(!s?.length)return[];let o=e.name.split("-map",1)[0],a=i.getProperty(`#${o}-cells`);if(!a)return n;let c=Be(a,0,0,r);if(c==null)return n;let l=[...Array.from({length:c},(u,d)=>`mask${c>1?d:""}`)];if(t.signatureArgs=l.map(u=>Lr.create(u)),s.length!==c){let u=e.ast.values??e.ast;return n.push(B(19,u.firstToken,u.lastToken,u,{templateStrings:[e.name,`<${[...Array.from({length:c},()=>"mask")].join(" ")}>`]})),n}return n});return t.description=["A `<specifier>-map-pass-thru` property may be specified for a nexus node. This property specifies a mask that is applied to the child unit specifier being looked up in the table specified in the `<specifier>-map` property. Any matching bits in the child unit specifier are copied over to the parent specifier. If this property is not specified, the mask isassumedtobe amaskwithno bits set."],t};var jC=()=>{let t=new X(/^(?!#(?:address-|interrupt-|size-)).*-cells$/,z("U32"));return t.list=!0,t.description=["The `#<specifier>-cells` propertydefines the number of cells required to encode a specifier for adomain."],t};function fr(){let t=new Rt;return t.addProperty([gC(),IC(),AC(),DC(),Kf(),Gf(),CC(),wC(),Wf(),PC(),NC(),kC(),OC(),yC(),SC(),bC(),_C(),TC(),vC(),xC(),LC(),$C(),BC(),FC(),jC()]),t}var UC=()=>{let t=new X("chassis-type",z("STRING"),"optional",void 0,["desktop","laptop","convertible","server","tablet","handset","watch","embedded"]);return t.description=["Specifies a string that identifies the form-factor of the system."],t};var HC=()=>{let t=new X("serial-number",z("STRING"),"optional");return t.description=[`Specifies a string representing the device\u2019s se-
|
|
249
|
-
|
|
228
|
+
`)],t};var yE=()=>{let t=new Y("model",z("STRING"));return t.description=["The model property value is a <string> that specifies the manufacturer's model number of the device.",'The recommended format is: "manufacturer, model" , where manufacturer is a string describing the name of the manufacturer (such as a stock ticker symbol), and model specifies the model number.'],t.examples=['```devicetree\nmodel = "{sl, MPC8349EMITX" ;\n```'],t};var Df=$(j());var TE=()=>{let t=new Y("name",z("STRING"),"optional",void 0,void 0,e=>[B(14,e.ast.firstToken,e.ast.lastToken,e.ast,{severity:Df.DiagnosticSeverity.Warning,tags:[Df.DiagnosticTag.Deprecated],templateStrings:[e.name]})]);return t.hideAutoComplete=!0,t};var vE=$(j());var bE=()=>{let t=new Y("interrupt-map",z("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,r)=>{let n=[],i=e.parent,s=e.parent.root,o=Le(e.ast.values);if(!o?.length)return[];i.getProperty("#address-cells")||n.push(B(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...e.parent.nodeNameOrLabelRef],templateStrings:[e.name,"#address-cells",i.pathString]}));let c=i.getProperty("#interrupt-cells");if(!c)return n.push(B(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...i.nodeNameOrLabelRef],templateStrings:[e.name,"#interrupt-cells",`/${i.path.slice(1).join("/")}`]})),n;let l=i.addressCells(r),u=Be(c,0,0,r),d={};if(u==null)return n;let f=0,p=[],m=0,h=0;for(;f<o.length;){if(p.push([...Array.from({length:l},(M,F)=>`${m}_ChildAddr${l>1?F:""}`),...Array.from({length:u},(M,F)=>`${m}_ChildIntrpt${u>1?F:""}`),`${m}_IntrptParent`,`${m}_ParentAddr...`,`${m}_ParentIntrpt...`]),f+l+u>=o.length){let M=f+l+u,F=o[o.length-1];n.push(B(20,F.firstToken,F.lastToken,F,{templateStrings:[e.name,`after the last value of ${p.at(-1).slice((o.length-h)%M===0?M:(o.length-h)%M).join(" ")}`]}));break}let T=new Q(oe(o.at(f).firstToken,o.at(l+u+f-1).lastToken)),b="";for(let M=f;M<l+u+f;M++){let F=o[M];b+=`${F instanceof be?F.evaluate(r).toString():F.toString()}:`}d[b]??=[],d[b].push(T),f+=l+u;let _=l+u+1;if(o.length<f+1){let M=o[o.length-1];n.push(B(20,M.firstToken,M.lastToken,M,{templateStrings:[e.name,`after the last value of ${p.at(-1).slice((o.length-h)%_===0?_:(o.length-h)%_).join(" ")}`]}));break}let v=Tn(o[f],s);if(!v){let M=o[f];n.push(B(17,M.firstToken,M.lastToken,M));break}let N=v.addressCells(r),C=v.getProperty("#interrupt-cells");if(!C){let M=o[f];n.push(B(16,M.firstToken,M.lastToken,M,{linkedTo:[...v.nodeNameOrLabelRef],templateStrings:[e.name,"#interrupt-cells",`/${i.path.slice(1).join("/")}`]}));break}f++;let H=Be(C,0,0,r);if(H==null)break;if(p.splice(-1,1,[...Array.from({length:l},(M,F)=>`${m}_ChildAddr${l>1?F:""}`),...Array.from({length:u},(M,F)=>`${m}_ChildIntrpt${u>1?F:""}`),`${m}_IntrptParent`,...Array.from({length:N},(M,F)=>`${m}_ParentAddr${N>1?F:""}`),...Array.from({length:H},(M,F)=>`${m}_ParentIntrpt${H>1?F:""}`)]),f+=N+H,o.length<f){let M=l+u+1+N+H,F=o[o.length-1];n.push(B(20,F.firstToken,F.lastToken,F,{templateStrings:[e.name,`after the last value of ${p.at(-1).slice((o.length-h)%M===0?M:(o.length-h)%M).join(" ")}`]}));break}h=f,m++}if(p.push([...Array.from({length:l},(T,b)=>`${m}_ChildAddr${l>1?b:""}`),...Array.from({length:u},(T,b)=>`${m}_ChildIntrpt${u>1?b:""}`),`${m}_IntrptParent`,`${m}_ParentAddr...`,`${m}_ParentIntrpt...`]),t.signatureArgs=p.map(T=>T.map(b=>vE.ParameterInformation.create(b))),!e.ast.values)return[];for(let T=0;T<e.ast.values.values.length;T++){let b=e.ast.values.values.at(T);if(b&&(n.length||u==null||!(b.value instanceof Nt)))return n}return Object.values(d).forEach(T=>{if(T.length>1){let b=T[T.length-1];n.push(B(30,b.firstToken,b.lastToken,b,{linkedTo:T.slice(0,-1)}))}}),n});return t.description=["An interrupt-map is a property on a nexus node that bridges one interrupt domain with a set of parent interrupt domains and specifies how interrupt specifiers in the child domain are mapped to their respective parent domains.","The interrupt map is a table where each row is a mapping entry consisting of five components: child unit address, child interrupt specifier, interrupt-parent, parent unit address, parent interrupt specifier.","- child unit address: The unit address of the child node being mapped. The number of 32-bit cells required to specify this is described by the #address-cells property of the bus node on which the child is located.","- child interrupt specifier: The interrupt specifier of the child node being mapped. The number of 32-bit cells required to specify this component is described by the #interrupt-cells property of this node-the nexus node containing the interrupt-map property.","- interrupt-parent: A single <phandle > value that points to the interrupt parent to which the child domain is being mapped.","- parent unit address: The unit address in the domain of the interrupt parent. The number of 32-bit cells required to specify this address is described by the #address-cells property of the node pointed to by the interrupt-parent field.","- parent interrupt specifier: The interrupt specifier in the parent domain. The number of 32-bit cells required to specify this component is described by the #interrupt-cells property of the node pointed to by the interrupt-parent field.","Lookups are performed on the interrupt mapping table by matching a unit-address/interrupt specifier pair against the child components in the interrupt-map. Because some fields in the unit interrupt specifier may not be relevant, a mask is applied before the lookup is done. This mask is defined in the interrupt-map-mask property","Note: Both the child node and the interrupt parent node are required to have #address-cells and #interrupt-cells properties defined. If a unit address component is not required ,#address-cells shall be explicitly defined to be zero."],t};var SE;(function(t){function e(r){return typeof r=="string"}t.is=e})(SE||(SE={}));var oT;(function(t){function e(r){return typeof r=="string"}t.is=e})(oT||(oT={}));var _E;(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(_E||(_E={}));var Af;(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(Af||(Af={}));var Yt;(function(t){function e(n,i){return n===Number.MAX_VALUE&&(n=Af.MAX_VALUE),i===Number.MAX_VALUE&&(i=Af.MAX_VALUE),{line:n,character:i}}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&I.uinteger(i.line)&&I.uinteger(i.character)}t.is=r})(Yt||(Yt={}));var Je;(function(t){function e(n,i,s,o){if(I.uinteger(n)&&I.uinteger(i)&&I.uinteger(s)&&I.uinteger(o))return{start:Yt.create(n,i),end:Yt.create(s,o)};if(Yt.is(n)&&Yt.is(i))return{start:n,end:i};throw new Error(`Range#create called with invalid arguments[${n}, ${i}, ${s}, ${o}]`)}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&Yt.is(i.start)&&Yt.is(i.end)}t.is=r})(Je||(Je={}));var If;(function(t){function e(n,i){return{uri:n,range:i}}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&Je.is(i.range)&&(I.string(i.uri)||I.undefined(i.uri))}t.is=r})(If||(If={}));var kE;(function(t){function e(n,i,s,o){return{targetUri:n,targetRange:i,targetSelectionRange:s,originSelectionRange:o}}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&Je.is(i.targetRange)&&I.string(i.targetUri)&&Je.is(i.targetSelectionRange)&&(Je.is(i.originSelectionRange)||I.undefined(i.originSelectionRange))}t.is=r})(kE||(kE={}));var aT;(function(t){function e(n,i,s,o){return{red:n,green:i,blue:s,alpha:o}}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&I.numberRange(i.red,0,1)&&I.numberRange(i.green,0,1)&&I.numberRange(i.blue,0,1)&&I.numberRange(i.alpha,0,1)}t.is=r})(aT||(aT={}));var NE;(function(t){function e(n,i){return{range:n,color:i}}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&Je.is(i.range)&&aT.is(i.color)}t.is=r})(NE||(NE={}));var RE;(function(t){function e(n,i,s){return{label:n,textEdit:i,additionalTextEdits:s}}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&I.string(i.label)&&(I.undefined(i.textEdit)||na.is(i))&&(I.undefined(i.additionalTextEdits)||I.typedArray(i.additionalTextEdits,na.is))}t.is=r})(RE||(RE={}));var PE;(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(PE||(PE={}));var wE;(function(t){function e(n,i,s,o,a,c){let l={startLine:n,endLine:i};return I.defined(s)&&(l.startCharacter=s),I.defined(o)&&(l.endCharacter=o),I.defined(a)&&(l.kind=a),I.defined(c)&&(l.collapsedText=c),l}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&I.uinteger(i.startLine)&&I.uinteger(i.startLine)&&(I.undefined(i.startCharacter)||I.uinteger(i.startCharacter))&&(I.undefined(i.endCharacter)||I.uinteger(i.endCharacter))&&(I.undefined(i.kind)||I.string(i.kind))}t.is=r})(wE||(wE={}));var cT;(function(t){function e(n,i){return{location:n,message:i}}t.create=e;function r(n){let i=n;return I.defined(i)&&If.is(i.location)&&I.string(i.message)}t.is=r})(cT||(cT={}));var EE;(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(EE||(EE={}));var CE;(function(t){t.Unnecessary=1,t.Deprecated=2})(CE||(CE={}));var DE;(function(t){function e(r){let n=r;return I.objectLiteral(n)&&I.string(n.href)}t.is=e})(DE||(DE={}));var Of;(function(t){function e(n,i,s,o,a,c){let l={range:n,message:i};return I.defined(s)&&(l.severity=s),I.defined(o)&&(l.code=o),I.defined(a)&&(l.source=a),I.defined(c)&&(l.relatedInformation=c),l}t.create=e;function r(n){var i;let s=n;return I.defined(s)&&Je.is(s.range)&&I.string(s.message)&&(I.number(s.severity)||I.undefined(s.severity))&&(I.integer(s.code)||I.string(s.code)||I.undefined(s.code))&&(I.undefined(s.codeDescription)||I.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(I.string(s.source)||I.undefined(s.source))&&(I.undefined(s.relatedInformation)||I.typedArray(s.relatedInformation,cT.is))}t.is=r})(Of||(Of={}));var ra;(function(t){function e(n,i,...s){let o={title:n,command:i};return I.defined(s)&&s.length>0&&(o.arguments=s),o}t.create=e;function r(n){let i=n;return I.defined(i)&&I.string(i.title)&&I.string(i.command)}t.is=r})(ra||(ra={}));var na;(function(t){function e(s,o){return{range:s,newText:o}}t.replace=e;function r(s,o){return{range:{start:s,end:s},newText:o}}t.insert=r;function n(s){return{range:s,newText:""}}t.del=n;function i(s){let o=s;return I.objectLiteral(o)&&I.string(o.newText)&&Je.is(o.range)}t.is=i})(na||(na={}));var lT;(function(t){function e(n,i,s){let o={label:n};return i!==void 0&&(o.needsConfirmation=i),s!==void 0&&(o.description=s),o}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&I.string(i.label)&&(I.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(I.string(i.description)||i.description===void 0)}t.is=r})(lT||(lT={}));var ia;(function(t){function e(r){let n=r;return I.string(n)}t.is=e})(ia||(ia={}));var AE;(function(t){function e(s,o,a){return{range:s,newText:o,annotationId:a}}t.replace=e;function r(s,o,a){return{range:{start:s,end:s},newText:o,annotationId:a}}t.insert=r;function n(s,o){return{range:s,newText:"",annotationId:o}}t.del=n;function i(s){let o=s;return na.is(o)&&(lT.is(o.annotationId)||ia.is(o.annotationId))}t.is=i})(AE||(AE={}));var uT;(function(t){function e(n,i){return{textDocument:n,edits:i}}t.create=e;function r(n){let i=n;return I.defined(i)&&mT.is(i.textDocument)&&Array.isArray(i.edits)}t.is=r})(uT||(uT={}));var dT;(function(t){function e(n,i,s){let o={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}t.create=e;function r(n){let i=n;return i&&i.kind==="create"&&I.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||I.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||I.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||ia.is(i.annotationId))}t.is=r})(dT||(dT={}));var fT;(function(t){function e(n,i,s,o){let a={kind:"rename",oldUri:n,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(a.options=s),o!==void 0&&(a.annotationId=o),a}t.create=e;function r(n){let i=n;return i&&i.kind==="rename"&&I.string(i.oldUri)&&I.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||I.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||I.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||ia.is(i.annotationId))}t.is=r})(fT||(fT={}));var pT;(function(t){function e(n,i,s){let o={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}t.create=e;function r(n){let i=n;return i&&i.kind==="delete"&&I.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||I.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||I.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||ia.is(i.annotationId))}t.is=r})(pT||(pT={}));var hT;(function(t){function e(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(i=>I.string(i.kind)?dT.is(i)||fT.is(i)||pT.is(i):uT.is(i)))}t.is=e})(hT||(hT={}));var IE;(function(t){function e(n){return{uri:n}}t.create=e;function r(n){let i=n;return I.defined(i)&&I.string(i.uri)}t.is=r})(IE||(IE={}));var OE;(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return I.defined(i)&&I.string(i.uri)&&I.integer(i.version)}t.is=r})(OE||(OE={}));var mT;(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return I.defined(i)&&I.string(i.uri)&&(i.version===null||I.integer(i.version))}t.is=r})(mT||(mT={}));var ME;(function(t){function e(n,i,s,o){return{uri:n,languageId:i,version:s,text:o}}t.create=e;function r(n){let i=n;return I.defined(i)&&I.string(i.uri)&&I.string(i.languageId)&&I.integer(i.version)&&I.string(i.text)}t.is=r})(ME||(ME={}));var cs;(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(r){let n=r;return n===t.PlainText||n===t.Markdown}t.is=e})(cs||(cs={}));var Oc;(function(t){function e(r){let n=r;return I.objectLiteral(r)&&cs.is(n.kind)&&I.string(n.value)}t.is=e})(Oc||(Oc={}));var xE;(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})(xE||(xE={}));var LE;(function(t){t.PlainText=1,t.Snippet=2})(LE||(LE={}));var qE;(function(t){t.Deprecated=1})(qE||(qE={}));var $E;(function(t){function e(n,i,s){return{newText:n,insert:i,replace:s}}t.create=e;function r(n){let i=n;return i&&I.string(i.newText)&&Je.is(i.insert)&&Je.is(i.replace)}t.is=r})($E||($E={}));var BE;(function(t){t.asIs=1,t.adjustIndentation=2})(BE||(BE={}));var FE;(function(t){function e(r){let n=r;return n&&(I.string(n.detail)||n.detail===void 0)&&(I.string(n.description)||n.description===void 0)}t.is=e})(FE||(FE={}));var jE;(function(t){function e(r){return{label:r}}t.create=e})(jE||(jE={}));var UE;(function(t){function e(r,n){return{items:r||[],isIncomplete:!!n}}t.create=e})(UE||(UE={}));var Mf;(function(t){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function r(n){let i=n;return I.string(i)||I.objectLiteral(i)&&I.string(i.language)&&I.string(i.value)}t.is=r})(Mf||(Mf={}));var HE;(function(t){function e(r){let n=r;return!!n&&I.objectLiteral(n)&&(Oc.is(n.contents)||Mf.is(n.contents)||I.typedArray(n.contents,Mf.is))&&(r.range===void 0||Je.is(r.range))}t.is=e})(HE||(HE={}));var $r;(function(t){function e(r,n){return n?{label:r,documentation:n}:{label:r}}t.create=e})($r||($r={}));var VE;(function(t){function e(r,n,...i){let s={label:r};return I.defined(n)&&(s.documentation=n),I.defined(i)?s.parameters=i:s.parameters=[],s}t.create=e})(VE||(VE={}));var zE;(function(t){t.Text=1,t.Read=2,t.Write=3})(zE||(zE={}));var WE;(function(t){function e(r,n){let i={range:r};return I.number(n)&&(i.kind=n),i}t.create=e})(WE||(WE={}));var GE;(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})(GE||(GE={}));var KE;(function(t){t.Deprecated=1})(KE||(KE={}));var YE;(function(t){function e(r,n,i,s,o){let a={name:r,kind:n,location:{uri:s,range:i}};return o&&(a.containerName=o),a}t.create=e})(YE||(YE={}));var XE;(function(t){function e(r,n,i,s){return s!==void 0?{name:r,kind:n,location:{uri:i,range:s}}:{name:r,kind:n,location:{uri:i}}}t.create=e})(XE||(XE={}));var JE;(function(t){function e(n,i,s,o,a,c){let l={name:n,detail:i,kind:s,range:o,selectionRange:a};return c!==void 0&&(l.children=c),l}t.create=e;function r(n){let i=n;return i&&I.string(i.name)&&I.number(i.kind)&&Je.is(i.range)&&Je.is(i.selectionRange)&&(i.detail===void 0||I.string(i.detail))&&(i.deprecated===void 0||I.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=r})(JE||(JE={}));var QE;(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"})(QE||(QE={}));var xf;(function(t){t.Invoked=1,t.Automatic=2})(xf||(xf={}));var ZE;(function(t){function e(n,i,s){let o={diagnostics:n};return i!=null&&(o.only=i),s!=null&&(o.triggerKind=s),o}t.create=e;function r(n){let i=n;return I.defined(i)&&I.typedArray(i.diagnostics,Of.is)&&(i.only===void 0||I.typedArray(i.only,I.string))&&(i.triggerKind===void 0||i.triggerKind===xf.Invoked||i.triggerKind===xf.Automatic)}t.is=r})(ZE||(ZE={}));var eC;(function(t){function e(n,i,s){let o={title:n},a=!0;return typeof i=="string"?(a=!1,o.kind=i):ra.is(i)?o.command=i:o.edit=i,a&&s!==void 0&&(o.kind=s),o}t.create=e;function r(n){let i=n;return i&&I.string(i.title)&&(i.diagnostics===void 0||I.typedArray(i.diagnostics,Of.is))&&(i.kind===void 0||I.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||ra.is(i.command))&&(i.isPreferred===void 0||I.boolean(i.isPreferred))&&(i.edit===void 0||hT.is(i.edit))}t.is=r})(eC||(eC={}));var tC;(function(t){function e(n,i){let s={range:n};return I.defined(i)&&(s.data=i),s}t.create=e;function r(n){let i=n;return I.defined(i)&&Je.is(i.range)&&(I.undefined(i.command)||ra.is(i.command))}t.is=r})(tC||(tC={}));var rC;(function(t){function e(n,i){return{tabSize:n,insertSpaces:i}}t.create=e;function r(n){let i=n;return I.defined(i)&&I.uinteger(i.tabSize)&&I.boolean(i.insertSpaces)}t.is=r})(rC||(rC={}));var nC;(function(t){function e(n,i,s){return{range:n,target:i,data:s}}t.create=e;function r(n){let i=n;return I.defined(i)&&Je.is(i.range)&&(I.undefined(i.target)||I.string(i.target))}t.is=r})(nC||(nC={}));var iC;(function(t){function e(n,i){return{range:n,parent:i}}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&Je.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=r})(iC||(iC={}));var sC;(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"})(sC||(sC={}));var oC;(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"})(oC||(oC={}));var aC;(function(t){function e(r){let n=r;return I.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}t.is=e})(aC||(aC={}));var cC;(function(t){function e(n,i){return{range:n,text:i}}t.create=e;function r(n){let i=n;return i!=null&&Je.is(i.range)&&I.string(i.text)}t.is=r})(cC||(cC={}));var lC;(function(t){function e(n,i,s){return{range:n,variableName:i,caseSensitiveLookup:s}}t.create=e;function r(n){let i=n;return i!=null&&Je.is(i.range)&&I.boolean(i.caseSensitiveLookup)&&(I.string(i.variableName)||i.variableName===void 0)}t.is=r})(lC||(lC={}));var uC;(function(t){function e(n,i){return{range:n,expression:i}}t.create=e;function r(n){let i=n;return i!=null&&Je.is(i.range)&&(I.string(i.expression)||i.expression===void 0)}t.is=r})(uC||(uC={}));var dC;(function(t){function e(n,i){return{frameId:n,stoppedLocation:i}}t.create=e;function r(n){let i=n;return I.defined(i)&&Je.is(n.stoppedLocation)}t.is=r})(dC||(dC={}));var gT;(function(t){t.Type=1,t.Parameter=2;function e(r){return r===1||r===2}t.is=e})(gT||(gT={}));var yT;(function(t){function e(n){return{value:n}}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&(i.tooltip===void 0||I.string(i.tooltip)||Oc.is(i.tooltip))&&(i.location===void 0||If.is(i.location))&&(i.command===void 0||ra.is(i.command))}t.is=r})(yT||(yT={}));var fC;(function(t){function e(n,i,s){let o={position:n,label:i};return s!==void 0&&(o.kind=s),o}t.create=e;function r(n){let i=n;return I.objectLiteral(i)&&Yt.is(i.position)&&(I.string(i.label)||I.typedArray(i.label,yT.is))&&(i.kind===void 0||gT.is(i.kind))&&i.textEdits===void 0||I.typedArray(i.textEdits,na.is)&&(i.tooltip===void 0||I.string(i.tooltip)||Oc.is(i.tooltip))&&(i.paddingLeft===void 0||I.boolean(i.paddingLeft))&&(i.paddingRight===void 0||I.boolean(i.paddingRight))}t.is=r})(fC||(fC={}));var pC;(function(t){function e(r){return{kind:"snippet",value:r}}t.createSnippet=e})(pC||(pC={}));var hC;(function(t){function e(r,n,i,s){return{insertText:r,filterText:n,range:i,command:s}}t.create=e})(hC||(hC={}));var mC;(function(t){function e(r){return{items:r}}t.create=e})(mC||(mC={}));var gC;(function(t){t.Invoked=0,t.Automatic=1})(gC||(gC={}));var yC;(function(t){function e(r,n){return{range:r,text:n}}t.create=e})(yC||(yC={}));var TC;(function(t){function e(r,n){return{triggerKind:r,selectedCompletionInfo:n}}t.create=e})(TC||(TC={}));var vC;(function(t){function e(r){let n=r;return I.objectLiteral(n)&&oT.is(n.uri)&&I.string(n.name)}t.is=e})(vC||(vC={}));var bC;(function(t){function e(s,o,a,c){return new TT(s,o,a,c)}t.create=e;function r(s){let o=s;return!!(I.defined(o)&&I.string(o.uri)&&(I.undefined(o.languageId)||I.string(o.languageId))&&I.uinteger(o.lineCount)&&I.func(o.getText)&&I.func(o.positionAt)&&I.func(o.offsetAt))}t.is=r;function n(s,o){let a=s.getText(),c=i(o,(u,d)=>{let f=u.range.start.line-d.range.start.line;return f===0?u.range.start.character-d.range.start.character:f}),l=a.length;for(let u=c.length-1;u>=0;u--){let d=c[u],f=s.offsetAt(d.range.start),p=s.offsetAt(d.range.end);if(p<=l)a=a.substring(0,f)+d.newText+a.substring(p,a.length);else throw new Error("Overlapping edit");l=f}return a}t.applyEdits=n;function i(s,o){if(s.length<=1)return s;let a=s.length/2|0,c=s.slice(0,a),l=s.slice(a);i(c,o),i(l,o);let u=0,d=0,f=0;for(;u<c.length&&d<l.length;)o(c[u],l[d])<=0?s[f++]=c[u++]:s[f++]=l[d++];for(;u<c.length;)s[f++]=c[u++];for(;d<l.length;)s[f++]=l[d++];return s}})(bC||(bC={}));var TT=class{constructor(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content}update(e,r){this._content=e.text,this._version=r,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],r=this._content,n=!0;for(let i=0;i<r.length;i++){n&&(e.push(i),n=!1);let s=r.charAt(i);n=s==="\r"||s===`
|
|
229
|
+
`,s==="\r"&&i+1<r.length&&r.charAt(i+1)===`
|
|
230
|
+
`&&i++}n&&r.length>0&&e.push(r.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return Yt.create(0,e);for(;n<i;){let o=Math.floor((n+i)/2);r[o]>e?i=o:n=o+1}let s=n-1;return Yt.create(s,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],i=e.line+1<r.length?r[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)}get lineCount(){return this.getLineOffsets().length}},I;(function(t){let e=Object.prototype.toString;function r(p){return typeof p<"u"}t.defined=r;function n(p){return typeof p>"u"}t.undefined=n;function i(p){return p===!0||p===!1}t.boolean=i;function s(p){return e.call(p)==="[object String]"}t.string=s;function o(p){return e.call(p)==="[object Number]"}t.number=o;function a(p,m,h){return e.call(p)==="[object Number]"&&m<=p&&p<=h}t.numberRange=a;function c(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}t.integer=c;function l(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}t.uinteger=l;function u(p){return e.call(p)==="[object Function]"}t.func=u;function d(p){return p!==null&&typeof p=="object"}t.objectLiteral=d;function f(p,m){return Array.isArray(p)&&p.every(m)}t.typedArray=f})(I||(I={}));var SC=()=>{let t=new Y("interrupt-map-mask",z("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,r)=>{let n=[],i=e.parent,s=Le(e.ast.values);if(!s?.length)return[];let o=i.getProperty("#interrupt-cells");if(!o)return n;let a=i.addressCells(r),c=Be(o,0,0,r);if(c==null)return n;let l=[...Array.from({length:a},(u,d)=>`AddressMask${a>1?d:""}`),...Array.from({length:c},(u,d)=>`InterruptMask${c>1?d:""}`)];if(t.signatureArgs=l.map(u=>$r.create(u)),s.length!==a+c){let u=e.ast.values??e.ast;return n.push(B(19,u.firstToken,u.lastToken,u,{templateStrings:[e.name,`<${[...Array.from({length:a},()=>"AddressMask"),...Array.from({length:c},()=>"InterruptMask")].join(" ")}>`]})),n}return n});return t.description=["An interrupt-map-mask property is specified for a nexus node in the interrupt tree. This property specifies a mask that is ANDed with the incoming unit interrupt specifier being looked up in the table specified in the interrupt-mapproperty."],t};var _C=$(j());var kC=()=>{let t=new Y(/^(?!interrupt-|no-).*?-map$/,z("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,r)=>{let n=e.name.split("-map",1)[0],i=[],s=e.parent,o=e.parent.root,a=s.getProperty(`#${n}-cells`);if(!a)return i.push(B(16,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...s.nodeNameOrLabelRef],templateStrings:[e.name,`#${n}-cells`,`/${s.path.slice(1).join("/")}`]})),i;let c=Be(a,0,0,r);if(c==null)return i;let l=Le(e.ast.values);if(!l?.length)return[];let u={},d=0,f=0,p=[],m=0;for(;d<l.length;){if(p.push([...Array.from({length:c},(N,C)=>`${m}_Interrupt${c>1?C:""}`),`${m}_SpecifierParent`,`${m}_ParentSpecifier...`]),d+c>=l.length){let N=d+c,C=l[l.length-1];i.push(B(20,C.firstToken,C.lastToken,C,{templateStrings:[e.name,`after the last value of ${p.at(-1).slice((l.length-f)%N===0?N:(l.length-f)%N).join(" ")}`]}));break}let h=new Q(oe(l.at(d).firstToken,l.at(c+d-1)?.lastToken)),T="";for(let N=d;N<c+d;N++){let C=l[N];T+=`${C instanceof be?C.evaluate(r).toString():C.toString()}:`}if(u[T]??=[],u[T].push(h),d+=c,l.length<d+1){let N=c+1,C=l[l.length-1];i.push(B(20,C.firstToken,C.lastToken,C,{templateStrings:[e.name,`after the last value of ${p.at(-1).slice((l.length-f)%N===0?N:(l.length-f)%N).join(" ")}`]}));break}let b=Tn(l[d],o);if(!b){let N=l[d];i.push(B(17,N.firstToken,N.lastToken,N));break}let _=b.getProperty(`#${n}-cells`);if(!_){let N=l[d];return i.push(B(16,N.firstToken,N.lastToken,N,{linkedTo:[...b.nodeNameOrLabelRef],templateStrings:[e.name,`#${n}-cells`,`/${s.path.slice(1).join("/")}`]})),i}d++;let v=Be(_,0,0,r);if(v==null)break;if(p.splice(-1,1,[...Array.from({length:c},(N,C)=>`${m}_ChildSpecifier${c>1?C:""}`),`${m}_SpecifierParent`,...Array.from({length:v},(N,C)=>`${m}_ParentSpecifier${v>1?C:""}`)]),d+=v,l.length<d){let N=c+1+v,C=l[l.length-1];i.push(B(20,C.firstToken,C.lastToken,C,{templateStrings:[e.name,`after the last value of ${p.at(-1).slice((l.length-f)%N===0?N:(l.length-f)%N).join(" ")}`]}));break}f=d,m++}return p.push([...Array.from({length:c},(h,T)=>`${m}_Interrupt${c>1?T:""}`),`${m}_SpecifierParent`,`${m}_ParentSpecifier...`]),t.signatureArgs=p.map(h=>h.map(T=>_C.ParameterInformation.create(T))),Object.values(u).forEach(h=>{if(h.length>1){let T=h[h.length-1];i.push(B(30,T.firstToken,T.lastToken,T,{linkedTo:h.slice(0,-1)}))}}),i});return t.description=["A `\u2039specifier>-map` is a property in a nexus node that bridges one specifier domain with a set of parent specifier domains and describes how specifiers in the child domain are mapped to their respective parent domains.","The map is a table where each row is a mapping entry consisting of three components: child specifier, specifier parent, and parent specifier.","- child specifier The specifier of the child node being mapped. The number of 32-bit cells required to specify this component is described by the `#<specifier>-cells` property of this node-the nexus node containing the \u2039specifier>-map property.","- Specifier parent A single <phandle > value that points to the specifier parent to which the child domain is being mapped.","- Parent specifier: The specifier in the parent domain. The number of 32-bit cells required to specify this component is described by the `#<specifier>-cells` property of the specifier parent node.","Lookups are performed on the mapping table by matching a specifier against the child specifier in the map. Because some fields in the specifier may not be relevant or need to be modified, a mask is applied before the lookup is done. This mask is defined in the `<specifier>-map-mask` property","Similarly, when the specifier is mapped, some fields in the unit specifier may need to be kept unmodified and passed through from the child node to the parent node. In this case, a `<specifier>-map-pass-thru` property may be specified to apply a mask to the child specifier and copy any bits that match to the parent unit specifier."],t.list=!0,t};var NC=()=>{let t=new Y(/^(?!interrupt-).*?-map-mask$/,z("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,r)=>{let n=[],i=e.parent,s=Le(e.ast.values);if(!s?.length)return[];let o=e.name.split("-map",1)[0],a=i.getProperty(`#${o}-cells`);if(!a)return n;let c=Be(a,0,0,r);if(c==null)return n;let l=[...Array.from({length:c},(u,d)=>`mask${c>1?d:""}`)];if(t.signatureArgs=l.map(u=>$r.create(u)),s.length!==c){let u=e.ast.values??e.ast;return n.push(B(19,u.firstToken,u.lastToken,u,{templateStrings:[e.name,`<${[...Array.from({length:c},()=>"mask")].join(" ")}>`]})),n}return n});return t.description=["A `<specifier>-map-mask` property may be specified for a nexus node. This property specifies a mask that is ANDed with the child unit specifier being looked up in the table specified in the `<specifier>-map` property. If this propertyis notspecified, the maskis assumedto be a mask with all bits set."],t};var RC=()=>{let t=new Y(/^(?!interrupt-).*?-map-pass-thru$/,z("PROP_ENCODED_ARRAY"),"optional",void 0,void 0,(e,r)=>{let n=[],i=e.parent,s=Le(e.ast.values);if(!s?.length)return[];let o=e.name.split("-map",1)[0],a=i.getProperty(`#${o}-cells`);if(!a)return n;let c=Be(a,0,0,r);if(c==null)return n;let l=[...Array.from({length:c},(u,d)=>`mask${c>1?d:""}`)];if(t.signatureArgs=l.map(u=>$r.create(u)),s.length!==c){let u=e.ast.values??e.ast;return n.push(B(19,u.firstToken,u.lastToken,u,{templateStrings:[e.name,`<${[...Array.from({length:c},()=>"mask")].join(" ")}>`]})),n}return n});return t.description=["A `<specifier>-map-pass-thru` property may be specified for a nexus node. This property specifies a mask that is applied to the child unit specifier being looked up in the table specified in the `<specifier>-map` property. Any matching bits in the child unit specifier are copied over to the parent specifier. If this property is not specified, the mask isassumedtobe amaskwithno bits set."],t};var PC=()=>{let t=new Y(/^(?!#(?:address-|interrupt-|size-)).*-cells$/,z("U32"));return t.list=!0,t.description=["The `#<specifier>-cells` propertydefines the number of cells required to encode a specifier for adomain."],t};function pr(){let t=new Pt;return t.addProperty([tE(),yE(),gE(),mE(),Cf(),Ef(),hE(),fE(),wf(),dE(),lE(),cE(),TE(),rE(),oE(),sE(),aE(),nE(),iE(),bE(),SC(),kC(),NC(),RC(),PC()]),t}var wC=()=>{let t=new Y("chassis-type",z("STRING"),"optional",void 0,["desktop","laptop","convertible","server","tablet","handset","watch","embedded"]);return t.description=["Specifies a string that identifies the form-factor of the system."],t};var EC=()=>{let t=new Y("serial-number",z("STRING"),"optional");return t.description=[`Specifies a string representing the device\u2019s se-
|
|
231
|
+
rialnumber.`],t};function CC(){let t=pr();t.noMismatchPropertiesAllowed=!0;let e=t.properties.find(s=>s.name==="#address-cells");e.required=()=>"required";let r=t.properties.find(s=>s.name==="#size-cells");r.required=()=>"required";let n=t.properties.find(s=>s.name==="model");n.required=()=>"required";let i=t.properties.find(s=>s.name==="compatible");return i.required=()=>"required",t.addProperty([wC(),EC()]),t}var DC=$(j());function AC(){let t=new Pt((r,n)=>{let i=[];if(n.parent?.name!=="/"){let s=n.definitions[0];i.push(B(26,s.firstToken,s.lastToken,s,{linkedTo:n.definitions.slice(1),templateStrings:["Aliases node can only be added to a root node"]}))}return n.nodes.forEach(s=>{s.definitions.forEach(o=>{i.push(B(26,o.firstToken,o.lastToken,o,{templateStrings:["Aliases node can not have child nodes"],edit:DC.TextEdit.del(Jr(o.firstToken.prevToken,o.lastToken,!1)),codeActionTitle:"Delete Node"}))})}),i});t.noMismatchPropertiesAllowed=!0;let e=new Y(/^[-A-Za-z0-9]+$/,z(["STRING","U32"]),void 0,void 0,void 0,r=>{let n=[],i=r.ast.quickValues;if(i?.length===1&&typeof i[0]=="string"){let s=r.ast.values??r.ast;if(!i[0].startsWith("/"))return n.push(B(23,s.firstToken,s.lastToken,s,{templateStrings:[i[0],r.name]})),n;if(i[0].trim().endsWith("/"))return n.push(B(23,s.firstToken,s.lastToken,s,{templateStrings:["",i[0]]})),n;let o=r.parent.root,a=i[0].split("/").slice(1);for(;a[0];){let c=o,l=a.splice(0,1)[0],[u,d]=l.split("@"),f=d?.split(",").map(p=>Number.parseInt(p,16));if(o=u?c.getNode(u,f,!1):void 0,!o){n.push(B(23,s.firstToken,s.lastToken,s,{templateStrings:[u,c.fullName]}));break}}}return n});return e.description=["Each property of the /aliases node defines an alias."],t.addProperty([e]),t}function IC(){let t=pr();t.noMismatchPropertiesAllowed=!0;let e=t.properties.find(r=>r.name==="reg");return e.required=()=>"required",t}var OC=(t,e,r)=>{let n=t?.(e,r)??[],i=e.parent.root.getProperty(e.name),s=i?Be(i,0,0,r):void 0,o=e.parent.getProperty(e.name);return(o?Be(o,0,0,r):void 0)!==s&&n.push(B(28,e.ast.firstToken,e.ast.lastToken,e.ast,{linkedTo:[...i?.ast?[i.ast]:[]],templateStrings:[`${e.name} value in this node must match value of root node`]})),n};function MC(){let t=new Pt;t.noMismatchPropertiesAllowed=!0;let e=Cf(),r=e?.additionalTypeCheck;e.additionalTypeCheck=(o,a)=>OC(r,o,a),e.required=()=>"required";let n=Ef(),i=n?.additionalTypeCheck;n.additionalTypeCheck=(o,a)=>OC(i,o,a),n.required=()=>"required";let s=wf();return s.required=()=>"required",s.type=z("EMPTY"),s.additionalTypeCheck=void 0,t.addProperty([e,n,s]),t}function xC(){let t=pr();t.additionalValidations=(i,s)=>{let o=[];if(s.parent?.name!=="/"){let a=s.definitions[0];o.push(B(26,a.firstToken,a.lastToken,a,{linkedTo:s.definitions.slice(1),templateStrings:["Chosen node can only be added to a root node"]}))}return o};let e=new Y("bootargs",z("STRING"));e.description=[`A string that specifies the boot arguments for
|
|
250
232
|
theclientprogram. Thevaluecouldpotentially
|
|
251
233
|
be a null string if no boot arguments are re-
|
|
252
|
-
quired.`];let r=new
|
|
234
|
+
quired.`];let r=new Y("stdout-path ",z("STRING"));r.description=[`A string that specifies the full path to the node
|
|
253
235
|
representingthedevicetobeusedforbootcon-
|
|
254
236
|
soleoutput. Ifthecharacter\u201C:\u201Dispresentinthe
|
|
255
237
|
valueit terminates thepath. Thevalue maybe
|
|
256
238
|
an alias. If the stdin-path property is not spec-
|
|
257
239
|
ified, stdout-path should be assumed to define
|
|
258
|
-
theinput device.`];let n=new
|
|
240
|
+
theinput device.`];let n=new Y("stdin-path ",z("STRING"));return n.description=[`A string that specifies the boot arguments for
|
|
259
241
|
theclientprogram. Thevaluecouldpotentially
|
|
260
242
|
be a null string if no boot arguments are re-
|
|
261
|
-
quired.`],t.addProperty([e,r,n]),t}function
|
|
243
|
+
quired.`],t.addProperty([e,r,n]),t}function LC(){let t=pr();t.additionalValidations=(i,s)=>{if(s.parent?.name!=="/"){let o=s.definitions[0];return[B(26,o.firstToken,o.lastToken,o,{linkedTo:s.definitions.slice(1),templateStrings:["Cpus node can only be added to a root node"]})]}return[]};let e=t.properties.find(i=>i.name==="#address-cells");e.required=()=>"required";let r=t.properties.find(i=>i.name==="#size-cells");r.required=()=>"required";let n=r?.additionalTypeCheck;return r.additionalTypeCheck=(i,s)=>{let o=n?.(i,s)??[],a=i.parent.getProperty(i.name);return(a?Be(a,0,0,s):void 0)!==0&&o.push(B(28,i.ast.firstToken,i.ast.lastToken,i.ast,{templateStrings:[`${i.name} value in cpus node must be '0'`]})),o},t}function qC(){let t=pr();t.additionalValidations=(n,i)=>{if(i.parent?.name!=="cpus"){let s=i.definitions[0];return[B(26,s.firstToken,s.lastToken,s,{linkedTo:i.definitions.slice(1),templateStrings:["`cpu` node can only be a child of `cpus` node"]})]}return[]};let e=t.properties.find(n=>n.name==="device_type");e.required=()=>"required";let r=t.properties.find(n=>n.name==="reg");return r.required=()=>"required",r.description=[`The value of reg is a \u2039prop-encoded-array> that defines a unique CPU/thread id for the
|
|
262
244
|
CP U/threads represented by the CPU node.
|
|
263
245
|
If a CPU supports more than one thread (i.e. multiple streams of execution) the reg property is an array with 1 element per thread.
|
|
264
246
|
The #address-cells on the /cpus node specifies how many cells each element of the array takes. Software can determine the number of threads by dividing the size of reg by the parent node's #address-cells.
|
|
265
247
|
If a CPU/thread can be the target of an external interrupt the reg property value must be a unique CPU/thread id that is addressable by the interrupt controller.
|
|
266
248
|
If a CPU/thread cannot be the target of an external interrupt, then reg must be unique and out of bounds of the range addressed by the interrupt controller
|
|
267
249
|
If a CPU/thread's PIR (pending interrupt reg-ister) is modifiable, a client program should modify PIR to match the reg property value.
|
|
268
|
-
If PIR cannot be modified and the PIR value is distinct from the interrupt controller number space, the CPUs binding may define a binding-specific representation of PIR values if desired.`],t}var
|
|
269
|
-
any circumstances other than under the control of the device driver using the region.`],t};var rD=()=>{let t=new X("reusable",z("EMPTY"),"optional");return t.description=["The operating system can use the memory in this region with the limitation that the device driver(s) owning the region need to be able to reclaim it back. Typically that means that the operating system can use that region to store volatile or cached data that can be otherwise regenerated or migrated elsewhere."],t};var nD=()=>{let t=new X("size",z("PROP_ENCODED_ARRAY"),"optional",void 0,[],(e,r)=>{let n=[],i=Le(e.ast.values),s=e.parent.sizeCells(r),o=[...Array.from({length:s},(a,c)=>`size${s>1?c:""}`)];if(t.signatureArgs=o.map(a=>Lr.create(a)),i?.length!==e.parent.sizeCells(r)){let a=e.ast.values??e.ast;n.push(B(19,a.firstToken,a.lastToken,a,{templateStrings:[e.name,`<${Array.from({length:s},()=>"size")}>`]}))}return n});return t.description=["Size in bytes of memory to reserve for dynamically allocated regions."],t};function iD(){let t=fr(),e=t.properties.find(r=>r.name==="reg");return e.required=()=>"optional",t.addProperty([nD(),ZC(),eD(),tD(),rD()]),t}function cs(t){switch(t?.name){case"/":return VC();case"aliases":return WC();case"memory":return GC();case"reserved-memory":return YC();case"chosen":return XC();case"cpus":return JC();case"cpu":return QC()}return t?.parent?.name==="reserved-memory"?iD():fr()}var J=class t{constructor(e,r,n,i=null){this.bindingLoader=e;this.name=r;this.address=n;this.parent=i;this.referencedBy=[];this.definitions=[];this._properties=[];this._deletedProperties=[];this._deletedNodes=[];this.deletes=[];this._nodes=[];this.linkedNodeNamePaths=[];this.linkedRefLabels=[];this.interrupControlerMapping=[];this.spesifierNexusMapping=[];this.missingBinding=[];i?.addNode(this)}static toJson(e){let r={};return e.properties.forEach(n=>r[n.name]=n.ast.values?.toJson()??!0),e.nodes.forEach(n=>r[n.fullName]=t.toJson(n)),r}get disabled(){return this.getProperty("status")?.ast.quickValues?.at(0)==="disabled"}get nodeTypes(){if(this._nodeTypes)return this._nodeTypes;let e=this.parent?.nodeType?.childNodeType?.(this);return e?(this._nodeTypes=[e],this._nodeTypes):(this._nodeTypes=this.bindingLoader?.getNodeTypes(this).type??[cs(this)],this._nodeTypes)}get nodeType(){return this.nodeTypes.find(e=>!e.onBus||this.parent?.nodeType?.bus?.some(r=>r===e.onBus))}isChildOf(e){return this.parent?this.parent===e?!0:this.parent.isChildOf(e):!1}getReferenceBy(e){return this.referencedBy.some(r=>r===e)?this:[...this._nodes,...this._deletedNodes.map(r=>r.node)].map(r=>r.getReferenceBy(e)).find(r=>r)}get nodeNameOrLabelRef(){return Jo([...this.definitions,...this.referencedBy])}getDeepestAstNode(e,r){let n=[...this.definitions,...this.referencedBy].find(i=>br(i,e,r));if(n){let i=this.deletes.map(c=>({item:this,ast:$n(c,e,r),beforeAst:Nc(c,e,r),afterAst:kc(c,e,r)})).find(c=>br(c.ast,e,r));if(i)return i;let s=[...this._properties.flatMap(c=>[c,...c.allReplaced]),...this._deletedProperties.flatMap(c=>[c.property,...c.property.allReplaced])].map(c=>({item:c,ast:c.ast})).find(c=>br(c.ast,e,r)||c.ast.lastToken.value!==";"&&Dw(c.ast,e,r));if(s)return s.item.getDeepestAstNode(e,r);let o=[...this._nodes,...this._deletedNodes.map(c=>c.node)].map(c=>c.getDeepestAstNode(e,r)).find(c=>c);if(o)return o;let a=$n(n,e,r);return{item:this,ast:a,beforeAst:Nc(a,e,r),afterAst:kc(a,e,r)}}}get labels(){return[...this.referencedBy.flatMap(e=>e.labels),...this.definitions.filter(e=>e instanceof Ke).flatMap(e=>e.labels)]}get labelsMapped(){return this.labels.map(e=>({label:e,owner:this}))}get allBindingsProperties(){return[...this.properties.filter(e=>e.name==="compatible"),...this._nodes.flatMap(e=>e.allBindingsProperties)]}get allDescendantsLabels(){return[...this.labels,...this._nodes.flatMap(e=>e.allDescendantsLabels)]}get allDescendantsLabelsMapped(){return[...this.labelsMapped,...this.properties.flatMap(e=>e.labelsMapped),...this._nodes.flatMap(e=>e.allDescendantsLabelsMapped)]}getOverlappingNodeAddressesIssues(e){return this._nodes.filter(r=>!r.disabled).flatMap(r=>{let n=r.regArray(e),i=this._nodes.filter(s=>s!==r&&!s.disabled);return n?.flatMap(s=>{let o=i.flatMap(a=>a.regArray(e)?.filter(c=>dn(c.startAddress,s.endAddress)<0&&dn(s.startAddress,c.endAddress)<0).flatMap(c=>({reg:c,node:a}))).filter(a=>!!a);return o.length?$t(10,s.rangeTokens.start,s.rangeTokens.end,r.definitions[0],{severity:yn.DiagnosticSeverity.Information,linkedTo:o.map(a=>({range:Gr(a.reg.rangeTokens.start,a.reg.rangeTokens.end),uri:a.reg.rangeTokens.start.uri})),templateStrings:[r.fullName,`0x${s.startAddress.map((a,c)=>a.toString(16).padStart(c?8:0,"0")).join("")}`,`0x${s.endAddress.map((a,c)=>a.toString(16).padStart(c?8:0,"0")).join("")}`],linkedToTemplateStrings:o.map(a=>[a.node.fullName,`0x${a.reg.startAddress.map((c,l)=>c.toString(16).padStart(l?8:0,"0")).join("")}`,`0x${a.reg.endAddress.map((c,l)=>c.toString(16).padStart(l?8:0,"0")).join("")}`])}):[]})??[]})}getIssues(e){let r=[...this.properties.flatMap(n=>n.issues),...this._nodes.flatMap(n=>n.getIssues(e)),...this._deletedNodes.flatMap(n=>n.node.getIssues(e)),...this.deletedPropertiesIssues,...this.deletedNodesIssues,...this.missingBinding,...this.getOverlappingNodeAddressesIssues(e)];if(this.name==="/"&&this.definitions.length&&!this._nodes.some(n=>n.name==="cpus")){let n=this.definitions[this.definitions.length-1],i=n.name??n;r.push($t(9,i.firstToken,i.lastToken,i,{severity:yn.DiagnosticSeverity.Error,linkedTo:this.definitions.slice(0,-1),templateStrings:["/","cpus"]}))}return r}get deletedPropertiesIssues(){return[...this._deletedProperties.flatMap(e=>[$t(6,e.property.ast.firstToken,e.property.ast.lastToken,e.property.ast,{severity:yn.DiagnosticSeverity.Hint,tags:[yn.DiagnosticTag.Deprecated],linkedTo:[e.by],templateStrings:[e.property.name]}),...e.property.allReplaced.map(r=>$t(6,r.ast.firstToken,r.ast.lastToken,r.ast,{severity:yn.DiagnosticSeverity.Hint,linkedTo:[e.by],tags:[yn.DiagnosticTag.Deprecated],templateStrings:[e.property.name]})),...e.property.issues])]}get deletedNodesIssues(){return this._deletedNodes.flatMap(e=>[...[...e.node.definitions.filter(r=>r instanceof Ke),...e.node.referencedBy].flatMap(r=>{let n;return r instanceof Ke?n=r.name.toString():r.reference instanceof ie?n=r.reference.label.value:n=r.reference.path.pathParts.at(-1).name,$t(7,r.firstToken,r.lastToken,r,{severity:yn.DiagnosticSeverity.Hint,linkedTo:[e.by],tags:[yn.DiagnosticTag.Deprecated],templateStrings:[n]})})])}get path(){return this.parent?[...this.parent.path,this.fullName]:[this.fullName]}get pathString(){return`/${this.path.slice(1).join("/")}`}get properties(){return this._properties}get deletedProperties(){return this._deletedProperties}get nodes(){return this._nodes}get deletedNodes(){return this._deletedNodes}get propertyNames(){return this._properties.map(e=>e.name)}hasNode(e,r){return this._nodes.some(n=>n.name===e&&(n.address===r||n.address?.every((i,s)=>r?.at(s)===i)))}hasProperty(e){return this._properties.some(r=>r.name===e)}getProperty(e){return this._properties.find(r=>r.name===e)}deleteNode(e,r,n){let i=this._nodes.findIndex(s=>s.name===e&&(s.address===n||n?.every((o,a)=>s.address?.at(a)===o)));i!==-1&&(this._deletedNodes.push({node:this._nodes[i],by:r}),this._nodes.splice(i,1))}get root(){return this.parent?this.parent.root:this}#e;get phandle(){if(this.#e!==void 0)return this.#e;let e=this.getProperty("phandle")?.ast.values?.values.at(0)?.value;if(e instanceof Ct){let r=e.values.at(0)?.value;if(r instanceof Kt)return this.#e=r.value,this.#e}}getAllPhandle(e){return e===this.phandle?[this,...this._nodes.flatMap(r=>r.getAllPhandle(e))]:this._nodes.flatMap(r=>r.getAllPhandle(e))}getPhandle(e){if(this.phandle===e)return this;for(let r of this._nodes){let n=r.getPhandle(e);if(n)return n}}getNode(e,r,n=!0){let i=n||!!r||this._nodes.filter(o=>o.name===e).length>1,s=this._nodes.findIndex(o=>o.name===e&&(!i||o.address===r||o.address?.every((a,c)=>r?.at(c)===a)));if(s!==-1)return this._nodes[s]}deleteProperty(e,r){let n=this._properties.findIndex(i=>i.name===e);n!==-1&&(this._deletedProperties.push({property:this._properties[n],by:r}),this._properties.splice(n,1))}addNode(e){this._nodes.push(e)}addProperty(e){let r=this._properties.findIndex(n=>n.name===e.name);if(r===-1)this._properties.push(e);else{let n=this._properties.splice(r,1)[0];this._properties.push(e),e.replaces=n,n.replacedBy=e}if(e.name==="compatible")if(this.bindingLoader){let n=this.bindingLoader.getNodeTypes(this);this._nodeTypes=n.type,this.missingBinding.push(...n.issues)}else this._nodeTypes=[cs(this)]}getChild(e,r=!0){if(e.length===1&&e[0]==="/"&&this.name==="/")return this;let n=[...e];n.splice(0,1);let i=n[0].split("@"),s=i[0],o=i[1]!==void 0?i[1].split(",").map(c=>Number.parseInt(c,16)):void 0,a=this.getNode(s,o,r);return n.length===1||!a?a:a.getChild(n)}getChildFromScope(e,r){if(e.length===1&&e[0]===this.fullName)return this;if(e[0]!==this.fullName)return;let n=[...e];return n.splice(0,1),[...this._nodes,...this._deletedNodes.filter(s=>!r(s.by)).map(s=>s.node)].find(s=>s.fullName===n[0])?.getChildFromScope(n,r)}get fullName(){return this.address!==void 0?`${this.name}@${this.address.map(e=>e.toString(16)).join(",")}`:this.name}#t;regArray(e){if(this.#t!==void 0)return this.#t;let r=this.getProperty("reg");if(!r){this.#t=null;return}let n=this.parentAddressCells(e),i=this.parentSizeCells(e),s=[],o=Le(r.ast.values)?.reverse();for(;o?.length;){let a=Array.from({length:n}).map(()=>o.pop()),c=Array.from({length:i}).map(()=>o.pop());if(![...a,...c].every(f=>f instanceof Se))continue;let l=a.map(f=>f.evaluate(e)),u=c.map(f=>f.evaluate(e)),d=a.at(0)?.firstToken;!d||![...l,...u].every(f=>typeof f=="number")||s.push({startAddress:l,endAddress:ss(l,u),size:u,rangeTokens:oe(d,c.at(-1)?.lastToken??a.at(-1)?.lastToken)})}return this.#t=s,this.#t}#n;rangeMap(e){if(this.#n!==void 0)return this.#n;let r=this.getProperty("ranges");if(!r){this.#n=null;return}let n=this.sizeCells(e),i=this.addressCells(e),s=this.parentAddressCells(e),o=[],a=Le(r.ast.values)?.reverse();for(;a?.length;){let c=Array.from({length:i}).map(()=>a.pop()),l=Array.from({length:s}).map(()=>a.pop()),u=Array.from({length:n}).map(()=>a.pop());if(![...c,...l,...u].every(h=>h instanceof Se))continue;let d=c.map(h=>h.evaluate(e)),f=l.map(h=>h.evaluate(e)),p=u.map(h=>h.evaluate(e)),m=c.at(0)?.firstToken;!m||![...d,...f,...p].every(h=>typeof h=="number")||o.push({childAddress:d,parentAddress:f,length:p,rangeTokens:oe(m,u.at(-1).lastToken)})}return this.#n=o,this.#n}#r;dmaRangeMap(e){if(this.#r!==void 0)return this.#r;let r=this.getProperty("dma-ranges");if(!r){this.#r=null;return}let n=this.sizeCells(e),i=this.addressCells(e),s=this.parentAddressCells(e),o=[],a=Le(r.ast.values)?.reverse();for(;a?.length;){let c=Array.from({length:i}).map(()=>a.pop()),l=Array.from({length:s}).map(()=>a.pop()),u=Array.from({length:n}).map(()=>a.pop());if(![...c,...l,...u].every(h=>h instanceof Se))continue;let d=c.map(h=>h.evaluate(e)),f=l.map(h=>h.evaluate(e)),p=u.map(h=>h.evaluate(e)),m=c.at(0)?.firstToken;!m||![...d,...f,...p].every(h=>typeof h=="number")||o.push({childAddress:d,parentAddress:f,length:p,rangeTokens:oe(m,u.at(-1).lastToken)})}return this.#r=o,this.#r}parentAddressCells(e){return this.parent?.addressCells(e)??2}parentSizeCells(e){return this.parent?.sizeCells(e)??1}#o;addressCells(e){if(this.#o!==void 0)return this.#o;let r=this?.getProperty("#address-cells");return this.#o=r?Be(r,0,0,e)??2:2,this.#o}#f;sizeCells(e){if(this.#f!==void 0)return this.#f;let r=this.getProperty("#size-cells");return this.#f=r?Be(r,0,0,e)??1:1,this.#f}#a;mappedReg(e){if(this.#a!==void 0)return this.#a;let r=this.parent?.rangeMap(e),n=this.regArray(e);return this.#a=n?.flatMap(i=>{let s=i.startAddress,o=i.size,a=ss(s,o),c={startAddress:s,startAddressRaw:s,size:o,endAddress:a,endAddressRaw:a,inMappingRange:!1,regRangeTokens:{start:i.rangeTokens.start,end:i.rangeTokens.end},missingMapping:!1};if(!r)return[c];let l=xw(r,s);return l.length?l.map(u=>(c.mappedAst={range:u.range,uri:u.uri},c.startAddress=u.start,c.endAddress=ss(u.start,o),c.inMappingRange=dn(c.endAddress,u.end)<=0,c.mappingEnd=u.end,{...c,mappedAst:{range:u.range,uri:u.uri},startAddress:u.start,endAddress:ss(u.start,o),inMappingRange:dn(c.endAddress,u.end)<=0,mappingEnd:u.end})):(c.missingMapping=!0,[c])}).sort((i,s)=>dn(i.endAddress,s.endAddress))??[],this.#a}get interruptsParent(){if(this.getProperty("interrupts-extended"))return null;let e=this.bindingLoader?.type==="Zephyr",r=this.getProperty("interrupt-parent"),n=r?gn(r?.ast.values?.values.at(0),this.root):e?void 0:this.parent;return!e||r?{interruptParent:r,parentInterruptNode:n??null}:n?{interruptParent:r,parentInterruptNode:n??null}:this.parent?this.parent.interruptsParent:{parentInterruptNode:this}}getNexusMapEntryMatch(e,r,n,i=[]){let s=new Z(oe(n[0].firstToken,n.at(-1).lastToken)),o=this.getNexusMap(e,r);if(o){let a=[...i.map((l,u)=>l&(o.mapMask.at(u)??4294967295)),...n.map((l,u)=>{let d=l instanceof Se?l.evaluate(r):l;return(typeof d=="number"?d&(o.mapMask.at(u+i.length)??4294967295):d).toString()})].join(":"),c=o.map.find(l=>l.mappingValues.map(u=>(u instanceof Se?u.evaluate(r):u).toString()).join(":")===a);return{entry:s,match:c}}return{entry:s}}getNexusMap(e,r){let n=this.getProperty(`${e}-map`),i=Le(n?.ast.values);if(!i?.length)return;let s=this.root,o=this.getProperty(`#${e}-cells`);if(!o)return;let a=Be(o,0,0,r);if(a==null)return;e==="interrupt"&&(a+=this.addressCells(r));let c=[],l=0;for(;l<i.length;){let f=i.slice(l,a+l);if(l+=a,i.length<l+1)break;let p=gn(i[l],s);if(!p)break;let m=p.getProperty(`#${e}-cells`);if(!m)return;l++;let h=Be(m,0,0,r);if(h==null||(e==="interrupt"&&(h+=p.addressCells(r)),l+=h,i.length<l))break;let T=i.slice(l-h,l);c.push({mappingValues:f,node:p,parentValues:T})}let u=this.getProperty(`${e}-map-mask`);return{mapMask:Array.from({length:a}).map((f,p)=>(u?Be(u,0,p,r):void 0)??4294967295),map:c}}uniqueLabels(){return Array.from(new Set(this.labels.map(e=>e.toString())))}toTooltipString(e){return`${this.uniqueLabels().join(" ")}${this.labels.length?" ":""}${this.fullName} {${this.properties.length?`
|
|
250
|
+
If PIR cannot be modified and the PIR value is distinct from the interrupt controller number space, the CPUs binding may define a binding-specific representation of PIR values if desired.`],t}var $C=()=>{let t=new Y("alignment",z("PROP_ENCODED_ARRAY"),"optional",void 0,[],(e,r)=>{let n=[],i=Le(e.ast.values),s=e.parent.sizeCells(r),o=[...Array.from({length:s},(a,c)=>`size${s>1?c:""}`)];if(t.signatureArgs=o.map(a=>$r.create(a)),i?.length!==s){let a=e.ast.values??e.ast;n.push(B(19,a.firstToken,a.lastToken,a,{templateStrings:[e.name,`<${Array.from({length:e.parent.sizeCells(r)},()=>"size")}>`]}))}return n});return t.description=["Address boundary for alignment of allocation."],t};var BC=()=>{let t=new Y("alloc-ranges",z("PROP_ENCODED_ARRAY"),"optional",void 0,[],(e,r)=>{let n=[],i=e.parent.addressCells(r),s=e.parent.sizeCells(r),o=[...Array.from({length:i},(c,l)=>`address${i>1?l:""}`),...Array.from({length:s},(c,l)=>`size${s>1?l:""}`)];t.signatureArgs=o.map(c=>$r.create(c)),t.signatureArgsCyclic=!0;let a=Le(e.ast.values);if(!a)return[];if(a.length===0||a.length%(i+s)!==0){let c=a.at(a.length-a.length%(s+i))??e.ast;return n.push(B(19,c.firstToken,c.lastToken,c,{templateStrings:[e.name,`<${[...Array.from({length:i},()=>"address"),...Array.from({length:s},()=>"size")].join(" ")}>`]})),n}return n});return t.description=["Specifies regions of memory that are acceptable to allocate from"],t};var FC=()=>{let t=new Y("no-map",z("EMPTY"),"optional");return t.description=[`Indicates the operating system must not create a virtual mapping of the region as part of its standard mapping of system memory, nor permit speculative access to it under
|
|
251
|
+
any circumstances other than under the control of the device driver using the region.`],t};var jC=()=>{let t=new Y("reusable",z("EMPTY"),"optional");return t.description=["The operating system can use the memory in this region with the limitation that the device driver(s) owning the region need to be able to reclaim it back. Typically that means that the operating system can use that region to store volatile or cached data that can be otherwise regenerated or migrated elsewhere."],t};var UC=()=>{let t=new Y("size",z("PROP_ENCODED_ARRAY"),"optional",void 0,[],(e,r)=>{let n=[],i=Le(e.ast.values),s=e.parent.sizeCells(r),o=[...Array.from({length:s},(a,c)=>`size${s>1?c:""}`)];if(t.signatureArgs=o.map(a=>$r.create(a)),i?.length!==e.parent.sizeCells(r)){let a=e.ast.values??e.ast;n.push(B(19,a.firstToken,a.lastToken,a,{templateStrings:[e.name,`<${Array.from({length:s},()=>"size")}>`]}))}return n});return t.description=["Size in bytes of memory to reserve for dynamically allocated regions."],t};function HC(){let t=pr(),e=t.properties.find(r=>r.name==="reg");return e.required=()=>"optional",t.addProperty([UC(),$C(),BC(),FC(),jC()]),t}function ls(t){switch(t?.name){case"/":return CC();case"aliases":return AC();case"memory":return IC();case"reserved-memory":return MC();case"chosen":return xC();case"cpus":return LC();case"cpu":return qC()}return t?.parent?.name==="reserved-memory"?HC():pr()}var X=class t{constructor(e,r,n,i=null){this.bindingLoader=e;this.name=r;this.address=n;this.parent=i;this.referencedBy=[];this.definitions=[];this._properties=[];this._deletedProperties=[];this._deletedNodes=[];this.deletes=[];this._nodes=[];this.linkedNodeNamePaths=[];this.linkedRefLabels=[];this.interrupControlerMapping=[];this.spesifierNexusMapping=[];this.missingBinding=[];i?.addNode(this)}static toJson(e){let r={};return e.properties.forEach(n=>r[n.name]=n.ast.values?.toJson()??!0),e.nodes.forEach(n=>r[n.fullName]=t.toJson(n)),r}get disabled(){return this.getProperty("status")?.ast.quickValues?.at(0)==="disabled"}get nodeTypes(){if(this._nodeTypes)return this._nodeTypes;let e=this.parent?.nodeType?.childNodeType?.(this);return e?(this._nodeTypes=[e],this._nodeTypes):(this._nodeTypes=this.bindingLoader?.getNodeTypes(this).type??[ls(this)],this._nodeTypes)}get nodeType(){return this.nodeTypes.find(e=>!e.onBus||this.parent?.nodeType?.bus?.some(r=>r===e.onBus))}isChildOf(e){return this.parent?this.parent===e?!0:this.parent.isChildOf(e):!1}getReferenceBy(e){return this.referencedBy.some(r=>r===e)?this:[...this._nodes,...this._deletedNodes.map(r=>r.node)].map(r=>r.getReferenceBy(e)).find(r=>r)}get nodeNameOrLabelRef(){return ta([...this.definitions,...this.referencedBy])}getDeepestAstNode(e,r){let n=[...this.definitions,...this.referencedBy].find(i=>kr(i,e,r));if(n){let i=this.deletes.map(c=>({item:this,ast:jn(c,e,r),beforeAst:Ec(c,e,r),afterAst:wc(c,e,r)})).find(c=>kr(c.ast,e,r));if(i)return i;let s=[...this._properties.flatMap(c=>[c,...c.allReplaced]),...this._deletedProperties.flatMap(c=>[c.property,...c.property.allReplaced])].map(c=>({item:c,ast:c.ast})).find(c=>kr(c.ast,e,r)||c.ast.lastToken.value!==";"&&Hw(c.ast,e,r));if(s)return s.item.getDeepestAstNode(e,r);let o=[...this._nodes,...this._deletedNodes.map(c=>c.node)].map(c=>c.getDeepestAstNode(e,r)).find(c=>c);if(o)return o;let a=jn(n,e,r);return{item:this,ast:a,beforeAst:Ec(a,e,r),afterAst:wc(a,e,r)}}}get labels(){return[...this.referencedBy.flatMap(e=>e.labels),...this.definitions.filter(e=>e instanceof Xe).flatMap(e=>e.labels)]}get labelsMapped(){return this.labels.map(e=>({label:e,owner:this}))}get allBindingsProperties(){return[...this.properties.filter(e=>e.name==="compatible"),...this._nodes.flatMap(e=>e.allBindingsProperties)]}get allDescendantsLabels(){return[...this.labels,...this._nodes.flatMap(e=>e.allDescendantsLabels)]}get allDescendantsLabelsMapped(){return[...this.labelsMapped,...this.properties.flatMap(e=>e.labelsMapped),...this._nodes.flatMap(e=>e.allDescendantsLabelsMapped)]}getOverlappingNodeAddressesIssues(e){return this._nodes.filter(r=>!r.disabled).flatMap(r=>{let n=r.regArray(e),i=this._nodes.filter(s=>s!==r&&!s.disabled);return n?.flatMap(s=>{let o=i.flatMap(a=>a.regArray(e)?.filter(c=>gn(c.startAddress,s.endAddress)<0&&gn(s.startAddress,c.endAddress)<0).flatMap(c=>({reg:c,node:a}))).filter(a=>!!a);return o.length?Bt(10,s.rangeTokens.start,s.rangeTokens.end,r.definitions[0],{severity:vn.DiagnosticSeverity.Information,linkedTo:o.map(a=>({range:Jr(a.reg.rangeTokens.start,a.reg.rangeTokens.end),uri:a.reg.rangeTokens.start.uri})),templateStrings:[r.fullName,`0x${s.startAddress.map((a,c)=>a.toString(16).padStart(c?8:0,"0")).join("")}`,`0x${s.endAddress.map((a,c)=>a.toString(16).padStart(c?8:0,"0")).join("")}`],linkedToTemplateStrings:o.map(a=>[a.node.fullName,`0x${a.reg.startAddress.map((c,l)=>c.toString(16).padStart(l?8:0,"0")).join("")}`,`0x${a.reg.endAddress.map((c,l)=>c.toString(16).padStart(l?8:0,"0")).join("")}`])}):[]})??[]})}getIssues(e){let r=[...this.properties.flatMap(n=>n.issues),...this._nodes.flatMap(n=>n.getIssues(e)),...this._deletedNodes.flatMap(n=>n.node.getIssues(e)),...this.deletedPropertiesIssues,...this.deletedNodesIssues,...this.missingBinding,...this.getOverlappingNodeAddressesIssues(e)];if(this.name==="/"&&this.definitions.length&&!this._nodes.some(n=>n.name==="cpus")){let n=this.definitions[this.definitions.length-1],i=n.name??n;r.push(Bt(9,i.firstToken,i.lastToken,i,{severity:vn.DiagnosticSeverity.Error,linkedTo:this.definitions.slice(0,-1),templateStrings:["/","cpus"]}))}return r}get deletedPropertiesIssues(){return[...this._deletedProperties.flatMap(e=>[Bt(6,e.property.ast.firstToken,e.property.ast.lastToken,e.property.ast,{severity:vn.DiagnosticSeverity.Hint,tags:[vn.DiagnosticTag.Deprecated],linkedTo:[e.by],templateStrings:[e.property.name]}),...e.property.allReplaced.map(r=>Bt(6,r.ast.firstToken,r.ast.lastToken,r.ast,{severity:vn.DiagnosticSeverity.Hint,linkedTo:[e.by],tags:[vn.DiagnosticTag.Deprecated],templateStrings:[e.property.name]})),...e.property.issues])]}get deletedNodesIssues(){return this._deletedNodes.flatMap(e=>[...[...e.node.definitions.filter(r=>r instanceof Xe),...e.node.referencedBy].flatMap(r=>{let n;return r instanceof Xe?n=r.name.toString():r.reference instanceof ie?n=r.reference.label.value:n=r.reference.path.pathParts.at(-1).name,Bt(7,r.firstToken,r.lastToken,r,{severity:vn.DiagnosticSeverity.Hint,linkedTo:[e.by],tags:[vn.DiagnosticTag.Deprecated],templateStrings:[n]})})])}get path(){return this.parent?[...this.parent.path,this.fullName]:[this.fullName]}get pathString(){return`/${this.path.slice(1).join("/")}`}get properties(){return this._properties}get deletedProperties(){return this._deletedProperties}get nodes(){return this._nodes}get deletedNodes(){return this._deletedNodes}get propertyNames(){return this._properties.map(e=>e.name)}hasNode(e,r){return this._nodes.some(n=>n.name===e&&(n.address===r||n.address?.every((i,s)=>r?.at(s)===i)))}hasProperty(e){return this._properties.some(r=>r.name===e)}getProperty(e){return this._properties.find(r=>r.name===e)}deleteNode(e,r,n){let i=this._nodes.findIndex(s=>s.name===e&&(s.address===n||n?.every((o,a)=>s.address?.at(a)===o)));i!==-1&&(this._deletedNodes.push({node:this._nodes[i],by:r}),this._nodes.splice(i,1))}get root(){return this.parent?this.parent.root:this}#e;get phandle(){if(this.#e!==void 0)return this.#e;let e=this.getProperty("phandle")?.ast.values?.values.at(0)?.value;if(e instanceof Nt){let r=e.values.at(0)?.value;if(r instanceof Kt)return this.#e=r.value,this.#e}}getAllPhandle(e){return e===this.phandle?[this,...this._nodes.flatMap(r=>r.getAllPhandle(e))]:this._nodes.flatMap(r=>r.getAllPhandle(e))}getPhandle(e){if(this.phandle===e)return this;for(let r of this._nodes){let n=r.getPhandle(e);if(n)return n}}getNode(e,r,n=!0){let i=n||!!r||this._nodes.filter(o=>o.name===e).length>1,s=this._nodes.findIndex(o=>o.name===e&&(!i||o.address===r||o.address?.every((a,c)=>r?.at(c)===a)));if(s!==-1)return this._nodes[s]}deleteProperty(e,r){let n=this._properties.findIndex(i=>i.name===e);n!==-1&&(this._deletedProperties.push({property:this._properties[n],by:r}),this._properties.splice(n,1))}addNode(e){this._nodes.push(e)}addProperty(e){let r=this._properties.findIndex(n=>n.name===e.name);if(r===-1)this._properties.push(e);else{let n=this._properties.splice(r,1)[0];this._properties.push(e),e.replaces=n,n.replacedBy=e}if(e.name==="compatible")if(this.bindingLoader){let n=this.bindingLoader.getNodeTypes(this);this._nodeTypes=n.type,this.missingBinding.push(...n.issues)}else this._nodeTypes=[ls(this)]}getChild(e,r=!0){if(e.length===1&&e[0]==="/"&&this.name==="/")return this;let n=[...e];n.splice(0,1);let i=n[0].split("@"),s=i[0],o=i[1]!==void 0?i[1].split(",").map(c=>Number.parseInt(c,16)):void 0,a=this.getNode(s,o,r);return n.length===1||!a?a:a.getChild(n)}getChildFromScope(e,r){if(e.length===1&&e[0]===this.fullName)return this;if(e[0]!==this.fullName)return;let n=[...e];return n.splice(0,1),[...this._nodes,...this._deletedNodes.filter(s=>!r(s.by)).map(s=>s.node)].find(s=>s.fullName===n[0])?.getChildFromScope(n,r)}get fullName(){return this.address!==void 0?`${this.name}@${this.address.map(e=>e.toString(16)).join(",")}`:this.name}#t;regArray(e){if(this.#t!==void 0)return this.#t;let r=this.getProperty("reg");if(!r){this.#t=null;return}let n=this.parentAddressCells(e),i=this.parentSizeCells(e),s=[],o=Le(r.ast.values)?.reverse();for(;o?.length;){let a=Array.from({length:n}).map(()=>o.pop()),c=Array.from({length:i}).map(()=>o.pop());if(![...a,...c].every(f=>f instanceof be))continue;let l=a.map(f=>f.evaluate(e)),u=c.map(f=>f.evaluate(e)),d=a.at(0)?.firstToken;!d||![...l,...u].every(f=>typeof f=="number")||s.push({startAddress:l,endAddress:as(l,u),size:u,rangeTokens:oe(d,c.at(-1)?.lastToken??a.at(-1)?.lastToken)})}return this.#t=s,this.#t}#n;rangeMap(e){if(this.#n!==void 0)return this.#n;let r=this.getProperty("ranges");if(!r){this.#n=null;return}let n=this.sizeCells(e),i=this.addressCells(e),s=this.parentAddressCells(e),o=[],a=Le(r.ast.values)?.reverse();for(;a?.length;){let c=Array.from({length:i}).map(()=>a.pop()),l=Array.from({length:s}).map(()=>a.pop()),u=Array.from({length:n}).map(()=>a.pop());if(![...c,...l,...u].every(h=>h instanceof be))continue;let d=c.map(h=>h.evaluate(e)),f=l.map(h=>h.evaluate(e)),p=u.map(h=>h.evaluate(e)),m=c.at(0)?.firstToken;!m||![...d,...f,...p].every(h=>typeof h=="number")||o.push({childAddress:d,parentAddress:f,length:p,rangeTokens:oe(m,u.at(-1).lastToken)})}return this.#n=o,this.#n}#r;dmaRangeMap(e){if(this.#r!==void 0)return this.#r;let r=this.getProperty("dma-ranges");if(!r){this.#r=null;return}let n=this.sizeCells(e),i=this.addressCells(e),s=this.parentAddressCells(e),o=[],a=Le(r.ast.values)?.reverse();for(;a?.length;){let c=Array.from({length:i}).map(()=>a.pop()),l=Array.from({length:s}).map(()=>a.pop()),u=Array.from({length:n}).map(()=>a.pop());if(![...c,...l,...u].every(h=>h instanceof be))continue;let d=c.map(h=>h.evaluate(e)),f=l.map(h=>h.evaluate(e)),p=u.map(h=>h.evaluate(e)),m=c.at(0)?.firstToken;!m||![...d,...f,...p].every(h=>typeof h=="number")||o.push({childAddress:d,parentAddress:f,length:p,rangeTokens:oe(m,u.at(-1).lastToken)})}return this.#r=o,this.#r}parentAddressCells(e){return this.parent?.addressCells(e)??2}parentSizeCells(e){return this.parent?.sizeCells(e)??1}#o;addressCells(e){if(this.#o!==void 0)return this.#o;let r=this?.getProperty("#address-cells");return this.#o=r?Be(r,0,0,e)??2:2,this.#o}#f;sizeCells(e){if(this.#f!==void 0)return this.#f;let r=this.getProperty("#size-cells");return this.#f=r?Be(r,0,0,e)??1:1,this.#f}#a;mappedReg(e){if(this.#a!==void 0)return this.#a;let r=this.parent?.rangeMap(e),n=this.regArray(e);return this.#a=n?.flatMap(i=>{let s=i.startAddress,o=i.size,a=as(s,o),c={startAddress:s,startAddressRaw:s,size:o,endAddress:a,endAddressRaw:a,inMappingRange:!1,regRangeTokens:{start:i.rangeTokens.start,end:i.rangeTokens.end},missingMapping:!1};if(!r)return[c];let l=Kw(r,s);return l.length?l.map(u=>(c.mappedAst={range:u.range,uri:u.uri},c.startAddress=u.start,c.endAddress=as(u.start,o),c.inMappingRange=gn(c.endAddress,u.end)<=0,c.mappingEnd=u.end,{...c,mappedAst:{range:u.range,uri:u.uri},startAddress:u.start,endAddress:as(u.start,o),inMappingRange:gn(c.endAddress,u.end)<=0,mappingEnd:u.end})):(c.missingMapping=!0,[c])}).sort((i,s)=>gn(i.endAddress,s.endAddress))??[],this.#a}get interruptsParent(){if(this.getProperty("interrupts-extended"))return null;let e=this.bindingLoader?.type==="Zephyr",r=this.getProperty("interrupt-parent"),n=r?Tn(r?.ast.values?.values.at(0),this.root):e?void 0:this.parent;return!e||r?{interruptParent:r,parentInterruptNode:n??null}:n?{interruptParent:r,parentInterruptNode:n??null}:this.parent?this.parent.interruptsParent:{parentInterruptNode:this}}getNexusMapEntryMatch(e,r,n,i=[]){let s=new Q(oe(n[0].firstToken,n.at(-1).lastToken)),o=this.getNexusMap(e,r);if(o){let a=[...i.map((l,u)=>l&(o.mapMask.at(u)??4294967295)),...n.map((l,u)=>{let d=l instanceof be?l.evaluate(r):l;return(typeof d=="number"?d&(o.mapMask.at(u+i.length)??4294967295):d).toString()})].join(":"),c=o.map.find(l=>l.mappingValues.map(u=>(u instanceof be?u.evaluate(r):u).toString()).join(":")===a);return{entry:s,match:c}}return{entry:s}}getNexusMap(e,r){let n=this.getProperty(`${e}-map`),i=Le(n?.ast.values);if(!i?.length)return;let s=this.root,o=this.getProperty(`#${e}-cells`);if(!o)return;let a=Be(o,0,0,r);if(a==null)return;e==="interrupt"&&(a+=this.addressCells(r));let c=[],l=0;for(;l<i.length;){let f=i.slice(l,a+l);if(l+=a,i.length<l+1)break;let p=Tn(i[l],s);if(!p)break;let m=p.getProperty(`#${e}-cells`);if(!m)return;l++;let h=Be(m,0,0,r);if(h==null||(e==="interrupt"&&(h+=p.addressCells(r)),l+=h,i.length<l))break;let T=i.slice(l-h,l);c.push({mappingValues:f,node:p,parentValues:T})}let u=this.getProperty(`${e}-map-mask`);return{mapMask:Array.from({length:a}).map((f,p)=>(u?Be(u,0,p,r):void 0)??4294967295),map:c}}uniqueLabels(){return Array.from(new Set(this.labels.map(e=>e.toString())))}toTooltipString(e){return`${this.uniqueLabels().join(" ")}${this.labels.length?" ":""}${this.fullName} {${this.properties.length?`
|
|
270
252
|
`:""}${this.properties.map(r=>r.toPrettyString(e)).join(`
|
|
271
253
|
`)}${this.nodes.length?`
|
|
272
254
|
${this.nodes.map(r=>`${r.fullName}{ /* ... */ };`).join(`
|
|
273
255
|
`)}`:""}
|
|
274
|
-
};`}toMarkupContent(e){return{kind:
|
|
275
|
-
`)}}toFullString(e,r,n=1){let i=this.definitions.some(o=>o instanceof
|
|
256
|
+
};`}toMarkupContent(e){return{kind:vn.MarkupKind.Markdown,value:["### Path",this.pathString,"### Current State","```devicetree",this.toTooltipString(e),"```",...this.nodeType?.maintainers?["### Maintainers",...this.nodeType?.maintainers??[]]:[],...this.nodeType?.description?["### Description",this.nodeType?.description]:[],...this.nodeType?.examples?["### Examples","```devicetree",...this.nodeType?.examples??[],"```"]:[]].join(`
|
|
257
|
+
`)}}toFullString(e,r,n=1){let i=this.definitions.some(o=>o instanceof Xe&&o.omitIfNoRef);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?`
|
|
276
258
|
${" ".repeat(n)}`:""}${this.properties.map(o=>o.toString()).join(`
|
|
277
259
|
${" ".repeat(n)}`)}${this.nodes.length?`
|
|
278
260
|
${" ".repeat(n)}${this.nodes.map(o=>`${o.fullName}{ ... };`).join(`
|
|
279
261
|
${" ".repeat(n)}`)}`:""}
|
|
280
262
|
${" ".repeat(n-1)}}; */`:`${i?`/* /omit-if-no-ref/ */
|
|
281
263
|
${" ".repeat(n-1)}`:""}${this.uniqueLabels().join(" ")}${this.labels.length?" ":""}${this.fullName} {${this.properties.length?`
|
|
282
|
-
${" ".repeat(n)}`:""}${this.properties.map(o=>`${o.toPrettyString(e)} /* ${r?`./${(0,
|
|
264
|
+
${" ".repeat(n)}`:""}${this.properties.map(o=>`${o.toPrettyString(e)} /* ${r?`./${(0,VC.relative)(r,o.ast.uri)}`:o.ast.uri} */`).join(`
|
|
283
265
|
${" ".repeat(n)}`)}${this.nodes.length?`
|
|
284
266
|
${" ".repeat(n)}${this.nodes.map(o=>o.toFullString(e,r,n+1)).join(`
|
|
285
267
|
${" ".repeat(n)}`)}`:""}
|
|
286
|
-
${" ".repeat(n-1)}};`}serialize(e){let r=this.mappedReg(e),n=[...this.definitions,...this.referencedBy],i=this.nodeType;return{nodeType:i instanceof
|
|
287
|
-
`),required:s.required(this)==="required"}))}:void 0,issues:n.flatMap(s=>s.serializeIssues),path:this.pathString,disabled:this.disabled,name:this.fullName,labels:this.labels.map(s=>s.label.value),nodes:n.map(s=>s.serialize(e)),properties:this.properties.map(s=>({...s.ast.serialize(e),nexusMapEnty:s.nexusMapsTo.map(o=>({mappingValuesAst:o.mappingValuesAst.map(a=>a.serialize(e)),specifierSpace:o.specifierSpace,target:o.target.pathString,mapItem:o.mapItem?{parentValues:o.mapItem?.parentValues.map(a=>a.serialize(e)),target:o.mapItem.node.pathString,mappingValues:o.mapItem.mappingValues.map(a=>a.serialize(e))}:void 0}))})),childNodes:this.nodes.map(s=>s.serialize(e)),reg:r?.map(s=>({mappedStartAddress:s?.startAddress,mappedEndAddress:s?.endAddress,startAddress:s?.startAddressRaw,endAddress:s?.endAddressRaw,size:s?.size,inMappingRange:s?.inMappingRange})),interruptControllerMappings:this.interrupControlerMapping.map(s=>({cells:s.expressions.map(o=>o.serialize(e)),path:s.node.pathString,property:s.property.ast.serialize(e)})),specifierNexusMappings:this.spesifierNexusMapping.map(s=>({cells:s.expressions.map(o=>o.serialize(e)),path:s.node.pathString,property:s.property.ast.serialize(e)}))}}};var
|
|
288
|
-
`)}}get allReplaced(){return this.replaces?[this.replaces,...this.replaces.allReplaced]:[]}toString(){return this.ast.toString()}toPrettyString(e){return this.ast.toPrettyString(e)}};var li=class t{constructor(e){this.context=e;this.comments=[];this.includes=[];this.roots=[];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.roots,...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 i=this.fileTopMostAsts(e).find(s=>br(s,e,r)||Aw(Yr().requestTokens(e,!1),s,r));if(i instanceof dr){let o=this.rootNode.getReferenceBy(i)?.getDeepestAstNode(e,r);return o?{...o,runtime:this}:{item:null,runtime:this,ast:$n(i,e,r)}}else if(i instanceof It&&i.path){let s=this.rootNode.getDeepestAstNode(e,r);return s?{...s,runtime:this}:void 0}else if(i instanceof Ke&&i.path){let s=t.getNodeFromPath(i.path.slice(1),this.rootNode)?.getDeepestAstNode(e,r);return s?{...s,runtime:this}:void 0}else if(i)return{runtime:this,item:null,ast:$n(i,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 Je)?.lastLinkedTo?.path)}get issues(){return this.issuesCache??=[...this.labelIssues(),...this.rootNode.getIssues(this.context.macros)],this.issuesCache}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($t(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 Iw([...e.definitions,...e.referencedBy],this.context)}};var Xf=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.staleUri=new Set;let i={includePaths:[],overlays:[],zephyrBindings:[],deviceOrgTreeBindings:[],deviceOrgBindingsMetaSchema:[],...e,ctxName:e.ctxName??(0,oD.basename)(e.dtsFile),lockRenameEdits:[],showFormattingErrorAsDiagnostics:e.showFormattingErrorAsDiagnostics??!0};this.isFullContext=this.settings.dtsFile.toLowerCase().endsWith(".dts"),this.overlays=i.overlays,this.overlays.filter(jc.existsSync),this.parser=new Ii(i.dtsFile,i.includePaths),this.ctxNames_.add(i.ctxName),this.id=Ci(i),this.parser.stable.then(()=>{this.overlayParsers=this.overlays?.map(s=>new Ii(s,i.includePaths,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]}async getFileTree(){let e=new Map,r=i=>({file:i,includes:(e.get(i)??[]).map(s=>r(s.resolvedPath??s.path))});return(await this.getRuntime()).includes.forEach(i=>{let s=e.get(i.uri);s||(s=[],e.set(i.uri,s)),s.push({path:i.path.path,resolvedPath:i.resolvedPath})}),{mainDtsPath:r(this.parser.uri),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=>pe(r,e))}getUriParser(e){let r=this.overlayParsers.find(n=>n.getFiles().some(i=>pe(i,e)));return r??=this.parser.getFiles().some(n=>pe(n,e))?this.parser:void 0,r}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=>pe(s.ast.uri,e)&&(!r||br(s.ast,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?{range:fe(o.value),target:ue(c.bindingsPath)}:void 0})).filter(s=>s)??[];return[...this.parser.cPreprocessorParser.dtsIncludes.filter(s=>pe(s.uri,e)&&(!r||br(s,e,r))).map(s=>{let o=this.parser.cPreprocessorParser.resolveInclude(s);if(o)return{range:fe(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($t(3,o.firstToken,o.lastToken,o,{templateStrings:[o.value]}))}else o instanceof Fn&&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($t(8,a.firstToken,a.lastToken,a,{templateStrings:[a.toString(),`${e.pathParts.filter(l=>l?.linksTo).map(l=>l?.toString()).join("/")}`]}))),c?.linkedNodeNamePaths.push(a),n=c}else break}}setStaleUri(e){this.staleUri.add(e)}async reevaluate(e){this.setStaleUri(e);let r=new Set;return this.staleUri.forEach(n=>{let i=this.getUriParser(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){if(e)return this.sortKeys.get(e.firstToken)}async evaluate(){let e=performance.now();await this.stable();let r=new li(this);this.staleUri.clear(),this._issues=[],this.parser.rootDocument.resetIssues(),this.processRoot(this.parser.rootDocument,r);for(let n=0;n<this.overlayParsers.length;n++)this.overlayParsers[n].rootDocument.resetIssues(),this.processRoot(this.overlayParsers[n].rootDocument,r);return r.includes=this.parser.includes,r.comments=this.parser.cPreprocessorParser.allAstItems.filter(n=>n instanceof mn),(await this.getAllStableParsers()).flatMap(n=>n.tokens).forEach((n,i)=>this.sortKeys.set(n,i)),this.linkPropertiesLabelsAndNodePaths(r),this.reportNodeNameAndPropertyClashes(r),console.log(`(ID: ${this.id}) evaluate`,performance.now()-e),r}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[o.definitions.length-1].name;this._issues.push($t(2,a.firstToken,a.lastToken,a,{linkedTo:[i.ast,...i.allReplaced.map(c=>c.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 Je?this.processDtcBaseNode(e,r,n):e instanceof Xe?this.processDtcProperty(e,r,n):e instanceof xr?this.processDeleteNode(e,r,n):e instanceof yt&&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||dn(c.address??[],a.fullAddress??[])===0)).map(c=>c.issueAst),i=r.nodes.map(o=>({name:o.name,address:o.address,issueAst:o.definitions[0].name??o.definitions[0]})),s=[];e.children.forEach(o=>{if(o instanceof Ke&&o.name){let a=n(s.map(c=>({name:c.name,address:c.fullAddress,issueAst:c})),o.name);a.length&&this._issues.push($t(2,o.name.firstToken,o.name.lastToken,o.name,{linkedTo:a})),s.push(o.name)}else if(o instanceof xr&&o.nodeNameOrRef instanceof xe){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,jc.existsSync)(this.settings.compileCommands)))return JSON.parse((0,jc.readFileSync)(this.settings.compileCommands).toString())}processDtcBaseNode(e,r,n){e instanceof It?this.processDtcRootNode(e,n):e instanceof Ke?this.processDtcChildNode(e,r,n):e instanceof dr&&this.processDtcRefNode(e,n)}processDtcRootNode(e,r){r.roots.push(e),r.rootNode.definitions.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.definitions.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?.referencedBy.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($t(3,r.firstToken,r.lastToken,r,{templateStrings:[r.label?.value??""]})),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?.referencedBy.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 Qe(e,r)),e.children.forEach(i=>this.processChild(i,r,n))}processDeleteNode(e,r,n){if(e.nodeNameOrRef instanceof xe&&e.nodeNameOrRef.value){if(e.parentNode?.parentNode)if(!r.hasNode(e.nodeNameOrRef.name,e.nodeNameOrRef.fullAddress))this._issues.push($t(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 Je&&!e.parentNode.pathName&&n.globalDeletes.push(e)):(n.unlinkedDeletes.push(e),this._issues.push($t(3,e.nodeNameOrRef.firstToken,e.nodeNameOrRef.lastToken,e.nodeNameOrRef,{templateStrings:[e.nodeNameOrRef.value]})))}else if(e.nodeNameOrRef instanceof st&&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($t(8,o.firstToken,o.lastToken,o,{templateStrings:[o.toString(),`${e.nodeNameOrRef.path.pathParts.filter(c=>c?.linksTo).map(c=>c?.toString()).join("/")}`]}))),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 Je&&!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($t(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===Js.DiagnosticSeverity.Hint&&i.raw.virtual))return i.raw.severity===Js.DiagnosticSeverity.Error&&!this.isFullContext&&(i.raw.severity=Js.DiagnosticSeverity.Warning),i}){return e.forEach(i=>{let s=n(i);s&&t.#e(s.diagnostic(),s.raw.uri,r)}),r}async getSyntaxIssues(e=new Map,r=n=>{if(n.raw.severity===Js.DiagnosticSeverity.Error&&!this.isFullContext&&!Ks(n.raw,n.raw.uri,!1)&&(n.raw.severity=Js.DiagnosticSeverity.Warning),!(n.raw.severity===Js.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/;
|
|
289
|
-
|
|
268
|
+
${" ".repeat(n-1)}};`}serialize(e){let r=this.mappedReg(e),n=[...this.definitions,...this.referencedBy],i=this.nodeType;return{nodeType:i instanceof Pt?{...this.nodeType,extends:Array.from(this.nodeType?.extends??[]),properties:i.properties.map(s=>({name:typeof s.name=="string"?s.name:s.name.toString(),nameIsRegex:typeof s.name!="string",allowedValues:s.allowedValues,type:s.type,description:s.description?.join(`
|
|
269
|
+
`),required:s.required(this)==="required"}))}:void 0,issues:n.flatMap(s=>s.serializeIssues),path:this.pathString,disabled:this.disabled,name:this.fullName,labels:this.labels.map(s=>s.label.value),nodes:n.map(s=>s.serialize(e)),properties:this.properties.map(s=>({...s.ast.serialize(e),nexusMapEnty:s.nexusMapsTo.map(o=>({mappingValuesAst:o.mappingValuesAst.map(a=>a.serialize(e)),specifierSpace:o.specifierSpace,target:o.target.pathString,mapItem:o.mapItem?{parentValues:o.mapItem?.parentValues.map(a=>a.serialize(e)),target:o.mapItem.node.pathString,mappingValues:o.mapItem.mappingValues.map(a=>a.serialize(e))}:void 0}))})),childNodes:this.nodes.map(s=>s.serialize(e)),reg:r?.map(s=>({mappedStartAddress:s?.startAddress,mappedEndAddress:s?.endAddress,startAddress:s?.startAddressRaw,endAddress:s?.endAddressRaw,size:s?.size,inMappingRange:s?.inMappingRange})),interruptControllerMappings:this.interrupControlerMapping.map(s=>({cells:s.expressions.map(o=>o.serialize(e)),path:s.node.pathString,property:s.property.ast.serialize(e)})),specifierNexusMappings:this.spesifierNexusMapping.map(s=>({cells:s.expressions.map(o=>o.serialize(e)),path:s.node.pathString,property:s.property.ast.serialize(e)}))}}};var sa=$(j());var vT=$(j());var us=class extends Q{constructor(r,n){super(n);this.label=r;this.docSymbolsMeta={name:this.label.value,kind:vT.SymbolKind.Constant},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration",this.addChild(r)}toString(){return`${this.label.toString()}:`}},rr=class extends Q{constructor(r,n){super(n);this.value=r;this.docSymbolsMeta={name:this.value,kind:vT.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(Ai("type"),Ii("declaration"),this.firstToken,this.lastToken)}toString(){return`${this.value}`}};var Ze=class{constructor(e,r){this.ast=e;this.parent=r;this.nexusMapsTo=[]}getDeepestAstNode(e,r){let n=jn(this.ast,e,r);return this.ast.assignOperatorToken&&Qy(this.ast.assignOperatorToken,e,r)?{item:this,ast:n,beforeAst:Ec(this.ast,e,r),afterAst:wc(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 us)}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:sa.DiagnosticSeverity.Hint,linkedTo:[this.ast],tags:[sa.DiagnosticTag.Unnecessary],templateStrings:[this.name]})]:[]]}onHover(){if(this.nexusMapsTo.length)return{kind:sa.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].uri}#L${e.mapItem.mappingValues[0].firstToken.pos.line+1}`})`])].join(`
|
|
270
|
+
`)}}get allReplaced(){return this.replaces?[this.replaces,...this.replaces.allReplaced]:[]}toString(){return this.ast.toString()}toPrettyString(e){return this.ast.toPrettyString(e)}};var Fc=require("fs");var li=class t{constructor(e,r){this.text=e;this.uri=r;this.inComment=!1;this.lineNumber=0;this.columnNumber=0;this._tokens=[];let n=this.text.replace(/\r\n/g,`
|
|
271
|
+
`).trimEnd();this.lines=n.split(`
|
|
272
|
+
`);for(let i=0;i<this.lines.length;i++)this.lines[i]+=`
|
|
273
|
+
`;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===`
|
|
274
|
+
`){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(Ft(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,uri:this.uri},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){let r="#";return e.startsWith(r)?(this.pushToken({tokens:[46],pos:this.generatePos(e,r),value:r}),!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 bT=require("fs"),ca=require("path"),$c=$(j());var ft=class extends Q{constructor(e){super(e),this.semanticTokenType="keyword",this.semanticTokenModifiers="declaration"}};var zC=require("path"),Lf=$(j());var ui=class extends Q{constructor(r,n){super();this.keyword=r;this.path=n;this.docSymbolsMeta={name:`Include ${n}`,kind:Lf.SymbolKind.File},this.addChild(r),this.addChild(n)}get resolvedPath(){return this._resolvedPath}set resolvedPath(r){this.docSymbolsMeta={name:`Include ${r}`,kind:Lf.SymbolKind.File},this._resolvedPath=r}},oa=class extends Q{constructor(r,n,i){super(i);this._path=r;this.relative=n;this.docSymbolsMeta={name:(0,zC.basename)(this.path),kind:Lf.SymbolKind.File},this.semanticTokenType="string",this.semanticTokenModifiers="declaration"}get path(){return this.relative?this._path.slice(1,-1):this._path}};var WC=$(j());var pt=class extends be{constructor(r,n){super(n);this.name=r;this.docSymbolsMeta={name:this.name.toString(),kind:WC.SymbolKind.Variable},this.semanticTokenType="macro",this.semanticTokenModifiers="declaration"}toString(){return this.name}};var qf=class extends Q{constructor(r,n){super(n);this.operator=r;this.semanticTokenType="operator",this.semanticTokenModifiers="declaration"}toString(){return this.operator}};var GC=$(j());var aa=class extends ft{toString(){return"..."}},di=class extends Q{constructor(r,n){super();this.functionName=r;this.params=n;this.addChild(r),this.params.forEach(i=>this.addChild(i))}getDocumentSymbols(r){return pe(this.uri,r)?[{name:this.functionName.name,kind:GC.SymbolKind.Function,range:fe(this),selectionRange:fe(this),children:this.params.flatMap(n=>n.getDocumentSymbols(r))}]:[]}toString(){return`${this.functionName}(${this.params.map(r=>r.toString()).join(",")})`}};var Mi=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||!pe(this.currentToken?.uri,e.uri))return;let s=this.currentToken,o=s;for(;this.currentToken?.pos.line===i&&pe(this.currentToken?.uri,e.uri);)o=this.moveToNextToken;return r&&this._issues.push(W(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=Ft(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=Ft(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||!pe(n.uri,s)||!pe(i.uri,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(xe));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 pt(s,oe(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(W(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(U(e,40)?(n="&",U(this.currentToken,40)&&(n="&&",r=this.moveToNextToken)):U(e,6)?(n="!",U(this.currentToken,0)&&(n="!=",r=this.moveToNextToken)):U(e,10)?n="~":U(e,8)?(n="|",U(this.currentToken,8)&&(n="||",r=this.moveToNextToken)):U(e,9)?n="^":U(e,4)?(n=">",U(this.currentToken,4)?(n=">>",r=this.moveToNextToken):U(this.currentToken,0)&&(n=">=",r=this.moveToNextToken)):U(e,5)?(n="<",U(this.currentToken,5)?(n="<<",r=this.moveToNextToken):U(this.currentToken,0)&&(n="<=",r=this.moveToNextToken)):U(e,15)?n="+":U(e,16)?n="-":U(e,17)?n="*":U(e,13)?n="/":U(e,18)?n="%":U(e,46)?U(this.currentToken,46)&&(n="##",r=this.moveToNextToken):U(e,0)&&U(this.currentToken,0)&&(n="==",r=this.moveToNextToken),n){let i=new qf(n,oe(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(!Ft(r.lastToken,this.currentToken)){this.popStack();return}let n=this.processMacroCallParams();if(!n){this.popStack();return}if(r.name==="defined")n.length>1?this._issues.push(W(44,r.firstToken,r.lastToken,r)):n.length<1&&this._issues.push(W(45,r.firstToken,r.lastToken,r));else{let s=e.get(r.name)?.macro;s&&(s?.identifier instanceof di?s.identifier.params.at(-1)instanceof aa||(n.length>s.identifier.params.length?this._issues.push(W(44,r.firstToken,r.lastToken,r,{linkedTo:[s]})):n.length<s.identifier.params.length&&this._issues.push(W(45,r.firstToken,r.lastToken,r,{linkedTo:[s]}))):this._issues.push(W(43,r.firstToken,r.lastToken,r)))}let i=new mn(r,n);return i.lastToken=this.prevToken,this.mergeStack(),i}processHex(){this.enqueueToStack();let e=this.checkConcurrentTokens([rt("0"),rt("x",{caseInsensitive:!0})]);if(e.length!==2){this.popStack();return}let r=this.consumeAnyConcurrentTokens([19,20].map(xe));if(!r.length){this.popStack();return}let n=Number.parseInt(r.map(s=>s.value).join(""),16),i=new Kt(n,oe(e[0],r.at(-1)),16);return this.mergeStack(),i}processDec(e=!1){this.enqueueToStack();let r;e&&(U(this.currentToken,16)||U(this.currentToken,15))&&Ft(this.currentToken,this.currentToken?.nextToken)&&(r=this.moveToNextToken);let n=this.consumeAnyConcurrentTokens([19].map(xe));if(!n.length){this.popStack();return}let i=Number.parseInt(n.map(o=>o.value).join(""),10);r&&U(r,16)&&(i=4294967295-i);let s=new Kt(i,oe(r??n[0],n.at(-1)),10);return this.mergeStack(),s}processEnclosedExpression(e,r){this.enqueueToStack();let n,i;if(U(this.currentToken,42)){let s;n=this.moveToNextToken,i=n;let o=this.processExpression(e,r,!0);return o&&(s=new Yr(o,!0),o=new Yr(s,!1),s.openBracket=n),U(this.currentToken,43)?(i=this.moveToNextToken,s&&(s.closeBracket=i)):n&&this._issues.push(W(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 Yr?i.addExpression(o,a):i=new Yr(i,!1,{operator:o,expression:a}):this._issues.push(W(27,o.firstToken,o.lastToken,r)),o=this.isOperator()}}return this.mergeStack(),i}processMacroCallParams(){if(!U(this.currentToken,42))return;let e=this.parseScopedBlock(n=>!!U(n,42),n=>!!U(n,43),n=>!!U(n,24));return e?.items.length===2&&U(e.endToken,43)?[]:e?.splitTokens.map((n,i)=>{if(n.tokens.length===0)return null;let s=new ci(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(""),oe(n.tokens[0],n.tokens.at(-1)),i);return s.splitToken=e.separatorTokens.at(i),s})}};var Zr=class extends Q{constructor(r){super();this.comments=r;this.disabled=!1;r.forEach(this.addChild.bind(this))}toString(){return this.comments.map(r=>r.toString()).join(`
|
|
275
|
+
`)}},en=class extends Q{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 $f=class t extends Mi{constructor(r,n=()=>tn().requestTokens(this.uri,!0)){super();this.uri=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||!U(c,13)||(l=s(),!U(l,17)||c.pos.line!==l.pos.line||c.pos.col+1!==l.pos.col))return;let u=()=>!(!U(a(),17)||!U(o(),13)||!Ft(a(),o())),d=l.pos.line,f=c,p=[];l=s();do{if(o()?.pos.line!==d){let T=new en(oe(f,a()));p.push(T),d=o().pos.line??0,f=o()}l=s()}while(n<r.length&&!u());let m=new en(oe(f,o()));p.push(m);let h=new Zr(p);return s(),{comment:h,tokenUsed:i,index:n-1}}static processLineComment(r,n){let i=[];if(!U(r[n],13)||r.length===n+1||!U(r[n+1],13)||!Ft(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 en(oe(r[i[0]],r[i.at(-1)])),tokenUsed:i,index:n-1}}};var KC=$(j());var Bf=class extends Q{constructor(r,n){super(r);this.content=n}toString(){let r=this.content.filter(n=>!U(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("")}},Mc=class extends Q{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 pt?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:KC.MarkupKind.Markdown,value:["```cpp",`#define ${this.toString()}`,"```"].join(`
|
|
276
|
+
`)}}};var Zs=class extends Q{constructor(e){super(e)}},xc=class extends Q{constructor(r,n){super();this.keyword=r;this.content=n;this.active=!1;this.addChild(r)}},Lc=class extends xc{constructor(r,n,i){super(r,i);this.identifier=n;this.addChild(n),this.addChild(i)}useBlock(r){return this.identifier&&r.has(this.identifier.name)}},Ff=class extends xc{constructor(r,n,i){super(r,i);this.expression=n;this.addChild(n),this.addChild(i)}useBlock(r){return this.expression?.isTrue(r)}},jf=class extends Lc{useBlock(e){return this.identifier&&!e.has(this.identifier.name)}},qc=class extends xc{};var Hn=(t,e)=>{let r=t,n=[];for(;r&&(n.push(r),r!==e);)r=r.nextToken;return n},Vn=class extends Q{constructor(r,n,i){super();this.ifDef=r;this.endIf=n;this.elseOption=i;this.addChild(r),i&&this.addChild(i),this.addChild(n)}get inactiveRanges(){if(this.elseOption&&!this.elseOption.active){let r=this.elseOption.firstToken,n=this.elseOption.content?.lastToken??this.endIf?.firstToken??this.lastToken;return[Je.create(Se(r),Se(n))]}if(!this.ifDef.active){let r=this.ifDef.firstToken,n=this.ifDef.content?this.ifDef.content?.lastToken:this.elseOption?this.elseOption.firstToken:this.endIf?.lastToken;return[Je.create(Se(r),Se(n??this.ifDef.lastToken))]}return[]}getInValidTokenRange(r){if(!this.ifDef.identifier)return new WeakSet(Hn(this.firstToken,this.lastToken));let n=this.ifDef.useBlock(r);return n?this.ifDef.active=!0:this.elseOption&&(this.elseOption.active=!0),this.getInValidTokenRangeWhenActiveBlock(n?this.ifDef:this.elseOption)}getInValidTokenRangeWhenActiveBlock(r){let n=new WeakSet,i=(this.ifDef.identifier??this.ifDef.keyword).lastToken;Hn(this.ifDef.firstToken,i).forEach(o=>n.add(o));let s=this.ifDef===r;return!s&&this.ifDef.content&&Hn(this.ifDef.content.firstToken,this.ifDef.content.lastToken).forEach(o=>n.add(o)),this.elseOption&&(Hn(this.elseOption.firstToken,this.elseOption.keyword.lastToken).forEach(o=>n.add(o)),s&&this.elseOption.content&&Hn(this.elseOption.content.firstToken,this.elseOption.content.lastToken).forEach(o=>n.add(o))),this.endIf&&Hn(this.endIf.firstToken,this.endIf.lastToken).forEach(o=>n.add(o)),n}},bn=class extends Q{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;if(this.ifBlocks.forEach((o,a)=>{if(o.active)return;let c=a===this.ifBlocks.length-1,l=o.firstToken,u=c?n?this.elseOption.firstToken:this.lastToken:o.content?.lastToken??this.ifBlocks[a+1].firstToken??o.lastToken;r.push(Je.create(Se(l),Se(u)))}),this.elseOption&&r.length){let o=this.elseOption.firstToken,a=this.elseOption.content?.lastToken??this.endIf?.lastToken??this.lastToken;return[Je.create(Se(o),Se(a))]}let i=this.firstToken,s=this.lastToken;return[Je.create(Se(i),Se(s))]}getInValidTokenRangeWhenActiveBlock(r){let n=new WeakSet,i=!1;return this.ifBlocks.forEach(s=>{let o=s.expression?.lastToken??s.keyword.lastToken;Hn(s.firstToken,o).forEach(a=>n.add(a)),!i&&s===r?i=!0:s.content&&Hn(s.content.firstToken,s.content.lastToken).forEach(a=>n.add(a))}),this.elseOption&&(Hn(this.elseOption.keyword.firstToken,this.elseOption.keyword.lastToken).forEach(s=>n.add(s)),i&&this.elseOption.content&&Hn(this.elseOption.content.firstToken,this.elseOption.content.lastToken).forEach(s=>n.add(s))),this.endIf&&Hn(this.endIf.firstToken,this.endIf.lastToken).forEach(s=>n.add(s)),n}};var la=class extends Mi{constructor(r,n,i,s,o){super();this.uri=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=Qr(r,i)||!r||U(r,14)&&r.pos.line+1===i?.pos.line;if(!(this.macroStart&&!s))return this.macroStart&&U(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.uri),i();return}}this.reset(r),this.parse().then(i)})}),this.parsing}async parse(){let r=new $f(this.uri,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.uri.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||!pe(this.prevToken.uri,this.currentToken.uri))){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||!U(n,25))return this.popStack(),!1;this.macroStart=!0;let i=new ft(oe(n)),s=this.isFunctionDefinition()||this.processCIdentifier(this.macros,!0);if(!s)return this._issues.push(W(30,i.firstToken,i.lastToken,i)),this.mergeStack(),this.macroStart=!1,!0;let o=this.consumeDefinitionContent(),a;o.length&&(a=new Bf(oe(o[0],o.at(-1)),o));let c=new Mc(i,s,a);this.macros.set(c.name,{macro:c,resolver:Ww(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||!U(n,28))return this.popStack(),!1;this.macroStart=!0;let i=new ft(oe(n)),s=this.processCIdentifier(this.macros,!0);if(!s)return this._issues.push(W(30,i.firstToken,i.lastToken,i)),this.mergeStack(),this.macroStart=!1,!0;let o=new Mc(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||!U(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(!U(n,42)||!Ft(r.lastToken,n)){this.popStack();return}let i=[],s=this.processCIdentifier(this.macros,!0)||this.processVariadic();for(;s;)i.push(s),!U(this.currentToken,24)&&!U(this.currentToken,43)?this._issues.push(W(28,s.firstToken,s.lastToken,s)):U(this.currentToken,43)||(n=this.moveToNextToken),s=this.processCIdentifier(this.macros,!0)||this.processVariadic();let o=new di(r,i);if(U(this.currentToken,43))n=this.moveToNextToken,o.lastToken=n;else{o.lastToken=this.prevToken;let a=i.at(-1)??o;this._issues.push(W(26,a.firstToken,a.lastToken,a))}return this.mergeStack(),o}processVariadic(){this.enqueueToStack();let r=this.checkConcurrentTokens([xe(45),xe(45),xe(45)]);if(r.length!==3){this.popStack();return}let n=new aa(oe(r[0],r.at(-1)));return this.mergeStack(),n}processIfDefBlocks(){let r=this.peekIndex(),n=this.parseScopedBlock(a=>!!a&&[33,34,32].some(c=>U(a,c))&&!Qr(a.prevToken,a),a=>!!a&&[37].some(c=>U(a,c))&&!Qr(a.prevToken,a),a=>!!a&&[36,35].some(c=>U(a,c))&&!Qr(a.prevToken,a));if(!n)return;let i;U(n.startToken,32)?i=this.processIfBlock(n,(a,c,l)=>new Ff(a,c??null,l)):i=this.processIfDefBlock(n,(a,c,l)=>U(n.startToken,33)?new Lc(a,c??null,l):new jf(a,c??null,l)),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=>bf(c,a.range))&&(a.disabled=!0)}),[...i instanceof bn?i.ifBlocks:[i.ifDef],...i.elseOption?[i.elseOption]:[]].forEach(a=>{!a.active&&a.content&&this._issues.push(W(47,a.content.firstToken,a.content.lastToken,a.content,{severity:$c.DiagnosticSeverity.Hint,tags:[$c.DiagnosticTag.Unnecessary]}))}),this.positionStack[this.positionStack.length-1]=r}processIfDefBlock(r,n){this.enqueueToStack(),this.macroStart=!0;let i=new ft(oe(r.startToken));r.splitTokens[0].rewind();let s=this.processCIdentifier(this.macros,!0);s||this._issues.push(W(31,i.firstToken,i.lastToken,i)),this.macroStart=!1;let o,a=r.splitTokens[0].tokens.indexOf(s?.lastToken??i.lastToken)+1,c=r.splitTokens[0].tokens[a];a&&c&&(o=new Zs(oe(c,r.splitTokens[0].tokens.at(-1))));let l=n(i,s??null,o??null),u;if(r.splitTokens.length>1){let p=r.separatorTokens[0],m=new ft(oe(p)),h;r.splitTokens[1].tokens.length&&(h=new Zs(oe(r.splitTokens[1].tokens[0],r.splitTokens[1].tokens.at(-1)))),u=new qc(m,h??null)}let d;r.endToken?d=new ft(oe(r.endToken)):this._issues.push(W(46,i.firstToken,i.lastToken,i));let f=new Vn(l,d??null,u);return this.mergeStack(),f}processIfBlock(r,n){this.enqueueToStack();let i=new ft(oe(r.startToken)),s=[],o;r.splitTokens.forEach((l,u)=>{l.rewind();let d=this.prevToken,f=new ft(oe(d));this.macroStart=!0;let p=this.processExpression(this.macros,f,!0)||this.processCIdentifier(this.macros,!0);if(p instanceof pt&&p.name.toLowerCase()==="defined"&&(p=this.processExpression(this.macros,f,!0)||this.processCIdentifier(this.macros,!0)),this.macroStart=!1,u===r.splitTokens.length-1&&U(d,36)){let h=d,T=new ft(oe(h)),b;l.tokens.length&&(b=new Zs(oe(l.tokens[0],l.tokens.at(-1)))),o=new qc(T,b??null)}else{p||this._issues.push(W(31,i.firstToken,i.lastToken,i));let h,T=r.splitTokens[0].tokens.indexOf(p?.lastToken??i.lastToken)+1,b=r.splitTokens[0].tokens[T];T&&b&&(h=new Zs(oe(b,r.splitTokens[u].tokens.at(-1))));let _=n(f,p??null,h??null);s.push(_)}});let a;r.endToken?a=new ft(oe(r.endToken)):this._issues.push(W(46,i.firstToken,i.lastToken,i));let c=new bn(s,a??null,o);return this.mergeStack(),c}get allAstItems(){return[...this.dtsIncludes,...this.nodes,...this.comments]}resolveInclude(r){if(r.path.path)return r.path.relative?[(0,ca.resolve)((0,ca.dirname)(r.uri),r.path.path),...this.incudes.map(n=>(0,ca.resolve)(n,r.path.path))].find(n=>(0,bT.existsSync)(n)):this.incudes.map(n=>(0,ca.resolve)(n,r.path.path)).find(n=>(0,bT.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(U(n,26))this.moveToNextToken;else{let h=this.checkConcurrentTokens([xe(13),rt("include"),xe(13)]);if(h.length!==3)return this.popStack(),!1;i=h[0],s=h.at(-1)}let o=i,a=new ft(oe(i,s));n=this.moveToNextToken;let c=n,l=!!U(n,21);if(!c||!l&&!U(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&&!U(this.currentToken,4);)u+=this.currentToken?.value??"",n=this.moveToNextToken;let d=new oa(u,l,oe(c,n)),f=new ui(a,d);this.dtsIncludes.push(f),l||(this.currentToken?.pos.line!==o.pos.line||!U(this.currentToken,4)?this._issues.push(W(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(W(36,f.path.firstToken,f.path.lastToken,f.path,{severity:$c.DiagnosticSeverity.Warning})),m&&!this.optimizeForFormatting){tn().requestTokens(m,!0);let h=Bc().getCPreprocessorParser(m,this.incudes,this.macros,this.uri);await h.stable,this._issues.push(...h.issues),this.macros.clear(),Array.from(h.macros).forEach(([T,b])=>this.macros.set(T,b)),m.endsWith(".h")?this.addTokensToClean({start:r,count:p-r}):(this.tokens.splice(r,p-r,...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 ST,Uf=class{constructor(){this.headerFiles=new Map;this.includeOwners=new WeakMap}getCPreprocessorParser(e,r,n,i){e=st(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 la(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=st(e);let r=this.headerFiles.get(e);r&&Array.from(r).forEach(n=>{n[1]&&(console.log("disposing c-preprocessor cache for",e),Array.from(this.includeOwners.get(n[1])??[]).forEach(this.reset.bind(this)),this.headerFiles.delete(e))})}};function Bc(){return ST??=new Uf,ST}function YC(){ST=new Uf}var _T,Hf=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,uri:o.uri,prevToken:i,nextToken:void 0};i&&(i.nextToken=a),n[s]=a,i=a}return n}needsRenew(e,r){return e=st(e),this.fileMap.get(e)?.text!==r}getDocument(e,r){return hn.create(e,"devicetree",0,r??this.fileMap.get(e)?.text??(0,Fc.readFileSync)(e).toString())}renewLexer(e,r){if(e=st(e),Bc().reset(e),!r&&!(0,Fc.existsSync)(e))return[];try{r??=(0,Fc.readFileSync)(e).toString();let n=new li(r,e);return this.fileMap.set(e,n),t.clone(n.tokens)}catch{}return[]}requestTokens(e,r){e=st(e);let n=this.fileMap.get(e)?.tokens;return!n&&r?[...this.renewLexer(e)]:t.clone(n??[])}reset(e){e=st(e),Bc().reset(e),this.fileMap.delete(e)}};function tn(){return _T??=new Hf,_T}function XC(){_T=new Hf}var fi=class t{constructor(e){this.context=e;this.comments=[];this.includes=[];this.roots=[];this.references=[];this.unlinkedDeletes=[];this.unlinkedRefNodes=[];this.globalDeletes=[];this.rootNode=new X(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.roots,...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 i=this.fileTopMostAsts(e).find(s=>kr(s,e,r)||Vw(tn().requestTokens(e,!1),s,r));if(i instanceof fr){let o=this.rootNode.getReferenceBy(i)?.getDeepestAstNode(e,r);return o?{...o,runtime:this}:{item:null,runtime:this,ast:jn(i,e,r)}}else if(i instanceof It&&i.path){let s=this.rootNode.getDeepestAstNode(e,r);return s?{...s,runtime:this}:void 0}else if(i instanceof Xe&&i.path){let s=t.getNodeFromPath(i.path.slice(1),this.rootNode)?.getDeepestAstNode(e,r);return s?{...s,runtime:this}:void 0}else if(i)return{runtime:this,item:null,ast:jn(i,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 We)?.lastLinkedTo?.path)}get issues(){return this.issuesCache??=[...this.labelIssues(),...this.rootNode.getIssues(this.context.macros)],this.issuesCache}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 X);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 zw([...e.definitions,...e.referencedBy],this.context)}};var jc=$(j());var JC=$(j());var Vf=class extends Q{constructor(r){super();this.values=r;this.docSymbolsMeta={name:"Values",kind:JC.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 QC=$(j());var zf=class extends Q{constructor(r){super();this.keyword=r;this.addChild(r),this.docSymbolsMeta={name:"DTS Document version",kind:QC.SymbolKind.Function}}};var pi=class extends Q{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 ZC=$(j());var Wf=class extends Q{constructor(r,n,i){super();this.keyword=r;this.startAddress=n;this.endAddress=i;this.addChild(r),this.docSymbolsMeta={name:"Memreserve",kind:ZC.SymbolKind.Function},this.addChild(n),this.addChild(i)}toString(){return`/memreserve/ 0x${this.startAddress?.value?.toString(16)} 0x${this.endAddress?.value?.toString(16)}`}};var eD=$(j());var Gf=class extends Q{constructor(r,n){super();this.keyword=r;this.bitsSize=n;this.addChild(r),this.docSymbolsMeta={name:"bits",kind:eD.SymbolKind.Function},this.addChild(n)}toString(){return`/bits/ ${this.bitsSize?.value?.toString()}`}};var xi=class extends Mi{constructor(r,n,i,s,o){super();this.uri=r;this.incudes=n;this.tokens=[];this.others=[];this.rootDocument=new We;this.unhandledStatements=new It;this.injectedMacros=[];this.cPreprocessorParser=new la(this.uri,this.incudes,i,s,o)}get issues(){return[...this._issues,...this.cPreprocessorParser.issues]}getFiles(){return[this.uri,...this.cPreprocessorParser.dtsIncludes.flatMap(r=>r.resolvedPath).filter(r=>!!r)]}reset(){super.reset(),this.others=[],this.rootDocument=new We,this._issues=[],this.unhandledStatements=new It}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,st(this.uri).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(W(22,s,s,null)),this.reportExtraEndStatements())}};for(;!this.done;)await r();this.uri.endsWith(".dtsi")||(this.unhandledStatements.nodes.forEach(s=>{this._issues.push(W(53,s.firstToken,s.lastToken,s))}),this.unhandledStatements.properties.forEach(s=>{this._issues.push(W(32,s.firstToken,s.lastToken,s))}),this.unhandledStatements.deleteProperties.forEach(s=>{this._issues.push(W(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 We||s instanceof Ye)&&Jw(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=rT(s);let o=`${n.uri}${Sf}${n.firstToken.pos.line}:${n.firstToken.pos.col}-${n.lastToken.pos.line}:${n.firstToken.pos.col}`,a=new Set;if(this.cPreprocessorParser.comments.forEach(l=>{kr(n,n.uri,l.range.start)&&a.add(l)}),this.cPreprocessorParser.removeComments(a),this.injectedMacros.push(n),n instanceof pt&&s.includes(n.name)||n instanceof mn&&s.includes(n.functionName.name))return!0;let c=new li(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||!U(n,13))return this.popStack(),!1;if(i=this.moveToNextToken,!i||!U(i,2))return this.popStack(),!1;let s=new It;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(U(n,3))this.moveToNextToken;else{let i=this.prevToken;return i&&this._issues.push(W(3,i,i,r)),this.endStatement(r,!1)}return this.prevToken?.value==="}"&&(r.closeScope=this.prevToken),this.endStatement(r)}isNodeEnd(){return U(this.currentToken,3)||U(this.currentToken,1)}endStatement(r,n=!0){let i=this.currentToken;if(!U(i,1)){let s=this.prevToken;if(s&&n)return this._issues.push(W(1,s,s,r)),s}return this.moveToNextToken,this.reportExtraEndStatements(),i}reportExtraEndStatements(){for(;U(this.currentToken,1);){let r=this.moveToNextToken;r&&this._issues.push(W(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(W(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 fr(s):new Xe(s,i);if(n==="Ref"?(this.enqueueToStack(),a=this.processNodePathRef(c),!a||!U(this.currentToken,2)?(this.popStack(),a=void 0):this.mergeStack(),a??=this.isLabelRef(c)):n==="Name"&&(o=this.isNodeName()),!a&&!o){if(!U(this.currentToken,2))return this.popStack(),!1;c.firstToken=this.currentToken,this._issues.push(W(n==="Name"?[7]:[10,48,11],c.firstToken,this.currentToken?.nextToken,c))}let l=!1;if(a&&c instanceof fr?(c.reference=a,l=!0):o&&c instanceof Xe&&(l=o.address!==void 0,c.name=o),U(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(W(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([rt("0"),rt("x",{caseInsensitive:!0})]);i.length!==2?(i=[],this.popStack()):(this._issues.push(W(50,i[0],i[1],r,{severity:jc.DiagnosticSeverity.Warning})),n=i.at(-1),this.mergeStack());let s=this.consumeAnyConcurrentTokens([19,20,48].map(xe)),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(W(8,n,n,r)):!Number.isNaN(a)&&!Ft(n,s[0])&&this._issues.push(W(29,n,s[0],r,{inclusiveStart:!1,inclusiveEnd:!1}))),this.currentToken?.value.toUpperCase()==="ULL"&&(this._issues.push(W(51,this.currentToken,this.currentToken,r,{severity:jc.DiagnosticSeverity.Warning})),this.moveToNextToken),new Pc(a,oe(i.at(0)??s[0]??this.prevToken,this.prevToken))}processNodeAddresses(r){this.enqueueToStack();let n=this.checkConcurrentTokens([xe(49)]);if(n.length){Ft(r.lastToken,n[0])||this._issues.push(W(29,r.lastToken,n[0],r,{inclusiveStart:!1,inclusiveEnd:!1}));let i=[],s=()=>{i.push(this.processNodeAddress(r)),U(this.currentToken,24)&&(this.prevToken&&!Ft(this.prevToken,this.currentToken)&&this._issues.push(W(29,this.prevToken,this.currentToken,r,{inclusiveStart:!1,inclusiveEnd:!1})),this.moveToNextToken,s())};s();let o=this.currentToken;for(;!U(this.currentToken,2)&&!U(this.currentToken,1)&&!U(this.currentToken,3)&&!U(this.currentToken,13)&&Qr(this.currentToken,i.at(-1)?.lastToken);)this.moveToNextToken;if(o&&o!==this.currentToken){this._issues.push(W(52,o,this.currentToken,r));let a=new Pc([],oe(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(xe));if(!r.length){this.popStack();return}let n=r.map(o=>o.value).join(""),i=new Me(n,oe(r[0],r.at(-1))),s=this.processNodeAddresses(i);return i.address=s,Nf(n)||this._issues.push(W(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(xe));if(!r.length){this.popStack();return}let n=new tt(r.map(i=>i.value).join(""),oe(r[0],r.at(-1)));return this.mergeStack(),n}isLabelName(){this.enqueueToStack();let r=this.consumeAnyConcurrentTokens([19,47,48].map(xe));if(!r.length){this.popStack();return}if(!Nf(r?.[0].value)){this.popStack();return}let n=r.map(s=>s.value).join(""),i=new rr(n,oe(r[0],r[r.length-1]));return this.mergeStack(),i}isLabelAssign(r){this.enqueueToStack();let n=this.consumeAnyConcurrentTokens([19,47,48].map(xe));if(!n.length){this.popStack();return}if(!Nf(n?.[0].value)){this.popStack();return}let i=n.map(c=>c.value).join(""),s=this.currentToken,o=s&&U(s,50),a=new us(new rr(i,oe(n[0],n.at(-1))),oe(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(W(29,c,s,a,{inclusiveStart:!1,inclusiveEnd:!1})),this.moveToNextToken}else if(r)this._issues.push(W(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(U(this.currentToken,2)||U(this.currentToken,49))return this.popStack(),!1;let s=new Ye(i,n),o;U(this.currentToken,0)?(s.assignOperatorToken=this.moveToNextToken,o=this.processValue(r),o?.values.filter(c=>!!c).length||this._issues.push(W(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([xe(13),rt("d"),rt("ts"),xe(16),rt("v"),rt("1")]);if(r.length!==6)return this.popStack(),!1;let n=r[0],i=n,s=new ft;s.firstToken=n;let o=new zf(s);if(this.others.push(o),U(this.currentToken,13))i=this.moveToNextToken;else return s.lastToken=r.at(-1),this._issues.push(W(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([xe(13),rt("memreserve")]);if(r.length!==2)return this.popStack(),!1;let n=new ft;n.firstToken=r[0];let s=r[0];U(this.currentToken,13)?(s=this.moveToNextToken,n.lastToken=s):(n.lastToken=r.at(-1),this._issues.push(W(21,n.firstToken,n.lastToken,n)));let o=this.processHex()||this.processDec(),a=o&&(this.processHex()||this.processDec()),c=new Wf(n,o,a);if(this.others.push(c),o||this._issues.push(W(37,n.firstToken,n.lastToken,n)),!a){let l=o??n;this._issues.push(W(38,l.firstToken,l.lastToken,c))}return c.lastToken=this.endStatement(c),this.mergeStack(),!0}isPlugin(){this.enqueueToStack();let r=this.checkConcurrentTokens([xe(13),rt("plugin"),xe(13)]);if(r.length!==3)return this.popStack(),!1;let n=new ft(oe(r[0],r.at(-1)));return n.lastToken=this.endStatement(n),this.mergeStack(),this.others.push(n),!0}processBits(){this.enqueueToStack();let r=this.checkConcurrentTokens([xe(13),rt("b"),rt("its")]);if(r.length!==3){this.popStack();return}let n=new ft;n.firstToken=r[0];let s=r[0];U(this.currentToken,13)?(s=this.moveToNextToken,n.lastToken=s):(n.lastToken=r.at(-1),this._issues.push(W(21,n.firstToken,n.lastToken,n)));let o=this.processDec(),a=new Gf(n,o);return this.others.push(a),o?o.value!==8&&o.value!==16&&o.value!==32&&o.value!==64&&this._issues.push(W(40,o.firstToken,o.lastToken,o)):this._issues.push(W(39,n.firstToken,n.lastToken,n)),this._issues.push(W(41,a.firstToken,a.lastToken,a,{severity:jc.DiagnosticSeverity.Warning})),this.mergeStack(),a}isOmitIfNoRefNode(){this.enqueueToStack();let r=this.checkConcurrentTokens([xe(13),rt("omit"),xe(16),rt("if"),xe(16),rt("no"),xe(16),rt("ref"),xe(13)]);if(r.length!==9){this.popStack();return}let n=new ft(oe(r[0],r.at(-1)));return this.mergeStack(),n}isDeleteNode(r,n){this.enqueueToStack();let i=this.checkConcurrentTokens([xe(13),rt("d"),rt("e"),rt("lete",{allowPartial:!0}),xe(16),rt("node",{allowPartial:!0})]);if(!i.length)return this.popStack(),!1;let s=i[0],o=s,a=new ft;if(a.firstToken=s,i.length===1&&!U(this.currentToken,2)){this._issues.push(W(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(W(c.startsWith("/delete-n")?34:25,a.firstToken,a.lastToken,a)):U(this.currentToken,13)?(o=this.moveToNextToken,a.lastToken=o):this._issues.push(W(21,a.firstToken,a.lastToken,a));let l=new qr(a);if(Qr(a.lastToken,s)){let d=this.processNodePathRef(r);d&&n==="Name"&&this._issues.push(W(7,d.firstToken,d.lastToken,d));let f=d?void 0:this.isLabelRef(r);f&&n==="Name"&&this._issues.push(W(7,f.firstToken,f.lastToken,f));let p=d||f?void 0:this.isNodeName();p&&n==="Ref"&&this._issues.push(W(10,p.firstToken,p.lastToken,p)),!d&&!p&&!f&&this._issues.push(W([7,10],l.firstToken,l.lastToken,l)),l.nodeNameOrRef=d??f??p??null}else n==="Name"?this._issues.push(W(7,a.firstToken,a.lastToken,a)):n==="Ref"&&this._issues.push(W(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([xe(13),rt("d"),rt("e"),rt("lete",{allowPartial:!0}),xe(16),rt("property",{allowPartial:!0})]);if(!n.length)return this.popStack(),!1;let i=n[0],s=i,o=new ft;if(o.firstToken=i,n.length===1&&!U(this.currentToken,2)){this._issues.push(W(25,o.firstToken,o.lastToken,o)),o.lastToken=n.at(-1);let u=new gt(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(W(a.startsWith("/delete-p")?35:25,o.firstToken,o.lastToken,o)):U(this.currentToken,13)?(s=this.moveToNextToken,o.lastToken=s):this._issues.push(W(21,o.firstToken,o.lastToken,o));let c=new gt(o);if(Qr(o.lastToken,i)){let u=this.isPropertyName();u||this._issues.push(W(6,c.firstToken,c.lastToken,c)),c.propertyName=u??null}else this._issues.push(W(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 Nr(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(;!U(this.currentToken,1);){let l=this.prevToken,u=this.currentToken,d,f=U(this.currentToken,24);if(f)d=this.currentToken,this.moveToNextToken;else if(!Qr(this.prevToken,this.currentToken))break;let p=o();if(u&&p===null&&f){let h=new Q(oe(u,this.currentToken));this._issues.push(W(0,h.firstToken,h.lastToken,h))}if(!f&&p===null)break;if(l&&!f&&p){let h=new Q(oe(l));this._issues.push(W(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 Vf(i)}processStringValue(){this.enqueueToStack();let r=this.processOptionalLabelAssign(!0),n=this.consumeAnyConcurrentTokens([xe(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(`
|
|
277
|
+
`),s=i,o=['"',"'"].some(u=>s.endsWith(u));o&&(s=s.slice(1,-1));let a=new ne(s,oe(n[0],n.at(-1)));o||this._issues.push(W(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 Nr(r,a,c);return this.mergeStack(),l}arrayValues(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!0),i=this.processBits(),s=this.currentToken;if(U(s,5))this.moveToNextToken;else{this.popStack();return}let o=this.processArrayValues(r)??null;o.openBracket=s;let a=this.processOptionalLabelAssign(!0)??[],c=new Nr(n,o,a,i);if(!U(this.currentToken,4))this._issues.push(W(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(!U(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(W(15,u.firstToken,u.lastToken,u))});let a=new Xr(s??[]);a.openBracket=i,a.values.length===0&&(a.firstToken=n,this._issues.push(W(14,a.firstToken,a.lastToken,a,{severity:jc.DiagnosticSeverity.Information})));let c=new Nr(r,a,o);U(this.currentToken,12)?a.closeBracket=this.moveToNextToken:this._issues.push(W(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 mn&&a.value.params.every(c=>!!c)&&this.cPreprocessorParser.macros.has(a.value.functionName.name)||a.value instanceof pt&&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 Nt(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 pi(i,n);return this.mergeStack(),s}processHexString(){this.enqueueToStack();let r=this.processOptionalLabelAssign(!1),n=this.checkConcurrentTokens([20,20].map(xe));if(!n.length){this.popStack();return}let i=Number.parseInt(n.map(a=>a.value).join(""),16),s=new Kt(i,oe(n[0],n.at(-1)),16),o=new pi(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 pi(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 pi(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 Nr(n,i,s);return this.mergeStack(),o}isLabelRef(r){this.enqueueToStack();let n=this.currentToken;if(!n||!U(n,40)){this.popStack();return}else this.moveToNextToken;let i=this.isLabelName();if(!i){let o=new ie(null);return this._issues.push(W(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(W(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 Nr(n,i,s);return this.mergeStack(),o}processRefValue(r,n){this.enqueueToStack();let i=this.processOptionalLabelAssign(n),s=this.currentToken;if(!s||!U(s,40)){this.popStack();return}let o=this.processNodePathRef(r);if(o!==void 0){let l=new pi(o,i);return this.mergeStack(),l}let a=this.isLabelRef(r);if(a===void 0){this._issues.push(W([18,9],s,s,r));let l=new pi(null,i);return l.firstToken=i.at(0)?.firstToken??s,this.mergeStack(),l}let c=new pi(a,i);return c.firstToken=i.at(0)?.firstToken??s,this.mergeStack(),c}processNodePath(r=!0,n=new Un){this.enqueueToStack();let i;if(U(this.currentToken,13))i=this.moveToNextToken;else{if(!r){this.popStack();return}this.prevToken&&this._issues.push(W(19,this.prevToken,this.prevToken,n))}let s=this.isNodeName(),o=i??this.prevToken;if(!s&&o&&!r&&this._issues.push(W(7,o,o,n)),!r||s?n.addPath(s??null,i?new Q(oe(i)):void 0):r&&!s&&i&&(n.addPath(new Me("/",oe(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(!U(i,40)){this.popStack();return}let s=this.moveToNextToken;if(i=s,!U(i,2)){this.popStack();return}n&&!Ft(n,s)&&this._issues.push(W(29,n,s,r,{inclusiveStart:!1,inclusiveEnd:!1}));let o=this.processNodePath(),a=new ot(o??null),c=this.currentToken??this.prevToken,l=c;return o?.children.forEach((u,d)=>{if(d===o?.children.length-1&&u&&l&&!Ft(u.lastToken,l)){this._issues.push(W(29,u.lastToken,l,r,{inclusiveStart:!1,inclusiveEnd:!1}));return}if(d===0&&s&&!Ft(s,u?.firstToken)){this._issues.push(W(29,s,u?.firstToken,r,{inclusiveStart:!1,inclusiveEnd:!1}));return}let f=o?.children[d+1];u&&f&&!Ft(u.lastToken,f.firstToken)&&this._issues.push(W(29,u.lastToken,f?.firstToken,r,{inclusiveStart:!1,inclusiveEnd:!1}))}),U(c,3)?this.moveToNextToken:this.prevToken&&this._issues.push(W(3,this.prevToken,this.prevToken,r)),a.firstToken=n,a.lastToken=c??this.prevToken,this.mergeStack(),a}get includes(){return this.allAstItems.filter(r=>r instanceof ui)}get allAstItems(){return[...this.cPreprocessorParser.allAstItems,...this.rootDocument.children,...this.others,...this.unhandledStatements.properties,...this.unhandledStatements.deleteProperties,...this.unhandledStatements.nodes]}buildSemanticTokens(r,n){let i=[];this.injectedMacros.forEach(s=>{s.buildSemanticTokens((...o)=>Mi.push(...o,n,i))}),super.buildSemanticTokens(r,n,i)}};var Kf=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.staleUri=new Set;let i={includePaths:[],overlays:[],zephyrBindings:[],deviceOrgTreeBindings:[],deviceOrgBindingsMetaSchema:[],...e,ctxName:e.ctxName??(0,tD.basename)(e.dtsFile),lockRenameEdits:[],showFormattingErrorAsDiagnostics:e.showFormattingErrorAsDiagnostics??!0};this.isFullContext=this.settings.dtsFile.toLowerCase().endsWith(".dts"),this.overlays=i.overlays,this.overlays.filter(Uc.existsSync),this.parser=new xi(i.dtsFile,i.includePaths),this.ctxNames_.add(i.ctxName),this.id=Oi(i),this.parser.stable.then(()=>{this.overlayParsers=this.overlays?.map(s=>new xi(s,i.includePaths,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]}async getFileTree(){let e=new Map,r=i=>({file:i,includes:(e.get(i)??[]).map(s=>r(s.resolvedPath??s.path))});return(await this.getRuntime()).includes.forEach(i=>{let s=e.get(i.uri);s||(s=[],e.set(i.uri,s)),s.push({path:i.path.path,resolvedPath:i.resolvedPath})}),{mainDtsPath:r(this.parser.uri),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=>pe(r,e))}getUriParser(e){let r=this.overlayParsers.find(n=>n.getFiles().some(i=>pe(i,e)));return r??=this.parser.getFiles().some(n=>pe(n,e))?this.parser:void 0,r}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=>pe(s.ast.uri,e)&&(!r||kr(s.ast,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?{range:fe(o.value),target:ue(c.bindingsPath)}:void 0})).filter(s=>s)??[];return[...this.parser.cPreprocessorParser.dtsIncludes.filter(s=>pe(s.uri,e)&&(!r||kr(s,e,r))).map(s=>{let o=this.parser.cPreprocessorParser.resolveInclude(s);if(o)return{range:fe(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]}))}else o instanceof Un&&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("/")}`]}))),c?.linkedNodeNamePaths.push(a),n=c}else break}}setStaleUri(e){this.staleUri.add(e)}async reevaluate(e){this.setStaleUri(e);let r=new Set;return this.staleUri.forEach(n=>{let i=this.getUriParser(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){if(e)return this.sortKeys.get(e.firstToken)}async evaluate(){let e=performance.now();await this.stable();let r=new fi(this);this.staleUri.clear(),this._issues=[],this.parser.rootDocument.resetIssues(),this.processRoot(this.parser.rootDocument,r);for(let n=0;n<this.overlayParsers.length;n++)this.overlayParsers[n].rootDocument.resetIssues(),this.processRoot(this.overlayParsers[n].rootDocument,r);return r.includes=this.parser.includes,r.comments=this.parser.cPreprocessorParser.allAstItems.filter(n=>n instanceof en),(await this.getAllStableParsers()).flatMap(n=>n.tokens).forEach((n,i)=>this.sortKeys.set(n,i)),this.linkPropertiesLabelsAndNodePaths(r),this.reportNodeNameAndPropertyClashes(r),console.log(`(ID: ${this.id}) evaluate`,performance.now()-e),r}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[o.definitions.length-1].name;this._issues.push(Bt(2,a.firstToken,a.lastToken,a,{linkedTo:[i.ast,...i.allReplaced.map(c=>c.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 We?this.processDtcBaseNode(e,r,n):e instanceof Ye?this.processDtcProperty(e,r,n):e instanceof qr?this.processDeleteNode(e,r,n):e instanceof gt&&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||gn(c.address??[],a.fullAddress??[])===0)).map(c=>c.issueAst),i=r.nodes.map(o=>({name:o.name,address:o.address,issueAst:o.definitions[0].name??o.definitions[0]})),s=[];e.children.forEach(o=>{if(o instanceof Xe&&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 Me){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,Uc.existsSync)(this.settings.compileCommands)))return JSON.parse((0,Uc.readFileSync)(this.settings.compileCommands).toString())}processDtcBaseNode(e,r,n){e instanceof It?this.processDtcRootNode(e,n):e instanceof Xe?this.processDtcChildNode(e,r,n):e instanceof fr&&this.processDtcRefNode(e,n)}processDtcRootNode(e,r){r.roots.push(e),r.rootNode.definitions.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 X(this.bindingLoader,e.name.name,e.name.fullAddress,r);o.definitions.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?.referencedBy.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??""]})),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?.referencedBy.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 X(this.bindingLoader,""),r))}processDtcProperty(e,r,n){e.propertyName?.name&&r.addProperty(new Ze(e,r)),e.children.forEach(i=>this.processChild(i,r,n))}processDeleteNode(e,r,n){if(e.nodeNameOrRef instanceof Me&&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 We&&!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]})))}else if(e.nodeNameOrRef instanceof ot&&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("/")}`]}))),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 We&&!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===eo.DiagnosticSeverity.Hint&&i.raw.virtual))return i.raw.severity===eo.DiagnosticSeverity.Error&&!this.isFullContext&&(i.raw.severity=eo.DiagnosticSeverity.Warning),i}){return e.forEach(i=>{let s=n(i);s&&t.#e(s.diagnostic(),s.raw.uri,r)}),r}async getSyntaxIssues(e=new Map,r=n=>{if(n.raw.severity===eo.DiagnosticSeverity.Error&&!this.isFullContext&&!Xs(n.raw,n.raw.uri,!1)&&(n.raw.severity=eo.DiagnosticSeverity.Warning),!(n.raw.severity===eo.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/;
|
|
278
|
+
${(await this.getRuntime()).rootNode.toFullString((await this.getAllStableParsers()).at(-1).cPreprocessorParser.macros,this.settings.cwd)}`}async serialize(){return await this.stable,await this.getDiagnostics(),(await this?.getRuntime())?.rootNode.serialize((await this.getAllStableParsers()).at(-1).cPreprocessorParser.macros)}};var rD=require("fs"),ua=require("path"),Mt=$(j());function kU(t){if(!t||!(t.ast instanceof oa))return[];let e=n=>n.flatMap(i=>{try{return(0,rD.readdirSync)(i,{withFileTypes:!0,recursive:!0}).filter(s=>s.name.toLowerCase().endsWith(".dtsi")||s.name.toLowerCase().endsWith(".h")).map(s=>({label:`${(0,ua.join)((0,ua.relative)(i,s.parentPath),s.name)}`,kind:Mt.CompletionItemKind.File}))}catch{return[]}});if(t.ast.relative)return e([(0,ua.dirname)(t.ast.uri)]);let r=t.runtime.context.settings.includePaths??[];return e(r)}var Yf=(t,e)=>[...t.labels.filter(e),...t.deletedNodes.filter(r=>!e(r.by)).flatMap(r=>Yf(r.node,e)),...t.nodes.flatMap(r=>Yf(r,e))],kT=(t,e)=>[...t.labels,...t.deletedNodes.filter(r=>!e(r.by)).flatMap(r=>kT(r.node,e)),...t.nodes.flatMap(r=>kT(r,e))];function NU(t,e){if(!t||!(t.item instanceof Ze)||!(t.ast instanceof ie))return[];let r=i=>kT(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:Mt.CompletionItemKind.Method,documentation:i.lastLinkedTo?.toMarkupContent(t.runtime.context.macros)}))}function RU(t,e){if(!t||t.item!==null||!(t.ast instanceof ie)||!(t.ast.parentNode instanceof fr))return[];let r=n=>Yf(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} {
|
|
290
279
|
$1
|
|
291
|
-
};`,kind:Ot.CompletionItemKind.Value,insertTextFormat:Ot.InsertTextFormat.Snippet}))]}function GU(t,e){let r=s=>s?s.parentNode instanceof dr||s.parentNode instanceof It||s.parentNode instanceof Ke?!1:r(s.parentNode):!0;if(!t||t.item!==null||!Vt(t.ast)||!r(t.ast))return[];let n=s=>Jf(s,e).filter(o=>e(o));if(t.ast instanceof pt)return n(t.runtime.rootNode).length?[{label:"/delete-node/",insertText:"/delete-node/ $1;",kind:Ot.CompletionItemKind.Keyword,insertTextFormat:Ot.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:Ot.CompletionItemKind.Keyword,insertTextFormat:Ot.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:Ot.CompletionItemKind.Variable,documentation:s.lastLinkedTo?.toMarkupContent(t.runtime.context.macros)}))}function KU(t,e){if(!t||!(t.item instanceof J)||t.item===null||t.beforeAst&&(!(t.beforeAst?.parentNode instanceof Sr)||t.beforeAst?.parentNode instanceof yt))return[];let r=n=>[...n.nodes,...n.deletedNodes.filter(i=>!e(i.by)).map(i=>i.node)].flatMap(i=>({node:i,astNodes:i.definitions.filter(s=>s instanceof Ke)})).filter(i=>i.astNodes.some(e));return t.ast instanceof xe||t.ast instanceof xr||t.beforeAst?.parentNode instanceof xr?r(t.item).map(n=>({label:`${n.astNodes.at(0)?.name?.toString()}`,kind:Ot.CompletionItemKind.Variable,documentation:n.node.toMarkupContent(t.runtime.context.macros)})):r(t.item).length?[{label:"/delete-node/",insertText:"/delete-node/ $1;",kind:Ot.CompletionItemKind.Keyword,insertTextFormat:Ot.InsertTextFormat.Snippet,sortText:"~",command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:[]}function YU(t,e){if(!t||!(t.item instanceof J)||t.beforeAst&&(!(t.beforeAst?.parentNode instanceof Sr)||t.beforeAst?.parentNode instanceof xr))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 tt||t.ast instanceof yt||t.beforeAst?.parentNode instanceof yt){let n=new Map;return r(t.item).forEach(i=>n.set(i.name,i)),Array.from(n).map(([,i])=>({label:`${i.name}`,kind:Ot.CompletionItemKind.Variable,documentation:i.ast.toPrettyString(t.runtime.context.macros)}))}return r(t.item).length?[{label:"/delete-property/",insertText:"/delete-property/ $1;",kind:Ot.CompletionItemKind.Keyword,sortText:"~",insertTextFormat:Ot.InsertTextFormat.Snippet,command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:[]}function XU(t,e){let r=t?.ast instanceof Fn?t.ast:t?.ast.parentNode;if(!t||!r||!(r instanceof Fn))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=>!Vt(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:Ot.CompletionItemKind.Variable,documentation:o.toMarkupContent(t.runtime.context.macros)}))}function JU(t){return!t||!(t.item instanceof Qe&&t.item.ast.assignOperatorToken)||t.ast instanceof ne?[]:!Ys(t?.ast)&&!(t.ast instanceof Xe&&t.item.ast.values===null)&&!Ys(t.beforeAst)&&!Ys(t.afterAst)?[]:t.item.parent.nodeType instanceof Rt?Array.from([t.runtime.context.parser,...t.runtime.context.overlayParsers].at(-1)?.cPreprocessorParser.macros??[]).map(([,n])=>n.macro.identifier instanceof oi?{label:`${n.macro.identifier.toString()}`,insertText:`${n.macro.name}(${n.macro.identifier.params.map((i,s)=>i instanceof ft?`$${s+1}`:"").join(", ")})`,kind:Ot.CompletionItemKind.Function,sortText:`~${n.macro.name}`,insertTextFormat:Ot.InsertTextFormat.Snippet}:{label:n.macro.identifier.name,kind:Ot.CompletionItemKind.Variable,sortText:`~${n.macro.name}`}):[]}async function cD(t,e){return Nt(t,e,(r,n)=>[...YU(r,n),...KU(r,n),...GU(r,n),...XU(r,n),...WU(r,n),...zU(r,n),...VU(r),...JU(r)])}var Ap=$(U());var uD=require("child_process");var kT=t=>/[A-Za-z0-9_]/.test(t);function QU(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 lD(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 dD(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,T=m,b=h;for(;T<b&&/\s/.test(t[T]);)T++;for(;b>T&&/\s/.test(t[b-1]);)b--;n.push({start:m,end:h,text:t.slice(T,b)}),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 NT(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=dD(i,0,i.length),o={macro:n,args:[]};return o.args=s.map(a=>{let c=NT(a.text);return c.parent=o,c}),o}function Mi(t,e){let r=t.getText(),n=t.offsetAt(e),i=n,s=n;for(;i>0&&kT(r[i-1]);)i--;for(;s<r.length&&kT(r[s]);)s++;if(r[s]==="("){let T=lD(r,s);T!==void 0&&(s=T+1)}let o=r.slice(i,s),a=o.trim().length?NT(o):void 0,c=QU(r,n);if(c===void 0)return a;let l=lD(r,c);if(l===void 0||!(c<n&&n<=l))return a;let u=c,d=u;for(;d>0&&kT(r[d-1]);)d--;let f=r.slice(d,u);if(!f)return a;let p=dD(r,c+1,l),m={macro:f,args:[]};m.args=p.map(T=>{let b=NT(T.text);return b.parent=m,b});let h=-1;for(let T=0;T<p.length;T++){let b=p[T];if(n>=b.start&&n<=b.end){h=T;break}}if(h>=0){let T=m.args[h];return T.argIndexInParent=h,T}return m}function ZU(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 Xr.create(o,u>=0?u:a.length)}}}async function ls(t,e,r,n){let i=fD(t,e,r);if(i)return i;let s=await tH(e,n,Pe(t.uri));if(s)return[s,r]}function fD(t,e,r){if(e.startsWith("DT_"))return;let n=ZU(t,e,r);if(!n)return;let i=Mi(t,n);if(i)return[i,n]}var eH=(t,e)=>new Promise(r=>{let n=(0,uD.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 tH(t,e,r){let n=e.getCompileCommands()?.find(s=>pe(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 eH(s,o.filter(u=>!!u)),c=qn.create(`macros://${n.file}`,"devicetree",0,a),l=fD(c,t,c.positionAt(a.length-1));if(l)return l[0]}catch(s){console.error(s)}}function ee(t){return t.toLowerCase().replace(/[@,-\.]/g,"_")}var Uc=$(U());async function pD({macro:t,context:e}){if(t.macro&&"DT_ALIAS".startsWith(t.macro))return[{label:"DT_ALIAS(...)",insertText:"DT_ALIAS($1)",kind:Uc.CompletionItemKind.Function,insertTextFormat:Uc.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 Fn&&(s=i.pathParts.at(-1)?.linksTo),{label:ee(n.name),kind:Uc.CompletionItemKind.Property,documentation:s?.toMarkupContent(r.context.macros)}})??[]}var Hc=$(U());async function pr(t,e,r){if(!t)return;let i=t?.properties.find(s=>ee(s.name)===e)?.ast.getFlatAstValues();return i?.length===0?!0:i?.map(s=>{if(s instanceof st)return s.path?.pathParts.at(-1)?.linksTo;if(s instanceof ie)return s.linksTo;if(s instanceof ne)return s.value;if(s instanceof Se){let o=s.evaluate(r.macros);return typeof o=="number"?o:s.toString()}})}async function Qf({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?pr(o,s[1].macro,r):void 0}async function hD(t,e){let r=await Qf(t,e);if(typeof r=="boolean")return;let n=r?.at(0);if(r?.length===1&&n instanceof J)return n}async function mD(t,e,r,n){if(r=typeof r=="number"?r:Ce(r),typeof r!="number")return;let i=await pr(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 Zf({document:t,macro:e,context:r,position:n},i){if(!(e.macro!=="DT_PROP_BY_IDX"||e.args?.length!==3))return mD(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro,r)}async function gD(t,e){let r=await Zf(t,e);if(typeof r!="boolean"&&r instanceof J)return r}async function qr(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 ep(t,e,r,n){return qr(await pr(t,e,r.context),r,n)}async function la({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 ep(c,o.macro,{macro:a,document:t,context:r,position:n},i)}async function yD(t,e){let r=await la(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 TD(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 tp(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 TD(n)}async function rp(t,e){let r=(await t.getRuntime()).rootNode.getChild(["/","chosen"]);if(!r)return;let s=r?.properties.find(o=>ee(o.name)===e)?.ast.getFlatAstValues()?.at(0);if(s instanceof ie)return s.linksTo;if(s instanceof st)return s.path?.pathParts.at(-1)?.linksTo}async function np(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 ip(t,e){let r=await e?.getRuntime();if(r){let n=li.getNodeFromPath(["aliases"],r.rootNode,!0),i=n?.properties.find(o=>ee(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 st&&(n=s[0].path?.pathParts.at(-1)?.linksTo),n}}async function sp({macro:t,context:e}){if(!(t.macro!=="DT_ALIAS"||t.args?.length!==1))return ip(t.args[0].macro,e)}async function vD(t,e){return t?.nodes.find(r=>ee(r.name)===e)}async function op({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 vD(s,e.args[1].macro)}var RT=(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=>ee(n)).includes(e)?[r,...RT(r,e)]:RT(r,e));async function bD(t,e){let r=await e?.getRuntime();if(r)return RT(r.rootNode,t)}async function PT({macro:t,context:e}){if(!(t.macro!=="DT_COMPAT_GET_ANY_STATUS_OKAY"||t.args?.length!==1))return bD(t.args[0].macro,e)}async function SD(t){return(await PT(t))?.at(0)}async function _D(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 _D(s)}var wT=(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=>ee(n)).includes(e)?[r,...wT(r,e)]:wT(r,e));async function kD(t,e,r){let n=await r?.getRuntime();if(n)return wT(n.rootNode,e).at(t)}async function cp({macro:t,context:e}){if(t.macro!=="DT_INST"||t.args?.length!==2)return;let r=Ce(t.args[0].macro);if(typeof r=="number")return kD(r,t.args[1].macro,e)}async function ND(t,e){let r=await e?.getRuntime(),n=r?.resolvePath([`&${t.trim()}`]);if(r&&n)return li.getNodeFromPath(n.slice(1),r.rootNode,!0)}async function lp({macro:t,context:e}){if(!(t.macro!=="DT_NODELABEL"||t.args?.length!==1))return ND(t.args[0].macro,e)}async function RD(t){return t?.parent??void 0}async function up({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 RD(s)}var PD=(t,e)=>{if(!e.length)return t;let r=e.splice(0,1)[0],n=t.nodes.find(i=>ee(i.fullName)===r);return n?PD(n,e):void 0};async function dp(t,e){let r=await e?.getRuntime();if(r)return PD(r.rootNode,t)}async function fp({macro:t,context:e}){let r=t.args;if(!(t.macro!=="DT_PATH"||!r?.length))return dp(r.map(n=>n.macro),e)}async function pp({macro:t,context:e}){let r=t.args;if(!(t.macro!=="DT_ROOT"||r?.length))return(await e.getRuntime()).rootNode}async function ua(t,e,r){let n=t?.properties.find(c=>ee(c.name)===e);if(!n)return;let i=n?.ast.quickValues?.at(r),s=n.parent.nodeType;if(Array.isArray(i)||!s||!(s instanceof Rt))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 hp(t,e,r,n,i){return qr(await ua(t,e,r),n,i)}async function mp({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=Ce(s[2].macro);if(typeof a=="number")return await hp(o,s[1].macro,a,{macro:s[3],document:t,context:r,position:n},i)}async function gp({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 hp(o,s[1].macro,0,{macro:s[2],document:t,context:r,position:n},i)}async function us(t,e,r,n,i){let s=t?.properties.find(d=>ee(d.name)===e),o=s?.parent.nodeType;if(!o||!(o instanceof Rt))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 Se){let d=u.evaluate(i.macros);return typeof d!="number"?u.toString():d}}async function da(t,e,r,n,i,s){return qr(await us(t,e,r,n,i.context),i,s)}async function yp({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=Ce(s[2].macro);if(typeof a=="number")return da(o,s[1].macro,a,s[3].macro,{macro:s[4],document:t,context:r,position:n},i)}async function Tp({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 da(o,s[1].macro,s[2].macro,s[3].macro,{macro:s[4],document:t,context:r,position:n},i)}async function ui(t,e,r=0){let n=t?.properties.find(s=>ee(s.name)===e);if(r=typeof r=="number"?r:Ce(r??"0"),typeof r!="number")return;let i=n?.ast.getFlatAstValues()?.at(r);if(i instanceof ie)return i.linksTo;if(i instanceof st)return i.path?.pathParts.at(-1)?.linksTo}async function ds({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 ui(o,s[1].macro,0)}async function di({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 ui(o,s[1].macro,s.at(2)?.macro)}async function wD(t,e,r){let n=t?.properties.find(l=>ee(l.name)===e);if(!n)return;let i=n.parent.nodeType;if(!i||!(i instanceof Rt))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 vp({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 wD(o,s[1].macro,s[2].macro)}async function bp({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 da(o,s[1].macro,0,s[2].macro,{macro:s[3],document:t,context:r,position:n},i)}async function Sp({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 ui(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro);return ep(s,e.args[3].macro,{macro:e.args[4],document:t,context:r,position:n},i)}async function _p(t,e){if(!t)return;let r=t?.properties.find(n=>ee(n.name)===e);return r?.nexusMapsTo.length?r.nexusMapsTo.length:r?.ast.getFlatAstValues()?.length}async function ED(t,e,r,n){if(t)return qr(await _p(t,e),r,n)}async function kp({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?ED(o,s[1].macro,{macro:s[2],document:t,context:r,position:n},i):void 0}async function fa(t,e){if(!t)return;let n=t?.properties.find(i=>ee(i.name)===e)?.ast.getFlatAstValues();if(n?.length===1&&n[0]instanceof ne)return ee(n[0].value)}async function CD(t,e,r,n){if(t)return qr(await fa(t,e),r,n)}async function Np({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 CD(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}async function Rp(t,e){if(!t)return;let n=t?.properties.find(i=>ee(i.name)===e)?.ast.getFlatAstValues();if(n?.length===1&&n[0]instanceof ne)return n[0].value}async function DD(t,e,r,n){if(t)return qr(await Rp(t,e),r,n)}async function Pp({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 DD(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}async function wp(t,e){return(await fa(t,e))?.toUpperCase()}async function AD(t,e,r,n){if(t)return qr(await wp(t,e),r,n)}async function Ep({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 AD(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}function Un(t){return async(e,r)=>{let n=await t(e,r);if(n instanceof J)return n}}async function x({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[tp,np,sp,op,SD,ap,cp,lp,up,fp,ds,di,vp,gD,hD,yD,pp,Un(mp),Un(gp),Un(yp),Un(Tp),Un(bp),Un(Sp),Un(kp),Un(la),Un(Np),Un(Pp),Un(Ep)].reduce((a,c)=>a.then(l=>l||c({macro:t,document:e,context:r,position:n},x)),Promise.resolve(void 0));if(s)return Array.isArray(s)?s.at(0):s;let o=await ls(e,t.macro,n,r);if(o)return x({document:e,macro:o[0],context:r,position:n})}async function ID({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:Hc.CompletionItemKind.Function,insertTextFormat:Hc.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_CHILD"||t.argIndexInParent!==1||!t.parent.args?.length?[]:(await x({document:e,macro:t.parent.args[0],context:r,position:n}))?.nodes.map(s=>({label:ee(s.fullName),kind:Hc.CompletionItemKind.Class,documentation:s.toMarkupContent(r.macros)}))??[]}var Vc=$(U());function OD({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:Vc.CompletionItemKind.Function,insertTextFormat:Vc.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_COMPAT_GET_ANY_STATUS_OKAY"||t.argIndexInParent!==0?[]:e.bindingLoader?.getBindings().map(r=>({label:ee(r),kind:Vc.CompletionItemKind.Property}))??[]}var zc=$(U());function MD({macro:t,context:e}){return t.macro&&"DT_INST".startsWith(t.macro)?[{label:"DT_INST(...)",insertText:"DT_INST($1, $2)",kind:zc.CompletionItemKind.Function,insertTextFormat:zc.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_INST"||t.argIndexInParent!==1?[]:e.bindingLoader?.getBindings().map(r=>({label:ee(r),kind:zc.CompletionItemKind.Property}))??[]}var Wc=$(U());async function xD({macro:t,context:e}){if(t.macro&&"DT_NODELABEL".startsWith(t.macro))return[{label:"DT_NODELABEL(...)",insertText:"DT_NODELABEL($1)",kind:Wc.CompletionItemKind.Function,insertTextFormat:Wc.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:Wc.CompletionItemKind.Property,documentation:n.lastLinkedTo?.toMarkupContent(r.context.macros)}))??[])}var Gc=$(U());async function LD({macro:t,context:e}){return t.macro&&t.macro&&"DT_PATH".startsWith(t.macro)?[{label:"DT_PATH(...)",insertText:"DT_PATH($1)",kind:Gc.CompletionItemKind.Function,insertTextFormat:Gc.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_PATH"||!t.parent.args?.length?[]:(await dp(t.parent.args.slice(0,-1).map(n=>n.macro),e))?.nodes.map(n=>({label:ee(n.fullName),kind:Gc.CompletionItemKind.Class,documentation:n.toMarkupContent(e.macros)}))??[]}var qD=$(U());async function $D({macro:t,context:e}){if(t.macro&&t.macro&&"DT_ROOT".startsWith(t.macro)){let r=await e.getRuntime();return[{label:"DT_ROOT",kind:qD.CompletionItemKind.Class,documentation:r.rootNode.toMarkupContent(r.context.macros)}]}return[]}var Cp=$(U());function BD({macro:t}){return t.macro&&t.macro&&"DT_SAME_NODE".startsWith(t.macro)?[{label:"DT_SAME_NODE(...)",insertText:"DT_SAME_NODE($1, $2)",kind:Cp.CompletionItemKind.Snippet,insertTextFormat:Cp.InsertTextFormat.Snippet}]:[]}var Kc=$(U());async function Q({macro:t,document:e,position:r,context:n},i,s,o,a,c=l=>x({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:Kc.CompletionItemKind.Function,insertTextFormat:Kc.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:ee(d.name),kind:Kc.CompletionItemKind.Property,documentation:d.toPrettyString(n.macros)}))??[]}async function FD(t){return Q(t,"DT_ENUM_HAS_VALUE",1,3)}async function jD(t){return Q(t,"DT_ENUM_HAS_VALUE_BY_IDX",1,4)}async function UD(t){return Q(t,"DT_ENUM_IDX",1,2)}async function HD(t){return Q(t,"DT_ENUM_IDX_BY_IDX",1,3)}async function VD(t){return Q(t,"DT_ENUM_IDX_BY_IDX_OR",1,4)}async function zD(t){return Q(t,"DT_ENUM_IDX_OR",1,3)}var WD=$(U());async function xi({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 x({document:e,macro:t.parent.args[0],context:r,position:n}))?.properties.find(f=>ee(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:ee(f),kind:WD.CompletionItemKind.Property}))??[]}async function GD(t){return t.macro.argIndexInParent===2?xi(t,"DT_PHA",2,0):Q(t,"DT_PHA",1,3,e=>!!e.nexusMapsTo.length)}var KD=$(U());async function rH({document:t,macro:e,position:r,context:n},i){if(e.parent?.macro!==i||!e.parent.args?.length)return[];let o=(await x({document:t,macro:e.parent.args[0],context:n,position:r}))?.properties.find(a=>ee(a.name)===e.parent?.args?.at(1)?.macro);return Array(o?.nexusMapsTo.length??0)?.map((a,c)=>({label:c.toString(),kind:KD.CompletionItemKind.Property}))??[]}async function YD(t){if(t.macro.argIndexInParent===2)return rH(t,"DT_PHA_BY_IDX");if(t.macro.argIndexInParent===3){let e=t.macro.parent?.args?Ce(t.macro.parent.args[2].macro):void 0;return typeof e!="number"?[]:xi(t,"DT_PHA_BY_IDX",3,e)}return Q(t,"DT_PHA_BY_IDX",1,3,e=>!!e.nexusMapsTo.length)}var XD=$(U());async function Yc({document:t,macro:e,context:r,position:n},i){if(e.parent?.macro!==i||!e.parent.args?.length)return[];let o=(await x({document:t,macro:e.parent.args[0],context:r,position:n}))?.properties.find(l=>ee(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:XD.CompletionItemKind.Property}))??[]}async function JD(t){let{macro:e}=t;return e.argIndexInParent===2?Yc(t,"DT_PHA_BY_NAME"):e.argIndexInParent===3?e.parent?.args?.[2]?.macro?xi(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 QD(t){let{macro:e}=t;return e.argIndexInParent===2?Yc(t,"DT_PHA_BY_NAME_OR"):e.argIndexInParent===3?e.parent?.args?.[2]?.macro?xi(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 ZD(t){let{macro:e}=t;return e.argIndexInParent===2?xi(t,"DT_PHA_OR",2,0):Q(t,"DT_PHA_OR",1,3,r=>!!r.nexusMapsTo.length)}async function Dp(t){return Q(t,"DT_PHANDLE",1,2,e=>!!e.ast.getFlatAstValues()?.some(r=>r instanceof ie||r instanceof st))}async function pa(t){return Q(t,"DT_PHANDLE_BY_IDX",1,3,e=>!!e.ast.getFlatAstValues()?.some(r=>r instanceof ie||r instanceof st))}async function eA(t){let{macro:e}=t;return e.argIndexInParent===2?Yc(t,"DT_PHANDLE_BY_NAME"):Q(t,"DT_PHANDLE_BY_NAME",1,3,r=>!!r.ast.getFlatAstValues()?.some(n=>n instanceof ie||n instanceof st))}async function tA(t){return Q(t,"DT_PROP",1,2,e=>!e.nexusMapsTo.length)}async function rA(t){return Q(t,"DT_PROP_BY_IDX",1,3,e=>!e.nexusMapsTo.length)}async function nA(t){let{macro:e}=t;return(e.argIndexInParent===1||e.argIndexInParent===2)&&e.parent?.macro==="DT_PROP_BY_PHANDLE_IDX"?pa({...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,()=>di({...t,macro:{macro:"DT_PHANDLE_BY_IDX",args:e.parent?.args?.slice(0,3)}},x))}async function iA(t){let{macro:e}=t;return e.argIndexInParent===1&&e.parent?.macro==="DT_PROP_BY_PHANDLE"?Dp({...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,()=>ds({...t,macro:{macro:"DT_PHANDLE",args:e.parent?.args?.slice(0,2)}},x))}async function sA(t){let{macro:e}=t;return(e.argIndexInParent===1||e.argIndexInParent===2)&&e.parent?.macro==="DT_PROP_BY_PHANDLE_IDX_OR"?pa({...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,()=>di({...t,macro:{macro:"DT_PHANDLE_BY_IDX",args:e.parent?.args?.slice(0,3)}},x))}async function oA(t){return Q(t,"DT_PROP_HAS_IDX",1,3,e=>!e.nexusMapsTo.length)}async function aA(t){return Q(t,"DT_PROP_HAS_NAME",1,3,e=>!e.nexusMapsTo.length)}async function cA(t){return Q(t,"DT_PROP_LAST",1,2,e=>!e.nexusMapsTo.length)}async function lA(t){return Q(t,"DT_PROP_LEN",1,2,e=>!e.nexusMapsTo.length)}async function uA(t){return Q(t,"DT_PROP_LEN_OR",1,2,e=>!e.nexusMapsTo.length)}async function dA(t){return Q(t,"DT_PROP_OR",1,2,e=>!e.nexusMapsTo.length)}async function fA(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 pA(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 hA(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 mA(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 gA(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 yA(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 TA(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 vA(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 bA(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 Xc=$(U());async function SA({macro:t,context:e}){return t.parent?.macro==="DT_ON_BUS"&&t.argIndexInParent===1?e.bindingLoader?.getBusTypes().map(r=>({label:ee(r),kind:Xc.CompletionItemKind.Enum}))??[]:t.macro&&"DT_ON_BUS".startsWith(t.macro)?[{label:"DT_ON_BUS(...)",insertText:"DT_ON_BUS($1, $2)",kind:Xc.CompletionItemKind.Function,insertTextFormat:Xc.InsertTextFormat.Snippet}]:[]}async function _A(t){return Q(t,"DT_CHOSEN",0,1,void 0,async()=>(await t.context.getRuntime()).rootNode.getChild(["/","chosen"]))}async function kA(t){return Q(t,"DT_HAS_CHOSEN",0,1,void 0,async()=>(await t.context.getRuntime()).rootNode.getChild(["/","chosen"]))}var nH=["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 NA(t,e,r){if(!r)return[];let n=Mi(r,t.position);return n?(await Promise.all([SA,_A,kA,pD,ID,OD,MD,iH,xD,LD,$D,BD,jD,FD,HD,VD,UD,zD,YD,JD,QD,GD,pa,eA,Dp,ZD,rA,iA,nA,sA,tA,oA,aA,cA,lA,uA,dA,fA,pA,hA,mA,gA,yA,TA,vA,bA].flatMap(async i=>await i({document:r,context:e,macro:n,position:t.position})))).flat():[]}function iH({macro:t}){return t.macro?nH.filter(e=>e.startsWith(t.macro)).map(e=>({label:`${e}(...)`,insertText:`${e}($1)`,kind:Ap.CompletionItemKind.Function,insertTextFormat:Ap.InsertTextFormat.Snippet})):[]}var Tn=$(U());function sH(t){if(!t||t.item===null||!(t.ast instanceof tt))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=Mr(s.uri);if(o)return Tn.Location.create(ue(o.docUri),o.range);if(s instanceof Xe)return Tn.Location.create(ue(s.uri),fe(s.propertyName??s));if(s instanceof yt)return Tn.Location.create(ue(s.uri),fe(s.propertyName??s))}).filter(s=>s)};if(t.item instanceof Qe&&t.ast instanceof tt)return r(e(t.item));if(t.item instanceof J&&t.ast instanceof tt&&t.ast.parentNode instanceof yt){let n=t.item.deletedProperties.find(i=>i.by===t.ast.parentNode)?.property;if(n)return r(n)}return[]}function oH(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 xe?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&&Mr(o?.uri);if(a)return Tn.Location.create(ue(a.docUri),a.range);if(o instanceof It)return Tn.Location.create(ue(o.uri),fe(o.name??o));if(o instanceof Ke)return Tn.Location.create(ue(o.uri),fe(o.name??o));if(o instanceof xe)return Tn.Location.create(ue(o.uri),fe(o));if(o instanceof xe)return Tn.Location.create(ue(o.uri),fe(o));if(o instanceof ie)return Tn.Location.create(ue(o.uri),fe(o.label??o));if(o instanceof Xe)return Tn.Location.create(ue((o.values??o)?.uri),fe(o.values??o))}).filter(o=>o)};if(t.item instanceof J&&!Vt(t.ast))return e(t.item);if(t.ast instanceof tr&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return e(t.ast.parentNode.linksTo);if(t.ast instanceof xe&&t.ast.linksTo)return Vt(t.ast)?[...e(t.ast.linksTo),Tn.Location.create(ue(t.ast.uri),fe(t.ast))]:e(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof Qe&&t.item.parent.name==="aliases"){let r=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(r)return e(r)}return[]}async function RA(t,e){return Nt(t,e,r=>[...oH(r),...sH(r)])}var Li=$(U());function PA(t){if(!t||t.item===null||!(t.ast instanceof tt))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 Xe||i instanceof yt)&&i.propertyName)return Li.Location.create(ue(i.uri),fe(i.propertyName))}).filter(i=>i);if(t.item instanceof Qe&&t.ast instanceof tt)return r(e(t.item));if(t.item instanceof J&&t.ast instanceof tt&&t.ast.parentNode instanceof yt){let n=t.item.deletedProperties.find(i=>i.by===t.ast.parentNode)?.property;if(n)return r(n)}return[]}function wA(t,e){if(!e||!(e.ast instanceof tr))return[];"newName"in t&&(e.ast.parentNode instanceof ie&&t.newName.startsWith("&")?t.newName=t.newName.slice(1):e.ast.parentNode instanceof os&&t.newName.endsWith(":")&&(t.newName=t.newName.slice(0,-1)));let r=e.ast.value,n=i=>[...i.definitions.filter(s=>s instanceof Ke).flatMap(s=>s.labels.map(o=>o.label)),...i.referencedBy.flatMap(s=>s.labels.map(o=>o.label)),...i.linkedRefLabels.map(s=>s.label)].filter(s=>s?.value===r).map(s=>{if(s)return Li.Location.create(ue(s.uri),fe(s))}).filter(s=>s);return e.item instanceof J&&!Vt(e.ast)?n(e.item):e.ast instanceof tr&&e.ast.parentNode instanceof ie&&e.ast.parentNode.linksTo?n(e.ast.parentNode.linksTo):[]}function EA(t){if(!t||!(t.ast instanceof xe)||t.ast instanceof xe&&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 Ke&&o.name)return Li.Location.create(ue(o.uri),fe(o.name));if(o instanceof xe)return Li.Location.create(ue(o.uri),fe(o));if(o instanceof Xe&&o.values?.values[0]?.value&&o.values?.values[0]?.value instanceof ne){let a=o.values.values[0].value,c=fe(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,Li.Location.create(ue(o.values.values[0].uri),c)}}).filter(o=>o)};return t.item instanceof J&&!Vt(t.ast)?e(t.item):t.ast instanceof xe&&t.ast.linksTo?Vt(t.ast)?[...e(t.ast.linksTo),Li.Location.create(ue(t.ast.uri),fe(t.ast))]:e(t.ast.linksTo):[]}async function CA(t,e){let r={};return(await Nt(t,e,i=>[...EA(i),...wA(t,i),...PA(i)])).forEach(i=>{r[i.uri]??=[],r[i.uri].push(Li.TextEdit.replace(i.range,t.newName))}),{changes:r}}async function DA(t,e){let r=await Nt(t,e,n=>[...EA(n),...wA(t,n),...PA(n)]);if(r.some(n=>e?.settings.lockRenameEdits?.some(i=>Pe(n.uri).startsWith(i))))throw new Error('Path is locked by user setting "lockRenameEdits"');if(r.some(n=>Wy(n.uri)))throw new Error("Item was generated using a MACRO.");return{defaultBehavior:!!r.length}}var ma=$(U());var ha=t=>[...t.definitions,...t.referencedBy].map(e=>{let r=Mr(e.uri);return r?ma.Location.create(ue(r.docUri),r.range):ma.Location.create(ue(e.uri),fe(e))}).filter(e=>e),AA=t=>t.replacedBy?AA(t.replacedBy):t,Ip=t=>[t.ast,...t.allReplaced.map(e=>e.ast)].map(e=>{let r=Mr(e.uri);return r?ma.Location.create(ue(r.docUri),r.range):ma.Location.create(ue(e.uri),fe(e.propertyName??e))}).filter(e=>e);function aH(t){if(!t||t.item===null||!(t.ast instanceof tt))return[];if(t.item instanceof Qe&&t.ast instanceof tt)return Ip(AA(t.item));if(t.item instanceof J&&t.ast instanceof tt&&t.ast.parentNode instanceof yt){let e=t.item.deletedProperties.find(r=>r.by===t.ast.parentNode)?.property;if(e)return Ip(e)}return[]}function cH(t){if(!t)return[];if(t.item instanceof J&&!Vt(t.ast))return ha(t.item);if(t.ast instanceof tr&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return ha(t.ast.parentNode.linksTo);if(t.ast instanceof xe&&t.ast.linksTo)return ha(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof Qe&&t.item.parent.name==="aliases"){let e=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(e)return ha(e)}return[]}function lH(t){if(t?.ast instanceof ft||t?.ast instanceof ii){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t.ast instanceof ft?t.ast.name:t.ast.value);if(e)return[ma.Location.create(ue(e.macro.uri),fe(e.macro.identifier))]}return[]}async function IA(t,e){return Nt(t,e,r=>[...cH(r),...aH(r),...lH(r)])}var uH=["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 Op({macro:t,document:e,context:r,position:n}){if(uH.some(i=>i===t.parent?.macro)&&t.argIndexInParent===1&&t.parent?.args?.[0])return(await x({document:e,context:r,position:n,macro:t.parent.args[0]}))?.properties.find(s=>ee(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 ds({document:e,context:r,position:n,macro:{macro:"DT_PHANDLE",args:t.parent.args.slice(0,2)}},x))?.properties.find(s=>ee(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 di({document:e,context:r,position:n,macro:{macro:"DT_PHANDLE_BY_IDX",args:t.parent.args.slice(0,3)}},x))?.properties.find(s=>ee(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=>ee(i.name)===t.macro)}async function OA(t,e,r){if(!r)return;let n=Mi(r,t.position);return MA(n,t.position,e,r)}async function MA(t,e,r,n){if(!t?.macro)return;let i=await x({document:n,macro:t,context:r,position:e});if(i)return ha(i);let s=await Op({document:n,macro:t,context:r,position:e});if(s)return Ip(s);let o=await ls(n,t.macro,e,r);if(o)return MA(o[0],o[1],r,n)}var fs=$(U());var ga=t=>{let e=t.definitions.at(0),r=e&&Mr(e.uri);return r?fs.Location.create(ue(r.docUri),r.range):e?fs.Location.create(ue(e.uri),fe(e)):void 0},Mp=t=>t.replaces?Mp(t.replaces):t,xA=t=>{let e=Mp(t),r=Mr(e.ast.uri);return r?fs.Location.create(ue(r.docUri),r.range):e?fs.Location.create(ue(e.ast.uri),fe(e.ast)):void 0};function dH(t){if(!t||t.item===null||!(t.ast instanceof tt))return;let e=r=>{let n=Mr(r.ast.uri);return n?fs.Location.create(ue(n.docUri),n.range):fs.Location.create(ue(r.ast.uri),fe(r.ast.propertyName??r.ast))};if(t.item instanceof Qe&&t.ast instanceof tt)return e(Mp(t.item));if(t.item instanceof J&&t.ast instanceof tt&&t.ast.parentNode instanceof yt){let r=t.item.deletedProperties.find(n=>n.by===t.ast.parentNode)?.property;if(r)return e(Mp(r))}}function fH(t){if(t){if(t.item instanceof J&&!Vt(t.ast))return ga(t.item);if(t.ast instanceof tr&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return ga(t.ast.parentNode.linksTo);if(t.ast instanceof xe&&t.ast.linksTo)return ga(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof Qe&&t.item.parent.name==="aliases"){let e=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(e)return ga(e)}}}function pH(t){if(t?.ast instanceof ft||t?.ast instanceof ii){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t.ast instanceof ft?t.ast.name:t.ast.value);if(e)return fs.Location.create(ue(e.macro.uri),fe(e.macro.identifier))}}async function LA(t,e){return(await Nt(t,e,r=>[fH(r)||dH(r)||pH(r)])).at(0)}async function qA(t,e,r){if(!r)return;let n=Mi(r,t.position);return $A(n,t.position,e,r)}async function $A(t,e,r,n){if(!t?.macro)return;let i=await x({document:n,macro:t,context:r,position:e});if(i)return ga(i);let s=await Op({document:n,macro:t,context:r,position:e});if(s)return xA(s);let o=await ls(n,t.macro,e,r);if(o)return $A(o[0],o[1],r,n)}var le=$(U());var hH=(t,e,r,n,i)=>{switch(r){case 1:return[{title:"Add semicolon",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),";")]}}}];case 2:return[{title:"Add open curly",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character)," {")]}}}];case 29:return[{title:"Remove white space",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(le.Range.create(le.Position.create(n.range.start.line,t.pos.colEnd),le.Position.create(n.range.end.line,e.pos.col)),"")]}}}];case 3:return[{title:"Add close curly",diagnostics:[n],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),"}")]}}}];case 19:return[{title:"Add '/'",diagnostics:[n],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),"/")]}}}];case 28:return[{title:"Add comma",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),",")]}}}];case 21:return[{title:"Add '/'",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),"/")]}}}];case 23:return[{title:"Remove ';'",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.del(n.range)]}}}];case 34:return[{title:"Complete Keyword '/delete-node/",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(n.range,"/delete-node/")]}}}];case 35:return[{title:"Complete Keyword '/delete-property/",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(n.range,"/delete-property/")]}}}];case 25:return[{title:"Complete Keyword '/delete-property/",diagnostics:[n],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(n.range,"/delete-property/")]}}},{title:"Complete Keyword '/delete-node/",diagnostics:[n],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(n.range,"/delete-node/")]}}}];case 12:return[{title:"Add '>'",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),">")]}}}];default:return}},mH=(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:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 27:return[{title:i??"Remove Property",diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 26:return[{title:i??"TODO",diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 36:return[{title:i??"TODO",diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 25:return n?[{title:i??"TODO",diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}]:[];default:return}},gH=(t,e,r,n)=>r?.length?[{title:n??"TODO",diagnostics:[t],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[e]:r}}}]:[];function BA(t){let e=t.context.diagnostics.flatMap(a=>{let c=a.data;if(c?.virtual)return[];switch(c?.type){case"FormattingIssues":return gH(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=>hH(c.firstToken,c.lastToken,l,a,t.textDocument.uri));case"StandardTypeIssue":return c?.items.flatMap(l=>mH(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===le.CodeActionKind.SourceFixAll),n=e.filter(a=>a.title.startsWith("Add Property")),i=e.filter(a=>a.kind!==le.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:le.CodeActionKind.QuickFix})),...s.length?[{title:"Fix All",kind:le.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:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[t.textDocument.uri]:a}}}:[])]}var FA=$(U());var xp=t=>!t||t instanceof Xe?!1:t instanceof _r||xp(t.parentNode);function yH(t){if(!t||!(t.item instanceof Qe&&t.item.ast.assignOperatorToken))return[];let e=xp(t?.ast);if(!e&&!(t.ast instanceof Xe&&t.item.ast.values===null)&&!xp(t.beforeAst)&&!xp(t.afterAst))return[];let r=-1;if(t.item.ast.values===null?r=0:r=(t.item.ast.values?.values.findIndex(i=>i&&Qy(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 s instanceof Rt&&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=>({label:`"${c}"`,kind:FA.CompletionItemKind.Variable,insertText:e?c:`"${c}"`})))}let n=t.item.parent.nodeType;return n instanceof Rt?n.properties.find(i=>i.name===t.item?.name)?.getPropertyCompletionItems(t.item,r,e)??[]:[]}function TH(t){if(!t||!(t.item instanceof Qe&&t.ast instanceof tt&&t.item.ast.values==null||t.item instanceof J)||Vt(t.ast)||t.beforeAst?.parentNode instanceof Sr)return[];let e=r=>r.nodeType?.getPropertyListCompletionItems(r)??[];return t.item instanceof Qe?e(t.item.parent):e(t.item)}async function jA(t,e){return Nt(t,e,r=>[...yH(r),...TH(r)])}var Lp=$(U());async function vH(t){if(t?.ast instanceof ft||t?.ast instanceof ii){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t?.ast instanceof ft?t.ast.name:t.ast.value);if(e){let r=Rc(t.ast),n=(await t.runtime.context.getAllStableParsers()).at(-1);if(r){let i=r?.evaluate(n.cPreprocessorParser.macros);return{contents:{kind:Lp.MarkupKind.Markdown,value:["```cpp",`#define ${e.macro.toString()} // = ${i}${typeof i=="number"?` (0x${i.toString(16)})`:""}`,"```"].join(`
|
|
292
|
-
`)
|
|
293
|
-
|
|
294
|
-
${r
|
|
280
|
+
};`,kind:Mt.CompletionItemKind.Value,insertTextFormat:Mt.InsertTextFormat.Snippet}))]}function PU(t,e){let r=s=>s?s.parentNode instanceof fr||s.parentNode instanceof It||s.parentNode instanceof Xe?!1:r(s.parentNode):!0;if(!t||t.item!==null||!Vt(t.ast)||!r(t.ast))return[];let n=s=>Yf(s,e).filter(o=>e(o));if(t.ast instanceof ft)return n(t.runtime.rootNode).length?[{label:"/delete-node/",insertText:"/delete-node/ $1;",kind:Mt.CompletionItemKind.Keyword,insertTextFormat:Mt.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:Mt.CompletionItemKind.Keyword,insertTextFormat:Mt.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:Mt.CompletionItemKind.Variable,documentation:s.lastLinkedTo?.toMarkupContent(t.runtime.context.macros)}))}function wU(t,e){if(!t||!(t.item instanceof X)||t.item===null||t.beforeAst&&(!(t.beforeAst?.parentNode instanceof _r)||t.beforeAst?.parentNode instanceof gt))return[];let r=n=>[...n.nodes,...n.deletedNodes.filter(i=>!e(i.by)).map(i=>i.node)].flatMap(i=>({node:i,astNodes:i.definitions.filter(s=>s instanceof Xe)})).filter(i=>i.astNodes.some(e));return t.ast instanceof Me||t.ast instanceof qr||t.beforeAst?.parentNode instanceof qr?r(t.item).map(n=>({label:`${n.astNodes.at(0)?.name?.toString()}`,kind:Mt.CompletionItemKind.Variable,documentation:n.node.toMarkupContent(t.runtime.context.macros)})):r(t.item).length?[{label:"/delete-node/",insertText:"/delete-node/ $1;",kind:Mt.CompletionItemKind.Keyword,insertTextFormat:Mt.InsertTextFormat.Snippet,sortText:"~",command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:[]}function EU(t,e){if(!t||!(t.item instanceof X)||t.beforeAst&&(!(t.beforeAst?.parentNode instanceof _r)||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 tt||t.ast instanceof gt||t.beforeAst?.parentNode instanceof gt){let n=new Map;return r(t.item).forEach(i=>n.set(i.name,i)),Array.from(n).map(([,i])=>({label:`${i.name}`,kind:Mt.CompletionItemKind.Variable,documentation:i.ast.toPrettyString(t.runtime.context.macros)}))}return r(t.item).length?[{label:"/delete-property/",insertText:"/delete-property/ $1;",kind:Mt.CompletionItemKind.Keyword,sortText:"~",insertTextFormat:Mt.InsertTextFormat.Snippet,command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:[]}function CU(t,e){let r=t?.ast instanceof Un?t.ast:t?.ast.parentNode;if(!t||!r||!(r instanceof Un))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=>!Vt(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:Mt.CompletionItemKind.Variable,documentation:o.toMarkupContent(t.runtime.context.macros)}))}function DU(t){return!t||!(t.item instanceof Ze&&t.item.ast.assignOperatorToken)||t.ast instanceof ne?[]:!Qs(t?.ast)&&!(t.ast instanceof Ye&&t.item.ast.values===null)&&!Qs(t.beforeAst)&&!Qs(t.afterAst)?[]:t.item.parent.nodeType instanceof Pt?Array.from([t.runtime.context.parser,...t.runtime.context.overlayParsers].at(-1)?.cPreprocessorParser.macros??[]).map(([,n])=>n.macro.identifier instanceof di?{label:`${n.macro.identifier.toString()}`,insertText:`${n.macro.name}(${n.macro.identifier.params.map((i,s)=>i instanceof pt?`$${s+1}`:"").join(", ")})`,kind:Mt.CompletionItemKind.Function,sortText:`~${n.macro.name}`,insertTextFormat:Mt.InsertTextFormat.Snippet}:{label:n.macro.identifier.name,kind:Mt.CompletionItemKind.Variable,sortText:`~${n.macro.name}`}):[]}async function nD(t,e){return Rt(t,e,(r,n)=>[...EU(r,n),...wU(r,n),...PU(r,n),...CU(r,n),...RU(r,n),...NU(r,n),...kU(r),...DU(r)])}var Cp=$(j());var sD=require("child_process");var NT=t=>/[A-Za-z0-9_]/.test(t);function AU(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 iD(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 oD(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,T=m,b=h;for(;T<b&&/\s/.test(t[T]);)T++;for(;b>T&&/\s/.test(t[b-1]);)b--;n.push({start:m,end:h,text:t.slice(T,b)}),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 RT(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=oD(i,0,i.length),o={macro:n,args:[]};return o.args=s.map(a=>{let c=RT(a.text);return c.parent=o,c}),o}function Li(t,e){let r=t.getText(),n=t.offsetAt(e),i=n,s=n;for(;i>0&&NT(r[i-1]);)i--;for(;s<r.length&&NT(r[s]);)s++;if(r[s]==="("){let T=iD(r,s);T!==void 0&&(s=T+1)}let o=r.slice(i,s),a=o.trim().length?RT(o):void 0,c=AU(r,n);if(c===void 0)return a;let l=iD(r,c);if(l===void 0||!(c<n&&n<=l))return a;let u=c,d=u;for(;d>0&&NT(r[d-1]);)d--;let f=r.slice(d,u);if(!f)return a;let p=oD(r,c+1,l),m={macro:f,args:[]};m.args=p.map(T=>{let b=RT(T.text);return b.parent=m,b});let h=-1;for(let T=0;T<p.length;T++){let b=p[T];if(n>=b.start&&n<=b.end){h=T;break}}if(h>=0){let T=m.args[h];return T.argIndexInParent=h,T}return m}function IU(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 Yt.create(o,u>=0?u:a.length)}}}async function ds(t,e,r,n){let i=aD(t,e,r);if(i)return i;let s=await MU(e,n,Pe(t.uri));if(s)return[s,r]}function aD(t,e,r){if(e.startsWith("DT_"))return;let n=IU(t,e,r);if(!n)return;let i=Li(t,n);if(i)return[i,n]}var OU=(t,e)=>new Promise(r=>{let n=(0,sD.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 MU(t,e,r){let n=e.getCompileCommands()?.find(s=>pe(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 OU(s,o.filter(u=>!!u)),c=hn.create(`macros://${n.file}`,"devicetree",0,a),l=aD(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 Hc=$(j());async function cD({macro:t,context:e}){if(t.macro&&"DT_ALIAS".startsWith(t.macro))return[{label:"DT_ALIAS(...)",insertText:"DT_ALIAS($1)",kind:Hc.CompletionItemKind.Function,insertTextFormat:Hc.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 Un&&(s=i.pathParts.at(-1)?.linksTo),{label:Z(n.name),kind:Hc.CompletionItemKind.Property,documentation:s?.toMarkupContent(r.context.macros)}})??[]}var Vc=$(j());async function hr(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 ot)return s.path?.pathParts.at(-1)?.linksTo;if(s instanceof ie)return s.linksTo;if(s instanceof ne)return s.value;if(s instanceof be){let o=s.evaluate(r.macros);return typeof o=="number"?o:s.toString()}})}async function Xf({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?hr(o,s[1].macro,r):void 0}async function lD(t,e){let r=await Xf(t,e);if(typeof r=="boolean")return;let n=r?.at(0);if(r?.length===1&&n instanceof X)return n}async function uD(t,e,r,n){if(r=typeof r=="number"?r:Ce(r),typeof r!="number")return;let i=await hr(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 X?i[0]:s}async function Jf({document:t,macro:e,context:r,position:n},i){if(!(e.macro!=="DT_PROP_BY_IDX"||e.args?.length!==3))return uD(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro,r)}async function dD(t,e){let r=await Jf(t,e);if(typeof r!="boolean"&&r instanceof X)return r}async function Br(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 Qf(t,e,r,n){return Br(await hr(t,e,r.context),r,n)}async function da({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 Qf(c,o.macro,{macro:a,document:t,context:r,position:n},i)}async function fD(t,e){let r=await da(t,e);if(r instanceof X)return r;if(typeof r=="boolean")return;let n=r?.at(0);if(r?.length===1&&n instanceof X)return n}async function pD(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 Zf(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 pD(n)}async function ep(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 ot)return s.path?.pathParts.at(-1)?.linksTo}async function tp(t){let e=t.macro.args;if(!(t.macro.macro!=="DT_CHOSEN"||e?.length!==1))return await ep(t.context,e[0].macro)}async function rp(t,e){let r=await e?.getRuntime();if(r){let n=fi.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 ot&&(n=s[0].path?.pathParts.at(-1)?.linksTo),n}}async function np({macro:t,context:e}){if(!(t.macro!=="DT_ALIAS"||t.args?.length!==1))return rp(t.args[0].macro,e)}async function hD(t,e){return t?.nodes.find(r=>Z(r.name)===e)}async function ip({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 hD(s,e.args[1].macro)}var PT=(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,...PT(r,e)]:PT(r,e));async function mD(t,e){let r=await e?.getRuntime();if(r)return PT(r.rootNode,t)}async function wT({macro:t,context:e}){if(!(t.macro!=="DT_COMPAT_GET_ANY_STATUS_OKAY"||t.args?.length!==1))return mD(t.args[0].macro,e)}async function gD(t){return(await wT(t))?.at(0)}async function yD(t){return t?.parent?.parent??void 0}async function sp({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 yD(s)}var ET=(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,...ET(r,e)]:ET(r,e));async function TD(t,e,r){let n=await r?.getRuntime();if(n)return ET(n.rootNode,e).at(t)}async function op({macro:t,context:e}){if(t.macro!=="DT_INST"||t.args?.length!==2)return;let r=Ce(t.args[0].macro);if(typeof r=="number")return TD(r,t.args[1].macro,e)}async function vD(t,e){let r=await e?.getRuntime(),n=r?.resolvePath([`&${t.trim()}`]);if(r&&n)return fi.getNodeFromPath(n.slice(1),r.rootNode,!0)}async function ap({macro:t,context:e}){if(!(t.macro!=="DT_NODELABEL"||t.args?.length!==1))return vD(t.args[0].macro,e)}async function bD(t){return t?.parent??void 0}async function cp({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 bD(s)}var SD=(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?SD(n,e):void 0};async function lp(t,e){let r=await e?.getRuntime();if(r)return SD(r.rootNode,t)}async function up({macro:t,context:e}){let r=t.args;if(!(t.macro!=="DT_PATH"||!r?.length))return lp(r.map(n=>n.macro),e)}async function dp({macro:t,context:e}){let r=t.args;if(!(t.macro!=="DT_ROOT"||r?.length))return(await e.getRuntime()).rootNode}async function fa(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 Pt))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 fp(t,e,r,n,i){return Br(await fa(t,e,r),n,i)}async function pp({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=Ce(s[2].macro);if(typeof a=="number")return await fp(o,s[1].macro,a,{macro:s[3],document:t,context:r,position:n},i)}async function hp({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 fp(o,s[1].macro,0,{macro:s[2],document:t,context:r,position:n},i)}async function fs(t,e,r,n,i){let s=t?.properties.find(d=>Z(d.name)===e),o=s?.parent.nodeType;if(!o||!(o instanceof Pt))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 be){let d=u.evaluate(i.macros);return typeof d!="number"?u.toString():d}}async function pa(t,e,r,n,i,s){return Br(await fs(t,e,r,n,i.context),i,s)}async function mp({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=Ce(s[2].macro);if(typeof a=="number")return pa(o,s[1].macro,a,s[3].macro,{macro:s[4],document:t,context:r,position:n},i)}async function gp({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 pa(o,s[1].macro,s[2].macro,s[3].macro,{macro:s[4],document:t,context:r,position:n},i)}async function hi(t,e,r=0){let n=t?.properties.find(s=>Z(s.name)===e);if(r=typeof r=="number"?r:Ce(r??"0"),typeof r!="number")return;let i=n?.ast.getFlatAstValues()?.at(r);if(i instanceof ie)return i.linksTo;if(i instanceof ot)return i.path?.pathParts.at(-1)?.linksTo}async function ps({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 hi(o,s[1].macro,0)}async function mi({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 hi(o,s[1].macro,s.at(2)?.macro)}async function _D(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 Pt))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 yp({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 _D(o,s[1].macro,s[2].macro)}async function Tp({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 pa(o,s[1].macro,0,s[2].macro,{macro:s[3],document:t,context:r,position:n},i)}async function vp({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 hi(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro);return Qf(s,e.args[3].macro,{macro:e.args[4],document:t,context:r,position:n},i)}async function bp(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 kD(t,e,r,n){if(t)return Br(await bp(t,e),r,n)}async function Sp({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?kD(o,s[1].macro,{macro:s[2],document:t,context:r,position:n},i):void 0}async function ha(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 ND(t,e,r,n){if(t)return Br(await ha(t,e),r,n)}async function _p({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 ND(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 RD(t,e,r,n){if(t)return Br(await kp(t,e),r,n)}async function Np({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 RD(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}async function Rp(t,e){return(await ha(t,e))?.toUpperCase()}async function PD(t,e,r,n){if(t)return Br(await Rp(t,e),r,n)}async function Pp({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 PD(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}function zn(t){return async(e,r)=>{let n=await t(e,r);if(n instanceof X)return n}}async function x({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[Zf,tp,np,ip,gD,sp,op,ap,cp,up,ps,mi,yp,dD,lD,fD,dp,zn(pp),zn(hp),zn(mp),zn(gp),zn(Tp),zn(vp),zn(Sp),zn(da),zn(_p),zn(Np),zn(Pp)].reduce((a,c)=>a.then(l=>l||c({macro:t,document:e,context:r,position:n},x)),Promise.resolve(void 0));if(s)return Array.isArray(s)?s.at(0):s;let o=await ds(e,t.macro,n,r);if(o)return x({document:e,macro:o[0],context:r,position:n})}async function wD({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:Vc.CompletionItemKind.Function,insertTextFormat:Vc.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_CHILD"||t.argIndexInParent!==1||!t.parent.args?.length?[]:(await x({document:e,macro:t.parent.args[0],context:r,position:n}))?.nodes.map(s=>({label:Z(s.fullName),kind:Vc.CompletionItemKind.Class,documentation:s.toMarkupContent(r.macros)}))??[]}var zc=$(j());function ED({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:zc.CompletionItemKind.Function,insertTextFormat:zc.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_COMPAT_GET_ANY_STATUS_OKAY"||t.argIndexInParent!==0?[]:e.bindingLoader?.getBindings().map(r=>({label:Z(r),kind:zc.CompletionItemKind.Property}))??[]}var Wc=$(j());function CD({macro:t,context:e}){return t.macro&&"DT_INST".startsWith(t.macro)?[{label:"DT_INST(...)",insertText:"DT_INST($1, $2)",kind:Wc.CompletionItemKind.Function,insertTextFormat:Wc.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_INST"||t.argIndexInParent!==1?[]:e.bindingLoader?.getBindings().map(r=>({label:Z(r),kind:Wc.CompletionItemKind.Property}))??[]}var Gc=$(j());async function DD({macro:t,context:e}){if(t.macro&&"DT_NODELABEL".startsWith(t.macro))return[{label:"DT_NODELABEL(...)",insertText:"DT_NODELABEL($1)",kind:Gc.CompletionItemKind.Function,insertTextFormat:Gc.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:Gc.CompletionItemKind.Property,documentation:n.lastLinkedTo?.toMarkupContent(r.context.macros)}))??[])}var Kc=$(j());async function AD({macro:t,context:e}){return t.macro&&t.macro&&"DT_PATH".startsWith(t.macro)?[{label:"DT_PATH(...)",insertText:"DT_PATH($1)",kind:Kc.CompletionItemKind.Function,insertTextFormat:Kc.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_PATH"||!t.parent.args?.length?[]:(await lp(t.parent.args.slice(0,-1).map(n=>n.macro),e))?.nodes.map(n=>({label:Z(n.fullName),kind:Kc.CompletionItemKind.Class,documentation:n.toMarkupContent(e.macros)}))??[]}var ID=$(j());async function OD({macro:t,context:e}){if(t.macro&&t.macro&&"DT_ROOT".startsWith(t.macro)){let r=await e.getRuntime();return[{label:"DT_ROOT",kind:ID.CompletionItemKind.Class,documentation:r.rootNode.toMarkupContent(r.context.macros)}]}return[]}var wp=$(j());function MD({macro:t}){return t.macro&&t.macro&&"DT_SAME_NODE".startsWith(t.macro)?[{label:"DT_SAME_NODE(...)",insertText:"DT_SAME_NODE($1, $2)",kind:wp.CompletionItemKind.Snippet,insertTextFormat:wp.InsertTextFormat.Snippet}]:[]}var Yc=$(j());async function J({macro:t,document:e,position:r,context:n},i,s,o,a,c=l=>x({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:Yc.CompletionItemKind.Function,insertTextFormat:Yc.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:Yc.CompletionItemKind.Property,documentation:d.toPrettyString(n.macros)}))??[]}async function xD(t){return J(t,"DT_ENUM_HAS_VALUE",1,3)}async function LD(t){return J(t,"DT_ENUM_HAS_VALUE_BY_IDX",1,4)}async function qD(t){return J(t,"DT_ENUM_IDX",1,2)}async function $D(t){return J(t,"DT_ENUM_IDX_BY_IDX",1,3)}async function BD(t){return J(t,"DT_ENUM_IDX_BY_IDX_OR",1,4)}async function FD(t){return J(t,"DT_ENUM_IDX_OR",1,3)}var jD=$(j());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 x({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:jD.CompletionItemKind.Property}))??[]}async function UD(t){return t.macro.argIndexInParent===2?qi(t,"DT_PHA",2,0):J(t,"DT_PHA",1,3,e=>!!e.nexusMapsTo.length)}var HD=$(j());async function xU({document:t,macro:e,position:r,context:n},i){if(e.parent?.macro!==i||!e.parent.args?.length)return[];let o=(await x({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:HD.CompletionItemKind.Property}))??[]}async function VD(t){if(t.macro.argIndexInParent===2)return xU(t,"DT_PHA_BY_IDX");if(t.macro.argIndexInParent===3){let e=t.macro.parent?.args?Ce(t.macro.parent.args[2].macro):void 0;return typeof e!="number"?[]:qi(t,"DT_PHA_BY_IDX",3,e)}return J(t,"DT_PHA_BY_IDX",1,3,e=>!!e.nexusMapsTo.length)}var zD=$(j());async function Xc({document:t,macro:e,context:r,position:n},i){if(e.parent?.macro!==i||!e.parent.args?.length)return[];let o=(await x({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:zD.CompletionItemKind.Property}))??[]}async function WD(t){let{macro:e}=t;return e.argIndexInParent===2?Xc(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):[]:J(t,"DT_PHA_BY_NAME",1,3,r=>!!r.nexusMapsTo.length)}async function GD(t){let{macro:e}=t;return e.argIndexInParent===2?Xc(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):[]:J(t,"DT_PHA_BY_NAME_OR",1,3,r=>!!r.nexusMapsTo.length)}async function KD(t){let{macro:e}=t;return e.argIndexInParent===2?qi(t,"DT_PHA_OR",2,0):J(t,"DT_PHA_OR",1,3,r=>!!r.nexusMapsTo.length)}async function Ep(t){return J(t,"DT_PHANDLE",1,2,e=>!!e.ast.getFlatAstValues()?.some(r=>r instanceof ie||r instanceof ot))}async function ma(t){return J(t,"DT_PHANDLE_BY_IDX",1,3,e=>!!e.ast.getFlatAstValues()?.some(r=>r instanceof ie||r instanceof ot))}async function YD(t){let{macro:e}=t;return e.argIndexInParent===2?Xc(t,"DT_PHANDLE_BY_NAME"):J(t,"DT_PHANDLE_BY_NAME",1,3,r=>!!r.ast.getFlatAstValues()?.some(n=>n instanceof ie||n instanceof ot))}async function XD(t){return J(t,"DT_PROP",1,2,e=>!e.nexusMapsTo.length)}async function JD(t){return J(t,"DT_PROP_BY_IDX",1,3,e=>!e.nexusMapsTo.length)}async function QD(t){let{macro:e}=t;return(e.argIndexInParent===1||e.argIndexInParent===2)&&e.parent?.macro==="DT_PROP_BY_PHANDLE_IDX"?ma({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE_BY_IDX"}:void 0}}):J(t,"DT_PROP_BY_PHANDLE_IDX",3,4,r=>!r.nexusMapsTo.length,()=>mi({...t,macro:{macro:"DT_PHANDLE_BY_IDX",args:e.parent?.args?.slice(0,3)}},x))}async function ZD(t){let{macro:e}=t;return e.argIndexInParent===1&&e.parent?.macro==="DT_PROP_BY_PHANDLE"?Ep({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE"}:void 0}}):J(t,"DT_PROP_BY_PHANDLE",2,3,r=>!r.nexusMapsTo.length,()=>ps({...t,macro:{macro:"DT_PHANDLE",args:e.parent?.args?.slice(0,2)}},x))}async function eA(t){let{macro:e}=t;return(e.argIndexInParent===1||e.argIndexInParent===2)&&e.parent?.macro==="DT_PROP_BY_PHANDLE_IDX_OR"?ma({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE_BY_IDX"}:void 0}}):J(t,"DT_PROP_BY_PHANDLE_IDX_OR",3,5,r=>!r.nexusMapsTo.length,()=>mi({...t,macro:{macro:"DT_PHANDLE_BY_IDX",args:e.parent?.args?.slice(0,3)}},x))}async function tA(t){return J(t,"DT_PROP_HAS_IDX",1,3,e=>!e.nexusMapsTo.length)}async function rA(t){return J(t,"DT_PROP_HAS_NAME",1,3,e=>!e.nexusMapsTo.length)}async function nA(t){return J(t,"DT_PROP_LAST",1,2,e=>!e.nexusMapsTo.length)}async function iA(t){return J(t,"DT_PROP_LEN",1,2,e=>!e.nexusMapsTo.length)}async function sA(t){return J(t,"DT_PROP_LEN_OR",1,2,e=>!e.nexusMapsTo.length)}async function oA(t){return J(t,"DT_PROP_OR",1,2,e=>!e.nexusMapsTo.length)}async function aA(t){return J(t,"DT_STRING_TOKEN",1,2,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function cA(t){return J(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 lA(t){return J(t,"DT_STRING_TOKEN_OR",1,3,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function uA(t){return J(t,"DT_STRING_UNQUOTED",1,2,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function dA(t){return J(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 fA(t){return J(t,"DT_STRING_UNQUOTED_OR",1,3,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function pA(t){return J(t,"DT_STRING_UPPER_TOKEN",1,2,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function hA(t){return J(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 mA(t){return J(t,"DT_STRING_UPPER_TOKEN_OR",1,3,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}var Jc=$(j());async function gA({macro:t,context:e}){return t.parent?.macro==="DT_ON_BUS"&&t.argIndexInParent===1?e.bindingLoader?.getBusTypes().map(r=>({label:Z(r),kind:Jc.CompletionItemKind.Enum}))??[]:t.macro&&"DT_ON_BUS".startsWith(t.macro)?[{label:"DT_ON_BUS(...)",insertText:"DT_ON_BUS($1, $2)",kind:Jc.CompletionItemKind.Function,insertTextFormat:Jc.InsertTextFormat.Snippet}]:[]}async function yA(t){return J(t,"DT_CHOSEN",0,1,void 0,async()=>(await t.context.getRuntime()).rootNode.getChild(["/","chosen"]))}async function TA(t){return J(t,"DT_HAS_CHOSEN",0,1,void 0,async()=>(await t.context.getRuntime()).rootNode.getChild(["/","chosen"]))}var LU=["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 vA(t,e,r){if(!r)return[];let n=Li(r,t.position);return n?(await Promise.all([gA,yA,TA,cD,wD,ED,CD,qU,DD,AD,OD,MD,LD,xD,$D,BD,qD,FD,VD,WD,GD,UD,ma,YD,Ep,KD,JD,ZD,QD,eA,XD,tA,rA,nA,iA,sA,oA,aA,cA,lA,uA,dA,fA,pA,hA,mA].flatMap(async i=>await i({document:r,context:e,macro:n,position:t.position})))).flat():[]}function qU({macro:t}){return t.macro?LU.filter(e=>e.startsWith(t.macro)).map(e=>({label:`${e}(...)`,insertText:`${e}($1)`,kind:Cp.CompletionItemKind.Function,insertTextFormat:Cp.InsertTextFormat.Snippet})):[]}var Sn=$(j());function $U(t){if(!t||t.item===null||!(t.ast instanceof tt))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=Lr(s.uri);if(o)return Sn.Location.create(ue(o.docUri),o.range);if(s instanceof Ye)return Sn.Location.create(ue(s.uri),fe(s.propertyName??s));if(s instanceof gt)return Sn.Location.create(ue(s.uri),fe(s.propertyName??s))}).filter(s=>s)};if(t.item instanceof Ze&&t.ast instanceof tt)return r(e(t.item));if(t.item instanceof X&&t.ast instanceof tt&&t.ast.parentNode instanceof gt){let n=t.item.deletedProperties.find(i=>i.by===t.ast.parentNode)?.property;if(n)return r(n)}return[]}function BU(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 Me?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&&Lr(o?.uri);if(a)return Sn.Location.create(ue(a.docUri),a.range);if(o instanceof It)return Sn.Location.create(ue(o.uri),fe(o.name??o));if(o instanceof Xe)return Sn.Location.create(ue(o.uri),fe(o.name??o));if(o instanceof Me)return Sn.Location.create(ue(o.uri),fe(o));if(o instanceof Me)return Sn.Location.create(ue(o.uri),fe(o));if(o instanceof ie)return Sn.Location.create(ue(o.uri),fe(o.label??o));if(o instanceof Ye)return Sn.Location.create(ue((o.values??o)?.uri),fe(o.values??o))}).filter(o=>o)};if(t.item instanceof X&&!Vt(t.ast))return e(t.item);if(t.ast instanceof rr&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return e(t.ast.parentNode.linksTo);if(t.ast instanceof Me&&t.ast.linksTo)return Vt(t.ast)?[...e(t.ast.linksTo),Sn.Location.create(ue(t.ast.uri),fe(t.ast))]:e(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof Ze&&t.item.parent.name==="aliases"){let r=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(r)return e(r)}return[]}async function bA(t,e){return Rt(t,e,r=>[...BU(r),...$U(r)])}var $i=$(j());function SA(t){if(!t||t.item===null||!(t.ast instanceof tt))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 Ye||i instanceof gt)&&i.propertyName)return $i.Location.create(ue(i.uri),fe(i.propertyName))}).filter(i=>i);if(t.item instanceof Ze&&t.ast instanceof tt)return r(e(t.item));if(t.item instanceof X&&t.ast instanceof tt&&t.ast.parentNode instanceof gt){let n=t.item.deletedProperties.find(i=>i.by===t.ast.parentNode)?.property;if(n)return r(n)}return[]}function _A(t,e){if(!e||!(e.ast instanceof rr))return[];"newName"in t&&(e.ast.parentNode instanceof ie&&t.newName.startsWith("&")?t.newName=t.newName.slice(1):e.ast.parentNode instanceof us&&t.newName.endsWith(":")&&(t.newName=t.newName.slice(0,-1)));let r=e.ast.value,n=i=>[...i.definitions.filter(s=>s instanceof Xe).flatMap(s=>s.labels.map(o=>o.label)),...i.referencedBy.flatMap(s=>s.labels.map(o=>o.label)),...i.linkedRefLabels.map(s=>s.label)].filter(s=>s?.value===r).map(s=>{if(s)return $i.Location.create(ue(s.uri),fe(s))}).filter(s=>s);return e.item instanceof X&&!Vt(e.ast)?n(e.item):e.ast instanceof rr&&e.ast.parentNode instanceof ie&&e.ast.parentNode.linksTo?n(e.ast.parentNode.linksTo):[]}function kA(t){if(!t||!(t.ast instanceof Me)||t.ast instanceof Me&&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 Xe&&o.name)return $i.Location.create(ue(o.uri),fe(o.name));if(o instanceof Me)return $i.Location.create(ue(o.uri),fe(o));if(o instanceof Ye&&o.values?.values[0]?.value&&o.values?.values[0]?.value instanceof ne){let a=o.values.values[0].value,c=fe(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,$i.Location.create(ue(o.values.values[0].uri),c)}}).filter(o=>o)};return t.item instanceof X&&!Vt(t.ast)?e(t.item):t.ast instanceof Me&&t.ast.linksTo?Vt(t.ast)?[...e(t.ast.linksTo),$i.Location.create(ue(t.ast.uri),fe(t.ast))]:e(t.ast.linksTo):[]}async function NA(t,e){let r={};return(await Rt(t,e,i=>[...kA(i),..._A(t,i),...SA(i)])).forEach(i=>{r[i.uri]??=[],r[i.uri].push($i.TextEdit.replace(i.range,t.newName))}),{changes:r}}async function RA(t,e){let r=await Rt(t,e,n=>[...kA(n),..._A(t,n),...SA(n)]);if(r.some(n=>e?.settings.lockRenameEdits?.some(i=>Pe(n.uri).startsWith(i))))throw new Error('Path is locked by user setting "lockRenameEdits"');if(r.some(n=>Zy(n.uri)))throw new Error("Item was generated using a MACRO.");return{defaultBehavior:!!r.length}}var ya=$(j());var ga=t=>[...t.definitions,...t.referencedBy].map(e=>{let r=Lr(e.uri);return r?ya.Location.create(ue(r.docUri),r.range):ya.Location.create(ue(e.uri),fe(e))}).filter(e=>e),PA=t=>t.replacedBy?PA(t.replacedBy):t,Dp=t=>[t.ast,...t.allReplaced.map(e=>e.ast)].map(e=>{let r=Lr(e.uri);return r?ya.Location.create(ue(r.docUri),r.range):ya.Location.create(ue(e.uri),fe(e.propertyName??e))}).filter(e=>e);function FU(t){if(!t||t.item===null||!(t.ast instanceof tt))return[];if(t.item instanceof Ze&&t.ast instanceof tt)return Dp(PA(t.item));if(t.item instanceof X&&t.ast instanceof tt&&t.ast.parentNode instanceof gt){let e=t.item.deletedProperties.find(r=>r.by===t.ast.parentNode)?.property;if(e)return Dp(e)}return[]}function jU(t){if(!t)return[];if(t.item instanceof X&&!Vt(t.ast))return ga(t.item);if(t.ast instanceof rr&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return ga(t.ast.parentNode.linksTo);if(t.ast instanceof Me&&t.ast.linksTo)return ga(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof Ze&&t.item.parent.name==="aliases"){let e=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(e)return ga(e)}return[]}function UU(t){if(t?.ast instanceof pt||t?.ast instanceof ci){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t.ast instanceof pt?t.ast.name:t.ast.value);if(e)return[ya.Location.create(ue(e.macro.uri),fe(e.macro.identifier))]}return[]}async function wA(t,e){return Rt(t,e,r=>[...jU(r),...FU(r),...UU(r)])}var HU=["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 Ap({macro:t,document:e,context:r,position:n}){if(HU.some(i=>i===t.parent?.macro)&&t.argIndexInParent===1&&t.parent?.args?.[0])return(await x({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 ps({document:e,context:r,position:n,macro:{macro:"DT_PHANDLE",args:t.parent.args.slice(0,2)}},x))?.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 mi({document:e,context:r,position:n,macro:{macro:"DT_PHANDLE_BY_IDX",args:t.parent.args.slice(0,3)}},x))?.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 EA(t,e,r){if(!r)return;let n=Li(r,t.position);return CA(n,t.position,e,r)}async function CA(t,e,r,n){if(!t?.macro)return;let i=await x({document:n,macro:t,context:r,position:e});if(i)return ga(i);let s=await Ap({document:n,macro:t,context:r,position:e});if(s)return Dp(s);let o=await ds(n,t.macro,e,r);if(o)return CA(o[0],o[1],r,n)}var hs=$(j());var Ta=t=>{let e=t.definitions.at(0),r=e&&Lr(e.uri);return r?hs.Location.create(ue(r.docUri),r.range):e?hs.Location.create(ue(e.uri),fe(e)):void 0},Ip=t=>t.replaces?Ip(t.replaces):t,DA=t=>{let e=Ip(t),r=Lr(e.ast.uri);return r?hs.Location.create(ue(r.docUri),r.range):e?hs.Location.create(ue(e.ast.uri),fe(e.ast)):void 0};function VU(t){if(!t||t.item===null||!(t.ast instanceof tt))return;let e=r=>{let n=Lr(r.ast.uri);return n?hs.Location.create(ue(n.docUri),n.range):hs.Location.create(ue(r.ast.uri),fe(r.ast.propertyName??r.ast))};if(t.item instanceof Ze&&t.ast instanceof tt)return e(Ip(t.item));if(t.item instanceof X&&t.ast instanceof tt&&t.ast.parentNode instanceof gt){let r=t.item.deletedProperties.find(n=>n.by===t.ast.parentNode)?.property;if(r)return e(Ip(r))}}function zU(t){if(t){if(t.item instanceof X&&!Vt(t.ast))return Ta(t.item);if(t.ast instanceof rr&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return Ta(t.ast.parentNode.linksTo);if(t.ast instanceof Me&&t.ast.linksTo)return Ta(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof Ze&&t.item.parent.name==="aliases"){let e=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(e)return Ta(e)}}}function WU(t){if(t?.ast instanceof pt||t?.ast instanceof ci){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t.ast instanceof pt?t.ast.name:t.ast.value);if(e)return hs.Location.create(ue(e.macro.uri),fe(e.macro.identifier))}}async function AA(t,e){return(await Rt(t,e,r=>[zU(r)||VU(r)||WU(r)])).at(0)}async function IA(t,e,r){if(!r)return;let n=Li(r,t.position);return OA(n,t.position,e,r)}async function OA(t,e,r,n){if(!t?.macro)return;let i=await x({document:n,macro:t,context:r,position:e});if(i)return Ta(i);let s=await Ap({document:n,macro:t,context:r,position:e});if(s)return DA(s);let o=await ds(n,t.macro,e,r);if(o)return OA(o[0],o[1],r,n)}var le=$(j());var GU=(t,e,r,n,i)=>{switch(r){case 1:return[{title:"Add semicolon",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),";")]}}}];case 2:return[{title:"Add open curly",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character)," {")]}}}];case 29:return[{title:"Remove white space",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(le.Range.create(le.Position.create(n.range.start.line,t.pos.colEnd),le.Position.create(n.range.end.line,e.pos.col)),"")]}}}];case 3:return[{title:"Add close curly",diagnostics:[n],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),"}")]}}}];case 19:return[{title:"Add '/'",diagnostics:[n],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),"/")]}}}];case 28:return[{title:"Add comma",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),",")]}}}];case 21:return[{title:"Add '/'",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),"/")]}}}];case 23:return[{title:"Remove ';'",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.del(n.range)]}}}];case 34:return[{title:"Complete Keyword '/delete-node/",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(n.range,"/delete-node/")]}}}];case 35:return[{title:"Complete Keyword '/delete-property/",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(n.range,"/delete-property/")]}}}];case 25:return[{title:"Complete Keyword '/delete-property/",diagnostics:[n],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(n.range,"/delete-property/")]}}},{title:"Complete Keyword '/delete-node/",diagnostics:[n],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(n.range,"/delete-node/")]}}}];case 12:return[{title:"Add '>'",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),">")]}}}];default:return}},KU=(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:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 27:return[{title:i??"Remove Property",diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 26:return[{title:i??"TODO",diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 36:return[{title:i??"TODO",diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 25:return n?[{title:i??"TODO",diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}]:[];default:return}},YU=(t,e,r,n)=>r?.length?[{title:n??"TODO",diagnostics:[t],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[e]:r}}}]:[];function MA(t){let e=t.context.diagnostics.flatMap(a=>{let c=a.data;if(c?.virtual)return[];switch(c?.type){case"FormattingIssues":return YU(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=>GU(c.firstToken,c.lastToken,l,a,t.textDocument.uri));case"StandardTypeIssue":return c?.items.flatMap(l=>KU(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===le.CodeActionKind.SourceFixAll),n=e.filter(a=>a.title.startsWith("Add Property")),i=e.filter(a=>a.kind!==le.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:le.CodeActionKind.QuickFix})),...s.length?[{title:"Fix All",kind:le.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:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[t.textDocument.uri]:a}}}:[])]}var ee=$(j());function xA(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 LA=(t,e)=>e.some(r=>xA(t,r.start)>=0&&xA(t,r.end)<=0),XU=async(t,e,r)=>{let n=Yt.create(t.pos.line,t.pos.col),i=r.find(s=>kr(s,e,n));if(i)return jn(i,e,n)},Op=(t,e)=>{let r=Yt.create(e.length-1,e.at(-1)?.length??0),n=[],i;return t.filter(o=>(o instanceof Zr||o instanceof en)&&/^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:Yt.create(o.firstToken.pos.line,o instanceof Zr?o.firstToken.pos.colEnd:0)};else if(a==="dts-format on"&&i){let c=Yt.create(o.lastToken.pos.line,o instanceof Zr?o.lastToken.pos.colEnd-1:e[o.lastToken.pos.line-1].length);n.push(Je.create(i.start,c)),i=void 0}}),i&&n.push(Je.create(i.start,r)),n},Mp=(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=>!LA(o.range.start,t)&&!LA(o.range.end,t))):r;return"range"in e&&(n=n.filter(i=>bf(e.range,i.raw.range))),n},xp=(t,e)=>async r=>{let n=t.filter(a=>!(a instanceof ui)&&!(a instanceof en)&&!(a instanceof Zr)&&!(a instanceof Vn)&&!(a instanceof bn)),i=await XU(r.firstToken,e,n);if(!i||i===r||r.allDescendants.some(a=>a===i))return{level:0};let s=Rf(i);return{level:Js(e,s),inAst:i}},Wn=(t,e)=>{if(t.insertSpaces)return"".padStart(e," ");let r=Math.floor(e/t.tabSize),n=e%t.tabSize;return`${"".padStart(r," ")}${"".padStart(n," ")}`},to=(t,e,r)=>`${"".padStart(t*e.length,e)}${r}`;var mr=$(j());function $p(t,e,r,n){return Qr(t,e)?n[t.pos.line].slice(0,e.pos.colEnd).replace(/^\s+/,o=>o.replace(/\t/g," ".repeat(r.tabSize))).length>r.wordWrapColumn:null}async function Qc(t,e,r,n,i,s,o=[]){let a=n.split(`
|
|
281
|
+
`),c=Op(e,a),l=n;o.push(...await JU(t,e,r,a,s));let u=Mp(c,t,o);switch(l=kf(hn.create(r,"devicetree",0,n),u.flatMap(d=>d.raw.edit).filter(d=>!!d)),i){case"New Text":return l;case"File Diagnostics":return u}}async function JU(t,e,r,n,i){let s=xp(e,r);return(await Promise.all(e.flatMap(async a=>await $A(t,a,r,s,n,i)))).flat()}var $A=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 We?QU(t,e,r,o,s,i,n):e instanceof Ye?ZU(e,o,u,i,l):[]},QU=async(t,e,r,n,i,s,o)=>{let a=[];return a.push(...(await Promise.all(e.children.flatMap(c=>$A(t,c,r,o,s,i,n+1)))).flat()),a},ZU=(t,e,r,n,i)=>$p(t.firstToken,t.lastToken,r,n)===!1?[]:t.values?eH(t.propertyName?.name.length??0,t.values,e,r,n,i,t.lastToken):[],eH=(t,e,r,n,i,s,o)=>{for(let[a,c]of e.values.entries()){if(!c)continue;let l=tH(t,c,e.values,a,r,n,i,s,a===e.values.length-1&&c.lastToken.nextToken===o?o:void 0);if(l)return l}return[]},Lp=t=>t instanceof Nt||t instanceof Xr&&t.openBracket?t.openBracket??t.firstToken:t.firstToken,tH=(t,e,r,n,i,s,o,a,c)=>{let l=e.nextValueSeparator??c,u=$p(e.firstToken,e.nextValueSeparator?e.nextValueSeparator:l??e.lastToken,s,o);if(u===!1)return;if(u===null){let b=e.value;return b instanceof Nt||b instanceof Xr?qA(t,b,i,s,o,a,l):b instanceof be?qp(t,b,i,s,o,a):[]}let d=o[e.firstToken.pos.line].substring(0,e.firstToken.pos.col),f=Math.trunc((t+3)/s.tabSize),p=(t+3)%s.tabSize,m=f+p+i,h=d.trimStart()!==""?i+t+3:m;if(e.firstToken.pos.col===h){let b=e.value;return b instanceof Nt||b instanceof Xr?qA(t,b,i,s,o,a,l):b instanceof be?qp(t,b,i,s,o,a):void 0}let T=r.slice(n).find(b=>b?.firstToken.pos.line!==e.firstToken.pos.line);return[Ot(8,e.firstToken.uri,Se(e.firstToken,!1),{edit:[mr.TextEdit.replace(mr.Range.create(Se(e.firstToken.prevToken),Se(e.firstToken,!1)),`
|
|
282
|
+
${to(i,a,Wn(s,t+3))}`),...T?[mr.TextEdit.replace(mr.Range.create(Se(Lp(T).prevToken),Se(Lp(T),!1))," ")]:[]],codeActionTitle:`Move ...${e.toString()}... to a new line`},Se(e.lastToken))]},qA=(t,e,r,n,i,s,o)=>{for(let[a,c]of e.values.entries()){if($p(c.firstToken,a===e.values.length-1?o??c.lastToken:c.lastToken,n,i)===!1)continue;if(c.value instanceof Yr)return qp(t,c.value,r,n,i,s,a!==0);if(a===0)return[];let d=e.values.slice(a).find(f=>f?.firstToken.pos.line!==c.firstToken.pos.line);return[Ot(8,c.firstToken.uri,Se(c.firstToken,!1),{edit:[mr.TextEdit.replace(mr.Range.create(Se(c.firstToken.prevToken),Se(c.firstToken,!1)),`
|
|
283
|
+
${to(r,s,Wn(n,t+4))}`),...d?[mr.TextEdit.replace(mr.Range.create(Se(Lp(d).prevToken),Se(Lp(d),!1))," ")]:[]],codeActionTitle:`Move ...${c.toString()}... to a new line`},Se(c.lastToken))]}},qp=(t,e,r,n,i,s,o=!1,a=0)=>{let c=i[e.firstToken.pos.line].substring(0,e.firstToken.pos.col),l=Math.trunc((t+4)/n.tabSize),u=(t+4)%n.tabSize,d=l+u+r,f=c.trimStart()!==""?r+t+4:d;if(o&&e.firstToken.pos.col!==f)return[Ot(8,e.firstToken.uri,Se(e.firstToken,!1),{edit:[mr.TextEdit.replace(mr.Range.create(Se(e.firstToken.prevToken),Se(e.firstToken,!1)),`
|
|
284
|
+
${to(r,s,Wn(n,t+4))}`)],codeActionTitle:`Move ...${e.toString()}... to a new line`},Se(e.lastToken))];if(!(e instanceof Yr))return[];let p=e.flatJoin;for(let[m,h]of p.entries()){let T=$p(h.expression.firstToken,p?.at(m+1)?.operator.lastToken??e.expression.lastToken,n,i);if(T===!1)continue;if(T===null)return qp(t,h.expression,r,n,i,s,m!==0,a+1);let b=p.slice(m).find(_=>_.expression.firstToken.pos.line!==h.expression.firstToken.pos.line);return[Ot(8,h.expression.firstToken.uri,Se(h.expression.firstToken,!1),{edit:[mr.TextEdit.replace(mr.Range.create(Se(h.expression.firstToken.prevToken),Se(h.expression.firstToken,!1)),`
|
|
285
|
+
${to(r,s,Wn(n,t+4))}`),...b?[mr.TextEdit.replace(mr.Range.create(Se(b.expression.firstToken.prevToken),Se(b.expression.firstToken,!1))," ")]:[]],codeActionTitle:`Move ...${h.expression.toString()}... to a new line`},Se(h.expression.lastToken))]}};var CT=(t,e,r)=>!!t.split(`
|
|
286
|
+
`).find(n=>n.replace(/^\s+/,i=>i.replace(/\t/g," ".repeat(e))).trimEnd().length>r);async function va(t,e,r,n={runBaseCheck:!0,runLongLineCheck:!0},i,s=[],o=[]){let a=Pe(t.textDocument.uri);i??=new li(e,a).tokens;let c=[...i],l=new xi(a,[],void 0,()=>i,!0);await l.stable;let u=l.issues.filter(m=>Xs(m.raw,a,!1));if(u?.length)throw new ee.ResponseError(ee.ErrorCodes.InternalError,"Unable to format. File has syntax issues.",u.map(m=>m.diagnostic()));let d=typeof t.options.wordWrapColumn=="number"?t.options.wordWrapColumn:100,f=await rH({...t,options:{...t.options,wordWrapColumn:d}},l,s,o,c,e,n);if(r==="New Text"){let m=e;if(n.runBaseCheck){let h=await DT({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,l.includes,s,a,e,r,n,f);f=[],m=h}if(CT(m,t.options.tabSize,d)){let h="";do{h=m;let T=l.allAstItems;if(h!==e){let b=new xi(a,[],void 0,()=>new li(h,a).tokens,!0);await b.stable,T=b.allAstItems}m=await Qc({...t,options:{...t.options,wordWrapColumn:d}},T,a,h,"New Text",n,[...f])}while(h!==m)}return m}if(r==="Both"){let m=e,h=[];if(n.runBaseCheck){let T=await DT({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,l.includes,s,a,e,r,n,[...f]);m=T.text,h.push(...T.diagnostic)}if(CT(m,t.options.tabSize,d)){h.push(...await Qc({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,a,e,"File Diagnostics",n,[...f]));let T="";do{T=m;let b=l.allAstItems;if(T!==e){let _=new xi(a,[],void 0,()=>new li(T,a).tokens,!0);await _.stable,b=_.allAstItems}m=await Qc({...t,options:{...t.options,wordWrapColumn:d}},b,a,T,"New Text",n,[...f])}while(T!==m)}return{text:m,diagnostic:h}}let p=[];if(n.runBaseCheck){let m=await DT({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,l.includes,s,a,e,r,n,[...f]);p.push(...m)}return CT(e,t.options.tabSize,d)&&p.push(...await Qc({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,a,e,r,n,[...f])),p}var rH=async(t,e,r,n,i,s,o)=>{let a=e.cPreprocessorParser.allAstItems.filter(m=>m instanceof Vn),c=e.cPreprocessorParser.allAstItems.filter(m=>m instanceof bn),l=a.filter(m=>r.every(h=>m.firstToken.pos.line!==h.firstToken.pos.line)),u=c.filter(m=>r.every(h=>m.firstToken.pos.line!==h.firstToken.pos.line));r.push(...l),r.push(...u);let d=[...a.map(m=>m.ifDef.active?m.elseOption?{block:m,branch:m.elseOption}:void 0:{block:m,branch:m.ifDef}),...c.flatMap(m=>{let h=m.ifBlocks.find(b=>b.active),T=m.ifBlocks.filter(b=>!b.active).map(b=>({block:m,branch:b}));return!h&&m.elseOption&&T.push({block:m,branch:m.elseOption}),T})].filter(m=>!!m),f=m=>{let h=m.block.getInValidTokenRangeWhenActiveBlock(m.branch),T=i.filter(_=>!h.has(_)),b=m.block.range;return n.push(m.branch),va({...t,range:b},s,"File Diagnostics",o,T,r,n)},p=[];return await d.filter(m=>n.every(h=>h.firstToken.pos.line!==m.block.firstToken.pos.line)).reduce((m,h)=>m.then(async()=>{p.push(...await f(h))}),Promise.resolve()),p};async function DT(t,e,r,n,i,s,o,a,c=[]){let l=s.split(`
|
|
287
|
+
`),u=Op(e,l),d=s;c.push(...await nH(t,e,r,n,i,l,a));let f=Mp(u,t,c);switch(d=kf(hn.create(i,"devicetree",0,s),f.flatMap(p=>p.raw.edit).filter(p=>!!p)),o){case"New Text":return d;case"File Diagnostics":return f;case"Both":return{text:d,diagnostic:f}}}async function nH(t,e,r,n,i,s,o){let a=xp(e,i),c=(await Promise.all(e.flatMap(async u=>await UA(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),`
|
|
288
|
+
`);c.push(Ot(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(Ot(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=iH(s,l,i);c.push(...u)}return c}var iH=(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=>Xw(c,l.range))||n.push(Ot(2,r,c.start,{edit:ee.TextEdit.del(c),codeActionTitle:"Remove whitespace"},c.end))}}),n},Fp=(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),`
|
|
289
|
+
`.repeat(e));return Ot(1,t.uri,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 Ot(1,t.uri,i,{edit:o,codeActionTitle:"Remove unnecessary new lines",templateStrings:["0"]},s)}},BA=(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),`${`
|
|
290
|
+
`.repeat(i)}${"".padStart(e*r.length,r)}${n}`);return Ot(0,t.uri,o,{edit:c,codeActionTitle:"Move to new line"},a)}},AT=(t,e,r,n,i="")=>{let s=to(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=TH(n,c);if(s===l)return[];let u=ee.TextEdit.replace(c,s);return[Ot(5,t.uri,o,{edit:u,codeActionTitle:"Fix indentation",templateStrings:[s.replaceAll(" ","\xB7").replaceAll(" ","\u2192")]},a)]},_t=(t,e,r=1,n=!1)=>{if(!t.nextToken)return[];if(t.nextToken?.pos.line!==t.pos.line){if(n)return[];let c=Fp(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[Ot(1,t.uri,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[Ot(1,t.uri,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[Ot(1,t.uri,s,{edit:a,codeActionTitle:i>r?"Remove space(s)":"Insert space(s)",templateStrings:[r.toString()]},o)]},Zc=(t,e)=>t.slice(1).flatMap(r=>r.firstToken.prevToken?_t(r.firstToken.prevToken,e):[]),sH=async(t,e,r,n,i,s,o,a,c,l)=>{let u=[],d=e.topComment||e.firstToken.prevToken?.value==="{"&&!e.topComment?1:IT(e.firstToken,n);if(u.push(...rn(e.firstToken,s,o,c,void 0,d,!0)),e instanceof Xe||e instanceof fr)if(u.push(...Zc(e.labels,c)),e instanceof Xe){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();h!==m&&u.push(Ot(9,p.uri,Se(p.firstToken,!1),{edit:ee.TextEdit.replace(fe(p),h),codeActionTitle:`Change to '${h}'`},Se(p.lastToken)))}),e.labels.length&&e.name&&e.name.firstToken.prevToken&&u.push(..._t(e.name.firstToken.prevToken,c));let f=e.name&&e.openScope?_t(e.name.lastToken,c):[];u.push(...f)}else{e.labels.length&&e.reference?.firstToken.prevToken&&u.push(..._t(e.reference.firstToken.prevToken,c));let f=e.reference&&e.openScope?_t(e.reference.lastToken,c):[];u.push(...f)}else e instanceof It&&e.firstToken.value==="/"&&e.openScope&&u.push(..._t(e.firstToken,c,1));return u.push(...(await Promise.all(e.children.flatMap(f=>UA(t,f,i,l,c,r,n,a,s+1)))).flat()),e.closeScope&&(e.openScope&&e.closeScope.prevToken===e.openScope?u.push(..._t(e.openScope,c,0)):u.push(...rn(e.closeScope,s,o,c,void 0,1,!0))),e.lastToken.value===";"&&e.closeScope&&u.push(...jp(e.closeScope,e.lastToken)),u},oH=(t,e,r,n,i,s)=>{let o=[];if(o.push(...Zc(e.labels,s)),e.labels.length&&e.value?.firstToken.prevToken&&o.push(..._t(e.value.firstToken.prevToken,s)),e.value instanceof Kt){let a=s[e.value.firstToken.pos.line].slice(e.value.firstToken.pos.col,e.value.lastToken.pos.colEnd),c=a.toLowerCase();c!==a&&o.push(Ot(9,e.value.uri,Se(e.value.firstToken,!1),{edit:ee.TextEdit.replace(fe(e.value),c),codeActionTitle:`Change to '${c}'`},Se(e.value.lastToken)))}if(e.firstToken.prevToken)if(e.firstToken.pos.line!==e.firstToken.prevToken?.pos.line&&e.firstToken.prevToken!==i){let a=Fp(e.firstToken,1,!0);a&&o.push(a),o.push(...AT(e.firstToken,r,n.singleIndent,s,Wn(n,t+4)))}else o.push(..._t(e.firstToken.prevToken,s,i&&e.firstToken.prevToken===i?0:1));return e.value instanceof be&&o.push(...Bp(e.value,s,r,n,t+4)),o},aH=(t,e,r,n,i)=>{let s=[];return e instanceof Nt||e instanceof Xr?e.openBracket&&e.openBracket?.nextToken===e.closeBracket?s.push(..._t(e.openBracket,i,0)):(s.push(...e.values.flatMap(o=>oH(t,o,r,n,e.openBracket,i))),e.closeBracket?.prevToken&&(e.values.at(-1)?.lastToken===e.closeBracket?.prevToken||e.closeBracket?.prevToken.value==="/"&&e.closeBracket?.prevToken?.prevToken?.value==="*"?s.push(..._t(e.closeBracket.prevToken,i,e.closeBracket.prevToken===e.values.at(-1)?.lastToken?0:1)):s.push(...rn(e.closeBracket,r,n.singleIndent,i)))):e instanceof be&&s.push(...Bp(e,i,r,n,t)),s},Bp=(t,e,r,n,i)=>t instanceof mn?cH(t,e):t instanceof Yr?lH(t,e,r,n,i):[],cH=(t,e)=>{let r=[];return r.push(..._t(t.functionName.lastToken,e,0)),t.lastToken.value===")"&&t.lastToken.prevToken&&r.push(..._t(t.lastToken.prevToken,e,0)),r},lH=(t,e,r,n,i)=>{let s=[];if(t.openBracket&&t.openBracket.nextToken&&s.push(..._t(t.openBracket,e,0)),s.push(...Bp(t.expression,e,r,n,i)),t.join?.forEach(o=>{o.operator.firstToken.prevToken&&s.push(..._t(o.operator.firstToken.prevToken,e)),o.expression.firstToken.prevToken?.pos.line===o.expression.firstToken.pos.line?s.push(..._t(o.expression.firstToken.prevToken,e)):s.push(...rn(o.expression.firstToken,r,n.singleIndent,e,Wn(n,i))),s.push(...Bp(o.expression,e,r,n,i))}),!t.join?.length&&!(t.expression instanceof Yr)&&(t.expression instanceof mn||t.expression instanceof pt)){let o=[];if(t.openBracket){let a=ee.Position.create(t.openBracket.pos.line,t.openBracket.pos.col),c=ee.Position.create(t.openBracket.pos.line,t.openBracket.pos.colEnd);o.push(ee.TextEdit.del(ee.Range.create(a,c)))}if(t.closeBracket){let a=ee.Position.create(t.closeBracket.pos.line,t.closeBracket.pos.col),c=ee.Position.create(t.closeBracket.pos.line,t.closeBracket.pos.colEnd);o.push(ee.TextEdit.del(ee.Range.create(a,c)))}s.push(Ot(7,t.uri,o[0].range.start,{edit:o,codeActionTitle:"Remove (...)"},o[o.length-1].range.end))}return t.closeBracket&&t.closeBracket.prevToken&&s.push(..._t(t.closeBracket.prevToken,e,0)),s},uH=(t,e,r,n,i)=>{let s=[];return s.push(...Zc(e.startLabels,i)),s.push(...aH(t,e.value,r,n,i)),s.push(...Zc(e.endLabels,i)),s},dH=(t,e,r,n,i,s,o)=>{let a=[];return r.values.forEach((c,l)=>{if(!c)return[];let u=c.firstToken.prevToken,d=l?r.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=BA(c.firstToken,n,i.singleIndent,Wn(i,t+3));f&&a.push(f)}else a.push(..._t(u,s,1));else if(o&&c.firstToken.prevToken===o)a.push(..._t(o,s));else{let f=Fp(c.firstToken,1,!0);f&&a.push(f),a.push(...AT(c.firstToken,n,i.singleIndent,s,Wn(i,t+3)))}a.push(...uH(t,c,n,i,s)),c.nextValueSeparator&&a.push(...jp(c.lastToken,c.nextValueSeparator))}),a},fH=(t,e,r,n)=>{let i=[],{force:s,newLines:o}=jA(t,t.firstToken);return i.push(...rn(t.firstToken,e,r.singleIndent,n,void 0,o,s)),i.push(...Zc(t.labels,n)),t.labels.length&&t.propertyName?.firstToken.prevToken&&i.push(..._t(t.propertyName.firstToken.prevToken,n)),t.values&&(t.propertyName&&i.push(..._t(t.propertyName?.lastToken,n)),i.push(...dH(t.propertyName?.name.length??0,t.propertyName?.name??"",t.values,e,r,n,t.assignOperatorToken))),t.lastToken.value===";"&&i.push(...jp(t.children[t.children.length-1].lastToken,t.lastToken)),i},rn=(t,e,r,n,i,s,o)=>{let a=[],c=BA(t,e,r,i,s);if(c)a.push(c);else{let l=Fp(t,s,o);l&&a.push(l),a.push(...AT(t,e,r,n,i))}return a},jp=(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[Ot(1,t.uri,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[Ot(6,t.uri,r,{edit:i,codeActionTitle:"Move token",templateStrings:[e.value]},n)]},pH=(t,e,r,n)=>{let i=[];i.push(...rn(t.firstToken,e,r,n));let s=_t(t.keyword.lastToken,n);return i.push(...s),t.lastToken.value===";"&&i.push(...jp(t.children[t.children.length-1].lastToken,t.lastToken)),i},hH=(t,e,r,n,i)=>{if(r===void 0)return[];if(!pe(t.uri,e))return[];let s=[];s.push(...rn(t.firstToken,r.level,n,i));let o=_t(t.keyword.lastToken,i);return s.push(...o),s},mH=(t,e,r,n,i,s)=>t.comments.length===1&&t.firstToken.pos.line===t.firstToken.prevToken?.pos.line?[]:t.comments.flatMap((o,a)=>gH(o,t,e,r,n,i,a?a===t.comments.length-1?"last":"comment":"first",s)),FA=(t,e,r="")=>{let n=e?nT(e):void 0;if(!n)return r;let i=Qs(e),s=n.propertyName?.name.length??0;return`${`${Wn(t,s+(i?4:3)+(r.length-r.trimStart().length))}`}${r.trimStart()}`},IT=(t,e)=>{let r=e.flatMap(n=>n instanceof Vn?[n.ifDef.identifier?.lastToken.nextToken,n.elseOption?.keyword.lastToken.nextToken]:[...n.ifBlocks.map(i=>i.expression?.lastToken.nextToken),n.elseOption?.lastToken.nextToken]).some(n=>n===t);return t.prevToken?.value==="{"||r?1:2},jA=(t,e)=>{let r=t.parentNode instanceof We?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 We&&t.firstToken.prevToken===(i.endComment??i).lastToken?{newLines:2,force:!0}:{newLines:void 0,force:void 0}},gH=(t,e,r,n,i,s,o,a)=>{if(!t.firstToken.prevToken)return rn(t.firstToken,n?.level??0,i,s);if(t.firstToken.pos.line===t.firstToken.prevToken?.pos.line)return _t(t.firstToken.prevToken,s,1);if(n===void 0)return[];let c,l;if(o==="first"&&!e.astBeforeComment&&e.astAfterComment instanceof We)c=!0,l=IT(e.firstToken,r);else if(o==="first"&&!e.astBeforeComment&&e.astAfterComment instanceof Ye){let{force:p,newLines:m}=jA(e.astAfterComment,e.firstToken);c=p,l=m}let u=[],d="",f=t.toString();switch(o==="last"&&f.trim()!==""&&t.lastToken.prevToken&&(o="comment",u.push(...rn(t.lastToken.prevToken,n?.level??0,i,s," "))),o){case"comment":d=t.firstToken.value==="*"?" ":" * ";break;case"first":break;case"last":d=" ";break}return n?.inAst instanceof We?u.push(...rn(t.firstToken,n?.level??0,i,s,d,l,c)):u.push(...rn(t.firstToken,n?.level??0,i,s,FA(a,n?.inAst,d),l,c)),u},yH=(t,e,r,n,i,s)=>{if(!t.firstToken.prevToken)return rn(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 We&&(a=!0,c=IT(t.firstToken,e)),rn(t.firstToken,r?.level??0,n,i,FA(s,r?.inAst),c,a)},UA=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 We?sH(t,e,s,o,r,c,d,a,i,n):e instanceof Ye?fH(e,c,f,i):e instanceof _r?pH(e,c,d,i):e instanceof ui?hH(e,r,await n(e),d,i):e instanceof en&&!e.disabled?yH(e,o,await n(e),d,i,f):e instanceof Zr&&!e.disabled?mH(e,o,await n(e),d,i,f):[]};function TH(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(`
|
|
291
|
+
`)}var HA=$(j());var Up=t=>!t||t instanceof Ye?!1:t instanceof Nr||Up(t.parentNode);function vH(t){if(!t||!(t.item instanceof Ze&&t.item.ast.assignOperatorToken))return[];let e=Up(t?.ast);if(!e&&!(t.ast instanceof Ye&&t.item.ast.values===null)&&!Up(t.beforeAst)&&!Up(t.afterAst))return[];let r=-1;if(t.item.ast.values===null?r=0:r=(t.item.ast.values?.values.findIndex(i=>i&&iT(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 s instanceof Pt&&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=>({label:`"${c}"`,kind:HA.CompletionItemKind.Variable,insertText:e?c:`"${c}"`})))}let n=t.item.parent.nodeType;return n instanceof Pt?n.properties.find(i=>i.name===t.item?.name)?.getPropertyCompletionItems(t.item,r,e)??[]:[]}function bH(t){if(!t||!(t.item instanceof Ze&&t.ast instanceof tt&&t.item.ast.values==null||t.item instanceof X)||Vt(t.ast)||t.beforeAst?.parentNode instanceof _r)return[];let e=r=>r.nodeType?.getPropertyListCompletionItems(r)??[];return t.item instanceof Ze?e(t.item.parent):e(t.item)}async function VA(t,e){return Rt(t,e,r=>[...vH(r),...bH(r)])}var Hp=$(j());async function SH(t){if(t?.ast instanceof pt||t?.ast instanceof ci){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t?.ast instanceof pt?t.ast.name:t.ast.value);if(e){let r=Cc(t.ast),n=(await t.runtime.context.getAllStableParsers()).at(-1);if(r){let i=r?.evaluate(n.cPreprocessorParser.macros);return{contents:{kind:Hp.MarkupKind.Markdown,value:["```cpp",`#define ${e.macro.toString()} // = ${i}${typeof i=="number"?` (0x${i.toString(16)})`:""}`,"```"].join(`
|
|
292
|
+
`)},range:fe(t.ast)}}return{contents:{kind:Hp.MarkupKind.Markdown,value:["```cpp",`#define ${e.macro.toString()} // = ${t.ast?.evaluate(n.cPreprocessorParser.macros)}`,"```"].join(`
|
|
293
|
+
`)},range:fe(t.ast)}}}}async function _H(t){if(!t)return;let e=(await t.runtime.context.getAllStableParsers()).at(-1);if(t?.ast instanceof Me){let r=t.ast.linksTo;if(r)return{contents:r.toMarkupContent(e.cPreprocessorParser.macros),range:fe(t.ast)}}if(t?.ast.parentNode instanceof ie){let r=t.ast.parentNode.linksTo;if(r)return{contents:r.toMarkupContent(e.cPreprocessorParser.macros),range:fe(t.ast)}}if(t?.ast instanceof ne&&t.item instanceof Ze&&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:fe(t.ast)}}if(t?.item instanceof X)return{contents:t.item.toMarkupContent(e.cPreprocessorParser.macros),range:fe(t.ast)}}function kH(t){if(t?.item instanceof Ze&&t.ast instanceof tt){let e=t.item.onHover(),r=t.item.parent.nodeType?.getOnPropertyHover(t.item.name);if(e||r)return{contents:{kind:Hp.MarkupKind.Markdown,value:`${e?.value??""}
|
|
294
|
+
${r?.value??""}`},range:fe(t.ast)}}}function zA(t,e){return Rt(t,e,async r=>[await _H(r)||kH(r)||await SH(r)])}async function WA(t){let e=await np(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function GA(t){let e=await ip(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var XA=$(j());async function KA(t){return t?.nodes.length??0}async function YA({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 KA(s)}async function JA(t){let e=await YA(t,x);return e!==void 0?{contents:{kind:XA.MarkupKind.Markdown,value:e.toString()}}:void 0}async function QA(t){let e=await wT(t);if(e)return e?.length?{contents:{kind:cs.Markdown,value:e.map((r,n)=>{let i=r.toMarkupContent(t.context.macros);return`## Node ${n+1}
|
|
295
295
|
|
|
296
296
|
${i.value}
|
|
297
297
|
`}).join(`
|
|
298
298
|
|
|
299
|
-
`)}}:{contents:{kind:as.Markdown,value:`No node matched compat ${t.macro.args[0].macro}`}}}async function XA(t){let e=await ap(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function JA(t,e){return!!await ip(t,e)}async function QA({macro:t,context:e}){if(!(t.macro!=="DT_HAS_ALIAS"||t.args?.length!==1))return JA(t.args[0].macro,e)}async function ZA(t){let e=await QA(t);if(e!==void 0)return{contents:{kind:as.Markdown,value:e?"1":"0"}}}var t0=$(U());async function Jc(t,e){if(t)switch(e){case"Unquoted":return t.fullName;case"Quoted":return`"${t.fullName}"`;case"Token":return ee(t.fullName);case"Upper Token":return ee(t.fullName).toUpperCase()}}async function e0({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 Jc(s,"Quoted");case"DT_NODE_FULL_NAME_TOKEN":return Jc(s,"Token");case"DT_NODE_FULL_NAME_UNQUOTED":return Jc(s,"Unquoted");case"DT_NODE_FULL_NAME_UPPER_TOKEN":return Jc(s,"Upper Token")}}async function r0(t){let e=await e0(t,x);if(e)return{contents:{kind:t0.MarkupKind.Markdown,value:e}}}var s0=$(U());async function n0(t){return t?.pathString}async function i0({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 n0(s)}async function o0(t){let e=await i0(t,x);if(e)return{contents:{kind:s0.MarkupKind.Markdown,value:`"${e}"`}}}async function a0(t){let e=await lp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var u0=$(U());async function c0(t){return t?.labels.map(e=>e.label)}async function l0({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 c0(s)}async function d0(t){let e=await l0(t,x);if(e)return{contents:{kind:u0.MarkupKind.Markdown,value:`{ ${e.map(r=>`"${r}"`).join(", ")} }`}}}async function f0(t){let e=await up(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function p0(t){let e=await fp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var m0=$(U());async function h0({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 g0(t){let e=await h0(t,x);if(e!==void 0)return{contents:{kind:m0.MarkupKind.Markdown,value:e?"1":"0"}}}var T0=$(U());async function y0({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=Ce(s[2].macro);if(typeof a=="number")return await ua(o,s[1].macro,a)}async function v0(t){let e=await y0(t,x);return e?{contents:{kind:T0.MarkupKind.Markdown,value:e.toString()}}:void 0}var S0=$(U());async function b0({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=Ce(s[2].macro);if(typeof a=="number")return us(o,s[1].macro,a,s[3].macro,r)}async function _0(t){let e=await b0(t,x);return e?{contents:{kind:S0.MarkupKind.Markdown,value:e.toString()}}:void 0}async function k0(t){let e=await di(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function N0(t){let e=await vp(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var Qc=$(U());async function at(t,e){if(e){if(typeof e=="boolean")return{contents:{kind:Qc.MarkupKind.Markdown,value:e?"1":"0"}};if(typeof e=="string")return{contents:{kind:Qc.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:Qc.MarkupKind.Markdown,value:e.length===1?e[0].toString():`{${e.join(", ")}}`}};if(e.every(r=>typeof r=="string"))return{contents:{kind:Qc.MarkupKind.Markdown,value:e.length===1?`"${e[0]}"`:`{${e.map(r=>`"${r}"`).join(", ")}}`}}}}async function R0(t){let e=await Qf(t,x);return at(t.context,e)}var ET=$(U());async function P0(t){let e=await Zf(t,x);if(e===!0)return{contents:{kind:ET.MarkupKind.Markdown,value:"1"}};if(e)return e instanceof J?{contents:e.toMarkupContent(t.context.macros)}:{contents:{kind:ET.MarkupKind.Markdown,value:e.toString()}}}async function w0(t){let e=await la(t,x);return at(t.context,e)}async function E0({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 ui(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro);return await pr(s,e.args[3].macro,r)}async function C0(t){return at(t.context,await E0(t,x))}async function D0(t){let e=await pp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var O0=$(U());async function A0(t){return t?.nodes.filter(e=>!e.disabled).length??0}async function I0({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 A0(s)}async function M0(t){let e=await I0(t,x);return e!==void 0?{contents:{kind:O0.MarkupKind.Markdown,value:e.toString()}}:void 0}async function x0(t){let e=await ds(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var q0=$(U());async function L0({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 us(o,s[1].macro,0,s[2].macro,r)}async function $0(t){let e=await L0(t,x);return e?{contents:{kind:q0.MarkupKind.Markdown,value:e.toString()}}:void 0}var B0=$(U());async function F0(t){let e=await yp(t,x);return e instanceof J?at(t.context,e):e?{contents:{kind:B0.MarkupKind.Markdown,value:e.toString()}}:void 0}var U0=$(U());async function j0({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 us(o,s[1].macro,s[2].macro,s[3].macro,r)}async function H0(t){let e=await j0(t,x);return e?{contents:{kind:U0.MarkupKind.Markdown,value:e.toString()}}:void 0}var V0=$(U());async function z0(t){let e=await Tp(t,x);return e instanceof J?at(t.context,e):e?{contents:{kind:V0.MarkupKind.Markdown,value:e.toString()}}:void 0}var W0=$(U());async function G0(t){let e=await bp(t,x);return e instanceof J?at(t.context,e):e?{contents:{kind:W0.MarkupKind.Markdown,value:e.toString()}}:void 0}var K0=$(U());async function Y0(t){let e=await mp(t,x);return e instanceof J?at(t.context,e):e?{contents:{kind:K0.MarkupKind.Markdown,value:e.toString()}}:void 0}var J0=$(U());async function X0({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 ua(o,s[1].macro,0)}async function Q0(t){let e=await X0(t,x);return e?{contents:{kind:J0.MarkupKind.Markdown,value:e.toString()}}:void 0}var Z0=$(U());async function eI(t){let e=await gp(t,x);return e instanceof J?at(t.context,e):e?{contents:{kind:Z0.MarkupKind.Markdown,value:e.toString()}}:void 0}async function tI({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_BY_PHANDLE"||e.args?.length!==3)return;let s=await ui(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro);return pr(s,e.args[2].macro,r)}async function rI(t){return at(t.context,await tI(t,x))}async function nI(t){return at(t.context,await Sp(t,x))}var oI=$(U());var iI=$(require("util"));async function qp(t,e,r,n){let i=t?.properties.find(o=>ee(o.name)===e);if(!i)return;let s=i?.ast.quickValues?.at(r);if(s!==void 0)return iI.default.isDeepStrictEqual(Ce(n),s)}async function sI({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 qp(o,s[1].macro,0,s[2].macro)}async function aI(t){let e=await sI(t,x);return e!==void 0?{contents:{kind:oI.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}var lI=$(U());async function cI({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=Ce(s[2].macro);if(typeof a=="number")return await qp(o,s[1].macro,a,s[3].macro)}async function uI(t){let e=await cI(t,x);return e!==void 0?{contents:{kind:lI.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}var pI=$(U());async function dI(t,e,r,n){let i=await pr(t,e,n);if(i===void 0)return!1;if(r=typeof r=="number"?r:Ce(r??"0"),typeof r=="number")return Array.isArray(i)?i.length<r:r===0}async function fI({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 dI(await i({document:t,macro:s[0],context:r,position:n}),s[1].macro,s[2].macro,r)}async function hI(t){let e=await fI(t,x);return e===void 0?void 0:{contents:{kind:pI.MarkupKind.Markdown,value:e?"1":"0"}}}var yI=$(U());async function mI(t,e,r,n){let i=t?.properties.find(u=>ee(u.name)===e),s=i?.parent.nodeType;if(!s||!(s instanceof Rt)||await pr(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 gI({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 mI(await i({document:t,macro:s[0],context:r,position:n}),s[1].macro,s[2].macro,r)}async function TI(t){let e=await gI(t,x);return e===void 0?void 0:{contents:{kind:yI.MarkupKind.Markdown,value:e?"1":"0"}}}async function vI(t){let e=await cp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var SI=$(U());async function bI({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?_p(o,s[1].macro):void 0}async function _I(t){let e=await bI(t,x);return e?{contents:{kind:SI.MarkupKind.Markdown,value:e.toString()}}:void 0}var kI=$(U());async function NI(t){let e=await kp(t,x);return e instanceof J?at(t.context,e):e?{contents:{kind:kI.MarkupKind.Markdown,value:e.toString()}}:void 0}var CT=$(U());async function RI(t,e,r){let n=await pr(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 PI({document:t,macro:e,context:r,position:n},i){if(!(e.macro!=="DT_PROP_LAST"||e.args?.length!==2))return RI(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,r)}async function wI(t){let e=await PI(t,x);if(e===!0)return{contents:{kind:CT.MarkupKind.Markdown,value:"1"}};if(e)return e instanceof J?{contents:e.toMarkupContent(t.context.macros)}:{contents:{kind:CT.MarkupKind.Markdown,value:e.toString()}}}var CI=$(U());async function EI({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?fa(o,s[1].macro):void 0}async function DI(t){let e=await EI(t,x);if(e)return{contents:{kind:CI.MarkupKind.Markdown,value:e.toString()}}}var II=$(U());async function $p(t,e,r){if(!t)return;let i=t?.properties.find(s=>ee(s.name)===e)?.ast.getFlatAstValues();if(!(!i||i.length<=1)&&i[r]instanceof ne)return ee(i[r].value)}async function AI({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=Ce(s[2].macro);if(typeof a=="number")return o?$p(o,s[1].macro,a):void 0}async function OI(t){let e=await AI(t,x);if(e)return{contents:{kind:II.MarkupKind.Markdown,value:e.toString()}}}var MI=$(U());async function xI(t){let e=await Np(t,x);if(e)return e instanceof J?at(t.context,e):{contents:{kind:MI.MarkupKind.Markdown,value:e.toString()}}}var $I=$(U());async function LI(t,e,r){if(!t)return;let i=t?.properties.find(s=>ee(s.name)===e)?.ast.getFlatAstValues();if(!(!i||i.length<=1)&&i[r]instanceof ne)return i[r].value}async function qI({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=Ce(s[2].macro);if(typeof a=="number")return o?LI(o,s[1].macro,a):void 0}async function BI(t){let e=await qI(t,x);if(e)return{contents:{kind:$I.MarkupKind.Markdown,value:e.toString()}}}var jI=$(U());async function FI({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?Rp(o,s[1].macro):void 0}async function UI(t){let e=await FI(t,x);if(e)return{contents:{kind:jI.MarkupKind.Markdown,value:e.toString()}}}var HI=$(U());async function VI(t){let e=await Pp(t,x);if(e)return e instanceof J?at(t.context,e):{contents:{kind:HI.MarkupKind.Markdown,value:e.toString()}}}var GI=$(U());async function zI(t,e,r){return(await $p(t,e,r))?.toUpperCase()}async function WI({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=Ce(s[2].macro);if(typeof a=="number")return o?zI(o,s[1].macro,a):void 0}async function KI(t){let e=await WI(t,x);if(e)return{contents:{kind:GI.MarkupKind.Markdown,value:e.toString()}}}var XI=$(U());async function YI({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?wp(o,s[1].macro):void 0}async function JI(t){let e=await YI(t,x);if(e)return{contents:{kind:XI.MarkupKind.Markdown,value:e.toString()}}}var QI=$(U());async function ZI(t){let e=await Ep(t,x);if(e)return e instanceof J?at(t.context,e):{contents:{kind:QI.MarkupKind.Markdown,value:e.toString()}}}async function eO(t){let e=await tp(t,x);return e?{contents:e.toMarkupContent(t.context.macros)}:void 0}var nO=$(U());async function tO(t,e){if(!t)return;let r=t.nodeType?.onBus;return r?ee(r)===e:!1}async function rO(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 tO(n,r[1].macro)}async function iO(t){let e=await rO(t,x);return e!==void 0?{contents:{kind:nO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}async function sO(t){let e=await np(t);return e?{contents:e.toMarkupContent(t.context.macros)}:void 0}var cO=$(U());async function oO(t,e){return!!await rp(t,e)}async function aO(t){let e=t.macro.args;if(!(t.macro.macro!=="DT_HAS_CHOSEN"||e?.length!==1))return await oO(t.context,e[0].macro)}async function lO(t){let e=await aO(t);return e!==void 0?{contents:{kind:cO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}async function _H(t){return[eO,iO,sO,lO,HA,VA,KA,M0,YA,XA,ZA,vI,D0,p0,o0,r0,a0,d0,f0,g0].reduce((e,r)=>e.then(n=>n||r(t)),Promise.resolve(void 0))}async function kH(t){return[uI,aI,v0,Y0,Q0,eI,_0,F0,H0,z0,$0,k0,N0,x0,G0,P0,rI,C0,nI,hI,TI,R0,wI,_I,NI,w0,OI,DI,xI,BI,UI,VI,KI,JI,ZI].reduce((e,r)=>e.then(n=>n||r(t)),Promise.resolve(void 0))}async function uO(t,e,r){if(!r)return;let n=Mi(r,t.position);return dO(n,t.position,e,r)}async function dO(t,e,r,n){if(!t?.macro)return;let i=await _H({position:e,context:r,document:n,macro:t})||await kH({position:e,context:r,document:n,macro:t});if(i)return i;let s=await x({document:n,macro:t,context:r,position:e});if(s)return{contents:s.toMarkupContent(r.macros)};let o=await ls(n,t.macro,e,r);if(o)return dO(o[0],o[1],r,n)}var D_=require("path"),A_=require("fs");var DT=(t,e,r)=>{let n=t instanceof RegExp?fO(t,r):t,i=e instanceof RegExp?fO(e,r):e,s=n!==null&&i!=null&&NH(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)}},fO=(t,e)=>{let r=e.match(t);return r?r[0]:null},NH=(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 pO="\0SLASH"+Math.random()+"\0",hO="\0OPEN"+Math.random()+"\0",IT="\0CLOSE"+Math.random()+"\0",mO="\0COMMA"+Math.random()+"\0",gO="\0PERIOD"+Math.random()+"\0",RH=new RegExp(pO,"g"),PH=new RegExp(hO,"g"),wH=new RegExp(IT,"g"),EH=new RegExp(mO,"g"),CH=new RegExp(gO,"g"),DH=/\\\\/g,AH=/\\{/g,IH=/\\}/g,OH=/\\,/g,MH=/\\./g;function AT(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function xH(t){return t.replace(DH,pO).replace(AH,hO).replace(IH,IT).replace(OH,mO).replace(MH,gO)}function LH(t){return t.replace(RH,"\\").replace(PH,"{").replace(wH,"}").replace(EH,",").replace(CH,".")}function yO(t){if(!t)return[""];let e=[],r=DT("{","}",t);if(!r)return t.split(",");let{pre:n,body:i,post:s}=r,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=yO(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function TO(t){return t?(t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),Zc(xH(t),!0).map(LH)):[]}function qH(t){return"{"+t+"}"}function $H(t){return/^-?0\d/.test(t)}function BH(t,e){return t<=e}function FH(t,e){return t>=e}function Zc(t,e){let r=[],n=DT("{","}",t);if(!n)return[t];let i=n.pre,s=n.post.length?Zc(n.post,!1):[""];if(/\$$/.test(n.pre))for(let o=0;o<s.length;o++){let a=i+"{"+n.body+"}"+s[o];r.push(a)}else{let o=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),a=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),c=o||a,l=n.body.indexOf(",")>=0;if(!c&&!l)return n.post.match(/,(?!,).*\}/)?(t=n.pre+"{"+n.body+IT+n.post,Zc(t)):[t];let u;if(c)u=n.body.split(/\.\./);else if(u=yO(n.body),u.length===1&&u[0]!==void 0&&(u=Zc(u[0],!1).map(qH),u.length===1))return s.map(f=>n.pre+u[0]+f);let d;if(c&&u[0]!==void 0&&u[1]!==void 0){let f=AT(u[0]),p=AT(u[1]),m=Math.max(u[0].length,u[1].length),h=u.length===3&&u[2]!==void 0?Math.abs(AT(u[2])):1,T=BH;p<f&&(h*=-1,T=FH);let S=u.some($H);d=[];for(let v=f;T(v,p);v+=h){let N;if(a)N=String.fromCharCode(v),N==="\\"&&(N="");else if(N=String(v),S){let C=m-N.length;if(C>0){let H=new Array(C+1).join("0");v<0?N="-"+H+N.slice(1):N=H+N}}d.push(N)}}else{d=[];for(let f=0;f<u.length;f++)d.push.apply(d,Zc(u[f],!1))}for(let f=0;f<d.length;f++)for(let p=0;p<s.length;p++){let m=i+d[f]+s[p];(!e||c||m)&&r.push(m)}}return r}var el=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")};var jH={"[: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]},tl=t=>t.replace(/[[\]\\-]/g,"\\$&"),UH=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),vO=t=>t.join(""),bO=(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[T,[b,S,v]]of Object.entries(jH))if(t.startsWith(T,s)){if(d)return["$.",!1,t.length-r,!0];s+=T.length,v?i.push(b):n.push(b),a=a||S;continue e}}if(c=!1,d){h>d?n.push(tl(d)+"-"+tl(h)):h===d&&n.push(tl(h)),d="",s++;continue}if(t.startsWith("-]",s+1)){n.push(tl(h+"-")),s+=2;continue}if(t.startsWith("-",s+1)){d=h,s+=2;continue}n.push(tl(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[UH(h),!1,u-r,!1]}let f="["+(l?"^":"")+vO(n)+"]",p="["+(l?"":"^")+vO(i)+"]";return[n.length&&i.length?"("+f+"|"+p+")":n.length?f:p,a,u-r,!0]};var Hn=(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 HH=new Set(["!","?","+","*","@"]),SO=t=>HH.has(t),VH="(?!(?:^|/)\\.\\.?(?:$|/))",Bp="(?!\\.)",zH=new Set(["[","."]),WH=new Set(["..","."]),GH=new Set("().*{}+?[]^$\\!"),KH=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),OT="[^/]",_O=OT+"*?",kO=OT+"+?",ya=class t{type;#e;#t;#n=!1;#r=[];#o;#f;#a;#d=!1;#c;#l;#s=!1;constructor(e,r,n={}){this.type=e,e&&(this.#t=!0),this.#o=r,this.#e=this.#o?this.#o.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#a=this.#e===this?[]:this.#e.#a,e==="!"&&!this.#e.#d&&this.#a.push(this),this.#f=this.#o?this.#o.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l!==void 0?this.#l:this.type?this.#l=this.type+"("+this.#r.map(e=>String(e)).join("|")+")":this.#l=this.#r.map(e=>String(e)).join("")}#y(){if(this!==this.#e)throw new Error("should only call on root");if(this.#d)return this;this.toString(),this.#d=!0;let e;for(;e=this.#a.pop();){if(e.type!=="!")continue;let r=e,n=r.#o;for(;n;){for(let i=r.#f+1;!n.type&&i<n.#r.length;i++)for(let s of e.#r){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#r[i])}r=n,n=r.#o}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof t&&r.#o===this))throw new Error("invalid part: "+r);this.#r.push(r)}}toJSON(){let e=this.type===null?this.#r.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#r.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#d&&this.#o?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#o?.isStart())return!1;if(this.#f===0)return!0;let e=this.#o;for(let r=0;r<this.#f;r++){let n=e.#r[r];if(!(n instanceof t&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let e=this.#o?this.#o.#r.length:0;return this.#f===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let r=new t(this.type,e);for(let n of this.#r)r.copyIn(n);return r}static#T(e,r,n,i){let s=!1,o=!1,a=-1,c=!1;if(r.type===null){let p=n,m="";for(;p<e.length;){let h=e.charAt(p++);if(s||h==="\\"){s=!s,m+=h;continue}if(o){p===a+1?(h==="^"||h==="!")&&(c=!0):h==="]"&&!(p===a+2&&c)&&(o=!1),m+=h;continue}else if(h==="["){o=!0,a=p,c=!1,m+=h;continue}if(!i.noext&&SO(h)&&e.charAt(p)==="("){r.push(m),m="";let T=new t(h,r);p=t.#T(e,T,p,i),r.push(T);continue}m+=h}return r.push(m),p}let l=n+1,u=new t(null,r),d=[],f="";for(;l<e.length;){let p=e.charAt(l++);if(s||p==="\\"){s=!s,f+=p;continue}if(o){l===a+1?(p==="^"||p==="!")&&(c=!0):p==="]"&&!(l===a+2&&c)&&(o=!1),f+=p;continue}else if(p==="["){o=!0,a=l,c=!1,f+=p;continue}if(SO(p)&&e.charAt(l)==="("){u.push(f),f="";let m=new t(p,u);u.push(m),l=t.#T(e,m,l,i);continue}if(p==="|"){u.push(f),f="",d.push(u),u=new t(null,r);continue}if(p===")")return f===""&&r.#r.length===0&&(r.#s=!0),u.push(f),f="",r.push(...d,u),l;f+=p}return r.type=null,r.#t=void 0,r.#r=[e.substring(n-1)],l}static fromGlob(e,r={}){let n=new t(null,void 0,r);return t.#T(e,n,0,r),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[r,n,i,s]=this.toRegExpSource();if(!(i||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:e})}get options(){return this.#c}toRegExpSource(e){let r=e??!!this.#c.dot;if(this.#e===this&&this.#y(),!this.type){let c=this.isStart()&&this.isEnd()&&!this.#r.some(p=>typeof p!="string"),l=this.#r.map(p=>{let[m,h,T,b]=typeof p=="string"?t.#p(p,this.#t,c):p.toRegExpSource(e);return this.#t=this.#t||T,this.#n=this.#n||b,m}).join(""),u="";if(this.isStart()&&typeof this.#r[0]=="string"&&!(this.#r.length===1&&WH.has(this.#r[0]))){let m=zH,h=r&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),T=!r&&!e&&m.has(l.charAt(0));u=h?VH:T?Bp:""}let d="";return this.isEnd()&&this.#e.#d&&this.#o?.type==="!"&&(d="(?:$|\\/)"),[u+l+d,Hn(l),this.#t=!!this.#t,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#h(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString();return this.#r=[c],this.type=null,this.#t=void 0,[c,Hn(this.toString()),!1,!1]}let o=!n||e||r||!Bp?"":this.#h(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#s)a=(this.isStart()&&!r?Bp:"")+kO;else{let c=this.type==="!"?"))"+(this.isStart()&&!r&&!e?Bp:"")+_O+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+c}return[a,Hn(s),this.#t=!!this.#t,this.#n]}#h(e){return this.#r.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#p(e,r,n=!1){let i=!1,s="",o=!1;for(let a=0;a<e.length;a++){let c=e.charAt(a);if(i){i=!1,s+=(GH.has(c)?"\\":"")+c;continue}if(c==="\\"){a===e.length-1?s+="\\\\":i=!0;continue}if(c==="["){let[l,u,d,f]=bO(e,a);if(d){s+=l,o=o||u,a+=d-1,r=r||f;continue}}if(c==="*"){s+=n&&e==="*"?kO:_O,r=!0;continue}if(c==="?"){s+=OT,r=!0;continue}s+=KH(c)}return[s,Hn(e),!!r,o]}};var Ta=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!1}={})=>r?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");var kr=(t,e,r={})=>(el(e),!r.nocomment&&e.charAt(0)==="#"?!1:new Qr(e,r).match(t)),YH=/^\*+([^+@!?\*\[\(]*)$/,XH=t=>e=>!e.startsWith(".")&&e.endsWith(t),JH=t=>e=>e.endsWith(t),QH=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),ZH=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),eV=/^\*+\.\*+$/,tV=t=>!t.startsWith(".")&&t.includes("."),rV=t=>t!=="."&&t!==".."&&t.includes("."),nV=/^\.\*+$/,iV=t=>t!=="."&&t!==".."&&t.startsWith("."),sV=/^\*+$/,oV=t=>t.length!==0&&!t.startsWith("."),aV=t=>t.length!==0&&t!=="."&&t!=="..",cV=/^\?+([^+@!?\*\[\(]*)?$/,lV=([t,e=""])=>{let r=PO([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},uV=([t,e=""])=>{let r=wO([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},dV=([t,e=""])=>{let r=wO([t]);return e?n=>r(n)&&n.endsWith(e):r},fV=([t,e=""])=>{let r=PO([t]);return e?n=>r(n)&&n.endsWith(e):r},PO=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},wO=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},EO=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",NO={win32:{sep:"\\"},posix:{sep:"/"}},pV=EO==="win32"?NO.win32.sep:NO.posix.sep;kr.sep=pV;var rr=Symbol("globstar **");kr.GLOBSTAR=rr;var hV="[^/]",mV=hV+"*?",gV="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",yV="(?:(?!(?:\\/|^)\\.).)*?",TV=(t,e={})=>r=>kr(r,t,e);kr.filter=TV;var vn=(t,e={})=>Object.assign({},t,e),vV=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return kr;let e=kr;return Object.assign((n,i,s={})=>e(n,i,vn(t,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,vn(t,s))}static defaults(i){return e.defaults(vn(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,vn(t,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,vn(t,s))}},unescape:(n,i={})=>e.unescape(n,vn(t,i)),escape:(n,i={})=>e.escape(n,vn(t,i)),filter:(n,i={})=>e.filter(n,vn(t,i)),defaults:n=>e.defaults(vn(t,n)),makeRe:(n,i={})=>e.makeRe(n,vn(t,i)),braceExpand:(n,i={})=>e.braceExpand(n,vn(t,i)),match:(n,i,s={})=>e.match(n,i,vn(t,s)),sep:e.sep,GLOBSTAR:rr})};kr.defaults=vV;var CO=(t,e={})=>(el(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:TO(t));kr.braceExpand=CO;var bV=(t,e={})=>new Qr(t,e).makeRe();kr.makeRe=bV;var SV=(t,e,r={})=>{let n=new Qr(e,r);return t=t.filter(i=>n.match(i)),n.options.nonull&&!t.length&&t.push(e),t};kr.match=SV;var RO=/[?*]|[+@!]\(.*?\)|\[|\]/,_V=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Qr=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,r={}){el(e),r=r||{},this.options=r,this.pattern=e,this.platform=r.platform||EO,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!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]==="?"||!RO.test(s[2]))&&!RO.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=0;n<e.length;n++)for(let i=0;i<e[n].length;i++)e[n][i]==="**"&&(e[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!=="**"&&(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=this.options;if(this.isWindows){let h=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),T=!h&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),b=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),S=!b&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),v=T?3:h?0:void 0,N=S?3:b?0:void 0;if(typeof v=="number"&&typeof N=="number"){let[C,H]=[e[v],r[N]];C.toLowerCase()===H.toLowerCase()&&(r[N]=C,N>v?r=r.slice(N):v>N&&(e=e.slice(v)))}}let{optimizationLevel:s=1}=this.options;s>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:r}),this.debug("matchOne",e.length,r.length);for(var o=0,a=0,c=e.length,l=r.length;o<c&&a<l;o++,a++){this.debug("matchOne loop");var u=r[a],d=e[o];if(this.debug(r,u,d),u===!1)return!1;if(u===rr){this.debug("GLOBSTAR",[r,u,d]);var f=o,p=a+1;if(p===l){for(this.debug("** at the end");o<c;o++)if(e[o]==="."||e[o]===".."||!i.dot&&e[o].charAt(0)===".")return!1;return!0}for(;f<c;){var m=e[f];if(this.debug(`
|
|
299
|
+
`)}}:{contents:{kind:cs.Markdown,value:`No node matched compat ${t.macro.args[0].macro}`}}}async function ZA(t){let e=await sp(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function e0(t,e){return!!await rp(t,e)}async function t0({macro:t,context:e}){if(!(t.macro!=="DT_HAS_ALIAS"||t.args?.length!==1))return e0(t.args[0].macro,e)}async function r0(t){let e=await t0(t);if(e!==void 0)return{contents:{kind:cs.Markdown,value:e?"1":"0"}}}var i0=$(j());async function el(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 n0({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 el(s,"Quoted");case"DT_NODE_FULL_NAME_TOKEN":return el(s,"Token");case"DT_NODE_FULL_NAME_UNQUOTED":return el(s,"Unquoted");case"DT_NODE_FULL_NAME_UPPER_TOKEN":return el(s,"Upper Token")}}async function s0(t){let e=await n0(t,x);if(e)return{contents:{kind:i0.MarkupKind.Markdown,value:e}}}var c0=$(j());async function o0(t){return t?.pathString}async function a0({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 o0(s)}async function l0(t){let e=await a0(t,x);if(e)return{contents:{kind:c0.MarkupKind.Markdown,value:`"${e}"`}}}async function u0(t){let e=await ap(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var p0=$(j());async function d0(t){return t?.labels.map(e=>e.label)}async function f0({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 d0(s)}async function h0(t){let e=await f0(t,x);if(e)return{contents:{kind:p0.MarkupKind.Markdown,value:`{ ${e.map(r=>`"${r}"`).join(", ")} }`}}}async function m0(t){let e=await cp(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function g0(t){let e=await up(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var T0=$(j());async function y0({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 v0(t){let e=await y0(t,x);if(e!==void 0)return{contents:{kind:T0.MarkupKind.Markdown,value:e?"1":"0"}}}var S0=$(j());async function b0({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=Ce(s[2].macro);if(typeof a=="number")return await fa(o,s[1].macro,a)}async function _0(t){let e=await b0(t,x);return e?{contents:{kind:S0.MarkupKind.Markdown,value:e.toString()}}:void 0}var N0=$(j());async function k0({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=Ce(s[2].macro);if(typeof a=="number")return fs(o,s[1].macro,a,s[3].macro,r)}async function R0(t){let e=await k0(t,x);return e?{contents:{kind:N0.MarkupKind.Markdown,value:e.toString()}}:void 0}async function P0(t){let e=await mi(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function w0(t){let e=await yp(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var tl=$(j());async function at(t,e){if(e){if(typeof e=="boolean")return{contents:{kind:tl.MarkupKind.Markdown,value:e?"1":"0"}};if(typeof e=="string")return{contents:{kind:tl.MarkupKind.Markdown,value:e}};if(e instanceof X)return{contents:e.toMarkupContent(t.macros)};if(e.length===1&&e[0]instanceof X)return{contents:e[0].toMarkupContent(t.macros)};if(e.every(r=>typeof r=="number"))return{contents:{kind:tl.MarkupKind.Markdown,value:e.length===1?e[0].toString():`{${e.join(", ")}}`}};if(e.every(r=>typeof r=="string"))return{contents:{kind:tl.MarkupKind.Markdown,value:e.length===1?`"${e[0]}"`:`{${e.map(r=>`"${r}"`).join(", ")}}`}}}}async function E0(t){let e=await Xf(t,x);return at(t.context,e)}var OT=$(j());async function C0(t){let e=await Jf(t,x);if(e===!0)return{contents:{kind:OT.MarkupKind.Markdown,value:"1"}};if(e)return e instanceof X?{contents:e.toMarkupContent(t.context.macros)}:{contents:{kind:OT.MarkupKind.Markdown,value:e.toString()}}}async function D0(t){let e=await da(t,x);return at(t.context,e)}async function A0({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 hi(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro);return await hr(s,e.args[3].macro,r)}async function I0(t){return at(t.context,await A0(t,x))}async function O0(t){let e=await dp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var L0=$(j());async function M0(t){return t?.nodes.filter(e=>!e.disabled).length??0}async function x0({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 M0(s)}async function q0(t){let e=await x0(t,x);return e!==void 0?{contents:{kind:L0.MarkupKind.Markdown,value:e.toString()}}:void 0}async function $0(t){let e=await ps(t,x);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var F0=$(j());async function B0({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 fs(o,s[1].macro,0,s[2].macro,r)}async function j0(t){let e=await B0(t,x);return e?{contents:{kind:F0.MarkupKind.Markdown,value:e.toString()}}:void 0}var U0=$(j());async function H0(t){let e=await mp(t,x);return e instanceof X?at(t.context,e):e?{contents:{kind:U0.MarkupKind.Markdown,value:e.toString()}}:void 0}var z0=$(j());async function V0({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 fs(o,s[1].macro,s[2].macro,s[3].macro,r)}async function W0(t){let e=await V0(t,x);return e?{contents:{kind:z0.MarkupKind.Markdown,value:e.toString()}}:void 0}var G0=$(j());async function K0(t){let e=await gp(t,x);return e instanceof X?at(t.context,e):e?{contents:{kind:G0.MarkupKind.Markdown,value:e.toString()}}:void 0}var Y0=$(j());async function X0(t){let e=await Tp(t,x);return e instanceof X?at(t.context,e):e?{contents:{kind:Y0.MarkupKind.Markdown,value:e.toString()}}:void 0}var J0=$(j());async function Q0(t){let e=await pp(t,x);return e instanceof X?at(t.context,e):e?{contents:{kind:J0.MarkupKind.Markdown,value:e.toString()}}:void 0}var eI=$(j());async function Z0({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 fa(o,s[1].macro,0)}async function tI(t){let e=await Z0(t,x);return e?{contents:{kind:eI.MarkupKind.Markdown,value:e.toString()}}:void 0}var rI=$(j());async function nI(t){let e=await hp(t,x);return e instanceof X?at(t.context,e):e?{contents:{kind:rI.MarkupKind.Markdown,value:e.toString()}}:void 0}async function iI({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_BY_PHANDLE"||e.args?.length!==3)return;let s=await hi(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro);return hr(s,e.args[2].macro,r)}async function sI(t){return at(t.context,await iI(t,x))}async function oI(t){return at(t.context,await vp(t,x))}var lI=$(j());var aI=$(require("util"));async function Vp(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 aI.default.isDeepStrictEqual(Ce(n),s)}async function cI({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 Vp(o,s[1].macro,0,s[2].macro)}async function uI(t){let e=await cI(t,x);return e!==void 0?{contents:{kind:lI.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}var fI=$(j());async function dI({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=Ce(s[2].macro);if(typeof a=="number")return await Vp(o,s[1].macro,a,s[3].macro)}async function pI(t){let e=await dI(t,x);return e!==void 0?{contents:{kind:fI.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}var gI=$(j());async function hI(t,e,r,n){let i=await hr(t,e,n);if(i===void 0)return!1;if(r=typeof r=="number"?r:Ce(r??"0"),typeof r=="number")return Array.isArray(i)?i.length<r:r===0}async function mI({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 hI(await i({document:t,macro:s[0],context:r,position:n}),s[1].macro,s[2].macro,r)}async function yI(t){let e=await mI(t,x);return e===void 0?void 0:{contents:{kind:gI.MarkupKind.Markdown,value:e?"1":"0"}}}var bI=$(j());async function TI(t,e,r,n){let i=t?.properties.find(u=>Z(u.name)===e),s=i?.parent.nodeType;if(!s||!(s instanceof Pt)||await hr(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 vI({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 TI(await i({document:t,macro:s[0],context:r,position:n}),s[1].macro,s[2].macro,r)}async function SI(t){let e=await vI(t,x);return e===void 0?void 0:{contents:{kind:bI.MarkupKind.Markdown,value:e?"1":"0"}}}async function _I(t){let e=await op(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var NI=$(j());async function kI({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?bp(o,s[1].macro):void 0}async function RI(t){let e=await kI(t,x);return e?{contents:{kind:NI.MarkupKind.Markdown,value:e.toString()}}:void 0}var PI=$(j());async function wI(t){let e=await Sp(t,x);return e instanceof X?at(t.context,e):e?{contents:{kind:PI.MarkupKind.Markdown,value:e.toString()}}:void 0}var MT=$(j());async function EI(t,e,r){let n=await hr(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 X?n[0]:i}async function CI({document:t,macro:e,context:r,position:n},i){if(!(e.macro!=="DT_PROP_LAST"||e.args?.length!==2))return EI(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,r)}async function DI(t){let e=await CI(t,x);if(e===!0)return{contents:{kind:MT.MarkupKind.Markdown,value:"1"}};if(e)return e instanceof X?{contents:e.toMarkupContent(t.context.macros)}:{contents:{kind:MT.MarkupKind.Markdown,value:e.toString()}}}var II=$(j());async function AI({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?ha(o,s[1].macro):void 0}async function OI(t){let e=await AI(t,x);if(e)return{contents:{kind:II.MarkupKind.Markdown,value:e.toString()}}}var xI=$(j());async function zp(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 MI({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=Ce(s[2].macro);if(typeof a=="number")return o?zp(o,s[1].macro,a):void 0}async function LI(t){let e=await MI(t,x);if(e)return{contents:{kind:xI.MarkupKind.Markdown,value:e.toString()}}}var qI=$(j());async function $I(t){let e=await _p(t,x);if(e)return e instanceof X?at(t.context,e):{contents:{kind:qI.MarkupKind.Markdown,value:e.toString()}}}var jI=$(j());async function BI(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 FI({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=Ce(s[2].macro);if(typeof a=="number")return o?BI(o,s[1].macro,a):void 0}async function UI(t){let e=await FI(t,x);if(e)return{contents:{kind:jI.MarkupKind.Markdown,value:e.toString()}}}var VI=$(j());async function HI({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 zI(t){let e=await HI(t,x);if(e)return{contents:{kind:VI.MarkupKind.Markdown,value:e.toString()}}}var WI=$(j());async function GI(t){let e=await Np(t,x);if(e)return e instanceof X?at(t.context,e):{contents:{kind:WI.MarkupKind.Markdown,value:e.toString()}}}var XI=$(j());async function KI(t,e,r){return(await zp(t,e,r))?.toUpperCase()}async function YI({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=Ce(s[2].macro);if(typeof a=="number")return o?KI(o,s[1].macro,a):void 0}async function JI(t){let e=await YI(t,x);if(e)return{contents:{kind:XI.MarkupKind.Markdown,value:e.toString()}}}var ZI=$(j());async function QI({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?Rp(o,s[1].macro):void 0}async function eO(t){let e=await QI(t,x);if(e)return{contents:{kind:ZI.MarkupKind.Markdown,value:e.toString()}}}var tO=$(j());async function rO(t){let e=await Pp(t,x);if(e)return e instanceof X?at(t.context,e):{contents:{kind:tO.MarkupKind.Markdown,value:e.toString()}}}async function nO(t){let e=await Zf(t,x);return e?{contents:e.toMarkupContent(t.context.macros)}:void 0}var oO=$(j());async function iO(t,e){if(!t)return;let r=t.nodeType?.onBus;return r?Z(r)===e:!1}async function sO(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 iO(n,r[1].macro)}async function aO(t){let e=await sO(t,x);return e!==void 0?{contents:{kind:oO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}async function cO(t){let e=await tp(t);return e?{contents:e.toMarkupContent(t.context.macros)}:void 0}var dO=$(j());async function lO(t,e){return!!await ep(t,e)}async function uO(t){let e=t.macro.args;if(!(t.macro.macro!=="DT_HAS_CHOSEN"||e?.length!==1))return await lO(t.context,e[0].macro)}async function fO(t){let e=await uO(t);return e!==void 0?{contents:{kind:dO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}async function NH(t){return[nO,aO,cO,fO,WA,GA,JA,q0,QA,ZA,r0,_I,O0,g0,l0,s0,u0,h0,m0,v0].reduce((e,r)=>e.then(n=>n||r(t)),Promise.resolve(void 0))}async function RH(t){return[pI,uI,_0,Q0,tI,nI,R0,H0,W0,K0,j0,P0,w0,$0,X0,C0,sI,I0,oI,yI,SI,E0,DI,RI,wI,D0,LI,OI,$I,UI,zI,GI,JI,eO,rO].reduce((e,r)=>e.then(n=>n||r(t)),Promise.resolve(void 0))}async function pO(t,e,r){if(!r)return;let n=Li(r,t.position);return hO(n,t.position,e,r)}async function hO(t,e,r,n){if(!t?.macro)return;let i=await NH({position:e,context:r,document:n,macro:t})||await RH({position:e,context:r,document:n,macro:t});if(i)return i;let s=await x({document:n,macro:t,context:r,position:e});if(s)return{contents:s.toMarkupContent(r.macros)};let o=await ds(n,t.macro,e,r);if(o)return hO(o[0],o[1],r,n)}var x_=require("path"),L_=require("fs");var xT=(t,e,r)=>{let n=t instanceof RegExp?mO(t,r):t,i=e instanceof RegExp?mO(e,r):e,s=n!==null&&i!=null&&PH(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)}},mO=(t,e)=>{let r=e.match(t);return r?r[0]:null},PH=(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 gO="\0SLASH"+Math.random()+"\0",yO="\0OPEN"+Math.random()+"\0",qT="\0CLOSE"+Math.random()+"\0",TO="\0COMMA"+Math.random()+"\0",vO="\0PERIOD"+Math.random()+"\0",wH=new RegExp(gO,"g"),EH=new RegExp(yO,"g"),CH=new RegExp(qT,"g"),DH=new RegExp(TO,"g"),AH=new RegExp(vO,"g"),IH=/\\\\/g,OH=/\\{/g,MH=/\\}/g,xH=/\\,/g,LH=/\\./g;function LT(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function qH(t){return t.replace(IH,gO).replace(OH,yO).replace(MH,qT).replace(xH,TO).replace(LH,vO)}function $H(t){return t.replace(wH,"\\").replace(EH,"{").replace(CH,"}").replace(DH,",").replace(AH,".")}function bO(t){if(!t)return[""];let e=[],r=xT("{","}",t);if(!r)return t.split(",");let{pre:n,body:i,post:s}=r,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=bO(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function SO(t){return t?(t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),rl(qH(t),!0).map($H)):[]}function BH(t){return"{"+t+"}"}function FH(t){return/^-?0\d/.test(t)}function jH(t,e){return t<=e}function UH(t,e){return t>=e}function rl(t,e){let r=[],n=xT("{","}",t);if(!n)return[t];let i=n.pre,s=n.post.length?rl(n.post,!1):[""];if(/\$$/.test(n.pre))for(let o=0;o<s.length;o++){let a=i+"{"+n.body+"}"+s[o];r.push(a)}else{let o=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),a=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),c=o||a,l=n.body.indexOf(",")>=0;if(!c&&!l)return n.post.match(/,(?!,).*\}/)?(t=n.pre+"{"+n.body+qT+n.post,rl(t)):[t];let u;if(c)u=n.body.split(/\.\./);else if(u=bO(n.body),u.length===1&&u[0]!==void 0&&(u=rl(u[0],!1).map(BH),u.length===1))return s.map(f=>n.pre+u[0]+f);let d;if(c&&u[0]!==void 0&&u[1]!==void 0){let f=LT(u[0]),p=LT(u[1]),m=Math.max(u[0].length,u[1].length),h=u.length===3&&u[2]!==void 0?Math.abs(LT(u[2])):1,T=jH;p<f&&(h*=-1,T=UH);let _=u.some(FH);d=[];for(let v=f;T(v,p);v+=h){let N;if(a)N=String.fromCharCode(v),N==="\\"&&(N="");else if(N=String(v),_){let C=m-N.length;if(C>0){let H=new Array(C+1).join("0");v<0?N="-"+H+N.slice(1):N=H+N}}d.push(N)}}else{d=[];for(let f=0;f<u.length;f++)d.push.apply(d,rl(u[f],!1))}for(let f=0;f<d.length;f++)for(let p=0;p<s.length;p++){let m=i+d[f]+s[p];(!e||c||m)&&r.push(m)}}return r}var nl=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")};var HH={"[: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]},il=t=>t.replace(/[[\]\\-]/g,"\\$&"),VH=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),_O=t=>t.join(""),kO=(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[T,[b,_,v]]of Object.entries(HH))if(t.startsWith(T,s)){if(d)return["$.",!1,t.length-r,!0];s+=T.length,v?i.push(b):n.push(b),a=a||_;continue e}}if(c=!1,d){h>d?n.push(il(d)+"-"+il(h)):h===d&&n.push(il(h)),d="",s++;continue}if(t.startsWith("-]",s+1)){n.push(il(h+"-")),s+=2;continue}if(t.startsWith("-",s+1)){d=h,s+=2;continue}n.push(il(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[VH(h),!1,u-r,!1]}let f="["+(l?"^":"")+_O(n)+"]",p="["+(l?"":"^")+_O(i)+"]";return[n.length&&i.length?"("+f+"|"+p+")":n.length?f:p,a,u-r,!0]};var Gn=(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 zH=new Set(["!","?","+","*","@"]),NO=t=>zH.has(t),WH="(?!(?:^|/)\\.\\.?(?:$|/))",Wp="(?!\\.)",GH=new Set(["[","."]),KH=new Set(["..","."]),YH=new Set("().*{}+?[]^$\\!"),XH=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),$T="[^/]",RO=$T+"*?",PO=$T+"+?",ba=class t{type;#e;#t;#n=!1;#r=[];#o;#f;#a;#d=!1;#c;#l;#s=!1;constructor(e,r,n={}){this.type=e,e&&(this.#t=!0),this.#o=r,this.#e=this.#o?this.#o.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#a=this.#e===this?[]:this.#e.#a,e==="!"&&!this.#e.#d&&this.#a.push(this),this.#f=this.#o?this.#o.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l!==void 0?this.#l:this.type?this.#l=this.type+"("+this.#r.map(e=>String(e)).join("|")+")":this.#l=this.#r.map(e=>String(e)).join("")}#y(){if(this!==this.#e)throw new Error("should only call on root");if(this.#d)return this;this.toString(),this.#d=!0;let e;for(;e=this.#a.pop();){if(e.type!=="!")continue;let r=e,n=r.#o;for(;n;){for(let i=r.#f+1;!n.type&&i<n.#r.length;i++)for(let s of e.#r){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#r[i])}r=n,n=r.#o}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof t&&r.#o===this))throw new Error("invalid part: "+r);this.#r.push(r)}}toJSON(){let e=this.type===null?this.#r.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#r.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#d&&this.#o?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#o?.isStart())return!1;if(this.#f===0)return!0;let e=this.#o;for(let r=0;r<this.#f;r++){let n=e.#r[r];if(!(n instanceof t&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let e=this.#o?this.#o.#r.length:0;return this.#f===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let r=new t(this.type,e);for(let n of this.#r)r.copyIn(n);return r}static#T(e,r,n,i){let s=!1,o=!1,a=-1,c=!1;if(r.type===null){let p=n,m="";for(;p<e.length;){let h=e.charAt(p++);if(s||h==="\\"){s=!s,m+=h;continue}if(o){p===a+1?(h==="^"||h==="!")&&(c=!0):h==="]"&&!(p===a+2&&c)&&(o=!1),m+=h;continue}else if(h==="["){o=!0,a=p,c=!1,m+=h;continue}if(!i.noext&&NO(h)&&e.charAt(p)==="("){r.push(m),m="";let T=new t(h,r);p=t.#T(e,T,p,i),r.push(T);continue}m+=h}return r.push(m),p}let l=n+1,u=new t(null,r),d=[],f="";for(;l<e.length;){let p=e.charAt(l++);if(s||p==="\\"){s=!s,f+=p;continue}if(o){l===a+1?(p==="^"||p==="!")&&(c=!0):p==="]"&&!(l===a+2&&c)&&(o=!1),f+=p;continue}else if(p==="["){o=!0,a=l,c=!1,f+=p;continue}if(NO(p)&&e.charAt(l)==="("){u.push(f),f="";let m=new t(p,u);u.push(m),l=t.#T(e,m,l,i);continue}if(p==="|"){u.push(f),f="",d.push(u),u=new t(null,r);continue}if(p===")")return f===""&&r.#r.length===0&&(r.#s=!0),u.push(f),f="",r.push(...d,u),l;f+=p}return r.type=null,r.#t=void 0,r.#r=[e.substring(n-1)],l}static fromGlob(e,r={}){let n=new t(null,void 0,r);return t.#T(e,n,0,r),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[r,n,i,s]=this.toRegExpSource();if(!(i||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:e})}get options(){return this.#c}toRegExpSource(e){let r=e??!!this.#c.dot;if(this.#e===this&&this.#y(),!this.type){let c=this.isStart()&&this.isEnd()&&!this.#r.some(p=>typeof p!="string"),l=this.#r.map(p=>{let[m,h,T,b]=typeof p=="string"?t.#p(p,this.#t,c):p.toRegExpSource(e);return this.#t=this.#t||T,this.#n=this.#n||b,m}).join(""),u="";if(this.isStart()&&typeof this.#r[0]=="string"&&!(this.#r.length===1&&KH.has(this.#r[0]))){let m=GH,h=r&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),T=!r&&!e&&m.has(l.charAt(0));u=h?WH:T?Wp:""}let d="";return this.isEnd()&&this.#e.#d&&this.#o?.type==="!"&&(d="(?:$|\\/)"),[u+l+d,Gn(l),this.#t=!!this.#t,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#h(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString();return this.#r=[c],this.type=null,this.#t=void 0,[c,Gn(this.toString()),!1,!1]}let o=!n||e||r||!Wp?"":this.#h(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#s)a=(this.isStart()&&!r?Wp:"")+PO;else{let c=this.type==="!"?"))"+(this.isStart()&&!r&&!e?Wp:"")+RO+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+c}return[a,Gn(s),this.#t=!!this.#t,this.#n]}#h(e){return this.#r.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#p(e,r,n=!1){let i=!1,s="",o=!1;for(let a=0;a<e.length;a++){let c=e.charAt(a);if(i){i=!1,s+=(YH.has(c)?"\\":"")+c;continue}if(c==="\\"){a===e.length-1?s+="\\\\":i=!0;continue}if(c==="["){let[l,u,d,f]=kO(e,a);if(d){s+=l,o=o||u,a+=d-1,r=r||f;continue}}if(c==="*"){s+=n&&e==="*"?PO:RO,r=!0;continue}if(c==="?"){s+=$T,r=!0;continue}s+=XH(c)}return[s,Gn(e),!!r,o]}};var Sa=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!1}={})=>r?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");var Rr=(t,e,r={})=>(nl(e),!r.nocomment&&e.charAt(0)==="#"?!1:new nn(e,r).match(t)),JH=/^\*+([^+@!?\*\[\(]*)$/,QH=t=>e=>!e.startsWith(".")&&e.endsWith(t),ZH=t=>e=>e.endsWith(t),eV=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),tV=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),rV=/^\*+\.\*+$/,nV=t=>!t.startsWith(".")&&t.includes("."),iV=t=>t!=="."&&t!==".."&&t.includes("."),sV=/^\.\*+$/,oV=t=>t!=="."&&t!==".."&&t.startsWith("."),aV=/^\*+$/,cV=t=>t.length!==0&&!t.startsWith("."),lV=t=>t.length!==0&&t!=="."&&t!=="..",uV=/^\?+([^+@!?\*\[\(]*)?$/,dV=([t,e=""])=>{let r=CO([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},fV=([t,e=""])=>{let r=DO([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},pV=([t,e=""])=>{let r=DO([t]);return e?n=>r(n)&&n.endsWith(e):r},hV=([t,e=""])=>{let r=CO([t]);return e?n=>r(n)&&n.endsWith(e):r},CO=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},DO=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},AO=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",wO={win32:{sep:"\\"},posix:{sep:"/"}},mV=AO==="win32"?wO.win32.sep:wO.posix.sep;Rr.sep=mV;var nr=Symbol("globstar **");Rr.GLOBSTAR=nr;var gV="[^/]",yV=gV+"*?",TV="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",vV="(?:(?!(?:\\/|^)\\.).)*?",bV=(t,e={})=>r=>Rr(r,t,e);Rr.filter=bV;var _n=(t,e={})=>Object.assign({},t,e),SV=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return Rr;let e=Rr;return Object.assign((n,i,s={})=>e(n,i,_n(t,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,_n(t,s))}static defaults(i){return e.defaults(_n(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,_n(t,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,_n(t,s))}},unescape:(n,i={})=>e.unescape(n,_n(t,i)),escape:(n,i={})=>e.escape(n,_n(t,i)),filter:(n,i={})=>e.filter(n,_n(t,i)),defaults:n=>e.defaults(_n(t,n)),makeRe:(n,i={})=>e.makeRe(n,_n(t,i)),braceExpand:(n,i={})=>e.braceExpand(n,_n(t,i)),match:(n,i,s={})=>e.match(n,i,_n(t,s)),sep:e.sep,GLOBSTAR:nr})};Rr.defaults=SV;var IO=(t,e={})=>(nl(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:SO(t));Rr.braceExpand=IO;var _V=(t,e={})=>new nn(t,e).makeRe();Rr.makeRe=_V;var kV=(t,e,r={})=>{let n=new nn(e,r);return t=t.filter(i=>n.match(i)),n.options.nonull&&!t.length&&t.push(e),t};Rr.match=kV;var EO=/[?*]|[+@!]\(.*?\)|\[|\]/,NV=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),nn=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,r={}){nl(e),r=r||{},this.options=r,this.pattern=e,this.platform=r.platform||AO,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!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]==="?"||!EO.test(s[2]))&&!EO.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=0;n<e.length;n++)for(let i=0;i<e[n].length;i++)e[n][i]==="**"&&(e[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!=="**"&&(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=this.options;if(this.isWindows){let h=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),T=!h&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),b=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),_=!b&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),v=T?3:h?0:void 0,N=_?3:b?0:void 0;if(typeof v=="number"&&typeof N=="number"){let[C,H]=[e[v],r[N]];C.toLowerCase()===H.toLowerCase()&&(r[N]=C,N>v?r=r.slice(N):v>N&&(e=e.slice(v)))}}let{optimizationLevel:s=1}=this.options;s>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:r}),this.debug("matchOne",e.length,r.length);for(var o=0,a=0,c=e.length,l=r.length;o<c&&a<l;o++,a++){this.debug("matchOne loop");var u=r[a],d=e[o];if(this.debug(r,u,d),u===!1)return!1;if(u===nr){this.debug("GLOBSTAR",[r,u,d]);var f=o,p=a+1;if(p===l){for(this.debug("** at the end");o<c;o++)if(e[o]==="."||e[o]===".."||!i.dot&&e[o].charAt(0)===".")return!1;return!0}for(;f<c;){var m=e[f];if(this.debug(`
|
|
300
300
|
globstar while`,e,f,r,p,m),this.matchOne(e.slice(f),r.slice(p),n))return this.debug("globstar found match!",f,c,m),!0;if(m==="."||m===".."||!i.dot&&m.charAt(0)==="."){this.debug("dot detected!",e,f,r,p);break}this.debug("globstar swallow a segment, and continue"),f++}return!!(n&&(this.debug(`
|
|
301
|
-
>>> no match, partial?`,e,f,r,p),f===c))}let h;if(typeof u=="string"?(h=d===u,this.debug("string match",u,d,h)):(h=u.test(d),this.debug("pattern match",u,d,h)),!h)return!1}if(o===c&&a===l)return!0;if(o===c)return n;if(a===l)return o===c-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return CO(this.pattern,this.options)}parse(e){el(e);let r=this.options;if(e==="**")return rr;if(e==="")return"";let n,i=null;(n=e.match(sV))?i=r.dot?aV:oV:(n=e.match(YH))?i=(r.nocase?r.dot?ZH:QH:r.dot?JH:XH)(n[1]):(n=e.match(cV))?i=(r.nocase?r.dot?uV:lV:r.dot?dV:fV)(n):(n=e.match(eV))?i=r.dot?rV:tV:(n=e.match(nV))&&(i=iV);let s=ya.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?mV:r.dot?gV:yV,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"?_V(d):d===rr?rr:d._src});l.forEach((d,f)=>{let p=l[f+1],m=l[f-1];d!==rr||m===rr||(m===void 0?p!==void 0&&p!==rr?l[f+1]="(?:\\/|"+n+"\\/)?"+p:l[f]=n:p===void 0?l[f-1]=m+"(?:\\/|\\/"+n+")?":p!==rr&&(l[f-1]=m+"(?:\\/|\\/"+n+"\\/)"+p,l[f+1]=rr))});let u=l.filter(d=>d!==rr);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=0;a<s.length;a++){let c=s[a],l=i;if(n.matchBase&&c.length===1&&(l=[o]),this.matchOne(l,c,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return kr.defaults(e).Minimatch}};kr.AST=ya;kr.Minimatch=Qr;kr.escape=Ta;kr.unescape=Hn;var ZO=require("node:url");var va=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,AO=new Set,MT=typeof process=="object"&&process?process:{},IO=(t,e,r,n)=>{typeof MT.emitWarning=="function"?MT.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)},Fp=globalThis.AbortController,DO=globalThis.AbortSignal;if(typeof Fp>"u"){DO=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},Fp=class{constructor(){e()}signal=new DO;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let t=MT.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,IO("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var kV=t=>!AO.has(t),Gke=Symbol("type"),ps=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),OO=t=>ps(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?ba:null:null,ba=class extends Array{constructor(e){super(e),this.fill(0)}},xT=class t{heap;length;static#e=!1;static create(e){let r=OO(e);if(!r)return[];t.#e=!0;let n=new t(e,r);return t.#e=!1,n}constructor(e,r){if(!t.#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]}},rl=class t{#e;#t;#n;#r;#o;#f;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#d;#c;#l;#s;#y;#T;#h;#p;#k;#g;#N;#R;#b;#S;#_;#m;static unsafeExposeInternals(e){return{starts:e.#R,ttls:e.#b,sizes:e.#N,keyMap:e.#c,keyList:e.#l,valList:e.#s,next:e.#y,prev:e.#T,get head(){return e.#h},get tail(){return e.#p},free:e.#k,isBackgroundFetch:r=>e.#u(r),backgroundFetch:(r,n,i,s)=>e.#$(r,n,i,s),moveToTail:r=>e.#F(r),indexes:r=>e.#w(r),rindexes:r=>e.#E(r),isStale:r=>e.#v(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#d}get size(){return this.#a}get fetchMethod(){return this.#o}get memoMethod(){return this.#f}get dispose(){return this.#n}get disposeAfter(){return this.#r}constructor(e){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:c,dispose:l,disposeAfter:u,noDisposeOnSet:d,noUpdateTTL:f,maxSize:p=0,maxEntrySize:m=0,sizeCalculation:h,fetchMethod:T,memoMethod:b,noDeleteOnFetchRejection:S,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:N,allowStaleOnFetchAbort:C,ignoreFetchAbort:H}=e;if(r!==0&&!ps(r))throw new TypeError("max option must be a nonnegative integer");let M=r?OO(r):Array;if(!M)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=p,this.maxEntrySize=m||this.#t,this.sizeCalculation=h,this.sizeCalculation){if(!this.#t&&!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(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#f=b,T!==void 0&&typeof T!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=T,this.#_=!!T,this.#c=new Map,this.#l=new Array(r).fill(void 0),this.#s=new Array(r).fill(void 0),this.#y=new M(r),this.#T=new M(r),this.#h=0,this.#p=0,this.#k=xT.create(r),this.#a=0,this.#d=0,typeof l=="function"&&(this.#n=l),typeof u=="function"?(this.#r=u,this.#g=[]):(this.#r=void 0,this.#g=void 0),this.#S=!!this.#n,this.#m=!!this.#r,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!S,this.allowStaleOnFetchRejection=!!N,this.allowStaleOnFetchAbort=!!C,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(this.#t!==0&&!ps(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!ps(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#D()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=ps(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!ps(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#C()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let F="LRU_CACHE_UNBOUNDED";kV(F)&&(AO.add(F),IO("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",F,t))}}getRemainingTTL(e){return this.#c.has(e)?1/0:0}#C(){let e=new ba(this.#e),r=new ba(this.#e);this.#b=e,this.#R=r,this.#I=(s,o,a=va.now())=>{if(r[s]=o!==0?a:0,e[s]=o,o!==0&&this.ttlAutopurge){let c=setTimeout(()=>{this.#v(s)&&this.#A(this.#l[s],"expire")},o+1);c.unref&&c.unref()}},this.#P=s=>{r[s]=e[s]!==0?va.now():0},this.#i=(s,o)=>{if(e[o]){let a=e[o],c=r[o];if(!a||!c)return;s.ttl=a,s.start=c,s.now=n||i();let l=s.now-c;s.remainingTTL=a-l}};let n=0,i=()=>{let s=va.now();if(this.ttlResolution>0){n=s;let o=setTimeout(()=>n=0,this.ttlResolution);o.unref&&o.unref()}return s};this.getRemainingTTL=s=>{let o=this.#c.get(s);if(o===void 0)return 0;let a=e[o],c=r[o];if(!a||!c)return 1/0;let l=(n||i())-c;return a-l},this.#v=s=>{let o=r[s],a=e[s];return!!a&&!!o&&(n||i())-o>a}}#P=()=>{};#i=()=>{};#I=()=>{};#v=()=>!1;#D(){let e=new ba(this.#e);this.#d=0,this.#N=e,this.#O=r=>{this.#d-=e[r],e[r]=0},this.#x=(r,n,i,s)=>{if(this.#u(n))return 0;if(!ps(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,r),!ps(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.#M=(r,n,i)=>{if(e[r]=n,this.#t){let s=this.#t-e[r];for(;this.#d>s;)this.#q(!0)}this.#d+=e[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#d)}}#O=e=>{};#M=(e,r,n)=>{};#x=(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#w({allowStale:e=this.allowStale}={}){if(this.#a)for(let r=this.#p;!(!this.#L(r)||((e||!this.#v(r))&&(yield r),r===this.#h));)r=this.#T[r]}*#E({allowStale:e=this.allowStale}={}){if(this.#a)for(let r=this.#h;!(!this.#L(r)||((e||!this.#v(r))&&(yield r),r===this.#p));)r=this.#y[r]}#L(e){return e!==void 0&&this.#c.get(this.#l[e])===e}*entries(){for(let e of this.#w())this.#s[e]!==void 0&&this.#l[e]!==void 0&&!this.#u(this.#s[e])&&(yield[this.#l[e],this.#s[e]])}*rentries(){for(let e of this.#E())this.#s[e]!==void 0&&this.#l[e]!==void 0&&!this.#u(this.#s[e])&&(yield[this.#l[e],this.#s[e]])}*keys(){for(let e of this.#w()){let r=this.#l[e];r!==void 0&&!this.#u(this.#s[e])&&(yield r)}}*rkeys(){for(let e of this.#E()){let r=this.#l[e];r!==void 0&&!this.#u(this.#s[e])&&(yield r)}}*values(){for(let e of this.#w())this.#s[e]!==void 0&&!this.#u(this.#s[e])&&(yield this.#s[e])}*rvalues(){for(let e of this.#E())this.#s[e]!==void 0&&!this.#u(this.#s[e])&&(yield this.#s[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#w()){let i=this.#s[n],s=this.#u(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#l[n],this))return this.get(this.#l[n],r)}}forEach(e,r=this){for(let n of this.#w()){let i=this.#s[n],s=this.#u(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#l[n],this)}}rforEach(e,r=this){for(let n of this.#E()){let i=this.#s[n],s=this.#u(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#l[n],this)}}purgeStale(){let e=!1;for(let r of this.#E({allowStale:!0}))this.#v(r)&&(this.#A(this.#l[r],"expire"),e=!0);return e}info(e){let r=this.#c.get(e);if(r===void 0)return;let n=this.#s[r],i=this.#u(n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(this.#b&&this.#R){let o=this.#b[r],a=this.#R[r];if(o&&a){let c=o-(va.now()-a);s.ttl=c,s.start=Date.now()}}return this.#N&&(s.size=this.#N[r]),s}dump(){let e=[];for(let r of this.#w({allowStale:!0})){let n=this.#l[r],i=this.#s[r],s=this.#u(i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let o={value:s};if(this.#b&&this.#R){o.ttl=this.#b[r];let a=va.now()-this.#R[r];o.start=Math.floor(Date.now()-a)}this.#N&&(o.size=this.#N[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=va.now()-i}this.set(r,n.value,n)}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=n,{noUpdateTTL:l=this.noUpdateTTL}=n,u=this.#x(e,r,n.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.#A(e,"set"),this;let d=this.#a===0?void 0:this.#c.get(e);if(d===void 0)d=this.#a===0?this.#p:this.#k.length!==0?this.#k.pop():this.#a===this.#e?this.#q(!1):this.#a,this.#l[d]=e,this.#s[d]=r,this.#c.set(e,d),this.#y[this.#p]=d,this.#T[d]=this.#p,this.#p=d,this.#a++,this.#M(d,u,c),c&&(c.set="add"),l=!1;else{this.#F(d);let f=this.#s[d];if(r!==f){if(this.#_&&this.#u(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=f;p!==void 0&&!o&&(this.#S&&this.#n?.(p,e,"set"),this.#m&&this.#g?.push([p,e,"set"]))}else o||(this.#S&&this.#n?.(f,e,"set"),this.#m&&this.#g?.push([f,e,"set"]));if(this.#O(d),this.#M(d,u,c),this.#s[d]=r,c){c.set="replace";let p=f&&this.#u(f)?f.__staleWhileFetching:f;p!==void 0&&(c.oldValue=p)}}else c&&(c.set="update")}if(i!==0&&!this.#b&&this.#C(),this.#b&&(l||this.#I(d,i,s),c&&this.#i(c,d)),!o&&this.#m&&this.#g){let f=this.#g,p;for(;p=f?.shift();)this.#r?.(...p)}return this}pop(){try{for(;this.#a;){let e=this.#s[this.#h];if(this.#q(!0),this.#u(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#m&&this.#g){let e=this.#g,r;for(;r=e?.shift();)this.#r?.(...r)}}}#q(e){let r=this.#h,n=this.#l[r],i=this.#s[r];return this.#_&&this.#u(i)?i.__abortController.abort(new Error("evicted")):(this.#S||this.#m)&&(this.#S&&this.#n?.(i,n,"evict"),this.#m&&this.#g?.push([i,n,"evict"])),this.#O(r),e&&(this.#l[r]=void 0,this.#s[r]=void 0,this.#k.push(r)),this.#a===1?(this.#h=this.#p=0,this.#k.length=0):this.#h=this.#y[r],this.#c.delete(n),this.#a--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,s=this.#c.get(e);if(s!==void 0){let o=this.#s[s];if(this.#u(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#v(s))i&&(i.has="stale",this.#i(i,s));else return n&&this.#P(s),i&&(i.has="hit",this.#i(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,i=this.#c.get(e);if(i===void 0||!n&&this.#v(i))return;let s=this.#s[i];return this.#u(s)?s.__staleWhileFetching:s}#$(e,r,n,i){let s=r===void 0?void 0:this.#s[r];if(this.#u(s))return s;let o=new Fp,{signal:a}=n;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let c={signal:o.signal,options:n,context:i},l=(h,T=!1)=>{let{aborted:b}=o.signal,S=n.ignoreFetchAbort&&h!==void 0;if(n.status&&(b&&!T?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,S&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),b&&!S&&!T)return d(o.signal.reason);let v=p;return this.#s[r]===p&&(h===void 0?v.__staleWhileFetching?this.#s[r]=v.__staleWhileFetching:this.#A(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,h,c.options))),h},u=h=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=h),d(h)),d=h=>{let{aborted:T}=o.signal,b=T&&n.allowStaleOnFetchAbort,S=b||n.allowStaleOnFetchRejection,v=S||n.noDeleteOnFetchRejection,N=p;if(this.#s[r]===p&&(!v||N.__staleWhileFetching===void 0?this.#A(e,"fetch"):b||(this.#s[r]=N.__staleWhileFetching)),S)return n.status&&N.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),N.__staleWhileFetching;if(N.__returned===N)throw h},f=(h,T)=>{let b=this.#o?.(e,s,c);b&&b instanceof Promise&&b.then(S=>h(S===void 0?void 0:S),T),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(h(void 0),n.allowStaleOnFetchAbort&&(h=S=>l(S,!0)))})};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.set(e,m,{...c.options,status:void 0}),r=this.#c.get(e)):this.#s[r]=m,m}#u(e){if(!this.#_)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof Fp}async fetch(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:T=!1,status:b,signal:S}=r;if(!this.#_)return b&&(b.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:b});let v={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:b,signal:S},N=this.#c.get(e);if(N===void 0){b&&(b.fetch="miss");let C=this.#$(e,N,v,h);return C.__returned=C}else{let C=this.#s[N];if(this.#u(C)){let lt=n&&C.__staleWhileFetching!==void 0;return b&&(b.fetch="inflight",lt&&(b.returnedStale=!0)),lt?C.__staleWhileFetching:C.__returned=C}let H=this.#v(N);if(!T&&!H)return b&&(b.fetch="hit"),this.#F(N),i&&this.#P(N),b&&this.#i(b,N),C;let M=this.#$(e,N,v,h),De=M.__staleWhileFetching!==void 0&&n;return b&&(b.fetch=H?"stale":"refresh",De&&H&&(b.returnedStale=!0)),De?M.__staleWhileFetching:M.__returned=M}}async forceFetch(e,r={}){let n=await this.fetch(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let n=this.#f;if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...o}=r,a=this.get(e,o);if(!s&&a!==void 0)return a;let c=n(e,a,{options:o,context:i});return this.set(e,c,o),c}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=r,a=this.#c.get(e);if(a!==void 0){let c=this.#s[a],l=this.#u(c);return o&&this.#i(o,a),this.#v(a)?(o&&(o.get="stale"),l?(o&&n&&c.__staleWhileFetching!==void 0&&(o.returnedStale=!0),n?c.__staleWhileFetching:void 0):(s||this.#A(e,"expire"),o&&n&&(o.returnedStale=!0),n?c:void 0)):(o&&(o.get="hit"),l?c.__staleWhileFetching:(this.#F(a),i&&this.#P(a),c))}else o&&(o.get="miss")}#B(e,r){this.#T[r]=e,this.#y[e]=r}#F(e){e!==this.#p&&(e===this.#h?this.#h=this.#y[e]:this.#B(this.#T[e],this.#y[e]),this.#B(this.#p,e),this.#p=e)}delete(e){return this.#A(e,"delete")}#A(e,r){let n=!1;if(this.#a!==0){let i=this.#c.get(e);if(i!==void 0)if(n=!0,this.#a===1)this.#j(r);else{this.#O(i);let s=this.#s[i];if(this.#u(s)?s.__abortController.abort(new Error("deleted")):(this.#S||this.#m)&&(this.#S&&this.#n?.(s,e,r),this.#m&&this.#g?.push([s,e,r])),this.#c.delete(e),this.#l[i]=void 0,this.#s[i]=void 0,i===this.#p)this.#p=this.#T[i];else if(i===this.#h)this.#h=this.#y[i];else{let o=this.#T[i];this.#y[o]=this.#y[i];let a=this.#y[i];this.#T[a]=this.#T[i]}this.#a--,this.#k.push(i)}}if(this.#m&&this.#g?.length){let i=this.#g,s;for(;s=i?.shift();)this.#r?.(...s)}return n}clear(){return this.#j("delete")}#j(e){for(let r of this.#E({allowStale:!0})){let n=this.#s[r];if(this.#u(n))n.__abortController.abort(new Error("deleted"));else{let i=this.#l[r];this.#S&&this.#n?.(n,i,e),this.#m&&this.#g?.push([n,i,e])}}if(this.#c.clear(),this.#s.fill(void 0),this.#l.fill(void 0),this.#b&&this.#R&&(this.#b.fill(0),this.#R.fill(0)),this.#N&&this.#N.fill(0),this.#h=0,this.#p=0,this.#k.length=0,this.#d=0,this.#a=0,this.#m&&this.#g){let r=this.#g,n;for(;n=r?.shift();)this.#r?.(...n)}}};var ka=require("node:path"),HO=require("node:url"),hi=require("fs"),OV=$(require("node:fs"),1),gs=require("node:fs/promises");var Gp=require("node:events"),UT=$(require("node:stream"),1),$O=require("node:string_decoder"),MO=typeof process=="object"&&process?process:{stdout:null,stderr:null},NV=t=>!!t&&typeof t=="object"&&(t instanceof ms||t instanceof UT.default||RV(t)||PV(t)),RV=t=>!!t&&typeof t=="object"&&t instanceof Gp.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==UT.default.Writable.prototype.pipe,PV=t=>!!t&&typeof t=="object"&&t instanceof Gp.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",qi=Symbol("EOF"),$i=Symbol("maybeEmitEnd"),hs=Symbol("emittedEnd"),jp=Symbol("emittingEnd"),nl=Symbol("emittedError"),Up=Symbol("closed"),xO=Symbol("read"),Hp=Symbol("flush"),LO=Symbol("flushChunk"),Vn=Symbol("encoding"),Sa=Symbol("decoder"),Yt=Symbol("flowing"),il=Symbol("paused"),_a=Symbol("resume"),Xt=Symbol("buffer"),Nr=Symbol("pipes"),Jt=Symbol("bufferLength"),LT=Symbol("bufferPush"),Vp=Symbol("bufferShift"),hr=Symbol("objectMode"),Mt=Symbol("destroyed"),qT=Symbol("error"),$T=Symbol("emitData"),qO=Symbol("emitEnd"),BT=Symbol("emitEnd2"),fi=Symbol("async"),FT=Symbol("abort"),zp=Symbol("aborted"),sl=Symbol("signal"),Qs=Symbol("dataListeners"),Zr=Symbol("discarded"),ol=t=>Promise.resolve().then(t),wV=t=>t(),EV=t=>t==="end"||t==="finish"||t==="prefinish",CV=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,DV=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Wp=class{src;dest;opts;ondrain;constructor(e,r,n){this.src=e,this.dest=r,this.opts=n,this.ondrain=()=>e[_a](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},jT=class extends Wp{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,r,n){super(e,r,n),this.proxyErrors=i=>r.emit("error",i),e.on("error",this.proxyErrors)}},AV=t=>!!t.objectMode,IV=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",ms=class extends Gp.EventEmitter{[Yt]=!1;[il]=!1;[Nr]=[];[Xt]=[];[hr];[Vn];[fi];[Sa];[qi]=!1;[hs]=!1;[jp]=!1;[Up]=!1;[nl]=null;[Jt]=0;[Mt]=!1;[sl];[zp]=!1;[Qs]=0;[Zr]=!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");AV(r)?(this[hr]=!0,this[Vn]=null):IV(r)?(this[Vn]=r.encoding,this[hr]=!1):(this[hr]=!1,this[Vn]=null),this[fi]=!!r.async,this[Sa]=this[Vn]?new $O.StringDecoder(this[Vn]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[Xt]}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Nr]});let{signal:n}=r;n&&(this[sl]=n,n.aborted?this[FT]():n.addEventListener("abort",()=>this[FT]()))}get bufferLength(){return this[Jt]}get encoding(){return this[Vn]}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[hr]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[fi]}set async(e){this[fi]=this[fi]||!!e}[FT](){this[zp]=!0,this.emit("abort",this[sl]?.reason),this.destroy(this[sl]?.reason)}get aborted(){return this[zp]}set aborted(e){}write(e,r,n){if(this[zp])return!1;if(this[qi])throw new Error("write after end");if(this[Mt])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[fi]?ol:wV;if(!this[hr]&&!Buffer.isBuffer(e)){if(DV(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(CV(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[hr]?(this[Yt]&&this[Jt]!==0&&this[Hp](!0),this[Yt]?this.emit("data",e):this[LT](e),this[Jt]!==0&&this.emit("readable"),n&&i(n),this[Yt]):e.length?(typeof e=="string"&&!(r===this[Vn]&&!this[Sa]?.lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[Vn]&&(e=this[Sa].write(e)),this[Yt]&&this[Jt]!==0&&this[Hp](!0),this[Yt]?this.emit("data",e):this[LT](e),this[Jt]!==0&&this.emit("readable"),n&&i(n),this[Yt]):(this[Jt]!==0&&this.emit("readable"),n&&i(n),this[Yt])}read(e){if(this[Mt])return null;if(this[Zr]=!1,this[Jt]===0||e===0||e&&e>this[Jt])return this[$i](),null;this[hr]&&(e=null),this[Xt].length>1&&!this[hr]&&(this[Xt]=[this[Vn]?this[Xt].join(""):Buffer.concat(this[Xt],this[Jt])]);let r=this[xO](e||null,this[Xt][0]);return this[$i](),r}[xO](e,r){if(this[hr])this[Vp]();else{let n=r;e===n.length||e===null?this[Vp]():typeof n=="string"?(this[Xt][0]=n.slice(e),r=n.slice(0,e),this[Jt]-=e):(this[Xt][0]=n.subarray(e),r=n.subarray(0,e),this[Jt]-=e)}return this.emit("data",r),!this[Xt].length&&!this[qi]&&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[qi]=!0,this.writable=!1,(this[Yt]||!this[il])&&this[$i](),this}[_a](){this[Mt]||(!this[Qs]&&!this[Nr].length&&(this[Zr]=!0),this[il]=!1,this[Yt]=!0,this.emit("resume"),this[Xt].length?this[Hp]():this[qi]?this[$i]():this.emit("drain"))}resume(){return this[_a]()}pause(){this[Yt]=!1,this[il]=!0,this[Zr]=!1}get destroyed(){return this[Mt]}get flowing(){return this[Yt]}get paused(){return this[il]}[LT](e){this[hr]?this[Jt]+=1:this[Jt]+=e.length,this[Xt].push(e)}[Vp](){return this[hr]?this[Jt]-=1:this[Jt]-=this[Xt][0].length,this[Xt].shift()}[Hp](e=!1){do;while(this[LO](this[Vp]())&&this[Xt].length);!e&&!this[Xt].length&&!this[qi]&&this.emit("drain")}[LO](e){return this.emit("data",e),this[Yt]}pipe(e,r){if(this[Mt])return e;this[Zr]=!1;let n=this[hs];return r=r||{},e===MO.stdout||e===MO.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,n?r.end&&e.end():(this[Nr].push(r.proxyErrors?new jT(this,e,r):new Wp(this,e,r)),this[fi]?ol(()=>this[_a]()):this[_a]()),e}unpipe(e){let r=this[Nr].find(n=>n.dest===e);r&&(this[Nr].length===1?(this[Yt]&&this[Qs]===0&&(this[Yt]=!1),this[Nr]=[]):this[Nr].splice(this[Nr].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[Zr]=!1,this[Qs]++,!this[Nr].length&&!this[Yt]&&this[_a]();else if(e==="readable"&&this[Jt]!==0)super.emit("readable");else if(EV(e)&&this[hs])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[nl]){let i=r;this[fi]?ol(()=>i.call(this,this[nl])):i.call(this,this[nl])}return n}removeListener(e,r){return this.off(e,r)}off(e,r){let n=super.off(e,r);return e==="data"&&(this[Qs]=this.listeners("data").length,this[Qs]===0&&!this[Zr]&&!this[Nr].length&&(this[Yt]=!1)),n}removeAllListeners(e){let r=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Qs]=0,!this[Zr]&&!this[Nr].length&&(this[Yt]=!1)),r}get emittedEnd(){return this[hs]}[$i](){!this[jp]&&!this[hs]&&!this[Mt]&&this[Xt].length===0&&this[qi]&&(this[jp]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Up]&&this.emit("close"),this[jp]=!1)}emit(e,...r){let n=r[0];if(e!=="error"&&e!=="close"&&e!==Mt&&this[Mt])return!1;if(e==="data")return!this[hr]&&!n?!1:this[fi]?(ol(()=>this[$T](n)),!0):this[$T](n);if(e==="end")return this[qO]();if(e==="close"){if(this[Up]=!0,!this[hs]&&!this[Mt])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[nl]=n,super.emit(qT,n);let s=!this[sl]||this.listeners("error").length?super.emit("error",n):!1;return this[$i](),s}else if(e==="resume"){let s=super.emit("resume");return this[$i](),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[$i](),i}[$T](e){for(let n of this[Nr])n.dest.write(e)===!1&&this.pause();let r=this[Zr]?!1:super.emit("data",e);return this[$i](),r}[qO](){return this[hs]?!1:(this[hs]=!0,this.readable=!1,this[fi]?(ol(()=>this[BT]()),!0):this[BT]())}[BT](){if(this[Sa]){let r=this[Sa].end();if(r){for(let n of this[Nr])n.dest.write(r);this[Zr]||super.emit("data",r)}}for(let r of this[Nr])r.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[hr]||(e.dataLength=0);let r=this.promise();return this.on("data",n=>{e.push(n),this[hr]||(e.dataLength+=n.length)}),await r,e}async concat(){if(this[hr])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Vn]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,r)=>{this.on(Mt,()=>r(new Error("stream destroyed"))),this.on("error",n=>r(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Zr]=!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[qi])return r();let s,o,a=d=>{this.off("data",c),this.off("end",l),this.off(Mt,u),r(),o(d)},c=d=>{this.off("error",a),this.off("end",l),this.off(Mt,u),this.pause(),s({value:d,done:!!this[qi]})},l=()=>{this.off("error",a),this.off("data",c),this.off(Mt,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(Mt,u),this.once("error",a),this.once("end",l),this.once("data",c)})},throw:r,return:r,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Zr]=!1;let e=!1,r=()=>(this.pause(),this.off(qT,r),this.off(Mt,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(qT,r),this.once(Mt,r),{next:n,throw:r,return:r,[Symbol.iterator](){return this}}}destroy(e){if(this[Mt])return e?this.emit("error",e):this.emit(Mt),this;this[Mt]=!0,this[Zr]=!0,this[Xt].length=0,this[Jt]=0;let r=this;return typeof r.close=="function"&&!this[Up]&&r.close(),e?this.emit("error",e):this.emit(Mt),this}static get isStream(){return NV}};var MV=hi.realpathSync.native,cl={lstatSync:hi.lstatSync,readdir:hi.readdir,readdirSync:hi.readdirSync,readlinkSync:hi.readlinkSync,realpathSync:MV,promises:{lstat:gs.lstat,readdir:gs.readdir,readlink:gs.readlink,realpath:gs.realpath}},VO=t=>!t||t===cl||t===OV?cl:{...cl,...t,promises:{...cl.promises,...t.promises||{}}},zO=/^\\\\\?\\([a-z]:)\\?$/i,xV=t=>t.replace(/\//g,"\\").replace(zO,"$1\\"),LV=/[\\\/]/,Sn=0,WO=1,GO=2,pi=4,KO=6,YO=8,Zs=10,XO=12,bn=15,al=~bn,HT=16,BO=32,ll=64,zn=128,Kp=256,Xp=512,FO=ll|zn|Xp,qV=1023,VT=t=>t.isFile()?YO:t.isDirectory()?pi:t.isSymbolicLink()?Zs:t.isCharacterDevice()?GO:t.isBlockDevice()?KO:t.isSocket()?XO:t.isFIFO()?WO:Sn,jO=new Map,ul=t=>{let e=jO.get(t);if(e)return e;let r=t.normalize("NFKD");return jO.set(t,r),r},UO=new Map,Yp=t=>{let e=UO.get(t);if(e)return e;let r=ul(t.toLowerCase());return UO.set(t,r),r},Jp=class extends rl{constructor(){super({max:256})}},zT=class extends rl{constructor(e=16*1024){super({maxSize:e,sizeCalculation:r=>r.length+1})}},JO=Symbol("PathScurry setAsCwd"),mr=class{name;root;roots;parent;nocase;isCWD=!1;#e;#t;get dev(){return this.#t}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#o;get uid(){return this.#o}#f;get gid(){return this.#f}#a;get rdev(){return this.#a}#d;get blksize(){return this.#d}#c;get ino(){return this.#c}#l;get size(){return this.#l}#s;get blocks(){return this.#s}#y;get atimeMs(){return this.#y}#T;get mtimeMs(){return this.#T}#h;get ctimeMs(){return this.#h}#p;get birthtimeMs(){return this.#p}#k;get atime(){return this.#k}#g;get mtime(){return this.#g}#N;get ctime(){return this.#N}#R;get birthtime(){return this.#R}#b;#S;#_;#m;#C;#P;#i;#I;#v;#D;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,r=Sn,n,i,s,o,a){this.name=e,this.#b=s?Yp(e):ul(e),this.#i=r&qV,this.nocase=s,this.roots=i,this.root=n||this,this.#I=o,this.#_=a.fullpath,this.#C=a.relative,this.#P=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=VO(a.fs)}depth(){return this.#S!==void 0?this.#S:this.parent?this.#S=this.parent.depth()+1:this.#S=0}childrenCache(){return this.#I}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.#I.get(this);if(e)return e;let r=Object.assign([],{provisional:0});return this.#I.set(this,r),this.#i&=~HT,r}child(e,r){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let n=this.children(),i=this.nocase?Yp(e):ul(e);for(let c of n)if(c.#b===i)return c;let s=this.parent?this.sep:"",o=this.#_?this.#_+s+e:void 0,a=this.newChild(e,Sn,{...r,parent:this,fullpath:o});return this.canReaddir()||(a.#i|=zn),n.push(a),a}relative(){if(this.isCWD)return"";if(this.#C!==void 0)return this.#C;let e=this.name,r=this.parent;if(!r)return this.#C=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.#P!==void 0)return this.#P;let e=this.name,r=this.parent;if(!r)return this.#P=this.fullpathPosix();let n=r.relativePosix();return n+(!n||!r.parent?"":"/")+e}fullpath(){if(this.#_!==void 0)return this.#_;let e=this.name,r=this.parent;if(!r)return this.#_=this.name;let i=r.fullpath()+(r.parent?this.sep:"")+e;return this.#_=i}fullpathPosix(){if(this.#m!==void 0)return this.#m;if(this.sep==="/")return this.#m=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#m=`//?/${i}`:this.#m=i}let e=this.parent,r=e.fullpathPosix(),n=r+(!r||!e.parent?"":"/")+this.name;return this.#m=n}isUnknown(){return(this.#i&bn)===Sn}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&bn)===YO}isDirectory(){return(this.#i&bn)===pi}isCharacterDevice(){return(this.#i&bn)===GO}isBlockDevice(){return(this.#i&bn)===KO}isFIFO(){return(this.#i&bn)===WO}isSocket(){return(this.#i&bn)===XO}isSymbolicLink(){return(this.#i&Zs)===Zs}lstatCached(){return this.#i&BO?this:void 0}readlinkCached(){return this.#v}realpathCached(){return this.#D}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#v)return!0;if(!this.parent)return!1;let e=this.#i&bn;return!(e!==Sn&&e!==Zs||this.#i&Kp||this.#i&zn)}calledReaddir(){return!!(this.#i&HT)}isENOENT(){return!!(this.#i&zn)}isNamed(e){return this.nocase?this.#b===Yp(e):this.#b===ul(e)}async readlink(){let e=this.#v;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.#v=n}catch(r){this.#u(r.code);return}}readlinkSync(){let e=this.#v;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.#v=n}catch(r){this.#u(r.code);return}}#M(e){this.#i|=HT;for(let r=e.provisional;r<e.length;r++){let n=e[r];n&&n.#x()}}#x(){this.#i&zn||(this.#i=(this.#i|zn)&al,this.#w())}#w(){let e=this.children();e.provisional=0;for(let r of e)r.#x()}#E(){this.#i|=Xp,this.#L()}#L(){if(this.#i&ll)return;let e=this.#i;(e&bn)===pi&&(e&=al),this.#i=e|ll,this.#w()}#q(e=""){e==="ENOTDIR"||e==="EPERM"?this.#L():e==="ENOENT"?this.#x():this.children().provisional=0}#$(e=""){e==="ENOTDIR"?this.parent.#L():e==="ENOENT"&&this.#x()}#u(e=""){let r=this.#i;r|=Kp,e==="ENOENT"&&(r|=zn),(e==="EINVAL"||e==="UNKNOWN")&&(r&=al),this.#i=r,e==="ENOTDIR"&&this.parent&&this.parent.#L()}#B(e,r){return this.#A(e,r)||this.#F(e,r)}#F(e,r){let n=VT(e),i=this.newChild(e.name,n,{parent:this}),s=i.#i&bn;return s!==pi&&s!==Zs&&s!==Sn&&(i.#i|=ll),r.unshift(i),r.provisional++,i}#A(e,r){for(let n=r.provisional;n<r.length;n++){let i=r[n];if((this.nocase?Yp(e.name):ul(e.name))===i.#b)return this.#j(e,i,n,r)}}#j(e,r,n,i){let s=r.name;return r.#i=r.#i&al|VT(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&zn)===0)try{return this.#z(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#$(e.code)}}lstatSync(){if((this.#i&zn)===0)try{return this.#z(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#$(e.code)}}#z(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:T,rdev:b,size:S,uid:v}=e;this.#k=r,this.#y=n,this.#R=i,this.#p=s,this.#d=o,this.#s=a,this.#N=c,this.#h=l,this.#t=u,this.#f=d,this.#c=f,this.#n=p,this.#g=m,this.#T=h,this.#r=T,this.#a=b,this.#l=S,this.#o=v;let N=VT(e);this.#i=this.#i&al|N|BO,N!==Sn&&N!==pi&&N!==Zs&&(this.#i|=ll)}#H=[];#V=!1;#W(e){this.#V=!1;let r=this.#H.slice();this.#H.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.#H.push(e),this.#V)return;this.#V=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(s,o)=>{if(s)this.#q(s.code),n.provisional=0;else{for(let a of o)this.#B(a,n);this.#M(n)}this.#W(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.#B(i,e);this.#M(e)}catch(i){this.#q(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.#B(n,e);this.#M(e)}catch(n){this.#q(n.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#i&FO)return!1;let e=bn&this.#i;return e===Sn||e===pi||e===Zs}shouldWalk(e,r){return(this.#i&pi)===pi&&!(this.#i&FO)&&!e.has(this)&&(!r||r(this))}async realpath(){if(this.#D)return this.#D;if(!((Xp|Kp|zn)&this.#i))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#D=this.resolve(e)}catch{this.#E()}}realpathSync(){if(this.#D)return this.#D;if(!((Xp|Kp|zn)&this.#i))try{let e=this.#e.realpathSync(this.fullpath());return this.#D=this.resolve(e)}catch{this.#E()}}[JO](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.#C=n.join(this.sep),i.#P=n.join("/"),i=i.parent,n.push("..");for(i=e;i&&i.parent&&!r.has(i);)i.#C=void 0,i.#P=void 0,i=i.parent}},Qp=class t extends mr{sep="\\";splitSep=LV;constructor(e,r=Sn,n,i,s,o,a){super(e,r,n,i,s,o,a)}newChild(e,r=Sn,n={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(e){return ka.win32.parse(e).root}getRoot(e){if(e=xV(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 Na(e,this).root}sameRoot(e,r=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(zO,"$1\\"),e===r}},Zp=class t extends mr{splitSep="/";sep="/";constructor(e,r=Sn,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=Sn,n={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}},eh=class{root;rootPath;roots;cwd;#e;#t;#n;nocase;#r;constructor(e=process.cwd(),r,n,{nocase:i,childrenCacheSize:s=16*1024,fs:o=cl}={}){this.#r=VO(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,HO.fileURLToPath)(e));let a=r.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new Jp,this.#t=new Jp,this.#n=new zT(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.#r),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.#t.get(r);if(n!==void 0)return n;let i=this.cwd.resolve(r).fullpathPosix();return this.#t.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 mr||(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 mr||(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 mr||(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 mr||(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 mr||(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 mr||(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 mr||(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 T=()=>{--h===0&&f()};for(let b of m)(!s||s(b))&&a.push(n?b:b.fullpath()),i&&b.isSymbolicLink()?b.realpath().then(S=>S?.isUnknown()?S.lstat():S).then(S=>S?.shouldWalk(c,o)?l(S,T):T()):b.shouldWalk(c,o)?l(b,T):T()},!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 mr||(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 mr||(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 mr||(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 mr||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=new ms({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=(T,b,S=!1)=>{if(T)return a.emit("error",T);if(i&&!S){let v=[];for(let N of b)N.isSymbolicLink()&&v.push(N.realpath().then(C=>C?.isUnknown()?C.lstat():C));if(v.length){Promise.all(v).then(()=>m(null,b,!0));return}}for(let v of b)v&&(!s||s(v))&&(a.write(n?v:v.fullpath())||(f=!0));u--;for(let v of b){let N=v.realpathCached()||v;N.shouldWalk(c,o)&&l.push(N)}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 mr||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=new ms({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 T=h;if(h.isSymbolicLink()){if(!(i&&(T=h.realpathSync())))continue;T.isUnknown()&&T.lstatSync()}T.shouldWalk(c,o)&&l.push(T)}}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[JO](r)}},Na=class extends eh{sep="\\";constructor(e=process.cwd(),r={}){let{nocase:n=!0}=r;super(e,ka.win32,"\\",{...r,nocase:n}),this.nocase=n;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return ka.win32.parse(e).root.toUpperCase()}newRoot(e){return new Qp(this.rootPath,pi,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Ra=class extends eh{sep="/";constructor(e=process.cwd(),r={}){let{nocase:n=!1}=r;super(e,ka.posix,"/",{...r,nocase:n}),this.nocase=n}parseRootPath(e){return"/"}newRoot(e){return new Zp(this.rootPath,pi,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},dl=class extends Ra{constructor(e=process.cwd(),r={}){let{nocase:n=!0}=r;super(e,{...r,nocase:n})}},Qke=process.platform==="win32"?Qp:Zp,QO=process.platform==="win32"?Na:process.platform==="darwin"?dl:Ra;var $V=t=>t.length>=1,BV=t=>t.length>=1,Pa=class t{#e;#t;#n;length;#r;#o;#f;#a;#d;#c;#l=!0;constructor(e,r,n,i){if(!$V(e))throw new TypeError("empty pattern list");if(!BV(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.#t=r,this.#n=n,this.#r=i,this.#n===0){if(this.isUNC()){let[s,o,a,c,...l]=this.#e,[u,d,f,p,...m]=this.#t;l[0]===""&&(l.shift(),m.shift());let h=[s,o,a,c,""].join("/"),T=[u,d,f,p,""].join("/");this.#e=[h,...l],this.#t=[T,...m],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...o]=this.#e,[a,...c]=this.#t;o[0]===""&&(o.shift(),c.shift());let l=s+"/",u=a+"/";this.#e=[l,...o],this.#t=[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]===rr}isRegExp(){return this.#e[this.#n]instanceof RegExp}globString(){return this.#f=this.#f||(this.#n===0?this.isAbsolute()?this.#t[0]+this.#t.slice(1).join("/"):this.#t.join("/"):this.#t.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new t(this.#e,this.#t,this.#n+1,this.#r),this.#o.#c=this.#c,this.#o.#d=this.#d,this.#o.#a=this.#a,this.#o):this.#o=null}isUNC(){let e=this.#e;return this.#d!==void 0?this.#d:this.#d=this.#r==="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.#a!==void 0?this.#a:this.#a=this.#r==="win32"&&this.#n===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#c!==void 0?this.#c:this.#c=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.#l)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};var FV=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",wa=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:r,nocase:n,noext:i,noglobstar:s,platform:o=FV}){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 Qr(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 Pa(i,s,0,this.platform),a=new Qr(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 WT=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()]))}},GT=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)])}},KT=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())}},fl=class t{hasWalkedCache;matches=new GT;subwalks=new KT;patterns;follow;dot;opts;constructor(e,r){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=r?r.copy():new WT}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===rr){(!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===rr?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 jV=(t,e)=>typeof t=="string"?new wa([t],e):Array.isArray(t)?new wa(t,e):t,th=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#t;#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.#t=jV(n.ignore??[],n),!this.includeChildMatches&&typeof this.#t.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}))}#r(e){return this.seen.has(e)||!!this.#t?.ignored?.(e)}#o(e){return!!this.#t?.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.#r(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.#r(e))return;if(!this.includeChildMatches&&this.#t?.add){let s=`${e.relativePosix()}/**`;this.#t.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 fl(this.opts),n)}walkCB2(e,r,n,i){if(this.#o(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.#r(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.#r(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 fl(this.opts),n)}walkCB2Sync(e,r,n,i){if(this.#o(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.#r(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.#r(a)||this.matchSync(a,c,l);for(let[a,c]of n.subwalks.entries())s++,this.walkCB2Sync(a,c,n.child(),o);o()}},pl=class extends th{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}},hl=class extends th{results;constructor(e,r,n){super(e,r,n),this.results=new ms({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 UV=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Wn=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,ZO.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||UV,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"?Na:r.platform==="darwin"?dl:r.platform?Ra:QO;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 Qr(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 Pa(c,u,0,this.platform)})}async walk(){return[...await new pl(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 pl(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 hl(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 hl(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 YT=(t,e={})=>{Array.isArray(t)||(t=[t]);for(let r of t)if(new Qr(r,e).hasMagic())return!0;return!1};function rh(t,e={}){return new Wn(t,e).streamSync()}function tM(t,e={}){return new Wn(t,e).stream()}function rM(t,e={}){return new Wn(t,e).walkSync()}async function eM(t,e={}){return new Wn(t,e).walk()}function nh(t,e={}){return new Wn(t,e).iterateSync()}function nM(t,e={}){return new Wn(t,e).iterate()}var HV=rh,VV=Object.assign(tM,{sync:rh}),zV=nh,WV=Object.assign(nM,{sync:nh}),GV=Object.assign(rM,{stream:rh,iterate:nh}),eo=Object.assign(eM,{glob:eM,globSync:rM,sync:GV,globStream:tM,stream:VV,globStreamSync:rh,streamSync:HV,globIterate:nM,iterate:WV,globIterateSync:nh,iterateSync:zV,Glob:Wn,hasMagic:YT,escape:Ta,unescape:Hn});eo.glob=eo;var I_=$(Db()),K$=$(z$());var C_={};FB(C_,{$id:()=>FJ,$schema:()=>BJ,default:()=>zJ,definitions:()=>UJ,properties:()=>VJ,title:()=>jJ,type:()=>HJ});var BJ="http://json-schema.org/draft-07/schema#",FJ="http://json-schema.org/draft-07/schema#",jJ="Core schema meta-schema",UJ={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:[]}},HJ=["object","boolean"],VJ={$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:"#"}},zJ={$schema:BJ,$id:FJ,title:jJ,definitions:UJ,type:HJ,properties:VJ,default:!0};var en=$(U());var xm=class extends $c{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.definitions,...n.referencedBy].forEach(a=>i.push(B(21,a.firstToken,a.lastToken,a,{severity:en.DiagnosticSeverity.Hint,linkedTo:[...o?.ast?[o?.ast]:[]],tags:[en.DiagnosticTag.Unnecessary]}))),i}let s=J.toJson(n);try{this.validate?(this.validate(s),this.validate.errors&&(this.validate.errors.forEach(o=>i.push(...WJ(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:en.MarkupKind.Markdown,value:[...n.description?["### Description",Array.isArray(n.description)?n.description.join(`
|
|
301
|
+
>>> no match, partial?`,e,f,r,p),f===c))}let h;if(typeof u=="string"?(h=d===u,this.debug("string match",u,d,h)):(h=u.test(d),this.debug("pattern match",u,d,h)),!h)return!1}if(o===c&&a===l)return!0;if(o===c)return n;if(a===l)return o===c-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return IO(this.pattern,this.options)}parse(e){nl(e);let r=this.options;if(e==="**")return nr;if(e==="")return"";let n,i=null;(n=e.match(aV))?i=r.dot?lV:cV:(n=e.match(JH))?i=(r.nocase?r.dot?tV:eV:r.dot?ZH:QH)(n[1]):(n=e.match(uV))?i=(r.nocase?r.dot?fV:dV:r.dot?pV:hV)(n):(n=e.match(rV))?i=r.dot?iV:nV:(n=e.match(sV))&&(i=oV);let s=ba.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?yV:r.dot?TV:vV,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"?NV(d):d===nr?nr:d._src});l.forEach((d,f)=>{let p=l[f+1],m=l[f-1];d!==nr||m===nr||(m===void 0?p!==void 0&&p!==nr?l[f+1]="(?:\\/|"+n+"\\/)?"+p:l[f]=n:p===void 0?l[f-1]=m+"(?:\\/|\\/"+n+")?":p!==nr&&(l[f-1]=m+"(?:\\/|\\/"+n+"\\/)"+p,l[f+1]=nr))});let u=l.filter(d=>d!==nr);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=0;a<s.length;a++){let c=s[a],l=i;if(n.matchBase&&c.length===1&&(l=[o]),this.matchOne(l,c,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return Rr.defaults(e).Minimatch}};Rr.AST=ba;Rr.Minimatch=nn;Rr.escape=Sa;Rr.unescape=Gn;var rM=require("node:url");var _a=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,MO=new Set,BT=typeof process=="object"&&process?process:{},xO=(t,e,r,n)=>{typeof BT.emitWarning=="function"?BT.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)},Gp=globalThis.AbortController,OO=globalThis.AbortSignal;if(typeof Gp>"u"){OO=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},Gp=class{constructor(){e()}signal=new OO;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let t=BT.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,xO("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var RV=t=>!MO.has(t),hNe=Symbol("type"),ms=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),LO=t=>ms(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?ka:null:null,ka=class extends Array{constructor(e){super(e),this.fill(0)}},FT=class t{heap;length;static#e=!1;static create(e){let r=LO(e);if(!r)return[];t.#e=!0;let n=new t(e,r);return t.#e=!1,n}constructor(e,r){if(!t.#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]}},sl=class t{#e;#t;#n;#r;#o;#f;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#d;#c;#l;#s;#y;#T;#h;#p;#k;#g;#N;#R;#b;#S;#_;#m;static unsafeExposeInternals(e){return{starts:e.#R,ttls:e.#b,sizes:e.#N,keyMap:e.#c,keyList:e.#l,valList:e.#s,next:e.#y,prev:e.#T,get head(){return e.#h},get tail(){return e.#p},free:e.#k,isBackgroundFetch:r=>e.#u(r),backgroundFetch:(r,n,i,s)=>e.#$(r,n,i,s),moveToTail:r=>e.#F(r),indexes:r=>e.#w(r),rindexes:r=>e.#E(r),isStale:r=>e.#v(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#d}get size(){return this.#a}get fetchMethod(){return this.#o}get memoMethod(){return this.#f}get dispose(){return this.#n}get disposeAfter(){return this.#r}constructor(e){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:c,dispose:l,disposeAfter:u,noDisposeOnSet:d,noUpdateTTL:f,maxSize:p=0,maxEntrySize:m=0,sizeCalculation:h,fetchMethod:T,memoMethod:b,noDeleteOnFetchRejection:_,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:N,allowStaleOnFetchAbort:C,ignoreFetchAbort:H}=e;if(r!==0&&!ms(r))throw new TypeError("max option must be a nonnegative integer");let M=r?LO(r):Array;if(!M)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=p,this.maxEntrySize=m||this.#t,this.sizeCalculation=h,this.sizeCalculation){if(!this.#t&&!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(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#f=b,T!==void 0&&typeof T!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=T,this.#_=!!T,this.#c=new Map,this.#l=new Array(r).fill(void 0),this.#s=new Array(r).fill(void 0),this.#y=new M(r),this.#T=new M(r),this.#h=0,this.#p=0,this.#k=FT.create(r),this.#a=0,this.#d=0,typeof l=="function"&&(this.#n=l),typeof u=="function"?(this.#r=u,this.#g=[]):(this.#r=void 0,this.#g=void 0),this.#S=!!this.#n,this.#m=!!this.#r,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!_,this.allowStaleOnFetchRejection=!!N,this.allowStaleOnFetchAbort=!!C,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(this.#t!==0&&!ms(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!ms(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#D()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=ms(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!ms(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#C()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let F="LRU_CACHE_UNBOUNDED";RV(F)&&(MO.add(F),xO("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",F,t))}}getRemainingTTL(e){return this.#c.has(e)?1/0:0}#C(){let e=new ka(this.#e),r=new ka(this.#e);this.#b=e,this.#R=r,this.#I=(s,o,a=_a.now())=>{if(r[s]=o!==0?a:0,e[s]=o,o!==0&&this.ttlAutopurge){let c=setTimeout(()=>{this.#v(s)&&this.#A(this.#l[s],"expire")},o+1);c.unref&&c.unref()}},this.#P=s=>{r[s]=e[s]!==0?_a.now():0},this.#i=(s,o)=>{if(e[o]){let a=e[o],c=r[o];if(!a||!c)return;s.ttl=a,s.start=c,s.now=n||i();let l=s.now-c;s.remainingTTL=a-l}};let n=0,i=()=>{let s=_a.now();if(this.ttlResolution>0){n=s;let o=setTimeout(()=>n=0,this.ttlResolution);o.unref&&o.unref()}return s};this.getRemainingTTL=s=>{let o=this.#c.get(s);if(o===void 0)return 0;let a=e[o],c=r[o];if(!a||!c)return 1/0;let l=(n||i())-c;return a-l},this.#v=s=>{let o=r[s],a=e[s];return!!a&&!!o&&(n||i())-o>a}}#P=()=>{};#i=()=>{};#I=()=>{};#v=()=>!1;#D(){let e=new ka(this.#e);this.#d=0,this.#N=e,this.#O=r=>{this.#d-=e[r],e[r]=0},this.#x=(r,n,i,s)=>{if(this.#u(n))return 0;if(!ms(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,r),!ms(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.#M=(r,n,i)=>{if(e[r]=n,this.#t){let s=this.#t-e[r];for(;this.#d>s;)this.#q(!0)}this.#d+=e[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#d)}}#O=e=>{};#M=(e,r,n)=>{};#x=(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#w({allowStale:e=this.allowStale}={}){if(this.#a)for(let r=this.#p;!(!this.#L(r)||((e||!this.#v(r))&&(yield r),r===this.#h));)r=this.#T[r]}*#E({allowStale:e=this.allowStale}={}){if(this.#a)for(let r=this.#h;!(!this.#L(r)||((e||!this.#v(r))&&(yield r),r===this.#p));)r=this.#y[r]}#L(e){return e!==void 0&&this.#c.get(this.#l[e])===e}*entries(){for(let e of this.#w())this.#s[e]!==void 0&&this.#l[e]!==void 0&&!this.#u(this.#s[e])&&(yield[this.#l[e],this.#s[e]])}*rentries(){for(let e of this.#E())this.#s[e]!==void 0&&this.#l[e]!==void 0&&!this.#u(this.#s[e])&&(yield[this.#l[e],this.#s[e]])}*keys(){for(let e of this.#w()){let r=this.#l[e];r!==void 0&&!this.#u(this.#s[e])&&(yield r)}}*rkeys(){for(let e of this.#E()){let r=this.#l[e];r!==void 0&&!this.#u(this.#s[e])&&(yield r)}}*values(){for(let e of this.#w())this.#s[e]!==void 0&&!this.#u(this.#s[e])&&(yield this.#s[e])}*rvalues(){for(let e of this.#E())this.#s[e]!==void 0&&!this.#u(this.#s[e])&&(yield this.#s[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#w()){let i=this.#s[n],s=this.#u(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#l[n],this))return this.get(this.#l[n],r)}}forEach(e,r=this){for(let n of this.#w()){let i=this.#s[n],s=this.#u(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#l[n],this)}}rforEach(e,r=this){for(let n of this.#E()){let i=this.#s[n],s=this.#u(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#l[n],this)}}purgeStale(){let e=!1;for(let r of this.#E({allowStale:!0}))this.#v(r)&&(this.#A(this.#l[r],"expire"),e=!0);return e}info(e){let r=this.#c.get(e);if(r===void 0)return;let n=this.#s[r],i=this.#u(n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(this.#b&&this.#R){let o=this.#b[r],a=this.#R[r];if(o&&a){let c=o-(_a.now()-a);s.ttl=c,s.start=Date.now()}}return this.#N&&(s.size=this.#N[r]),s}dump(){let e=[];for(let r of this.#w({allowStale:!0})){let n=this.#l[r],i=this.#s[r],s=this.#u(i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let o={value:s};if(this.#b&&this.#R){o.ttl=this.#b[r];let a=_a.now()-this.#R[r];o.start=Math.floor(Date.now()-a)}this.#N&&(o.size=this.#N[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=_a.now()-i}this.set(r,n.value,n)}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=n,{noUpdateTTL:l=this.noUpdateTTL}=n,u=this.#x(e,r,n.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.#A(e,"set"),this;let d=this.#a===0?void 0:this.#c.get(e);if(d===void 0)d=this.#a===0?this.#p:this.#k.length!==0?this.#k.pop():this.#a===this.#e?this.#q(!1):this.#a,this.#l[d]=e,this.#s[d]=r,this.#c.set(e,d),this.#y[this.#p]=d,this.#T[d]=this.#p,this.#p=d,this.#a++,this.#M(d,u,c),c&&(c.set="add"),l=!1;else{this.#F(d);let f=this.#s[d];if(r!==f){if(this.#_&&this.#u(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=f;p!==void 0&&!o&&(this.#S&&this.#n?.(p,e,"set"),this.#m&&this.#g?.push([p,e,"set"]))}else o||(this.#S&&this.#n?.(f,e,"set"),this.#m&&this.#g?.push([f,e,"set"]));if(this.#O(d),this.#M(d,u,c),this.#s[d]=r,c){c.set="replace";let p=f&&this.#u(f)?f.__staleWhileFetching:f;p!==void 0&&(c.oldValue=p)}}else c&&(c.set="update")}if(i!==0&&!this.#b&&this.#C(),this.#b&&(l||this.#I(d,i,s),c&&this.#i(c,d)),!o&&this.#m&&this.#g){let f=this.#g,p;for(;p=f?.shift();)this.#r?.(...p)}return this}pop(){try{for(;this.#a;){let e=this.#s[this.#h];if(this.#q(!0),this.#u(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#m&&this.#g){let e=this.#g,r;for(;r=e?.shift();)this.#r?.(...r)}}}#q(e){let r=this.#h,n=this.#l[r],i=this.#s[r];return this.#_&&this.#u(i)?i.__abortController.abort(new Error("evicted")):(this.#S||this.#m)&&(this.#S&&this.#n?.(i,n,"evict"),this.#m&&this.#g?.push([i,n,"evict"])),this.#O(r),e&&(this.#l[r]=void 0,this.#s[r]=void 0,this.#k.push(r)),this.#a===1?(this.#h=this.#p=0,this.#k.length=0):this.#h=this.#y[r],this.#c.delete(n),this.#a--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,s=this.#c.get(e);if(s!==void 0){let o=this.#s[s];if(this.#u(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#v(s))i&&(i.has="stale",this.#i(i,s));else return n&&this.#P(s),i&&(i.has="hit",this.#i(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,i=this.#c.get(e);if(i===void 0||!n&&this.#v(i))return;let s=this.#s[i];return this.#u(s)?s.__staleWhileFetching:s}#$(e,r,n,i){let s=r===void 0?void 0:this.#s[r];if(this.#u(s))return s;let o=new Gp,{signal:a}=n;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let c={signal:o.signal,options:n,context:i},l=(h,T=!1)=>{let{aborted:b}=o.signal,_=n.ignoreFetchAbort&&h!==void 0;if(n.status&&(b&&!T?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,_&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),b&&!_&&!T)return d(o.signal.reason);let v=p;return this.#s[r]===p&&(h===void 0?v.__staleWhileFetching?this.#s[r]=v.__staleWhileFetching:this.#A(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,h,c.options))),h},u=h=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=h),d(h)),d=h=>{let{aborted:T}=o.signal,b=T&&n.allowStaleOnFetchAbort,_=b||n.allowStaleOnFetchRejection,v=_||n.noDeleteOnFetchRejection,N=p;if(this.#s[r]===p&&(!v||N.__staleWhileFetching===void 0?this.#A(e,"fetch"):b||(this.#s[r]=N.__staleWhileFetching)),_)return n.status&&N.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),N.__staleWhileFetching;if(N.__returned===N)throw h},f=(h,T)=>{let b=this.#o?.(e,s,c);b&&b instanceof Promise&&b.then(_=>h(_===void 0?void 0:_),T),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(h(void 0),n.allowStaleOnFetchAbort&&(h=_=>l(_,!0)))})};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.set(e,m,{...c.options,status:void 0}),r=this.#c.get(e)):this.#s[r]=m,m}#u(e){if(!this.#_)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof Gp}async fetch(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:T=!1,status:b,signal:_}=r;if(!this.#_)return b&&(b.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:b});let v={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:b,signal:_},N=this.#c.get(e);if(N===void 0){b&&(b.fetch="miss");let C=this.#$(e,N,v,h);return C.__returned=C}else{let C=this.#s[N];if(this.#u(C)){let lt=n&&C.__staleWhileFetching!==void 0;return b&&(b.fetch="inflight",lt&&(b.returnedStale=!0)),lt?C.__staleWhileFetching:C.__returned=C}let H=this.#v(N);if(!T&&!H)return b&&(b.fetch="hit"),this.#F(N),i&&this.#P(N),b&&this.#i(b,N),C;let M=this.#$(e,N,v,h),De=M.__staleWhileFetching!==void 0&&n;return b&&(b.fetch=H?"stale":"refresh",De&&H&&(b.returnedStale=!0)),De?M.__staleWhileFetching:M.__returned=M}}async forceFetch(e,r={}){let n=await this.fetch(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let n=this.#f;if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...o}=r,a=this.get(e,o);if(!s&&a!==void 0)return a;let c=n(e,a,{options:o,context:i});return this.set(e,c,o),c}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=r,a=this.#c.get(e);if(a!==void 0){let c=this.#s[a],l=this.#u(c);return o&&this.#i(o,a),this.#v(a)?(o&&(o.get="stale"),l?(o&&n&&c.__staleWhileFetching!==void 0&&(o.returnedStale=!0),n?c.__staleWhileFetching:void 0):(s||this.#A(e,"expire"),o&&n&&(o.returnedStale=!0),n?c:void 0)):(o&&(o.get="hit"),l?c.__staleWhileFetching:(this.#F(a),i&&this.#P(a),c))}else o&&(o.get="miss")}#B(e,r){this.#T[r]=e,this.#y[e]=r}#F(e){e!==this.#p&&(e===this.#h?this.#h=this.#y[e]:this.#B(this.#T[e],this.#y[e]),this.#B(this.#p,e),this.#p=e)}delete(e){return this.#A(e,"delete")}#A(e,r){let n=!1;if(this.#a!==0){let i=this.#c.get(e);if(i!==void 0)if(n=!0,this.#a===1)this.#j(r);else{this.#O(i);let s=this.#s[i];if(this.#u(s)?s.__abortController.abort(new Error("deleted")):(this.#S||this.#m)&&(this.#S&&this.#n?.(s,e,r),this.#m&&this.#g?.push([s,e,r])),this.#c.delete(e),this.#l[i]=void 0,this.#s[i]=void 0,i===this.#p)this.#p=this.#T[i];else if(i===this.#h)this.#h=this.#y[i];else{let o=this.#T[i];this.#y[o]=this.#y[i];let a=this.#y[i];this.#T[a]=this.#T[i]}this.#a--,this.#k.push(i)}}if(this.#m&&this.#g?.length){let i=this.#g,s;for(;s=i?.shift();)this.#r?.(...s)}return n}clear(){return this.#j("delete")}#j(e){for(let r of this.#E({allowStale:!0})){let n=this.#s[r];if(this.#u(n))n.__abortController.abort(new Error("deleted"));else{let i=this.#l[r];this.#S&&this.#n?.(n,i,e),this.#m&&this.#g?.push([n,i,e])}}if(this.#c.clear(),this.#s.fill(void 0),this.#l.fill(void 0),this.#b&&this.#R&&(this.#b.fill(0),this.#R.fill(0)),this.#N&&this.#N.fill(0),this.#h=0,this.#p=0,this.#k.length=0,this.#d=0,this.#a=0,this.#m&&this.#g){let r=this.#g,n;for(;n=r?.shift();)this.#r?.(...n)}}};var Pa=require("node:path"),WO=require("node:url"),Ti=require("fs"),xV=$(require("node:fs"),1),Ts=require("node:fs/promises");var eh=require("node:events"),GT=$(require("node:stream"),1),jO=require("node:string_decoder"),qO=typeof process=="object"&&process?process:{stdout:null,stderr:null},PV=t=>!!t&&typeof t=="object"&&(t instanceof ys||t instanceof GT.default||wV(t)||EV(t)),wV=t=>!!t&&typeof t=="object"&&t instanceof eh.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==GT.default.Writable.prototype.pipe,EV=t=>!!t&&typeof t=="object"&&t instanceof eh.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",Bi=Symbol("EOF"),Fi=Symbol("maybeEmitEnd"),gs=Symbol("emittedEnd"),Kp=Symbol("emittingEnd"),ol=Symbol("emittedError"),Yp=Symbol("closed"),$O=Symbol("read"),Xp=Symbol("flush"),BO=Symbol("flushChunk"),Kn=Symbol("encoding"),Na=Symbol("decoder"),Xt=Symbol("flowing"),al=Symbol("paused"),Ra=Symbol("resume"),Jt=Symbol("buffer"),Pr=Symbol("pipes"),Qt=Symbol("bufferLength"),jT=Symbol("bufferPush"),Jp=Symbol("bufferShift"),gr=Symbol("objectMode"),xt=Symbol("destroyed"),UT=Symbol("error"),HT=Symbol("emitData"),FO=Symbol("emitEnd"),VT=Symbol("emitEnd2"),gi=Symbol("async"),zT=Symbol("abort"),Qp=Symbol("aborted"),cl=Symbol("signal"),ro=Symbol("dataListeners"),sn=Symbol("discarded"),ll=t=>Promise.resolve().then(t),CV=t=>t(),DV=t=>t==="end"||t==="finish"||t==="prefinish",AV=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,IV=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Zp=class{src;dest;opts;ondrain;constructor(e,r,n){this.src=e,this.dest=r,this.opts=n,this.ondrain=()=>e[Ra](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},WT=class extends Zp{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,r,n){super(e,r,n),this.proxyErrors=i=>r.emit("error",i),e.on("error",this.proxyErrors)}},OV=t=>!!t.objectMode,MV=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",ys=class extends eh.EventEmitter{[Xt]=!1;[al]=!1;[Pr]=[];[Jt]=[];[gr];[Kn];[gi];[Na];[Bi]=!1;[gs]=!1;[Kp]=!1;[Yp]=!1;[ol]=null;[Qt]=0;[xt]=!1;[cl];[Qp]=!1;[ro]=0;[sn]=!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");OV(r)?(this[gr]=!0,this[Kn]=null):MV(r)?(this[Kn]=r.encoding,this[gr]=!1):(this[gr]=!1,this[Kn]=null),this[gi]=!!r.async,this[Na]=this[Kn]?new jO.StringDecoder(this[Kn]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[Jt]}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Pr]});let{signal:n}=r;n&&(this[cl]=n,n.aborted?this[zT]():n.addEventListener("abort",()=>this[zT]()))}get bufferLength(){return this[Qt]}get encoding(){return this[Kn]}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[gr]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[gi]}set async(e){this[gi]=this[gi]||!!e}[zT](){this[Qp]=!0,this.emit("abort",this[cl]?.reason),this.destroy(this[cl]?.reason)}get aborted(){return this[Qp]}set aborted(e){}write(e,r,n){if(this[Qp])return!1;if(this[Bi])throw new Error("write after end");if(this[xt])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[gi]?ll:CV;if(!this[gr]&&!Buffer.isBuffer(e)){if(IV(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(AV(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[gr]?(this[Xt]&&this[Qt]!==0&&this[Xp](!0),this[Xt]?this.emit("data",e):this[jT](e),this[Qt]!==0&&this.emit("readable"),n&&i(n),this[Xt]):e.length?(typeof e=="string"&&!(r===this[Kn]&&!this[Na]?.lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[Kn]&&(e=this[Na].write(e)),this[Xt]&&this[Qt]!==0&&this[Xp](!0),this[Xt]?this.emit("data",e):this[jT](e),this[Qt]!==0&&this.emit("readable"),n&&i(n),this[Xt]):(this[Qt]!==0&&this.emit("readable"),n&&i(n),this[Xt])}read(e){if(this[xt])return null;if(this[sn]=!1,this[Qt]===0||e===0||e&&e>this[Qt])return this[Fi](),null;this[gr]&&(e=null),this[Jt].length>1&&!this[gr]&&(this[Jt]=[this[Kn]?this[Jt].join(""):Buffer.concat(this[Jt],this[Qt])]);let r=this[$O](e||null,this[Jt][0]);return this[Fi](),r}[$O](e,r){if(this[gr])this[Jp]();else{let n=r;e===n.length||e===null?this[Jp]():typeof n=="string"?(this[Jt][0]=n.slice(e),r=n.slice(0,e),this[Qt]-=e):(this[Jt][0]=n.subarray(e),r=n.subarray(0,e),this[Qt]-=e)}return this.emit("data",r),!this[Jt].length&&!this[Bi]&&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[Bi]=!0,this.writable=!1,(this[Xt]||!this[al])&&this[Fi](),this}[Ra](){this[xt]||(!this[ro]&&!this[Pr].length&&(this[sn]=!0),this[al]=!1,this[Xt]=!0,this.emit("resume"),this[Jt].length?this[Xp]():this[Bi]?this[Fi]():this.emit("drain"))}resume(){return this[Ra]()}pause(){this[Xt]=!1,this[al]=!0,this[sn]=!1}get destroyed(){return this[xt]}get flowing(){return this[Xt]}get paused(){return this[al]}[jT](e){this[gr]?this[Qt]+=1:this[Qt]+=e.length,this[Jt].push(e)}[Jp](){return this[gr]?this[Qt]-=1:this[Qt]-=this[Jt][0].length,this[Jt].shift()}[Xp](e=!1){do;while(this[BO](this[Jp]())&&this[Jt].length);!e&&!this[Jt].length&&!this[Bi]&&this.emit("drain")}[BO](e){return this.emit("data",e),this[Xt]}pipe(e,r){if(this[xt])return e;this[sn]=!1;let n=this[gs];return r=r||{},e===qO.stdout||e===qO.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,n?r.end&&e.end():(this[Pr].push(r.proxyErrors?new WT(this,e,r):new Zp(this,e,r)),this[gi]?ll(()=>this[Ra]()):this[Ra]()),e}unpipe(e){let r=this[Pr].find(n=>n.dest===e);r&&(this[Pr].length===1?(this[Xt]&&this[ro]===0&&(this[Xt]=!1),this[Pr]=[]):this[Pr].splice(this[Pr].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[sn]=!1,this[ro]++,!this[Pr].length&&!this[Xt]&&this[Ra]();else if(e==="readable"&&this[Qt]!==0)super.emit("readable");else if(DV(e)&&this[gs])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[ol]){let i=r;this[gi]?ll(()=>i.call(this,this[ol])):i.call(this,this[ol])}return n}removeListener(e,r){return this.off(e,r)}off(e,r){let n=super.off(e,r);return e==="data"&&(this[ro]=this.listeners("data").length,this[ro]===0&&!this[sn]&&!this[Pr].length&&(this[Xt]=!1)),n}removeAllListeners(e){let r=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[ro]=0,!this[sn]&&!this[Pr].length&&(this[Xt]=!1)),r}get emittedEnd(){return this[gs]}[Fi](){!this[Kp]&&!this[gs]&&!this[xt]&&this[Jt].length===0&&this[Bi]&&(this[Kp]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Yp]&&this.emit("close"),this[Kp]=!1)}emit(e,...r){let n=r[0];if(e!=="error"&&e!=="close"&&e!==xt&&this[xt])return!1;if(e==="data")return!this[gr]&&!n?!1:this[gi]?(ll(()=>this[HT](n)),!0):this[HT](n);if(e==="end")return this[FO]();if(e==="close"){if(this[Yp]=!0,!this[gs]&&!this[xt])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[ol]=n,super.emit(UT,n);let s=!this[cl]||this.listeners("error").length?super.emit("error",n):!1;return this[Fi](),s}else if(e==="resume"){let s=super.emit("resume");return this[Fi](),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[Fi](),i}[HT](e){for(let n of this[Pr])n.dest.write(e)===!1&&this.pause();let r=this[sn]?!1:super.emit("data",e);return this[Fi](),r}[FO](){return this[gs]?!1:(this[gs]=!0,this.readable=!1,this[gi]?(ll(()=>this[VT]()),!0):this[VT]())}[VT](){if(this[Na]){let r=this[Na].end();if(r){for(let n of this[Pr])n.dest.write(r);this[sn]||super.emit("data",r)}}for(let r of this[Pr])r.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[gr]||(e.dataLength=0);let r=this.promise();return this.on("data",n=>{e.push(n),this[gr]||(e.dataLength+=n.length)}),await r,e}async concat(){if(this[gr])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Kn]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,r)=>{this.on(xt,()=>r(new Error("stream destroyed"))),this.on("error",n=>r(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[sn]=!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[Bi])return r();let s,o,a=d=>{this.off("data",c),this.off("end",l),this.off(xt,u),r(),o(d)},c=d=>{this.off("error",a),this.off("end",l),this.off(xt,u),this.pause(),s({value:d,done:!!this[Bi]})},l=()=>{this.off("error",a),this.off("data",c),this.off(xt,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(xt,u),this.once("error",a),this.once("end",l),this.once("data",c)})},throw:r,return:r,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[sn]=!1;let e=!1,r=()=>(this.pause(),this.off(UT,r),this.off(xt,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(UT,r),this.once(xt,r),{next:n,throw:r,return:r,[Symbol.iterator](){return this}}}destroy(e){if(this[xt])return e?this.emit("error",e):this.emit(xt),this;this[xt]=!0,this[sn]=!0,this[Jt].length=0,this[Qt]=0;let r=this;return typeof r.close=="function"&&!this[Yp]&&r.close(),e?this.emit("error",e):this.emit(xt),this}static get isStream(){return PV}};var LV=Ti.realpathSync.native,dl={lstatSync:Ti.lstatSync,readdir:Ti.readdir,readdirSync:Ti.readdirSync,readlinkSync:Ti.readlinkSync,realpathSync:LV,promises:{lstat:Ts.lstat,readdir:Ts.readdir,readlink:Ts.readlink,realpath:Ts.realpath}},GO=t=>!t||t===dl||t===xV?dl:{...dl,...t,promises:{...dl.promises,...t.promises||{}}},KO=/^\\\\\?\\([a-z]:)\\?$/i,qV=t=>t.replace(/\//g,"\\").replace(KO,"$1\\"),$V=/[\\\/]/,Nn=0,YO=1,XO=2,yi=4,JO=6,QO=8,no=10,ZO=12,kn=15,ul=~kn,KT=16,UO=32,fl=64,Yn=128,th=256,nh=512,HO=fl|Yn|nh,BV=1023,YT=t=>t.isFile()?QO:t.isDirectory()?yi:t.isSymbolicLink()?no:t.isCharacterDevice()?XO:t.isBlockDevice()?JO:t.isSocket()?ZO:t.isFIFO()?YO:Nn,VO=new Map,pl=t=>{let e=VO.get(t);if(e)return e;let r=t.normalize("NFKD");return VO.set(t,r),r},zO=new Map,rh=t=>{let e=zO.get(t);if(e)return e;let r=pl(t.toLowerCase());return zO.set(t,r),r},ih=class extends sl{constructor(){super({max:256})}},XT=class extends sl{constructor(e=16*1024){super({maxSize:e,sizeCalculation:r=>r.length+1})}},eM=Symbol("PathScurry setAsCwd"),yr=class{name;root;roots;parent;nocase;isCWD=!1;#e;#t;get dev(){return this.#t}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#o;get uid(){return this.#o}#f;get gid(){return this.#f}#a;get rdev(){return this.#a}#d;get blksize(){return this.#d}#c;get ino(){return this.#c}#l;get size(){return this.#l}#s;get blocks(){return this.#s}#y;get atimeMs(){return this.#y}#T;get mtimeMs(){return this.#T}#h;get ctimeMs(){return this.#h}#p;get birthtimeMs(){return this.#p}#k;get atime(){return this.#k}#g;get mtime(){return this.#g}#N;get ctime(){return this.#N}#R;get birthtime(){return this.#R}#b;#S;#_;#m;#C;#P;#i;#I;#v;#D;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,r=Nn,n,i,s,o,a){this.name=e,this.#b=s?rh(e):pl(e),this.#i=r&BV,this.nocase=s,this.roots=i,this.root=n||this,this.#I=o,this.#_=a.fullpath,this.#C=a.relative,this.#P=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=GO(a.fs)}depth(){return this.#S!==void 0?this.#S:this.parent?this.#S=this.parent.depth()+1:this.#S=0}childrenCache(){return this.#I}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.#I.get(this);if(e)return e;let r=Object.assign([],{provisional:0});return this.#I.set(this,r),this.#i&=~KT,r}child(e,r){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let n=this.children(),i=this.nocase?rh(e):pl(e);for(let c of n)if(c.#b===i)return c;let s=this.parent?this.sep:"",o=this.#_?this.#_+s+e:void 0,a=this.newChild(e,Nn,{...r,parent:this,fullpath:o});return this.canReaddir()||(a.#i|=Yn),n.push(a),a}relative(){if(this.isCWD)return"";if(this.#C!==void 0)return this.#C;let e=this.name,r=this.parent;if(!r)return this.#C=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.#P!==void 0)return this.#P;let e=this.name,r=this.parent;if(!r)return this.#P=this.fullpathPosix();let n=r.relativePosix();return n+(!n||!r.parent?"":"/")+e}fullpath(){if(this.#_!==void 0)return this.#_;let e=this.name,r=this.parent;if(!r)return this.#_=this.name;let i=r.fullpath()+(r.parent?this.sep:"")+e;return this.#_=i}fullpathPosix(){if(this.#m!==void 0)return this.#m;if(this.sep==="/")return this.#m=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#m=`//?/${i}`:this.#m=i}let e=this.parent,r=e.fullpathPosix(),n=r+(!r||!e.parent?"":"/")+this.name;return this.#m=n}isUnknown(){return(this.#i&kn)===Nn}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&kn)===QO}isDirectory(){return(this.#i&kn)===yi}isCharacterDevice(){return(this.#i&kn)===XO}isBlockDevice(){return(this.#i&kn)===JO}isFIFO(){return(this.#i&kn)===YO}isSocket(){return(this.#i&kn)===ZO}isSymbolicLink(){return(this.#i&no)===no}lstatCached(){return this.#i&UO?this:void 0}readlinkCached(){return this.#v}realpathCached(){return this.#D}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#v)return!0;if(!this.parent)return!1;let e=this.#i&kn;return!(e!==Nn&&e!==no||this.#i&th||this.#i&Yn)}calledReaddir(){return!!(this.#i&KT)}isENOENT(){return!!(this.#i&Yn)}isNamed(e){return this.nocase?this.#b===rh(e):this.#b===pl(e)}async readlink(){let e=this.#v;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.#v=n}catch(r){this.#u(r.code);return}}readlinkSync(){let e=this.#v;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.#v=n}catch(r){this.#u(r.code);return}}#M(e){this.#i|=KT;for(let r=e.provisional;r<e.length;r++){let n=e[r];n&&n.#x()}}#x(){this.#i&Yn||(this.#i=(this.#i|Yn)&ul,this.#w())}#w(){let e=this.children();e.provisional=0;for(let r of e)r.#x()}#E(){this.#i|=nh,this.#L()}#L(){if(this.#i&fl)return;let e=this.#i;(e&kn)===yi&&(e&=ul),this.#i=e|fl,this.#w()}#q(e=""){e==="ENOTDIR"||e==="EPERM"?this.#L():e==="ENOENT"?this.#x():this.children().provisional=0}#$(e=""){e==="ENOTDIR"?this.parent.#L():e==="ENOENT"&&this.#x()}#u(e=""){let r=this.#i;r|=th,e==="ENOENT"&&(r|=Yn),(e==="EINVAL"||e==="UNKNOWN")&&(r&=ul),this.#i=r,e==="ENOTDIR"&&this.parent&&this.parent.#L()}#B(e,r){return this.#A(e,r)||this.#F(e,r)}#F(e,r){let n=YT(e),i=this.newChild(e.name,n,{parent:this}),s=i.#i&kn;return s!==yi&&s!==no&&s!==Nn&&(i.#i|=fl),r.unshift(i),r.provisional++,i}#A(e,r){for(let n=r.provisional;n<r.length;n++){let i=r[n];if((this.nocase?rh(e.name):pl(e.name))===i.#b)return this.#j(e,i,n,r)}}#j(e,r,n,i){let s=r.name;return r.#i=r.#i&ul|YT(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&Yn)===0)try{return this.#z(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#$(e.code)}}lstatSync(){if((this.#i&Yn)===0)try{return this.#z(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#$(e.code)}}#z(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:T,rdev:b,size:_,uid:v}=e;this.#k=r,this.#y=n,this.#R=i,this.#p=s,this.#d=o,this.#s=a,this.#N=c,this.#h=l,this.#t=u,this.#f=d,this.#c=f,this.#n=p,this.#g=m,this.#T=h,this.#r=T,this.#a=b,this.#l=_,this.#o=v;let N=YT(e);this.#i=this.#i&ul|N|UO,N!==Nn&&N!==yi&&N!==no&&(this.#i|=fl)}#H=[];#V=!1;#W(e){this.#V=!1;let r=this.#H.slice();this.#H.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.#H.push(e),this.#V)return;this.#V=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(s,o)=>{if(s)this.#q(s.code),n.provisional=0;else{for(let a of o)this.#B(a,n);this.#M(n)}this.#W(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.#B(i,e);this.#M(e)}catch(i){this.#q(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.#B(n,e);this.#M(e)}catch(n){this.#q(n.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#i&HO)return!1;let e=kn&this.#i;return e===Nn||e===yi||e===no}shouldWalk(e,r){return(this.#i&yi)===yi&&!(this.#i&HO)&&!e.has(this)&&(!r||r(this))}async realpath(){if(this.#D)return this.#D;if(!((nh|th|Yn)&this.#i))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#D=this.resolve(e)}catch{this.#E()}}realpathSync(){if(this.#D)return this.#D;if(!((nh|th|Yn)&this.#i))try{let e=this.#e.realpathSync(this.fullpath());return this.#D=this.resolve(e)}catch{this.#E()}}[eM](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.#C=n.join(this.sep),i.#P=n.join("/"),i=i.parent,n.push("..");for(i=e;i&&i.parent&&!r.has(i);)i.#C=void 0,i.#P=void 0,i=i.parent}},sh=class t extends yr{sep="\\";splitSep=$V;constructor(e,r=Nn,n,i,s,o,a){super(e,r,n,i,s,o,a)}newChild(e,r=Nn,n={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(e){return Pa.win32.parse(e).root}getRoot(e){if(e=qV(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 wa(e,this).root}sameRoot(e,r=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(KO,"$1\\"),e===r}},oh=class t extends yr{splitSep="/";sep="/";constructor(e,r=Nn,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=Nn,n={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}},ah=class{root;rootPath;roots;cwd;#e;#t;#n;nocase;#r;constructor(e=process.cwd(),r,n,{nocase:i,childrenCacheSize:s=16*1024,fs:o=dl}={}){this.#r=GO(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,WO.fileURLToPath)(e));let a=r.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new ih,this.#t=new ih,this.#n=new XT(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.#r),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.#t.get(r);if(n!==void 0)return n;let i=this.cwd.resolve(r).fullpathPosix();return this.#t.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 yr||(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 yr||(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 yr||(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 yr||(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 yr||(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 yr||(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 yr||(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 T=()=>{--h===0&&f()};for(let b of m)(!s||s(b))&&a.push(n?b:b.fullpath()),i&&b.isSymbolicLink()?b.realpath().then(_=>_?.isUnknown()?_.lstat():_).then(_=>_?.shouldWalk(c,o)?l(_,T):T()):b.shouldWalk(c,o)?l(b,T):T()},!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 yr||(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 yr||(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 yr||(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 yr||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=new ys({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=(T,b,_=!1)=>{if(T)return a.emit("error",T);if(i&&!_){let v=[];for(let N of b)N.isSymbolicLink()&&v.push(N.realpath().then(C=>C?.isUnknown()?C.lstat():C));if(v.length){Promise.all(v).then(()=>m(null,b,!0));return}}for(let v of b)v&&(!s||s(v))&&(a.write(n?v:v.fullpath())||(f=!0));u--;for(let v of b){let N=v.realpathCached()||v;N.shouldWalk(c,o)&&l.push(N)}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 yr||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=new ys({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 T=h;if(h.isSymbolicLink()){if(!(i&&(T=h.realpathSync())))continue;T.isUnknown()&&T.lstatSync()}T.shouldWalk(c,o)&&l.push(T)}}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[eM](r)}},wa=class extends ah{sep="\\";constructor(e=process.cwd(),r={}){let{nocase:n=!0}=r;super(e,Pa.win32,"\\",{...r,nocase:n}),this.nocase=n;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return Pa.win32.parse(e).root.toUpperCase()}newRoot(e){return new sh(this.rootPath,yi,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Ea=class extends ah{sep="/";constructor(e=process.cwd(),r={}){let{nocase:n=!1}=r;super(e,Pa.posix,"/",{...r,nocase:n}),this.nocase=n}parseRootPath(e){return"/"}newRoot(e){return new oh(this.rootPath,yi,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},hl=class extends Ea{constructor(e=process.cwd(),r={}){let{nocase:n=!0}=r;super(e,{...r,nocase:n})}},vNe=process.platform==="win32"?sh:oh,tM=process.platform==="win32"?wa:process.platform==="darwin"?hl:Ea;var FV=t=>t.length>=1,jV=t=>t.length>=1,Ca=class t{#e;#t;#n;length;#r;#o;#f;#a;#d;#c;#l=!0;constructor(e,r,n,i){if(!FV(e))throw new TypeError("empty pattern list");if(!jV(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.#t=r,this.#n=n,this.#r=i,this.#n===0){if(this.isUNC()){let[s,o,a,c,...l]=this.#e,[u,d,f,p,...m]=this.#t;l[0]===""&&(l.shift(),m.shift());let h=[s,o,a,c,""].join("/"),T=[u,d,f,p,""].join("/");this.#e=[h,...l],this.#t=[T,...m],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...o]=this.#e,[a,...c]=this.#t;o[0]===""&&(o.shift(),c.shift());let l=s+"/",u=a+"/";this.#e=[l,...o],this.#t=[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]===nr}isRegExp(){return this.#e[this.#n]instanceof RegExp}globString(){return this.#f=this.#f||(this.#n===0?this.isAbsolute()?this.#t[0]+this.#t.slice(1).join("/"):this.#t.join("/"):this.#t.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new t(this.#e,this.#t,this.#n+1,this.#r),this.#o.#c=this.#c,this.#o.#d=this.#d,this.#o.#a=this.#a,this.#o):this.#o=null}isUNC(){let e=this.#e;return this.#d!==void 0?this.#d:this.#d=this.#r==="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.#a!==void 0?this.#a:this.#a=this.#r==="win32"&&this.#n===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#c!==void 0?this.#c:this.#c=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.#l)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};var UV=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Da=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:r,nocase:n,noext:i,noglobstar:s,platform:o=UV}){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 nn(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 Ca(i,s,0,this.platform),a=new nn(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 JT=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()]))}},QT=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)])}},ZT=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())}},ml=class t{hasWalkedCache;matches=new QT;subwalks=new ZT;patterns;follow;dot;opts;constructor(e,r){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=r?r.copy():new JT}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===nr){(!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===nr?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 HV=(t,e)=>typeof t=="string"?new Da([t],e):Array.isArray(t)?new Da(t,e):t,ch=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#t;#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.#t=HV(n.ignore??[],n),!this.includeChildMatches&&typeof this.#t.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}))}#r(e){return this.seen.has(e)||!!this.#t?.ignored?.(e)}#o(e){return!!this.#t?.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.#r(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.#r(e))return;if(!this.includeChildMatches&&this.#t?.add){let s=`${e.relativePosix()}/**`;this.#t.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 ml(this.opts),n)}walkCB2(e,r,n,i){if(this.#o(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.#r(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.#r(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 ml(this.opts),n)}walkCB2Sync(e,r,n,i){if(this.#o(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.#r(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.#r(a)||this.matchSync(a,c,l);for(let[a,c]of n.subwalks.entries())s++,this.walkCB2Sync(a,c,n.child(),o);o()}},gl=class extends ch{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}},yl=class extends ch{results;constructor(e,r,n){super(e,r,n),this.results=new ys({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 VV=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Xn=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,rM.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||VV,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"?wa:r.platform==="darwin"?hl:r.platform?Ea:tM;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 nn(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 Ca(c,u,0,this.platform)})}async walk(){return[...await new gl(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 gl(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 yl(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 yl(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 ev=(t,e={})=>{Array.isArray(t)||(t=[t]);for(let r of t)if(new nn(r,e).hasMagic())return!0;return!1};function lh(t,e={}){return new Xn(t,e).streamSync()}function iM(t,e={}){return new Xn(t,e).stream()}function sM(t,e={}){return new Xn(t,e).walkSync()}async function nM(t,e={}){return new Xn(t,e).walk()}function uh(t,e={}){return new Xn(t,e).iterateSync()}function oM(t,e={}){return new Xn(t,e).iterate()}var zV=lh,WV=Object.assign(iM,{sync:lh}),GV=uh,KV=Object.assign(oM,{sync:uh}),YV=Object.assign(sM,{stream:lh,iterate:uh}),io=Object.assign(nM,{glob:nM,globSync:sM,sync:YV,globStream:iM,stream:WV,globStreamSync:lh,streamSync:zV,globIterate:oM,iterate:KV,globIterateSync:uh,iterateSync:GV,Glob:Xn,hasMagic:ev,escape:Sa,unescape:Gn});io.glob=io;var q_=$(xb()),J$=$(K$());var M_={};HB(M_,{$id:()=>UJ,$schema:()=>jJ,default:()=>GJ,definitions:()=>VJ,properties:()=>WJ,title:()=>HJ,type:()=>zJ});var jJ="http://json-schema.org/draft-07/schema#",UJ="http://json-schema.org/draft-07/schema#",HJ="Core schema meta-schema",VJ={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:[]}},zJ=["object","boolean"],WJ={$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:"#"}},GJ={$schema:jJ,$id:UJ,title:HJ,definitions:VJ,type:zJ,properties:WJ,default:!0};var on=$(j());var Um=class extends Dc{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.definitions,...n.referencedBy].forEach(a=>i.push(B(21,a.firstToken,a.lastToken,a,{severity:on.DiagnosticSeverity.Hint,linkedTo:[...o?.ast?[o?.ast]:[]],tags:[on.DiagnosticTag.Unnecessary]}))),i}let s=X.toJson(n);try{this.validate?(this.validate(s),this.validate.errors&&(this.validate.errors.forEach(o=>i.push(...KJ(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:on.MarkupKind.Markdown,value:[...n.description?["### Description",Array.isArray(n.description)?n.description.join(`
|
|
302
302
|
|
|
303
303
|
`):n.description]:[]].join(`
|
|
304
|
-
`)}}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:
|
|
305
|
-
${"".padEnd(
|
|
304
|
+
`)}}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:on.CompletionItemKind.Property,sortText:`${c}${s}`}})??[]}},KJ=(t,e,r,n)=>{let i=YJ(r,e.instancePath),s=i.node;if(e.keyword==="additionalProperties"){let a=s.getProperty(e.params.additionalProperty);return a?[B(25,a.ast.firstToken,a.ast.lastToken,a.ast,{templateStrings:[`Node "${s.name}" ${e.message}: ${a.name}`],edit:on.TextEdit.del(Jr(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?[B(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=ta(c);return c.map((u,d)=>{let f=l[d],p=u.openScope??f.lastToken;return B(0,f.firstToken,f.lastToken,f,{templateStrings:[a],edit:on.TextEdit.insert(on.Position.create(p.pos.line,p.pos.col+1),`
|
|
305
|
+
${"".padEnd(Js(f.uri,u),t.context.formattingOptions.insertSpaces?" ".repeat(t.context.formattingOptions.tabSize):" ")}${a};`)})})}else if(e.keyword==="const"){let a=i.property;return a?[B(25,a.ast.firstToken,a.ast.lastToken,a.ast,{templateStrings:[`Property "${a.name}" ${e.message}: ${e.params.allowedValue}`]})]:[]}else if(e.keyword==="enum"){let a=i.property;return a?[B(25,a.ast.firstToken,a.ast.lastToken,a.ast,{templateStrings:[`Property "${a.name}" ${e.message}:
|
|
306
306
|
${e.params.allowedValues.join(`
|
|
307
307
|
`)}
|
|
308
308
|
${n}`]})]:[]}else if(e.keyword==="maxItems"||e.keyword==="minItems"){let a=s.getProperty(e.instancePath.split("/").at(-1)??"");return a?[B(25,a.ast.firstToken,a.ast.lastToken,a.ast,{templateStrings:[`Property "${a.name}" ${e.message}`]})]:[]}if(i.property)return[B(25,i.property.ast.firstToken,i.property.ast.lastToken,i.property.ast,{templateStrings:[`${e.message??"NO MESSAGE"}:
|
|
309
309
|
${JSON.stringify(e)}
|
|
310
310
|
${n}`]})];let o=i.node.definitions[0]instanceof It?i.node.definitions[0]:i.node.definitions[0].name??i.node.definitions[0];return[B(25,o.firstToken,o.lastToken,o,{templateStrings:[`${e.message??"NO MESSAGE"}:
|
|
311
311
|
${JSON.stringify(e)}
|
|
312
|
-
${n}`]})]},GJ=(t,e)=>W$(t,e.split("/").filter(r=>r)),W$=(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?W$(s,e.slice(1)):{node:t,property:t.getProperty(e[0]),remainingInstancePath:e.slice(1).join("/")}};var O_=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){eo.sync("**/*.yaml",{cwd:e}).forEach(i=>{i=(0,D_.resolve)(e,i);try{let s=I_.default.parse((0,A_.readFileSync)(i,"utf-8"));r.addMetaSchema(s),this.schemaIdValidators.set(s.$id,i)}catch{}})}parseBindings(e,r){eo.sync("**/*.yaml",{cwd:e}).forEach(i=>{i=(0,D_.resolve)(e,i);try{let s=I_.default.parse((0,A_.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 K$.default({strict:!1,strictSchema:!1,strictNumbers:!1}),s.addMetaSchema(C_),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=>f.endsWith(`/${c}.yaml#`));if(!l)return;let u=new xm(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())}},G$,M_=()=>(G$??=new O_,G$);var _u=require("path"),tB=require("fs"),rB=$(require("path")),nB=$(Db());var En=$(U());var Y$=()=>{let t=new X("nonposted-mmio",z("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 X$(){let t=fr();t.noMismatchPropertiesAllowed=!0;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(Y$()),t}var J$=t=>{switch(t){case"string":return z("STRING");case"int":return z("U32");case"boolean":return z("EMPTY");case"array":return z("PROP_ENCODED_ARRAY");case"uint8-array":return z("BYTESTRING");case"string-array":return z("STRINGLIST");case"phandle":return z("U32");case"phandles":return z("PROP_ENCODED_ARRAY");case"phandle-array":return z("PROP_ENCODED_ARRAY");case"path":return z(["STRING","U32"]);case"compound":return z("ANY");default:return z("ANY")}},Q$=(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}},Lm=(t,e)=>{if(e.extends??=[],e=e.include.reduce((r,n)=>{let i=t.find(s=>(0,_u.basename)(s.filePath)===n.name);if(i){let s=n["property-blocklist"],o=n["property-allowlist"];return e.extends?.push(...r.include.map(a=>(0,_u.basename)(a.name,".yaml"))),r.include=r.include.filter(a=>a!==n),iB(t,i,r,s,o)??r}return console.warn(`Unable to find ${n.name}`),r},e),e["child-binding"]&&(e["child-binding"].include=sB(e["child-binding"].include),e["child-binding"]=Lm(t,e["child-binding"])),!e.include.length)return e},iB=(t,e,r,n=[],i)=>{let s=Lm(t,e),o=Lm(t,r);if(!s||!o)return;let a=new Set;Object.keys(s?.properties??{}).forEach(f=>a.add(f)),Object.keys(o?.properties??{}).forEach(f=>a.add(f));let c={};Array.from(a).forEach(f=>{let p=n?.some(h=>h===f)||i&&!i.some(h=>h===f)?void 0:s.properties?.[f]??void 0,m=o.properties?.[f]??void 0;(p||m)&&(c={...c,[f]:{...p??{},...m}})}),o.properties=c,o.extends??=[],o.extends.push(...s.extends??[]);let l=new Set;return Object.keys(s).filter(f=>f.endsWith("-cells")).forEach(f=>l.add(f)),Object.keys(s).filter(f=>f.endsWith("-cells")).forEach(f=>l.add(f)),Array.from(l).forEach(f=>{let p=s[f]??[],m=o[f]??[];o[f]=Array.from([...p,...m])}),o["on-bus"]??=s["on-bus"],o.bus?o.bus.push(...s.bus??[]):o.bus=s.bus,s["child-binding"]&&iB(t,s["child-binding"],o["child-binding"]??{filePath:o.filePath,include:[],rawInclude:[]}),o},sB=t=>t?typeof t=="string"?[{name:t}]:t.map(e=>typeof e!="string"?e:{name:e}):[],x_=class t{constructor(){this.typeCache=new Map;this.processedFolders=new Set;this.zephyrBindingCache=new Map}static getCompatibleKeys(e,r){return!r||!r.nodeType?.bus?.length?[e]:[...r.nodeType.bus.map(n=>`${e}::${n}`),e]}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);if(!n?.length){if(e.name==="zephyr,user"){let a=r.split(":"),l=Array.from(this.zephyrBindingCache.keys()).filter(d=>a.some(f=>d.startsWith(f))).flatMap(d=>this.zephyrBindingCache.get(d)).find(d=>d.filePath.endsWith("/base.yaml")),u=l?L_(l,e):void 0;if(u){u.warnMismatchProperties=!1;let d=u.properties.find(f=>f.name==="compatible");d&&(d.required=()=>"optional")}return{type:[u??cs(e)],issues:[]}}return{type:[cs(e)],issues:[]}}let i=n.flatMap(a=>t.getCompatibleKeys(a.name,e.parent).map(c=>this.typeCache.get(r)?.get(c)?.(e)).filter(c=>!!c)),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 B(37,a.ast.firstToken,a.ast.lastToken,a.ast,{templateStrings:l})}return c?[]:[B(32,a.ast.firstToken,a.ast.lastToken,a.ast,{severity:En.DiagnosticSeverity.Hint,tags:[En.DiagnosticTag.Unnecessary],templateStrings:[a.name]})]});return{type:i.length?i:[cs(e)],issues:o}}loadTypeAndCache(e,r){e=Array.isArray(e)?e:[e];let n=e.filter(o=>this.processedFolders.has(o)).flatMap(o=>Array.from(this.zephyrBindingCache.entries()).flatMap(([a,c])=>a.startsWith(o)?[c]:[]));n.push(...e.filter(o=>!this.processedFolders.has(o)).flatMap(o=>(this.processedFolders.add(o),eo.sync("**/*.yaml",{cwd:o,ignore:"test/*"}).map(c=>{if(c=(0,_u.resolve)(o,c),this.zephyrBindingCache.has(c))return this.zephyrBindingCache.get(c);try{let l=nB.default.parse((0,tB.readFileSync)(c,"utf-8")),u=sB(l?.include),d={...l,bus:l.bus?Array.isArray(l.bus)?l.bus:[l.bus]:void 0,include:u,rawInclude:[...u],filePath:c};return this.zephyrBindingCache.set(c,d),d}catch(l){console.warn(l)}}).filter(c=>!!c))));let i=n.map(o=>Lm(n,o)).filter(o=>!!o&&!o.include.length),s=this.typeCache.get(r);s||(s=new Map,s.set("simple-bus",()=>X$()),this.typeCache.set(r,s)),KJ(i,s)}getBindings(e){return Array.from(this.typeCache.get(e)?.keys()??[]).map(r=>r.split("::",1)[0])}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(Pe(e.uri));if(!n)return[];let i=e.getText();return n.rawInclude.map(o=>{let c=new RegExp(o.name).exec(i);if(c){let l=e.positionAt(c.index),u=e.positionAt(c.index+c[0].length),d=Array.from(this.zephyrBindingCache.keys()).find(f=>f.endsWith(`${rB.default.sep}${o.name}`)&&r.some(p=>f.startsWith(p)));return d?{range:En.Range.create(l,u),target:ue(d)}:void 0}}).filter(o=>!!o)}},Z$,Qa=()=>(Z$??=new x_,Z$),KJ=(t,e)=>t.forEach(r=>{r.compatible&&e.set(r["on-bus"]?`${r.compatible}::${r["on-bus"]}`:r.compatible,n=>L_(r,n))}),L_=(t,e)=>{let r=cs(e);r.compatible=t.compatible,r.description=t.description,r.bindingsPath=t.filePath,r.bus=typeof t.bus=="string"?[t.bus]:Array.from(new Set(t.bus)),r.onBus=t["on-bus"],t.extends?.forEach(s=>r.extends.add(s)),r.warnMismatchProperties=!0;let i=Object.keys(t).filter(s=>s.endsWith("-cells")).map(s=>({specifier:s.replace(/-cells$/,""),values:t[s]}));if(r.cellsValues=i,Object.keys(t.properties??{}).forEach(s=>{let o=t.properties[s];YJ(r,s,o)}),t["child-binding"]){let s=t["child-binding"];r.childNodeType=o=>L_(s,o)}return r},YJ=(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=Q$(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:J$(r.type);i??=J$(r.type);let s=new X(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=Q$(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 l=i.ast.quickValues;if(l?.length==1){let u=Array.isArray(n.const)?n.const:[n.const];if(!(Array.isArray(l[0])&&u.length===l[0].length&&l[0].every((f,p)=>typeof f=="number"&&Number.isNaN(f)||u[p]===f))){let f=i.ast.values??i.ast;a.push(B(24,f.firstToken,f.lastToken,f,{templateStrings:[`Binding expects values to be "${n.type}" with value: ${n.const}`]}))}}}if(n.deprecated&&a.push(B(14,i.ast.firstToken,i.ast.lastToken,i.ast,{severity:En.DiagnosticSeverity.Warning,tags:[En.DiagnosticTag.Deprecated],templateStrings:[i.name]})),(n.type==="phandle"||n.type==="phandles"||n.type==="path")&&Le(i.ast.values)?.forEach(u=>{gn(u,o)||a.push(B(22,u.firstToken,u.lastToken,u))}),n.type==="path"&&i.ast.values?.values.at(0)?.value instanceof ne){let l=i.ast.values?.values.at(0)?.value,u=[];l.value.split("/").every(d=>{let f=o.getNode(d);return f?u.push(d):a.push(B(23,l.firstToken,l.lastToken,l,{templateStrings:[d,`/${u.join("/")}`]})),!f})}let c=i.name.match(/^(.*)-(\d+)$/);if(n.type==="phandles"&&c){let l="";e.endsWith("-gpios")?l="gpio":l=n["specifier-space"]??c[1];let u=Number.parseInt(c[2],10),d=i.parent.getProperty(`${l}-names`);d&&(d.ast.quickValues?.at(u)||a.push(B(33,i.ast.firstToken,i.ast.lastToken,i.ast,{severity:En.DiagnosticSeverity.Warning,linkedTo:[d.ast],templateStrings:[i.name,u.toString()]})))}if(n.type==="phandle-array"){let l=Le(i.ast.values),u=0,d=[],f=0;for(;l&&u<l.length;){let p=l.at(u),m=gn(p,o);if(!m){let M=p??i.ast;a.push(B(22,M.firstToken,M.lastToken,M));break}let h="";e.endsWith("-gpios")?h="gpio":h=n["specifier-space"]??e.slice(0,-1);let T=m.getProperty(`#${h}-cells`);if(!T){a.push(B(16,i.ast.firstToken,i.ast.lastToken,i.ast,{linkedTo:[...m.nodeNameOrLabelRef],templateStrings:[i.name,`#${h}-cells`,`/${m.path.slice(1).join("/")}`]}));break}let b=T?Be(T,0,0,s)??0:0,S=m.nodeType?.cellsValues?.find(M=>M.specifier===h)?.values;if(d.push([`${f}_phandle`,...S?.map(M=>`${f}_${M}`)??[],...Array.from({length:b-(S?.length??0)},(M,F)=>`${f}_cell${b-(S?.length??0)?F:""}`)]),1+b>l.length-u){let M=p??i.ast;a.push(B(19,M.firstToken,M.lastToken,M,{templateStrings:[i.name,`<${d.at(-1).join(" ")}>`]}));break}u+=1+b;let v=l.slice(u-b,u),N={mappingValuesAst:v,specifierSpace:h,target:m};i.nexusMapsTo.push(N);let C=m.getProperty(`${h}-map`);if(C){let M=m.getNexusMapEntryMatch(h,s,v);M?.match?N.mapItem=M.match:a.push(B(31,M.entry.firstToken,M.entry.lastToken,M.entry,{linkedTo:[C.ast]}))}v.every(M=>M instanceof Se)&&m.spesifierNexusMapping.push({expressions:v,node:i.parent,property:i});let H=i.parent.getProperty(`${h}-names`);p&&H&&(H.ast.quickValues?.at(f)||a.push(B(33,p.firstToken,l[u-1]?.lastToken,i.ast,{severity:En.DiagnosticSeverity.Warning,linkedTo:[H.ast],templateStrings:[i.name,f.toString()]}))),f++}d.push([`${f}_phandle`,`${f}_cell...`]),r.signatureArgs=d.map(p=>p.map(m=>En.ParameterInformation.create(m)))}return a}};var oB=(t,e)=>{let r=t.zephyrBindings.join(":");return e==="Zephyr"&&Qa().loadTypeAndCache(t.zephyrBindings,r),{files:t,type:e,getNodeTypes:n=>{switch(e){case"Zephyr":return Qa().getNodeTypes(n,r);case"DevicetreeOrg":return{type:M_().getNodeTypes(t.deviceOrgBindingsMetaSchema,t.deviceOrgTreeBindings,n),issues:[]}}},getBindings:()=>{switch(e){case"Zephyr":return Qa().getBindings(r);case"DevicetreeOrg":return M_().getBindings()}},getBusTypes:()=>{switch(e){case"Zephyr":return Qa().getBusTypes();case"DevicetreeOrg":return[]}},getDocumentLinks(n){if(!n)return[];switch(e){case"Zephyr":return Qa().getDocumentLinks(n,t.zephyrBindings);case"DevicetreeOrg":return[]}}}};var qm=$(U());var XJ=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:qm.FoldingRangeKind.Comment}],q_=t=>!t.openScope||!t.closeScope?.prevToken?t.nodes.flatMap(q_):[{startLine:t.openScope.pos.line,startCharacter:t.openScope.pos.col,endLine:t.closeScope.prevToken.pos.line,endCharacter:t.closeScope.prevToken.pos.col,kind:qm.FoldingRangeKind.Region},...t.nodes.flatMap(q_)],aB=t=>{let e=[];return[...t instanceof jn?t.ifBlocks.map(r=>({start:(r.expression??r.keyword).lastToken,end:r.content?.lastToken??(r.expression??r.keyword).lastToken})):[{start:(t.ifDef.identifier??t.ifDef.keyword).lastToken,end:t.ifDef.content?.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:qm.FoldingRangeKind.Region})}),e},JJ=t=>t instanceof Je?q_(t):t instanceof ci||t instanceof jn?aB(t):t instanceof hn?XJ(t):[];function cB(t,e){return e.allAstItems.flatMap(r=>[r,...r.allDescendants]).filter(r=>pe(r.uri,t)).flatMap(JJ)}var So=$(U());function QJ(t){if(!t||!(t.ast instanceof xe)&&!(t.ast instanceof tr))return[];let e=r=>r.nodeType?.bindingsPath?[So.Location.create(ue(r.nodeType.bindingsPath),So.Range.create(So.Position.create(0,0),So.Position.create(0,0)))]:[];return t.item instanceof J&&!Vt(t.ast)?e(t.item):t.ast instanceof tr&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo?e(t.ast.parentNode.linksTo):t.ast instanceof xe&&t.ast.linksTo?e(t.ast.linksTo):[]}async function lB(t,e){return Nt(t,e,r=>[...QJ(r)])}var Bm=require("fs");var ZJ=(t,e)=>{Yr().reset(t),Yr().requestTokens(t,!0),e(t)},$m=class{constructor(e,r,n){this.file=e;this.cb=r;this.hasDocumentOpen=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(this.hasDocumentOpen(e)){console.log("skipping on change document is open",e);return}console.log("onChange",e),ZJ(e,r)},(0,Bm.watchFile)(e,this.onChange)}}unwatch(){this.count===1&&(console.log("dispose watch for",this.file),(0,Bm.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 Qt=$(require("path")),$_=require("fs");var Zn=t=>{if(t)return Array.isArray(t)?t:[t]},e6=t=>({...t,deviceOrgBindingsMetaSchema:Zn(t.deviceOrgBindingsMetaSchema),deviceOrgTreeBindings:Zn(t.deviceOrgTreeBindings),includePaths:Zn(t.includePaths),lockRenameEdits:Zn(t.lockRenameEdits),zephyrBindings:Zn(t.zephyrBindings),overlays:Zn(t.overlays)}),uB=t=>({...t,defaultDeviceOrgBindingsMetaSchema:Zn(t.defaultDeviceOrgBindingsMetaSchema),defaultDeviceOrgTreeBindings:Zn(t.defaultDeviceOrgTreeBindings),defaultIncludePaths:Zn(t.defaultIncludePaths),defaultLockRenameEdits:Zn(t.defaultLockRenameEdits),defaultZephyrBindings:Zn(t.defaultZephyrBindings),contexts:t.contexts?.map(e6)}),Cn=async(t,e=[],r)=>{let n=r?e.map(s=>Pe(s.uri)).find(s=>Mw(s,r)):void 0;return[...e.at(0)?[{replace:"${workspaceFolder}",uri:n??Pe(e[0].uri)}]:[],...e.map(s=>({replace:`\${workspaceFolder:${s.name}}`,uri:Pe(s.uri)}))].forEach(s=>t=t.replaceAll(s.replace,s.uri)),t},Ms={defaultBindingType:"Zephyr",defaultZephyrBindings:[],defaultIncludePaths:[],defaultDeviceOrgBindingsMetaSchema:[],defaultDeviceOrgTreeBindings:[],contexts:[],defaultLockRenameEdits:[],allowAdhocContexts:!0,autoChangeContext:!0,defaultShowFormattingErrorAsDiagnostics:!0},B_=async(t,e,r)=>{let n=await Cn(t.cwd??"${workspaceFolder}",r,t.dtsFile)??e.cwd,i=await Promise.all((t.includePaths??e.defaultIncludePaths).map(p=>Cn(p,r,t.dtsFile))),s=await Promise.all((t.zephyrBindings??e.defaultZephyrBindings).map(p=>Cn(p,r,t.dtsFile))),o=t.bindingType??e.defaultBindingType,a=await Promise.all((t.deviceOrgTreeBindings??e.defaultDeviceOrgTreeBindings).map(p=>Cn(p,r,t.dtsFile))),c=await Promise.all((t.deviceOrgBindingsMetaSchema??e.defaultDeviceOrgBindingsMetaSchema).map(p=>Cn(p,r,t.dtsFile))),l=await Promise.all((t.lockRenameEdits??e.defaultLockRenameEdits).map(p=>Cn(p,r,t.dtsFile)));n&&o==="Zephyr"&&(!s||s.length===0)&&(s=["./zephyr/dts/bindings"]);let u=t.dtsFile,d=t.overlays??[],f=t.compileCommands;return n&&(s=s.map(p=>(0,Qt.resolve)(n,p)).filter(p=>(0,$_.existsSync)(p)),a=a?.map(p=>(0,Qt.resolve)(n,p)),c=c.map(p=>(0,Qt.resolve)(n,p)),i=i.map(p=>(0,Qt.resolve)(n,p)),u=(0,Qt.resolve)(n,u),d=d.map(p=>(0,Qt.resolve)(n,p)),l=l.map(p=>(0,Qt.resolve)(n,p)),f=f?(0,Qt.resolve)(n,f):void 0),{ctxName:t.ctxName??(0,Qt.basename)(u),cwd:n?it(n):void 0,includePaths:i.map(it),zephyrBindings:s.map(it),bindingType:o,deviceOrgTreeBindings:a.map(it),deviceOrgBindingsMetaSchema:c.map(it),dtsFile:it(u),overlays:d.map(it),lockRenameEdits:l.map(it),compileCommands:f?it(f):void 0,showFormattingErrorAsDiagnostics:t.showFormattingErrorAsDiagnostics??e.defaultShowFormattingErrorAsDiagnostics}},ku=async(t,e)=>{let r=t.cwd?await Cn(t.cwd,e):void 0,n=t.defaultBindingType,i=t.defaultDeviceOrgBindingsMetaSchema=await Promise.all((t.defaultDeviceOrgBindingsMetaSchema??[]).map(d=>Cn(d,e))),s=t.defaultDeviceOrgTreeBindings=await Promise.all((t.defaultDeviceOrgTreeBindings??[]).map(d=>Cn(d,e))),o=t.defaultIncludePaths=await Promise.all((t.defaultIncludePaths??[]).map(d=>Cn(d,e))),a=t.defaultZephyrBindings=await Promise.all((t.defaultZephyrBindings??[]).map(d=>Cn(d,e))),c=t.defaultLockRenameEdits=await Promise.all((t.defaultLockRenameEdits??[]).map(d=>Cn(d,e)));r&&(o=t.defaultIncludePaths=(t.defaultIncludePaths??[]).map(d=>(0,Qt.resolve)(r,d)),n==="Zephyr"&&!t.defaultZephyrBindings&&(a=["./zephyr/dts/bindings"]),a=a.map(d=>(0,Qt.resolve)(r,d)),i=i.map(d=>(0,Qt.resolve)(r,d)),s=(t.defaultDeviceOrgTreeBindings??[]).map(d=>(0,Qt.resolve)(r,d)),c=c.map(d=>(0,Qt.resolve)(r,d)));let l={cwd:r,defaultDeviceOrgBindingsMetaSchema:i,defaultDeviceOrgTreeBindings:s,defaultIncludePaths:o,defaultZephyrBindings:a,defaultLockRenameEdits:c,defaultBindingType:n,autoChangeContext:t.autoChangeContext??Ms.autoChangeContext,allowAdhocContexts:t.allowAdhocContexts??Ms.allowAdhocContexts,defaultShowFormattingErrorAsDiagnostics:t.defaultShowFormattingErrorAsDiagnostics??Ms.defaultShowFormattingErrorAsDiagnostics},u=(await Promise.all(t.contexts?.map(d=>B_(d,l,e))??[])).filter(d=>[d.dtsFile,...d.overlays].every(f=>(0,$_.existsSync)(f)&&Qt.default.isAbsolute(f)));return{...l,contexts:u}};var dB=t=>`DT_PROP(${F_(t.parent)}, ${t.name.replaceAll("-","_")}))`,fB=t=>t.parent.labels.map(e=>`DT_PROP(DT_NODELABEL(${e.label.toString()}), ${t.name.replaceAll("-","_")})`);var F_=t=>`DT_PATH(${t.path.slice(1).map(e=>e.replace("@","_").replaceAll("-","_")).join(",")})`,pB=t=>t.labels.map(e=>`DT_NODELABEL(${e.label.toString()})`),hB=t=>{let e=[];return li.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 st&&s.path?.pathParts.at(-1)?.linksTo===t)return!0})?.forEach(i=>e.push(`DT_ALIAS(${i.name.replaceAll("-","_")})`)),e};function t6(t,e){if(!t||!(t.item instanceof Qe)||!(t.ast instanceof tt))return[];let r=[];return e.settings.bindingType==="Zephyr"&&(r.push({type:"dt_zephyr_macro_prop_node_path",data:dB(t.item)}),fB(t.item).forEach(n=>{r.push({type:"dt_zephyr_macro_prop_node_label",data:n})})),r}function r6(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 xe&&t.ast.linksTo&&(r=t.ast.linksTo),!r)return[];let n=[{type:"path",data:r.pathString}];return e.settings.bindingType==="Zephyr"&&(pB(r).forEach(i=>{n.push({type:"dt_zephyr_macro_node_label",data:i})}),n.push({type:"dt_zephyr_macro_node_path",data:F_(r)}),hB(r).forEach(i=>{n.push({type:"dt_zephyr_macro_prop_node_alias",data:i})})),n}async function mB(t,e){return e?Nt(t,e,r=>[...r6(r,e),...t6(r,e)]):[]}var gB=$(U());function n6(t){return!t||!(t.item instanceof Qe)?void 0:t.item.parent.nodeType?.getSignatureHelp?.(t.item,t.ast,t.beforeAst,t.afterAst)}async function i6(t){let e=Rc(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 oi))return;let i=n.params.map(o=>({label:o instanceof ft?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:[gB.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 yB(t,e){if(e)return(await Nt(t,e,async r=>[await i6(r)||n6(r)])).at(0)}var TB=require("timers"),vB=require("events");var j_=class extends vB.EventEmitter{constructor(e=3e3,r=1e3){super(),this.thresholdBytes=e*1024*1024,this.interval=(0,TB.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)}},s6=new j_(3e3),bB=()=>{s6.on("thresholdExceeded",({usedMb:t,thresholdMb:e})=>{console.warn(`[HeapMonitor] Heap usage exceeded ${e}MB: ${t}MB used`),tE(),eE()})};var He=[],ce,ec,Fm=new WeakMap,Nu=new Map;bB();var _B=t=>{t.getContextFiles().forEach(e=>{Nu.has(e)||Nu.set(e,new $m(e,G_,r=>!!Du(r))),Nu.get(e)?.watch()})},z_=async t=>{let e=He.indexOf(t);if(e===-1)return;Pu(t,void 0,!0),Fm.delete(t),console.log(`(ID: ${t.id}) cleaning Context for [${t.ctxNames.join(",")}]`);let r=await Ls(t);if(te.sendNotification("devicetree/contextDeleted",{ctxNames:t.ctxNames.map(n=>n.toString()),id:t.id,...await t.getFileTree(),settings:t.settings,active:ce===t,type:r.type}),He.splice(e,1),await X_(),t===ce&&(ce=void 0,He.length)){let n=ec?fn(He,{uri:ec}):void 0;n??=He[0],console.log("Active context was deleted. Forcing active to",n.id),await or({id:n.id},!0)}t.getContextFiles().map(n=>Nu.get(n)?.unwatch())},o6=t=>{let e=Fm.get(t);if(!e?.abort.signal.aborted)return Promise.all([e?.promise,t.getRuntime()])},Ve=async()=>{await Promise.all(He.map(o6))},W_=async t=>(await kB()).indexOf(t)!==-1,kB=async()=>{let t=await NB();return He.filter(e=>!t.some(r=>r===e))},NB=async()=>{let t=await V_();return He.filter(e=>t.contexts.find(r=>Ci(r)===e.id))},a6=async()=>{let t=await p6();return He.filter(e=>t.contexts.find(r=>Ci(r)===e.id))},c6=async t=>(await a6()).indexOf(t)!==-1,l6=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=>pe(i.resolvedPath,t.parser.uri))&&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=>pe(i,t.parser.uri))},u6=async t=>{if(!await W_(t))return;let e=await kB(),r=await NB(),n=await vf(e);if(He.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 l6(a.context,c)})))),s=t.getContextFiles(),o=n.filter(a=>i.some(c=>c.context===a.context&&c.same)||a.context!==t&&pe(a.context.parser.uri,t.parser.uri)&&s.some(c=>c&&a.files.indexOf(c)!==-1)).map(a=>a.context);o.length&&await Promise.all(o.map(z_))},te=(0,We.createConnection)(We.ProposedFeatures.all),vr=new We.TextDocuments(qn),RB=!1,jm=!1,PB=!1,wB=!1,EB=!1,U_;te.onInitialize(async t=>{U_=t.workspaceFolders??[],te.console.log(`[Server(${process.pid}) ${U_?.at(0)?.uri} Version 0.7.3 ] Started and initialize received`);let e=t.capabilities;RB=!!(e.workspace&&e.workspace.configuration),jm=!!(e.workspace&&e.workspace.workspaceFolders),PB=!!e.workspace?.diagnostics?.refreshSupport,wB=!!e.workspace?.semanticTokens?.refreshSupport,EB=!!e.workspace?.foldingRange?.refreshSupport;let r={capabilities:{typeDefinitionProvider:!0,workspaceSymbolProvider:!0,textDocumentSync:We.TextDocumentSyncKind.Incremental,renameProvider:{prepareProvider:!0},completionProvider:{resolveProvider:!0,triggerCharacters:["&","="," ",'"',"(",","]},codeActionProvider:{codeActionKinds:[We.CodeActionKind.QuickFix,We.CodeActionKind.SourceFixAll]},documentSymbolProvider:!0,semanticTokensProvider:{legend:{tokenTypes:ff,tokenModifiers:pf},full:!0},documentLinkProvider:{resolveProvider:!1},foldingRangeProvider:!0,definitionProvider:!0,declarationProvider:!0,referencesProvider:!0,documentFormattingProvider:!0,documentRangeFormattingProvider:!0,hoverProvider:!0,signatureHelpProvider:{triggerCharacters:["<","("],retriggerCharacters:[" ",","]}}};return jm&&(r.capabilities.workspace={workspaceFolders:{changeNotifications:!0,supported:!0}}),await IB(t.initializationOptions),r});var H_,d6={tabSize:8,insertSpaces:!1,trimTrailingWhitespace:!0,insertFinalNewline:!0,wordWrapColumn:100};te.onInitialized(async()=>{if(RB&&(te.client.register(We.DidChangeConfigurationNotification.type,{}),!H_)){let t=await te.workspace.getConfiguration("editor").catch(()=>{}),e=await te.workspace.getConfiguration("[devicetree]").catch(()=>{}),r={tabSize:e?.["editor.tabSize"],insertSpaces:e?.["editor.insertSpaces"],trimFinalNewlines:e?.["editor.trimFinalNewlines"],trimTrailingWhitespace:e?.["editor.trimTrailingWhitespace"],insertFinalNewline:e?.["editor.insertFinalNewline"],wordWrapColumn:e?.["editor.wordWrapColumn"]};(t||r)&&(H_={...t,...r})}jm&&te.workspace.onDidChangeWorkspaceFolders(async t=>{te.console.log("Workspace folder change event received"),await Cu()})});te.onRequest("workspace/workspaceFolders",async()=>U_??null);var f6=async()=>{let t=CB();return t={...Ms,...t},ku(t,await Eu())},V_=async()=>{let t=m6();return t={...Ms,...t},ku(t,await Eu())},p6=async()=>{let t=g6();return t={...Ms,...t},ku(t,await Eu())},wu=async()=>{let t=h6();return t={...Ms,...t},ku(t,await Eu())},Eu=async()=>jm?await te.workspace.getWorkspaceFolders()??[]:[],SB=async t=>{let e=fn(He,{id:Ci(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=Ci(t);console.log(`(ID: ${r}) New context [${t.ctxName}]`),console.log(`(ID: ${r}) Settings: ${JSON.stringify(t,void 0," ")}`);let n=(0,tc.join)((0,tc.dirname)(t.dtsFile),"dts","bindings"),i=new Xf(t,H_??d6,t.bindingType?oB({zephyrBindings:t.zephyrBindings?[n,...t.zephyrBindings]:[n],deviceOrgBindingsMetaSchema:t.deviceOrgBindingsMetaSchema??[],deviceOrgTreeBindings:t.deviceOrgTreeBindings??[]},t.bindingType):void 0);He.push(i),await i.stable(),_B(i);let s=await Ls(i);return te.sendNotification("devicetree/contextCreated",{ctxNames:i.ctxNames.map(o=>o.toString()),id:i.id,...await i.getFileTree(),settings:i.settings,active:i===ce,type:s.type}),await u6(i),await X_(),i},Cu=async()=>{let t=await V_(),e=await wu();e.allowAdhocContexts||(e=await V_());let r=e.contexts.map(Ci),n=He.filter(i=>!r.includes(i.id));await Promise.all(n.map(z_)),await t.contexts?.reduce((i,s)=>i.then(async()=>{await SB(s)}),Promise.resolve()),e.allowAdhocContexts&&await(await f6()).contexts?.reduce((s,o)=>s.then(async()=>{fn(He,{uri:o.dtsFile})||await SB(o)}),Promise.resolve()),ec?await or({uri:ec}):!ce&&He.length&&(console.log(`No active context using first context (ID: ${He[0].id}) [${He[0].ctxNames.join(",")}]`),await or({id:He[0].id}))},Dn,xs,Ru=new Map,Za=new Map,h6=()=>!xs&&!Dn?void 0:{...xs,...Dn,contexts:[...Dn?.contexts??[],...Array.from(Za.values()),...Array.from(Ru.values())]},CB=()=>!xs&&!Dn?void 0:{...xs,...Dn,contexts:[...Array.from(Ru.values())]},m6=()=>!xs&&!Dn?void 0:{...xs,...Dn,contexts:[...Dn?.contexts??[],...Array.from(Za.values())]},g6=()=>!xs&&!Dn?void 0:{...Dn,contexts:[...Dn?.contexts??[]]};function y6(t){let e={...t};for(let r in e)e[r]===null&&delete e[r];return e}var DB=async()=>{let t=await wu();console.log("Resolved settings",JSON.stringify(t,void 0," ")),te.sendNotification("devicetree/settingsChanged",t),await Cu(),Ve().then(()=>{PB&&te.languages.diagnostics.refresh()})},T6=async()=>{let t=ce?.getContextFiles();await Promise.all(Array.from(vr.keys()).filter(Ut).map(async e=>{t?.some(r=>pe(r,Pe(e)))||await te.sendDiagnostics({uri:e,version:vr.get(e)?.version,diagnostics:[{severity:We.DiagnosticSeverity.Information,range:We.Range.create(We.Position.create(0,0),We.Position.create(0,0)),message:"File not in active context",source:"devicetree"}]})}))},G_=async t=>{let e=Ky(He,t);if(e.length)e.sort((r,n)=>r===ce?-1:n===ce?1:0).forEach(r=>{Fm.get(r)?.abort.abort();let n=new AbortController,i=new Promise(s=>{setTimeout(async()=>{if(r.setStaleUri(t),n.signal.aborted){s();return}let o=performance.now(),a=ce===r,c=a?AB(r):[],l=r.getContextFiles();await r.reevaluate(t),_B(r),l.forEach(p=>Nu.get(p)?.unwatch()),a&&J_(r)?.length&&K_(r).then(p=>{let m=p.items.map(h=>({uri:h.uri,version:h.version??void 0,diagnostics:h.items}));Pu(r,c.filter(h=>m.every(T=>T.uri!==h.uri))),m.forEach(h=>{te.sendDiagnostics(h)}),Au.set(r,!0)});let[u,d]=await Promise.all([Ls(r),r.getFileTree()]),f={ctxNames:r.ctxNames.map(p=>p.toString()),id:r.id,...d,settings:r.settings,active:a,type:u.type};ce===r&&te.sendNotification("devicetree/activeContextStableNotification",f),te.sendNotification("devicetree/contextStableNotification",f),s(),console.log("reevaluate",performance.now()-o)},50)});Fm.set(r,{abort:n,promise:i})});else{if((await wu()).allowAdhocContexts===!1)return;await Cu(),await or({uri:t})}},v6=t=>vr.keys().find(e=>pe(Pe(e),t)),Du=t=>{let e=v6(t);if(e)return vr.get(e)},AB=t=>t.getContextFiles().map(e=>({uri:ue(e),version:Du(e)?.version,diagnostics:[]})),Au=new WeakMap,Pu=async(t,e=AB(t),r=!1)=>{if(!r&&t!==ce)return;let n=performance.now();await Promise.all(e.filter(i=>t===ce||!ce?.getContextFiles().some(s=>pe(Pe(i.uri),s))).map(i=>te.sendDiagnostics({uri:i.uri,version:vr.get(i.uri)?.version,diagnostics:[]}))),Au.delete(t),console.log(`(ID: ${t.id})`,"clear workspace diagnostics",`[${t.ctxNames.join(",")}]`,performance.now()-n)},K_=async t=>{await t.stable();let e=performance.now(),r=await t.getDiagnostics(),n=await Promise.all(t.getContextFiles().map(async i=>{let s=Du(i),o=[];return s&&t.settings.showFormattingErrorAsDiagnostics&&o.push(...(await oa({textDocument:s,options:t.formattingOptions},s?.getText(),"File Diagnostics").catch(()=>[])).map(a=>a.diagnostic())),{uri:ue(i),kind:We.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]}},Y_=async t=>{let{items:e}=await K_(t);e.map(r=>({uri:r.uri,version:r.version??void 0,diagnostics:r.items})).forEach(async r=>{te.sendDiagnostics(r)}),Au.set(t,!0)},X_=async()=>{let t=await Promise.all(He.map(Ls));console.log("======== Context List ========"),t.forEach(e=>{console.log(`(ID: ${e.ctx.id}) [${e.ctx.ctxNames.join(",")}]`,`[${e.type}]`,ce===e.ctx?" [ACTIVE]":"")}),console.log("==============================")},Ls=async t=>{let e=await W_(t),r=!e&&await c6(t);return{ctx:t,type:e?"Ad Hoc":r?"User":"3rd Party"}},or=async(t,e=!1)=>{if("uri"in t){if(!Ut(t.uri))return!1;ec=t.uri,console.log("Active File Uri",ec)}let r=await wu();if(ce&&!e&&!r.autoChangeContext||(await Ve(),!e&&ce?.getContextFiles().find(o=>"uri"in t&&pe(o,t.uri))))return!1;let n=ce,i=fn(He,t),s=n!==i;return s&&(n&&Pu(n),ce=i,i?(Ls(i).then(async o=>{let a=await i.getFileTree();!i||i!==ce&&!He.includes(i)||te.sendNotification("devicetree/newActiveContext",{ctxNames:i.ctxNames.map(c=>c.toString()),id:i.id,...a,settings:i.settings,active:ce===i,type:o.type})}),J_(i)?.length&&Y_(i),await X_()):te.sendNotification("devicetree/newActiveContext",void 0)),EB&&te.languages.foldingRange.refresh(),wB&&te.languages.semanticTokens.refresh(),s},Ut=t=>[".dts",".dtsi",".dtso",".overlay"].some(e=>t.endsWith(e));vr.listen(te);var J_=t=>t?.getContextFiles()?.filter(e=>Du(e));vr.onDidClose(async t=>{let e=Pe(t.document.uri);if(!Ut(e))return;let r=Ky(He,e);if(r.length===0){Ru.delete(e),te.sendDiagnostics({uri:t.document.uri,version:vr.get(t.document.uri)?.version,diagnostics:[]});return}await Promise.all(r.map(async n=>{!!J_(n)?.filter(s=>s!==e).length?ce?.getContextFiles().some(s=>pe(s,e))?ce?.getContextFiles().some(s=>pe(s,e))&&(await Pu(ce),await Y_(ce)):te.sendDiagnostics({uri:t.document.uri,version:vr.get(t.document.uri)?.version,diagnostics:[]}):await W_(n)?(await z_(n),Ru.delete(n.settings.dtsFile)):Pu(n)}))});vr.onDidOpen(async t=>{let e=Pe(t.document.uri);if(!Ut(e))return;await Ve(),T6();let r=fn(He,{uri:e});if(console.log("onDidOpen",r?.id,e),r)r!==ce?await or({id:r.id}):r===ce&&(!Au.get(r)||r.getContextFiles().some(n=>!pe(n,e)))&&await Y_(r);else{let n={ctxName:(0,tc.basename)(e),dtsFile:e};Ru.set(e,n),await G_(e)}});vr.onDidChangeContent(async t=>{let e=Pe(t.document.uri);if(!Ut(e))return;let r=t.document.getText(),n=Yr();n.needsRenew(e,r)&&(console.log("Content changed"),n.renewLexer(e,r),await G_(e))});var IB=async t=>{t?.settings?.devicetree&&(Dn=uB(y6(t.settings.devicetree)),console.log("Configuration changed",JSON.stringify(t,void 0," ")),await DB())};te.onDidChangeConfiguration(async t=>{await IB(t)});te.listen();te.languages.diagnostics.onWorkspace(async()=>{await Ve();let t=ce;return t?K_(t).finally(()=>{Au.set(t,!0)}):{items:[]}});te.onDidChangeWatchedFiles(t=>{te.console.log("We received a file change event")});te.onCompletion(async t=>{let e=Pe(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&ce&&ce.bindingLoader?.type==="Zephyr")return NA(t,ce,vr.get(t.textDocument.uri));if(!Ut(e))return[];await Ve(),or({uri:e});let r=wr(e);return r?[...await cD(t,r),...await jA(t,r)]:[]});te.onCompletionResolve(t=>t);var wr=t=>{let e=CB();return fn(He,{uri:t},ce,e?.preferredContext)};te.onDocumentSymbol(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return[];await Ve();let r=wr(e);return r?r.getUriParser(e)?.getDocumentSymbols(e):[]});te.onWorkspaceSymbol(async()=>{await Ve();let t=ce;return t?(await t.getAllStableParsers()).flatMap(e=>e.getWorkspaceSymbols()):[]});te.languages.semanticTokens.on(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return{data:[]};try{await Ve();let r=wr(e),n=new We.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}});te.onDocumentLinks(async t=>{await Ve();let e=Pe(t.textDocument.uri);return Ut(e)?wr(e)?.getDocumentLinks(e):e.endsWith(".yaml")&&ce?ce.bindingLoader?.getDocumentLinks?.(vr.get(t.textDocument.uri))??[]:[]});te.onPrepareRename(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await Ve(),or({uri:e});let r=wr(e);return DA(t,r)});te.onRenameRequest(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await Ve(),or({uri:e});let r=wr(e);return CA(t,r)});te.onReferences(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await Ve(),or({uri:e});let r=wr(e);return RA(t,r)});te.onDefinition(async t=>{let e=Pe(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&ce&&ce.bindingLoader?.type==="Zephyr")return OA(t,ce,vr.get(t.textDocument.uri));if(!Ut(e))return;await Ve(),or({uri:e});let r=wr(e),n=(await r?.getDocumentLinks(e,t.position))?.filter(i=>i.target).map(i=>We.Location.create(i.target,i.range))??[];return n.length?n:IA(t,r)});te.onDeclaration(async t=>{let e=Pe(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&ce&&ce.bindingLoader?.type==="Zephyr")return qA(t,ce,vr.get(t.textDocument.uri));if(!Ut(e))return;await Ve(),or({uri:e});let r=wr(e);return LA(t,r)});te.onCodeAction(async t=>{let e=Pe(t.textDocument.uri);if(Ut(e))return BA(t)});var OB=async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await Ve(),or({uri:e});let r=wr(e);if(!r)return[];if((await r.getSyntaxIssues(void 0,l=>Ks(l.raw,e,!1)?l:void 0)).get(e)?.length)return[];let i=Yr().getDocument(e),s=i.getText(),o=await oa(t,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[We.TextEdit.replace(We.Range.create(We.Position.create(0,0),We.Position.create(i.lineCount,c)),o)]};te.onDocumentRangeFormatting(OB);te.onDocumentFormatting(OB);te.onHover(async t=>{let e=Pe(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&ce&&ce.bindingLoader?.type==="Zephyr")return uO(t,ce,vr.get(t.textDocument.uri));if(!Ut(e))return;await Ve();let r=wr(e);return(await UA(t,r)).at(0)});te.onFoldingRanges(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await Ve();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?cB(e,i):[]});te.onTypeDefinition(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await Ve(),or({uri:e});let r=wr(e);return lB(t,r)});te.onSignatureHelp(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await Ve(),or({uri:e});let r=wr(e);return yB(t,r)});te.onRequest("devicetree/getContexts",async()=>(await Ve(),Promise.all(He.map(async t=>{let e=await Ls(t);return{ctxNames:t.ctxNames.map(r=>r.toString()),id:t.id,...await t.getFileTree(),settings:t.settings,active:ce===t,type:e.type}}))));te.onRequest("devicetree/setActive",async t=>(await Ve(),console.log("devicetree/setActive",t),await or(t,!0)));te.onRequest("devicetree/getActiveContext",async()=>{if(await Ve(),console.log("devicetree/getActiveContext"),!ce)return;let t=await Ls(ce);return ce?{ctxNames:ce.ctxNames.map(e=>e.toString()),id:ce.id,...await ce.getFileTree(),settings:ce.settings,active:!0,type:t.type}:void 0});te.onRequest("devicetree/setDefaultSettings",async t=>{await Ve(),xs=t,console.log("Integration Settings",t),await DB()});te.onRequest("devicetree/requestContext",async t=>{await Ve();let e=await wu(),r=await B_(t,e,await Eu());console.log("devicetree/requestContext",r);let n=Ci(r),i=Array.from(Za).find(([,a])=>a.ctxName===t.ctxName);if(i){let a=i[0].split(":",1)[0];fn(He,{name:t.ctxName.toString()})?.removeCtxName(t.ctxName),console.log(`Removing integration context with ID ${a} and name ${t.ctxName}`),Za.delete(i[0])}Za.set(`${n}:${t.ctxName}`,t),await Cu();let s=He.find(a=>a.id===n);if(!s)throw new Error("Failed to create context");let o=await Ls(s);return{ctxNames:s.ctxNames.map(a=>a.toString()),id:n,...await s.getFileTree(),settings:s.settings,active:!0,type:o.type}});te.onRequest("devicetree/removeContext",async({id:t,name:e})=>{await Ve(),Za.delete(`${t}:${e}`);let r=fn(He,{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 Cu()}});te.onRequest("devicetree/compiledDtsOutput",async t=>{if(await Ve(),!t)return;let e=fn(He,{id:t});if(!e)return;let r=await e.toFullString();return oa({textDocument:{uri:ue(e.settings.dtsFile)},options:e.formattingOptions},r,"New Text").catch(()=>r)});te.onRequest("devicetree/serializedContext",async t=>{if(await Ve(),!t)return;let e=fn(He,{id:t}),r=performance.now();return e?.serialize().finally(()=>{console.info("serializedContext",performance.now()-r)})});te.onRequest("devicetree/activePath",async t=>{if(await Ve(),!ce)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 Nt(t,ce,r=>[e(r)])).at(0)});te.onRequest("devicetree/customActions",async t=>(await Ve(),mB(t,ce)));te.onRequest("devicetree/activeFileUri",async t=>{await Ve(),or({uri:t})});te.onRequest("devicetree/formattingText",async t=>{let e=Pe(t.textDocument.uri),r=Du(e)??Yr().getDocument(e,t.text),n=await oa(t,r.getText(),"Both");return{text:n.text,diagnostics:n.diagnostic.map(i=>i.diagnostic())}});te.onRequest("devicetree/diagnosticIssues",async({uri:t,full:e})=>{await Ve();let r=Pe(t);or({uri:r});let n=wr(r);if(!n)return[];let i=e?(await n.getDiagnostics()).get(r):(await n.getSyntaxIssues(void 0,s=>Ks(s.raw,r,!!e)?s:void 0)).get(r);if(i?.length)return i});te.onRequest("devicetree/evalMacros",async({macros:t,ctxId:e})=>{await Ve();let r=fn(He,{id:e});return r?t.map(n=>{let i=hf(n,r.macros),s=Ce(i);return{macro:n,evaluated:typeof s=="number"?s:i}}):[]});
|
|
312
|
+
${n}`]})]},YJ=(t,e)=>Y$(t,e.split("/").filter(r=>r)),Y$=(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?Y$(s,e.slice(1)):{node:t,property:t.getProperty(e[0]),remainingInstancePath:e.slice(1).join("/")}};var $_=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){io.sync("**/*.yaml",{cwd:e}).forEach(i=>{i=(0,x_.resolve)(e,i);try{let s=q_.default.parse((0,L_.readFileSync)(i,"utf-8"));r.addMetaSchema(s),this.schemaIdValidators.set(s.$id,i)}catch{}})}parseBindings(e,r){io.sync("**/*.yaml",{cwd:e}).forEach(i=>{i=(0,x_.resolve)(e,i);try{let s=q_.default.parse((0,L_.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 J$.default({strict:!1,strictSchema:!1,strictNumbers:!1}),s.addMetaSchema(M_),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=>f.endsWith(`/${c}.yaml#`));if(!l)return;let u=new Um(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())}},X$,B_=()=>(X$??=new $_,X$);var Ru=require("path"),iB=require("fs"),sB=$(require("path")),oB=$(xb());var An=$(j());var Q$=()=>{let t=new Y("nonposted-mmio",z("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 Z$(){let t=pr();t.noMismatchPropertiesAllowed=!0;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(Q$()),t}var eB=t=>{switch(t){case"string":return z("STRING");case"int":return z("U32");case"boolean":return z("EMPTY");case"array":return z("PROP_ENCODED_ARRAY");case"uint8-array":return z("BYTESTRING");case"string-array":return z("STRINGLIST");case"phandle":return z("U32");case"phandles":return z("PROP_ENCODED_ARRAY");case"phandle-array":return z("PROP_ENCODED_ARRAY");case"path":return z(["STRING","U32"]);case"compound":return z("ANY");default:return z("ANY")}},tB=(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}},Hm=(t,e)=>{if(e.extends??=[],e=e.include.reduce((r,n)=>{let i=t.find(s=>(0,Ru.basename)(s.filePath)===n.name);if(i){let s=n["property-blocklist"],o=n["property-allowlist"];return e.extends?.push(...r.include.map(a=>(0,Ru.basename)(a.name,".yaml"))),r.include=r.include.filter(a=>a!==n),aB(t,i,r,s,o)??r}return console.warn(`Unable to find ${n.name}`),r},e),e["child-binding"]&&(e["child-binding"].include=cB(e["child-binding"].include),e["child-binding"]=Hm(t,e["child-binding"])),!e.include.length)return e},aB=(t,e,r,n=[],i)=>{let s=Hm(t,e),o=Hm(t,r);if(!s||!o)return;let a=new Set;Object.keys(s?.properties??{}).forEach(f=>a.add(f)),Object.keys(o?.properties??{}).forEach(f=>a.add(f));let c={};Array.from(a).forEach(f=>{let p=n?.some(h=>h===f)||i&&!i.some(h=>h===f)?void 0:s.properties?.[f]??void 0,m=o.properties?.[f]??void 0;(p||m)&&(c={...c,[f]:{...p??{},...m}})}),o.properties=c,o.extends??=[],o.extends.push(...s.extends??[]);let l=new Set;return Object.keys(s).filter(f=>f.endsWith("-cells")).forEach(f=>l.add(f)),Object.keys(s).filter(f=>f.endsWith("-cells")).forEach(f=>l.add(f)),Array.from(l).forEach(f=>{let p=s[f]??[],m=o[f]??[];o[f]=Array.from([...p,...m])}),o["on-bus"]??=s["on-bus"],o.bus?o.bus.push(...s.bus??[]):o.bus=s.bus,s["child-binding"]&&aB(t,s["child-binding"],o["child-binding"]??{filePath:o.filePath,include:[],rawInclude:[]}),o},cB=t=>t?typeof t=="string"?[{name:t}]:t.map(e=>typeof e!="string"?e:{name:e}):[],F_=class t{constructor(){this.typeCache=new Map;this.processedFolders=new Set;this.zephyrBindingCache=new Map}static getCompatibleKeys(e,r){return!r||!r.nodeType?.bus?.length?[e]:[...r.nodeType.bus.map(n=>`${e}::${n}`),e]}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);if(!n?.length){if(e.name==="zephyr,user"){let a=r.split(":"),l=Array.from(this.zephyrBindingCache.keys()).filter(d=>a.some(f=>d.startsWith(f))).flatMap(d=>this.zephyrBindingCache.get(d)).find(d=>d.filePath.endsWith("/base.yaml")),u=l?j_(l,e):void 0;if(u){u.warnMismatchProperties=!1;let d=u.properties.find(f=>f.name==="compatible");d&&(d.required=()=>"optional")}return{type:[u??ls(e)],issues:[]}}return{type:[ls(e)],issues:[]}}let i=n.flatMap(a=>t.getCompatibleKeys(a.name,e.parent).map(c=>this.typeCache.get(r)?.get(c)?.(e)).filter(c=>!!c)),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 B(37,a.ast.firstToken,a.ast.lastToken,a.ast,{templateStrings:l})}return c?[]:[B(32,a.ast.firstToken,a.ast.lastToken,a.ast,{severity:An.DiagnosticSeverity.Hint,tags:[An.DiagnosticTag.Unnecessary],templateStrings:[a.name]})]});return{type:i.length?i:[ls(e)],issues:o}}loadTypeAndCache(e,r){e=Array.isArray(e)?e:[e];let n=e.filter(o=>this.processedFolders.has(o)).flatMap(o=>Array.from(this.zephyrBindingCache.entries()).flatMap(([a,c])=>a.startsWith(o)?[c]:[]));n.push(...e.filter(o=>!this.processedFolders.has(o)).flatMap(o=>(this.processedFolders.add(o),io.sync("**/*.yaml",{cwd:o,ignore:"test/*"}).map(c=>{if(c=(0,Ru.resolve)(o,c),this.zephyrBindingCache.has(c))return this.zephyrBindingCache.get(c);try{let l=oB.default.parse((0,iB.readFileSync)(c,"utf-8")),u=cB(l?.include),d={...l,bus:l.bus?Array.isArray(l.bus)?l.bus:[l.bus]:void 0,include:u,rawInclude:[...u],filePath:c};return this.zephyrBindingCache.set(c,d),d}catch(l){console.warn(l)}}).filter(c=>!!c))));let i=n.map(o=>Hm(n,o)).filter(o=>!!o&&!o.include.length),s=this.typeCache.get(r);s||(s=new Map,s.set("simple-bus",()=>Z$()),this.typeCache.set(r,s)),XJ(i,s)}getBindings(e){return Array.from(this.typeCache.get(e)?.keys()??[]).map(r=>r.split("::",1)[0])}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(Pe(e.uri));if(!n)return[];let i=e.getText();return n.rawInclude.map(o=>{let c=new RegExp(o.name).exec(i);if(c){let l=e.positionAt(c.index),u=e.positionAt(c.index+c[0].length),d=Array.from(this.zephyrBindingCache.keys()).find(f=>f.endsWith(`${sB.default.sep}${o.name}`)&&r.some(p=>f.startsWith(p)));return d?{range:An.Range.create(l,u),target:ue(d)}:void 0}}).filter(o=>!!o)}},rB,tc=()=>(rB??=new F_,rB),XJ=(t,e)=>t.forEach(r=>{r.compatible&&e.set(r["on-bus"]?`${r.compatible}::${r["on-bus"]}`:r.compatible,n=>j_(r,n))}),j_=(t,e)=>{let r=ls(e);r.compatible=t.compatible,r.description=t.description,r.bindingsPath=t.filePath,r.bus=typeof t.bus=="string"?[t.bus]:Array.from(new Set(t.bus)),r.onBus=t["on-bus"],t.extends?.forEach(s=>r.extends.add(s)),r.warnMismatchProperties=!0;let i=Object.keys(t).filter(s=>s.endsWith("-cells")).map(s=>({specifier:s.replace(/-cells$/,""),values:t[s]}));if(r.cellsValues=i,Object.keys(t.properties??{}).forEach(s=>{let o=t.properties[s];JJ(r,s,o)}),t["child-binding"]){let s=t["child-binding"];r.childNodeType=o=>j_(s,o)}return r},JJ=(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=tB(r.type,r.const),n.bindingType=r.type;let i=n.additionalTypeCheck;n.additionalTypeCheck=(s,o)=>[...nB(r,e,n)(s,o),...i?.(s,o)??[]]}else{let i=r.type==="compound"?n?.type:eB(r.type);i??=eB(r.type);let s=new Y(e,i,r.required?"required":"optional",void 0,r.enum);s.additionalTypeCheck=(o,a)=>{let c=[...n?.additionalTypeCheck?.(o,a)??[],...nB(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=tB(r.type,r.const),t.addProperty(s)}},nB=(t,e,r)=>{let n=t;return(i,s)=>{let o=i.parent.root,a=[];if(n.const){let l=i.ast.quickValues;if(l?.length==1){let u=Array.isArray(n.const)?n.const:[n.const];if(!(Array.isArray(l[0])&&u.length===l[0].length&&l[0].every((f,p)=>typeof f=="number"&&Number.isNaN(f)||u[p]===f))){let f=i.ast.values??i.ast;a.push(B(24,f.firstToken,f.lastToken,f,{templateStrings:[`Binding expects values to be "${n.type}" with value: ${n.const}`]}))}}}if(n.deprecated&&a.push(B(14,i.ast.firstToken,i.ast.lastToken,i.ast,{severity:An.DiagnosticSeverity.Warning,tags:[An.DiagnosticTag.Deprecated],templateStrings:[i.name]})),(n.type==="phandle"||n.type==="phandles"||n.type==="path")&&Le(i.ast.values)?.forEach(u=>{Tn(u,o)||a.push(B(22,u.firstToken,u.lastToken,u))}),n.type==="path"&&i.ast.values?.values.at(0)?.value instanceof ne){let l=i.ast.values?.values.at(0)?.value,u=[];l.value.split("/").every(d=>{let f=o.getNode(d);return f?u.push(d):a.push(B(23,l.firstToken,l.lastToken,l,{templateStrings:[d,`/${u.join("/")}`]})),!f})}let c=i.name.match(/^(.*)-(\d+)$/);if(n.type==="phandles"&&c){let l="";e.endsWith("-gpios")?l="gpio":l=n["specifier-space"]??c[1];let u=Number.parseInt(c[2],10),d=i.parent.getProperty(`${l}-names`);d&&(d.ast.quickValues?.at(u)||a.push(B(33,i.ast.firstToken,i.ast.lastToken,i.ast,{severity:An.DiagnosticSeverity.Warning,linkedTo:[d.ast],templateStrings:[i.name,u.toString()]})))}if(n.type==="phandle-array"){let l=Le(i.ast.values),u=0,d=[],f=0;for(;l&&u<l.length;){let p=l.at(u),m=Tn(p,o);if(!m){let M=p??i.ast;a.push(B(22,M.firstToken,M.lastToken,M));break}let h="";e.endsWith("-gpios")?h="gpio":h=n["specifier-space"]??e.slice(0,-1);let T=m.getProperty(`#${h}-cells`);if(!T){a.push(B(16,i.ast.firstToken,i.ast.lastToken,i.ast,{linkedTo:[...m.nodeNameOrLabelRef],templateStrings:[i.name,`#${h}-cells`,`/${m.path.slice(1).join("/")}`]}));break}let b=T?Be(T,0,0,s)??0:0,_=m.nodeType?.cellsValues?.find(M=>M.specifier===h)?.values;if(d.push([`${f}_phandle`,..._?.map(M=>`${f}_${M}`)??[],...Array.from({length:b-(_?.length??0)},(M,F)=>`${f}_cell${b-(_?.length??0)?F:""}`)]),1+b>l.length-u){let M=p??i.ast;a.push(B(19,M.firstToken,M.lastToken,M,{templateStrings:[i.name,`<${d.at(-1).join(" ")}>`]}));break}u+=1+b;let v=l.slice(u-b,u),N={mappingValuesAst:v,specifierSpace:h,target:m};i.nexusMapsTo.push(N);let C=m.getProperty(`${h}-map`);if(C){let M=m.getNexusMapEntryMatch(h,s,v);M?.match?N.mapItem=M.match:a.push(B(31,M.entry.firstToken,M.entry.lastToken,M.entry,{linkedTo:[C.ast]}))}v.every(M=>M instanceof be)&&m.spesifierNexusMapping.push({expressions:v,node:i.parent,property:i});let H=i.parent.getProperty(`${h}-names`);p&&H&&(H.ast.quickValues?.at(f)||a.push(B(33,p.firstToken,l[u-1]?.lastToken,i.ast,{severity:An.DiagnosticSeverity.Warning,linkedTo:[H.ast],templateStrings:[i.name,f.toString()]}))),f++}d.push([`${f}_phandle`,`${f}_cell...`]),r.signatureArgs=d.map(p=>p.map(m=>An.ParameterInformation.create(m)))}return a}};var lB=(t,e)=>{let r=t.zephyrBindings.join(":");return e==="Zephyr"&&tc().loadTypeAndCache(t.zephyrBindings,r),{files:t,type:e,getNodeTypes:n=>{switch(e){case"Zephyr":return tc().getNodeTypes(n,r);case"DevicetreeOrg":return{type:B_().getNodeTypes(t.deviceOrgBindingsMetaSchema,t.deviceOrgTreeBindings,n),issues:[]}}},getBindings:()=>{switch(e){case"Zephyr":return tc().getBindings(r);case"DevicetreeOrg":return B_().getBindings()}},getBusTypes:()=>{switch(e){case"Zephyr":return tc().getBusTypes();case"DevicetreeOrg":return[]}},getDocumentLinks(n){if(!n)return[];switch(e){case"Zephyr":return tc().getDocumentLinks(n,t.zephyrBindings);case"DevicetreeOrg":return[]}}}};var Vm=$(j());var QJ=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:Vm.FoldingRangeKind.Comment}],U_=t=>!t.openScope||!t.closeScope?.prevToken?t.nodes.flatMap(U_):[{startLine:t.openScope.pos.line,startCharacter:t.openScope.pos.col,endLine:t.closeScope.prevToken.pos.line,endCharacter:t.closeScope.prevToken.pos.col,kind:Vm.FoldingRangeKind.Region},...t.nodes.flatMap(U_)],uB=t=>{let e=[];return[...t instanceof bn?t.ifBlocks.map(r=>({start:(r.expression??r.keyword).lastToken,end:r.content?.lastToken??(r.expression??r.keyword).lastToken})):[{start:(t.ifDef.identifier??t.ifDef.keyword).lastToken,end:t.ifDef.content?.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:Vm.FoldingRangeKind.Region})}),e},ZJ=t=>t instanceof We?U_(t):t instanceof Vn||t instanceof bn?uB(t):t instanceof Zr?QJ(t):[];function dB(t,e){return e.allAstItems.flatMap(r=>[r,...r.allDescendants]).filter(r=>pe(r.uri,t)).flatMap(ZJ)}var Ro=$(j());function e6(t){if(!t||!(t.ast instanceof Me)&&!(t.ast instanceof rr))return[];let e=r=>r.nodeType?.bindingsPath?[Ro.Location.create(ue(r.nodeType.bindingsPath),Ro.Range.create(Ro.Position.create(0,0),Ro.Position.create(0,0)))]:[];return t.item instanceof X&&!Vt(t.ast)?e(t.item):t.ast instanceof rr&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo?e(t.ast.parentNode.linksTo):t.ast instanceof Me&&t.ast.linksTo?e(t.ast.linksTo):[]}async function fB(t,e){return Rt(t,e,r=>[...e6(r)])}var Wm=require("fs");var t6=(t,e)=>{tn().reset(t),tn().requestTokens(t,!0),e(t)},zm=class{constructor(e,r,n){this.file=e;this.cb=r;this.hasDocumentOpen=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(this.hasDocumentOpen(e)){console.log("skipping on change document is open",e);return}console.log("onChange",e),t6(e,r)},(0,Wm.watchFile)(e,this.onChange)}}unwatch(){this.count===1&&(console.log("dispose watch for",this.file),(0,Wm.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 Zt=$(require("path")),H_=require("fs");var ni=t=>{if(t)return Array.isArray(t)?t:[t]},r6=t=>({...t,deviceOrgBindingsMetaSchema:ni(t.deviceOrgBindingsMetaSchema),deviceOrgTreeBindings:ni(t.deviceOrgTreeBindings),includePaths:ni(t.includePaths),lockRenameEdits:ni(t.lockRenameEdits),zephyrBindings:ni(t.zephyrBindings),overlays:ni(t.overlays)}),pB=t=>({...t,defaultDeviceOrgBindingsMetaSchema:ni(t.defaultDeviceOrgBindingsMetaSchema),defaultDeviceOrgTreeBindings:ni(t.defaultDeviceOrgTreeBindings),defaultIncludePaths:ni(t.defaultIncludePaths),defaultLockRenameEdits:ni(t.defaultLockRenameEdits),defaultZephyrBindings:ni(t.defaultZephyrBindings),contexts:t.contexts?.map(r6)}),In=async(t,e=[],r)=>{let n=r?e.map(s=>Pe(s.uri)).find(s=>Gw(s,r)):void 0;return[...e.at(0)?[{replace:"${workspaceFolder}",uri:n??Pe(e[0].uri)}]:[],...e.map(s=>({replace:`\${workspaceFolder:${s.name}}`,uri:Pe(s.uri)}))].forEach(s=>t=t.replaceAll(s.replace,s.uri)),t},Ls={defaultBindingType:"Zephyr",defaultZephyrBindings:[],defaultIncludePaths:[],defaultDeviceOrgBindingsMetaSchema:[],defaultDeviceOrgTreeBindings:[],contexts:[],defaultLockRenameEdits:[],allowAdhocContexts:!0,autoChangeContext:!0,defaultShowFormattingErrorAsDiagnostics:!0},V_=async(t,e,r)=>{let n=await In(t.cwd??"${workspaceFolder}",r,t.dtsFile)??e.cwd,i=await Promise.all((t.includePaths??e.defaultIncludePaths).map(p=>In(p,r,t.dtsFile))),s=await Promise.all((t.zephyrBindings??e.defaultZephyrBindings).map(p=>In(p,r,t.dtsFile))),o=t.bindingType??e.defaultBindingType,a=await Promise.all((t.deviceOrgTreeBindings??e.defaultDeviceOrgTreeBindings).map(p=>In(p,r,t.dtsFile))),c=await Promise.all((t.deviceOrgBindingsMetaSchema??e.defaultDeviceOrgBindingsMetaSchema).map(p=>In(p,r,t.dtsFile))),l=await Promise.all((t.lockRenameEdits??e.defaultLockRenameEdits).map(p=>In(p,r,t.dtsFile)));n&&o==="Zephyr"&&(!s||s.length===0)&&(s=["./zephyr/dts/bindings"]);let u=t.dtsFile,d=t.overlays??[],f=t.compileCommands;return n&&(s=s.map(p=>(0,Zt.resolve)(n,p)).filter(p=>(0,H_.existsSync)(p)),a=a?.map(p=>(0,Zt.resolve)(n,p)),c=c.map(p=>(0,Zt.resolve)(n,p)),i=i.map(p=>(0,Zt.resolve)(n,p)),u=(0,Zt.resolve)(n,u),d=d.map(p=>(0,Zt.resolve)(n,p)),l=l.map(p=>(0,Zt.resolve)(n,p)),f=f?(0,Zt.resolve)(n,f):void 0),{ctxName:t.ctxName??(0,Zt.basename)(u),cwd:n?st(n):void 0,includePaths:i.map(st),zephyrBindings:s.map(st),bindingType:o,deviceOrgTreeBindings:a.map(st),deviceOrgBindingsMetaSchema:c.map(st),dtsFile:st(u),overlays:d.map(st),lockRenameEdits:l.map(st),compileCommands:f?st(f):void 0,showFormattingErrorAsDiagnostics:t.showFormattingErrorAsDiagnostics??e.defaultShowFormattingErrorAsDiagnostics}},Pu=async(t,e)=>{let r=t.cwd?await In(t.cwd,e):void 0,n=t.defaultBindingType,i=t.defaultDeviceOrgBindingsMetaSchema=await Promise.all((t.defaultDeviceOrgBindingsMetaSchema??[]).map(d=>In(d,e))),s=t.defaultDeviceOrgTreeBindings=await Promise.all((t.defaultDeviceOrgTreeBindings??[]).map(d=>In(d,e))),o=t.defaultIncludePaths=await Promise.all((t.defaultIncludePaths??[]).map(d=>In(d,e))),a=t.defaultZephyrBindings=await Promise.all((t.defaultZephyrBindings??[]).map(d=>In(d,e))),c=t.defaultLockRenameEdits=await Promise.all((t.defaultLockRenameEdits??[]).map(d=>In(d,e)));r&&(o=t.defaultIncludePaths=(t.defaultIncludePaths??[]).map(d=>(0,Zt.resolve)(r,d)),n==="Zephyr"&&!t.defaultZephyrBindings&&(a=["./zephyr/dts/bindings"]),a=a.map(d=>(0,Zt.resolve)(r,d)),i=i.map(d=>(0,Zt.resolve)(r,d)),s=(t.defaultDeviceOrgTreeBindings??[]).map(d=>(0,Zt.resolve)(r,d)),c=c.map(d=>(0,Zt.resolve)(r,d)));let l={cwd:r,defaultDeviceOrgBindingsMetaSchema:i,defaultDeviceOrgTreeBindings:s,defaultIncludePaths:o,defaultZephyrBindings:a,defaultLockRenameEdits:c,defaultBindingType:n,autoChangeContext:t.autoChangeContext??Ls.autoChangeContext,allowAdhocContexts:t.allowAdhocContexts??Ls.allowAdhocContexts,defaultShowFormattingErrorAsDiagnostics:t.defaultShowFormattingErrorAsDiagnostics??Ls.defaultShowFormattingErrorAsDiagnostics},u=(await Promise.all(t.contexts?.map(d=>V_(d,l,e))??[])).filter(d=>[d.dtsFile,...d.overlays].every(f=>(0,H_.existsSync)(f)&&Zt.default.isAbsolute(f)));return{...l,contexts:u}};var hB=t=>`DT_PROP(${z_(t.parent)}, ${t.name.replaceAll("-","_")}))`,mB=t=>t.parent.labels.map(e=>`DT_PROP(DT_NODELABEL(${e.label.toString()}), ${t.name.replaceAll("-","_")})`);var z_=t=>`DT_PATH(${t.path.slice(1).map(e=>e.replace("@","_").replaceAll("-","_")).join(",")})`,gB=t=>t.labels.map(e=>`DT_NODELABEL(${e.label.toString()})`),yB=t=>{let e=[];return fi.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 ot&&s.path?.pathParts.at(-1)?.linksTo===t)return!0})?.forEach(i=>e.push(`DT_ALIAS(${i.name.replaceAll("-","_")})`)),e};function n6(t,e){if(!t||!(t.item instanceof Ze)||!(t.ast instanceof tt))return[];let r=[];return e.settings.bindingType==="Zephyr"&&(r.push({type:"dt_zephyr_macro_prop_node_path",data:hB(t.item)}),mB(t.item).forEach(n=>{r.push({type:"dt_zephyr_macro_prop_node_label",data:n})})),r}function i6(t,e){if(!t||t.item===null)return[];let r;if(t.item instanceof X?r=t.item:t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo?r=t.ast.parentNode.linksTo:t.ast instanceof Me&&t.ast.linksTo&&(r=t.ast.linksTo),!r)return[];let n=[{type:"path",data:r.pathString}];return e.settings.bindingType==="Zephyr"&&(gB(r).forEach(i=>{n.push({type:"dt_zephyr_macro_node_label",data:i})}),n.push({type:"dt_zephyr_macro_node_path",data:z_(r)}),yB(r).forEach(i=>{n.push({type:"dt_zephyr_macro_prop_node_alias",data:i})})),n}async function TB(t,e){return e?Rt(t,e,r=>[...i6(r,e),...n6(r,e)]):[]}var vB=$(j());function s6(t){return!t||!(t.item instanceof Ze)?void 0:t.item.parent.nodeType?.getSignatureHelp?.(t.item,t.ast,t.beforeAst,t.afterAst)}async function o6(t){let e=Cc(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 di))return;let i=n.params.map(o=>({label:o instanceof pt?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:[vB.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 bB(t,e){if(e)return(await Rt(t,e,async r=>[await o6(r)||s6(r)])).at(0)}var SB=require("timers"),_B=require("events");var W_=class extends _B.EventEmitter{constructor(e=3e3,r=1e3){super(),this.thresholdBytes=e*1024*1024,this.interval=(0,SB.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)}},a6=new W_(3e3),kB=()=>{a6.on("thresholdExceeded",({usedMb:t,thresholdMb:e})=>{console.warn(`[HeapMonitor] Heap usage exceeded ${e}MB: ${t}MB used`),XC(),YC()})};var He=[],ce,nc,Gm=new WeakMap,wu=new Map;kB();var RB=t=>{t.getContextFiles().forEach(e=>{wu.has(e)||wu.set(e,new zm(e,Q_,r=>!!Ou(r))),wu.get(e)?.watch()})},X_=async t=>{let e=He.indexOf(t);if(e===-1)return;Cu(t,void 0,!0),Gm.delete(t),console.log(`(ID: ${t.id}) cleaning Context for [${t.ctxNames.join(",")}]`);let r=await $s(t);if(te.sendNotification("devicetree/contextDeleted",{ctxNames:t.ctxNames.map(n=>n.toString()),id:t.id,...await t.getFileTree(),settings:t.settings,active:ce===t,type:r.type}),He.splice(e,1),await tk(),t===ce&&(ce=void 0,He.length)){let n=nc?yn(He,{uri:nc}):void 0;n??=He[0],console.log("Active context was deleted. Forcing active to",n.id),await ar({id:n.id},!0)}t.getContextFiles().map(n=>wu.get(n)?.unwatch())},c6=t=>{let e=Gm.get(t);if(!e?.abort.signal.aborted)return Promise.all([e?.promise,t.getRuntime()])},Ve=async()=>{await Promise.all(He.map(c6))},J_=async t=>(await PB()).indexOf(t)!==-1,PB=async()=>{let t=await wB();return He.filter(e=>!t.some(r=>r===e))},wB=async()=>{let t=await Y_();return He.filter(e=>t.contexts.find(r=>Oi(r)===e.id))},l6=async()=>{let t=await m6();return He.filter(e=>t.contexts.find(r=>Oi(r)===e.id))},u6=async t=>(await l6()).indexOf(t)!==-1,d6=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=>pe(i.resolvedPath,t.parser.uri))&&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=>pe(i,t.parser.uri))},f6=async t=>{if(!await J_(t))return;let e=await PB(),r=await wB(),n=await _f(e);if(He.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 d6(a.context,c)})))),s=t.getContextFiles(),o=n.filter(a=>i.some(c=>c.context===a.context&&c.same)||a.context!==t&&pe(a.context.parser.uri,t.parser.uri)&&s.some(c=>c&&a.files.indexOf(c)!==-1)).map(a=>a.context);o.length&&await Promise.all(o.map(X_))},te=(0,Ge.createConnection)(Ge.ProposedFeatures.all),Sr=new Ge.TextDocuments(hn),EB=!1,Km=!1,CB=!1,DB=!1,AB=!1,G_;te.onInitialize(async t=>{G_=t.workspaceFolders??[],te.console.log(`[Server(${process.pid}) ${G_?.at(0)?.uri} Version 0.7.5 ] Started and initialize received`);let e=t.capabilities;EB=!!(e.workspace&&e.workspace.configuration),Km=!!(e.workspace&&e.workspace.workspaceFolders),CB=!!e.workspace?.diagnostics?.refreshSupport,DB=!!e.workspace?.semanticTokens?.refreshSupport,AB=!!e.workspace?.foldingRange?.refreshSupport;let r={capabilities:{typeDefinitionProvider:!0,workspaceSymbolProvider:!0,textDocumentSync:Ge.TextDocumentSyncKind.Incremental,renameProvider:{prepareProvider:!0},completionProvider:{resolveProvider:!0,triggerCharacters:["&","="," ",'"',"(",","]},codeActionProvider:{codeActionKinds:[Ge.CodeActionKind.QuickFix,Ge.CodeActionKind.SourceFixAll]},documentSymbolProvider:!0,semanticTokensProvider:{legend:{tokenTypes:mf,tokenModifiers:gf},full:!0},documentLinkProvider:{resolveProvider:!1},foldingRangeProvider:!0,definitionProvider:!0,declarationProvider:!0,referencesProvider:!0,documentFormattingProvider:!0,documentRangeFormattingProvider:!0,hoverProvider:!0,signatureHelpProvider:{triggerCharacters:["<","("],retriggerCharacters:[" ",","]}}};return Km&&(r.capabilities.workspace={workspaceFolders:{changeNotifications:!0,supported:!0}}),await xB(t.initializationOptions),r});var K_,p6={tabSize:8,insertSpaces:!1,trimTrailingWhitespace:!0,insertFinalNewline:!0,wordWrapColumn:100};te.onInitialized(async()=>{if(EB&&(te.client.register(Ge.DidChangeConfigurationNotification.type,{}),!K_)){let t=await te.workspace.getConfiguration("editor").catch(()=>{}),e=await te.workspace.getConfiguration("[devicetree]").catch(()=>{}),r={tabSize:e?.["editor.tabSize"],insertSpaces:e?.["editor.insertSpaces"],trimFinalNewlines:e?.["editor.trimFinalNewlines"],trimTrailingWhitespace:e?.["editor.trimTrailingWhitespace"],insertFinalNewline:e?.["editor.insertFinalNewline"],wordWrapColumn:e?.["editor.wordWrapColumn"]};(t||r)&&(K_={...t,...r})}Km&&te.workspace.onDidChangeWorkspaceFolders(async t=>{te.console.log("Workspace folder change event received"),await Iu()})});te.onRequest("workspace/workspaceFolders",async()=>G_??null);var h6=async()=>{let t=IB();return t={...Ls,...t},Pu(t,await Au())},Y_=async()=>{let t=y6();return t={...Ls,...t},Pu(t,await Au())},m6=async()=>{let t=T6();return t={...Ls,...t},Pu(t,await Au())},Du=async()=>{let t=g6();return t={...Ls,...t},Pu(t,await Au())},Au=async()=>Km?await te.workspace.getWorkspaceFolders()??[]:[],NB=async t=>{let e=yn(He,{id:Oi(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=Oi(t);console.log(`(ID: ${r}) New context [${t.ctxName}]`),console.log(`(ID: ${r}) Settings: ${JSON.stringify(t,void 0," ")}`);let n=(0,ic.join)((0,ic.dirname)(t.dtsFile),"dts","bindings"),i=new Kf(t,K_??p6,t.bindingType?lB({zephyrBindings:t.zephyrBindings?[n,...t.zephyrBindings]:[n],deviceOrgBindingsMetaSchema:t.deviceOrgBindingsMetaSchema??[],deviceOrgTreeBindings:t.deviceOrgTreeBindings??[]},t.bindingType):void 0);He.push(i);let s=performance.now();await i.stable(),console.log(`(ID: ${r}) New context took ${performance.now()-s}ms to start [${t.ctxName}]`),RB(i);let o=await $s(i);return te.sendNotification("devicetree/contextCreated",{ctxNames:i.ctxNames.map(a=>a.toString()),id:i.id,...await i.getFileTree(),settings:i.settings,active:i===ce,type:o.type}),await f6(i),await tk(),i},Iu=async()=>{let t=await Y_(),e=await Du();e.allowAdhocContexts||(e=await Y_());let r=e.contexts.map(Oi),n=He.filter(i=>!r.includes(i.id));await Promise.all(n.map(X_)),await t.contexts?.reduce((i,s)=>i.then(async()=>{await NB(s)}),Promise.resolve()),e.allowAdhocContexts&&await(await h6()).contexts?.reduce((s,o)=>s.then(async()=>{yn(He,{uri:o.dtsFile})||await NB(o)}),Promise.resolve()),nc?await ar({uri:nc}):!ce&&He.length&&(console.log(`No active context using first context (ID: ${He[0].id}) [${He[0].ctxNames.join(",")}]`),await ar({id:He[0].id}))},On,qs,Eu=new Map,rc=new Map,g6=()=>!qs&&!On?void 0:{...qs,...On,contexts:[...On?.contexts??[],...Array.from(rc.values()),...Array.from(Eu.values())]},IB=()=>!qs&&!On?void 0:{...qs,...On,contexts:[...Array.from(Eu.values())]},y6=()=>!qs&&!On?void 0:{...qs,...On,contexts:[...On?.contexts??[],...Array.from(rc.values())]},T6=()=>!qs&&!On?void 0:{...On,contexts:[...On?.contexts??[]]};function v6(t){let e={...t};for(let r in e)e[r]===null&&delete e[r];return e}var OB=async()=>{let t=await Du();console.log("Resolved settings",JSON.stringify(t,void 0," ")),te.sendNotification("devicetree/settingsChanged",t),await Iu(),Ve().then(()=>{CB&&te.languages.diagnostics.refresh()})},b6=async()=>{let t=ce?.getContextFiles();await Promise.all(Array.from(Sr.keys()).filter(Ut).map(async e=>{t?.some(r=>pe(r,Pe(e)))||await te.sendDiagnostics({uri:e,version:Sr.get(e)?.version,diagnostics:[{severity:Ge.DiagnosticSeverity.Information,range:Ge.Range.create(Ge.Position.create(0,0),Ge.Position.create(0,0)),message:"File not in active context",source:"devicetree"}]})}))},Q_=async t=>{let e=tT(He,t);if(e.length)e.sort((r,n)=>r===ce?-1:n===ce?1:0).forEach(r=>{Gm.get(r)?.abort.abort();let n=new AbortController,i=new Promise(s=>{setTimeout(async()=>{if(r.setStaleUri(t),n.signal.aborted){s();return}let o=performance.now(),a=ce===r,c=a?MB(r):[],l=r.getContextFiles();await r.reevaluate(t),RB(r),l.forEach(p=>wu.get(p)?.unwatch()),a&&rk(r)?.length&&Z_(r).then(p=>{let m=p.items.map(h=>({uri:h.uri,version:h.version??void 0,diagnostics:h.items}));Cu(r,c.filter(h=>m.every(T=>T.uri!==h.uri))),m.forEach(h=>{te.sendDiagnostics(h)}),Mu.set(r,!0)});let[u,d]=await Promise.all([$s(r),r.getFileTree()]),f={ctxNames:r.ctxNames.map(p=>p.toString()),id:r.id,...d,settings:r.settings,active:a,type:u.type};ce===r&&te.sendNotification("devicetree/activeContextStableNotification",f),te.sendNotification("devicetree/contextStableNotification",f),s(),console.log("reevaluate",performance.now()-o)},50)});Gm.set(r,{abort:n,promise:i})});else{if((await Du()).allowAdhocContexts===!1)return;await Iu(),await ar({uri:t})}},S6=t=>Sr.keys().find(e=>pe(Pe(e),t)),Ou=t=>{let e=S6(t);if(e)return Sr.get(e)},MB=t=>t.getContextFiles().map(e=>({uri:ue(e),version:Ou(e)?.version,diagnostics:[]})),Mu=new WeakMap,Cu=async(t,e=MB(t),r=!1)=>{if(!r&&t!==ce)return;let n=performance.now();await Promise.all(e.filter(i=>t===ce||!ce?.getContextFiles().some(s=>pe(Pe(i.uri),s))).map(i=>te.sendDiagnostics({uri:i.uri,version:Sr.get(i.uri)?.version,diagnostics:[]}))),Mu.delete(t),console.log(`(ID: ${t.id})`,"clear workspace diagnostics",`[${t.ctxNames.join(",")}]`,performance.now()-n)},Z_=async t=>{await t.stable();let e=performance.now(),r=await t.getDiagnostics(),n=await Promise.all(t.getContextFiles().map(async i=>{let s=Ou(i),o=[];return s&&t.settings.showFormattingErrorAsDiagnostics&&o.push(...(await va({textDocument:s,options:t.formattingOptions},s?.getText(),"File Diagnostics").catch(()=>[])).map(a=>a.diagnostic())),{uri:ue(i),kind:Ge.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]}},ek=async t=>{let{items:e}=await Z_(t);e.map(r=>({uri:r.uri,version:r.version??void 0,diagnostics:r.items})).forEach(async r=>{te.sendDiagnostics(r)}),Mu.set(t,!0)},tk=async()=>{let t=await Promise.all(He.map($s));console.log("======== Context List ========"),t.forEach(e=>{console.log(`(ID: ${e.ctx.id}) [${e.ctx.ctxNames.join(",")}]`,`[${e.type}]`,ce===e.ctx?" [ACTIVE]":"")}),console.log("==============================")},$s=async t=>{let e=await J_(t),r=!e&&await u6(t);return{ctx:t,type:e?"Ad Hoc":r?"User":"3rd Party"}},ar=async(t,e=!1)=>{if("uri"in t){if(!Ut(t.uri))return!1;nc=t.uri,console.log("Active File Uri",nc)}let r=await Du();if(ce&&!e&&!r.autoChangeContext||(await Ve(),!e&&ce?.getContextFiles().find(o=>"uri"in t&&pe(o,t.uri))))return!1;let n=ce,i=yn(He,t),s=n!==i;return s&&(n&&Cu(n),ce=i,i?($s(i).then(async o=>{let a=await i.getFileTree();!i||i!==ce&&!He.includes(i)||te.sendNotification("devicetree/newActiveContext",{ctxNames:i.ctxNames.map(c=>c.toString()),id:i.id,...a,settings:i.settings,active:ce===i,type:o.type})}),rk(i)?.length&&ek(i),await tk()):te.sendNotification("devicetree/newActiveContext",void 0)),AB&&te.languages.foldingRange.refresh(),DB&&te.languages.semanticTokens.refresh(),s},Ut=t=>[".dts",".dtsi",".dtso",".overlay"].some(e=>t.endsWith(e));Sr.listen(te);var rk=t=>t?.getContextFiles()?.filter(e=>Ou(e));Sr.onDidClose(async t=>{let e=Pe(t.document.uri);if(!Ut(e))return;let r=tT(He,e);if(r.length===0){Eu.delete(e),te.sendDiagnostics({uri:t.document.uri,version:Sr.get(t.document.uri)?.version,diagnostics:[]});return}await Promise.all(r.map(async n=>{!!rk(n)?.filter(s=>s!==e).length?ce?.getContextFiles().some(s=>pe(s,e))?ce?.getContextFiles().some(s=>pe(s,e))&&(await Cu(ce),await ek(ce)):te.sendDiagnostics({uri:t.document.uri,version:Sr.get(t.document.uri)?.version,diagnostics:[]}):await J_(n)?(await X_(n),Eu.delete(n.settings.dtsFile)):Cu(n)}))});Sr.onDidOpen(async t=>{let e=Pe(t.document.uri);if(!Ut(e))return;await Ve(),b6();let r=yn(He,{uri:e});if(console.log("onDidOpen",r?.id,e),r)r!==ce?await ar({id:r.id}):r===ce&&(!Mu.get(r)||r.getContextFiles().some(n=>!pe(n,e)))&&await ek(r);else{let n={ctxName:(0,ic.basename)(e),dtsFile:e};Eu.set(e,n),await Q_(e)}});Sr.onDidChangeContent(async t=>{let e=Pe(t.document.uri);if(!Ut(e))return;let r=t.document.getText(),n=tn();n.needsRenew(e,r)&&(console.log("Content changed"),n.renewLexer(e,r),await Q_(e))});var xB=async t=>{t?.settings?.devicetree&&(On=pB(v6(t.settings.devicetree)),console.log("Configuration changed",JSON.stringify(t,void 0," ")),await OB())};te.onDidChangeConfiguration(async t=>{await xB(t)});te.listen();te.languages.diagnostics.onWorkspace(async()=>{await Ve();let t=ce;return t?Z_(t).finally(()=>{Mu.set(t,!0)}):{items:[]}});te.onDidChangeWatchedFiles(t=>{te.console.log("We received a file change event")});te.onCompletion(async t=>{let e=Pe(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&ce&&ce.bindingLoader?.type==="Zephyr")return vA(t,ce,Sr.get(t.textDocument.uri));if(!Ut(e))return[];await Ve(),ar({uri:e});let r=Cr(e);return r?[...await nD(t,r),...await VA(t,r)]:[]});te.onCompletionResolve(t=>t);var Cr=t=>{let e=IB();return yn(He,{uri:t},ce,e?.preferredContext)};te.onDocumentSymbol(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return[];await Ve();let r=Cr(e);return r?r.getUriParser(e)?.getDocumentSymbols(e):[]});te.onWorkspaceSymbol(async()=>{await Ve();let t=ce;return t?(await t.getAllStableParsers()).flatMap(e=>e.getWorkspaceSymbols()):[]});te.languages.semanticTokens.on(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return{data:[]};try{await Ve();let r=Cr(e),n=new Ge.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}});te.onDocumentLinks(async t=>{await Ve();let e=Pe(t.textDocument.uri);return Ut(e)?Cr(e)?.getDocumentLinks(e):e.endsWith(".yaml")&&ce?ce.bindingLoader?.getDocumentLinks?.(Sr.get(t.textDocument.uri))??[]:[]});te.onPrepareRename(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await Ve(),ar({uri:e});let r=Cr(e);return RA(t,r)});te.onRenameRequest(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await Ve(),ar({uri:e});let r=Cr(e);return NA(t,r)});te.onReferences(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await Ve(),ar({uri:e});let r=Cr(e);return bA(t,r)});te.onDefinition(async t=>{let e=Pe(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&ce&&ce.bindingLoader?.type==="Zephyr")return EA(t,ce,Sr.get(t.textDocument.uri));if(!Ut(e))return;await Ve(),ar({uri:e});let r=Cr(e),n=(await r?.getDocumentLinks(e,t.position))?.filter(i=>i.target).map(i=>Ge.Location.create(i.target,i.range))??[];return n.length?n:wA(t,r)});te.onDeclaration(async t=>{let e=Pe(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&ce&&ce.bindingLoader?.type==="Zephyr")return IA(t,ce,Sr.get(t.textDocument.uri));if(!Ut(e))return;await Ve(),ar({uri:e});let r=Cr(e);return AA(t,r)});te.onCodeAction(async t=>{let e=Pe(t.textDocument.uri);if(Ut(e))return MA(t)});var LB=async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await Ve(),ar({uri:e});let r=Cr(e);if(!r)return[];if((await r.getSyntaxIssues(void 0,l=>Xs(l.raw,e,!1)?l:void 0)).get(e)?.length)return[];let i=tn().getDocument(e),s=i.getText(),o=await va(t,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[Ge.TextEdit.replace(Ge.Range.create(Ge.Position.create(0,0),Ge.Position.create(i.lineCount,c)),o)]};te.onDocumentRangeFormatting(LB);te.onDocumentFormatting(LB);te.onHover(async t=>{let e=Pe(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&ce&&ce.bindingLoader?.type==="Zephyr")return pO(t,ce,Sr.get(t.textDocument.uri));if(!Ut(e))return;await Ve();let r=Cr(e);return(await zA(t,r)).at(0)});te.onFoldingRanges(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await Ve();let r=Cr(e),n=r?.isInContext(e);if(!r||!n)return[];let i=(await r.getAllStableParsers()).find(s=>s.getFiles().some(o=>o===e));return i?dB(e,i):[]});te.onTypeDefinition(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await Ve(),ar({uri:e});let r=Cr(e);return fB(t,r)});te.onSignatureHelp(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await Ve(),ar({uri:e});let r=Cr(e);return bB(t,r)});te.onRequest("devicetree/getContexts",async()=>(await Ve(),Promise.all(He.map(async t=>{let e=await $s(t);return{ctxNames:t.ctxNames.map(r=>r.toString()),id:t.id,...await t.getFileTree(),settings:t.settings,active:ce===t,type:e.type}}))));te.onRequest("devicetree/setActive",async t=>(await Ve(),console.log("devicetree/setActive",t),await ar(t,!0)));te.onRequest("devicetree/getActiveContext",async()=>{if(await Ve(),console.log("devicetree/getActiveContext"),!ce)return;let t=await $s(ce);return ce?{ctxNames:ce.ctxNames.map(e=>e.toString()),id:ce.id,...await ce.getFileTree(),settings:ce.settings,active:!0,type:t.type}:void 0});te.onRequest("devicetree/setDefaultSettings",async t=>{await Ve(),qs=t,console.log("Integration Settings",t),await OB()});te.onRequest("devicetree/requestContext",async t=>{await Ve();let e=await Du(),r=await V_(t,e,await Au());console.log("devicetree/requestContext",r);let n=Oi(r),i=Array.from(rc).find(([,a])=>a.ctxName===t.ctxName);if(i){let a=i[0].split(":",1)[0];yn(He,{name:t.ctxName.toString()})?.removeCtxName(t.ctxName),console.log(`Removing integration context with ID ${a} and name ${t.ctxName}`),rc.delete(i[0])}rc.set(`${n}:${t.ctxName}`,t),await Iu();let s=He.find(a=>a.id===n);if(!s)throw new Error("Failed to create context");let o=await $s(s);return{ctxNames:s.ctxNames.map(a=>a.toString()),id:n,...await s.getFileTree(),settings:s.settings,active:!0,type:o.type}});te.onRequest("devicetree/removeContext",async({id:t,name:e})=>{await Ve(),rc.delete(`${t}:${e}`);let r=yn(He,{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 Iu()}});te.onRequest("devicetree/compiledDtsOutput",async t=>{if(await Ve(),!t)return;let e=yn(He,{id:t});if(!e)return;let r=await e.toFullString();return va({textDocument:{uri:ue(e.settings.dtsFile)},options:e.formattingOptions},r,"New Text").catch(()=>r)});te.onRequest("devicetree/serializedContext",async t=>{if(await Ve(),!t)return;let e=yn(He,{id:t}),r=performance.now();return e?.serialize().finally(()=>{console.info("serializedContext",performance.now()-r)})});te.onRequest("devicetree/activePath",async t=>{if(await Ve(),!ce)return;let e=r=>{if(r?.item)return r.item instanceof X?{nodePath:r.item.pathString}:{nodePath:r.item.parent.pathString,propertyName:r.item.name}};return(await Rt(t,ce,r=>[e(r)])).at(0)});te.onRequest("devicetree/customActions",async t=>(await Ve(),TB(t,ce)));te.onRequest("devicetree/activeFileUri",async t=>{await Ve(),ar({uri:t})});te.onRequest("devicetree/formattingText",async t=>{let e=Pe(t.textDocument.uri),r=Ou(e)??tn().getDocument(e,t.text),n=await va(t,r.getText(),"Both");return{text:n.text,diagnostics:n.diagnostic.map(i=>i.diagnostic())}});te.onRequest("devicetree/diagnosticIssues",async({uri:t,full:e})=>{await Ve();let r=Pe(t);ar({uri:r});let n=Cr(r);if(!n)return[];let i=e?(await n.getDiagnostics()).get(r):(await n.getSyntaxIssues(void 0,s=>Xs(s.raw,r,!!e)?s:void 0)).get(r);if(i?.length)return i});te.onRequest("devicetree/evalMacros",async({macros:t,ctxId:e})=>{await Ve();let r=yn(He,{id:e});return r?t.map(n=>{let i=yf(n,r.macros),s=Ce(i);return{macro:n,evaluated:typeof s=="number"?s:i}}):[]});
|