@zuplo/core 6.32.22 → 6.32.24

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.
@@ -575,7 +575,13 @@ globstar while`,s,K,c,Ne,xe),this.matchOne(s.slice(K),c.slice(Ne),f))return this
575
575
  >>> no match, partial?`,s,K,c,Ne),K===O))}let Te;if(typeof H=="string"?(Te=$===H,this.debug("string match",H,$,Te)):(Te=H.test($),this.debug("pattern match",H,$,Te)),!Te)return!1}if(E===O&&A===M)return!0;if(E===O)return f;if(A===M)return E===O-1&&s[E]==="";throw new Error("wtf?")}braceExpand(){return Qut(this.pattern,this.options)}parse(s){dQ(s);let c=this.options;if(s==="**")return ry;if(s==="")return"";let f,d=null;(f=s.match(Dsr))?d=c.dot?ksr:Asr:(f=s.match(hsr))?d=(c.nocase?c.dot?bsr:vsr:c.dot?ysr:gsr)(f[1]):(f=s.match(wsr))?d=(c.nocase?c.dot?Nsr:Psr:c.dot?Isr:Osr)(f):(f=s.match(Ssr))?d=c.dot?Csr:Tsr:(f=s.match(Esr))&&(d=xsr);let v=Gj.fromGlob(s,this.options).toMMPattern();return d&&typeof v=="object"&&Reflect.defineProperty(v,"test",{value:d}),v}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let s=this.set;if(!s.length)return this.regexp=!1,this.regexp;let c=this.options,f=c.noglobstar?Rsr:c.dot?Msr:jsr,d=new Set(c.nocase?["i"]:[]),v=s.map(O=>{let M=O.map(H=>{if(H instanceof RegExp)for(let $ of H.flags.split(""))d.add($);return typeof H=="string"?zsr(H):H===ry?ry:H._src});return M.forEach((H,$)=>{let K=M[$+1],Ne=M[$-1];H!==ry||Ne===ry||(Ne===void 0?K!==void 0&&K!==ry?M[$+1]="(?:\\/|"+f+"\\/)?"+K:M[$]=f:K===void 0?M[$-1]=Ne+"(?:\\/|"+f+")?":K!==ry&&(M[$-1]=Ne+"(?:\\/|\\/"+f+"\\/)"+K,M[$+1]=ry))}),M.filter(H=>H!==ry).join("/")}).join("|"),[E,A]=s.length>1?["(?:",")"]:["",""];v="^"+E+v+A+"$",this.negate&&(v="^(?!"+v+").+$");try{this.regexp=new RegExp(v,[...d].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,c=this.partial){if(this.debug("match",s,this.pattern),this.comment)return!1;if(this.empty)return s==="";if(s==="/"&&c)return!0;let f=this.options;this.isWindows&&(s=s.split("\\").join("/"));let d=this.slashSplit(s);this.debug(this.pattern,"split",d);let v=this.set;this.debug(this.pattern,"set",v);let E=d[d.length-1];if(!E)for(let A=d.length-2;!E&&A>=0;A--)E=d[A];for(let A=0;A<v.length;A++){let O=v[A],M=d;if(f.matchBase&&O.length===1&&(M=[E]),this.matchOne(M,O,c))return f.flipNegate?!0:!this.negate}return f.flipNegate?!1:this.negate}static defaults(s){return Cv.defaults(s).Minimatch}};Cv.AST=Gj;Cv.Minimatch=AS;Cv.escape=Qj;Cv.unescape=Tx;import{fileURLToPath as Tar}from"url";var Kj=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Yut=new Set,iNe=typeof process=="object"&&process?process:{},Xut=t((a,s,c,f)=>{typeof iNe.emitWarning=="function"?iNe.emitWarning(a,s,c,f):console.error(`[${c}] ${s}: ${a}`)},"emitWarning"),Gue=globalThis.AbortController,Kut=globalThis.AbortSignal;if(typeof Gue>"u"){Kut=class{static{t(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(f,d){this._onabort.push(d)}},Gue=class{static{t(this,"AbortController")}constructor(){s()}signal=new Kut;abort(f){if(!this.signal.aborted){this.signal.reason=f,this.signal.aborted=!0;for(let d of this.signal._onabort)d(f);this.signal.onabort?.(f)}}};let a=iNe.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",s=t(()=>{a&&(a=!1,Xut("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 qsr=t(a=>!Yut.has(a),"shouldWarn"),qLr=Symbol("type"),gN=t(a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),"isPosInt"),Zut=t(a=>gN(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?Yj:null:null,"getUintArray"),Yj=class extends Array{static{t(this,"ZeroArray")}constructor(s){super(s),this.fill(0)}},sNe=class a{static{t(this,"Stack")}heap;length;static#r=!1;static create(s){let c=Zut(s);if(!c)return[];a.#r=!0;let f=new a(s,c);return a.#r=!1,f}constructor(s,c){if(!a.#r)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new c(s),this.length=0}push(s){this.heap[this.length++]=s}pop(){return this.heap[--this.length]}},hQ=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;#x;#C;#b;#A;#E;#y;static unsafeExposeInternals(s){return{starts:s.#C,ttls:s.#b,sizes:s.#x,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(c=>s.#h(c),"isBackgroundFetch"),backgroundFetch:t((c,f,d,v)=>s.#j(c,f,d,v),"backgroundFetch"),moveToTail:t(c=>s.#U(c),"moveToTail"),indexes:t(c=>s.#w(c),"indexes"),rindexes:t(c=>s.#P(c),"rindexes"),isStale:t(c=>s.#S(c),"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:c=0,ttl:f,ttlResolution:d=1,ttlAutopurge:v,updateAgeOnGet:E,updateAgeOnHas:A,allowStale:O,dispose:M,disposeAfter:H,noDisposeOnSet:$,noUpdateTTL:K,maxSize:Ne=0,maxEntrySize:xe=0,sizeCalculation:Te,fetchMethod:Tt,memoMethod:Dt,noDeleteOnFetchRejection:br,noDeleteOnStaleGet:dr,allowStaleOnFetchRejection:jr,allowStaleOnFetchAbort:Cr,ignoreFetchAbort:pr}=s;if(c!==0&&!gN(c))throw new TypeError("max option must be a nonnegative integer");let sr=c?Zut(c):Array;if(!sr)throw new Error("invalid max value: "+c);if(this.#r=c,this.#n=Ne,this.maxEntrySize=xe||this.#n,this.sizeCalculation=Te,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(Dt!==void 0&&typeof Dt!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#p=Dt,Tt!==void 0&&typeof Tt!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#s=Tt,this.#E=!!Tt,this.#c=new Map,this.#l=new Array(c).fill(void 0),this.#i=new Array(c).fill(void 0),this.#f=new sr(c),this.#v=new sr(c),this.#d=0,this.#u=0,this.#m=sNe.create(c),this.#a=0,this.#_=0,typeof M=="function"&&(this.#e=M),typeof H=="function"?(this.#t=H,this.#g=[]):(this.#t=void 0,this.#g=void 0),this.#A=!!this.#e,this.#y=!!this.#t,this.noDisposeOnSet=!!$,this.noUpdateTTL=!!K,this.noDeleteOnFetchRejection=!!br,this.allowStaleOnFetchRejection=!!jr,this.allowStaleOnFetchAbort=!!Cr,this.ignoreFetchAbort=!!pr,this.maxEntrySize!==0){if(this.#n!==0&&!gN(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!gN(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#T()}if(this.allowStale=!!O,this.noDeleteOnStaleGet=!!dr,this.updateAgeOnGet=!!E,this.updateAgeOnHas=!!A,this.ttlResolution=gN(d)||d===0?d:1,this.ttlAutopurge=!!v,this.ttl=f||0,this.ttl){if(!gN(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 Cs="LRU_CACHE_UNBOUNDED";qsr(Cs)&&(Yut.add(Cs),Xut("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Cs,a))}}getRemainingTTL(s){return this.#c.has(s)?1/0:0}#D(){let s=new Yj(this.#r),c=new Yj(this.#r);this.#b=s,this.#C=c,this.#N=(v,E,A=Kj.now())=>{if(c[v]=E!==0?A:0,s[v]=E,E!==0&&this.ttlAutopurge){let O=setTimeout(()=>{this.#S(v)&&this.#O(this.#l[v],"expire")},E+1);O.unref&&O.unref()}},this.#k=v=>{c[v]=s[v]!==0?Kj.now():0},this.#o=(v,E)=>{if(s[E]){let A=s[E],O=c[E];if(!A||!O)return;v.ttl=A,v.start=O,v.now=f||d();let M=v.now-O;v.remainingTTL=A-M}};let f=0,d=t(()=>{let v=Kj.now();if(this.ttlResolution>0){f=v;let E=setTimeout(()=>f=0,this.ttlResolution);E.unref&&E.unref()}return v},"getNow");this.getRemainingTTL=v=>{let E=this.#c.get(v);if(E===void 0)return 0;let A=s[E],O=c[E];if(!A||!O)return 1/0;let M=(f||d())-O;return A-M},this.#S=v=>{let E=c[v],A=s[v];return!!A&&!!E&&(f||d())-E>A}}#k=t(()=>{},"#updateItemAge");#o=t(()=>{},"#statusTTL");#N=t(()=>{},"#setItemTTL");#S=t(()=>!1,"#isStale");#T(){let s=new Yj(this.#r);this.#_=0,this.#x=s,this.#I=c=>{this.#_-=s[c],s[c]=0},this.#L=(c,f,d,v)=>{if(this.#h(f))return 0;if(!gN(d))if(v){if(typeof v!="function")throw new TypeError("sizeCalculation must be a function");if(d=v(f,c),!gN(d))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 d},this.#F=(c,f,d)=>{if(s[c]=f,this.#n){let v=this.#n-s[c];for(;this.#_>v;)this.#M(!0)}this.#_+=s[c],d&&(d.entrySize=f,d.totalCalculatedSize=this.#_)}}#I=t(s=>{},"#removeItemSize");#F=t((s,c,f)=>{},"#addItemSize");#L=t((s,c,f,d)=>{if(f||d)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#w({allowStale:s=this.allowStale}={}){if(this.#a)for(let c=this.#u;!(!this.#R(c)||((s||!this.#S(c))&&(yield c),c===this.#d));)c=this.#v[c]}*#P({allowStale:s=this.allowStale}={}){if(this.#a)for(let c=this.#d;!(!this.#R(c)||((s||!this.#S(c))&&(yield c),c===this.#u));)c=this.#f[c]}#R(s){return s!==void 0&&this.#c.get(this.#l[s])===s}*entries(){for(let s of this.#w())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.#P())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.#w()){let c=this.#l[s];c!==void 0&&!this.#h(this.#i[s])&&(yield c)}}*rkeys(){for(let s of this.#P()){let c=this.#l[s];c!==void 0&&!this.#h(this.#i[s])&&(yield c)}}*values(){for(let s of this.#w())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}*rvalues(){for(let s of this.#P())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(s,c={}){for(let f of this.#w()){let d=this.#i[f],v=this.#h(d)?d.__staleWhileFetching:d;if(v!==void 0&&s(v,this.#l[f],this))return this.get(this.#l[f],c)}}forEach(s,c=this){for(let f of this.#w()){let d=this.#i[f],v=this.#h(d)?d.__staleWhileFetching:d;v!==void 0&&s.call(c,v,this.#l[f],this)}}rforEach(s,c=this){for(let f of this.#P()){let d=this.#i[f],v=this.#h(d)?d.__staleWhileFetching:d;v!==void 0&&s.call(c,v,this.#l[f],this)}}purgeStale(){let s=!1;for(let c of this.#P({allowStale:!0}))this.#S(c)&&(this.#O(this.#l[c],"expire"),s=!0);return s}info(s){let c=this.#c.get(s);if(c===void 0)return;let f=this.#i[c],d=this.#h(f)?f.__staleWhileFetching:f;if(d===void 0)return;let v={value:d};if(this.#b&&this.#C){let E=this.#b[c],A=this.#C[c];if(E&&A){let O=E-(Kj.now()-A);v.ttl=O,v.start=Date.now()}}return this.#x&&(v.size=this.#x[c]),v}dump(){let s=[];for(let c of this.#w({allowStale:!0})){let f=this.#l[c],d=this.#i[c],v=this.#h(d)?d.__staleWhileFetching:d;if(v===void 0||f===void 0)continue;let E={value:v};if(this.#b&&this.#C){E.ttl=this.#b[c];let A=Kj.now()-this.#C[c];E.start=Math.floor(Date.now()-A)}this.#x&&(E.size=this.#x[c]),s.unshift([f,E])}return s}load(s){this.clear();for(let[c,f]of s){if(f.start){let d=Date.now()-f.start;f.start=Kj.now()-d}this.set(c,f.value,f)}}set(s,c,f={}){if(c===void 0)return this.delete(s),this;let{ttl:d=this.ttl,start:v,noDisposeOnSet:E=this.noDisposeOnSet,sizeCalculation:A=this.sizeCalculation,status:O}=f,{noUpdateTTL:M=this.noUpdateTTL}=f,H=this.#L(s,c,f.size||0,A);if(this.maxEntrySize&&H>this.maxEntrySize)return O&&(O.set="miss",O.maxEntrySizeExceeded=!0),this.#O(s,"set"),this;let $=this.#a===0?void 0:this.#c.get(s);if($===void 0)$=this.#a===0?this.#u:this.#m.length!==0?this.#m.pop():this.#a===this.#r?this.#M(!1):this.#a,this.#l[$]=s,this.#i[$]=c,this.#c.set(s,$),this.#f[this.#u]=$,this.#v[$]=this.#u,this.#u=$,this.#a++,this.#F($,H,O),O&&(O.set="add"),M=!1;else{this.#U($);let K=this.#i[$];if(c!==K){if(this.#E&&this.#h(K)){K.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Ne}=K;Ne!==void 0&&!E&&(this.#A&&this.#e?.(Ne,s,"set"),this.#y&&this.#g?.push([Ne,s,"set"]))}else E||(this.#A&&this.#e?.(K,s,"set"),this.#y&&this.#g?.push([K,s,"set"]));if(this.#I($),this.#F($,H,O),this.#i[$]=c,O){O.set="replace";let Ne=K&&this.#h(K)?K.__staleWhileFetching:K;Ne!==void 0&&(O.oldValue=Ne)}}else O&&(O.set="update")}if(d!==0&&!this.#b&&this.#D(),this.#b&&(M||this.#N($,d,v),O&&this.#o(O,$)),!E&&this.#y&&this.#g){let K=this.#g,Ne;for(;Ne=K?.shift();)this.#t?.(...Ne)}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,c;for(;c=s?.shift();)this.#t?.(...c)}}}#M(s){let c=this.#d,f=this.#l[c],d=this.#i[c];return this.#E&&this.#h(d)?d.__abortController.abort(new Error("evicted")):(this.#A||this.#y)&&(this.#A&&this.#e?.(d,f,"evict"),this.#y&&this.#g?.push([d,f,"evict"])),this.#I(c),s&&(this.#l[c]=void 0,this.#i[c]=void 0,this.#m.push(c)),this.#a===1?(this.#d=this.#u=0,this.#m.length=0):this.#d=this.#f[c],this.#c.delete(f),this.#a--,c}has(s,c={}){let{updateAgeOnHas:f=this.updateAgeOnHas,status:d}=c,v=this.#c.get(s);if(v!==void 0){let E=this.#i[v];if(this.#h(E)&&E.__staleWhileFetching===void 0)return!1;if(this.#S(v))d&&(d.has="stale",this.#o(d,v));else return f&&this.#k(v),d&&(d.has="hit",this.#o(d,v)),!0}else d&&(d.has="miss");return!1}peek(s,c={}){let{allowStale:f=this.allowStale}=c,d=this.#c.get(s);if(d===void 0||!f&&this.#S(d))return;let v=this.#i[d];return this.#h(v)?v.__staleWhileFetching:v}#j(s,c,f,d){let v=c===void 0?void 0:this.#i[c];if(this.#h(v))return v;let E=new Gue,{signal:A}=f;A?.addEventListener("abort",()=>E.abort(A.reason),{signal:E.signal});let O={signal:E.signal,options:f,context:d},M=t((Te,Tt=!1)=>{let{aborted:Dt}=E.signal,br=f.ignoreFetchAbort&&Te!==void 0;if(f.status&&(Dt&&!Tt?(f.status.fetchAborted=!0,f.status.fetchError=E.signal.reason,br&&(f.status.fetchAbortIgnored=!0)):f.status.fetchResolved=!0),Dt&&!br&&!Tt)return $(E.signal.reason);let dr=Ne;return this.#i[c]===Ne&&(Te===void 0?dr.__staleWhileFetching?this.#i[c]=dr.__staleWhileFetching:this.#O(s,"fetch"):(f.status&&(f.status.fetchUpdated=!0),this.set(s,Te,O.options))),Te},"cb"),H=t(Te=>(f.status&&(f.status.fetchRejected=!0,f.status.fetchError=Te),$(Te)),"eb"),$=t(Te=>{let{aborted:Tt}=E.signal,Dt=Tt&&f.allowStaleOnFetchAbort,br=Dt||f.allowStaleOnFetchRejection,dr=br||f.noDeleteOnFetchRejection,jr=Ne;if(this.#i[c]===Ne&&(!dr||jr.__staleWhileFetching===void 0?this.#O(s,"fetch"):Dt||(this.#i[c]=jr.__staleWhileFetching)),br)return f.status&&jr.__staleWhileFetching!==void 0&&(f.status.returnedStale=!0),jr.__staleWhileFetching;if(jr.__returned===jr)throw Te},"fetchFail"),K=t((Te,Tt)=>{let Dt=this.#s?.(s,v,O);Dt&&Dt instanceof Promise&&Dt.then(br=>Te(br===void 0?void 0:br),Tt),E.signal.addEventListener("abort",()=>{(!f.ignoreFetchAbort||f.allowStaleOnFetchAbort)&&(Te(void 0),f.allowStaleOnFetchAbort&&(Te=t(br=>M(br,!0),"res")))})},"pcall");f.status&&(f.status.fetchDispatched=!0);let Ne=new Promise(K).then(M,H),xe=Object.assign(Ne,{__abortController:E,__staleWhileFetching:v,__returned:void 0});return c===void 0?(this.set(s,xe,{...O.options,status:void 0}),c=this.#c.get(s)):this.#i[c]=xe,xe}#h(s){if(!this.#E)return!1;let c=s;return!!c&&c instanceof Promise&&c.hasOwnProperty("__staleWhileFetching")&&c.__abortController instanceof Gue}async fetch(s,c={}){let{allowStale:f=this.allowStale,updateAgeOnGet:d=this.updateAgeOnGet,noDeleteOnStaleGet:v=this.noDeleteOnStaleGet,ttl:E=this.ttl,noDisposeOnSet:A=this.noDisposeOnSet,size:O=0,sizeCalculation:M=this.sizeCalculation,noUpdateTTL:H=this.noUpdateTTL,noDeleteOnFetchRejection:$=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:K=this.allowStaleOnFetchRejection,ignoreFetchAbort:Ne=this.ignoreFetchAbort,allowStaleOnFetchAbort:xe=this.allowStaleOnFetchAbort,context:Te,forceRefresh:Tt=!1,status:Dt,signal:br}=c;if(!this.#E)return Dt&&(Dt.fetch="get"),this.get(s,{allowStale:f,updateAgeOnGet:d,noDeleteOnStaleGet:v,status:Dt});let dr={allowStale:f,updateAgeOnGet:d,noDeleteOnStaleGet:v,ttl:E,noDisposeOnSet:A,size:O,sizeCalculation:M,noUpdateTTL:H,noDeleteOnFetchRejection:$,allowStaleOnFetchRejection:K,allowStaleOnFetchAbort:xe,ignoreFetchAbort:Ne,status:Dt,signal:br},jr=this.#c.get(s);if(jr===void 0){Dt&&(Dt.fetch="miss");let Cr=this.#j(s,jr,dr,Te);return Cr.__returned=Cr}else{let Cr=this.#i[jr];if(this.#h(Cr)){let _o=f&&Cr.__staleWhileFetching!==void 0;return Dt&&(Dt.fetch="inflight",_o&&(Dt.returnedStale=!0)),_o?Cr.__staleWhileFetching:Cr.__returned=Cr}let pr=this.#S(jr);if(!Tt&&!pr)return Dt&&(Dt.fetch="hit"),this.#U(jr),d&&this.#k(jr),Dt&&this.#o(Dt,jr),Cr;let sr=this.#j(s,jr,dr,Te),Di=sr.__staleWhileFetching!==void 0&&f;return Dt&&(Dt.fetch=pr?"stale":"refresh",Di&&pr&&(Dt.returnedStale=!0)),Di?sr.__staleWhileFetching:sr.__returned=sr}}async forceFetch(s,c={}){let f=await this.fetch(s,c);if(f===void 0)throw new Error("fetch() returned undefined");return f}memo(s,c={}){let f=this.#p;if(!f)throw new Error("no memoMethod provided to constructor");let{context:d,forceRefresh:v,...E}=c,A=this.get(s,E);if(!v&&A!==void 0)return A;let O=f(s,A,{options:E,context:d});return this.set(s,O,E),O}get(s,c={}){let{allowStale:f=this.allowStale,updateAgeOnGet:d=this.updateAgeOnGet,noDeleteOnStaleGet:v=this.noDeleteOnStaleGet,status:E}=c,A=this.#c.get(s);if(A!==void 0){let O=this.#i[A],M=this.#h(O);return E&&this.#o(E,A),this.#S(A)?(E&&(E.get="stale"),M?(E&&f&&O.__staleWhileFetching!==void 0&&(E.returnedStale=!0),f?O.__staleWhileFetching:void 0):(v||this.#O(s,"expire"),E&&f&&(E.returnedStale=!0),f?O:void 0)):(E&&(E.get="hit"),M?O.__staleWhileFetching:(this.#U(A),d&&this.#k(A),O))}else E&&(E.get="miss")}#B(s,c){this.#v[c]=s,this.#f[s]=c}#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,c){let f=!1;if(this.#a!==0){let d=this.#c.get(s);if(d!==void 0)if(f=!0,this.#a===1)this.#$(c);else{this.#I(d);let v=this.#i[d];if(this.#h(v)?v.__abortController.abort(new Error("deleted")):(this.#A||this.#y)&&(this.#A&&this.#e?.(v,s,c),this.#y&&this.#g?.push([v,s,c])),this.#c.delete(s),this.#l[d]=void 0,this.#i[d]=void 0,d===this.#u)this.#u=this.#v[d];else if(d===this.#d)this.#d=this.#f[d];else{let E=this.#v[d];this.#f[E]=this.#f[d];let A=this.#f[d];this.#v[A]=this.#v[d]}this.#a--,this.#m.push(d)}}if(this.#y&&this.#g?.length){let d=this.#g,v;for(;v=d?.shift();)this.#t?.(...v)}return f}clear(){return this.#$("delete")}#$(s){for(let c of this.#P({allowStale:!0})){let f=this.#i[c];if(this.#h(f))f.__abortController.abort(new Error("deleted"));else{let d=this.#l[c];this.#A&&this.#e?.(f,d,s),this.#y&&this.#g?.push([f,d,s])}}if(this.#c.clear(),this.#i.fill(void 0),this.#l.fill(void 0),this.#b&&this.#C&&(this.#b.fill(0),this.#C.fill(0)),this.#x&&this.#x.fill(0),this.#d=0,this.#u=0,this.#m.length=0,this.#_=0,this.#a=0,this.#y&&this.#g){let c=this.#g,f;for(;f=c?.shift();)this.#t?.(...f)}}};import{posix as tar,win32 as mNe}from"path";import{fileURLToPath as rar}from"url";import{lstatSync as nar,readdir as iar,readdirSync as sar,readlinkSync as aar,realpathSync as oar}from"fs";import*as car from"fs";import{lstat as uar,readdir as far,readlink as _ar,realpath as par}from"fs/promises";import{EventEmitter as _Ne}from"events";import ift from"stream";import{StringDecoder as Vsr}from"string_decoder";var eft=typeof process=="object"&&process?process:{stdout:null,stderr:null},Wsr=t(a=>!!a&&typeof a=="object"&&(a instanceof vN||a instanceof ift||Hsr(a)||Gsr(a)),"isStream"),Hsr=t(a=>!!a&&typeof a=="object"&&a instanceof _Ne&&typeof a.pipe=="function"&&a.pipe!==ift.Writable.prototype.pipe,"isReadable"),Gsr=t(a=>!!a&&typeof a=="object"&&a instanceof _Ne&&typeof a.write=="function"&&typeof a.end=="function","isWritable"),t6=Symbol("EOF"),r6=Symbol("maybeEmitEnd"),yN=Symbol("emittedEnd"),Que=Symbol("emittingEnd"),gQ=Symbol("emittedError"),Kue=Symbol("closed"),tft=Symbol("read"),Yue=Symbol("flush"),rft=Symbol("flushChunk"),Cx=Symbol("encoding"),Xj=Symbol("decoder"),d0=Symbol("flowing"),yQ=Symbol("paused"),Zj=Symbol("resume"),m0=Symbol("buffer"),Ev=Symbol("pipes"),h0=Symbol("bufferLength"),aNe=Symbol("bufferPush"),Xue=Symbol("bufferShift"),r1=Symbol("objectMode"),uh=Symbol("destroyed"),oNe=Symbol("error"),cNe=Symbol("emitData"),nft=Symbol("emitEnd"),lNe=Symbol("emitEnd2"),XA=Symbol("async"),uNe=Symbol("abort"),Zue=Symbol("aborted"),vQ=Symbol("signal"),qF=Symbol("dataListeners"),kS=Symbol("discarded"),bQ=t(a=>Promise.resolve().then(a),"defer"),Qsr=t(a=>a(),"nodefer"),Ksr=t(a=>a==="end"||a==="finish"||a==="prefinish","isEndish"),Ysr=t(a=>a instanceof ArrayBuffer||!!a&&typeof a=="object"&&a.constructor&&a.constructor.name==="ArrayBuffer"&&a.byteLength>=0,"isArrayBufferLike"),Xsr=t(a=>!Buffer.isBuffer(a)&&ArrayBuffer.isView(a),"isArrayBufferView"),efe=class{static{t(this,"Pipe")}src;dest;opts;ondrain;constructor(s,c,f){this.src=s,this.dest=c,this.opts=f,this.ondrain=()=>s[Zj](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(s){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},fNe=class extends efe{static{t(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(s,c,f){super(s,c,f),this.proxyErrors=d=>c.emit("error",d),s.on("error",this.proxyErrors)}},Zsr=t(a=>!!a.objectMode,"isObjectModeOptions"),ear=t(a=>!a.objectMode&&!!a.encoding&&a.encoding!=="buffer","isEncodingOptions"),vN=class extends _Ne{static{t(this,"Minipass")}[d0]=!1;[yQ]=!1;[Ev]=[];[m0]=[];[r1];[Cx];[XA];[Xj];[t6]=!1;[yN]=!1;[Que]=!1;[Kue]=!1;[gQ]=null;[h0]=0;[uh]=!1;[vQ];[Zue]=!1;[qF]=0;[kS]=!1;writable=!0;readable=!0;constructor(...s){let c=s[0]||{};if(super(),c.objectMode&&typeof c.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Zsr(c)?(this[r1]=!0,this[Cx]=null):ear(c)?(this[Cx]=c.encoding,this[r1]=!1):(this[r1]=!1,this[Cx]=null),this[XA]=!!c.async,this[Xj]=this[Cx]?new Vsr(this[Cx]):null,c&&c.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:t(()=>this[m0],"get")}),c&&c.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:t(()=>this[Ev],"get")});let{signal:f}=c;f&&(this[vQ]=f,f.aborted?this[uNe]():f.addEventListener("abort",()=>this[uNe]()))}get bufferLength(){return this[h0]}get encoding(){return this[Cx]}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[r1]}set objectMode(s){throw new Error("objectMode must be set at instantiation time")}get async(){return this[XA]}set async(s){this[XA]=this[XA]||!!s}[uNe](){this[Zue]=!0,this.emit("abort",this[vQ]?.reason),this.destroy(this[vQ]?.reason)}get aborted(){return this[Zue]}set aborted(s){}write(s,c,f){if(this[Zue])return!1;if(this[t6])throw new Error("write after end");if(this[uh])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof c=="function"&&(f=c,c="utf8"),c||(c="utf8");let d=this[XA]?bQ:Qsr;if(!this[r1]&&!Buffer.isBuffer(s)){if(Xsr(s))s=Buffer.from(s.buffer,s.byteOffset,s.byteLength);else if(Ysr(s))s=Buffer.from(s);else if(typeof s!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[r1]?(this[d0]&&this[h0]!==0&&this[Yue](!0),this[d0]?this.emit("data",s):this[aNe](s),this[h0]!==0&&this.emit("readable"),f&&d(f),this[d0]):s.length?(typeof s=="string"&&!(c===this[Cx]&&!this[Xj]?.lastNeed)&&(s=Buffer.from(s,c)),Buffer.isBuffer(s)&&this[Cx]&&(s=this[Xj].write(s)),this[d0]&&this[h0]!==0&&this[Yue](!0),this[d0]?this.emit("data",s):this[aNe](s),this[h0]!==0&&this.emit("readable"),f&&d(f),this[d0]):(this[h0]!==0&&this.emit("readable"),f&&d(f),this[d0])}read(s){if(this[uh])return null;if(this[kS]=!1,this[h0]===0||s===0||s&&s>this[h0])return this[r6](),null;this[r1]&&(s=null),this[m0].length>1&&!this[r1]&&(this[m0]=[this[Cx]?this[m0].join(""):Buffer.concat(this[m0],this[h0])]);let c=this[tft](s||null,this[m0][0]);return this[r6](),c}[tft](s,c){if(this[r1])this[Xue]();else{let f=c;s===f.length||s===null?this[Xue]():typeof f=="string"?(this[m0][0]=f.slice(s),c=f.slice(0,s),this[h0]-=s):(this[m0][0]=f.subarray(s),c=f.subarray(0,s),this[h0]-=s)}return this.emit("data",c),!this[m0].length&&!this[t6]&&this.emit("drain"),c}end(s,c,f){return typeof s=="function"&&(f=s,s=void 0),typeof c=="function"&&(f=c,c="utf8"),s!==void 0&&this.write(s,c),f&&this.once("end",f),this[t6]=!0,this.writable=!1,(this[d0]||!this[yQ])&&this[r6](),this}[Zj](){this[uh]||(!this[qF]&&!this[Ev].length&&(this[kS]=!0),this[yQ]=!1,this[d0]=!0,this.emit("resume"),this[m0].length?this[Yue]():this[t6]?this[r6]():this.emit("drain"))}resume(){return this[Zj]()}pause(){this[d0]=!1,this[yQ]=!0,this[kS]=!1}get destroyed(){return this[uh]}get flowing(){return this[d0]}get paused(){return this[yQ]}[aNe](s){this[r1]?this[h0]+=1:this[h0]+=s.length,this[m0].push(s)}[Xue](){return this[r1]?this[h0]-=1:this[h0]-=this[m0][0].length,this[m0].shift()}[Yue](s=!1){do;while(this[rft](this[Xue]())&&this[m0].length);!s&&!this[m0].length&&!this[t6]&&this.emit("drain")}[rft](s){return this.emit("data",s),this[d0]}pipe(s,c){if(this[uh])return s;this[kS]=!1;let f=this[yN];return c=c||{},s===eft.stdout||s===eft.stderr?c.end=!1:c.end=c.end!==!1,c.proxyErrors=!!c.proxyErrors,f?c.end&&s.end():(this[Ev].push(c.proxyErrors?new fNe(this,s,c):new efe(this,s,c)),this[XA]?bQ(()=>this[Zj]()):this[Zj]()),s}unpipe(s){let c=this[Ev].find(f=>f.dest===s);c&&(this[Ev].length===1?(this[d0]&&this[qF]===0&&(this[d0]=!1),this[Ev]=[]):this[Ev].splice(this[Ev].indexOf(c),1),c.unpipe())}addListener(s,c){return this.on(s,c)}on(s,c){let f=super.on(s,c);if(s==="data")this[kS]=!1,this[qF]++,!this[Ev].length&&!this[d0]&&this[Zj]();else if(s==="readable"&&this[h0]!==0)super.emit("readable");else if(Ksr(s)&&this[yN])super.emit(s),this.removeAllListeners(s);else if(s==="error"&&this[gQ]){let d=c;this[XA]?bQ(()=>d.call(this,this[gQ])):d.call(this,this[gQ])}return f}removeListener(s,c){return this.off(s,c)}off(s,c){let f=super.off(s,c);return s==="data"&&(this[qF]=this.listeners("data").length,this[qF]===0&&!this[kS]&&!this[Ev].length&&(this[d0]=!1)),f}removeAllListeners(s){let c=super.removeAllListeners(s);return(s==="data"||s===void 0)&&(this[qF]=0,!this[kS]&&!this[Ev].length&&(this[d0]=!1)),c}get emittedEnd(){return this[yN]}[r6](){!this[Que]&&!this[yN]&&!this[uh]&&this[m0].length===0&&this[t6]&&(this[Que]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Kue]&&this.emit("close"),this[Que]=!1)}emit(s,...c){let f=c[0];if(s!=="error"&&s!=="close"&&s!==uh&&this[uh])return!1;if(s==="data")return!this[r1]&&!f?!1:this[XA]?(bQ(()=>this[cNe](f)),!0):this[cNe](f);if(s==="end")return this[nft]();if(s==="close"){if(this[Kue]=!0,!this[yN]&&!this[uh])return!1;let v=super.emit("close");return this.removeAllListeners("close"),v}else if(s==="error"){this[gQ]=f,super.emit(oNe,f);let v=!this[vQ]||this.listeners("error").length?super.emit("error",f):!1;return this[r6](),v}else if(s==="resume"){let v=super.emit("resume");return this[r6](),v}else if(s==="finish"||s==="prefinish"){let v=super.emit(s);return this.removeAllListeners(s),v}let d=super.emit(s,...c);return this[r6](),d}[cNe](s){for(let f of this[Ev])f.dest.write(s)===!1&&this.pause();let c=this[kS]?!1:super.emit("data",s);return this[r6](),c}[nft](){return this[yN]?!1:(this[yN]=!0,this.readable=!1,this[XA]?(bQ(()=>this[lNe]()),!0):this[lNe]())}[lNe](){if(this[Xj]){let c=this[Xj].end();if(c){for(let f of this[Ev])f.dest.write(c);this[kS]||super.emit("data",c)}}for(let c of this[Ev])c.end();let s=super.emit("end");return this.removeAllListeners("end"),s}async collect(){let s=Object.assign([],{dataLength:0});this[r1]||(s.dataLength=0);let c=this.promise();return this.on("data",f=>{s.push(f),this[r1]||(s.dataLength+=f.length)}),await c,s}async concat(){if(this[r1])throw new Error("cannot concat in objectMode");let s=await this.collect();return this[Cx]?s.join(""):Buffer.concat(s,s.dataLength)}async promise(){return new Promise((s,c)=>{this.on(uh,()=>c(new Error("stream destroyed"))),this.on("error",f=>c(f)),this.on("end",()=>s())})}[Symbol.asyncIterator](){this[kS]=!1;let s=!1,c=t(async()=>(this.pause(),s=!0,{value:void 0,done:!0}),"stop");return{next:t(()=>{if(s)return c();let d=this.read();if(d!==null)return Promise.resolve({done:!1,value:d});if(this[t6])return c();let v,E,A=t($=>{this.off("data",O),this.off("end",M),this.off(uh,H),c(),E($)},"onerr"),O=t($=>{this.off("error",A),this.off("end",M),this.off(uh,H),this.pause(),v({value:$,done:!!this[t6]})},"ondata"),M=t(()=>{this.off("error",A),this.off("data",O),this.off(uh,H),c(),v({done:!0,value:void 0})},"onend"),H=t(()=>A(new Error("stream destroyed")),"ondestroy");return new Promise(($,K)=>{E=K,v=$,this.once(uh,H),this.once("error",A),this.once("end",M),this.once("data",O)})},"next"),throw:c,return:c,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[kS]=!1;let s=!1,c=t(()=>(this.pause(),this.off(oNe,c),this.off(uh,c),this.off("end",c),s=!0,{done:!0,value:void 0}),"stop"),f=t(()=>{if(s)return c();let d=this.read();return d===null?c():{done:!1,value:d}},"next");return this.once("end",c),this.once(oNe,c),this.once(uh,c),{next:f,throw:c,return:c,[Symbol.iterator](){return this}}}destroy(s){if(this[uh])return s?this.emit("error",s):this.emit(uh),this;this[uh]=!0,this[kS]=!0,this[m0].length=0,this[h0]=0;let c=this;return typeof c.close=="function"&&!this[Kue]&&c.close(),s?this.emit("error",s):this.emit(uh),this}static get isStream(){return Wsr}};var lar=oar.native,TQ={lstatSync:nar,readdir:iar,readdirSync:sar,readlinkSync:aar,realpathSync:lar,promises:{lstat:uar,readdir:far,readlink:_ar,realpath:par}},lft=t(a=>!a||a===TQ||a===car?TQ:{...TQ,...a,promises:{...TQ.promises,...a.promises||{}}},"fsFromOption"),uft=/^\\\\\?\\([a-z]:)\\?$/i,dar=t(a=>a.replace(/\//g,"\\").replace(uft,"$1\\"),"uncToDrive"),mar=/[\\\/]/,mC=0,fft=1,_ft=2,ZA=4,pft=6,dft=8,VF=10,mft=12,dC=15,SQ=~dC,pNe=16,sft=32,CQ=64,Ex=128,tfe=256,nfe=512,aft=CQ|Ex|nfe,har=1023,dNe=t(a=>a.isFile()?dft:a.isDirectory()?ZA:a.isSymbolicLink()?VF:a.isCharacterDevice()?_ft:a.isBlockDevice()?pft:a.isSocket()?mft:a.isFIFO()?fft:mC,"entToType"),oft=new Map,EQ=t(a=>{let s=oft.get(a);if(s)return s;let c=a.normalize("NFKD");return oft.set(a,c),c},"normalize"),cft=new Map,rfe=t(a=>{let s=cft.get(a);if(s)return s;let c=EQ(a.toLowerCase());return cft.set(a,c),c},"normalizeNocase"),ife=class extends hQ{static{t(this,"ResolveCache")}constructor(){super({max:256})}},hNe=class extends hQ{static{t(this,"ChildrenCache")}constructor(s=16*1024){super({maxSize:s,sizeCalculation:t(c=>c.length+1,"sizeCalculation")})}},hft=Symbol("PathScurry setAsCwd"),n1=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}#x;get ctime(){return this.#x}#C;get birthtime(){return this.#C}#b;#A;#E;#y;#D;#k;#o;#N;#S;#T;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(s,c=mC,f,d,v,E,A){this.name=s,this.#b=v?rfe(s):EQ(s),this.#o=c&har,this.nocase=v,this.roots=d,this.root=f||this,this.#N=E,this.#E=A.fullpath,this.#D=A.relative,this.#k=A.relativePosix,this.parent=A.parent,this.parent?this.#r=this.parent.#r:this.#r=lft(A.fs)}depth(){return this.#A!==void 0?this.#A:this.parent?this.#A=this.parent.depth()+1:this.#A=0}childrenCache(){return this.#N}resolve(s){if(!s)return this;let c=this.getRootString(s),d=s.substring(c.length).split(this.splitSep);return c?this.getRoot(c).#I(d):this.#I(d)}#I(s){let c=this;for(let f of s)c=c.child(f);return c}children(){let s=this.#N.get(this);if(s)return s;let c=Object.assign([],{provisional:0});return this.#N.set(this,c),this.#o&=~pNe,c}child(s,c){if(s===""||s===".")return this;if(s==="..")return this.parent||this;let f=this.children(),d=this.nocase?rfe(s):EQ(s);for(let O of f)if(O.#b===d)return O;let v=this.parent?this.sep:"",E=this.#E?this.#E+v+s:void 0,A=this.newChild(s,mC,{...c,parent:this,fullpath:E});return this.canReaddir()||(A.#o|=Ex),f.push(A),A}relative(){if(this.isCWD)return"";if(this.#D!==void 0)return this.#D;let s=this.name,c=this.parent;if(!c)return this.#D=this.name;let f=c.relative();return f+(!f||!c.parent?"":this.sep)+s}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#k!==void 0)return this.#k;let s=this.name,c=this.parent;if(!c)return this.#k=this.fullpathPosix();let f=c.relativePosix();return f+(!f||!c.parent?"":"/")+s}fullpath(){if(this.#E!==void 0)return this.#E;let s=this.name,c=this.parent;if(!c)return this.#E=this.name;let d=c.fullpath()+(c.parent?this.sep:"")+s;return this.#E=d}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let d=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(d)?this.#y=`//?/${d}`:this.#y=d}let s=this.parent,c=s.fullpathPosix(),f=c+(!c||!s.parent?"":"/")+this.name;return this.#y=f}isUnknown(){return(this.#o&dC)===mC}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&dC)===dft}isDirectory(){return(this.#o&dC)===ZA}isCharacterDevice(){return(this.#o&dC)===_ft}isBlockDevice(){return(this.#o&dC)===pft}isFIFO(){return(this.#o&dC)===fft}isSocket(){return(this.#o&dC)===mft}isSymbolicLink(){return(this.#o&VF)===VF}lstatCached(){return this.#o&sft?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&dC;return!(s!==mC&&s!==VF||this.#o&tfe||this.#o&Ex)}calledReaddir(){return!!(this.#o&pNe)}isENOENT(){return!!(this.#o&Ex)}isNamed(s){return this.nocase?this.#b===rfe(s):this.#b===EQ(s)}async readlink(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let c=await this.#r.promises.readlink(this.fullpath()),f=(await this.parent.realpath())?.resolve(c);if(f)return this.#S=f}catch(c){this.#h(c.code);return}}readlinkSync(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let c=this.#r.readlinkSync(this.fullpath()),f=this.parent.realpathSync()?.resolve(c);if(f)return this.#S=f}catch(c){this.#h(c.code);return}}#F(s){this.#o|=pNe;for(let c=s.provisional;c<s.length;c++){let f=s[c];f&&f.#L()}}#L(){this.#o&Ex||(this.#o=(this.#o|Ex)&SQ,this.#w())}#w(){let s=this.children();s.provisional=0;for(let c of s)c.#L()}#P(){this.#o|=nfe,this.#R()}#R(){if(this.#o&CQ)return;let s=this.#o;(s&dC)===ZA&&(s&=SQ),this.#o=s|CQ,this.#w()}#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 c=this.#o;c|=tfe,s==="ENOENT"&&(c|=Ex),(s==="EINVAL"||s==="UNKNOWN")&&(c&=SQ),this.#o=c,s==="ENOTDIR"&&this.parent&&this.parent.#R()}#B(s,c){return this.#O(s,c)||this.#U(s,c)}#U(s,c){let f=dNe(s),d=this.newChild(s.name,f,{parent:this}),v=d.#o&dC;return v!==ZA&&v!==VF&&v!==mC&&(d.#o|=CQ),c.unshift(d),c.provisional++,d}#O(s,c){for(let f=c.provisional;f<c.length;f++){let d=c[f];if((this.nocase?rfe(s.name):EQ(s.name))===d.#b)return this.#$(s,d,f,c)}}#$(s,c,f,d){let v=c.name;return c.#o=c.#o&SQ|dNe(s),v!==s.name&&(c.name=s.name),f!==d.provisional&&(f===d.length-1?d.pop():d.splice(f,1),d.unshift(c)),d.provisional++,c}async lstat(){if(!(this.#o&Ex))try{return this.#V(await this.#r.promises.lstat(this.fullpath())),this}catch(s){this.#j(s.code)}}lstatSync(){if(!(this.#o&Ex))try{return this.#V(this.#r.lstatSync(this.fullpath())),this}catch(s){this.#j(s.code)}}#V(s){let{atime:c,atimeMs:f,birthtime:d,birthtimeMs:v,blksize:E,blocks:A,ctime:O,ctimeMs:M,dev:H,gid:$,ino:K,mode:Ne,mtime:xe,mtimeMs:Te,nlink:Tt,rdev:Dt,size:br,uid:dr}=s;this.#m=c,this.#f=f,this.#C=d,this.#u=v,this.#_=E,this.#i=A,this.#x=O,this.#d=M,this.#n=H,this.#p=$,this.#c=K,this.#e=Ne,this.#g=xe,this.#v=Te,this.#t=Tt,this.#a=Dt,this.#l=br,this.#s=dr;let jr=dNe(s);this.#o=this.#o&SQ|jr|sft,jr!==mC&&jr!==ZA&&jr!==VF&&(this.#o|=CQ)}#z=[];#q=!1;#W(s){this.#q=!1;let c=this.#z.slice();this.#z.length=0,c.forEach(f=>f(null,s))}readdirCB(s,c=!1){if(!this.canReaddir()){c?s(null,[]):queueMicrotask(()=>s(null,[]));return}let f=this.children();if(this.calledReaddir()){let v=f.slice(0,f.provisional);c?s(null,v):queueMicrotask(()=>s(null,v));return}if(this.#z.push(s),this.#q)return;this.#q=!0;let d=this.fullpath();this.#r.readdir(d,{withFileTypes:!0},(v,E)=>{if(v)this.#M(v.code),f.provisional=0;else{for(let A of E)this.#B(A,f);this.#F(f)}this.#W(f.slice(0,f.provisional))})}#J;async readdir(){if(!this.canReaddir())return[];let s=this.children();if(this.calledReaddir())return s.slice(0,s.provisional);let c=this.fullpath();if(this.#J)await this.#J;else{let f=t(()=>{},"resolve");this.#J=new Promise(d=>f=d);try{for(let d of await this.#r.promises.readdir(c,{withFileTypes:!0}))this.#B(d,s);this.#F(s)}catch(d){this.#M(d.code),s.provisional=0}this.#J=void 0,f()}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 c=this.fullpath();try{for(let f of this.#r.readdirSync(c,{withFileTypes:!0}))this.#B(f,s);this.#F(s)}catch(f){this.#M(f.code),s.provisional=0}return s.slice(0,s.provisional)}canReaddir(){if(this.#o&aft)return!1;let s=dC&this.#o;return s===mC||s===ZA||s===VF}shouldWalk(s,c){return(this.#o&ZA)===ZA&&!(this.#o&aft)&&!s.has(this)&&(!c||c(this))}async realpath(){if(this.#T)return this.#T;if(!((nfe|tfe|Ex)&this.#o))try{let s=await this.#r.promises.realpath(this.fullpath());return this.#T=this.resolve(s)}catch{this.#P()}}realpathSync(){if(this.#T)return this.#T;if(!((nfe|tfe|Ex)&this.#o))try{let s=this.#r.realpathSync(this.fullpath());return this.#T=this.resolve(s)}catch{this.#P()}}[hft](s){if(s===this)return;s.isCWD=!1,this.isCWD=!0;let c=new Set([]),f=[],d=this;for(;d&&d.parent;)c.add(d),d.#D=f.join(this.sep),d.#k=f.join("/"),d=d.parent,f.push("..");for(d=s;d&&d.parent&&!c.has(d);)d.#D=void 0,d.#k=void 0,d=d.parent}},sfe=class a extends n1{static{t(this,"PathWin32")}sep="\\";splitSep=mar;constructor(s,c=mC,f,d,v,E,A){super(s,c,f,d,v,E,A)}newChild(s,c=mC,f={}){return new a(s,c,this.root,this.roots,this.nocase,this.childrenCache(),f)}getRootString(s){return mNe.parse(s).root}getRoot(s){if(s=dar(s.toUpperCase()),s===this.root.name)return this.root;for(let[c,f]of Object.entries(this.roots))if(this.sameRoot(s,c))return this.roots[s]=f;return this.roots[s]=new eB(s,this).root}sameRoot(s,c=this.root.name){return s=s.toUpperCase().replace(/\//g,"\\").replace(uft,"$1\\"),s===c}},afe=class a extends n1{static{t(this,"PathPosix")}splitSep="/";sep="/";constructor(s,c=mC,f,d,v,E,A){super(s,c,f,d,v,E,A)}getRootString(s){return s.startsWith("/")?"/":""}getRoot(s){return this.root}newChild(s,c=mC,f={}){return new a(s,c,this.root,this.roots,this.nocase,this.childrenCache(),f)}},ofe=class{static{t(this,"PathScurryBase")}root;rootPath;roots;cwd;#r;#n;#e;nocase;#t;constructor(s=process.cwd(),c,f,{nocase:d,childrenCacheSize:v=16*1024,fs:E=TQ}={}){this.#t=lft(E),(s instanceof URL||s.startsWith("file://"))&&(s=rar(s));let A=c.resolve(s);this.roots=Object.create(null),this.rootPath=this.parseRootPath(A),this.#r=new ife,this.#n=new ife,this.#e=new hNe(v);let O=A.substring(this.rootPath.length).split(f);if(O.length===1&&!O[0]&&O.pop(),d===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=d,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let M=this.root,H=O.length-1,$=c.sep,K=this.rootPath,Ne=!1;for(let xe of O){let Te=H--;M=M.child(xe,{relative:new Array(Te).fill("..").join($),relativePosix:new Array(Te).fill("..").join("/"),fullpath:K+=(Ne?"":$)+xe}),Ne=!0}this.cwd=M}depth(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.depth()}childrenCache(){return this.#e}resolve(...s){let c="";for(let v=s.length-1;v>=0;v--){let E=s[v];if(!(!E||E===".")&&(c=c?`${E}/${c}`:E,this.isAbsolute(E)))break}let f=this.#r.get(c);if(f!==void 0)return f;let d=this.cwd.resolve(c).fullpath();return this.#r.set(c,d),d}resolvePosix(...s){let c="";for(let v=s.length-1;v>=0;v--){let E=s[v];if(!(!E||E===".")&&(c=c?`${E}/${c}`:E,this.isAbsolute(E)))break}let f=this.#n.get(c);if(f!==void 0)return f;let d=this.cwd.resolve(c).fullpathPosix();return this.#n.set(c,d),d}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,c={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s,s=this.cwd);let{withFileTypes:f}=c;if(s.canReaddir()){let d=await s.readdir();return f?d:d.map(v=>v.name)}else return[]}readdirSync(s=this.cwd,c={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s,s=this.cwd);let{withFileTypes:f=!0}=c;return s.canReaddir()?f?s.readdirSync():s.readdirSync().map(d=>d.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:c}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s.withFileTypes,s=this.cwd);let f=await s.readlink();return c?f:f?.fullpath()}readlinkSync(s=this.cwd,{withFileTypes:c}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s.withFileTypes,s=this.cwd);let f=s.readlinkSync();return c?f:f?.fullpath()}async realpath(s=this.cwd,{withFileTypes:c}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s.withFileTypes,s=this.cwd);let f=await s.realpath();return c?f:f?.fullpath()}realpathSync(s=this.cwd,{withFileTypes:c}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s.withFileTypes,s=this.cwd);let f=s.realpathSync();return c?f:f?.fullpath()}async walk(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c,A=[];(!v||v(s))&&A.push(f?s:s.fullpath());let O=new Set,M=t(($,K)=>{O.add($),$.readdirCB((Ne,xe)=>{if(Ne)return K(Ne);let Te=xe.length;if(!Te)return K();let Tt=t(()=>{--Te===0&&K()},"next");for(let Dt of xe)(!v||v(Dt))&&A.push(f?Dt:Dt.fullpath()),d&&Dt.isSymbolicLink()?Dt.realpath().then(br=>br?.isUnknown()?br.lstat():br).then(br=>br?.shouldWalk(O,E)?M(br,Tt):Tt()):Dt.shouldWalk(O,E)?M(Dt,Tt):Tt()},!0)},"walk"),H=s;return new Promise(($,K)=>{M(H,Ne=>{if(Ne)return K(Ne);$(A)})})}walkSync(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c,A=[];(!v||v(s))&&A.push(f?s:s.fullpath());let O=new Set([s]);for(let M of O){let H=M.readdirSync();for(let $ of H){(!v||v($))&&A.push(f?$:$.fullpath());let K=$;if($.isSymbolicLink()){if(!(d&&(K=$.realpathSync())))continue;K.isUnknown()&&K.lstatSync()}K.shouldWalk(O,E)&&O.add(K)}}return A}[Symbol.asyncIterator](){return this.iterate()}iterate(s=this.cwd,c={}){return typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s,s=this.cwd),this.stream(s,c)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c;(!v||v(s))&&(yield f?s:s.fullpath());let A=new Set([s]);for(let O of A){let M=O.readdirSync();for(let H of M){(!v||v(H))&&(yield f?H:H.fullpath());let $=H;if(H.isSymbolicLink()){if(!(d&&($=H.realpathSync())))continue;$.isUnknown()&&$.lstatSync()}$.shouldWalk(A,E)&&A.add($)}}}stream(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c,A=new vN({objectMode:!0});(!v||v(s))&&A.write(f?s:s.fullpath());let O=new Set,M=[s],H=0,$=t(()=>{let K=!1;for(;!K;){let Ne=M.shift();if(!Ne){H===0&&A.end();return}H++,O.add(Ne);let xe=t((Tt,Dt,br=!1)=>{if(Tt)return A.emit("error",Tt);if(d&&!br){let dr=[];for(let jr of Dt)jr.isSymbolicLink()&&dr.push(jr.realpath().then(Cr=>Cr?.isUnknown()?Cr.lstat():Cr));if(dr.length){Promise.all(dr).then(()=>xe(null,Dt,!0));return}}for(let dr of Dt)dr&&(!v||v(dr))&&(A.write(f?dr:dr.fullpath())||(K=!0));H--;for(let dr of Dt){let jr=dr.realpathCached()||dr;jr.shouldWalk(O,E)&&M.push(jr)}K&&!A.flowing?A.once("drain",$):Te||$()},"onReaddir"),Te=!0;Ne.readdirCB(xe,!0),Te=!1}},"process");return $(),A}streamSync(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c,A=new vN({objectMode:!0}),O=new Set;(!v||v(s))&&A.write(f?s:s.fullpath());let M=[s],H=0,$=t(()=>{let K=!1;for(;!K;){let Ne=M.shift();if(!Ne){H===0&&A.end();return}H++,O.add(Ne);let xe=Ne.readdirSync();for(let Te of xe)(!v||v(Te))&&(A.write(f?Te:Te.fullpath())||(K=!0));H--;for(let Te of xe){let Tt=Te;if(Te.isSymbolicLink()){if(!(d&&(Tt=Te.realpathSync())))continue;Tt.isUnknown()&&Tt.lstatSync()}Tt.shouldWalk(O,E)&&M.push(Tt)}}K&&!A.flowing&&A.once("drain",$)},"process");return $(),A}chdir(s=this.cwd){let c=this.cwd;this.cwd=typeof s=="string"?this.cwd.resolve(s):s,this.cwd[hft](c)}},eB=class extends ofe{static{t(this,"PathScurryWin32")}sep="\\";constructor(s=process.cwd(),c={}){let{nocase:f=!0}=c;super(s,mNe,"\\",{...c,nocase:f}),this.nocase=f;for(let d=this.cwd;d;d=d.parent)d.nocase=this.nocase}parseRootPath(s){return mNe.parse(s).root.toUpperCase()}newRoot(s){return new sfe(this.rootPath,ZA,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")||s.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(s)}},tB=class extends ofe{static{t(this,"PathScurryPosix")}sep="/";constructor(s=process.cwd(),c={}){let{nocase:f=!1}=c;super(s,tar,"/",{...c,nocase:f}),this.nocase=f}parseRootPath(s){return"/"}newRoot(s){return new afe(this.rootPath,ZA,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")}},xQ=class extends tB{static{t(this,"PathScurryDarwin")}constructor(s=process.cwd(),c={}){let{nocase:f=!0}=c;super(s,{...c,nocase:f})}},iRr=process.platform==="win32"?sfe:afe,gft=process.platform==="win32"?eB:process.platform==="darwin"?xQ:tB;var gar=t(a=>a.length>=1,"isPatternList"),yar=t(a=>a.length>=1,"isGlobList"),rB=class a{static{t(this,"Pattern")}#r;#n;#e;length;#t;#s;#p;#a;#_;#c;#l=!0;constructor(s,c,f,d){if(!gar(s))throw new TypeError("empty pattern list");if(!yar(c))throw new TypeError("empty glob list");if(c.length!==s.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=s.length,f<0||f>=this.length)throw new TypeError("index out of range");if(this.#r=s,this.#n=c,this.#e=f,this.#t=d,this.#e===0){if(this.isUNC()){let[v,E,A,O,...M]=this.#r,[H,$,K,Ne,...xe]=this.#n;M[0]===""&&(M.shift(),xe.shift());let Te=[v,E,A,O,""].join("/"),Tt=[H,$,K,Ne,""].join("/");this.#r=[Te,...M],this.#n=[Tt,...xe],this.length=this.#r.length}else if(this.isDrive()||this.isAbsolute()){let[v,...E]=this.#r,[A,...O]=this.#n;E[0]===""&&(E.shift(),O.shift());let M=v+"/",H=A+"/";this.#r=[M,...E],this.#n=[H,...O],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]===ry}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 bar=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",nB=class{static{t(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(s,{nobrace:c,nocase:f,noext:d,noglobstar:v,platform:E=bar}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=E,this.mmopts={dot:!0,nobrace:c,nocase:f,noext:d,noglobstar:v,optimizationLevel:2,platform:E,nocomment:!0,nonegate:!0};for(let A of s)this.add(A)}add(s){let c=new AS(s,this.mmopts);for(let f=0;f<c.set.length;f++){let d=c.set[f],v=c.globParts[f];if(!d||!v)throw new Error("invalid pattern object");for(;d[0]==="."&&v[0]===".";)d.shift(),v.shift();let E=new rB(d,v,0,this.platform),A=new AS(E.globString(),this.mmopts),O=v[v.length-1]==="**",M=E.isAbsolute();M?this.absolute.push(A):this.relative.push(A),O&&(M?this.absoluteChildren.push(A):this.relativeChildren.push(A))}}ignored(s){let c=s.fullpath(),f=`${c}/`,d=s.relative()||".",v=`${d}/`;for(let E of this.relative)if(E.match(d)||E.match(v))return!0;for(let E of this.absolute)if(E.match(c)||E.match(f))return!0;return!1}childrenIgnored(s){let c=s.fullpath()+"/",f=(s.relative()||".")+"/";for(let d of this.relativeChildren)if(d.match(f))return!0;for(let d of this.absoluteChildren)if(d.match(c))return!0;return!1}};var gNe=class a{static{t(this,"HasWalkedCache")}store;constructor(s=new Map){this.store=s}copy(){return new a(new Map(this.store))}hasWalked(s,c){return this.store.get(s.fullpath())?.has(c.globString())}storeWalked(s,c){let f=s.fullpath(),d=this.store.get(f);d?d.add(c.globString()):this.store.set(f,new Set([c.globString()]))}},yNe=class{static{t(this,"MatchRecord")}store=new Map;add(s,c,f){let d=(c?2:0)|(f?1:0),v=this.store.get(s);this.store.set(s,v===void 0?d:d&v)}entries(){return[...this.store.entries()].map(([s,c])=>[s,!!(c&2),!!(c&1)])}},vNe=class{static{t(this,"SubWalks")}store=new Map;add(s,c){if(!s.canReaddir())return;let f=this.store.get(s);f?f.find(d=>d.globString()===c.globString())||f.push(c):this.store.set(s,[c])}get(s){let c=this.store.get(s);if(!c)throw new Error("attempting to walk unknown path");return c}entries(){return this.keys().map(s=>[s,this.store.get(s)])}keys(){return[...this.store.keys()].filter(s=>s.canReaddir())}},DQ=class a{static{t(this,"Processor")}hasWalkedCache;matches=new yNe;subwalks=new vNe;patterns;follow;dot;opts;constructor(s,c){this.opts=s,this.follow=!!s.follow,this.dot=!!s.dot,this.hasWalkedCache=c?c.copy():new gNe}processPatterns(s,c){this.patterns=c;let f=c.map(d=>[s,d]);for(let[d,v]of f){this.hasWalkedCache.storeWalked(d,v);let E=v.root(),A=v.isAbsolute()&&this.opts.absolute!==!1;if(E){d=d.resolve(E==="/"&&this.opts.root!==void 0?this.opts.root:E);let $=v.rest();if($)v=$;else{this.matches.add(d,!0,!1);continue}}if(d.isENOENT())continue;let O,M,H=!1;for(;typeof(O=v.pattern())=="string"&&(M=v.rest());)d=d.resolve(O),v=M,H=!0;if(O=v.pattern(),M=v.rest(),H){if(this.hasWalkedCache.hasWalked(d,v))continue;this.hasWalkedCache.storeWalked(d,v)}if(typeof O=="string"){let $=O===".."||O===""||O===".";this.matches.add(d.resolve(O),A,$);continue}else if(O===ry){(!d.isSymbolicLink()||this.follow||v.checkFollowGlobstar())&&this.subwalks.add(d,v);let $=M?.pattern(),K=M?.rest();if(!M||($===""||$===".")&&!K)this.matches.add(d,A,$===""||$===".");else if($===".."){let Ne=d.parent||d;K?this.hasWalkedCache.hasWalked(Ne,K)||this.subwalks.add(Ne,K):this.matches.add(Ne,A,!0)}}else O instanceof RegExp&&this.subwalks.add(d,v)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new a(this.opts,this.hasWalkedCache)}filterEntries(s,c){let f=this.subwalks.get(s),d=this.child();for(let v of c)for(let E of f){let A=E.isAbsolute(),O=E.pattern(),M=E.rest();O===ry?d.testGlobstar(v,E,M,A):O instanceof RegExp?d.testRegExp(v,O,M,A):d.testString(v,O,M,A)}return d}testGlobstar(s,c,f,d){if((this.dot||!s.name.startsWith("."))&&(c.hasMore()||this.matches.add(s,d,!1),s.canReaddir()&&(this.follow||!s.isSymbolicLink()?this.subwalks.add(s,c):s.isSymbolicLink()&&(f&&c.checkFollowGlobstar()?this.subwalks.add(s,f):c.markFollowGlobstar()&&this.subwalks.add(s,c)))),f){let v=f.pattern();if(typeof v=="string"&&v!==".."&&v!==""&&v!==".")this.testString(s,v,f.rest(),d);else if(v===".."){let E=s.parent||s;this.subwalks.add(E,f)}else v instanceof RegExp&&this.testRegExp(s,v,f.rest(),d)}}testRegExp(s,c,f,d){c.test(s.name)&&(f?this.subwalks.add(s,f):this.matches.add(s,d,!1))}testString(s,c,f,d){s.isNamed(c)&&(f?this.subwalks.add(s,f):this.matches.add(s,d,!1))}};var Sar=t((a,s)=>typeof a=="string"?new nB([a],s):Array.isArray(a)?new nB(a,s):a,"makeIgnore"),cfe=class{static{t(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#r=[];#n;#e;signal;maxDepth;includeChildMatches;constructor(s,c,f){if(this.patterns=s,this.path=c,this.opts=f,this.#e=!f.posix&&f.platform==="win32"?"\\":"/",this.includeChildMatches=f.includeChildMatches!==!1,(f.ignore||!this.includeChildMatches)&&(this.#n=Sar(f.ignore??[],f),!this.includeChildMatches&&typeof this.#n.add!="function")){let d="cannot ignore child matches, ignore lacks add() method.";throw new Error(d)}this.maxDepth=f.maxDepth||1/0,f.signal&&(this.signal=f.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,c){if(c&&this.opts.nodir)return;let f;if(this.opts.realpath){if(f=s.realpathCached()||await s.realpath(),!f)return;s=f}let v=s.isUnknown()||this.opts.stat?await s.lstat():s;if(this.opts.follow&&this.opts.nodir&&v?.isSymbolicLink()){let E=await v.realpath();E&&(E.isUnknown()||this.opts.stat)&&await E.lstat()}return this.matchCheckTest(v,c)}matchCheckTest(s,c){return s&&(this.maxDepth===1/0||s.depth()<=this.maxDepth)&&(!c||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,c){if(c&&this.opts.nodir)return;let f;if(this.opts.realpath){if(f=s.realpathCached()||s.realpathSync(),!f)return;s=f}let v=s.isUnknown()||this.opts.stat?s.lstatSync():s;if(this.opts.follow&&this.opts.nodir&&v?.isSymbolicLink()){let E=v.realpathSync();E&&(E?.isUnknown()||this.opts.stat)&&E.lstatSync()}return this.matchCheckTest(v,c)}matchFinish(s,c){if(this.#t(s))return;if(!this.includeChildMatches&&this.#n?.add){let v=`${s.relativePosix()}/**`;this.#n.add(v)}let f=this.opts.absolute===void 0?c:this.opts.absolute;this.seen.add(s);let d=this.opts.mark&&s.isDirectory()?this.#e:"";if(this.opts.withFileTypes)this.matchEmit(s);else if(f){let v=this.opts.posix?s.fullpathPosix():s.fullpath();this.matchEmit(v+d)}else{let v=this.opts.posix?s.relativePosix():s.relative(),E=this.opts.dotRelative&&!v.startsWith(".."+this.#e)?"."+this.#e:"";this.matchEmit(v?E+v+d:"."+d)}}async match(s,c,f){let d=await this.matchCheck(s,f);d&&this.matchFinish(d,c)}matchSync(s,c,f){let d=this.matchCheckSync(s,f);d&&this.matchFinish(d,c)}walkCB(s,c,f){this.signal?.aborted&&f(),this.walkCB2(s,c,new DQ(this.opts),f)}walkCB2(s,c,f,d){if(this.#s(s))return d();if(this.signal?.aborted&&d(),this.paused){this.onResume(()=>this.walkCB2(s,c,f,d));return}f.processPatterns(s,c);let v=1,E=t(()=>{--v===0&&d()},"next");for(let[A,O,M]of f.matches.entries())this.#t(A)||(v++,this.match(A,O,M).then(()=>E()));for(let A of f.subwalkTargets()){if(this.maxDepth!==1/0&&A.depth()>=this.maxDepth)continue;v++;let O=A.readdirCached();A.calledReaddir()?this.walkCB3(A,O,f,E):A.readdirCB((M,H)=>this.walkCB3(A,H,f,E),!0)}E()}walkCB3(s,c,f,d){f=f.filterEntries(s,c);let v=1,E=t(()=>{--v===0&&d()},"next");for(let[A,O,M]of f.matches.entries())this.#t(A)||(v++,this.match(A,O,M).then(()=>E()));for(let[A,O]of f.subwalks.entries())v++,this.walkCB2(A,O,f.child(),E);E()}walkCBSync(s,c,f){this.signal?.aborted&&f(),this.walkCB2Sync(s,c,new DQ(this.opts),f)}walkCB2Sync(s,c,f,d){if(this.#s(s))return d();if(this.signal?.aborted&&d(),this.paused){this.onResume(()=>this.walkCB2Sync(s,c,f,d));return}f.processPatterns(s,c);let v=1,E=t(()=>{--v===0&&d()},"next");for(let[A,O,M]of f.matches.entries())this.#t(A)||this.matchSync(A,O,M);for(let A of f.subwalkTargets()){if(this.maxDepth!==1/0&&A.depth()>=this.maxDepth)continue;v++;let O=A.readdirSync();this.walkCB3Sync(A,O,f,E)}E()}walkCB3Sync(s,c,f,d){f=f.filterEntries(s,c);let v=1,E=t(()=>{--v===0&&d()},"next");for(let[A,O,M]of f.matches.entries())this.#t(A)||this.matchSync(A,O,M);for(let[A,O]of f.subwalks.entries())v++,this.walkCB2Sync(A,O,f.child(),E);E()}},AQ=class extends cfe{static{t(this,"GlobWalker")}matches=new Set;constructor(s,c,f){super(s,c,f)}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,c)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?c(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}},kQ=class extends cfe{static{t(this,"GlobStream")}results;constructor(s,c,f){super(s,c,f),this.results=new vN({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 Car=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",xx=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,c){if(!c)throw new TypeError("glob options required");if(this.withFileTypes=!!c.withFileTypes,this.signal=c.signal,this.follow=!!c.follow,this.dot=!!c.dot,this.dotRelative=!!c.dotRelative,this.nodir=!!c.nodir,this.mark=!!c.mark,c.cwd?(c.cwd instanceof URL||c.cwd.startsWith("file://"))&&(c.cwd=Tar(c.cwd)):this.cwd="",this.cwd=c.cwd||"",this.root=c.root,this.magicalBraces=!!c.magicalBraces,this.nobrace=!!c.nobrace,this.noext=!!c.noext,this.realpath=!!c.realpath,this.absolute=c.absolute,this.includeChildMatches=c.includeChildMatches!==!1,this.noglobstar=!!c.noglobstar,this.matchBase=!!c.matchBase,this.maxDepth=typeof c.maxDepth=="number"?c.maxDepth:1/0,this.stat=!!c.stat,this.ignore=c.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof s=="string"&&(s=[s]),this.windowsPathsNoEscape=!!c.windowsPathsNoEscape||c.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(s=s.map(O=>O.replace(/\\/g,"/"))),this.matchBase){if(c.noglobstar)throw new TypeError("base matching requires globstar");s=s.map(O=>O.includes("/")?O:`./**/${O}`)}if(this.pattern=s,this.platform=c.platform||Car,this.opts={...c,platform:this.platform},c.scurry){if(this.scurry=c.scurry,c.nocase!==void 0&&c.nocase!==c.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let O=c.platform==="win32"?eB:c.platform==="darwin"?xQ:c.platform?tB:gft;this.scurry=new O(this.cwd,{nocase:c.nocase,fs:c.fs})}this.nocase=this.scurry.nocase;let f=this.platform==="darwin"||this.platform==="win32",d={...c,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:f,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},v=this.pattern.map(O=>new AS(O,d)),[E,A]=v.reduce((O,M)=>(O[0].push(...M.set),O[1].push(...M.globParts),O),[[],[]]);this.patterns=E.map((O,M)=>{let H=A[M];if(!H)throw new Error("invalid pattern object");return new rB(O,H,0,this.platform)})}async walk(){return[...await new AQ(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 AQ(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 kQ(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 kQ(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 bNe=t((a,s={})=>{Array.isArray(a)||(a=[a]);for(let c of a)if(new AS(c,s).hasMagic())return!0;return!1},"hasMagic");function lfe(a,s={}){return new xx(a,s).streamSync()}t(lfe,"globStreamSync");function vft(a,s={}){return new xx(a,s).stream()}t(vft,"globStream");function bft(a,s={}){return new xx(a,s).walkSync()}t(bft,"globSync");async function yft(a,s={}){return new xx(a,s).walk()}t(yft,"glob_");function ufe(a,s={}){return new xx(a,s).iterateSync()}t(ufe,"globIterateSync");function Sft(a,s={}){return new xx(a,s).iterate()}t(Sft,"globIterate");var Ear=lfe,xar=Object.assign(vft,{sync:lfe}),Dar=ufe,Aar=Object.assign(Sft,{sync:ufe}),kar=Object.assign(bft,{stream:lfe,iterate:ufe}),wQ=Object.assign(yft,{glob:yft,globSync:bft,sync:kar,globStream:vft,stream:xar,globStreamSync:lfe,streamSync:Ear,globIterate:Sft,iterate:Aar,globIterateSync:ufe,iterateSync:Dar,Glob:xx,hasMagic:bNe,escape:Qj,unescape:Tx});wQ.glob=wQ;import Bde from"fs";import nRe from"path";var xv=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 war="[",Par="]",Nar="{",Iar="}",Oar=":",Far=",",Lar="true",Rar="false",Mar="null",jar="NaN",Bar="Infinity",TNe='"',PQ=new Map([[34,TNe],[92,"\\"],[47,"/"],[98,"\b"],[110,`
576
576
  `],[102,"\f"],[114,"\r"],[116," "]]),pfe=new Map([...PQ,[118,"\v"],[48,"\0"]]),Uar=new Map([[TNe,TNe],["\\","\\"],["/","/"],["\b","b"],[`
577
577
  `,"n"],["\f","f"],["\r","r"],[" ","t"]]),zRr=new Map([...Uar,["\v","v"],["\0","0"],["\u2028","u2028"],["\u2029","u2029"]]),_fe=new Map([[war,"LBracket"],[Par,"RBracket"],[Nar,"LBrace"],[Iar,"RBrace"],[Oar,"Colon"],[Far,"Comma"],[Lar,"Boolean"],[Rar,"Boolean"],[Mar,"Null"]]),ffe=new Map([..._fe,[jar,"Number"],[Bar,"Number"]]),CNe=new Set([10,13,8232,8233]),i6=class extends Error{static{t(this,"ErrorWithLocation")}constructor(s,{line:c,column:f,offset:d}){super(`${s} (${c}:${f})`),this.line=c,this.column=f,this.offset=d}},ENe=class extends i6{static{t(this,"UnexpectedChar")}constructor(s,c){super(`Unexpected character '${String.fromCharCode(s)}' found.`,c)}},xNe=class extends i6{static{t(this,"UnexpectedIdentifier")}constructor(s,c){super(`Unexpected identifier '${s}' found.`,c)}},WF=class extends i6{static{t(this,"UnexpectedToken")}constructor(s){super(`Unexpected token ${s.type} found.`,s.loc.start)}},dfe=class extends i6{static{t(this,"UnexpectedEOF")}constructor(s){super("Unexpected end of input found.",s)}},$ar=/[\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]/,Jar=/[\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]/,zar=13,Tft=10,DNe=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===zar?(this.#s=!0,this.peek()===Tft&&this.#t++):s===Tft&&(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}},qar="Infinity",Var="NaN",War=new Set([116,102,110]),ANe=new Set([32,9,10,13]),Cft=new Set([...ANe,11,12,160,8232,8233,65279,160,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288]),Har={mode:"json",ranges:!1},Gar=new Set(["true","false","null"]),H_={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 n6(a){return a>=48&&a<=57}t(n6,"isDigit");function SNe(a){return n6(a)||a>=65&&a<=70||a>=97&&a<=102}t(SNe,"isHexDigit");function Qar(a){return a>=49&&a<=57}t(Qar,"isPositiveDigit");function Kar(a){return War.has(a)}t(Kar,"isKeywordStart");function xft(a){return n6(a)||a===46||a===45}t(xft,"isNumberStart");function Yar(a){return xft(a)||a===43}t(Yar,"isJSON5NumberStart");function Eft(a,s){return a===34||s&&a===39}t(Eft,"isStringStart");function Dft(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 $ar.test(s)}t(Dft,"isJSON5IdentifierStart");function Xar(a){if(Dft(a)||n6(a))return!0;let s=String.fromCharCode(a);return Jar.test(s)}t(Xar,"isJSON5IdentifierPart");var kNe=class{static{t(this,"Tokenizer")}#r;#n;#e;#t;#s;#p;#a;#_;#c;#l;#i;constructor(s,c){this.#n=s,this.#r={...Har,...c},this.#e=new DNe(s),this.#t=this.#r.mode==="json5",this.#s=this.#r.mode!=="json",this.#p=this.#r.ranges,this.#_=this.#t?pfe.has.bind(pfe):PQ.has.bind(PQ),this.#c=this.#t?CNe.has.bind(CNe):()=>!1,this.#l=this.#t?f=>f===120:()=>!1,this.#i=this.#t?Cft.has.bind(Cft):ANe.has.bind(ANe)}#f(s,c=this.#e.locate()){throw new ENe(s,c)}#v(s,c=this.#e.locate()){throw new xNe(s,c)}#d(){throw new dfe(this.#e.locate())}#u(s,c,f,d){let v=f.offset+c,E=this.#r.ranges?{range:[f.offset,v]}:void 0;return{type:s,loc:{start:f,end:d||{line:f.line,column:f.column+c,offset:v}},...E}}#m(s){let c="",f;for(let d=0;d<s;d++){if(f=this.#e.peek(),SNe(f)){this.#e.next(),c+=String.fromCharCode(f);continue}this.#f(f)}return c}#g(s){let c="";do{if(c+=String.fromCharCode(s),s===92&&(s=this.#e.next(),s!==117&&this.#f(s),c+=String.fromCharCode(s),c+=this.#m(4)),s=this.#e.peek(),!Xar(s))break;this.#e.next()}while(!0);return c}#x(s){let c=s,f=1;for(s=this.#e.peek();s!==-1&&s!==c;){if(this.#e.next(),f++,s===92)if(s=this.#e.peek(),this.#_(s)||this.#c(s))this.#e.next(),f++;else if(s===117){this.#e.next(),f++;let d=this.#m(4);f+=d.length}else if(this.#l(s)){this.#e.next(),f++;let d=this.#m(2);f+=d.length}else this.#t?(this.#e.next(),f++):this.#f(s);s=this.#e.peek()}return s===-1&&(this.#e.next(),this.#d()),this.#e.next(),f++,f}#C(s){let c=1;if(s===45||this.#t&&s===43){if(s=this.#e.peek(),this.#t&&(s===73||s===78)){this.#e.next();let f=this.#g(s);return f!==qar&&f!==Var&&this.#f(s),c+f.length}n6(s)||this.#f(s),this.#e.next(),c++}if(s===48)if(s=this.#e.peek(),this.#t&&(s===120||s===88)){this.#e.next(),c++,s=this.#e.peek(),SNe(s)||(this.#e.next(),this.#f(s));do this.#e.next(),c++,s=this.#e.peek();while(SNe(s))}else n6(s)&&this.#f(s);else if(!this.#t||s!==46)for(Qar(s)||this.#f(s),s=this.#e.peek();n6(s);)this.#e.next(),c++,s=this.#e.peek();if(s===46){let f=-1;for(this.#e.next(),c++,f++,s=this.#e.peek();n6(s);)this.#e.next(),c++,f++,s=this.#e.peek();!this.#t&&f===0&&(this.#e.next(),s?this.#f(s):this.#d())}if(s===101||s===69)for(this.#e.next(),c++,s=this.#e.peek(),(s===43||s===45)&&(this.#e.next(),c++,s=this.#e.peek()),s===-1&&(this.#e.next(),this.#d()),n6(s)||(this.#e.next(),this.#f(s));n6(s);)this.#e.next(),c++,s=this.#e.peek();return c}#b(s){let c=1;if(s=this.#e.peek(),s===47){do this.#e.next(),c+=1,s=this.#e.peek();while(s>-1&&s!==13&&s!==10);return{length:c,multiline:!1}}if(s===42){for(this.#e.next(),c+=1;s>-1;)if(s=this.#e.peek(),s===42){if(this.#e.next(),c+=1,s=this.#e.peek(),s===47)return this.#e.next(),c+=1,{length:c,multiline:!0}}else this.#e.next(),c+=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 H_.EOF;let c=this.#e.locate(),f=String.fromCharCode(s);if(this.#t)if(ffe.has(f))this.#a=this.#u(ffe.get(f),1,c);else if(Dft(s)){let d=this.#g(s);ffe.has(d)?this.#a=this.#u(ffe.get(d),d.length,c):this.#a=this.#u("Identifier",d.length,c)}else if(Yar(s)){let d=this.#C(s);this.#a=this.#u("Number",d,c)}else if(Eft(s,this.#t)){let d=this.#x(s),v=this.#e.locate();this.#a=this.#u("String",d,c,{line:v.line,column:v.column+1,offset:v.offset+1})}else if(s===47&&this.#s){let d=this.#b(s),v=this.#e.locate();this.#a=this.#u(d.multiline?"BlockComment":"LineComment",d.length,c,{line:v.line,column:v.column+1,offset:v.offset+1})}else this.#f(s);else if(_fe.has(f))this.#a=this.#u(_fe.get(f),1,c);else if(Kar(s)){let d=this.#g(s);Gar.has(d)||this.#v(d,c),this.#a=this.#u(_fe.get(d),d.length,c)}else if(xft(s)){let d=this.#C(s);this.#a=this.#u("Number",d,c)}else if(Eft(s,this.#t)){let d=this.#x(s);this.#a=this.#u("String",d,c)}else if(s===47&&this.#s){let d=this.#b(s),v=this.#e.locate();this.#a=this.#u(d.multiline?"BlockComment":"LineComment",d.length,c,{line:v.line,column:v.column+1,offset:v.offset+1})}else this.#f(s);return H_[this.#a.type]}get token(){return this.#a}};var hC={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,c={}){return{type:"Member",name:a,value:s,loc:c.loc,...c}},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}}},Zar={mode:"json",ranges:!1,tokens:!1,allowTrailingCommas:!1};function eor(a,s,c=!1){let f="",d=a.indexOf("\\"),v=0;for(;d>=0;){f+=a.slice(v,d);let E=a.charAt(d+1),A=E.charCodeAt(0);if(c&&pfe.has(A))f+=pfe.get(A),v=d+2;else if(PQ.has(A))f+=PQ.get(A),v=d+2;else if(E==="u"){let O=a.slice(d+2,d+6);if(O.length<4||/[^0-9a-f]/i.test(O))throw new i6(`Invalid unicode escape \\u${O}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});f+=String.fromCharCode(parseInt(O,16)),v=d+6}else if(c&&E==="x"){let O=a.slice(d+2,d+4);if(O.length<2||/[^0-9a-f]/i.test(O))throw new i6(`Invalid hex escape \\x${O}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});f+=String.fromCharCode(parseInt(O,16)),v=d+4}else if(c&&CNe.has(A))v=d+2,E==="\r"&&a.charAt(v)===`
578
- `&&v++;else if(c)f+=E,v=d+2;else throw new i6(`Invalid escape \\${E}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});d=a.indexOf("\\",v)}return f+=a.slice(v),f}t(eor,"getStringValue");function tor(a,s,c=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return eor(a.slice(1,-1),s,c);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(tor,"getLiteralValue");function Aft(a,s){s=Object.freeze({...Zar,...s});let c=[],f=new kNe(a,{mode:s.mode,ranges:s.ranges}),d=s.mode==="json5",v=s.allowTrailingCommas||d;function E(){let pr=f.next();return pr&&s.tokens&&c.push(f.token),pr}t(E,"nextNoComments");function A(){let pr=f.next();return pr&&s.tokens&&c.push(f.token),pr>=H_.LineComment?A():pr}t(A,"nextSkipComments");let O=s.mode==="json"?E:A;function M(pr,sr){if(pr!==sr)throw new WF(f.token)}t(M,"assertTokenType");function H(pr,sr){if(!sr.includes(pr))throw new WF(f.token)}t(H,"assertTokenTypes");function $(pr,sr){return s.ranges?{range:[pr.offset,sr.offset]}:void 0}t($,"createRange");function K(pr){let sr=f.token,Cs=$(sr.loc.start,sr.loc.end),Di=tor(a.slice(sr.loc.start.offset,sr.loc.end.offset),sr,d),hi={loc:{start:{...sr.loc.start},end:{...sr.loc.end}},...Cs};switch(pr){case H_.String:return hC.string(Di,hi);case H_.Number:return hC.number(Di,hi);case H_.Boolean:return hC.boolean(Di,hi);default:throw new TypeError(`Unknown token type ${sr.type}.`)}}t(K,"createLiteralNode");function Ne(pr){let sr=$(pr.loc.start,pr.loc.end),Cs=a.slice(pr.loc.start.offset,pr.loc.end.offset),_o={loc:{start:{...pr.loc.start},end:{...pr.loc.end}},...sr};if(pr.type!=="Identifier"){let hi="";return(Cs[0]==="+"||Cs[0]==="-")&&(hi=Cs[0]),hC[Cs.includes("NaN")?"nan":"infinity"](hi,_o)}return hC.identifier(Cs,_o)}t(Ne,"createJSON5IdentifierNode");function xe(pr){let sr=$(pr.loc.start,pr.loc.end);return hC.null({loc:{start:{...pr.loc.start},end:{...pr.loc.end}},...sr})}t(xe,"createNullNode");function Te(pr){d?H(pr,[H_.String,H_.Identifier,H_.Number]):M(pr,H_.String);let sr=f.token,Cs=pr===H_.String?K(pr):Ne(sr);if(d&&(Cs.type==="NaN"||Cs.type==="Infinity")){if(Cs.sign!=="")throw new WF(f.token);Cs=hC.identifier(Cs.type,{loc:Cs.loc,...$(Cs.loc.start,Cs.loc.end)})}pr=O(),M(pr,H_.Colon);let Di=br(),_o=$(Cs.loc.start,Di.loc.end);return hC.member(Cs,Di,{loc:{start:{...Cs.loc.start},end:{...Di.loc.end}},..._o})}t(Te,"parseProperty");function Tt(pr){M(pr,H_.LBrace);let sr=f.token,Cs=[],Di=O();if(Di!==H_.RBrace)do{if(Cs.push(Te(Di)),Di=O(),!Di)throw new dfe(Cs[Cs.length-1].loc.end);if(Di===H_.Comma){if(Di=O(),v&&Di===H_.RBrace)break}else break}while(Di);M(Di,H_.RBrace);let _o=f.token,hi=$(sr.loc.start,_o.loc.end);return hC.object(Cs,{loc:{start:{...sr.loc.start},end:{..._o.loc.end}},...hi})}t(Tt,"parseObject");function Dt(pr){M(pr,H_.LBracket);let sr=f.token,Cs=[],Di=O();if(Di!==H_.RBracket)do{let No=br(Di);if(Cs.push(hC.element(No,{loc:No.loc})),Di=O(),Di===H_.Comma){if(Di=O(),v&&Di===H_.RBracket)break}else break}while(Di);M(Di,H_.RBracket);let _o=f.token,hi=$(sr.loc.start,_o.loc.end);return hC.array(Cs,{loc:{start:{...sr.loc.start},end:{..._o.loc.end}},...hi})}t(Dt,"parseArray");function br(pr){pr=pr??O();let sr=f.token;switch(pr){case H_.String:case H_.Boolean:return K(pr);case H_.Number:if(d){let Cs=a.slice(sr.loc.start.offset,sr.loc.end.offset);if((Cs[0]==="+"||Cs[0]==="-")&&(Cs=Cs.slice(1)),Cs==="NaN"||Cs==="Infinity")return Ne(sr)}return K(pr);case H_.Null:return xe(sr);case H_.LBrace:return Tt(pr);case H_.LBracket:return Dt(pr);default:throw new WF(sr)}}t(br,"parseValue");let dr=br();if(O())throw new WF(f.token);let Cr={loc:{start:{line:1,column:1,offset:0},end:{...dr.loc.end}}};return s.tokens&&(Cr.tokens=c),s.ranges&&(Cr.range=[Cr.loc.start.offset,Cr.loc.end.offset]),hC.document(dr,Cr)}t(Aft,"parse");var ror=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function kft(a){return a&&typeof a=="object"}t(kft,"isObject");function nor(a){return kft(a)&&typeof a.type=="string"}t(nor,"isNode");function ior(a,s){function c(f,d){typeof s.enter=="function"&&s.enter(f,d);for(let v of ror.get(f.type)){let E=f[v];kft(E)&&(Array.isArray(E)?E.forEach(A=>c(A,f)):nor(E)&&c(E,f))}typeof s.exit=="function"&&s.exit(f,d)}t(c,"visitNode"),c(a)}t(ior,"traverse");function wft(a,s=()=>!0){let c=[];return ior(a,{enter(f,d){c.push({node:f,parent:d,phase:"enter"})},exit(f,d){c.push({node:f,parent:d,phase:"exit"})}}),c.filter(s).values()}t(wft,"iterator");import sor from"fs/promises";var NQ=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),mfe=t(async a=>{try{return await sor.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),IQ=t(async a=>{try{return Aft(a)}catch(s){if(s.column&&s.line&&s.message){let c=NQ(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:c}}return}},"getSchemaAST");var Pft=t(async(a,s,c)=>{try{if(a.length===0)return;for(let f of a){let d=await mfe(f),v=await aor(d,f,s,c);if(v)return v}}catch{}},"getRouteLocationByValue"),aor=t(async(a,s,c,f)=>{try{if(!a)return;let d=null,v=await IQ(a);if(v){for(let{node:E}of wft(v))if(E.value&&E.value===c){d=E.loc;break}if(d!==null){let E=NQ(a,d.start.line);return{file:s,line:d.start.line,column:d.start.column,length:d.end.column-d.start.column,lineText:E,suggestion:f}}}}catch{}},"getRouteLocationByValueFromSchema");import Nft from"fs/promises";import hfe from"path";var wNe="schemas",PNe=".oas.json";var HF=t(async a=>(await Nft.readdir(a)).map(c=>`${a}/${c}`).filter(c=>c.endsWith(PNe)).sort(),"getOpenApiFilesByAlphabetical"),iB=t(async a=>{let s=hfe.resolve(a,"config");return(await Nft.readdir(s)).filter(f=>f.endsWith(PNe)).length>=1},"oasFileInProject");function OQ(a,s,c,f,d,v,E){if(v.has(c))return;let A;try{A=f.get(c)}catch(O){throw new Tv({text:`Failed to resolve reference: ${c}`,detail:O.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:c,namespace:s,suggestion:"Check the reference and try again."}})}v.set(c,d.length),d.push(c),NNe(INe(c),s,A,f,d,v,E)}t(OQ,"chaseRefs");function NNe(a,s,c,f,d,v,E){if(Array.isArray(c))for(let A of c)NNe(a,s,A,f,d,v,E);else if(typeof c=="object")for(let A in c){if(A==="$ref"){let O=c[A];E&&(c[A]=E(s,O)),OQ(a,s,bN(a,O),f,d,v,E)}NNe(a,s,c[A],f,d,v,E)}}t(NNe,"lookForRefs");function bN(a,s){let c=s.indexOf("#");return c>=0?`${hfe.resolve(a,s.substring(0,c))}${s.substring(c)}`:hfe.resolve(hfe.dirname(a),s)}t(bN,"getFullyQualifiedRefName");function INe(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(INe,"getFilePathNameFromRefName");var ONe=class{static{t(this,"Environment")}get ZUP_HOSTNAME(){return process.env.ZUP_HOSTNAME??"zuplo.app"}get ZUP_WORKING_COPY_HOSTNAME(){return process.env.ZUP_WORKING_COPY_HOSTNAME??"working-copy.zuplotest.com"}},oor=new ONe,FNe=oor;var KQ=jp(QIe(),1);var YIe={};Nlt(YIe,{UnsafePathError:()=>zfe,deleteFolder:()=>i_r,dirExists:()=>KIe,fileExists:()=>Gfr,getParentDirFilename:()=>t_r,isNotFileOrDirectory:()=>Kfr,listFolderContents:()=>sdt,listFolders:()=>Xfr,mkDirTemp:()=>Qfr,mkdirForFilePathIfNotExits:()=>Zfr,mkdirIfNotExists:()=>adt,safePath:()=>e_r,tarFolder:()=>r_r,untarFile:()=>n_r});import{spawn as ndt}from"child_process";import{randomUUID as Wfr}from"crypto";import kN from"fs/promises";import{tmpdir as Hfr}from"os";import AN from"path";var idt=[".git","node_modules",".yarn",".DS_Store"];async function Gfr(a){try{return(await kN.stat(a)).isFile()}catch{return!1}}t(Gfr,"fileExists");async function Qfr(){let a=Hfr(),s=Wfr().replaceAll("-",""),c=AN.join(a,s);return await kN.mkdir(c,{recursive:!0}),c}t(Qfr,"mkDirTemp");async function KIe(a){try{return(await kN.stat(a)).isDirectory()}catch{return!1}}t(KIe,"dirExists");async function Kfr(a){try{return await kN.stat(a),!1}catch{return!0}}t(Kfr,"isNotFileOrDirectory");function Yfr(a,s){let c=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),f=a.match(c);if(!f)return"";let d=a.split(f[0]);return d[1]===""?"":`/${d[1]}`}t(Yfr,"getParentDirectory");async function Xfr(a){if(!await KIe(a))return[];let s=await kN.readdir(a,{withFileTypes:!0}),c=[];for await(let f of s)idt.includes(f.name)||f.isDirectory()&&c.push(f.name);return c}t(Xfr,"listFolders");async function sdt(a,s,c=!0){let f=Yfr(a,s),d=await kN.readdir(a,{withFileTypes:!0}),v=[];for await(let E of d)if(!idt.includes(E.name)||!c)if(E.isDirectory()){let A=await sdt(AN.join(a,E.name),s,c);v.push(...A)}else v.push(AN.join(f,E.name));return v}t(sdt,"listFolderContents");var adt=t(async a=>{await kN.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),Zfr=t(async a=>{let s=AN.dirname(a);return adt(s)},"mkdirForFilePathIfNotExits"),zfe=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function e_r(a){let s=t(c=>{if(!c.startsWith(a))throw new zfe("Resolved path is not part of the project.");return c},"ensureSafePath");return{resolve:t((...c)=>s(AN.resolve(...c)),"resolve")}}t(e_r,"safePath");function t_r(a){return`${AN.basename(AN.dirname(a))}/${AN.basename(a)}`}t(t_r,"getParentDirFilename");async function r_r({folderPath:a,outputTarPath:s,exclude:c=["node_modules",".git","dist"]}){return new Promise((f,d)=>{let v=ndt("tar",[...c.map(E=>["--exclude",E]).flat(),"-cvf",s,"-C",a,"."]);process.env.DEBUG_TAR&&(v.stdout.on("data",E=>{let A=E.toString().trim();A.length>0&&console.info(A)}),v.stderr.on("data",E=>{let A=E.toString().trim();A.length>0&&console.error(A)})),v.on("close",E=>{E===0?f(`Folder archived to ${s}`):d(new Error(`tar process exited with code ${E}`))}),v.on("error",E=>{d(E)})})}t(r_r,"tarFolder");async function n_r({tarFilePath:a,outputDir:s}){return new Promise((c,f)=>{let d=ndt("tar",["-xvf",a,"-C",s]);process.env.DEBUG_TAR&&(d.stdout.on("data",v=>{let E=v.toString().trim();E.length>0&&console.info(E)}),d.stderr.on("data",v=>{let E=v.toString().trim();E.length>0&&console.error(E)})),d.on("close",v=>{v===0?c("Extraction completed."):f(new Error(`tar process exited with code ${v}`))}),d.on("error",v=>{f(v)})})}t(n_r,"untarFile");async function i_r(a){if(await KIe(a))return await kN.rm(a,{recursive:!0})}t(i_r,"deleteFolder");var Ml=YIe;var bC=jp(QIe(),1);import{readFile as s_r}from"fs/promises";var r7=class extends Error{static{t(this,"CustomResolveError")}},wN=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,c){this.sourceDirectory=s,this.logger=c}dereference(s,c){return KQ.$RefParser.dereference(s,{resolve:{json:!0,file:qfe(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:c?.onDereference}})}bundle(s){return KQ.$RefParser.bundle(s,{resolve:{file:qfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return KQ.$RefParser.parse(s,{resolve:{file:qfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return KQ.$RefParser.resolve(s,{resolve:{file:qfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function qfe(a,s){return{order:100,canRead(c){let f=c_r(c.url);if(!(f===void 0||f==="file"))return!1;let v;try{v=odt(c.url)}catch(E){throw new r7(`Malformed URI: ${c.url}`,{cause:E})}try{Ml.safePath(a).resolve(v)}catch(E){return s?.warn(E),!1}return!0},async read(c){let f;try{f=odt(c.url)}catch(d){throw new r7(`Malformed URI: ${c.url}`,{cause:d})}try{return await s_r(f)}catch(d){throw new r7(`Error opening file "${f}"`,{cause:d})}}}}t(qfe,"customResolver");var XIe=/^win/.test(globalThis.process?globalThis.process.platform:""),a_r=/\//g,o_r=/^(\w{2,}):\/\//i,ZIe=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function c_r(a){let s=o_r.exec(a);if(s)return s[1].toLowerCase()}t(c_r,"getProtocol");function odt(a,s){a=decodeURI(a);for(let f=0;f<ZIe.length;f+=2)a=a.replace(ZIe[f],ZIe[f+1]);let c=a.substr(0,7).toLowerCase()==="file://";return c&&(a=a[7]==="/"?a.substr(8):a.substr(7),XIe&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(c=!1,a=XIe?a:"/"+a)),XIe&&!c&&(a=a.replace(a_r,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(odt,"toFileSystemPath");var cdt="YOUR_KEY_HERE";async function ldt(a){let c=await new wN(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),f=a.openApiDocPath.replace(a.sourceDirectory,"");return l_r({...a,relativeOpenApiPath:f},c)}t(ldt,"buildPublicOpenApiFile");async function l_r(a,s){p_r({relativeOpenApiPath:a.relativeOpenApiPath},s);let c=s;return c=f_r(c),u_r(c,a),c=__r(c,a),udt(c,"x-zuplo"),c}t(l_r,"buildRawOpenApiFile");function u_r(a,{deploymentUrl:s,deploymentName:c,environmentType:f}){let d;s?d=s.hostname:f&&c&&(d=f===Flt.WORKING_COPY?`${c}.${FNe.ZUP_WORKING_COPY_HOSTNAME}`:`${c}.${FNe.ZUP_HOSTNAME}`),d?a.servers=[{url:`https://${d}`}]:a.servers=void 0}t(u_r,"addServerHost");function f_r(a){if(!a.paths)return a;let{components:s}=a,c=s?{...s}:void 0,f=[];c&&c.parameters&&(f=Object.entries(c.parameters).reduce((v,[E,A])=>(qj in A&&Mue(A[qj])&&(v.push(E),c.parameters&&delete c.parameters[E]),v),[]));let d=Object.entries(a.paths).reduce((v,[E,A])=>{if(!A)return v;let O={...A},M=["delete","get","head","patch","post","put","trace","options"];return M.forEach(H=>{let $=A[H];if(!$)return;if(Mue($[qj])){delete O[H];return}let{parameters:K}=$;if(!K)return;let Ne=K.filter(xe=>{if(qj in xe&&Mue(xe[qj]))return!1;if("$ref"in xe){let Te=xe.$ref.split("/").pop();return Te?!f.includes(Te):!0}return!0});O[H]={...$,parameters:Ne}}),M.some(H=>!!O[H])&&(v[E]=O),v},{});return{...a,paths:d,components:c}}t(f_r,"removeHiddenRoutesAndParams");function __r(a,{policiesConfig:s}){if(!a.paths)return a;let c=Object.entries(a.paths).reduce((f,[d,v])=>{if(!v)return f;let E={...v};return[E.delete,E.get,E.head,E.patch,E.post,E.put,E.trace,E.options].forEach(A=>{if(!A)return;let O=A["x-zuplo-route"]?.policies?.inbound?.reduce(($,K)=>{let Ne=s.policies?.find(({name:Tt})=>Tt===K);if(!Ne)return $;if(!(Ne.handler.export==="CompositeInboundPolicy"))return $.concat(K);let Te=Ne.handler.options?.policies;return Te?$.concat(Te):$},[]),M=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="ApiAuthKeyInboundPolicy"||K.handler.export==="ApiKeyInboundPolicy")&&!K.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&M.push(K)})}),M.length>0){let $=M.length>0&&M[0].handler&&M[0].handler.options&&M[0].handler.options.authHeader?M[0].handler.options.authHeader:"Authorization",K=M.length>0&&M[0].handler&&M[0].handler.options&&(M[0].handler.options.authScheme||M[0].handler.options.authScheme==="")?M[0].handler.options.authScheme:"Bearer",Ne=K!==""?`${K} ${cdt}`:cdt,xe={name:$,in:"header",required:!0,example:Ne,schema:{type:"string"},description:`The \`${$}\` header is used to authenticate with the API using your API key. Value is of the format \`${Ne}\`.`};A.parameters?A.parameters.some(br=>"name"in br&&br.name===xe.name)||A.parameters.unshift(xe):A.parameters=[xe];let Te={type:"http",scheme:K.toLowerCase()},Tt="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===K)||(a.components.securitySchemes={...a.components.securitySchemes,[Tt]:Te}):(a.components||(a.components={}),a.components.securitySchemes={[Tt]:Te});let Dt={[Tt]:[]};A.security?A.security.some(br=>br[Tt]!==void 0)||A.security.unshift(Dt):A.security=[Dt]}let H=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="RateLimitInboundPolicy"||K.handler.export==="ComplexRateLimitInboundPolicy")&&H.push(K)})}),H.length>0){let $={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"}}}}}},K={...$,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:$,RateLimitWithRetryAfter:K},A.responses||(A.responses={});let Ne=H.some(xe=>xe.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Ne?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),f[d]=E,f},{});return{...a,paths:c}}t(__r,"enrichSpecWithZuploData");function udt(a,s){for(let c in a)c.startsWith(s)?delete a[c]:typeof a[c]=="object"&&udt(a[c],s)}t(udt,"removePropertiesByPrefix");function p_r({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new Tv({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new Tv({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 Tv({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(p_r,"assertIsZuploOpenApiSpec");function d_r(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let M=0;M<s.length;M++)s[M]=255;for(let M=0;M<a.length;M++){let H=a.charAt(M),$=H.charCodeAt(0);if(s[$]!==255)throw new TypeError(H+" is ambiguous");s[$]=M}let c=a.length,f=a.charAt(0),d=Math.log(c)/Math.log(256),v=Math.log(256)/Math.log(c);function E(M){if(M instanceof Uint8Array||(ArrayBuffer.isView(M)?M=new Uint8Array(M.buffer,M.byteOffset,M.byteLength):Array.isArray(M)&&(M=Uint8Array.from(M))),!(M instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(M.length===0)return"";let H=0,$=0,K=0,Ne=M.length;for(;K!==Ne&&M[K]===0;)K++,H++;let xe=(Ne-K)*v+1>>>0,Te=new Uint8Array(xe);for(;K!==Ne;){let br=M[K],dr=0;for(let jr=xe-1;(br!==0||dr<$)&&jr!==-1;jr--,dr++)br+=256*Te[jr]>>>0,Te[jr]=br%c>>>0,br=br/c>>>0;if(br!==0)throw new Error("Non-zero carry");$=dr,K++}let Tt=xe-$;for(;Tt!==xe&&Te[Tt]===0;)Tt++;let Dt=f.repeat(H);for(;Tt<xe;++Tt)Dt+=a.charAt(Te[Tt]);return Dt}t(E,"encode");function A(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return new Uint8Array;let H=0,$=0,K=0;for(;M[H]===f;)$++,H++;let Ne=(M.length-H)*d+1>>>0,xe=new Uint8Array(Ne);for(;M[H];){let br=s[M.charCodeAt(H)];if(br===255)return;let dr=0;for(let jr=Ne-1;(br!==0||dr<K)&&jr!==-1;jr--,dr++)br+=c*xe[jr]>>>0,xe[jr]=br%256>>>0,br=br/256>>>0;if(br!==0)throw new Error("Non-zero carry");K=dr,H++}let Te=Ne-K;for(;Te!==Ne&&xe[Te]===0;)Te++;let Tt=new Uint8Array($+(Ne-Te)),Dt=$;for(;Te!==Ne;)Tt[Dt++]=xe[Te++];return Tt}t(A,"decodeUnsafe");function O(M){let H=A(M);if(H)return H;throw new Error("Non-base"+c+" character")}return t(O,"decode"),{encode:E,decodeUnsafe:A,decode:O}}t(d_r,"base");var fdt=d_r;var m_r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Vfe=fdt(m_r);var e8e="2024-09-02",_dt=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 pdt(){return new SC({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:e8e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:_dt[e8e]},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(pdt,"getMockEnvironment");var SC=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=pdt()),this.#r}constructor({build:s,runtime:c}){let f;try{if(c.__ZUPLO_CONFIG){let d=atob(c.__ZUPLO_CONFIG);f=JSON.parse(d)}if(c.ZUPLO_SYSTEM_CONFIGURATIONS){let d=new TextDecoder().decode(Vfe.decode(c.ZUPLO_SYSTEM_CONFIGURATIONS)),v=JSON.parse(d);for(let E of Object.keys(v))c[E]||(c[E]=v[E])}}catch(d){console.error("Failed to parse runtime configuration",d)}this.config=f??{},this.build=s,this.runtime=c,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 zudokuHostUrl(){return this.runtime.__ZUPLO_ZUDOKU_HOST_URL??this.config.zudoku_host_url??"https://zudoku.zuploedge.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 h_r=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function ddt(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!h_r.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(ddt,"isRestrictedEnvVariableName");function mdt(a){return!!a.startsWith("ZUPLO_")}t(mdt,"isZuploReadableEnvVariableName");var MBr=new Proxy({},{get(a,s){let c=String(s);switch(c){case"ZUPLO_ENVIRONMENT_TYPE":return SC.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return SC.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return SC.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return SC.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return SC.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return SC.instance.build.BUILD_ID}if(!(ddt(c)&&!mdt(c)))return SC.instance.runtime[c]}});function YQ(a,s,c){return`_${l6(`${a}_${s}_${c}`)}`}t(YQ,"getRawOperationDataIdentifierName");function t8e(a,s,c,f){return`_${l6(a.toLowerCase())}_${s.toLowerCase()}_${c.toLowerCase()}_${f.toLowerCase()}`}t(t8e,"getIdForParameterSchema");function r8e(a,s,c){return`_${l6(a.toLowerCase())}_${s.toLowerCase()}_rb_${l6(c.toLowerCase())}`}t(r8e,"getIdForRequestBodySchema");function XQ(a,s){return`_${l6(a)}_${l6(s)}`}t(XQ,"getIdForRefSchema");function l6(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(l6,"sanitizedIdentifierName");var Hyt=jp(sht(),1);import gpe from"path";var dK=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,c,f,d,v){this.type=a,this.name=s,this.prefix=c,this.value=f,this.suffix=d,this.modifier=v}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},cmr=/[$_\p{ID_Start}]/u,lmr=/[$_\u200C\u200D\p{ID_Continue}]/u,K8e=".*";function umr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(umr,"Re");function cht(a,s=!1){let c=[],f=0;for(;f<a.length;){let d=a[f],v=t(function(E){if(!s)throw new TypeError(E);c.push({type:"INVALID_CHAR",index:f,value:a[f++]})},"c");if(d==="*"){c.push({type:"ASTERISK",index:f,value:a[f++]});continue}if(d==="+"||d==="?"){c.push({type:"OTHER_MODIFIER",index:f,value:a[f++]});continue}if(d==="\\"){c.push({type:"ESCAPED_CHAR",index:f++,value:a[f++]});continue}if(d==="{"){c.push({type:"OPEN",index:f,value:a[f++]});continue}if(d==="}"){c.push({type:"CLOSE",index:f,value:a[f++]});continue}if(d===":"){let E="",A=f+1;for(;A<a.length;){let O=a.substr(A,1);if(A===f+1&&cmr.test(O)||A!==f+1&&lmr.test(O)){E+=a[A++];continue}break}if(!E){v(`Missing parameter name at ${f}`);continue}c.push({type:"NAME",index:f,value:E}),f=A;continue}if(d==="("){let E=1,A="",O=f+1,M=!1;if(a[O]==="?"){v(`Pattern cannot start with "?" at ${O}`);continue}for(;O<a.length;){if(!umr(a[O],!1)){v(`Invalid character '${a[O]}' at ${O}.`),M=!0;break}if(a[O]==="\\"){A+=a[O++]+a[O++];continue}if(a[O]===")"){if(E--,E===0){O++;break}}else if(a[O]==="("&&(E++,a[O+1]!=="?")){v(`Capturing groups are not allowed at ${O}`),M=!0;break}A+=a[O++]}if(M)continue;if(E){v(`Unbalanced pattern at ${f}`);continue}if(!A){v(`Missing pattern at ${f}`);continue}c.push({type:"REGEX",index:f,value:A}),f=O;continue}c.push({type:"CHAR",index:f,value:a[f++]})}return c.push({type:"END",index:f,value:""}),c}t(cht,"v");function lht(a,s={}){let c=cht(a);s.delimiter??="/#?",s.prefixes??="./";let f=`[^${xC(s.delimiter)}]+?`,d=[],v=0,E=0,A="",O=new Set,M=t(dr=>{if(E<c.length&&c[E].type===dr)return c[E++].value},"a"),H=t(()=>M("OTHER_MODIFIER")??M("ASTERISK"),"f"),$=t(dr=>{let jr=M(dr);if(jr!==void 0)return jr;let{type:Cr,index:pr}=c[E];throw new TypeError(`Unexpected ${Cr} at ${pr}, expected ${dr}`)},"d"),K=t(()=>{let dr="",jr;for(;jr=M("CHAR")??M("ESCAPED_CHAR");)dr+=jr;return dr},"T"),Ne=t(dr=>dr,"Se"),xe=s.encodePart||Ne,Te="",Tt=t(dr=>{Te+=dr},"U"),Dt=t(()=>{Te.length&&(d.push(new dK(3,"","",xe(Te),"",3)),Te="")},"$"),br=t((dr,jr,Cr,pr,sr)=>{let Cs=3;switch(sr){case"?":Cs=1;break;case"*":Cs=0;break;case"+":Cs=2;break}if(!jr&&!Cr&&Cs===3){Tt(dr);return}if(Dt(),!jr&&!Cr){if(!dr)return;d.push(new dK(3,"","",xe(dr),"",Cs));return}let Di;Cr?Cr==="*"?Di=K8e:Di=Cr:Di=f;let _o=2;Di===f?(_o=1,Di=""):Di===K8e&&(_o=0,Di="");let hi;if(jr?hi=jr:Cr&&(hi=v++),O.has(hi))throw new TypeError(`Duplicate name '${hi}'.`);O.add(hi),d.push(new dK(_o,hi,xe(dr),Di,xe(pr),Cs))},"V");for(;E<c.length;){let dr=M("CHAR"),jr=M("NAME"),Cr=M("REGEX");if(!jr&&!Cr&&(Cr=M("ASTERISK")),jr||Cr){let sr=dr??"";s.prefixes.indexOf(sr)===-1&&(Tt(sr),sr=""),Dt();let Cs=H();br(sr,jr,Cr,"",Cs);continue}let pr=dr??M("ESCAPED_CHAR");if(pr){Tt(pr);continue}if(M("OPEN")){let sr=K(),Cs=M("NAME"),Di=M("REGEX");!Cs&&!Di&&(Di=M("ASTERISK"));let _o=K();$("CLOSE");let hi=H();br(sr,Cs,Di,_o,hi);continue}Dt(),$("END")}return d}t(lht,"D");function xC(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(xC,"S");function aht(a){return a&&a.ignoreCase?"ui":"u"}t(aht,"X");function fmr(a,s,c){return uht(lht(a,c),s,c)}t(fmr,"Z");function kB(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(kB,"k");function uht(a,s,c={}){c.delimiter??="/#?",c.prefixes??="./",c.sensitive??=!1,c.strict??=!1,c.end??=!0,c.start??=!0,c.endsWith="";let f=c.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?f+=xC(A.value):f+=`(?:${xC(A.value)})${kB(A.modifier)}`;continue}s&&s.push(A.name);let O=`[^${xC(c.delimiter)}]+?`,M=A.value;if(A.type===1?M=O:A.type===0&&(M=K8e),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?f+=`(${M})${kB(A.modifier)}`:f+=`((?:${M})${kB(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){f+=`(?:${xC(A.prefix)}(${M})${xC(A.suffix)})`,f+=kB(A.modifier);continue}f+=`(?:${xC(A.prefix)}`,f+=`((?:${M})(?:`,f+=xC(A.suffix),f+=xC(A.prefix),f+=`(?:${M}))*)${xC(A.suffix)})`,A.modifier===0&&(f+="?")}let d=`[${xC(c.endsWith)}]|$`,v=`[${xC(c.delimiter)}]`;if(c.end)return c.strict||(f+=`${v}?`),c.endsWith.length?f+=`(?=${d})`:f+="$",new RegExp(f,aht(c));c.strict||(f+=`(?:${v}(?=${d}))?`);let E=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(E=c.delimiter.indexOf(A)>-1)}return E||(f+=`(?=${v}|${d})`),new RegExp(f,aht(c))}t(uht,"F");var ON={delimiter:"",prefixes:"",sensitive:!0,strict:!0},_mr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},pmr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function dmr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(dmr,"J");function fht(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(fht,"Q");function mmr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(mmr,"Ee");function _ht(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(_ht,"W");var pht=["ftp","file","http","https","ws","wss"];function dht(a){if(!a)return!0;for(let s of pht)if(a.test(s))return!0;return!1}t(dht,"N");function hmr(a,s){if(a=fht(a,"#"),s||a==="")return a;let c=new URL("https://example.com");return c.hash=a,c.hash?c.hash.substring(1,c.hash.length):""}t(hmr,"te");function gmr(a,s){if(a=fht(a,"?"),s||a==="")return a;let c=new URL("https://example.com");return c.search=a,c.search?c.search.substring(1,c.search.length):""}t(gmr,"re");function ymr(a,s){return s||a===""?a:_ht(a)?ght(a):hht(a)}t(ymr,"ne");function vmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.password=a,c.password}t(vmr,"se");function bmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.username=a,c.username}t(bmr,"ie");function Smr(a,s,c){if(c||a==="")return a;if(s&&!pht.includes(s))return new URL(`${s}:${a}`).pathname;let f=a[0]=="/";return a=new URL(f?a:"/-"+a,"https://example.com").pathname,f||(a=a.substring(2,a.length)),a}t(Smr,"ae");function Tmr(a,s,c){return mht(s)===a&&(a=""),c||a===""?a:yht(a)}t(Tmr,"oe");function Cmr(a,s){return a=mmr(a,":"),s||a===""?a:Y8e(a)}t(Cmr,"ce");function mht(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(mht,"_");function Y8e(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(Y8e,"y");function Emr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Emr,"le");function xmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(xmr,"fe");function hht(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(hht,"z");function ght(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(ght,"j");function yht(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(yht,"K");function Dmr(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(Dmr,"he");function Amr(a){return a===""?a:new URL(`data:${a}`).pathname}t(Amr,"ue");function kmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(kmr,"de");function wmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(wmr,"pe");var Pmr=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=cht(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.#k()){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.#x()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#C()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#C()&&this.#i(5,1);break;case 4:this.#C()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#A()&&!this.#c?this.#i(6,1):this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#E()?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 c=this.#u(a);return c.value===s&&(c.type==="CHAR"||c.type==="ESCAPED_CHAR"||c.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#x(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#C(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#A(){return this.#m(this.#t,":")}#E(){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,"#")}#k(){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,ON),a.encodePart=Y8e;let s=fmr(this.#T(),void 0,a);this.#l=dht(s)}},Q8e=["protocol","username","password","hostname","port","pathname","search","hash"],IN="*";function oht(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let c=new URL(a,s);return{protocol:c.protocol.substring(0,c.protocol.length-1),username:c.username,password:c.password,hostname:c.hostname,port:c.port,pathname:c.pathname,search:c.search!==""?c.search.substring(1,c.search.length):void 0,hash:c.hash!==""?c.hash.substring(1,c.hash.length):void 0}}t(oht,"ge");function d6(a,s){return s?pK(a):a}t(d6,"b");function _K(a,s,c){let f;if(typeof s.baseURL=="string")try{f=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=d6(f.protocol.substring(0,f.protocol.length-1),c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=d6(f.username,c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=d6(f.password,c)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=d6(f.hostname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=d6(f.port,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=d6(f.pathname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=d6(f.search.substring(1,f.search.length),c)),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=d6(f.hash.substring(1,f.hash.length),c))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Cmr(s.protocol,c)),typeof s.username=="string"&&(a.username=bmr(s.username,c)),typeof s.password=="string"&&(a.password=vmr(s.password,c)),typeof s.hostname=="string"&&(a.hostname=ymr(s.hostname,c)),typeof s.port=="string"&&(a.port=Tmr(s.port,a.protocol,c)),typeof s.pathname=="string"){if(a.pathname=s.pathname,f&&!dmr(a.pathname,c)){let d=f.pathname.lastIndexOf("/");d>=0&&(a.pathname=d6(f.pathname.substring(0,d+1),c)+a.pathname)}a.pathname=Smr(a.pathname,a.protocol,c)}return typeof s.search=="string"&&(a.search=gmr(s.search,c)),typeof s.hash=="string"&&(a.hash=hmr(s.hash,c)),a}t(_K,"w");function pK(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(pK,"C");function Nmr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(Nmr,"Oe");function Imr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let c=".*",f=`[^${Nmr(s.delimiter)}]+?`,d=/[$_\u200C\u200D\p{ID_Continue}]/u,v="";for(let E=0;E<a.length;++E){let A=a[E];if(A.type===3){if(A.modifier===3){v+=pK(A.value);continue}v+=`{${pK(A.value)}}${kB(A.modifier)}`;continue}let O=A.hasCustomName(),M=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),H=E>0?a[E-1]:null,$=E<a.length-1?a[E+1]:null;if(!M&&O&&A.type===1&&A.modifier===3&&$&&!$.prefix.length&&!$.suffix.length)if($.type===3){let K=$.value.length>0?$.value[0]:"";M=d.test(K)}else M=!$.hasCustomName();if(!M&&!A.prefix.length&&H&&H.type===3){let K=H.value[H.value.length-1];M=s.prefixes.includes(K)}M&&(v+="{"),v+=pK(A.prefix),O&&(v+=`:${A.name}`),A.type===2?v+=`(${A.value})`:A.type===1?O||(v+=`(${f})`):A.type===0&&(!O&&(!H||H.type===3||H.modifier!==3||M||A.prefix!=="")?v+="*":v+=`(${c})`),A.type===1&&O&&A.suffix.length&&d.test(A.suffix[0])&&(v+="\\"),v+=pK(A.suffix),M&&(v+="}"),A.modifier!==3&&(v+=kB(A.modifier))}return v}t(Imr,"ke");var vht=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,c){try{let f;if(typeof s=="string"?f=s:c=s,typeof a=="string"){let A=new Pmr(a);if(A.parse(),a=A.result,f===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=f}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(f)throw new TypeError("parameter 1 is not of type 'string'.")}typeof c>"u"&&(c={ignoreCase:!1});let d={ignoreCase:c.ignoreCase===!0},v={pathname:IN,protocol:IN,username:IN,password:IN,hostname:IN,port:IN,search:IN,hash:IN};this.#r=_K(v,a,!0),mht(this.#r.protocol)===this.#r.port&&(this.#r.port="");let E;for(E of Q8e){if(!(E in this.#r))continue;let A={},O=this.#r[E];switch(this.#e[E]=[],E){case"protocol":Object.assign(A,ON),A.encodePart=Y8e;break;case"username":Object.assign(A,ON),A.encodePart=Emr;break;case"password":Object.assign(A,ON),A.encodePart=xmr;break;case"hostname":Object.assign(A,_mr),_ht(O)?A.encodePart=ght:A.encodePart=hht;break;case"port":Object.assign(A,ON),A.encodePart=yht;break;case"pathname":dht(this.#n.protocol)?(Object.assign(A,pmr,d),A.encodePart=Dmr):(Object.assign(A,ON,d),A.encodePart=Amr);break;case"search":Object.assign(A,ON,d),A.encodePart=kmr;break;case"hash":Object.assign(A,ON,d),A.encodePart=wmr;break}try{this.#s[E]=lht(O,A),this.#n[E]=uht(this.#s[E],this.#e[E],A),this.#t[E]=Imr(this.#s[E],A),this.#p=this.#p||this.#s[E].some(M=>M.type===2)}catch{throw new TypeError(`invalid ${E} pattern '${this.#r[E]}'.`)}}}catch(f){throw new TypeError(`Failed to construct 'URLPattern': ${f.message}`)}}test(a={},s){let c={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"?c=_K(c,a,!1):c=_K(c,oht(a,s),!1)}catch{return!1}let f;for(f of Q8e)if(!this.#n[f].exec(c[f]))return!1;return!0}exec(a={},s){let c={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"?c=_K(c,a,!1):c=_K(c,oht(a,s),!1)}catch{return null}let f={};s?f.inputs=[a,s]:f.inputs=[a];let d;for(d of Q8e){let v=this.#n[d].exec(c[d]);if(!v)return null;let E={};for(let[A,O]of this.#e[d].entries())if(typeof O=="string"||typeof O=="number"){let M=v[A+1];E[O]=M}f[d]={input:c[d]??"",groups:E}}return f}static compareComponent(a,s,c){let f=t((A,O)=>{for(let M of["type","modifier","prefix","value","suffix"]){if(A[M]<O[M])return-1;if(A[M]!==O[M])return 1}return 0},"o"),d=new dK(3,"","","","",3),v=new dK(0,"","","","",3),E=t((A,O)=>{let M=0;for(;M<Math.min(A.length,O.length);++M){let H=f(A[M],O[M]);if(H)return H}return A.length===O.length?0:f(A[M]??d,O[M]??d)},"s");return!s.#t[a]&&!c.#t[a]?0:s.#t[a]&&!c.#t[a]?E(s.#s[a],[v]):!s.#t[a]&&c.#t[a]?E([v],c.#s[a]):E(s.#s[a],c.#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=vht);import{AssertionError as Omr}from"assert";function m6(a,s){if(a===!1)throw new Omr({message:s})}t(m6,"assert");var Jc;(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"})(Jc||(Jc={}));function wB(a){return a.type===Jc.Object}t(wB,"isAstObject");function h6(a){return a.type===Jc.Property}t(h6,"isAstProperty");function bht(a){return a.type===Jc.Array}t(bht,"isAstArray");function PB(a){return a.type===Jc.Literal}t(PB,"isAstLiteral");function l7(a){if(a===void 0)throw new Error("Node is undefined");if(!wB(a))throw new Error("Node is not object")}t(l7,"assertAstObject");import{findNodeAtLocation as Fmr,getNodeValue as Lmr,printParseErrorCode as Rmr,visit as Mmr}from"jsonc-parser";var jmr={DEFAULT:{allowTrailingComma:!1}};function mK(a,s=[],c=jmr.DEFAULT){let f={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function d(O){f.type==="property"&&(f.length=O-f.offset,f=f.parent)}t(d,"ensurePropertyComplete");function v(O){return f.children?.push(O),O}t(v,"onValue"),Mmr(a,{onObjectBegin:t((O,M,H)=>{f=v({type:"object",offset:O,length:-1,line:M+1,column:H+1,parent:f,children:[]})},"onObjectBegin"),onObjectProperty:t((O,M,H,$,K)=>{f=v({type:"property",offset:M,length:-1,line:$+1,column:K+1,parent:f,children:[]}),f.children?.push({type:"string",value:O,offset:M,length:H,line:$,column:K,parent:f})},"onObjectProperty"),onObjectEnd:t((O,M)=>{d(O+M),f.length=O+M-f.offset,f=f.parent,d(O+M)},"onObjectEnd"),onArrayBegin:t((O,M,H,$)=>{f=v({type:"array",offset:O,length:-1,line:H+1,column:$+1,parent:f,children:[]})},"onArrayBegin"),onArrayEnd:t((O,M)=>{f.length=O+M-f.offset,f=f.parent,d(O+M)},"onArrayEnd"),onLiteralValue:t((O,M,H,$,K)=>{v({type:Bmr(O),offset:M,length:H,line:$+1,column:K+1,parent:f,value:O}),d(M+H)},"onLiteralValue"),onSeparator:t((O,M)=>{f.type==="property"&&(O===":"?f.colonOffset=M:O===","&&d(M))},"onSeparator"),onError:t((O,M,H,$,K)=>{s.push({error:O,offset:M,length:H,line:$+1,column:K+1})},"onError")},c);let A=f.children[0];return A&&delete A.parent,A}t(mK,"parse");function Bmr(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(Bmr,"getNodeType");function X8e(a,s){return Fmr(a,s)}t(X8e,"findNodeAtLocation");function hK(a){return Lmr(a)}t(hK,"getNodeValue");function Sht(a){return Rmr(a)}t(Sht,"printParseErrorCode");var gK=class{static{t(this,"AstAdapter")}parse(s){let f=mK(s,[]);if(f)return this.parseNode(f,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,c){switch(s.type){case"object":return this.createObject(s,c);case"array":return this.createArray(s,c);case"property":return this.createProperty(s,c);case"string":return this.createLiteral(s,c);case"number":return this.createLiteral(s,c);case"boolean":return this.createLiteral(s,c);case"null":return this.createLiteral(s,c)}}createLiteral(s,c){return{type:Jc.Literal,location:{line:s.line,column:s.column},parent:c,value:s.type==="null"?null:s.value}}createObject(s,c){let f={type:Jc.Object,children:[],parent:c,location:{line:s.line,column:s.column}};return s.children?.forEach(d=>{f.children.push(this.parseNode(d,f))}),f}createProperty(s,c){m6(s.children?.length===2,"Invalid property node");let f={type:Jc.Property,location:{line:s.line,column:s.column},parent:c,name:null,value:null};return f.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Jc.Identifier,parent:f},f.value=this.parseNode(s.children[1],f),f}createArray(s,c){let f={type:Jc.Array,location:{line:s.line,column:s.column},parent:c,children:[]};return s.children?.forEach(d=>f.children.push(this.parseNode(d,f))),f}};var Rx={createLiteral:t((a,s)=>({type:Jc.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Jc.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Jc.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,c)=>{let f={type:Jc.Property,parent:c,name:null,value:s};return f.name={value:a,type:Jc.Identifier,parent:f},f.value.parent=f,f},"createProperty"),createArrayOfLiterals:t((a,s)=>{let c={type:Jc.Array,parent:s,children:[]};for(let f of a)c.children.push(Rx.createLiteral(f,c));return c},"createArrayOfLiterals")};var Umr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,yK=class{static{t(this,"SourceGenerator")}generate(s){let c=[];return this.generateSource(c,s),c.join("")}generateSource(s,c){switch(c.type){case Jc.Array:return this.generateArray(s,c);case Jc.Object:return this.generateObject(s,c);case Jc.Property:return this.generateProperty(s,c);case Jc.Literal:return this.generateLiteral(s,c);case Jc.FunctionCall:return this.generateFunctionCall(s,c);case Jc.Identifier:return this.generateIdentifier(s,c);case Jc.Raw:return this.generateRaw(s,c);case Jc.TemplateString:return this.generateTemplateString(s,c)}}generateArray(s,c){s.push("["),c.children.map(f=>{this.generateSource(s,f),s.push(",")}),s.push("]")}generateObject(s,c){s.push("{"),c.children.forEach(f=>{this.generateSource(s,f),s.push(",")}),s.push("}")}generateProperty(s,c){this.generateIdentifier(s,c.name),s.push(":"),this.generateSource(s,c.value)}generateFunctionCall(s,c){s.push(c.name.value),s.push("("),c.children.forEach((f,d,v)=>{this.generateSource(s,f),d<v.length&&s.push(",")}),s.push(")")}generateRaw(s,c){s.push(c.value)}generateTemplateString(s,c){s.push("`"),s.push(c.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,c){if(c.value===null)return s.push("null");switch(typeof c.value){case"number":case"boolean":return s.push(`${c.value}`);case"string":{let f=c.value,d=JSON.stringify(f);return s.push(`${d}`)}}}generateIdentifier(s,c){let f=Umr.test(c.value)?c.value:`'${c.value}'`;s.push(f)}};import{parse as $mr}from"@swc/core";import Jmr from"fs/promises";var Tht=t(async a=>{let s=new Set;try{let c=await Jmr.readFile(a,"utf-8");(await $mr(c,{syntax:"typescript"})).body.forEach(d=>{d.type==="ExportDefaultDeclaration"||d.type==="ExportDefaultExpression"?s.add("default"):d.type==="ExportDeclaration"&&d.declaration.type==="FunctionDeclaration"?s.add(d.declaration.identifier.value):d.type==="ExportDeclaration"&&d.declaration.type==="VariableDeclaration"&&d.declaration.declarations[0].id.type==="Identifier"&&s.add(d.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var Cht={$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 Z8e={$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 Eht={$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 eOe={$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 tOe={$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 Myt=jp(ayt(),1),jyt=jp(Ryt(),1);var lpe=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new jyt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,Myt.default)(this.ajv,{mode:"fast"})}addSchema(s,c){this.ajv.addSchema(s,c)}compile(s){let c=this.ajv.compile(s);return t(d=>({isValid:c(d),errors:this.toSimpleErrors(c.errors,d),warnings:[]}),"validator")}toSimpleErrors(s,c){let f=[];return s?.forEach(d=>{d.keyword==="enum"&&d.params.allowedValues&&Array.isArray(d.params.allowedValues)&&(d.message+=`; ${d.params.allowedValues.join(", ")}`),d.instancePath&&(d.instancePath=d.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let v={details:{}},E=d.instancePath.split("/");if(E.length>2){let O=E[1],M=E[2]?parseInt(E[2]):0,H=E[3],$=isNaN(M)?void 0:c[O][M][H];v={details:{property:O,index:M,field:H,fieldValue:$}}}if(d.keyword==="required"&&d.params.missingProperty&&d.instancePath&&(d.message=`A 'path' is missing required property '${d.params.missingProperty}'`),d.keyword==="additionalProperties"&&d.params.additionalProperty&&d.instancePath&&(d.message=`A 'path' should NOT include property '${d.params.additionalProperty}'`),d.keyword==="type"&&d.params.type&&d.instancePath){let O=d.instancePath.split("/"),M=O[O.length-1];d.message=`Value of property '${M}' must be '${d.params.type}'`}let A=Object.assign(d,v);f.push(A)}),f}};var zN=lpe.instance;zN.addSchema(tOe,"route-configuration.schema.json");zN.addSchema(Eht,"policy-configuration.schema.json");zN.addSchema(Z8e,"policies.schema.json");zN.addSchema(eOe,"open-api-route-configuration.schema.json");zN.addSchema(Cht,"fragments.schema.json");var Rqr=zN.compile(tOe),Byt=zN.compile(eOe),h7e=zN.compile(Z8e);var upe=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=h7e(s),this.results}};var fpe=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=Byt(s),this.results}};import Gbr from"path";var g7e=/\$import\((.*)\)/,_pe=/\$env\((.*?)\)/g;var S6=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,c,f,d){super(s),this.location={file:c,namespace:"",line:f?f.line:0,column:f?f.column:0,length:0,lineText:d??"",suggestion:""}}},Hbr=t(a=>{let s=[],c=a;for(;c.parent;)s.push(c),c=c.parent;return s.reverse()},"invertTree"),qN=t((a,s)=>{if(!a)return!1;let c=Hbr(a);return s.split("/").every((v,E)=>{let A=c[E];return A?v==="*"||h6(A)&&A.name.value===v?!0:v==="{}"?A.type===Jc.Object:v==="[]"?A.type===Jc.Array:!1:!1})},"testPosition");var ppe=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),wB(s)?s.children.forEach(c=>{this.visitor(c)}):bht(s)?s.children.forEach(c=>{this.visitor(c)}):h6(s)&&this.visitor(s.value)}},Uyt=t((a,s,c)=>f=>{if(!h6(f)||!PB(f.value)||typeof f.value.value!="string")return;if(!a.some(v=>qN(f,v))){_pe.test(f.value.value)&&s.push(new S6("An $env() statement is not expected at this location.",c,f.location,f.value.value));return}let d=new RegExp(_pe).exec(f.value.value);if(d?.length===2&&d[0]===f.value.value){let v={type:Jc.Raw,parent:null,value:`environment["${d[1]}"]`};f.value=v}else{let v=f.value.value.replaceAll(new RegExp(_pe),(E,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);v!==f.value.value&&(f.value=Rx.createTemplateString(v,f))}},"getEnvStatementTransformer");var YK="config/routes.json",Qbr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Kbr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],$yt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],Ybr="handler/{}/options/{}/rewritePattern",Xbr="handler/{}/options/{}/baseUrl",dpe=class extends ppe{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let c=this.addedImports.get(s);if(!c)throw new Error("Import name is undefined. This should not happen.");return c}getImports(){let s=[];return this.addedImports.forEach((c,f)=>{s.push({name:c,path:f})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!h6(s)||!PB(s.value)||typeof s.value.value!="string")&&qN(s,Ybr)){if(!s.parent||!wB(s.parent)){this.errors.push(new S6("Invalid node, expected object",YK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Jyt(c)},d=Rx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}rewriteForwardFunction(s){if(!(!h6(s)||!PB(s.value)||typeof s.value.value!="string")&&qN(s,Xbr)){if(!s.parent||!wB(s.parent)){this.errors.push(new S6("Invalid node, expected object",YK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Jyt(c)},d=Rx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}replaceImportStatements(s){if(!h6(s)||!PB(s.value))return;let c=s.value.value;if(typeof c!="string")return;if(!Kbr.some(A=>qN(s,A))&&!$yt.some(A=>qN(s,A))){if(g7e.test(c)){if(s.name.value==="$ref")return;this.errors.push(new S6("An $import() statement is not expected at this location.",YK,s.location,c))}return}let f=g7e.exec(c);if($yt.some(A=>qN(s,A))&&!f)return;if(!f){this.errors.push(new S6("Invalid $import() statement",YK,s.location,c));return}let d=f[1];d.startsWith(".")&&(d=Gbr.join("..",d));let v=this.getImportName(d),E={type:Jc.Identifier,parent:s.parent,value:v};s.value=E}replaceEnvStatements=Uyt(Qbr,this.errors,YK)};function Jyt(a){return`(request, context) => {
578
+ `&&v++;else if(c)f+=E,v=d+2;else throw new i6(`Invalid escape \\${E}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});d=a.indexOf("\\",v)}return f+=a.slice(v),f}t(eor,"getStringValue");function tor(a,s,c=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return eor(a.slice(1,-1),s,c);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(tor,"getLiteralValue");function Aft(a,s){s=Object.freeze({...Zar,...s});let c=[],f=new kNe(a,{mode:s.mode,ranges:s.ranges}),d=s.mode==="json5",v=s.allowTrailingCommas||d;function E(){let pr=f.next();return pr&&s.tokens&&c.push(f.token),pr}t(E,"nextNoComments");function A(){let pr=f.next();return pr&&s.tokens&&c.push(f.token),pr>=H_.LineComment?A():pr}t(A,"nextSkipComments");let O=s.mode==="json"?E:A;function M(pr,sr){if(pr!==sr)throw new WF(f.token)}t(M,"assertTokenType");function H(pr,sr){if(!sr.includes(pr))throw new WF(f.token)}t(H,"assertTokenTypes");function $(pr,sr){return s.ranges?{range:[pr.offset,sr.offset]}:void 0}t($,"createRange");function K(pr){let sr=f.token,Cs=$(sr.loc.start,sr.loc.end),Di=tor(a.slice(sr.loc.start.offset,sr.loc.end.offset),sr,d),hi={loc:{start:{...sr.loc.start},end:{...sr.loc.end}},...Cs};switch(pr){case H_.String:return hC.string(Di,hi);case H_.Number:return hC.number(Di,hi);case H_.Boolean:return hC.boolean(Di,hi);default:throw new TypeError(`Unknown token type ${sr.type}.`)}}t(K,"createLiteralNode");function Ne(pr){let sr=$(pr.loc.start,pr.loc.end),Cs=a.slice(pr.loc.start.offset,pr.loc.end.offset),_o={loc:{start:{...pr.loc.start},end:{...pr.loc.end}},...sr};if(pr.type!=="Identifier"){let hi="";return(Cs[0]==="+"||Cs[0]==="-")&&(hi=Cs[0]),hC[Cs.includes("NaN")?"nan":"infinity"](hi,_o)}return hC.identifier(Cs,_o)}t(Ne,"createJSON5IdentifierNode");function xe(pr){let sr=$(pr.loc.start,pr.loc.end);return hC.null({loc:{start:{...pr.loc.start},end:{...pr.loc.end}},...sr})}t(xe,"createNullNode");function Te(pr){d?H(pr,[H_.String,H_.Identifier,H_.Number]):M(pr,H_.String);let sr=f.token,Cs=pr===H_.String?K(pr):Ne(sr);if(d&&(Cs.type==="NaN"||Cs.type==="Infinity")){if(Cs.sign!=="")throw new WF(f.token);Cs=hC.identifier(Cs.type,{loc:Cs.loc,...$(Cs.loc.start,Cs.loc.end)})}pr=O(),M(pr,H_.Colon);let Di=br(),_o=$(Cs.loc.start,Di.loc.end);return hC.member(Cs,Di,{loc:{start:{...Cs.loc.start},end:{...Di.loc.end}},..._o})}t(Te,"parseProperty");function Tt(pr){M(pr,H_.LBrace);let sr=f.token,Cs=[],Di=O();if(Di!==H_.RBrace)do{if(Cs.push(Te(Di)),Di=O(),!Di)throw new dfe(Cs[Cs.length-1].loc.end);if(Di===H_.Comma){if(Di=O(),v&&Di===H_.RBrace)break}else break}while(Di);M(Di,H_.RBrace);let _o=f.token,hi=$(sr.loc.start,_o.loc.end);return hC.object(Cs,{loc:{start:{...sr.loc.start},end:{..._o.loc.end}},...hi})}t(Tt,"parseObject");function Dt(pr){M(pr,H_.LBracket);let sr=f.token,Cs=[],Di=O();if(Di!==H_.RBracket)do{let No=br(Di);if(Cs.push(hC.element(No,{loc:No.loc})),Di=O(),Di===H_.Comma){if(Di=O(),v&&Di===H_.RBracket)break}else break}while(Di);M(Di,H_.RBracket);let _o=f.token,hi=$(sr.loc.start,_o.loc.end);return hC.array(Cs,{loc:{start:{...sr.loc.start},end:{..._o.loc.end}},...hi})}t(Dt,"parseArray");function br(pr){pr=pr??O();let sr=f.token;switch(pr){case H_.String:case H_.Boolean:return K(pr);case H_.Number:if(d){let Cs=a.slice(sr.loc.start.offset,sr.loc.end.offset);if((Cs[0]==="+"||Cs[0]==="-")&&(Cs=Cs.slice(1)),Cs==="NaN"||Cs==="Infinity")return Ne(sr)}return K(pr);case H_.Null:return xe(sr);case H_.LBrace:return Tt(pr);case H_.LBracket:return Dt(pr);default:throw new WF(sr)}}t(br,"parseValue");let dr=br();if(O())throw new WF(f.token);let Cr={loc:{start:{line:1,column:1,offset:0},end:{...dr.loc.end}}};return s.tokens&&(Cr.tokens=c),s.ranges&&(Cr.range=[Cr.loc.start.offset,Cr.loc.end.offset]),hC.document(dr,Cr)}t(Aft,"parse");var ror=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function kft(a){return a&&typeof a=="object"}t(kft,"isObject");function nor(a){return kft(a)&&typeof a.type=="string"}t(nor,"isNode");function ior(a,s){function c(f,d){typeof s.enter=="function"&&s.enter(f,d);for(let v of ror.get(f.type)){let E=f[v];kft(E)&&(Array.isArray(E)?E.forEach(A=>c(A,f)):nor(E)&&c(E,f))}typeof s.exit=="function"&&s.exit(f,d)}t(c,"visitNode"),c(a)}t(ior,"traverse");function wft(a,s=()=>!0){let c=[];return ior(a,{enter(f,d){c.push({node:f,parent:d,phase:"enter"})},exit(f,d){c.push({node:f,parent:d,phase:"exit"})}}),c.filter(s).values()}t(wft,"iterator");import sor from"fs/promises";var NQ=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),mfe=t(async a=>{try{return await sor.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),IQ=t(async a=>{try{return Aft(a)}catch(s){if(s.column&&s.line&&s.message){let c=NQ(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:c}}return}},"getSchemaAST");var Pft=t(async(a,s,c)=>{try{if(a.length===0)return;for(let f of a){let d=await mfe(f),v=await aor(d,f,s,c);if(v)return v}}catch{}},"getRouteLocationByValue"),aor=t(async(a,s,c,f)=>{try{if(!a)return;let d=null,v=await IQ(a);if(v){for(let{node:E}of wft(v))if(E.value&&E.value===c){d=E.loc;break}if(d!==null){let E=NQ(a,d.start.line);return{file:s,line:d.start.line,column:d.start.column,length:d.end.column-d.start.column,lineText:E,suggestion:f}}}}catch{}},"getRouteLocationByValueFromSchema");import Nft from"fs/promises";import hfe from"path";var wNe="schemas",PNe=".oas.json";var HF=t(async a=>(await Nft.readdir(a)).map(c=>`${a}/${c}`).filter(c=>c.endsWith(PNe)).sort(),"getOpenApiFilesByAlphabetical"),iB=t(async a=>{let s=hfe.resolve(a,"config");return(await Nft.readdir(s)).filter(f=>f.endsWith(PNe)).length>=1},"oasFileInProject");function OQ(a,s,c,f,d,v,E){if(v.has(c))return;let A;try{A=f.get(c)}catch(O){throw new Tv({text:`Failed to resolve reference: ${c}`,detail:O.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:c,namespace:s,suggestion:"Check the reference and try again."}})}v.set(c,d.length),d.push(c),NNe(INe(c),s,A,f,d,v,E)}t(OQ,"chaseRefs");function NNe(a,s,c,f,d,v,E){if(Array.isArray(c))for(let A of c)NNe(a,s,A,f,d,v,E);else if(typeof c=="object")for(let A in c){if(A==="$ref"){let O=c[A];E&&(c[A]=E(s,O)),OQ(a,s,bN(a,O),f,d,v,E)}NNe(a,s,c[A],f,d,v,E)}}t(NNe,"lookForRefs");function bN(a,s){let c=s.indexOf("#");return c>=0?`${hfe.resolve(a,s.substring(0,c))}${s.substring(c)}`:hfe.resolve(hfe.dirname(a),s)}t(bN,"getFullyQualifiedRefName");function INe(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(INe,"getFilePathNameFromRefName");var ONe=class{static{t(this,"Environment")}get ZUP_HOSTNAME(){return process.env.ZUP_HOSTNAME??"zuplo.app"}get ZUP_WORKING_COPY_HOSTNAME(){return process.env.ZUP_WORKING_COPY_HOSTNAME??"working-copy.zuplotest.com"}},oor=new ONe,FNe=oor;var KQ=jp(QIe(),1);var YIe={};Nlt(YIe,{UnsafePathError:()=>zfe,deleteFolder:()=>i_r,dirExists:()=>KIe,fileExists:()=>Gfr,getParentDirFilename:()=>t_r,isNotFileOrDirectory:()=>Kfr,listFolderContents:()=>sdt,listFolders:()=>Xfr,mkDirTemp:()=>Qfr,mkdirForFilePathIfNotExits:()=>Zfr,mkdirIfNotExists:()=>adt,safePath:()=>e_r,tarFolder:()=>r_r,untarFile:()=>n_r});import{spawn as ndt}from"child_process";import{randomUUID as Wfr}from"crypto";import kN from"fs/promises";import{tmpdir as Hfr}from"os";import AN from"path";var idt=[".git","node_modules",".yarn",".DS_Store"];async function Gfr(a){try{return(await kN.stat(a)).isFile()}catch{return!1}}t(Gfr,"fileExists");async function Qfr(){let a=Hfr(),s=Wfr().replaceAll("-",""),c=AN.join(a,s);return await kN.mkdir(c,{recursive:!0}),c}t(Qfr,"mkDirTemp");async function KIe(a){try{return(await kN.stat(a)).isDirectory()}catch{return!1}}t(KIe,"dirExists");async function Kfr(a){try{return await kN.stat(a),!1}catch{return!0}}t(Kfr,"isNotFileOrDirectory");function Yfr(a,s){let c=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),f=a.match(c);if(!f)return"";let d=a.split(f[0]);return d[1]===""?"":`/${d[1]}`}t(Yfr,"getParentDirectory");async function Xfr(a){if(!await KIe(a))return[];let s=await kN.readdir(a,{withFileTypes:!0}),c=[];for await(let f of s)idt.includes(f.name)||f.isDirectory()&&c.push(f.name);return c}t(Xfr,"listFolders");async function sdt(a,s,c=!0){let f=Yfr(a,s),d=await kN.readdir(a,{withFileTypes:!0}),v=[];for await(let E of d)if(!idt.includes(E.name)||!c)if(E.isDirectory()){let A=await sdt(AN.join(a,E.name),s,c);v.push(...A)}else v.push(AN.join(f,E.name));return v}t(sdt,"listFolderContents");var adt=t(async a=>{await kN.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),Zfr=t(async a=>{let s=AN.dirname(a);return adt(s)},"mkdirForFilePathIfNotExits"),zfe=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function e_r(a){let s=t(c=>{if(!c.startsWith(a))throw new zfe("Resolved path is not part of the project.");return c},"ensureSafePath");return{resolve:t((...c)=>s(AN.resolve(...c)),"resolve")}}t(e_r,"safePath");function t_r(a){return`${AN.basename(AN.dirname(a))}/${AN.basename(a)}`}t(t_r,"getParentDirFilename");async function r_r({folderPath:a,outputTarPath:s,exclude:c=["node_modules",".git","dist"]}){return new Promise((f,d)=>{let v=ndt("tar",[...c.map(E=>["--exclude",E]).flat(),"-cvf",s,"-C",a,"."]);process.env.DEBUG_TAR&&(v.stdout.on("data",E=>{let A=E.toString().trim();A.length>0&&console.info(A)}),v.stderr.on("data",E=>{let A=E.toString().trim();A.length>0&&console.error(A)})),v.on("close",E=>{E===0?f(`Folder archived to ${s}`):d(new Error(`tar process exited with code ${E}`))}),v.on("error",E=>{d(E)})})}t(r_r,"tarFolder");async function n_r({tarFilePath:a,outputDir:s}){return new Promise((c,f)=>{let d=`
579
+ if tar -tf ${a} | grep -qE '^([^/]+/)$'; then
580
+ tar --strip-components=1 -xf ${a} -C ${s};
581
+ else
582
+ tar -xf ${a} -C ${s};
583
+ fi
584
+ `.trim(),v=ndt("sh",["-c",d]);process.env.DEBUG_TAR&&(v.stdout.on("data",E=>{let A=E.toString().trim();A.length>0&&console.info(A)}),v.stderr.on("data",E=>{let A=E.toString().trim();A.length>0&&console.error(A)})),v.on("close",E=>{E===0?c("Extraction completed."):f(new Error(`tar process exited with code ${E}`))}),v.on("error",E=>{f(E)})})}t(n_r,"untarFile");async function i_r(a){if(await KIe(a))return await kN.rm(a,{recursive:!0})}t(i_r,"deleteFolder");var Ml=YIe;var bC=jp(QIe(),1);import{readFile as s_r}from"fs/promises";var r7=class extends Error{static{t(this,"CustomResolveError")}},wN=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,c){this.sourceDirectory=s,this.logger=c}dereference(s,c){return KQ.$RefParser.dereference(s,{resolve:{json:!0,file:qfe(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:c?.onDereference}})}bundle(s){return KQ.$RefParser.bundle(s,{resolve:{file:qfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return KQ.$RefParser.parse(s,{resolve:{file:qfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return KQ.$RefParser.resolve(s,{resolve:{file:qfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function qfe(a,s){return{order:100,canRead(c){let f=c_r(c.url);if(!(f===void 0||f==="file"))return!1;let v;try{v=odt(c.url)}catch(E){throw new r7(`Malformed URI: ${c.url}`,{cause:E})}try{Ml.safePath(a).resolve(v)}catch(E){return s?.warn(E),!1}return!0},async read(c){let f;try{f=odt(c.url)}catch(d){throw new r7(`Malformed URI: ${c.url}`,{cause:d})}try{return await s_r(f)}catch(d){throw new r7(`Error opening file "${f}"`,{cause:d})}}}}t(qfe,"customResolver");var XIe=/^win/.test(globalThis.process?globalThis.process.platform:""),a_r=/\//g,o_r=/^(\w{2,}):\/\//i,ZIe=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function c_r(a){let s=o_r.exec(a);if(s)return s[1].toLowerCase()}t(c_r,"getProtocol");function odt(a,s){a=decodeURI(a);for(let f=0;f<ZIe.length;f+=2)a=a.replace(ZIe[f],ZIe[f+1]);let c=a.substr(0,7).toLowerCase()==="file://";return c&&(a=a[7]==="/"?a.substr(8):a.substr(7),XIe&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(c=!1,a=XIe?a:"/"+a)),XIe&&!c&&(a=a.replace(a_r,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(odt,"toFileSystemPath");var cdt="YOUR_KEY_HERE";async function ldt(a){let c=await new wN(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),f=a.openApiDocPath.replace(a.sourceDirectory,"");return l_r({...a,relativeOpenApiPath:f},c)}t(ldt,"buildPublicOpenApiFile");async function l_r(a,s){p_r({relativeOpenApiPath:a.relativeOpenApiPath},s);let c=s;return c=f_r(c),u_r(c,a),c=__r(c,a),udt(c,"x-zuplo"),c}t(l_r,"buildRawOpenApiFile");function u_r(a,{deploymentUrl:s,deploymentName:c,environmentType:f}){let d;s?d=s.hostname:f&&c&&(d=f===Flt.WORKING_COPY?`${c}.${FNe.ZUP_WORKING_COPY_HOSTNAME}`:`${c}.${FNe.ZUP_HOSTNAME}`),d?a.servers=[{url:`https://${d}`}]:a.servers=void 0}t(u_r,"addServerHost");function f_r(a){if(!a.paths)return a;let{components:s}=a,c=s?{...s}:void 0,f=[];c&&c.parameters&&(f=Object.entries(c.parameters).reduce((v,[E,A])=>(qj in A&&Mue(A[qj])&&(v.push(E),c.parameters&&delete c.parameters[E]),v),[]));let d=Object.entries(a.paths).reduce((v,[E,A])=>{if(!A)return v;let O={...A},M=["delete","get","head","patch","post","put","trace","options"];return M.forEach(H=>{let $=A[H];if(!$)return;if(Mue($[qj])){delete O[H];return}let{parameters:K}=$;if(!K)return;let Ne=K.filter(xe=>{if(qj in xe&&Mue(xe[qj]))return!1;if("$ref"in xe){let Te=xe.$ref.split("/").pop();return Te?!f.includes(Te):!0}return!0});O[H]={...$,parameters:Ne}}),M.some(H=>!!O[H])&&(v[E]=O),v},{});return{...a,paths:d,components:c}}t(f_r,"removeHiddenRoutesAndParams");function __r(a,{policiesConfig:s}){if(!a.paths)return a;let c=Object.entries(a.paths).reduce((f,[d,v])=>{if(!v)return f;let E={...v};return[E.delete,E.get,E.head,E.patch,E.post,E.put,E.trace,E.options].forEach(A=>{if(!A)return;let O=A["x-zuplo-route"]?.policies?.inbound?.reduce(($,K)=>{let Ne=s.policies?.find(({name:Tt})=>Tt===K);if(!Ne)return $;if(!(Ne.handler.export==="CompositeInboundPolicy"))return $.concat(K);let Te=Ne.handler.options?.policies;return Te?$.concat(Te):$},[]),M=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="ApiAuthKeyInboundPolicy"||K.handler.export==="ApiKeyInboundPolicy")&&!K.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&M.push(K)})}),M.length>0){let $=M.length>0&&M[0].handler&&M[0].handler.options&&M[0].handler.options.authHeader?M[0].handler.options.authHeader:"Authorization",K=M.length>0&&M[0].handler&&M[0].handler.options&&(M[0].handler.options.authScheme||M[0].handler.options.authScheme==="")?M[0].handler.options.authScheme:"Bearer",Ne=K!==""?`${K} ${cdt}`:cdt,xe={name:$,in:"header",required:!0,example:Ne,schema:{type:"string"},description:`The \`${$}\` header is used to authenticate with the API using your API key. Value is of the format \`${Ne}\`.`};A.parameters?A.parameters.some(br=>"name"in br&&br.name===xe.name)||A.parameters.unshift(xe):A.parameters=[xe];let Te={type:"http",scheme:K.toLowerCase()},Tt="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===K)||(a.components.securitySchemes={...a.components.securitySchemes,[Tt]:Te}):(a.components||(a.components={}),a.components.securitySchemes={[Tt]:Te});let Dt={[Tt]:[]};A.security?A.security.some(br=>br[Tt]!==void 0)||A.security.unshift(Dt):A.security=[Dt]}let H=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="RateLimitInboundPolicy"||K.handler.export==="ComplexRateLimitInboundPolicy")&&H.push(K)})}),H.length>0){let $={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"}}}}}},K={...$,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:$,RateLimitWithRetryAfter:K},A.responses||(A.responses={});let Ne=H.some(xe=>xe.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Ne?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),f[d]=E,f},{});return{...a,paths:c}}t(__r,"enrichSpecWithZuploData");function udt(a,s){for(let c in a)c.startsWith(s)?delete a[c]:typeof a[c]=="object"&&udt(a[c],s)}t(udt,"removePropertiesByPrefix");function p_r({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new Tv({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new Tv({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 Tv({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(p_r,"assertIsZuploOpenApiSpec");function d_r(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let M=0;M<s.length;M++)s[M]=255;for(let M=0;M<a.length;M++){let H=a.charAt(M),$=H.charCodeAt(0);if(s[$]!==255)throw new TypeError(H+" is ambiguous");s[$]=M}let c=a.length,f=a.charAt(0),d=Math.log(c)/Math.log(256),v=Math.log(256)/Math.log(c);function E(M){if(M instanceof Uint8Array||(ArrayBuffer.isView(M)?M=new Uint8Array(M.buffer,M.byteOffset,M.byteLength):Array.isArray(M)&&(M=Uint8Array.from(M))),!(M instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(M.length===0)return"";let H=0,$=0,K=0,Ne=M.length;for(;K!==Ne&&M[K]===0;)K++,H++;let xe=(Ne-K)*v+1>>>0,Te=new Uint8Array(xe);for(;K!==Ne;){let br=M[K],dr=0;for(let jr=xe-1;(br!==0||dr<$)&&jr!==-1;jr--,dr++)br+=256*Te[jr]>>>0,Te[jr]=br%c>>>0,br=br/c>>>0;if(br!==0)throw new Error("Non-zero carry");$=dr,K++}let Tt=xe-$;for(;Tt!==xe&&Te[Tt]===0;)Tt++;let Dt=f.repeat(H);for(;Tt<xe;++Tt)Dt+=a.charAt(Te[Tt]);return Dt}t(E,"encode");function A(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return new Uint8Array;let H=0,$=0,K=0;for(;M[H]===f;)$++,H++;let Ne=(M.length-H)*d+1>>>0,xe=new Uint8Array(Ne);for(;M[H];){let br=s[M.charCodeAt(H)];if(br===255)return;let dr=0;for(let jr=Ne-1;(br!==0||dr<K)&&jr!==-1;jr--,dr++)br+=c*xe[jr]>>>0,xe[jr]=br%256>>>0,br=br/256>>>0;if(br!==0)throw new Error("Non-zero carry");K=dr,H++}let Te=Ne-K;for(;Te!==Ne&&xe[Te]===0;)Te++;let Tt=new Uint8Array($+(Ne-Te)),Dt=$;for(;Te!==Ne;)Tt[Dt++]=xe[Te++];return Tt}t(A,"decodeUnsafe");function O(M){let H=A(M);if(H)return H;throw new Error("Non-base"+c+" character")}return t(O,"decode"),{encode:E,decodeUnsafe:A,decode:O}}t(d_r,"base");var fdt=d_r;var m_r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Vfe=fdt(m_r);var e8e="2024-09-02",_dt=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 pdt(){return new SC({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:e8e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:_dt[e8e]},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(pdt,"getMockEnvironment");var SC=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=pdt()),this.#r}constructor({build:s,runtime:c}){let f;try{if(c.__ZUPLO_CONFIG){let d=atob(c.__ZUPLO_CONFIG);f=JSON.parse(d)}if(c.ZUPLO_SYSTEM_CONFIGURATIONS){let d=new TextDecoder().decode(Vfe.decode(c.ZUPLO_SYSTEM_CONFIGURATIONS)),v=JSON.parse(d);for(let E of Object.keys(v))c[E]||(c[E]=v[E])}}catch(d){console.error("Failed to parse runtime configuration",d)}this.config=f??{},this.build=s,this.runtime=c,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 zudokuHostUrl(){return this.runtime.__ZUPLO_ZUDOKU_HOST_URL??this.config.zudoku_host_url??"https://zudoku.zuploedge.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 h_r=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function ddt(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!h_r.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(ddt,"isRestrictedEnvVariableName");function mdt(a){return!!a.startsWith("ZUPLO_")}t(mdt,"isZuploReadableEnvVariableName");var MBr=new Proxy({},{get(a,s){let c=String(s);switch(c){case"ZUPLO_ENVIRONMENT_TYPE":return SC.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return SC.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return SC.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return SC.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return SC.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return SC.instance.build.BUILD_ID}if(!(ddt(c)&&!mdt(c)))return SC.instance.runtime[c]}});function YQ(a,s,c){return`_${l6(`${a}_${s}_${c}`)}`}t(YQ,"getRawOperationDataIdentifierName");function t8e(a,s,c,f){return`_${l6(a.toLowerCase())}_${s.toLowerCase()}_${c.toLowerCase()}_${f.toLowerCase()}`}t(t8e,"getIdForParameterSchema");function r8e(a,s,c){return`_${l6(a.toLowerCase())}_${s.toLowerCase()}_rb_${l6(c.toLowerCase())}`}t(r8e,"getIdForRequestBodySchema");function XQ(a,s){return`_${l6(a)}_${l6(s)}`}t(XQ,"getIdForRefSchema");function l6(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(l6,"sanitizedIdentifierName");var Hyt=jp(sht(),1);import gpe from"path";var dK=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,c,f,d,v){this.type=a,this.name=s,this.prefix=c,this.value=f,this.suffix=d,this.modifier=v}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},cmr=/[$_\p{ID_Start}]/u,lmr=/[$_\u200C\u200D\p{ID_Continue}]/u,K8e=".*";function umr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(umr,"Re");function cht(a,s=!1){let c=[],f=0;for(;f<a.length;){let d=a[f],v=t(function(E){if(!s)throw new TypeError(E);c.push({type:"INVALID_CHAR",index:f,value:a[f++]})},"c");if(d==="*"){c.push({type:"ASTERISK",index:f,value:a[f++]});continue}if(d==="+"||d==="?"){c.push({type:"OTHER_MODIFIER",index:f,value:a[f++]});continue}if(d==="\\"){c.push({type:"ESCAPED_CHAR",index:f++,value:a[f++]});continue}if(d==="{"){c.push({type:"OPEN",index:f,value:a[f++]});continue}if(d==="}"){c.push({type:"CLOSE",index:f,value:a[f++]});continue}if(d===":"){let E="",A=f+1;for(;A<a.length;){let O=a.substr(A,1);if(A===f+1&&cmr.test(O)||A!==f+1&&lmr.test(O)){E+=a[A++];continue}break}if(!E){v(`Missing parameter name at ${f}`);continue}c.push({type:"NAME",index:f,value:E}),f=A;continue}if(d==="("){let E=1,A="",O=f+1,M=!1;if(a[O]==="?"){v(`Pattern cannot start with "?" at ${O}`);continue}for(;O<a.length;){if(!umr(a[O],!1)){v(`Invalid character '${a[O]}' at ${O}.`),M=!0;break}if(a[O]==="\\"){A+=a[O++]+a[O++];continue}if(a[O]===")"){if(E--,E===0){O++;break}}else if(a[O]==="("&&(E++,a[O+1]!=="?")){v(`Capturing groups are not allowed at ${O}`),M=!0;break}A+=a[O++]}if(M)continue;if(E){v(`Unbalanced pattern at ${f}`);continue}if(!A){v(`Missing pattern at ${f}`);continue}c.push({type:"REGEX",index:f,value:A}),f=O;continue}c.push({type:"CHAR",index:f,value:a[f++]})}return c.push({type:"END",index:f,value:""}),c}t(cht,"v");function lht(a,s={}){let c=cht(a);s.delimiter??="/#?",s.prefixes??="./";let f=`[^${xC(s.delimiter)}]+?`,d=[],v=0,E=0,A="",O=new Set,M=t(dr=>{if(E<c.length&&c[E].type===dr)return c[E++].value},"a"),H=t(()=>M("OTHER_MODIFIER")??M("ASTERISK"),"f"),$=t(dr=>{let jr=M(dr);if(jr!==void 0)return jr;let{type:Cr,index:pr}=c[E];throw new TypeError(`Unexpected ${Cr} at ${pr}, expected ${dr}`)},"d"),K=t(()=>{let dr="",jr;for(;jr=M("CHAR")??M("ESCAPED_CHAR");)dr+=jr;return dr},"T"),Ne=t(dr=>dr,"Se"),xe=s.encodePart||Ne,Te="",Tt=t(dr=>{Te+=dr},"U"),Dt=t(()=>{Te.length&&(d.push(new dK(3,"","",xe(Te),"",3)),Te="")},"$"),br=t((dr,jr,Cr,pr,sr)=>{let Cs=3;switch(sr){case"?":Cs=1;break;case"*":Cs=0;break;case"+":Cs=2;break}if(!jr&&!Cr&&Cs===3){Tt(dr);return}if(Dt(),!jr&&!Cr){if(!dr)return;d.push(new dK(3,"","",xe(dr),"",Cs));return}let Di;Cr?Cr==="*"?Di=K8e:Di=Cr:Di=f;let _o=2;Di===f?(_o=1,Di=""):Di===K8e&&(_o=0,Di="");let hi;if(jr?hi=jr:Cr&&(hi=v++),O.has(hi))throw new TypeError(`Duplicate name '${hi}'.`);O.add(hi),d.push(new dK(_o,hi,xe(dr),Di,xe(pr),Cs))},"V");for(;E<c.length;){let dr=M("CHAR"),jr=M("NAME"),Cr=M("REGEX");if(!jr&&!Cr&&(Cr=M("ASTERISK")),jr||Cr){let sr=dr??"";s.prefixes.indexOf(sr)===-1&&(Tt(sr),sr=""),Dt();let Cs=H();br(sr,jr,Cr,"",Cs);continue}let pr=dr??M("ESCAPED_CHAR");if(pr){Tt(pr);continue}if(M("OPEN")){let sr=K(),Cs=M("NAME"),Di=M("REGEX");!Cs&&!Di&&(Di=M("ASTERISK"));let _o=K();$("CLOSE");let hi=H();br(sr,Cs,Di,_o,hi);continue}Dt(),$("END")}return d}t(lht,"D");function xC(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(xC,"S");function aht(a){return a&&a.ignoreCase?"ui":"u"}t(aht,"X");function fmr(a,s,c){return uht(lht(a,c),s,c)}t(fmr,"Z");function kB(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(kB,"k");function uht(a,s,c={}){c.delimiter??="/#?",c.prefixes??="./",c.sensitive??=!1,c.strict??=!1,c.end??=!0,c.start??=!0,c.endsWith="";let f=c.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?f+=xC(A.value):f+=`(?:${xC(A.value)})${kB(A.modifier)}`;continue}s&&s.push(A.name);let O=`[^${xC(c.delimiter)}]+?`,M=A.value;if(A.type===1?M=O:A.type===0&&(M=K8e),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?f+=`(${M})${kB(A.modifier)}`:f+=`((?:${M})${kB(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){f+=`(?:${xC(A.prefix)}(${M})${xC(A.suffix)})`,f+=kB(A.modifier);continue}f+=`(?:${xC(A.prefix)}`,f+=`((?:${M})(?:`,f+=xC(A.suffix),f+=xC(A.prefix),f+=`(?:${M}))*)${xC(A.suffix)})`,A.modifier===0&&(f+="?")}let d=`[${xC(c.endsWith)}]|$`,v=`[${xC(c.delimiter)}]`;if(c.end)return c.strict||(f+=`${v}?`),c.endsWith.length?f+=`(?=${d})`:f+="$",new RegExp(f,aht(c));c.strict||(f+=`(?:${v}(?=${d}))?`);let E=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(E=c.delimiter.indexOf(A)>-1)}return E||(f+=`(?=${v}|${d})`),new RegExp(f,aht(c))}t(uht,"F");var ON={delimiter:"",prefixes:"",sensitive:!0,strict:!0},_mr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},pmr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function dmr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(dmr,"J");function fht(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(fht,"Q");function mmr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(mmr,"Ee");function _ht(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(_ht,"W");var pht=["ftp","file","http","https","ws","wss"];function dht(a){if(!a)return!0;for(let s of pht)if(a.test(s))return!0;return!1}t(dht,"N");function hmr(a,s){if(a=fht(a,"#"),s||a==="")return a;let c=new URL("https://example.com");return c.hash=a,c.hash?c.hash.substring(1,c.hash.length):""}t(hmr,"te");function gmr(a,s){if(a=fht(a,"?"),s||a==="")return a;let c=new URL("https://example.com");return c.search=a,c.search?c.search.substring(1,c.search.length):""}t(gmr,"re");function ymr(a,s){return s||a===""?a:_ht(a)?ght(a):hht(a)}t(ymr,"ne");function vmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.password=a,c.password}t(vmr,"se");function bmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.username=a,c.username}t(bmr,"ie");function Smr(a,s,c){if(c||a==="")return a;if(s&&!pht.includes(s))return new URL(`${s}:${a}`).pathname;let f=a[0]=="/";return a=new URL(f?a:"/-"+a,"https://example.com").pathname,f||(a=a.substring(2,a.length)),a}t(Smr,"ae");function Tmr(a,s,c){return mht(s)===a&&(a=""),c||a===""?a:yht(a)}t(Tmr,"oe");function Cmr(a,s){return a=mmr(a,":"),s||a===""?a:Y8e(a)}t(Cmr,"ce");function mht(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(mht,"_");function Y8e(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(Y8e,"y");function Emr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Emr,"le");function xmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(xmr,"fe");function hht(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(hht,"z");function ght(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(ght,"j");function yht(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(yht,"K");function Dmr(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(Dmr,"he");function Amr(a){return a===""?a:new URL(`data:${a}`).pathname}t(Amr,"ue");function kmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(kmr,"de");function wmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(wmr,"pe");var Pmr=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=cht(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.#k()){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.#x()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#C()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#C()&&this.#i(5,1);break;case 4:this.#C()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#A()&&!this.#c?this.#i(6,1):this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#E()?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 c=this.#u(a);return c.value===s&&(c.type==="CHAR"||c.type==="ESCAPED_CHAR"||c.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#x(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#C(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#A(){return this.#m(this.#t,":")}#E(){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,"#")}#k(){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,ON),a.encodePart=Y8e;let s=fmr(this.#T(),void 0,a);this.#l=dht(s)}},Q8e=["protocol","username","password","hostname","port","pathname","search","hash"],IN="*";function oht(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let c=new URL(a,s);return{protocol:c.protocol.substring(0,c.protocol.length-1),username:c.username,password:c.password,hostname:c.hostname,port:c.port,pathname:c.pathname,search:c.search!==""?c.search.substring(1,c.search.length):void 0,hash:c.hash!==""?c.hash.substring(1,c.hash.length):void 0}}t(oht,"ge");function d6(a,s){return s?pK(a):a}t(d6,"b");function _K(a,s,c){let f;if(typeof s.baseURL=="string")try{f=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=d6(f.protocol.substring(0,f.protocol.length-1),c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=d6(f.username,c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=d6(f.password,c)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=d6(f.hostname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=d6(f.port,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=d6(f.pathname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=d6(f.search.substring(1,f.search.length),c)),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=d6(f.hash.substring(1,f.hash.length),c))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Cmr(s.protocol,c)),typeof s.username=="string"&&(a.username=bmr(s.username,c)),typeof s.password=="string"&&(a.password=vmr(s.password,c)),typeof s.hostname=="string"&&(a.hostname=ymr(s.hostname,c)),typeof s.port=="string"&&(a.port=Tmr(s.port,a.protocol,c)),typeof s.pathname=="string"){if(a.pathname=s.pathname,f&&!dmr(a.pathname,c)){let d=f.pathname.lastIndexOf("/");d>=0&&(a.pathname=d6(f.pathname.substring(0,d+1),c)+a.pathname)}a.pathname=Smr(a.pathname,a.protocol,c)}return typeof s.search=="string"&&(a.search=gmr(s.search,c)),typeof s.hash=="string"&&(a.hash=hmr(s.hash,c)),a}t(_K,"w");function pK(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(pK,"C");function Nmr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(Nmr,"Oe");function Imr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let c=".*",f=`[^${Nmr(s.delimiter)}]+?`,d=/[$_\u200C\u200D\p{ID_Continue}]/u,v="";for(let E=0;E<a.length;++E){let A=a[E];if(A.type===3){if(A.modifier===3){v+=pK(A.value);continue}v+=`{${pK(A.value)}}${kB(A.modifier)}`;continue}let O=A.hasCustomName(),M=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),H=E>0?a[E-1]:null,$=E<a.length-1?a[E+1]:null;if(!M&&O&&A.type===1&&A.modifier===3&&$&&!$.prefix.length&&!$.suffix.length)if($.type===3){let K=$.value.length>0?$.value[0]:"";M=d.test(K)}else M=!$.hasCustomName();if(!M&&!A.prefix.length&&H&&H.type===3){let K=H.value[H.value.length-1];M=s.prefixes.includes(K)}M&&(v+="{"),v+=pK(A.prefix),O&&(v+=`:${A.name}`),A.type===2?v+=`(${A.value})`:A.type===1?O||(v+=`(${f})`):A.type===0&&(!O&&(!H||H.type===3||H.modifier!==3||M||A.prefix!=="")?v+="*":v+=`(${c})`),A.type===1&&O&&A.suffix.length&&d.test(A.suffix[0])&&(v+="\\"),v+=pK(A.suffix),M&&(v+="}"),A.modifier!==3&&(v+=kB(A.modifier))}return v}t(Imr,"ke");var vht=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,c){try{let f;if(typeof s=="string"?f=s:c=s,typeof a=="string"){let A=new Pmr(a);if(A.parse(),a=A.result,f===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=f}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(f)throw new TypeError("parameter 1 is not of type 'string'.")}typeof c>"u"&&(c={ignoreCase:!1});let d={ignoreCase:c.ignoreCase===!0},v={pathname:IN,protocol:IN,username:IN,password:IN,hostname:IN,port:IN,search:IN,hash:IN};this.#r=_K(v,a,!0),mht(this.#r.protocol)===this.#r.port&&(this.#r.port="");let E;for(E of Q8e){if(!(E in this.#r))continue;let A={},O=this.#r[E];switch(this.#e[E]=[],E){case"protocol":Object.assign(A,ON),A.encodePart=Y8e;break;case"username":Object.assign(A,ON),A.encodePart=Emr;break;case"password":Object.assign(A,ON),A.encodePart=xmr;break;case"hostname":Object.assign(A,_mr),_ht(O)?A.encodePart=ght:A.encodePart=hht;break;case"port":Object.assign(A,ON),A.encodePart=yht;break;case"pathname":dht(this.#n.protocol)?(Object.assign(A,pmr,d),A.encodePart=Dmr):(Object.assign(A,ON,d),A.encodePart=Amr);break;case"search":Object.assign(A,ON,d),A.encodePart=kmr;break;case"hash":Object.assign(A,ON,d),A.encodePart=wmr;break}try{this.#s[E]=lht(O,A),this.#n[E]=uht(this.#s[E],this.#e[E],A),this.#t[E]=Imr(this.#s[E],A),this.#p=this.#p||this.#s[E].some(M=>M.type===2)}catch{throw new TypeError(`invalid ${E} pattern '${this.#r[E]}'.`)}}}catch(f){throw new TypeError(`Failed to construct 'URLPattern': ${f.message}`)}}test(a={},s){let c={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"?c=_K(c,a,!1):c=_K(c,oht(a,s),!1)}catch{return!1}let f;for(f of Q8e)if(!this.#n[f].exec(c[f]))return!1;return!0}exec(a={},s){let c={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"?c=_K(c,a,!1):c=_K(c,oht(a,s),!1)}catch{return null}let f={};s?f.inputs=[a,s]:f.inputs=[a];let d;for(d of Q8e){let v=this.#n[d].exec(c[d]);if(!v)return null;let E={};for(let[A,O]of this.#e[d].entries())if(typeof O=="string"||typeof O=="number"){let M=v[A+1];E[O]=M}f[d]={input:c[d]??"",groups:E}}return f}static compareComponent(a,s,c){let f=t((A,O)=>{for(let M of["type","modifier","prefix","value","suffix"]){if(A[M]<O[M])return-1;if(A[M]!==O[M])return 1}return 0},"o"),d=new dK(3,"","","","",3),v=new dK(0,"","","","",3),E=t((A,O)=>{let M=0;for(;M<Math.min(A.length,O.length);++M){let H=f(A[M],O[M]);if(H)return H}return A.length===O.length?0:f(A[M]??d,O[M]??d)},"s");return!s.#t[a]&&!c.#t[a]?0:s.#t[a]&&!c.#t[a]?E(s.#s[a],[v]):!s.#t[a]&&c.#t[a]?E([v],c.#s[a]):E(s.#s[a],c.#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=vht);import{AssertionError as Omr}from"assert";function m6(a,s){if(a===!1)throw new Omr({message:s})}t(m6,"assert");var Jc;(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"})(Jc||(Jc={}));function wB(a){return a.type===Jc.Object}t(wB,"isAstObject");function h6(a){return a.type===Jc.Property}t(h6,"isAstProperty");function bht(a){return a.type===Jc.Array}t(bht,"isAstArray");function PB(a){return a.type===Jc.Literal}t(PB,"isAstLiteral");function l7(a){if(a===void 0)throw new Error("Node is undefined");if(!wB(a))throw new Error("Node is not object")}t(l7,"assertAstObject");import{findNodeAtLocation as Fmr,getNodeValue as Lmr,printParseErrorCode as Rmr,visit as Mmr}from"jsonc-parser";var jmr={DEFAULT:{allowTrailingComma:!1}};function mK(a,s=[],c=jmr.DEFAULT){let f={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function d(O){f.type==="property"&&(f.length=O-f.offset,f=f.parent)}t(d,"ensurePropertyComplete");function v(O){return f.children?.push(O),O}t(v,"onValue"),Mmr(a,{onObjectBegin:t((O,M,H)=>{f=v({type:"object",offset:O,length:-1,line:M+1,column:H+1,parent:f,children:[]})},"onObjectBegin"),onObjectProperty:t((O,M,H,$,K)=>{f=v({type:"property",offset:M,length:-1,line:$+1,column:K+1,parent:f,children:[]}),f.children?.push({type:"string",value:O,offset:M,length:H,line:$,column:K,parent:f})},"onObjectProperty"),onObjectEnd:t((O,M)=>{d(O+M),f.length=O+M-f.offset,f=f.parent,d(O+M)},"onObjectEnd"),onArrayBegin:t((O,M,H,$)=>{f=v({type:"array",offset:O,length:-1,line:H+1,column:$+1,parent:f,children:[]})},"onArrayBegin"),onArrayEnd:t((O,M)=>{f.length=O+M-f.offset,f=f.parent,d(O+M)},"onArrayEnd"),onLiteralValue:t((O,M,H,$,K)=>{v({type:Bmr(O),offset:M,length:H,line:$+1,column:K+1,parent:f,value:O}),d(M+H)},"onLiteralValue"),onSeparator:t((O,M)=>{f.type==="property"&&(O===":"?f.colonOffset=M:O===","&&d(M))},"onSeparator"),onError:t((O,M,H,$,K)=>{s.push({error:O,offset:M,length:H,line:$+1,column:K+1})},"onError")},c);let A=f.children[0];return A&&delete A.parent,A}t(mK,"parse");function Bmr(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(Bmr,"getNodeType");function X8e(a,s){return Fmr(a,s)}t(X8e,"findNodeAtLocation");function hK(a){return Lmr(a)}t(hK,"getNodeValue");function Sht(a){return Rmr(a)}t(Sht,"printParseErrorCode");var gK=class{static{t(this,"AstAdapter")}parse(s){let f=mK(s,[]);if(f)return this.parseNode(f,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,c){switch(s.type){case"object":return this.createObject(s,c);case"array":return this.createArray(s,c);case"property":return this.createProperty(s,c);case"string":return this.createLiteral(s,c);case"number":return this.createLiteral(s,c);case"boolean":return this.createLiteral(s,c);case"null":return this.createLiteral(s,c)}}createLiteral(s,c){return{type:Jc.Literal,location:{line:s.line,column:s.column},parent:c,value:s.type==="null"?null:s.value}}createObject(s,c){let f={type:Jc.Object,children:[],parent:c,location:{line:s.line,column:s.column}};return s.children?.forEach(d=>{f.children.push(this.parseNode(d,f))}),f}createProperty(s,c){m6(s.children?.length===2,"Invalid property node");let f={type:Jc.Property,location:{line:s.line,column:s.column},parent:c,name:null,value:null};return f.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Jc.Identifier,parent:f},f.value=this.parseNode(s.children[1],f),f}createArray(s,c){let f={type:Jc.Array,location:{line:s.line,column:s.column},parent:c,children:[]};return s.children?.forEach(d=>f.children.push(this.parseNode(d,f))),f}};var Rx={createLiteral:t((a,s)=>({type:Jc.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Jc.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Jc.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,c)=>{let f={type:Jc.Property,parent:c,name:null,value:s};return f.name={value:a,type:Jc.Identifier,parent:f},f.value.parent=f,f},"createProperty"),createArrayOfLiterals:t((a,s)=>{let c={type:Jc.Array,parent:s,children:[]};for(let f of a)c.children.push(Rx.createLiteral(f,c));return c},"createArrayOfLiterals")};var Umr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,yK=class{static{t(this,"SourceGenerator")}generate(s){let c=[];return this.generateSource(c,s),c.join("")}generateSource(s,c){switch(c.type){case Jc.Array:return this.generateArray(s,c);case Jc.Object:return this.generateObject(s,c);case Jc.Property:return this.generateProperty(s,c);case Jc.Literal:return this.generateLiteral(s,c);case Jc.FunctionCall:return this.generateFunctionCall(s,c);case Jc.Identifier:return this.generateIdentifier(s,c);case Jc.Raw:return this.generateRaw(s,c);case Jc.TemplateString:return this.generateTemplateString(s,c)}}generateArray(s,c){s.push("["),c.children.map(f=>{this.generateSource(s,f),s.push(",")}),s.push("]")}generateObject(s,c){s.push("{"),c.children.forEach(f=>{this.generateSource(s,f),s.push(",")}),s.push("}")}generateProperty(s,c){this.generateIdentifier(s,c.name),s.push(":"),this.generateSource(s,c.value)}generateFunctionCall(s,c){s.push(c.name.value),s.push("("),c.children.forEach((f,d,v)=>{this.generateSource(s,f),d<v.length&&s.push(",")}),s.push(")")}generateRaw(s,c){s.push(c.value)}generateTemplateString(s,c){s.push("`"),s.push(c.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,c){if(c.value===null)return s.push("null");switch(typeof c.value){case"number":case"boolean":return s.push(`${c.value}`);case"string":{let f=c.value,d=JSON.stringify(f);return s.push(`${d}`)}}}generateIdentifier(s,c){let f=Umr.test(c.value)?c.value:`'${c.value}'`;s.push(f)}};import{parse as $mr}from"@swc/core";import Jmr from"fs/promises";var Tht=t(async a=>{let s=new Set;try{let c=await Jmr.readFile(a,"utf-8");(await $mr(c,{syntax:"typescript"})).body.forEach(d=>{d.type==="ExportDefaultDeclaration"||d.type==="ExportDefaultExpression"?s.add("default"):d.type==="ExportDeclaration"&&d.declaration.type==="FunctionDeclaration"?s.add(d.declaration.identifier.value):d.type==="ExportDeclaration"&&d.declaration.type==="VariableDeclaration"&&d.declaration.declarations[0].id.type==="Identifier"&&s.add(d.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var Cht={$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 Z8e={$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 Eht={$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 eOe={$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 tOe={$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 Myt=jp(ayt(),1),jyt=jp(Ryt(),1);var lpe=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new jyt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,Myt.default)(this.ajv,{mode:"fast"})}addSchema(s,c){this.ajv.addSchema(s,c)}compile(s){let c=this.ajv.compile(s);return t(d=>({isValid:c(d),errors:this.toSimpleErrors(c.errors,d),warnings:[]}),"validator")}toSimpleErrors(s,c){let f=[];return s?.forEach(d=>{d.keyword==="enum"&&d.params.allowedValues&&Array.isArray(d.params.allowedValues)&&(d.message+=`; ${d.params.allowedValues.join(", ")}`),d.instancePath&&(d.instancePath=d.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let v={details:{}},E=d.instancePath.split("/");if(E.length>2){let O=E[1],M=E[2]?parseInt(E[2]):0,H=E[3],$=isNaN(M)?void 0:c[O][M][H];v={details:{property:O,index:M,field:H,fieldValue:$}}}if(d.keyword==="required"&&d.params.missingProperty&&d.instancePath&&(d.message=`A 'path' is missing required property '${d.params.missingProperty}'`),d.keyword==="additionalProperties"&&d.params.additionalProperty&&d.instancePath&&(d.message=`A 'path' should NOT include property '${d.params.additionalProperty}'`),d.keyword==="type"&&d.params.type&&d.instancePath){let O=d.instancePath.split("/"),M=O[O.length-1];d.message=`Value of property '${M}' must be '${d.params.type}'`}let A=Object.assign(d,v);f.push(A)}),f}};var zN=lpe.instance;zN.addSchema(tOe,"route-configuration.schema.json");zN.addSchema(Eht,"policy-configuration.schema.json");zN.addSchema(Z8e,"policies.schema.json");zN.addSchema(eOe,"open-api-route-configuration.schema.json");zN.addSchema(Cht,"fragments.schema.json");var Rqr=zN.compile(tOe),Byt=zN.compile(eOe),h7e=zN.compile(Z8e);var upe=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=h7e(s),this.results}};var fpe=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=Byt(s),this.results}};import Gbr from"path";var g7e=/\$import\((.*)\)/,_pe=/\$env\((.*?)\)/g;var S6=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,c,f,d){super(s),this.location={file:c,namespace:"",line:f?f.line:0,column:f?f.column:0,length:0,lineText:d??"",suggestion:""}}},Hbr=t(a=>{let s=[],c=a;for(;c.parent;)s.push(c),c=c.parent;return s.reverse()},"invertTree"),qN=t((a,s)=>{if(!a)return!1;let c=Hbr(a);return s.split("/").every((v,E)=>{let A=c[E];return A?v==="*"||h6(A)&&A.name.value===v?!0:v==="{}"?A.type===Jc.Object:v==="[]"?A.type===Jc.Array:!1:!1})},"testPosition");var ppe=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),wB(s)?s.children.forEach(c=>{this.visitor(c)}):bht(s)?s.children.forEach(c=>{this.visitor(c)}):h6(s)&&this.visitor(s.value)}},Uyt=t((a,s,c)=>f=>{if(!h6(f)||!PB(f.value)||typeof f.value.value!="string")return;if(!a.some(v=>qN(f,v))){_pe.test(f.value.value)&&s.push(new S6("An $env() statement is not expected at this location.",c,f.location,f.value.value));return}let d=new RegExp(_pe).exec(f.value.value);if(d?.length===2&&d[0]===f.value.value){let v={type:Jc.Raw,parent:null,value:`environment["${d[1]}"]`};f.value=v}else{let v=f.value.value.replaceAll(new RegExp(_pe),(E,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);v!==f.value.value&&(f.value=Rx.createTemplateString(v,f))}},"getEnvStatementTransformer");var YK="config/routes.json",Qbr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Kbr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],$yt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],Ybr="handler/{}/options/{}/rewritePattern",Xbr="handler/{}/options/{}/baseUrl",dpe=class extends ppe{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let c=this.addedImports.get(s);if(!c)throw new Error("Import name is undefined. This should not happen.");return c}getImports(){let s=[];return this.addedImports.forEach((c,f)=>{s.push({name:c,path:f})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!h6(s)||!PB(s.value)||typeof s.value.value!="string")&&qN(s,Ybr)){if(!s.parent||!wB(s.parent)){this.errors.push(new S6("Invalid node, expected object",YK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Jyt(c)},d=Rx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}rewriteForwardFunction(s){if(!(!h6(s)||!PB(s.value)||typeof s.value.value!="string")&&qN(s,Xbr)){if(!s.parent||!wB(s.parent)){this.errors.push(new S6("Invalid node, expected object",YK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Jyt(c)},d=Rx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}replaceImportStatements(s){if(!h6(s)||!PB(s.value))return;let c=s.value.value;if(typeof c!="string")return;if(!Kbr.some(A=>qN(s,A))&&!$yt.some(A=>qN(s,A))){if(g7e.test(c)){if(s.name.value==="$ref")return;this.errors.push(new S6("An $import() statement is not expected at this location.",YK,s.location,c))}return}let f=g7e.exec(c);if($yt.some(A=>qN(s,A))&&!f)return;if(!f){this.errors.push(new S6("Invalid $import() statement",YK,s.location,c));return}let d=f[1];d.startsWith(".")&&(d=Gbr.join("..",d));let v=this.getImportName(d),E={type:Jc.Identifier,parent:s.parent,value:v};s.value=E}replaceEnvStatements=Uyt(Qbr,this.errors,YK)};function Jyt(a){return`(request, context) => {
579
585
  const { params, url, query, method, headers } = request;
580
586
  const { host, hostname, origin, pathname, port, search } = new URL(url);
581
587
  const e = encodeURIComponent;
package/index.minified.js CHANGED
@@ -575,7 +575,13 @@ globstar while`,s,K,c,Ne,xe),this.matchOne(s.slice(K),c.slice(Ne),f))return this
575
575
  >>> no match, partial?`,s,K,c,Ne),K===O))}let Te;if(typeof H=="string"?(Te=$===H,this.debug("string match",H,$,Te)):(Te=H.test($),this.debug("pattern match",H,$,Te)),!Te)return!1}if(E===O&&A===M)return!0;if(E===O)return f;if(A===M)return E===O-1&&s[E]==="";throw new Error("wtf?")}braceExpand(){return tft(this.pattern,this.options)}parse(s){dQ(s);let c=this.options;if(s==="**")return ry;if(s==="")return"";let f,d=null;(f=s.match(Ysr))?d=c.dot?Zsr:Xsr:(f=s.match($sr))?d=(c.nocase?c.dot?Vsr:qsr:c.dot?zsr:Jsr)(f[1]):(f=s.match(ear))?d=(c.nocase?c.dot?rar:tar:c.dot?nar:iar)(f):(f=s.match(Wsr))?d=c.dot?Gsr:Hsr:(f=s.match(Qsr))&&(d=Ksr);let v=Qj.fromGlob(s,this.options).toMMPattern();return d&&typeof v=="object"&&Reflect.defineProperty(v,"test",{value:d}),v}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let s=this.set;if(!s.length)return this.regexp=!1,this.regexp;let c=this.options,f=c.noglobstar?oar:c.dot?car:lar,d=new Set(c.nocase?["i"]:[]),v=s.map(O=>{let M=O.map(H=>{if(H instanceof RegExp)for(let $ of H.flags.split(""))d.add($);return typeof H=="string"?dar(H):H===ry?ry:H._src});return M.forEach((H,$)=>{let K=M[$+1],Ne=M[$-1];H!==ry||Ne===ry||(Ne===void 0?K!==void 0&&K!==ry?M[$+1]="(?:\\/|"+f+"\\/)?"+K:M[$]=f:K===void 0?M[$-1]=Ne+"(?:\\/|"+f+")?":K!==ry&&(M[$-1]=Ne+"(?:\\/|\\/"+f+"\\/)"+K,M[$+1]=ry))}),M.filter(H=>H!==ry).join("/")}).join("|"),[E,A]=s.length>1?["(?:",")"]:["",""];v="^"+E+v+A+"$",this.negate&&(v="^(?!"+v+").+$");try{this.regexp=new RegExp(v,[...d].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,c=this.partial){if(this.debug("match",s,this.pattern),this.comment)return!1;if(this.empty)return s==="";if(s==="/"&&c)return!0;let f=this.options;this.isWindows&&(s=s.split("\\").join("/"));let d=this.slashSplit(s);this.debug(this.pattern,"split",d);let v=this.set;this.debug(this.pattern,"set",v);let E=d[d.length-1];if(!E)for(let A=d.length-2;!E&&A>=0;A--)E=d[A];for(let A=0;A<v.length;A++){let O=v[A],M=d;if(f.matchBase&&O.length===1&&(M=[E]),this.matchOne(M,O,c))return f.flipNegate?!0:!this.negate}return f.flipNegate?!1:this.negate}static defaults(s){return Cv.defaults(s).Minimatch}};Cv.AST=Qj;Cv.Minimatch=AS;Cv.escape=Kj;Cv.unescape=Cx;import{fileURLToPath as Har}from"url";var Yj=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,nft=new Set,uNe=typeof process=="object"&&process?process:{},ift=t((a,s,c,f)=>{typeof uNe.emitWarning=="function"?uNe.emitWarning(a,s,c,f):console.error(`[${c}] ${s}: ${a}`)},"emitWarning"),Que=globalThis.AbortController,rft=globalThis.AbortSignal;if(typeof Que>"u"){rft=class{static{t(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(f,d){this._onabort.push(d)}},Que=class{static{t(this,"AbortController")}constructor(){s()}signal=new rft;abort(f){if(!this.signal.aborted){this.signal.reason=f,this.signal.aborted=!0;for(let d of this.signal._onabort)d(f);this.signal.onabort?.(f)}}};let a=uNe.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",s=t(()=>{a&&(a=!1,ift("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 mar=t(a=>!nft.has(a),"shouldWarn"),pRr=Symbol("type"),vN=t(a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),"isPosInt"),sft=t(a=>vN(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?Xj:null:null,"getUintArray"),Xj=class extends Array{static{t(this,"ZeroArray")}constructor(s){super(s),this.fill(0)}},fNe=class a{static{t(this,"Stack")}heap;length;static#r=!1;static create(s){let c=sft(s);if(!c)return[];a.#r=!0;let f=new a(s,c);return a.#r=!1,f}constructor(s,c){if(!a.#r)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new c(s),this.length=0}push(s){this.heap[this.length++]=s}pop(){return this.heap[--this.length]}},hQ=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;#x;#C;#b;#A;#E;#y;static unsafeExposeInternals(s){return{starts:s.#C,ttls:s.#b,sizes:s.#x,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(c=>s.#h(c),"isBackgroundFetch"),backgroundFetch:t((c,f,d,v)=>s.#j(c,f,d,v),"backgroundFetch"),moveToTail:t(c=>s.#U(c),"moveToTail"),indexes:t(c=>s.#w(c),"indexes"),rindexes:t(c=>s.#P(c),"rindexes"),isStale:t(c=>s.#S(c),"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:c=0,ttl:f,ttlResolution:d=1,ttlAutopurge:v,updateAgeOnGet:E,updateAgeOnHas:A,allowStale:O,dispose:M,disposeAfter:H,noDisposeOnSet:$,noUpdateTTL:K,maxSize:Ne=0,maxEntrySize:xe=0,sizeCalculation:Te,fetchMethod:Tt,memoMethod:Dt,noDeleteOnFetchRejection:br,noDeleteOnStaleGet:dr,allowStaleOnFetchRejection:jr,allowStaleOnFetchAbort:Cr,ignoreFetchAbort:pr}=s;if(c!==0&&!vN(c))throw new TypeError("max option must be a nonnegative integer");let sr=c?sft(c):Array;if(!sr)throw new Error("invalid max value: "+c);if(this.#r=c,this.#n=Ne,this.maxEntrySize=xe||this.#n,this.sizeCalculation=Te,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(Dt!==void 0&&typeof Dt!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#p=Dt,Tt!==void 0&&typeof Tt!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#s=Tt,this.#E=!!Tt,this.#c=new Map,this.#l=new Array(c).fill(void 0),this.#i=new Array(c).fill(void 0),this.#f=new sr(c),this.#v=new sr(c),this.#d=0,this.#u=0,this.#m=fNe.create(c),this.#a=0,this.#_=0,typeof M=="function"&&(this.#e=M),typeof H=="function"?(this.#t=H,this.#g=[]):(this.#t=void 0,this.#g=void 0),this.#A=!!this.#e,this.#y=!!this.#t,this.noDisposeOnSet=!!$,this.noUpdateTTL=!!K,this.noDeleteOnFetchRejection=!!br,this.allowStaleOnFetchRejection=!!jr,this.allowStaleOnFetchAbort=!!Cr,this.ignoreFetchAbort=!!pr,this.maxEntrySize!==0){if(this.#n!==0&&!vN(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!vN(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#T()}if(this.allowStale=!!O,this.noDeleteOnStaleGet=!!dr,this.updateAgeOnGet=!!E,this.updateAgeOnHas=!!A,this.ttlResolution=vN(d)||d===0?d:1,this.ttlAutopurge=!!v,this.ttl=f||0,this.ttl){if(!vN(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 Cs="LRU_CACHE_UNBOUNDED";mar(Cs)&&(nft.add(Cs),ift("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Cs,a))}}getRemainingTTL(s){return this.#c.has(s)?1/0:0}#D(){let s=new Xj(this.#r),c=new Xj(this.#r);this.#b=s,this.#C=c,this.#N=(v,E,A=Yj.now())=>{if(c[v]=E!==0?A:0,s[v]=E,E!==0&&this.ttlAutopurge){let O=setTimeout(()=>{this.#S(v)&&this.#O(this.#l[v],"expire")},E+1);O.unref&&O.unref()}},this.#k=v=>{c[v]=s[v]!==0?Yj.now():0},this.#o=(v,E)=>{if(s[E]){let A=s[E],O=c[E];if(!A||!O)return;v.ttl=A,v.start=O,v.now=f||d();let M=v.now-O;v.remainingTTL=A-M}};let f=0,d=t(()=>{let v=Yj.now();if(this.ttlResolution>0){f=v;let E=setTimeout(()=>f=0,this.ttlResolution);E.unref&&E.unref()}return v},"getNow");this.getRemainingTTL=v=>{let E=this.#c.get(v);if(E===void 0)return 0;let A=s[E],O=c[E];if(!A||!O)return 1/0;let M=(f||d())-O;return A-M},this.#S=v=>{let E=c[v],A=s[v];return!!A&&!!E&&(f||d())-E>A}}#k=t(()=>{},"#updateItemAge");#o=t(()=>{},"#statusTTL");#N=t(()=>{},"#setItemTTL");#S=t(()=>!1,"#isStale");#T(){let s=new Xj(this.#r);this.#_=0,this.#x=s,this.#I=c=>{this.#_-=s[c],s[c]=0},this.#L=(c,f,d,v)=>{if(this.#h(f))return 0;if(!vN(d))if(v){if(typeof v!="function")throw new TypeError("sizeCalculation must be a function");if(d=v(f,c),!vN(d))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 d},this.#F=(c,f,d)=>{if(s[c]=f,this.#n){let v=this.#n-s[c];for(;this.#_>v;)this.#M(!0)}this.#_+=s[c],d&&(d.entrySize=f,d.totalCalculatedSize=this.#_)}}#I=t(s=>{},"#removeItemSize");#F=t((s,c,f)=>{},"#addItemSize");#L=t((s,c,f,d)=>{if(f||d)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#w({allowStale:s=this.allowStale}={}){if(this.#a)for(let c=this.#u;!(!this.#R(c)||((s||!this.#S(c))&&(yield c),c===this.#d));)c=this.#v[c]}*#P({allowStale:s=this.allowStale}={}){if(this.#a)for(let c=this.#d;!(!this.#R(c)||((s||!this.#S(c))&&(yield c),c===this.#u));)c=this.#f[c]}#R(s){return s!==void 0&&this.#c.get(this.#l[s])===s}*entries(){for(let s of this.#w())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.#P())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.#w()){let c=this.#l[s];c!==void 0&&!this.#h(this.#i[s])&&(yield c)}}*rkeys(){for(let s of this.#P()){let c=this.#l[s];c!==void 0&&!this.#h(this.#i[s])&&(yield c)}}*values(){for(let s of this.#w())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}*rvalues(){for(let s of this.#P())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(s,c={}){for(let f of this.#w()){let d=this.#i[f],v=this.#h(d)?d.__staleWhileFetching:d;if(v!==void 0&&s(v,this.#l[f],this))return this.get(this.#l[f],c)}}forEach(s,c=this){for(let f of this.#w()){let d=this.#i[f],v=this.#h(d)?d.__staleWhileFetching:d;v!==void 0&&s.call(c,v,this.#l[f],this)}}rforEach(s,c=this){for(let f of this.#P()){let d=this.#i[f],v=this.#h(d)?d.__staleWhileFetching:d;v!==void 0&&s.call(c,v,this.#l[f],this)}}purgeStale(){let s=!1;for(let c of this.#P({allowStale:!0}))this.#S(c)&&(this.#O(this.#l[c],"expire"),s=!0);return s}info(s){let c=this.#c.get(s);if(c===void 0)return;let f=this.#i[c],d=this.#h(f)?f.__staleWhileFetching:f;if(d===void 0)return;let v={value:d};if(this.#b&&this.#C){let E=this.#b[c],A=this.#C[c];if(E&&A){let O=E-(Yj.now()-A);v.ttl=O,v.start=Date.now()}}return this.#x&&(v.size=this.#x[c]),v}dump(){let s=[];for(let c of this.#w({allowStale:!0})){let f=this.#l[c],d=this.#i[c],v=this.#h(d)?d.__staleWhileFetching:d;if(v===void 0||f===void 0)continue;let E={value:v};if(this.#b&&this.#C){E.ttl=this.#b[c];let A=Yj.now()-this.#C[c];E.start=Math.floor(Date.now()-A)}this.#x&&(E.size=this.#x[c]),s.unshift([f,E])}return s}load(s){this.clear();for(let[c,f]of s){if(f.start){let d=Date.now()-f.start;f.start=Yj.now()-d}this.set(c,f.value,f)}}set(s,c,f={}){if(c===void 0)return this.delete(s),this;let{ttl:d=this.ttl,start:v,noDisposeOnSet:E=this.noDisposeOnSet,sizeCalculation:A=this.sizeCalculation,status:O}=f,{noUpdateTTL:M=this.noUpdateTTL}=f,H=this.#L(s,c,f.size||0,A);if(this.maxEntrySize&&H>this.maxEntrySize)return O&&(O.set="miss",O.maxEntrySizeExceeded=!0),this.#O(s,"set"),this;let $=this.#a===0?void 0:this.#c.get(s);if($===void 0)$=this.#a===0?this.#u:this.#m.length!==0?this.#m.pop():this.#a===this.#r?this.#M(!1):this.#a,this.#l[$]=s,this.#i[$]=c,this.#c.set(s,$),this.#f[this.#u]=$,this.#v[$]=this.#u,this.#u=$,this.#a++,this.#F($,H,O),O&&(O.set="add"),M=!1;else{this.#U($);let K=this.#i[$];if(c!==K){if(this.#E&&this.#h(K)){K.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Ne}=K;Ne!==void 0&&!E&&(this.#A&&this.#e?.(Ne,s,"set"),this.#y&&this.#g?.push([Ne,s,"set"]))}else E||(this.#A&&this.#e?.(K,s,"set"),this.#y&&this.#g?.push([K,s,"set"]));if(this.#I($),this.#F($,H,O),this.#i[$]=c,O){O.set="replace";let Ne=K&&this.#h(K)?K.__staleWhileFetching:K;Ne!==void 0&&(O.oldValue=Ne)}}else O&&(O.set="update")}if(d!==0&&!this.#b&&this.#D(),this.#b&&(M||this.#N($,d,v),O&&this.#o(O,$)),!E&&this.#y&&this.#g){let K=this.#g,Ne;for(;Ne=K?.shift();)this.#t?.(...Ne)}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,c;for(;c=s?.shift();)this.#t?.(...c)}}}#M(s){let c=this.#d,f=this.#l[c],d=this.#i[c];return this.#E&&this.#h(d)?d.__abortController.abort(new Error("evicted")):(this.#A||this.#y)&&(this.#A&&this.#e?.(d,f,"evict"),this.#y&&this.#g?.push([d,f,"evict"])),this.#I(c),s&&(this.#l[c]=void 0,this.#i[c]=void 0,this.#m.push(c)),this.#a===1?(this.#d=this.#u=0,this.#m.length=0):this.#d=this.#f[c],this.#c.delete(f),this.#a--,c}has(s,c={}){let{updateAgeOnHas:f=this.updateAgeOnHas,status:d}=c,v=this.#c.get(s);if(v!==void 0){let E=this.#i[v];if(this.#h(E)&&E.__staleWhileFetching===void 0)return!1;if(this.#S(v))d&&(d.has="stale",this.#o(d,v));else return f&&this.#k(v),d&&(d.has="hit",this.#o(d,v)),!0}else d&&(d.has="miss");return!1}peek(s,c={}){let{allowStale:f=this.allowStale}=c,d=this.#c.get(s);if(d===void 0||!f&&this.#S(d))return;let v=this.#i[d];return this.#h(v)?v.__staleWhileFetching:v}#j(s,c,f,d){let v=c===void 0?void 0:this.#i[c];if(this.#h(v))return v;let E=new Que,{signal:A}=f;A?.addEventListener("abort",()=>E.abort(A.reason),{signal:E.signal});let O={signal:E.signal,options:f,context:d},M=t((Te,Tt=!1)=>{let{aborted:Dt}=E.signal,br=f.ignoreFetchAbort&&Te!==void 0;if(f.status&&(Dt&&!Tt?(f.status.fetchAborted=!0,f.status.fetchError=E.signal.reason,br&&(f.status.fetchAbortIgnored=!0)):f.status.fetchResolved=!0),Dt&&!br&&!Tt)return $(E.signal.reason);let dr=Ne;return this.#i[c]===Ne&&(Te===void 0?dr.__staleWhileFetching?this.#i[c]=dr.__staleWhileFetching:this.#O(s,"fetch"):(f.status&&(f.status.fetchUpdated=!0),this.set(s,Te,O.options))),Te},"cb"),H=t(Te=>(f.status&&(f.status.fetchRejected=!0,f.status.fetchError=Te),$(Te)),"eb"),$=t(Te=>{let{aborted:Tt}=E.signal,Dt=Tt&&f.allowStaleOnFetchAbort,br=Dt||f.allowStaleOnFetchRejection,dr=br||f.noDeleteOnFetchRejection,jr=Ne;if(this.#i[c]===Ne&&(!dr||jr.__staleWhileFetching===void 0?this.#O(s,"fetch"):Dt||(this.#i[c]=jr.__staleWhileFetching)),br)return f.status&&jr.__staleWhileFetching!==void 0&&(f.status.returnedStale=!0),jr.__staleWhileFetching;if(jr.__returned===jr)throw Te},"fetchFail"),K=t((Te,Tt)=>{let Dt=this.#s?.(s,v,O);Dt&&Dt instanceof Promise&&Dt.then(br=>Te(br===void 0?void 0:br),Tt),E.signal.addEventListener("abort",()=>{(!f.ignoreFetchAbort||f.allowStaleOnFetchAbort)&&(Te(void 0),f.allowStaleOnFetchAbort&&(Te=t(br=>M(br,!0),"res")))})},"pcall");f.status&&(f.status.fetchDispatched=!0);let Ne=new Promise(K).then(M,H),xe=Object.assign(Ne,{__abortController:E,__staleWhileFetching:v,__returned:void 0});return c===void 0?(this.set(s,xe,{...O.options,status:void 0}),c=this.#c.get(s)):this.#i[c]=xe,xe}#h(s){if(!this.#E)return!1;let c=s;return!!c&&c instanceof Promise&&c.hasOwnProperty("__staleWhileFetching")&&c.__abortController instanceof Que}async fetch(s,c={}){let{allowStale:f=this.allowStale,updateAgeOnGet:d=this.updateAgeOnGet,noDeleteOnStaleGet:v=this.noDeleteOnStaleGet,ttl:E=this.ttl,noDisposeOnSet:A=this.noDisposeOnSet,size:O=0,sizeCalculation:M=this.sizeCalculation,noUpdateTTL:H=this.noUpdateTTL,noDeleteOnFetchRejection:$=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:K=this.allowStaleOnFetchRejection,ignoreFetchAbort:Ne=this.ignoreFetchAbort,allowStaleOnFetchAbort:xe=this.allowStaleOnFetchAbort,context:Te,forceRefresh:Tt=!1,status:Dt,signal:br}=c;if(!this.#E)return Dt&&(Dt.fetch="get"),this.get(s,{allowStale:f,updateAgeOnGet:d,noDeleteOnStaleGet:v,status:Dt});let dr={allowStale:f,updateAgeOnGet:d,noDeleteOnStaleGet:v,ttl:E,noDisposeOnSet:A,size:O,sizeCalculation:M,noUpdateTTL:H,noDeleteOnFetchRejection:$,allowStaleOnFetchRejection:K,allowStaleOnFetchAbort:xe,ignoreFetchAbort:Ne,status:Dt,signal:br},jr=this.#c.get(s);if(jr===void 0){Dt&&(Dt.fetch="miss");let Cr=this.#j(s,jr,dr,Te);return Cr.__returned=Cr}else{let Cr=this.#i[jr];if(this.#h(Cr)){let _o=f&&Cr.__staleWhileFetching!==void 0;return Dt&&(Dt.fetch="inflight",_o&&(Dt.returnedStale=!0)),_o?Cr.__staleWhileFetching:Cr.__returned=Cr}let pr=this.#S(jr);if(!Tt&&!pr)return Dt&&(Dt.fetch="hit"),this.#U(jr),d&&this.#k(jr),Dt&&this.#o(Dt,jr),Cr;let sr=this.#j(s,jr,dr,Te),Di=sr.__staleWhileFetching!==void 0&&f;return Dt&&(Dt.fetch=pr?"stale":"refresh",Di&&pr&&(Dt.returnedStale=!0)),Di?sr.__staleWhileFetching:sr.__returned=sr}}async forceFetch(s,c={}){let f=await this.fetch(s,c);if(f===void 0)throw new Error("fetch() returned undefined");return f}memo(s,c={}){let f=this.#p;if(!f)throw new Error("no memoMethod provided to constructor");let{context:d,forceRefresh:v,...E}=c,A=this.get(s,E);if(!v&&A!==void 0)return A;let O=f(s,A,{options:E,context:d});return this.set(s,O,E),O}get(s,c={}){let{allowStale:f=this.allowStale,updateAgeOnGet:d=this.updateAgeOnGet,noDeleteOnStaleGet:v=this.noDeleteOnStaleGet,status:E}=c,A=this.#c.get(s);if(A!==void 0){let O=this.#i[A],M=this.#h(O);return E&&this.#o(E,A),this.#S(A)?(E&&(E.get="stale"),M?(E&&f&&O.__staleWhileFetching!==void 0&&(E.returnedStale=!0),f?O.__staleWhileFetching:void 0):(v||this.#O(s,"expire"),E&&f&&(E.returnedStale=!0),f?O:void 0)):(E&&(E.get="hit"),M?O.__staleWhileFetching:(this.#U(A),d&&this.#k(A),O))}else E&&(E.get="miss")}#B(s,c){this.#v[c]=s,this.#f[s]=c}#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,c){let f=!1;if(this.#a!==0){let d=this.#c.get(s);if(d!==void 0)if(f=!0,this.#a===1)this.#$(c);else{this.#I(d);let v=this.#i[d];if(this.#h(v)?v.__abortController.abort(new Error("deleted")):(this.#A||this.#y)&&(this.#A&&this.#e?.(v,s,c),this.#y&&this.#g?.push([v,s,c])),this.#c.delete(s),this.#l[d]=void 0,this.#i[d]=void 0,d===this.#u)this.#u=this.#v[d];else if(d===this.#d)this.#d=this.#f[d];else{let E=this.#v[d];this.#f[E]=this.#f[d];let A=this.#f[d];this.#v[A]=this.#v[d]}this.#a--,this.#m.push(d)}}if(this.#y&&this.#g?.length){let d=this.#g,v;for(;v=d?.shift();)this.#t?.(...v)}return f}clear(){return this.#$("delete")}#$(s){for(let c of this.#P({allowStale:!0})){let f=this.#i[c];if(this.#h(f))f.__abortController.abort(new Error("deleted"));else{let d=this.#l[c];this.#A&&this.#e?.(f,d,s),this.#y&&this.#g?.push([f,d,s])}}if(this.#c.clear(),this.#i.fill(void 0),this.#l.fill(void 0),this.#b&&this.#C&&(this.#b.fill(0),this.#C.fill(0)),this.#x&&this.#x.fill(0),this.#d=0,this.#u=0,this.#m.length=0,this.#_=0,this.#a=0,this.#y&&this.#g){let c=this.#g,f;for(;f=c?.shift();)this.#t?.(...f)}}};import{posix as Aar,win32 as SNe}from"path";import{fileURLToPath as kar}from"url";import{lstatSync as war,readdir as Par,readdirSync as Nar,readlinkSync as Iar,realpathSync as Oar}from"fs";import*as Far from"fs";import{lstat as Rar,readdir as Mar,readlink as jar,realpath as Bar}from"fs/promises";import{EventEmitter as yNe}from"events";import uft from"stream";import{StringDecoder as har}from"string_decoder";var aft=typeof process=="object"&&process?process:{stdout:null,stderr:null},gar=t(a=>!!a&&typeof a=="object"&&(a instanceof SN||a instanceof uft||yar(a)||bar(a)),"isStream"),yar=t(a=>!!a&&typeof a=="object"&&a instanceof yNe&&typeof a.pipe=="function"&&a.pipe!==uft.Writable.prototype.pipe,"isReadable"),bar=t(a=>!!a&&typeof a=="object"&&a instanceof yNe&&typeof a.write=="function"&&typeof a.end=="function","isWritable"),i6=Symbol("EOF"),s6=Symbol("maybeEmitEnd"),bN=Symbol("emittedEnd"),Kue=Symbol("emittingEnd"),gQ=Symbol("emittedError"),Yue=Symbol("closed"),oft=Symbol("read"),Xue=Symbol("flush"),cft=Symbol("flushChunk"),Ex=Symbol("encoding"),Zj=Symbol("decoder"),d0=Symbol("flowing"),yQ=Symbol("paused"),eB=Symbol("resume"),m0=Symbol("buffer"),Ev=Symbol("pipes"),h0=Symbol("bufferLength"),_Ne=Symbol("bufferPush"),Zue=Symbol("bufferShift"),r1=Symbol("objectMode"),uh=Symbol("destroyed"),pNe=Symbol("error"),dNe=Symbol("emitData"),lft=Symbol("emitEnd"),mNe=Symbol("emitEnd2"),ZA=Symbol("async"),hNe=Symbol("abort"),efe=Symbol("aborted"),vQ=Symbol("signal"),WF=Symbol("dataListeners"),kS=Symbol("discarded"),bQ=t(a=>Promise.resolve().then(a),"defer"),Sar=t(a=>a(),"nodefer"),Tar=t(a=>a==="end"||a==="finish"||a==="prefinish","isEndish"),Car=t(a=>a instanceof ArrayBuffer||!!a&&typeof a=="object"&&a.constructor&&a.constructor.name==="ArrayBuffer"&&a.byteLength>=0,"isArrayBufferLike"),Ear=t(a=>!Buffer.isBuffer(a)&&ArrayBuffer.isView(a),"isArrayBufferView"),tfe=class{static{t(this,"Pipe")}src;dest;opts;ondrain;constructor(s,c,f){this.src=s,this.dest=c,this.opts=f,this.ondrain=()=>s[eB](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(s){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},gNe=class extends tfe{static{t(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(s,c,f){super(s,c,f),this.proxyErrors=d=>c.emit("error",d),s.on("error",this.proxyErrors)}},xar=t(a=>!!a.objectMode,"isObjectModeOptions"),Dar=t(a=>!a.objectMode&&!!a.encoding&&a.encoding!=="buffer","isEncodingOptions"),SN=class extends yNe{static{t(this,"Minipass")}[d0]=!1;[yQ]=!1;[Ev]=[];[m0]=[];[r1];[Ex];[ZA];[Zj];[i6]=!1;[bN]=!1;[Kue]=!1;[Yue]=!1;[gQ]=null;[h0]=0;[uh]=!1;[vQ];[efe]=!1;[WF]=0;[kS]=!1;writable=!0;readable=!0;constructor(...s){let c=s[0]||{};if(super(),c.objectMode&&typeof c.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");xar(c)?(this[r1]=!0,this[Ex]=null):Dar(c)?(this[Ex]=c.encoding,this[r1]=!1):(this[r1]=!1,this[Ex]=null),this[ZA]=!!c.async,this[Zj]=this[Ex]?new har(this[Ex]):null,c&&c.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:t(()=>this[m0],"get")}),c&&c.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:t(()=>this[Ev],"get")});let{signal:f}=c;f&&(this[vQ]=f,f.aborted?this[hNe]():f.addEventListener("abort",()=>this[hNe]()))}get bufferLength(){return this[h0]}get encoding(){return this[Ex]}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[r1]}set objectMode(s){throw new Error("objectMode must be set at instantiation time")}get async(){return this[ZA]}set async(s){this[ZA]=this[ZA]||!!s}[hNe](){this[efe]=!0,this.emit("abort",this[vQ]?.reason),this.destroy(this[vQ]?.reason)}get aborted(){return this[efe]}set aborted(s){}write(s,c,f){if(this[efe])return!1;if(this[i6])throw new Error("write after end");if(this[uh])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof c=="function"&&(f=c,c="utf8"),c||(c="utf8");let d=this[ZA]?bQ:Sar;if(!this[r1]&&!Buffer.isBuffer(s)){if(Ear(s))s=Buffer.from(s.buffer,s.byteOffset,s.byteLength);else if(Car(s))s=Buffer.from(s);else if(typeof s!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[r1]?(this[d0]&&this[h0]!==0&&this[Xue](!0),this[d0]?this.emit("data",s):this[_Ne](s),this[h0]!==0&&this.emit("readable"),f&&d(f),this[d0]):s.length?(typeof s=="string"&&!(c===this[Ex]&&!this[Zj]?.lastNeed)&&(s=Buffer.from(s,c)),Buffer.isBuffer(s)&&this[Ex]&&(s=this[Zj].write(s)),this[d0]&&this[h0]!==0&&this[Xue](!0),this[d0]?this.emit("data",s):this[_Ne](s),this[h0]!==0&&this.emit("readable"),f&&d(f),this[d0]):(this[h0]!==0&&this.emit("readable"),f&&d(f),this[d0])}read(s){if(this[uh])return null;if(this[kS]=!1,this[h0]===0||s===0||s&&s>this[h0])return this[s6](),null;this[r1]&&(s=null),this[m0].length>1&&!this[r1]&&(this[m0]=[this[Ex]?this[m0].join(""):Buffer.concat(this[m0],this[h0])]);let c=this[oft](s||null,this[m0][0]);return this[s6](),c}[oft](s,c){if(this[r1])this[Zue]();else{let f=c;s===f.length||s===null?this[Zue]():typeof f=="string"?(this[m0][0]=f.slice(s),c=f.slice(0,s),this[h0]-=s):(this[m0][0]=f.subarray(s),c=f.subarray(0,s),this[h0]-=s)}return this.emit("data",c),!this[m0].length&&!this[i6]&&this.emit("drain"),c}end(s,c,f){return typeof s=="function"&&(f=s,s=void 0),typeof c=="function"&&(f=c,c="utf8"),s!==void 0&&this.write(s,c),f&&this.once("end",f),this[i6]=!0,this.writable=!1,(this[d0]||!this[yQ])&&this[s6](),this}[eB](){this[uh]||(!this[WF]&&!this[Ev].length&&(this[kS]=!0),this[yQ]=!1,this[d0]=!0,this.emit("resume"),this[m0].length?this[Xue]():this[i6]?this[s6]():this.emit("drain"))}resume(){return this[eB]()}pause(){this[d0]=!1,this[yQ]=!0,this[kS]=!1}get destroyed(){return this[uh]}get flowing(){return this[d0]}get paused(){return this[yQ]}[_Ne](s){this[r1]?this[h0]+=1:this[h0]+=s.length,this[m0].push(s)}[Zue](){return this[r1]?this[h0]-=1:this[h0]-=this[m0][0].length,this[m0].shift()}[Xue](s=!1){do;while(this[cft](this[Zue]())&&this[m0].length);!s&&!this[m0].length&&!this[i6]&&this.emit("drain")}[cft](s){return this.emit("data",s),this[d0]}pipe(s,c){if(this[uh])return s;this[kS]=!1;let f=this[bN];return c=c||{},s===aft.stdout||s===aft.stderr?c.end=!1:c.end=c.end!==!1,c.proxyErrors=!!c.proxyErrors,f?c.end&&s.end():(this[Ev].push(c.proxyErrors?new gNe(this,s,c):new tfe(this,s,c)),this[ZA]?bQ(()=>this[eB]()):this[eB]()),s}unpipe(s){let c=this[Ev].find(f=>f.dest===s);c&&(this[Ev].length===1?(this[d0]&&this[WF]===0&&(this[d0]=!1),this[Ev]=[]):this[Ev].splice(this[Ev].indexOf(c),1),c.unpipe())}addListener(s,c){return this.on(s,c)}on(s,c){let f=super.on(s,c);if(s==="data")this[kS]=!1,this[WF]++,!this[Ev].length&&!this[d0]&&this[eB]();else if(s==="readable"&&this[h0]!==0)super.emit("readable");else if(Tar(s)&&this[bN])super.emit(s),this.removeAllListeners(s);else if(s==="error"&&this[gQ]){let d=c;this[ZA]?bQ(()=>d.call(this,this[gQ])):d.call(this,this[gQ])}return f}removeListener(s,c){return this.off(s,c)}off(s,c){let f=super.off(s,c);return s==="data"&&(this[WF]=this.listeners("data").length,this[WF]===0&&!this[kS]&&!this[Ev].length&&(this[d0]=!1)),f}removeAllListeners(s){let c=super.removeAllListeners(s);return(s==="data"||s===void 0)&&(this[WF]=0,!this[kS]&&!this[Ev].length&&(this[d0]=!1)),c}get emittedEnd(){return this[bN]}[s6](){!this[Kue]&&!this[bN]&&!this[uh]&&this[m0].length===0&&this[i6]&&(this[Kue]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Yue]&&this.emit("close"),this[Kue]=!1)}emit(s,...c){let f=c[0];if(s!=="error"&&s!=="close"&&s!==uh&&this[uh])return!1;if(s==="data")return!this[r1]&&!f?!1:this[ZA]?(bQ(()=>this[dNe](f)),!0):this[dNe](f);if(s==="end")return this[lft]();if(s==="close"){if(this[Yue]=!0,!this[bN]&&!this[uh])return!1;let v=super.emit("close");return this.removeAllListeners("close"),v}else if(s==="error"){this[gQ]=f,super.emit(pNe,f);let v=!this[vQ]||this.listeners("error").length?super.emit("error",f):!1;return this[s6](),v}else if(s==="resume"){let v=super.emit("resume");return this[s6](),v}else if(s==="finish"||s==="prefinish"){let v=super.emit(s);return this.removeAllListeners(s),v}let d=super.emit(s,...c);return this[s6](),d}[dNe](s){for(let f of this[Ev])f.dest.write(s)===!1&&this.pause();let c=this[kS]?!1:super.emit("data",s);return this[s6](),c}[lft](){return this[bN]?!1:(this[bN]=!0,this.readable=!1,this[ZA]?(bQ(()=>this[mNe]()),!0):this[mNe]())}[mNe](){if(this[Zj]){let c=this[Zj].end();if(c){for(let f of this[Ev])f.dest.write(c);this[kS]||super.emit("data",c)}}for(let c of this[Ev])c.end();let s=super.emit("end");return this.removeAllListeners("end"),s}async collect(){let s=Object.assign([],{dataLength:0});this[r1]||(s.dataLength=0);let c=this.promise();return this.on("data",f=>{s.push(f),this[r1]||(s.dataLength+=f.length)}),await c,s}async concat(){if(this[r1])throw new Error("cannot concat in objectMode");let s=await this.collect();return this[Ex]?s.join(""):Buffer.concat(s,s.dataLength)}async promise(){return new Promise((s,c)=>{this.on(uh,()=>c(new Error("stream destroyed"))),this.on("error",f=>c(f)),this.on("end",()=>s())})}[Symbol.asyncIterator](){this[kS]=!1;let s=!1,c=t(async()=>(this.pause(),s=!0,{value:void 0,done:!0}),"stop");return{next:t(()=>{if(s)return c();let d=this.read();if(d!==null)return Promise.resolve({done:!1,value:d});if(this[i6])return c();let v,E,A=t($=>{this.off("data",O),this.off("end",M),this.off(uh,H),c(),E($)},"onerr"),O=t($=>{this.off("error",A),this.off("end",M),this.off(uh,H),this.pause(),v({value:$,done:!!this[i6]})},"ondata"),M=t(()=>{this.off("error",A),this.off("data",O),this.off(uh,H),c(),v({done:!0,value:void 0})},"onend"),H=t(()=>A(new Error("stream destroyed")),"ondestroy");return new Promise(($,K)=>{E=K,v=$,this.once(uh,H),this.once("error",A),this.once("end",M),this.once("data",O)})},"next"),throw:c,return:c,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[kS]=!1;let s=!1,c=t(()=>(this.pause(),this.off(pNe,c),this.off(uh,c),this.off("end",c),s=!0,{done:!0,value:void 0}),"stop"),f=t(()=>{if(s)return c();let d=this.read();return d===null?c():{done:!1,value:d}},"next");return this.once("end",c),this.once(pNe,c),this.once(uh,c),{next:f,throw:c,return:c,[Symbol.iterator](){return this}}}destroy(s){if(this[uh])return s?this.emit("error",s):this.emit(uh),this;this[uh]=!0,this[kS]=!0,this[m0].length=0,this[h0]=0;let c=this;return typeof c.close=="function"&&!this[Yue]&&c.close(),s?this.emit("error",s):this.emit(uh),this}static get isStream(){return gar}};var Lar=Oar.native,TQ={lstatSync:war,readdir:Par,readdirSync:Nar,readlinkSync:Iar,realpathSync:Lar,promises:{lstat:Rar,readdir:Mar,readlink:jar,realpath:Bar}},mft=t(a=>!a||a===TQ||a===Far?TQ:{...TQ,...a,promises:{...TQ.promises,...a.promises||{}}},"fsFromOption"),hft=/^\\\\\?\\([a-z]:)\\?$/i,Uar=t(a=>a.replace(/\//g,"\\").replace(hft,"$1\\"),"uncToDrive"),$ar=/[\\\/]/,mC=0,gft=1,yft=2,ek=4,vft=6,bft=8,HF=10,Sft=12,dC=15,SQ=~dC,vNe=16,fft=32,CQ=64,xx=128,rfe=256,ife=512,_ft=CQ|xx|ife,Jar=1023,bNe=t(a=>a.isFile()?bft:a.isDirectory()?ek:a.isSymbolicLink()?HF:a.isCharacterDevice()?yft:a.isBlockDevice()?vft:a.isSocket()?Sft:a.isFIFO()?gft:mC,"entToType"),pft=new Map,EQ=t(a=>{let s=pft.get(a);if(s)return s;let c=a.normalize("NFKD");return pft.set(a,c),c},"normalize"),dft=new Map,nfe=t(a=>{let s=dft.get(a);if(s)return s;let c=EQ(a.toLowerCase());return dft.set(a,c),c},"normalizeNocase"),sfe=class extends hQ{static{t(this,"ResolveCache")}constructor(){super({max:256})}},TNe=class extends hQ{static{t(this,"ChildrenCache")}constructor(s=16*1024){super({maxSize:s,sizeCalculation:t(c=>c.length+1,"sizeCalculation")})}},Tft=Symbol("PathScurry setAsCwd"),n1=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}#x;get ctime(){return this.#x}#C;get birthtime(){return this.#C}#b;#A;#E;#y;#D;#k;#o;#N;#S;#T;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(s,c=mC,f,d,v,E,A){this.name=s,this.#b=v?nfe(s):EQ(s),this.#o=c&Jar,this.nocase=v,this.roots=d,this.root=f||this,this.#N=E,this.#E=A.fullpath,this.#D=A.relative,this.#k=A.relativePosix,this.parent=A.parent,this.parent?this.#r=this.parent.#r:this.#r=mft(A.fs)}depth(){return this.#A!==void 0?this.#A:this.parent?this.#A=this.parent.depth()+1:this.#A=0}childrenCache(){return this.#N}resolve(s){if(!s)return this;let c=this.getRootString(s),d=s.substring(c.length).split(this.splitSep);return c?this.getRoot(c).#I(d):this.#I(d)}#I(s){let c=this;for(let f of s)c=c.child(f);return c}children(){let s=this.#N.get(this);if(s)return s;let c=Object.assign([],{provisional:0});return this.#N.set(this,c),this.#o&=~vNe,c}child(s,c){if(s===""||s===".")return this;if(s==="..")return this.parent||this;let f=this.children(),d=this.nocase?nfe(s):EQ(s);for(let O of f)if(O.#b===d)return O;let v=this.parent?this.sep:"",E=this.#E?this.#E+v+s:void 0,A=this.newChild(s,mC,{...c,parent:this,fullpath:E});return this.canReaddir()||(A.#o|=xx),f.push(A),A}relative(){if(this.isCWD)return"";if(this.#D!==void 0)return this.#D;let s=this.name,c=this.parent;if(!c)return this.#D=this.name;let f=c.relative();return f+(!f||!c.parent?"":this.sep)+s}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#k!==void 0)return this.#k;let s=this.name,c=this.parent;if(!c)return this.#k=this.fullpathPosix();let f=c.relativePosix();return f+(!f||!c.parent?"":"/")+s}fullpath(){if(this.#E!==void 0)return this.#E;let s=this.name,c=this.parent;if(!c)return this.#E=this.name;let d=c.fullpath()+(c.parent?this.sep:"")+s;return this.#E=d}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let d=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(d)?this.#y=`//?/${d}`:this.#y=d}let s=this.parent,c=s.fullpathPosix(),f=c+(!c||!s.parent?"":"/")+this.name;return this.#y=f}isUnknown(){return(this.#o&dC)===mC}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&dC)===bft}isDirectory(){return(this.#o&dC)===ek}isCharacterDevice(){return(this.#o&dC)===yft}isBlockDevice(){return(this.#o&dC)===vft}isFIFO(){return(this.#o&dC)===gft}isSocket(){return(this.#o&dC)===Sft}isSymbolicLink(){return(this.#o&HF)===HF}lstatCached(){return this.#o&fft?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&dC;return!(s!==mC&&s!==HF||this.#o&rfe||this.#o&xx)}calledReaddir(){return!!(this.#o&vNe)}isENOENT(){return!!(this.#o&xx)}isNamed(s){return this.nocase?this.#b===nfe(s):this.#b===EQ(s)}async readlink(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let c=await this.#r.promises.readlink(this.fullpath()),f=(await this.parent.realpath())?.resolve(c);if(f)return this.#S=f}catch(c){this.#h(c.code);return}}readlinkSync(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let c=this.#r.readlinkSync(this.fullpath()),f=this.parent.realpathSync()?.resolve(c);if(f)return this.#S=f}catch(c){this.#h(c.code);return}}#F(s){this.#o|=vNe;for(let c=s.provisional;c<s.length;c++){let f=s[c];f&&f.#L()}}#L(){this.#o&xx||(this.#o=(this.#o|xx)&SQ,this.#w())}#w(){let s=this.children();s.provisional=0;for(let c of s)c.#L()}#P(){this.#o|=ife,this.#R()}#R(){if(this.#o&CQ)return;let s=this.#o;(s&dC)===ek&&(s&=SQ),this.#o=s|CQ,this.#w()}#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 c=this.#o;c|=rfe,s==="ENOENT"&&(c|=xx),(s==="EINVAL"||s==="UNKNOWN")&&(c&=SQ),this.#o=c,s==="ENOTDIR"&&this.parent&&this.parent.#R()}#B(s,c){return this.#O(s,c)||this.#U(s,c)}#U(s,c){let f=bNe(s),d=this.newChild(s.name,f,{parent:this}),v=d.#o&dC;return v!==ek&&v!==HF&&v!==mC&&(d.#o|=CQ),c.unshift(d),c.provisional++,d}#O(s,c){for(let f=c.provisional;f<c.length;f++){let d=c[f];if((this.nocase?nfe(s.name):EQ(s.name))===d.#b)return this.#$(s,d,f,c)}}#$(s,c,f,d){let v=c.name;return c.#o=c.#o&SQ|bNe(s),v!==s.name&&(c.name=s.name),f!==d.provisional&&(f===d.length-1?d.pop():d.splice(f,1),d.unshift(c)),d.provisional++,c}async lstat(){if(!(this.#o&xx))try{return this.#V(await this.#r.promises.lstat(this.fullpath())),this}catch(s){this.#j(s.code)}}lstatSync(){if(!(this.#o&xx))try{return this.#V(this.#r.lstatSync(this.fullpath())),this}catch(s){this.#j(s.code)}}#V(s){let{atime:c,atimeMs:f,birthtime:d,birthtimeMs:v,blksize:E,blocks:A,ctime:O,ctimeMs:M,dev:H,gid:$,ino:K,mode:Ne,mtime:xe,mtimeMs:Te,nlink:Tt,rdev:Dt,size:br,uid:dr}=s;this.#m=c,this.#f=f,this.#C=d,this.#u=v,this.#_=E,this.#i=A,this.#x=O,this.#d=M,this.#n=H,this.#p=$,this.#c=K,this.#e=Ne,this.#g=xe,this.#v=Te,this.#t=Tt,this.#a=Dt,this.#l=br,this.#s=dr;let jr=bNe(s);this.#o=this.#o&SQ|jr|fft,jr!==mC&&jr!==ek&&jr!==HF&&(this.#o|=CQ)}#z=[];#q=!1;#W(s){this.#q=!1;let c=this.#z.slice();this.#z.length=0,c.forEach(f=>f(null,s))}readdirCB(s,c=!1){if(!this.canReaddir()){c?s(null,[]):queueMicrotask(()=>s(null,[]));return}let f=this.children();if(this.calledReaddir()){let v=f.slice(0,f.provisional);c?s(null,v):queueMicrotask(()=>s(null,v));return}if(this.#z.push(s),this.#q)return;this.#q=!0;let d=this.fullpath();this.#r.readdir(d,{withFileTypes:!0},(v,E)=>{if(v)this.#M(v.code),f.provisional=0;else{for(let A of E)this.#B(A,f);this.#F(f)}this.#W(f.slice(0,f.provisional))})}#J;async readdir(){if(!this.canReaddir())return[];let s=this.children();if(this.calledReaddir())return s.slice(0,s.provisional);let c=this.fullpath();if(this.#J)await this.#J;else{let f=t(()=>{},"resolve");this.#J=new Promise(d=>f=d);try{for(let d of await this.#r.promises.readdir(c,{withFileTypes:!0}))this.#B(d,s);this.#F(s)}catch(d){this.#M(d.code),s.provisional=0}this.#J=void 0,f()}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 c=this.fullpath();try{for(let f of this.#r.readdirSync(c,{withFileTypes:!0}))this.#B(f,s);this.#F(s)}catch(f){this.#M(f.code),s.provisional=0}return s.slice(0,s.provisional)}canReaddir(){if(this.#o&_ft)return!1;let s=dC&this.#o;return s===mC||s===ek||s===HF}shouldWalk(s,c){return(this.#o&ek)===ek&&!(this.#o&_ft)&&!s.has(this)&&(!c||c(this))}async realpath(){if(this.#T)return this.#T;if(!((ife|rfe|xx)&this.#o))try{let s=await this.#r.promises.realpath(this.fullpath());return this.#T=this.resolve(s)}catch{this.#P()}}realpathSync(){if(this.#T)return this.#T;if(!((ife|rfe|xx)&this.#o))try{let s=this.#r.realpathSync(this.fullpath());return this.#T=this.resolve(s)}catch{this.#P()}}[Tft](s){if(s===this)return;s.isCWD=!1,this.isCWD=!0;let c=new Set([]),f=[],d=this;for(;d&&d.parent;)c.add(d),d.#D=f.join(this.sep),d.#k=f.join("/"),d=d.parent,f.push("..");for(d=s;d&&d.parent&&!c.has(d);)d.#D=void 0,d.#k=void 0,d=d.parent}},afe=class a extends n1{static{t(this,"PathWin32")}sep="\\";splitSep=$ar;constructor(s,c=mC,f,d,v,E,A){super(s,c,f,d,v,E,A)}newChild(s,c=mC,f={}){return new a(s,c,this.root,this.roots,this.nocase,this.childrenCache(),f)}getRootString(s){return SNe.parse(s).root}getRoot(s){if(s=Uar(s.toUpperCase()),s===this.root.name)return this.root;for(let[c,f]of Object.entries(this.roots))if(this.sameRoot(s,c))return this.roots[s]=f;return this.roots[s]=new tB(s,this).root}sameRoot(s,c=this.root.name){return s=s.toUpperCase().replace(/\//g,"\\").replace(hft,"$1\\"),s===c}},ofe=class a extends n1{static{t(this,"PathPosix")}splitSep="/";sep="/";constructor(s,c=mC,f,d,v,E,A){super(s,c,f,d,v,E,A)}getRootString(s){return s.startsWith("/")?"/":""}getRoot(s){return this.root}newChild(s,c=mC,f={}){return new a(s,c,this.root,this.roots,this.nocase,this.childrenCache(),f)}},cfe=class{static{t(this,"PathScurryBase")}root;rootPath;roots;cwd;#r;#n;#e;nocase;#t;constructor(s=process.cwd(),c,f,{nocase:d,childrenCacheSize:v=16*1024,fs:E=TQ}={}){this.#t=mft(E),(s instanceof URL||s.startsWith("file://"))&&(s=kar(s));let A=c.resolve(s);this.roots=Object.create(null),this.rootPath=this.parseRootPath(A),this.#r=new sfe,this.#n=new sfe,this.#e=new TNe(v);let O=A.substring(this.rootPath.length).split(f);if(O.length===1&&!O[0]&&O.pop(),d===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=d,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let M=this.root,H=O.length-1,$=c.sep,K=this.rootPath,Ne=!1;for(let xe of O){let Te=H--;M=M.child(xe,{relative:new Array(Te).fill("..").join($),relativePosix:new Array(Te).fill("..").join("/"),fullpath:K+=(Ne?"":$)+xe}),Ne=!0}this.cwd=M}depth(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.depth()}childrenCache(){return this.#e}resolve(...s){let c="";for(let v=s.length-1;v>=0;v--){let E=s[v];if(!(!E||E===".")&&(c=c?`${E}/${c}`:E,this.isAbsolute(E)))break}let f=this.#r.get(c);if(f!==void 0)return f;let d=this.cwd.resolve(c).fullpath();return this.#r.set(c,d),d}resolvePosix(...s){let c="";for(let v=s.length-1;v>=0;v--){let E=s[v];if(!(!E||E===".")&&(c=c?`${E}/${c}`:E,this.isAbsolute(E)))break}let f=this.#n.get(c);if(f!==void 0)return f;let d=this.cwd.resolve(c).fullpathPosix();return this.#n.set(c,d),d}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,c={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s,s=this.cwd);let{withFileTypes:f}=c;if(s.canReaddir()){let d=await s.readdir();return f?d:d.map(v=>v.name)}else return[]}readdirSync(s=this.cwd,c={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s,s=this.cwd);let{withFileTypes:f=!0}=c;return s.canReaddir()?f?s.readdirSync():s.readdirSync().map(d=>d.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:c}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s.withFileTypes,s=this.cwd);let f=await s.readlink();return c?f:f?.fullpath()}readlinkSync(s=this.cwd,{withFileTypes:c}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s.withFileTypes,s=this.cwd);let f=s.readlinkSync();return c?f:f?.fullpath()}async realpath(s=this.cwd,{withFileTypes:c}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s.withFileTypes,s=this.cwd);let f=await s.realpath();return c?f:f?.fullpath()}realpathSync(s=this.cwd,{withFileTypes:c}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s.withFileTypes,s=this.cwd);let f=s.realpathSync();return c?f:f?.fullpath()}async walk(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c,A=[];(!v||v(s))&&A.push(f?s:s.fullpath());let O=new Set,M=t(($,K)=>{O.add($),$.readdirCB((Ne,xe)=>{if(Ne)return K(Ne);let Te=xe.length;if(!Te)return K();let Tt=t(()=>{--Te===0&&K()},"next");for(let Dt of xe)(!v||v(Dt))&&A.push(f?Dt:Dt.fullpath()),d&&Dt.isSymbolicLink()?Dt.realpath().then(br=>br?.isUnknown()?br.lstat():br).then(br=>br?.shouldWalk(O,E)?M(br,Tt):Tt()):Dt.shouldWalk(O,E)?M(Dt,Tt):Tt()},!0)},"walk"),H=s;return new Promise(($,K)=>{M(H,Ne=>{if(Ne)return K(Ne);$(A)})})}walkSync(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c,A=[];(!v||v(s))&&A.push(f?s:s.fullpath());let O=new Set([s]);for(let M of O){let H=M.readdirSync();for(let $ of H){(!v||v($))&&A.push(f?$:$.fullpath());let K=$;if($.isSymbolicLink()){if(!(d&&(K=$.realpathSync())))continue;K.isUnknown()&&K.lstatSync()}K.shouldWalk(O,E)&&O.add(K)}}return A}[Symbol.asyncIterator](){return this.iterate()}iterate(s=this.cwd,c={}){return typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s,s=this.cwd),this.stream(s,c)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c;(!v||v(s))&&(yield f?s:s.fullpath());let A=new Set([s]);for(let O of A){let M=O.readdirSync();for(let H of M){(!v||v(H))&&(yield f?H:H.fullpath());let $=H;if(H.isSymbolicLink()){if(!(d&&($=H.realpathSync())))continue;$.isUnknown()&&$.lstatSync()}$.shouldWalk(A,E)&&A.add($)}}}stream(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c,A=new SN({objectMode:!0});(!v||v(s))&&A.write(f?s:s.fullpath());let O=new Set,M=[s],H=0,$=t(()=>{let K=!1;for(;!K;){let Ne=M.shift();if(!Ne){H===0&&A.end();return}H++,O.add(Ne);let xe=t((Tt,Dt,br=!1)=>{if(Tt)return A.emit("error",Tt);if(d&&!br){let dr=[];for(let jr of Dt)jr.isSymbolicLink()&&dr.push(jr.realpath().then(Cr=>Cr?.isUnknown()?Cr.lstat():Cr));if(dr.length){Promise.all(dr).then(()=>xe(null,Dt,!0));return}}for(let dr of Dt)dr&&(!v||v(dr))&&(A.write(f?dr:dr.fullpath())||(K=!0));H--;for(let dr of Dt){let jr=dr.realpathCached()||dr;jr.shouldWalk(O,E)&&M.push(jr)}K&&!A.flowing?A.once("drain",$):Te||$()},"onReaddir"),Te=!0;Ne.readdirCB(xe,!0),Te=!1}},"process");return $(),A}streamSync(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof n1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c,A=new SN({objectMode:!0}),O=new Set;(!v||v(s))&&A.write(f?s:s.fullpath());let M=[s],H=0,$=t(()=>{let K=!1;for(;!K;){let Ne=M.shift();if(!Ne){H===0&&A.end();return}H++,O.add(Ne);let xe=Ne.readdirSync();for(let Te of xe)(!v||v(Te))&&(A.write(f?Te:Te.fullpath())||(K=!0));H--;for(let Te of xe){let Tt=Te;if(Te.isSymbolicLink()){if(!(d&&(Tt=Te.realpathSync())))continue;Tt.isUnknown()&&Tt.lstatSync()}Tt.shouldWalk(O,E)&&M.push(Tt)}}K&&!A.flowing&&A.once("drain",$)},"process");return $(),A}chdir(s=this.cwd){let c=this.cwd;this.cwd=typeof s=="string"?this.cwd.resolve(s):s,this.cwd[Tft](c)}},tB=class extends cfe{static{t(this,"PathScurryWin32")}sep="\\";constructor(s=process.cwd(),c={}){let{nocase:f=!0}=c;super(s,SNe,"\\",{...c,nocase:f}),this.nocase=f;for(let d=this.cwd;d;d=d.parent)d.nocase=this.nocase}parseRootPath(s){return SNe.parse(s).root.toUpperCase()}newRoot(s){return new afe(this.rootPath,ek,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")||s.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(s)}},rB=class extends cfe{static{t(this,"PathScurryPosix")}sep="/";constructor(s=process.cwd(),c={}){let{nocase:f=!1}=c;super(s,Aar,"/",{...c,nocase:f}),this.nocase=f}parseRootPath(s){return"/"}newRoot(s){return new ofe(this.rootPath,ek,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")}},xQ=class extends rB{static{t(this,"PathScurryDarwin")}constructor(s=process.cwd(),c={}){let{nocase:f=!0}=c;super(s,{...c,nocase:f})}},ARr=process.platform==="win32"?afe:ofe,Cft=process.platform==="win32"?tB:process.platform==="darwin"?xQ:rB;var zar=t(a=>a.length>=1,"isPatternList"),qar=t(a=>a.length>=1,"isGlobList"),nB=class a{static{t(this,"Pattern")}#r;#n;#e;length;#t;#s;#p;#a;#_;#c;#l=!0;constructor(s,c,f,d){if(!zar(s))throw new TypeError("empty pattern list");if(!qar(c))throw new TypeError("empty glob list");if(c.length!==s.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=s.length,f<0||f>=this.length)throw new TypeError("index out of range");if(this.#r=s,this.#n=c,this.#e=f,this.#t=d,this.#e===0){if(this.isUNC()){let[v,E,A,O,...M]=this.#r,[H,$,K,Ne,...xe]=this.#n;M[0]===""&&(M.shift(),xe.shift());let Te=[v,E,A,O,""].join("/"),Tt=[H,$,K,Ne,""].join("/");this.#r=[Te,...M],this.#n=[Tt,...xe],this.length=this.#r.length}else if(this.isDrive()||this.isAbsolute()){let[v,...E]=this.#r,[A,...O]=this.#n;E[0]===""&&(E.shift(),O.shift());let M=v+"/",H=A+"/";this.#r=[M,...E],this.#n=[H,...O],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]===ry}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 Var=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",iB=class{static{t(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(s,{nobrace:c,nocase:f,noext:d,noglobstar:v,platform:E=Var}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=E,this.mmopts={dot:!0,nobrace:c,nocase:f,noext:d,noglobstar:v,optimizationLevel:2,platform:E,nocomment:!0,nonegate:!0};for(let A of s)this.add(A)}add(s){let c=new AS(s,this.mmopts);for(let f=0;f<c.set.length;f++){let d=c.set[f],v=c.globParts[f];if(!d||!v)throw new Error("invalid pattern object");for(;d[0]==="."&&v[0]===".";)d.shift(),v.shift();let E=new nB(d,v,0,this.platform),A=new AS(E.globString(),this.mmopts),O=v[v.length-1]==="**",M=E.isAbsolute();M?this.absolute.push(A):this.relative.push(A),O&&(M?this.absoluteChildren.push(A):this.relativeChildren.push(A))}}ignored(s){let c=s.fullpath(),f=`${c}/`,d=s.relative()||".",v=`${d}/`;for(let E of this.relative)if(E.match(d)||E.match(v))return!0;for(let E of this.absolute)if(E.match(c)||E.match(f))return!0;return!1}childrenIgnored(s){let c=s.fullpath()+"/",f=(s.relative()||".")+"/";for(let d of this.relativeChildren)if(d.match(f))return!0;for(let d of this.absoluteChildren)if(d.match(c))return!0;return!1}};var CNe=class a{static{t(this,"HasWalkedCache")}store;constructor(s=new Map){this.store=s}copy(){return new a(new Map(this.store))}hasWalked(s,c){return this.store.get(s.fullpath())?.has(c.globString())}storeWalked(s,c){let f=s.fullpath(),d=this.store.get(f);d?d.add(c.globString()):this.store.set(f,new Set([c.globString()]))}},ENe=class{static{t(this,"MatchRecord")}store=new Map;add(s,c,f){let d=(c?2:0)|(f?1:0),v=this.store.get(s);this.store.set(s,v===void 0?d:d&v)}entries(){return[...this.store.entries()].map(([s,c])=>[s,!!(c&2),!!(c&1)])}},xNe=class{static{t(this,"SubWalks")}store=new Map;add(s,c){if(!s.canReaddir())return;let f=this.store.get(s);f?f.find(d=>d.globString()===c.globString())||f.push(c):this.store.set(s,[c])}get(s){let c=this.store.get(s);if(!c)throw new Error("attempting to walk unknown path");return c}entries(){return this.keys().map(s=>[s,this.store.get(s)])}keys(){return[...this.store.keys()].filter(s=>s.canReaddir())}},DQ=class a{static{t(this,"Processor")}hasWalkedCache;matches=new ENe;subwalks=new xNe;patterns;follow;dot;opts;constructor(s,c){this.opts=s,this.follow=!!s.follow,this.dot=!!s.dot,this.hasWalkedCache=c?c.copy():new CNe}processPatterns(s,c){this.patterns=c;let f=c.map(d=>[s,d]);for(let[d,v]of f){this.hasWalkedCache.storeWalked(d,v);let E=v.root(),A=v.isAbsolute()&&this.opts.absolute!==!1;if(E){d=d.resolve(E==="/"&&this.opts.root!==void 0?this.opts.root:E);let $=v.rest();if($)v=$;else{this.matches.add(d,!0,!1);continue}}if(d.isENOENT())continue;let O,M,H=!1;for(;typeof(O=v.pattern())=="string"&&(M=v.rest());)d=d.resolve(O),v=M,H=!0;if(O=v.pattern(),M=v.rest(),H){if(this.hasWalkedCache.hasWalked(d,v))continue;this.hasWalkedCache.storeWalked(d,v)}if(typeof O=="string"){let $=O===".."||O===""||O===".";this.matches.add(d.resolve(O),A,$);continue}else if(O===ry){(!d.isSymbolicLink()||this.follow||v.checkFollowGlobstar())&&this.subwalks.add(d,v);let $=M?.pattern(),K=M?.rest();if(!M||($===""||$===".")&&!K)this.matches.add(d,A,$===""||$===".");else if($===".."){let Ne=d.parent||d;K?this.hasWalkedCache.hasWalked(Ne,K)||this.subwalks.add(Ne,K):this.matches.add(Ne,A,!0)}}else O instanceof RegExp&&this.subwalks.add(d,v)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new a(this.opts,this.hasWalkedCache)}filterEntries(s,c){let f=this.subwalks.get(s),d=this.child();for(let v of c)for(let E of f){let A=E.isAbsolute(),O=E.pattern(),M=E.rest();O===ry?d.testGlobstar(v,E,M,A):O instanceof RegExp?d.testRegExp(v,O,M,A):d.testString(v,O,M,A)}return d}testGlobstar(s,c,f,d){if((this.dot||!s.name.startsWith("."))&&(c.hasMore()||this.matches.add(s,d,!1),s.canReaddir()&&(this.follow||!s.isSymbolicLink()?this.subwalks.add(s,c):s.isSymbolicLink()&&(f&&c.checkFollowGlobstar()?this.subwalks.add(s,f):c.markFollowGlobstar()&&this.subwalks.add(s,c)))),f){let v=f.pattern();if(typeof v=="string"&&v!==".."&&v!==""&&v!==".")this.testString(s,v,f.rest(),d);else if(v===".."){let E=s.parent||s;this.subwalks.add(E,f)}else v instanceof RegExp&&this.testRegExp(s,v,f.rest(),d)}}testRegExp(s,c,f,d){c.test(s.name)&&(f?this.subwalks.add(s,f):this.matches.add(s,d,!1))}testString(s,c,f,d){s.isNamed(c)&&(f?this.subwalks.add(s,f):this.matches.add(s,d,!1))}};var War=t((a,s)=>typeof a=="string"?new iB([a],s):Array.isArray(a)?new iB(a,s):a,"makeIgnore"),lfe=class{static{t(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#r=[];#n;#e;signal;maxDepth;includeChildMatches;constructor(s,c,f){if(this.patterns=s,this.path=c,this.opts=f,this.#e=!f.posix&&f.platform==="win32"?"\\":"/",this.includeChildMatches=f.includeChildMatches!==!1,(f.ignore||!this.includeChildMatches)&&(this.#n=War(f.ignore??[],f),!this.includeChildMatches&&typeof this.#n.add!="function")){let d="cannot ignore child matches, ignore lacks add() method.";throw new Error(d)}this.maxDepth=f.maxDepth||1/0,f.signal&&(this.signal=f.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,c){if(c&&this.opts.nodir)return;let f;if(this.opts.realpath){if(f=s.realpathCached()||await s.realpath(),!f)return;s=f}let v=s.isUnknown()||this.opts.stat?await s.lstat():s;if(this.opts.follow&&this.opts.nodir&&v?.isSymbolicLink()){let E=await v.realpath();E&&(E.isUnknown()||this.opts.stat)&&await E.lstat()}return this.matchCheckTest(v,c)}matchCheckTest(s,c){return s&&(this.maxDepth===1/0||s.depth()<=this.maxDepth)&&(!c||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,c){if(c&&this.opts.nodir)return;let f;if(this.opts.realpath){if(f=s.realpathCached()||s.realpathSync(),!f)return;s=f}let v=s.isUnknown()||this.opts.stat?s.lstatSync():s;if(this.opts.follow&&this.opts.nodir&&v?.isSymbolicLink()){let E=v.realpathSync();E&&(E?.isUnknown()||this.opts.stat)&&E.lstatSync()}return this.matchCheckTest(v,c)}matchFinish(s,c){if(this.#t(s))return;if(!this.includeChildMatches&&this.#n?.add){let v=`${s.relativePosix()}/**`;this.#n.add(v)}let f=this.opts.absolute===void 0?c:this.opts.absolute;this.seen.add(s);let d=this.opts.mark&&s.isDirectory()?this.#e:"";if(this.opts.withFileTypes)this.matchEmit(s);else if(f){let v=this.opts.posix?s.fullpathPosix():s.fullpath();this.matchEmit(v+d)}else{let v=this.opts.posix?s.relativePosix():s.relative(),E=this.opts.dotRelative&&!v.startsWith(".."+this.#e)?"."+this.#e:"";this.matchEmit(v?E+v+d:"."+d)}}async match(s,c,f){let d=await this.matchCheck(s,f);d&&this.matchFinish(d,c)}matchSync(s,c,f){let d=this.matchCheckSync(s,f);d&&this.matchFinish(d,c)}walkCB(s,c,f){this.signal?.aborted&&f(),this.walkCB2(s,c,new DQ(this.opts),f)}walkCB2(s,c,f,d){if(this.#s(s))return d();if(this.signal?.aborted&&d(),this.paused){this.onResume(()=>this.walkCB2(s,c,f,d));return}f.processPatterns(s,c);let v=1,E=t(()=>{--v===0&&d()},"next");for(let[A,O,M]of f.matches.entries())this.#t(A)||(v++,this.match(A,O,M).then(()=>E()));for(let A of f.subwalkTargets()){if(this.maxDepth!==1/0&&A.depth()>=this.maxDepth)continue;v++;let O=A.readdirCached();A.calledReaddir()?this.walkCB3(A,O,f,E):A.readdirCB((M,H)=>this.walkCB3(A,H,f,E),!0)}E()}walkCB3(s,c,f,d){f=f.filterEntries(s,c);let v=1,E=t(()=>{--v===0&&d()},"next");for(let[A,O,M]of f.matches.entries())this.#t(A)||(v++,this.match(A,O,M).then(()=>E()));for(let[A,O]of f.subwalks.entries())v++,this.walkCB2(A,O,f.child(),E);E()}walkCBSync(s,c,f){this.signal?.aborted&&f(),this.walkCB2Sync(s,c,new DQ(this.opts),f)}walkCB2Sync(s,c,f,d){if(this.#s(s))return d();if(this.signal?.aborted&&d(),this.paused){this.onResume(()=>this.walkCB2Sync(s,c,f,d));return}f.processPatterns(s,c);let v=1,E=t(()=>{--v===0&&d()},"next");for(let[A,O,M]of f.matches.entries())this.#t(A)||this.matchSync(A,O,M);for(let A of f.subwalkTargets()){if(this.maxDepth!==1/0&&A.depth()>=this.maxDepth)continue;v++;let O=A.readdirSync();this.walkCB3Sync(A,O,f,E)}E()}walkCB3Sync(s,c,f,d){f=f.filterEntries(s,c);let v=1,E=t(()=>{--v===0&&d()},"next");for(let[A,O,M]of f.matches.entries())this.#t(A)||this.matchSync(A,O,M);for(let[A,O]of f.subwalks.entries())v++,this.walkCB2Sync(A,O,f.child(),E);E()}},AQ=class extends lfe{static{t(this,"GlobWalker")}matches=new Set;constructor(s,c,f){super(s,c,f)}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,c)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?c(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}},kQ=class extends lfe{static{t(this,"GlobStream")}results;constructor(s,c,f){super(s,c,f),this.results=new SN({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 Gar=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Dx=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,c){if(!c)throw new TypeError("glob options required");if(this.withFileTypes=!!c.withFileTypes,this.signal=c.signal,this.follow=!!c.follow,this.dot=!!c.dot,this.dotRelative=!!c.dotRelative,this.nodir=!!c.nodir,this.mark=!!c.mark,c.cwd?(c.cwd instanceof URL||c.cwd.startsWith("file://"))&&(c.cwd=Har(c.cwd)):this.cwd="",this.cwd=c.cwd||"",this.root=c.root,this.magicalBraces=!!c.magicalBraces,this.nobrace=!!c.nobrace,this.noext=!!c.noext,this.realpath=!!c.realpath,this.absolute=c.absolute,this.includeChildMatches=c.includeChildMatches!==!1,this.noglobstar=!!c.noglobstar,this.matchBase=!!c.matchBase,this.maxDepth=typeof c.maxDepth=="number"?c.maxDepth:1/0,this.stat=!!c.stat,this.ignore=c.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof s=="string"&&(s=[s]),this.windowsPathsNoEscape=!!c.windowsPathsNoEscape||c.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(s=s.map(O=>O.replace(/\\/g,"/"))),this.matchBase){if(c.noglobstar)throw new TypeError("base matching requires globstar");s=s.map(O=>O.includes("/")?O:`./**/${O}`)}if(this.pattern=s,this.platform=c.platform||Gar,this.opts={...c,platform:this.platform},c.scurry){if(this.scurry=c.scurry,c.nocase!==void 0&&c.nocase!==c.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let O=c.platform==="win32"?tB:c.platform==="darwin"?xQ:c.platform?rB:Cft;this.scurry=new O(this.cwd,{nocase:c.nocase,fs:c.fs})}this.nocase=this.scurry.nocase;let f=this.platform==="darwin"||this.platform==="win32",d={...c,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:f,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},v=this.pattern.map(O=>new AS(O,d)),[E,A]=v.reduce((O,M)=>(O[0].push(...M.set),O[1].push(...M.globParts),O),[[],[]]);this.patterns=E.map((O,M)=>{let H=A[M];if(!H)throw new Error("invalid pattern object");return new nB(O,H,0,this.platform)})}async walk(){return[...await new AQ(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 AQ(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 kQ(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 kQ(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 DNe=t((a,s={})=>{Array.isArray(a)||(a=[a]);for(let c of a)if(new AS(c,s).hasMagic())return!0;return!1},"hasMagic");function ufe(a,s={}){return new Dx(a,s).streamSync()}t(ufe,"globStreamSync");function xft(a,s={}){return new Dx(a,s).stream()}t(xft,"globStream");function Dft(a,s={}){return new Dx(a,s).walkSync()}t(Dft,"globSync");async function Eft(a,s={}){return new Dx(a,s).walk()}t(Eft,"glob_");function ffe(a,s={}){return new Dx(a,s).iterateSync()}t(ffe,"globIterateSync");function Aft(a,s={}){return new Dx(a,s).iterate()}t(Aft,"globIterate");var Qar=ufe,Kar=Object.assign(xft,{sync:ufe}),Yar=ffe,Xar=Object.assign(Aft,{sync:ffe}),Zar=Object.assign(Dft,{stream:ufe,iterate:ffe}),wQ=Object.assign(Eft,{glob:Eft,globSync:Dft,sync:Zar,globStream:xft,stream:Kar,globStreamSync:ufe,streamSync:Qar,globIterate:Aft,iterate:Xar,globIterateSync:ffe,iterateSync:Yar,Glob:Dx,hasMagic:DNe,escape:Kj,unescape:Cx});wQ.glob=wQ;import Ude from"fs";import uRe from"path";var xv=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 eor="[",tor="]",ror="{",nor="}",ior=":",sor=",",aor="true",oor="false",cor="null",lor="NaN",uor="Infinity",kNe='"',PQ=new Map([[34,kNe],[92,"\\"],[47,"/"],[98,"\b"],[110,`
576
576
  `],[102,"\f"],[114,"\r"],[116," "]]),dfe=new Map([...PQ,[118,"\v"],[48,"\0"]]),_or=new Map([[kNe,kNe],["\\","\\"],["/","/"],["\b","b"],[`
577
577
  `,"n"],["\f","f"],["\r","r"],[" ","t"]]),_Mr=new Map([..._or,["\v","v"],["\0","0"],["\u2028","u2028"],["\u2029","u2029"]]),pfe=new Map([[eor,"LBracket"],[tor,"RBracket"],[ror,"LBrace"],[nor,"RBrace"],[ior,"Colon"],[sor,"Comma"],[aor,"Boolean"],[oor,"Boolean"],[cor,"Null"]]),_fe=new Map([...pfe,[lor,"Number"],[uor,"Number"]]),wNe=new Set([10,13,8232,8233]),o6=class extends Error{static{t(this,"ErrorWithLocation")}constructor(s,{line:c,column:f,offset:d}){super(`${s} (${c}:${f})`),this.line=c,this.column=f,this.offset=d}},PNe=class extends o6{static{t(this,"UnexpectedChar")}constructor(s,c){super(`Unexpected character '${String.fromCharCode(s)}' found.`,c)}},NNe=class extends o6{static{t(this,"UnexpectedIdentifier")}constructor(s,c){super(`Unexpected identifier '${s}' found.`,c)}},GF=class extends o6{static{t(this,"UnexpectedToken")}constructor(s){super(`Unexpected token ${s.type} found.`,s.loc.start)}},mfe=class extends o6{static{t(this,"UnexpectedEOF")}constructor(s){super("Unexpected end of input found.",s)}},por=/[\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]/,dor=/[\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]/,mor=13,kft=10,INe=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===mor?(this.#s=!0,this.peek()===kft&&this.#t++):s===kft&&(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}},hor="Infinity",gor="NaN",yor=new Set([116,102,110]),ONe=new Set([32,9,10,13]),wft=new Set([...ONe,11,12,160,8232,8233,65279,160,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288]),vor={mode:"json",ranges:!1},bor=new Set(["true","false","null"]),G_={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 a6(a){return a>=48&&a<=57}t(a6,"isDigit");function ANe(a){return a6(a)||a>=65&&a<=70||a>=97&&a<=102}t(ANe,"isHexDigit");function Sor(a){return a>=49&&a<=57}t(Sor,"isPositiveDigit");function Tor(a){return yor.has(a)}t(Tor,"isKeywordStart");function Nft(a){return a6(a)||a===46||a===45}t(Nft,"isNumberStart");function Cor(a){return Nft(a)||a===43}t(Cor,"isJSON5NumberStart");function Pft(a,s){return a===34||s&&a===39}t(Pft,"isStringStart");function Ift(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 por.test(s)}t(Ift,"isJSON5IdentifierStart");function Eor(a){if(Ift(a)||a6(a))return!0;let s=String.fromCharCode(a);return dor.test(s)}t(Eor,"isJSON5IdentifierPart");var FNe=class{static{t(this,"Tokenizer")}#r;#n;#e;#t;#s;#p;#a;#_;#c;#l;#i;constructor(s,c){this.#n=s,this.#r={...vor,...c},this.#e=new INe(s),this.#t=this.#r.mode==="json5",this.#s=this.#r.mode!=="json",this.#p=this.#r.ranges,this.#_=this.#t?dfe.has.bind(dfe):PQ.has.bind(PQ),this.#c=this.#t?wNe.has.bind(wNe):()=>!1,this.#l=this.#t?f=>f===120:()=>!1,this.#i=this.#t?wft.has.bind(wft):ONe.has.bind(ONe)}#f(s,c=this.#e.locate()){throw new PNe(s,c)}#v(s,c=this.#e.locate()){throw new NNe(s,c)}#d(){throw new mfe(this.#e.locate())}#u(s,c,f,d){let v=f.offset+c,E=this.#r.ranges?{range:[f.offset,v]}:void 0;return{type:s,loc:{start:f,end:d||{line:f.line,column:f.column+c,offset:v}},...E}}#m(s){let c="",f;for(let d=0;d<s;d++){if(f=this.#e.peek(),ANe(f)){this.#e.next(),c+=String.fromCharCode(f);continue}this.#f(f)}return c}#g(s){let c="";do{if(c+=String.fromCharCode(s),s===92&&(s=this.#e.next(),s!==117&&this.#f(s),c+=String.fromCharCode(s),c+=this.#m(4)),s=this.#e.peek(),!Eor(s))break;this.#e.next()}while(!0);return c}#x(s){let c=s,f=1;for(s=this.#e.peek();s!==-1&&s!==c;){if(this.#e.next(),f++,s===92)if(s=this.#e.peek(),this.#_(s)||this.#c(s))this.#e.next(),f++;else if(s===117){this.#e.next(),f++;let d=this.#m(4);f+=d.length}else if(this.#l(s)){this.#e.next(),f++;let d=this.#m(2);f+=d.length}else this.#t?(this.#e.next(),f++):this.#f(s);s=this.#e.peek()}return s===-1&&(this.#e.next(),this.#d()),this.#e.next(),f++,f}#C(s){let c=1;if(s===45||this.#t&&s===43){if(s=this.#e.peek(),this.#t&&(s===73||s===78)){this.#e.next();let f=this.#g(s);return f!==hor&&f!==gor&&this.#f(s),c+f.length}a6(s)||this.#f(s),this.#e.next(),c++}if(s===48)if(s=this.#e.peek(),this.#t&&(s===120||s===88)){this.#e.next(),c++,s=this.#e.peek(),ANe(s)||(this.#e.next(),this.#f(s));do this.#e.next(),c++,s=this.#e.peek();while(ANe(s))}else a6(s)&&this.#f(s);else if(!this.#t||s!==46)for(Sor(s)||this.#f(s),s=this.#e.peek();a6(s);)this.#e.next(),c++,s=this.#e.peek();if(s===46){let f=-1;for(this.#e.next(),c++,f++,s=this.#e.peek();a6(s);)this.#e.next(),c++,f++,s=this.#e.peek();!this.#t&&f===0&&(this.#e.next(),s?this.#f(s):this.#d())}if(s===101||s===69)for(this.#e.next(),c++,s=this.#e.peek(),(s===43||s===45)&&(this.#e.next(),c++,s=this.#e.peek()),s===-1&&(this.#e.next(),this.#d()),a6(s)||(this.#e.next(),this.#f(s));a6(s);)this.#e.next(),c++,s=this.#e.peek();return c}#b(s){let c=1;if(s=this.#e.peek(),s===47){do this.#e.next(),c+=1,s=this.#e.peek();while(s>-1&&s!==13&&s!==10);return{length:c,multiline:!1}}if(s===42){for(this.#e.next(),c+=1;s>-1;)if(s=this.#e.peek(),s===42){if(this.#e.next(),c+=1,s=this.#e.peek(),s===47)return this.#e.next(),c+=1,{length:c,multiline:!0}}else this.#e.next(),c+=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 G_.EOF;let c=this.#e.locate(),f=String.fromCharCode(s);if(this.#t)if(_fe.has(f))this.#a=this.#u(_fe.get(f),1,c);else if(Ift(s)){let d=this.#g(s);_fe.has(d)?this.#a=this.#u(_fe.get(d),d.length,c):this.#a=this.#u("Identifier",d.length,c)}else if(Cor(s)){let d=this.#C(s);this.#a=this.#u("Number",d,c)}else if(Pft(s,this.#t)){let d=this.#x(s),v=this.#e.locate();this.#a=this.#u("String",d,c,{line:v.line,column:v.column+1,offset:v.offset+1})}else if(s===47&&this.#s){let d=this.#b(s),v=this.#e.locate();this.#a=this.#u(d.multiline?"BlockComment":"LineComment",d.length,c,{line:v.line,column:v.column+1,offset:v.offset+1})}else this.#f(s);else if(pfe.has(f))this.#a=this.#u(pfe.get(f),1,c);else if(Tor(s)){let d=this.#g(s);bor.has(d)||this.#v(d,c),this.#a=this.#u(pfe.get(d),d.length,c)}else if(Nft(s)){let d=this.#C(s);this.#a=this.#u("Number",d,c)}else if(Pft(s,this.#t)){let d=this.#x(s);this.#a=this.#u("String",d,c)}else if(s===47&&this.#s){let d=this.#b(s),v=this.#e.locate();this.#a=this.#u(d.multiline?"BlockComment":"LineComment",d.length,c,{line:v.line,column:v.column+1,offset:v.offset+1})}else this.#f(s);return G_[this.#a.type]}get token(){return this.#a}};var hC={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,c={}){return{type:"Member",name:a,value:s,loc:c.loc,...c}},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}}},xor={mode:"json",ranges:!1,tokens:!1,allowTrailingCommas:!1};function Dor(a,s,c=!1){let f="",d=a.indexOf("\\"),v=0;for(;d>=0;){f+=a.slice(v,d);let E=a.charAt(d+1),A=E.charCodeAt(0);if(c&&dfe.has(A))f+=dfe.get(A),v=d+2;else if(PQ.has(A))f+=PQ.get(A),v=d+2;else if(E==="u"){let O=a.slice(d+2,d+6);if(O.length<4||/[^0-9a-f]/i.test(O))throw new o6(`Invalid unicode escape \\u${O}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});f+=String.fromCharCode(parseInt(O,16)),v=d+6}else if(c&&E==="x"){let O=a.slice(d+2,d+4);if(O.length<2||/[^0-9a-f]/i.test(O))throw new o6(`Invalid hex escape \\x${O}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});f+=String.fromCharCode(parseInt(O,16)),v=d+4}else if(c&&wNe.has(A))v=d+2,E==="\r"&&a.charAt(v)===`
578
- `&&v++;else if(c)f+=E,v=d+2;else throw new o6(`Invalid escape \\${E}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});d=a.indexOf("\\",v)}return f+=a.slice(v),f}t(Dor,"getStringValue");function Aor(a,s,c=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return Dor(a.slice(1,-1),s,c);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(Aor,"getLiteralValue");function Oft(a,s){s=Object.freeze({...xor,...s});let c=[],f=new FNe(a,{mode:s.mode,ranges:s.ranges}),d=s.mode==="json5",v=s.allowTrailingCommas||d;function E(){let pr=f.next();return pr&&s.tokens&&c.push(f.token),pr}t(E,"nextNoComments");function A(){let pr=f.next();return pr&&s.tokens&&c.push(f.token),pr>=G_.LineComment?A():pr}t(A,"nextSkipComments");let O=s.mode==="json"?E:A;function M(pr,sr){if(pr!==sr)throw new GF(f.token)}t(M,"assertTokenType");function H(pr,sr){if(!sr.includes(pr))throw new GF(f.token)}t(H,"assertTokenTypes");function $(pr,sr){return s.ranges?{range:[pr.offset,sr.offset]}:void 0}t($,"createRange");function K(pr){let sr=f.token,Cs=$(sr.loc.start,sr.loc.end),Di=Aor(a.slice(sr.loc.start.offset,sr.loc.end.offset),sr,d),hi={loc:{start:{...sr.loc.start},end:{...sr.loc.end}},...Cs};switch(pr){case G_.String:return hC.string(Di,hi);case G_.Number:return hC.number(Di,hi);case G_.Boolean:return hC.boolean(Di,hi);default:throw new TypeError(`Unknown token type ${sr.type}.`)}}t(K,"createLiteralNode");function Ne(pr){let sr=$(pr.loc.start,pr.loc.end),Cs=a.slice(pr.loc.start.offset,pr.loc.end.offset),_o={loc:{start:{...pr.loc.start},end:{...pr.loc.end}},...sr};if(pr.type!=="Identifier"){let hi="";return(Cs[0]==="+"||Cs[0]==="-")&&(hi=Cs[0]),hC[Cs.includes("NaN")?"nan":"infinity"](hi,_o)}return hC.identifier(Cs,_o)}t(Ne,"createJSON5IdentifierNode");function xe(pr){let sr=$(pr.loc.start,pr.loc.end);return hC.null({loc:{start:{...pr.loc.start},end:{...pr.loc.end}},...sr})}t(xe,"createNullNode");function Te(pr){d?H(pr,[G_.String,G_.Identifier,G_.Number]):M(pr,G_.String);let sr=f.token,Cs=pr===G_.String?K(pr):Ne(sr);if(d&&(Cs.type==="NaN"||Cs.type==="Infinity")){if(Cs.sign!=="")throw new GF(f.token);Cs=hC.identifier(Cs.type,{loc:Cs.loc,...$(Cs.loc.start,Cs.loc.end)})}pr=O(),M(pr,G_.Colon);let Di=br(),_o=$(Cs.loc.start,Di.loc.end);return hC.member(Cs,Di,{loc:{start:{...Cs.loc.start},end:{...Di.loc.end}},..._o})}t(Te,"parseProperty");function Tt(pr){M(pr,G_.LBrace);let sr=f.token,Cs=[],Di=O();if(Di!==G_.RBrace)do{if(Cs.push(Te(Di)),Di=O(),!Di)throw new mfe(Cs[Cs.length-1].loc.end);if(Di===G_.Comma){if(Di=O(),v&&Di===G_.RBrace)break}else break}while(Di);M(Di,G_.RBrace);let _o=f.token,hi=$(sr.loc.start,_o.loc.end);return hC.object(Cs,{loc:{start:{...sr.loc.start},end:{..._o.loc.end}},...hi})}t(Tt,"parseObject");function Dt(pr){M(pr,G_.LBracket);let sr=f.token,Cs=[],Di=O();if(Di!==G_.RBracket)do{let No=br(Di);if(Cs.push(hC.element(No,{loc:No.loc})),Di=O(),Di===G_.Comma){if(Di=O(),v&&Di===G_.RBracket)break}else break}while(Di);M(Di,G_.RBracket);let _o=f.token,hi=$(sr.loc.start,_o.loc.end);return hC.array(Cs,{loc:{start:{...sr.loc.start},end:{..._o.loc.end}},...hi})}t(Dt,"parseArray");function br(pr){pr=pr??O();let sr=f.token;switch(pr){case G_.String:case G_.Boolean:return K(pr);case G_.Number:if(d){let Cs=a.slice(sr.loc.start.offset,sr.loc.end.offset);if((Cs[0]==="+"||Cs[0]==="-")&&(Cs=Cs.slice(1)),Cs==="NaN"||Cs==="Infinity")return Ne(sr)}return K(pr);case G_.Null:return xe(sr);case G_.LBrace:return Tt(pr);case G_.LBracket:return Dt(pr);default:throw new GF(sr)}}t(br,"parseValue");let dr=br();if(O())throw new GF(f.token);let Cr={loc:{start:{line:1,column:1,offset:0},end:{...dr.loc.end}}};return s.tokens&&(Cr.tokens=c),s.ranges&&(Cr.range=[Cr.loc.start.offset,Cr.loc.end.offset]),hC.document(dr,Cr)}t(Oft,"parse");var kor=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function Fft(a){return a&&typeof a=="object"}t(Fft,"isObject");function wor(a){return Fft(a)&&typeof a.type=="string"}t(wor,"isNode");function Por(a,s){function c(f,d){typeof s.enter=="function"&&s.enter(f,d);for(let v of kor.get(f.type)){let E=f[v];Fft(E)&&(Array.isArray(E)?E.forEach(A=>c(A,f)):wor(E)&&c(E,f))}typeof s.exit=="function"&&s.exit(f,d)}t(c,"visitNode"),c(a)}t(Por,"traverse");function Lft(a,s=()=>!0){let c=[];return Por(a,{enter(f,d){c.push({node:f,parent:d,phase:"enter"})},exit(f,d){c.push({node:f,parent:d,phase:"exit"})}}),c.filter(s).values()}t(Lft,"iterator");import Nor from"fs/promises";var NQ=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),hfe=t(async a=>{try{return await Nor.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),IQ=t(async a=>{try{return Oft(a)}catch(s){if(s.column&&s.line&&s.message){let c=NQ(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:c}}return}},"getSchemaAST");var Rft=t(async(a,s,c)=>{try{if(a.length===0)return;for(let f of a){let d=await hfe(f),v=await Ior(d,f,s,c);if(v)return v}}catch{}},"getRouteLocationByValue"),Ior=t(async(a,s,c,f)=>{try{if(!a)return;let d=null,v=await IQ(a);if(v){for(let{node:E}of Lft(v))if(E.value&&E.value===c){d=E.loc;break}if(d!==null){let E=NQ(a,d.start.line);return{file:s,line:d.start.line,column:d.start.column,length:d.end.column-d.start.column,lineText:E,suggestion:f}}}}catch{}},"getRouteLocationByValueFromSchema");import Mft from"fs/promises";import gfe from"path";var LNe="schemas",RNe=".oas.json";var QF=t(async a=>(await Mft.readdir(a)).map(c=>`${a}/${c}`).filter(c=>c.endsWith(RNe)).sort(),"getOpenApiFilesByAlphabetical"),sB=t(async a=>{let s=gfe.resolve(a,"config");return(await Mft.readdir(s)).filter(f=>f.endsWith(RNe)).length>=1},"oasFileInProject");function OQ(a,s,c,f,d,v,E){if(v.has(c))return;let A;try{A=f.get(c)}catch(O){throw new Tv({text:`Failed to resolve reference: ${c}`,detail:O.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:c,namespace:s,suggestion:"Check the reference and try again."}})}v.set(c,d.length),d.push(c),MNe(jNe(c),s,A,f,d,v,E)}t(OQ,"chaseRefs");function MNe(a,s,c,f,d,v,E){if(Array.isArray(c))for(let A of c)MNe(a,s,A,f,d,v,E);else if(typeof c=="object")for(let A in c){if(A==="$ref"){let O=c[A];E&&(c[A]=E(s,O)),OQ(a,s,TN(a,O),f,d,v,E)}MNe(a,s,c[A],f,d,v,E)}}t(MNe,"lookForRefs");function TN(a,s){let c=s.indexOf("#");return c>=0?`${gfe.resolve(a,s.substring(0,c))}${s.substring(c)}`:gfe.resolve(gfe.dirname(a),s)}t(TN,"getFullyQualifiedRefName");function jNe(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(jNe,"getFilePathNameFromRefName");var BNe=class{static{t(this,"Environment")}get ZUP_HOSTNAME(){return process.env.ZUP_HOSTNAME??"zuplo.app"}get ZUP_WORKING_COPY_HOSTNAME(){return process.env.ZUP_WORKING_COPY_HOSTNAME??"working-copy.zuplotest.com"}},Oor=new BNe,UNe=Oor;var KQ=W_(t8e(),1);var n8e={};Llt(n8e,{UnsafePathError:()=>qfe,deleteFolder:()=>w_r,dirExists:()=>r8e,fileExists:()=>v_r,getParentDirFilename:()=>D_r,isNotFileOrDirectory:()=>S_r,listFolderContents:()=>fdt,listFolders:()=>C_r,mkDirTemp:()=>b_r,mkdirForFilePathIfNotExits:()=>E_r,mkdirIfNotExists:()=>_dt,safePath:()=>x_r,tarFolder:()=>A_r,untarFile:()=>k_r});import{spawn as ldt}from"child_process";import{randomUUID as g_r}from"crypto";import PN from"fs/promises";import{tmpdir as y_r}from"os";import wN from"path";var udt=[".git","node_modules",".yarn",".DS_Store"];async function v_r(a){try{return(await PN.stat(a)).isFile()}catch{return!1}}t(v_r,"fileExists");async function b_r(){let a=y_r(),s=g_r().replaceAll("-",""),c=wN.join(a,s);return await PN.mkdir(c,{recursive:!0}),c}t(b_r,"mkDirTemp");async function r8e(a){try{return(await PN.stat(a)).isDirectory()}catch{return!1}}t(r8e,"dirExists");async function S_r(a){try{return await PN.stat(a),!1}catch{return!0}}t(S_r,"isNotFileOrDirectory");function T_r(a,s){let c=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),f=a.match(c);if(!f)return"";let d=a.split(f[0]);return d[1]===""?"":`/${d[1]}`}t(T_r,"getParentDirectory");async function C_r(a){if(!await r8e(a))return[];let s=await PN.readdir(a,{withFileTypes:!0}),c=[];for await(let f of s)udt.includes(f.name)||f.isDirectory()&&c.push(f.name);return c}t(C_r,"listFolders");async function fdt(a,s,c=!0){let f=T_r(a,s),d=await PN.readdir(a,{withFileTypes:!0}),v=[];for await(let E of d)if(!udt.includes(E.name)||!c)if(E.isDirectory()){let A=await fdt(wN.join(a,E.name),s,c);v.push(...A)}else v.push(wN.join(f,E.name));return v}t(fdt,"listFolderContents");var _dt=t(async a=>{await PN.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),E_r=t(async a=>{let s=wN.dirname(a);return _dt(s)},"mkdirForFilePathIfNotExits"),qfe=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function x_r(a){let s=t(c=>{if(!c.startsWith(a))throw new qfe("Resolved path is not part of the project.");return c},"ensureSafePath");return{resolve:t((...c)=>s(wN.resolve(...c)),"resolve")}}t(x_r,"safePath");function D_r(a){return`${wN.basename(wN.dirname(a))}/${wN.basename(a)}`}t(D_r,"getParentDirFilename");async function A_r({folderPath:a,outputTarPath:s,exclude:c=["node_modules",".git","dist"]}){return new Promise((f,d)=>{let v=ldt("tar",[...c.map(E=>["--exclude",E]).flat(),"-cvf",s,"-C",a,"."]);process.env.DEBUG_TAR&&(v.stdout.on("data",E=>{let A=E.toString().trim();A.length>0&&console.info(A)}),v.stderr.on("data",E=>{let A=E.toString().trim();A.length>0&&console.error(A)})),v.on("close",E=>{E===0?f(`Folder archived to ${s}`):d(new Error(`tar process exited with code ${E}`))}),v.on("error",E=>{d(E)})})}t(A_r,"tarFolder");async function k_r({tarFilePath:a,outputDir:s}){return new Promise((c,f)=>{let d=ldt("tar",["-xvf",a,"-C",s]);process.env.DEBUG_TAR&&(d.stdout.on("data",v=>{let E=v.toString().trim();E.length>0&&console.info(E)}),d.stderr.on("data",v=>{let E=v.toString().trim();E.length>0&&console.error(E)})),d.on("close",v=>{v===0?c("Extraction completed."):f(new Error(`tar process exited with code ${v}`))}),d.on("error",v=>{f(v)})})}t(k_r,"untarFile");async function w_r(a){if(await r8e(a))return await PN.rm(a,{recursive:!0})}t(w_r,"deleteFolder");var Ml=n8e;var bC=W_(t8e(),1);import{readFile as P_r}from"fs/promises";var i7=class extends Error{static{t(this,"CustomResolveError")}},NN=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,c){this.sourceDirectory=s,this.logger=c}dereference(s,c){return KQ.$RefParser.dereference(s,{resolve:{json:!0,file:Vfe(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:c?.onDereference}})}bundle(s){return KQ.$RefParser.bundle(s,{resolve:{file:Vfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return KQ.$RefParser.parse(s,{resolve:{file:Vfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return KQ.$RefParser.resolve(s,{resolve:{file:Vfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function Vfe(a,s){return{order:100,canRead(c){let f=O_r(c.url);if(!(f===void 0||f==="file"))return!1;let v;try{v=pdt(c.url)}catch(E){throw new i7(`Malformed URI: ${c.url}`,{cause:E})}try{Ml.safePath(a).resolve(v)}catch(E){return s?.warn(E),!1}return!0},async read(c){let f;try{f=pdt(c.url)}catch(d){throw new i7(`Malformed URI: ${c.url}`,{cause:d})}try{return await P_r(f)}catch(d){throw new i7(`Error opening file "${f}"`,{cause:d})}}}}t(Vfe,"customResolver");var i8e=/^win/.test(globalThis.process?globalThis.process.platform:""),N_r=/\//g,I_r=/^(\w{2,}):\/\//i,s8e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function O_r(a){let s=I_r.exec(a);if(s)return s[1].toLowerCase()}t(O_r,"getProtocol");function pdt(a,s){a=decodeURI(a);for(let f=0;f<s8e.length;f+=2)a=a.replace(s8e[f],s8e[f+1]);let c=a.substr(0,7).toLowerCase()==="file://";return c&&(a=a[7]==="/"?a.substr(8):a.substr(7),i8e&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(c=!1,a=i8e?a:"/"+a)),i8e&&!c&&(a=a.replace(N_r,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(pdt,"toFileSystemPath");var ddt="YOUR_KEY_HERE";async function mdt(a){let c=await new NN(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),f=a.openApiDocPath.replace(a.sourceDirectory,"");return F_r({...a,relativeOpenApiPath:f},c)}t(mdt,"buildPublicOpenApiFile");async function F_r(a,s){j_r({relativeOpenApiPath:a.relativeOpenApiPath},s);let c=s;return c=R_r(c),L_r(c,a),c=M_r(c,a),hdt(c,"x-zuplo"),c}t(F_r,"buildRawOpenApiFile");function L_r(a,{deploymentUrl:s,deploymentName:c,environmentType:f}){let d;s?d=s.hostname:f&&c&&(d=f===Jlt.WORKING_COPY?`${c}.${UNe.ZUP_WORKING_COPY_HOSTNAME}`:`${c}.${UNe.ZUP_HOSTNAME}`),d?a.servers=[{url:`https://${d}`}]:a.servers=void 0}t(L_r,"addServerHost");function R_r(a){if(!a.paths)return a;let{components:s}=a,c=s?{...s}:void 0,f=[];c&&c.parameters&&(f=Object.entries(c.parameters).reduce((v,[E,A])=>(Wj in A&&jue(A[Wj])&&(v.push(E),c.parameters&&delete c.parameters[E]),v),[]));let d=Object.entries(a.paths).reduce((v,[E,A])=>{if(!A)return v;let O={...A},M=["delete","get","head","patch","post","put","trace","options"];return M.forEach(H=>{let $=A[H];if(!$)return;if(jue($[Wj])){delete O[H];return}let{parameters:K}=$;if(!K)return;let Ne=K.filter(xe=>{if(Wj in xe&&jue(xe[Wj]))return!1;if("$ref"in xe){let Te=xe.$ref.split("/").pop();return Te?!f.includes(Te):!0}return!0});O[H]={...$,parameters:Ne}}),M.some(H=>!!O[H])&&(v[E]=O),v},{});return{...a,paths:d,components:c}}t(R_r,"removeHiddenRoutesAndParams");function M_r(a,{policiesConfig:s}){if(!a.paths)return a;let c=Object.entries(a.paths).reduce((f,[d,v])=>{if(!v)return f;let E={...v};return[E.delete,E.get,E.head,E.patch,E.post,E.put,E.trace,E.options].forEach(A=>{if(!A)return;let O=A["x-zuplo-route"]?.policies?.inbound?.reduce(($,K)=>{let Ne=s.policies?.find(({name:Tt})=>Tt===K);if(!Ne)return $;if(!(Ne.handler.export==="CompositeInboundPolicy"))return $.concat(K);let Te=Ne.handler.options?.policies;return Te?$.concat(Te):$},[]),M=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="ApiAuthKeyInboundPolicy"||K.handler.export==="ApiKeyInboundPolicy")&&!K.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&M.push(K)})}),M.length>0){let $=M.length>0&&M[0].handler&&M[0].handler.options&&M[0].handler.options.authHeader?M[0].handler.options.authHeader:"Authorization",K=M.length>0&&M[0].handler&&M[0].handler.options&&(M[0].handler.options.authScheme||M[0].handler.options.authScheme==="")?M[0].handler.options.authScheme:"Bearer",Ne=K!==""?`${K} ${ddt}`:ddt,xe={name:$,in:"header",required:!0,example:Ne,schema:{type:"string"},description:`The \`${$}\` header is used to authenticate with the API using your API key. Value is of the format \`${Ne}\`.`};A.parameters?A.parameters.some(br=>"name"in br&&br.name===xe.name)||A.parameters.unshift(xe):A.parameters=[xe];let Te={type:"http",scheme:K.toLowerCase()},Tt="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===K)||(a.components.securitySchemes={...a.components.securitySchemes,[Tt]:Te}):(a.components||(a.components={}),a.components.securitySchemes={[Tt]:Te});let Dt={[Tt]:[]};A.security?A.security.some(br=>br[Tt]!==void 0)||A.security.unshift(Dt):A.security=[Dt]}let H=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="RateLimitInboundPolicy"||K.handler.export==="ComplexRateLimitInboundPolicy")&&H.push(K)})}),H.length>0){let $={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"}}}}}},K={...$,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:$,RateLimitWithRetryAfter:K},A.responses||(A.responses={});let Ne=H.some(xe=>xe.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Ne?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),f[d]=E,f},{});return{...a,paths:c}}t(M_r,"enrichSpecWithZuploData");function hdt(a,s){for(let c in a)c.startsWith(s)?delete a[c]:typeof a[c]=="object"&&hdt(a[c],s)}t(hdt,"removePropertiesByPrefix");function j_r({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new Tv({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new Tv({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 Tv({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(j_r,"assertIsZuploOpenApiSpec");function B_r(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let M=0;M<s.length;M++)s[M]=255;for(let M=0;M<a.length;M++){let H=a.charAt(M),$=H.charCodeAt(0);if(s[$]!==255)throw new TypeError(H+" is ambiguous");s[$]=M}let c=a.length,f=a.charAt(0),d=Math.log(c)/Math.log(256),v=Math.log(256)/Math.log(c);function E(M){if(M instanceof Uint8Array||(ArrayBuffer.isView(M)?M=new Uint8Array(M.buffer,M.byteOffset,M.byteLength):Array.isArray(M)&&(M=Uint8Array.from(M))),!(M instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(M.length===0)return"";let H=0,$=0,K=0,Ne=M.length;for(;K!==Ne&&M[K]===0;)K++,H++;let xe=(Ne-K)*v+1>>>0,Te=new Uint8Array(xe);for(;K!==Ne;){let br=M[K],dr=0;for(let jr=xe-1;(br!==0||dr<$)&&jr!==-1;jr--,dr++)br+=256*Te[jr]>>>0,Te[jr]=br%c>>>0,br=br/c>>>0;if(br!==0)throw new Error("Non-zero carry");$=dr,K++}let Tt=xe-$;for(;Tt!==xe&&Te[Tt]===0;)Tt++;let Dt=f.repeat(H);for(;Tt<xe;++Tt)Dt+=a.charAt(Te[Tt]);return Dt}t(E,"encode");function A(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return new Uint8Array;let H=0,$=0,K=0;for(;M[H]===f;)$++,H++;let Ne=(M.length-H)*d+1>>>0,xe=new Uint8Array(Ne);for(;M[H];){let br=s[M.charCodeAt(H)];if(br===255)return;let dr=0;for(let jr=Ne-1;(br!==0||dr<K)&&jr!==-1;jr--,dr++)br+=c*xe[jr]>>>0,xe[jr]=br%256>>>0,br=br/256>>>0;if(br!==0)throw new Error("Non-zero carry");K=dr,H++}let Te=Ne-K;for(;Te!==Ne&&xe[Te]===0;)Te++;let Tt=new Uint8Array($+(Ne-Te)),Dt=$;for(;Te!==Ne;)Tt[Dt++]=xe[Te++];return Tt}t(A,"decodeUnsafe");function O(M){let H=A(M);if(H)return H;throw new Error("Non-base"+c+" character")}return t(O,"decode"),{encode:E,decodeUnsafe:A,decode:O}}t(B_r,"base");var gdt=B_r;var U_r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Wfe=gdt(U_r);var a8e="2024-09-02",ydt=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 vdt(){return new SC({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:a8e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:ydt[a8e]},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(vdt,"getMockEnvironment");var SC=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=vdt()),this.#r}constructor({build:s,runtime:c}){let f;try{if(c.__ZUPLO_CONFIG){let d=atob(c.__ZUPLO_CONFIG);f=JSON.parse(d)}if(c.ZUPLO_SYSTEM_CONFIGURATIONS){let d=new TextDecoder().decode(Wfe.decode(c.ZUPLO_SYSTEM_CONFIGURATIONS)),v=JSON.parse(d);for(let E of Object.keys(v))c[E]||(c[E]=v[E])}}catch(d){console.error("Failed to parse runtime configuration",d)}this.config=f??{},this.build=s,this.runtime=c,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 zudokuHostUrl(){return this.runtime.__ZUPLO_ZUDOKU_HOST_URL??this.config.zudoku_host_url??"https://zudoku.zuploedge.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 $_r=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function bdt(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!$_r.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(bdt,"isRestrictedEnvVariableName");function Sdt(a){return!!a.startsWith("ZUPLO_")}t(Sdt,"isZuploReadableEnvVariableName");var aUr=new Proxy({},{get(a,s){let c=String(s);switch(c){case"ZUPLO_ENVIRONMENT_TYPE":return SC.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return SC.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return SC.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return SC.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return SC.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return SC.instance.build.BUILD_ID}if(!(bdt(c)&&!Sdt(c)))return SC.instance.runtime[c]}});function YQ(a,s,c){return`_${_6(`${a}_${s}_${c}`)}`}t(YQ,"getRawOperationDataIdentifierName");function o8e(a,s,c,f){return`_${_6(a.toLowerCase())}_${s.toLowerCase()}_${c.toLowerCase()}_${f.toLowerCase()}`}t(o8e,"getIdForParameterSchema");function c8e(a,s,c){return`_${_6(a.toLowerCase())}_${s.toLowerCase()}_rb_${_6(c.toLowerCase())}`}t(c8e,"getIdForRequestBodySchema");function XQ(a,s){return`_${_6(a)}_${_6(s)}`}t(XQ,"getIdForRefSchema");function _6(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(_6,"sanitizedIdentifierName");var Zyt=W_(fht(),1);import ype from"path";var dK=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,c,f,d,v){this.type=a,this.name=s,this.prefix=c,this.value=f,this.suffix=d,this.modifier=v}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Omr=/[$_\p{ID_Start}]/u,Fmr=/[$_\u200C\u200D\p{ID_Continue}]/u,rOe=".*";function Lmr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(Lmr,"Re");function dht(a,s=!1){let c=[],f=0;for(;f<a.length;){let d=a[f],v=t(function(E){if(!s)throw new TypeError(E);c.push({type:"INVALID_CHAR",index:f,value:a[f++]})},"c");if(d==="*"){c.push({type:"ASTERISK",index:f,value:a[f++]});continue}if(d==="+"||d==="?"){c.push({type:"OTHER_MODIFIER",index:f,value:a[f++]});continue}if(d==="\\"){c.push({type:"ESCAPED_CHAR",index:f++,value:a[f++]});continue}if(d==="{"){c.push({type:"OPEN",index:f,value:a[f++]});continue}if(d==="}"){c.push({type:"CLOSE",index:f,value:a[f++]});continue}if(d===":"){let E="",A=f+1;for(;A<a.length;){let O=a.substr(A,1);if(A===f+1&&Omr.test(O)||A!==f+1&&Fmr.test(O)){E+=a[A++];continue}break}if(!E){v(`Missing parameter name at ${f}`);continue}c.push({type:"NAME",index:f,value:E}),f=A;continue}if(d==="("){let E=1,A="",O=f+1,M=!1;if(a[O]==="?"){v(`Pattern cannot start with "?" at ${O}`);continue}for(;O<a.length;){if(!Lmr(a[O],!1)){v(`Invalid character '${a[O]}' at ${O}.`),M=!0;break}if(a[O]==="\\"){A+=a[O++]+a[O++];continue}if(a[O]===")"){if(E--,E===0){O++;break}}else if(a[O]==="("&&(E++,a[O+1]!=="?")){v(`Capturing groups are not allowed at ${O}`),M=!0;break}A+=a[O++]}if(M)continue;if(E){v(`Unbalanced pattern at ${f}`);continue}if(!A){v(`Missing pattern at ${f}`);continue}c.push({type:"REGEX",index:f,value:A}),f=O;continue}c.push({type:"CHAR",index:f,value:a[f++]})}return c.push({type:"END",index:f,value:""}),c}t(dht,"v");function mht(a,s={}){let c=dht(a);s.delimiter??="/#?",s.prefixes??="./";let f=`[^${xC(s.delimiter)}]+?`,d=[],v=0,E=0,A="",O=new Set,M=t(dr=>{if(E<c.length&&c[E].type===dr)return c[E++].value},"a"),H=t(()=>M("OTHER_MODIFIER")??M("ASTERISK"),"f"),$=t(dr=>{let jr=M(dr);if(jr!==void 0)return jr;let{type:Cr,index:pr}=c[E];throw new TypeError(`Unexpected ${Cr} at ${pr}, expected ${dr}`)},"d"),K=t(()=>{let dr="",jr;for(;jr=M("CHAR")??M("ESCAPED_CHAR");)dr+=jr;return dr},"T"),Ne=t(dr=>dr,"Se"),xe=s.encodePart||Ne,Te="",Tt=t(dr=>{Te+=dr},"U"),Dt=t(()=>{Te.length&&(d.push(new dK(3,"","",xe(Te),"",3)),Te="")},"$"),br=t((dr,jr,Cr,pr,sr)=>{let Cs=3;switch(sr){case"?":Cs=1;break;case"*":Cs=0;break;case"+":Cs=2;break}if(!jr&&!Cr&&Cs===3){Tt(dr);return}if(Dt(),!jr&&!Cr){if(!dr)return;d.push(new dK(3,"","",xe(dr),"",Cs));return}let Di;Cr?Cr==="*"?Di=rOe:Di=Cr:Di=f;let _o=2;Di===f?(_o=1,Di=""):Di===rOe&&(_o=0,Di="");let hi;if(jr?hi=jr:Cr&&(hi=v++),O.has(hi))throw new TypeError(`Duplicate name '${hi}'.`);O.add(hi),d.push(new dK(_o,hi,xe(dr),Di,xe(pr),Cs))},"V");for(;E<c.length;){let dr=M("CHAR"),jr=M("NAME"),Cr=M("REGEX");if(!jr&&!Cr&&(Cr=M("ASTERISK")),jr||Cr){let sr=dr??"";s.prefixes.indexOf(sr)===-1&&(Tt(sr),sr=""),Dt();let Cs=H();br(sr,jr,Cr,"",Cs);continue}let pr=dr??M("ESCAPED_CHAR");if(pr){Tt(pr);continue}if(M("OPEN")){let sr=K(),Cs=M("NAME"),Di=M("REGEX");!Cs&&!Di&&(Di=M("ASTERISK"));let _o=K();$("CLOSE");let hi=H();br(sr,Cs,Di,_o,hi);continue}Dt(),$("END")}return d}t(mht,"D");function xC(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(xC,"S");function _ht(a){return a&&a.ignoreCase?"ui":"u"}t(_ht,"X");function Rmr(a,s,c){return hht(mht(a,c),s,c)}t(Rmr,"Z");function wB(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(wB,"k");function hht(a,s,c={}){c.delimiter??="/#?",c.prefixes??="./",c.sensitive??=!1,c.strict??=!1,c.end??=!0,c.start??=!0,c.endsWith="";let f=c.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?f+=xC(A.value):f+=`(?:${xC(A.value)})${wB(A.modifier)}`;continue}s&&s.push(A.name);let O=`[^${xC(c.delimiter)}]+?`,M=A.value;if(A.type===1?M=O:A.type===0&&(M=rOe),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?f+=`(${M})${wB(A.modifier)}`:f+=`((?:${M})${wB(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){f+=`(?:${xC(A.prefix)}(${M})${xC(A.suffix)})`,f+=wB(A.modifier);continue}f+=`(?:${xC(A.prefix)}`,f+=`((?:${M})(?:`,f+=xC(A.suffix),f+=xC(A.prefix),f+=`(?:${M}))*)${xC(A.suffix)})`,A.modifier===0&&(f+="?")}let d=`[${xC(c.endsWith)}]|$`,v=`[${xC(c.delimiter)}]`;if(c.end)return c.strict||(f+=`${v}?`),c.endsWith.length?f+=`(?=${d})`:f+="$",new RegExp(f,_ht(c));c.strict||(f+=`(?:${v}(?=${d}))?`);let E=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(E=c.delimiter.indexOf(A)>-1)}return E||(f+=`(?=${v}|${d})`),new RegExp(f,_ht(c))}t(hht,"F");var LN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Mmr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},jmr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function Bmr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(Bmr,"J");function ght(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(ght,"Q");function Umr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(Umr,"Ee");function yht(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(yht,"W");var vht=["ftp","file","http","https","ws","wss"];function bht(a){if(!a)return!0;for(let s of vht)if(a.test(s))return!0;return!1}t(bht,"N");function $mr(a,s){if(a=ght(a,"#"),s||a==="")return a;let c=new URL("https://example.com");return c.hash=a,c.hash?c.hash.substring(1,c.hash.length):""}t($mr,"te");function Jmr(a,s){if(a=ght(a,"?"),s||a==="")return a;let c=new URL("https://example.com");return c.search=a,c.search?c.search.substring(1,c.search.length):""}t(Jmr,"re");function zmr(a,s){return s||a===""?a:yht(a)?Cht(a):Tht(a)}t(zmr,"ne");function qmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.password=a,c.password}t(qmr,"se");function Vmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.username=a,c.username}t(Vmr,"ie");function Wmr(a,s,c){if(c||a==="")return a;if(s&&!vht.includes(s))return new URL(`${s}:${a}`).pathname;let f=a[0]=="/";return a=new URL(f?a:"/-"+a,"https://example.com").pathname,f||(a=a.substring(2,a.length)),a}t(Wmr,"ae");function Hmr(a,s,c){return Sht(s)===a&&(a=""),c||a===""?a:Eht(a)}t(Hmr,"oe");function Gmr(a,s){return a=Umr(a,":"),s||a===""?a:nOe(a)}t(Gmr,"ce");function Sht(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(Sht,"_");function nOe(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(nOe,"y");function Qmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Qmr,"le");function Kmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(Kmr,"fe");function Tht(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(Tht,"z");function Cht(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(Cht,"j");function Eht(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(Eht,"K");function Ymr(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(Ymr,"he");function Xmr(a){return a===""?a:new URL(`data:${a}`).pathname}t(Xmr,"ue");function Zmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(Zmr,"de");function ehr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(ehr,"pe");var thr=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=dht(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.#k()){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.#x()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#C()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#C()&&this.#i(5,1);break;case 4:this.#C()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#A()&&!this.#c?this.#i(6,1):this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#E()?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 c=this.#u(a);return c.value===s&&(c.type==="CHAR"||c.type==="ESCAPED_CHAR"||c.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#x(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#C(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#A(){return this.#m(this.#t,":")}#E(){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,"#")}#k(){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,LN),a.encodePart=nOe;let s=Rmr(this.#T(),void 0,a);this.#l=bht(s)}},tOe=["protocol","username","password","hostname","port","pathname","search","hash"],FN="*";function pht(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let c=new URL(a,s);return{protocol:c.protocol.substring(0,c.protocol.length-1),username:c.username,password:c.password,hostname:c.hostname,port:c.port,pathname:c.pathname,search:c.search!==""?c.search.substring(1,c.search.length):void 0,hash:c.hash!==""?c.hash.substring(1,c.hash.length):void 0}}t(pht,"ge");function g6(a,s){return s?pK(a):a}t(g6,"b");function _K(a,s,c){let f;if(typeof s.baseURL=="string")try{f=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=g6(f.protocol.substring(0,f.protocol.length-1),c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=g6(f.username,c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=g6(f.password,c)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=g6(f.hostname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=g6(f.port,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=g6(f.pathname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=g6(f.search.substring(1,f.search.length),c)),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=g6(f.hash.substring(1,f.hash.length),c))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Gmr(s.protocol,c)),typeof s.username=="string"&&(a.username=Vmr(s.username,c)),typeof s.password=="string"&&(a.password=qmr(s.password,c)),typeof s.hostname=="string"&&(a.hostname=zmr(s.hostname,c)),typeof s.port=="string"&&(a.port=Hmr(s.port,a.protocol,c)),typeof s.pathname=="string"){if(a.pathname=s.pathname,f&&!Bmr(a.pathname,c)){let d=f.pathname.lastIndexOf("/");d>=0&&(a.pathname=g6(f.pathname.substring(0,d+1),c)+a.pathname)}a.pathname=Wmr(a.pathname,a.protocol,c)}return typeof s.search=="string"&&(a.search=Jmr(s.search,c)),typeof s.hash=="string"&&(a.hash=$mr(s.hash,c)),a}t(_K,"w");function pK(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(pK,"C");function rhr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(rhr,"Oe");function nhr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let c=".*",f=`[^${rhr(s.delimiter)}]+?`,d=/[$_\u200C\u200D\p{ID_Continue}]/u,v="";for(let E=0;E<a.length;++E){let A=a[E];if(A.type===3){if(A.modifier===3){v+=pK(A.value);continue}v+=`{${pK(A.value)}}${wB(A.modifier)}`;continue}let O=A.hasCustomName(),M=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),H=E>0?a[E-1]:null,$=E<a.length-1?a[E+1]:null;if(!M&&O&&A.type===1&&A.modifier===3&&$&&!$.prefix.length&&!$.suffix.length)if($.type===3){let K=$.value.length>0?$.value[0]:"";M=d.test(K)}else M=!$.hasCustomName();if(!M&&!A.prefix.length&&H&&H.type===3){let K=H.value[H.value.length-1];M=s.prefixes.includes(K)}M&&(v+="{"),v+=pK(A.prefix),O&&(v+=`:${A.name}`),A.type===2?v+=`(${A.value})`:A.type===1?O||(v+=`(${f})`):A.type===0&&(!O&&(!H||H.type===3||H.modifier!==3||M||A.prefix!=="")?v+="*":v+=`(${c})`),A.type===1&&O&&A.suffix.length&&d.test(A.suffix[0])&&(v+="\\"),v+=pK(A.suffix),M&&(v+="}"),A.modifier!==3&&(v+=wB(A.modifier))}return v}t(nhr,"ke");var xht=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,c){try{let f;if(typeof s=="string"?f=s:c=s,typeof a=="string"){let A=new thr(a);if(A.parse(),a=A.result,f===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=f}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(f)throw new TypeError("parameter 1 is not of type 'string'.")}typeof c>"u"&&(c={ignoreCase:!1});let d={ignoreCase:c.ignoreCase===!0},v={pathname:FN,protocol:FN,username:FN,password:FN,hostname:FN,port:FN,search:FN,hash:FN};this.#r=_K(v,a,!0),Sht(this.#r.protocol)===this.#r.port&&(this.#r.port="");let E;for(E of tOe){if(!(E in this.#r))continue;let A={},O=this.#r[E];switch(this.#e[E]=[],E){case"protocol":Object.assign(A,LN),A.encodePart=nOe;break;case"username":Object.assign(A,LN),A.encodePart=Qmr;break;case"password":Object.assign(A,LN),A.encodePart=Kmr;break;case"hostname":Object.assign(A,Mmr),yht(O)?A.encodePart=Cht:A.encodePart=Tht;break;case"port":Object.assign(A,LN),A.encodePart=Eht;break;case"pathname":bht(this.#n.protocol)?(Object.assign(A,jmr,d),A.encodePart=Ymr):(Object.assign(A,LN,d),A.encodePart=Xmr);break;case"search":Object.assign(A,LN,d),A.encodePart=Zmr;break;case"hash":Object.assign(A,LN,d),A.encodePart=ehr;break}try{this.#s[E]=mht(O,A),this.#n[E]=hht(this.#s[E],this.#e[E],A),this.#t[E]=nhr(this.#s[E],A),this.#p=this.#p||this.#s[E].some(M=>M.type===2)}catch{throw new TypeError(`invalid ${E} pattern '${this.#r[E]}'.`)}}}catch(f){throw new TypeError(`Failed to construct 'URLPattern': ${f.message}`)}}test(a={},s){let c={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"?c=_K(c,a,!1):c=_K(c,pht(a,s),!1)}catch{return!1}let f;for(f of tOe)if(!this.#n[f].exec(c[f]))return!1;return!0}exec(a={},s){let c={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"?c=_K(c,a,!1):c=_K(c,pht(a,s),!1)}catch{return null}let f={};s?f.inputs=[a,s]:f.inputs=[a];let d;for(d of tOe){let v=this.#n[d].exec(c[d]);if(!v)return null;let E={};for(let[A,O]of this.#e[d].entries())if(typeof O=="string"||typeof O=="number"){let M=v[A+1];E[O]=M}f[d]={input:c[d]??"",groups:E}}return f}static compareComponent(a,s,c){let f=t((A,O)=>{for(let M of["type","modifier","prefix","value","suffix"]){if(A[M]<O[M])return-1;if(A[M]!==O[M])return 1}return 0},"o"),d=new dK(3,"","","","",3),v=new dK(0,"","","","",3),E=t((A,O)=>{let M=0;for(;M<Math.min(A.length,O.length);++M){let H=f(A[M],O[M]);if(H)return H}return A.length===O.length?0:f(A[M]??d,O[M]??d)},"s");return!s.#t[a]&&!c.#t[a]?0:s.#t[a]&&!c.#t[a]?E(s.#s[a],[v]):!s.#t[a]&&c.#t[a]?E([v],c.#s[a]):E(s.#s[a],c.#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=xht);import{AssertionError as ihr}from"assert";function y6(a,s){if(a===!1)throw new ihr({message:s})}t(y6,"assert");var Jc;(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"})(Jc||(Jc={}));function PB(a){return a.type===Jc.Object}t(PB,"isAstObject");function v6(a){return a.type===Jc.Property}t(v6,"isAstProperty");function Dht(a){return a.type===Jc.Array}t(Dht,"isAstArray");function NB(a){return a.type===Jc.Literal}t(NB,"isAstLiteral");function f7(a){if(a===void 0)throw new Error("Node is undefined");if(!PB(a))throw new Error("Node is not object")}t(f7,"assertAstObject");import{findNodeAtLocation as shr,getNodeValue as ahr,printParseErrorCode as ohr,visit as chr}from"jsonc-parser";var lhr={DEFAULT:{allowTrailingComma:!1}};function mK(a,s=[],c=lhr.DEFAULT){let f={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function d(O){f.type==="property"&&(f.length=O-f.offset,f=f.parent)}t(d,"ensurePropertyComplete");function v(O){return f.children?.push(O),O}t(v,"onValue"),chr(a,{onObjectBegin:t((O,M,H)=>{f=v({type:"object",offset:O,length:-1,line:M+1,column:H+1,parent:f,children:[]})},"onObjectBegin"),onObjectProperty:t((O,M,H,$,K)=>{f=v({type:"property",offset:M,length:-1,line:$+1,column:K+1,parent:f,children:[]}),f.children?.push({type:"string",value:O,offset:M,length:H,line:$,column:K,parent:f})},"onObjectProperty"),onObjectEnd:t((O,M)=>{d(O+M),f.length=O+M-f.offset,f=f.parent,d(O+M)},"onObjectEnd"),onArrayBegin:t((O,M,H,$)=>{f=v({type:"array",offset:O,length:-1,line:H+1,column:$+1,parent:f,children:[]})},"onArrayBegin"),onArrayEnd:t((O,M)=>{f.length=O+M-f.offset,f=f.parent,d(O+M)},"onArrayEnd"),onLiteralValue:t((O,M,H,$,K)=>{v({type:uhr(O),offset:M,length:H,line:$+1,column:K+1,parent:f,value:O}),d(M+H)},"onLiteralValue"),onSeparator:t((O,M)=>{f.type==="property"&&(O===":"?f.colonOffset=M:O===","&&d(M))},"onSeparator"),onError:t((O,M,H,$,K)=>{s.push({error:O,offset:M,length:H,line:$+1,column:K+1})},"onError")},c);let A=f.children[0];return A&&delete A.parent,A}t(mK,"parse");function uhr(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(uhr,"getNodeType");function iOe(a,s){return shr(a,s)}t(iOe,"findNodeAtLocation");function hK(a){return ahr(a)}t(hK,"getNodeValue");function Aht(a){return ohr(a)}t(Aht,"printParseErrorCode");var gK=class{static{t(this,"AstAdapter")}parse(s){let f=mK(s,[]);if(f)return this.parseNode(f,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,c){switch(s.type){case"object":return this.createObject(s,c);case"array":return this.createArray(s,c);case"property":return this.createProperty(s,c);case"string":return this.createLiteral(s,c);case"number":return this.createLiteral(s,c);case"boolean":return this.createLiteral(s,c);case"null":return this.createLiteral(s,c)}}createLiteral(s,c){return{type:Jc.Literal,location:{line:s.line,column:s.column},parent:c,value:s.type==="null"?null:s.value}}createObject(s,c){let f={type:Jc.Object,children:[],parent:c,location:{line:s.line,column:s.column}};return s.children?.forEach(d=>{f.children.push(this.parseNode(d,f))}),f}createProperty(s,c){y6(s.children?.length===2,"Invalid property node");let f={type:Jc.Property,location:{line:s.line,column:s.column},parent:c,name:null,value:null};return f.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Jc.Identifier,parent:f},f.value=this.parseNode(s.children[1],f),f}createArray(s,c){let f={type:Jc.Array,location:{line:s.line,column:s.column},parent:c,children:[]};return s.children?.forEach(d=>f.children.push(this.parseNode(d,f))),f}};var Mx={createLiteral:t((a,s)=>({type:Jc.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Jc.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Jc.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,c)=>{let f={type:Jc.Property,parent:c,name:null,value:s};return f.name={value:a,type:Jc.Identifier,parent:f},f.value.parent=f,f},"createProperty"),createArrayOfLiterals:t((a,s)=>{let c={type:Jc.Array,parent:s,children:[]};for(let f of a)c.children.push(Mx.createLiteral(f,c));return c},"createArrayOfLiterals")};var fhr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,yK=class{static{t(this,"SourceGenerator")}generate(s){let c=[];return this.generateSource(c,s),c.join("")}generateSource(s,c){switch(c.type){case Jc.Array:return this.generateArray(s,c);case Jc.Object:return this.generateObject(s,c);case Jc.Property:return this.generateProperty(s,c);case Jc.Literal:return this.generateLiteral(s,c);case Jc.FunctionCall:return this.generateFunctionCall(s,c);case Jc.Identifier:return this.generateIdentifier(s,c);case Jc.Raw:return this.generateRaw(s,c);case Jc.TemplateString:return this.generateTemplateString(s,c)}}generateArray(s,c){s.push("["),c.children.map(f=>{this.generateSource(s,f),s.push(",")}),s.push("]")}generateObject(s,c){s.push("{"),c.children.forEach(f=>{this.generateSource(s,f),s.push(",")}),s.push("}")}generateProperty(s,c){this.generateIdentifier(s,c.name),s.push(":"),this.generateSource(s,c.value)}generateFunctionCall(s,c){s.push(c.name.value),s.push("("),c.children.forEach((f,d,v)=>{this.generateSource(s,f),d<v.length&&s.push(",")}),s.push(")")}generateRaw(s,c){s.push(c.value)}generateTemplateString(s,c){s.push("`"),s.push(c.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,c){if(c.value===null)return s.push("null");switch(typeof c.value){case"number":case"boolean":return s.push(`${c.value}`);case"string":{let f=c.value,d=JSON.stringify(f);return s.push(`${d}`)}}}generateIdentifier(s,c){let f=fhr.test(c.value)?c.value:`'${c.value}'`;s.push(f)}};import{parse as _hr}from"@swc/core";import phr from"fs/promises";var kht=t(async a=>{let s=new Set;try{let c=await phr.readFile(a,"utf-8");(await _hr(c,{syntax:"typescript"})).body.forEach(d=>{d.type==="ExportDefaultDeclaration"||d.type==="ExportDefaultExpression"?s.add("default"):d.type==="ExportDeclaration"&&d.declaration.type==="FunctionDeclaration"?s.add(d.declaration.identifier.value):d.type==="ExportDeclaration"&&d.declaration.type==="VariableDeclaration"&&d.declaration.declarations[0].id.type==="Identifier"&&s.add(d.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var wht={$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 sOe={$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 Pht={$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 aOe={$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 oOe={$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 zyt=W_(_yt(),1),qyt=W_(Jyt(),1);var upe=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new qyt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,zyt.default)(this.ajv,{mode:"fast"})}addSchema(s,c){this.ajv.addSchema(s,c)}compile(s){let c=this.ajv.compile(s);return t(d=>({isValid:c(d),errors:this.toSimpleErrors(c.errors,d),warnings:[]}),"validator")}toSimpleErrors(s,c){let f=[];return s?.forEach(d=>{d.keyword==="enum"&&d.params.allowedValues&&Array.isArray(d.params.allowedValues)&&(d.message+=`; ${d.params.allowedValues.join(", ")}`),d.instancePath&&(d.instancePath=d.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let v={details:{}},E=d.instancePath.split("/");if(E.length>2){let O=E[1],M=E[2]?parseInt(E[2]):0,H=E[3],$=isNaN(M)?void 0:c[O][M][H];v={details:{property:O,index:M,field:H,fieldValue:$}}}if(d.keyword==="required"&&d.params.missingProperty&&d.instancePath&&(d.message=`A 'path' is missing required property '${d.params.missingProperty}'`),d.keyword==="additionalProperties"&&d.params.additionalProperty&&d.instancePath&&(d.message=`A 'path' should NOT include property '${d.params.additionalProperty}'`),d.keyword==="type"&&d.params.type&&d.instancePath){let O=d.instancePath.split("/"),M=O[O.length-1];d.message=`Value of property '${M}' must be '${d.params.type}'`}let A=Object.assign(d,v);f.push(A)}),f}};var VN=upe.instance;VN.addSchema(oOe,"route-configuration.schema.json");VN.addSchema(Pht,"policy-configuration.schema.json");VN.addSchema(sOe,"policies.schema.json");VN.addSchema(aOe,"open-api-route-configuration.schema.json");VN.addSchema(wht,"fragments.schema.json");var sVr=VN.compile(oOe),Vyt=VN.compile(aOe),T7e=VN.compile(sOe);var fpe=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=T7e(s),this.results}};var _pe=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=Vyt(s),this.results}};import v2r from"path";var C7e=/\$import\((.*)\)/,ppe=/\$env\((.*?)\)/g;var E6=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,c,f,d){super(s),this.location={file:c,namespace:"",line:f?f.line:0,column:f?f.column:0,length:0,lineText:d??"",suggestion:""}}},y2r=t(a=>{let s=[],c=a;for(;c.parent;)s.push(c),c=c.parent;return s.reverse()},"invertTree"),WN=t((a,s)=>{if(!a)return!1;let c=y2r(a);return s.split("/").every((v,E)=>{let A=c[E];return A?v==="*"||v6(A)&&A.name.value===v?!0:v==="{}"?A.type===Jc.Object:v==="[]"?A.type===Jc.Array:!1:!1})},"testPosition");var dpe=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),PB(s)?s.children.forEach(c=>{this.visitor(c)}):Dht(s)?s.children.forEach(c=>{this.visitor(c)}):v6(s)&&this.visitor(s.value)}},Wyt=t((a,s,c)=>f=>{if(!v6(f)||!NB(f.value)||typeof f.value.value!="string")return;if(!a.some(v=>WN(f,v))){ppe.test(f.value.value)&&s.push(new E6("An $env() statement is not expected at this location.",c,f.location,f.value.value));return}let d=new RegExp(ppe).exec(f.value.value);if(d?.length===2&&d[0]===f.value.value){let v={type:Jc.Raw,parent:null,value:`environment["${d[1]}"]`};f.value=v}else{let v=f.value.value.replaceAll(new RegExp(ppe),(E,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);v!==f.value.value&&(f.value=Mx.createTemplateString(v,f))}},"getEnvStatementTransformer");var YK="config/routes.json",b2r=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],S2r=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Hyt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],T2r="handler/{}/options/{}/rewritePattern",C2r="handler/{}/options/{}/baseUrl",mpe=class extends dpe{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let c=this.addedImports.get(s);if(!c)throw new Error("Import name is undefined. This should not happen.");return c}getImports(){let s=[];return this.addedImports.forEach((c,f)=>{s.push({name:c,path:f})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!v6(s)||!NB(s.value)||typeof s.value.value!="string")&&WN(s,T2r)){if(!s.parent||!PB(s.parent)){this.errors.push(new E6("Invalid node, expected object",YK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Gyt(c)},d=Mx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}rewriteForwardFunction(s){if(!(!v6(s)||!NB(s.value)||typeof s.value.value!="string")&&WN(s,C2r)){if(!s.parent||!PB(s.parent)){this.errors.push(new E6("Invalid node, expected object",YK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Gyt(c)},d=Mx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}replaceImportStatements(s){if(!v6(s)||!NB(s.value))return;let c=s.value.value;if(typeof c!="string")return;if(!S2r.some(A=>WN(s,A))&&!Hyt.some(A=>WN(s,A))){if(C7e.test(c)){if(s.name.value==="$ref")return;this.errors.push(new E6("An $import() statement is not expected at this location.",YK,s.location,c))}return}let f=C7e.exec(c);if(Hyt.some(A=>WN(s,A))&&!f)return;if(!f){this.errors.push(new E6("Invalid $import() statement",YK,s.location,c));return}let d=f[1];d.startsWith(".")&&(d=v2r.join("..",d));let v=this.getImportName(d),E={type:Jc.Identifier,parent:s.parent,value:v};s.value=E}replaceEnvStatements=Wyt(b2r,this.errors,YK)};function Gyt(a){return`(request, context) => {
578
+ `&&v++;else if(c)f+=E,v=d+2;else throw new o6(`Invalid escape \\${E}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});d=a.indexOf("\\",v)}return f+=a.slice(v),f}t(Dor,"getStringValue");function Aor(a,s,c=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return Dor(a.slice(1,-1),s,c);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(Aor,"getLiteralValue");function Oft(a,s){s=Object.freeze({...xor,...s});let c=[],f=new FNe(a,{mode:s.mode,ranges:s.ranges}),d=s.mode==="json5",v=s.allowTrailingCommas||d;function E(){let pr=f.next();return pr&&s.tokens&&c.push(f.token),pr}t(E,"nextNoComments");function A(){let pr=f.next();return pr&&s.tokens&&c.push(f.token),pr>=G_.LineComment?A():pr}t(A,"nextSkipComments");let O=s.mode==="json"?E:A;function M(pr,sr){if(pr!==sr)throw new GF(f.token)}t(M,"assertTokenType");function H(pr,sr){if(!sr.includes(pr))throw new GF(f.token)}t(H,"assertTokenTypes");function $(pr,sr){return s.ranges?{range:[pr.offset,sr.offset]}:void 0}t($,"createRange");function K(pr){let sr=f.token,Cs=$(sr.loc.start,sr.loc.end),Di=Aor(a.slice(sr.loc.start.offset,sr.loc.end.offset),sr,d),hi={loc:{start:{...sr.loc.start},end:{...sr.loc.end}},...Cs};switch(pr){case G_.String:return hC.string(Di,hi);case G_.Number:return hC.number(Di,hi);case G_.Boolean:return hC.boolean(Di,hi);default:throw new TypeError(`Unknown token type ${sr.type}.`)}}t(K,"createLiteralNode");function Ne(pr){let sr=$(pr.loc.start,pr.loc.end),Cs=a.slice(pr.loc.start.offset,pr.loc.end.offset),_o={loc:{start:{...pr.loc.start},end:{...pr.loc.end}},...sr};if(pr.type!=="Identifier"){let hi="";return(Cs[0]==="+"||Cs[0]==="-")&&(hi=Cs[0]),hC[Cs.includes("NaN")?"nan":"infinity"](hi,_o)}return hC.identifier(Cs,_o)}t(Ne,"createJSON5IdentifierNode");function xe(pr){let sr=$(pr.loc.start,pr.loc.end);return hC.null({loc:{start:{...pr.loc.start},end:{...pr.loc.end}},...sr})}t(xe,"createNullNode");function Te(pr){d?H(pr,[G_.String,G_.Identifier,G_.Number]):M(pr,G_.String);let sr=f.token,Cs=pr===G_.String?K(pr):Ne(sr);if(d&&(Cs.type==="NaN"||Cs.type==="Infinity")){if(Cs.sign!=="")throw new GF(f.token);Cs=hC.identifier(Cs.type,{loc:Cs.loc,...$(Cs.loc.start,Cs.loc.end)})}pr=O(),M(pr,G_.Colon);let Di=br(),_o=$(Cs.loc.start,Di.loc.end);return hC.member(Cs,Di,{loc:{start:{...Cs.loc.start},end:{...Di.loc.end}},..._o})}t(Te,"parseProperty");function Tt(pr){M(pr,G_.LBrace);let sr=f.token,Cs=[],Di=O();if(Di!==G_.RBrace)do{if(Cs.push(Te(Di)),Di=O(),!Di)throw new mfe(Cs[Cs.length-1].loc.end);if(Di===G_.Comma){if(Di=O(),v&&Di===G_.RBrace)break}else break}while(Di);M(Di,G_.RBrace);let _o=f.token,hi=$(sr.loc.start,_o.loc.end);return hC.object(Cs,{loc:{start:{...sr.loc.start},end:{..._o.loc.end}},...hi})}t(Tt,"parseObject");function Dt(pr){M(pr,G_.LBracket);let sr=f.token,Cs=[],Di=O();if(Di!==G_.RBracket)do{let No=br(Di);if(Cs.push(hC.element(No,{loc:No.loc})),Di=O(),Di===G_.Comma){if(Di=O(),v&&Di===G_.RBracket)break}else break}while(Di);M(Di,G_.RBracket);let _o=f.token,hi=$(sr.loc.start,_o.loc.end);return hC.array(Cs,{loc:{start:{...sr.loc.start},end:{..._o.loc.end}},...hi})}t(Dt,"parseArray");function br(pr){pr=pr??O();let sr=f.token;switch(pr){case G_.String:case G_.Boolean:return K(pr);case G_.Number:if(d){let Cs=a.slice(sr.loc.start.offset,sr.loc.end.offset);if((Cs[0]==="+"||Cs[0]==="-")&&(Cs=Cs.slice(1)),Cs==="NaN"||Cs==="Infinity")return Ne(sr)}return K(pr);case G_.Null:return xe(sr);case G_.LBrace:return Tt(pr);case G_.LBracket:return Dt(pr);default:throw new GF(sr)}}t(br,"parseValue");let dr=br();if(O())throw new GF(f.token);let Cr={loc:{start:{line:1,column:1,offset:0},end:{...dr.loc.end}}};return s.tokens&&(Cr.tokens=c),s.ranges&&(Cr.range=[Cr.loc.start.offset,Cr.loc.end.offset]),hC.document(dr,Cr)}t(Oft,"parse");var kor=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function Fft(a){return a&&typeof a=="object"}t(Fft,"isObject");function wor(a){return Fft(a)&&typeof a.type=="string"}t(wor,"isNode");function Por(a,s){function c(f,d){typeof s.enter=="function"&&s.enter(f,d);for(let v of kor.get(f.type)){let E=f[v];Fft(E)&&(Array.isArray(E)?E.forEach(A=>c(A,f)):wor(E)&&c(E,f))}typeof s.exit=="function"&&s.exit(f,d)}t(c,"visitNode"),c(a)}t(Por,"traverse");function Lft(a,s=()=>!0){let c=[];return Por(a,{enter(f,d){c.push({node:f,parent:d,phase:"enter"})},exit(f,d){c.push({node:f,parent:d,phase:"exit"})}}),c.filter(s).values()}t(Lft,"iterator");import Nor from"fs/promises";var NQ=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),hfe=t(async a=>{try{return await Nor.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),IQ=t(async a=>{try{return Oft(a)}catch(s){if(s.column&&s.line&&s.message){let c=NQ(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:c}}return}},"getSchemaAST");var Rft=t(async(a,s,c)=>{try{if(a.length===0)return;for(let f of a){let d=await hfe(f),v=await Ior(d,f,s,c);if(v)return v}}catch{}},"getRouteLocationByValue"),Ior=t(async(a,s,c,f)=>{try{if(!a)return;let d=null,v=await IQ(a);if(v){for(let{node:E}of Lft(v))if(E.value&&E.value===c){d=E.loc;break}if(d!==null){let E=NQ(a,d.start.line);return{file:s,line:d.start.line,column:d.start.column,length:d.end.column-d.start.column,lineText:E,suggestion:f}}}}catch{}},"getRouteLocationByValueFromSchema");import Mft from"fs/promises";import gfe from"path";var LNe="schemas",RNe=".oas.json";var QF=t(async a=>(await Mft.readdir(a)).map(c=>`${a}/${c}`).filter(c=>c.endsWith(RNe)).sort(),"getOpenApiFilesByAlphabetical"),sB=t(async a=>{let s=gfe.resolve(a,"config");return(await Mft.readdir(s)).filter(f=>f.endsWith(RNe)).length>=1},"oasFileInProject");function OQ(a,s,c,f,d,v,E){if(v.has(c))return;let A;try{A=f.get(c)}catch(O){throw new Tv({text:`Failed to resolve reference: ${c}`,detail:O.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:c,namespace:s,suggestion:"Check the reference and try again."}})}v.set(c,d.length),d.push(c),MNe(jNe(c),s,A,f,d,v,E)}t(OQ,"chaseRefs");function MNe(a,s,c,f,d,v,E){if(Array.isArray(c))for(let A of c)MNe(a,s,A,f,d,v,E);else if(typeof c=="object")for(let A in c){if(A==="$ref"){let O=c[A];E&&(c[A]=E(s,O)),OQ(a,s,TN(a,O),f,d,v,E)}MNe(a,s,c[A],f,d,v,E)}}t(MNe,"lookForRefs");function TN(a,s){let c=s.indexOf("#");return c>=0?`${gfe.resolve(a,s.substring(0,c))}${s.substring(c)}`:gfe.resolve(gfe.dirname(a),s)}t(TN,"getFullyQualifiedRefName");function jNe(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(jNe,"getFilePathNameFromRefName");var BNe=class{static{t(this,"Environment")}get ZUP_HOSTNAME(){return process.env.ZUP_HOSTNAME??"zuplo.app"}get ZUP_WORKING_COPY_HOSTNAME(){return process.env.ZUP_WORKING_COPY_HOSTNAME??"working-copy.zuplotest.com"}},Oor=new BNe,UNe=Oor;var KQ=W_(t8e(),1);var n8e={};Llt(n8e,{UnsafePathError:()=>qfe,deleteFolder:()=>w_r,dirExists:()=>r8e,fileExists:()=>v_r,getParentDirFilename:()=>D_r,isNotFileOrDirectory:()=>S_r,listFolderContents:()=>fdt,listFolders:()=>C_r,mkDirTemp:()=>b_r,mkdirForFilePathIfNotExits:()=>E_r,mkdirIfNotExists:()=>_dt,safePath:()=>x_r,tarFolder:()=>A_r,untarFile:()=>k_r});import{spawn as ldt}from"child_process";import{randomUUID as g_r}from"crypto";import PN from"fs/promises";import{tmpdir as y_r}from"os";import wN from"path";var udt=[".git","node_modules",".yarn",".DS_Store"];async function v_r(a){try{return(await PN.stat(a)).isFile()}catch{return!1}}t(v_r,"fileExists");async function b_r(){let a=y_r(),s=g_r().replaceAll("-",""),c=wN.join(a,s);return await PN.mkdir(c,{recursive:!0}),c}t(b_r,"mkDirTemp");async function r8e(a){try{return(await PN.stat(a)).isDirectory()}catch{return!1}}t(r8e,"dirExists");async function S_r(a){try{return await PN.stat(a),!1}catch{return!0}}t(S_r,"isNotFileOrDirectory");function T_r(a,s){let c=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),f=a.match(c);if(!f)return"";let d=a.split(f[0]);return d[1]===""?"":`/${d[1]}`}t(T_r,"getParentDirectory");async function C_r(a){if(!await r8e(a))return[];let s=await PN.readdir(a,{withFileTypes:!0}),c=[];for await(let f of s)udt.includes(f.name)||f.isDirectory()&&c.push(f.name);return c}t(C_r,"listFolders");async function fdt(a,s,c=!0){let f=T_r(a,s),d=await PN.readdir(a,{withFileTypes:!0}),v=[];for await(let E of d)if(!udt.includes(E.name)||!c)if(E.isDirectory()){let A=await fdt(wN.join(a,E.name),s,c);v.push(...A)}else v.push(wN.join(f,E.name));return v}t(fdt,"listFolderContents");var _dt=t(async a=>{await PN.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),E_r=t(async a=>{let s=wN.dirname(a);return _dt(s)},"mkdirForFilePathIfNotExits"),qfe=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function x_r(a){let s=t(c=>{if(!c.startsWith(a))throw new qfe("Resolved path is not part of the project.");return c},"ensureSafePath");return{resolve:t((...c)=>s(wN.resolve(...c)),"resolve")}}t(x_r,"safePath");function D_r(a){return`${wN.basename(wN.dirname(a))}/${wN.basename(a)}`}t(D_r,"getParentDirFilename");async function A_r({folderPath:a,outputTarPath:s,exclude:c=["node_modules",".git","dist"]}){return new Promise((f,d)=>{let v=ldt("tar",[...c.map(E=>["--exclude",E]).flat(),"-cvf",s,"-C",a,"."]);process.env.DEBUG_TAR&&(v.stdout.on("data",E=>{let A=E.toString().trim();A.length>0&&console.info(A)}),v.stderr.on("data",E=>{let A=E.toString().trim();A.length>0&&console.error(A)})),v.on("close",E=>{E===0?f(`Folder archived to ${s}`):d(new Error(`tar process exited with code ${E}`))}),v.on("error",E=>{d(E)})})}t(A_r,"tarFolder");async function k_r({tarFilePath:a,outputDir:s}){return new Promise((c,f)=>{let d=`
579
+ if tar -tf ${a} | grep -qE '^([^/]+/)$'; then
580
+ tar --strip-components=1 -xf ${a} -C ${s};
581
+ else
582
+ tar -xf ${a} -C ${s};
583
+ fi
584
+ `.trim(),v=ldt("sh",["-c",d]);process.env.DEBUG_TAR&&(v.stdout.on("data",E=>{let A=E.toString().trim();A.length>0&&console.info(A)}),v.stderr.on("data",E=>{let A=E.toString().trim();A.length>0&&console.error(A)})),v.on("close",E=>{E===0?c("Extraction completed."):f(new Error(`tar process exited with code ${E}`))}),v.on("error",E=>{f(E)})})}t(k_r,"untarFile");async function w_r(a){if(await r8e(a))return await PN.rm(a,{recursive:!0})}t(w_r,"deleteFolder");var Ml=n8e;var bC=W_(t8e(),1);import{readFile as P_r}from"fs/promises";var i7=class extends Error{static{t(this,"CustomResolveError")}},NN=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,c){this.sourceDirectory=s,this.logger=c}dereference(s,c){return KQ.$RefParser.dereference(s,{resolve:{json:!0,file:Vfe(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:c?.onDereference}})}bundle(s){return KQ.$RefParser.bundle(s,{resolve:{file:Vfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return KQ.$RefParser.parse(s,{resolve:{file:Vfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return KQ.$RefParser.resolve(s,{resolve:{file:Vfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function Vfe(a,s){return{order:100,canRead(c){let f=O_r(c.url);if(!(f===void 0||f==="file"))return!1;let v;try{v=pdt(c.url)}catch(E){throw new i7(`Malformed URI: ${c.url}`,{cause:E})}try{Ml.safePath(a).resolve(v)}catch(E){return s?.warn(E),!1}return!0},async read(c){let f;try{f=pdt(c.url)}catch(d){throw new i7(`Malformed URI: ${c.url}`,{cause:d})}try{return await P_r(f)}catch(d){throw new i7(`Error opening file "${f}"`,{cause:d})}}}}t(Vfe,"customResolver");var i8e=/^win/.test(globalThis.process?globalThis.process.platform:""),N_r=/\//g,I_r=/^(\w{2,}):\/\//i,s8e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function O_r(a){let s=I_r.exec(a);if(s)return s[1].toLowerCase()}t(O_r,"getProtocol");function pdt(a,s){a=decodeURI(a);for(let f=0;f<s8e.length;f+=2)a=a.replace(s8e[f],s8e[f+1]);let c=a.substr(0,7).toLowerCase()==="file://";return c&&(a=a[7]==="/"?a.substr(8):a.substr(7),i8e&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(c=!1,a=i8e?a:"/"+a)),i8e&&!c&&(a=a.replace(N_r,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(pdt,"toFileSystemPath");var ddt="YOUR_KEY_HERE";async function mdt(a){let c=await new NN(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),f=a.openApiDocPath.replace(a.sourceDirectory,"");return F_r({...a,relativeOpenApiPath:f},c)}t(mdt,"buildPublicOpenApiFile");async function F_r(a,s){j_r({relativeOpenApiPath:a.relativeOpenApiPath},s);let c=s;return c=R_r(c),L_r(c,a),c=M_r(c,a),hdt(c,"x-zuplo"),c}t(F_r,"buildRawOpenApiFile");function L_r(a,{deploymentUrl:s,deploymentName:c,environmentType:f}){let d;s?d=s.hostname:f&&c&&(d=f===Jlt.WORKING_COPY?`${c}.${UNe.ZUP_WORKING_COPY_HOSTNAME}`:`${c}.${UNe.ZUP_HOSTNAME}`),d?a.servers=[{url:`https://${d}`}]:a.servers=void 0}t(L_r,"addServerHost");function R_r(a){if(!a.paths)return a;let{components:s}=a,c=s?{...s}:void 0,f=[];c&&c.parameters&&(f=Object.entries(c.parameters).reduce((v,[E,A])=>(Wj in A&&jue(A[Wj])&&(v.push(E),c.parameters&&delete c.parameters[E]),v),[]));let d=Object.entries(a.paths).reduce((v,[E,A])=>{if(!A)return v;let O={...A},M=["delete","get","head","patch","post","put","trace","options"];return M.forEach(H=>{let $=A[H];if(!$)return;if(jue($[Wj])){delete O[H];return}let{parameters:K}=$;if(!K)return;let Ne=K.filter(xe=>{if(Wj in xe&&jue(xe[Wj]))return!1;if("$ref"in xe){let Te=xe.$ref.split("/").pop();return Te?!f.includes(Te):!0}return!0});O[H]={...$,parameters:Ne}}),M.some(H=>!!O[H])&&(v[E]=O),v},{});return{...a,paths:d,components:c}}t(R_r,"removeHiddenRoutesAndParams");function M_r(a,{policiesConfig:s}){if(!a.paths)return a;let c=Object.entries(a.paths).reduce((f,[d,v])=>{if(!v)return f;let E={...v};return[E.delete,E.get,E.head,E.patch,E.post,E.put,E.trace,E.options].forEach(A=>{if(!A)return;let O=A["x-zuplo-route"]?.policies?.inbound?.reduce(($,K)=>{let Ne=s.policies?.find(({name:Tt})=>Tt===K);if(!Ne)return $;if(!(Ne.handler.export==="CompositeInboundPolicy"))return $.concat(K);let Te=Ne.handler.options?.policies;return Te?$.concat(Te):$},[]),M=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="ApiAuthKeyInboundPolicy"||K.handler.export==="ApiKeyInboundPolicy")&&!K.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&M.push(K)})}),M.length>0){let $=M.length>0&&M[0].handler&&M[0].handler.options&&M[0].handler.options.authHeader?M[0].handler.options.authHeader:"Authorization",K=M.length>0&&M[0].handler&&M[0].handler.options&&(M[0].handler.options.authScheme||M[0].handler.options.authScheme==="")?M[0].handler.options.authScheme:"Bearer",Ne=K!==""?`${K} ${ddt}`:ddt,xe={name:$,in:"header",required:!0,example:Ne,schema:{type:"string"},description:`The \`${$}\` header is used to authenticate with the API using your API key. Value is of the format \`${Ne}\`.`};A.parameters?A.parameters.some(br=>"name"in br&&br.name===xe.name)||A.parameters.unshift(xe):A.parameters=[xe];let Te={type:"http",scheme:K.toLowerCase()},Tt="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===K)||(a.components.securitySchemes={...a.components.securitySchemes,[Tt]:Te}):(a.components||(a.components={}),a.components.securitySchemes={[Tt]:Te});let Dt={[Tt]:[]};A.security?A.security.some(br=>br[Tt]!==void 0)||A.security.unshift(Dt):A.security=[Dt]}let H=[];if(O&&O.forEach($=>{s.policies?.forEach(K=>{K.name===$&&(K.handler.export==="RateLimitInboundPolicy"||K.handler.export==="ComplexRateLimitInboundPolicy")&&H.push(K)})}),H.length>0){let $={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"}}}}}},K={...$,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:$,RateLimitWithRetryAfter:K},A.responses||(A.responses={});let Ne=H.some(xe=>xe.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Ne?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),f[d]=E,f},{});return{...a,paths:c}}t(M_r,"enrichSpecWithZuploData");function hdt(a,s){for(let c in a)c.startsWith(s)?delete a[c]:typeof a[c]=="object"&&hdt(a[c],s)}t(hdt,"removePropertiesByPrefix");function j_r({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new Tv({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new Tv({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 Tv({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(j_r,"assertIsZuploOpenApiSpec");function B_r(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let M=0;M<s.length;M++)s[M]=255;for(let M=0;M<a.length;M++){let H=a.charAt(M),$=H.charCodeAt(0);if(s[$]!==255)throw new TypeError(H+" is ambiguous");s[$]=M}let c=a.length,f=a.charAt(0),d=Math.log(c)/Math.log(256),v=Math.log(256)/Math.log(c);function E(M){if(M instanceof Uint8Array||(ArrayBuffer.isView(M)?M=new Uint8Array(M.buffer,M.byteOffset,M.byteLength):Array.isArray(M)&&(M=Uint8Array.from(M))),!(M instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(M.length===0)return"";let H=0,$=0,K=0,Ne=M.length;for(;K!==Ne&&M[K]===0;)K++,H++;let xe=(Ne-K)*v+1>>>0,Te=new Uint8Array(xe);for(;K!==Ne;){let br=M[K],dr=0;for(let jr=xe-1;(br!==0||dr<$)&&jr!==-1;jr--,dr++)br+=256*Te[jr]>>>0,Te[jr]=br%c>>>0,br=br/c>>>0;if(br!==0)throw new Error("Non-zero carry");$=dr,K++}let Tt=xe-$;for(;Tt!==xe&&Te[Tt]===0;)Tt++;let Dt=f.repeat(H);for(;Tt<xe;++Tt)Dt+=a.charAt(Te[Tt]);return Dt}t(E,"encode");function A(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return new Uint8Array;let H=0,$=0,K=0;for(;M[H]===f;)$++,H++;let Ne=(M.length-H)*d+1>>>0,xe=new Uint8Array(Ne);for(;M[H];){let br=s[M.charCodeAt(H)];if(br===255)return;let dr=0;for(let jr=Ne-1;(br!==0||dr<K)&&jr!==-1;jr--,dr++)br+=c*xe[jr]>>>0,xe[jr]=br%256>>>0,br=br/256>>>0;if(br!==0)throw new Error("Non-zero carry");K=dr,H++}let Te=Ne-K;for(;Te!==Ne&&xe[Te]===0;)Te++;let Tt=new Uint8Array($+(Ne-Te)),Dt=$;for(;Te!==Ne;)Tt[Dt++]=xe[Te++];return Tt}t(A,"decodeUnsafe");function O(M){let H=A(M);if(H)return H;throw new Error("Non-base"+c+" character")}return t(O,"decode"),{encode:E,decodeUnsafe:A,decode:O}}t(B_r,"base");var gdt=B_r;var U_r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Wfe=gdt(U_r);var a8e="2024-09-02",ydt=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 vdt(){return new SC({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:a8e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:ydt[a8e]},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(vdt,"getMockEnvironment");var SC=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=vdt()),this.#r}constructor({build:s,runtime:c}){let f;try{if(c.__ZUPLO_CONFIG){let d=atob(c.__ZUPLO_CONFIG);f=JSON.parse(d)}if(c.ZUPLO_SYSTEM_CONFIGURATIONS){let d=new TextDecoder().decode(Wfe.decode(c.ZUPLO_SYSTEM_CONFIGURATIONS)),v=JSON.parse(d);for(let E of Object.keys(v))c[E]||(c[E]=v[E])}}catch(d){console.error("Failed to parse runtime configuration",d)}this.config=f??{},this.build=s,this.runtime=c,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 zudokuHostUrl(){return this.runtime.__ZUPLO_ZUDOKU_HOST_URL??this.config.zudoku_host_url??"https://zudoku.zuploedge.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 $_r=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function bdt(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!$_r.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(bdt,"isRestrictedEnvVariableName");function Sdt(a){return!!a.startsWith("ZUPLO_")}t(Sdt,"isZuploReadableEnvVariableName");var aUr=new Proxy({},{get(a,s){let c=String(s);switch(c){case"ZUPLO_ENVIRONMENT_TYPE":return SC.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return SC.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return SC.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return SC.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return SC.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return SC.instance.build.BUILD_ID}if(!(bdt(c)&&!Sdt(c)))return SC.instance.runtime[c]}});function YQ(a,s,c){return`_${_6(`${a}_${s}_${c}`)}`}t(YQ,"getRawOperationDataIdentifierName");function o8e(a,s,c,f){return`_${_6(a.toLowerCase())}_${s.toLowerCase()}_${c.toLowerCase()}_${f.toLowerCase()}`}t(o8e,"getIdForParameterSchema");function c8e(a,s,c){return`_${_6(a.toLowerCase())}_${s.toLowerCase()}_rb_${_6(c.toLowerCase())}`}t(c8e,"getIdForRequestBodySchema");function XQ(a,s){return`_${_6(a)}_${_6(s)}`}t(XQ,"getIdForRefSchema");function _6(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(_6,"sanitizedIdentifierName");var Zyt=W_(fht(),1);import ype from"path";var dK=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,c,f,d,v){this.type=a,this.name=s,this.prefix=c,this.value=f,this.suffix=d,this.modifier=v}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Omr=/[$_\p{ID_Start}]/u,Fmr=/[$_\u200C\u200D\p{ID_Continue}]/u,rOe=".*";function Lmr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(Lmr,"Re");function dht(a,s=!1){let c=[],f=0;for(;f<a.length;){let d=a[f],v=t(function(E){if(!s)throw new TypeError(E);c.push({type:"INVALID_CHAR",index:f,value:a[f++]})},"c");if(d==="*"){c.push({type:"ASTERISK",index:f,value:a[f++]});continue}if(d==="+"||d==="?"){c.push({type:"OTHER_MODIFIER",index:f,value:a[f++]});continue}if(d==="\\"){c.push({type:"ESCAPED_CHAR",index:f++,value:a[f++]});continue}if(d==="{"){c.push({type:"OPEN",index:f,value:a[f++]});continue}if(d==="}"){c.push({type:"CLOSE",index:f,value:a[f++]});continue}if(d===":"){let E="",A=f+1;for(;A<a.length;){let O=a.substr(A,1);if(A===f+1&&Omr.test(O)||A!==f+1&&Fmr.test(O)){E+=a[A++];continue}break}if(!E){v(`Missing parameter name at ${f}`);continue}c.push({type:"NAME",index:f,value:E}),f=A;continue}if(d==="("){let E=1,A="",O=f+1,M=!1;if(a[O]==="?"){v(`Pattern cannot start with "?" at ${O}`);continue}for(;O<a.length;){if(!Lmr(a[O],!1)){v(`Invalid character '${a[O]}' at ${O}.`),M=!0;break}if(a[O]==="\\"){A+=a[O++]+a[O++];continue}if(a[O]===")"){if(E--,E===0){O++;break}}else if(a[O]==="("&&(E++,a[O+1]!=="?")){v(`Capturing groups are not allowed at ${O}`),M=!0;break}A+=a[O++]}if(M)continue;if(E){v(`Unbalanced pattern at ${f}`);continue}if(!A){v(`Missing pattern at ${f}`);continue}c.push({type:"REGEX",index:f,value:A}),f=O;continue}c.push({type:"CHAR",index:f,value:a[f++]})}return c.push({type:"END",index:f,value:""}),c}t(dht,"v");function mht(a,s={}){let c=dht(a);s.delimiter??="/#?",s.prefixes??="./";let f=`[^${xC(s.delimiter)}]+?`,d=[],v=0,E=0,A="",O=new Set,M=t(dr=>{if(E<c.length&&c[E].type===dr)return c[E++].value},"a"),H=t(()=>M("OTHER_MODIFIER")??M("ASTERISK"),"f"),$=t(dr=>{let jr=M(dr);if(jr!==void 0)return jr;let{type:Cr,index:pr}=c[E];throw new TypeError(`Unexpected ${Cr} at ${pr}, expected ${dr}`)},"d"),K=t(()=>{let dr="",jr;for(;jr=M("CHAR")??M("ESCAPED_CHAR");)dr+=jr;return dr},"T"),Ne=t(dr=>dr,"Se"),xe=s.encodePart||Ne,Te="",Tt=t(dr=>{Te+=dr},"U"),Dt=t(()=>{Te.length&&(d.push(new dK(3,"","",xe(Te),"",3)),Te="")},"$"),br=t((dr,jr,Cr,pr,sr)=>{let Cs=3;switch(sr){case"?":Cs=1;break;case"*":Cs=0;break;case"+":Cs=2;break}if(!jr&&!Cr&&Cs===3){Tt(dr);return}if(Dt(),!jr&&!Cr){if(!dr)return;d.push(new dK(3,"","",xe(dr),"",Cs));return}let Di;Cr?Cr==="*"?Di=rOe:Di=Cr:Di=f;let _o=2;Di===f?(_o=1,Di=""):Di===rOe&&(_o=0,Di="");let hi;if(jr?hi=jr:Cr&&(hi=v++),O.has(hi))throw new TypeError(`Duplicate name '${hi}'.`);O.add(hi),d.push(new dK(_o,hi,xe(dr),Di,xe(pr),Cs))},"V");for(;E<c.length;){let dr=M("CHAR"),jr=M("NAME"),Cr=M("REGEX");if(!jr&&!Cr&&(Cr=M("ASTERISK")),jr||Cr){let sr=dr??"";s.prefixes.indexOf(sr)===-1&&(Tt(sr),sr=""),Dt();let Cs=H();br(sr,jr,Cr,"",Cs);continue}let pr=dr??M("ESCAPED_CHAR");if(pr){Tt(pr);continue}if(M("OPEN")){let sr=K(),Cs=M("NAME"),Di=M("REGEX");!Cs&&!Di&&(Di=M("ASTERISK"));let _o=K();$("CLOSE");let hi=H();br(sr,Cs,Di,_o,hi);continue}Dt(),$("END")}return d}t(mht,"D");function xC(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(xC,"S");function _ht(a){return a&&a.ignoreCase?"ui":"u"}t(_ht,"X");function Rmr(a,s,c){return hht(mht(a,c),s,c)}t(Rmr,"Z");function wB(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(wB,"k");function hht(a,s,c={}){c.delimiter??="/#?",c.prefixes??="./",c.sensitive??=!1,c.strict??=!1,c.end??=!0,c.start??=!0,c.endsWith="";let f=c.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?f+=xC(A.value):f+=`(?:${xC(A.value)})${wB(A.modifier)}`;continue}s&&s.push(A.name);let O=`[^${xC(c.delimiter)}]+?`,M=A.value;if(A.type===1?M=O:A.type===0&&(M=rOe),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?f+=`(${M})${wB(A.modifier)}`:f+=`((?:${M})${wB(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){f+=`(?:${xC(A.prefix)}(${M})${xC(A.suffix)})`,f+=wB(A.modifier);continue}f+=`(?:${xC(A.prefix)}`,f+=`((?:${M})(?:`,f+=xC(A.suffix),f+=xC(A.prefix),f+=`(?:${M}))*)${xC(A.suffix)})`,A.modifier===0&&(f+="?")}let d=`[${xC(c.endsWith)}]|$`,v=`[${xC(c.delimiter)}]`;if(c.end)return c.strict||(f+=`${v}?`),c.endsWith.length?f+=`(?=${d})`:f+="$",new RegExp(f,_ht(c));c.strict||(f+=`(?:${v}(?=${d}))?`);let E=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(E=c.delimiter.indexOf(A)>-1)}return E||(f+=`(?=${v}|${d})`),new RegExp(f,_ht(c))}t(hht,"F");var LN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Mmr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},jmr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function Bmr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(Bmr,"J");function ght(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(ght,"Q");function Umr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(Umr,"Ee");function yht(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(yht,"W");var vht=["ftp","file","http","https","ws","wss"];function bht(a){if(!a)return!0;for(let s of vht)if(a.test(s))return!0;return!1}t(bht,"N");function $mr(a,s){if(a=ght(a,"#"),s||a==="")return a;let c=new URL("https://example.com");return c.hash=a,c.hash?c.hash.substring(1,c.hash.length):""}t($mr,"te");function Jmr(a,s){if(a=ght(a,"?"),s||a==="")return a;let c=new URL("https://example.com");return c.search=a,c.search?c.search.substring(1,c.search.length):""}t(Jmr,"re");function zmr(a,s){return s||a===""?a:yht(a)?Cht(a):Tht(a)}t(zmr,"ne");function qmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.password=a,c.password}t(qmr,"se");function Vmr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.username=a,c.username}t(Vmr,"ie");function Wmr(a,s,c){if(c||a==="")return a;if(s&&!vht.includes(s))return new URL(`${s}:${a}`).pathname;let f=a[0]=="/";return a=new URL(f?a:"/-"+a,"https://example.com").pathname,f||(a=a.substring(2,a.length)),a}t(Wmr,"ae");function Hmr(a,s,c){return Sht(s)===a&&(a=""),c||a===""?a:Eht(a)}t(Hmr,"oe");function Gmr(a,s){return a=Umr(a,":"),s||a===""?a:nOe(a)}t(Gmr,"ce");function Sht(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(Sht,"_");function nOe(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(nOe,"y");function Qmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Qmr,"le");function Kmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(Kmr,"fe");function Tht(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(Tht,"z");function Cht(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(Cht,"j");function Eht(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(Eht,"K");function Ymr(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(Ymr,"he");function Xmr(a){return a===""?a:new URL(`data:${a}`).pathname}t(Xmr,"ue");function Zmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(Zmr,"de");function ehr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(ehr,"pe");var thr=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=dht(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.#k()){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.#x()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#C()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#C()&&this.#i(5,1);break;case 4:this.#C()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#A()&&!this.#c?this.#i(6,1):this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#E()?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 c=this.#u(a);return c.value===s&&(c.type==="CHAR"||c.type==="ESCAPED_CHAR"||c.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#x(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#C(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#A(){return this.#m(this.#t,":")}#E(){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,"#")}#k(){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,LN),a.encodePart=nOe;let s=Rmr(this.#T(),void 0,a);this.#l=bht(s)}},tOe=["protocol","username","password","hostname","port","pathname","search","hash"],FN="*";function pht(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let c=new URL(a,s);return{protocol:c.protocol.substring(0,c.protocol.length-1),username:c.username,password:c.password,hostname:c.hostname,port:c.port,pathname:c.pathname,search:c.search!==""?c.search.substring(1,c.search.length):void 0,hash:c.hash!==""?c.hash.substring(1,c.hash.length):void 0}}t(pht,"ge");function g6(a,s){return s?pK(a):a}t(g6,"b");function _K(a,s,c){let f;if(typeof s.baseURL=="string")try{f=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=g6(f.protocol.substring(0,f.protocol.length-1),c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=g6(f.username,c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=g6(f.password,c)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=g6(f.hostname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=g6(f.port,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=g6(f.pathname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=g6(f.search.substring(1,f.search.length),c)),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=g6(f.hash.substring(1,f.hash.length),c))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Gmr(s.protocol,c)),typeof s.username=="string"&&(a.username=Vmr(s.username,c)),typeof s.password=="string"&&(a.password=qmr(s.password,c)),typeof s.hostname=="string"&&(a.hostname=zmr(s.hostname,c)),typeof s.port=="string"&&(a.port=Hmr(s.port,a.protocol,c)),typeof s.pathname=="string"){if(a.pathname=s.pathname,f&&!Bmr(a.pathname,c)){let d=f.pathname.lastIndexOf("/");d>=0&&(a.pathname=g6(f.pathname.substring(0,d+1),c)+a.pathname)}a.pathname=Wmr(a.pathname,a.protocol,c)}return typeof s.search=="string"&&(a.search=Jmr(s.search,c)),typeof s.hash=="string"&&(a.hash=$mr(s.hash,c)),a}t(_K,"w");function pK(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(pK,"C");function rhr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(rhr,"Oe");function nhr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let c=".*",f=`[^${rhr(s.delimiter)}]+?`,d=/[$_\u200C\u200D\p{ID_Continue}]/u,v="";for(let E=0;E<a.length;++E){let A=a[E];if(A.type===3){if(A.modifier===3){v+=pK(A.value);continue}v+=`{${pK(A.value)}}${wB(A.modifier)}`;continue}let O=A.hasCustomName(),M=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),H=E>0?a[E-1]:null,$=E<a.length-1?a[E+1]:null;if(!M&&O&&A.type===1&&A.modifier===3&&$&&!$.prefix.length&&!$.suffix.length)if($.type===3){let K=$.value.length>0?$.value[0]:"";M=d.test(K)}else M=!$.hasCustomName();if(!M&&!A.prefix.length&&H&&H.type===3){let K=H.value[H.value.length-1];M=s.prefixes.includes(K)}M&&(v+="{"),v+=pK(A.prefix),O&&(v+=`:${A.name}`),A.type===2?v+=`(${A.value})`:A.type===1?O||(v+=`(${f})`):A.type===0&&(!O&&(!H||H.type===3||H.modifier!==3||M||A.prefix!=="")?v+="*":v+=`(${c})`),A.type===1&&O&&A.suffix.length&&d.test(A.suffix[0])&&(v+="\\"),v+=pK(A.suffix),M&&(v+="}"),A.modifier!==3&&(v+=wB(A.modifier))}return v}t(nhr,"ke");var xht=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,c){try{let f;if(typeof s=="string"?f=s:c=s,typeof a=="string"){let A=new thr(a);if(A.parse(),a=A.result,f===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=f}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(f)throw new TypeError("parameter 1 is not of type 'string'.")}typeof c>"u"&&(c={ignoreCase:!1});let d={ignoreCase:c.ignoreCase===!0},v={pathname:FN,protocol:FN,username:FN,password:FN,hostname:FN,port:FN,search:FN,hash:FN};this.#r=_K(v,a,!0),Sht(this.#r.protocol)===this.#r.port&&(this.#r.port="");let E;for(E of tOe){if(!(E in this.#r))continue;let A={},O=this.#r[E];switch(this.#e[E]=[],E){case"protocol":Object.assign(A,LN),A.encodePart=nOe;break;case"username":Object.assign(A,LN),A.encodePart=Qmr;break;case"password":Object.assign(A,LN),A.encodePart=Kmr;break;case"hostname":Object.assign(A,Mmr),yht(O)?A.encodePart=Cht:A.encodePart=Tht;break;case"port":Object.assign(A,LN),A.encodePart=Eht;break;case"pathname":bht(this.#n.protocol)?(Object.assign(A,jmr,d),A.encodePart=Ymr):(Object.assign(A,LN,d),A.encodePart=Xmr);break;case"search":Object.assign(A,LN,d),A.encodePart=Zmr;break;case"hash":Object.assign(A,LN,d),A.encodePart=ehr;break}try{this.#s[E]=mht(O,A),this.#n[E]=hht(this.#s[E],this.#e[E],A),this.#t[E]=nhr(this.#s[E],A),this.#p=this.#p||this.#s[E].some(M=>M.type===2)}catch{throw new TypeError(`invalid ${E} pattern '${this.#r[E]}'.`)}}}catch(f){throw new TypeError(`Failed to construct 'URLPattern': ${f.message}`)}}test(a={},s){let c={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"?c=_K(c,a,!1):c=_K(c,pht(a,s),!1)}catch{return!1}let f;for(f of tOe)if(!this.#n[f].exec(c[f]))return!1;return!0}exec(a={},s){let c={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"?c=_K(c,a,!1):c=_K(c,pht(a,s),!1)}catch{return null}let f={};s?f.inputs=[a,s]:f.inputs=[a];let d;for(d of tOe){let v=this.#n[d].exec(c[d]);if(!v)return null;let E={};for(let[A,O]of this.#e[d].entries())if(typeof O=="string"||typeof O=="number"){let M=v[A+1];E[O]=M}f[d]={input:c[d]??"",groups:E}}return f}static compareComponent(a,s,c){let f=t((A,O)=>{for(let M of["type","modifier","prefix","value","suffix"]){if(A[M]<O[M])return-1;if(A[M]!==O[M])return 1}return 0},"o"),d=new dK(3,"","","","",3),v=new dK(0,"","","","",3),E=t((A,O)=>{let M=0;for(;M<Math.min(A.length,O.length);++M){let H=f(A[M],O[M]);if(H)return H}return A.length===O.length?0:f(A[M]??d,O[M]??d)},"s");return!s.#t[a]&&!c.#t[a]?0:s.#t[a]&&!c.#t[a]?E(s.#s[a],[v]):!s.#t[a]&&c.#t[a]?E([v],c.#s[a]):E(s.#s[a],c.#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=xht);import{AssertionError as ihr}from"assert";function y6(a,s){if(a===!1)throw new ihr({message:s})}t(y6,"assert");var Jc;(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"})(Jc||(Jc={}));function PB(a){return a.type===Jc.Object}t(PB,"isAstObject");function v6(a){return a.type===Jc.Property}t(v6,"isAstProperty");function Dht(a){return a.type===Jc.Array}t(Dht,"isAstArray");function NB(a){return a.type===Jc.Literal}t(NB,"isAstLiteral");function f7(a){if(a===void 0)throw new Error("Node is undefined");if(!PB(a))throw new Error("Node is not object")}t(f7,"assertAstObject");import{findNodeAtLocation as shr,getNodeValue as ahr,printParseErrorCode as ohr,visit as chr}from"jsonc-parser";var lhr={DEFAULT:{allowTrailingComma:!1}};function mK(a,s=[],c=lhr.DEFAULT){let f={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function d(O){f.type==="property"&&(f.length=O-f.offset,f=f.parent)}t(d,"ensurePropertyComplete");function v(O){return f.children?.push(O),O}t(v,"onValue"),chr(a,{onObjectBegin:t((O,M,H)=>{f=v({type:"object",offset:O,length:-1,line:M+1,column:H+1,parent:f,children:[]})},"onObjectBegin"),onObjectProperty:t((O,M,H,$,K)=>{f=v({type:"property",offset:M,length:-1,line:$+1,column:K+1,parent:f,children:[]}),f.children?.push({type:"string",value:O,offset:M,length:H,line:$,column:K,parent:f})},"onObjectProperty"),onObjectEnd:t((O,M)=>{d(O+M),f.length=O+M-f.offset,f=f.parent,d(O+M)},"onObjectEnd"),onArrayBegin:t((O,M,H,$)=>{f=v({type:"array",offset:O,length:-1,line:H+1,column:$+1,parent:f,children:[]})},"onArrayBegin"),onArrayEnd:t((O,M)=>{f.length=O+M-f.offset,f=f.parent,d(O+M)},"onArrayEnd"),onLiteralValue:t((O,M,H,$,K)=>{v({type:uhr(O),offset:M,length:H,line:$+1,column:K+1,parent:f,value:O}),d(M+H)},"onLiteralValue"),onSeparator:t((O,M)=>{f.type==="property"&&(O===":"?f.colonOffset=M:O===","&&d(M))},"onSeparator"),onError:t((O,M,H,$,K)=>{s.push({error:O,offset:M,length:H,line:$+1,column:K+1})},"onError")},c);let A=f.children[0];return A&&delete A.parent,A}t(mK,"parse");function uhr(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(uhr,"getNodeType");function iOe(a,s){return shr(a,s)}t(iOe,"findNodeAtLocation");function hK(a){return ahr(a)}t(hK,"getNodeValue");function Aht(a){return ohr(a)}t(Aht,"printParseErrorCode");var gK=class{static{t(this,"AstAdapter")}parse(s){let f=mK(s,[]);if(f)return this.parseNode(f,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,c){switch(s.type){case"object":return this.createObject(s,c);case"array":return this.createArray(s,c);case"property":return this.createProperty(s,c);case"string":return this.createLiteral(s,c);case"number":return this.createLiteral(s,c);case"boolean":return this.createLiteral(s,c);case"null":return this.createLiteral(s,c)}}createLiteral(s,c){return{type:Jc.Literal,location:{line:s.line,column:s.column},parent:c,value:s.type==="null"?null:s.value}}createObject(s,c){let f={type:Jc.Object,children:[],parent:c,location:{line:s.line,column:s.column}};return s.children?.forEach(d=>{f.children.push(this.parseNode(d,f))}),f}createProperty(s,c){y6(s.children?.length===2,"Invalid property node");let f={type:Jc.Property,location:{line:s.line,column:s.column},parent:c,name:null,value:null};return f.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Jc.Identifier,parent:f},f.value=this.parseNode(s.children[1],f),f}createArray(s,c){let f={type:Jc.Array,location:{line:s.line,column:s.column},parent:c,children:[]};return s.children?.forEach(d=>f.children.push(this.parseNode(d,f))),f}};var Mx={createLiteral:t((a,s)=>({type:Jc.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Jc.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Jc.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,c)=>{let f={type:Jc.Property,parent:c,name:null,value:s};return f.name={value:a,type:Jc.Identifier,parent:f},f.value.parent=f,f},"createProperty"),createArrayOfLiterals:t((a,s)=>{let c={type:Jc.Array,parent:s,children:[]};for(let f of a)c.children.push(Mx.createLiteral(f,c));return c},"createArrayOfLiterals")};var fhr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,yK=class{static{t(this,"SourceGenerator")}generate(s){let c=[];return this.generateSource(c,s),c.join("")}generateSource(s,c){switch(c.type){case Jc.Array:return this.generateArray(s,c);case Jc.Object:return this.generateObject(s,c);case Jc.Property:return this.generateProperty(s,c);case Jc.Literal:return this.generateLiteral(s,c);case Jc.FunctionCall:return this.generateFunctionCall(s,c);case Jc.Identifier:return this.generateIdentifier(s,c);case Jc.Raw:return this.generateRaw(s,c);case Jc.TemplateString:return this.generateTemplateString(s,c)}}generateArray(s,c){s.push("["),c.children.map(f=>{this.generateSource(s,f),s.push(",")}),s.push("]")}generateObject(s,c){s.push("{"),c.children.forEach(f=>{this.generateSource(s,f),s.push(",")}),s.push("}")}generateProperty(s,c){this.generateIdentifier(s,c.name),s.push(":"),this.generateSource(s,c.value)}generateFunctionCall(s,c){s.push(c.name.value),s.push("("),c.children.forEach((f,d,v)=>{this.generateSource(s,f),d<v.length&&s.push(",")}),s.push(")")}generateRaw(s,c){s.push(c.value)}generateTemplateString(s,c){s.push("`"),s.push(c.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,c){if(c.value===null)return s.push("null");switch(typeof c.value){case"number":case"boolean":return s.push(`${c.value}`);case"string":{let f=c.value,d=JSON.stringify(f);return s.push(`${d}`)}}}generateIdentifier(s,c){let f=fhr.test(c.value)?c.value:`'${c.value}'`;s.push(f)}};import{parse as _hr}from"@swc/core";import phr from"fs/promises";var kht=t(async a=>{let s=new Set;try{let c=await phr.readFile(a,"utf-8");(await _hr(c,{syntax:"typescript"})).body.forEach(d=>{d.type==="ExportDefaultDeclaration"||d.type==="ExportDefaultExpression"?s.add("default"):d.type==="ExportDeclaration"&&d.declaration.type==="FunctionDeclaration"?s.add(d.declaration.identifier.value):d.type==="ExportDeclaration"&&d.declaration.type==="VariableDeclaration"&&d.declaration.declarations[0].id.type==="Identifier"&&s.add(d.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var wht={$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 sOe={$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 Pht={$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 aOe={$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 oOe={$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 zyt=W_(_yt(),1),qyt=W_(Jyt(),1);var upe=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new qyt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,zyt.default)(this.ajv,{mode:"fast"})}addSchema(s,c){this.ajv.addSchema(s,c)}compile(s){let c=this.ajv.compile(s);return t(d=>({isValid:c(d),errors:this.toSimpleErrors(c.errors,d),warnings:[]}),"validator")}toSimpleErrors(s,c){let f=[];return s?.forEach(d=>{d.keyword==="enum"&&d.params.allowedValues&&Array.isArray(d.params.allowedValues)&&(d.message+=`; ${d.params.allowedValues.join(", ")}`),d.instancePath&&(d.instancePath=d.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let v={details:{}},E=d.instancePath.split("/");if(E.length>2){let O=E[1],M=E[2]?parseInt(E[2]):0,H=E[3],$=isNaN(M)?void 0:c[O][M][H];v={details:{property:O,index:M,field:H,fieldValue:$}}}if(d.keyword==="required"&&d.params.missingProperty&&d.instancePath&&(d.message=`A 'path' is missing required property '${d.params.missingProperty}'`),d.keyword==="additionalProperties"&&d.params.additionalProperty&&d.instancePath&&(d.message=`A 'path' should NOT include property '${d.params.additionalProperty}'`),d.keyword==="type"&&d.params.type&&d.instancePath){let O=d.instancePath.split("/"),M=O[O.length-1];d.message=`Value of property '${M}' must be '${d.params.type}'`}let A=Object.assign(d,v);f.push(A)}),f}};var VN=upe.instance;VN.addSchema(oOe,"route-configuration.schema.json");VN.addSchema(Pht,"policy-configuration.schema.json");VN.addSchema(sOe,"policies.schema.json");VN.addSchema(aOe,"open-api-route-configuration.schema.json");VN.addSchema(wht,"fragments.schema.json");var sVr=VN.compile(oOe),Vyt=VN.compile(aOe),T7e=VN.compile(sOe);var fpe=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=T7e(s),this.results}};var _pe=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=Vyt(s),this.results}};import v2r from"path";var C7e=/\$import\((.*)\)/,ppe=/\$env\((.*?)\)/g;var E6=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,c,f,d){super(s),this.location={file:c,namespace:"",line:f?f.line:0,column:f?f.column:0,length:0,lineText:d??"",suggestion:""}}},y2r=t(a=>{let s=[],c=a;for(;c.parent;)s.push(c),c=c.parent;return s.reverse()},"invertTree"),WN=t((a,s)=>{if(!a)return!1;let c=y2r(a);return s.split("/").every((v,E)=>{let A=c[E];return A?v==="*"||v6(A)&&A.name.value===v?!0:v==="{}"?A.type===Jc.Object:v==="[]"?A.type===Jc.Array:!1:!1})},"testPosition");var dpe=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),PB(s)?s.children.forEach(c=>{this.visitor(c)}):Dht(s)?s.children.forEach(c=>{this.visitor(c)}):v6(s)&&this.visitor(s.value)}},Wyt=t((a,s,c)=>f=>{if(!v6(f)||!NB(f.value)||typeof f.value.value!="string")return;if(!a.some(v=>WN(f,v))){ppe.test(f.value.value)&&s.push(new E6("An $env() statement is not expected at this location.",c,f.location,f.value.value));return}let d=new RegExp(ppe).exec(f.value.value);if(d?.length===2&&d[0]===f.value.value){let v={type:Jc.Raw,parent:null,value:`environment["${d[1]}"]`};f.value=v}else{let v=f.value.value.replaceAll(new RegExp(ppe),(E,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);v!==f.value.value&&(f.value=Mx.createTemplateString(v,f))}},"getEnvStatementTransformer");var YK="config/routes.json",b2r=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],S2r=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Hyt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],T2r="handler/{}/options/{}/rewritePattern",C2r="handler/{}/options/{}/baseUrl",mpe=class extends dpe{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let c=this.addedImports.get(s);if(!c)throw new Error("Import name is undefined. This should not happen.");return c}getImports(){let s=[];return this.addedImports.forEach((c,f)=>{s.push({name:c,path:f})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!v6(s)||!NB(s.value)||typeof s.value.value!="string")&&WN(s,T2r)){if(!s.parent||!PB(s.parent)){this.errors.push(new E6("Invalid node, expected object",YK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Gyt(c)},d=Mx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}rewriteForwardFunction(s){if(!(!v6(s)||!NB(s.value)||typeof s.value.value!="string")&&WN(s,C2r)){if(!s.parent||!PB(s.parent)){this.errors.push(new E6("Invalid node, expected object",YK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Jc.Raw,parent:null,value:Gyt(c)},d=Mx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}replaceImportStatements(s){if(!v6(s)||!NB(s.value))return;let c=s.value.value;if(typeof c!="string")return;if(!S2r.some(A=>WN(s,A))&&!Hyt.some(A=>WN(s,A))){if(C7e.test(c)){if(s.name.value==="$ref")return;this.errors.push(new E6("An $import() statement is not expected at this location.",YK,s.location,c))}return}let f=C7e.exec(c);if(Hyt.some(A=>WN(s,A))&&!f)return;if(!f){this.errors.push(new E6("Invalid $import() statement",YK,s.location,c));return}let d=f[1];d.startsWith(".")&&(d=v2r.join("..",d));let v=this.getImportName(d),E={type:Jc.Identifier,parent:s.parent,value:v};s.value=E}replaceEnvStatements=Wyt(b2r,this.errors,YK)};function Gyt(a){return`(request, context) => {
579
585
  const { params, url, query, method, headers } = request;
580
586
  const { host, hostname, origin, pathname, port, search } = new URL(url);
581
587
  const e = encodeURIComponent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/core",
3
- "version": "6.32.22",
3
+ "version": "6.32.24",
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.32.22",
44
- "@zuplo/otel": "^6.32.22",
45
- "@zuplo/runtime": "^6.32.22"
43
+ "@zuplo/graphql": "^6.32.24",
44
+ "@zuplo/otel": "^6.32.24",
45
+ "@zuplo/runtime": "^6.32.24"
46
46
  }
47
47
  }