@zuplo/core 6.18.14 → 6.18.15
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/customer.cli.minified.js +1 -1
- package/index.minified.js +1 -1
- package/package.json +4 -4
package/customer.cli.minified.js
CHANGED
|
@@ -557,7 +557,7 @@ globstar while`,s,Z,l,Re,Ae),this.matchOne(s.slice(Z),l.slice(Re),_))return this
|
|
|
557
557
|
>>> no match, partial?`,s,Z,l,Re),Z===M))}let ke;if(typeof ne=="string"?(ke=se===ne,this.debug("string match",ne,se,ke)):(ke=ne.test(se),this.debug("pattern match",ne,se,ke)),!ke)return!1}if(D===M&&A===U)return!0;if(D===M)return _;if(A===U)return D===M-1&&s[D]==="";throw new Error("wtf?")}braceExpand(){return Rat(this.pattern,this.options)}parse(s){gH(s);let l=this.options;if(s==="**")return F0;if(s==="")return"";let _,m=null;(_=s.match(IQt))?m=l.dot?FQt:OQt:(_=s.match(TQt))?m=(l.nocase?l.dot?DQt:EQt:l.dot?CQt:xQt)(_[1]):(_=s.match(LQt))?m=(l.nocase?l.dot?MQt:RQt:l.dot?jQt:BQt)(_):(_=s.match(kQt))?m=l.dot?PQt:wQt:(_=s.match(AQt))&&(m=NQt);let b=XR.fromGlob(s,this.options).toMMPattern();return m&&typeof b=="object"&&Reflect.defineProperty(b,"test",{value:m}),b}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let s=this.set;if(!s.length)return this.regexp=!1,this.regexp;let l=this.options,_=l.noglobstar?JQt:l.dot?zQt:qQt,m=new Set(l.nocase?["i"]:[]),b=s.map(M=>{let U=M.map(ne=>{if(ne instanceof RegExp)for(let se of ne.flags.split(""))m.add(se);return typeof ne=="string"?KQt(ne):ne===F0?F0:ne._src});return U.forEach((ne,se)=>{let Z=U[se+1],Re=U[se-1];ne!==F0||Re===F0||(Re===void 0?Z!==void 0&&Z!==F0?U[se+1]="(?:\\/|"+_+"\\/)?"+Z:U[se]=_:Z===void 0?U[se-1]=Re+"(?:\\/|"+_+")?":Z!==F0&&(U[se-1]=Re+"(?:\\/|\\/"+_+"\\/)"+Z,U[se+1]=F0))}),U.filter(ne=>ne!==F0).join("/")}).join("|"),[D,A]=s.length>1?["(?:",")"]:["",""];b="^"+D+b+A+"$",this.negate&&(b="^(?!"+b+").+$");try{this.regexp=new RegExp(b,[...m].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(s){return this.preserveMultipleSlashes?s.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(s)?["",...s.split(/\/+/)]:s.split(/\/+/)}match(s,l=this.partial){if(this.debug("match",s,this.pattern),this.comment)return!1;if(this.empty)return s==="";if(s==="/"&&l)return!0;let _=this.options;this.isWindows&&(s=s.split("\\").join("/"));let m=this.slashSplit(s);this.debug(this.pattern,"split",m);let b=this.set;this.debug(this.pattern,"set",b);let D=m[m.length-1];if(!D)for(let A=m.length-2;!D&&A>=0;A--)D=m[A];for(let A=0;A<b.length;A++){let M=b[A],U=m;if(_.matchBase&&M.length===1&&(U=[D]),this.matchOne(U,M,l))return _.flipNegate?!0:!this.negate}return _.flipNegate?!1:this.negate}static defaults(s){return j1.defaults(s).Minimatch}};j1.AST=XR;j1.Minimatch=U2;j1.escape=QR;j1.unescape=kC;import{fileURLToPath as kZt}from"url";var ZR=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,jat=new Set,s6e=typeof process=="object"&&process?process:{},Bat=t((a,s,l,_)=>{typeof s6e.emitWarning=="function"?s6e.emitWarning(a,s,l,_):console.error(`[${l}] ${s}: ${a}`)},"emitWarning"),Pce=globalThis.AbortController,Mat=globalThis.AbortSignal;if(typeof Pce>"u"){Mat=class{static{t(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(_,m){this._onabort.push(m)}},Pce=class{static{t(this,"AbortController")}constructor(){s()}signal=new Mat;abort(_){if(!this.signal.aborted){this.signal.reason=_,this.signal.aborted=!0;for(let m of this.signal._onabort)m(_);this.signal.onabort?.(_)}}};let a=s6e.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",s=t(()=>{a&&(a=!1,Bat("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",s))},"warnACPolyfill")}var YQt=t(a=>!jat.has(a),"shouldWarn"),U6r=Symbol("type"),e3=t(a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),"isPosInt"),Uat=t(a=>e3(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?eM:null:null,"getUintArray"),eM=class extends Array{static{t(this,"ZeroArray")}constructor(s){super(s),this.fill(0)}},a6e=class a{static{t(this,"Stack")}heap;length;static#r=!1;static create(s){let l=Uat(s);if(!l)return[];a.#r=!0;let _=new a(s,l);return a.#r=!1,_}constructor(s,l){if(!a.#r)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new l(s),this.length=0}push(s){this.heap[this.length++]=s}pop(){return this.heap[--this.length]}},vH=class a{static{t(this,"LRUCache")}#r;#n;#e;#t;#s;#p;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#_;#c;#l;#i;#f;#v;#d;#u;#m;#g;#E;#x;#b;#k;#C;#y;static unsafeExposeInternals(s){return{starts:s.#x,ttls:s.#b,sizes:s.#E,keyMap:s.#c,keyList:s.#l,valList:s.#i,next:s.#f,prev:s.#v,get head(){return s.#d},get tail(){return s.#u},free:s.#m,isBackgroundFetch:t(l=>s.#h(l),"isBackgroundFetch"),backgroundFetch:t((l,_,m,b)=>s.#j(l,_,m,b),"backgroundFetch"),moveToTail:t(l=>s.#U(l),"moveToTail"),indexes:t(l=>s.#P(l),"indexes"),rindexes:t(l=>s.#A(l),"rindexes"),isStale:t(l=>s.#S(l),"isStale")}}get max(){return this.#r}get maxSize(){return this.#n}get calculatedSize(){return this.#_}get size(){return this.#a}get fetchMethod(){return this.#s}get memoMethod(){return this.#p}get dispose(){return this.#e}get disposeAfter(){return this.#t}constructor(s){let{max:l=0,ttl:_,ttlResolution:m=1,ttlAutopurge:b,updateAgeOnGet:D,updateAgeOnHas:A,allowStale:M,dispose:U,disposeAfter:ne,noDisposeOnSet:se,noUpdateTTL:Z,maxSize:Re=0,maxEntrySize:Ae=0,sizeCalculation:ke,fetchMethod:Ot,memoMethod:kt,noDeleteOnFetchRejection:br,noDeleteOnStaleGet:Kr,allowStaleOnFetchRejection:on,allowStaleOnFetchAbort:un,ignoreFetchAbort:hr}=s;if(l!==0&&!e3(l))throw new TypeError("max option must be a nonnegative integer");let mr=l?Uat(l):Array;if(!mr)throw new Error("invalid max value: "+l);if(this.#r=l,this.#n=Re,this.maxEntrySize=Ae||this.#n,this.sizeCalculation=ke,this.sizeCalculation){if(!this.#n&&!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(kt!==void 0&&typeof kt!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#p=kt,Ot!==void 0&&typeof Ot!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#s=Ot,this.#C=!!Ot,this.#c=new Map,this.#l=new Array(l).fill(void 0),this.#i=new Array(l).fill(void 0),this.#f=new mr(l),this.#v=new mr(l),this.#d=0,this.#u=0,this.#m=a6e.create(l),this.#a=0,this.#_=0,typeof U=="function"&&(this.#e=U),typeof ne=="function"?(this.#t=ne,this.#g=[]):(this.#t=void 0,this.#g=void 0),this.#k=!!this.#e,this.#y=!!this.#t,this.noDisposeOnSet=!!se,this.noUpdateTTL=!!Z,this.noDeleteOnFetchRejection=!!br,this.allowStaleOnFetchRejection=!!on,this.allowStaleOnFetchAbort=!!un,this.ignoreFetchAbort=!!hr,this.maxEntrySize!==0){if(this.#n!==0&&!e3(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!e3(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#T()}if(this.allowStale=!!M,this.noDeleteOnStaleGet=!!Kr,this.updateAgeOnGet=!!D,this.updateAgeOnHas=!!A,this.ttlResolution=e3(m)||m===0?m:1,this.ttlAutopurge=!!b,this.ttl=_||0,this.ttl){if(!e3(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#D()}if(this.#r===0&&this.ttl===0&&this.#n===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#r&&!this.#n){let Ds="LRU_CACHE_UNBOUNDED";YQt(Ds)&&(jat.add(Ds),Bat("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Ds,a))}}getRemainingTTL(s){return this.#c.has(s)?1/0:0}#D(){let s=new eM(this.#r),l=new eM(this.#r);this.#b=s,this.#x=l,this.#N=(b,D,A=ZR.now())=>{if(l[b]=D!==0?A:0,s[b]=D,D!==0&&this.ttlAutopurge){let M=setTimeout(()=>{this.#S(b)&&this.#O(this.#l[b],"expire")},D+1);M.unref&&M.unref()}},this.#w=b=>{l[b]=s[b]!==0?ZR.now():0},this.#o=(b,D)=>{if(s[D]){let A=s[D],M=l[D];if(!A||!M)return;b.ttl=A,b.start=M,b.now=_||m();let U=b.now-M;b.remainingTTL=A-U}};let _=0,m=t(()=>{let b=ZR.now();if(this.ttlResolution>0){_=b;let D=setTimeout(()=>_=0,this.ttlResolution);D.unref&&D.unref()}return b},"getNow");this.getRemainingTTL=b=>{let D=this.#c.get(b);if(D===void 0)return 0;let A=s[D],M=l[D];if(!A||!M)return 1/0;let U=(_||m())-M;return A-U},this.#S=b=>{let D=l[b],A=s[b];return!!A&&!!D&&(_||m())-D>A}}#w=t(()=>{},"#updateItemAge");#o=t(()=>{},"#statusTTL");#N=t(()=>{},"#setItemTTL");#S=t(()=>!1,"#isStale");#T(){let s=new eM(this.#r);this.#_=0,this.#E=s,this.#I=l=>{this.#_-=s[l],s[l]=0},this.#L=(l,_,m,b)=>{if(this.#h(_))return 0;if(!e3(m))if(b){if(typeof b!="function")throw new TypeError("sizeCalculation must be a function");if(m=b(_,l),!e3(m))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 m},this.#F=(l,_,m)=>{if(s[l]=_,this.#n){let b=this.#n-s[l];for(;this.#_>b;)this.#M(!0)}this.#_+=s[l],m&&(m.entrySize=_,m.totalCalculatedSize=this.#_)}}#I=t(s=>{},"#removeItemSize");#F=t((s,l,_)=>{},"#addItemSize");#L=t((s,l,_,m)=>{if(_||m)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#P({allowStale:s=this.allowStale}={}){if(this.#a)for(let l=this.#u;!(!this.#R(l)||((s||!this.#S(l))&&(yield l),l===this.#d));)l=this.#v[l]}*#A({allowStale:s=this.allowStale}={}){if(this.#a)for(let l=this.#d;!(!this.#R(l)||((s||!this.#S(l))&&(yield l),l===this.#u));)l=this.#f[l]}#R(s){return s!==void 0&&this.#c.get(this.#l[s])===s}*entries(){for(let s of this.#P())this.#i[s]!==void 0&&this.#l[s]!==void 0&&!this.#h(this.#i[s])&&(yield[this.#l[s],this.#i[s]])}*rentries(){for(let s of this.#A())this.#i[s]!==void 0&&this.#l[s]!==void 0&&!this.#h(this.#i[s])&&(yield[this.#l[s],this.#i[s]])}*keys(){for(let s of this.#P()){let l=this.#l[s];l!==void 0&&!this.#h(this.#i[s])&&(yield l)}}*rkeys(){for(let s of this.#A()){let l=this.#l[s];l!==void 0&&!this.#h(this.#i[s])&&(yield l)}}*values(){for(let s of this.#P())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}*rvalues(){for(let s of this.#A())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(s,l={}){for(let _ of this.#P()){let m=this.#i[_],b=this.#h(m)?m.__staleWhileFetching:m;if(b!==void 0&&s(b,this.#l[_],this))return this.get(this.#l[_],l)}}forEach(s,l=this){for(let _ of this.#P()){let m=this.#i[_],b=this.#h(m)?m.__staleWhileFetching:m;b!==void 0&&s.call(l,b,this.#l[_],this)}}rforEach(s,l=this){for(let _ of this.#A()){let m=this.#i[_],b=this.#h(m)?m.__staleWhileFetching:m;b!==void 0&&s.call(l,b,this.#l[_],this)}}purgeStale(){let s=!1;for(let l of this.#A({allowStale:!0}))this.#S(l)&&(this.#O(this.#l[l],"expire"),s=!0);return s}info(s){let l=this.#c.get(s);if(l===void 0)return;let _=this.#i[l],m=this.#h(_)?_.__staleWhileFetching:_;if(m===void 0)return;let b={value:m};if(this.#b&&this.#x){let D=this.#b[l],A=this.#x[l];if(D&&A){let M=D-(ZR.now()-A);b.ttl=M,b.start=Date.now()}}return this.#E&&(b.size=this.#E[l]),b}dump(){let s=[];for(let l of this.#P({allowStale:!0})){let _=this.#l[l],m=this.#i[l],b=this.#h(m)?m.__staleWhileFetching:m;if(b===void 0||_===void 0)continue;let D={value:b};if(this.#b&&this.#x){D.ttl=this.#b[l];let A=ZR.now()-this.#x[l];D.start=Math.floor(Date.now()-A)}this.#E&&(D.size=this.#E[l]),s.unshift([_,D])}return s}load(s){this.clear();for(let[l,_]of s){if(_.start){let m=Date.now()-_.start;_.start=ZR.now()-m}this.set(l,_.value,_)}}set(s,l,_={}){if(l===void 0)return this.delete(s),this;let{ttl:m=this.ttl,start:b,noDisposeOnSet:D=this.noDisposeOnSet,sizeCalculation:A=this.sizeCalculation,status:M}=_,{noUpdateTTL:U=this.noUpdateTTL}=_,ne=this.#L(s,l,_.size||0,A);if(this.maxEntrySize&&ne>this.maxEntrySize)return M&&(M.set="miss",M.maxEntrySizeExceeded=!0),this.#O(s,"set"),this;let se=this.#a===0?void 0:this.#c.get(s);if(se===void 0)se=this.#a===0?this.#u:this.#m.length!==0?this.#m.pop():this.#a===this.#r?this.#M(!1):this.#a,this.#l[se]=s,this.#i[se]=l,this.#c.set(s,se),this.#f[this.#u]=se,this.#v[se]=this.#u,this.#u=se,this.#a++,this.#F(se,ne,M),M&&(M.set="add"),U=!1;else{this.#U(se);let Z=this.#i[se];if(l!==Z){if(this.#C&&this.#h(Z)){Z.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Re}=Z;Re!==void 0&&!D&&(this.#k&&this.#e?.(Re,s,"set"),this.#y&&this.#g?.push([Re,s,"set"]))}else D||(this.#k&&this.#e?.(Z,s,"set"),this.#y&&this.#g?.push([Z,s,"set"]));if(this.#I(se),this.#F(se,ne,M),this.#i[se]=l,M){M.set="replace";let Re=Z&&this.#h(Z)?Z.__staleWhileFetching:Z;Re!==void 0&&(M.oldValue=Re)}}else M&&(M.set="update")}if(m!==0&&!this.#b&&this.#D(),this.#b&&(U||this.#N(se,m,b),M&&this.#o(M,se)),!D&&this.#y&&this.#g){let Z=this.#g,Re;for(;Re=Z?.shift();)this.#t?.(...Re)}return this}pop(){try{for(;this.#a;){let s=this.#i[this.#d];if(this.#M(!0),this.#h(s)){if(s.__staleWhileFetching)return s.__staleWhileFetching}else if(s!==void 0)return s}}finally{if(this.#y&&this.#g){let s=this.#g,l;for(;l=s?.shift();)this.#t?.(...l)}}}#M(s){let l=this.#d,_=this.#l[l],m=this.#i[l];return this.#C&&this.#h(m)?m.__abortController.abort(new Error("evicted")):(this.#k||this.#y)&&(this.#k&&this.#e?.(m,_,"evict"),this.#y&&this.#g?.push([m,_,"evict"])),this.#I(l),s&&(this.#l[l]=void 0,this.#i[l]=void 0,this.#m.push(l)),this.#a===1?(this.#d=this.#u=0,this.#m.length=0):this.#d=this.#f[l],this.#c.delete(_),this.#a--,l}has(s,l={}){let{updateAgeOnHas:_=this.updateAgeOnHas,status:m}=l,b=this.#c.get(s);if(b!==void 0){let D=this.#i[b];if(this.#h(D)&&D.__staleWhileFetching===void 0)return!1;if(this.#S(b))m&&(m.has="stale",this.#o(m,b));else return _&&this.#w(b),m&&(m.has="hit",this.#o(m,b)),!0}else m&&(m.has="miss");return!1}peek(s,l={}){let{allowStale:_=this.allowStale}=l,m=this.#c.get(s);if(m===void 0||!_&&this.#S(m))return;let b=this.#i[m];return this.#h(b)?b.__staleWhileFetching:b}#j(s,l,_,m){let b=l===void 0?void 0:this.#i[l];if(this.#h(b))return b;let D=new Pce,{signal:A}=_;A?.addEventListener("abort",()=>D.abort(A.reason),{signal:D.signal});let M={signal:D.signal,options:_,context:m},U=t((ke,Ot=!1)=>{let{aborted:kt}=D.signal,br=_.ignoreFetchAbort&&ke!==void 0;if(_.status&&(kt&&!Ot?(_.status.fetchAborted=!0,_.status.fetchError=D.signal.reason,br&&(_.status.fetchAbortIgnored=!0)):_.status.fetchResolved=!0),kt&&!br&&!Ot)return se(D.signal.reason);let Kr=Re;return this.#i[l]===Re&&(ke===void 0?Kr.__staleWhileFetching?this.#i[l]=Kr.__staleWhileFetching:this.#O(s,"fetch"):(_.status&&(_.status.fetchUpdated=!0),this.set(s,ke,M.options))),ke},"cb"),ne=t(ke=>(_.status&&(_.status.fetchRejected=!0,_.status.fetchError=ke),se(ke)),"eb"),se=t(ke=>{let{aborted:Ot}=D.signal,kt=Ot&&_.allowStaleOnFetchAbort,br=kt||_.allowStaleOnFetchRejection,Kr=br||_.noDeleteOnFetchRejection,on=Re;if(this.#i[l]===Re&&(!Kr||on.__staleWhileFetching===void 0?this.#O(s,"fetch"):kt||(this.#i[l]=on.__staleWhileFetching)),br)return _.status&&on.__staleWhileFetching!==void 0&&(_.status.returnedStale=!0),on.__staleWhileFetching;if(on.__returned===on)throw ke},"fetchFail"),Z=t((ke,Ot)=>{let kt=this.#s?.(s,b,M);kt&&kt instanceof Promise&&kt.then(br=>ke(br===void 0?void 0:br),Ot),D.signal.addEventListener("abort",()=>{(!_.ignoreFetchAbort||_.allowStaleOnFetchAbort)&&(ke(void 0),_.allowStaleOnFetchAbort&&(ke=t(br=>U(br,!0),"res")))})},"pcall");_.status&&(_.status.fetchDispatched=!0);let Re=new Promise(Z).then(U,ne),Ae=Object.assign(Re,{__abortController:D,__staleWhileFetching:b,__returned:void 0});return l===void 0?(this.set(s,Ae,{...M.options,status:void 0}),l=this.#c.get(s)):this.#i[l]=Ae,Ae}#h(s){if(!this.#C)return!1;let l=s;return!!l&&l instanceof Promise&&l.hasOwnProperty("__staleWhileFetching")&&l.__abortController instanceof Pce}async fetch(s,l={}){let{allowStale:_=this.allowStale,updateAgeOnGet:m=this.updateAgeOnGet,noDeleteOnStaleGet:b=this.noDeleteOnStaleGet,ttl:D=this.ttl,noDisposeOnSet:A=this.noDisposeOnSet,size:M=0,sizeCalculation:U=this.sizeCalculation,noUpdateTTL:ne=this.noUpdateTTL,noDeleteOnFetchRejection:se=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Z=this.allowStaleOnFetchRejection,ignoreFetchAbort:Re=this.ignoreFetchAbort,allowStaleOnFetchAbort:Ae=this.allowStaleOnFetchAbort,context:ke,forceRefresh:Ot=!1,status:kt,signal:br}=l;if(!this.#C)return kt&&(kt.fetch="get"),this.get(s,{allowStale:_,updateAgeOnGet:m,noDeleteOnStaleGet:b,status:kt});let Kr={allowStale:_,updateAgeOnGet:m,noDeleteOnStaleGet:b,ttl:D,noDisposeOnSet:A,size:M,sizeCalculation:U,noUpdateTTL:ne,noDeleteOnFetchRejection:se,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:Ae,ignoreFetchAbort:Re,status:kt,signal:br},on=this.#c.get(s);if(on===void 0){kt&&(kt.fetch="miss");let un=this.#j(s,on,Kr,ke);return un.__returned=un}else{let un=this.#i[on];if(this.#h(un)){let Po=_&&un.__staleWhileFetching!==void 0;return kt&&(kt.fetch="inflight",Po&&(kt.returnedStale=!0)),Po?un.__staleWhileFetching:un.__returned=un}let hr=this.#S(on);if(!Ot&&!hr)return kt&&(kt.fetch="hit"),this.#U(on),m&&this.#w(on),kt&&this.#o(kt,on),un;let mr=this.#j(s,on,Kr,ke),Pi=mr.__staleWhileFetching!==void 0&&_;return kt&&(kt.fetch=hr?"stale":"refresh",Pi&&hr&&(kt.returnedStale=!0)),Pi?mr.__staleWhileFetching:mr.__returned=mr}}async forceFetch(s,l={}){let _=await this.fetch(s,l);if(_===void 0)throw new Error("fetch() returned undefined");return _}memo(s,l={}){let _=this.#p;if(!_)throw new Error("no memoMethod provided to constructor");let{context:m,forceRefresh:b,...D}=l,A=this.get(s,D);if(!b&&A!==void 0)return A;let M=_(s,A,{options:D,context:m});return this.set(s,M,D),M}get(s,l={}){let{allowStale:_=this.allowStale,updateAgeOnGet:m=this.updateAgeOnGet,noDeleteOnStaleGet:b=this.noDeleteOnStaleGet,status:D}=l,A=this.#c.get(s);if(A!==void 0){let M=this.#i[A],U=this.#h(M);return D&&this.#o(D,A),this.#S(A)?(D&&(D.get="stale"),U?(D&&_&&M.__staleWhileFetching!==void 0&&(D.returnedStale=!0),_?M.__staleWhileFetching:void 0):(b||this.#O(s,"expire"),D&&_&&(D.returnedStale=!0),_?M:void 0)):(D&&(D.get="hit"),U?M.__staleWhileFetching:(this.#U(A),m&&this.#w(A),M))}else D&&(D.get="miss")}#B(s,l){this.#v[l]=s,this.#f[s]=l}#U(s){s!==this.#u&&(s===this.#d?this.#d=this.#f[s]:this.#B(this.#v[s],this.#f[s]),this.#B(this.#u,s),this.#u=s)}delete(s){return this.#O(s,"delete")}#O(s,l){let _=!1;if(this.#a!==0){let m=this.#c.get(s);if(m!==void 0)if(_=!0,this.#a===1)this.#$(l);else{this.#I(m);let b=this.#i[m];if(this.#h(b)?b.__abortController.abort(new Error("deleted")):(this.#k||this.#y)&&(this.#k&&this.#e?.(b,s,l),this.#y&&this.#g?.push([b,s,l])),this.#c.delete(s),this.#l[m]=void 0,this.#i[m]=void 0,m===this.#u)this.#u=this.#v[m];else if(m===this.#d)this.#d=this.#f[m];else{let D=this.#v[m];this.#f[D]=this.#f[m];let A=this.#f[m];this.#v[A]=this.#v[m]}this.#a--,this.#m.push(m)}}if(this.#y&&this.#g?.length){let m=this.#g,b;for(;b=m?.shift();)this.#t?.(...b)}return _}clear(){return this.#$("delete")}#$(s){for(let l of this.#A({allowStale:!0})){let _=this.#i[l];if(this.#h(_))_.__abortController.abort(new Error("deleted"));else{let m=this.#l[l];this.#k&&this.#e?.(_,m,s),this.#y&&this.#g?.push([_,m,s])}}if(this.#c.clear(),this.#i.fill(void 0),this.#l.fill(void 0),this.#b&&this.#x&&(this.#b.fill(0),this.#x.fill(0)),this.#E&&this.#E.fill(0),this.#d=0,this.#u=0,this.#m.length=0,this.#_=0,this.#a=0,this.#y&&this.#g){let l=this.#g,_;for(;_=l?.shift();)this.#t?.(..._)}}};import{posix as oZt,win32 as h6e}from"path";import{fileURLToPath as cZt}from"url";import{lstatSync as lZt,readdir as uZt,readdirSync as fZt,readlinkSync as _Zt,realpathSync as pZt}from"fs";import*as dZt from"fs";import{lstat as hZt,readdir as gZt,readlink as yZt,realpath as vZt}from"fs/promises";import{EventEmitter as p6e}from"events";import Vat from"stream";import{StringDecoder as XQt}from"string_decoder";var $at=typeof process=="object"&&process?process:{stdout:null,stderr:null},QQt=t(a=>!!a&&typeof a=="object"&&(a instanceof r3||a instanceof Vat||ZQt(a)||eZt(a)),"isStream"),ZQt=t(a=>!!a&&typeof a=="object"&&a instanceof p6e&&typeof a.pipe=="function"&&a.pipe!==Vat.Writable.prototype.pipe,"isReadable"),eZt=t(a=>!!a&&typeof a=="object"&&a instanceof p6e&&typeof a.write=="function"&&typeof a.end=="function","isWritable"),HP=Symbol("EOF"),GP=Symbol("maybeEmitEnd"),t3=Symbol("emittedEnd"),Ace=Symbol("emittingEnd"),bH=Symbol("emittedError"),Nce=Symbol("closed"),Jat=Symbol("read"),Ice=Symbol("flush"),zat=Symbol("flushChunk"),wC=Symbol("encoding"),tM=Symbol("decoder"),Gg=Symbol("flowing"),SH=Symbol("paused"),rM=Symbol("resume"),Kg=Symbol("buffer"),B1=Symbol("pipes"),Yg=Symbol("bufferLength"),o6e=Symbol("bufferPush"),Oce=Symbol("bufferShift"),Ny=Symbol("objectMode"),Gm=Symbol("destroyed"),c6e=Symbol("error"),l6e=Symbol("emitData"),qat=Symbol("emitEnd"),u6e=Symbol("emitEnd2"),HD=Symbol("async"),f6e=Symbol("abort"),Fce=Symbol("aborted"),TH=Symbol("signal"),bO=Symbol("dataListeners"),$2=Symbol("discarded"),xH=t(a=>Promise.resolve().then(a),"defer"),tZt=t(a=>a(),"nodefer"),rZt=t(a=>a==="end"||a==="finish"||a==="prefinish","isEndish"),nZt=t(a=>a instanceof ArrayBuffer||!!a&&typeof a=="object"&&a.constructor&&a.constructor.name==="ArrayBuffer"&&a.byteLength>=0,"isArrayBufferLike"),iZt=t(a=>!Buffer.isBuffer(a)&&ArrayBuffer.isView(a),"isArrayBufferView"),Lce=class{static{t(this,"Pipe")}src;dest;opts;ondrain;constructor(s,l,_){this.src=s,this.dest=l,this.opts=_,this.ondrain=()=>s[rM](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(s){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},_6e=class extends Lce{static{t(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(s,l,_){super(s,l,_),this.proxyErrors=m=>l.emit("error",m),s.on("error",this.proxyErrors)}},sZt=t(a=>!!a.objectMode,"isObjectModeOptions"),aZt=t(a=>!a.objectMode&&!!a.encoding&&a.encoding!=="buffer","isEncodingOptions"),r3=class extends p6e{static{t(this,"Minipass")}[Gg]=!1;[SH]=!1;[B1]=[];[Kg]=[];[Ny];[wC];[HD];[tM];[HP]=!1;[t3]=!1;[Ace]=!1;[Nce]=!1;[bH]=null;[Yg]=0;[Gm]=!1;[TH];[Fce]=!1;[bO]=0;[$2]=!1;writable=!0;readable=!0;constructor(...s){let l=s[0]||{};if(super(),l.objectMode&&typeof l.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");sZt(l)?(this[Ny]=!0,this[wC]=null):aZt(l)?(this[wC]=l.encoding,this[Ny]=!1):(this[Ny]=!1,this[wC]=null),this[HD]=!!l.async,this[tM]=this[wC]?new XQt(this[wC]):null,l&&l.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:t(()=>this[Kg],"get")}),l&&l.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:t(()=>this[B1],"get")});let{signal:_}=l;_&&(this[TH]=_,_.aborted?this[f6e]():_.addEventListener("abort",()=>this[f6e]()))}get bufferLength(){return this[Yg]}get encoding(){return this[wC]}set encoding(s){throw new Error("Encoding must be set at instantiation time")}setEncoding(s){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Ny]}set objectMode(s){throw new Error("objectMode must be set at instantiation time")}get async(){return this[HD]}set async(s){this[HD]=this[HD]||!!s}[f6e](){this[Fce]=!0,this.emit("abort",this[TH]?.reason),this.destroy(this[TH]?.reason)}get aborted(){return this[Fce]}set aborted(s){}write(s,l,_){if(this[Fce])return!1;if(this[HP])throw new Error("write after end");if(this[Gm])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof l=="function"&&(_=l,l="utf8"),l||(l="utf8");let m=this[HD]?xH:tZt;if(!this[Ny]&&!Buffer.isBuffer(s)){if(iZt(s))s=Buffer.from(s.buffer,s.byteOffset,s.byteLength);else if(nZt(s))s=Buffer.from(s);else if(typeof s!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Ny]?(this[Gg]&&this[Yg]!==0&&this[Ice](!0),this[Gg]?this.emit("data",s):this[o6e](s),this[Yg]!==0&&this.emit("readable"),_&&m(_),this[Gg]):s.length?(typeof s=="string"&&!(l===this[wC]&&!this[tM]?.lastNeed)&&(s=Buffer.from(s,l)),Buffer.isBuffer(s)&&this[wC]&&(s=this[tM].write(s)),this[Gg]&&this[Yg]!==0&&this[Ice](!0),this[Gg]?this.emit("data",s):this[o6e](s),this[Yg]!==0&&this.emit("readable"),_&&m(_),this[Gg]):(this[Yg]!==0&&this.emit("readable"),_&&m(_),this[Gg])}read(s){if(this[Gm])return null;if(this[$2]=!1,this[Yg]===0||s===0||s&&s>this[Yg])return this[GP](),null;this[Ny]&&(s=null),this[Kg].length>1&&!this[Ny]&&(this[Kg]=[this[wC]?this[Kg].join(""):Buffer.concat(this[Kg],this[Yg])]);let l=this[Jat](s||null,this[Kg][0]);return this[GP](),l}[Jat](s,l){if(this[Ny])this[Oce]();else{let _=l;s===_.length||s===null?this[Oce]():typeof _=="string"?(this[Kg][0]=_.slice(s),l=_.slice(0,s),this[Yg]-=s):(this[Kg][0]=_.subarray(s),l=_.subarray(0,s),this[Yg]-=s)}return this.emit("data",l),!this[Kg].length&&!this[HP]&&this.emit("drain"),l}end(s,l,_){return typeof s=="function"&&(_=s,s=void 0),typeof l=="function"&&(_=l,l="utf8"),s!==void 0&&this.write(s,l),_&&this.once("end",_),this[HP]=!0,this.writable=!1,(this[Gg]||!this[SH])&&this[GP](),this}[rM](){this[Gm]||(!this[bO]&&!this[B1].length&&(this[$2]=!0),this[SH]=!1,this[Gg]=!0,this.emit("resume"),this[Kg].length?this[Ice]():this[HP]?this[GP]():this.emit("drain"))}resume(){return this[rM]()}pause(){this[Gg]=!1,this[SH]=!0,this[$2]=!1}get destroyed(){return this[Gm]}get flowing(){return this[Gg]}get paused(){return this[SH]}[o6e](s){this[Ny]?this[Yg]+=1:this[Yg]+=s.length,this[Kg].push(s)}[Oce](){return this[Ny]?this[Yg]-=1:this[Yg]-=this[Kg][0].length,this[Kg].shift()}[Ice](s=!1){do;while(this[zat](this[Oce]())&&this[Kg].length);!s&&!this[Kg].length&&!this[HP]&&this.emit("drain")}[zat](s){return this.emit("data",s),this[Gg]}pipe(s,l){if(this[Gm])return s;this[$2]=!1;let _=this[t3];return l=l||{},s===$at.stdout||s===$at.stderr?l.end=!1:l.end=l.end!==!1,l.proxyErrors=!!l.proxyErrors,_?l.end&&s.end():(this[B1].push(l.proxyErrors?new _6e(this,s,l):new Lce(this,s,l)),this[HD]?xH(()=>this[rM]()):this[rM]()),s}unpipe(s){let l=this[B1].find(_=>_.dest===s);l&&(this[B1].length===1?(this[Gg]&&this[bO]===0&&(this[Gg]=!1),this[B1]=[]):this[B1].splice(this[B1].indexOf(l),1),l.unpipe())}addListener(s,l){return this.on(s,l)}on(s,l){let _=super.on(s,l);if(s==="data")this[$2]=!1,this[bO]++,!this[B1].length&&!this[Gg]&&this[rM]();else if(s==="readable"&&this[Yg]!==0)super.emit("readable");else if(rZt(s)&&this[t3])super.emit(s),this.removeAllListeners(s);else if(s==="error"&&this[bH]){let m=l;this[HD]?xH(()=>m.call(this,this[bH])):m.call(this,this[bH])}return _}removeListener(s,l){return this.off(s,l)}off(s,l){let _=super.off(s,l);return s==="data"&&(this[bO]=this.listeners("data").length,this[bO]===0&&!this[$2]&&!this[B1].length&&(this[Gg]=!1)),_}removeAllListeners(s){let l=super.removeAllListeners(s);return(s==="data"||s===void 0)&&(this[bO]=0,!this[$2]&&!this[B1].length&&(this[Gg]=!1)),l}get emittedEnd(){return this[t3]}[GP](){!this[Ace]&&!this[t3]&&!this[Gm]&&this[Kg].length===0&&this[HP]&&(this[Ace]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Nce]&&this.emit("close"),this[Ace]=!1)}emit(s,...l){let _=l[0];if(s!=="error"&&s!=="close"&&s!==Gm&&this[Gm])return!1;if(s==="data")return!this[Ny]&&!_?!1:this[HD]?(xH(()=>this[l6e](_)),!0):this[l6e](_);if(s==="end")return this[qat]();if(s==="close"){if(this[Nce]=!0,!this[t3]&&!this[Gm])return!1;let b=super.emit("close");return this.removeAllListeners("close"),b}else if(s==="error"){this[bH]=_,super.emit(c6e,_);let b=!this[TH]||this.listeners("error").length?super.emit("error",_):!1;return this[GP](),b}else if(s==="resume"){let b=super.emit("resume");return this[GP](),b}else if(s==="finish"||s==="prefinish"){let b=super.emit(s);return this.removeAllListeners(s),b}let m=super.emit(s,...l);return this[GP](),m}[l6e](s){for(let _ of this[B1])_.dest.write(s)===!1&&this.pause();let l=this[$2]?!1:super.emit("data",s);return this[GP](),l}[qat](){return this[t3]?!1:(this[t3]=!0,this.readable=!1,this[HD]?(xH(()=>this[u6e]()),!0):this[u6e]())}[u6e](){if(this[tM]){let l=this[tM].end();if(l){for(let _ of this[B1])_.dest.write(l);this[$2]||super.emit("data",l)}}for(let l of this[B1])l.end();let s=super.emit("end");return this.removeAllListeners("end"),s}async collect(){let s=Object.assign([],{dataLength:0});this[Ny]||(s.dataLength=0);let l=this.promise();return this.on("data",_=>{s.push(_),this[Ny]||(s.dataLength+=_.length)}),await l,s}async concat(){if(this[Ny])throw new Error("cannot concat in objectMode");let s=await this.collect();return this[wC]?s.join(""):Buffer.concat(s,s.dataLength)}async promise(){return new Promise((s,l)=>{this.on(Gm,()=>l(new Error("stream destroyed"))),this.on("error",_=>l(_)),this.on("end",()=>s())})}[Symbol.asyncIterator](){this[$2]=!1;let s=!1,l=t(async()=>(this.pause(),s=!0,{value:void 0,done:!0}),"stop");return{next:t(()=>{if(s)return l();let m=this.read();if(m!==null)return Promise.resolve({done:!1,value:m});if(this[HP])return l();let b,D,A=t(se=>{this.off("data",M),this.off("end",U),this.off(Gm,ne),l(),D(se)},"onerr"),M=t(se=>{this.off("error",A),this.off("end",U),this.off(Gm,ne),this.pause(),b({value:se,done:!!this[HP]})},"ondata"),U=t(()=>{this.off("error",A),this.off("data",M),this.off(Gm,ne),l(),b({done:!0,value:void 0})},"onend"),ne=t(()=>A(new Error("stream destroyed")),"ondestroy");return new Promise((se,Z)=>{D=Z,b=se,this.once(Gm,ne),this.once("error",A),this.once("end",U),this.once("data",M)})},"next"),throw:l,return:l,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[$2]=!1;let s=!1,l=t(()=>(this.pause(),this.off(c6e,l),this.off(Gm,l),this.off("end",l),s=!0,{done:!0,value:void 0}),"stop"),_=t(()=>{if(s)return l();let m=this.read();return m===null?l():{done:!1,value:m}},"next");return this.once("end",l),this.once(c6e,l),this.once(Gm,l),{next:_,throw:l,return:l,[Symbol.iterator](){return this}}}destroy(s){if(this[Gm])return s?this.emit("error",s):this.emit(Gm),this;this[Gm]=!0,this[$2]=!0,this[Kg].length=0,this[Yg]=0;let l=this;return typeof l.close=="function"&&!this[Nce]&&l.close(),s?this.emit("error",s):this.emit(Gm),this}static get isStream(){return QQt}};var mZt=pZt.native,EH={lstatSync:lZt,readdir:uZt,readdirSync:fZt,readlinkSync:_Zt,realpathSync:mZt,promises:{lstat:hZt,readdir:gZt,readlink:yZt,realpath:vZt}},Yat=t(a=>!a||a===EH||a===dZt?EH:{...EH,...a,promises:{...EH.promises,...a.promises||{}}},"fsFromOption"),Xat=/^\\\\\?\\([a-z]:)\\?$/i,bZt=t(a=>a.replace(/\//g,"\\").replace(Xat,"$1\\"),"uncToDrive"),SZt=/[\\\/]/,ST=0,Qat=1,Zat=2,GD=4,eot=6,tot=8,SO=10,rot=12,bT=15,CH=~bT,d6e=16,Wat=32,DH=64,PC=128,Rce=256,jce=512,Hat=DH|PC|jce,TZt=1023,m6e=t(a=>a.isFile()?tot:a.isDirectory()?GD:a.isSymbolicLink()?SO:a.isCharacterDevice()?Zat:a.isBlockDevice()?eot:a.isSocket()?rot:a.isFIFO()?Qat:ST,"entToType"),Gat=new Map,kH=t(a=>{let s=Gat.get(a);if(s)return s;let l=a.normalize("NFKD");return Gat.set(a,l),l},"normalize"),Kat=new Map,Mce=t(a=>{let s=Kat.get(a);if(s)return s;let l=kH(a.toLowerCase());return Kat.set(a,l),l},"normalizeNocase"),Bce=class extends vH{static{t(this,"ResolveCache")}constructor(){super({max:256})}},g6e=class extends vH{static{t(this,"ChildrenCache")}constructor(s=16*1024){super({maxSize:s,sizeCalculation:t(l=>l.length+1,"sizeCalculation")})}},not=Symbol("PathScurry setAsCwd"),Iy=class{static{t(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#r;#n;get dev(){return this.#n}#e;get mode(){return this.#e}#t;get nlink(){return this.#t}#s;get uid(){return this.#s}#p;get gid(){return this.#p}#a;get rdev(){return this.#a}#_;get blksize(){return this.#_}#c;get ino(){return this.#c}#l;get size(){return this.#l}#i;get blocks(){return this.#i}#f;get atimeMs(){return this.#f}#v;get mtimeMs(){return this.#v}#d;get ctimeMs(){return this.#d}#u;get birthtimeMs(){return this.#u}#m;get atime(){return this.#m}#g;get mtime(){return this.#g}#E;get ctime(){return this.#E}#x;get birthtime(){return this.#x}#b;#k;#C;#y;#D;#w;#o;#N;#S;#T;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(s,l=ST,_,m,b,D,A){this.name=s,this.#b=b?Mce(s):kH(s),this.#o=l&TZt,this.nocase=b,this.roots=m,this.root=_||this,this.#N=D,this.#C=A.fullpath,this.#D=A.relative,this.#w=A.relativePosix,this.parent=A.parent,this.parent?this.#r=this.parent.#r:this.#r=Yat(A.fs)}depth(){return this.#k!==void 0?this.#k:this.parent?this.#k=this.parent.depth()+1:this.#k=0}childrenCache(){return this.#N}resolve(s){if(!s)return this;let l=this.getRootString(s),m=s.substring(l.length).split(this.splitSep);return l?this.getRoot(l).#I(m):this.#I(m)}#I(s){let l=this;for(let _ of s)l=l.child(_);return l}children(){let s=this.#N.get(this);if(s)return s;let l=Object.assign([],{provisional:0});return this.#N.set(this,l),this.#o&=~d6e,l}child(s,l){if(s===""||s===".")return this;if(s==="..")return this.parent||this;let _=this.children(),m=this.nocase?Mce(s):kH(s);for(let M of _)if(M.#b===m)return M;let b=this.parent?this.sep:"",D=this.#C?this.#C+b+s:void 0,A=this.newChild(s,ST,{...l,parent:this,fullpath:D});return this.canReaddir()||(A.#o|=PC),_.push(A),A}relative(){if(this.isCWD)return"";if(this.#D!==void 0)return this.#D;let s=this.name,l=this.parent;if(!l)return this.#D=this.name;let _=l.relative();return _+(!_||!l.parent?"":this.sep)+s}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let s=this.name,l=this.parent;if(!l)return this.#w=this.fullpathPosix();let _=l.relativePosix();return _+(!_||!l.parent?"":"/")+s}fullpath(){if(this.#C!==void 0)return this.#C;let s=this.name,l=this.parent;if(!l)return this.#C=this.name;let m=l.fullpath()+(l.parent?this.sep:"")+s;return this.#C=m}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let m=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(m)?this.#y=`//?/${m}`:this.#y=m}let s=this.parent,l=s.fullpathPosix(),_=l+(!l||!s.parent?"":"/")+this.name;return this.#y=_}isUnknown(){return(this.#o&bT)===ST}isType(s){return this[`is${s}`]()}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.#o&bT)===tot}isDirectory(){return(this.#o&bT)===GD}isCharacterDevice(){return(this.#o&bT)===Zat}isBlockDevice(){return(this.#o&bT)===eot}isFIFO(){return(this.#o&bT)===Qat}isSocket(){return(this.#o&bT)===rot}isSymbolicLink(){return(this.#o&SO)===SO}lstatCached(){return this.#o&Wat?this:void 0}readlinkCached(){return this.#S}realpathCached(){return this.#T}readdirCached(){let s=this.children();return s.slice(0,s.provisional)}canReadlink(){if(this.#S)return!0;if(!this.parent)return!1;let s=this.#o&bT;return!(s!==ST&&s!==SO||this.#o&Rce||this.#o&PC)}calledReaddir(){return!!(this.#o&d6e)}isENOENT(){return!!(this.#o&PC)}isNamed(s){return this.nocase?this.#b===Mce(s):this.#b===kH(s)}async readlink(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let l=await this.#r.promises.readlink(this.fullpath()),_=(await this.parent.realpath())?.resolve(l);if(_)return this.#S=_}catch(l){this.#h(l.code);return}}readlinkSync(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let l=this.#r.readlinkSync(this.fullpath()),_=this.parent.realpathSync()?.resolve(l);if(_)return this.#S=_}catch(l){this.#h(l.code);return}}#F(s){this.#o|=d6e;for(let l=s.provisional;l<s.length;l++){let _=s[l];_&&_.#L()}}#L(){this.#o&PC||(this.#o=(this.#o|PC)&CH,this.#P())}#P(){let s=this.children();s.provisional=0;for(let l of s)l.#L()}#A(){this.#o|=jce,this.#R()}#R(){if(this.#o&DH)return;let s=this.#o;(s&bT)===GD&&(s&=CH),this.#o=s|DH,this.#P()}#M(s=""){s==="ENOTDIR"||s==="EPERM"?this.#R():s==="ENOENT"?this.#L():this.children().provisional=0}#j(s=""){s==="ENOTDIR"?this.parent.#R():s==="ENOENT"&&this.#L()}#h(s=""){let l=this.#o;l|=Rce,s==="ENOENT"&&(l|=PC),(s==="EINVAL"||s==="UNKNOWN")&&(l&=CH),this.#o=l,s==="ENOTDIR"&&this.parent&&this.parent.#R()}#B(s,l){return this.#O(s,l)||this.#U(s,l)}#U(s,l){let _=m6e(s),m=this.newChild(s.name,_,{parent:this}),b=m.#o&bT;return b!==GD&&b!==SO&&b!==ST&&(m.#o|=DH),l.unshift(m),l.provisional++,m}#O(s,l){for(let _=l.provisional;_<l.length;_++){let m=l[_];if((this.nocase?Mce(s.name):kH(s.name))===m.#b)return this.#$(s,m,_,l)}}#$(s,l,_,m){let b=l.name;return l.#o=l.#o&CH|m6e(s),b!==s.name&&(l.name=s.name),_!==m.provisional&&(_===m.length-1?m.pop():m.splice(_,1),m.unshift(l)),m.provisional++,l}async lstat(){if(!(this.#o&PC))try{return this.#V(await this.#r.promises.lstat(this.fullpath())),this}catch(s){this.#j(s.code)}}lstatSync(){if(!(this.#o&PC))try{return this.#V(this.#r.lstatSync(this.fullpath())),this}catch(s){this.#j(s.code)}}#V(s){let{atime:l,atimeMs:_,birthtime:m,birthtimeMs:b,blksize:D,blocks:A,ctime:M,ctimeMs:U,dev:ne,gid:se,ino:Z,mode:Re,mtime:Ae,mtimeMs:ke,nlink:Ot,rdev:kt,size:br,uid:Kr}=s;this.#m=l,this.#f=_,this.#x=m,this.#u=b,this.#_=D,this.#i=A,this.#E=M,this.#d=U,this.#n=ne,this.#p=se,this.#c=Z,this.#e=Re,this.#g=Ae,this.#v=ke,this.#t=Ot,this.#a=kt,this.#l=br,this.#s=Kr;let on=m6e(s);this.#o=this.#o&CH|on|Wat,on!==ST&&on!==GD&&on!==SO&&(this.#o|=DH)}#z=[];#q=!1;#W(s){this.#q=!1;let l=this.#z.slice();this.#z.length=0,l.forEach(_=>_(null,s))}readdirCB(s,l=!1){if(!this.canReaddir()){l?s(null,[]):queueMicrotask(()=>s(null,[]));return}let _=this.children();if(this.calledReaddir()){let b=_.slice(0,_.provisional);l?s(null,b):queueMicrotask(()=>s(null,b));return}if(this.#z.push(s),this.#q)return;this.#q=!0;let m=this.fullpath();this.#r.readdir(m,{withFileTypes:!0},(b,D)=>{if(b)this.#M(b.code),_.provisional=0;else{for(let A of D)this.#B(A,_);this.#F(_)}this.#W(_.slice(0,_.provisional))})}#J;async readdir(){if(!this.canReaddir())return[];let s=this.children();if(this.calledReaddir())return s.slice(0,s.provisional);let l=this.fullpath();if(this.#J)await this.#J;else{let _=t(()=>{},"resolve");this.#J=new Promise(m=>_=m);try{for(let m of await this.#r.promises.readdir(l,{withFileTypes:!0}))this.#B(m,s);this.#F(s)}catch(m){this.#M(m.code),s.provisional=0}this.#J=void 0,_()}return s.slice(0,s.provisional)}readdirSync(){if(!this.canReaddir())return[];let s=this.children();if(this.calledReaddir())return s.slice(0,s.provisional);let l=this.fullpath();try{for(let _ of this.#r.readdirSync(l,{withFileTypes:!0}))this.#B(_,s);this.#F(s)}catch(_){this.#M(_.code),s.provisional=0}return s.slice(0,s.provisional)}canReaddir(){if(this.#o&Hat)return!1;let s=bT&this.#o;return s===ST||s===GD||s===SO}shouldWalk(s,l){return(this.#o&GD)===GD&&!(this.#o&Hat)&&!s.has(this)&&(!l||l(this))}async realpath(){if(this.#T)return this.#T;if(!((jce|Rce|PC)&this.#o))try{let s=await this.#r.promises.realpath(this.fullpath());return this.#T=this.resolve(s)}catch{this.#A()}}realpathSync(){if(this.#T)return this.#T;if(!((jce|Rce|PC)&this.#o))try{let s=this.#r.realpathSync(this.fullpath());return this.#T=this.resolve(s)}catch{this.#A()}}[not](s){if(s===this)return;s.isCWD=!1,this.isCWD=!0;let l=new Set([]),_=[],m=this;for(;m&&m.parent;)l.add(m),m.#D=_.join(this.sep),m.#w=_.join("/"),m=m.parent,_.push("..");for(m=s;m&&m.parent&&!l.has(m);)m.#D=void 0,m.#w=void 0,m=m.parent}},Uce=class a extends Iy{static{t(this,"PathWin32")}sep="\\";splitSep=SZt;constructor(s,l=ST,_,m,b,D,A){super(s,l,_,m,b,D,A)}newChild(s,l=ST,_={}){return new a(s,l,this.root,this.roots,this.nocase,this.childrenCache(),_)}getRootString(s){return h6e.parse(s).root}getRoot(s){if(s=bZt(s.toUpperCase()),s===this.root.name)return this.root;for(let[l,_]of Object.entries(this.roots))if(this.sameRoot(s,l))return this.roots[s]=_;return this.roots[s]=new nM(s,this).root}sameRoot(s,l=this.root.name){return s=s.toUpperCase().replace(/\//g,"\\").replace(Xat,"$1\\"),s===l}},$ce=class a extends Iy{static{t(this,"PathPosix")}splitSep="/";sep="/";constructor(s,l=ST,_,m,b,D,A){super(s,l,_,m,b,D,A)}getRootString(s){return s.startsWith("/")?"/":""}getRoot(s){return this.root}newChild(s,l=ST,_={}){return new a(s,l,this.root,this.roots,this.nocase,this.childrenCache(),_)}},Jce=class{static{t(this,"PathScurryBase")}root;rootPath;roots;cwd;#r;#n;#e;nocase;#t;constructor(s=process.cwd(),l,_,{nocase:m,childrenCacheSize:b=16*1024,fs:D=EH}={}){this.#t=Yat(D),(s instanceof URL||s.startsWith("file://"))&&(s=cZt(s));let A=l.resolve(s);this.roots=Object.create(null),this.rootPath=this.parseRootPath(A),this.#r=new Bce,this.#n=new Bce,this.#e=new g6e(b);let M=A.substring(this.rootPath.length).split(_);if(M.length===1&&!M[0]&&M.pop(),m===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=m,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let U=this.root,ne=M.length-1,se=l.sep,Z=this.rootPath,Re=!1;for(let Ae of M){let ke=ne--;U=U.child(Ae,{relative:new Array(ke).fill("..").join(se),relativePosix:new Array(ke).fill("..").join("/"),fullpath:Z+=(Re?"":se)+Ae}),Re=!0}this.cwd=U}depth(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.depth()}childrenCache(){return this.#e}resolve(...s){let l="";for(let b=s.length-1;b>=0;b--){let D=s[b];if(!(!D||D===".")&&(l=l?`${D}/${l}`:D,this.isAbsolute(D)))break}let _=this.#r.get(l);if(_!==void 0)return _;let m=this.cwd.resolve(l).fullpath();return this.#r.set(l,m),m}resolvePosix(...s){let l="";for(let b=s.length-1;b>=0;b--){let D=s[b];if(!(!D||D===".")&&(l=l?`${D}/${l}`:D,this.isAbsolute(D)))break}let _=this.#n.get(l);if(_!==void 0)return _;let m=this.cwd.resolve(l).fullpathPosix();return this.#n.set(l,m),m}relative(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.relative()}relativePosix(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.relativePosix()}basename(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.name}dirname(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),(s.parent||s).fullpath()}async readdir(s=this.cwd,l={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_}=l;if(s.canReaddir()){let m=await s.readdir();return _?m:m.map(b=>b.name)}else return[]}readdirSync(s=this.cwd,l={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0}=l;return s.canReaddir()?_?s.readdirSync():s.readdirSync().map(m=>m.name):[]}async lstat(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.lstat()}lstatSync(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.lstatSync()}async readlink(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s.withFileTypes,s=this.cwd);let _=await s.readlink();return l?_:_?.fullpath()}readlinkSync(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s.withFileTypes,s=this.cwd);let _=s.readlinkSync();return l?_:_?.fullpath()}async realpath(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s.withFileTypes,s=this.cwd);let _=await s.realpath();return l?_:_?.fullpath()}realpathSync(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s.withFileTypes,s=this.cwd);let _=s.realpathSync();return l?_:_?.fullpath()}async walk(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l,A=[];(!b||b(s))&&A.push(_?s:s.fullpath());let M=new Set,U=t((se,Z)=>{M.add(se),se.readdirCB((Re,Ae)=>{if(Re)return Z(Re);let ke=Ae.length;if(!ke)return Z();let Ot=t(()=>{--ke===0&&Z()},"next");for(let kt of Ae)(!b||b(kt))&&A.push(_?kt:kt.fullpath()),m&&kt.isSymbolicLink()?kt.realpath().then(br=>br?.isUnknown()?br.lstat():br).then(br=>br?.shouldWalk(M,D)?U(br,Ot):Ot()):kt.shouldWalk(M,D)?U(kt,Ot):Ot()},!0)},"walk"),ne=s;return new Promise((se,Z)=>{U(ne,Re=>{if(Re)return Z(Re);se(A)})})}walkSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l,A=[];(!b||b(s))&&A.push(_?s:s.fullpath());let M=new Set([s]);for(let U of M){let ne=U.readdirSync();for(let se of ne){(!b||b(se))&&A.push(_?se:se.fullpath());let Z=se;if(se.isSymbolicLink()){if(!(m&&(Z=se.realpathSync())))continue;Z.isUnknown()&&Z.lstatSync()}Z.shouldWalk(M,D)&&M.add(Z)}}return A}[Symbol.asyncIterator](){return this.iterate()}iterate(s=this.cwd,l={}){return typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd),this.stream(s,l)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l;(!b||b(s))&&(yield _?s:s.fullpath());let A=new Set([s]);for(let M of A){let U=M.readdirSync();for(let ne of U){(!b||b(ne))&&(yield _?ne:ne.fullpath());let se=ne;if(ne.isSymbolicLink()){if(!(m&&(se=ne.realpathSync())))continue;se.isUnknown()&&se.lstatSync()}se.shouldWalk(A,D)&&A.add(se)}}}stream(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l,A=new r3({objectMode:!0});(!b||b(s))&&A.write(_?s:s.fullpath());let M=new Set,U=[s],ne=0,se=t(()=>{let Z=!1;for(;!Z;){let Re=U.shift();if(!Re){ne===0&&A.end();return}ne++,M.add(Re);let Ae=t((Ot,kt,br=!1)=>{if(Ot)return A.emit("error",Ot);if(m&&!br){let Kr=[];for(let on of kt)on.isSymbolicLink()&&Kr.push(on.realpath().then(un=>un?.isUnknown()?un.lstat():un));if(Kr.length){Promise.all(Kr).then(()=>Ae(null,kt,!0));return}}for(let Kr of kt)Kr&&(!b||b(Kr))&&(A.write(_?Kr:Kr.fullpath())||(Z=!0));ne--;for(let Kr of kt){let on=Kr.realpathCached()||Kr;on.shouldWalk(M,D)&&U.push(on)}Z&&!A.flowing?A.once("drain",se):ke||se()},"onReaddir"),ke=!0;Re.readdirCB(Ae,!0),ke=!1}},"process");return se(),A}streamSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l,A=new r3({objectMode:!0}),M=new Set;(!b||b(s))&&A.write(_?s:s.fullpath());let U=[s],ne=0,se=t(()=>{let Z=!1;for(;!Z;){let Re=U.shift();if(!Re){ne===0&&A.end();return}ne++,M.add(Re);let Ae=Re.readdirSync();for(let ke of Ae)(!b||b(ke))&&(A.write(_?ke:ke.fullpath())||(Z=!0));ne--;for(let ke of Ae){let Ot=ke;if(ke.isSymbolicLink()){if(!(m&&(Ot=ke.realpathSync())))continue;Ot.isUnknown()&&Ot.lstatSync()}Ot.shouldWalk(M,D)&&U.push(Ot)}}Z&&!A.flowing&&A.once("drain",se)},"process");return se(),A}chdir(s=this.cwd){let l=this.cwd;this.cwd=typeof s=="string"?this.cwd.resolve(s):s,this.cwd[not](l)}},nM=class extends Jce{static{t(this,"PathScurryWin32")}sep="\\";constructor(s=process.cwd(),l={}){let{nocase:_=!0}=l;super(s,h6e,"\\",{...l,nocase:_}),this.nocase=_;for(let m=this.cwd;m;m=m.parent)m.nocase=this.nocase}parseRootPath(s){return h6e.parse(s).root.toUpperCase()}newRoot(s){return new Uce(this.rootPath,GD,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")||s.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(s)}},iM=class extends Jce{static{t(this,"PathScurryPosix")}sep="/";constructor(s=process.cwd(),l={}){let{nocase:_=!1}=l;super(s,oZt,"/",{...l,nocase:_}),this.nocase=_}parseRootPath(s){return"/"}newRoot(s){return new $ce(this.rootPath,GD,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")}},wH=class extends iM{static{t(this,"PathScurryDarwin")}constructor(s=process.cwd(),l={}){let{nocase:_=!0}=l;super(s,{...l,nocase:_})}},e4r=process.platform==="win32"?Uce:$ce,iot=process.platform==="win32"?nM:process.platform==="darwin"?wH:iM;var xZt=t(a=>a.length>=1,"isPatternList"),CZt=t(a=>a.length>=1,"isGlobList"),sM=class a{static{t(this,"Pattern")}#r;#n;#e;length;#t;#s;#p;#a;#_;#c;#l=!0;constructor(s,l,_,m){if(!xZt(s))throw new TypeError("empty pattern list");if(!CZt(l))throw new TypeError("empty glob list");if(l.length!==s.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=s.length,_<0||_>=this.length)throw new TypeError("index out of range");if(this.#r=s,this.#n=l,this.#e=_,this.#t=m,this.#e===0){if(this.isUNC()){let[b,D,A,M,...U]=this.#r,[ne,se,Z,Re,...Ae]=this.#n;U[0]===""&&(U.shift(),Ae.shift());let ke=[b,D,A,M,""].join("/"),Ot=[ne,se,Z,Re,""].join("/");this.#r=[ke,...U],this.#n=[Ot,...Ae],this.length=this.#r.length}else if(this.isDrive()||this.isAbsolute()){let[b,...D]=this.#r,[A,...M]=this.#n;D[0]===""&&(D.shift(),M.shift());let U=b+"/",ne=A+"/";this.#r=[U,...D],this.#n=[ne,...M],this.length=this.#r.length}}}pattern(){return this.#r[this.#e]}isString(){return typeof this.#r[this.#e]=="string"}isGlobstar(){return this.#r[this.#e]===F0}isRegExp(){return this.#r[this.#e]instanceof RegExp}globString(){return this.#p=this.#p||(this.#e===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#e).join("/"))}hasMore(){return this.length>this.#e+1}rest(){return this.#s!==void 0?this.#s:this.hasMore()?(this.#s=new a(this.#r,this.#n,this.#e+1,this.#t),this.#s.#c=this.#c,this.#s.#_=this.#_,this.#s.#a=this.#a,this.#s):this.#s=null}isUNC(){let s=this.#r;return this.#_!==void 0?this.#_:this.#_=this.#t==="win32"&&this.#e===0&&s[0]===""&&s[1]===""&&typeof s[2]=="string"&&!!s[2]&&typeof s[3]=="string"&&!!s[3]}isDrive(){let s=this.#r;return this.#a!==void 0?this.#a:this.#a=this.#t==="win32"&&this.#e===0&&this.length>1&&typeof s[0]=="string"&&/^[a-z]:$/i.test(s[0])}isAbsolute(){let s=this.#r;return this.#c!==void 0?this.#c:this.#c=s[0]===""&&s.length>1||this.isDrive()||this.isUNC()}root(){let s=this.#r[0];return typeof s=="string"&&this.isAbsolute()&&this.#e===0?s:""}checkFollowGlobstar(){return!(this.#e===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#e===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};var EZt=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",aM=class{static{t(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(s,{nobrace:l,nocase:_,noext:m,noglobstar:b,platform:D=EZt}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=D,this.mmopts={dot:!0,nobrace:l,nocase:_,noext:m,noglobstar:b,optimizationLevel:2,platform:D,nocomment:!0,nonegate:!0};for(let A of s)this.add(A)}add(s){let l=new U2(s,this.mmopts);for(let _=0;_<l.set.length;_++){let m=l.set[_],b=l.globParts[_];if(!m||!b)throw new Error("invalid pattern object");for(;m[0]==="."&&b[0]===".";)m.shift(),b.shift();let D=new sM(m,b,0,this.platform),A=new U2(D.globString(),this.mmopts),M=b[b.length-1]==="**",U=D.isAbsolute();U?this.absolute.push(A):this.relative.push(A),M&&(U?this.absoluteChildren.push(A):this.relativeChildren.push(A))}}ignored(s){let l=s.fullpath(),_=`${l}/`,m=s.relative()||".",b=`${m}/`;for(let D of this.relative)if(D.match(m)||D.match(b))return!0;for(let D of this.absolute)if(D.match(l)||D.match(_))return!0;return!1}childrenIgnored(s){let l=s.fullpath()+"/",_=(s.relative()||".")+"/";for(let m of this.relativeChildren)if(m.match(_))return!0;for(let m of this.absoluteChildren)if(m.match(l))return!0;return!1}};var y6e=class a{static{t(this,"HasWalkedCache")}store;constructor(s=new Map){this.store=s}copy(){return new a(new Map(this.store))}hasWalked(s,l){return this.store.get(s.fullpath())?.has(l.globString())}storeWalked(s,l){let _=s.fullpath(),m=this.store.get(_);m?m.add(l.globString()):this.store.set(_,new Set([l.globString()]))}},v6e=class{static{t(this,"MatchRecord")}store=new Map;add(s,l,_){let m=(l?2:0)|(_?1:0),b=this.store.get(s);this.store.set(s,b===void 0?m:m&b)}entries(){return[...this.store.entries()].map(([s,l])=>[s,!!(l&2),!!(l&1)])}},b6e=class{static{t(this,"SubWalks")}store=new Map;add(s,l){if(!s.canReaddir())return;let _=this.store.get(s);_?_.find(m=>m.globString()===l.globString())||_.push(l):this.store.set(s,[l])}get(s){let l=this.store.get(s);if(!l)throw new Error("attempting to walk unknown path");return l}entries(){return this.keys().map(s=>[s,this.store.get(s)])}keys(){return[...this.store.keys()].filter(s=>s.canReaddir())}},PH=class a{static{t(this,"Processor")}hasWalkedCache;matches=new v6e;subwalks=new b6e;patterns;follow;dot;opts;constructor(s,l){this.opts=s,this.follow=!!s.follow,this.dot=!!s.dot,this.hasWalkedCache=l?l.copy():new y6e}processPatterns(s,l){this.patterns=l;let _=l.map(m=>[s,m]);for(let[m,b]of _){this.hasWalkedCache.storeWalked(m,b);let D=b.root(),A=b.isAbsolute()&&this.opts.absolute!==!1;if(D){m=m.resolve(D==="/"&&this.opts.root!==void 0?this.opts.root:D);let se=b.rest();if(se)b=se;else{this.matches.add(m,!0,!1);continue}}if(m.isENOENT())continue;let M,U,ne=!1;for(;typeof(M=b.pattern())=="string"&&(U=b.rest());)m=m.resolve(M),b=U,ne=!0;if(M=b.pattern(),U=b.rest(),ne){if(this.hasWalkedCache.hasWalked(m,b))continue;this.hasWalkedCache.storeWalked(m,b)}if(typeof M=="string"){let se=M===".."||M===""||M===".";this.matches.add(m.resolve(M),A,se);continue}else if(M===F0){(!m.isSymbolicLink()||this.follow||b.checkFollowGlobstar())&&this.subwalks.add(m,b);let se=U?.pattern(),Z=U?.rest();if(!U||(se===""||se===".")&&!Z)this.matches.add(m,A,se===""||se===".");else if(se===".."){let Re=m.parent||m;Z?this.hasWalkedCache.hasWalked(Re,Z)||this.subwalks.add(Re,Z):this.matches.add(Re,A,!0)}}else M instanceof RegExp&&this.subwalks.add(m,b)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new a(this.opts,this.hasWalkedCache)}filterEntries(s,l){let _=this.subwalks.get(s),m=this.child();for(let b of l)for(let D of _){let A=D.isAbsolute(),M=D.pattern(),U=D.rest();M===F0?m.testGlobstar(b,D,U,A):M instanceof RegExp?m.testRegExp(b,M,U,A):m.testString(b,M,U,A)}return m}testGlobstar(s,l,_,m){if((this.dot||!s.name.startsWith("."))&&(l.hasMore()||this.matches.add(s,m,!1),s.canReaddir()&&(this.follow||!s.isSymbolicLink()?this.subwalks.add(s,l):s.isSymbolicLink()&&(_&&l.checkFollowGlobstar()?this.subwalks.add(s,_):l.markFollowGlobstar()&&this.subwalks.add(s,l)))),_){let b=_.pattern();if(typeof b=="string"&&b!==".."&&b!==""&&b!==".")this.testString(s,b,_.rest(),m);else if(b===".."){let D=s.parent||s;this.subwalks.add(D,_)}else b instanceof RegExp&&this.testRegExp(s,b,_.rest(),m)}}testRegExp(s,l,_,m){l.test(s.name)&&(_?this.subwalks.add(s,_):this.matches.add(s,m,!1))}testString(s,l,_,m){s.isNamed(l)&&(_?this.subwalks.add(s,_):this.matches.add(s,m,!1))}};var DZt=t((a,s)=>typeof a=="string"?new aM([a],s):Array.isArray(a)?new aM(a,s):a,"makeIgnore"),zce=class{static{t(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#r=[];#n;#e;signal;maxDepth;includeChildMatches;constructor(s,l,_){if(this.patterns=s,this.path=l,this.opts=_,this.#e=!_.posix&&_.platform==="win32"?"\\":"/",this.includeChildMatches=_.includeChildMatches!==!1,(_.ignore||!this.includeChildMatches)&&(this.#n=DZt(_.ignore??[],_),!this.includeChildMatches&&typeof this.#n.add!="function")){let m="cannot ignore child matches, ignore lacks add() method.";throw new Error(m)}this.maxDepth=_.maxDepth||1/0,_.signal&&(this.signal=_.signal,this.signal.addEventListener("abort",()=>{this.#r.length=0}))}#t(s){return this.seen.has(s)||!!this.#n?.ignored?.(s)}#s(s){return!!this.#n?.childrenIgnored?.(s)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let s;for(;!this.paused&&(s=this.#r.shift());)s()}onResume(s){this.signal?.aborted||(this.paused?this.#r.push(s):s())}async matchCheck(s,l){if(l&&this.opts.nodir)return;let _;if(this.opts.realpath){if(_=s.realpathCached()||await s.realpath(),!_)return;s=_}let b=s.isUnknown()||this.opts.stat?await s.lstat():s;if(this.opts.follow&&this.opts.nodir&&b?.isSymbolicLink()){let D=await b.realpath();D&&(D.isUnknown()||this.opts.stat)&&await D.lstat()}return this.matchCheckTest(b,l)}matchCheckTest(s,l){return s&&(this.maxDepth===1/0||s.depth()<=this.maxDepth)&&(!l||s.canReaddir())&&(!this.opts.nodir||!s.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!s.isSymbolicLink()||!s.realpathCached()?.isDirectory())&&!this.#t(s)?s:void 0}matchCheckSync(s,l){if(l&&this.opts.nodir)return;let _;if(this.opts.realpath){if(_=s.realpathCached()||s.realpathSync(),!_)return;s=_}let b=s.isUnknown()||this.opts.stat?s.lstatSync():s;if(this.opts.follow&&this.opts.nodir&&b?.isSymbolicLink()){let D=b.realpathSync();D&&(D?.isUnknown()||this.opts.stat)&&D.lstatSync()}return this.matchCheckTest(b,l)}matchFinish(s,l){if(this.#t(s))return;if(!this.includeChildMatches&&this.#n?.add){let b=`${s.relativePosix()}/**`;this.#n.add(b)}let _=this.opts.absolute===void 0?l:this.opts.absolute;this.seen.add(s);let m=this.opts.mark&&s.isDirectory()?this.#e:"";if(this.opts.withFileTypes)this.matchEmit(s);else if(_){let b=this.opts.posix?s.fullpathPosix():s.fullpath();this.matchEmit(b+m)}else{let b=this.opts.posix?s.relativePosix():s.relative(),D=this.opts.dotRelative&&!b.startsWith(".."+this.#e)?"."+this.#e:"";this.matchEmit(b?D+b+m:"."+m)}}async match(s,l,_){let m=await this.matchCheck(s,_);m&&this.matchFinish(m,l)}matchSync(s,l,_){let m=this.matchCheckSync(s,_);m&&this.matchFinish(m,l)}walkCB(s,l,_){this.signal?.aborted&&_(),this.walkCB2(s,l,new PH(this.opts),_)}walkCB2(s,l,_,m){if(this.#s(s))return m();if(this.signal?.aborted&&m(),this.paused){this.onResume(()=>this.walkCB2(s,l,_,m));return}_.processPatterns(s,l);let b=1,D=t(()=>{--b===0&&m()},"next");for(let[A,M,U]of _.matches.entries())this.#t(A)||(b++,this.match(A,M,U).then(()=>D()));for(let A of _.subwalkTargets()){if(this.maxDepth!==1/0&&A.depth()>=this.maxDepth)continue;b++;let M=A.readdirCached();A.calledReaddir()?this.walkCB3(A,M,_,D):A.readdirCB((U,ne)=>this.walkCB3(A,ne,_,D),!0)}D()}walkCB3(s,l,_,m){_=_.filterEntries(s,l);let b=1,D=t(()=>{--b===0&&m()},"next");for(let[A,M,U]of _.matches.entries())this.#t(A)||(b++,this.match(A,M,U).then(()=>D()));for(let[A,M]of _.subwalks.entries())b++,this.walkCB2(A,M,_.child(),D);D()}walkCBSync(s,l,_){this.signal?.aborted&&_(),this.walkCB2Sync(s,l,new PH(this.opts),_)}walkCB2Sync(s,l,_,m){if(this.#s(s))return m();if(this.signal?.aborted&&m(),this.paused){this.onResume(()=>this.walkCB2Sync(s,l,_,m));return}_.processPatterns(s,l);let b=1,D=t(()=>{--b===0&&m()},"next");for(let[A,M,U]of _.matches.entries())this.#t(A)||this.matchSync(A,M,U);for(let A of _.subwalkTargets()){if(this.maxDepth!==1/0&&A.depth()>=this.maxDepth)continue;b++;let M=A.readdirSync();this.walkCB3Sync(A,M,_,D)}D()}walkCB3Sync(s,l,_,m){_=_.filterEntries(s,l);let b=1,D=t(()=>{--b===0&&m()},"next");for(let[A,M,U]of _.matches.entries())this.#t(A)||this.matchSync(A,M,U);for(let[A,M]of _.subwalks.entries())b++,this.walkCB2Sync(A,M,_.child(),D);D()}},AH=class extends zce{static{t(this,"GlobWalker")}matches=new Set;constructor(s,l,_){super(s,l,_)}matchEmit(s){this.matches.add(s)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((s,l)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?l(this.signal.reason):s(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}},NH=class extends zce{static{t(this,"GlobStream")}results;constructor(s,l,_){super(s,l,_),this.results=new r3({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(s){this.results.write(s),this.results.flowing||this.pause()}stream(){let s=this.path;return s.isUnknown()?s.lstat().then(()=>{this.walkCB(s,this.patterns,()=>this.results.end())}):this.walkCB(s,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 wZt=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",AC=class{static{t(this,"Glob")}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(s,l){if(!l)throw new TypeError("glob options required");if(this.withFileTypes=!!l.withFileTypes,this.signal=l.signal,this.follow=!!l.follow,this.dot=!!l.dot,this.dotRelative=!!l.dotRelative,this.nodir=!!l.nodir,this.mark=!!l.mark,l.cwd?(l.cwd instanceof URL||l.cwd.startsWith("file://"))&&(l.cwd=kZt(l.cwd)):this.cwd="",this.cwd=l.cwd||"",this.root=l.root,this.magicalBraces=!!l.magicalBraces,this.nobrace=!!l.nobrace,this.noext=!!l.noext,this.realpath=!!l.realpath,this.absolute=l.absolute,this.includeChildMatches=l.includeChildMatches!==!1,this.noglobstar=!!l.noglobstar,this.matchBase=!!l.matchBase,this.maxDepth=typeof l.maxDepth=="number"?l.maxDepth:1/0,this.stat=!!l.stat,this.ignore=l.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof s=="string"&&(s=[s]),this.windowsPathsNoEscape=!!l.windowsPathsNoEscape||l.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(s=s.map(M=>M.replace(/\\/g,"/"))),this.matchBase){if(l.noglobstar)throw new TypeError("base matching requires globstar");s=s.map(M=>M.includes("/")?M:`./**/${M}`)}if(this.pattern=s,this.platform=l.platform||wZt,this.opts={...l,platform:this.platform},l.scurry){if(this.scurry=l.scurry,l.nocase!==void 0&&l.nocase!==l.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let M=l.platform==="win32"?nM:l.platform==="darwin"?wH:l.platform?iM:iot;this.scurry=new M(this.cwd,{nocase:l.nocase,fs:l.fs})}this.nocase=this.scurry.nocase;let _=this.platform==="darwin"||this.platform==="win32",m={...l,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:_,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},b=this.pattern.map(M=>new U2(M,m)),[D,A]=b.reduce((M,U)=>(M[0].push(...U.set),M[1].push(...U.globParts),M),[[],[]]);this.patterns=D.map((M,U)=>{let ne=A[U];if(!ne)throw new Error("invalid pattern object");return new sM(M,ne,0,this.platform)})}async walk(){return[...await new AH(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 AH(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 NH(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 NH(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 S6e=t((a,s={})=>{Array.isArray(a)||(a=[a]);for(let l of a)if(new U2(l,s).hasMagic())return!0;return!1},"hasMagic");function qce(a,s={}){return new AC(a,s).streamSync()}t(qce,"globStreamSync");function aot(a,s={}){return new AC(a,s).stream()}t(aot,"globStream");function oot(a,s={}){return new AC(a,s).walkSync()}t(oot,"globSync");async function sot(a,s={}){return new AC(a,s).walk()}t(sot,"glob_");function Vce(a,s={}){return new AC(a,s).iterateSync()}t(Vce,"globIterateSync");function cot(a,s={}){return new AC(a,s).iterate()}t(cot,"globIterate");var PZt=qce,AZt=Object.assign(aot,{sync:qce}),NZt=Vce,IZt=Object.assign(cot,{sync:Vce}),OZt=Object.assign(oot,{stream:qce,iterate:Vce}),IH=Object.assign(sot,{glob:sot,globSync:oot,sync:OZt,globStream:aot,stream:AZt,globStreamSync:qce,streamSync:PZt,globIterate:cot,iterate:IZt,globIterateSync:Vce,iterateSync:NZt,Glob:AC,hasMagic:S6e,escape:QR,unescape:kC});IH.glob=IH;import Vfe from"fs";import YFe from"path";var U1=class extends Error{static{t(this,"CompilationError")}buildMessages;constructor(s){super("An error occurred during compilation."),this.buildMessages=Array.isArray(s)?s:[s]}toBuildResult(){return{content:"",errors:this.buildMessages}}};var FZt="[",LZt="]",RZt="{",MZt="}",jZt=":",BZt=",",UZt="true",$Zt="false",JZt="null",zZt="NaN",qZt="Infinity",x6e='"',OH=new Map([[34,x6e],[92,"\\"],[47,"/"],[98,"\b"],[110,`
|
|
558
558
|
`],[102,"\f"],[114,"\r"],[116," "]]),Gce=new Map([...OH,[118,"\v"],[48,"\0"]]),VZt=new Map([[x6e,x6e],["\\","\\"],["/","/"],["\b","b"],[`
|
|
559
559
|
`,"n"],["\f","f"],["\r","r"],[" ","t"]]),B4r=new Map([...VZt,["\v","v"],["\0","0"],["\u2028","u2028"],["\u2029","u2029"]]),Hce=new Map([[FZt,"LBracket"],[LZt,"RBracket"],[RZt,"LBrace"],[MZt,"RBrace"],[jZt,"Colon"],[BZt,"Comma"],[UZt,"Boolean"],[$Zt,"Boolean"],[JZt,"Null"]]),Wce=new Map([...Hce,[zZt,"Number"],[qZt,"Number"]]),C6e=new Set([10,13,8232,8233]),YP=class extends Error{static{t(this,"ErrorWithLocation")}constructor(s,{line:l,column:_,offset:m}){super(`${s} (${l}:${_})`),this.line=l,this.column=_,this.offset=m}},E6e=class extends YP{static{t(this,"UnexpectedChar")}constructor(s,l){super(`Unexpected character '${String.fromCharCode(s)}' found.`,l)}},D6e=class extends YP{static{t(this,"UnexpectedIdentifier")}constructor(s,l){super(`Unexpected identifier '${s}' found.`,l)}},TO=class extends YP{static{t(this,"UnexpectedToken")}constructor(s){super(`Unexpected token ${s.type} found.`,s.loc.start)}},Kce=class extends YP{static{t(this,"UnexpectedEOF")}constructor(s){super("Unexpected end of input found.",s)}},WZt=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,HZt=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,GZt=13,lot=10,k6e=class{static{t(this,"CharCodeReader")}#r="";#n=1;#e=0;#t=-1;#s=!1;#p=-1;#a=!1;constructor(s){this.#r=s}#_(){this.#a||(this.#e++,this.#t++,this.#p=-1,this.#a=!0)}locate(){return{line:this.#n,column:this.#e,offset:this.#t}}next(){if(this.#t>=this.#r.length-1)return this.#_(),-1;this.#t++;let s=this.#r.charCodeAt(this.#t);return this.#s?(this.#n++,this.#e=1,this.#s=!1):this.#e++,s===GZt?(this.#s=!0,this.peek()===lot&&this.#t++):s===lot&&(this.#s=!0),this.#p=s,s}peek(){return this.#t===this.#r.length-1?-1:this.#r.charCodeAt(this.#t+1)}match(s){return s(this.peek())?(this.next(),!0):!1}current(){return this.#p}},KZt="Infinity",YZt="NaN",XZt=new Set([116,102,110]),w6e=new Set([32,9,10,13]),uot=new Set([...w6e,11,12,160,8232,8233,65279,160,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288]),QZt={mode:"json",ranges:!1},ZZt=new Set(["true","false","null"]),T_={EOF:0,Number:1,String:2,Boolean:3,Null:4,NaN:5,Infinity:6,Identifier:7,Colon:20,LBrace:21,RBrace:22,LBracket:23,RBracket:24,Comma:25,LineComment:40,BlockComment:41};function KP(a){return a>=48&&a<=57}t(KP,"isDigit");function T6e(a){return KP(a)||a>=65&&a<=70||a>=97&&a<=102}t(T6e,"isHexDigit");function eer(a){return a>=49&&a<=57}t(eer,"isPositiveDigit");function ter(a){return XZt.has(a)}t(ter,"isKeywordStart");function _ot(a){return KP(a)||a===46||a===45}t(_ot,"isNumberStart");function rer(a){return _ot(a)||a===43}t(rer,"isJSON5NumberStart");function fot(a,s){return a===34||s&&a===39}t(fot,"isStringStart");function pot(a){if(a===36||a===95||a===92||a>=97&&a<=122||a>=65&&a<=90||a===8204||a===8205)return!0;let s=String.fromCharCode(a);return WZt.test(s)}t(pot,"isJSON5IdentifierStart");function ner(a){if(pot(a)||KP(a))return!0;let s=String.fromCharCode(a);return HZt.test(s)}t(ner,"isJSON5IdentifierPart");var P6e=class{static{t(this,"Tokenizer")}#r;#n;#e;#t;#s;#p;#a;#_;#c;#l;#i;constructor(s,l){this.#n=s,this.#r={...QZt,...l},this.#e=new k6e(s),this.#t=this.#r.mode==="json5",this.#s=this.#r.mode!=="json",this.#p=this.#r.ranges,this.#_=this.#t?Gce.has.bind(Gce):OH.has.bind(OH),this.#c=this.#t?C6e.has.bind(C6e):()=>!1,this.#l=this.#t?_=>_===120:()=>!1,this.#i=this.#t?uot.has.bind(uot):w6e.has.bind(w6e)}#f(s,l=this.#e.locate()){throw new E6e(s,l)}#v(s,l=this.#e.locate()){throw new D6e(s,l)}#d(){throw new Kce(this.#e.locate())}#u(s,l,_,m){let b=_.offset+l,D=this.#r.ranges?{range:[_.offset,b]}:void 0;return{type:s,loc:{start:_,end:m||{line:_.line,column:_.column+l,offset:b}},...D}}#m(s){let l="",_;for(let m=0;m<s;m++){if(_=this.#e.peek(),T6e(_)){this.#e.next(),l+=String.fromCharCode(_);continue}this.#f(_)}return l}#g(s){let l="";do{if(l+=String.fromCharCode(s),s===92&&(s=this.#e.next(),s!==117&&this.#f(s),l+=String.fromCharCode(s),l+=this.#m(4)),s=this.#e.peek(),!ner(s))break;this.#e.next()}while(!0);return l}#E(s){let l=s,_=1;for(s=this.#e.peek();s!==-1&&s!==l;){if(this.#e.next(),_++,s===92)if(s=this.#e.peek(),this.#_(s)||this.#c(s))this.#e.next(),_++;else if(s===117){this.#e.next(),_++;let m=this.#m(4);_+=m.length}else if(this.#l(s)){this.#e.next(),_++;let m=this.#m(2);_+=m.length}else this.#t?(this.#e.next(),_++):this.#f(s);s=this.#e.peek()}return s===-1&&(this.#e.next(),this.#d()),this.#e.next(),_++,_}#x(s){let l=1;if(s===45||this.#t&&s===43){if(s=this.#e.peek(),this.#t&&(s===73||s===78)){this.#e.next();let _=this.#g(s);return _!==KZt&&_!==YZt&&this.#f(s),l+_.length}KP(s)||this.#f(s),this.#e.next(),l++}if(s===48)if(s=this.#e.peek(),this.#t&&(s===120||s===88)){this.#e.next(),l++,s=this.#e.peek(),T6e(s)||(this.#e.next(),this.#f(s));do this.#e.next(),l++,s=this.#e.peek();while(T6e(s))}else KP(s)&&this.#f(s);else if(!this.#t||s!==46)for(eer(s)||this.#f(s),s=this.#e.peek();KP(s);)this.#e.next(),l++,s=this.#e.peek();if(s===46){let _=-1;for(this.#e.next(),l++,_++,s=this.#e.peek();KP(s);)this.#e.next(),l++,_++,s=this.#e.peek();!this.#t&&_===0&&(this.#e.next(),s?this.#f(s):this.#d())}if(s===101||s===69)for(this.#e.next(),l++,s=this.#e.peek(),(s===43||s===45)&&(this.#e.next(),l++,s=this.#e.peek()),s===-1&&(this.#e.next(),this.#d()),KP(s)||(this.#e.next(),this.#f(s));KP(s);)this.#e.next(),l++,s=this.#e.peek();return l}#b(s){let l=1;if(s=this.#e.peek(),s===47){do this.#e.next(),l+=1,s=this.#e.peek();while(s>-1&&s!==13&&s!==10);return{length:l,multiline:!1}}if(s===42){for(this.#e.next(),l+=1;s>-1;)if(s=this.#e.peek(),s===42){if(this.#e.next(),l+=1,s=this.#e.peek(),s===47)return this.#e.next(),l+=1,{length:l,multiline:!0}}else this.#e.next(),l+=1;this.#e.next(),this.#d()}this.#e.next(),this.#f(s)}next(){let s=this.#e.next();for(;this.#i(s);)s=this.#e.next();if(s===-1)return T_.EOF;let l=this.#e.locate(),_=String.fromCharCode(s);if(this.#t)if(Wce.has(_))this.#a=this.#u(Wce.get(_),1,l);else if(pot(s)){let m=this.#g(s);Wce.has(m)?this.#a=this.#u(Wce.get(m),m.length,l):this.#a=this.#u("Identifier",m.length,l)}else if(rer(s)){let m=this.#x(s);this.#a=this.#u("Number",m,l)}else if(fot(s,this.#t)){let m=this.#E(s),b=this.#e.locate();this.#a=this.#u("String",m,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else if(s===47&&this.#s){let m=this.#b(s),b=this.#e.locate();this.#a=this.#u(m.multiline?"BlockComment":"LineComment",m.length,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else this.#f(s);else if(Hce.has(_))this.#a=this.#u(Hce.get(_),1,l);else if(ter(s)){let m=this.#g(s);ZZt.has(m)||this.#v(m,l),this.#a=this.#u(Hce.get(m),m.length,l)}else if(_ot(s)){let m=this.#x(s);this.#a=this.#u("Number",m,l)}else if(fot(s,this.#t)){let m=this.#E(s);this.#a=this.#u("String",m,l)}else if(s===47&&this.#s){let m=this.#b(s),b=this.#e.locate();this.#a=this.#u(m.multiline?"BlockComment":"LineComment",m.length,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else this.#f(s);return T_[this.#a.type]}get token(){return this.#a}};var TT={document(a,s={}){return{type:"Document",body:a,loc:s.loc,...s}},string(a,s={}){return{type:"String",value:a,loc:s.loc,...s}},number(a,s={}){return{type:"Number",value:a,loc:s.loc,...s}},boolean(a,s={}){return{type:"Boolean",value:a,loc:s.loc,...s}},null(a={}){return{type:"Null",loc:a.loc,...a}},array(a,s={}){return{type:"Array",elements:a,loc:s.loc,...s}},element(a,s={}){return{type:"Element",value:a,loc:s.loc,...s}},object(a,s={}){return{type:"Object",members:a,loc:s.loc,...s}},member(a,s,l={}){return{type:"Member",name:a,value:s,loc:l.loc,...l}},identifier(a,s={}){return{type:"Identifier",name:a,loc:s.loc,...s}},nan(a="",s={}){return{type:"NaN",sign:a,loc:s.loc,...s}},infinity(a="",s={}){return{type:"Infinity",sign:a,loc:s.loc,...s}}},ier={mode:"json",ranges:!1,tokens:!1,allowTrailingCommas:!1};function ser(a,s,l=!1){let _="",m=a.indexOf("\\"),b=0;for(;m>=0;){_+=a.slice(b,m);let D=a.charAt(m+1),A=D.charCodeAt(0);if(l&&Gce.has(A))_+=Gce.get(A),b=m+2;else if(OH.has(A))_+=OH.get(A),b=m+2;else if(D==="u"){let M=a.slice(m+2,m+6);if(M.length<4||/[^0-9a-f]/i.test(M))throw new YP(`Invalid unicode escape \\u${M}.`,{line:s.loc.start.line,column:s.loc.start.column+m,offset:s.loc.start.offset+m});_+=String.fromCharCode(parseInt(M,16)),b=m+6}else if(l&&D==="x"){let M=a.slice(m+2,m+4);if(M.length<2||/[^0-9a-f]/i.test(M))throw new YP(`Invalid hex escape \\x${M}.`,{line:s.loc.start.line,column:s.loc.start.column+m,offset:s.loc.start.offset+m});_+=String.fromCharCode(parseInt(M,16)),b=m+4}else if(l&&C6e.has(A))b=m+2,D==="\r"&&a.charAt(b)===`
|
|
560
|
-
`&&b++;else if(l)_+=D,b=m+2;else throw new YP(`Invalid escape \\${D}.`,{line:s.loc.start.line,column:s.loc.start.column+m,offset:s.loc.start.offset+m});m=a.indexOf("\\",b)}return _+=a.slice(b),_}t(ser,"getStringValue");function aer(a,s,l=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return ser(a.slice(1,-1),s,l);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(aer,"getLiteralValue");function dot(a,s){s=Object.freeze({...ier,...s});let l=[],_=new P6e(a,{mode:s.mode,ranges:s.ranges}),m=s.mode==="json5",b=s.allowTrailingCommas||m;function D(){let hr=_.next();return hr&&s.tokens&&l.push(_.token),hr}t(D,"nextNoComments");function A(){let hr=_.next();return hr&&s.tokens&&l.push(_.token),hr>=T_.LineComment?A():hr}t(A,"nextSkipComments");let M=s.mode==="json"?D:A;function U(hr,mr){if(hr!==mr)throw new TO(_.token)}t(U,"assertTokenType");function ne(hr,mr){if(!mr.includes(hr))throw new TO(_.token)}t(ne,"assertTokenTypes");function se(hr,mr){return s.ranges?{range:[hr.offset,mr.offset]}:void 0}t(se,"createRange");function Z(hr){let mr=_.token,Ds=se(mr.loc.start,mr.loc.end),Pi=aer(a.slice(mr.loc.start.offset,mr.loc.end.offset),mr,m),Ti={loc:{start:{...mr.loc.start},end:{...mr.loc.end}},...Ds};switch(hr){case T_.String:return TT.string(Pi,Ti);case T_.Number:return TT.number(Pi,Ti);case T_.Boolean:return TT.boolean(Pi,Ti);default:throw new TypeError(`Unknown token type ${mr.type}.`)}}t(Z,"createLiteralNode");function Re(hr){let mr=se(hr.loc.start,hr.loc.end),Ds=a.slice(hr.loc.start.offset,hr.loc.end.offset),Po={loc:{start:{...hr.loc.start},end:{...hr.loc.end}},...mr};if(hr.type!=="Identifier"){let Ti="";return(Ds[0]==="+"||Ds[0]==="-")&&(Ti=Ds[0]),TT[Ds.includes("NaN")?"nan":"infinity"](Ti,Po)}return TT.identifier(Ds,Po)}t(Re,"createJSON5IdentifierNode");function Ae(hr){let mr=se(hr.loc.start,hr.loc.end);return TT.null({loc:{start:{...hr.loc.start},end:{...hr.loc.end}},...mr})}t(Ae,"createNullNode");function ke(hr){m?ne(hr,[T_.String,T_.Identifier,T_.Number]):U(hr,T_.String);let mr=_.token,Ds=hr===T_.String?Z(hr):Re(mr);if(m&&(Ds.type==="NaN"||Ds.type==="Infinity")){if(Ds.sign!=="")throw new TO(_.token);Ds=TT.identifier(Ds.type,{loc:Ds.loc,...se(Ds.loc.start,Ds.loc.end)})}hr=M(),U(hr,T_.Colon);let Pi=br(),Po=se(Ds.loc.start,Pi.loc.end);return TT.member(Ds,Pi,{loc:{start:{...Ds.loc.start},end:{...Pi.loc.end}},...Po})}t(ke,"parseProperty");function Ot(hr){U(hr,T_.LBrace);let mr=_.token,Ds=[],Pi=M();if(Pi!==T_.RBrace)do{if(Ds.push(ke(Pi)),Pi=M(),!Pi)throw new Kce(Ds[Ds.length-1].loc.end);if(Pi===T_.Comma){if(Pi=M(),b&&Pi===T_.RBrace)break}else break}while(Pi);U(Pi,T_.RBrace);let Po=_.token,Ti=se(mr.loc.start,Po.loc.end);return TT.object(Ds,{loc:{start:{...mr.loc.start},end:{...Po.loc.end}},...Ti})}t(Ot,"parseObject");function kt(hr){U(hr,T_.LBracket);let mr=_.token,Ds=[],Pi=M();if(Pi!==T_.RBracket)do{let _p=br(Pi);if(Ds.push(TT.element(_p,{loc:_p.loc})),Pi=M(),Pi===T_.Comma){if(Pi=M(),b&&Pi===T_.RBracket)break}else break}while(Pi);U(Pi,T_.RBracket);let Po=_.token,Ti=se(mr.loc.start,Po.loc.end);return TT.array(Ds,{loc:{start:{...mr.loc.start},end:{...Po.loc.end}},...Ti})}t(kt,"parseArray");function br(hr){hr=hr??M();let mr=_.token;switch(hr){case T_.String:case T_.Boolean:return Z(hr);case T_.Number:if(m){let Ds=a.slice(mr.loc.start.offset,mr.loc.end.offset);if((Ds[0]==="+"||Ds[0]==="-")&&(Ds=Ds.slice(1)),Ds==="NaN"||Ds==="Infinity")return Re(mr)}return Z(hr);case T_.Null:return Ae(mr);case T_.LBrace:return Ot(hr);case T_.LBracket:return kt(hr);default:throw new TO(mr)}}t(br,"parseValue");let Kr=br();if(M())throw new TO(_.token);let un={loc:{start:{line:1,column:1,offset:0},end:{...Kr.loc.end}}};return s.tokens&&(un.tokens=l),s.ranges&&(un.range=[un.loc.start.offset,un.loc.end.offset]),TT.document(Kr,un)}t(dot,"parse");var oer=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function mot(a){return a&&typeof a=="object"}t(mot,"isObject");function cer(a){return mot(a)&&typeof a.type=="string"}t(cer,"isNode");function ler(a,s){function l(_,m){typeof s.enter=="function"&&s.enter(_,m);for(let b of oer.get(_.type)){let D=_[b];mot(D)&&(Array.isArray(D)?D.forEach(A=>l(A,_)):cer(D)&&l(D,_))}typeof s.exit=="function"&&s.exit(_,m)}t(l,"visitNode"),l(a)}t(ler,"traverse");function hot(a,s=()=>!0){let l=[];return ler(a,{enter(_,m){l.push({node:_,parent:m,phase:"enter"})},exit(_,m){l.push({node:_,parent:m,phase:"exit"})}}),l.filter(s).values()}t(hot,"iterator");import uer from"fs/promises";var FH=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),Yce=t(async a=>{try{return await uer.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),LH=t(async a=>{try{return dot(a)}catch(s){if(s.column&&s.line&&s.message){let l=FH(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:l}}return}},"getSchemaAST");var got=t(async(a,s,l)=>{try{if(a.length===0)return;for(let _ of a){let m=await Yce(_),b=await fer(m,_,s,l);if(b)return b}}catch{}},"getRouteLocationByValue"),fer=t(async(a,s,l,_)=>{try{if(!a)return;let m=null,b=await LH(a);if(b){for(let{node:D}of hot(b))if(D.value&&D.value===l){m=D.loc;break}if(m!==null){let D=FH(a,m.start.line);return{file:s,line:m.start.line,column:m.start.column,length:m.end.column-m.start.column,lineText:D,suggestion:_}}}}catch{}},"getRouteLocationByValueFromSchema");import yot from"fs/promises";import Xce from"path";var A6e="schemas",N6e=".oas.json";var xO=t(async a=>(await yot.readdir(a)).map(l=>`${a}/${l}`).filter(l=>l.endsWith(N6e)).sort(),"getOpenApiFilesByAlphabetical"),oM=t(async a=>{let s=Xce.resolve(a,"config");return(await yot.readdir(s)).filter(_=>_.endsWith(N6e)).length>=1},"oasFileInProject");function RH(a,s,l,_,m,b,D){if(b.has(l))return;let A=_.get(l);b.set(l,m.length),m.push(l),I6e(O6e(l),s,A,_,m,b,D)}t(RH,"chaseRefs");function I6e(a,s,l,_,m,b,D){if(Array.isArray(l))for(let A of l)I6e(a,s,A,_,m,b,D);else if(typeof l=="object")for(let A in l){if(A==="$ref"){let M=l[A];D&&(l[A]=D(s,M)),RH(a,s,n3(a,M),_,m,b,D)}I6e(a,s,l[A],_,m,b,D)}}t(I6e,"lookForRefs");function n3(a,s){let l=s.indexOf("#");return l>=0?`${Xce.resolve(a,s.substring(0,l))}${s.substring(l)}`:Xce.resolve(Xce.dirname(a),s)}t(n3,"getFullyQualifiedRefName");function O6e(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(O6e,"getFilePathNameFromRefName");var ZH=up(G4e(),1);var K4e={};hst(K4e,{UnsafePathError:()=>Cle,deleteFile:()=>Yir,deleteFolder:()=>ssr,dirExists:()=>Ele,ensureDirectoryExists:()=>esr,fileExists:()=>Kir,getParentDirFilename:()=>rsr,isNotFileOrDirectory:()=>Xir,listFolderContents:()=>Wlt,listFolders:()=>Zir,mkdirForFilePathIfNotExits:()=>Glt,mkdirIfNotExists:()=>Hlt,safePath:()=>tsr,tarFolderContent:()=>nsr,untar:()=>isr});import qlt from"child_process";import f3 from"fs/promises";import u3 from"path";var Vlt=[".git","node_modules",".yarn",".DS_Store"];async function Kir(a){try{return(await f3.stat(a)).isFile()}catch{return!1}}t(Kir,"fileExists");async function Yir(a,s){return await f3.rm(a,s)}t(Yir,"deleteFile");async function Ele(a){try{return(await f3.stat(a)).isDirectory()}catch{return!1}}t(Ele,"dirExists");async function Xir(a){try{return await f3.stat(a),!1}catch{return!0}}t(Xir,"isNotFileOrDirectory");function Qir(a,s){let l=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),_=a.match(l);if(!_)return"";let m=a.split(_[0]);return m[1]===""?"":`/${m[1]}`}t(Qir,"getParentDirectory");async function Zir(a){if(!await Ele(a))return[];let s=await f3.readdir(a,{withFileTypes:!0}),l=[];for await(let _ of s)Vlt.includes(_.name)||_.isDirectory()&&l.push(_.name);return l}t(Zir,"listFolders");async function Wlt(a,s,l=!0){let _=Qir(a,s),m=await f3.readdir(a,{withFileTypes:!0}),b=[];for await(let D of m)if(!Vlt.includes(D.name)||!l)if(D.isDirectory()){let A=await Wlt(u3.join(a,D.name),s,l);b.push(...A)}else b.push(u3.join(_,D.name));return b}t(Wlt,"listFolderContents");var Hlt=t(async a=>{if(await Ele(a))return!0;await f3.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),Glt=t(async a=>{let s=u3.dirname(a);return Hlt(s)},"mkdirForFilePathIfNotExits"),esr=Glt,Cle=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function tsr(a){let s=t(l=>{if(!l.startsWith(a))throw new Cle("Resolved path is not part of the project.");return l},"ensureSafePath");return{resolve:t((...l)=>s(u3.resolve(...l)),"resolve")}}t(tsr,"safePath");function rsr(a){return`${u3.basename(u3.dirname(a))}/${u3.basename(a)}`}t(rsr,"getParentDirFilename");function nsr(a,s,l,_){let m=u3.join(_,l);return qlt.execSync(`tar --exclude='.git/' --exclude='dist/' -czf ${m} ${s}`,{cwd:a}),m}t(nsr,"tarFolderContent");function isr(a,s,l,_=!1){qlt.execSync(`tar -xf ${s} ${_?"--strip-components=1 ":""}-C ${l}`,{cwd:a})}t(isr,"untar");async function ssr(a){if(await Ele(a))return await f3.rm(a,{recursive:!0})}t(ssr,"deleteFolder");var yl=K4e;var DT=up(G4e(),1);import{readFile as asr}from"fs/promises";var IO=class extends Error{static{t(this,"CustomResolveError")}},_3=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,l){this.sourceDirectory=s,this.logger=l}dereference(s,l){return ZH.$RefParser.dereference(s,{resolve:{json:!0,file:Dle(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:l?.onDereference}})}bundle(s){return ZH.$RefParser.bundle(s,{resolve:{file:Dle(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return ZH.$RefParser.parse(s,{resolve:{file:Dle(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return ZH.$RefParser.resolve(s,{resolve:{file:Dle(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function Dle(a,s){return{order:100,canRead(l){let _=lsr(l.url);if(!(_===void 0||_==="file"))return!1;let b;try{b=Klt(l.url)}catch(D){throw new IO(`Malformed URI: ${l.url}`,{cause:D})}try{yl.safePath(a).resolve(b)}catch(D){return s?.warn(D),!1}return!0},async read(l){let _;try{_=Klt(l.url)}catch(m){throw new IO(`Malformed URI: ${l.url}`,{cause:m})}try{return await asr(_)}catch(m){throw new IO(`Error opening file "${_}"`,{cause:m})}}}}t(Dle,"customResolver");var Y4e=/^win/.test(globalThis.process?globalThis.process.platform:""),osr=/\//g,csr=/^(\w{2,}):\/\//i,X4e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function lsr(a){let s=csr.exec(a);if(s)return s[1].toLowerCase()}t(lsr,"getProtocol");function Klt(a,s){a=decodeURI(a);for(let _=0;_<X4e.length;_+=2)a=a.replace(X4e[_],X4e[_+1]);let l=a.substr(0,7).toLowerCase()==="file://";return l&&(a=a[7]==="/"?a.substr(8):a.substr(7),Y4e&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(l=!1,a=Y4e?a:"/"+a)),Y4e&&!l&&(a=a.replace(osr,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(Klt,"toFileSystemPath");var Ylt="YOUR_KEY_HERE";async function Xlt(a){let l=await new _3(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),_=a.openApiDocPath.replace(a.sourceDirectory,"");return usr({...a,relativeOpenApiPath:_},l)}t(Xlt,"buildPublicOpenApiFile");async function usr(a,s){dsr({relativeOpenApiPath:a.relativeOpenApiPath},s);let l=s;return l=_sr(l),fsr(l,a),l=psr(l,a),Qlt(l,"x-zuplo"),l}t(usr,"buildRawOpenApiFile");function fsr(a,{customDomain:s,deploymentName:l,environmentType:_}){let m;s?m=s:_&&l&&(m=_===hce.WORKING_COPY?`${l}.d2.zuplo.dev`:`${l}.zuplo.app`),m?a.servers=[{url:`https://${m}`}]:a.servers=void 0}t(fsr,"addServerHost");function _sr(a){if(!a.paths)return a;let{components:s}=a,l=s?{...s}:void 0,_=[];l&&l.parameters&&(_=Object.entries(l.parameters).reduce((b,[D,A])=>(HR in A&&gce(A[HR])&&(b.push(D),l.parameters&&delete l.parameters[D]),b),[]));let m=Object.entries(a.paths).reduce((b,[D,A])=>{if(!A)return b;let M={...A},U=["delete","get","head","patch","post","put","trace","options"];return U.forEach(ne=>{let se=A[ne];if(!se)return;if(gce(se[HR])){delete M[ne];return}let{parameters:Z}=se;if(!Z)return;let Re=Z.filter(Ae=>{if(HR in Ae&&gce(Ae[HR]))return!1;if("$ref"in Ae){let ke=Ae.$ref.split("/").pop();return ke?!_.includes(ke):!0}return!0});M[ne]={...se,parameters:Re}}),U.some(ne=>!!M[ne])&&(b[D]=M),b},{});return{...a,paths:m,components:l}}t(_sr,"removeHiddenRoutesAndParams");function psr(a,{policiesConfig:s}){if(!a.paths)return a;let l=Object.entries(a.paths).reduce((_,[m,b])=>{if(!b)return _;let D={...b};return[D.delete,D.get,D.head,D.patch,D.post,D.put,D.trace,D.options].forEach(A=>{if(!A)return;let M=A["x-zuplo-route"]?.policies?.inbound?.reduce((se,Z)=>{let Re=s.policies?.find(({name:Ot})=>Ot===Z);if(!Re)return se;if(!(Re.handler.export==="CompositeInboundPolicy"))return se.concat(Z);let ke=Re.handler.options?.policies;return ke?se.concat(ke):se},[]),U=[];if(M&&M.forEach(se=>{s.policies?.forEach(Z=>{Z.name===se&&(Z.handler.export==="ApiAuthKeyInboundPolicy"||Z.handler.export==="ApiKeyInboundPolicy")&&!Z.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&U.push(Z)})}),U.length>0){let se=U.length>0&&U[0].handler&&U[0].handler.options&&U[0].handler.options.authHeader?U[0].handler.options.authHeader:"Authorization",Z=U.length>0&&U[0].handler&&U[0].handler.options&&(U[0].handler.options.authScheme||U[0].handler.options.authScheme==="")?U[0].handler.options.authScheme:"Bearer",Re=Z!==""?`${Z} ${Ylt}`:Ylt,Ae={name:se,in:"header",required:!0,example:Re,schema:{type:"string"},description:`The \`${se}\` header is used to authenticate with the API using your API key. Value is of the format \`${Re}\`.`};A.parameters?A.parameters.some(br=>"name"in br&&br.name===Ae.name)||A.parameters.unshift(Ae):A.parameters=[Ae];let ke={type:"http",scheme:Z.toLowerCase()},Ot="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(br=>"name"in br&&br.type==="apiKey"||"type"in br&&br.type==="http"&&br.scheme===Z)||(a.components.securitySchemes={...a.components.securitySchemes,[Ot]:ke}):(a.components||(a.components={}),a.components.securitySchemes={[Ot]:ke});let kt={[Ot]:[]};A.security?A.security.some(br=>br[Ot]!==void 0)||A.security.unshift(kt):A.security=[kt]}let ne=[];if(M&&M.forEach(se=>{s.policies?.forEach(Z=>{Z.name===se&&(Z.handler.export==="RateLimitInboundPolicy"||Z.handler.export==="ComplexRateLimitInboundPolicy")&&ne.push(Z)})}),ne.length>0){let se={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},Z={...se,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:se,RateLimitWithRetryAfter:Z},A.responses||(A.responses={});let Re=ne.some(Ae=>Ae.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Re?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),_[m]=D,_},{});return{...a,paths:l}}t(psr,"enrichSpecWithZuploData");function Qlt(a,s){for(let l in a)l.startsWith(s)?delete a[l]:typeof a[l]=="object"&&Qlt(a[l],s)}t(Qlt,"removePropertiesByPrefix");function dsr({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new B2({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new B2({message:"The OpenAPI document does not have the required 'info' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"});if(!("title"in s.info)||typeof s.info.title!="string")throw new B2({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(dsr,"assertIsZuploOpenApiSpec");function msr(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let U=0;U<s.length;U++)s[U]=255;for(let U=0;U<a.length;U++){let ne=a.charAt(U),se=ne.charCodeAt(0);if(s[se]!==255)throw new TypeError(ne+" is ambiguous");s[se]=U}let l=a.length,_=a.charAt(0),m=Math.log(l)/Math.log(256),b=Math.log(256)/Math.log(l);function D(U){if(U instanceof Uint8Array||(ArrayBuffer.isView(U)?U=new Uint8Array(U.buffer,U.byteOffset,U.byteLength):Array.isArray(U)&&(U=Uint8Array.from(U))),!(U instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(U.length===0)return"";let ne=0,se=0,Z=0,Re=U.length;for(;Z!==Re&&U[Z]===0;)Z++,ne++;let Ae=(Re-Z)*b+1>>>0,ke=new Uint8Array(Ae);for(;Z!==Re;){let br=U[Z],Kr=0;for(let on=Ae-1;(br!==0||Kr<se)&&on!==-1;on--,Kr++)br+=256*ke[on]>>>0,ke[on]=br%l>>>0,br=br/l>>>0;if(br!==0)throw new Error("Non-zero carry");se=Kr,Z++}let Ot=Ae-se;for(;Ot!==Ae&&ke[Ot]===0;)Ot++;let kt=_.repeat(ne);for(;Ot<Ae;++Ot)kt+=a.charAt(ke[Ot]);return kt}t(D,"encode");function A(U){if(typeof U!="string")throw new TypeError("Expected String");if(U.length===0)return new Uint8Array;let ne=0,se=0,Z=0;for(;U[ne]===_;)se++,ne++;let Re=(U.length-ne)*m+1>>>0,Ae=new Uint8Array(Re);for(;U[ne];){let br=s[U.charCodeAt(ne)];if(br===255)return;let Kr=0;for(let on=Re-1;(br!==0||Kr<Z)&&on!==-1;on--,Kr++)br+=l*Ae[on]>>>0,Ae[on]=br%256>>>0,br=br/256>>>0;if(br!==0)throw new Error("Non-zero carry");Z=Kr,ne++}let ke=Re-Z;for(;ke!==Re&&Ae[ke]===0;)ke++;let Ot=new Uint8Array(se+(Re-ke)),kt=se;for(;ke!==Re;)Ot[kt++]=Ae[ke++];return Ot}t(A,"decodeUnsafe");function M(U){let ne=A(U);if(ne)return ne;throw new Error("Non-base"+l+" character")}return t(M,"decode"),{encode:D,decodeUnsafe:A,decode:M}}t(msr,"base");var Zlt=msr;var hsr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",kle=Zlt(hsr);var Q4e="2024-09-02",eut=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function tut(){return new kT({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:Q4e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:eut[Q4e]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(tut,"getMockEnvironment");var kT=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=tut()),this.#r}constructor({build:s,runtime:l}){let _;try{if(l.__ZUPLO_CONFIG){let m=atob(l.__ZUPLO_CONFIG);_=JSON.parse(m)}if(l.ZUPLO_SYSTEM_CONFIGURATIONS){let m=new TextDecoder().decode(kle.decode(l.ZUPLO_SYSTEM_CONFIGURATIONS)),b=JSON.parse(m);for(let D of Object.keys(b))l[D]=b[D]}}catch(m){console.error("Failed to parse runtime configuration",m)}this.config=_??{},this.build=s,this.runtime=l,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var gsr=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function rut(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!gsr.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(rut,"isRestrictedEnvVariableName");function nut(a){return!!a.startsWith("ZUPLO_")}t(nut,"isZuploReadableEnvVariableName");var kIr=new Proxy({},{get(a,s){let l=String(s);switch(l){case"ZUPLO_ENVIRONMENT_TYPE":return kT.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return kT.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return kT.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return kT.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return kT.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return kT.instance.build.BUILD_ID}if(!(rut(l)&&!nut(l)))return kT.instance.runtime[l]}});function eG(a,s,l){return`_${tA(`${a}_${s}_${l}`)}`}t(eG,"getRawOperationDataIdentifierName");function Z4e(a,s,l,_){return`_${tA(a.toLowerCase())}_${s.toLowerCase()}_${l.toLowerCase()}_${_.toLowerCase()}`}t(Z4e,"getIdForParameterSchema");function e3e(a,s,l){return`_${tA(a.toLowerCase())}_${s.toLowerCase()}_rb_${tA(l.toLowerCase())}`}t(e3e,"getIdForRequestBodySchema");function tG(a,s){return`_${tA(a)}_${tA(s)}`}t(tG,"getIdForRefSchema");function tA(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(tA,"sanitizedIdentifierName");var Lmt=up(Hft(),1);import Zue from"path";var gG=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,l,_,m,b){this.type=a,this.name=s,this.prefix=l,this.value=_,this.suffix=m,this.modifier=b}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},fcr=/[$_\p{ID_Start}]/u,_cr=/[$_\u200C\u200D\p{ID_Continue}]/u,G3e=".*";function pcr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(pcr,"Re");function Yft(a,s=!1){let l=[],_=0;for(;_<a.length;){let m=a[_],b=t(function(D){if(!s)throw new TypeError(D);l.push({type:"INVALID_CHAR",index:_,value:a[_++]})},"c");if(m==="*"){l.push({type:"ASTERISK",index:_,value:a[_++]});continue}if(m==="+"||m==="?"){l.push({type:"OTHER_MODIFIER",index:_,value:a[_++]});continue}if(m==="\\"){l.push({type:"ESCAPED_CHAR",index:_++,value:a[_++]});continue}if(m==="{"){l.push({type:"OPEN",index:_,value:a[_++]});continue}if(m==="}"){l.push({type:"CLOSE",index:_,value:a[_++]});continue}if(m===":"){let D="",A=_+1;for(;A<a.length;){let M=a.substr(A,1);if(A===_+1&&fcr.test(M)||A!==_+1&&_cr.test(M)){D+=a[A++];continue}break}if(!D){b(`Missing parameter name at ${_}`);continue}l.push({type:"NAME",index:_,value:D}),_=A;continue}if(m==="("){let D=1,A="",M=_+1,U=!1;if(a[M]==="?"){b(`Pattern cannot start with "?" at ${M}`);continue}for(;M<a.length;){if(!pcr(a[M],!1)){b(`Invalid character '${a[M]}' at ${M}.`),U=!0;break}if(a[M]==="\\"){A+=a[M++]+a[M++];continue}if(a[M]===")"){if(D--,D===0){M++;break}}else if(a[M]==="("&&(D++,a[M+1]!=="?")){b(`Capturing groups are not allowed at ${M}`),U=!0;break}A+=a[M++]}if(U)continue;if(D){b(`Unbalanced pattern at ${_}`);continue}if(!A){b(`Missing pattern at ${_}`);continue}l.push({type:"REGEX",index:_,value:A}),_=M;continue}l.push({type:"CHAR",index:_,value:a[_++]})}return l.push({type:"END",index:_,value:""}),l}t(Yft,"v");function Xft(a,s={}){let l=Yft(a);s.delimiter??="/#?",s.prefixes??="./";let _=`[^${NT(s.delimiter)}]+?`,m=[],b=0,D=0,A="",M=new Set,U=t(Kr=>{if(D<l.length&&l[D].type===Kr)return l[D++].value},"a"),ne=t(()=>U("OTHER_MODIFIER")??U("ASTERISK"),"f"),se=t(Kr=>{let on=U(Kr);if(on!==void 0)return on;let{type:un,index:hr}=l[D];throw new TypeError(`Unexpected ${un} at ${hr}, expected ${Kr}`)},"d"),Z=t(()=>{let Kr="",on;for(;on=U("CHAR")??U("ESCAPED_CHAR");)Kr+=on;return Kr},"T"),Re=t(Kr=>Kr,"Se"),Ae=s.encodePart||Re,ke="",Ot=t(Kr=>{ke+=Kr},"U"),kt=t(()=>{ke.length&&(m.push(new gG(3,"","",Ae(ke),"",3)),ke="")},"$"),br=t((Kr,on,un,hr,mr)=>{let Ds=3;switch(mr){case"?":Ds=1;break;case"*":Ds=0;break;case"+":Ds=2;break}if(!on&&!un&&Ds===3){Ot(Kr);return}if(kt(),!on&&!un){if(!Kr)return;m.push(new gG(3,"","",Ae(Kr),"",Ds));return}let Pi;un?un==="*"?Pi=G3e:Pi=un:Pi=_;let Po=2;Pi===_?(Po=1,Pi=""):Pi===G3e&&(Po=0,Pi="");let Ti;if(on?Ti=on:un&&(Ti=b++),M.has(Ti))throw new TypeError(`Duplicate name '${Ti}'.`);M.add(Ti),m.push(new gG(Po,Ti,Ae(Kr),Pi,Ae(hr),Ds))},"V");for(;D<l.length;){let Kr=U("CHAR"),on=U("NAME"),un=U("REGEX");if(!on&&!un&&(un=U("ASTERISK")),on||un){let mr=Kr??"";s.prefixes.indexOf(mr)===-1&&(Ot(mr),mr=""),kt();let Ds=ne();br(mr,on,un,"",Ds);continue}let hr=Kr??U("ESCAPED_CHAR");if(hr){Ot(hr);continue}if(U("OPEN")){let mr=Z(),Ds=U("NAME"),Pi=U("REGEX");!Ds&&!Pi&&(Pi=U("ASTERISK"));let Po=Z();se("CLOSE");let Ti=ne();br(mr,Ds,Pi,Po,Ti);continue}kt(),se("END")}return m}t(Xft,"D");function NT(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(NT,"S");function Gft(a){return a&&a.ignoreCase?"ui":"u"}t(Gft,"X");function dcr(a,s,l){return Qft(Xft(a,l),s,l)}t(dcr,"Z");function NM(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(NM,"k");function Qft(a,s,l={}){l.delimiter??="/#?",l.prefixes??="./",l.sensitive??=!1,l.strict??=!1,l.end??=!0,l.start??=!0,l.endsWith="";let _=l.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?_+=NT(A.value):_+=`(?:${NT(A.value)})${NM(A.modifier)}`;continue}s&&s.push(A.name);let M=`[^${NT(l.delimiter)}]+?`,U=A.value;if(A.type===1?U=M:A.type===0&&(U=G3e),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?_+=`(${U})${NM(A.modifier)}`:_+=`((?:${U})${NM(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){_+=`(?:${NT(A.prefix)}(${U})${NT(A.suffix)})`,_+=NM(A.modifier);continue}_+=`(?:${NT(A.prefix)}`,_+=`((?:${U})(?:`,_+=NT(A.suffix),_+=NT(A.prefix),_+=`(?:${U}))*)${NT(A.suffix)})`,A.modifier===0&&(_+="?")}let m=`[${NT(l.endsWith)}]|$`,b=`[${NT(l.delimiter)}]`;if(l.end)return l.strict||(_+=`${b}?`),l.endsWith.length?_+=`(?=${m})`:_+="$",new RegExp(_,Gft(l));l.strict||(_+=`(?:${b}(?=${m}))?`);let D=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(D=l.delimiter.indexOf(A)>-1)}return D||(_+=`(?=${b}|${m})`),new RegExp(_,Gft(l))}t(Qft,"F");var h3={delimiter:"",prefixes:"",sensitive:!0,strict:!0},mcr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},hcr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function gcr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(gcr,"J");function Zft(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(Zft,"Q");function ycr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(ycr,"Ee");function e_t(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(e_t,"W");var t_t=["ftp","file","http","https","ws","wss"];function r_t(a){if(!a)return!0;for(let s of t_t)if(a.test(s))return!0;return!1}t(r_t,"N");function vcr(a,s){if(a=Zft(a,"#"),s||a==="")return a;let l=new URL("https://example.com");return l.hash=a,l.hash?l.hash.substring(1,l.hash.length):""}t(vcr,"te");function bcr(a,s){if(a=Zft(a,"?"),s||a==="")return a;let l=new URL("https://example.com");return l.search=a,l.search?l.search.substring(1,l.search.length):""}t(bcr,"re");function Scr(a,s){return s||a===""?a:e_t(a)?s_t(a):i_t(a)}t(Scr,"ne");function Tcr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.password=a,l.password}t(Tcr,"se");function xcr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.username=a,l.username}t(xcr,"ie");function Ccr(a,s,l){if(l||a==="")return a;if(s&&!t_t.includes(s))return new URL(`${s}:${a}`).pathname;let _=a[0]=="/";return a=new URL(_?a:"/-"+a,"https://example.com").pathname,_||(a=a.substring(2,a.length)),a}t(Ccr,"ae");function Ecr(a,s,l){return n_t(s)===a&&(a=""),l||a===""?a:a_t(a)}t(Ecr,"oe");function Dcr(a,s){return a=ycr(a,":"),s||a===""?a:K3e(a)}t(Dcr,"ce");function n_t(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(n_t,"_");function K3e(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(K3e,"y");function kcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(kcr,"le");function wcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(wcr,"fe");function i_t(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(i_t,"z");function s_t(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(s_t,"j");function a_t(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(a_t,"K");function Pcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(Pcr,"he");function Acr(a){return a===""?a:new URL(`data:${a}`).pathname}t(Acr,"ue");function Ncr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(Ncr,"de");function Icr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(Icr,"pe");var Ocr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=Yft(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#w()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#E()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#x()?this.#d(3):(this.#C()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#x()&&this.#i(5,1);break;case 4:this.#x()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#k()&&!this.#c?this.#i(6,1):this.#C()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#C()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 7:this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 8:this.#D()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#i(a,s){switch(this.#a){case 0:break;case 1:this.#e.protocol=this.#T();break;case 2:break;case 3:this.#e.username=this.#T();break;case 4:this.#e.password=this.#T();break;case 5:this.#e.hostname=this.#T();break;case 6:this.#e.port=this.#T();break;case 7:this.#e.pathname=this.#T();break;case 8:this.#e.search=this.#T();break;case 9:this.#e.hash=this.#T();break;case 10:break}this.#a!==0&&a!==10&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(a)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(a)&&(this.#e.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&a===9&&(this.#e.search??="")),this.#f(a,s)}#f(a,s){this.#a=a,this.#p=this.#t+s,this.#t+=s,this.#s=0}#v(){this.#t=this.#p,this.#s=0}#d(a){this.#v(),this.#a=a}#u(a){return a<0&&(a=this.#n.length-a),a<this.#n.length?this.#n[a]:this.#n[this.#n.length-1]}#m(a,s){let l=this.#u(a);return l.value===s&&(l.type==="CHAR"||l.type==="ESCAPED_CHAR"||l.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#E(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#x(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#k(){return this.#m(this.#t,":")}#C(){return this.#m(this.#t,"/")}#y(){if(this.#m(this.#t,"?"))return!0;if(this.#n[this.#t].value!=="?")return!1;let a=this.#u(this.#t-1);return a.type!=="NAME"&&a.type!=="REGEX"&&a.type!=="CLOSE"&&a.type!=="ASTERISK"}#D(){return this.#m(this.#t,"#")}#w(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,h3),a.encodePart=K3e;let s=dcr(this.#T(),void 0,a);this.#l=r_t(s)}},H3e=["protocol","username","password","hostname","port","pathname","search","hash"],m3="*";function Kft(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let l=new URL(a,s);return{protocol:l.protocol.substring(0,l.protocol.length-1),username:l.username,password:l.password,hostname:l.hostname,port:l.port,pathname:l.pathname,search:l.search!==""?l.search.substring(1,l.search.length):void 0,hash:l.hash!==""?l.hash.substring(1,l.hash.length):void 0}}t(Kft,"ge");function aA(a,s){return s?hG(a):a}t(aA,"b");function mG(a,s,l){let _;if(typeof s.baseURL=="string")try{_=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=aA(_.protocol.substring(0,_.protocol.length-1),l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=aA(_.username,l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=aA(_.password,l)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=aA(_.hostname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=aA(_.port,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=aA(_.pathname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=aA(_.search.substring(1,_.search.length),l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=aA(_.hash.substring(1,_.hash.length),l))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Dcr(s.protocol,l)),typeof s.username=="string"&&(a.username=xcr(s.username,l)),typeof s.password=="string"&&(a.password=Tcr(s.password,l)),typeof s.hostname=="string"&&(a.hostname=Scr(s.hostname,l)),typeof s.port=="string"&&(a.port=Ecr(s.port,a.protocol,l)),typeof s.pathname=="string"){if(a.pathname=s.pathname,_&&!gcr(a.pathname,l)){let m=_.pathname.lastIndexOf("/");m>=0&&(a.pathname=aA(_.pathname.substring(0,m+1),l)+a.pathname)}a.pathname=Ccr(a.pathname,a.protocol,l)}return typeof s.search=="string"&&(a.search=bcr(s.search,l)),typeof s.hash=="string"&&(a.hash=vcr(s.hash,l)),a}t(mG,"w");function hG(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(hG,"C");function Fcr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(Fcr,"Oe");function Lcr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let l=".*",_=`[^${Fcr(s.delimiter)}]+?`,m=/[$_\u200C\u200D\p{ID_Continue}]/u,b="";for(let D=0;D<a.length;++D){let A=a[D];if(A.type===3){if(A.modifier===3){b+=hG(A.value);continue}b+=`{${hG(A.value)}}${NM(A.modifier)}`;continue}let M=A.hasCustomName(),U=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),ne=D>0?a[D-1]:null,se=D<a.length-1?a[D+1]:null;if(!U&&M&&A.type===1&&A.modifier===3&&se&&!se.prefix.length&&!se.suffix.length)if(se.type===3){let Z=se.value.length>0?se.value[0]:"";U=m.test(Z)}else U=!se.hasCustomName();if(!U&&!A.prefix.length&&ne&&ne.type===3){let Z=ne.value[ne.value.length-1];U=s.prefixes.includes(Z)}U&&(b+="{"),b+=hG(A.prefix),M&&(b+=`:${A.name}`),A.type===2?b+=`(${A.value})`:A.type===1?M||(b+=`(${_})`):A.type===0&&(!M&&(!ne||ne.type===3||ne.modifier!==3||U||A.prefix!=="")?b+="*":b+=`(${l})`),A.type===1&&M&&A.suffix.length&&m.test(A.suffix[0])&&(b+="\\"),b+=hG(A.suffix),U&&(b+="}"),A.modifier!==3&&(b+=NM(A.modifier))}return b}t(Lcr,"ke");var o_t=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,l){try{let _;if(typeof s=="string"?_=s:l=s,typeof a=="string"){let A=new Ocr(a);if(A.parse(),a=A.result,_===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=_}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(_)throw new TypeError("parameter 1 is not of type 'string'.")}typeof l>"u"&&(l={ignoreCase:!1});let m={ignoreCase:l.ignoreCase===!0},b={pathname:m3,protocol:m3,username:m3,password:m3,hostname:m3,port:m3,search:m3,hash:m3};this.#r=mG(b,a,!0),n_t(this.#r.protocol)===this.#r.port&&(this.#r.port="");let D;for(D of H3e){if(!(D in this.#r))continue;let A={},M=this.#r[D];switch(this.#e[D]=[],D){case"protocol":Object.assign(A,h3),A.encodePart=K3e;break;case"username":Object.assign(A,h3),A.encodePart=kcr;break;case"password":Object.assign(A,h3),A.encodePart=wcr;break;case"hostname":Object.assign(A,mcr),e_t(M)?A.encodePart=s_t:A.encodePart=i_t;break;case"port":Object.assign(A,h3),A.encodePart=a_t;break;case"pathname":r_t(this.#n.protocol)?(Object.assign(A,hcr,m),A.encodePart=Pcr):(Object.assign(A,h3,m),A.encodePart=Acr);break;case"search":Object.assign(A,h3,m),A.encodePart=Ncr;break;case"hash":Object.assign(A,h3,m),A.encodePart=Icr;break}try{this.#s[D]=Xft(M,A),this.#n[D]=Qft(this.#s[D],this.#e[D],A),this.#t[D]=Lcr(this.#s[D],A),this.#p=this.#p||this.#s[D].some(U=>U.type===2)}catch{throw new TypeError(`invalid ${D} pattern '${this.#r[D]}'.`)}}}catch(_){throw new TypeError(`Failed to construct 'URLPattern': ${_.message}`)}}test(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?l=mG(l,a,!1):l=mG(l,Kft(a,s),!1)}catch{return!1}let _;for(_ of H3e)if(!this.#n[_].exec(l[_]))return!1;return!0}exec(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?l=mG(l,a,!1):l=mG(l,Kft(a,s),!1)}catch{return null}let _={};s?_.inputs=[a,s]:_.inputs=[a];let m;for(m of H3e){let b=this.#n[m].exec(l[m]);if(!b)return null;let D={};for(let[A,M]of this.#e[m].entries())if(typeof M=="string"||typeof M=="number"){let U=b[A+1];D[M]=U}_[m]={input:l[m]??"",groups:D}}return _}static compareComponent(a,s,l){let _=t((A,M)=>{for(let U of["type","modifier","prefix","value","suffix"]){if(A[U]<M[U])return-1;if(A[U]!==M[U])return 1}return 0},"o"),m=new gG(3,"","","","",3),b=new gG(0,"","","","",3),D=t((A,M)=>{let U=0;for(;U<Math.min(A.length,M.length);++U){let ne=_(A[U],M[U]);if(ne)return ne}return A.length===M.length?0:_(A[U]??m,M[U]??m)},"s");return!s.#t[a]&&!l.#t[a]?0:s.#t[a]&&!l.#t[a]?D(s.#s[a],[b]):!s.#t[a]&&l.#t[a]?D([b],l.#s[a]):D(s.#s[a],l.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=o_t);import{AssertionError as Rcr}from"assert";function oA(a,s){if(a===!1)throw new Rcr({message:s})}t(oA,"assert");var Ac;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Ac||(Ac={}));function IM(a){return a.type===Ac.Object}t(IM,"isAstObject");function cA(a){return a.type===Ac.Property}t(cA,"isAstProperty");function c_t(a){return a.type===Ac.Array}t(c_t,"isAstArray");function OM(a){return a.type===Ac.Literal}t(OM,"isAstLiteral");function BO(a){if(a===void 0)throw new Error("Node is undefined");if(!IM(a))throw new Error("Node is not object")}t(BO,"assertAstObject");import{findNodeAtLocation as Mcr,getNodeValue as jcr,printParseErrorCode as Bcr,visit as Ucr}from"jsonc-parser";var $cr={DEFAULT:{allowTrailingComma:!1}};function yG(a,s=[],l=$cr.DEFAULT){let _={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function m(M){_.type==="property"&&(_.length=M-_.offset,_=_.parent)}t(m,"ensurePropertyComplete");function b(M){return _.children?.push(M),M}t(b,"onValue"),Ucr(a,{onObjectBegin:t((M,U,ne)=>{_=b({type:"object",offset:M,length:-1,line:U+1,column:ne+1,parent:_,children:[]})},"onObjectBegin"),onObjectProperty:t((M,U,ne,se,Z)=>{_=b({type:"property",offset:U,length:-1,line:se+1,column:Z+1,parent:_,children:[]}),_.children?.push({type:"string",value:M,offset:U,length:ne,line:se,column:Z,parent:_})},"onObjectProperty"),onObjectEnd:t((M,U)=>{m(M+U),_.length=M+U-_.offset,_=_.parent,m(M+U)},"onObjectEnd"),onArrayBegin:t((M,U,ne,se)=>{_=b({type:"array",offset:M,length:-1,line:ne+1,column:se+1,parent:_,children:[]})},"onArrayBegin"),onArrayEnd:t((M,U)=>{_.length=M+U-_.offset,_=_.parent,m(M+U)},"onArrayEnd"),onLiteralValue:t((M,U,ne,se,Z)=>{b({type:Jcr(M),offset:U,length:ne,line:se+1,column:Z+1,parent:_,value:M}),m(U+ne)},"onLiteralValue"),onSeparator:t((M,U)=>{_.type==="property"&&(M===":"?_.colonOffset=U:M===","&&m(U))},"onSeparator"),onError:t((M,U,ne,se,Z)=>{s.push({error:M,offset:U,length:ne,line:se+1,column:Z+1})},"onError")},l);let A=_.children[0];return A&&delete A.parent,A}t(yG,"parse");function Jcr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(Jcr,"getNodeType");function Y3e(a,s){return Mcr(a,s)}t(Y3e,"findNodeAtLocation");function vG(a){return jcr(a)}t(vG,"getNodeValue");function l_t(a){return Bcr(a)}t(l_t,"printParseErrorCode");var bG=class{static{t(this,"AstAdapter")}parse(s){let _=yG(s,[]);if(_)return this.parseNode(_,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,l){switch(s.type){case"object":return this.createObject(s,l);case"array":return this.createArray(s,l);case"property":return this.createProperty(s,l);case"string":return this.createLiteral(s,l);case"number":return this.createLiteral(s,l);case"boolean":return this.createLiteral(s,l);case"null":return this.createLiteral(s,l)}}createLiteral(s,l){return{type:Ac.Literal,location:{line:s.line,column:s.column},parent:l,value:s.type==="null"?null:s.value}}createObject(s,l){let _={type:Ac.Object,children:[],parent:l,location:{line:s.line,column:s.column}};return s.children?.forEach(m=>{_.children.push(this.parseNode(m,_))}),_}createProperty(s,l){oA(s.children?.length===2,"Invalid property node");let _={type:Ac.Property,location:{line:s.line,column:s.column},parent:l,name:null,value:null};return _.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Ac.Identifier,parent:_},_.value=this.parseNode(s.children[1],_),_}createArray(s,l){let _={type:Ac.Array,location:{line:s.line,column:s.column},parent:l,children:[]};return s.children?.forEach(m=>_.children.push(this.parseNode(m,_))),_}};var $C={createLiteral:t((a,s)=>({type:Ac.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Ac.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Ac.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,l)=>{let _={type:Ac.Property,parent:l,name:null,value:s};return _.name={value:a,type:Ac.Identifier,parent:_},_.value.parent=_,_},"createProperty"),createArrayOfLiterals:t((a,s)=>{let l={type:Ac.Array,parent:s,children:[]};for(let _ of a)l.children.push($C.createLiteral(_,l));return l},"createArrayOfLiterals")};var zcr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,SG=class{static{t(this,"SourceGenerator")}generate(s){let l=[];return this.generateSource(l,s),l.join("")}generateSource(s,l){switch(l.type){case Ac.Array:return this.generateArray(s,l);case Ac.Object:return this.generateObject(s,l);case Ac.Property:return this.generateProperty(s,l);case Ac.Literal:return this.generateLiteral(s,l);case Ac.FunctionCall:return this.generateFunctionCall(s,l);case Ac.Identifier:return this.generateIdentifier(s,l);case Ac.Raw:return this.generateRaw(s,l);case Ac.TemplateString:return this.generateTemplateString(s,l)}}generateArray(s,l){s.push("["),l.children.map(_=>{this.generateSource(s,_),s.push(",")}),s.push("]")}generateObject(s,l){s.push("{"),l.children.forEach(_=>{this.generateSource(s,_),s.push(",")}),s.push("}")}generateProperty(s,l){this.generateIdentifier(s,l.name),s.push(":"),this.generateSource(s,l.value)}generateFunctionCall(s,l){s.push(l.name.value),s.push("("),l.children.forEach((_,m,b)=>{this.generateSource(s,_),m<b.length&&s.push(",")}),s.push(")")}generateRaw(s,l){s.push(l.value)}generateTemplateString(s,l){s.push("`"),s.push(l.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,l){if(l.value===null)return s.push("null");switch(typeof l.value){case"number":case"boolean":return s.push(`${l.value}`);case"string":{let _=l.value,m=JSON.stringify(_);return s.push(`${m}`)}}}generateIdentifier(s,l){let _=zcr.test(l.value)?l.value:`'${l.value}'`;s.push(_)}};import{parse as qcr}from"@swc/core";import Vcr from"fs/promises";var u_t=t(async a=>{let s=new Set;try{let l=await Vcr.readFile(a,"utf-8");(await qcr(l,{syntax:"typescript"})).body.forEach(m=>{m.type==="ExportDefaultDeclaration"||m.type==="ExportDefaultExpression"?s.add("default"):m.type==="ExportDeclaration"&&m.declaration.type==="FunctionDeclaration"?s.add(m.declaration.identifier.value):m.type==="ExportDeclaration"&&m.declaration.type==="VariableDeclaration"&&m.declaration.declarations[0].id.type==="Identifier"&&s.add(m.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var f_t={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var X3e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var __t={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var Q3e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var Z3e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var Emt=up(Gdt(),1),Dmt=up(Cmt(),1);var Vue=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new Dmt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,Emt.default)(this.ajv,{mode:"fast"})}addSchema(s,l){this.ajv.addSchema(s,l)}compile(s){let l=this.ajv.compile(s);return t(m=>({isValid:l(m),errors:this.toSimpleErrors(l.errors,m),warnings:[]}),"validator")}toSimpleErrors(s,l){let _=[];return s?.forEach(m=>{m.keyword==="enum"&&m.params.allowedValues&&Array.isArray(m.params.allowedValues)&&(m.message+=`; ${m.params.allowedValues.join(", ")}`),m.instancePath&&(m.instancePath=m.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let b={details:{}},D=m.instancePath.split("/");if(D.length>2){let M=D[1],U=D[2]?parseInt(D[2]):0,ne=D[3],se=isNaN(U)?void 0:l[M][U][ne];b={details:{property:M,index:U,field:ne,fieldValue:se}}}if(m.keyword==="required"&&m.params.missingProperty&&m.instancePath&&(m.message=`A 'path' is missing required property '${m.params.missingProperty}'`),m.keyword==="additionalProperties"&&m.params.additionalProperty&&m.instancePath&&(m.message=`A 'path' should NOT include property '${m.params.additionalProperty}'`),m.keyword==="type"&&m.params.type&&m.instancePath){let M=m.instancePath.split("/"),U=M[M.length-1];m.message=`Value of property '${U}' must be '${m.params.type}'`}let A=Object.assign(m,b);_.push(A)}),_}};var D3=Vue.instance;D3.addSchema(Z3e,"route-configuration.schema.json");D3.addSchema(__t,"policy-configuration.schema.json");D3.addSchema(X3e,"policies.schema.json");D3.addSchema(Q3e,"open-api-route-configuration.schema.json");D3.addSchema(f_t,"fragments.schema.json");var D5r=D3.compile(Z3e),kmt=D3.compile(Q3e),d8e=D3.compile(X3e);var Wue=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=d8e(s),this.results}};var Hue=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=kmt(s),this.results}};import Xmr from"path";var m8e=/\$import\((.*)\)/,Gue=/\$env\((.*?)\)/g;var pA=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,l,_,m){super(s),this.location={file:l,namespace:"",line:_?_.line:0,column:_?_.column:0,length:0,lineText:m??"",suggestion:""}}},Ymr=t(a=>{let s=[],l=a;for(;l.parent;)s.push(l),l=l.parent;return s.reverse()},"invertTree"),k3=t((a,s)=>{if(!a)return!1;let l=Ymr(a);return s.split("/").every((b,D)=>{let A=l[D];return A?b==="*"||cA(A)&&A.name.value===b?!0:b==="{}"?A.type===Ac.Object:b==="[]"?A.type===Ac.Array:!1:!1})},"testPosition");var Kue=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),IM(s)?s.children.forEach(l=>{this.visitor(l)}):c_t(s)?s.children.forEach(l=>{this.visitor(l)}):cA(s)&&this.visitor(s.value)}},wmt=t((a,s,l)=>_=>{if(!cA(_)||!OM(_.value)||typeof _.value.value!="string")return;if(!a.some(b=>k3(_,b))){Gue.test(_.value.value)&&s.push(new pA("An $env() statement is not expected at this location.",l,_.location,_.value.value));return}let m=new RegExp(Gue).exec(_.value.value);if(m?.length===2&&m[0]===_.value.value){let b={type:Ac.Raw,parent:null,value:`environment["${m[1]}"]`};_.value=b}else{let b=_.value.value.replaceAll(new RegExp(Gue),(D,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);b!==_.value.value&&(_.value=$C.createTemplateString(b,_))}},"getEnvStatementTransformer");var eK="config/routes.json",Qmr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Zmr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Pmt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],ehr="handler/{}/options/{}/rewritePattern",thr="handler/{}/options/{}/baseUrl",Yue=class extends Kue{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let l=this.addedImports.get(s);if(!l)throw new Error("Import name is undefined. This should not happen.");return l}getImports(){let s=[];return this.addedImports.forEach((l,_)=>{s.push({name:l,path:_})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!cA(s)||!OM(s.value)||typeof s.value.value!="string")&&k3(s,ehr)){if(!s.parent||!IM(s.parent)){this.errors.push(new pA("Invalid node, expected object",eK,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Amt(l)},m=$C.createProperty("__rewriteFunction",_,s);s.parent.children.push(m)}}rewriteForwardFunction(s){if(!(!cA(s)||!OM(s.value)||typeof s.value.value!="string")&&k3(s,thr)){if(!s.parent||!IM(s.parent)){this.errors.push(new pA("Invalid node, expected object",eK,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Amt(l)},m=$C.createProperty("__rewriteFunction",_,s);s.parent.children.push(m)}}replaceImportStatements(s){if(!cA(s)||!OM(s.value))return;let l=s.value.value;if(typeof l!="string")return;if(!Zmr.some(A=>k3(s,A))&&!Pmt.some(A=>k3(s,A))){if(m8e.test(l)){if(s.name.value==="$ref")return;this.errors.push(new pA("An $import() statement is not expected at this location.",eK,s.location,l))}return}let _=m8e.exec(l);if(Pmt.some(A=>k3(s,A))&&!_)return;if(!_){this.errors.push(new pA("Invalid $import() statement",eK,s.location,l));return}let m=_[1];m.startsWith(".")&&(m=Xmr.join("..",m));let b=this.getImportName(m),D={type:Ac.Identifier,parent:s.parent,value:b};s.value=D}replaceEnvStatements=wmt(Qmr,this.errors,eK)};function Amt(a){return`(request, context) => {
|
|
560
|
+
`&&b++;else if(l)_+=D,b=m+2;else throw new YP(`Invalid escape \\${D}.`,{line:s.loc.start.line,column:s.loc.start.column+m,offset:s.loc.start.offset+m});m=a.indexOf("\\",b)}return _+=a.slice(b),_}t(ser,"getStringValue");function aer(a,s,l=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return ser(a.slice(1,-1),s,l);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(aer,"getLiteralValue");function dot(a,s){s=Object.freeze({...ier,...s});let l=[],_=new P6e(a,{mode:s.mode,ranges:s.ranges}),m=s.mode==="json5",b=s.allowTrailingCommas||m;function D(){let hr=_.next();return hr&&s.tokens&&l.push(_.token),hr}t(D,"nextNoComments");function A(){let hr=_.next();return hr&&s.tokens&&l.push(_.token),hr>=T_.LineComment?A():hr}t(A,"nextSkipComments");let M=s.mode==="json"?D:A;function U(hr,mr){if(hr!==mr)throw new TO(_.token)}t(U,"assertTokenType");function ne(hr,mr){if(!mr.includes(hr))throw new TO(_.token)}t(ne,"assertTokenTypes");function se(hr,mr){return s.ranges?{range:[hr.offset,mr.offset]}:void 0}t(se,"createRange");function Z(hr){let mr=_.token,Ds=se(mr.loc.start,mr.loc.end),Pi=aer(a.slice(mr.loc.start.offset,mr.loc.end.offset),mr,m),Ti={loc:{start:{...mr.loc.start},end:{...mr.loc.end}},...Ds};switch(hr){case T_.String:return TT.string(Pi,Ti);case T_.Number:return TT.number(Pi,Ti);case T_.Boolean:return TT.boolean(Pi,Ti);default:throw new TypeError(`Unknown token type ${mr.type}.`)}}t(Z,"createLiteralNode");function Re(hr){let mr=se(hr.loc.start,hr.loc.end),Ds=a.slice(hr.loc.start.offset,hr.loc.end.offset),Po={loc:{start:{...hr.loc.start},end:{...hr.loc.end}},...mr};if(hr.type!=="Identifier"){let Ti="";return(Ds[0]==="+"||Ds[0]==="-")&&(Ti=Ds[0]),TT[Ds.includes("NaN")?"nan":"infinity"](Ti,Po)}return TT.identifier(Ds,Po)}t(Re,"createJSON5IdentifierNode");function Ae(hr){let mr=se(hr.loc.start,hr.loc.end);return TT.null({loc:{start:{...hr.loc.start},end:{...hr.loc.end}},...mr})}t(Ae,"createNullNode");function ke(hr){m?ne(hr,[T_.String,T_.Identifier,T_.Number]):U(hr,T_.String);let mr=_.token,Ds=hr===T_.String?Z(hr):Re(mr);if(m&&(Ds.type==="NaN"||Ds.type==="Infinity")){if(Ds.sign!=="")throw new TO(_.token);Ds=TT.identifier(Ds.type,{loc:Ds.loc,...se(Ds.loc.start,Ds.loc.end)})}hr=M(),U(hr,T_.Colon);let Pi=br(),Po=se(Ds.loc.start,Pi.loc.end);return TT.member(Ds,Pi,{loc:{start:{...Ds.loc.start},end:{...Pi.loc.end}},...Po})}t(ke,"parseProperty");function Ot(hr){U(hr,T_.LBrace);let mr=_.token,Ds=[],Pi=M();if(Pi!==T_.RBrace)do{if(Ds.push(ke(Pi)),Pi=M(),!Pi)throw new Kce(Ds[Ds.length-1].loc.end);if(Pi===T_.Comma){if(Pi=M(),b&&Pi===T_.RBrace)break}else break}while(Pi);U(Pi,T_.RBrace);let Po=_.token,Ti=se(mr.loc.start,Po.loc.end);return TT.object(Ds,{loc:{start:{...mr.loc.start},end:{...Po.loc.end}},...Ti})}t(Ot,"parseObject");function kt(hr){U(hr,T_.LBracket);let mr=_.token,Ds=[],Pi=M();if(Pi!==T_.RBracket)do{let _p=br(Pi);if(Ds.push(TT.element(_p,{loc:_p.loc})),Pi=M(),Pi===T_.Comma){if(Pi=M(),b&&Pi===T_.RBracket)break}else break}while(Pi);U(Pi,T_.RBracket);let Po=_.token,Ti=se(mr.loc.start,Po.loc.end);return TT.array(Ds,{loc:{start:{...mr.loc.start},end:{...Po.loc.end}},...Ti})}t(kt,"parseArray");function br(hr){hr=hr??M();let mr=_.token;switch(hr){case T_.String:case T_.Boolean:return Z(hr);case T_.Number:if(m){let Ds=a.slice(mr.loc.start.offset,mr.loc.end.offset);if((Ds[0]==="+"||Ds[0]==="-")&&(Ds=Ds.slice(1)),Ds==="NaN"||Ds==="Infinity")return Re(mr)}return Z(hr);case T_.Null:return Ae(mr);case T_.LBrace:return Ot(hr);case T_.LBracket:return kt(hr);default:throw new TO(mr)}}t(br,"parseValue");let Kr=br();if(M())throw new TO(_.token);let un={loc:{start:{line:1,column:1,offset:0},end:{...Kr.loc.end}}};return s.tokens&&(un.tokens=l),s.ranges&&(un.range=[un.loc.start.offset,un.loc.end.offset]),TT.document(Kr,un)}t(dot,"parse");var oer=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function mot(a){return a&&typeof a=="object"}t(mot,"isObject");function cer(a){return mot(a)&&typeof a.type=="string"}t(cer,"isNode");function ler(a,s){function l(_,m){typeof s.enter=="function"&&s.enter(_,m);for(let b of oer.get(_.type)){let D=_[b];mot(D)&&(Array.isArray(D)?D.forEach(A=>l(A,_)):cer(D)&&l(D,_))}typeof s.exit=="function"&&s.exit(_,m)}t(l,"visitNode"),l(a)}t(ler,"traverse");function hot(a,s=()=>!0){let l=[];return ler(a,{enter(_,m){l.push({node:_,parent:m,phase:"enter"})},exit(_,m){l.push({node:_,parent:m,phase:"exit"})}}),l.filter(s).values()}t(hot,"iterator");import uer from"fs/promises";var FH=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),Yce=t(async a=>{try{return await uer.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),LH=t(async a=>{try{return dot(a)}catch(s){if(s.column&&s.line&&s.message){let l=FH(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:l}}return}},"getSchemaAST");var got=t(async(a,s,l)=>{try{if(a.length===0)return;for(let _ of a){let m=await Yce(_),b=await fer(m,_,s,l);if(b)return b}}catch{}},"getRouteLocationByValue"),fer=t(async(a,s,l,_)=>{try{if(!a)return;let m=null,b=await LH(a);if(b){for(let{node:D}of hot(b))if(D.value&&D.value===l){m=D.loc;break}if(m!==null){let D=FH(a,m.start.line);return{file:s,line:m.start.line,column:m.start.column,length:m.end.column-m.start.column,lineText:D,suggestion:_}}}}catch{}},"getRouteLocationByValueFromSchema");import yot from"fs/promises";import Xce from"path";var A6e="schemas",N6e=".oas.json";var xO=t(async a=>(await yot.readdir(a)).map(l=>`${a}/${l}`).filter(l=>l.endsWith(N6e)).sort(),"getOpenApiFilesByAlphabetical"),oM=t(async a=>{let s=Xce.resolve(a,"config");return(await yot.readdir(s)).filter(_=>_.endsWith(N6e)).length>=1},"oasFileInProject");function RH(a,s,l,_,m,b,D){if(b.has(l))return;let A=_.get(l);b.set(l,m.length),m.push(l),I6e(O6e(l),s,A,_,m,b,D)}t(RH,"chaseRefs");function I6e(a,s,l,_,m,b,D){if(Array.isArray(l))for(let A of l)I6e(a,s,A,_,m,b,D);else if(typeof l=="object")for(let A in l){if(A==="$ref"){let M=l[A];D&&(l[A]=D(s,M)),RH(a,s,n3(a,M),_,m,b,D)}I6e(a,s,l[A],_,m,b,D)}}t(I6e,"lookForRefs");function n3(a,s){let l=s.indexOf("#");return l>=0?`${Xce.resolve(a,s.substring(0,l))}${s.substring(l)}`:Xce.resolve(Xce.dirname(a),s)}t(n3,"getFullyQualifiedRefName");function O6e(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(O6e,"getFilePathNameFromRefName");var ZH=up(G4e(),1);var K4e={};hst(K4e,{UnsafePathError:()=>Cle,deleteFile:()=>Yir,deleteFolder:()=>ssr,dirExists:()=>Ele,ensureDirectoryExists:()=>esr,fileExists:()=>Kir,getParentDirFilename:()=>rsr,isNotFileOrDirectory:()=>Xir,listFolderContents:()=>Wlt,listFolders:()=>Zir,mkdirForFilePathIfNotExits:()=>Glt,mkdirIfNotExists:()=>Hlt,safePath:()=>tsr,tarFolderContent:()=>nsr,untar:()=>isr});import qlt from"child_process";import f3 from"fs/promises";import u3 from"path";var Vlt=[".git","node_modules",".yarn",".DS_Store"];async function Kir(a){try{return(await f3.stat(a)).isFile()}catch{return!1}}t(Kir,"fileExists");async function Yir(a,s){return await f3.rm(a,s)}t(Yir,"deleteFile");async function Ele(a){try{return(await f3.stat(a)).isDirectory()}catch{return!1}}t(Ele,"dirExists");async function Xir(a){try{return await f3.stat(a),!1}catch{return!0}}t(Xir,"isNotFileOrDirectory");function Qir(a,s){let l=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),_=a.match(l);if(!_)return"";let m=a.split(_[0]);return m[1]===""?"":`/${m[1]}`}t(Qir,"getParentDirectory");async function Zir(a){if(!await Ele(a))return[];let s=await f3.readdir(a,{withFileTypes:!0}),l=[];for await(let _ of s)Vlt.includes(_.name)||_.isDirectory()&&l.push(_.name);return l}t(Zir,"listFolders");async function Wlt(a,s,l=!0){let _=Qir(a,s),m=await f3.readdir(a,{withFileTypes:!0}),b=[];for await(let D of m)if(!Vlt.includes(D.name)||!l)if(D.isDirectory()){let A=await Wlt(u3.join(a,D.name),s,l);b.push(...A)}else b.push(u3.join(_,D.name));return b}t(Wlt,"listFolderContents");var Hlt=t(async a=>{if(await Ele(a))return!0;await f3.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),Glt=t(async a=>{let s=u3.dirname(a);return Hlt(s)},"mkdirForFilePathIfNotExits"),esr=Glt,Cle=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function tsr(a){let s=t(l=>{if(!l.startsWith(a))throw new Cle("Resolved path is not part of the project.");return l},"ensureSafePath");return{resolve:t((...l)=>s(u3.resolve(...l)),"resolve")}}t(tsr,"safePath");function rsr(a){return`${u3.basename(u3.dirname(a))}/${u3.basename(a)}`}t(rsr,"getParentDirFilename");function nsr(a,s,l,_){let m=u3.join(_,l);return qlt.execSync(`tar --exclude='.git/' --exclude='dist/' -czf ${m} ${s}`,{cwd:a}),m}t(nsr,"tarFolderContent");function isr(a,s,l,_=!1){qlt.execSync(`tar -xf ${s} ${_?"--strip-components=1 ":""}-C ${l}`,{cwd:a})}t(isr,"untar");async function ssr(a){if(await Ele(a))return await f3.rm(a,{recursive:!0})}t(ssr,"deleteFolder");var yl=K4e;var DT=up(G4e(),1);import{readFile as asr}from"fs/promises";var IO=class extends Error{static{t(this,"CustomResolveError")}},_3=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,l){this.sourceDirectory=s,this.logger=l}dereference(s,l){return ZH.$RefParser.dereference(s,{resolve:{json:!0,file:Dle(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:l?.onDereference}})}bundle(s){return ZH.$RefParser.bundle(s,{resolve:{file:Dle(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return ZH.$RefParser.parse(s,{resolve:{file:Dle(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return ZH.$RefParser.resolve(s,{resolve:{file:Dle(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function Dle(a,s){return{order:100,canRead(l){let _=lsr(l.url);if(!(_===void 0||_==="file"))return!1;let b;try{b=Klt(l.url)}catch(D){throw new IO(`Malformed URI: ${l.url}`,{cause:D})}try{yl.safePath(a).resolve(b)}catch(D){return s?.warn(D),!1}return!0},async read(l){let _;try{_=Klt(l.url)}catch(m){throw new IO(`Malformed URI: ${l.url}`,{cause:m})}try{return await asr(_)}catch(m){throw new IO(`Error opening file "${_}"`,{cause:m})}}}}t(Dle,"customResolver");var Y4e=/^win/.test(globalThis.process?globalThis.process.platform:""),osr=/\//g,csr=/^(\w{2,}):\/\//i,X4e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function lsr(a){let s=csr.exec(a);if(s)return s[1].toLowerCase()}t(lsr,"getProtocol");function Klt(a,s){a=decodeURI(a);for(let _=0;_<X4e.length;_+=2)a=a.replace(X4e[_],X4e[_+1]);let l=a.substr(0,7).toLowerCase()==="file://";return l&&(a=a[7]==="/"?a.substr(8):a.substr(7),Y4e&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(l=!1,a=Y4e?a:"/"+a)),Y4e&&!l&&(a=a.replace(osr,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(Klt,"toFileSystemPath");var Ylt="YOUR_KEY_HERE";async function Xlt(a){let l=await new _3(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),_=a.openApiDocPath.replace(a.sourceDirectory,"");return usr({...a,relativeOpenApiPath:_},l)}t(Xlt,"buildPublicOpenApiFile");async function usr(a,s){dsr({relativeOpenApiPath:a.relativeOpenApiPath},s);let l=s;return l=_sr(l),fsr(l,a),l=psr(l,a),Qlt(l,"x-zuplo"),l}t(usr,"buildRawOpenApiFile");function fsr(a,{customDomain:s,deploymentName:l,environmentType:_}){let m;s?m=s:_&&l&&(m=_===hce.WORKING_COPY?`${l}.d2.zuplo.dev`:`${l}.zuplo.app`),m?a.servers=[{url:`https://${m}`}]:a.servers=void 0}t(fsr,"addServerHost");function _sr(a){if(!a.paths)return a;let{components:s}=a,l=s?{...s}:void 0,_=[];l&&l.parameters&&(_=Object.entries(l.parameters).reduce((b,[D,A])=>(HR in A&&gce(A[HR])&&(b.push(D),l.parameters&&delete l.parameters[D]),b),[]));let m=Object.entries(a.paths).reduce((b,[D,A])=>{if(!A)return b;let M={...A},U=["delete","get","head","patch","post","put","trace","options"];return U.forEach(ne=>{let se=A[ne];if(!se)return;if(gce(se[HR])){delete M[ne];return}let{parameters:Z}=se;if(!Z)return;let Re=Z.filter(Ae=>{if(HR in Ae&&gce(Ae[HR]))return!1;if("$ref"in Ae){let ke=Ae.$ref.split("/").pop();return ke?!_.includes(ke):!0}return!0});M[ne]={...se,parameters:Re}}),U.some(ne=>!!M[ne])&&(b[D]=M),b},{});return{...a,paths:m,components:l}}t(_sr,"removeHiddenRoutesAndParams");function psr(a,{policiesConfig:s}){if(!a.paths)return a;let l=Object.entries(a.paths).reduce((_,[m,b])=>{if(!b)return _;let D={...b};return[D.delete,D.get,D.head,D.patch,D.post,D.put,D.trace,D.options].forEach(A=>{if(!A)return;let M=A["x-zuplo-route"]?.policies?.inbound?.reduce((se,Z)=>{let Re=s.policies?.find(({name:Ot})=>Ot===Z);if(!Re)return se;if(!(Re.handler.export==="CompositeInboundPolicy"))return se.concat(Z);let ke=Re.handler.options?.policies;return ke?se.concat(ke):se},[]),U=[];if(M&&M.forEach(se=>{s.policies?.forEach(Z=>{Z.name===se&&(Z.handler.export==="ApiAuthKeyInboundPolicy"||Z.handler.export==="ApiKeyInboundPolicy")&&!Z.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&U.push(Z)})}),U.length>0){let se=U.length>0&&U[0].handler&&U[0].handler.options&&U[0].handler.options.authHeader?U[0].handler.options.authHeader:"Authorization",Z=U.length>0&&U[0].handler&&U[0].handler.options&&(U[0].handler.options.authScheme||U[0].handler.options.authScheme==="")?U[0].handler.options.authScheme:"Bearer",Re=Z!==""?`${Z} ${Ylt}`:Ylt,Ae={name:se,in:"header",required:!0,example:Re,schema:{type:"string"},description:`The \`${se}\` header is used to authenticate with the API using your API key. Value is of the format \`${Re}\`.`};A.parameters?A.parameters.some(br=>"name"in br&&br.name===Ae.name)||A.parameters.unshift(Ae):A.parameters=[Ae];let ke={type:"http",scheme:Z.toLowerCase()},Ot="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(br=>"name"in br&&br.type==="apiKey"||"type"in br&&br.type==="http"&&br.scheme===Z)||(a.components.securitySchemes={...a.components.securitySchemes,[Ot]:ke}):(a.components||(a.components={}),a.components.securitySchemes={[Ot]:ke});let kt={[Ot]:[]};A.security?A.security.some(br=>br[Ot]!==void 0)||A.security.unshift(kt):A.security=[kt]}let ne=[];if(M&&M.forEach(se=>{s.policies?.forEach(Z=>{Z.name===se&&(Z.handler.export==="RateLimitInboundPolicy"||Z.handler.export==="ComplexRateLimitInboundPolicy")&&ne.push(Z)})}),ne.length>0){let se={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},Z={...se,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:se,RateLimitWithRetryAfter:Z},A.responses||(A.responses={});let Re=ne.some(Ae=>Ae.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Re?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),_[m]=D,_},{});return{...a,paths:l}}t(psr,"enrichSpecWithZuploData");function Qlt(a,s){for(let l in a)l.startsWith(s)?delete a[l]:typeof a[l]=="object"&&Qlt(a[l],s)}t(Qlt,"removePropertiesByPrefix");function dsr({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new B2({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new B2({message:"The OpenAPI document does not have the required 'info' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"});if(!("title"in s.info)||typeof s.info.title!="string")throw new B2({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(dsr,"assertIsZuploOpenApiSpec");function msr(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let U=0;U<s.length;U++)s[U]=255;for(let U=0;U<a.length;U++){let ne=a.charAt(U),se=ne.charCodeAt(0);if(s[se]!==255)throw new TypeError(ne+" is ambiguous");s[se]=U}let l=a.length,_=a.charAt(0),m=Math.log(l)/Math.log(256),b=Math.log(256)/Math.log(l);function D(U){if(U instanceof Uint8Array||(ArrayBuffer.isView(U)?U=new Uint8Array(U.buffer,U.byteOffset,U.byteLength):Array.isArray(U)&&(U=Uint8Array.from(U))),!(U instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(U.length===0)return"";let ne=0,se=0,Z=0,Re=U.length;for(;Z!==Re&&U[Z]===0;)Z++,ne++;let Ae=(Re-Z)*b+1>>>0,ke=new Uint8Array(Ae);for(;Z!==Re;){let br=U[Z],Kr=0;for(let on=Ae-1;(br!==0||Kr<se)&&on!==-1;on--,Kr++)br+=256*ke[on]>>>0,ke[on]=br%l>>>0,br=br/l>>>0;if(br!==0)throw new Error("Non-zero carry");se=Kr,Z++}let Ot=Ae-se;for(;Ot!==Ae&&ke[Ot]===0;)Ot++;let kt=_.repeat(ne);for(;Ot<Ae;++Ot)kt+=a.charAt(ke[Ot]);return kt}t(D,"encode");function A(U){if(typeof U!="string")throw new TypeError("Expected String");if(U.length===0)return new Uint8Array;let ne=0,se=0,Z=0;for(;U[ne]===_;)se++,ne++;let Re=(U.length-ne)*m+1>>>0,Ae=new Uint8Array(Re);for(;U[ne];){let br=s[U.charCodeAt(ne)];if(br===255)return;let Kr=0;for(let on=Re-1;(br!==0||Kr<Z)&&on!==-1;on--,Kr++)br+=l*Ae[on]>>>0,Ae[on]=br%256>>>0,br=br/256>>>0;if(br!==0)throw new Error("Non-zero carry");Z=Kr,ne++}let ke=Re-Z;for(;ke!==Re&&Ae[ke]===0;)ke++;let Ot=new Uint8Array(se+(Re-ke)),kt=se;for(;ke!==Re;)Ot[kt++]=Ae[ke++];return Ot}t(A,"decodeUnsafe");function M(U){let ne=A(U);if(ne)return ne;throw new Error("Non-base"+l+" character")}return t(M,"decode"),{encode:D,decodeUnsafe:A,decode:M}}t(msr,"base");var Zlt=msr;var hsr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",kle=Zlt(hsr);var Q4e="2024-09-02",eut=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function tut(){return new kT({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:Q4e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:eut[Q4e]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(tut,"getMockEnvironment");var kT=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=tut()),this.#r}constructor({build:s,runtime:l}){let _;try{if(l.__ZUPLO_CONFIG){let m=atob(l.__ZUPLO_CONFIG);_=JSON.parse(m)}if(l.ZUPLO_SYSTEM_CONFIGURATIONS){let m=new TextDecoder().decode(kle.decode(l.ZUPLO_SYSTEM_CONFIGURATIONS)),b=JSON.parse(m);for(let D of Object.keys(b))l[D]=b[D]}}catch(m){console.error("Failed to parse runtime configuration",m)}this.config=_??{},this.build=s,this.runtime=l,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get zuploEdgeApiUrl(){return this.config.zuplo_edge_api_url??"https://api.zuploedge.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var gsr=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function rut(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!gsr.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(rut,"isRestrictedEnvVariableName");function nut(a){return!!a.startsWith("ZUPLO_")}t(nut,"isZuploReadableEnvVariableName");var kIr=new Proxy({},{get(a,s){let l=String(s);switch(l){case"ZUPLO_ENVIRONMENT_TYPE":return kT.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return kT.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return kT.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return kT.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return kT.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return kT.instance.build.BUILD_ID}if(!(rut(l)&&!nut(l)))return kT.instance.runtime[l]}});function eG(a,s,l){return`_${tA(`${a}_${s}_${l}`)}`}t(eG,"getRawOperationDataIdentifierName");function Z4e(a,s,l,_){return`_${tA(a.toLowerCase())}_${s.toLowerCase()}_${l.toLowerCase()}_${_.toLowerCase()}`}t(Z4e,"getIdForParameterSchema");function e3e(a,s,l){return`_${tA(a.toLowerCase())}_${s.toLowerCase()}_rb_${tA(l.toLowerCase())}`}t(e3e,"getIdForRequestBodySchema");function tG(a,s){return`_${tA(a)}_${tA(s)}`}t(tG,"getIdForRefSchema");function tA(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(tA,"sanitizedIdentifierName");var Lmt=up(Hft(),1);import Zue from"path";var gG=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,l,_,m,b){this.type=a,this.name=s,this.prefix=l,this.value=_,this.suffix=m,this.modifier=b}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},fcr=/[$_\p{ID_Start}]/u,_cr=/[$_\u200C\u200D\p{ID_Continue}]/u,G3e=".*";function pcr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(pcr,"Re");function Yft(a,s=!1){let l=[],_=0;for(;_<a.length;){let m=a[_],b=t(function(D){if(!s)throw new TypeError(D);l.push({type:"INVALID_CHAR",index:_,value:a[_++]})},"c");if(m==="*"){l.push({type:"ASTERISK",index:_,value:a[_++]});continue}if(m==="+"||m==="?"){l.push({type:"OTHER_MODIFIER",index:_,value:a[_++]});continue}if(m==="\\"){l.push({type:"ESCAPED_CHAR",index:_++,value:a[_++]});continue}if(m==="{"){l.push({type:"OPEN",index:_,value:a[_++]});continue}if(m==="}"){l.push({type:"CLOSE",index:_,value:a[_++]});continue}if(m===":"){let D="",A=_+1;for(;A<a.length;){let M=a.substr(A,1);if(A===_+1&&fcr.test(M)||A!==_+1&&_cr.test(M)){D+=a[A++];continue}break}if(!D){b(`Missing parameter name at ${_}`);continue}l.push({type:"NAME",index:_,value:D}),_=A;continue}if(m==="("){let D=1,A="",M=_+1,U=!1;if(a[M]==="?"){b(`Pattern cannot start with "?" at ${M}`);continue}for(;M<a.length;){if(!pcr(a[M],!1)){b(`Invalid character '${a[M]}' at ${M}.`),U=!0;break}if(a[M]==="\\"){A+=a[M++]+a[M++];continue}if(a[M]===")"){if(D--,D===0){M++;break}}else if(a[M]==="("&&(D++,a[M+1]!=="?")){b(`Capturing groups are not allowed at ${M}`),U=!0;break}A+=a[M++]}if(U)continue;if(D){b(`Unbalanced pattern at ${_}`);continue}if(!A){b(`Missing pattern at ${_}`);continue}l.push({type:"REGEX",index:_,value:A}),_=M;continue}l.push({type:"CHAR",index:_,value:a[_++]})}return l.push({type:"END",index:_,value:""}),l}t(Yft,"v");function Xft(a,s={}){let l=Yft(a);s.delimiter??="/#?",s.prefixes??="./";let _=`[^${NT(s.delimiter)}]+?`,m=[],b=0,D=0,A="",M=new Set,U=t(Kr=>{if(D<l.length&&l[D].type===Kr)return l[D++].value},"a"),ne=t(()=>U("OTHER_MODIFIER")??U("ASTERISK"),"f"),se=t(Kr=>{let on=U(Kr);if(on!==void 0)return on;let{type:un,index:hr}=l[D];throw new TypeError(`Unexpected ${un} at ${hr}, expected ${Kr}`)},"d"),Z=t(()=>{let Kr="",on;for(;on=U("CHAR")??U("ESCAPED_CHAR");)Kr+=on;return Kr},"T"),Re=t(Kr=>Kr,"Se"),Ae=s.encodePart||Re,ke="",Ot=t(Kr=>{ke+=Kr},"U"),kt=t(()=>{ke.length&&(m.push(new gG(3,"","",Ae(ke),"",3)),ke="")},"$"),br=t((Kr,on,un,hr,mr)=>{let Ds=3;switch(mr){case"?":Ds=1;break;case"*":Ds=0;break;case"+":Ds=2;break}if(!on&&!un&&Ds===3){Ot(Kr);return}if(kt(),!on&&!un){if(!Kr)return;m.push(new gG(3,"","",Ae(Kr),"",Ds));return}let Pi;un?un==="*"?Pi=G3e:Pi=un:Pi=_;let Po=2;Pi===_?(Po=1,Pi=""):Pi===G3e&&(Po=0,Pi="");let Ti;if(on?Ti=on:un&&(Ti=b++),M.has(Ti))throw new TypeError(`Duplicate name '${Ti}'.`);M.add(Ti),m.push(new gG(Po,Ti,Ae(Kr),Pi,Ae(hr),Ds))},"V");for(;D<l.length;){let Kr=U("CHAR"),on=U("NAME"),un=U("REGEX");if(!on&&!un&&(un=U("ASTERISK")),on||un){let mr=Kr??"";s.prefixes.indexOf(mr)===-1&&(Ot(mr),mr=""),kt();let Ds=ne();br(mr,on,un,"",Ds);continue}let hr=Kr??U("ESCAPED_CHAR");if(hr){Ot(hr);continue}if(U("OPEN")){let mr=Z(),Ds=U("NAME"),Pi=U("REGEX");!Ds&&!Pi&&(Pi=U("ASTERISK"));let Po=Z();se("CLOSE");let Ti=ne();br(mr,Ds,Pi,Po,Ti);continue}kt(),se("END")}return m}t(Xft,"D");function NT(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(NT,"S");function Gft(a){return a&&a.ignoreCase?"ui":"u"}t(Gft,"X");function dcr(a,s,l){return Qft(Xft(a,l),s,l)}t(dcr,"Z");function NM(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(NM,"k");function Qft(a,s,l={}){l.delimiter??="/#?",l.prefixes??="./",l.sensitive??=!1,l.strict??=!1,l.end??=!0,l.start??=!0,l.endsWith="";let _=l.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?_+=NT(A.value):_+=`(?:${NT(A.value)})${NM(A.modifier)}`;continue}s&&s.push(A.name);let M=`[^${NT(l.delimiter)}]+?`,U=A.value;if(A.type===1?U=M:A.type===0&&(U=G3e),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?_+=`(${U})${NM(A.modifier)}`:_+=`((?:${U})${NM(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){_+=`(?:${NT(A.prefix)}(${U})${NT(A.suffix)})`,_+=NM(A.modifier);continue}_+=`(?:${NT(A.prefix)}`,_+=`((?:${U})(?:`,_+=NT(A.suffix),_+=NT(A.prefix),_+=`(?:${U}))*)${NT(A.suffix)})`,A.modifier===0&&(_+="?")}let m=`[${NT(l.endsWith)}]|$`,b=`[${NT(l.delimiter)}]`;if(l.end)return l.strict||(_+=`${b}?`),l.endsWith.length?_+=`(?=${m})`:_+="$",new RegExp(_,Gft(l));l.strict||(_+=`(?:${b}(?=${m}))?`);let D=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(D=l.delimiter.indexOf(A)>-1)}return D||(_+=`(?=${b}|${m})`),new RegExp(_,Gft(l))}t(Qft,"F");var h3={delimiter:"",prefixes:"",sensitive:!0,strict:!0},mcr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},hcr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function gcr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(gcr,"J");function Zft(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(Zft,"Q");function ycr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(ycr,"Ee");function e_t(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(e_t,"W");var t_t=["ftp","file","http","https","ws","wss"];function r_t(a){if(!a)return!0;for(let s of t_t)if(a.test(s))return!0;return!1}t(r_t,"N");function vcr(a,s){if(a=Zft(a,"#"),s||a==="")return a;let l=new URL("https://example.com");return l.hash=a,l.hash?l.hash.substring(1,l.hash.length):""}t(vcr,"te");function bcr(a,s){if(a=Zft(a,"?"),s||a==="")return a;let l=new URL("https://example.com");return l.search=a,l.search?l.search.substring(1,l.search.length):""}t(bcr,"re");function Scr(a,s){return s||a===""?a:e_t(a)?s_t(a):i_t(a)}t(Scr,"ne");function Tcr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.password=a,l.password}t(Tcr,"se");function xcr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.username=a,l.username}t(xcr,"ie");function Ccr(a,s,l){if(l||a==="")return a;if(s&&!t_t.includes(s))return new URL(`${s}:${a}`).pathname;let _=a[0]=="/";return a=new URL(_?a:"/-"+a,"https://example.com").pathname,_||(a=a.substring(2,a.length)),a}t(Ccr,"ae");function Ecr(a,s,l){return n_t(s)===a&&(a=""),l||a===""?a:a_t(a)}t(Ecr,"oe");function Dcr(a,s){return a=ycr(a,":"),s||a===""?a:K3e(a)}t(Dcr,"ce");function n_t(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(n_t,"_");function K3e(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(K3e,"y");function kcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(kcr,"le");function wcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(wcr,"fe");function i_t(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(i_t,"z");function s_t(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(s_t,"j");function a_t(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(a_t,"K");function Pcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(Pcr,"he");function Acr(a){return a===""?a:new URL(`data:${a}`).pathname}t(Acr,"ue");function Ncr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(Ncr,"de");function Icr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(Icr,"pe");var Ocr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=Yft(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#w()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#E()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#x()?this.#d(3):(this.#C()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#x()&&this.#i(5,1);break;case 4:this.#x()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#k()&&!this.#c?this.#i(6,1):this.#C()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#C()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 7:this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 8:this.#D()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#i(a,s){switch(this.#a){case 0:break;case 1:this.#e.protocol=this.#T();break;case 2:break;case 3:this.#e.username=this.#T();break;case 4:this.#e.password=this.#T();break;case 5:this.#e.hostname=this.#T();break;case 6:this.#e.port=this.#T();break;case 7:this.#e.pathname=this.#T();break;case 8:this.#e.search=this.#T();break;case 9:this.#e.hash=this.#T();break;case 10:break}this.#a!==0&&a!==10&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(a)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(a)&&(this.#e.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&a===9&&(this.#e.search??="")),this.#f(a,s)}#f(a,s){this.#a=a,this.#p=this.#t+s,this.#t+=s,this.#s=0}#v(){this.#t=this.#p,this.#s=0}#d(a){this.#v(),this.#a=a}#u(a){return a<0&&(a=this.#n.length-a),a<this.#n.length?this.#n[a]:this.#n[this.#n.length-1]}#m(a,s){let l=this.#u(a);return l.value===s&&(l.type==="CHAR"||l.type==="ESCAPED_CHAR"||l.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#E(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#x(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#k(){return this.#m(this.#t,":")}#C(){return this.#m(this.#t,"/")}#y(){if(this.#m(this.#t,"?"))return!0;if(this.#n[this.#t].value!=="?")return!1;let a=this.#u(this.#t-1);return a.type!=="NAME"&&a.type!=="REGEX"&&a.type!=="CLOSE"&&a.type!=="ASTERISK"}#D(){return this.#m(this.#t,"#")}#w(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,h3),a.encodePart=K3e;let s=dcr(this.#T(),void 0,a);this.#l=r_t(s)}},H3e=["protocol","username","password","hostname","port","pathname","search","hash"],m3="*";function Kft(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let l=new URL(a,s);return{protocol:l.protocol.substring(0,l.protocol.length-1),username:l.username,password:l.password,hostname:l.hostname,port:l.port,pathname:l.pathname,search:l.search!==""?l.search.substring(1,l.search.length):void 0,hash:l.hash!==""?l.hash.substring(1,l.hash.length):void 0}}t(Kft,"ge");function aA(a,s){return s?hG(a):a}t(aA,"b");function mG(a,s,l){let _;if(typeof s.baseURL=="string")try{_=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=aA(_.protocol.substring(0,_.protocol.length-1),l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=aA(_.username,l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=aA(_.password,l)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=aA(_.hostname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=aA(_.port,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=aA(_.pathname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=aA(_.search.substring(1,_.search.length),l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=aA(_.hash.substring(1,_.hash.length),l))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Dcr(s.protocol,l)),typeof s.username=="string"&&(a.username=xcr(s.username,l)),typeof s.password=="string"&&(a.password=Tcr(s.password,l)),typeof s.hostname=="string"&&(a.hostname=Scr(s.hostname,l)),typeof s.port=="string"&&(a.port=Ecr(s.port,a.protocol,l)),typeof s.pathname=="string"){if(a.pathname=s.pathname,_&&!gcr(a.pathname,l)){let m=_.pathname.lastIndexOf("/");m>=0&&(a.pathname=aA(_.pathname.substring(0,m+1),l)+a.pathname)}a.pathname=Ccr(a.pathname,a.protocol,l)}return typeof s.search=="string"&&(a.search=bcr(s.search,l)),typeof s.hash=="string"&&(a.hash=vcr(s.hash,l)),a}t(mG,"w");function hG(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(hG,"C");function Fcr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(Fcr,"Oe");function Lcr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let l=".*",_=`[^${Fcr(s.delimiter)}]+?`,m=/[$_\u200C\u200D\p{ID_Continue}]/u,b="";for(let D=0;D<a.length;++D){let A=a[D];if(A.type===3){if(A.modifier===3){b+=hG(A.value);continue}b+=`{${hG(A.value)}}${NM(A.modifier)}`;continue}let M=A.hasCustomName(),U=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),ne=D>0?a[D-1]:null,se=D<a.length-1?a[D+1]:null;if(!U&&M&&A.type===1&&A.modifier===3&&se&&!se.prefix.length&&!se.suffix.length)if(se.type===3){let Z=se.value.length>0?se.value[0]:"";U=m.test(Z)}else U=!se.hasCustomName();if(!U&&!A.prefix.length&&ne&&ne.type===3){let Z=ne.value[ne.value.length-1];U=s.prefixes.includes(Z)}U&&(b+="{"),b+=hG(A.prefix),M&&(b+=`:${A.name}`),A.type===2?b+=`(${A.value})`:A.type===1?M||(b+=`(${_})`):A.type===0&&(!M&&(!ne||ne.type===3||ne.modifier!==3||U||A.prefix!=="")?b+="*":b+=`(${l})`),A.type===1&&M&&A.suffix.length&&m.test(A.suffix[0])&&(b+="\\"),b+=hG(A.suffix),U&&(b+="}"),A.modifier!==3&&(b+=NM(A.modifier))}return b}t(Lcr,"ke");var o_t=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,l){try{let _;if(typeof s=="string"?_=s:l=s,typeof a=="string"){let A=new Ocr(a);if(A.parse(),a=A.result,_===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=_}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(_)throw new TypeError("parameter 1 is not of type 'string'.")}typeof l>"u"&&(l={ignoreCase:!1});let m={ignoreCase:l.ignoreCase===!0},b={pathname:m3,protocol:m3,username:m3,password:m3,hostname:m3,port:m3,search:m3,hash:m3};this.#r=mG(b,a,!0),n_t(this.#r.protocol)===this.#r.port&&(this.#r.port="");let D;for(D of H3e){if(!(D in this.#r))continue;let A={},M=this.#r[D];switch(this.#e[D]=[],D){case"protocol":Object.assign(A,h3),A.encodePart=K3e;break;case"username":Object.assign(A,h3),A.encodePart=kcr;break;case"password":Object.assign(A,h3),A.encodePart=wcr;break;case"hostname":Object.assign(A,mcr),e_t(M)?A.encodePart=s_t:A.encodePart=i_t;break;case"port":Object.assign(A,h3),A.encodePart=a_t;break;case"pathname":r_t(this.#n.protocol)?(Object.assign(A,hcr,m),A.encodePart=Pcr):(Object.assign(A,h3,m),A.encodePart=Acr);break;case"search":Object.assign(A,h3,m),A.encodePart=Ncr;break;case"hash":Object.assign(A,h3,m),A.encodePart=Icr;break}try{this.#s[D]=Xft(M,A),this.#n[D]=Qft(this.#s[D],this.#e[D],A),this.#t[D]=Lcr(this.#s[D],A),this.#p=this.#p||this.#s[D].some(U=>U.type===2)}catch{throw new TypeError(`invalid ${D} pattern '${this.#r[D]}'.`)}}}catch(_){throw new TypeError(`Failed to construct 'URLPattern': ${_.message}`)}}test(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?l=mG(l,a,!1):l=mG(l,Kft(a,s),!1)}catch{return!1}let _;for(_ of H3e)if(!this.#n[_].exec(l[_]))return!1;return!0}exec(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?l=mG(l,a,!1):l=mG(l,Kft(a,s),!1)}catch{return null}let _={};s?_.inputs=[a,s]:_.inputs=[a];let m;for(m of H3e){let b=this.#n[m].exec(l[m]);if(!b)return null;let D={};for(let[A,M]of this.#e[m].entries())if(typeof M=="string"||typeof M=="number"){let U=b[A+1];D[M]=U}_[m]={input:l[m]??"",groups:D}}return _}static compareComponent(a,s,l){let _=t((A,M)=>{for(let U of["type","modifier","prefix","value","suffix"]){if(A[U]<M[U])return-1;if(A[U]!==M[U])return 1}return 0},"o"),m=new gG(3,"","","","",3),b=new gG(0,"","","","",3),D=t((A,M)=>{let U=0;for(;U<Math.min(A.length,M.length);++U){let ne=_(A[U],M[U]);if(ne)return ne}return A.length===M.length?0:_(A[U]??m,M[U]??m)},"s");return!s.#t[a]&&!l.#t[a]?0:s.#t[a]&&!l.#t[a]?D(s.#s[a],[b]):!s.#t[a]&&l.#t[a]?D([b],l.#s[a]):D(s.#s[a],l.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=o_t);import{AssertionError as Rcr}from"assert";function oA(a,s){if(a===!1)throw new Rcr({message:s})}t(oA,"assert");var Ac;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Ac||(Ac={}));function IM(a){return a.type===Ac.Object}t(IM,"isAstObject");function cA(a){return a.type===Ac.Property}t(cA,"isAstProperty");function c_t(a){return a.type===Ac.Array}t(c_t,"isAstArray");function OM(a){return a.type===Ac.Literal}t(OM,"isAstLiteral");function BO(a){if(a===void 0)throw new Error("Node is undefined");if(!IM(a))throw new Error("Node is not object")}t(BO,"assertAstObject");import{findNodeAtLocation as Mcr,getNodeValue as jcr,printParseErrorCode as Bcr,visit as Ucr}from"jsonc-parser";var $cr={DEFAULT:{allowTrailingComma:!1}};function yG(a,s=[],l=$cr.DEFAULT){let _={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function m(M){_.type==="property"&&(_.length=M-_.offset,_=_.parent)}t(m,"ensurePropertyComplete");function b(M){return _.children?.push(M),M}t(b,"onValue"),Ucr(a,{onObjectBegin:t((M,U,ne)=>{_=b({type:"object",offset:M,length:-1,line:U+1,column:ne+1,parent:_,children:[]})},"onObjectBegin"),onObjectProperty:t((M,U,ne,se,Z)=>{_=b({type:"property",offset:U,length:-1,line:se+1,column:Z+1,parent:_,children:[]}),_.children?.push({type:"string",value:M,offset:U,length:ne,line:se,column:Z,parent:_})},"onObjectProperty"),onObjectEnd:t((M,U)=>{m(M+U),_.length=M+U-_.offset,_=_.parent,m(M+U)},"onObjectEnd"),onArrayBegin:t((M,U,ne,se)=>{_=b({type:"array",offset:M,length:-1,line:ne+1,column:se+1,parent:_,children:[]})},"onArrayBegin"),onArrayEnd:t((M,U)=>{_.length=M+U-_.offset,_=_.parent,m(M+U)},"onArrayEnd"),onLiteralValue:t((M,U,ne,se,Z)=>{b({type:Jcr(M),offset:U,length:ne,line:se+1,column:Z+1,parent:_,value:M}),m(U+ne)},"onLiteralValue"),onSeparator:t((M,U)=>{_.type==="property"&&(M===":"?_.colonOffset=U:M===","&&m(U))},"onSeparator"),onError:t((M,U,ne,se,Z)=>{s.push({error:M,offset:U,length:ne,line:se+1,column:Z+1})},"onError")},l);let A=_.children[0];return A&&delete A.parent,A}t(yG,"parse");function Jcr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(Jcr,"getNodeType");function Y3e(a,s){return Mcr(a,s)}t(Y3e,"findNodeAtLocation");function vG(a){return jcr(a)}t(vG,"getNodeValue");function l_t(a){return Bcr(a)}t(l_t,"printParseErrorCode");var bG=class{static{t(this,"AstAdapter")}parse(s){let _=yG(s,[]);if(_)return this.parseNode(_,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,l){switch(s.type){case"object":return this.createObject(s,l);case"array":return this.createArray(s,l);case"property":return this.createProperty(s,l);case"string":return this.createLiteral(s,l);case"number":return this.createLiteral(s,l);case"boolean":return this.createLiteral(s,l);case"null":return this.createLiteral(s,l)}}createLiteral(s,l){return{type:Ac.Literal,location:{line:s.line,column:s.column},parent:l,value:s.type==="null"?null:s.value}}createObject(s,l){let _={type:Ac.Object,children:[],parent:l,location:{line:s.line,column:s.column}};return s.children?.forEach(m=>{_.children.push(this.parseNode(m,_))}),_}createProperty(s,l){oA(s.children?.length===2,"Invalid property node");let _={type:Ac.Property,location:{line:s.line,column:s.column},parent:l,name:null,value:null};return _.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Ac.Identifier,parent:_},_.value=this.parseNode(s.children[1],_),_}createArray(s,l){let _={type:Ac.Array,location:{line:s.line,column:s.column},parent:l,children:[]};return s.children?.forEach(m=>_.children.push(this.parseNode(m,_))),_}};var $C={createLiteral:t((a,s)=>({type:Ac.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Ac.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Ac.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,l)=>{let _={type:Ac.Property,parent:l,name:null,value:s};return _.name={value:a,type:Ac.Identifier,parent:_},_.value.parent=_,_},"createProperty"),createArrayOfLiterals:t((a,s)=>{let l={type:Ac.Array,parent:s,children:[]};for(let _ of a)l.children.push($C.createLiteral(_,l));return l},"createArrayOfLiterals")};var zcr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,SG=class{static{t(this,"SourceGenerator")}generate(s){let l=[];return this.generateSource(l,s),l.join("")}generateSource(s,l){switch(l.type){case Ac.Array:return this.generateArray(s,l);case Ac.Object:return this.generateObject(s,l);case Ac.Property:return this.generateProperty(s,l);case Ac.Literal:return this.generateLiteral(s,l);case Ac.FunctionCall:return this.generateFunctionCall(s,l);case Ac.Identifier:return this.generateIdentifier(s,l);case Ac.Raw:return this.generateRaw(s,l);case Ac.TemplateString:return this.generateTemplateString(s,l)}}generateArray(s,l){s.push("["),l.children.map(_=>{this.generateSource(s,_),s.push(",")}),s.push("]")}generateObject(s,l){s.push("{"),l.children.forEach(_=>{this.generateSource(s,_),s.push(",")}),s.push("}")}generateProperty(s,l){this.generateIdentifier(s,l.name),s.push(":"),this.generateSource(s,l.value)}generateFunctionCall(s,l){s.push(l.name.value),s.push("("),l.children.forEach((_,m,b)=>{this.generateSource(s,_),m<b.length&&s.push(",")}),s.push(")")}generateRaw(s,l){s.push(l.value)}generateTemplateString(s,l){s.push("`"),s.push(l.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,l){if(l.value===null)return s.push("null");switch(typeof l.value){case"number":case"boolean":return s.push(`${l.value}`);case"string":{let _=l.value,m=JSON.stringify(_);return s.push(`${m}`)}}}generateIdentifier(s,l){let _=zcr.test(l.value)?l.value:`'${l.value}'`;s.push(_)}};import{parse as qcr}from"@swc/core";import Vcr from"fs/promises";var u_t=t(async a=>{let s=new Set;try{let l=await Vcr.readFile(a,"utf-8");(await qcr(l,{syntax:"typescript"})).body.forEach(m=>{m.type==="ExportDefaultDeclaration"||m.type==="ExportDefaultExpression"?s.add("default"):m.type==="ExportDeclaration"&&m.declaration.type==="FunctionDeclaration"?s.add(m.declaration.identifier.value):m.type==="ExportDeclaration"&&m.declaration.type==="VariableDeclaration"&&m.declaration.declarations[0].id.type==="Identifier"&&s.add(m.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var f_t={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var X3e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var __t={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var Q3e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var Z3e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var Emt=up(Gdt(),1),Dmt=up(Cmt(),1);var Vue=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new Dmt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,Emt.default)(this.ajv,{mode:"fast"})}addSchema(s,l){this.ajv.addSchema(s,l)}compile(s){let l=this.ajv.compile(s);return t(m=>({isValid:l(m),errors:this.toSimpleErrors(l.errors,m),warnings:[]}),"validator")}toSimpleErrors(s,l){let _=[];return s?.forEach(m=>{m.keyword==="enum"&&m.params.allowedValues&&Array.isArray(m.params.allowedValues)&&(m.message+=`; ${m.params.allowedValues.join(", ")}`),m.instancePath&&(m.instancePath=m.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let b={details:{}},D=m.instancePath.split("/");if(D.length>2){let M=D[1],U=D[2]?parseInt(D[2]):0,ne=D[3],se=isNaN(U)?void 0:l[M][U][ne];b={details:{property:M,index:U,field:ne,fieldValue:se}}}if(m.keyword==="required"&&m.params.missingProperty&&m.instancePath&&(m.message=`A 'path' is missing required property '${m.params.missingProperty}'`),m.keyword==="additionalProperties"&&m.params.additionalProperty&&m.instancePath&&(m.message=`A 'path' should NOT include property '${m.params.additionalProperty}'`),m.keyword==="type"&&m.params.type&&m.instancePath){let M=m.instancePath.split("/"),U=M[M.length-1];m.message=`Value of property '${U}' must be '${m.params.type}'`}let A=Object.assign(m,b);_.push(A)}),_}};var D3=Vue.instance;D3.addSchema(Z3e,"route-configuration.schema.json");D3.addSchema(__t,"policy-configuration.schema.json");D3.addSchema(X3e,"policies.schema.json");D3.addSchema(Q3e,"open-api-route-configuration.schema.json");D3.addSchema(f_t,"fragments.schema.json");var D5r=D3.compile(Z3e),kmt=D3.compile(Q3e),d8e=D3.compile(X3e);var Wue=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=d8e(s),this.results}};var Hue=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=kmt(s),this.results}};import Xmr from"path";var m8e=/\$import\((.*)\)/,Gue=/\$env\((.*?)\)/g;var pA=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,l,_,m){super(s),this.location={file:l,namespace:"",line:_?_.line:0,column:_?_.column:0,length:0,lineText:m??"",suggestion:""}}},Ymr=t(a=>{let s=[],l=a;for(;l.parent;)s.push(l),l=l.parent;return s.reverse()},"invertTree"),k3=t((a,s)=>{if(!a)return!1;let l=Ymr(a);return s.split("/").every((b,D)=>{let A=l[D];return A?b==="*"||cA(A)&&A.name.value===b?!0:b==="{}"?A.type===Ac.Object:b==="[]"?A.type===Ac.Array:!1:!1})},"testPosition");var Kue=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),IM(s)?s.children.forEach(l=>{this.visitor(l)}):c_t(s)?s.children.forEach(l=>{this.visitor(l)}):cA(s)&&this.visitor(s.value)}},wmt=t((a,s,l)=>_=>{if(!cA(_)||!OM(_.value)||typeof _.value.value!="string")return;if(!a.some(b=>k3(_,b))){Gue.test(_.value.value)&&s.push(new pA("An $env() statement is not expected at this location.",l,_.location,_.value.value));return}let m=new RegExp(Gue).exec(_.value.value);if(m?.length===2&&m[0]===_.value.value){let b={type:Ac.Raw,parent:null,value:`environment["${m[1]}"]`};_.value=b}else{let b=_.value.value.replaceAll(new RegExp(Gue),(D,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);b!==_.value.value&&(_.value=$C.createTemplateString(b,_))}},"getEnvStatementTransformer");var eK="config/routes.json",Qmr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Zmr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Pmt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],ehr="handler/{}/options/{}/rewritePattern",thr="handler/{}/options/{}/baseUrl",Yue=class extends Kue{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let l=this.addedImports.get(s);if(!l)throw new Error("Import name is undefined. This should not happen.");return l}getImports(){let s=[];return this.addedImports.forEach((l,_)=>{s.push({name:l,path:_})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!cA(s)||!OM(s.value)||typeof s.value.value!="string")&&k3(s,ehr)){if(!s.parent||!IM(s.parent)){this.errors.push(new pA("Invalid node, expected object",eK,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Amt(l)},m=$C.createProperty("__rewriteFunction",_,s);s.parent.children.push(m)}}rewriteForwardFunction(s){if(!(!cA(s)||!OM(s.value)||typeof s.value.value!="string")&&k3(s,thr)){if(!s.parent||!IM(s.parent)){this.errors.push(new pA("Invalid node, expected object",eK,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Amt(l)},m=$C.createProperty("__rewriteFunction",_,s);s.parent.children.push(m)}}replaceImportStatements(s){if(!cA(s)||!OM(s.value))return;let l=s.value.value;if(typeof l!="string")return;if(!Zmr.some(A=>k3(s,A))&&!Pmt.some(A=>k3(s,A))){if(m8e.test(l)){if(s.name.value==="$ref")return;this.errors.push(new pA("An $import() statement is not expected at this location.",eK,s.location,l))}return}let _=m8e.exec(l);if(Pmt.some(A=>k3(s,A))&&!_)return;if(!_){this.errors.push(new pA("Invalid $import() statement",eK,s.location,l));return}let m=_[1];m.startsWith(".")&&(m=Xmr.join("..",m));let b=this.getImportName(m),D={type:Ac.Identifier,parent:s.parent,value:b};s.value=D}replaceEnvStatements=wmt(Qmr,this.errors,eK)};function Amt(a){return`(request, context) => {
|
|
561
561
|
const { params, url, query, method, headers } = request;
|
|
562
562
|
const { host, hostname, origin, pathname, port, search } = new URL(url);
|
|
563
563
|
const e = encodeURIComponent;
|
package/index.minified.js
CHANGED
|
@@ -557,7 +557,7 @@ globstar while`,s,Z,l,Re,Ae),this.matchOne(s.slice(Z),l.slice(Re),_))return this
|
|
|
557
557
|
>>> no match, partial?`,s,Z,l,Re),Z===M))}let ke;if(typeof ne=="string"?(ke=se===ne,this.debug("string match",ne,se,ke)):(ke=ne.test(se),this.debug("pattern match",ne,se,ke)),!ke)return!1}if(D===M&&A===U)return!0;if(D===M)return _;if(A===U)return D===M-1&&s[D]==="";throw new Error("wtf?")}braceExpand(){return $at(this.pattern,this.options)}parse(s){gH(s);let l=this.options;if(s==="**")return F0;if(s==="")return"";let _,m=null;(_=s.match(nZt))?m=l.dot?sZt:iZt:(_=s.match(HQt))?m=(l.nocase?l.dot?XQt:YQt:l.dot?KQt:GQt)(_[1]):(_=s.match(aZt))?m=(l.nocase?l.dot?cZt:oZt:l.dot?lZt:uZt)(_):(_=s.match(QQt))?m=l.dot?eZt:ZQt:(_=s.match(tZt))&&(m=rZt);let b=ZR.fromGlob(s,this.options).toMMPattern();return m&&typeof b=="object"&&Reflect.defineProperty(b,"test",{value:m}),b}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let s=this.set;if(!s.length)return this.regexp=!1,this.regexp;let l=this.options,_=l.noglobstar?pZt:l.dot?dZt:mZt,m=new Set(l.nocase?["i"]:[]),b=s.map(M=>{let U=M.map(ne=>{if(ne instanceof RegExp)for(let se of ne.flags.split(""))m.add(se);return typeof ne=="string"?bZt(ne):ne===F0?F0:ne._src});return U.forEach((ne,se)=>{let Z=U[se+1],Re=U[se-1];ne!==F0||Re===F0||(Re===void 0?Z!==void 0&&Z!==F0?U[se+1]="(?:\\/|"+_+"\\/)?"+Z:U[se]=_:Z===void 0?U[se-1]=Re+"(?:\\/|"+_+")?":Z!==F0&&(U[se-1]=Re+"(?:\\/|\\/"+_+"\\/)"+Z,U[se+1]=F0))}),U.filter(ne=>ne!==F0).join("/")}).join("|"),[D,A]=s.length>1?["(?:",")"]:["",""];b="^"+D+b+A+"$",this.negate&&(b="^(?!"+b+").+$");try{this.regexp=new RegExp(b,[...m].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(s){return this.preserveMultipleSlashes?s.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(s)?["",...s.split(/\/+/)]:s.split(/\/+/)}match(s,l=this.partial){if(this.debug("match",s,this.pattern),this.comment)return!1;if(this.empty)return s==="";if(s==="/"&&l)return!0;let _=this.options;this.isWindows&&(s=s.split("\\").join("/"));let m=this.slashSplit(s);this.debug(this.pattern,"split",m);let b=this.set;this.debug(this.pattern,"set",b);let D=m[m.length-1];if(!D)for(let A=m.length-2;!D&&A>=0;A--)D=m[A];for(let A=0;A<b.length;A++){let M=b[A],U=m;if(_.matchBase&&M.length===1&&(U=[D]),this.matchOne(U,M,l))return _.flipNegate?!0:!this.negate}return _.flipNegate?!1:this.negate}static defaults(s){return j1.defaults(s).Minimatch}};j1.AST=ZR;j1.Minimatch=U2;j1.escape=eM;j1.unescape=kC;import{fileURLToPath as QZt}from"url";var tM=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,zat=new Set,f6e=typeof process=="object"&&process?process:{},qat=t((a,s,l,_)=>{typeof f6e.emitWarning=="function"?f6e.emitWarning(a,s,l,_):console.error(`[${l}] ${s}: ${a}`)},"emitWarning"),Ace=globalThis.AbortController,Jat=globalThis.AbortSignal;if(typeof Ace>"u"){Jat=class{static{t(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(_,m){this._onabort.push(m)}},Ace=class{static{t(this,"AbortController")}constructor(){s()}signal=new Jat;abort(_){if(!this.signal.aborted){this.signal.reason=_,this.signal.aborted=!0;for(let m of this.signal._onabort)m(_);this.signal.onabort?.(_)}}};let a=f6e.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",s=t(()=>{a&&(a=!1,qat("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",s))},"warnACPolyfill")}var SZt=t(a=>!zat.has(a),"shouldWarn"),l4r=Symbol("type"),t3=t(a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),"isPosInt"),Vat=t(a=>t3(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?rM:null:null,"getUintArray"),rM=class extends Array{static{t(this,"ZeroArray")}constructor(s){super(s),this.fill(0)}},_6e=class a{static{t(this,"Stack")}heap;length;static#r=!1;static create(s){let l=Vat(s);if(!l)return[];a.#r=!0;let _=new a(s,l);return a.#r=!1,_}constructor(s,l){if(!a.#r)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new l(s),this.length=0}push(s){this.heap[this.length++]=s}pop(){return this.heap[--this.length]}},vH=class a{static{t(this,"LRUCache")}#r;#n;#e;#t;#s;#p;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#_;#c;#l;#i;#f;#v;#d;#u;#m;#g;#E;#x;#b;#k;#C;#y;static unsafeExposeInternals(s){return{starts:s.#x,ttls:s.#b,sizes:s.#E,keyMap:s.#c,keyList:s.#l,valList:s.#i,next:s.#f,prev:s.#v,get head(){return s.#d},get tail(){return s.#u},free:s.#m,isBackgroundFetch:t(l=>s.#h(l),"isBackgroundFetch"),backgroundFetch:t((l,_,m,b)=>s.#j(l,_,m,b),"backgroundFetch"),moveToTail:t(l=>s.#U(l),"moveToTail"),indexes:t(l=>s.#P(l),"indexes"),rindexes:t(l=>s.#A(l),"rindexes"),isStale:t(l=>s.#S(l),"isStale")}}get max(){return this.#r}get maxSize(){return this.#n}get calculatedSize(){return this.#_}get size(){return this.#a}get fetchMethod(){return this.#s}get memoMethod(){return this.#p}get dispose(){return this.#e}get disposeAfter(){return this.#t}constructor(s){let{max:l=0,ttl:_,ttlResolution:m=1,ttlAutopurge:b,updateAgeOnGet:D,updateAgeOnHas:A,allowStale:M,dispose:U,disposeAfter:ne,noDisposeOnSet:se,noUpdateTTL:Z,maxSize:Re=0,maxEntrySize:Ae=0,sizeCalculation:ke,fetchMethod:Ot,memoMethod:kt,noDeleteOnFetchRejection:br,noDeleteOnStaleGet:Kr,allowStaleOnFetchRejection:on,allowStaleOnFetchAbort:un,ignoreFetchAbort:hr}=s;if(l!==0&&!t3(l))throw new TypeError("max option must be a nonnegative integer");let mr=l?Vat(l):Array;if(!mr)throw new Error("invalid max value: "+l);if(this.#r=l,this.#n=Re,this.maxEntrySize=Ae||this.#n,this.sizeCalculation=ke,this.sizeCalculation){if(!this.#n&&!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(kt!==void 0&&typeof kt!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#p=kt,Ot!==void 0&&typeof Ot!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#s=Ot,this.#C=!!Ot,this.#c=new Map,this.#l=new Array(l).fill(void 0),this.#i=new Array(l).fill(void 0),this.#f=new mr(l),this.#v=new mr(l),this.#d=0,this.#u=0,this.#m=_6e.create(l),this.#a=0,this.#_=0,typeof U=="function"&&(this.#e=U),typeof ne=="function"?(this.#t=ne,this.#g=[]):(this.#t=void 0,this.#g=void 0),this.#k=!!this.#e,this.#y=!!this.#t,this.noDisposeOnSet=!!se,this.noUpdateTTL=!!Z,this.noDeleteOnFetchRejection=!!br,this.allowStaleOnFetchRejection=!!on,this.allowStaleOnFetchAbort=!!un,this.ignoreFetchAbort=!!hr,this.maxEntrySize!==0){if(this.#n!==0&&!t3(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!t3(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#T()}if(this.allowStale=!!M,this.noDeleteOnStaleGet=!!Kr,this.updateAgeOnGet=!!D,this.updateAgeOnHas=!!A,this.ttlResolution=t3(m)||m===0?m:1,this.ttlAutopurge=!!b,this.ttl=_||0,this.ttl){if(!t3(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#D()}if(this.#r===0&&this.ttl===0&&this.#n===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#r&&!this.#n){let Ds="LRU_CACHE_UNBOUNDED";SZt(Ds)&&(zat.add(Ds),qat("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Ds,a))}}getRemainingTTL(s){return this.#c.has(s)?1/0:0}#D(){let s=new rM(this.#r),l=new rM(this.#r);this.#b=s,this.#x=l,this.#N=(b,D,A=tM.now())=>{if(l[b]=D!==0?A:0,s[b]=D,D!==0&&this.ttlAutopurge){let M=setTimeout(()=>{this.#S(b)&&this.#O(this.#l[b],"expire")},D+1);M.unref&&M.unref()}},this.#w=b=>{l[b]=s[b]!==0?tM.now():0},this.#o=(b,D)=>{if(s[D]){let A=s[D],M=l[D];if(!A||!M)return;b.ttl=A,b.start=M,b.now=_||m();let U=b.now-M;b.remainingTTL=A-U}};let _=0,m=t(()=>{let b=tM.now();if(this.ttlResolution>0){_=b;let D=setTimeout(()=>_=0,this.ttlResolution);D.unref&&D.unref()}return b},"getNow");this.getRemainingTTL=b=>{let D=this.#c.get(b);if(D===void 0)return 0;let A=s[D],M=l[D];if(!A||!M)return 1/0;let U=(_||m())-M;return A-U},this.#S=b=>{let D=l[b],A=s[b];return!!A&&!!D&&(_||m())-D>A}}#w=t(()=>{},"#updateItemAge");#o=t(()=>{},"#statusTTL");#N=t(()=>{},"#setItemTTL");#S=t(()=>!1,"#isStale");#T(){let s=new rM(this.#r);this.#_=0,this.#E=s,this.#I=l=>{this.#_-=s[l],s[l]=0},this.#L=(l,_,m,b)=>{if(this.#h(_))return 0;if(!t3(m))if(b){if(typeof b!="function")throw new TypeError("sizeCalculation must be a function");if(m=b(_,l),!t3(m))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 m},this.#F=(l,_,m)=>{if(s[l]=_,this.#n){let b=this.#n-s[l];for(;this.#_>b;)this.#M(!0)}this.#_+=s[l],m&&(m.entrySize=_,m.totalCalculatedSize=this.#_)}}#I=t(s=>{},"#removeItemSize");#F=t((s,l,_)=>{},"#addItemSize");#L=t((s,l,_,m)=>{if(_||m)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#P({allowStale:s=this.allowStale}={}){if(this.#a)for(let l=this.#u;!(!this.#R(l)||((s||!this.#S(l))&&(yield l),l===this.#d));)l=this.#v[l]}*#A({allowStale:s=this.allowStale}={}){if(this.#a)for(let l=this.#d;!(!this.#R(l)||((s||!this.#S(l))&&(yield l),l===this.#u));)l=this.#f[l]}#R(s){return s!==void 0&&this.#c.get(this.#l[s])===s}*entries(){for(let s of this.#P())this.#i[s]!==void 0&&this.#l[s]!==void 0&&!this.#h(this.#i[s])&&(yield[this.#l[s],this.#i[s]])}*rentries(){for(let s of this.#A())this.#i[s]!==void 0&&this.#l[s]!==void 0&&!this.#h(this.#i[s])&&(yield[this.#l[s],this.#i[s]])}*keys(){for(let s of this.#P()){let l=this.#l[s];l!==void 0&&!this.#h(this.#i[s])&&(yield l)}}*rkeys(){for(let s of this.#A()){let l=this.#l[s];l!==void 0&&!this.#h(this.#i[s])&&(yield l)}}*values(){for(let s of this.#P())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}*rvalues(){for(let s of this.#A())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(s,l={}){for(let _ of this.#P()){let m=this.#i[_],b=this.#h(m)?m.__staleWhileFetching:m;if(b!==void 0&&s(b,this.#l[_],this))return this.get(this.#l[_],l)}}forEach(s,l=this){for(let _ of this.#P()){let m=this.#i[_],b=this.#h(m)?m.__staleWhileFetching:m;b!==void 0&&s.call(l,b,this.#l[_],this)}}rforEach(s,l=this){for(let _ of this.#A()){let m=this.#i[_],b=this.#h(m)?m.__staleWhileFetching:m;b!==void 0&&s.call(l,b,this.#l[_],this)}}purgeStale(){let s=!1;for(let l of this.#A({allowStale:!0}))this.#S(l)&&(this.#O(this.#l[l],"expire"),s=!0);return s}info(s){let l=this.#c.get(s);if(l===void 0)return;let _=this.#i[l],m=this.#h(_)?_.__staleWhileFetching:_;if(m===void 0)return;let b={value:m};if(this.#b&&this.#x){let D=this.#b[l],A=this.#x[l];if(D&&A){let M=D-(tM.now()-A);b.ttl=M,b.start=Date.now()}}return this.#E&&(b.size=this.#E[l]),b}dump(){let s=[];for(let l of this.#P({allowStale:!0})){let _=this.#l[l],m=this.#i[l],b=this.#h(m)?m.__staleWhileFetching:m;if(b===void 0||_===void 0)continue;let D={value:b};if(this.#b&&this.#x){D.ttl=this.#b[l];let A=tM.now()-this.#x[l];D.start=Math.floor(Date.now()-A)}this.#E&&(D.size=this.#E[l]),s.unshift([_,D])}return s}load(s){this.clear();for(let[l,_]of s){if(_.start){let m=Date.now()-_.start;_.start=tM.now()-m}this.set(l,_.value,_)}}set(s,l,_={}){if(l===void 0)return this.delete(s),this;let{ttl:m=this.ttl,start:b,noDisposeOnSet:D=this.noDisposeOnSet,sizeCalculation:A=this.sizeCalculation,status:M}=_,{noUpdateTTL:U=this.noUpdateTTL}=_,ne=this.#L(s,l,_.size||0,A);if(this.maxEntrySize&&ne>this.maxEntrySize)return M&&(M.set="miss",M.maxEntrySizeExceeded=!0),this.#O(s,"set"),this;let se=this.#a===0?void 0:this.#c.get(s);if(se===void 0)se=this.#a===0?this.#u:this.#m.length!==0?this.#m.pop():this.#a===this.#r?this.#M(!1):this.#a,this.#l[se]=s,this.#i[se]=l,this.#c.set(s,se),this.#f[this.#u]=se,this.#v[se]=this.#u,this.#u=se,this.#a++,this.#F(se,ne,M),M&&(M.set="add"),U=!1;else{this.#U(se);let Z=this.#i[se];if(l!==Z){if(this.#C&&this.#h(Z)){Z.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Re}=Z;Re!==void 0&&!D&&(this.#k&&this.#e?.(Re,s,"set"),this.#y&&this.#g?.push([Re,s,"set"]))}else D||(this.#k&&this.#e?.(Z,s,"set"),this.#y&&this.#g?.push([Z,s,"set"]));if(this.#I(se),this.#F(se,ne,M),this.#i[se]=l,M){M.set="replace";let Re=Z&&this.#h(Z)?Z.__staleWhileFetching:Z;Re!==void 0&&(M.oldValue=Re)}}else M&&(M.set="update")}if(m!==0&&!this.#b&&this.#D(),this.#b&&(U||this.#N(se,m,b),M&&this.#o(M,se)),!D&&this.#y&&this.#g){let Z=this.#g,Re;for(;Re=Z?.shift();)this.#t?.(...Re)}return this}pop(){try{for(;this.#a;){let s=this.#i[this.#d];if(this.#M(!0),this.#h(s)){if(s.__staleWhileFetching)return s.__staleWhileFetching}else if(s!==void 0)return s}}finally{if(this.#y&&this.#g){let s=this.#g,l;for(;l=s?.shift();)this.#t?.(...l)}}}#M(s){let l=this.#d,_=this.#l[l],m=this.#i[l];return this.#C&&this.#h(m)?m.__abortController.abort(new Error("evicted")):(this.#k||this.#y)&&(this.#k&&this.#e?.(m,_,"evict"),this.#y&&this.#g?.push([m,_,"evict"])),this.#I(l),s&&(this.#l[l]=void 0,this.#i[l]=void 0,this.#m.push(l)),this.#a===1?(this.#d=this.#u=0,this.#m.length=0):this.#d=this.#f[l],this.#c.delete(_),this.#a--,l}has(s,l={}){let{updateAgeOnHas:_=this.updateAgeOnHas,status:m}=l,b=this.#c.get(s);if(b!==void 0){let D=this.#i[b];if(this.#h(D)&&D.__staleWhileFetching===void 0)return!1;if(this.#S(b))m&&(m.has="stale",this.#o(m,b));else return _&&this.#w(b),m&&(m.has="hit",this.#o(m,b)),!0}else m&&(m.has="miss");return!1}peek(s,l={}){let{allowStale:_=this.allowStale}=l,m=this.#c.get(s);if(m===void 0||!_&&this.#S(m))return;let b=this.#i[m];return this.#h(b)?b.__staleWhileFetching:b}#j(s,l,_,m){let b=l===void 0?void 0:this.#i[l];if(this.#h(b))return b;let D=new Ace,{signal:A}=_;A?.addEventListener("abort",()=>D.abort(A.reason),{signal:D.signal});let M={signal:D.signal,options:_,context:m},U=t((ke,Ot=!1)=>{let{aborted:kt}=D.signal,br=_.ignoreFetchAbort&&ke!==void 0;if(_.status&&(kt&&!Ot?(_.status.fetchAborted=!0,_.status.fetchError=D.signal.reason,br&&(_.status.fetchAbortIgnored=!0)):_.status.fetchResolved=!0),kt&&!br&&!Ot)return se(D.signal.reason);let Kr=Re;return this.#i[l]===Re&&(ke===void 0?Kr.__staleWhileFetching?this.#i[l]=Kr.__staleWhileFetching:this.#O(s,"fetch"):(_.status&&(_.status.fetchUpdated=!0),this.set(s,ke,M.options))),ke},"cb"),ne=t(ke=>(_.status&&(_.status.fetchRejected=!0,_.status.fetchError=ke),se(ke)),"eb"),se=t(ke=>{let{aborted:Ot}=D.signal,kt=Ot&&_.allowStaleOnFetchAbort,br=kt||_.allowStaleOnFetchRejection,Kr=br||_.noDeleteOnFetchRejection,on=Re;if(this.#i[l]===Re&&(!Kr||on.__staleWhileFetching===void 0?this.#O(s,"fetch"):kt||(this.#i[l]=on.__staleWhileFetching)),br)return _.status&&on.__staleWhileFetching!==void 0&&(_.status.returnedStale=!0),on.__staleWhileFetching;if(on.__returned===on)throw ke},"fetchFail"),Z=t((ke,Ot)=>{let kt=this.#s?.(s,b,M);kt&&kt instanceof Promise&&kt.then(br=>ke(br===void 0?void 0:br),Ot),D.signal.addEventListener("abort",()=>{(!_.ignoreFetchAbort||_.allowStaleOnFetchAbort)&&(ke(void 0),_.allowStaleOnFetchAbort&&(ke=t(br=>U(br,!0),"res")))})},"pcall");_.status&&(_.status.fetchDispatched=!0);let Re=new Promise(Z).then(U,ne),Ae=Object.assign(Re,{__abortController:D,__staleWhileFetching:b,__returned:void 0});return l===void 0?(this.set(s,Ae,{...M.options,status:void 0}),l=this.#c.get(s)):this.#i[l]=Ae,Ae}#h(s){if(!this.#C)return!1;let l=s;return!!l&&l instanceof Promise&&l.hasOwnProperty("__staleWhileFetching")&&l.__abortController instanceof Ace}async fetch(s,l={}){let{allowStale:_=this.allowStale,updateAgeOnGet:m=this.updateAgeOnGet,noDeleteOnStaleGet:b=this.noDeleteOnStaleGet,ttl:D=this.ttl,noDisposeOnSet:A=this.noDisposeOnSet,size:M=0,sizeCalculation:U=this.sizeCalculation,noUpdateTTL:ne=this.noUpdateTTL,noDeleteOnFetchRejection:se=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Z=this.allowStaleOnFetchRejection,ignoreFetchAbort:Re=this.ignoreFetchAbort,allowStaleOnFetchAbort:Ae=this.allowStaleOnFetchAbort,context:ke,forceRefresh:Ot=!1,status:kt,signal:br}=l;if(!this.#C)return kt&&(kt.fetch="get"),this.get(s,{allowStale:_,updateAgeOnGet:m,noDeleteOnStaleGet:b,status:kt});let Kr={allowStale:_,updateAgeOnGet:m,noDeleteOnStaleGet:b,ttl:D,noDisposeOnSet:A,size:M,sizeCalculation:U,noUpdateTTL:ne,noDeleteOnFetchRejection:se,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:Ae,ignoreFetchAbort:Re,status:kt,signal:br},on=this.#c.get(s);if(on===void 0){kt&&(kt.fetch="miss");let un=this.#j(s,on,Kr,ke);return un.__returned=un}else{let un=this.#i[on];if(this.#h(un)){let Po=_&&un.__staleWhileFetching!==void 0;return kt&&(kt.fetch="inflight",Po&&(kt.returnedStale=!0)),Po?un.__staleWhileFetching:un.__returned=un}let hr=this.#S(on);if(!Ot&&!hr)return kt&&(kt.fetch="hit"),this.#U(on),m&&this.#w(on),kt&&this.#o(kt,on),un;let mr=this.#j(s,on,Kr,ke),Pi=mr.__staleWhileFetching!==void 0&&_;return kt&&(kt.fetch=hr?"stale":"refresh",Pi&&hr&&(kt.returnedStale=!0)),Pi?mr.__staleWhileFetching:mr.__returned=mr}}async forceFetch(s,l={}){let _=await this.fetch(s,l);if(_===void 0)throw new Error("fetch() returned undefined");return _}memo(s,l={}){let _=this.#p;if(!_)throw new Error("no memoMethod provided to constructor");let{context:m,forceRefresh:b,...D}=l,A=this.get(s,D);if(!b&&A!==void 0)return A;let M=_(s,A,{options:D,context:m});return this.set(s,M,D),M}get(s,l={}){let{allowStale:_=this.allowStale,updateAgeOnGet:m=this.updateAgeOnGet,noDeleteOnStaleGet:b=this.noDeleteOnStaleGet,status:D}=l,A=this.#c.get(s);if(A!==void 0){let M=this.#i[A],U=this.#h(M);return D&&this.#o(D,A),this.#S(A)?(D&&(D.get="stale"),U?(D&&_&&M.__staleWhileFetching!==void 0&&(D.returnedStale=!0),_?M.__staleWhileFetching:void 0):(b||this.#O(s,"expire"),D&&_&&(D.returnedStale=!0),_?M:void 0)):(D&&(D.get="hit"),U?M.__staleWhileFetching:(this.#U(A),m&&this.#w(A),M))}else D&&(D.get="miss")}#B(s,l){this.#v[l]=s,this.#f[s]=l}#U(s){s!==this.#u&&(s===this.#d?this.#d=this.#f[s]:this.#B(this.#v[s],this.#f[s]),this.#B(this.#u,s),this.#u=s)}delete(s){return this.#O(s,"delete")}#O(s,l){let _=!1;if(this.#a!==0){let m=this.#c.get(s);if(m!==void 0)if(_=!0,this.#a===1)this.#$(l);else{this.#I(m);let b=this.#i[m];if(this.#h(b)?b.__abortController.abort(new Error("deleted")):(this.#k||this.#y)&&(this.#k&&this.#e?.(b,s,l),this.#y&&this.#g?.push([b,s,l])),this.#c.delete(s),this.#l[m]=void 0,this.#i[m]=void 0,m===this.#u)this.#u=this.#v[m];else if(m===this.#d)this.#d=this.#f[m];else{let D=this.#v[m];this.#f[D]=this.#f[m];let A=this.#f[m];this.#v[A]=this.#v[m]}this.#a--,this.#m.push(m)}}if(this.#y&&this.#g?.length){let m=this.#g,b;for(;b=m?.shift();)this.#t?.(...b)}return _}clear(){return this.#$("delete")}#$(s){for(let l of this.#A({allowStale:!0})){let _=this.#i[l];if(this.#h(_))_.__abortController.abort(new Error("deleted"));else{let m=this.#l[l];this.#k&&this.#e?.(_,m,s),this.#y&&this.#g?.push([_,m,s])}}if(this.#c.clear(),this.#i.fill(void 0),this.#l.fill(void 0),this.#b&&this.#x&&(this.#b.fill(0),this.#x.fill(0)),this.#E&&this.#E.fill(0),this.#d=0,this.#u=0,this.#m.length=0,this.#_=0,this.#a=0,this.#y&&this.#g){let l=this.#g,_;for(;_=l?.shift();)this.#t?.(..._)}}};import{posix as IZt,win32 as T6e}from"path";import{fileURLToPath as OZt}from"url";import{lstatSync as FZt,readdir as LZt,readdirSync as RZt,readlinkSync as MZt,realpathSync as jZt}from"fs";import*as BZt from"fs";import{lstat as $Zt,readdir as JZt,readlink as zZt,realpath as qZt}from"fs/promises";import{EventEmitter as v6e}from"events";import Yat from"stream";import{StringDecoder as TZt}from"string_decoder";var Wat=typeof process=="object"&&process?process:{stdout:null,stderr:null},xZt=t(a=>!!a&&typeof a=="object"&&(a instanceof n3||a instanceof Yat||CZt(a)||EZt(a)),"isStream"),CZt=t(a=>!!a&&typeof a=="object"&&a instanceof v6e&&typeof a.pipe=="function"&&a.pipe!==Yat.Writable.prototype.pipe,"isReadable"),EZt=t(a=>!!a&&typeof a=="object"&&a instanceof v6e&&typeof a.write=="function"&&typeof a.end=="function","isWritable"),GP=Symbol("EOF"),KP=Symbol("maybeEmitEnd"),r3=Symbol("emittedEnd"),Nce=Symbol("emittingEnd"),bH=Symbol("emittedError"),Ice=Symbol("closed"),Hat=Symbol("read"),Oce=Symbol("flush"),Gat=Symbol("flushChunk"),wC=Symbol("encoding"),nM=Symbol("decoder"),Gg=Symbol("flowing"),SH=Symbol("paused"),iM=Symbol("resume"),Kg=Symbol("buffer"),B1=Symbol("pipes"),Yg=Symbol("bufferLength"),p6e=Symbol("bufferPush"),Fce=Symbol("bufferShift"),Iy=Symbol("objectMode"),Gm=Symbol("destroyed"),d6e=Symbol("error"),m6e=Symbol("emitData"),Kat=Symbol("emitEnd"),h6e=Symbol("emitEnd2"),HD=Symbol("async"),g6e=Symbol("abort"),Lce=Symbol("aborted"),TH=Symbol("signal"),TO=Symbol("dataListeners"),$2=Symbol("discarded"),xH=t(a=>Promise.resolve().then(a),"defer"),DZt=t(a=>a(),"nodefer"),kZt=t(a=>a==="end"||a==="finish"||a==="prefinish","isEndish"),wZt=t(a=>a instanceof ArrayBuffer||!!a&&typeof a=="object"&&a.constructor&&a.constructor.name==="ArrayBuffer"&&a.byteLength>=0,"isArrayBufferLike"),PZt=t(a=>!Buffer.isBuffer(a)&&ArrayBuffer.isView(a),"isArrayBufferView"),Rce=class{static{t(this,"Pipe")}src;dest;opts;ondrain;constructor(s,l,_){this.src=s,this.dest=l,this.opts=_,this.ondrain=()=>s[iM](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(s){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},y6e=class extends Rce{static{t(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(s,l,_){super(s,l,_),this.proxyErrors=m=>l.emit("error",m),s.on("error",this.proxyErrors)}},AZt=t(a=>!!a.objectMode,"isObjectModeOptions"),NZt=t(a=>!a.objectMode&&!!a.encoding&&a.encoding!=="buffer","isEncodingOptions"),n3=class extends v6e{static{t(this,"Minipass")}[Gg]=!1;[SH]=!1;[B1]=[];[Kg]=[];[Iy];[wC];[HD];[nM];[GP]=!1;[r3]=!1;[Nce]=!1;[Ice]=!1;[bH]=null;[Yg]=0;[Gm]=!1;[TH];[Lce]=!1;[TO]=0;[$2]=!1;writable=!0;readable=!0;constructor(...s){let l=s[0]||{};if(super(),l.objectMode&&typeof l.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");AZt(l)?(this[Iy]=!0,this[wC]=null):NZt(l)?(this[wC]=l.encoding,this[Iy]=!1):(this[Iy]=!1,this[wC]=null),this[HD]=!!l.async,this[nM]=this[wC]?new TZt(this[wC]):null,l&&l.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:t(()=>this[Kg],"get")}),l&&l.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:t(()=>this[B1],"get")});let{signal:_}=l;_&&(this[TH]=_,_.aborted?this[g6e]():_.addEventListener("abort",()=>this[g6e]()))}get bufferLength(){return this[Yg]}get encoding(){return this[wC]}set encoding(s){throw new Error("Encoding must be set at instantiation time")}setEncoding(s){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Iy]}set objectMode(s){throw new Error("objectMode must be set at instantiation time")}get async(){return this[HD]}set async(s){this[HD]=this[HD]||!!s}[g6e](){this[Lce]=!0,this.emit("abort",this[TH]?.reason),this.destroy(this[TH]?.reason)}get aborted(){return this[Lce]}set aborted(s){}write(s,l,_){if(this[Lce])return!1;if(this[GP])throw new Error("write after end");if(this[Gm])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof l=="function"&&(_=l,l="utf8"),l||(l="utf8");let m=this[HD]?xH:DZt;if(!this[Iy]&&!Buffer.isBuffer(s)){if(PZt(s))s=Buffer.from(s.buffer,s.byteOffset,s.byteLength);else if(wZt(s))s=Buffer.from(s);else if(typeof s!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Iy]?(this[Gg]&&this[Yg]!==0&&this[Oce](!0),this[Gg]?this.emit("data",s):this[p6e](s),this[Yg]!==0&&this.emit("readable"),_&&m(_),this[Gg]):s.length?(typeof s=="string"&&!(l===this[wC]&&!this[nM]?.lastNeed)&&(s=Buffer.from(s,l)),Buffer.isBuffer(s)&&this[wC]&&(s=this[nM].write(s)),this[Gg]&&this[Yg]!==0&&this[Oce](!0),this[Gg]?this.emit("data",s):this[p6e](s),this[Yg]!==0&&this.emit("readable"),_&&m(_),this[Gg]):(this[Yg]!==0&&this.emit("readable"),_&&m(_),this[Gg])}read(s){if(this[Gm])return null;if(this[$2]=!1,this[Yg]===0||s===0||s&&s>this[Yg])return this[KP](),null;this[Iy]&&(s=null),this[Kg].length>1&&!this[Iy]&&(this[Kg]=[this[wC]?this[Kg].join(""):Buffer.concat(this[Kg],this[Yg])]);let l=this[Hat](s||null,this[Kg][0]);return this[KP](),l}[Hat](s,l){if(this[Iy])this[Fce]();else{let _=l;s===_.length||s===null?this[Fce]():typeof _=="string"?(this[Kg][0]=_.slice(s),l=_.slice(0,s),this[Yg]-=s):(this[Kg][0]=_.subarray(s),l=_.subarray(0,s),this[Yg]-=s)}return this.emit("data",l),!this[Kg].length&&!this[GP]&&this.emit("drain"),l}end(s,l,_){return typeof s=="function"&&(_=s,s=void 0),typeof l=="function"&&(_=l,l="utf8"),s!==void 0&&this.write(s,l),_&&this.once("end",_),this[GP]=!0,this.writable=!1,(this[Gg]||!this[SH])&&this[KP](),this}[iM](){this[Gm]||(!this[TO]&&!this[B1].length&&(this[$2]=!0),this[SH]=!1,this[Gg]=!0,this.emit("resume"),this[Kg].length?this[Oce]():this[GP]?this[KP]():this.emit("drain"))}resume(){return this[iM]()}pause(){this[Gg]=!1,this[SH]=!0,this[$2]=!1}get destroyed(){return this[Gm]}get flowing(){return this[Gg]}get paused(){return this[SH]}[p6e](s){this[Iy]?this[Yg]+=1:this[Yg]+=s.length,this[Kg].push(s)}[Fce](){return this[Iy]?this[Yg]-=1:this[Yg]-=this[Kg][0].length,this[Kg].shift()}[Oce](s=!1){do;while(this[Gat](this[Fce]())&&this[Kg].length);!s&&!this[Kg].length&&!this[GP]&&this.emit("drain")}[Gat](s){return this.emit("data",s),this[Gg]}pipe(s,l){if(this[Gm])return s;this[$2]=!1;let _=this[r3];return l=l||{},s===Wat.stdout||s===Wat.stderr?l.end=!1:l.end=l.end!==!1,l.proxyErrors=!!l.proxyErrors,_?l.end&&s.end():(this[B1].push(l.proxyErrors?new y6e(this,s,l):new Rce(this,s,l)),this[HD]?xH(()=>this[iM]()):this[iM]()),s}unpipe(s){let l=this[B1].find(_=>_.dest===s);l&&(this[B1].length===1?(this[Gg]&&this[TO]===0&&(this[Gg]=!1),this[B1]=[]):this[B1].splice(this[B1].indexOf(l),1),l.unpipe())}addListener(s,l){return this.on(s,l)}on(s,l){let _=super.on(s,l);if(s==="data")this[$2]=!1,this[TO]++,!this[B1].length&&!this[Gg]&&this[iM]();else if(s==="readable"&&this[Yg]!==0)super.emit("readable");else if(kZt(s)&&this[r3])super.emit(s),this.removeAllListeners(s);else if(s==="error"&&this[bH]){let m=l;this[HD]?xH(()=>m.call(this,this[bH])):m.call(this,this[bH])}return _}removeListener(s,l){return this.off(s,l)}off(s,l){let _=super.off(s,l);return s==="data"&&(this[TO]=this.listeners("data").length,this[TO]===0&&!this[$2]&&!this[B1].length&&(this[Gg]=!1)),_}removeAllListeners(s){let l=super.removeAllListeners(s);return(s==="data"||s===void 0)&&(this[TO]=0,!this[$2]&&!this[B1].length&&(this[Gg]=!1)),l}get emittedEnd(){return this[r3]}[KP](){!this[Nce]&&!this[r3]&&!this[Gm]&&this[Kg].length===0&&this[GP]&&(this[Nce]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Ice]&&this.emit("close"),this[Nce]=!1)}emit(s,...l){let _=l[0];if(s!=="error"&&s!=="close"&&s!==Gm&&this[Gm])return!1;if(s==="data")return!this[Iy]&&!_?!1:this[HD]?(xH(()=>this[m6e](_)),!0):this[m6e](_);if(s==="end")return this[Kat]();if(s==="close"){if(this[Ice]=!0,!this[r3]&&!this[Gm])return!1;let b=super.emit("close");return this.removeAllListeners("close"),b}else if(s==="error"){this[bH]=_,super.emit(d6e,_);let b=!this[TH]||this.listeners("error").length?super.emit("error",_):!1;return this[KP](),b}else if(s==="resume"){let b=super.emit("resume");return this[KP](),b}else if(s==="finish"||s==="prefinish"){let b=super.emit(s);return this.removeAllListeners(s),b}let m=super.emit(s,...l);return this[KP](),m}[m6e](s){for(let _ of this[B1])_.dest.write(s)===!1&&this.pause();let l=this[$2]?!1:super.emit("data",s);return this[KP](),l}[Kat](){return this[r3]?!1:(this[r3]=!0,this.readable=!1,this[HD]?(xH(()=>this[h6e]()),!0):this[h6e]())}[h6e](){if(this[nM]){let l=this[nM].end();if(l){for(let _ of this[B1])_.dest.write(l);this[$2]||super.emit("data",l)}}for(let l of this[B1])l.end();let s=super.emit("end");return this.removeAllListeners("end"),s}async collect(){let s=Object.assign([],{dataLength:0});this[Iy]||(s.dataLength=0);let l=this.promise();return this.on("data",_=>{s.push(_),this[Iy]||(s.dataLength+=_.length)}),await l,s}async concat(){if(this[Iy])throw new Error("cannot concat in objectMode");let s=await this.collect();return this[wC]?s.join(""):Buffer.concat(s,s.dataLength)}async promise(){return new Promise((s,l)=>{this.on(Gm,()=>l(new Error("stream destroyed"))),this.on("error",_=>l(_)),this.on("end",()=>s())})}[Symbol.asyncIterator](){this[$2]=!1;let s=!1,l=t(async()=>(this.pause(),s=!0,{value:void 0,done:!0}),"stop");return{next:t(()=>{if(s)return l();let m=this.read();if(m!==null)return Promise.resolve({done:!1,value:m});if(this[GP])return l();let b,D,A=t(se=>{this.off("data",M),this.off("end",U),this.off(Gm,ne),l(),D(se)},"onerr"),M=t(se=>{this.off("error",A),this.off("end",U),this.off(Gm,ne),this.pause(),b({value:se,done:!!this[GP]})},"ondata"),U=t(()=>{this.off("error",A),this.off("data",M),this.off(Gm,ne),l(),b({done:!0,value:void 0})},"onend"),ne=t(()=>A(new Error("stream destroyed")),"ondestroy");return new Promise((se,Z)=>{D=Z,b=se,this.once(Gm,ne),this.once("error",A),this.once("end",U),this.once("data",M)})},"next"),throw:l,return:l,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[$2]=!1;let s=!1,l=t(()=>(this.pause(),this.off(d6e,l),this.off(Gm,l),this.off("end",l),s=!0,{done:!0,value:void 0}),"stop"),_=t(()=>{if(s)return l();let m=this.read();return m===null?l():{done:!1,value:m}},"next");return this.once("end",l),this.once(d6e,l),this.once(Gm,l),{next:_,throw:l,return:l,[Symbol.iterator](){return this}}}destroy(s){if(this[Gm])return s?this.emit("error",s):this.emit(Gm),this;this[Gm]=!0,this[$2]=!0,this[Kg].length=0,this[Yg]=0;let l=this;return typeof l.close=="function"&&!this[Ice]&&l.close(),s?this.emit("error",s):this.emit(Gm),this}static get isStream(){return xZt}};var UZt=jZt.native,EH={lstatSync:FZt,readdir:LZt,readdirSync:RZt,readlinkSync:MZt,realpathSync:UZt,promises:{lstat:$Zt,readdir:JZt,readlink:zZt,realpath:qZt}},tot=t(a=>!a||a===EH||a===BZt?EH:{...EH,...a,promises:{...EH.promises,...a.promises||{}}},"fsFromOption"),rot=/^\\\\\?\\([a-z]:)\\?$/i,VZt=t(a=>a.replace(/\//g,"\\").replace(rot,"$1\\"),"uncToDrive"),WZt=/[\\\/]/,ST=0,not=1,iot=2,GD=4,sot=6,aot=8,xO=10,oot=12,bT=15,CH=~bT,b6e=16,Xat=32,DH=64,PC=128,Mce=256,Bce=512,Qat=DH|PC|Bce,HZt=1023,S6e=t(a=>a.isFile()?aot:a.isDirectory()?GD:a.isSymbolicLink()?xO:a.isCharacterDevice()?iot:a.isBlockDevice()?sot:a.isSocket()?oot:a.isFIFO()?not:ST,"entToType"),Zat=new Map,kH=t(a=>{let s=Zat.get(a);if(s)return s;let l=a.normalize("NFKD");return Zat.set(a,l),l},"normalize"),eot=new Map,jce=t(a=>{let s=eot.get(a);if(s)return s;let l=kH(a.toLowerCase());return eot.set(a,l),l},"normalizeNocase"),Uce=class extends vH{static{t(this,"ResolveCache")}constructor(){super({max:256})}},x6e=class extends vH{static{t(this,"ChildrenCache")}constructor(s=16*1024){super({maxSize:s,sizeCalculation:t(l=>l.length+1,"sizeCalculation")})}},cot=Symbol("PathScurry setAsCwd"),Oy=class{static{t(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#r;#n;get dev(){return this.#n}#e;get mode(){return this.#e}#t;get nlink(){return this.#t}#s;get uid(){return this.#s}#p;get gid(){return this.#p}#a;get rdev(){return this.#a}#_;get blksize(){return this.#_}#c;get ino(){return this.#c}#l;get size(){return this.#l}#i;get blocks(){return this.#i}#f;get atimeMs(){return this.#f}#v;get mtimeMs(){return this.#v}#d;get ctimeMs(){return this.#d}#u;get birthtimeMs(){return this.#u}#m;get atime(){return this.#m}#g;get mtime(){return this.#g}#E;get ctime(){return this.#E}#x;get birthtime(){return this.#x}#b;#k;#C;#y;#D;#w;#o;#N;#S;#T;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(s,l=ST,_,m,b,D,A){this.name=s,this.#b=b?jce(s):kH(s),this.#o=l&HZt,this.nocase=b,this.roots=m,this.root=_||this,this.#N=D,this.#C=A.fullpath,this.#D=A.relative,this.#w=A.relativePosix,this.parent=A.parent,this.parent?this.#r=this.parent.#r:this.#r=tot(A.fs)}depth(){return this.#k!==void 0?this.#k:this.parent?this.#k=this.parent.depth()+1:this.#k=0}childrenCache(){return this.#N}resolve(s){if(!s)return this;let l=this.getRootString(s),m=s.substring(l.length).split(this.splitSep);return l?this.getRoot(l).#I(m):this.#I(m)}#I(s){let l=this;for(let _ of s)l=l.child(_);return l}children(){let s=this.#N.get(this);if(s)return s;let l=Object.assign([],{provisional:0});return this.#N.set(this,l),this.#o&=~b6e,l}child(s,l){if(s===""||s===".")return this;if(s==="..")return this.parent||this;let _=this.children(),m=this.nocase?jce(s):kH(s);for(let M of _)if(M.#b===m)return M;let b=this.parent?this.sep:"",D=this.#C?this.#C+b+s:void 0,A=this.newChild(s,ST,{...l,parent:this,fullpath:D});return this.canReaddir()||(A.#o|=PC),_.push(A),A}relative(){if(this.isCWD)return"";if(this.#D!==void 0)return this.#D;let s=this.name,l=this.parent;if(!l)return this.#D=this.name;let _=l.relative();return _+(!_||!l.parent?"":this.sep)+s}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let s=this.name,l=this.parent;if(!l)return this.#w=this.fullpathPosix();let _=l.relativePosix();return _+(!_||!l.parent?"":"/")+s}fullpath(){if(this.#C!==void 0)return this.#C;let s=this.name,l=this.parent;if(!l)return this.#C=this.name;let m=l.fullpath()+(l.parent?this.sep:"")+s;return this.#C=m}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let m=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(m)?this.#y=`//?/${m}`:this.#y=m}let s=this.parent,l=s.fullpathPosix(),_=l+(!l||!s.parent?"":"/")+this.name;return this.#y=_}isUnknown(){return(this.#o&bT)===ST}isType(s){return this[`is${s}`]()}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.#o&bT)===aot}isDirectory(){return(this.#o&bT)===GD}isCharacterDevice(){return(this.#o&bT)===iot}isBlockDevice(){return(this.#o&bT)===sot}isFIFO(){return(this.#o&bT)===not}isSocket(){return(this.#o&bT)===oot}isSymbolicLink(){return(this.#o&xO)===xO}lstatCached(){return this.#o&Xat?this:void 0}readlinkCached(){return this.#S}realpathCached(){return this.#T}readdirCached(){let s=this.children();return s.slice(0,s.provisional)}canReadlink(){if(this.#S)return!0;if(!this.parent)return!1;let s=this.#o&bT;return!(s!==ST&&s!==xO||this.#o&Mce||this.#o&PC)}calledReaddir(){return!!(this.#o&b6e)}isENOENT(){return!!(this.#o&PC)}isNamed(s){return this.nocase?this.#b===jce(s):this.#b===kH(s)}async readlink(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let l=await this.#r.promises.readlink(this.fullpath()),_=(await this.parent.realpath())?.resolve(l);if(_)return this.#S=_}catch(l){this.#h(l.code);return}}readlinkSync(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let l=this.#r.readlinkSync(this.fullpath()),_=this.parent.realpathSync()?.resolve(l);if(_)return this.#S=_}catch(l){this.#h(l.code);return}}#F(s){this.#o|=b6e;for(let l=s.provisional;l<s.length;l++){let _=s[l];_&&_.#L()}}#L(){this.#o&PC||(this.#o=(this.#o|PC)&CH,this.#P())}#P(){let s=this.children();s.provisional=0;for(let l of s)l.#L()}#A(){this.#o|=Bce,this.#R()}#R(){if(this.#o&DH)return;let s=this.#o;(s&bT)===GD&&(s&=CH),this.#o=s|DH,this.#P()}#M(s=""){s==="ENOTDIR"||s==="EPERM"?this.#R():s==="ENOENT"?this.#L():this.children().provisional=0}#j(s=""){s==="ENOTDIR"?this.parent.#R():s==="ENOENT"&&this.#L()}#h(s=""){let l=this.#o;l|=Mce,s==="ENOENT"&&(l|=PC),(s==="EINVAL"||s==="UNKNOWN")&&(l&=CH),this.#o=l,s==="ENOTDIR"&&this.parent&&this.parent.#R()}#B(s,l){return this.#O(s,l)||this.#U(s,l)}#U(s,l){let _=S6e(s),m=this.newChild(s.name,_,{parent:this}),b=m.#o&bT;return b!==GD&&b!==xO&&b!==ST&&(m.#o|=DH),l.unshift(m),l.provisional++,m}#O(s,l){for(let _=l.provisional;_<l.length;_++){let m=l[_];if((this.nocase?jce(s.name):kH(s.name))===m.#b)return this.#$(s,m,_,l)}}#$(s,l,_,m){let b=l.name;return l.#o=l.#o&CH|S6e(s),b!==s.name&&(l.name=s.name),_!==m.provisional&&(_===m.length-1?m.pop():m.splice(_,1),m.unshift(l)),m.provisional++,l}async lstat(){if(!(this.#o&PC))try{return this.#V(await this.#r.promises.lstat(this.fullpath())),this}catch(s){this.#j(s.code)}}lstatSync(){if(!(this.#o&PC))try{return this.#V(this.#r.lstatSync(this.fullpath())),this}catch(s){this.#j(s.code)}}#V(s){let{atime:l,atimeMs:_,birthtime:m,birthtimeMs:b,blksize:D,blocks:A,ctime:M,ctimeMs:U,dev:ne,gid:se,ino:Z,mode:Re,mtime:Ae,mtimeMs:ke,nlink:Ot,rdev:kt,size:br,uid:Kr}=s;this.#m=l,this.#f=_,this.#x=m,this.#u=b,this.#_=D,this.#i=A,this.#E=M,this.#d=U,this.#n=ne,this.#p=se,this.#c=Z,this.#e=Re,this.#g=Ae,this.#v=ke,this.#t=Ot,this.#a=kt,this.#l=br,this.#s=Kr;let on=S6e(s);this.#o=this.#o&CH|on|Xat,on!==ST&&on!==GD&&on!==xO&&(this.#o|=DH)}#z=[];#q=!1;#W(s){this.#q=!1;let l=this.#z.slice();this.#z.length=0,l.forEach(_=>_(null,s))}readdirCB(s,l=!1){if(!this.canReaddir()){l?s(null,[]):queueMicrotask(()=>s(null,[]));return}let _=this.children();if(this.calledReaddir()){let b=_.slice(0,_.provisional);l?s(null,b):queueMicrotask(()=>s(null,b));return}if(this.#z.push(s),this.#q)return;this.#q=!0;let m=this.fullpath();this.#r.readdir(m,{withFileTypes:!0},(b,D)=>{if(b)this.#M(b.code),_.provisional=0;else{for(let A of D)this.#B(A,_);this.#F(_)}this.#W(_.slice(0,_.provisional))})}#J;async readdir(){if(!this.canReaddir())return[];let s=this.children();if(this.calledReaddir())return s.slice(0,s.provisional);let l=this.fullpath();if(this.#J)await this.#J;else{let _=t(()=>{},"resolve");this.#J=new Promise(m=>_=m);try{for(let m of await this.#r.promises.readdir(l,{withFileTypes:!0}))this.#B(m,s);this.#F(s)}catch(m){this.#M(m.code),s.provisional=0}this.#J=void 0,_()}return s.slice(0,s.provisional)}readdirSync(){if(!this.canReaddir())return[];let s=this.children();if(this.calledReaddir())return s.slice(0,s.provisional);let l=this.fullpath();try{for(let _ of this.#r.readdirSync(l,{withFileTypes:!0}))this.#B(_,s);this.#F(s)}catch(_){this.#M(_.code),s.provisional=0}return s.slice(0,s.provisional)}canReaddir(){if(this.#o&Qat)return!1;let s=bT&this.#o;return s===ST||s===GD||s===xO}shouldWalk(s,l){return(this.#o&GD)===GD&&!(this.#o&Qat)&&!s.has(this)&&(!l||l(this))}async realpath(){if(this.#T)return this.#T;if(!((Bce|Mce|PC)&this.#o))try{let s=await this.#r.promises.realpath(this.fullpath());return this.#T=this.resolve(s)}catch{this.#A()}}realpathSync(){if(this.#T)return this.#T;if(!((Bce|Mce|PC)&this.#o))try{let s=this.#r.realpathSync(this.fullpath());return this.#T=this.resolve(s)}catch{this.#A()}}[cot](s){if(s===this)return;s.isCWD=!1,this.isCWD=!0;let l=new Set([]),_=[],m=this;for(;m&&m.parent;)l.add(m),m.#D=_.join(this.sep),m.#w=_.join("/"),m=m.parent,_.push("..");for(m=s;m&&m.parent&&!l.has(m);)m.#D=void 0,m.#w=void 0,m=m.parent}},$ce=class a extends Oy{static{t(this,"PathWin32")}sep="\\";splitSep=WZt;constructor(s,l=ST,_,m,b,D,A){super(s,l,_,m,b,D,A)}newChild(s,l=ST,_={}){return new a(s,l,this.root,this.roots,this.nocase,this.childrenCache(),_)}getRootString(s){return T6e.parse(s).root}getRoot(s){if(s=VZt(s.toUpperCase()),s===this.root.name)return this.root;for(let[l,_]of Object.entries(this.roots))if(this.sameRoot(s,l))return this.roots[s]=_;return this.roots[s]=new sM(s,this).root}sameRoot(s,l=this.root.name){return s=s.toUpperCase().replace(/\//g,"\\").replace(rot,"$1\\"),s===l}},Jce=class a extends Oy{static{t(this,"PathPosix")}splitSep="/";sep="/";constructor(s,l=ST,_,m,b,D,A){super(s,l,_,m,b,D,A)}getRootString(s){return s.startsWith("/")?"/":""}getRoot(s){return this.root}newChild(s,l=ST,_={}){return new a(s,l,this.root,this.roots,this.nocase,this.childrenCache(),_)}},zce=class{static{t(this,"PathScurryBase")}root;rootPath;roots;cwd;#r;#n;#e;nocase;#t;constructor(s=process.cwd(),l,_,{nocase:m,childrenCacheSize:b=16*1024,fs:D=EH}={}){this.#t=tot(D),(s instanceof URL||s.startsWith("file://"))&&(s=OZt(s));let A=l.resolve(s);this.roots=Object.create(null),this.rootPath=this.parseRootPath(A),this.#r=new Uce,this.#n=new Uce,this.#e=new x6e(b);let M=A.substring(this.rootPath.length).split(_);if(M.length===1&&!M[0]&&M.pop(),m===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=m,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let U=this.root,ne=M.length-1,se=l.sep,Z=this.rootPath,Re=!1;for(let Ae of M){let ke=ne--;U=U.child(Ae,{relative:new Array(ke).fill("..").join(se),relativePosix:new Array(ke).fill("..").join("/"),fullpath:Z+=(Re?"":se)+Ae}),Re=!0}this.cwd=U}depth(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.depth()}childrenCache(){return this.#e}resolve(...s){let l="";for(let b=s.length-1;b>=0;b--){let D=s[b];if(!(!D||D===".")&&(l=l?`${D}/${l}`:D,this.isAbsolute(D)))break}let _=this.#r.get(l);if(_!==void 0)return _;let m=this.cwd.resolve(l).fullpath();return this.#r.set(l,m),m}resolvePosix(...s){let l="";for(let b=s.length-1;b>=0;b--){let D=s[b];if(!(!D||D===".")&&(l=l?`${D}/${l}`:D,this.isAbsolute(D)))break}let _=this.#n.get(l);if(_!==void 0)return _;let m=this.cwd.resolve(l).fullpathPosix();return this.#n.set(l,m),m}relative(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.relative()}relativePosix(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.relativePosix()}basename(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.name}dirname(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),(s.parent||s).fullpath()}async readdir(s=this.cwd,l={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Oy||(l=s,s=this.cwd);let{withFileTypes:_}=l;if(s.canReaddir()){let m=await s.readdir();return _?m:m.map(b=>b.name)}else return[]}readdirSync(s=this.cwd,l={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Oy||(l=s,s=this.cwd);let{withFileTypes:_=!0}=l;return s.canReaddir()?_?s.readdirSync():s.readdirSync().map(m=>m.name):[]}async lstat(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.lstat()}lstatSync(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.lstatSync()}async readlink(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Oy||(l=s.withFileTypes,s=this.cwd);let _=await s.readlink();return l?_:_?.fullpath()}readlinkSync(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Oy||(l=s.withFileTypes,s=this.cwd);let _=s.readlinkSync();return l?_:_?.fullpath()}async realpath(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Oy||(l=s.withFileTypes,s=this.cwd);let _=await s.realpath();return l?_:_?.fullpath()}realpathSync(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Oy||(l=s.withFileTypes,s=this.cwd);let _=s.realpathSync();return l?_:_?.fullpath()}async walk(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Oy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l,A=[];(!b||b(s))&&A.push(_?s:s.fullpath());let M=new Set,U=t((se,Z)=>{M.add(se),se.readdirCB((Re,Ae)=>{if(Re)return Z(Re);let ke=Ae.length;if(!ke)return Z();let Ot=t(()=>{--ke===0&&Z()},"next");for(let kt of Ae)(!b||b(kt))&&A.push(_?kt:kt.fullpath()),m&&kt.isSymbolicLink()?kt.realpath().then(br=>br?.isUnknown()?br.lstat():br).then(br=>br?.shouldWalk(M,D)?U(br,Ot):Ot()):kt.shouldWalk(M,D)?U(kt,Ot):Ot()},!0)},"walk"),ne=s;return new Promise((se,Z)=>{U(ne,Re=>{if(Re)return Z(Re);se(A)})})}walkSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Oy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l,A=[];(!b||b(s))&&A.push(_?s:s.fullpath());let M=new Set([s]);for(let U of M){let ne=U.readdirSync();for(let se of ne){(!b||b(se))&&A.push(_?se:se.fullpath());let Z=se;if(se.isSymbolicLink()){if(!(m&&(Z=se.realpathSync())))continue;Z.isUnknown()&&Z.lstatSync()}Z.shouldWalk(M,D)&&M.add(Z)}}return A}[Symbol.asyncIterator](){return this.iterate()}iterate(s=this.cwd,l={}){return typeof s=="string"?s=this.cwd.resolve(s):s instanceof Oy||(l=s,s=this.cwd),this.stream(s,l)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Oy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l;(!b||b(s))&&(yield _?s:s.fullpath());let A=new Set([s]);for(let M of A){let U=M.readdirSync();for(let ne of U){(!b||b(ne))&&(yield _?ne:ne.fullpath());let se=ne;if(ne.isSymbolicLink()){if(!(m&&(se=ne.realpathSync())))continue;se.isUnknown()&&se.lstatSync()}se.shouldWalk(A,D)&&A.add(se)}}}stream(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Oy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l,A=new n3({objectMode:!0});(!b||b(s))&&A.write(_?s:s.fullpath());let M=new Set,U=[s],ne=0,se=t(()=>{let Z=!1;for(;!Z;){let Re=U.shift();if(!Re){ne===0&&A.end();return}ne++,M.add(Re);let Ae=t((Ot,kt,br=!1)=>{if(Ot)return A.emit("error",Ot);if(m&&!br){let Kr=[];for(let on of kt)on.isSymbolicLink()&&Kr.push(on.realpath().then(un=>un?.isUnknown()?un.lstat():un));if(Kr.length){Promise.all(Kr).then(()=>Ae(null,kt,!0));return}}for(let Kr of kt)Kr&&(!b||b(Kr))&&(A.write(_?Kr:Kr.fullpath())||(Z=!0));ne--;for(let Kr of kt){let on=Kr.realpathCached()||Kr;on.shouldWalk(M,D)&&U.push(on)}Z&&!A.flowing?A.once("drain",se):ke||se()},"onReaddir"),ke=!0;Re.readdirCB(Ae,!0),ke=!1}},"process");return se(),A}streamSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Oy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l,A=new n3({objectMode:!0}),M=new Set;(!b||b(s))&&A.write(_?s:s.fullpath());let U=[s],ne=0,se=t(()=>{let Z=!1;for(;!Z;){let Re=U.shift();if(!Re){ne===0&&A.end();return}ne++,M.add(Re);let Ae=Re.readdirSync();for(let ke of Ae)(!b||b(ke))&&(A.write(_?ke:ke.fullpath())||(Z=!0));ne--;for(let ke of Ae){let Ot=ke;if(ke.isSymbolicLink()){if(!(m&&(Ot=ke.realpathSync())))continue;Ot.isUnknown()&&Ot.lstatSync()}Ot.shouldWalk(M,D)&&U.push(Ot)}}Z&&!A.flowing&&A.once("drain",se)},"process");return se(),A}chdir(s=this.cwd){let l=this.cwd;this.cwd=typeof s=="string"?this.cwd.resolve(s):s,this.cwd[cot](l)}},sM=class extends zce{static{t(this,"PathScurryWin32")}sep="\\";constructor(s=process.cwd(),l={}){let{nocase:_=!0}=l;super(s,T6e,"\\",{...l,nocase:_}),this.nocase=_;for(let m=this.cwd;m;m=m.parent)m.nocase=this.nocase}parseRootPath(s){return T6e.parse(s).root.toUpperCase()}newRoot(s){return new $ce(this.rootPath,GD,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")||s.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(s)}},aM=class extends zce{static{t(this,"PathScurryPosix")}sep="/";constructor(s=process.cwd(),l={}){let{nocase:_=!1}=l;super(s,IZt,"/",{...l,nocase:_}),this.nocase=_}parseRootPath(s){return"/"}newRoot(s){return new Jce(this.rootPath,GD,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")}},wH=class extends aM{static{t(this,"PathScurryDarwin")}constructor(s=process.cwd(),l={}){let{nocase:_=!0}=l;super(s,{...l,nocase:_})}},x4r=process.platform==="win32"?$ce:Jce,lot=process.platform==="win32"?sM:process.platform==="darwin"?wH:aM;var GZt=t(a=>a.length>=1,"isPatternList"),KZt=t(a=>a.length>=1,"isGlobList"),oM=class a{static{t(this,"Pattern")}#r;#n;#e;length;#t;#s;#p;#a;#_;#c;#l=!0;constructor(s,l,_,m){if(!GZt(s))throw new TypeError("empty pattern list");if(!KZt(l))throw new TypeError("empty glob list");if(l.length!==s.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=s.length,_<0||_>=this.length)throw new TypeError("index out of range");if(this.#r=s,this.#n=l,this.#e=_,this.#t=m,this.#e===0){if(this.isUNC()){let[b,D,A,M,...U]=this.#r,[ne,se,Z,Re,...Ae]=this.#n;U[0]===""&&(U.shift(),Ae.shift());let ke=[b,D,A,M,""].join("/"),Ot=[ne,se,Z,Re,""].join("/");this.#r=[ke,...U],this.#n=[Ot,...Ae],this.length=this.#r.length}else if(this.isDrive()||this.isAbsolute()){let[b,...D]=this.#r,[A,...M]=this.#n;D[0]===""&&(D.shift(),M.shift());let U=b+"/",ne=A+"/";this.#r=[U,...D],this.#n=[ne,...M],this.length=this.#r.length}}}pattern(){return this.#r[this.#e]}isString(){return typeof this.#r[this.#e]=="string"}isGlobstar(){return this.#r[this.#e]===F0}isRegExp(){return this.#r[this.#e]instanceof RegExp}globString(){return this.#p=this.#p||(this.#e===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#e).join("/"))}hasMore(){return this.length>this.#e+1}rest(){return this.#s!==void 0?this.#s:this.hasMore()?(this.#s=new a(this.#r,this.#n,this.#e+1,this.#t),this.#s.#c=this.#c,this.#s.#_=this.#_,this.#s.#a=this.#a,this.#s):this.#s=null}isUNC(){let s=this.#r;return this.#_!==void 0?this.#_:this.#_=this.#t==="win32"&&this.#e===0&&s[0]===""&&s[1]===""&&typeof s[2]=="string"&&!!s[2]&&typeof s[3]=="string"&&!!s[3]}isDrive(){let s=this.#r;return this.#a!==void 0?this.#a:this.#a=this.#t==="win32"&&this.#e===0&&this.length>1&&typeof s[0]=="string"&&/^[a-z]:$/i.test(s[0])}isAbsolute(){let s=this.#r;return this.#c!==void 0?this.#c:this.#c=s[0]===""&&s.length>1||this.isDrive()||this.isUNC()}root(){let s=this.#r[0];return typeof s=="string"&&this.isAbsolute()&&this.#e===0?s:""}checkFollowGlobstar(){return!(this.#e===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#e===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};var YZt=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",cM=class{static{t(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(s,{nobrace:l,nocase:_,noext:m,noglobstar:b,platform:D=YZt}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=D,this.mmopts={dot:!0,nobrace:l,nocase:_,noext:m,noglobstar:b,optimizationLevel:2,platform:D,nocomment:!0,nonegate:!0};for(let A of s)this.add(A)}add(s){let l=new U2(s,this.mmopts);for(let _=0;_<l.set.length;_++){let m=l.set[_],b=l.globParts[_];if(!m||!b)throw new Error("invalid pattern object");for(;m[0]==="."&&b[0]===".";)m.shift(),b.shift();let D=new oM(m,b,0,this.platform),A=new U2(D.globString(),this.mmopts),M=b[b.length-1]==="**",U=D.isAbsolute();U?this.absolute.push(A):this.relative.push(A),M&&(U?this.absoluteChildren.push(A):this.relativeChildren.push(A))}}ignored(s){let l=s.fullpath(),_=`${l}/`,m=s.relative()||".",b=`${m}/`;for(let D of this.relative)if(D.match(m)||D.match(b))return!0;for(let D of this.absolute)if(D.match(l)||D.match(_))return!0;return!1}childrenIgnored(s){let l=s.fullpath()+"/",_=(s.relative()||".")+"/";for(let m of this.relativeChildren)if(m.match(_))return!0;for(let m of this.absoluteChildren)if(m.match(l))return!0;return!1}};var C6e=class a{static{t(this,"HasWalkedCache")}store;constructor(s=new Map){this.store=s}copy(){return new a(new Map(this.store))}hasWalked(s,l){return this.store.get(s.fullpath())?.has(l.globString())}storeWalked(s,l){let _=s.fullpath(),m=this.store.get(_);m?m.add(l.globString()):this.store.set(_,new Set([l.globString()]))}},E6e=class{static{t(this,"MatchRecord")}store=new Map;add(s,l,_){let m=(l?2:0)|(_?1:0),b=this.store.get(s);this.store.set(s,b===void 0?m:m&b)}entries(){return[...this.store.entries()].map(([s,l])=>[s,!!(l&2),!!(l&1)])}},D6e=class{static{t(this,"SubWalks")}store=new Map;add(s,l){if(!s.canReaddir())return;let _=this.store.get(s);_?_.find(m=>m.globString()===l.globString())||_.push(l):this.store.set(s,[l])}get(s){let l=this.store.get(s);if(!l)throw new Error("attempting to walk unknown path");return l}entries(){return this.keys().map(s=>[s,this.store.get(s)])}keys(){return[...this.store.keys()].filter(s=>s.canReaddir())}},PH=class a{static{t(this,"Processor")}hasWalkedCache;matches=new E6e;subwalks=new D6e;patterns;follow;dot;opts;constructor(s,l){this.opts=s,this.follow=!!s.follow,this.dot=!!s.dot,this.hasWalkedCache=l?l.copy():new C6e}processPatterns(s,l){this.patterns=l;let _=l.map(m=>[s,m]);for(let[m,b]of _){this.hasWalkedCache.storeWalked(m,b);let D=b.root(),A=b.isAbsolute()&&this.opts.absolute!==!1;if(D){m=m.resolve(D==="/"&&this.opts.root!==void 0?this.opts.root:D);let se=b.rest();if(se)b=se;else{this.matches.add(m,!0,!1);continue}}if(m.isENOENT())continue;let M,U,ne=!1;for(;typeof(M=b.pattern())=="string"&&(U=b.rest());)m=m.resolve(M),b=U,ne=!0;if(M=b.pattern(),U=b.rest(),ne){if(this.hasWalkedCache.hasWalked(m,b))continue;this.hasWalkedCache.storeWalked(m,b)}if(typeof M=="string"){let se=M===".."||M===""||M===".";this.matches.add(m.resolve(M),A,se);continue}else if(M===F0){(!m.isSymbolicLink()||this.follow||b.checkFollowGlobstar())&&this.subwalks.add(m,b);let se=U?.pattern(),Z=U?.rest();if(!U||(se===""||se===".")&&!Z)this.matches.add(m,A,se===""||se===".");else if(se===".."){let Re=m.parent||m;Z?this.hasWalkedCache.hasWalked(Re,Z)||this.subwalks.add(Re,Z):this.matches.add(Re,A,!0)}}else M instanceof RegExp&&this.subwalks.add(m,b)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new a(this.opts,this.hasWalkedCache)}filterEntries(s,l){let _=this.subwalks.get(s),m=this.child();for(let b of l)for(let D of _){let A=D.isAbsolute(),M=D.pattern(),U=D.rest();M===F0?m.testGlobstar(b,D,U,A):M instanceof RegExp?m.testRegExp(b,M,U,A):m.testString(b,M,U,A)}return m}testGlobstar(s,l,_,m){if((this.dot||!s.name.startsWith("."))&&(l.hasMore()||this.matches.add(s,m,!1),s.canReaddir()&&(this.follow||!s.isSymbolicLink()?this.subwalks.add(s,l):s.isSymbolicLink()&&(_&&l.checkFollowGlobstar()?this.subwalks.add(s,_):l.markFollowGlobstar()&&this.subwalks.add(s,l)))),_){let b=_.pattern();if(typeof b=="string"&&b!==".."&&b!==""&&b!==".")this.testString(s,b,_.rest(),m);else if(b===".."){let D=s.parent||s;this.subwalks.add(D,_)}else b instanceof RegExp&&this.testRegExp(s,b,_.rest(),m)}}testRegExp(s,l,_,m){l.test(s.name)&&(_?this.subwalks.add(s,_):this.matches.add(s,m,!1))}testString(s,l,_,m){s.isNamed(l)&&(_?this.subwalks.add(s,_):this.matches.add(s,m,!1))}};var XZt=t((a,s)=>typeof a=="string"?new cM([a],s):Array.isArray(a)?new cM(a,s):a,"makeIgnore"),qce=class{static{t(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#r=[];#n;#e;signal;maxDepth;includeChildMatches;constructor(s,l,_){if(this.patterns=s,this.path=l,this.opts=_,this.#e=!_.posix&&_.platform==="win32"?"\\":"/",this.includeChildMatches=_.includeChildMatches!==!1,(_.ignore||!this.includeChildMatches)&&(this.#n=XZt(_.ignore??[],_),!this.includeChildMatches&&typeof this.#n.add!="function")){let m="cannot ignore child matches, ignore lacks add() method.";throw new Error(m)}this.maxDepth=_.maxDepth||1/0,_.signal&&(this.signal=_.signal,this.signal.addEventListener("abort",()=>{this.#r.length=0}))}#t(s){return this.seen.has(s)||!!this.#n?.ignored?.(s)}#s(s){return!!this.#n?.childrenIgnored?.(s)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let s;for(;!this.paused&&(s=this.#r.shift());)s()}onResume(s){this.signal?.aborted||(this.paused?this.#r.push(s):s())}async matchCheck(s,l){if(l&&this.opts.nodir)return;let _;if(this.opts.realpath){if(_=s.realpathCached()||await s.realpath(),!_)return;s=_}let b=s.isUnknown()||this.opts.stat?await s.lstat():s;if(this.opts.follow&&this.opts.nodir&&b?.isSymbolicLink()){let D=await b.realpath();D&&(D.isUnknown()||this.opts.stat)&&await D.lstat()}return this.matchCheckTest(b,l)}matchCheckTest(s,l){return s&&(this.maxDepth===1/0||s.depth()<=this.maxDepth)&&(!l||s.canReaddir())&&(!this.opts.nodir||!s.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!s.isSymbolicLink()||!s.realpathCached()?.isDirectory())&&!this.#t(s)?s:void 0}matchCheckSync(s,l){if(l&&this.opts.nodir)return;let _;if(this.opts.realpath){if(_=s.realpathCached()||s.realpathSync(),!_)return;s=_}let b=s.isUnknown()||this.opts.stat?s.lstatSync():s;if(this.opts.follow&&this.opts.nodir&&b?.isSymbolicLink()){let D=b.realpathSync();D&&(D?.isUnknown()||this.opts.stat)&&D.lstatSync()}return this.matchCheckTest(b,l)}matchFinish(s,l){if(this.#t(s))return;if(!this.includeChildMatches&&this.#n?.add){let b=`${s.relativePosix()}/**`;this.#n.add(b)}let _=this.opts.absolute===void 0?l:this.opts.absolute;this.seen.add(s);let m=this.opts.mark&&s.isDirectory()?this.#e:"";if(this.opts.withFileTypes)this.matchEmit(s);else if(_){let b=this.opts.posix?s.fullpathPosix():s.fullpath();this.matchEmit(b+m)}else{let b=this.opts.posix?s.relativePosix():s.relative(),D=this.opts.dotRelative&&!b.startsWith(".."+this.#e)?"."+this.#e:"";this.matchEmit(b?D+b+m:"."+m)}}async match(s,l,_){let m=await this.matchCheck(s,_);m&&this.matchFinish(m,l)}matchSync(s,l,_){let m=this.matchCheckSync(s,_);m&&this.matchFinish(m,l)}walkCB(s,l,_){this.signal?.aborted&&_(),this.walkCB2(s,l,new PH(this.opts),_)}walkCB2(s,l,_,m){if(this.#s(s))return m();if(this.signal?.aborted&&m(),this.paused){this.onResume(()=>this.walkCB2(s,l,_,m));return}_.processPatterns(s,l);let b=1,D=t(()=>{--b===0&&m()},"next");for(let[A,M,U]of _.matches.entries())this.#t(A)||(b++,this.match(A,M,U).then(()=>D()));for(let A of _.subwalkTargets()){if(this.maxDepth!==1/0&&A.depth()>=this.maxDepth)continue;b++;let M=A.readdirCached();A.calledReaddir()?this.walkCB3(A,M,_,D):A.readdirCB((U,ne)=>this.walkCB3(A,ne,_,D),!0)}D()}walkCB3(s,l,_,m){_=_.filterEntries(s,l);let b=1,D=t(()=>{--b===0&&m()},"next");for(let[A,M,U]of _.matches.entries())this.#t(A)||(b++,this.match(A,M,U).then(()=>D()));for(let[A,M]of _.subwalks.entries())b++,this.walkCB2(A,M,_.child(),D);D()}walkCBSync(s,l,_){this.signal?.aborted&&_(),this.walkCB2Sync(s,l,new PH(this.opts),_)}walkCB2Sync(s,l,_,m){if(this.#s(s))return m();if(this.signal?.aborted&&m(),this.paused){this.onResume(()=>this.walkCB2Sync(s,l,_,m));return}_.processPatterns(s,l);let b=1,D=t(()=>{--b===0&&m()},"next");for(let[A,M,U]of _.matches.entries())this.#t(A)||this.matchSync(A,M,U);for(let A of _.subwalkTargets()){if(this.maxDepth!==1/0&&A.depth()>=this.maxDepth)continue;b++;let M=A.readdirSync();this.walkCB3Sync(A,M,_,D)}D()}walkCB3Sync(s,l,_,m){_=_.filterEntries(s,l);let b=1,D=t(()=>{--b===0&&m()},"next");for(let[A,M,U]of _.matches.entries())this.#t(A)||this.matchSync(A,M,U);for(let[A,M]of _.subwalks.entries())b++,this.walkCB2Sync(A,M,_.child(),D);D()}},AH=class extends qce{static{t(this,"GlobWalker")}matches=new Set;constructor(s,l,_){super(s,l,_)}matchEmit(s){this.matches.add(s)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((s,l)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?l(this.signal.reason):s(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}},NH=class extends qce{static{t(this,"GlobStream")}results;constructor(s,l,_){super(s,l,_),this.results=new n3({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(s){this.results.write(s),this.results.flowing||this.pause()}stream(){let s=this.path;return s.isUnknown()?s.lstat().then(()=>{this.walkCB(s,this.patterns,()=>this.results.end())}):this.walkCB(s,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 ZZt=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",AC=class{static{t(this,"Glob")}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(s,l){if(!l)throw new TypeError("glob options required");if(this.withFileTypes=!!l.withFileTypes,this.signal=l.signal,this.follow=!!l.follow,this.dot=!!l.dot,this.dotRelative=!!l.dotRelative,this.nodir=!!l.nodir,this.mark=!!l.mark,l.cwd?(l.cwd instanceof URL||l.cwd.startsWith("file://"))&&(l.cwd=QZt(l.cwd)):this.cwd="",this.cwd=l.cwd||"",this.root=l.root,this.magicalBraces=!!l.magicalBraces,this.nobrace=!!l.nobrace,this.noext=!!l.noext,this.realpath=!!l.realpath,this.absolute=l.absolute,this.includeChildMatches=l.includeChildMatches!==!1,this.noglobstar=!!l.noglobstar,this.matchBase=!!l.matchBase,this.maxDepth=typeof l.maxDepth=="number"?l.maxDepth:1/0,this.stat=!!l.stat,this.ignore=l.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof s=="string"&&(s=[s]),this.windowsPathsNoEscape=!!l.windowsPathsNoEscape||l.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(s=s.map(M=>M.replace(/\\/g,"/"))),this.matchBase){if(l.noglobstar)throw new TypeError("base matching requires globstar");s=s.map(M=>M.includes("/")?M:`./**/${M}`)}if(this.pattern=s,this.platform=l.platform||ZZt,this.opts={...l,platform:this.platform},l.scurry){if(this.scurry=l.scurry,l.nocase!==void 0&&l.nocase!==l.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let M=l.platform==="win32"?sM:l.platform==="darwin"?wH:l.platform?aM:lot;this.scurry=new M(this.cwd,{nocase:l.nocase,fs:l.fs})}this.nocase=this.scurry.nocase;let _=this.platform==="darwin"||this.platform==="win32",m={...l,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:_,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},b=this.pattern.map(M=>new U2(M,m)),[D,A]=b.reduce((M,U)=>(M[0].push(...U.set),M[1].push(...U.globParts),M),[[],[]]);this.patterns=D.map((M,U)=>{let ne=A[U];if(!ne)throw new Error("invalid pattern object");return new oM(M,ne,0,this.platform)})}async walk(){return[...await new AH(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 AH(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 NH(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 NH(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 k6e=t((a,s={})=>{Array.isArray(a)||(a=[a]);for(let l of a)if(new U2(l,s).hasMagic())return!0;return!1},"hasMagic");function Vce(a,s={}){return new AC(a,s).streamSync()}t(Vce,"globStreamSync");function fot(a,s={}){return new AC(a,s).stream()}t(fot,"globStream");function _ot(a,s={}){return new AC(a,s).walkSync()}t(_ot,"globSync");async function uot(a,s={}){return new AC(a,s).walk()}t(uot,"glob_");function Wce(a,s={}){return new AC(a,s).iterateSync()}t(Wce,"globIterateSync");function pot(a,s={}){return new AC(a,s).iterate()}t(pot,"globIterate");var eer=Vce,ter=Object.assign(fot,{sync:Vce}),rer=Wce,ner=Object.assign(pot,{sync:Wce}),ier=Object.assign(_ot,{stream:Vce,iterate:Wce}),IH=Object.assign(uot,{glob:uot,globSync:_ot,sync:ier,globStream:fot,stream:ter,globStreamSync:Vce,streamSync:eer,globIterate:pot,iterate:ner,globIterateSync:Wce,iterateSync:rer,Glob:AC,hasMagic:k6e,escape:eM,unescape:kC});IH.glob=IH;import Wfe from"fs";import r7e from"path";var U1=class extends Error{static{t(this,"CompilationError")}buildMessages;constructor(s){super("An error occurred during compilation."),this.buildMessages=Array.isArray(s)?s:[s]}toBuildResult(){return{content:"",errors:this.buildMessages}}};var ser="[",aer="]",oer="{",cer="}",ler=":",uer=",",fer="true",_er="false",per="null",der="NaN",mer="Infinity",P6e='"',OH=new Map([[34,P6e],[92,"\\"],[47,"/"],[98,"\b"],[110,`
|
|
558
558
|
`],[102,"\f"],[114,"\r"],[116," "]]),Kce=new Map([...OH,[118,"\v"],[48,"\0"]]),her=new Map([[P6e,P6e],["\\","\\"],["/","/"],["\b","b"],[`
|
|
559
559
|
`,"n"],["\f","f"],["\r","r"],[" ","t"]]),c3r=new Map([...her,["\v","v"],["\0","0"],["\u2028","u2028"],["\u2029","u2029"]]),Gce=new Map([[ser,"LBracket"],[aer,"RBracket"],[oer,"LBrace"],[cer,"RBrace"],[ler,"Colon"],[uer,"Comma"],[fer,"Boolean"],[_er,"Boolean"],[per,"Null"]]),Hce=new Map([...Gce,[der,"Number"],[mer,"Number"]]),A6e=new Set([10,13,8232,8233]),XP=class extends Error{static{t(this,"ErrorWithLocation")}constructor(s,{line:l,column:_,offset:m}){super(`${s} (${l}:${_})`),this.line=l,this.column=_,this.offset=m}},N6e=class extends XP{static{t(this,"UnexpectedChar")}constructor(s,l){super(`Unexpected character '${String.fromCharCode(s)}' found.`,l)}},I6e=class extends XP{static{t(this,"UnexpectedIdentifier")}constructor(s,l){super(`Unexpected identifier '${s}' found.`,l)}},CO=class extends XP{static{t(this,"UnexpectedToken")}constructor(s){super(`Unexpected token ${s.type} found.`,s.loc.start)}},Yce=class extends XP{static{t(this,"UnexpectedEOF")}constructor(s){super("Unexpected end of input found.",s)}},ger=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,yer=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,ver=13,dot=10,O6e=class{static{t(this,"CharCodeReader")}#r="";#n=1;#e=0;#t=-1;#s=!1;#p=-1;#a=!1;constructor(s){this.#r=s}#_(){this.#a||(this.#e++,this.#t++,this.#p=-1,this.#a=!0)}locate(){return{line:this.#n,column:this.#e,offset:this.#t}}next(){if(this.#t>=this.#r.length-1)return this.#_(),-1;this.#t++;let s=this.#r.charCodeAt(this.#t);return this.#s?(this.#n++,this.#e=1,this.#s=!1):this.#e++,s===ver?(this.#s=!0,this.peek()===dot&&this.#t++):s===dot&&(this.#s=!0),this.#p=s,s}peek(){return this.#t===this.#r.length-1?-1:this.#r.charCodeAt(this.#t+1)}match(s){return s(this.peek())?(this.next(),!0):!1}current(){return this.#p}},ber="Infinity",Ser="NaN",Ter=new Set([116,102,110]),F6e=new Set([32,9,10,13]),mot=new Set([...F6e,11,12,160,8232,8233,65279,160,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288]),xer={mode:"json",ranges:!1},Cer=new Set(["true","false","null"]),x_={EOF:0,Number:1,String:2,Boolean:3,Null:4,NaN:5,Infinity:6,Identifier:7,Colon:20,LBrace:21,RBrace:22,LBracket:23,RBracket:24,Comma:25,LineComment:40,BlockComment:41};function YP(a){return a>=48&&a<=57}t(YP,"isDigit");function w6e(a){return YP(a)||a>=65&&a<=70||a>=97&&a<=102}t(w6e,"isHexDigit");function Eer(a){return a>=49&&a<=57}t(Eer,"isPositiveDigit");function Der(a){return Ter.has(a)}t(Der,"isKeywordStart");function got(a){return YP(a)||a===46||a===45}t(got,"isNumberStart");function ker(a){return got(a)||a===43}t(ker,"isJSON5NumberStart");function hot(a,s){return a===34||s&&a===39}t(hot,"isStringStart");function yot(a){if(a===36||a===95||a===92||a>=97&&a<=122||a>=65&&a<=90||a===8204||a===8205)return!0;let s=String.fromCharCode(a);return ger.test(s)}t(yot,"isJSON5IdentifierStart");function wer(a){if(yot(a)||YP(a))return!0;let s=String.fromCharCode(a);return yer.test(s)}t(wer,"isJSON5IdentifierPart");var L6e=class{static{t(this,"Tokenizer")}#r;#n;#e;#t;#s;#p;#a;#_;#c;#l;#i;constructor(s,l){this.#n=s,this.#r={...xer,...l},this.#e=new O6e(s),this.#t=this.#r.mode==="json5",this.#s=this.#r.mode!=="json",this.#p=this.#r.ranges,this.#_=this.#t?Kce.has.bind(Kce):OH.has.bind(OH),this.#c=this.#t?A6e.has.bind(A6e):()=>!1,this.#l=this.#t?_=>_===120:()=>!1,this.#i=this.#t?mot.has.bind(mot):F6e.has.bind(F6e)}#f(s,l=this.#e.locate()){throw new N6e(s,l)}#v(s,l=this.#e.locate()){throw new I6e(s,l)}#d(){throw new Yce(this.#e.locate())}#u(s,l,_,m){let b=_.offset+l,D=this.#r.ranges?{range:[_.offset,b]}:void 0;return{type:s,loc:{start:_,end:m||{line:_.line,column:_.column+l,offset:b}},...D}}#m(s){let l="",_;for(let m=0;m<s;m++){if(_=this.#e.peek(),w6e(_)){this.#e.next(),l+=String.fromCharCode(_);continue}this.#f(_)}return l}#g(s){let l="";do{if(l+=String.fromCharCode(s),s===92&&(s=this.#e.next(),s!==117&&this.#f(s),l+=String.fromCharCode(s),l+=this.#m(4)),s=this.#e.peek(),!wer(s))break;this.#e.next()}while(!0);return l}#E(s){let l=s,_=1;for(s=this.#e.peek();s!==-1&&s!==l;){if(this.#e.next(),_++,s===92)if(s=this.#e.peek(),this.#_(s)||this.#c(s))this.#e.next(),_++;else if(s===117){this.#e.next(),_++;let m=this.#m(4);_+=m.length}else if(this.#l(s)){this.#e.next(),_++;let m=this.#m(2);_+=m.length}else this.#t?(this.#e.next(),_++):this.#f(s);s=this.#e.peek()}return s===-1&&(this.#e.next(),this.#d()),this.#e.next(),_++,_}#x(s){let l=1;if(s===45||this.#t&&s===43){if(s=this.#e.peek(),this.#t&&(s===73||s===78)){this.#e.next();let _=this.#g(s);return _!==ber&&_!==Ser&&this.#f(s),l+_.length}YP(s)||this.#f(s),this.#e.next(),l++}if(s===48)if(s=this.#e.peek(),this.#t&&(s===120||s===88)){this.#e.next(),l++,s=this.#e.peek(),w6e(s)||(this.#e.next(),this.#f(s));do this.#e.next(),l++,s=this.#e.peek();while(w6e(s))}else YP(s)&&this.#f(s);else if(!this.#t||s!==46)for(Eer(s)||this.#f(s),s=this.#e.peek();YP(s);)this.#e.next(),l++,s=this.#e.peek();if(s===46){let _=-1;for(this.#e.next(),l++,_++,s=this.#e.peek();YP(s);)this.#e.next(),l++,_++,s=this.#e.peek();!this.#t&&_===0&&(this.#e.next(),s?this.#f(s):this.#d())}if(s===101||s===69)for(this.#e.next(),l++,s=this.#e.peek(),(s===43||s===45)&&(this.#e.next(),l++,s=this.#e.peek()),s===-1&&(this.#e.next(),this.#d()),YP(s)||(this.#e.next(),this.#f(s));YP(s);)this.#e.next(),l++,s=this.#e.peek();return l}#b(s){let l=1;if(s=this.#e.peek(),s===47){do this.#e.next(),l+=1,s=this.#e.peek();while(s>-1&&s!==13&&s!==10);return{length:l,multiline:!1}}if(s===42){for(this.#e.next(),l+=1;s>-1;)if(s=this.#e.peek(),s===42){if(this.#e.next(),l+=1,s=this.#e.peek(),s===47)return this.#e.next(),l+=1,{length:l,multiline:!0}}else this.#e.next(),l+=1;this.#e.next(),this.#d()}this.#e.next(),this.#f(s)}next(){let s=this.#e.next();for(;this.#i(s);)s=this.#e.next();if(s===-1)return x_.EOF;let l=this.#e.locate(),_=String.fromCharCode(s);if(this.#t)if(Hce.has(_))this.#a=this.#u(Hce.get(_),1,l);else if(yot(s)){let m=this.#g(s);Hce.has(m)?this.#a=this.#u(Hce.get(m),m.length,l):this.#a=this.#u("Identifier",m.length,l)}else if(ker(s)){let m=this.#x(s);this.#a=this.#u("Number",m,l)}else if(hot(s,this.#t)){let m=this.#E(s),b=this.#e.locate();this.#a=this.#u("String",m,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else if(s===47&&this.#s){let m=this.#b(s),b=this.#e.locate();this.#a=this.#u(m.multiline?"BlockComment":"LineComment",m.length,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else this.#f(s);else if(Gce.has(_))this.#a=this.#u(Gce.get(_),1,l);else if(Der(s)){let m=this.#g(s);Cer.has(m)||this.#v(m,l),this.#a=this.#u(Gce.get(m),m.length,l)}else if(got(s)){let m=this.#x(s);this.#a=this.#u("Number",m,l)}else if(hot(s,this.#t)){let m=this.#E(s);this.#a=this.#u("String",m,l)}else if(s===47&&this.#s){let m=this.#b(s),b=this.#e.locate();this.#a=this.#u(m.multiline?"BlockComment":"LineComment",m.length,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else this.#f(s);return x_[this.#a.type]}get token(){return this.#a}};var TT={document(a,s={}){return{type:"Document",body:a,loc:s.loc,...s}},string(a,s={}){return{type:"String",value:a,loc:s.loc,...s}},number(a,s={}){return{type:"Number",value:a,loc:s.loc,...s}},boolean(a,s={}){return{type:"Boolean",value:a,loc:s.loc,...s}},null(a={}){return{type:"Null",loc:a.loc,...a}},array(a,s={}){return{type:"Array",elements:a,loc:s.loc,...s}},element(a,s={}){return{type:"Element",value:a,loc:s.loc,...s}},object(a,s={}){return{type:"Object",members:a,loc:s.loc,...s}},member(a,s,l={}){return{type:"Member",name:a,value:s,loc:l.loc,...l}},identifier(a,s={}){return{type:"Identifier",name:a,loc:s.loc,...s}},nan(a="",s={}){return{type:"NaN",sign:a,loc:s.loc,...s}},infinity(a="",s={}){return{type:"Infinity",sign:a,loc:s.loc,...s}}},Per={mode:"json",ranges:!1,tokens:!1,allowTrailingCommas:!1};function Aer(a,s,l=!1){let _="",m=a.indexOf("\\"),b=0;for(;m>=0;){_+=a.slice(b,m);let D=a.charAt(m+1),A=D.charCodeAt(0);if(l&&Kce.has(A))_+=Kce.get(A),b=m+2;else if(OH.has(A))_+=OH.get(A),b=m+2;else if(D==="u"){let M=a.slice(m+2,m+6);if(M.length<4||/[^0-9a-f]/i.test(M))throw new XP(`Invalid unicode escape \\u${M}.`,{line:s.loc.start.line,column:s.loc.start.column+m,offset:s.loc.start.offset+m});_+=String.fromCharCode(parseInt(M,16)),b=m+6}else if(l&&D==="x"){let M=a.slice(m+2,m+4);if(M.length<2||/[^0-9a-f]/i.test(M))throw new XP(`Invalid hex escape \\x${M}.`,{line:s.loc.start.line,column:s.loc.start.column+m,offset:s.loc.start.offset+m});_+=String.fromCharCode(parseInt(M,16)),b=m+4}else if(l&&A6e.has(A))b=m+2,D==="\r"&&a.charAt(b)===`
|
|
560
|
-
`&&b++;else if(l)_+=D,b=m+2;else throw new XP(`Invalid escape \\${D}.`,{line:s.loc.start.line,column:s.loc.start.column+m,offset:s.loc.start.offset+m});m=a.indexOf("\\",b)}return _+=a.slice(b),_}t(Aer,"getStringValue");function Ner(a,s,l=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return Aer(a.slice(1,-1),s,l);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(Ner,"getLiteralValue");function vot(a,s){s=Object.freeze({...Per,...s});let l=[],_=new L6e(a,{mode:s.mode,ranges:s.ranges}),m=s.mode==="json5",b=s.allowTrailingCommas||m;function D(){let hr=_.next();return hr&&s.tokens&&l.push(_.token),hr}t(D,"nextNoComments");function A(){let hr=_.next();return hr&&s.tokens&&l.push(_.token),hr>=x_.LineComment?A():hr}t(A,"nextSkipComments");let M=s.mode==="json"?D:A;function U(hr,mr){if(hr!==mr)throw new CO(_.token)}t(U,"assertTokenType");function ne(hr,mr){if(!mr.includes(hr))throw new CO(_.token)}t(ne,"assertTokenTypes");function se(hr,mr){return s.ranges?{range:[hr.offset,mr.offset]}:void 0}t(se,"createRange");function Z(hr){let mr=_.token,Ds=se(mr.loc.start,mr.loc.end),Pi=Ner(a.slice(mr.loc.start.offset,mr.loc.end.offset),mr,m),Ti={loc:{start:{...mr.loc.start},end:{...mr.loc.end}},...Ds};switch(hr){case x_.String:return TT.string(Pi,Ti);case x_.Number:return TT.number(Pi,Ti);case x_.Boolean:return TT.boolean(Pi,Ti);default:throw new TypeError(`Unknown token type ${mr.type}.`)}}t(Z,"createLiteralNode");function Re(hr){let mr=se(hr.loc.start,hr.loc.end),Ds=a.slice(hr.loc.start.offset,hr.loc.end.offset),Po={loc:{start:{...hr.loc.start},end:{...hr.loc.end}},...mr};if(hr.type!=="Identifier"){let Ti="";return(Ds[0]==="+"||Ds[0]==="-")&&(Ti=Ds[0]),TT[Ds.includes("NaN")?"nan":"infinity"](Ti,Po)}return TT.identifier(Ds,Po)}t(Re,"createJSON5IdentifierNode");function Ae(hr){let mr=se(hr.loc.start,hr.loc.end);return TT.null({loc:{start:{...hr.loc.start},end:{...hr.loc.end}},...mr})}t(Ae,"createNullNode");function ke(hr){m?ne(hr,[x_.String,x_.Identifier,x_.Number]):U(hr,x_.String);let mr=_.token,Ds=hr===x_.String?Z(hr):Re(mr);if(m&&(Ds.type==="NaN"||Ds.type==="Infinity")){if(Ds.sign!=="")throw new CO(_.token);Ds=TT.identifier(Ds.type,{loc:Ds.loc,...se(Ds.loc.start,Ds.loc.end)})}hr=M(),U(hr,x_.Colon);let Pi=br(),Po=se(Ds.loc.start,Pi.loc.end);return TT.member(Ds,Pi,{loc:{start:{...Ds.loc.start},end:{...Pi.loc.end}},...Po})}t(ke,"parseProperty");function Ot(hr){U(hr,x_.LBrace);let mr=_.token,Ds=[],Pi=M();if(Pi!==x_.RBrace)do{if(Ds.push(ke(Pi)),Pi=M(),!Pi)throw new Yce(Ds[Ds.length-1].loc.end);if(Pi===x_.Comma){if(Pi=M(),b&&Pi===x_.RBrace)break}else break}while(Pi);U(Pi,x_.RBrace);let Po=_.token,Ti=se(mr.loc.start,Po.loc.end);return TT.object(Ds,{loc:{start:{...mr.loc.start},end:{...Po.loc.end}},...Ti})}t(Ot,"parseObject");function kt(hr){U(hr,x_.LBracket);let mr=_.token,Ds=[],Pi=M();if(Pi!==x_.RBracket)do{let _p=br(Pi);if(Ds.push(TT.element(_p,{loc:_p.loc})),Pi=M(),Pi===x_.Comma){if(Pi=M(),b&&Pi===x_.RBracket)break}else break}while(Pi);U(Pi,x_.RBracket);let Po=_.token,Ti=se(mr.loc.start,Po.loc.end);return TT.array(Ds,{loc:{start:{...mr.loc.start},end:{...Po.loc.end}},...Ti})}t(kt,"parseArray");function br(hr){hr=hr??M();let mr=_.token;switch(hr){case x_.String:case x_.Boolean:return Z(hr);case x_.Number:if(m){let Ds=a.slice(mr.loc.start.offset,mr.loc.end.offset);if((Ds[0]==="+"||Ds[0]==="-")&&(Ds=Ds.slice(1)),Ds==="NaN"||Ds==="Infinity")return Re(mr)}return Z(hr);case x_.Null:return Ae(mr);case x_.LBrace:return Ot(hr);case x_.LBracket:return kt(hr);default:throw new CO(mr)}}t(br,"parseValue");let Kr=br();if(M())throw new CO(_.token);let un={loc:{start:{line:1,column:1,offset:0},end:{...Kr.loc.end}}};return s.tokens&&(un.tokens=l),s.ranges&&(un.range=[un.loc.start.offset,un.loc.end.offset]),TT.document(Kr,un)}t(vot,"parse");var Ier=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function bot(a){return a&&typeof a=="object"}t(bot,"isObject");function Oer(a){return bot(a)&&typeof a.type=="string"}t(Oer,"isNode");function Fer(a,s){function l(_,m){typeof s.enter=="function"&&s.enter(_,m);for(let b of Ier.get(_.type)){let D=_[b];bot(D)&&(Array.isArray(D)?D.forEach(A=>l(A,_)):Oer(D)&&l(D,_))}typeof s.exit=="function"&&s.exit(_,m)}t(l,"visitNode"),l(a)}t(Fer,"traverse");function Sot(a,s=()=>!0){let l=[];return Fer(a,{enter(_,m){l.push({node:_,parent:m,phase:"enter"})},exit(_,m){l.push({node:_,parent:m,phase:"exit"})}}),l.filter(s).values()}t(Sot,"iterator");import Ler from"fs/promises";var FH=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),Xce=t(async a=>{try{return await Ler.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),LH=t(async a=>{try{return vot(a)}catch(s){if(s.column&&s.line&&s.message){let l=FH(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:l}}return}},"getSchemaAST");var Tot=t(async(a,s,l)=>{try{if(a.length===0)return;for(let _ of a){let m=await Xce(_),b=await Rer(m,_,s,l);if(b)return b}}catch{}},"getRouteLocationByValue"),Rer=t(async(a,s,l,_)=>{try{if(!a)return;let m=null,b=await LH(a);if(b){for(let{node:D}of Sot(b))if(D.value&&D.value===l){m=D.loc;break}if(m!==null){let D=FH(a,m.start.line);return{file:s,line:m.start.line,column:m.start.column,length:m.end.column-m.start.column,lineText:D,suggestion:_}}}}catch{}},"getRouteLocationByValueFromSchema");import xot from"fs/promises";import Qce from"path";var R6e="schemas",M6e=".oas.json";var EO=t(async a=>(await xot.readdir(a)).map(l=>`${a}/${l}`).filter(l=>l.endsWith(M6e)).sort(),"getOpenApiFilesByAlphabetical"),lM=t(async a=>{let s=Qce.resolve(a,"config");return(await xot.readdir(s)).filter(_=>_.endsWith(M6e)).length>=1},"oasFileInProject");function RH(a,s,l,_,m,b,D){if(b.has(l))return;let A=_.get(l);b.set(l,m.length),m.push(l),j6e(B6e(l),s,A,_,m,b,D)}t(RH,"chaseRefs");function j6e(a,s,l,_,m,b,D){if(Array.isArray(l))for(let A of l)j6e(a,s,A,_,m,b,D);else if(typeof l=="object")for(let A in l){if(A==="$ref"){let M=l[A];D&&(l[A]=D(s,M)),RH(a,s,i3(a,M),_,m,b,D)}j6e(a,s,l[A],_,m,b,D)}}t(j6e,"lookForRefs");function i3(a,s){let l=s.indexOf("#");return l>=0?`${Qce.resolve(a,s.substring(0,l))}${s.substring(l)}`:Qce.resolve(Qce.dirname(a),s)}t(i3,"getFullyQualifiedRefName");function B6e(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(B6e,"getFilePathNameFromRefName");var ZH=S_(e3e(),1);var t3e={};vst(t3e,{UnsafePathError:()=>Ele,deleteFile:()=>Ssr,deleteFolder:()=>Asr,dirExists:()=>Dle,ensureDirectoryExists:()=>Esr,fileExists:()=>bsr,getParentDirFilename:()=>ksr,isNotFileOrDirectory:()=>Tsr,listFolderContents:()=>Xlt,listFolders:()=>Csr,mkdirForFilePathIfNotExits:()=>Zlt,mkdirIfNotExists:()=>Qlt,safePath:()=>Dsr,tarFolderContent:()=>wsr,untar:()=>Psr});import Klt from"child_process";import _3 from"fs/promises";import f3 from"path";var Ylt=[".git","node_modules",".yarn",".DS_Store"];async function bsr(a){try{return(await _3.stat(a)).isFile()}catch{return!1}}t(bsr,"fileExists");async function Ssr(a,s){return await _3.rm(a,s)}t(Ssr,"deleteFile");async function Dle(a){try{return(await _3.stat(a)).isDirectory()}catch{return!1}}t(Dle,"dirExists");async function Tsr(a){try{return await _3.stat(a),!1}catch{return!0}}t(Tsr,"isNotFileOrDirectory");function xsr(a,s){let l=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),_=a.match(l);if(!_)return"";let m=a.split(_[0]);return m[1]===""?"":`/${m[1]}`}t(xsr,"getParentDirectory");async function Csr(a){if(!await Dle(a))return[];let s=await _3.readdir(a,{withFileTypes:!0}),l=[];for await(let _ of s)Ylt.includes(_.name)||_.isDirectory()&&l.push(_.name);return l}t(Csr,"listFolders");async function Xlt(a,s,l=!0){let _=xsr(a,s),m=await _3.readdir(a,{withFileTypes:!0}),b=[];for await(let D of m)if(!Ylt.includes(D.name)||!l)if(D.isDirectory()){let A=await Xlt(f3.join(a,D.name),s,l);b.push(...A)}else b.push(f3.join(_,D.name));return b}t(Xlt,"listFolderContents");var Qlt=t(async a=>{if(await Dle(a))return!0;await _3.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),Zlt=t(async a=>{let s=f3.dirname(a);return Qlt(s)},"mkdirForFilePathIfNotExits"),Esr=Zlt,Ele=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function Dsr(a){let s=t(l=>{if(!l.startsWith(a))throw new Ele("Resolved path is not part of the project.");return l},"ensureSafePath");return{resolve:t((...l)=>s(f3.resolve(...l)),"resolve")}}t(Dsr,"safePath");function ksr(a){return`${f3.basename(f3.dirname(a))}/${f3.basename(a)}`}t(ksr,"getParentDirFilename");function wsr(a,s,l,_){let m=f3.join(_,l);return Klt.execSync(`tar --exclude='.git/' --exclude='dist/' -czf ${m} ${s}`,{cwd:a}),m}t(wsr,"tarFolderContent");function Psr(a,s,l,_=!1){Klt.execSync(`tar -xf ${s} ${_?"--strip-components=1 ":""}-C ${l}`,{cwd:a})}t(Psr,"untar");async function Asr(a){if(await Dle(a))return await _3.rm(a,{recursive:!0})}t(Asr,"deleteFolder");var yl=t3e;var DT=S_(e3e(),1);import{readFile as Nsr}from"fs/promises";var FO=class extends Error{static{t(this,"CustomResolveError")}},p3=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,l){this.sourceDirectory=s,this.logger=l}dereference(s,l){return ZH.$RefParser.dereference(s,{resolve:{json:!0,file:kle(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:l?.onDereference}})}bundle(s){return ZH.$RefParser.bundle(s,{resolve:{file:kle(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return ZH.$RefParser.parse(s,{resolve:{file:kle(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return ZH.$RefParser.resolve(s,{resolve:{file:kle(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function kle(a,s){return{order:100,canRead(l){let _=Fsr(l.url);if(!(_===void 0||_==="file"))return!1;let b;try{b=eut(l.url)}catch(D){throw new FO(`Malformed URI: ${l.url}`,{cause:D})}try{yl.safePath(a).resolve(b)}catch(D){return s?.warn(D),!1}return!0},async read(l){let _;try{_=eut(l.url)}catch(m){throw new FO(`Malformed URI: ${l.url}`,{cause:m})}try{return await Nsr(_)}catch(m){throw new FO(`Error opening file "${_}"`,{cause:m})}}}}t(kle,"customResolver");var r3e=/^win/.test(globalThis.process?globalThis.process.platform:""),Isr=/\//g,Osr=/^(\w{2,}):\/\//i,n3e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function Fsr(a){let s=Osr.exec(a);if(s)return s[1].toLowerCase()}t(Fsr,"getProtocol");function eut(a,s){a=decodeURI(a);for(let _=0;_<n3e.length;_+=2)a=a.replace(n3e[_],n3e[_+1]);let l=a.substr(0,7).toLowerCase()==="file://";return l&&(a=a[7]==="/"?a.substr(8):a.substr(7),r3e&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(l=!1,a=r3e?a:"/"+a)),r3e&&!l&&(a=a.replace(Isr,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(eut,"toFileSystemPath");var tut="YOUR_KEY_HERE";async function rut(a){let l=await new p3(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),_=a.openApiDocPath.replace(a.sourceDirectory,"");return Lsr({...a,relativeOpenApiPath:_},l)}t(rut,"buildPublicOpenApiFile");async function Lsr(a,s){Bsr({relativeOpenApiPath:a.relativeOpenApiPath},s);let l=s;return l=Msr(l),Rsr(l,a),l=jsr(l,a),nut(l,"x-zuplo"),l}t(Lsr,"buildRawOpenApiFile");function Rsr(a,{customDomain:s,deploymentName:l,environmentType:_}){let m;s?m=s:_&&l&&(m=_===gce.WORKING_COPY?`${l}.d2.zuplo.dev`:`${l}.zuplo.app`),m?a.servers=[{url:`https://${m}`}]:a.servers=void 0}t(Rsr,"addServerHost");function Msr(a){if(!a.paths)return a;let{components:s}=a,l=s?{...s}:void 0,_=[];l&&l.parameters&&(_=Object.entries(l.parameters).reduce((b,[D,A])=>(YR in A&&yce(A[YR])&&(b.push(D),l.parameters&&delete l.parameters[D]),b),[]));let m=Object.entries(a.paths).reduce((b,[D,A])=>{if(!A)return b;let M={...A},U=["delete","get","head","patch","post","put","trace","options"];return U.forEach(ne=>{let se=A[ne];if(!se)return;if(yce(se[YR])){delete M[ne];return}let{parameters:Z}=se;if(!Z)return;let Re=Z.filter(Ae=>{if(YR in Ae&&yce(Ae[YR]))return!1;if("$ref"in Ae){let ke=Ae.$ref.split("/").pop();return ke?!_.includes(ke):!0}return!0});M[ne]={...se,parameters:Re}}),U.some(ne=>!!M[ne])&&(b[D]=M),b},{});return{...a,paths:m,components:l}}t(Msr,"removeHiddenRoutesAndParams");function jsr(a,{policiesConfig:s}){if(!a.paths)return a;let l=Object.entries(a.paths).reduce((_,[m,b])=>{if(!b)return _;let D={...b};return[D.delete,D.get,D.head,D.patch,D.post,D.put,D.trace,D.options].forEach(A=>{if(!A)return;let M=A["x-zuplo-route"]?.policies?.inbound?.reduce((se,Z)=>{let Re=s.policies?.find(({name:Ot})=>Ot===Z);if(!Re)return se;if(!(Re.handler.export==="CompositeInboundPolicy"))return se.concat(Z);let ke=Re.handler.options?.policies;return ke?se.concat(ke):se},[]),U=[];if(M&&M.forEach(se=>{s.policies?.forEach(Z=>{Z.name===se&&(Z.handler.export==="ApiAuthKeyInboundPolicy"||Z.handler.export==="ApiKeyInboundPolicy")&&!Z.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&U.push(Z)})}),U.length>0){let se=U.length>0&&U[0].handler&&U[0].handler.options&&U[0].handler.options.authHeader?U[0].handler.options.authHeader:"Authorization",Z=U.length>0&&U[0].handler&&U[0].handler.options&&(U[0].handler.options.authScheme||U[0].handler.options.authScheme==="")?U[0].handler.options.authScheme:"Bearer",Re=Z!==""?`${Z} ${tut}`:tut,Ae={name:se,in:"header",required:!0,example:Re,schema:{type:"string"},description:`The \`${se}\` header is used to authenticate with the API using your API key. Value is of the format \`${Re}\`.`};A.parameters?A.parameters.some(br=>"name"in br&&br.name===Ae.name)||A.parameters.unshift(Ae):A.parameters=[Ae];let ke={type:"http",scheme:Z.toLowerCase()},Ot="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(br=>"name"in br&&br.type==="apiKey"||"type"in br&&br.type==="http"&&br.scheme===Z)||(a.components.securitySchemes={...a.components.securitySchemes,[Ot]:ke}):(a.components||(a.components={}),a.components.securitySchemes={[Ot]:ke});let kt={[Ot]:[]};A.security?A.security.some(br=>br[Ot]!==void 0)||A.security.unshift(kt):A.security=[kt]}let ne=[];if(M&&M.forEach(se=>{s.policies?.forEach(Z=>{Z.name===se&&(Z.handler.export==="RateLimitInboundPolicy"||Z.handler.export==="ComplexRateLimitInboundPolicy")&&ne.push(Z)})}),ne.length>0){let se={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},Z={...se,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:se,RateLimitWithRetryAfter:Z},A.responses||(A.responses={});let Re=ne.some(Ae=>Ae.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Re?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),_[m]=D,_},{});return{...a,paths:l}}t(jsr,"enrichSpecWithZuploData");function nut(a,s){for(let l in a)l.startsWith(s)?delete a[l]:typeof a[l]=="object"&&nut(a[l],s)}t(nut,"removePropertiesByPrefix");function Bsr({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new B2({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new B2({message:"The OpenAPI document does not have the required 'info' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"});if(!("title"in s.info)||typeof s.info.title!="string")throw new B2({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(Bsr,"assertIsZuploOpenApiSpec");function Usr(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let U=0;U<s.length;U++)s[U]=255;for(let U=0;U<a.length;U++){let ne=a.charAt(U),se=ne.charCodeAt(0);if(s[se]!==255)throw new TypeError(ne+" is ambiguous");s[se]=U}let l=a.length,_=a.charAt(0),m=Math.log(l)/Math.log(256),b=Math.log(256)/Math.log(l);function D(U){if(U instanceof Uint8Array||(ArrayBuffer.isView(U)?U=new Uint8Array(U.buffer,U.byteOffset,U.byteLength):Array.isArray(U)&&(U=Uint8Array.from(U))),!(U instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(U.length===0)return"";let ne=0,se=0,Z=0,Re=U.length;for(;Z!==Re&&U[Z]===0;)Z++,ne++;let Ae=(Re-Z)*b+1>>>0,ke=new Uint8Array(Ae);for(;Z!==Re;){let br=U[Z],Kr=0;for(let on=Ae-1;(br!==0||Kr<se)&&on!==-1;on--,Kr++)br+=256*ke[on]>>>0,ke[on]=br%l>>>0,br=br/l>>>0;if(br!==0)throw new Error("Non-zero carry");se=Kr,Z++}let Ot=Ae-se;for(;Ot!==Ae&&ke[Ot]===0;)Ot++;let kt=_.repeat(ne);for(;Ot<Ae;++Ot)kt+=a.charAt(ke[Ot]);return kt}t(D,"encode");function A(U){if(typeof U!="string")throw new TypeError("Expected String");if(U.length===0)return new Uint8Array;let ne=0,se=0,Z=0;for(;U[ne]===_;)se++,ne++;let Re=(U.length-ne)*m+1>>>0,Ae=new Uint8Array(Re);for(;U[ne];){let br=s[U.charCodeAt(ne)];if(br===255)return;let Kr=0;for(let on=Re-1;(br!==0||Kr<Z)&&on!==-1;on--,Kr++)br+=l*Ae[on]>>>0,Ae[on]=br%256>>>0,br=br/256>>>0;if(br!==0)throw new Error("Non-zero carry");Z=Kr,ne++}let ke=Re-Z;for(;ke!==Re&&Ae[ke]===0;)ke++;let Ot=new Uint8Array(se+(Re-ke)),kt=se;for(;ke!==Re;)Ot[kt++]=Ae[ke++];return Ot}t(A,"decodeUnsafe");function M(U){let ne=A(U);if(ne)return ne;throw new Error("Non-base"+l+" character")}return t(M,"decode"),{encode:D,decodeUnsafe:A,decode:M}}t(Usr,"base");var iut=Usr;var $sr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",wle=iut($sr);var i3e="2024-09-02",sut=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function aut(){return new kT({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:i3e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:sut[i3e]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(aut,"getMockEnvironment");var kT=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=aut()),this.#r}constructor({build:s,runtime:l}){let _;try{if(l.__ZUPLO_CONFIG){let m=atob(l.__ZUPLO_CONFIG);_=JSON.parse(m)}if(l.ZUPLO_SYSTEM_CONFIGURATIONS){let m=new TextDecoder().decode(wle.decode(l.ZUPLO_SYSTEM_CONFIGURATIONS)),b=JSON.parse(m);for(let D of Object.keys(b))l[D]=b[D]}}catch(m){console.error("Failed to parse runtime configuration",m)}this.config=_??{},this.build=s,this.runtime=l,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var Jsr=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function out(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!Jsr.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(out,"isRestrictedEnvVariableName");function cut(a){return!!a.startsWith("ZUPLO_")}t(cut,"isZuploReadableEnvVariableName");var YIr=new Proxy({},{get(a,s){let l=String(s);switch(l){case"ZUPLO_ENVIRONMENT_TYPE":return kT.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return kT.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return kT.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return kT.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return kT.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return kT.instance.build.BUILD_ID}if(!(out(l)&&!cut(l)))return kT.instance.runtime[l]}});function eG(a,s,l){return`_${rA(`${a}_${s}_${l}`)}`}t(eG,"getRawOperationDataIdentifierName");function s3e(a,s,l,_){return`_${rA(a.toLowerCase())}_${s.toLowerCase()}_${l.toLowerCase()}_${_.toLowerCase()}`}t(s3e,"getIdForParameterSchema");function a3e(a,s,l){return`_${rA(a.toLowerCase())}_${s.toLowerCase()}_rb_${rA(l.toLowerCase())}`}t(a3e,"getIdForRequestBodySchema");function tG(a,s){return`_${rA(a)}_${rA(s)}`}t(tG,"getIdForRefSchema");function rA(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(rA,"sanitizedIdentifierName");var Umt=S_(Qft(),1);import efe from"path";var gG=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,l,_,m,b){this.type=a,this.name=s,this.prefix=l,this.value=_,this.suffix=m,this.modifier=b}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Rcr=/[$_\p{ID_Start}]/u,Mcr=/[$_\u200C\u200D\p{ID_Continue}]/u,eNe=".*";function jcr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(jcr,"Re");function t_t(a,s=!1){let l=[],_=0;for(;_<a.length;){let m=a[_],b=t(function(D){if(!s)throw new TypeError(D);l.push({type:"INVALID_CHAR",index:_,value:a[_++]})},"c");if(m==="*"){l.push({type:"ASTERISK",index:_,value:a[_++]});continue}if(m==="+"||m==="?"){l.push({type:"OTHER_MODIFIER",index:_,value:a[_++]});continue}if(m==="\\"){l.push({type:"ESCAPED_CHAR",index:_++,value:a[_++]});continue}if(m==="{"){l.push({type:"OPEN",index:_,value:a[_++]});continue}if(m==="}"){l.push({type:"CLOSE",index:_,value:a[_++]});continue}if(m===":"){let D="",A=_+1;for(;A<a.length;){let M=a.substr(A,1);if(A===_+1&&Rcr.test(M)||A!==_+1&&Mcr.test(M)){D+=a[A++];continue}break}if(!D){b(`Missing parameter name at ${_}`);continue}l.push({type:"NAME",index:_,value:D}),_=A;continue}if(m==="("){let D=1,A="",M=_+1,U=!1;if(a[M]==="?"){b(`Pattern cannot start with "?" at ${M}`);continue}for(;M<a.length;){if(!jcr(a[M],!1)){b(`Invalid character '${a[M]}' at ${M}.`),U=!0;break}if(a[M]==="\\"){A+=a[M++]+a[M++];continue}if(a[M]===")"){if(D--,D===0){M++;break}}else if(a[M]==="("&&(D++,a[M+1]!=="?")){b(`Capturing groups are not allowed at ${M}`),U=!0;break}A+=a[M++]}if(U)continue;if(D){b(`Unbalanced pattern at ${_}`);continue}if(!A){b(`Missing pattern at ${_}`);continue}l.push({type:"REGEX",index:_,value:A}),_=M;continue}l.push({type:"CHAR",index:_,value:a[_++]})}return l.push({type:"END",index:_,value:""}),l}t(t_t,"v");function r_t(a,s={}){let l=t_t(a);s.delimiter??="/#?",s.prefixes??="./";let _=`[^${NT(s.delimiter)}]+?`,m=[],b=0,D=0,A="",M=new Set,U=t(Kr=>{if(D<l.length&&l[D].type===Kr)return l[D++].value},"a"),ne=t(()=>U("OTHER_MODIFIER")??U("ASTERISK"),"f"),se=t(Kr=>{let on=U(Kr);if(on!==void 0)return on;let{type:un,index:hr}=l[D];throw new TypeError(`Unexpected ${un} at ${hr}, expected ${Kr}`)},"d"),Z=t(()=>{let Kr="",on;for(;on=U("CHAR")??U("ESCAPED_CHAR");)Kr+=on;return Kr},"T"),Re=t(Kr=>Kr,"Se"),Ae=s.encodePart||Re,ke="",Ot=t(Kr=>{ke+=Kr},"U"),kt=t(()=>{ke.length&&(m.push(new gG(3,"","",Ae(ke),"",3)),ke="")},"$"),br=t((Kr,on,un,hr,mr)=>{let Ds=3;switch(mr){case"?":Ds=1;break;case"*":Ds=0;break;case"+":Ds=2;break}if(!on&&!un&&Ds===3){Ot(Kr);return}if(kt(),!on&&!un){if(!Kr)return;m.push(new gG(3,"","",Ae(Kr),"",Ds));return}let Pi;un?un==="*"?Pi=eNe:Pi=un:Pi=_;let Po=2;Pi===_?(Po=1,Pi=""):Pi===eNe&&(Po=0,Pi="");let Ti;if(on?Ti=on:un&&(Ti=b++),M.has(Ti))throw new TypeError(`Duplicate name '${Ti}'.`);M.add(Ti),m.push(new gG(Po,Ti,Ae(Kr),Pi,Ae(hr),Ds))},"V");for(;D<l.length;){let Kr=U("CHAR"),on=U("NAME"),un=U("REGEX");if(!on&&!un&&(un=U("ASTERISK")),on||un){let mr=Kr??"";s.prefixes.indexOf(mr)===-1&&(Ot(mr),mr=""),kt();let Ds=ne();br(mr,on,un,"",Ds);continue}let hr=Kr??U("ESCAPED_CHAR");if(hr){Ot(hr);continue}if(U("OPEN")){let mr=Z(),Ds=U("NAME"),Pi=U("REGEX");!Ds&&!Pi&&(Pi=U("ASTERISK"));let Po=Z();se("CLOSE");let Ti=ne();br(mr,Ds,Pi,Po,Ti);continue}kt(),se("END")}return m}t(r_t,"D");function NT(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(NT,"S");function Zft(a){return a&&a.ignoreCase?"ui":"u"}t(Zft,"X");function Bcr(a,s,l){return n_t(r_t(a,l),s,l)}t(Bcr,"Z");function OM(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(OM,"k");function n_t(a,s,l={}){l.delimiter??="/#?",l.prefixes??="./",l.sensitive??=!1,l.strict??=!1,l.end??=!0,l.start??=!0,l.endsWith="";let _=l.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?_+=NT(A.value):_+=`(?:${NT(A.value)})${OM(A.modifier)}`;continue}s&&s.push(A.name);let M=`[^${NT(l.delimiter)}]+?`,U=A.value;if(A.type===1?U=M:A.type===0&&(U=eNe),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?_+=`(${U})${OM(A.modifier)}`:_+=`((?:${U})${OM(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){_+=`(?:${NT(A.prefix)}(${U})${NT(A.suffix)})`,_+=OM(A.modifier);continue}_+=`(?:${NT(A.prefix)}`,_+=`((?:${U})(?:`,_+=NT(A.suffix),_+=NT(A.prefix),_+=`(?:${U}))*)${NT(A.suffix)})`,A.modifier===0&&(_+="?")}let m=`[${NT(l.endsWith)}]|$`,b=`[${NT(l.delimiter)}]`;if(l.end)return l.strict||(_+=`${b}?`),l.endsWith.length?_+=`(?=${m})`:_+="$",new RegExp(_,Zft(l));l.strict||(_+=`(?:${b}(?=${m}))?`);let D=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(D=l.delimiter.indexOf(A)>-1)}return D||(_+=`(?=${b}|${m})`),new RegExp(_,Zft(l))}t(n_t,"F");var g3={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Ucr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},$cr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function Jcr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(Jcr,"J");function i_t(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(i_t,"Q");function zcr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(zcr,"Ee");function s_t(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(s_t,"W");var a_t=["ftp","file","http","https","ws","wss"];function o_t(a){if(!a)return!0;for(let s of a_t)if(a.test(s))return!0;return!1}t(o_t,"N");function qcr(a,s){if(a=i_t(a,"#"),s||a==="")return a;let l=new URL("https://example.com");return l.hash=a,l.hash?l.hash.substring(1,l.hash.length):""}t(qcr,"te");function Vcr(a,s){if(a=i_t(a,"?"),s||a==="")return a;let l=new URL("https://example.com");return l.search=a,l.search?l.search.substring(1,l.search.length):""}t(Vcr,"re");function Wcr(a,s){return s||a===""?a:s_t(a)?u_t(a):l_t(a)}t(Wcr,"ne");function Hcr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.password=a,l.password}t(Hcr,"se");function Gcr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.username=a,l.username}t(Gcr,"ie");function Kcr(a,s,l){if(l||a==="")return a;if(s&&!a_t.includes(s))return new URL(`${s}:${a}`).pathname;let _=a[0]=="/";return a=new URL(_?a:"/-"+a,"https://example.com").pathname,_||(a=a.substring(2,a.length)),a}t(Kcr,"ae");function Ycr(a,s,l){return c_t(s)===a&&(a=""),l||a===""?a:f_t(a)}t(Ycr,"oe");function Xcr(a,s){return a=zcr(a,":"),s||a===""?a:tNe(a)}t(Xcr,"ce");function c_t(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(c_t,"_");function tNe(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(tNe,"y");function Qcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Qcr,"le");function Zcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(Zcr,"fe");function l_t(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(l_t,"z");function u_t(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(u_t,"j");function f_t(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(f_t,"K");function elr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(elr,"he");function tlr(a){return a===""?a:new URL(`data:${a}`).pathname}t(tlr,"ue");function rlr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(rlr,"de");function nlr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(nlr,"pe");var ilr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=t_t(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#w()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#E()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#x()?this.#d(3):(this.#C()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#x()&&this.#i(5,1);break;case 4:this.#x()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#k()&&!this.#c?this.#i(6,1):this.#C()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#C()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 7:this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 8:this.#D()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#i(a,s){switch(this.#a){case 0:break;case 1:this.#e.protocol=this.#T();break;case 2:break;case 3:this.#e.username=this.#T();break;case 4:this.#e.password=this.#T();break;case 5:this.#e.hostname=this.#T();break;case 6:this.#e.port=this.#T();break;case 7:this.#e.pathname=this.#T();break;case 8:this.#e.search=this.#T();break;case 9:this.#e.hash=this.#T();break;case 10:break}this.#a!==0&&a!==10&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(a)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(a)&&(this.#e.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&a===9&&(this.#e.search??="")),this.#f(a,s)}#f(a,s){this.#a=a,this.#p=this.#t+s,this.#t+=s,this.#s=0}#v(){this.#t=this.#p,this.#s=0}#d(a){this.#v(),this.#a=a}#u(a){return a<0&&(a=this.#n.length-a),a<this.#n.length?this.#n[a]:this.#n[this.#n.length-1]}#m(a,s){let l=this.#u(a);return l.value===s&&(l.type==="CHAR"||l.type==="ESCAPED_CHAR"||l.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#E(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#x(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#k(){return this.#m(this.#t,":")}#C(){return this.#m(this.#t,"/")}#y(){if(this.#m(this.#t,"?"))return!0;if(this.#n[this.#t].value!=="?")return!1;let a=this.#u(this.#t-1);return a.type!=="NAME"&&a.type!=="REGEX"&&a.type!=="CLOSE"&&a.type!=="ASTERISK"}#D(){return this.#m(this.#t,"#")}#w(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,g3),a.encodePart=tNe;let s=Bcr(this.#T(),void 0,a);this.#l=o_t(s)}},Z3e=["protocol","username","password","hostname","port","pathname","search","hash"],h3="*";function e_t(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let l=new URL(a,s);return{protocol:l.protocol.substring(0,l.protocol.length-1),username:l.username,password:l.password,hostname:l.hostname,port:l.port,pathname:l.pathname,search:l.search!==""?l.search.substring(1,l.search.length):void 0,hash:l.hash!==""?l.hash.substring(1,l.hash.length):void 0}}t(e_t,"ge");function oA(a,s){return s?hG(a):a}t(oA,"b");function mG(a,s,l){let _;if(typeof s.baseURL=="string")try{_=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=oA(_.protocol.substring(0,_.protocol.length-1),l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=oA(_.username,l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=oA(_.password,l)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=oA(_.hostname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=oA(_.port,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=oA(_.pathname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=oA(_.search.substring(1,_.search.length),l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=oA(_.hash.substring(1,_.hash.length),l))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Xcr(s.protocol,l)),typeof s.username=="string"&&(a.username=Gcr(s.username,l)),typeof s.password=="string"&&(a.password=Hcr(s.password,l)),typeof s.hostname=="string"&&(a.hostname=Wcr(s.hostname,l)),typeof s.port=="string"&&(a.port=Ycr(s.port,a.protocol,l)),typeof s.pathname=="string"){if(a.pathname=s.pathname,_&&!Jcr(a.pathname,l)){let m=_.pathname.lastIndexOf("/");m>=0&&(a.pathname=oA(_.pathname.substring(0,m+1),l)+a.pathname)}a.pathname=Kcr(a.pathname,a.protocol,l)}return typeof s.search=="string"&&(a.search=Vcr(s.search,l)),typeof s.hash=="string"&&(a.hash=qcr(s.hash,l)),a}t(mG,"w");function hG(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(hG,"C");function slr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(slr,"Oe");function alr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let l=".*",_=`[^${slr(s.delimiter)}]+?`,m=/[$_\u200C\u200D\p{ID_Continue}]/u,b="";for(let D=0;D<a.length;++D){let A=a[D];if(A.type===3){if(A.modifier===3){b+=hG(A.value);continue}b+=`{${hG(A.value)}}${OM(A.modifier)}`;continue}let M=A.hasCustomName(),U=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),ne=D>0?a[D-1]:null,se=D<a.length-1?a[D+1]:null;if(!U&&M&&A.type===1&&A.modifier===3&&se&&!se.prefix.length&&!se.suffix.length)if(se.type===3){let Z=se.value.length>0?se.value[0]:"";U=m.test(Z)}else U=!se.hasCustomName();if(!U&&!A.prefix.length&&ne&&ne.type===3){let Z=ne.value[ne.value.length-1];U=s.prefixes.includes(Z)}U&&(b+="{"),b+=hG(A.prefix),M&&(b+=`:${A.name}`),A.type===2?b+=`(${A.value})`:A.type===1?M||(b+=`(${_})`):A.type===0&&(!M&&(!ne||ne.type===3||ne.modifier!==3||U||A.prefix!=="")?b+="*":b+=`(${l})`),A.type===1&&M&&A.suffix.length&&m.test(A.suffix[0])&&(b+="\\"),b+=hG(A.suffix),U&&(b+="}"),A.modifier!==3&&(b+=OM(A.modifier))}return b}t(alr,"ke");var __t=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,l){try{let _;if(typeof s=="string"?_=s:l=s,typeof a=="string"){let A=new ilr(a);if(A.parse(),a=A.result,_===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=_}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(_)throw new TypeError("parameter 1 is not of type 'string'.")}typeof l>"u"&&(l={ignoreCase:!1});let m={ignoreCase:l.ignoreCase===!0},b={pathname:h3,protocol:h3,username:h3,password:h3,hostname:h3,port:h3,search:h3,hash:h3};this.#r=mG(b,a,!0),c_t(this.#r.protocol)===this.#r.port&&(this.#r.port="");let D;for(D of Z3e){if(!(D in this.#r))continue;let A={},M=this.#r[D];switch(this.#e[D]=[],D){case"protocol":Object.assign(A,g3),A.encodePart=tNe;break;case"username":Object.assign(A,g3),A.encodePart=Qcr;break;case"password":Object.assign(A,g3),A.encodePart=Zcr;break;case"hostname":Object.assign(A,Ucr),s_t(M)?A.encodePart=u_t:A.encodePart=l_t;break;case"port":Object.assign(A,g3),A.encodePart=f_t;break;case"pathname":o_t(this.#n.protocol)?(Object.assign(A,$cr,m),A.encodePart=elr):(Object.assign(A,g3,m),A.encodePart=tlr);break;case"search":Object.assign(A,g3,m),A.encodePart=rlr;break;case"hash":Object.assign(A,g3,m),A.encodePart=nlr;break}try{this.#s[D]=r_t(M,A),this.#n[D]=n_t(this.#s[D],this.#e[D],A),this.#t[D]=alr(this.#s[D],A),this.#p=this.#p||this.#s[D].some(U=>U.type===2)}catch{throw new TypeError(`invalid ${D} pattern '${this.#r[D]}'.`)}}}catch(_){throw new TypeError(`Failed to construct 'URLPattern': ${_.message}`)}}test(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?l=mG(l,a,!1):l=mG(l,e_t(a,s),!1)}catch{return!1}let _;for(_ of Z3e)if(!this.#n[_].exec(l[_]))return!1;return!0}exec(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?l=mG(l,a,!1):l=mG(l,e_t(a,s),!1)}catch{return null}let _={};s?_.inputs=[a,s]:_.inputs=[a];let m;for(m of Z3e){let b=this.#n[m].exec(l[m]);if(!b)return null;let D={};for(let[A,M]of this.#e[m].entries())if(typeof M=="string"||typeof M=="number"){let U=b[A+1];D[M]=U}_[m]={input:l[m]??"",groups:D}}return _}static compareComponent(a,s,l){let _=t((A,M)=>{for(let U of["type","modifier","prefix","value","suffix"]){if(A[U]<M[U])return-1;if(A[U]!==M[U])return 1}return 0},"o"),m=new gG(3,"","","","",3),b=new gG(0,"","","","",3),D=t((A,M)=>{let U=0;for(;U<Math.min(A.length,M.length);++U){let ne=_(A[U],M[U]);if(ne)return ne}return A.length===M.length?0:_(A[U]??m,M[U]??m)},"s");return!s.#t[a]&&!l.#t[a]?0:s.#t[a]&&!l.#t[a]?D(s.#s[a],[b]):!s.#t[a]&&l.#t[a]?D([b],l.#s[a]):D(s.#s[a],l.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=__t);import{AssertionError as olr}from"assert";function cA(a,s){if(a===!1)throw new olr({message:s})}t(cA,"assert");var Ac;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Ac||(Ac={}));function FM(a){return a.type===Ac.Object}t(FM,"isAstObject");function lA(a){return a.type===Ac.Property}t(lA,"isAstProperty");function p_t(a){return a.type===Ac.Array}t(p_t,"isAstArray");function LM(a){return a.type===Ac.Literal}t(LM,"isAstLiteral");function $O(a){if(a===void 0)throw new Error("Node is undefined");if(!FM(a))throw new Error("Node is not object")}t($O,"assertAstObject");import{findNodeAtLocation as clr,getNodeValue as llr,printParseErrorCode as ulr,visit as flr}from"jsonc-parser";var _lr={DEFAULT:{allowTrailingComma:!1}};function yG(a,s=[],l=_lr.DEFAULT){let _={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function m(M){_.type==="property"&&(_.length=M-_.offset,_=_.parent)}t(m,"ensurePropertyComplete");function b(M){return _.children?.push(M),M}t(b,"onValue"),flr(a,{onObjectBegin:t((M,U,ne)=>{_=b({type:"object",offset:M,length:-1,line:U+1,column:ne+1,parent:_,children:[]})},"onObjectBegin"),onObjectProperty:t((M,U,ne,se,Z)=>{_=b({type:"property",offset:U,length:-1,line:se+1,column:Z+1,parent:_,children:[]}),_.children?.push({type:"string",value:M,offset:U,length:ne,line:se,column:Z,parent:_})},"onObjectProperty"),onObjectEnd:t((M,U)=>{m(M+U),_.length=M+U-_.offset,_=_.parent,m(M+U)},"onObjectEnd"),onArrayBegin:t((M,U,ne,se)=>{_=b({type:"array",offset:M,length:-1,line:ne+1,column:se+1,parent:_,children:[]})},"onArrayBegin"),onArrayEnd:t((M,U)=>{_.length=M+U-_.offset,_=_.parent,m(M+U)},"onArrayEnd"),onLiteralValue:t((M,U,ne,se,Z)=>{b({type:plr(M),offset:U,length:ne,line:se+1,column:Z+1,parent:_,value:M}),m(U+ne)},"onLiteralValue"),onSeparator:t((M,U)=>{_.type==="property"&&(M===":"?_.colonOffset=U:M===","&&m(U))},"onSeparator"),onError:t((M,U,ne,se,Z)=>{s.push({error:M,offset:U,length:ne,line:se+1,column:Z+1})},"onError")},l);let A=_.children[0];return A&&delete A.parent,A}t(yG,"parse");function plr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(plr,"getNodeType");function rNe(a,s){return clr(a,s)}t(rNe,"findNodeAtLocation");function vG(a){return llr(a)}t(vG,"getNodeValue");function d_t(a){return ulr(a)}t(d_t,"printParseErrorCode");var bG=class{static{t(this,"AstAdapter")}parse(s){let _=yG(s,[]);if(_)return this.parseNode(_,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,l){switch(s.type){case"object":return this.createObject(s,l);case"array":return this.createArray(s,l);case"property":return this.createProperty(s,l);case"string":return this.createLiteral(s,l);case"number":return this.createLiteral(s,l);case"boolean":return this.createLiteral(s,l);case"null":return this.createLiteral(s,l)}}createLiteral(s,l){return{type:Ac.Literal,location:{line:s.line,column:s.column},parent:l,value:s.type==="null"?null:s.value}}createObject(s,l){let _={type:Ac.Object,children:[],parent:l,location:{line:s.line,column:s.column}};return s.children?.forEach(m=>{_.children.push(this.parseNode(m,_))}),_}createProperty(s,l){cA(s.children?.length===2,"Invalid property node");let _={type:Ac.Property,location:{line:s.line,column:s.column},parent:l,name:null,value:null};return _.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Ac.Identifier,parent:_},_.value=this.parseNode(s.children[1],_),_}createArray(s,l){let _={type:Ac.Array,location:{line:s.line,column:s.column},parent:l,children:[]};return s.children?.forEach(m=>_.children.push(this.parseNode(m,_))),_}};var $C={createLiteral:t((a,s)=>({type:Ac.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Ac.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Ac.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,l)=>{let _={type:Ac.Property,parent:l,name:null,value:s};return _.name={value:a,type:Ac.Identifier,parent:_},_.value.parent=_,_},"createProperty"),createArrayOfLiterals:t((a,s)=>{let l={type:Ac.Array,parent:s,children:[]};for(let _ of a)l.children.push($C.createLiteral(_,l));return l},"createArrayOfLiterals")};var dlr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,SG=class{static{t(this,"SourceGenerator")}generate(s){let l=[];return this.generateSource(l,s),l.join("")}generateSource(s,l){switch(l.type){case Ac.Array:return this.generateArray(s,l);case Ac.Object:return this.generateObject(s,l);case Ac.Property:return this.generateProperty(s,l);case Ac.Literal:return this.generateLiteral(s,l);case Ac.FunctionCall:return this.generateFunctionCall(s,l);case Ac.Identifier:return this.generateIdentifier(s,l);case Ac.Raw:return this.generateRaw(s,l);case Ac.TemplateString:return this.generateTemplateString(s,l)}}generateArray(s,l){s.push("["),l.children.map(_=>{this.generateSource(s,_),s.push(",")}),s.push("]")}generateObject(s,l){s.push("{"),l.children.forEach(_=>{this.generateSource(s,_),s.push(",")}),s.push("}")}generateProperty(s,l){this.generateIdentifier(s,l.name),s.push(":"),this.generateSource(s,l.value)}generateFunctionCall(s,l){s.push(l.name.value),s.push("("),l.children.forEach((_,m,b)=>{this.generateSource(s,_),m<b.length&&s.push(",")}),s.push(")")}generateRaw(s,l){s.push(l.value)}generateTemplateString(s,l){s.push("`"),s.push(l.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,l){if(l.value===null)return s.push("null");switch(typeof l.value){case"number":case"boolean":return s.push(`${l.value}`);case"string":{let _=l.value,m=JSON.stringify(_);return s.push(`${m}`)}}}generateIdentifier(s,l){let _=dlr.test(l.value)?l.value:`'${l.value}'`;s.push(_)}};import{parse as mlr}from"@swc/core";import hlr from"fs/promises";var m_t=t(async a=>{let s=new Set;try{let l=await hlr.readFile(a,"utf-8");(await mlr(l,{syntax:"typescript"})).body.forEach(m=>{m.type==="ExportDefaultDeclaration"||m.type==="ExportDefaultExpression"?s.add("default"):m.type==="ExportDeclaration"&&m.declaration.type==="FunctionDeclaration"?s.add(m.declaration.identifier.value):m.type==="ExportDeclaration"&&m.declaration.type==="VariableDeclaration"&&m.declaration.declarations[0].id.type==="Identifier"&&s.add(m.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var h_t={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var nNe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var g_t={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var iNe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var sNe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var Amt=S_(Zdt(),1),Nmt=S_(Pmt(),1);var Wue=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new Nmt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,Amt.default)(this.ajv,{mode:"fast"})}addSchema(s,l){this.ajv.addSchema(s,l)}compile(s){let l=this.ajv.compile(s);return t(m=>({isValid:l(m),errors:this.toSimpleErrors(l.errors,m),warnings:[]}),"validator")}toSimpleErrors(s,l){let _=[];return s?.forEach(m=>{m.keyword==="enum"&&m.params.allowedValues&&Array.isArray(m.params.allowedValues)&&(m.message+=`; ${m.params.allowedValues.join(", ")}`),m.instancePath&&(m.instancePath=m.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let b={details:{}},D=m.instancePath.split("/");if(D.length>2){let M=D[1],U=D[2]?parseInt(D[2]):0,ne=D[3],se=isNaN(U)?void 0:l[M][U][ne];b={details:{property:M,index:U,field:ne,fieldValue:se}}}if(m.keyword==="required"&&m.params.missingProperty&&m.instancePath&&(m.message=`A 'path' is missing required property '${m.params.missingProperty}'`),m.keyword==="additionalProperties"&&m.params.additionalProperty&&m.instancePath&&(m.message=`A 'path' should NOT include property '${m.params.additionalProperty}'`),m.keyword==="type"&&m.params.type&&m.instancePath){let M=m.instancePath.split("/"),U=M[M.length-1];m.message=`Value of property '${U}' must be '${m.params.type}'`}let A=Object.assign(m,b);_.push(A)}),_}};var k3=Wue.instance;k3.addSchema(sNe,"route-configuration.schema.json");k3.addSchema(g_t,"policy-configuration.schema.json");k3.addSchema(nNe,"policies.schema.json");k3.addSchema(iNe,"open-api-route-configuration.schema.json");k3.addSchema(h_t,"fragments.schema.json");var K5r=k3.compile(sNe),Imt=k3.compile(iNe),b8e=k3.compile(nNe);var Hue=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=b8e(s),this.results}};var Gue=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=Imt(s),this.results}};import Thr from"path";var S8e=/\$import\((.*)\)/,Kue=/\$env\((.*?)\)/g;var dA=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,l,_,m){super(s),this.location={file:l,namespace:"",line:_?_.line:0,column:_?_.column:0,length:0,lineText:m??"",suggestion:""}}},Shr=t(a=>{let s=[],l=a;for(;l.parent;)s.push(l),l=l.parent;return s.reverse()},"invertTree"),w3=t((a,s)=>{if(!a)return!1;let l=Shr(a);return s.split("/").every((b,D)=>{let A=l[D];return A?b==="*"||lA(A)&&A.name.value===b?!0:b==="{}"?A.type===Ac.Object:b==="[]"?A.type===Ac.Array:!1:!1})},"testPosition");var Yue=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),FM(s)?s.children.forEach(l=>{this.visitor(l)}):p_t(s)?s.children.forEach(l=>{this.visitor(l)}):lA(s)&&this.visitor(s.value)}},Omt=t((a,s,l)=>_=>{if(!lA(_)||!LM(_.value)||typeof _.value.value!="string")return;if(!a.some(b=>w3(_,b))){Kue.test(_.value.value)&&s.push(new dA("An $env() statement is not expected at this location.",l,_.location,_.value.value));return}let m=new RegExp(Kue).exec(_.value.value);if(m?.length===2&&m[0]===_.value.value){let b={type:Ac.Raw,parent:null,value:`environment["${m[1]}"]`};_.value=b}else{let b=_.value.value.replaceAll(new RegExp(Kue),(D,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);b!==_.value.value&&(_.value=$C.createTemplateString(b,_))}},"getEnvStatementTransformer");var eK="config/routes.json",xhr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Chr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Fmt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],Ehr="handler/{}/options/{}/rewritePattern",Dhr="handler/{}/options/{}/baseUrl",Xue=class extends Yue{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let l=this.addedImports.get(s);if(!l)throw new Error("Import name is undefined. This should not happen.");return l}getImports(){let s=[];return this.addedImports.forEach((l,_)=>{s.push({name:l,path:_})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!lA(s)||!LM(s.value)||typeof s.value.value!="string")&&w3(s,Ehr)){if(!s.parent||!FM(s.parent)){this.errors.push(new dA("Invalid node, expected object",eK,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Lmt(l)},m=$C.createProperty("__rewriteFunction",_,s);s.parent.children.push(m)}}rewriteForwardFunction(s){if(!(!lA(s)||!LM(s.value)||typeof s.value.value!="string")&&w3(s,Dhr)){if(!s.parent||!FM(s.parent)){this.errors.push(new dA("Invalid node, expected object",eK,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Lmt(l)},m=$C.createProperty("__rewriteFunction",_,s);s.parent.children.push(m)}}replaceImportStatements(s){if(!lA(s)||!LM(s.value))return;let l=s.value.value;if(typeof l!="string")return;if(!Chr.some(A=>w3(s,A))&&!Fmt.some(A=>w3(s,A))){if(S8e.test(l)){if(s.name.value==="$ref")return;this.errors.push(new dA("An $import() statement is not expected at this location.",eK,s.location,l))}return}let _=S8e.exec(l);if(Fmt.some(A=>w3(s,A))&&!_)return;if(!_){this.errors.push(new dA("Invalid $import() statement",eK,s.location,l));return}let m=_[1];m.startsWith(".")&&(m=Thr.join("..",m));let b=this.getImportName(m),D={type:Ac.Identifier,parent:s.parent,value:b};s.value=D}replaceEnvStatements=Omt(xhr,this.errors,eK)};function Lmt(a){return`(request, context) => {
|
|
560
|
+
`&&b++;else if(l)_+=D,b=m+2;else throw new XP(`Invalid escape \\${D}.`,{line:s.loc.start.line,column:s.loc.start.column+m,offset:s.loc.start.offset+m});m=a.indexOf("\\",b)}return _+=a.slice(b),_}t(Aer,"getStringValue");function Ner(a,s,l=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return Aer(a.slice(1,-1),s,l);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(Ner,"getLiteralValue");function vot(a,s){s=Object.freeze({...Per,...s});let l=[],_=new L6e(a,{mode:s.mode,ranges:s.ranges}),m=s.mode==="json5",b=s.allowTrailingCommas||m;function D(){let hr=_.next();return hr&&s.tokens&&l.push(_.token),hr}t(D,"nextNoComments");function A(){let hr=_.next();return hr&&s.tokens&&l.push(_.token),hr>=x_.LineComment?A():hr}t(A,"nextSkipComments");let M=s.mode==="json"?D:A;function U(hr,mr){if(hr!==mr)throw new CO(_.token)}t(U,"assertTokenType");function ne(hr,mr){if(!mr.includes(hr))throw new CO(_.token)}t(ne,"assertTokenTypes");function se(hr,mr){return s.ranges?{range:[hr.offset,mr.offset]}:void 0}t(se,"createRange");function Z(hr){let mr=_.token,Ds=se(mr.loc.start,mr.loc.end),Pi=Ner(a.slice(mr.loc.start.offset,mr.loc.end.offset),mr,m),Ti={loc:{start:{...mr.loc.start},end:{...mr.loc.end}},...Ds};switch(hr){case x_.String:return TT.string(Pi,Ti);case x_.Number:return TT.number(Pi,Ti);case x_.Boolean:return TT.boolean(Pi,Ti);default:throw new TypeError(`Unknown token type ${mr.type}.`)}}t(Z,"createLiteralNode");function Re(hr){let mr=se(hr.loc.start,hr.loc.end),Ds=a.slice(hr.loc.start.offset,hr.loc.end.offset),Po={loc:{start:{...hr.loc.start},end:{...hr.loc.end}},...mr};if(hr.type!=="Identifier"){let Ti="";return(Ds[0]==="+"||Ds[0]==="-")&&(Ti=Ds[0]),TT[Ds.includes("NaN")?"nan":"infinity"](Ti,Po)}return TT.identifier(Ds,Po)}t(Re,"createJSON5IdentifierNode");function Ae(hr){let mr=se(hr.loc.start,hr.loc.end);return TT.null({loc:{start:{...hr.loc.start},end:{...hr.loc.end}},...mr})}t(Ae,"createNullNode");function ke(hr){m?ne(hr,[x_.String,x_.Identifier,x_.Number]):U(hr,x_.String);let mr=_.token,Ds=hr===x_.String?Z(hr):Re(mr);if(m&&(Ds.type==="NaN"||Ds.type==="Infinity")){if(Ds.sign!=="")throw new CO(_.token);Ds=TT.identifier(Ds.type,{loc:Ds.loc,...se(Ds.loc.start,Ds.loc.end)})}hr=M(),U(hr,x_.Colon);let Pi=br(),Po=se(Ds.loc.start,Pi.loc.end);return TT.member(Ds,Pi,{loc:{start:{...Ds.loc.start},end:{...Pi.loc.end}},...Po})}t(ke,"parseProperty");function Ot(hr){U(hr,x_.LBrace);let mr=_.token,Ds=[],Pi=M();if(Pi!==x_.RBrace)do{if(Ds.push(ke(Pi)),Pi=M(),!Pi)throw new Yce(Ds[Ds.length-1].loc.end);if(Pi===x_.Comma){if(Pi=M(),b&&Pi===x_.RBrace)break}else break}while(Pi);U(Pi,x_.RBrace);let Po=_.token,Ti=se(mr.loc.start,Po.loc.end);return TT.object(Ds,{loc:{start:{...mr.loc.start},end:{...Po.loc.end}},...Ti})}t(Ot,"parseObject");function kt(hr){U(hr,x_.LBracket);let mr=_.token,Ds=[],Pi=M();if(Pi!==x_.RBracket)do{let _p=br(Pi);if(Ds.push(TT.element(_p,{loc:_p.loc})),Pi=M(),Pi===x_.Comma){if(Pi=M(),b&&Pi===x_.RBracket)break}else break}while(Pi);U(Pi,x_.RBracket);let Po=_.token,Ti=se(mr.loc.start,Po.loc.end);return TT.array(Ds,{loc:{start:{...mr.loc.start},end:{...Po.loc.end}},...Ti})}t(kt,"parseArray");function br(hr){hr=hr??M();let mr=_.token;switch(hr){case x_.String:case x_.Boolean:return Z(hr);case x_.Number:if(m){let Ds=a.slice(mr.loc.start.offset,mr.loc.end.offset);if((Ds[0]==="+"||Ds[0]==="-")&&(Ds=Ds.slice(1)),Ds==="NaN"||Ds==="Infinity")return Re(mr)}return Z(hr);case x_.Null:return Ae(mr);case x_.LBrace:return Ot(hr);case x_.LBracket:return kt(hr);default:throw new CO(mr)}}t(br,"parseValue");let Kr=br();if(M())throw new CO(_.token);let un={loc:{start:{line:1,column:1,offset:0},end:{...Kr.loc.end}}};return s.tokens&&(un.tokens=l),s.ranges&&(un.range=[un.loc.start.offset,un.loc.end.offset]),TT.document(Kr,un)}t(vot,"parse");var Ier=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function bot(a){return a&&typeof a=="object"}t(bot,"isObject");function Oer(a){return bot(a)&&typeof a.type=="string"}t(Oer,"isNode");function Fer(a,s){function l(_,m){typeof s.enter=="function"&&s.enter(_,m);for(let b of Ier.get(_.type)){let D=_[b];bot(D)&&(Array.isArray(D)?D.forEach(A=>l(A,_)):Oer(D)&&l(D,_))}typeof s.exit=="function"&&s.exit(_,m)}t(l,"visitNode"),l(a)}t(Fer,"traverse");function Sot(a,s=()=>!0){let l=[];return Fer(a,{enter(_,m){l.push({node:_,parent:m,phase:"enter"})},exit(_,m){l.push({node:_,parent:m,phase:"exit"})}}),l.filter(s).values()}t(Sot,"iterator");import Ler from"fs/promises";var FH=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),Xce=t(async a=>{try{return await Ler.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),LH=t(async a=>{try{return vot(a)}catch(s){if(s.column&&s.line&&s.message){let l=FH(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:l}}return}},"getSchemaAST");var Tot=t(async(a,s,l)=>{try{if(a.length===0)return;for(let _ of a){let m=await Xce(_),b=await Rer(m,_,s,l);if(b)return b}}catch{}},"getRouteLocationByValue"),Rer=t(async(a,s,l,_)=>{try{if(!a)return;let m=null,b=await LH(a);if(b){for(let{node:D}of Sot(b))if(D.value&&D.value===l){m=D.loc;break}if(m!==null){let D=FH(a,m.start.line);return{file:s,line:m.start.line,column:m.start.column,length:m.end.column-m.start.column,lineText:D,suggestion:_}}}}catch{}},"getRouteLocationByValueFromSchema");import xot from"fs/promises";import Qce from"path";var R6e="schemas",M6e=".oas.json";var EO=t(async a=>(await xot.readdir(a)).map(l=>`${a}/${l}`).filter(l=>l.endsWith(M6e)).sort(),"getOpenApiFilesByAlphabetical"),lM=t(async a=>{let s=Qce.resolve(a,"config");return(await xot.readdir(s)).filter(_=>_.endsWith(M6e)).length>=1},"oasFileInProject");function RH(a,s,l,_,m,b,D){if(b.has(l))return;let A=_.get(l);b.set(l,m.length),m.push(l),j6e(B6e(l),s,A,_,m,b,D)}t(RH,"chaseRefs");function j6e(a,s,l,_,m,b,D){if(Array.isArray(l))for(let A of l)j6e(a,s,A,_,m,b,D);else if(typeof l=="object")for(let A in l){if(A==="$ref"){let M=l[A];D&&(l[A]=D(s,M)),RH(a,s,i3(a,M),_,m,b,D)}j6e(a,s,l[A],_,m,b,D)}}t(j6e,"lookForRefs");function i3(a,s){let l=s.indexOf("#");return l>=0?`${Qce.resolve(a,s.substring(0,l))}${s.substring(l)}`:Qce.resolve(Qce.dirname(a),s)}t(i3,"getFullyQualifiedRefName");function B6e(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(B6e,"getFilePathNameFromRefName");var ZH=S_(e3e(),1);var t3e={};vst(t3e,{UnsafePathError:()=>Ele,deleteFile:()=>Ssr,deleteFolder:()=>Asr,dirExists:()=>Dle,ensureDirectoryExists:()=>Esr,fileExists:()=>bsr,getParentDirFilename:()=>ksr,isNotFileOrDirectory:()=>Tsr,listFolderContents:()=>Xlt,listFolders:()=>Csr,mkdirForFilePathIfNotExits:()=>Zlt,mkdirIfNotExists:()=>Qlt,safePath:()=>Dsr,tarFolderContent:()=>wsr,untar:()=>Psr});import Klt from"child_process";import _3 from"fs/promises";import f3 from"path";var Ylt=[".git","node_modules",".yarn",".DS_Store"];async function bsr(a){try{return(await _3.stat(a)).isFile()}catch{return!1}}t(bsr,"fileExists");async function Ssr(a,s){return await _3.rm(a,s)}t(Ssr,"deleteFile");async function Dle(a){try{return(await _3.stat(a)).isDirectory()}catch{return!1}}t(Dle,"dirExists");async function Tsr(a){try{return await _3.stat(a),!1}catch{return!0}}t(Tsr,"isNotFileOrDirectory");function xsr(a,s){let l=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),_=a.match(l);if(!_)return"";let m=a.split(_[0]);return m[1]===""?"":`/${m[1]}`}t(xsr,"getParentDirectory");async function Csr(a){if(!await Dle(a))return[];let s=await _3.readdir(a,{withFileTypes:!0}),l=[];for await(let _ of s)Ylt.includes(_.name)||_.isDirectory()&&l.push(_.name);return l}t(Csr,"listFolders");async function Xlt(a,s,l=!0){let _=xsr(a,s),m=await _3.readdir(a,{withFileTypes:!0}),b=[];for await(let D of m)if(!Ylt.includes(D.name)||!l)if(D.isDirectory()){let A=await Xlt(f3.join(a,D.name),s,l);b.push(...A)}else b.push(f3.join(_,D.name));return b}t(Xlt,"listFolderContents");var Qlt=t(async a=>{if(await Dle(a))return!0;await _3.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),Zlt=t(async a=>{let s=f3.dirname(a);return Qlt(s)},"mkdirForFilePathIfNotExits"),Esr=Zlt,Ele=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function Dsr(a){let s=t(l=>{if(!l.startsWith(a))throw new Ele("Resolved path is not part of the project.");return l},"ensureSafePath");return{resolve:t((...l)=>s(f3.resolve(...l)),"resolve")}}t(Dsr,"safePath");function ksr(a){return`${f3.basename(f3.dirname(a))}/${f3.basename(a)}`}t(ksr,"getParentDirFilename");function wsr(a,s,l,_){let m=f3.join(_,l);return Klt.execSync(`tar --exclude='.git/' --exclude='dist/' -czf ${m} ${s}`,{cwd:a}),m}t(wsr,"tarFolderContent");function Psr(a,s,l,_=!1){Klt.execSync(`tar -xf ${s} ${_?"--strip-components=1 ":""}-C ${l}`,{cwd:a})}t(Psr,"untar");async function Asr(a){if(await Dle(a))return await _3.rm(a,{recursive:!0})}t(Asr,"deleteFolder");var yl=t3e;var DT=S_(e3e(),1);import{readFile as Nsr}from"fs/promises";var FO=class extends Error{static{t(this,"CustomResolveError")}},p3=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,l){this.sourceDirectory=s,this.logger=l}dereference(s,l){return ZH.$RefParser.dereference(s,{resolve:{json:!0,file:kle(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:l?.onDereference}})}bundle(s){return ZH.$RefParser.bundle(s,{resolve:{file:kle(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return ZH.$RefParser.parse(s,{resolve:{file:kle(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return ZH.$RefParser.resolve(s,{resolve:{file:kle(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function kle(a,s){return{order:100,canRead(l){let _=Fsr(l.url);if(!(_===void 0||_==="file"))return!1;let b;try{b=eut(l.url)}catch(D){throw new FO(`Malformed URI: ${l.url}`,{cause:D})}try{yl.safePath(a).resolve(b)}catch(D){return s?.warn(D),!1}return!0},async read(l){let _;try{_=eut(l.url)}catch(m){throw new FO(`Malformed URI: ${l.url}`,{cause:m})}try{return await Nsr(_)}catch(m){throw new FO(`Error opening file "${_}"`,{cause:m})}}}}t(kle,"customResolver");var r3e=/^win/.test(globalThis.process?globalThis.process.platform:""),Isr=/\//g,Osr=/^(\w{2,}):\/\//i,n3e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function Fsr(a){let s=Osr.exec(a);if(s)return s[1].toLowerCase()}t(Fsr,"getProtocol");function eut(a,s){a=decodeURI(a);for(let _=0;_<n3e.length;_+=2)a=a.replace(n3e[_],n3e[_+1]);let l=a.substr(0,7).toLowerCase()==="file://";return l&&(a=a[7]==="/"?a.substr(8):a.substr(7),r3e&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(l=!1,a=r3e?a:"/"+a)),r3e&&!l&&(a=a.replace(Isr,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(eut,"toFileSystemPath");var tut="YOUR_KEY_HERE";async function rut(a){let l=await new p3(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),_=a.openApiDocPath.replace(a.sourceDirectory,"");return Lsr({...a,relativeOpenApiPath:_},l)}t(rut,"buildPublicOpenApiFile");async function Lsr(a,s){Bsr({relativeOpenApiPath:a.relativeOpenApiPath},s);let l=s;return l=Msr(l),Rsr(l,a),l=jsr(l,a),nut(l,"x-zuplo"),l}t(Lsr,"buildRawOpenApiFile");function Rsr(a,{customDomain:s,deploymentName:l,environmentType:_}){let m;s?m=s:_&&l&&(m=_===gce.WORKING_COPY?`${l}.d2.zuplo.dev`:`${l}.zuplo.app`),m?a.servers=[{url:`https://${m}`}]:a.servers=void 0}t(Rsr,"addServerHost");function Msr(a){if(!a.paths)return a;let{components:s}=a,l=s?{...s}:void 0,_=[];l&&l.parameters&&(_=Object.entries(l.parameters).reduce((b,[D,A])=>(YR in A&&yce(A[YR])&&(b.push(D),l.parameters&&delete l.parameters[D]),b),[]));let m=Object.entries(a.paths).reduce((b,[D,A])=>{if(!A)return b;let M={...A},U=["delete","get","head","patch","post","put","trace","options"];return U.forEach(ne=>{let se=A[ne];if(!se)return;if(yce(se[YR])){delete M[ne];return}let{parameters:Z}=se;if(!Z)return;let Re=Z.filter(Ae=>{if(YR in Ae&&yce(Ae[YR]))return!1;if("$ref"in Ae){let ke=Ae.$ref.split("/").pop();return ke?!_.includes(ke):!0}return!0});M[ne]={...se,parameters:Re}}),U.some(ne=>!!M[ne])&&(b[D]=M),b},{});return{...a,paths:m,components:l}}t(Msr,"removeHiddenRoutesAndParams");function jsr(a,{policiesConfig:s}){if(!a.paths)return a;let l=Object.entries(a.paths).reduce((_,[m,b])=>{if(!b)return _;let D={...b};return[D.delete,D.get,D.head,D.patch,D.post,D.put,D.trace,D.options].forEach(A=>{if(!A)return;let M=A["x-zuplo-route"]?.policies?.inbound?.reduce((se,Z)=>{let Re=s.policies?.find(({name:Ot})=>Ot===Z);if(!Re)return se;if(!(Re.handler.export==="CompositeInboundPolicy"))return se.concat(Z);let ke=Re.handler.options?.policies;return ke?se.concat(ke):se},[]),U=[];if(M&&M.forEach(se=>{s.policies?.forEach(Z=>{Z.name===se&&(Z.handler.export==="ApiAuthKeyInboundPolicy"||Z.handler.export==="ApiKeyInboundPolicy")&&!Z.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&U.push(Z)})}),U.length>0){let se=U.length>0&&U[0].handler&&U[0].handler.options&&U[0].handler.options.authHeader?U[0].handler.options.authHeader:"Authorization",Z=U.length>0&&U[0].handler&&U[0].handler.options&&(U[0].handler.options.authScheme||U[0].handler.options.authScheme==="")?U[0].handler.options.authScheme:"Bearer",Re=Z!==""?`${Z} ${tut}`:tut,Ae={name:se,in:"header",required:!0,example:Re,schema:{type:"string"},description:`The \`${se}\` header is used to authenticate with the API using your API key. Value is of the format \`${Re}\`.`};A.parameters?A.parameters.some(br=>"name"in br&&br.name===Ae.name)||A.parameters.unshift(Ae):A.parameters=[Ae];let ke={type:"http",scheme:Z.toLowerCase()},Ot="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(br=>"name"in br&&br.type==="apiKey"||"type"in br&&br.type==="http"&&br.scheme===Z)||(a.components.securitySchemes={...a.components.securitySchemes,[Ot]:ke}):(a.components||(a.components={}),a.components.securitySchemes={[Ot]:ke});let kt={[Ot]:[]};A.security?A.security.some(br=>br[Ot]!==void 0)||A.security.unshift(kt):A.security=[kt]}let ne=[];if(M&&M.forEach(se=>{s.policies?.forEach(Z=>{Z.name===se&&(Z.handler.export==="RateLimitInboundPolicy"||Z.handler.export==="ComplexRateLimitInboundPolicy")&&ne.push(Z)})}),ne.length>0){let se={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},Z={...se,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:se,RateLimitWithRetryAfter:Z},A.responses||(A.responses={});let Re=ne.some(Ae=>Ae.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Re?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),_[m]=D,_},{});return{...a,paths:l}}t(jsr,"enrichSpecWithZuploData");function nut(a,s){for(let l in a)l.startsWith(s)?delete a[l]:typeof a[l]=="object"&&nut(a[l],s)}t(nut,"removePropertiesByPrefix");function Bsr({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new B2({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new B2({message:"The OpenAPI document does not have the required 'info' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"});if(!("title"in s.info)||typeof s.info.title!="string")throw new B2({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(Bsr,"assertIsZuploOpenApiSpec");function Usr(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let U=0;U<s.length;U++)s[U]=255;for(let U=0;U<a.length;U++){let ne=a.charAt(U),se=ne.charCodeAt(0);if(s[se]!==255)throw new TypeError(ne+" is ambiguous");s[se]=U}let l=a.length,_=a.charAt(0),m=Math.log(l)/Math.log(256),b=Math.log(256)/Math.log(l);function D(U){if(U instanceof Uint8Array||(ArrayBuffer.isView(U)?U=new Uint8Array(U.buffer,U.byteOffset,U.byteLength):Array.isArray(U)&&(U=Uint8Array.from(U))),!(U instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(U.length===0)return"";let ne=0,se=0,Z=0,Re=U.length;for(;Z!==Re&&U[Z]===0;)Z++,ne++;let Ae=(Re-Z)*b+1>>>0,ke=new Uint8Array(Ae);for(;Z!==Re;){let br=U[Z],Kr=0;for(let on=Ae-1;(br!==0||Kr<se)&&on!==-1;on--,Kr++)br+=256*ke[on]>>>0,ke[on]=br%l>>>0,br=br/l>>>0;if(br!==0)throw new Error("Non-zero carry");se=Kr,Z++}let Ot=Ae-se;for(;Ot!==Ae&&ke[Ot]===0;)Ot++;let kt=_.repeat(ne);for(;Ot<Ae;++Ot)kt+=a.charAt(ke[Ot]);return kt}t(D,"encode");function A(U){if(typeof U!="string")throw new TypeError("Expected String");if(U.length===0)return new Uint8Array;let ne=0,se=0,Z=0;for(;U[ne]===_;)se++,ne++;let Re=(U.length-ne)*m+1>>>0,Ae=new Uint8Array(Re);for(;U[ne];){let br=s[U.charCodeAt(ne)];if(br===255)return;let Kr=0;for(let on=Re-1;(br!==0||Kr<Z)&&on!==-1;on--,Kr++)br+=l*Ae[on]>>>0,Ae[on]=br%256>>>0,br=br/256>>>0;if(br!==0)throw new Error("Non-zero carry");Z=Kr,ne++}let ke=Re-Z;for(;ke!==Re&&Ae[ke]===0;)ke++;let Ot=new Uint8Array(se+(Re-ke)),kt=se;for(;ke!==Re;)Ot[kt++]=Ae[ke++];return Ot}t(A,"decodeUnsafe");function M(U){let ne=A(U);if(ne)return ne;throw new Error("Non-base"+l+" character")}return t(M,"decode"),{encode:D,decodeUnsafe:A,decode:M}}t(Usr,"base");var iut=Usr;var $sr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",wle=iut($sr);var i3e="2024-09-02",sut=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function aut(){return new kT({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:i3e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:sut[i3e]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(aut,"getMockEnvironment");var kT=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=aut()),this.#r}constructor({build:s,runtime:l}){let _;try{if(l.__ZUPLO_CONFIG){let m=atob(l.__ZUPLO_CONFIG);_=JSON.parse(m)}if(l.ZUPLO_SYSTEM_CONFIGURATIONS){let m=new TextDecoder().decode(wle.decode(l.ZUPLO_SYSTEM_CONFIGURATIONS)),b=JSON.parse(m);for(let D of Object.keys(b))l[D]=b[D]}}catch(m){console.error("Failed to parse runtime configuration",m)}this.config=_??{},this.build=s,this.runtime=l,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get zuploEdgeApiUrl(){return this.config.zuplo_edge_api_url??"https://api.zuploedge.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var Jsr=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function out(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!Jsr.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(out,"isRestrictedEnvVariableName");function cut(a){return!!a.startsWith("ZUPLO_")}t(cut,"isZuploReadableEnvVariableName");var YIr=new Proxy({},{get(a,s){let l=String(s);switch(l){case"ZUPLO_ENVIRONMENT_TYPE":return kT.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return kT.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return kT.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return kT.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return kT.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return kT.instance.build.BUILD_ID}if(!(out(l)&&!cut(l)))return kT.instance.runtime[l]}});function eG(a,s,l){return`_${rA(`${a}_${s}_${l}`)}`}t(eG,"getRawOperationDataIdentifierName");function s3e(a,s,l,_){return`_${rA(a.toLowerCase())}_${s.toLowerCase()}_${l.toLowerCase()}_${_.toLowerCase()}`}t(s3e,"getIdForParameterSchema");function a3e(a,s,l){return`_${rA(a.toLowerCase())}_${s.toLowerCase()}_rb_${rA(l.toLowerCase())}`}t(a3e,"getIdForRequestBodySchema");function tG(a,s){return`_${rA(a)}_${rA(s)}`}t(tG,"getIdForRefSchema");function rA(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(rA,"sanitizedIdentifierName");var Umt=S_(Qft(),1);import efe from"path";var gG=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,l,_,m,b){this.type=a,this.name=s,this.prefix=l,this.value=_,this.suffix=m,this.modifier=b}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Rcr=/[$_\p{ID_Start}]/u,Mcr=/[$_\u200C\u200D\p{ID_Continue}]/u,eNe=".*";function jcr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(jcr,"Re");function t_t(a,s=!1){let l=[],_=0;for(;_<a.length;){let m=a[_],b=t(function(D){if(!s)throw new TypeError(D);l.push({type:"INVALID_CHAR",index:_,value:a[_++]})},"c");if(m==="*"){l.push({type:"ASTERISK",index:_,value:a[_++]});continue}if(m==="+"||m==="?"){l.push({type:"OTHER_MODIFIER",index:_,value:a[_++]});continue}if(m==="\\"){l.push({type:"ESCAPED_CHAR",index:_++,value:a[_++]});continue}if(m==="{"){l.push({type:"OPEN",index:_,value:a[_++]});continue}if(m==="}"){l.push({type:"CLOSE",index:_,value:a[_++]});continue}if(m===":"){let D="",A=_+1;for(;A<a.length;){let M=a.substr(A,1);if(A===_+1&&Rcr.test(M)||A!==_+1&&Mcr.test(M)){D+=a[A++];continue}break}if(!D){b(`Missing parameter name at ${_}`);continue}l.push({type:"NAME",index:_,value:D}),_=A;continue}if(m==="("){let D=1,A="",M=_+1,U=!1;if(a[M]==="?"){b(`Pattern cannot start with "?" at ${M}`);continue}for(;M<a.length;){if(!jcr(a[M],!1)){b(`Invalid character '${a[M]}' at ${M}.`),U=!0;break}if(a[M]==="\\"){A+=a[M++]+a[M++];continue}if(a[M]===")"){if(D--,D===0){M++;break}}else if(a[M]==="("&&(D++,a[M+1]!=="?")){b(`Capturing groups are not allowed at ${M}`),U=!0;break}A+=a[M++]}if(U)continue;if(D){b(`Unbalanced pattern at ${_}`);continue}if(!A){b(`Missing pattern at ${_}`);continue}l.push({type:"REGEX",index:_,value:A}),_=M;continue}l.push({type:"CHAR",index:_,value:a[_++]})}return l.push({type:"END",index:_,value:""}),l}t(t_t,"v");function r_t(a,s={}){let l=t_t(a);s.delimiter??="/#?",s.prefixes??="./";let _=`[^${NT(s.delimiter)}]+?`,m=[],b=0,D=0,A="",M=new Set,U=t(Kr=>{if(D<l.length&&l[D].type===Kr)return l[D++].value},"a"),ne=t(()=>U("OTHER_MODIFIER")??U("ASTERISK"),"f"),se=t(Kr=>{let on=U(Kr);if(on!==void 0)return on;let{type:un,index:hr}=l[D];throw new TypeError(`Unexpected ${un} at ${hr}, expected ${Kr}`)},"d"),Z=t(()=>{let Kr="",on;for(;on=U("CHAR")??U("ESCAPED_CHAR");)Kr+=on;return Kr},"T"),Re=t(Kr=>Kr,"Se"),Ae=s.encodePart||Re,ke="",Ot=t(Kr=>{ke+=Kr},"U"),kt=t(()=>{ke.length&&(m.push(new gG(3,"","",Ae(ke),"",3)),ke="")},"$"),br=t((Kr,on,un,hr,mr)=>{let Ds=3;switch(mr){case"?":Ds=1;break;case"*":Ds=0;break;case"+":Ds=2;break}if(!on&&!un&&Ds===3){Ot(Kr);return}if(kt(),!on&&!un){if(!Kr)return;m.push(new gG(3,"","",Ae(Kr),"",Ds));return}let Pi;un?un==="*"?Pi=eNe:Pi=un:Pi=_;let Po=2;Pi===_?(Po=1,Pi=""):Pi===eNe&&(Po=0,Pi="");let Ti;if(on?Ti=on:un&&(Ti=b++),M.has(Ti))throw new TypeError(`Duplicate name '${Ti}'.`);M.add(Ti),m.push(new gG(Po,Ti,Ae(Kr),Pi,Ae(hr),Ds))},"V");for(;D<l.length;){let Kr=U("CHAR"),on=U("NAME"),un=U("REGEX");if(!on&&!un&&(un=U("ASTERISK")),on||un){let mr=Kr??"";s.prefixes.indexOf(mr)===-1&&(Ot(mr),mr=""),kt();let Ds=ne();br(mr,on,un,"",Ds);continue}let hr=Kr??U("ESCAPED_CHAR");if(hr){Ot(hr);continue}if(U("OPEN")){let mr=Z(),Ds=U("NAME"),Pi=U("REGEX");!Ds&&!Pi&&(Pi=U("ASTERISK"));let Po=Z();se("CLOSE");let Ti=ne();br(mr,Ds,Pi,Po,Ti);continue}kt(),se("END")}return m}t(r_t,"D");function NT(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(NT,"S");function Zft(a){return a&&a.ignoreCase?"ui":"u"}t(Zft,"X");function Bcr(a,s,l){return n_t(r_t(a,l),s,l)}t(Bcr,"Z");function OM(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(OM,"k");function n_t(a,s,l={}){l.delimiter??="/#?",l.prefixes??="./",l.sensitive??=!1,l.strict??=!1,l.end??=!0,l.start??=!0,l.endsWith="";let _=l.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?_+=NT(A.value):_+=`(?:${NT(A.value)})${OM(A.modifier)}`;continue}s&&s.push(A.name);let M=`[^${NT(l.delimiter)}]+?`,U=A.value;if(A.type===1?U=M:A.type===0&&(U=eNe),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?_+=`(${U})${OM(A.modifier)}`:_+=`((?:${U})${OM(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){_+=`(?:${NT(A.prefix)}(${U})${NT(A.suffix)})`,_+=OM(A.modifier);continue}_+=`(?:${NT(A.prefix)}`,_+=`((?:${U})(?:`,_+=NT(A.suffix),_+=NT(A.prefix),_+=`(?:${U}))*)${NT(A.suffix)})`,A.modifier===0&&(_+="?")}let m=`[${NT(l.endsWith)}]|$`,b=`[${NT(l.delimiter)}]`;if(l.end)return l.strict||(_+=`${b}?`),l.endsWith.length?_+=`(?=${m})`:_+="$",new RegExp(_,Zft(l));l.strict||(_+=`(?:${b}(?=${m}))?`);let D=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(D=l.delimiter.indexOf(A)>-1)}return D||(_+=`(?=${b}|${m})`),new RegExp(_,Zft(l))}t(n_t,"F");var g3={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Ucr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},$cr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function Jcr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(Jcr,"J");function i_t(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(i_t,"Q");function zcr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(zcr,"Ee");function s_t(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(s_t,"W");var a_t=["ftp","file","http","https","ws","wss"];function o_t(a){if(!a)return!0;for(let s of a_t)if(a.test(s))return!0;return!1}t(o_t,"N");function qcr(a,s){if(a=i_t(a,"#"),s||a==="")return a;let l=new URL("https://example.com");return l.hash=a,l.hash?l.hash.substring(1,l.hash.length):""}t(qcr,"te");function Vcr(a,s){if(a=i_t(a,"?"),s||a==="")return a;let l=new URL("https://example.com");return l.search=a,l.search?l.search.substring(1,l.search.length):""}t(Vcr,"re");function Wcr(a,s){return s||a===""?a:s_t(a)?u_t(a):l_t(a)}t(Wcr,"ne");function Hcr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.password=a,l.password}t(Hcr,"se");function Gcr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.username=a,l.username}t(Gcr,"ie");function Kcr(a,s,l){if(l||a==="")return a;if(s&&!a_t.includes(s))return new URL(`${s}:${a}`).pathname;let _=a[0]=="/";return a=new URL(_?a:"/-"+a,"https://example.com").pathname,_||(a=a.substring(2,a.length)),a}t(Kcr,"ae");function Ycr(a,s,l){return c_t(s)===a&&(a=""),l||a===""?a:f_t(a)}t(Ycr,"oe");function Xcr(a,s){return a=zcr(a,":"),s||a===""?a:tNe(a)}t(Xcr,"ce");function c_t(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(c_t,"_");function tNe(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(tNe,"y");function Qcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Qcr,"le");function Zcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(Zcr,"fe");function l_t(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(l_t,"z");function u_t(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(u_t,"j");function f_t(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(f_t,"K");function elr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(elr,"he");function tlr(a){return a===""?a:new URL(`data:${a}`).pathname}t(tlr,"ue");function rlr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(rlr,"de");function nlr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(nlr,"pe");var ilr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=t_t(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#w()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#E()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#x()?this.#d(3):(this.#C()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#x()&&this.#i(5,1);break;case 4:this.#x()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#k()&&!this.#c?this.#i(6,1):this.#C()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#C()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 7:this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 8:this.#D()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#i(a,s){switch(this.#a){case 0:break;case 1:this.#e.protocol=this.#T();break;case 2:break;case 3:this.#e.username=this.#T();break;case 4:this.#e.password=this.#T();break;case 5:this.#e.hostname=this.#T();break;case 6:this.#e.port=this.#T();break;case 7:this.#e.pathname=this.#T();break;case 8:this.#e.search=this.#T();break;case 9:this.#e.hash=this.#T();break;case 10:break}this.#a!==0&&a!==10&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(a)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(a)&&(this.#e.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&a===9&&(this.#e.search??="")),this.#f(a,s)}#f(a,s){this.#a=a,this.#p=this.#t+s,this.#t+=s,this.#s=0}#v(){this.#t=this.#p,this.#s=0}#d(a){this.#v(),this.#a=a}#u(a){return a<0&&(a=this.#n.length-a),a<this.#n.length?this.#n[a]:this.#n[this.#n.length-1]}#m(a,s){let l=this.#u(a);return l.value===s&&(l.type==="CHAR"||l.type==="ESCAPED_CHAR"||l.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#E(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#x(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#k(){return this.#m(this.#t,":")}#C(){return this.#m(this.#t,"/")}#y(){if(this.#m(this.#t,"?"))return!0;if(this.#n[this.#t].value!=="?")return!1;let a=this.#u(this.#t-1);return a.type!=="NAME"&&a.type!=="REGEX"&&a.type!=="CLOSE"&&a.type!=="ASTERISK"}#D(){return this.#m(this.#t,"#")}#w(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,g3),a.encodePart=tNe;let s=Bcr(this.#T(),void 0,a);this.#l=o_t(s)}},Z3e=["protocol","username","password","hostname","port","pathname","search","hash"],h3="*";function e_t(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let l=new URL(a,s);return{protocol:l.protocol.substring(0,l.protocol.length-1),username:l.username,password:l.password,hostname:l.hostname,port:l.port,pathname:l.pathname,search:l.search!==""?l.search.substring(1,l.search.length):void 0,hash:l.hash!==""?l.hash.substring(1,l.hash.length):void 0}}t(e_t,"ge");function oA(a,s){return s?hG(a):a}t(oA,"b");function mG(a,s,l){let _;if(typeof s.baseURL=="string")try{_=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=oA(_.protocol.substring(0,_.protocol.length-1),l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=oA(_.username,l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=oA(_.password,l)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=oA(_.hostname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=oA(_.port,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=oA(_.pathname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=oA(_.search.substring(1,_.search.length),l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=oA(_.hash.substring(1,_.hash.length),l))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Xcr(s.protocol,l)),typeof s.username=="string"&&(a.username=Gcr(s.username,l)),typeof s.password=="string"&&(a.password=Hcr(s.password,l)),typeof s.hostname=="string"&&(a.hostname=Wcr(s.hostname,l)),typeof s.port=="string"&&(a.port=Ycr(s.port,a.protocol,l)),typeof s.pathname=="string"){if(a.pathname=s.pathname,_&&!Jcr(a.pathname,l)){let m=_.pathname.lastIndexOf("/");m>=0&&(a.pathname=oA(_.pathname.substring(0,m+1),l)+a.pathname)}a.pathname=Kcr(a.pathname,a.protocol,l)}return typeof s.search=="string"&&(a.search=Vcr(s.search,l)),typeof s.hash=="string"&&(a.hash=qcr(s.hash,l)),a}t(mG,"w");function hG(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(hG,"C");function slr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(slr,"Oe");function alr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let l=".*",_=`[^${slr(s.delimiter)}]+?`,m=/[$_\u200C\u200D\p{ID_Continue}]/u,b="";for(let D=0;D<a.length;++D){let A=a[D];if(A.type===3){if(A.modifier===3){b+=hG(A.value);continue}b+=`{${hG(A.value)}}${OM(A.modifier)}`;continue}let M=A.hasCustomName(),U=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),ne=D>0?a[D-1]:null,se=D<a.length-1?a[D+1]:null;if(!U&&M&&A.type===1&&A.modifier===3&&se&&!se.prefix.length&&!se.suffix.length)if(se.type===3){let Z=se.value.length>0?se.value[0]:"";U=m.test(Z)}else U=!se.hasCustomName();if(!U&&!A.prefix.length&&ne&&ne.type===3){let Z=ne.value[ne.value.length-1];U=s.prefixes.includes(Z)}U&&(b+="{"),b+=hG(A.prefix),M&&(b+=`:${A.name}`),A.type===2?b+=`(${A.value})`:A.type===1?M||(b+=`(${_})`):A.type===0&&(!M&&(!ne||ne.type===3||ne.modifier!==3||U||A.prefix!=="")?b+="*":b+=`(${l})`),A.type===1&&M&&A.suffix.length&&m.test(A.suffix[0])&&(b+="\\"),b+=hG(A.suffix),U&&(b+="}"),A.modifier!==3&&(b+=OM(A.modifier))}return b}t(alr,"ke");var __t=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,l){try{let _;if(typeof s=="string"?_=s:l=s,typeof a=="string"){let A=new ilr(a);if(A.parse(),a=A.result,_===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=_}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(_)throw new TypeError("parameter 1 is not of type 'string'.")}typeof l>"u"&&(l={ignoreCase:!1});let m={ignoreCase:l.ignoreCase===!0},b={pathname:h3,protocol:h3,username:h3,password:h3,hostname:h3,port:h3,search:h3,hash:h3};this.#r=mG(b,a,!0),c_t(this.#r.protocol)===this.#r.port&&(this.#r.port="");let D;for(D of Z3e){if(!(D in this.#r))continue;let A={},M=this.#r[D];switch(this.#e[D]=[],D){case"protocol":Object.assign(A,g3),A.encodePart=tNe;break;case"username":Object.assign(A,g3),A.encodePart=Qcr;break;case"password":Object.assign(A,g3),A.encodePart=Zcr;break;case"hostname":Object.assign(A,Ucr),s_t(M)?A.encodePart=u_t:A.encodePart=l_t;break;case"port":Object.assign(A,g3),A.encodePart=f_t;break;case"pathname":o_t(this.#n.protocol)?(Object.assign(A,$cr,m),A.encodePart=elr):(Object.assign(A,g3,m),A.encodePart=tlr);break;case"search":Object.assign(A,g3,m),A.encodePart=rlr;break;case"hash":Object.assign(A,g3,m),A.encodePart=nlr;break}try{this.#s[D]=r_t(M,A),this.#n[D]=n_t(this.#s[D],this.#e[D],A),this.#t[D]=alr(this.#s[D],A),this.#p=this.#p||this.#s[D].some(U=>U.type===2)}catch{throw new TypeError(`invalid ${D} pattern '${this.#r[D]}'.`)}}}catch(_){throw new TypeError(`Failed to construct 'URLPattern': ${_.message}`)}}test(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?l=mG(l,a,!1):l=mG(l,e_t(a,s),!1)}catch{return!1}let _;for(_ of Z3e)if(!this.#n[_].exec(l[_]))return!1;return!0}exec(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?l=mG(l,a,!1):l=mG(l,e_t(a,s),!1)}catch{return null}let _={};s?_.inputs=[a,s]:_.inputs=[a];let m;for(m of Z3e){let b=this.#n[m].exec(l[m]);if(!b)return null;let D={};for(let[A,M]of this.#e[m].entries())if(typeof M=="string"||typeof M=="number"){let U=b[A+1];D[M]=U}_[m]={input:l[m]??"",groups:D}}return _}static compareComponent(a,s,l){let _=t((A,M)=>{for(let U of["type","modifier","prefix","value","suffix"]){if(A[U]<M[U])return-1;if(A[U]!==M[U])return 1}return 0},"o"),m=new gG(3,"","","","",3),b=new gG(0,"","","","",3),D=t((A,M)=>{let U=0;for(;U<Math.min(A.length,M.length);++U){let ne=_(A[U],M[U]);if(ne)return ne}return A.length===M.length?0:_(A[U]??m,M[U]??m)},"s");return!s.#t[a]&&!l.#t[a]?0:s.#t[a]&&!l.#t[a]?D(s.#s[a],[b]):!s.#t[a]&&l.#t[a]?D([b],l.#s[a]):D(s.#s[a],l.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=__t);import{AssertionError as olr}from"assert";function cA(a,s){if(a===!1)throw new olr({message:s})}t(cA,"assert");var Ac;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Ac||(Ac={}));function FM(a){return a.type===Ac.Object}t(FM,"isAstObject");function lA(a){return a.type===Ac.Property}t(lA,"isAstProperty");function p_t(a){return a.type===Ac.Array}t(p_t,"isAstArray");function LM(a){return a.type===Ac.Literal}t(LM,"isAstLiteral");function $O(a){if(a===void 0)throw new Error("Node is undefined");if(!FM(a))throw new Error("Node is not object")}t($O,"assertAstObject");import{findNodeAtLocation as clr,getNodeValue as llr,printParseErrorCode as ulr,visit as flr}from"jsonc-parser";var _lr={DEFAULT:{allowTrailingComma:!1}};function yG(a,s=[],l=_lr.DEFAULT){let _={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function m(M){_.type==="property"&&(_.length=M-_.offset,_=_.parent)}t(m,"ensurePropertyComplete");function b(M){return _.children?.push(M),M}t(b,"onValue"),flr(a,{onObjectBegin:t((M,U,ne)=>{_=b({type:"object",offset:M,length:-1,line:U+1,column:ne+1,parent:_,children:[]})},"onObjectBegin"),onObjectProperty:t((M,U,ne,se,Z)=>{_=b({type:"property",offset:U,length:-1,line:se+1,column:Z+1,parent:_,children:[]}),_.children?.push({type:"string",value:M,offset:U,length:ne,line:se,column:Z,parent:_})},"onObjectProperty"),onObjectEnd:t((M,U)=>{m(M+U),_.length=M+U-_.offset,_=_.parent,m(M+U)},"onObjectEnd"),onArrayBegin:t((M,U,ne,se)=>{_=b({type:"array",offset:M,length:-1,line:ne+1,column:se+1,parent:_,children:[]})},"onArrayBegin"),onArrayEnd:t((M,U)=>{_.length=M+U-_.offset,_=_.parent,m(M+U)},"onArrayEnd"),onLiteralValue:t((M,U,ne,se,Z)=>{b({type:plr(M),offset:U,length:ne,line:se+1,column:Z+1,parent:_,value:M}),m(U+ne)},"onLiteralValue"),onSeparator:t((M,U)=>{_.type==="property"&&(M===":"?_.colonOffset=U:M===","&&m(U))},"onSeparator"),onError:t((M,U,ne,se,Z)=>{s.push({error:M,offset:U,length:ne,line:se+1,column:Z+1})},"onError")},l);let A=_.children[0];return A&&delete A.parent,A}t(yG,"parse");function plr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(plr,"getNodeType");function rNe(a,s){return clr(a,s)}t(rNe,"findNodeAtLocation");function vG(a){return llr(a)}t(vG,"getNodeValue");function d_t(a){return ulr(a)}t(d_t,"printParseErrorCode");var bG=class{static{t(this,"AstAdapter")}parse(s){let _=yG(s,[]);if(_)return this.parseNode(_,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,l){switch(s.type){case"object":return this.createObject(s,l);case"array":return this.createArray(s,l);case"property":return this.createProperty(s,l);case"string":return this.createLiteral(s,l);case"number":return this.createLiteral(s,l);case"boolean":return this.createLiteral(s,l);case"null":return this.createLiteral(s,l)}}createLiteral(s,l){return{type:Ac.Literal,location:{line:s.line,column:s.column},parent:l,value:s.type==="null"?null:s.value}}createObject(s,l){let _={type:Ac.Object,children:[],parent:l,location:{line:s.line,column:s.column}};return s.children?.forEach(m=>{_.children.push(this.parseNode(m,_))}),_}createProperty(s,l){cA(s.children?.length===2,"Invalid property node");let _={type:Ac.Property,location:{line:s.line,column:s.column},parent:l,name:null,value:null};return _.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Ac.Identifier,parent:_},_.value=this.parseNode(s.children[1],_),_}createArray(s,l){let _={type:Ac.Array,location:{line:s.line,column:s.column},parent:l,children:[]};return s.children?.forEach(m=>_.children.push(this.parseNode(m,_))),_}};var $C={createLiteral:t((a,s)=>({type:Ac.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Ac.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Ac.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,l)=>{let _={type:Ac.Property,parent:l,name:null,value:s};return _.name={value:a,type:Ac.Identifier,parent:_},_.value.parent=_,_},"createProperty"),createArrayOfLiterals:t((a,s)=>{let l={type:Ac.Array,parent:s,children:[]};for(let _ of a)l.children.push($C.createLiteral(_,l));return l},"createArrayOfLiterals")};var dlr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,SG=class{static{t(this,"SourceGenerator")}generate(s){let l=[];return this.generateSource(l,s),l.join("")}generateSource(s,l){switch(l.type){case Ac.Array:return this.generateArray(s,l);case Ac.Object:return this.generateObject(s,l);case Ac.Property:return this.generateProperty(s,l);case Ac.Literal:return this.generateLiteral(s,l);case Ac.FunctionCall:return this.generateFunctionCall(s,l);case Ac.Identifier:return this.generateIdentifier(s,l);case Ac.Raw:return this.generateRaw(s,l);case Ac.TemplateString:return this.generateTemplateString(s,l)}}generateArray(s,l){s.push("["),l.children.map(_=>{this.generateSource(s,_),s.push(",")}),s.push("]")}generateObject(s,l){s.push("{"),l.children.forEach(_=>{this.generateSource(s,_),s.push(",")}),s.push("}")}generateProperty(s,l){this.generateIdentifier(s,l.name),s.push(":"),this.generateSource(s,l.value)}generateFunctionCall(s,l){s.push(l.name.value),s.push("("),l.children.forEach((_,m,b)=>{this.generateSource(s,_),m<b.length&&s.push(",")}),s.push(")")}generateRaw(s,l){s.push(l.value)}generateTemplateString(s,l){s.push("`"),s.push(l.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,l){if(l.value===null)return s.push("null");switch(typeof l.value){case"number":case"boolean":return s.push(`${l.value}`);case"string":{let _=l.value,m=JSON.stringify(_);return s.push(`${m}`)}}}generateIdentifier(s,l){let _=dlr.test(l.value)?l.value:`'${l.value}'`;s.push(_)}};import{parse as mlr}from"@swc/core";import hlr from"fs/promises";var m_t=t(async a=>{let s=new Set;try{let l=await hlr.readFile(a,"utf-8");(await mlr(l,{syntax:"typescript"})).body.forEach(m=>{m.type==="ExportDefaultDeclaration"||m.type==="ExportDefaultExpression"?s.add("default"):m.type==="ExportDeclaration"&&m.declaration.type==="FunctionDeclaration"?s.add(m.declaration.identifier.value):m.type==="ExportDeclaration"&&m.declaration.type==="VariableDeclaration"&&m.declaration.declarations[0].id.type==="Identifier"&&s.add(m.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var h_t={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var nNe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var g_t={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var iNe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var sNe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var Amt=S_(Zdt(),1),Nmt=S_(Pmt(),1);var Wue=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new Nmt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,Amt.default)(this.ajv,{mode:"fast"})}addSchema(s,l){this.ajv.addSchema(s,l)}compile(s){let l=this.ajv.compile(s);return t(m=>({isValid:l(m),errors:this.toSimpleErrors(l.errors,m),warnings:[]}),"validator")}toSimpleErrors(s,l){let _=[];return s?.forEach(m=>{m.keyword==="enum"&&m.params.allowedValues&&Array.isArray(m.params.allowedValues)&&(m.message+=`; ${m.params.allowedValues.join(", ")}`),m.instancePath&&(m.instancePath=m.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let b={details:{}},D=m.instancePath.split("/");if(D.length>2){let M=D[1],U=D[2]?parseInt(D[2]):0,ne=D[3],se=isNaN(U)?void 0:l[M][U][ne];b={details:{property:M,index:U,field:ne,fieldValue:se}}}if(m.keyword==="required"&&m.params.missingProperty&&m.instancePath&&(m.message=`A 'path' is missing required property '${m.params.missingProperty}'`),m.keyword==="additionalProperties"&&m.params.additionalProperty&&m.instancePath&&(m.message=`A 'path' should NOT include property '${m.params.additionalProperty}'`),m.keyword==="type"&&m.params.type&&m.instancePath){let M=m.instancePath.split("/"),U=M[M.length-1];m.message=`Value of property '${U}' must be '${m.params.type}'`}let A=Object.assign(m,b);_.push(A)}),_}};var k3=Wue.instance;k3.addSchema(sNe,"route-configuration.schema.json");k3.addSchema(g_t,"policy-configuration.schema.json");k3.addSchema(nNe,"policies.schema.json");k3.addSchema(iNe,"open-api-route-configuration.schema.json");k3.addSchema(h_t,"fragments.schema.json");var K5r=k3.compile(sNe),Imt=k3.compile(iNe),b8e=k3.compile(nNe);var Hue=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=b8e(s),this.results}};var Gue=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=Imt(s),this.results}};import Thr from"path";var S8e=/\$import\((.*)\)/,Kue=/\$env\((.*?)\)/g;var dA=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,l,_,m){super(s),this.location={file:l,namespace:"",line:_?_.line:0,column:_?_.column:0,length:0,lineText:m??"",suggestion:""}}},Shr=t(a=>{let s=[],l=a;for(;l.parent;)s.push(l),l=l.parent;return s.reverse()},"invertTree"),w3=t((a,s)=>{if(!a)return!1;let l=Shr(a);return s.split("/").every((b,D)=>{let A=l[D];return A?b==="*"||lA(A)&&A.name.value===b?!0:b==="{}"?A.type===Ac.Object:b==="[]"?A.type===Ac.Array:!1:!1})},"testPosition");var Yue=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),FM(s)?s.children.forEach(l=>{this.visitor(l)}):p_t(s)?s.children.forEach(l=>{this.visitor(l)}):lA(s)&&this.visitor(s.value)}},Omt=t((a,s,l)=>_=>{if(!lA(_)||!LM(_.value)||typeof _.value.value!="string")return;if(!a.some(b=>w3(_,b))){Kue.test(_.value.value)&&s.push(new dA("An $env() statement is not expected at this location.",l,_.location,_.value.value));return}let m=new RegExp(Kue).exec(_.value.value);if(m?.length===2&&m[0]===_.value.value){let b={type:Ac.Raw,parent:null,value:`environment["${m[1]}"]`};_.value=b}else{let b=_.value.value.replaceAll(new RegExp(Kue),(D,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);b!==_.value.value&&(_.value=$C.createTemplateString(b,_))}},"getEnvStatementTransformer");var eK="config/routes.json",xhr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Chr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Fmt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],Ehr="handler/{}/options/{}/rewritePattern",Dhr="handler/{}/options/{}/baseUrl",Xue=class extends Yue{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let l=this.addedImports.get(s);if(!l)throw new Error("Import name is undefined. This should not happen.");return l}getImports(){let s=[];return this.addedImports.forEach((l,_)=>{s.push({name:l,path:_})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!lA(s)||!LM(s.value)||typeof s.value.value!="string")&&w3(s,Ehr)){if(!s.parent||!FM(s.parent)){this.errors.push(new dA("Invalid node, expected object",eK,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Lmt(l)},m=$C.createProperty("__rewriteFunction",_,s);s.parent.children.push(m)}}rewriteForwardFunction(s){if(!(!lA(s)||!LM(s.value)||typeof s.value.value!="string")&&w3(s,Dhr)){if(!s.parent||!FM(s.parent)){this.errors.push(new dA("Invalid node, expected object",eK,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Lmt(l)},m=$C.createProperty("__rewriteFunction",_,s);s.parent.children.push(m)}}replaceImportStatements(s){if(!lA(s)||!LM(s.value))return;let l=s.value.value;if(typeof l!="string")return;if(!Chr.some(A=>w3(s,A))&&!Fmt.some(A=>w3(s,A))){if(S8e.test(l)){if(s.name.value==="$ref")return;this.errors.push(new dA("An $import() statement is not expected at this location.",eK,s.location,l))}return}let _=S8e.exec(l);if(Fmt.some(A=>w3(s,A))&&!_)return;if(!_){this.errors.push(new dA("Invalid $import() statement",eK,s.location,l));return}let m=_[1];m.startsWith(".")&&(m=Thr.join("..",m));let b=this.getImportName(m),D={type:Ac.Identifier,parent:s.parent,value:b};s.value=D}replaceEnvStatements=Omt(xhr,this.errors,eK)};function Lmt(a){return`(request, context) => {
|
|
561
561
|
const { params, url, query, method, headers } = request;
|
|
562
562
|
const { host, hostname, origin, pathname, port, search } = new URL(url);
|
|
563
563
|
const e = encodeURIComponent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/core",
|
|
3
|
-
"version": "6.18.
|
|
3
|
+
"version": "6.18.15",
|
|
4
4
|
"repository": "https://github.com/zuplo/zuplo",
|
|
5
5
|
"author": "Zuplo, Inc.",
|
|
6
6
|
"type": "module",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"prettier": "^3.3.3"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@zuplo/graphql": "^6.18.
|
|
44
|
-
"@zuplo/otel": "^6.18.
|
|
45
|
-
"@zuplo/runtime": "^6.18.
|
|
43
|
+
"@zuplo/graphql": "^6.18.15",
|
|
44
|
+
"@zuplo/otel": "^6.18.15",
|
|
45
|
+
"@zuplo/runtime": "^6.18.15"
|
|
46
46
|
}
|
|
47
47
|
}
|