@zuplo/core 6.20.17 → 6.21.0

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.
@@ -557,7 +557,7 @@ globstar while`,s,Z,l,Re,Pe),this.matchOne(s.slice(Z),l.slice(Re),_))return this
557
557
  >>> no match, partial?`,s,Z,l,Re),Z===M))}let ke;if(typeof ie=="string"?(ke=se===ie,this.debug("string match",ie,se,ke)):(ke=ie.test(se),this.debug("pattern match",ie,se,ke)),!ke)return!1}if(D===M&&A===U)return!0;if(D===M)return _;if(A===U)return D===M-1&&s[D]==="";throw new Error("wtf?")}braceExpand(){return Rat(this.pattern,this.options)}parse(s){hH(s);let l=this.options;if(s==="**")return F0;if(s==="")return"";let _,m=null;(_=s.match(NQt))?m=l.dot?OQt:IQt:(_=s.match(SQt))?m=(l.nocase?l.dot?CQt:EQt:l.dot?xQt:TQt)(_[1]):(_=s.match(FQt))?m=(l.nocase?l.dot?RQt:LQt:l.dot?MQt:jQt)(_):(_=s.match(DQt))?m=l.dot?wQt:kQt:(_=s.match(PQt))&&(m=AQt);let b=XR.fromGlob(s,this.options).toMMPattern();return m&&typeof b=="object"&&Reflect.defineProperty(b,"test",{value:m}),b}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let s=this.set;if(!s.length)return this.regexp=!1,this.regexp;let l=this.options,_=l.noglobstar?$Qt:l.dot?JQt:zQt,m=new Set(l.nocase?["i"]:[]),b=s.map(M=>{let U=M.map(ie=>{if(ie instanceof RegExp)for(let se of ie.flags.split(""))m.add(se);return typeof ie=="string"?GQt(ie):ie===F0?F0:ie._src});return U.forEach((ie,se)=>{let Z=U[se+1],Re=U[se-1];ie!==F0||Re===F0||(Re===void 0?Z!==void 0&&Z!==F0?U[se+1]="(?:\\/|"+_+"\\/)?"+Z:U[se]=_:Z===void 0?U[se-1]=Re+"(?:\\/|"+_+")?":Z!==F0&&(U[se-1]=Re+"(?:\\/|\\/"+_+"\\/)"+Z,U[se+1]=F0))}),U.filter(ie=>ie!==F0).join("/")}).join("|"),[D,A]=s.length>1?["(?:",")"]:["",""];b="^"+D+b+A+"$",this.negate&&(b="^(?!"+b+").+$");try{this.regexp=new RegExp(b,[...m].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(s){return this.preserveMultipleSlashes?s.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(s)?["",...s.split(/\/+/)]:s.split(/\/+/)}match(s,l=this.partial){if(this.debug("match",s,this.pattern),this.comment)return!1;if(this.empty)return s==="";if(s==="/"&&l)return!0;let _=this.options;this.isWindows&&(s=s.split("\\").join("/"));let m=this.slashSplit(s);this.debug(this.pattern,"split",m);let b=this.set;this.debug(this.pattern,"set",b);let D=m[m.length-1];if(!D)for(let A=m.length-2;!D&&A>=0;A--)D=m[A];for(let A=0;A<b.length;A++){let M=b[A],U=m;if(_.matchBase&&M.length===1&&(U=[D]),this.matchOne(U,M,l))return _.flipNegate?!0:!this.negate}return _.flipNegate?!1:this.negate}static defaults(s){return j1.defaults(s).Minimatch}};j1.AST=XR;j1.Minimatch=B2;j1.escape=QR;j1.unescape=DE;import{fileURLToPath as DZt}from"url";var ZR=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,jat=new Set,t6e=typeof process=="object"&&process?process:{},Bat=t((a,s,l,_)=>{typeof t6e.emitWarning=="function"?t6e.emitWarning(a,s,l,_):console.error(`[${l}] ${s}: ${a}`)},"emitWarning"),Cce=globalThis.AbortController,Mat=globalThis.AbortSignal;if(typeof Cce>"u"){Mat=class{static{t(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(_,m){this._onabort.push(m)}},Cce=class{static{t(this,"AbortController")}constructor(){s()}signal=new Mat;abort(_){if(!this.signal.aborted){this.signal.reason=_,this.signal.aborted=!0;for(let m of this.signal._onabort)m(_);this.signal.onabort?.(_)}}};let a=t6e.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",s=t(()=>{a&&(a=!1,Bat("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",s))},"warnACPolyfill")}var KQt=t(a=>!jat.has(a),"shouldWarn"),B6r=Symbol("type"),Z4=t(a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),"isPosInt"),Uat=t(a=>Z4(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?eM:null:null,"getUintArray"),eM=class extends Array{static{t(this,"ZeroArray")}constructor(s){super(s),this.fill(0)}},r6e=class a{static{t(this,"Stack")}heap;length;static#r=!1;static create(s){let l=Uat(s);if(!l)return[];a.#r=!0;let _=new a(s,l);return a.#r=!1,_}constructor(s,l){if(!a.#r)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new l(s),this.length=0}push(s){this.heap[this.length++]=s}pop(){return this.heap[--this.length]}},yH=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;#C;#x;#b;#k;#E;#y;static unsafeExposeInternals(s){return{starts:s.#x,ttls:s.#b,sizes:s.#C,keyMap:s.#c,keyList:s.#l,valList:s.#i,next:s.#f,prev:s.#v,get head(){return s.#d},get tail(){return s.#u},free:s.#m,isBackgroundFetch:t(l=>s.#h(l),"isBackgroundFetch"),backgroundFetch:t((l,_,m,b)=>s.#j(l,_,m,b),"backgroundFetch"),moveToTail:t(l=>s.#U(l),"moveToTail"),indexes:t(l=>s.#P(l),"indexes"),rindexes:t(l=>s.#A(l),"rindexes"),isStale:t(l=>s.#S(l),"isStale")}}get max(){return this.#r}get maxSize(){return this.#n}get calculatedSize(){return this.#_}get size(){return this.#a}get fetchMethod(){return this.#s}get memoMethod(){return this.#p}get dispose(){return this.#e}get disposeAfter(){return this.#t}constructor(s){let{max:l=0,ttl:_,ttlResolution:m=1,ttlAutopurge:b,updateAgeOnGet:D,updateAgeOnHas:A,allowStale:M,dispose:U,disposeAfter:ie,noDisposeOnSet:se,noUpdateTTL:Z,maxSize:Re=0,maxEntrySize:Pe=0,sizeCalculation:ke,fetchMethod:wt,memoMethod:At,noDeleteOnFetchRejection:yr,noDeleteOnStaleGet:zr,allowStaleOnFetchRejection:en,allowStaleOnFetchAbort:hn,ignoreFetchAbort:br}=s;if(l!==0&&!Z4(l))throw new TypeError("max option must be a nonnegative integer");let mr=l?Uat(l):Array;if(!mr)throw new Error("invalid max value: "+l);if(this.#r=l,this.#n=Re,this.maxEntrySize=Pe||this.#n,this.sizeCalculation=ke,this.sizeCalculation){if(!this.#n&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(At!==void 0&&typeof At!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#p=At,wt!==void 0&&typeof wt!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#s=wt,this.#E=!!wt,this.#c=new Map,this.#l=new Array(l).fill(void 0),this.#i=new Array(l).fill(void 0),this.#f=new mr(l),this.#v=new mr(l),this.#d=0,this.#u=0,this.#m=r6e.create(l),this.#a=0,this.#_=0,typeof U=="function"&&(this.#e=U),typeof ie=="function"?(this.#t=ie,this.#g=[]):(this.#t=void 0,this.#g=void 0),this.#k=!!this.#e,this.#y=!!this.#t,this.noDisposeOnSet=!!se,this.noUpdateTTL=!!Z,this.noDeleteOnFetchRejection=!!yr,this.allowStaleOnFetchRejection=!!en,this.allowStaleOnFetchAbort=!!hn,this.ignoreFetchAbort=!!br,this.maxEntrySize!==0){if(this.#n!==0&&!Z4(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!Z4(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#T()}if(this.allowStale=!!M,this.noDeleteOnStaleGet=!!zr,this.updateAgeOnGet=!!D,this.updateAgeOnHas=!!A,this.ttlResolution=Z4(m)||m===0?m:1,this.ttlAutopurge=!!b,this.ttl=_||0,this.ttl){if(!Z4(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 Is="LRU_CACHE_UNBOUNDED";KQt(Is)&&(jat.add(Is),Bat("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Is,a))}}getRemainingTTL(s){return this.#c.has(s)?1/0:0}#D(){let s=new eM(this.#r),l=new eM(this.#r);this.#b=s,this.#x=l,this.#N=(b,D,A=ZR.now())=>{if(l[b]=D!==0?A:0,s[b]=D,D!==0&&this.ttlAutopurge){let M=setTimeout(()=>{this.#S(b)&&this.#O(this.#l[b],"expire")},D+1);M.unref&&M.unref()}},this.#w=b=>{l[b]=s[b]!==0?ZR.now():0},this.#o=(b,D)=>{if(s[D]){let A=s[D],M=l[D];if(!A||!M)return;b.ttl=A,b.start=M,b.now=_||m();let U=b.now-M;b.remainingTTL=A-U}};let _=0,m=t(()=>{let b=ZR.now();if(this.ttlResolution>0){_=b;let D=setTimeout(()=>_=0,this.ttlResolution);D.unref&&D.unref()}return b},"getNow");this.getRemainingTTL=b=>{let D=this.#c.get(b);if(D===void 0)return 0;let A=s[D],M=l[D];if(!A||!M)return 1/0;let U=(_||m())-M;return A-U},this.#S=b=>{let D=l[b],A=s[b];return!!A&&!!D&&(_||m())-D>A}}#w=t(()=>{},"#updateItemAge");#o=t(()=>{},"#statusTTL");#N=t(()=>{},"#setItemTTL");#S=t(()=>!1,"#isStale");#T(){let s=new eM(this.#r);this.#_=0,this.#C=s,this.#I=l=>{this.#_-=s[l],s[l]=0},this.#L=(l,_,m,b)=>{if(this.#h(_))return 0;if(!Z4(m))if(b){if(typeof b!="function")throw new TypeError("sizeCalculation must be a function");if(m=b(_,l),!Z4(m))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return m},this.#F=(l,_,m)=>{if(s[l]=_,this.#n){let b=this.#n-s[l];for(;this.#_>b;)this.#M(!0)}this.#_+=s[l],m&&(m.entrySize=_,m.totalCalculatedSize=this.#_)}}#I=t(s=>{},"#removeItemSize");#F=t((s,l,_)=>{},"#addItemSize");#L=t((s,l,_,m)=>{if(_||m)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#P({allowStale:s=this.allowStale}={}){if(this.#a)for(let l=this.#u;!(!this.#R(l)||((s||!this.#S(l))&&(yield l),l===this.#d));)l=this.#v[l]}*#A({allowStale:s=this.allowStale}={}){if(this.#a)for(let l=this.#d;!(!this.#R(l)||((s||!this.#S(l))&&(yield l),l===this.#u));)l=this.#f[l]}#R(s){return s!==void 0&&this.#c.get(this.#l[s])===s}*entries(){for(let s of this.#P())this.#i[s]!==void 0&&this.#l[s]!==void 0&&!this.#h(this.#i[s])&&(yield[this.#l[s],this.#i[s]])}*rentries(){for(let s of this.#A())this.#i[s]!==void 0&&this.#l[s]!==void 0&&!this.#h(this.#i[s])&&(yield[this.#l[s],this.#i[s]])}*keys(){for(let s of this.#P()){let l=this.#l[s];l!==void 0&&!this.#h(this.#i[s])&&(yield l)}}*rkeys(){for(let s of this.#A()){let l=this.#l[s];l!==void 0&&!this.#h(this.#i[s])&&(yield l)}}*values(){for(let s of this.#P())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}*rvalues(){for(let s of this.#A())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(s,l={}){for(let _ of this.#P()){let m=this.#i[_],b=this.#h(m)?m.__staleWhileFetching:m;if(b!==void 0&&s(b,this.#l[_],this))return this.get(this.#l[_],l)}}forEach(s,l=this){for(let _ of this.#P()){let m=this.#i[_],b=this.#h(m)?m.__staleWhileFetching:m;b!==void 0&&s.call(l,b,this.#l[_],this)}}rforEach(s,l=this){for(let _ of this.#A()){let m=this.#i[_],b=this.#h(m)?m.__staleWhileFetching:m;b!==void 0&&s.call(l,b,this.#l[_],this)}}purgeStale(){let s=!1;for(let l of this.#A({allowStale:!0}))this.#S(l)&&(this.#O(this.#l[l],"expire"),s=!0);return s}info(s){let l=this.#c.get(s);if(l===void 0)return;let _=this.#i[l],m=this.#h(_)?_.__staleWhileFetching:_;if(m===void 0)return;let b={value:m};if(this.#b&&this.#x){let D=this.#b[l],A=this.#x[l];if(D&&A){let M=D-(ZR.now()-A);b.ttl=M,b.start=Date.now()}}return this.#C&&(b.size=this.#C[l]),b}dump(){let s=[];for(let l of this.#P({allowStale:!0})){let _=this.#l[l],m=this.#i[l],b=this.#h(m)?m.__staleWhileFetching:m;if(b===void 0||_===void 0)continue;let D={value:b};if(this.#b&&this.#x){D.ttl=this.#b[l];let A=ZR.now()-this.#x[l];D.start=Math.floor(Date.now()-A)}this.#C&&(D.size=this.#C[l]),s.unshift([_,D])}return s}load(s){this.clear();for(let[l,_]of s){if(_.start){let m=Date.now()-_.start;_.start=ZR.now()-m}this.set(l,_.value,_)}}set(s,l,_={}){if(l===void 0)return this.delete(s),this;let{ttl:m=this.ttl,start:b,noDisposeOnSet:D=this.noDisposeOnSet,sizeCalculation:A=this.sizeCalculation,status:M}=_,{noUpdateTTL:U=this.noUpdateTTL}=_,ie=this.#L(s,l,_.size||0,A);if(this.maxEntrySize&&ie>this.maxEntrySize)return M&&(M.set="miss",M.maxEntrySizeExceeded=!0),this.#O(s,"set"),this;let se=this.#a===0?void 0:this.#c.get(s);if(se===void 0)se=this.#a===0?this.#u:this.#m.length!==0?this.#m.pop():this.#a===this.#r?this.#M(!1):this.#a,this.#l[se]=s,this.#i[se]=l,this.#c.set(s,se),this.#f[this.#u]=se,this.#v[se]=this.#u,this.#u=se,this.#a++,this.#F(se,ie,M),M&&(M.set="add"),U=!1;else{this.#U(se);let Z=this.#i[se];if(l!==Z){if(this.#E&&this.#h(Z)){Z.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Re}=Z;Re!==void 0&&!D&&(this.#k&&this.#e?.(Re,s,"set"),this.#y&&this.#g?.push([Re,s,"set"]))}else D||(this.#k&&this.#e?.(Z,s,"set"),this.#y&&this.#g?.push([Z,s,"set"]));if(this.#I(se),this.#F(se,ie,M),this.#i[se]=l,M){M.set="replace";let Re=Z&&this.#h(Z)?Z.__staleWhileFetching:Z;Re!==void 0&&(M.oldValue=Re)}}else M&&(M.set="update")}if(m!==0&&!this.#b&&this.#D(),this.#b&&(U||this.#N(se,m,b),M&&this.#o(M,se)),!D&&this.#y&&this.#g){let Z=this.#g,Re;for(;Re=Z?.shift();)this.#t?.(...Re)}return this}pop(){try{for(;this.#a;){let s=this.#i[this.#d];if(this.#M(!0),this.#h(s)){if(s.__staleWhileFetching)return s.__staleWhileFetching}else if(s!==void 0)return s}}finally{if(this.#y&&this.#g){let s=this.#g,l;for(;l=s?.shift();)this.#t?.(...l)}}}#M(s){let l=this.#d,_=this.#l[l],m=this.#i[l];return this.#E&&this.#h(m)?m.__abortController.abort(new Error("evicted")):(this.#k||this.#y)&&(this.#k&&this.#e?.(m,_,"evict"),this.#y&&this.#g?.push([m,_,"evict"])),this.#I(l),s&&(this.#l[l]=void 0,this.#i[l]=void 0,this.#m.push(l)),this.#a===1?(this.#d=this.#u=0,this.#m.length=0):this.#d=this.#f[l],this.#c.delete(_),this.#a--,l}has(s,l={}){let{updateAgeOnHas:_=this.updateAgeOnHas,status:m}=l,b=this.#c.get(s);if(b!==void 0){let D=this.#i[b];if(this.#h(D)&&D.__staleWhileFetching===void 0)return!1;if(this.#S(b))m&&(m.has="stale",this.#o(m,b));else return _&&this.#w(b),m&&(m.has="hit",this.#o(m,b)),!0}else m&&(m.has="miss");return!1}peek(s,l={}){let{allowStale:_=this.allowStale}=l,m=this.#c.get(s);if(m===void 0||!_&&this.#S(m))return;let b=this.#i[m];return this.#h(b)?b.__staleWhileFetching:b}#j(s,l,_,m){let b=l===void 0?void 0:this.#i[l];if(this.#h(b))return b;let D=new Cce,{signal:A}=_;A?.addEventListener("abort",()=>D.abort(A.reason),{signal:D.signal});let M={signal:D.signal,options:_,context:m},U=t((ke,wt=!1)=>{let{aborted:At}=D.signal,yr=_.ignoreFetchAbort&&ke!==void 0;if(_.status&&(At&&!wt?(_.status.fetchAborted=!0,_.status.fetchError=D.signal.reason,yr&&(_.status.fetchAbortIgnored=!0)):_.status.fetchResolved=!0),At&&!yr&&!wt)return se(D.signal.reason);let zr=Re;return this.#i[l]===Re&&(ke===void 0?zr.__staleWhileFetching?this.#i[l]=zr.__staleWhileFetching:this.#O(s,"fetch"):(_.status&&(_.status.fetchUpdated=!0),this.set(s,ke,M.options))),ke},"cb"),ie=t(ke=>(_.status&&(_.status.fetchRejected=!0,_.status.fetchError=ke),se(ke)),"eb"),se=t(ke=>{let{aborted:wt}=D.signal,At=wt&&_.allowStaleOnFetchAbort,yr=At||_.allowStaleOnFetchRejection,zr=yr||_.noDeleteOnFetchRejection,en=Re;if(this.#i[l]===Re&&(!zr||en.__staleWhileFetching===void 0?this.#O(s,"fetch"):At||(this.#i[l]=en.__staleWhileFetching)),yr)return _.status&&en.__staleWhileFetching!==void 0&&(_.status.returnedStale=!0),en.__staleWhileFetching;if(en.__returned===en)throw ke},"fetchFail"),Z=t((ke,wt)=>{let At=this.#s?.(s,b,M);At&&At instanceof Promise&&At.then(yr=>ke(yr===void 0?void 0:yr),wt),D.signal.addEventListener("abort",()=>{(!_.ignoreFetchAbort||_.allowStaleOnFetchAbort)&&(ke(void 0),_.allowStaleOnFetchAbort&&(ke=t(yr=>U(yr,!0),"res")))})},"pcall");_.status&&(_.status.fetchDispatched=!0);let Re=new Promise(Z).then(U,ie),Pe=Object.assign(Re,{__abortController:D,__staleWhileFetching:b,__returned:void 0});return l===void 0?(this.set(s,Pe,{...M.options,status:void 0}),l=this.#c.get(s)):this.#i[l]=Pe,Pe}#h(s){if(!this.#E)return!1;let l=s;return!!l&&l instanceof Promise&&l.hasOwnProperty("__staleWhileFetching")&&l.__abortController instanceof Cce}async fetch(s,l={}){let{allowStale:_=this.allowStale,updateAgeOnGet:m=this.updateAgeOnGet,noDeleteOnStaleGet:b=this.noDeleteOnStaleGet,ttl:D=this.ttl,noDisposeOnSet:A=this.noDisposeOnSet,size:M=0,sizeCalculation:U=this.sizeCalculation,noUpdateTTL:ie=this.noUpdateTTL,noDeleteOnFetchRejection:se=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Z=this.allowStaleOnFetchRejection,ignoreFetchAbort:Re=this.ignoreFetchAbort,allowStaleOnFetchAbort:Pe=this.allowStaleOnFetchAbort,context:ke,forceRefresh:wt=!1,status:At,signal:yr}=l;if(!this.#E)return At&&(At.fetch="get"),this.get(s,{allowStale:_,updateAgeOnGet:m,noDeleteOnStaleGet:b,status:At});let zr={allowStale:_,updateAgeOnGet:m,noDeleteOnStaleGet:b,ttl:D,noDisposeOnSet:A,size:M,sizeCalculation:U,noUpdateTTL:ie,noDeleteOnFetchRejection:se,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:Pe,ignoreFetchAbort:Re,status:At,signal:yr},en=this.#c.get(s);if(en===void 0){At&&(At.fetch="miss");let hn=this.#j(s,en,zr,ke);return hn.__returned=hn}else{let hn=this.#i[en];if(this.#h(hn)){let Po=_&&hn.__staleWhileFetching!==void 0;return At&&(At.fetch="inflight",Po&&(At.returnedStale=!0)),Po?hn.__staleWhileFetching:hn.__returned=hn}let br=this.#S(en);if(!wt&&!br)return At&&(At.fetch="hit"),this.#U(en),m&&this.#w(en),At&&this.#o(At,en),hn;let mr=this.#j(s,en,zr,ke),Pi=mr.__staleWhileFetching!==void 0&&_;return At&&(At.fetch=br?"stale":"refresh",Pi&&br&&(At.returnedStale=!0)),Pi?mr.__staleWhileFetching:mr.__returned=mr}}async forceFetch(s,l={}){let _=await this.fetch(s,l);if(_===void 0)throw new Error("fetch() returned undefined");return _}memo(s,l={}){let _=this.#p;if(!_)throw new Error("no memoMethod provided to constructor");let{context:m,forceRefresh:b,...D}=l,A=this.get(s,D);if(!b&&A!==void 0)return A;let M=_(s,A,{options:D,context:m});return this.set(s,M,D),M}get(s,l={}){let{allowStale:_=this.allowStale,updateAgeOnGet:m=this.updateAgeOnGet,noDeleteOnStaleGet:b=this.noDeleteOnStaleGet,status:D}=l,A=this.#c.get(s);if(A!==void 0){let M=this.#i[A],U=this.#h(M);return D&&this.#o(D,A),this.#S(A)?(D&&(D.get="stale"),U?(D&&_&&M.__staleWhileFetching!==void 0&&(D.returnedStale=!0),_?M.__staleWhileFetching:void 0):(b||this.#O(s,"expire"),D&&_&&(D.returnedStale=!0),_?M:void 0)):(D&&(D.get="hit"),U?M.__staleWhileFetching:(this.#U(A),m&&this.#w(A),M))}else D&&(D.get="miss")}#B(s,l){this.#v[l]=s,this.#f[s]=l}#U(s){s!==this.#u&&(s===this.#d?this.#d=this.#f[s]:this.#B(this.#v[s],this.#f[s]),this.#B(this.#u,s),this.#u=s)}delete(s){return this.#O(s,"delete")}#O(s,l){let _=!1;if(this.#a!==0){let m=this.#c.get(s);if(m!==void 0)if(_=!0,this.#a===1)this.#$(l);else{this.#I(m);let b=this.#i[m];if(this.#h(b)?b.__abortController.abort(new Error("deleted")):(this.#k||this.#y)&&(this.#k&&this.#e?.(b,s,l),this.#y&&this.#g?.push([b,s,l])),this.#c.delete(s),this.#l[m]=void 0,this.#i[m]=void 0,m===this.#u)this.#u=this.#v[m];else if(m===this.#d)this.#d=this.#f[m];else{let D=this.#v[m];this.#f[D]=this.#f[m];let A=this.#f[m];this.#v[A]=this.#v[m]}this.#a--,this.#m.push(m)}}if(this.#y&&this.#g?.length){let m=this.#g,b;for(;b=m?.shift();)this.#t?.(...b)}return _}clear(){return this.#$("delete")}#$(s){for(let l of this.#A({allowStale:!0})){let _=this.#i[l];if(this.#h(_))_.__abortController.abort(new Error("deleted"));else{let m=this.#l[l];this.#k&&this.#e?.(_,m,s),this.#y&&this.#g?.push([_,m,s])}}if(this.#c.clear(),this.#i.fill(void 0),this.#l.fill(void 0),this.#b&&this.#x&&(this.#b.fill(0),this.#x.fill(0)),this.#C&&this.#C.fill(0),this.#d=0,this.#u=0,this.#m.length=0,this.#_=0,this.#a=0,this.#y&&this.#g){let l=this.#g,_;for(;_=l?.shift();)this.#t?.(..._)}}};import{posix as aZt,win32 as _6e}from"path";import{fileURLToPath as oZt}from"url";import{lstatSync as cZt,readdir as lZt,readdirSync as uZt,readlinkSync as fZt,realpathSync as _Zt}from"fs";import*as pZt from"fs";import{lstat as mZt,readdir as hZt,readlink as gZt,realpath as yZt}from"fs/promises";import{EventEmitter as l6e}from"events";import Vat from"stream";import{StringDecoder as YQt}from"string_decoder";var $at=typeof process=="object"&&process?process:{stdout:null,stderr:null},XQt=t(a=>!!a&&typeof a=="object"&&(a instanceof t3||a instanceof Vat||QQt(a)||ZQt(a)),"isStream"),QQt=t(a=>!!a&&typeof a=="object"&&a instanceof l6e&&typeof a.pipe=="function"&&a.pipe!==Vat.Writable.prototype.pipe,"isReadable"),ZQt=t(a=>!!a&&typeof a=="object"&&a instanceof l6e&&typeof a.write=="function"&&typeof a.end=="function","isWritable"),WP=Symbol("EOF"),HP=Symbol("maybeEmitEnd"),e3=Symbol("emittedEnd"),Dce=Symbol("emittingEnd"),vH=Symbol("emittedError"),kce=Symbol("closed"),Jat=Symbol("read"),wce=Symbol("flush"),zat=Symbol("flushChunk"),kE=Symbol("encoding"),tM=Symbol("decoder"),Gg=Symbol("flowing"),bH=Symbol("paused"),rM=Symbol("resume"),Kg=Symbol("buffer"),B1=Symbol("pipes"),Yg=Symbol("bufferLength"),n6e=Symbol("bufferPush"),Pce=Symbol("bufferShift"),Ny=Symbol("objectMode"),Gm=Symbol("destroyed"),i6e=Symbol("error"),s6e=Symbol("emitData"),qat=Symbol("emitEnd"),a6e=Symbol("emitEnd2"),WD=Symbol("async"),o6e=Symbol("abort"),Ace=Symbol("aborted"),SH=Symbol("signal"),bO=Symbol("dataListeners"),U2=Symbol("discarded"),TH=t(a=>Promise.resolve().then(a),"defer"),eZt=t(a=>a(),"nodefer"),tZt=t(a=>a==="end"||a==="finish"||a==="prefinish","isEndish"),rZt=t(a=>a instanceof ArrayBuffer||!!a&&typeof a=="object"&&a.constructor&&a.constructor.name==="ArrayBuffer"&&a.byteLength>=0,"isArrayBufferLike"),nZt=t(a=>!Buffer.isBuffer(a)&&ArrayBuffer.isView(a),"isArrayBufferView"),Nce=class{static{t(this,"Pipe")}src;dest;opts;ondrain;constructor(s,l,_){this.src=s,this.dest=l,this.opts=_,this.ondrain=()=>s[rM](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(s){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},c6e=class extends Nce{static{t(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(s,l,_){super(s,l,_),this.proxyErrors=m=>l.emit("error",m),s.on("error",this.proxyErrors)}},iZt=t(a=>!!a.objectMode,"isObjectModeOptions"),sZt=t(a=>!a.objectMode&&!!a.encoding&&a.encoding!=="buffer","isEncodingOptions"),t3=class extends l6e{static{t(this,"Minipass")}[Gg]=!1;[bH]=!1;[B1]=[];[Kg]=[];[Ny];[kE];[WD];[tM];[WP]=!1;[e3]=!1;[Dce]=!1;[kce]=!1;[vH]=null;[Yg]=0;[Gm]=!1;[SH];[Ace]=!1;[bO]=0;[U2]=!1;writable=!0;readable=!0;constructor(...s){let l=s[0]||{};if(super(),l.objectMode&&typeof l.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");iZt(l)?(this[Ny]=!0,this[kE]=null):sZt(l)?(this[kE]=l.encoding,this[Ny]=!1):(this[Ny]=!1,this[kE]=null),this[WD]=!!l.async,this[tM]=this[kE]?new YQt(this[kE]):null,l&&l.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:t(()=>this[Kg],"get")}),l&&l.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:t(()=>this[B1],"get")});let{signal:_}=l;_&&(this[SH]=_,_.aborted?this[o6e]():_.addEventListener("abort",()=>this[o6e]()))}get bufferLength(){return this[Yg]}get encoding(){return this[kE]}set encoding(s){throw new Error("Encoding must be set at instantiation time")}setEncoding(s){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Ny]}set objectMode(s){throw new Error("objectMode must be set at instantiation time")}get async(){return this[WD]}set async(s){this[WD]=this[WD]||!!s}[o6e](){this[Ace]=!0,this.emit("abort",this[SH]?.reason),this.destroy(this[SH]?.reason)}get aborted(){return this[Ace]}set aborted(s){}write(s,l,_){if(this[Ace])return!1;if(this[WP])throw new Error("write after end");if(this[Gm])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof l=="function"&&(_=l,l="utf8"),l||(l="utf8");let m=this[WD]?TH:eZt;if(!this[Ny]&&!Buffer.isBuffer(s)){if(nZt(s))s=Buffer.from(s.buffer,s.byteOffset,s.byteLength);else if(rZt(s))s=Buffer.from(s);else if(typeof s!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Ny]?(this[Gg]&&this[Yg]!==0&&this[wce](!0),this[Gg]?this.emit("data",s):this[n6e](s),this[Yg]!==0&&this.emit("readable"),_&&m(_),this[Gg]):s.length?(typeof s=="string"&&!(l===this[kE]&&!this[tM]?.lastNeed)&&(s=Buffer.from(s,l)),Buffer.isBuffer(s)&&this[kE]&&(s=this[tM].write(s)),this[Gg]&&this[Yg]!==0&&this[wce](!0),this[Gg]?this.emit("data",s):this[n6e](s),this[Yg]!==0&&this.emit("readable"),_&&m(_),this[Gg]):(this[Yg]!==0&&this.emit("readable"),_&&m(_),this[Gg])}read(s){if(this[Gm])return null;if(this[U2]=!1,this[Yg]===0||s===0||s&&s>this[Yg])return this[HP](),null;this[Ny]&&(s=null),this[Kg].length>1&&!this[Ny]&&(this[Kg]=[this[kE]?this[Kg].join(""):Buffer.concat(this[Kg],this[Yg])]);let l=this[Jat](s||null,this[Kg][0]);return this[HP](),l}[Jat](s,l){if(this[Ny])this[Pce]();else{let _=l;s===_.length||s===null?this[Pce]():typeof _=="string"?(this[Kg][0]=_.slice(s),l=_.slice(0,s),this[Yg]-=s):(this[Kg][0]=_.subarray(s),l=_.subarray(0,s),this[Yg]-=s)}return this.emit("data",l),!this[Kg].length&&!this[WP]&&this.emit("drain"),l}end(s,l,_){return typeof s=="function"&&(_=s,s=void 0),typeof l=="function"&&(_=l,l="utf8"),s!==void 0&&this.write(s,l),_&&this.once("end",_),this[WP]=!0,this.writable=!1,(this[Gg]||!this[bH])&&this[HP](),this}[rM](){this[Gm]||(!this[bO]&&!this[B1].length&&(this[U2]=!0),this[bH]=!1,this[Gg]=!0,this.emit("resume"),this[Kg].length?this[wce]():this[WP]?this[HP]():this.emit("drain"))}resume(){return this[rM]()}pause(){this[Gg]=!1,this[bH]=!0,this[U2]=!1}get destroyed(){return this[Gm]}get flowing(){return this[Gg]}get paused(){return this[bH]}[n6e](s){this[Ny]?this[Yg]+=1:this[Yg]+=s.length,this[Kg].push(s)}[Pce](){return this[Ny]?this[Yg]-=1:this[Yg]-=this[Kg][0].length,this[Kg].shift()}[wce](s=!1){do;while(this[zat](this[Pce]())&&this[Kg].length);!s&&!this[Kg].length&&!this[WP]&&this.emit("drain")}[zat](s){return this.emit("data",s),this[Gg]}pipe(s,l){if(this[Gm])return s;this[U2]=!1;let _=this[e3];return l=l||{},s===$at.stdout||s===$at.stderr?l.end=!1:l.end=l.end!==!1,l.proxyErrors=!!l.proxyErrors,_?l.end&&s.end():(this[B1].push(l.proxyErrors?new c6e(this,s,l):new Nce(this,s,l)),this[WD]?TH(()=>this[rM]()):this[rM]()),s}unpipe(s){let l=this[B1].find(_=>_.dest===s);l&&(this[B1].length===1?(this[Gg]&&this[bO]===0&&(this[Gg]=!1),this[B1]=[]):this[B1].splice(this[B1].indexOf(l),1),l.unpipe())}addListener(s,l){return this.on(s,l)}on(s,l){let _=super.on(s,l);if(s==="data")this[U2]=!1,this[bO]++,!this[B1].length&&!this[Gg]&&this[rM]();else if(s==="readable"&&this[Yg]!==0)super.emit("readable");else if(tZt(s)&&this[e3])super.emit(s),this.removeAllListeners(s);else if(s==="error"&&this[vH]){let m=l;this[WD]?TH(()=>m.call(this,this[vH])):m.call(this,this[vH])}return _}removeListener(s,l){return this.off(s,l)}off(s,l){let _=super.off(s,l);return s==="data"&&(this[bO]=this.listeners("data").length,this[bO]===0&&!this[U2]&&!this[B1].length&&(this[Gg]=!1)),_}removeAllListeners(s){let l=super.removeAllListeners(s);return(s==="data"||s===void 0)&&(this[bO]=0,!this[U2]&&!this[B1].length&&(this[Gg]=!1)),l}get emittedEnd(){return this[e3]}[HP](){!this[Dce]&&!this[e3]&&!this[Gm]&&this[Kg].length===0&&this[WP]&&(this[Dce]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[kce]&&this.emit("close"),this[Dce]=!1)}emit(s,...l){let _=l[0];if(s!=="error"&&s!=="close"&&s!==Gm&&this[Gm])return!1;if(s==="data")return!this[Ny]&&!_?!1:this[WD]?(TH(()=>this[s6e](_)),!0):this[s6e](_);if(s==="end")return this[qat]();if(s==="close"){if(this[kce]=!0,!this[e3]&&!this[Gm])return!1;let b=super.emit("close");return this.removeAllListeners("close"),b}else if(s==="error"){this[vH]=_,super.emit(i6e,_);let b=!this[SH]||this.listeners("error").length?super.emit("error",_):!1;return this[HP](),b}else if(s==="resume"){let b=super.emit("resume");return this[HP](),b}else if(s==="finish"||s==="prefinish"){let b=super.emit(s);return this.removeAllListeners(s),b}let m=super.emit(s,...l);return this[HP](),m}[s6e](s){for(let _ of this[B1])_.dest.write(s)===!1&&this.pause();let l=this[U2]?!1:super.emit("data",s);return this[HP](),l}[qat](){return this[e3]?!1:(this[e3]=!0,this.readable=!1,this[WD]?(TH(()=>this[a6e]()),!0):this[a6e]())}[a6e](){if(this[tM]){let l=this[tM].end();if(l){for(let _ of this[B1])_.dest.write(l);this[U2]||super.emit("data",l)}}for(let l of this[B1])l.end();let s=super.emit("end");return this.removeAllListeners("end"),s}async collect(){let s=Object.assign([],{dataLength:0});this[Ny]||(s.dataLength=0);let l=this.promise();return this.on("data",_=>{s.push(_),this[Ny]||(s.dataLength+=_.length)}),await l,s}async concat(){if(this[Ny])throw new Error("cannot concat in objectMode");let s=await this.collect();return this[kE]?s.join(""):Buffer.concat(s,s.dataLength)}async promise(){return new Promise((s,l)=>{this.on(Gm,()=>l(new Error("stream destroyed"))),this.on("error",_=>l(_)),this.on("end",()=>s())})}[Symbol.asyncIterator](){this[U2]=!1;let s=!1,l=t(async()=>(this.pause(),s=!0,{value:void 0,done:!0}),"stop");return{next:t(()=>{if(s)return l();let m=this.read();if(m!==null)return Promise.resolve({done:!1,value:m});if(this[WP])return l();let b,D,A=t(se=>{this.off("data",M),this.off("end",U),this.off(Gm,ie),l(),D(se)},"onerr"),M=t(se=>{this.off("error",A),this.off("end",U),this.off(Gm,ie),this.pause(),b({value:se,done:!!this[WP]})},"ondata"),U=t(()=>{this.off("error",A),this.off("data",M),this.off(Gm,ie),l(),b({done:!0,value:void 0})},"onend"),ie=t(()=>A(new Error("stream destroyed")),"ondestroy");return new Promise((se,Z)=>{D=Z,b=se,this.once(Gm,ie),this.once("error",A),this.once("end",U),this.once("data",M)})},"next"),throw:l,return:l,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[U2]=!1;let s=!1,l=t(()=>(this.pause(),this.off(i6e,l),this.off(Gm,l),this.off("end",l),s=!0,{done:!0,value:void 0}),"stop"),_=t(()=>{if(s)return l();let m=this.read();return m===null?l():{done:!1,value:m}},"next");return this.once("end",l),this.once(i6e,l),this.once(Gm,l),{next:_,throw:l,return:l,[Symbol.iterator](){return this}}}destroy(s){if(this[Gm])return s?this.emit("error",s):this.emit(Gm),this;this[Gm]=!0,this[U2]=!0,this[Kg].length=0,this[Yg]=0;let l=this;return typeof l.close=="function"&&!this[kce]&&l.close(),s?this.emit("error",s):this.emit(Gm),this}static get isStream(){return XQt}};var dZt=_Zt.native,EH={lstatSync:cZt,readdir:lZt,readdirSync:uZt,readlinkSync:fZt,realpathSync:dZt,promises:{lstat:mZt,readdir:hZt,readlink:gZt,realpath:yZt}},Yat=t(a=>!a||a===EH||a===pZt?EH:{...EH,...a,promises:{...EH.promises,...a.promises||{}}},"fsFromOption"),Xat=/^\\\\\?\\([a-z]:)\\?$/i,vZt=t(a=>a.replace(/\//g,"\\").replace(Xat,"$1\\"),"uncToDrive"),bZt=/[\\\/]/,bT=0,Qat=1,Zat=2,HD=4,eot=6,tot=8,SO=10,rot=12,vT=15,xH=~vT,u6e=16,Wat=32,CH=64,wE=128,Ice=256,Fce=512,Hat=CH|wE|Fce,SZt=1023,f6e=t(a=>a.isFile()?tot:a.isDirectory()?HD:a.isSymbolicLink()?SO:a.isCharacterDevice()?Zat:a.isBlockDevice()?eot:a.isSocket()?rot:a.isFIFO()?Qat:bT,"entToType"),Gat=new Map,DH=t(a=>{let s=Gat.get(a);if(s)return s;let l=a.normalize("NFKD");return Gat.set(a,l),l},"normalize"),Kat=new Map,Oce=t(a=>{let s=Kat.get(a);if(s)return s;let l=DH(a.toLowerCase());return Kat.set(a,l),l},"normalizeNocase"),Lce=class extends yH{static{t(this,"ResolveCache")}constructor(){super({max:256})}},p6e=class extends yH{static{t(this,"ChildrenCache")}constructor(s=16*1024){super({maxSize:s,sizeCalculation:t(l=>l.length+1,"sizeCalculation")})}},not=Symbol("PathScurry setAsCwd"),Iy=class{static{t(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#r;#n;get dev(){return this.#n}#e;get mode(){return this.#e}#t;get nlink(){return this.#t}#s;get uid(){return this.#s}#p;get gid(){return this.#p}#a;get rdev(){return this.#a}#_;get blksize(){return this.#_}#c;get ino(){return this.#c}#l;get size(){return this.#l}#i;get blocks(){return this.#i}#f;get atimeMs(){return this.#f}#v;get mtimeMs(){return this.#v}#d;get ctimeMs(){return this.#d}#u;get birthtimeMs(){return this.#u}#m;get atime(){return this.#m}#g;get mtime(){return this.#g}#C;get ctime(){return this.#C}#x;get birthtime(){return this.#x}#b;#k;#E;#y;#D;#w;#o;#N;#S;#T;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(s,l=bT,_,m,b,D,A){this.name=s,this.#b=b?Oce(s):DH(s),this.#o=l&SZt,this.nocase=b,this.roots=m,this.root=_||this,this.#N=D,this.#E=A.fullpath,this.#D=A.relative,this.#w=A.relativePosix,this.parent=A.parent,this.parent?this.#r=this.parent.#r:this.#r=Yat(A.fs)}depth(){return this.#k!==void 0?this.#k:this.parent?this.#k=this.parent.depth()+1:this.#k=0}childrenCache(){return this.#N}resolve(s){if(!s)return this;let l=this.getRootString(s),m=s.substring(l.length).split(this.splitSep);return l?this.getRoot(l).#I(m):this.#I(m)}#I(s){let l=this;for(let _ of s)l=l.child(_);return l}children(){let s=this.#N.get(this);if(s)return s;let l=Object.assign([],{provisional:0});return this.#N.set(this,l),this.#o&=~u6e,l}child(s,l){if(s===""||s===".")return this;if(s==="..")return this.parent||this;let _=this.children(),m=this.nocase?Oce(s):DH(s);for(let M of _)if(M.#b===m)return M;let b=this.parent?this.sep:"",D=this.#E?this.#E+b+s:void 0,A=this.newChild(s,bT,{...l,parent:this,fullpath:D});return this.canReaddir()||(A.#o|=wE),_.push(A),A}relative(){if(this.isCWD)return"";if(this.#D!==void 0)return this.#D;let s=this.name,l=this.parent;if(!l)return this.#D=this.name;let _=l.relative();return _+(!_||!l.parent?"":this.sep)+s}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let s=this.name,l=this.parent;if(!l)return this.#w=this.fullpathPosix();let _=l.relativePosix();return _+(!_||!l.parent?"":"/")+s}fullpath(){if(this.#E!==void 0)return this.#E;let s=this.name,l=this.parent;if(!l)return this.#E=this.name;let m=l.fullpath()+(l.parent?this.sep:"")+s;return this.#E=m}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let m=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(m)?this.#y=`//?/${m}`:this.#y=m}let s=this.parent,l=s.fullpathPosix(),_=l+(!l||!s.parent?"":"/")+this.name;return this.#y=_}isUnknown(){return(this.#o&vT)===bT}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&vT)===tot}isDirectory(){return(this.#o&vT)===HD}isCharacterDevice(){return(this.#o&vT)===Zat}isBlockDevice(){return(this.#o&vT)===eot}isFIFO(){return(this.#o&vT)===Qat}isSocket(){return(this.#o&vT)===rot}isSymbolicLink(){return(this.#o&SO)===SO}lstatCached(){return this.#o&Wat?this:void 0}readlinkCached(){return this.#S}realpathCached(){return this.#T}readdirCached(){let s=this.children();return s.slice(0,s.provisional)}canReadlink(){if(this.#S)return!0;if(!this.parent)return!1;let s=this.#o&vT;return!(s!==bT&&s!==SO||this.#o&Ice||this.#o&wE)}calledReaddir(){return!!(this.#o&u6e)}isENOENT(){return!!(this.#o&wE)}isNamed(s){return this.nocase?this.#b===Oce(s):this.#b===DH(s)}async readlink(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let l=await this.#r.promises.readlink(this.fullpath()),_=(await this.parent.realpath())?.resolve(l);if(_)return this.#S=_}catch(l){this.#h(l.code);return}}readlinkSync(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let l=this.#r.readlinkSync(this.fullpath()),_=this.parent.realpathSync()?.resolve(l);if(_)return this.#S=_}catch(l){this.#h(l.code);return}}#F(s){this.#o|=u6e;for(let l=s.provisional;l<s.length;l++){let _=s[l];_&&_.#L()}}#L(){this.#o&wE||(this.#o=(this.#o|wE)&xH,this.#P())}#P(){let s=this.children();s.provisional=0;for(let l of s)l.#L()}#A(){this.#o|=Fce,this.#R()}#R(){if(this.#o&CH)return;let s=this.#o;(s&vT)===HD&&(s&=xH),this.#o=s|CH,this.#P()}#M(s=""){s==="ENOTDIR"||s==="EPERM"?this.#R():s==="ENOENT"?this.#L():this.children().provisional=0}#j(s=""){s==="ENOTDIR"?this.parent.#R():s==="ENOENT"&&this.#L()}#h(s=""){let l=this.#o;l|=Ice,s==="ENOENT"&&(l|=wE),(s==="EINVAL"||s==="UNKNOWN")&&(l&=xH),this.#o=l,s==="ENOTDIR"&&this.parent&&this.parent.#R()}#B(s,l){return this.#O(s,l)||this.#U(s,l)}#U(s,l){let _=f6e(s),m=this.newChild(s.name,_,{parent:this}),b=m.#o&vT;return b!==HD&&b!==SO&&b!==bT&&(m.#o|=CH),l.unshift(m),l.provisional++,m}#O(s,l){for(let _=l.provisional;_<l.length;_++){let m=l[_];if((this.nocase?Oce(s.name):DH(s.name))===m.#b)return this.#$(s,m,_,l)}}#$(s,l,_,m){let b=l.name;return l.#o=l.#o&xH|f6e(s),b!==s.name&&(l.name=s.name),_!==m.provisional&&(_===m.length-1?m.pop():m.splice(_,1),m.unshift(l)),m.provisional++,l}async lstat(){if(!(this.#o&wE))try{return this.#V(await this.#r.promises.lstat(this.fullpath())),this}catch(s){this.#j(s.code)}}lstatSync(){if(!(this.#o&wE))try{return this.#V(this.#r.lstatSync(this.fullpath())),this}catch(s){this.#j(s.code)}}#V(s){let{atime:l,atimeMs:_,birthtime:m,birthtimeMs:b,blksize:D,blocks:A,ctime:M,ctimeMs:U,dev:ie,gid:se,ino:Z,mode:Re,mtime:Pe,mtimeMs:ke,nlink:wt,rdev:At,size:yr,uid:zr}=s;this.#m=l,this.#f=_,this.#x=m,this.#u=b,this.#_=D,this.#i=A,this.#C=M,this.#d=U,this.#n=ie,this.#p=se,this.#c=Z,this.#e=Re,this.#g=Pe,this.#v=ke,this.#t=wt,this.#a=At,this.#l=yr,this.#s=zr;let en=f6e(s);this.#o=this.#o&xH|en|Wat,en!==bT&&en!==HD&&en!==SO&&(this.#o|=CH)}#z=[];#q=!1;#W(s){this.#q=!1;let l=this.#z.slice();this.#z.length=0,l.forEach(_=>_(null,s))}readdirCB(s,l=!1){if(!this.canReaddir()){l?s(null,[]):queueMicrotask(()=>s(null,[]));return}let _=this.children();if(this.calledReaddir()){let b=_.slice(0,_.provisional);l?s(null,b):queueMicrotask(()=>s(null,b));return}if(this.#z.push(s),this.#q)return;this.#q=!0;let m=this.fullpath();this.#r.readdir(m,{withFileTypes:!0},(b,D)=>{if(b)this.#M(b.code),_.provisional=0;else{for(let A of D)this.#B(A,_);this.#F(_)}this.#W(_.slice(0,_.provisional))})}#J;async readdir(){if(!this.canReaddir())return[];let s=this.children();if(this.calledReaddir())return s.slice(0,s.provisional);let l=this.fullpath();if(this.#J)await this.#J;else{let _=t(()=>{},"resolve");this.#J=new Promise(m=>_=m);try{for(let m of await this.#r.promises.readdir(l,{withFileTypes:!0}))this.#B(m,s);this.#F(s)}catch(m){this.#M(m.code),s.provisional=0}this.#J=void 0,_()}return s.slice(0,s.provisional)}readdirSync(){if(!this.canReaddir())return[];let s=this.children();if(this.calledReaddir())return s.slice(0,s.provisional);let l=this.fullpath();try{for(let _ of this.#r.readdirSync(l,{withFileTypes:!0}))this.#B(_,s);this.#F(s)}catch(_){this.#M(_.code),s.provisional=0}return s.slice(0,s.provisional)}canReaddir(){if(this.#o&Hat)return!1;let s=vT&this.#o;return s===bT||s===HD||s===SO}shouldWalk(s,l){return(this.#o&HD)===HD&&!(this.#o&Hat)&&!s.has(this)&&(!l||l(this))}async realpath(){if(this.#T)return this.#T;if(!((Fce|Ice|wE)&this.#o))try{let s=await this.#r.promises.realpath(this.fullpath());return this.#T=this.resolve(s)}catch{this.#A()}}realpathSync(){if(this.#T)return this.#T;if(!((Fce|Ice|wE)&this.#o))try{let s=this.#r.realpathSync(this.fullpath());return this.#T=this.resolve(s)}catch{this.#A()}}[not](s){if(s===this)return;s.isCWD=!1,this.isCWD=!0;let l=new Set([]),_=[],m=this;for(;m&&m.parent;)l.add(m),m.#D=_.join(this.sep),m.#w=_.join("/"),m=m.parent,_.push("..");for(m=s;m&&m.parent&&!l.has(m);)m.#D=void 0,m.#w=void 0,m=m.parent}},Rce=class a extends Iy{static{t(this,"PathWin32")}sep="\\";splitSep=bZt;constructor(s,l=bT,_,m,b,D,A){super(s,l,_,m,b,D,A)}newChild(s,l=bT,_={}){return new a(s,l,this.root,this.roots,this.nocase,this.childrenCache(),_)}getRootString(s){return _6e.parse(s).root}getRoot(s){if(s=vZt(s.toUpperCase()),s===this.root.name)return this.root;for(let[l,_]of Object.entries(this.roots))if(this.sameRoot(s,l))return this.roots[s]=_;return this.roots[s]=new nM(s,this).root}sameRoot(s,l=this.root.name){return s=s.toUpperCase().replace(/\//g,"\\").replace(Xat,"$1\\"),s===l}},Mce=class a extends Iy{static{t(this,"PathPosix")}splitSep="/";sep="/";constructor(s,l=bT,_,m,b,D,A){super(s,l,_,m,b,D,A)}getRootString(s){return s.startsWith("/")?"/":""}getRoot(s){return this.root}newChild(s,l=bT,_={}){return new a(s,l,this.root,this.roots,this.nocase,this.childrenCache(),_)}},jce=class{static{t(this,"PathScurryBase")}root;rootPath;roots;cwd;#r;#n;#e;nocase;#t;constructor(s=process.cwd(),l,_,{nocase:m,childrenCacheSize:b=16*1024,fs:D=EH}={}){this.#t=Yat(D),(s instanceof URL||s.startsWith("file://"))&&(s=oZt(s));let A=l.resolve(s);this.roots=Object.create(null),this.rootPath=this.parseRootPath(A),this.#r=new Lce,this.#n=new Lce,this.#e=new p6e(b);let M=A.substring(this.rootPath.length).split(_);if(M.length===1&&!M[0]&&M.pop(),m===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=m,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let U=this.root,ie=M.length-1,se=l.sep,Z=this.rootPath,Re=!1;for(let Pe of M){let ke=ie--;U=U.child(Pe,{relative:new Array(ke).fill("..").join(se),relativePosix:new Array(ke).fill("..").join("/"),fullpath:Z+=(Re?"":se)+Pe}),Re=!0}this.cwd=U}depth(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.depth()}childrenCache(){return this.#e}resolve(...s){let l="";for(let b=s.length-1;b>=0;b--){let D=s[b];if(!(!D||D===".")&&(l=l?`${D}/${l}`:D,this.isAbsolute(D)))break}let _=this.#r.get(l);if(_!==void 0)return _;let m=this.cwd.resolve(l).fullpath();return this.#r.set(l,m),m}resolvePosix(...s){let l="";for(let b=s.length-1;b>=0;b--){let D=s[b];if(!(!D||D===".")&&(l=l?`${D}/${l}`:D,this.isAbsolute(D)))break}let _=this.#n.get(l);if(_!==void 0)return _;let m=this.cwd.resolve(l).fullpathPosix();return this.#n.set(l,m),m}relative(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.relative()}relativePosix(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.relativePosix()}basename(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.name}dirname(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),(s.parent||s).fullpath()}async readdir(s=this.cwd,l={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_}=l;if(s.canReaddir()){let m=await s.readdir();return _?m:m.map(b=>b.name)}else return[]}readdirSync(s=this.cwd,l={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0}=l;return s.canReaddir()?_?s.readdirSync():s.readdirSync().map(m=>m.name):[]}async lstat(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.lstat()}lstatSync(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.lstatSync()}async readlink(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s.withFileTypes,s=this.cwd);let _=await s.readlink();return l?_:_?.fullpath()}readlinkSync(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s.withFileTypes,s=this.cwd);let _=s.readlinkSync();return l?_:_?.fullpath()}async realpath(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s.withFileTypes,s=this.cwd);let _=await s.realpath();return l?_:_?.fullpath()}realpathSync(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s.withFileTypes,s=this.cwd);let _=s.realpathSync();return l?_:_?.fullpath()}async walk(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l,A=[];(!b||b(s))&&A.push(_?s:s.fullpath());let M=new Set,U=t((se,Z)=>{M.add(se),se.readdirCB((Re,Pe)=>{if(Re)return Z(Re);let ke=Pe.length;if(!ke)return Z();let wt=t(()=>{--ke===0&&Z()},"next");for(let At of Pe)(!b||b(At))&&A.push(_?At:At.fullpath()),m&&At.isSymbolicLink()?At.realpath().then(yr=>yr?.isUnknown()?yr.lstat():yr).then(yr=>yr?.shouldWalk(M,D)?U(yr,wt):wt()):At.shouldWalk(M,D)?U(At,wt):wt()},!0)},"walk"),ie=s;return new Promise((se,Z)=>{U(ie,Re=>{if(Re)return Z(Re);se(A)})})}walkSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l,A=[];(!b||b(s))&&A.push(_?s:s.fullpath());let M=new Set([s]);for(let U of M){let ie=U.readdirSync();for(let se of ie){(!b||b(se))&&A.push(_?se:se.fullpath());let Z=se;if(se.isSymbolicLink()){if(!(m&&(Z=se.realpathSync())))continue;Z.isUnknown()&&Z.lstatSync()}Z.shouldWalk(M,D)&&M.add(Z)}}return A}[Symbol.asyncIterator](){return this.iterate()}iterate(s=this.cwd,l={}){return typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd),this.stream(s,l)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l;(!b||b(s))&&(yield _?s:s.fullpath());let A=new Set([s]);for(let M of A){let U=M.readdirSync();for(let ie of U){(!b||b(ie))&&(yield _?ie:ie.fullpath());let se=ie;if(ie.isSymbolicLink()){if(!(m&&(se=ie.realpathSync())))continue;se.isUnknown()&&se.lstatSync()}se.shouldWalk(A,D)&&A.add(se)}}}stream(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l,A=new t3({objectMode:!0});(!b||b(s))&&A.write(_?s:s.fullpath());let M=new Set,U=[s],ie=0,se=t(()=>{let Z=!1;for(;!Z;){let Re=U.shift();if(!Re){ie===0&&A.end();return}ie++,M.add(Re);let Pe=t((wt,At,yr=!1)=>{if(wt)return A.emit("error",wt);if(m&&!yr){let zr=[];for(let en of At)en.isSymbolicLink()&&zr.push(en.realpath().then(hn=>hn?.isUnknown()?hn.lstat():hn));if(zr.length){Promise.all(zr).then(()=>Pe(null,At,!0));return}}for(let zr of At)zr&&(!b||b(zr))&&(A.write(_?zr:zr.fullpath())||(Z=!0));ie--;for(let zr of At){let en=zr.realpathCached()||zr;en.shouldWalk(M,D)&&U.push(en)}Z&&!A.flowing?A.once("drain",se):ke||se()},"onReaddir"),ke=!0;Re.readdirCB(Pe,!0),ke=!1}},"process");return se(),A}streamSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l,A=new t3({objectMode:!0}),M=new Set;(!b||b(s))&&A.write(_?s:s.fullpath());let U=[s],ie=0,se=t(()=>{let Z=!1;for(;!Z;){let Re=U.shift();if(!Re){ie===0&&A.end();return}ie++,M.add(Re);let Pe=Re.readdirSync();for(let ke of Pe)(!b||b(ke))&&(A.write(_?ke:ke.fullpath())||(Z=!0));ie--;for(let ke of Pe){let wt=ke;if(ke.isSymbolicLink()){if(!(m&&(wt=ke.realpathSync())))continue;wt.isUnknown()&&wt.lstatSync()}wt.shouldWalk(M,D)&&U.push(wt)}}Z&&!A.flowing&&A.once("drain",se)},"process");return se(),A}chdir(s=this.cwd){let l=this.cwd;this.cwd=typeof s=="string"?this.cwd.resolve(s):s,this.cwd[not](l)}},nM=class extends jce{static{t(this,"PathScurryWin32")}sep="\\";constructor(s=process.cwd(),l={}){let{nocase:_=!0}=l;super(s,_6e,"\\",{...l,nocase:_}),this.nocase=_;for(let m=this.cwd;m;m=m.parent)m.nocase=this.nocase}parseRootPath(s){return _6e.parse(s).root.toUpperCase()}newRoot(s){return new Rce(this.rootPath,HD,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")||s.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(s)}},iM=class extends jce{static{t(this,"PathScurryPosix")}sep="/";constructor(s=process.cwd(),l={}){let{nocase:_=!1}=l;super(s,aZt,"/",{...l,nocase:_}),this.nocase=_}parseRootPath(s){return"/"}newRoot(s){return new Mce(this.rootPath,HD,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")}},kH=class extends iM{static{t(this,"PathScurryDarwin")}constructor(s=process.cwd(),l={}){let{nocase:_=!0}=l;super(s,{...l,nocase:_})}},Z6r=process.platform==="win32"?Rce:Mce,iot=process.platform==="win32"?nM:process.platform==="darwin"?kH:iM;var TZt=t(a=>a.length>=1,"isPatternList"),xZt=t(a=>a.length>=1,"isGlobList"),sM=class a{static{t(this,"Pattern")}#r;#n;#e;length;#t;#s;#p;#a;#_;#c;#l=!0;constructor(s,l,_,m){if(!TZt(s))throw new TypeError("empty pattern list");if(!xZt(l))throw new TypeError("empty glob list");if(l.length!==s.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=s.length,_<0||_>=this.length)throw new TypeError("index out of range");if(this.#r=s,this.#n=l,this.#e=_,this.#t=m,this.#e===0){if(this.isUNC()){let[b,D,A,M,...U]=this.#r,[ie,se,Z,Re,...Pe]=this.#n;U[0]===""&&(U.shift(),Pe.shift());let ke=[b,D,A,M,""].join("/"),wt=[ie,se,Z,Re,""].join("/");this.#r=[ke,...U],this.#n=[wt,...Pe],this.length=this.#r.length}else if(this.isDrive()||this.isAbsolute()){let[b,...D]=this.#r,[A,...M]=this.#n;D[0]===""&&(D.shift(),M.shift());let U=b+"/",ie=A+"/";this.#r=[U,...D],this.#n=[ie,...M],this.length=this.#r.length}}}pattern(){return this.#r[this.#e]}isString(){return typeof this.#r[this.#e]=="string"}isGlobstar(){return this.#r[this.#e]===F0}isRegExp(){return this.#r[this.#e]instanceof RegExp}globString(){return this.#p=this.#p||(this.#e===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#e).join("/"))}hasMore(){return this.length>this.#e+1}rest(){return this.#s!==void 0?this.#s:this.hasMore()?(this.#s=new a(this.#r,this.#n,this.#e+1,this.#t),this.#s.#c=this.#c,this.#s.#_=this.#_,this.#s.#a=this.#a,this.#s):this.#s=null}isUNC(){let s=this.#r;return this.#_!==void 0?this.#_:this.#_=this.#t==="win32"&&this.#e===0&&s[0]===""&&s[1]===""&&typeof s[2]=="string"&&!!s[2]&&typeof s[3]=="string"&&!!s[3]}isDrive(){let s=this.#r;return this.#a!==void 0?this.#a:this.#a=this.#t==="win32"&&this.#e===0&&this.length>1&&typeof s[0]=="string"&&/^[a-z]:$/i.test(s[0])}isAbsolute(){let s=this.#r;return this.#c!==void 0?this.#c:this.#c=s[0]===""&&s.length>1||this.isDrive()||this.isUNC()}root(){let s=this.#r[0];return typeof s=="string"&&this.isAbsolute()&&this.#e===0?s:""}checkFollowGlobstar(){return!(this.#e===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#e===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};var EZt=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",aM=class{static{t(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(s,{nobrace:l,nocase:_,noext:m,noglobstar:b,platform:D=EZt}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=D,this.mmopts={dot:!0,nobrace:l,nocase:_,noext:m,noglobstar:b,optimizationLevel:2,platform:D,nocomment:!0,nonegate:!0};for(let A of s)this.add(A)}add(s){let l=new B2(s,this.mmopts);for(let _=0;_<l.set.length;_++){let m=l.set[_],b=l.globParts[_];if(!m||!b)throw new Error("invalid pattern object");for(;m[0]==="."&&b[0]===".";)m.shift(),b.shift();let D=new sM(m,b,0,this.platform),A=new B2(D.globString(),this.mmopts),M=b[b.length-1]==="**",U=D.isAbsolute();U?this.absolute.push(A):this.relative.push(A),M&&(U?this.absoluteChildren.push(A):this.relativeChildren.push(A))}}ignored(s){let l=s.fullpath(),_=`${l}/`,m=s.relative()||".",b=`${m}/`;for(let D of this.relative)if(D.match(m)||D.match(b))return!0;for(let D of this.absolute)if(D.match(l)||D.match(_))return!0;return!1}childrenIgnored(s){let l=s.fullpath()+"/",_=(s.relative()||".")+"/";for(let m of this.relativeChildren)if(m.match(_))return!0;for(let m of this.absoluteChildren)if(m.match(l))return!0;return!1}};var d6e=class a{static{t(this,"HasWalkedCache")}store;constructor(s=new Map){this.store=s}copy(){return new a(new Map(this.store))}hasWalked(s,l){return this.store.get(s.fullpath())?.has(l.globString())}storeWalked(s,l){let _=s.fullpath(),m=this.store.get(_);m?m.add(l.globString()):this.store.set(_,new Set([l.globString()]))}},m6e=class{static{t(this,"MatchRecord")}store=new Map;add(s,l,_){let m=(l?2:0)|(_?1:0),b=this.store.get(s);this.store.set(s,b===void 0?m:m&b)}entries(){return[...this.store.entries()].map(([s,l])=>[s,!!(l&2),!!(l&1)])}},h6e=class{static{t(this,"SubWalks")}store=new Map;add(s,l){if(!s.canReaddir())return;let _=this.store.get(s);_?_.find(m=>m.globString()===l.globString())||_.push(l):this.store.set(s,[l])}get(s){let l=this.store.get(s);if(!l)throw new Error("attempting to walk unknown path");return l}entries(){return this.keys().map(s=>[s,this.store.get(s)])}keys(){return[...this.store.keys()].filter(s=>s.canReaddir())}},wH=class a{static{t(this,"Processor")}hasWalkedCache;matches=new m6e;subwalks=new h6e;patterns;follow;dot;opts;constructor(s,l){this.opts=s,this.follow=!!s.follow,this.dot=!!s.dot,this.hasWalkedCache=l?l.copy():new d6e}processPatterns(s,l){this.patterns=l;let _=l.map(m=>[s,m]);for(let[m,b]of _){this.hasWalkedCache.storeWalked(m,b);let D=b.root(),A=b.isAbsolute()&&this.opts.absolute!==!1;if(D){m=m.resolve(D==="/"&&this.opts.root!==void 0?this.opts.root:D);let se=b.rest();if(se)b=se;else{this.matches.add(m,!0,!1);continue}}if(m.isENOENT())continue;let M,U,ie=!1;for(;typeof(M=b.pattern())=="string"&&(U=b.rest());)m=m.resolve(M),b=U,ie=!0;if(M=b.pattern(),U=b.rest(),ie){if(this.hasWalkedCache.hasWalked(m,b))continue;this.hasWalkedCache.storeWalked(m,b)}if(typeof M=="string"){let se=M===".."||M===""||M===".";this.matches.add(m.resolve(M),A,se);continue}else if(M===F0){(!m.isSymbolicLink()||this.follow||b.checkFollowGlobstar())&&this.subwalks.add(m,b);let se=U?.pattern(),Z=U?.rest();if(!U||(se===""||se===".")&&!Z)this.matches.add(m,A,se===""||se===".");else if(se===".."){let Re=m.parent||m;Z?this.hasWalkedCache.hasWalked(Re,Z)||this.subwalks.add(Re,Z):this.matches.add(Re,A,!0)}}else M instanceof RegExp&&this.subwalks.add(m,b)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new a(this.opts,this.hasWalkedCache)}filterEntries(s,l){let _=this.subwalks.get(s),m=this.child();for(let b of l)for(let D of _){let A=D.isAbsolute(),M=D.pattern(),U=D.rest();M===F0?m.testGlobstar(b,D,U,A):M instanceof RegExp?m.testRegExp(b,M,U,A):m.testString(b,M,U,A)}return m}testGlobstar(s,l,_,m){if((this.dot||!s.name.startsWith("."))&&(l.hasMore()||this.matches.add(s,m,!1),s.canReaddir()&&(this.follow||!s.isSymbolicLink()?this.subwalks.add(s,l):s.isSymbolicLink()&&(_&&l.checkFollowGlobstar()?this.subwalks.add(s,_):l.markFollowGlobstar()&&this.subwalks.add(s,l)))),_){let b=_.pattern();if(typeof b=="string"&&b!==".."&&b!==""&&b!==".")this.testString(s,b,_.rest(),m);else if(b===".."){let D=s.parent||s;this.subwalks.add(D,_)}else b instanceof RegExp&&this.testRegExp(s,b,_.rest(),m)}}testRegExp(s,l,_,m){l.test(s.name)&&(_?this.subwalks.add(s,_):this.matches.add(s,m,!1))}testString(s,l,_,m){s.isNamed(l)&&(_?this.subwalks.add(s,_):this.matches.add(s,m,!1))}};var CZt=t((a,s)=>typeof a=="string"?new aM([a],s):Array.isArray(a)?new aM(a,s):a,"makeIgnore"),Bce=class{static{t(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#r=[];#n;#e;signal;maxDepth;includeChildMatches;constructor(s,l,_){if(this.patterns=s,this.path=l,this.opts=_,this.#e=!_.posix&&_.platform==="win32"?"\\":"/",this.includeChildMatches=_.includeChildMatches!==!1,(_.ignore||!this.includeChildMatches)&&(this.#n=CZt(_.ignore??[],_),!this.includeChildMatches&&typeof this.#n.add!="function")){let m="cannot ignore child matches, ignore lacks add() method.";throw new Error(m)}this.maxDepth=_.maxDepth||1/0,_.signal&&(this.signal=_.signal,this.signal.addEventListener("abort",()=>{this.#r.length=0}))}#t(s){return this.seen.has(s)||!!this.#n?.ignored?.(s)}#s(s){return!!this.#n?.childrenIgnored?.(s)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let s;for(;!this.paused&&(s=this.#r.shift());)s()}onResume(s){this.signal?.aborted||(this.paused?this.#r.push(s):s())}async matchCheck(s,l){if(l&&this.opts.nodir)return;let _;if(this.opts.realpath){if(_=s.realpathCached()||await s.realpath(),!_)return;s=_}let b=s.isUnknown()||this.opts.stat?await s.lstat():s;if(this.opts.follow&&this.opts.nodir&&b?.isSymbolicLink()){let D=await b.realpath();D&&(D.isUnknown()||this.opts.stat)&&await D.lstat()}return this.matchCheckTest(b,l)}matchCheckTest(s,l){return s&&(this.maxDepth===1/0||s.depth()<=this.maxDepth)&&(!l||s.canReaddir())&&(!this.opts.nodir||!s.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!s.isSymbolicLink()||!s.realpathCached()?.isDirectory())&&!this.#t(s)?s:void 0}matchCheckSync(s,l){if(l&&this.opts.nodir)return;let _;if(this.opts.realpath){if(_=s.realpathCached()||s.realpathSync(),!_)return;s=_}let b=s.isUnknown()||this.opts.stat?s.lstatSync():s;if(this.opts.follow&&this.opts.nodir&&b?.isSymbolicLink()){let D=b.realpathSync();D&&(D?.isUnknown()||this.opts.stat)&&D.lstatSync()}return this.matchCheckTest(b,l)}matchFinish(s,l){if(this.#t(s))return;if(!this.includeChildMatches&&this.#n?.add){let b=`${s.relativePosix()}/**`;this.#n.add(b)}let _=this.opts.absolute===void 0?l:this.opts.absolute;this.seen.add(s);let m=this.opts.mark&&s.isDirectory()?this.#e:"";if(this.opts.withFileTypes)this.matchEmit(s);else if(_){let b=this.opts.posix?s.fullpathPosix():s.fullpath();this.matchEmit(b+m)}else{let b=this.opts.posix?s.relativePosix():s.relative(),D=this.opts.dotRelative&&!b.startsWith(".."+this.#e)?"."+this.#e:"";this.matchEmit(b?D+b+m:"."+m)}}async match(s,l,_){let m=await this.matchCheck(s,_);m&&this.matchFinish(m,l)}matchSync(s,l,_){let m=this.matchCheckSync(s,_);m&&this.matchFinish(m,l)}walkCB(s,l,_){this.signal?.aborted&&_(),this.walkCB2(s,l,new wH(this.opts),_)}walkCB2(s,l,_,m){if(this.#s(s))return m();if(this.signal?.aborted&&m(),this.paused){this.onResume(()=>this.walkCB2(s,l,_,m));return}_.processPatterns(s,l);let b=1,D=t(()=>{--b===0&&m()},"next");for(let[A,M,U]of _.matches.entries())this.#t(A)||(b++,this.match(A,M,U).then(()=>D()));for(let A of _.subwalkTargets()){if(this.maxDepth!==1/0&&A.depth()>=this.maxDepth)continue;b++;let M=A.readdirCached();A.calledReaddir()?this.walkCB3(A,M,_,D):A.readdirCB((U,ie)=>this.walkCB3(A,ie,_,D),!0)}D()}walkCB3(s,l,_,m){_=_.filterEntries(s,l);let b=1,D=t(()=>{--b===0&&m()},"next");for(let[A,M,U]of _.matches.entries())this.#t(A)||(b++,this.match(A,M,U).then(()=>D()));for(let[A,M]of _.subwalks.entries())b++,this.walkCB2(A,M,_.child(),D);D()}walkCBSync(s,l,_){this.signal?.aborted&&_(),this.walkCB2Sync(s,l,new wH(this.opts),_)}walkCB2Sync(s,l,_,m){if(this.#s(s))return m();if(this.signal?.aborted&&m(),this.paused){this.onResume(()=>this.walkCB2Sync(s,l,_,m));return}_.processPatterns(s,l);let b=1,D=t(()=>{--b===0&&m()},"next");for(let[A,M,U]of _.matches.entries())this.#t(A)||this.matchSync(A,M,U);for(let A of _.subwalkTargets()){if(this.maxDepth!==1/0&&A.depth()>=this.maxDepth)continue;b++;let M=A.readdirSync();this.walkCB3Sync(A,M,_,D)}D()}walkCB3Sync(s,l,_,m){_=_.filterEntries(s,l);let b=1,D=t(()=>{--b===0&&m()},"next");for(let[A,M,U]of _.matches.entries())this.#t(A)||this.matchSync(A,M,U);for(let[A,M]of _.subwalks.entries())b++,this.walkCB2Sync(A,M,_.child(),D);D()}},PH=class extends Bce{static{t(this,"GlobWalker")}matches=new Set;constructor(s,l,_){super(s,l,_)}matchEmit(s){this.matches.add(s)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((s,l)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?l(this.signal.reason):s(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},AH=class extends Bce{static{t(this,"GlobStream")}results;constructor(s,l,_){super(s,l,_),this.results=new t3({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 kZt=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",PE=class{static{t(this,"Glob")}absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(s,l){if(!l)throw new TypeError("glob options required");if(this.withFileTypes=!!l.withFileTypes,this.signal=l.signal,this.follow=!!l.follow,this.dot=!!l.dot,this.dotRelative=!!l.dotRelative,this.nodir=!!l.nodir,this.mark=!!l.mark,l.cwd?(l.cwd instanceof URL||l.cwd.startsWith("file://"))&&(l.cwd=DZt(l.cwd)):this.cwd="",this.cwd=l.cwd||"",this.root=l.root,this.magicalBraces=!!l.magicalBraces,this.nobrace=!!l.nobrace,this.noext=!!l.noext,this.realpath=!!l.realpath,this.absolute=l.absolute,this.includeChildMatches=l.includeChildMatches!==!1,this.noglobstar=!!l.noglobstar,this.matchBase=!!l.matchBase,this.maxDepth=typeof l.maxDepth=="number"?l.maxDepth:1/0,this.stat=!!l.stat,this.ignore=l.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof s=="string"&&(s=[s]),this.windowsPathsNoEscape=!!l.windowsPathsNoEscape||l.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(s=s.map(M=>M.replace(/\\/g,"/"))),this.matchBase){if(l.noglobstar)throw new TypeError("base matching requires globstar");s=s.map(M=>M.includes("/")?M:`./**/${M}`)}if(this.pattern=s,this.platform=l.platform||kZt,this.opts={...l,platform:this.platform},l.scurry){if(this.scurry=l.scurry,l.nocase!==void 0&&l.nocase!==l.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let M=l.platform==="win32"?nM:l.platform==="darwin"?kH:l.platform?iM:iot;this.scurry=new M(this.cwd,{nocase:l.nocase,fs:l.fs})}this.nocase=this.scurry.nocase;let _=this.platform==="darwin"||this.platform==="win32",m={...l,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:_,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},b=this.pattern.map(M=>new B2(M,m)),[D,A]=b.reduce((M,U)=>(M[0].push(...U.set),M[1].push(...U.globParts),M),[[],[]]);this.patterns=D.map((M,U)=>{let ie=A[U];if(!ie)throw new Error("invalid pattern object");return new sM(M,ie,0,this.platform)})}async walk(){return[...await new PH(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 PH(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 AH(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new AH(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var g6e=t((a,s={})=>{Array.isArray(a)||(a=[a]);for(let l of a)if(new B2(l,s).hasMagic())return!0;return!1},"hasMagic");function Uce(a,s={}){return new PE(a,s).streamSync()}t(Uce,"globStreamSync");function aot(a,s={}){return new PE(a,s).stream()}t(aot,"globStream");function oot(a,s={}){return new PE(a,s).walkSync()}t(oot,"globSync");async function sot(a,s={}){return new PE(a,s).walk()}t(sot,"glob_");function $ce(a,s={}){return new PE(a,s).iterateSync()}t($ce,"globIterateSync");function cot(a,s={}){return new PE(a,s).iterate()}t(cot,"globIterate");var wZt=Uce,PZt=Object.assign(aot,{sync:Uce}),AZt=$ce,NZt=Object.assign(cot,{sync:$ce}),IZt=Object.assign(oot,{stream:Uce,iterate:$ce}),NH=Object.assign(sot,{glob:sot,globSync:oot,sync:IZt,globStream:aot,stream:PZt,globStreamSync:Uce,streamSync:wZt,globIterate:cot,iterate:NZt,globIterateSync:$ce,iterateSync:AZt,Glob:PE,hasMagic:g6e,escape:QR,unescape:DE});NH.glob=NH;import $fe from"fs";import HFe from"path";var U1=class extends Error{static{t(this,"CompilationError")}buildMessages;constructor(s){super("An error occurred during compilation."),this.buildMessages=Array.isArray(s)?s:[s]}toBuildResult(){return{content:"",errors:this.buildMessages}}};var OZt="[",FZt="]",LZt="{",RZt="}",MZt=":",jZt=",",BZt="true",UZt="false",$Zt="null",JZt="NaN",zZt="Infinity",v6e='"',IH=new Map([[34,v6e],[92,"\\"],[47,"/"],[98,"\b"],[110,`
558
558
  `],[102,"\f"],[114,"\r"],[116," "]]),qce=new Map([...IH,[118,"\v"],[48,"\0"]]),qZt=new Map([[v6e,v6e],["\\","\\"],["/","/"],["\b","b"],[`
559
559
  `,"n"],["\f","f"],["\r","r"],[" ","t"]]),j4r=new Map([...qZt,["\v","v"],["\0","0"],["\u2028","u2028"],["\u2029","u2029"]]),zce=new Map([[OZt,"LBracket"],[FZt,"RBracket"],[LZt,"LBrace"],[RZt,"RBrace"],[MZt,"Colon"],[jZt,"Comma"],[BZt,"Boolean"],[UZt,"Boolean"],[$Zt,"Null"]]),Jce=new Map([...zce,[JZt,"Number"],[zZt,"Number"]]),b6e=new Set([10,13,8232,8233]),KP=class extends Error{static{t(this,"ErrorWithLocation")}constructor(s,{line:l,column:_,offset:m}){super(`${s} (${l}:${_})`),this.line=l,this.column=_,this.offset=m}},S6e=class extends KP{static{t(this,"UnexpectedChar")}constructor(s,l){super(`Unexpected character '${String.fromCharCode(s)}' found.`,l)}},T6e=class extends KP{static{t(this,"UnexpectedIdentifier")}constructor(s,l){super(`Unexpected identifier '${s}' found.`,l)}},TO=class extends KP{static{t(this,"UnexpectedToken")}constructor(s){super(`Unexpected token ${s.type} found.`,s.loc.start)}},Vce=class extends KP{static{t(this,"UnexpectedEOF")}constructor(s){super("Unexpected end of input found.",s)}},VZt=/[\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]/,WZt=/[\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]/,HZt=13,lot=10,x6e=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===HZt?(this.#s=!0,this.peek()===lot&&this.#t++):s===lot&&(this.#s=!0),this.#p=s,s}peek(){return this.#t===this.#r.length-1?-1:this.#r.charCodeAt(this.#t+1)}match(s){return s(this.peek())?(this.next(),!0):!1}current(){return this.#p}},GZt="Infinity",KZt="NaN",YZt=new Set([116,102,110]),E6e=new Set([32,9,10,13]),uot=new Set([...E6e,11,12,160,8232,8233,65279,160,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288]),XZt={mode:"json",ranges:!1},QZt=new Set(["true","false","null"]),T_={EOF:0,Number:1,String:2,Boolean:3,Null:4,NaN:5,Infinity:6,Identifier:7,Colon:20,LBrace:21,RBrace:22,LBracket:23,RBracket:24,Comma:25,LineComment:40,BlockComment:41};function GP(a){return a>=48&&a<=57}t(GP,"isDigit");function y6e(a){return GP(a)||a>=65&&a<=70||a>=97&&a<=102}t(y6e,"isHexDigit");function ZZt(a){return a>=49&&a<=57}t(ZZt,"isPositiveDigit");function eer(a){return YZt.has(a)}t(eer,"isKeywordStart");function _ot(a){return GP(a)||a===46||a===45}t(_ot,"isNumberStart");function ter(a){return _ot(a)||a===43}t(ter,"isJSON5NumberStart");function fot(a,s){return a===34||s&&a===39}t(fot,"isStringStart");function pot(a){if(a===36||a===95||a===92||a>=97&&a<=122||a>=65&&a<=90||a===8204||a===8205)return!0;let s=String.fromCharCode(a);return VZt.test(s)}t(pot,"isJSON5IdentifierStart");function rer(a){if(pot(a)||GP(a))return!0;let s=String.fromCharCode(a);return WZt.test(s)}t(rer,"isJSON5IdentifierPart");var C6e=class{static{t(this,"Tokenizer")}#r;#n;#e;#t;#s;#p;#a;#_;#c;#l;#i;constructor(s,l){this.#n=s,this.#r={...XZt,...l},this.#e=new x6e(s),this.#t=this.#r.mode==="json5",this.#s=this.#r.mode!=="json",this.#p=this.#r.ranges,this.#_=this.#t?qce.has.bind(qce):IH.has.bind(IH),this.#c=this.#t?b6e.has.bind(b6e):()=>!1,this.#l=this.#t?_=>_===120:()=>!1,this.#i=this.#t?uot.has.bind(uot):E6e.has.bind(E6e)}#f(s,l=this.#e.locate()){throw new S6e(s,l)}#v(s,l=this.#e.locate()){throw new T6e(s,l)}#d(){throw new Vce(this.#e.locate())}#u(s,l,_,m){let b=_.offset+l,D=this.#r.ranges?{range:[_.offset,b]}:void 0;return{type:s,loc:{start:_,end:m||{line:_.line,column:_.column+l,offset:b}},...D}}#m(s){let l="",_;for(let m=0;m<s;m++){if(_=this.#e.peek(),y6e(_)){this.#e.next(),l+=String.fromCharCode(_);continue}this.#f(_)}return l}#g(s){let l="";do{if(l+=String.fromCharCode(s),s===92&&(s=this.#e.next(),s!==117&&this.#f(s),l+=String.fromCharCode(s),l+=this.#m(4)),s=this.#e.peek(),!rer(s))break;this.#e.next()}while(!0);return l}#C(s){let l=s,_=1;for(s=this.#e.peek();s!==-1&&s!==l;){if(this.#e.next(),_++,s===92)if(s=this.#e.peek(),this.#_(s)||this.#c(s))this.#e.next(),_++;else if(s===117){this.#e.next(),_++;let m=this.#m(4);_+=m.length}else if(this.#l(s)){this.#e.next(),_++;let m=this.#m(2);_+=m.length}else this.#t?(this.#e.next(),_++):this.#f(s);s=this.#e.peek()}return s===-1&&(this.#e.next(),this.#d()),this.#e.next(),_++,_}#x(s){let l=1;if(s===45||this.#t&&s===43){if(s=this.#e.peek(),this.#t&&(s===73||s===78)){this.#e.next();let _=this.#g(s);return _!==GZt&&_!==KZt&&this.#f(s),l+_.length}GP(s)||this.#f(s),this.#e.next(),l++}if(s===48)if(s=this.#e.peek(),this.#t&&(s===120||s===88)){this.#e.next(),l++,s=this.#e.peek(),y6e(s)||(this.#e.next(),this.#f(s));do this.#e.next(),l++,s=this.#e.peek();while(y6e(s))}else GP(s)&&this.#f(s);else if(!this.#t||s!==46)for(ZZt(s)||this.#f(s),s=this.#e.peek();GP(s);)this.#e.next(),l++,s=this.#e.peek();if(s===46){let _=-1;for(this.#e.next(),l++,_++,s=this.#e.peek();GP(s);)this.#e.next(),l++,_++,s=this.#e.peek();!this.#t&&_===0&&(this.#e.next(),s?this.#f(s):this.#d())}if(s===101||s===69)for(this.#e.next(),l++,s=this.#e.peek(),(s===43||s===45)&&(this.#e.next(),l++,s=this.#e.peek()),s===-1&&(this.#e.next(),this.#d()),GP(s)||(this.#e.next(),this.#f(s));GP(s);)this.#e.next(),l++,s=this.#e.peek();return l}#b(s){let l=1;if(s=this.#e.peek(),s===47){do this.#e.next(),l+=1,s=this.#e.peek();while(s>-1&&s!==13&&s!==10);return{length:l,multiline:!1}}if(s===42){for(this.#e.next(),l+=1;s>-1;)if(s=this.#e.peek(),s===42){if(this.#e.next(),l+=1,s=this.#e.peek(),s===47)return this.#e.next(),l+=1,{length:l,multiline:!0}}else this.#e.next(),l+=1;this.#e.next(),this.#d()}this.#e.next(),this.#f(s)}next(){let s=this.#e.next();for(;this.#i(s);)s=this.#e.next();if(s===-1)return T_.EOF;let l=this.#e.locate(),_=String.fromCharCode(s);if(this.#t)if(Jce.has(_))this.#a=this.#u(Jce.get(_),1,l);else if(pot(s)){let m=this.#g(s);Jce.has(m)?this.#a=this.#u(Jce.get(m),m.length,l):this.#a=this.#u("Identifier",m.length,l)}else if(ter(s)){let m=this.#x(s);this.#a=this.#u("Number",m,l)}else if(fot(s,this.#t)){let m=this.#C(s),b=this.#e.locate();this.#a=this.#u("String",m,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else if(s===47&&this.#s){let m=this.#b(s),b=this.#e.locate();this.#a=this.#u(m.multiline?"BlockComment":"LineComment",m.length,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else this.#f(s);else if(zce.has(_))this.#a=this.#u(zce.get(_),1,l);else if(eer(s)){let m=this.#g(s);QZt.has(m)||this.#v(m,l),this.#a=this.#u(zce.get(m),m.length,l)}else if(_ot(s)){let m=this.#x(s);this.#a=this.#u("Number",m,l)}else if(fot(s,this.#t)){let m=this.#C(s);this.#a=this.#u("String",m,l)}else if(s===47&&this.#s){let m=this.#b(s),b=this.#e.locate();this.#a=this.#u(m.multiline?"BlockComment":"LineComment",m.length,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else this.#f(s);return T_[this.#a.type]}get token(){return this.#a}};var ST={document(a,s={}){return{type:"Document",body:a,loc:s.loc,...s}},string(a,s={}){return{type:"String",value:a,loc:s.loc,...s}},number(a,s={}){return{type:"Number",value:a,loc:s.loc,...s}},boolean(a,s={}){return{type:"Boolean",value:a,loc:s.loc,...s}},null(a={}){return{type:"Null",loc:a.loc,...a}},array(a,s={}){return{type:"Array",elements:a,loc:s.loc,...s}},element(a,s={}){return{type:"Element",value:a,loc:s.loc,...s}},object(a,s={}){return{type:"Object",members:a,loc:s.loc,...s}},member(a,s,l={}){return{type:"Member",name:a,value:s,loc:l.loc,...l}},identifier(a,s={}){return{type:"Identifier",name:a,loc:s.loc,...s}},nan(a="",s={}){return{type:"NaN",sign:a,loc:s.loc,...s}},infinity(a="",s={}){return{type:"Infinity",sign:a,loc:s.loc,...s}}},ner={mode:"json",ranges:!1,tokens:!1,allowTrailingCommas:!1};function ier(a,s,l=!1){let _="",m=a.indexOf("\\"),b=0;for(;m>=0;){_+=a.slice(b,m);let D=a.charAt(m+1),A=D.charCodeAt(0);if(l&&qce.has(A))_+=qce.get(A),b=m+2;else if(IH.has(A))_+=IH.get(A),b=m+2;else if(D==="u"){let M=a.slice(m+2,m+6);if(M.length<4||/[^0-9a-f]/i.test(M))throw new KP(`Invalid unicode escape \\u${M}.`,{line:s.loc.start.line,column:s.loc.start.column+m,offset:s.loc.start.offset+m});_+=String.fromCharCode(parseInt(M,16)),b=m+6}else if(l&&D==="x"){let M=a.slice(m+2,m+4);if(M.length<2||/[^0-9a-f]/i.test(M))throw new KP(`Invalid hex escape \\x${M}.`,{line:s.loc.start.line,column:s.loc.start.column+m,offset:s.loc.start.offset+m});_+=String.fromCharCode(parseInt(M,16)),b=m+4}else if(l&&b6e.has(A))b=m+2,D==="\r"&&a.charAt(b)===`
560
- `&&b++;else if(l)_+=D,b=m+2;else throw new KP(`Invalid escape \\${D}.`,{line:s.loc.start.line,column:s.loc.start.column+m,offset:s.loc.start.offset+m});m=a.indexOf("\\",b)}return _+=a.slice(b),_}t(ier,"getStringValue");function ser(a,s,l=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return ier(a.slice(1,-1),s,l);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(ser,"getLiteralValue");function dot(a,s){s=Object.freeze({...ner,...s});let l=[],_=new C6e(a,{mode:s.mode,ranges:s.ranges}),m=s.mode==="json5",b=s.allowTrailingCommas||m;function D(){let br=_.next();return br&&s.tokens&&l.push(_.token),br}t(D,"nextNoComments");function A(){let br=_.next();return br&&s.tokens&&l.push(_.token),br>=T_.LineComment?A():br}t(A,"nextSkipComments");let M=s.mode==="json"?D:A;function U(br,mr){if(br!==mr)throw new TO(_.token)}t(U,"assertTokenType");function ie(br,mr){if(!mr.includes(br))throw new TO(_.token)}t(ie,"assertTokenTypes");function se(br,mr){return s.ranges?{range:[br.offset,mr.offset]}:void 0}t(se,"createRange");function Z(br){let mr=_.token,Is=se(mr.loc.start,mr.loc.end),Pi=ser(a.slice(mr.loc.start.offset,mr.loc.end.offset),mr,m),Ti={loc:{start:{...mr.loc.start},end:{...mr.loc.end}},...Is};switch(br){case T_.String:return ST.string(Pi,Ti);case T_.Number:return ST.number(Pi,Ti);case T_.Boolean:return ST.boolean(Pi,Ti);default:throw new TypeError(`Unknown token type ${mr.type}.`)}}t(Z,"createLiteralNode");function Re(br){let mr=se(br.loc.start,br.loc.end),Is=a.slice(br.loc.start.offset,br.loc.end.offset),Po={loc:{start:{...br.loc.start},end:{...br.loc.end}},...mr};if(br.type!=="Identifier"){let Ti="";return(Is[0]==="+"||Is[0]==="-")&&(Ti=Is[0]),ST[Is.includes("NaN")?"nan":"infinity"](Ti,Po)}return ST.identifier(Is,Po)}t(Re,"createJSON5IdentifierNode");function Pe(br){let mr=se(br.loc.start,br.loc.end);return ST.null({loc:{start:{...br.loc.start},end:{...br.loc.end}},...mr})}t(Pe,"createNullNode");function ke(br){m?ie(br,[T_.String,T_.Identifier,T_.Number]):U(br,T_.String);let mr=_.token,Is=br===T_.String?Z(br):Re(mr);if(m&&(Is.type==="NaN"||Is.type==="Infinity")){if(Is.sign!=="")throw new TO(_.token);Is=ST.identifier(Is.type,{loc:Is.loc,...se(Is.loc.start,Is.loc.end)})}br=M(),U(br,T_.Colon);let Pi=yr(),Po=se(Is.loc.start,Pi.loc.end);return ST.member(Is,Pi,{loc:{start:{...Is.loc.start},end:{...Pi.loc.end}},...Po})}t(ke,"parseProperty");function wt(br){U(br,T_.LBrace);let mr=_.token,Is=[],Pi=M();if(Pi!==T_.RBrace)do{if(Is.push(ke(Pi)),Pi=M(),!Pi)throw new Vce(Is[Is.length-1].loc.end);if(Pi===T_.Comma){if(Pi=M(),b&&Pi===T_.RBrace)break}else break}while(Pi);U(Pi,T_.RBrace);let Po=_.token,Ti=se(mr.loc.start,Po.loc.end);return ST.object(Is,{loc:{start:{...mr.loc.start},end:{...Po.loc.end}},...Ti})}t(wt,"parseObject");function At(br){U(br,T_.LBracket);let mr=_.token,Is=[],Pi=M();if(Pi!==T_.RBracket)do{let _p=yr(Pi);if(Is.push(ST.element(_p,{loc:_p.loc})),Pi=M(),Pi===T_.Comma){if(Pi=M(),b&&Pi===T_.RBracket)break}else break}while(Pi);U(Pi,T_.RBracket);let Po=_.token,Ti=se(mr.loc.start,Po.loc.end);return ST.array(Is,{loc:{start:{...mr.loc.start},end:{...Po.loc.end}},...Ti})}t(At,"parseArray");function yr(br){br=br??M();let mr=_.token;switch(br){case T_.String:case T_.Boolean:return Z(br);case T_.Number:if(m){let Is=a.slice(mr.loc.start.offset,mr.loc.end.offset);if((Is[0]==="+"||Is[0]==="-")&&(Is=Is.slice(1)),Is==="NaN"||Is==="Infinity")return Re(mr)}return Z(br);case T_.Null:return Pe(mr);case T_.LBrace:return wt(br);case T_.LBracket:return At(br);default:throw new TO(mr)}}t(yr,"parseValue");let zr=yr();if(M())throw new TO(_.token);let hn={loc:{start:{line:1,column:1,offset:0},end:{...zr.loc.end}}};return s.tokens&&(hn.tokens=l),s.ranges&&(hn.range=[hn.loc.start.offset,hn.loc.end.offset]),ST.document(zr,hn)}t(dot,"parse");var aer=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function mot(a){return a&&typeof a=="object"}t(mot,"isObject");function oer(a){return mot(a)&&typeof a.type=="string"}t(oer,"isNode");function cer(a,s){function l(_,m){typeof s.enter=="function"&&s.enter(_,m);for(let b of aer.get(_.type)){let D=_[b];mot(D)&&(Array.isArray(D)?D.forEach(A=>l(A,_)):oer(D)&&l(D,_))}typeof s.exit=="function"&&s.exit(_,m)}t(l,"visitNode"),l(a)}t(cer,"traverse");function hot(a,s=()=>!0){let l=[];return cer(a,{enter(_,m){l.push({node:_,parent:m,phase:"enter"})},exit(_,m){l.push({node:_,parent:m,phase:"exit"})}}),l.filter(s).values()}t(hot,"iterator");import ler from"fs/promises";var OH=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),Wce=t(async a=>{try{return await ler.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),FH=t(async a=>{try{return dot(a)}catch(s){if(s.column&&s.line&&s.message){let l=OH(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:l}}return}},"getSchemaAST");var got=t(async(a,s,l)=>{try{if(a.length===0)return;for(let _ of a){let m=await Wce(_),b=await uer(m,_,s,l);if(b)return b}}catch{}},"getRouteLocationByValue"),uer=t(async(a,s,l,_)=>{try{if(!a)return;let m=null,b=await FH(a);if(b){for(let{node:D}of hot(b))if(D.value&&D.value===l){m=D.loc;break}if(m!==null){let D=OH(a,m.start.line);return{file:s,line:m.start.line,column:m.start.column,length:m.end.column-m.start.column,lineText:D,suggestion:_}}}}catch{}},"getRouteLocationByValueFromSchema");import yot from"fs/promises";import Hce from"path";var D6e="schemas",k6e=".oas.json";var xO=t(async a=>(await yot.readdir(a)).map(l=>`${a}/${l}`).filter(l=>l.endsWith(k6e)).sort(),"getOpenApiFilesByAlphabetical"),oM=t(async a=>{let s=Hce.resolve(a,"config");return(await yot.readdir(s)).filter(_=>_.endsWith(k6e)).length>=1},"oasFileInProject");function LH(a,s,l,_,m,b,D){if(b.has(l))return;let A;try{A=_.get(l)}catch(M){throw new M1({text:`Failed to resolve reference: ${l}`,detail:M.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:l,namespace:s,suggestion:"Check the reference and try again."}})}b.set(l,m.length),m.push(l),w6e(P6e(l),s,A,_,m,b,D)}t(LH,"chaseRefs");function w6e(a,s,l,_,m,b,D){if(Array.isArray(l))for(let A of l)w6e(a,s,A,_,m,b,D);else if(typeof l=="object")for(let A in l){if(A==="$ref"){let M=l[A];D&&(l[A]=D(s,M)),LH(a,s,r3(a,M),_,m,b,D)}w6e(a,s,l[A],_,m,b,D)}}t(w6e,"lookForRefs");function r3(a,s){let l=s.indexOf("#");return l>=0?`${Hce.resolve(a,s.substring(0,l))}${s.substring(l)}`:Hce.resolve(Hce.dirname(a),s)}t(r3,"getFullyQualifiedRefName");function P6e(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(P6e,"getFilePathNameFromRefName");var A6e=class{static{t(this,"Environment")}get WORKING_COPY_ENVIRONMENT(){return process.env.WORKING_COPY_ENVIRONMENT??"staging"}get ZUP_HOSTNAME(){return process.env.ZUP_HOSTNAME??"zuplo.app"}get ZUP_WORKING_COPY_HOSTNAME(){return process.env.ZUP_WORKING_COPY_HOSTNAME??this.WORKING_COPY_ENVIRONMENT==="staging"?"d1.zuplo.dev":"d2.zuplo.dev"}},fer=new A6e,N6e=fer;var QH=up(W4e(),1);var H4e={};dst(H4e,{UnsafePathError:()=>ble,deleteFile:()=>Yir,deleteFolder:()=>ssr,dirExists:()=>Sle,ensureDirectoryExists:()=>esr,fileExists:()=>Kir,getParentDirFilename:()=>rsr,isNotFileOrDirectory:()=>Xir,listFolderContents:()=>Wlt,listFolders:()=>Zir,mkdirForFilePathIfNotExits:()=>Glt,mkdirIfNotExists:()=>Hlt,safePath:()=>tsr,tarFolderContent:()=>nsr,untar:()=>isr});import qlt from"child_process";import u3 from"fs/promises";import l3 from"path";var Vlt=[".git","node_modules",".yarn",".DS_Store"];async function Kir(a){try{return(await u3.stat(a)).isFile()}catch{return!1}}t(Kir,"fileExists");async function Yir(a,s){return await u3.rm(a,s)}t(Yir,"deleteFile");async function Sle(a){try{return(await u3.stat(a)).isDirectory()}catch{return!1}}t(Sle,"dirExists");async function Xir(a){try{return await u3.stat(a),!1}catch{return!0}}t(Xir,"isNotFileOrDirectory");function Qir(a,s){let l=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),_=a.match(l);if(!_)return"";let m=a.split(_[0]);return m[1]===""?"":`/${m[1]}`}t(Qir,"getParentDirectory");async function Zir(a){if(!await Sle(a))return[];let s=await u3.readdir(a,{withFileTypes:!0}),l=[];for await(let _ of s)Vlt.includes(_.name)||_.isDirectory()&&l.push(_.name);return l}t(Zir,"listFolders");async function Wlt(a,s,l=!0){let _=Qir(a,s),m=await u3.readdir(a,{withFileTypes:!0}),b=[];for await(let D of m)if(!Vlt.includes(D.name)||!l)if(D.isDirectory()){let A=await Wlt(l3.join(a,D.name),s,l);b.push(...A)}else b.push(l3.join(_,D.name));return b}t(Wlt,"listFolderContents");var Hlt=t(async a=>{if(await Sle(a))return!0;await u3.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),Glt=t(async a=>{let s=l3.dirname(a);return Hlt(s)},"mkdirForFilePathIfNotExits"),esr=Glt,ble=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function tsr(a){let s=t(l=>{if(!l.startsWith(a))throw new ble("Resolved path is not part of the project.");return l},"ensureSafePath");return{resolve:t((...l)=>s(l3.resolve(...l)),"resolve")}}t(tsr,"safePath");function rsr(a){return`${l3.basename(l3.dirname(a))}/${l3.basename(a)}`}t(rsr,"getParentDirFilename");function nsr(a,s,l,_){let m=l3.join(_,l);return qlt.execSync(`tar --exclude='.git/' --exclude='dist/' -czf ${m} ${s}`,{cwd:a}),m}t(nsr,"tarFolderContent");function isr(a,s,l,_=!1){qlt.execSync(`tar -xf ${s} ${_?"--strip-components=1 ":""}-C ${l}`,{cwd:a})}t(isr,"untar");async function ssr(a){if(await Sle(a))return await u3.rm(a,{recursive:!0})}t(ssr,"deleteFolder");var wl=H4e;var CT=up(W4e(),1);import{readFile as asr}from"fs/promises";var IO=class extends Error{static{t(this,"CustomResolveError")}},f3=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,l){this.sourceDirectory=s,this.logger=l}dereference(s,l){return QH.$RefParser.dereference(s,{resolve:{json:!0,file:Tle(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:l?.onDereference}})}bundle(s){return QH.$RefParser.bundle(s,{resolve:{file:Tle(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return QH.$RefParser.parse(s,{resolve:{file:Tle(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return QH.$RefParser.resolve(s,{resolve:{file:Tle(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function Tle(a,s){return{order:100,canRead(l){let _=lsr(l.url);if(!(_===void 0||_==="file"))return!1;let b;try{b=Klt(l.url)}catch(D){throw new IO(`Malformed URI: ${l.url}`,{cause:D})}try{wl.safePath(a).resolve(b)}catch(D){return s?.warn(D),!1}return!0},async read(l){let _;try{_=Klt(l.url)}catch(m){throw new IO(`Malformed URI: ${l.url}`,{cause:m})}try{return await asr(_)}catch(m){throw new IO(`Error opening file "${_}"`,{cause:m})}}}}t(Tle,"customResolver");var G4e=/^win/.test(globalThis.process?globalThis.process.platform:""),osr=/\//g,csr=/^(\w{2,}):\/\//i,K4e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function lsr(a){let s=csr.exec(a);if(s)return s[1].toLowerCase()}t(lsr,"getProtocol");function Klt(a,s){a=decodeURI(a);for(let _=0;_<K4e.length;_+=2)a=a.replace(K4e[_],K4e[_+1]);let l=a.substr(0,7).toLowerCase()==="file://";return l&&(a=a[7]==="/"?a.substr(8):a.substr(7),G4e&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(l=!1,a=G4e?a:"/"+a)),G4e&&!l&&(a=a.replace(osr,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(Klt,"toFileSystemPath");var Ylt="YOUR_KEY_HERE";async function Xlt(a){let l=await new f3(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),_=a.openApiDocPath.replace(a.sourceDirectory,"");return usr({...a,relativeOpenApiPath:_},l)}t(Xlt,"buildPublicOpenApiFile");async function usr(a,s){dsr({relativeOpenApiPath:a.relativeOpenApiPath},s);let l=s;return l=_sr(l),fsr(l,a),l=psr(l,a),Qlt(l,"x-zuplo"),l}t(usr,"buildRawOpenApiFile");function fsr(a,{customDomain:s,deploymentName:l,environmentType:_}){let m;s?m=s:_&&l&&(m=_===pce.WORKING_COPY?`${l}.${N6e.ZUP_WORKING_COPY_HOSTNAME}`:`${l}.${N6e.ZUP_HOSTNAME}`),m?a.servers=[{url:`https://${m}`}]:a.servers=void 0}t(fsr,"addServerHost");function _sr(a){if(!a.paths)return a;let{components:s}=a,l=s?{...s}:void 0,_=[];l&&l.parameters&&(_=Object.entries(l.parameters).reduce((b,[D,A])=>(HR in A&&dce(A[HR])&&(b.push(D),l.parameters&&delete l.parameters[D]),b),[]));let m=Object.entries(a.paths).reduce((b,[D,A])=>{if(!A)return b;let M={...A},U=["delete","get","head","patch","post","put","trace","options"];return U.forEach(ie=>{let se=A[ie];if(!se)return;if(dce(se[HR])){delete M[ie];return}let{parameters:Z}=se;if(!Z)return;let Re=Z.filter(Pe=>{if(HR in Pe&&dce(Pe[HR]))return!1;if("$ref"in Pe){let ke=Pe.$ref.split("/").pop();return ke?!_.includes(ke):!0}return!0});M[ie]={...se,parameters:Re}}),U.some(ie=>!!M[ie])&&(b[D]=M),b},{});return{...a,paths:m,components:l}}t(_sr,"removeHiddenRoutesAndParams");function psr(a,{policiesConfig:s}){if(!a.paths)return a;let l=Object.entries(a.paths).reduce((_,[m,b])=>{if(!b)return _;let D={...b};return[D.delete,D.get,D.head,D.patch,D.post,D.put,D.trace,D.options].forEach(A=>{if(!A)return;let M=A["x-zuplo-route"]?.policies?.inbound?.reduce((se,Z)=>{let Re=s.policies?.find(({name:wt})=>wt===Z);if(!Re)return se;if(!(Re.handler.export==="CompositeInboundPolicy"))return se.concat(Z);let ke=Re.handler.options?.policies;return ke?se.concat(ke):se},[]),U=[];if(M&&M.forEach(se=>{s.policies?.forEach(Z=>{Z.name===se&&(Z.handler.export==="ApiAuthKeyInboundPolicy"||Z.handler.export==="ApiKeyInboundPolicy")&&!Z.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&U.push(Z)})}),U.length>0){let se=U.length>0&&U[0].handler&&U[0].handler.options&&U[0].handler.options.authHeader?U[0].handler.options.authHeader:"Authorization",Z=U.length>0&&U[0].handler&&U[0].handler.options&&(U[0].handler.options.authScheme||U[0].handler.options.authScheme==="")?U[0].handler.options.authScheme:"Bearer",Re=Z!==""?`${Z} ${Ylt}`:Ylt,Pe={name:se,in:"header",required:!0,example:Re,schema:{type:"string"},description:`The \`${se}\` header is used to authenticate with the API using your API key. Value is of the format \`${Re}\`.`};A.parameters?A.parameters.some(yr=>"name"in yr&&yr.name===Pe.name)||A.parameters.unshift(Pe):A.parameters=[Pe];let ke={type:"http",scheme:Z.toLowerCase()},wt="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(yr=>"name"in yr&&yr.type==="apiKey"||"type"in yr&&yr.type==="http"&&yr.scheme===Z)||(a.components.securitySchemes={...a.components.securitySchemes,[wt]:ke}):(a.components||(a.components={}),a.components.securitySchemes={[wt]:ke});let At={[wt]:[]};A.security?A.security.some(yr=>yr[wt]!==void 0)||A.security.unshift(At):A.security=[At]}let ie=[];if(M&&M.forEach(se=>{s.policies?.forEach(Z=>{Z.name===se&&(Z.handler.export==="RateLimitInboundPolicy"||Z.handler.export==="ComplexRateLimitInboundPolicy")&&ie.push(Z)})}),ie.length>0){let se={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},Z={...se,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:se,RateLimitWithRetryAfter:Z},A.responses||(A.responses={});let Re=ie.some(Pe=>Pe.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Re?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),_[m]=D,_},{});return{...a,paths:l}}t(psr,"enrichSpecWithZuploData");function Qlt(a,s){for(let l in a)l.startsWith(s)?delete a[l]:typeof a[l]=="object"&&Qlt(a[l],s)}t(Qlt,"removePropertiesByPrefix");function dsr({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new M1({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new M1({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 M1({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(dsr,"assertIsZuploOpenApiSpec");function msr(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let U=0;U<s.length;U++)s[U]=255;for(let U=0;U<a.length;U++){let ie=a.charAt(U),se=ie.charCodeAt(0);if(s[se]!==255)throw new TypeError(ie+" is ambiguous");s[se]=U}let l=a.length,_=a.charAt(0),m=Math.log(l)/Math.log(256),b=Math.log(256)/Math.log(l);function D(U){if(U instanceof Uint8Array||(ArrayBuffer.isView(U)?U=new Uint8Array(U.buffer,U.byteOffset,U.byteLength):Array.isArray(U)&&(U=Uint8Array.from(U))),!(U instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(U.length===0)return"";let ie=0,se=0,Z=0,Re=U.length;for(;Z!==Re&&U[Z]===0;)Z++,ie++;let Pe=(Re-Z)*b+1>>>0,ke=new Uint8Array(Pe);for(;Z!==Re;){let yr=U[Z],zr=0;for(let en=Pe-1;(yr!==0||zr<se)&&en!==-1;en--,zr++)yr+=256*ke[en]>>>0,ke[en]=yr%l>>>0,yr=yr/l>>>0;if(yr!==0)throw new Error("Non-zero carry");se=zr,Z++}let wt=Pe-se;for(;wt!==Pe&&ke[wt]===0;)wt++;let At=_.repeat(ie);for(;wt<Pe;++wt)At+=a.charAt(ke[wt]);return At}t(D,"encode");function A(U){if(typeof U!="string")throw new TypeError("Expected String");if(U.length===0)return new Uint8Array;let ie=0,se=0,Z=0;for(;U[ie]===_;)se++,ie++;let Re=(U.length-ie)*m+1>>>0,Pe=new Uint8Array(Re);for(;U[ie];){let yr=s[U.charCodeAt(ie)];if(yr===255)return;let zr=0;for(let en=Re-1;(yr!==0||zr<Z)&&en!==-1;en--,zr++)yr+=l*Pe[en]>>>0,Pe[en]=yr%256>>>0,yr=yr/256>>>0;if(yr!==0)throw new Error("Non-zero carry");Z=zr,ie++}let ke=Re-Z;for(;ke!==Re&&Pe[ke]===0;)ke++;let wt=new Uint8Array(se+(Re-ke)),At=se;for(;ke!==Re;)wt[At++]=Pe[ke++];return wt}t(A,"decodeUnsafe");function M(U){let ie=A(U);if(ie)return ie;throw new Error("Non-base"+l+" character")}return t(M,"decode"),{encode:D,decodeUnsafe:A,decode:M}}t(msr,"base");var Zlt=msr;var hsr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",xle=Zlt(hsr);var Y4e="2024-09-02",eut=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function tut(){return new DT({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:Y4e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:eut[Y4e]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(tut,"getMockEnvironment");var DT=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=tut()),this.#r}constructor({build:s,runtime:l}){let _;try{if(l.__ZUPLO_CONFIG){let m=atob(l.__ZUPLO_CONFIG);_=JSON.parse(m)}if(l.ZUPLO_SYSTEM_CONFIGURATIONS){let m=new TextDecoder().decode(xle.decode(l.ZUPLO_SYSTEM_CONFIGURATIONS)),b=JSON.parse(m);for(let D of Object.keys(b))l[D]=b[D]}}catch(m){console.error("Failed to parse runtime configuration",m)}this.config=_??{},this.build=s,this.runtime=l,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get 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 gsr=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function rut(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!gsr.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(rut,"isRestrictedEnvVariableName");function nut(a){return!!a.startsWith("ZUPLO_")}t(nut,"isZuploReadableEnvVariableName");var AIr=new Proxy({},{get(a,s){let l=String(s);switch(l){case"ZUPLO_ENVIRONMENT_TYPE":return DT.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return DT.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return DT.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return DT.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return DT.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return DT.instance.build.BUILD_ID}if(!(rut(l)&&!nut(l)))return DT.instance.runtime[l]}});function ZH(a,s,l){return`_${eA(`${a}_${s}_${l}`)}`}t(ZH,"getRawOperationDataIdentifierName");function X4e(a,s,l,_){return`_${eA(a.toLowerCase())}_${s.toLowerCase()}_${l.toLowerCase()}_${_.toLowerCase()}`}t(X4e,"getIdForParameterSchema");function Q4e(a,s,l){return`_${eA(a.toLowerCase())}_${s.toLowerCase()}_rb_${eA(l.toLowerCase())}`}t(Q4e,"getIdForRequestBodySchema");function eG(a,s){return`_${eA(a)}_${eA(s)}`}t(eG,"getIdForRefSchema");function eA(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(eA,"sanitizedIdentifierName");var Lmt=up(Hft(),1);import Kue from"path";var hG=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,l,_,m,b){this.type=a,this.name=s,this.prefix=l,this.value=_,this.suffix=m,this.modifier=b}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},fcr=/[$_\p{ID_Start}]/u,_cr=/[$_\u200C\u200D\p{ID_Continue}]/u,W3e=".*";function pcr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(pcr,"Re");function Yft(a,s=!1){let l=[],_=0;for(;_<a.length;){let m=a[_],b=t(function(D){if(!s)throw new TypeError(D);l.push({type:"INVALID_CHAR",index:_,value:a[_++]})},"c");if(m==="*"){l.push({type:"ASTERISK",index:_,value:a[_++]});continue}if(m==="+"||m==="?"){l.push({type:"OTHER_MODIFIER",index:_,value:a[_++]});continue}if(m==="\\"){l.push({type:"ESCAPED_CHAR",index:_++,value:a[_++]});continue}if(m==="{"){l.push({type:"OPEN",index:_,value:a[_++]});continue}if(m==="}"){l.push({type:"CLOSE",index:_,value:a[_++]});continue}if(m===":"){let D="",A=_+1;for(;A<a.length;){let M=a.substr(A,1);if(A===_+1&&fcr.test(M)||A!==_+1&&_cr.test(M)){D+=a[A++];continue}break}if(!D){b(`Missing parameter name at ${_}`);continue}l.push({type:"NAME",index:_,value:D}),_=A;continue}if(m==="("){let D=1,A="",M=_+1,U=!1;if(a[M]==="?"){b(`Pattern cannot start with "?" at ${M}`);continue}for(;M<a.length;){if(!pcr(a[M],!1)){b(`Invalid character '${a[M]}' at ${M}.`),U=!0;break}if(a[M]==="\\"){A+=a[M++]+a[M++];continue}if(a[M]===")"){if(D--,D===0){M++;break}}else if(a[M]==="("&&(D++,a[M+1]!=="?")){b(`Capturing groups are not allowed at ${M}`),U=!0;break}A+=a[M++]}if(U)continue;if(D){b(`Unbalanced pattern at ${_}`);continue}if(!A){b(`Missing pattern at ${_}`);continue}l.push({type:"REGEX",index:_,value:A}),_=M;continue}l.push({type:"CHAR",index:_,value:a[_++]})}return l.push({type:"END",index:_,value:""}),l}t(Yft,"v");function Xft(a,s={}){let l=Yft(a);s.delimiter??="/#?",s.prefixes??="./";let _=`[^${AT(s.delimiter)}]+?`,m=[],b=0,D=0,A="",M=new Set,U=t(zr=>{if(D<l.length&&l[D].type===zr)return l[D++].value},"a"),ie=t(()=>U("OTHER_MODIFIER")??U("ASTERISK"),"f"),se=t(zr=>{let en=U(zr);if(en!==void 0)return en;let{type:hn,index:br}=l[D];throw new TypeError(`Unexpected ${hn} at ${br}, expected ${zr}`)},"d"),Z=t(()=>{let zr="",en;for(;en=U("CHAR")??U("ESCAPED_CHAR");)zr+=en;return zr},"T"),Re=t(zr=>zr,"Se"),Pe=s.encodePart||Re,ke="",wt=t(zr=>{ke+=zr},"U"),At=t(()=>{ke.length&&(m.push(new hG(3,"","",Pe(ke),"",3)),ke="")},"$"),yr=t((zr,en,hn,br,mr)=>{let Is=3;switch(mr){case"?":Is=1;break;case"*":Is=0;break;case"+":Is=2;break}if(!en&&!hn&&Is===3){wt(zr);return}if(At(),!en&&!hn){if(!zr)return;m.push(new hG(3,"","",Pe(zr),"",Is));return}let Pi;hn?hn==="*"?Pi=W3e:Pi=hn:Pi=_;let Po=2;Pi===_?(Po=1,Pi=""):Pi===W3e&&(Po=0,Pi="");let Ti;if(en?Ti=en:hn&&(Ti=b++),M.has(Ti))throw new TypeError(`Duplicate name '${Ti}'.`);M.add(Ti),m.push(new hG(Po,Ti,Pe(zr),Pi,Pe(br),Is))},"V");for(;D<l.length;){let zr=U("CHAR"),en=U("NAME"),hn=U("REGEX");if(!en&&!hn&&(hn=U("ASTERISK")),en||hn){let mr=zr??"";s.prefixes.indexOf(mr)===-1&&(wt(mr),mr=""),At();let Is=ie();yr(mr,en,hn,"",Is);continue}let br=zr??U("ESCAPED_CHAR");if(br){wt(br);continue}if(U("OPEN")){let mr=Z(),Is=U("NAME"),Pi=U("REGEX");!Is&&!Pi&&(Pi=U("ASTERISK"));let Po=Z();se("CLOSE");let Ti=ie();yr(mr,Is,Pi,Po,Ti);continue}At(),se("END")}return m}t(Xft,"D");function AT(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(AT,"S");function Gft(a){return a&&a.ignoreCase?"ui":"u"}t(Gft,"X");function dcr(a,s,l){return Qft(Xft(a,l),s,l)}t(dcr,"Z");function NM(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(NM,"k");function Qft(a,s,l={}){l.delimiter??="/#?",l.prefixes??="./",l.sensitive??=!1,l.strict??=!1,l.end??=!0,l.start??=!0,l.endsWith="";let _=l.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?_+=AT(A.value):_+=`(?:${AT(A.value)})${NM(A.modifier)}`;continue}s&&s.push(A.name);let M=`[^${AT(l.delimiter)}]+?`,U=A.value;if(A.type===1?U=M:A.type===0&&(U=W3e),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?_+=`(${U})${NM(A.modifier)}`:_+=`((?:${U})${NM(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){_+=`(?:${AT(A.prefix)}(${U})${AT(A.suffix)})`,_+=NM(A.modifier);continue}_+=`(?:${AT(A.prefix)}`,_+=`((?:${U})(?:`,_+=AT(A.suffix),_+=AT(A.prefix),_+=`(?:${U}))*)${AT(A.suffix)})`,A.modifier===0&&(_+="?")}let m=`[${AT(l.endsWith)}]|$`,b=`[${AT(l.delimiter)}]`;if(l.end)return l.strict||(_+=`${b}?`),l.endsWith.length?_+=`(?=${m})`:_+="$",new RegExp(_,Gft(l));l.strict||(_+=`(?:${b}(?=${m}))?`);let D=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(D=l.delimiter.indexOf(A)>-1)}return D||(_+=`(?=${b}|${m})`),new RegExp(_,Gft(l))}t(Qft,"F");var m3={delimiter:"",prefixes:"",sensitive:!0,strict:!0},mcr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},hcr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function gcr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(gcr,"J");function Zft(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(Zft,"Q");function ycr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(ycr,"Ee");function e_t(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(e_t,"W");var t_t=["ftp","file","http","https","ws","wss"];function r_t(a){if(!a)return!0;for(let s of t_t)if(a.test(s))return!0;return!1}t(r_t,"N");function vcr(a,s){if(a=Zft(a,"#"),s||a==="")return a;let l=new URL("https://example.com");return l.hash=a,l.hash?l.hash.substring(1,l.hash.length):""}t(vcr,"te");function bcr(a,s){if(a=Zft(a,"?"),s||a==="")return a;let l=new URL("https://example.com");return l.search=a,l.search?l.search.substring(1,l.search.length):""}t(bcr,"re");function Scr(a,s){return s||a===""?a:e_t(a)?s_t(a):i_t(a)}t(Scr,"ne");function Tcr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.password=a,l.password}t(Tcr,"se");function xcr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.username=a,l.username}t(xcr,"ie");function Ecr(a,s,l){if(l||a==="")return a;if(s&&!t_t.includes(s))return new URL(`${s}:${a}`).pathname;let _=a[0]=="/";return a=new URL(_?a:"/-"+a,"https://example.com").pathname,_||(a=a.substring(2,a.length)),a}t(Ecr,"ae");function Ccr(a,s,l){return n_t(s)===a&&(a=""),l||a===""?a:a_t(a)}t(Ccr,"oe");function Dcr(a,s){return a=ycr(a,":"),s||a===""?a:H3e(a)}t(Dcr,"ce");function n_t(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(n_t,"_");function H3e(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(H3e,"y");function kcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(kcr,"le");function wcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(wcr,"fe");function i_t(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(i_t,"z");function s_t(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(s_t,"j");function a_t(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(a_t,"K");function Pcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(Pcr,"he");function Acr(a){return a===""?a:new URL(`data:${a}`).pathname}t(Acr,"ue");function Ncr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(Ncr,"de");function Icr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(Icr,"pe");var Ocr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=Yft(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#w()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#C()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#x()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#x()&&this.#i(5,1);break;case 4:this.#x()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#k()&&!this.#c?this.#i(6,1):this.#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 l=this.#u(a);return l.value===s&&(l.type==="CHAR"||l.type==="ESCAPED_CHAR"||l.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#C(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#x(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#k(){return this.#m(this.#t,":")}#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,"#")}#w(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,m3),a.encodePart=H3e;let s=dcr(this.#T(),void 0,a);this.#l=r_t(s)}},V3e=["protocol","username","password","hostname","port","pathname","search","hash"],d3="*";function Kft(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let l=new URL(a,s);return{protocol:l.protocol.substring(0,l.protocol.length-1),username:l.username,password:l.password,hostname:l.hostname,port:l.port,pathname:l.pathname,search:l.search!==""?l.search.substring(1,l.search.length):void 0,hash:l.hash!==""?l.hash.substring(1,l.hash.length):void 0}}t(Kft,"ge");function sA(a,s){return s?mG(a):a}t(sA,"b");function dG(a,s,l){let _;if(typeof s.baseURL=="string")try{_=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=sA(_.protocol.substring(0,_.protocol.length-1),l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=sA(_.username,l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=sA(_.password,l)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=sA(_.hostname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=sA(_.port,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=sA(_.pathname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=sA(_.search.substring(1,_.search.length),l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=sA(_.hash.substring(1,_.hash.length),l))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Dcr(s.protocol,l)),typeof s.username=="string"&&(a.username=xcr(s.username,l)),typeof s.password=="string"&&(a.password=Tcr(s.password,l)),typeof s.hostname=="string"&&(a.hostname=Scr(s.hostname,l)),typeof s.port=="string"&&(a.port=Ccr(s.port,a.protocol,l)),typeof s.pathname=="string"){if(a.pathname=s.pathname,_&&!gcr(a.pathname,l)){let m=_.pathname.lastIndexOf("/");m>=0&&(a.pathname=sA(_.pathname.substring(0,m+1),l)+a.pathname)}a.pathname=Ecr(a.pathname,a.protocol,l)}return typeof s.search=="string"&&(a.search=bcr(s.search,l)),typeof s.hash=="string"&&(a.hash=vcr(s.hash,l)),a}t(dG,"w");function mG(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(mG,"C");function Fcr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(Fcr,"Oe");function Lcr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let l=".*",_=`[^${Fcr(s.delimiter)}]+?`,m=/[$_\u200C\u200D\p{ID_Continue}]/u,b="";for(let D=0;D<a.length;++D){let A=a[D];if(A.type===3){if(A.modifier===3){b+=mG(A.value);continue}b+=`{${mG(A.value)}}${NM(A.modifier)}`;continue}let M=A.hasCustomName(),U=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),ie=D>0?a[D-1]:null,se=D<a.length-1?a[D+1]:null;if(!U&&M&&A.type===1&&A.modifier===3&&se&&!se.prefix.length&&!se.suffix.length)if(se.type===3){let Z=se.value.length>0?se.value[0]:"";U=m.test(Z)}else U=!se.hasCustomName();if(!U&&!A.prefix.length&&ie&&ie.type===3){let Z=ie.value[ie.value.length-1];U=s.prefixes.includes(Z)}U&&(b+="{"),b+=mG(A.prefix),M&&(b+=`:${A.name}`),A.type===2?b+=`(${A.value})`:A.type===1?M||(b+=`(${_})`):A.type===0&&(!M&&(!ie||ie.type===3||ie.modifier!==3||U||A.prefix!=="")?b+="*":b+=`(${l})`),A.type===1&&M&&A.suffix.length&&m.test(A.suffix[0])&&(b+="\\"),b+=mG(A.suffix),U&&(b+="}"),A.modifier!==3&&(b+=NM(A.modifier))}return b}t(Lcr,"ke");var o_t=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,l){try{let _;if(typeof s=="string"?_=s:l=s,typeof a=="string"){let A=new Ocr(a);if(A.parse(),a=A.result,_===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=_}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(_)throw new TypeError("parameter 1 is not of type 'string'.")}typeof l>"u"&&(l={ignoreCase:!1});let m={ignoreCase:l.ignoreCase===!0},b={pathname:d3,protocol:d3,username:d3,password:d3,hostname:d3,port:d3,search:d3,hash:d3};this.#r=dG(b,a,!0),n_t(this.#r.protocol)===this.#r.port&&(this.#r.port="");let D;for(D of V3e){if(!(D in this.#r))continue;let A={},M=this.#r[D];switch(this.#e[D]=[],D){case"protocol":Object.assign(A,m3),A.encodePart=H3e;break;case"username":Object.assign(A,m3),A.encodePart=kcr;break;case"password":Object.assign(A,m3),A.encodePart=wcr;break;case"hostname":Object.assign(A,mcr),e_t(M)?A.encodePart=s_t:A.encodePart=i_t;break;case"port":Object.assign(A,m3),A.encodePart=a_t;break;case"pathname":r_t(this.#n.protocol)?(Object.assign(A,hcr,m),A.encodePart=Pcr):(Object.assign(A,m3,m),A.encodePart=Acr);break;case"search":Object.assign(A,m3,m),A.encodePart=Ncr;break;case"hash":Object.assign(A,m3,m),A.encodePart=Icr;break}try{this.#s[D]=Xft(M,A),this.#n[D]=Qft(this.#s[D],this.#e[D],A),this.#t[D]=Lcr(this.#s[D],A),this.#p=this.#p||this.#s[D].some(U=>U.type===2)}catch{throw new TypeError(`invalid ${D} pattern '${this.#r[D]}'.`)}}}catch(_){throw new TypeError(`Failed to construct 'URLPattern': ${_.message}`)}}test(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?l=dG(l,a,!1):l=dG(l,Kft(a,s),!1)}catch{return!1}let _;for(_ of V3e)if(!this.#n[_].exec(l[_]))return!1;return!0}exec(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?l=dG(l,a,!1):l=dG(l,Kft(a,s),!1)}catch{return null}let _={};s?_.inputs=[a,s]:_.inputs=[a];let m;for(m of V3e){let b=this.#n[m].exec(l[m]);if(!b)return null;let D={};for(let[A,M]of this.#e[m].entries())if(typeof M=="string"||typeof M=="number"){let U=b[A+1];D[M]=U}_[m]={input:l[m]??"",groups:D}}return _}static compareComponent(a,s,l){let _=t((A,M)=>{for(let U of["type","modifier","prefix","value","suffix"]){if(A[U]<M[U])return-1;if(A[U]!==M[U])return 1}return 0},"o"),m=new hG(3,"","","","",3),b=new hG(0,"","","","",3),D=t((A,M)=>{let U=0;for(;U<Math.min(A.length,M.length);++U){let ie=_(A[U],M[U]);if(ie)return ie}return A.length===M.length?0:_(A[U]??m,M[U]??m)},"s");return!s.#t[a]&&!l.#t[a]?0:s.#t[a]&&!l.#t[a]?D(s.#s[a],[b]):!s.#t[a]&&l.#t[a]?D([b],l.#s[a]):D(s.#s[a],l.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=o_t);import{AssertionError as Rcr}from"assert";function aA(a,s){if(a===!1)throw new Rcr({message:s})}t(aA,"assert");var Ac;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Ac||(Ac={}));function IM(a){return a.type===Ac.Object}t(IM,"isAstObject");function oA(a){return a.type===Ac.Property}t(oA,"isAstProperty");function c_t(a){return a.type===Ac.Array}t(c_t,"isAstArray");function OM(a){return a.type===Ac.Literal}t(OM,"isAstLiteral");function BO(a){if(a===void 0)throw new Error("Node is undefined");if(!IM(a))throw new Error("Node is not object")}t(BO,"assertAstObject");import{findNodeAtLocation as Mcr,getNodeValue as jcr,printParseErrorCode as Bcr,visit as Ucr}from"jsonc-parser";var $cr={DEFAULT:{allowTrailingComma:!1}};function gG(a,s=[],l=$cr.DEFAULT){let _={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function m(M){_.type==="property"&&(_.length=M-_.offset,_=_.parent)}t(m,"ensurePropertyComplete");function b(M){return _.children?.push(M),M}t(b,"onValue"),Ucr(a,{onObjectBegin:t((M,U,ie)=>{_=b({type:"object",offset:M,length:-1,line:U+1,column:ie+1,parent:_,children:[]})},"onObjectBegin"),onObjectProperty:t((M,U,ie,se,Z)=>{_=b({type:"property",offset:U,length:-1,line:se+1,column:Z+1,parent:_,children:[]}),_.children?.push({type:"string",value:M,offset:U,length:ie,line:se,column:Z,parent:_})},"onObjectProperty"),onObjectEnd:t((M,U)=>{m(M+U),_.length=M+U-_.offset,_=_.parent,m(M+U)},"onObjectEnd"),onArrayBegin:t((M,U,ie,se)=>{_=b({type:"array",offset:M,length:-1,line:ie+1,column:se+1,parent:_,children:[]})},"onArrayBegin"),onArrayEnd:t((M,U)=>{_.length=M+U-_.offset,_=_.parent,m(M+U)},"onArrayEnd"),onLiteralValue:t((M,U,ie,se,Z)=>{b({type:Jcr(M),offset:U,length:ie,line:se+1,column:Z+1,parent:_,value:M}),m(U+ie)},"onLiteralValue"),onSeparator:t((M,U)=>{_.type==="property"&&(M===":"?_.colonOffset=U:M===","&&m(U))},"onSeparator"),onError:t((M,U,ie,se,Z)=>{s.push({error:M,offset:U,length:ie,line:se+1,column:Z+1})},"onError")},l);let A=_.children[0];return A&&delete A.parent,A}t(gG,"parse");function Jcr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(Jcr,"getNodeType");function G3e(a,s){return Mcr(a,s)}t(G3e,"findNodeAtLocation");function yG(a){return jcr(a)}t(yG,"getNodeValue");function l_t(a){return Bcr(a)}t(l_t,"printParseErrorCode");var vG=class{static{t(this,"AstAdapter")}parse(s){let _=gG(s,[]);if(_)return this.parseNode(_,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,l){switch(s.type){case"object":return this.createObject(s,l);case"array":return this.createArray(s,l);case"property":return this.createProperty(s,l);case"string":return this.createLiteral(s,l);case"number":return this.createLiteral(s,l);case"boolean":return this.createLiteral(s,l);case"null":return this.createLiteral(s,l)}}createLiteral(s,l){return{type:Ac.Literal,location:{line:s.line,column:s.column},parent:l,value:s.type==="null"?null:s.value}}createObject(s,l){let _={type:Ac.Object,children:[],parent:l,location:{line:s.line,column:s.column}};return s.children?.forEach(m=>{_.children.push(this.parseNode(m,_))}),_}createProperty(s,l){aA(s.children?.length===2,"Invalid property node");let _={type:Ac.Property,location:{line:s.line,column:s.column},parent:l,name:null,value:null};return _.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Ac.Identifier,parent:_},_.value=this.parseNode(s.children[1],_),_}createArray(s,l){let _={type:Ac.Array,location:{line:s.line,column:s.column},parent:l,children:[]};return s.children?.forEach(m=>_.children.push(this.parseNode(m,_))),_}};var UE={createLiteral:t((a,s)=>({type:Ac.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Ac.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Ac.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,l)=>{let _={type:Ac.Property,parent:l,name:null,value:s};return _.name={value:a,type:Ac.Identifier,parent:_},_.value.parent=_,_},"createProperty"),createArrayOfLiterals:t((a,s)=>{let l={type:Ac.Array,parent:s,children:[]};for(let _ of a)l.children.push(UE.createLiteral(_,l));return l},"createArrayOfLiterals")};var zcr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,bG=class{static{t(this,"SourceGenerator")}generate(s){let l=[];return this.generateSource(l,s),l.join("")}generateSource(s,l){switch(l.type){case Ac.Array:return this.generateArray(s,l);case Ac.Object:return this.generateObject(s,l);case Ac.Property:return this.generateProperty(s,l);case Ac.Literal:return this.generateLiteral(s,l);case Ac.FunctionCall:return this.generateFunctionCall(s,l);case Ac.Identifier:return this.generateIdentifier(s,l);case Ac.Raw:return this.generateRaw(s,l);case Ac.TemplateString:return this.generateTemplateString(s,l)}}generateArray(s,l){s.push("["),l.children.map(_=>{this.generateSource(s,_),s.push(",")}),s.push("]")}generateObject(s,l){s.push("{"),l.children.forEach(_=>{this.generateSource(s,_),s.push(",")}),s.push("}")}generateProperty(s,l){this.generateIdentifier(s,l.name),s.push(":"),this.generateSource(s,l.value)}generateFunctionCall(s,l){s.push(l.name.value),s.push("("),l.children.forEach((_,m,b)=>{this.generateSource(s,_),m<b.length&&s.push(",")}),s.push(")")}generateRaw(s,l){s.push(l.value)}generateTemplateString(s,l){s.push("`"),s.push(l.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,l){if(l.value===null)return s.push("null");switch(typeof l.value){case"number":case"boolean":return s.push(`${l.value}`);case"string":{let _=l.value,m=JSON.stringify(_);return s.push(`${m}`)}}}generateIdentifier(s,l){let _=zcr.test(l.value)?l.value:`'${l.value}'`;s.push(_)}};import{parse as qcr}from"@swc/core";import Vcr from"fs/promises";var u_t=t(async a=>{let s=new Set;try{let l=await Vcr.readFile(a,"utf-8");(await qcr(l,{syntax:"typescript"})).body.forEach(m=>{m.type==="ExportDefaultDeclaration"||m.type==="ExportDefaultExpression"?s.add("default"):m.type==="ExportDeclaration"&&m.declaration.type==="FunctionDeclaration"?s.add(m.declaration.identifier.value):m.type==="ExportDeclaration"&&m.declaration.type==="VariableDeclaration"&&m.declaration.declarations[0].id.type==="Identifier"&&s.add(m.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var f_t={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var K3e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var __t={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var Y3e={$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 X3e={$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 Cmt=up(Gdt(),1),Dmt=up(Emt(),1);var $ue=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new Dmt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,Cmt.default)(this.ajv,{mode:"fast"})}addSchema(s,l){this.ajv.addSchema(s,l)}compile(s){let l=this.ajv.compile(s);return t(m=>({isValid:l(m),errors:this.toSimpleErrors(l.errors,m),warnings:[]}),"validator")}toSimpleErrors(s,l){let _=[];return s?.forEach(m=>{m.keyword==="enum"&&m.params.allowedValues&&Array.isArray(m.params.allowedValues)&&(m.message+=`; ${m.params.allowedValues.join(", ")}`),m.instancePath&&(m.instancePath=m.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let b={details:{}},D=m.instancePath.split("/");if(D.length>2){let M=D[1],U=D[2]?parseInt(D[2]):0,ie=D[3],se=isNaN(U)?void 0:l[M][U][ie];b={details:{property:M,index:U,field:ie,fieldValue:se}}}if(m.keyword==="required"&&m.params.missingProperty&&m.instancePath&&(m.message=`A 'path' is missing required property '${m.params.missingProperty}'`),m.keyword==="additionalProperties"&&m.params.additionalProperty&&m.instancePath&&(m.message=`A 'path' should NOT include property '${m.params.additionalProperty}'`),m.keyword==="type"&&m.params.type&&m.instancePath){let M=m.instancePath.split("/"),U=M[M.length-1];m.message=`Value of property '${U}' must be '${m.params.type}'`}let A=Object.assign(m,b);_.push(A)}),_}};var C3=$ue.instance;C3.addSchema(X3e,"route-configuration.schema.json");C3.addSchema(__t,"policy-configuration.schema.json");C3.addSchema(K3e,"policies.schema.json");C3.addSchema(Y3e,"open-api-route-configuration.schema.json");C3.addSchema(f_t,"fragments.schema.json");var P5r=C3.compile(X3e),kmt=C3.compile(Y3e),_8e=C3.compile(K3e);var Jue=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=_8e(s),this.results}};var zue=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=kmt(s),this.results}};import Xmr from"path";var p8e=/\$import\((.*)\)/,que=/\$env\((.*?)\)/g;var _A=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,l,_,m){super(s),this.location={file:l,namespace:"",line:_?_.line:0,column:_?_.column:0,length:0,lineText:m??"",suggestion:""}}},Ymr=t(a=>{let s=[],l=a;for(;l.parent;)s.push(l),l=l.parent;return s.reverse()},"invertTree"),D3=t((a,s)=>{if(!a)return!1;let l=Ymr(a);return s.split("/").every((b,D)=>{let A=l[D];return A?b==="*"||oA(A)&&A.name.value===b?!0:b==="{}"?A.type===Ac.Object:b==="[]"?A.type===Ac.Array:!1:!1})},"testPosition");var Vue=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),IM(s)?s.children.forEach(l=>{this.visitor(l)}):c_t(s)?s.children.forEach(l=>{this.visitor(l)}):oA(s)&&this.visitor(s.value)}},wmt=t((a,s,l)=>_=>{if(!oA(_)||!OM(_.value)||typeof _.value.value!="string")return;if(!a.some(b=>D3(_,b))){que.test(_.value.value)&&s.push(new _A("An $env() statement is not expected at this location.",l,_.location,_.value.value));return}let m=new RegExp(que).exec(_.value.value);if(m?.length===2&&m[0]===_.value.value){let b={type:Ac.Raw,parent:null,value:`environment["${m[1]}"]`};_.value=b}else{let b=_.value.value.replaceAll(new RegExp(que),(D,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);b!==_.value.value&&(_.value=UE.createTemplateString(b,_))}},"getEnvStatementTransformer");var ZG="config/routes.json",Qmr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Zmr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Pmt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],ehr="handler/{}/options/{}/rewritePattern",thr="handler/{}/options/{}/baseUrl",Wue=class extends Vue{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let l=this.addedImports.get(s);if(!l)throw new Error("Import name is undefined. This should not happen.");return l}getImports(){let s=[];return this.addedImports.forEach((l,_)=>{s.push({name:l,path:_})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!oA(s)||!OM(s.value)||typeof s.value.value!="string")&&D3(s,ehr)){if(!s.parent||!IM(s.parent)){this.errors.push(new _A("Invalid node, expected object",ZG,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Amt(l)},m=UE.createProperty("__rewriteFunction",_,s);s.parent.children.push(m)}}rewriteForwardFunction(s){if(!(!oA(s)||!OM(s.value)||typeof s.value.value!="string")&&D3(s,thr)){if(!s.parent||!IM(s.parent)){this.errors.push(new _A("Invalid node, expected object",ZG,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Amt(l)},m=UE.createProperty("__rewriteFunction",_,s);s.parent.children.push(m)}}replaceImportStatements(s){if(!oA(s)||!OM(s.value))return;let l=s.value.value;if(typeof l!="string")return;if(!Zmr.some(A=>D3(s,A))&&!Pmt.some(A=>D3(s,A))){if(p8e.test(l)){if(s.name.value==="$ref")return;this.errors.push(new _A("An $import() statement is not expected at this location.",ZG,s.location,l))}return}let _=p8e.exec(l);if(Pmt.some(A=>D3(s,A))&&!_)return;if(!_){this.errors.push(new _A("Invalid $import() statement",ZG,s.location,l));return}let m=_[1];m.startsWith(".")&&(m=Xmr.join("..",m));let b=this.getImportName(m),D={type:Ac.Identifier,parent:s.parent,value:b};s.value=D}replaceEnvStatements=wmt(Qmr,this.errors,ZG)};function Amt(a){return`(request, context) => {
560
+ `&&b++;else if(l)_+=D,b=m+2;else throw new KP(`Invalid escape \\${D}.`,{line:s.loc.start.line,column:s.loc.start.column+m,offset:s.loc.start.offset+m});m=a.indexOf("\\",b)}return _+=a.slice(b),_}t(ier,"getStringValue");function ser(a,s,l=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return ier(a.slice(1,-1),s,l);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(ser,"getLiteralValue");function dot(a,s){s=Object.freeze({...ner,...s});let l=[],_=new C6e(a,{mode:s.mode,ranges:s.ranges}),m=s.mode==="json5",b=s.allowTrailingCommas||m;function D(){let br=_.next();return br&&s.tokens&&l.push(_.token),br}t(D,"nextNoComments");function A(){let br=_.next();return br&&s.tokens&&l.push(_.token),br>=T_.LineComment?A():br}t(A,"nextSkipComments");let M=s.mode==="json"?D:A;function U(br,mr){if(br!==mr)throw new TO(_.token)}t(U,"assertTokenType");function ie(br,mr){if(!mr.includes(br))throw new TO(_.token)}t(ie,"assertTokenTypes");function se(br,mr){return s.ranges?{range:[br.offset,mr.offset]}:void 0}t(se,"createRange");function Z(br){let mr=_.token,Is=se(mr.loc.start,mr.loc.end),Pi=ser(a.slice(mr.loc.start.offset,mr.loc.end.offset),mr,m),Ti={loc:{start:{...mr.loc.start},end:{...mr.loc.end}},...Is};switch(br){case T_.String:return ST.string(Pi,Ti);case T_.Number:return ST.number(Pi,Ti);case T_.Boolean:return ST.boolean(Pi,Ti);default:throw new TypeError(`Unknown token type ${mr.type}.`)}}t(Z,"createLiteralNode");function Re(br){let mr=se(br.loc.start,br.loc.end),Is=a.slice(br.loc.start.offset,br.loc.end.offset),Po={loc:{start:{...br.loc.start},end:{...br.loc.end}},...mr};if(br.type!=="Identifier"){let Ti="";return(Is[0]==="+"||Is[0]==="-")&&(Ti=Is[0]),ST[Is.includes("NaN")?"nan":"infinity"](Ti,Po)}return ST.identifier(Is,Po)}t(Re,"createJSON5IdentifierNode");function Pe(br){let mr=se(br.loc.start,br.loc.end);return ST.null({loc:{start:{...br.loc.start},end:{...br.loc.end}},...mr})}t(Pe,"createNullNode");function ke(br){m?ie(br,[T_.String,T_.Identifier,T_.Number]):U(br,T_.String);let mr=_.token,Is=br===T_.String?Z(br):Re(mr);if(m&&(Is.type==="NaN"||Is.type==="Infinity")){if(Is.sign!=="")throw new TO(_.token);Is=ST.identifier(Is.type,{loc:Is.loc,...se(Is.loc.start,Is.loc.end)})}br=M(),U(br,T_.Colon);let Pi=yr(),Po=se(Is.loc.start,Pi.loc.end);return ST.member(Is,Pi,{loc:{start:{...Is.loc.start},end:{...Pi.loc.end}},...Po})}t(ke,"parseProperty");function wt(br){U(br,T_.LBrace);let mr=_.token,Is=[],Pi=M();if(Pi!==T_.RBrace)do{if(Is.push(ke(Pi)),Pi=M(),!Pi)throw new Vce(Is[Is.length-1].loc.end);if(Pi===T_.Comma){if(Pi=M(),b&&Pi===T_.RBrace)break}else break}while(Pi);U(Pi,T_.RBrace);let Po=_.token,Ti=se(mr.loc.start,Po.loc.end);return ST.object(Is,{loc:{start:{...mr.loc.start},end:{...Po.loc.end}},...Ti})}t(wt,"parseObject");function At(br){U(br,T_.LBracket);let mr=_.token,Is=[],Pi=M();if(Pi!==T_.RBracket)do{let _p=yr(Pi);if(Is.push(ST.element(_p,{loc:_p.loc})),Pi=M(),Pi===T_.Comma){if(Pi=M(),b&&Pi===T_.RBracket)break}else break}while(Pi);U(Pi,T_.RBracket);let Po=_.token,Ti=se(mr.loc.start,Po.loc.end);return ST.array(Is,{loc:{start:{...mr.loc.start},end:{...Po.loc.end}},...Ti})}t(At,"parseArray");function yr(br){br=br??M();let mr=_.token;switch(br){case T_.String:case T_.Boolean:return Z(br);case T_.Number:if(m){let Is=a.slice(mr.loc.start.offset,mr.loc.end.offset);if((Is[0]==="+"||Is[0]==="-")&&(Is=Is.slice(1)),Is==="NaN"||Is==="Infinity")return Re(mr)}return Z(br);case T_.Null:return Pe(mr);case T_.LBrace:return wt(br);case T_.LBracket:return At(br);default:throw new TO(mr)}}t(yr,"parseValue");let zr=yr();if(M())throw new TO(_.token);let hn={loc:{start:{line:1,column:1,offset:0},end:{...zr.loc.end}}};return s.tokens&&(hn.tokens=l),s.ranges&&(hn.range=[hn.loc.start.offset,hn.loc.end.offset]),ST.document(zr,hn)}t(dot,"parse");var aer=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function mot(a){return a&&typeof a=="object"}t(mot,"isObject");function oer(a){return mot(a)&&typeof a.type=="string"}t(oer,"isNode");function cer(a,s){function l(_,m){typeof s.enter=="function"&&s.enter(_,m);for(let b of aer.get(_.type)){let D=_[b];mot(D)&&(Array.isArray(D)?D.forEach(A=>l(A,_)):oer(D)&&l(D,_))}typeof s.exit=="function"&&s.exit(_,m)}t(l,"visitNode"),l(a)}t(cer,"traverse");function hot(a,s=()=>!0){let l=[];return cer(a,{enter(_,m){l.push({node:_,parent:m,phase:"enter"})},exit(_,m){l.push({node:_,parent:m,phase:"exit"})}}),l.filter(s).values()}t(hot,"iterator");import ler from"fs/promises";var OH=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),Wce=t(async a=>{try{return await ler.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),FH=t(async a=>{try{return dot(a)}catch(s){if(s.column&&s.line&&s.message){let l=OH(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:l}}return}},"getSchemaAST");var got=t(async(a,s,l)=>{try{if(a.length===0)return;for(let _ of a){let m=await Wce(_),b=await uer(m,_,s,l);if(b)return b}}catch{}},"getRouteLocationByValue"),uer=t(async(a,s,l,_)=>{try{if(!a)return;let m=null,b=await FH(a);if(b){for(let{node:D}of hot(b))if(D.value&&D.value===l){m=D.loc;break}if(m!==null){let D=OH(a,m.start.line);return{file:s,line:m.start.line,column:m.start.column,length:m.end.column-m.start.column,lineText:D,suggestion:_}}}}catch{}},"getRouteLocationByValueFromSchema");import yot from"fs/promises";import Hce from"path";var D6e="schemas",k6e=".oas.json";var xO=t(async a=>(await yot.readdir(a)).map(l=>`${a}/${l}`).filter(l=>l.endsWith(k6e)).sort(),"getOpenApiFilesByAlphabetical"),oM=t(async a=>{let s=Hce.resolve(a,"config");return(await yot.readdir(s)).filter(_=>_.endsWith(k6e)).length>=1},"oasFileInProject");function LH(a,s,l,_,m,b,D){if(b.has(l))return;let A;try{A=_.get(l)}catch(M){throw new M1({text:`Failed to resolve reference: ${l}`,detail:M.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:l,namespace:s,suggestion:"Check the reference and try again."}})}b.set(l,m.length),m.push(l),w6e(P6e(l),s,A,_,m,b,D)}t(LH,"chaseRefs");function w6e(a,s,l,_,m,b,D){if(Array.isArray(l))for(let A of l)w6e(a,s,A,_,m,b,D);else if(typeof l=="object")for(let A in l){if(A==="$ref"){let M=l[A];D&&(l[A]=D(s,M)),LH(a,s,r3(a,M),_,m,b,D)}w6e(a,s,l[A],_,m,b,D)}}t(w6e,"lookForRefs");function r3(a,s){let l=s.indexOf("#");return l>=0?`${Hce.resolve(a,s.substring(0,l))}${s.substring(l)}`:Hce.resolve(Hce.dirname(a),s)}t(r3,"getFullyQualifiedRefName");function P6e(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(P6e,"getFilePathNameFromRefName");var A6e=class{static{t(this,"Environment")}get WORKING_COPY_ENVIRONMENT(){return process.env.WORKING_COPY_ENVIRONMENT??"staging"}get ZUP_HOSTNAME(){return process.env.ZUP_HOSTNAME??"zuplo.app"}get ZUP_WORKING_COPY_HOSTNAME(){return process.env.ZUP_WORKING_COPY_HOSTNAME?process.env.ZUP_WORKING_COPY_HOSTNAME:this.WORKING_COPY_ENVIRONMENT==="staging"?"d1.zuplo.dev":"d2.zuplo.dev"}},fer=new A6e,N6e=fer;var QH=up(W4e(),1);var H4e={};dst(H4e,{UnsafePathError:()=>ble,deleteFile:()=>Yir,deleteFolder:()=>ssr,dirExists:()=>Sle,ensureDirectoryExists:()=>esr,fileExists:()=>Kir,getParentDirFilename:()=>rsr,isNotFileOrDirectory:()=>Xir,listFolderContents:()=>Wlt,listFolders:()=>Zir,mkdirForFilePathIfNotExits:()=>Glt,mkdirIfNotExists:()=>Hlt,safePath:()=>tsr,tarFolderContent:()=>nsr,untar:()=>isr});import qlt from"child_process";import u3 from"fs/promises";import l3 from"path";var Vlt=[".git","node_modules",".yarn",".DS_Store"];async function Kir(a){try{return(await u3.stat(a)).isFile()}catch{return!1}}t(Kir,"fileExists");async function Yir(a,s){return await u3.rm(a,s)}t(Yir,"deleteFile");async function Sle(a){try{return(await u3.stat(a)).isDirectory()}catch{return!1}}t(Sle,"dirExists");async function Xir(a){try{return await u3.stat(a),!1}catch{return!0}}t(Xir,"isNotFileOrDirectory");function Qir(a,s){let l=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),_=a.match(l);if(!_)return"";let m=a.split(_[0]);return m[1]===""?"":`/${m[1]}`}t(Qir,"getParentDirectory");async function Zir(a){if(!await Sle(a))return[];let s=await u3.readdir(a,{withFileTypes:!0}),l=[];for await(let _ of s)Vlt.includes(_.name)||_.isDirectory()&&l.push(_.name);return l}t(Zir,"listFolders");async function Wlt(a,s,l=!0){let _=Qir(a,s),m=await u3.readdir(a,{withFileTypes:!0}),b=[];for await(let D of m)if(!Vlt.includes(D.name)||!l)if(D.isDirectory()){let A=await Wlt(l3.join(a,D.name),s,l);b.push(...A)}else b.push(l3.join(_,D.name));return b}t(Wlt,"listFolderContents");var Hlt=t(async a=>{if(await Sle(a))return!0;await u3.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),Glt=t(async a=>{let s=l3.dirname(a);return Hlt(s)},"mkdirForFilePathIfNotExits"),esr=Glt,ble=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function tsr(a){let s=t(l=>{if(!l.startsWith(a))throw new ble("Resolved path is not part of the project.");return l},"ensureSafePath");return{resolve:t((...l)=>s(l3.resolve(...l)),"resolve")}}t(tsr,"safePath");function rsr(a){return`${l3.basename(l3.dirname(a))}/${l3.basename(a)}`}t(rsr,"getParentDirFilename");function nsr(a,s,l,_){let m=l3.join(_,l);return qlt.execSync(`tar --exclude='.git/' --exclude='dist/' -czf ${m} ${s}`,{cwd:a}),m}t(nsr,"tarFolderContent");function isr(a,s,l,_=!1){qlt.execSync(`tar -xf ${s} ${_?"--strip-components=1 ":""}-C ${l}`,{cwd:a})}t(isr,"untar");async function ssr(a){if(await Sle(a))return await u3.rm(a,{recursive:!0})}t(ssr,"deleteFolder");var wl=H4e;var CT=up(W4e(),1);import{readFile as asr}from"fs/promises";var IO=class extends Error{static{t(this,"CustomResolveError")}},f3=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,l){this.sourceDirectory=s,this.logger=l}dereference(s,l){return QH.$RefParser.dereference(s,{resolve:{json:!0,file:Tle(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:l?.onDereference}})}bundle(s){return QH.$RefParser.bundle(s,{resolve:{file:Tle(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return QH.$RefParser.parse(s,{resolve:{file:Tle(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return QH.$RefParser.resolve(s,{resolve:{file:Tle(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function Tle(a,s){return{order:100,canRead(l){let _=lsr(l.url);if(!(_===void 0||_==="file"))return!1;let b;try{b=Klt(l.url)}catch(D){throw new IO(`Malformed URI: ${l.url}`,{cause:D})}try{wl.safePath(a).resolve(b)}catch(D){return s?.warn(D),!1}return!0},async read(l){let _;try{_=Klt(l.url)}catch(m){throw new IO(`Malformed URI: ${l.url}`,{cause:m})}try{return await asr(_)}catch(m){throw new IO(`Error opening file "${_}"`,{cause:m})}}}}t(Tle,"customResolver");var G4e=/^win/.test(globalThis.process?globalThis.process.platform:""),osr=/\//g,csr=/^(\w{2,}):\/\//i,K4e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function lsr(a){let s=csr.exec(a);if(s)return s[1].toLowerCase()}t(lsr,"getProtocol");function Klt(a,s){a=decodeURI(a);for(let _=0;_<K4e.length;_+=2)a=a.replace(K4e[_],K4e[_+1]);let l=a.substr(0,7).toLowerCase()==="file://";return l&&(a=a[7]==="/"?a.substr(8):a.substr(7),G4e&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(l=!1,a=G4e?a:"/"+a)),G4e&&!l&&(a=a.replace(osr,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(Klt,"toFileSystemPath");var Ylt="YOUR_KEY_HERE";async function Xlt(a){let l=await new f3(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),_=a.openApiDocPath.replace(a.sourceDirectory,"");return usr({...a,relativeOpenApiPath:_},l)}t(Xlt,"buildPublicOpenApiFile");async function usr(a,s){dsr({relativeOpenApiPath:a.relativeOpenApiPath},s);let l=s;return l=_sr(l),fsr(l,a),l=psr(l,a),Qlt(l,"x-zuplo"),l}t(usr,"buildRawOpenApiFile");function fsr(a,{customDomain:s,deploymentName:l,environmentType:_}){let m;s?m=s:_&&l&&(m=_===pce.WORKING_COPY?`${l}.${N6e.ZUP_WORKING_COPY_HOSTNAME}`:`${l}.${N6e.ZUP_HOSTNAME}`),m?a.servers=[{url:`https://${m}`}]:a.servers=void 0}t(fsr,"addServerHost");function _sr(a){if(!a.paths)return a;let{components:s}=a,l=s?{...s}:void 0,_=[];l&&l.parameters&&(_=Object.entries(l.parameters).reduce((b,[D,A])=>(HR in A&&dce(A[HR])&&(b.push(D),l.parameters&&delete l.parameters[D]),b),[]));let m=Object.entries(a.paths).reduce((b,[D,A])=>{if(!A)return b;let M={...A},U=["delete","get","head","patch","post","put","trace","options"];return U.forEach(ie=>{let se=A[ie];if(!se)return;if(dce(se[HR])){delete M[ie];return}let{parameters:Z}=se;if(!Z)return;let Re=Z.filter(Pe=>{if(HR in Pe&&dce(Pe[HR]))return!1;if("$ref"in Pe){let ke=Pe.$ref.split("/").pop();return ke?!_.includes(ke):!0}return!0});M[ie]={...se,parameters:Re}}),U.some(ie=>!!M[ie])&&(b[D]=M),b},{});return{...a,paths:m,components:l}}t(_sr,"removeHiddenRoutesAndParams");function psr(a,{policiesConfig:s}){if(!a.paths)return a;let l=Object.entries(a.paths).reduce((_,[m,b])=>{if(!b)return _;let D={...b};return[D.delete,D.get,D.head,D.patch,D.post,D.put,D.trace,D.options].forEach(A=>{if(!A)return;let M=A["x-zuplo-route"]?.policies?.inbound?.reduce((se,Z)=>{let Re=s.policies?.find(({name:wt})=>wt===Z);if(!Re)return se;if(!(Re.handler.export==="CompositeInboundPolicy"))return se.concat(Z);let ke=Re.handler.options?.policies;return ke?se.concat(ke):se},[]),U=[];if(M&&M.forEach(se=>{s.policies?.forEach(Z=>{Z.name===se&&(Z.handler.export==="ApiAuthKeyInboundPolicy"||Z.handler.export==="ApiKeyInboundPolicy")&&!Z.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&U.push(Z)})}),U.length>0){let se=U.length>0&&U[0].handler&&U[0].handler.options&&U[0].handler.options.authHeader?U[0].handler.options.authHeader:"Authorization",Z=U.length>0&&U[0].handler&&U[0].handler.options&&(U[0].handler.options.authScheme||U[0].handler.options.authScheme==="")?U[0].handler.options.authScheme:"Bearer",Re=Z!==""?`${Z} ${Ylt}`:Ylt,Pe={name:se,in:"header",required:!0,example:Re,schema:{type:"string"},description:`The \`${se}\` header is used to authenticate with the API using your API key. Value is of the format \`${Re}\`.`};A.parameters?A.parameters.some(yr=>"name"in yr&&yr.name===Pe.name)||A.parameters.unshift(Pe):A.parameters=[Pe];let ke={type:"http",scheme:Z.toLowerCase()},wt="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(yr=>"name"in yr&&yr.type==="apiKey"||"type"in yr&&yr.type==="http"&&yr.scheme===Z)||(a.components.securitySchemes={...a.components.securitySchemes,[wt]:ke}):(a.components||(a.components={}),a.components.securitySchemes={[wt]:ke});let At={[wt]:[]};A.security?A.security.some(yr=>yr[wt]!==void 0)||A.security.unshift(At):A.security=[At]}let ie=[];if(M&&M.forEach(se=>{s.policies?.forEach(Z=>{Z.name===se&&(Z.handler.export==="RateLimitInboundPolicy"||Z.handler.export==="ComplexRateLimitInboundPolicy")&&ie.push(Z)})}),ie.length>0){let se={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},Z={...se,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:se,RateLimitWithRetryAfter:Z},A.responses||(A.responses={});let Re=ie.some(Pe=>Pe.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Re?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),_[m]=D,_},{});return{...a,paths:l}}t(psr,"enrichSpecWithZuploData");function Qlt(a,s){for(let l in a)l.startsWith(s)?delete a[l]:typeof a[l]=="object"&&Qlt(a[l],s)}t(Qlt,"removePropertiesByPrefix");function dsr({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new M1({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new M1({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 M1({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(dsr,"assertIsZuploOpenApiSpec");function msr(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let U=0;U<s.length;U++)s[U]=255;for(let U=0;U<a.length;U++){let ie=a.charAt(U),se=ie.charCodeAt(0);if(s[se]!==255)throw new TypeError(ie+" is ambiguous");s[se]=U}let l=a.length,_=a.charAt(0),m=Math.log(l)/Math.log(256),b=Math.log(256)/Math.log(l);function D(U){if(U instanceof Uint8Array||(ArrayBuffer.isView(U)?U=new Uint8Array(U.buffer,U.byteOffset,U.byteLength):Array.isArray(U)&&(U=Uint8Array.from(U))),!(U instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(U.length===0)return"";let ie=0,se=0,Z=0,Re=U.length;for(;Z!==Re&&U[Z]===0;)Z++,ie++;let Pe=(Re-Z)*b+1>>>0,ke=new Uint8Array(Pe);for(;Z!==Re;){let yr=U[Z],zr=0;for(let en=Pe-1;(yr!==0||zr<se)&&en!==-1;en--,zr++)yr+=256*ke[en]>>>0,ke[en]=yr%l>>>0,yr=yr/l>>>0;if(yr!==0)throw new Error("Non-zero carry");se=zr,Z++}let wt=Pe-se;for(;wt!==Pe&&ke[wt]===0;)wt++;let At=_.repeat(ie);for(;wt<Pe;++wt)At+=a.charAt(ke[wt]);return At}t(D,"encode");function A(U){if(typeof U!="string")throw new TypeError("Expected String");if(U.length===0)return new Uint8Array;let ie=0,se=0,Z=0;for(;U[ie]===_;)se++,ie++;let Re=(U.length-ie)*m+1>>>0,Pe=new Uint8Array(Re);for(;U[ie];){let yr=s[U.charCodeAt(ie)];if(yr===255)return;let zr=0;for(let en=Re-1;(yr!==0||zr<Z)&&en!==-1;en--,zr++)yr+=l*Pe[en]>>>0,Pe[en]=yr%256>>>0,yr=yr/256>>>0;if(yr!==0)throw new Error("Non-zero carry");Z=zr,ie++}let ke=Re-Z;for(;ke!==Re&&Pe[ke]===0;)ke++;let wt=new Uint8Array(se+(Re-ke)),At=se;for(;ke!==Re;)wt[At++]=Pe[ke++];return wt}t(A,"decodeUnsafe");function M(U){let ie=A(U);if(ie)return ie;throw new Error("Non-base"+l+" character")}return t(M,"decode"),{encode:D,decodeUnsafe:A,decode:M}}t(msr,"base");var Zlt=msr;var hsr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",xle=Zlt(hsr);var Y4e="2024-09-02",eut=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function tut(){return new DT({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:Y4e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:eut[Y4e]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(tut,"getMockEnvironment");var DT=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=tut()),this.#r}constructor({build:s,runtime:l}){let _;try{if(l.__ZUPLO_CONFIG){let m=atob(l.__ZUPLO_CONFIG);_=JSON.parse(m)}if(l.ZUPLO_SYSTEM_CONFIGURATIONS){let m=new TextDecoder().decode(xle.decode(l.ZUPLO_SYSTEM_CONFIGURATIONS)),b=JSON.parse(m);for(let D of Object.keys(b))l[D]=b[D]}}catch(m){console.error("Failed to parse runtime configuration",m)}this.config=_??{},this.build=s,this.runtime=l,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get 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 gsr=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function rut(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!gsr.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(rut,"isRestrictedEnvVariableName");function nut(a){return!!a.startsWith("ZUPLO_")}t(nut,"isZuploReadableEnvVariableName");var AIr=new Proxy({},{get(a,s){let l=String(s);switch(l){case"ZUPLO_ENVIRONMENT_TYPE":return DT.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return DT.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return DT.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return DT.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return DT.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return DT.instance.build.BUILD_ID}if(!(rut(l)&&!nut(l)))return DT.instance.runtime[l]}});function ZH(a,s,l){return`_${eA(`${a}_${s}_${l}`)}`}t(ZH,"getRawOperationDataIdentifierName");function X4e(a,s,l,_){return`_${eA(a.toLowerCase())}_${s.toLowerCase()}_${l.toLowerCase()}_${_.toLowerCase()}`}t(X4e,"getIdForParameterSchema");function Q4e(a,s,l){return`_${eA(a.toLowerCase())}_${s.toLowerCase()}_rb_${eA(l.toLowerCase())}`}t(Q4e,"getIdForRequestBodySchema");function eG(a,s){return`_${eA(a)}_${eA(s)}`}t(eG,"getIdForRefSchema");function eA(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(eA,"sanitizedIdentifierName");var Lmt=up(Hft(),1);import Kue from"path";var hG=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,l,_,m,b){this.type=a,this.name=s,this.prefix=l,this.value=_,this.suffix=m,this.modifier=b}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},fcr=/[$_\p{ID_Start}]/u,_cr=/[$_\u200C\u200D\p{ID_Continue}]/u,W3e=".*";function pcr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(pcr,"Re");function Yft(a,s=!1){let l=[],_=0;for(;_<a.length;){let m=a[_],b=t(function(D){if(!s)throw new TypeError(D);l.push({type:"INVALID_CHAR",index:_,value:a[_++]})},"c");if(m==="*"){l.push({type:"ASTERISK",index:_,value:a[_++]});continue}if(m==="+"||m==="?"){l.push({type:"OTHER_MODIFIER",index:_,value:a[_++]});continue}if(m==="\\"){l.push({type:"ESCAPED_CHAR",index:_++,value:a[_++]});continue}if(m==="{"){l.push({type:"OPEN",index:_,value:a[_++]});continue}if(m==="}"){l.push({type:"CLOSE",index:_,value:a[_++]});continue}if(m===":"){let D="",A=_+1;for(;A<a.length;){let M=a.substr(A,1);if(A===_+1&&fcr.test(M)||A!==_+1&&_cr.test(M)){D+=a[A++];continue}break}if(!D){b(`Missing parameter name at ${_}`);continue}l.push({type:"NAME",index:_,value:D}),_=A;continue}if(m==="("){let D=1,A="",M=_+1,U=!1;if(a[M]==="?"){b(`Pattern cannot start with "?" at ${M}`);continue}for(;M<a.length;){if(!pcr(a[M],!1)){b(`Invalid character '${a[M]}' at ${M}.`),U=!0;break}if(a[M]==="\\"){A+=a[M++]+a[M++];continue}if(a[M]===")"){if(D--,D===0){M++;break}}else if(a[M]==="("&&(D++,a[M+1]!=="?")){b(`Capturing groups are not allowed at ${M}`),U=!0;break}A+=a[M++]}if(U)continue;if(D){b(`Unbalanced pattern at ${_}`);continue}if(!A){b(`Missing pattern at ${_}`);continue}l.push({type:"REGEX",index:_,value:A}),_=M;continue}l.push({type:"CHAR",index:_,value:a[_++]})}return l.push({type:"END",index:_,value:""}),l}t(Yft,"v");function Xft(a,s={}){let l=Yft(a);s.delimiter??="/#?",s.prefixes??="./";let _=`[^${AT(s.delimiter)}]+?`,m=[],b=0,D=0,A="",M=new Set,U=t(zr=>{if(D<l.length&&l[D].type===zr)return l[D++].value},"a"),ie=t(()=>U("OTHER_MODIFIER")??U("ASTERISK"),"f"),se=t(zr=>{let en=U(zr);if(en!==void 0)return en;let{type:hn,index:br}=l[D];throw new TypeError(`Unexpected ${hn} at ${br}, expected ${zr}`)},"d"),Z=t(()=>{let zr="",en;for(;en=U("CHAR")??U("ESCAPED_CHAR");)zr+=en;return zr},"T"),Re=t(zr=>zr,"Se"),Pe=s.encodePart||Re,ke="",wt=t(zr=>{ke+=zr},"U"),At=t(()=>{ke.length&&(m.push(new hG(3,"","",Pe(ke),"",3)),ke="")},"$"),yr=t((zr,en,hn,br,mr)=>{let Is=3;switch(mr){case"?":Is=1;break;case"*":Is=0;break;case"+":Is=2;break}if(!en&&!hn&&Is===3){wt(zr);return}if(At(),!en&&!hn){if(!zr)return;m.push(new hG(3,"","",Pe(zr),"",Is));return}let Pi;hn?hn==="*"?Pi=W3e:Pi=hn:Pi=_;let Po=2;Pi===_?(Po=1,Pi=""):Pi===W3e&&(Po=0,Pi="");let Ti;if(en?Ti=en:hn&&(Ti=b++),M.has(Ti))throw new TypeError(`Duplicate name '${Ti}'.`);M.add(Ti),m.push(new hG(Po,Ti,Pe(zr),Pi,Pe(br),Is))},"V");for(;D<l.length;){let zr=U("CHAR"),en=U("NAME"),hn=U("REGEX");if(!en&&!hn&&(hn=U("ASTERISK")),en||hn){let mr=zr??"";s.prefixes.indexOf(mr)===-1&&(wt(mr),mr=""),At();let Is=ie();yr(mr,en,hn,"",Is);continue}let br=zr??U("ESCAPED_CHAR");if(br){wt(br);continue}if(U("OPEN")){let mr=Z(),Is=U("NAME"),Pi=U("REGEX");!Is&&!Pi&&(Pi=U("ASTERISK"));let Po=Z();se("CLOSE");let Ti=ie();yr(mr,Is,Pi,Po,Ti);continue}At(),se("END")}return m}t(Xft,"D");function AT(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(AT,"S");function Gft(a){return a&&a.ignoreCase?"ui":"u"}t(Gft,"X");function dcr(a,s,l){return Qft(Xft(a,l),s,l)}t(dcr,"Z");function NM(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(NM,"k");function Qft(a,s,l={}){l.delimiter??="/#?",l.prefixes??="./",l.sensitive??=!1,l.strict??=!1,l.end??=!0,l.start??=!0,l.endsWith="";let _=l.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?_+=AT(A.value):_+=`(?:${AT(A.value)})${NM(A.modifier)}`;continue}s&&s.push(A.name);let M=`[^${AT(l.delimiter)}]+?`,U=A.value;if(A.type===1?U=M:A.type===0&&(U=W3e),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?_+=`(${U})${NM(A.modifier)}`:_+=`((?:${U})${NM(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){_+=`(?:${AT(A.prefix)}(${U})${AT(A.suffix)})`,_+=NM(A.modifier);continue}_+=`(?:${AT(A.prefix)}`,_+=`((?:${U})(?:`,_+=AT(A.suffix),_+=AT(A.prefix),_+=`(?:${U}))*)${AT(A.suffix)})`,A.modifier===0&&(_+="?")}let m=`[${AT(l.endsWith)}]|$`,b=`[${AT(l.delimiter)}]`;if(l.end)return l.strict||(_+=`${b}?`),l.endsWith.length?_+=`(?=${m})`:_+="$",new RegExp(_,Gft(l));l.strict||(_+=`(?:${b}(?=${m}))?`);let D=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(D=l.delimiter.indexOf(A)>-1)}return D||(_+=`(?=${b}|${m})`),new RegExp(_,Gft(l))}t(Qft,"F");var m3={delimiter:"",prefixes:"",sensitive:!0,strict:!0},mcr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},hcr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function gcr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(gcr,"J");function Zft(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(Zft,"Q");function ycr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(ycr,"Ee");function e_t(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(e_t,"W");var t_t=["ftp","file","http","https","ws","wss"];function r_t(a){if(!a)return!0;for(let s of t_t)if(a.test(s))return!0;return!1}t(r_t,"N");function vcr(a,s){if(a=Zft(a,"#"),s||a==="")return a;let l=new URL("https://example.com");return l.hash=a,l.hash?l.hash.substring(1,l.hash.length):""}t(vcr,"te");function bcr(a,s){if(a=Zft(a,"?"),s||a==="")return a;let l=new URL("https://example.com");return l.search=a,l.search?l.search.substring(1,l.search.length):""}t(bcr,"re");function Scr(a,s){return s||a===""?a:e_t(a)?s_t(a):i_t(a)}t(Scr,"ne");function Tcr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.password=a,l.password}t(Tcr,"se");function xcr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.username=a,l.username}t(xcr,"ie");function Ecr(a,s,l){if(l||a==="")return a;if(s&&!t_t.includes(s))return new URL(`${s}:${a}`).pathname;let _=a[0]=="/";return a=new URL(_?a:"/-"+a,"https://example.com").pathname,_||(a=a.substring(2,a.length)),a}t(Ecr,"ae");function Ccr(a,s,l){return n_t(s)===a&&(a=""),l||a===""?a:a_t(a)}t(Ccr,"oe");function Dcr(a,s){return a=ycr(a,":"),s||a===""?a:H3e(a)}t(Dcr,"ce");function n_t(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(n_t,"_");function H3e(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(H3e,"y");function kcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(kcr,"le");function wcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(wcr,"fe");function i_t(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(i_t,"z");function s_t(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(s_t,"j");function a_t(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(a_t,"K");function Pcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(Pcr,"he");function Acr(a){return a===""?a:new URL(`data:${a}`).pathname}t(Acr,"ue");function Ncr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(Ncr,"de");function Icr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(Icr,"pe");var Ocr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=Yft(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#w()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#C()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#x()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#x()&&this.#i(5,1);break;case 4:this.#x()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#k()&&!this.#c?this.#i(6,1):this.#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 l=this.#u(a);return l.value===s&&(l.type==="CHAR"||l.type==="ESCAPED_CHAR"||l.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#C(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#x(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#k(){return this.#m(this.#t,":")}#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,"#")}#w(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,m3),a.encodePart=H3e;let s=dcr(this.#T(),void 0,a);this.#l=r_t(s)}},V3e=["protocol","username","password","hostname","port","pathname","search","hash"],d3="*";function Kft(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let l=new URL(a,s);return{protocol:l.protocol.substring(0,l.protocol.length-1),username:l.username,password:l.password,hostname:l.hostname,port:l.port,pathname:l.pathname,search:l.search!==""?l.search.substring(1,l.search.length):void 0,hash:l.hash!==""?l.hash.substring(1,l.hash.length):void 0}}t(Kft,"ge");function sA(a,s){return s?mG(a):a}t(sA,"b");function dG(a,s,l){let _;if(typeof s.baseURL=="string")try{_=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=sA(_.protocol.substring(0,_.protocol.length-1),l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=sA(_.username,l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=sA(_.password,l)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=sA(_.hostname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=sA(_.port,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=sA(_.pathname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=sA(_.search.substring(1,_.search.length),l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=sA(_.hash.substring(1,_.hash.length),l))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Dcr(s.protocol,l)),typeof s.username=="string"&&(a.username=xcr(s.username,l)),typeof s.password=="string"&&(a.password=Tcr(s.password,l)),typeof s.hostname=="string"&&(a.hostname=Scr(s.hostname,l)),typeof s.port=="string"&&(a.port=Ccr(s.port,a.protocol,l)),typeof s.pathname=="string"){if(a.pathname=s.pathname,_&&!gcr(a.pathname,l)){let m=_.pathname.lastIndexOf("/");m>=0&&(a.pathname=sA(_.pathname.substring(0,m+1),l)+a.pathname)}a.pathname=Ecr(a.pathname,a.protocol,l)}return typeof s.search=="string"&&(a.search=bcr(s.search,l)),typeof s.hash=="string"&&(a.hash=vcr(s.hash,l)),a}t(dG,"w");function mG(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(mG,"C");function Fcr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(Fcr,"Oe");function Lcr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let l=".*",_=`[^${Fcr(s.delimiter)}]+?`,m=/[$_\u200C\u200D\p{ID_Continue}]/u,b="";for(let D=0;D<a.length;++D){let A=a[D];if(A.type===3){if(A.modifier===3){b+=mG(A.value);continue}b+=`{${mG(A.value)}}${NM(A.modifier)}`;continue}let M=A.hasCustomName(),U=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),ie=D>0?a[D-1]:null,se=D<a.length-1?a[D+1]:null;if(!U&&M&&A.type===1&&A.modifier===3&&se&&!se.prefix.length&&!se.suffix.length)if(se.type===3){let Z=se.value.length>0?se.value[0]:"";U=m.test(Z)}else U=!se.hasCustomName();if(!U&&!A.prefix.length&&ie&&ie.type===3){let Z=ie.value[ie.value.length-1];U=s.prefixes.includes(Z)}U&&(b+="{"),b+=mG(A.prefix),M&&(b+=`:${A.name}`),A.type===2?b+=`(${A.value})`:A.type===1?M||(b+=`(${_})`):A.type===0&&(!M&&(!ie||ie.type===3||ie.modifier!==3||U||A.prefix!=="")?b+="*":b+=`(${l})`),A.type===1&&M&&A.suffix.length&&m.test(A.suffix[0])&&(b+="\\"),b+=mG(A.suffix),U&&(b+="}"),A.modifier!==3&&(b+=NM(A.modifier))}return b}t(Lcr,"ke");var o_t=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,l){try{let _;if(typeof s=="string"?_=s:l=s,typeof a=="string"){let A=new Ocr(a);if(A.parse(),a=A.result,_===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=_}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(_)throw new TypeError("parameter 1 is not of type 'string'.")}typeof l>"u"&&(l={ignoreCase:!1});let m={ignoreCase:l.ignoreCase===!0},b={pathname:d3,protocol:d3,username:d3,password:d3,hostname:d3,port:d3,search:d3,hash:d3};this.#r=dG(b,a,!0),n_t(this.#r.protocol)===this.#r.port&&(this.#r.port="");let D;for(D of V3e){if(!(D in this.#r))continue;let A={},M=this.#r[D];switch(this.#e[D]=[],D){case"protocol":Object.assign(A,m3),A.encodePart=H3e;break;case"username":Object.assign(A,m3),A.encodePart=kcr;break;case"password":Object.assign(A,m3),A.encodePart=wcr;break;case"hostname":Object.assign(A,mcr),e_t(M)?A.encodePart=s_t:A.encodePart=i_t;break;case"port":Object.assign(A,m3),A.encodePart=a_t;break;case"pathname":r_t(this.#n.protocol)?(Object.assign(A,hcr,m),A.encodePart=Pcr):(Object.assign(A,m3,m),A.encodePart=Acr);break;case"search":Object.assign(A,m3,m),A.encodePart=Ncr;break;case"hash":Object.assign(A,m3,m),A.encodePart=Icr;break}try{this.#s[D]=Xft(M,A),this.#n[D]=Qft(this.#s[D],this.#e[D],A),this.#t[D]=Lcr(this.#s[D],A),this.#p=this.#p||this.#s[D].some(U=>U.type===2)}catch{throw new TypeError(`invalid ${D} pattern '${this.#r[D]}'.`)}}}catch(_){throw new TypeError(`Failed to construct 'URLPattern': ${_.message}`)}}test(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?l=dG(l,a,!1):l=dG(l,Kft(a,s),!1)}catch{return!1}let _;for(_ of V3e)if(!this.#n[_].exec(l[_]))return!1;return!0}exec(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?l=dG(l,a,!1):l=dG(l,Kft(a,s),!1)}catch{return null}let _={};s?_.inputs=[a,s]:_.inputs=[a];let m;for(m of V3e){let b=this.#n[m].exec(l[m]);if(!b)return null;let D={};for(let[A,M]of this.#e[m].entries())if(typeof M=="string"||typeof M=="number"){let U=b[A+1];D[M]=U}_[m]={input:l[m]??"",groups:D}}return _}static compareComponent(a,s,l){let _=t((A,M)=>{for(let U of["type","modifier","prefix","value","suffix"]){if(A[U]<M[U])return-1;if(A[U]!==M[U])return 1}return 0},"o"),m=new hG(3,"","","","",3),b=new hG(0,"","","","",3),D=t((A,M)=>{let U=0;for(;U<Math.min(A.length,M.length);++U){let ie=_(A[U],M[U]);if(ie)return ie}return A.length===M.length?0:_(A[U]??m,M[U]??m)},"s");return!s.#t[a]&&!l.#t[a]?0:s.#t[a]&&!l.#t[a]?D(s.#s[a],[b]):!s.#t[a]&&l.#t[a]?D([b],l.#s[a]):D(s.#s[a],l.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=o_t);import{AssertionError as Rcr}from"assert";function aA(a,s){if(a===!1)throw new Rcr({message:s})}t(aA,"assert");var Ac;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Ac||(Ac={}));function IM(a){return a.type===Ac.Object}t(IM,"isAstObject");function oA(a){return a.type===Ac.Property}t(oA,"isAstProperty");function c_t(a){return a.type===Ac.Array}t(c_t,"isAstArray");function OM(a){return a.type===Ac.Literal}t(OM,"isAstLiteral");function BO(a){if(a===void 0)throw new Error("Node is undefined");if(!IM(a))throw new Error("Node is not object")}t(BO,"assertAstObject");import{findNodeAtLocation as Mcr,getNodeValue as jcr,printParseErrorCode as Bcr,visit as Ucr}from"jsonc-parser";var $cr={DEFAULT:{allowTrailingComma:!1}};function gG(a,s=[],l=$cr.DEFAULT){let _={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function m(M){_.type==="property"&&(_.length=M-_.offset,_=_.parent)}t(m,"ensurePropertyComplete");function b(M){return _.children?.push(M),M}t(b,"onValue"),Ucr(a,{onObjectBegin:t((M,U,ie)=>{_=b({type:"object",offset:M,length:-1,line:U+1,column:ie+1,parent:_,children:[]})},"onObjectBegin"),onObjectProperty:t((M,U,ie,se,Z)=>{_=b({type:"property",offset:U,length:-1,line:se+1,column:Z+1,parent:_,children:[]}),_.children?.push({type:"string",value:M,offset:U,length:ie,line:se,column:Z,parent:_})},"onObjectProperty"),onObjectEnd:t((M,U)=>{m(M+U),_.length=M+U-_.offset,_=_.parent,m(M+U)},"onObjectEnd"),onArrayBegin:t((M,U,ie,se)=>{_=b({type:"array",offset:M,length:-1,line:ie+1,column:se+1,parent:_,children:[]})},"onArrayBegin"),onArrayEnd:t((M,U)=>{_.length=M+U-_.offset,_=_.parent,m(M+U)},"onArrayEnd"),onLiteralValue:t((M,U,ie,se,Z)=>{b({type:Jcr(M),offset:U,length:ie,line:se+1,column:Z+1,parent:_,value:M}),m(U+ie)},"onLiteralValue"),onSeparator:t((M,U)=>{_.type==="property"&&(M===":"?_.colonOffset=U:M===","&&m(U))},"onSeparator"),onError:t((M,U,ie,se,Z)=>{s.push({error:M,offset:U,length:ie,line:se+1,column:Z+1})},"onError")},l);let A=_.children[0];return A&&delete A.parent,A}t(gG,"parse");function Jcr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(Jcr,"getNodeType");function G3e(a,s){return Mcr(a,s)}t(G3e,"findNodeAtLocation");function yG(a){return jcr(a)}t(yG,"getNodeValue");function l_t(a){return Bcr(a)}t(l_t,"printParseErrorCode");var vG=class{static{t(this,"AstAdapter")}parse(s){let _=gG(s,[]);if(_)return this.parseNode(_,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,l){switch(s.type){case"object":return this.createObject(s,l);case"array":return this.createArray(s,l);case"property":return this.createProperty(s,l);case"string":return this.createLiteral(s,l);case"number":return this.createLiteral(s,l);case"boolean":return this.createLiteral(s,l);case"null":return this.createLiteral(s,l)}}createLiteral(s,l){return{type:Ac.Literal,location:{line:s.line,column:s.column},parent:l,value:s.type==="null"?null:s.value}}createObject(s,l){let _={type:Ac.Object,children:[],parent:l,location:{line:s.line,column:s.column}};return s.children?.forEach(m=>{_.children.push(this.parseNode(m,_))}),_}createProperty(s,l){aA(s.children?.length===2,"Invalid property node");let _={type:Ac.Property,location:{line:s.line,column:s.column},parent:l,name:null,value:null};return _.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Ac.Identifier,parent:_},_.value=this.parseNode(s.children[1],_),_}createArray(s,l){let _={type:Ac.Array,location:{line:s.line,column:s.column},parent:l,children:[]};return s.children?.forEach(m=>_.children.push(this.parseNode(m,_))),_}};var UE={createLiteral:t((a,s)=>({type:Ac.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Ac.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Ac.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,l)=>{let _={type:Ac.Property,parent:l,name:null,value:s};return _.name={value:a,type:Ac.Identifier,parent:_},_.value.parent=_,_},"createProperty"),createArrayOfLiterals:t((a,s)=>{let l={type:Ac.Array,parent:s,children:[]};for(let _ of a)l.children.push(UE.createLiteral(_,l));return l},"createArrayOfLiterals")};var zcr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,bG=class{static{t(this,"SourceGenerator")}generate(s){let l=[];return this.generateSource(l,s),l.join("")}generateSource(s,l){switch(l.type){case Ac.Array:return this.generateArray(s,l);case Ac.Object:return this.generateObject(s,l);case Ac.Property:return this.generateProperty(s,l);case Ac.Literal:return this.generateLiteral(s,l);case Ac.FunctionCall:return this.generateFunctionCall(s,l);case Ac.Identifier:return this.generateIdentifier(s,l);case Ac.Raw:return this.generateRaw(s,l);case Ac.TemplateString:return this.generateTemplateString(s,l)}}generateArray(s,l){s.push("["),l.children.map(_=>{this.generateSource(s,_),s.push(",")}),s.push("]")}generateObject(s,l){s.push("{"),l.children.forEach(_=>{this.generateSource(s,_),s.push(",")}),s.push("}")}generateProperty(s,l){this.generateIdentifier(s,l.name),s.push(":"),this.generateSource(s,l.value)}generateFunctionCall(s,l){s.push(l.name.value),s.push("("),l.children.forEach((_,m,b)=>{this.generateSource(s,_),m<b.length&&s.push(",")}),s.push(")")}generateRaw(s,l){s.push(l.value)}generateTemplateString(s,l){s.push("`"),s.push(l.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,l){if(l.value===null)return s.push("null");switch(typeof l.value){case"number":case"boolean":return s.push(`${l.value}`);case"string":{let _=l.value,m=JSON.stringify(_);return s.push(`${m}`)}}}generateIdentifier(s,l){let _=zcr.test(l.value)?l.value:`'${l.value}'`;s.push(_)}};import{parse as qcr}from"@swc/core";import Vcr from"fs/promises";var u_t=t(async a=>{let s=new Set;try{let l=await Vcr.readFile(a,"utf-8");(await qcr(l,{syntax:"typescript"})).body.forEach(m=>{m.type==="ExportDefaultDeclaration"||m.type==="ExportDefaultExpression"?s.add("default"):m.type==="ExportDeclaration"&&m.declaration.type==="FunctionDeclaration"?s.add(m.declaration.identifier.value):m.type==="ExportDeclaration"&&m.declaration.type==="VariableDeclaration"&&m.declaration.declarations[0].id.type==="Identifier"&&s.add(m.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var f_t={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var K3e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var __t={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var Y3e={$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 X3e={$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 Cmt=up(Gdt(),1),Dmt=up(Emt(),1);var $ue=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new Dmt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,Cmt.default)(this.ajv,{mode:"fast"})}addSchema(s,l){this.ajv.addSchema(s,l)}compile(s){let l=this.ajv.compile(s);return t(m=>({isValid:l(m),errors:this.toSimpleErrors(l.errors,m),warnings:[]}),"validator")}toSimpleErrors(s,l){let _=[];return s?.forEach(m=>{m.keyword==="enum"&&m.params.allowedValues&&Array.isArray(m.params.allowedValues)&&(m.message+=`; ${m.params.allowedValues.join(", ")}`),m.instancePath&&(m.instancePath=m.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let b={details:{}},D=m.instancePath.split("/");if(D.length>2){let M=D[1],U=D[2]?parseInt(D[2]):0,ie=D[3],se=isNaN(U)?void 0:l[M][U][ie];b={details:{property:M,index:U,field:ie,fieldValue:se}}}if(m.keyword==="required"&&m.params.missingProperty&&m.instancePath&&(m.message=`A 'path' is missing required property '${m.params.missingProperty}'`),m.keyword==="additionalProperties"&&m.params.additionalProperty&&m.instancePath&&(m.message=`A 'path' should NOT include property '${m.params.additionalProperty}'`),m.keyword==="type"&&m.params.type&&m.instancePath){let M=m.instancePath.split("/"),U=M[M.length-1];m.message=`Value of property '${U}' must be '${m.params.type}'`}let A=Object.assign(m,b);_.push(A)}),_}};var C3=$ue.instance;C3.addSchema(X3e,"route-configuration.schema.json");C3.addSchema(__t,"policy-configuration.schema.json");C3.addSchema(K3e,"policies.schema.json");C3.addSchema(Y3e,"open-api-route-configuration.schema.json");C3.addSchema(f_t,"fragments.schema.json");var P5r=C3.compile(X3e),kmt=C3.compile(Y3e),_8e=C3.compile(K3e);var Jue=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=_8e(s),this.results}};var zue=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=kmt(s),this.results}};import Xmr from"path";var p8e=/\$import\((.*)\)/,que=/\$env\((.*?)\)/g;var _A=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,l,_,m){super(s),this.location={file:l,namespace:"",line:_?_.line:0,column:_?_.column:0,length:0,lineText:m??"",suggestion:""}}},Ymr=t(a=>{let s=[],l=a;for(;l.parent;)s.push(l),l=l.parent;return s.reverse()},"invertTree"),D3=t((a,s)=>{if(!a)return!1;let l=Ymr(a);return s.split("/").every((b,D)=>{let A=l[D];return A?b==="*"||oA(A)&&A.name.value===b?!0:b==="{}"?A.type===Ac.Object:b==="[]"?A.type===Ac.Array:!1:!1})},"testPosition");var Vue=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),IM(s)?s.children.forEach(l=>{this.visitor(l)}):c_t(s)?s.children.forEach(l=>{this.visitor(l)}):oA(s)&&this.visitor(s.value)}},wmt=t((a,s,l)=>_=>{if(!oA(_)||!OM(_.value)||typeof _.value.value!="string")return;if(!a.some(b=>D3(_,b))){que.test(_.value.value)&&s.push(new _A("An $env() statement is not expected at this location.",l,_.location,_.value.value));return}let m=new RegExp(que).exec(_.value.value);if(m?.length===2&&m[0]===_.value.value){let b={type:Ac.Raw,parent:null,value:`environment["${m[1]}"]`};_.value=b}else{let b=_.value.value.replaceAll(new RegExp(que),(D,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);b!==_.value.value&&(_.value=UE.createTemplateString(b,_))}},"getEnvStatementTransformer");var ZG="config/routes.json",Qmr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Zmr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Pmt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],ehr="handler/{}/options/{}/rewritePattern",thr="handler/{}/options/{}/baseUrl",Wue=class extends Vue{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let l=this.addedImports.get(s);if(!l)throw new Error("Import name is undefined. This should not happen.");return l}getImports(){let s=[];return this.addedImports.forEach((l,_)=>{s.push({name:l,path:_})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!oA(s)||!OM(s.value)||typeof s.value.value!="string")&&D3(s,ehr)){if(!s.parent||!IM(s.parent)){this.errors.push(new _A("Invalid node, expected object",ZG,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Amt(l)},m=UE.createProperty("__rewriteFunction",_,s);s.parent.children.push(m)}}rewriteForwardFunction(s){if(!(!oA(s)||!OM(s.value)||typeof s.value.value!="string")&&D3(s,thr)){if(!s.parent||!IM(s.parent)){this.errors.push(new _A("Invalid node, expected object",ZG,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Amt(l)},m=UE.createProperty("__rewriteFunction",_,s);s.parent.children.push(m)}}replaceImportStatements(s){if(!oA(s)||!OM(s.value))return;let l=s.value.value;if(typeof l!="string")return;if(!Zmr.some(A=>D3(s,A))&&!Pmt.some(A=>D3(s,A))){if(p8e.test(l)){if(s.name.value==="$ref")return;this.errors.push(new _A("An $import() statement is not expected at this location.",ZG,s.location,l))}return}let _=p8e.exec(l);if(Pmt.some(A=>D3(s,A))&&!_)return;if(!_){this.errors.push(new _A("Invalid $import() statement",ZG,s.location,l));return}let m=_[1];m.startsWith(".")&&(m=Xmr.join("..",m));let b=this.getImportName(m),D={type:Ac.Identifier,parent:s.parent,value:b};s.value=D}replaceEnvStatements=wmt(Qmr,this.errors,ZG)};function Amt(a){return`(request, context) => {
561
561
  const { params, url, query, method, headers } = request;
562
562
  const { host, hostname, origin, pathname, port, search } = new URL(url);
563
563
  const e = encodeURIComponent;
package/index.minified.js CHANGED
@@ -557,7 +557,7 @@ globstar while`,s,Z,l,Re,Pe),this.matchOne(s.slice(Z),l.slice(Re),_))return this
557
557
  >>> no match, partial?`,s,Z,l,Re),Z===M))}let ke;if(typeof ie=="string"?(ke=se===ie,this.debug("string match",ie,se,ke)):(ke=ie.test(se),this.debug("pattern match",ie,se,ke)),!ke)return!1}if(D===M&&A===U)return!0;if(D===M)return _;if(A===U)return D===M-1&&s[D]==="";throw new Error("wtf?")}braceExpand(){return Jat(this.pattern,this.options)}parse(s){hH(s);let l=this.options;if(s==="**")return F0;if(s==="")return"";let _,m=null;(_=s.match(rZt))?m=l.dot?iZt:nZt:(_=s.match(WQt))?m=(l.nocase?l.dot?YQt:KQt:l.dot?GQt:HQt)(_[1]):(_=s.match(sZt))?m=(l.nocase?l.dot?oZt:aZt:l.dot?cZt:lZt)(_):(_=s.match(XQt))?m=l.dot?ZQt:QQt:(_=s.match(eZt))&&(m=tZt);let b=QR.fromGlob(s,this.options).toMMPattern();return m&&typeof b=="object"&&Reflect.defineProperty(b,"test",{value:m}),b}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let s=this.set;if(!s.length)return this.regexp=!1,this.regexp;let l=this.options,_=l.noglobstar?_Zt:l.dot?pZt:dZt,m=new Set(l.nocase?["i"]:[]),b=s.map(M=>{let U=M.map(ie=>{if(ie instanceof RegExp)for(let se of ie.flags.split(""))m.add(se);return typeof ie=="string"?vZt(ie):ie===F0?F0:ie._src});return U.forEach((ie,se)=>{let Z=U[se+1],Re=U[se-1];ie!==F0||Re===F0||(Re===void 0?Z!==void 0&&Z!==F0?U[se+1]="(?:\\/|"+_+"\\/)?"+Z:U[se]=_:Z===void 0?U[se-1]=Re+"(?:\\/|"+_+")?":Z!==F0&&(U[se-1]=Re+"(?:\\/|\\/"+_+"\\/)"+Z,U[se+1]=F0))}),U.filter(ie=>ie!==F0).join("/")}).join("|"),[D,A]=s.length>1?["(?:",")"]:["",""];b="^"+D+b+A+"$",this.negate&&(b="^(?!"+b+").+$");try{this.regexp=new RegExp(b,[...m].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(s){return this.preserveMultipleSlashes?s.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(s)?["",...s.split(/\/+/)]:s.split(/\/+/)}match(s,l=this.partial){if(this.debug("match",s,this.pattern),this.comment)return!1;if(this.empty)return s==="";if(s==="/"&&l)return!0;let _=this.options;this.isWindows&&(s=s.split("\\").join("/"));let m=this.slashSplit(s);this.debug(this.pattern,"split",m);let b=this.set;this.debug(this.pattern,"set",b);let D=m[m.length-1];if(!D)for(let A=m.length-2;!D&&A>=0;A--)D=m[A];for(let A=0;A<b.length;A++){let M=b[A],U=m;if(_.matchBase&&M.length===1&&(U=[D]),this.matchOne(U,M,l))return _.flipNegate?!0:!this.negate}return _.flipNegate?!1:this.negate}static defaults(s){return j1.defaults(s).Minimatch}};j1.AST=QR;j1.Minimatch=B2;j1.escape=ZR;j1.unescape=kE;import{fileURLToPath as XZt}from"url";var eM=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,qat=new Set,o6e=typeof process=="object"&&process?process:{},Vat=t((a,s,l,_)=>{typeof o6e.emitWarning=="function"?o6e.emitWarning(a,s,l,_):console.error(`[${l}] ${s}: ${a}`)},"emitWarning"),Dce=globalThis.AbortController,zat=globalThis.AbortSignal;if(typeof Dce>"u"){zat=class{static{t(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(_,m){this._onabort.push(m)}},Dce=class{static{t(this,"AbortController")}constructor(){s()}signal=new zat;abort(_){if(!this.signal.aborted){this.signal.reason=_,this.signal.aborted=!0;for(let m of this.signal._onabort)m(_);this.signal.onabort?.(_)}}};let a=o6e.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",s=t(()=>{a&&(a=!1,Vat("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 bZt=t(a=>!qat.has(a),"shouldWarn"),c4r=Symbol("type"),e3=t(a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),"isPosInt"),Wat=t(a=>e3(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?tM:null:null,"getUintArray"),tM=class extends Array{static{t(this,"ZeroArray")}constructor(s){super(s),this.fill(0)}},c6e=class a{static{t(this,"Stack")}heap;length;static#r=!1;static create(s){let l=Wat(s);if(!l)return[];a.#r=!0;let _=new a(s,l);return a.#r=!1,_}constructor(s,l){if(!a.#r)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new l(s),this.length=0}push(s){this.heap[this.length++]=s}pop(){return this.heap[--this.length]}},yH=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;#C;#x;#b;#k;#E;#y;static unsafeExposeInternals(s){return{starts:s.#x,ttls:s.#b,sizes:s.#C,keyMap:s.#c,keyList:s.#l,valList:s.#i,next:s.#f,prev:s.#v,get head(){return s.#d},get tail(){return s.#u},free:s.#m,isBackgroundFetch:t(l=>s.#h(l),"isBackgroundFetch"),backgroundFetch:t((l,_,m,b)=>s.#j(l,_,m,b),"backgroundFetch"),moveToTail:t(l=>s.#U(l),"moveToTail"),indexes:t(l=>s.#P(l),"indexes"),rindexes:t(l=>s.#A(l),"rindexes"),isStale:t(l=>s.#S(l),"isStale")}}get max(){return this.#r}get maxSize(){return this.#n}get calculatedSize(){return this.#_}get size(){return this.#a}get fetchMethod(){return this.#s}get memoMethod(){return this.#p}get dispose(){return this.#e}get disposeAfter(){return this.#t}constructor(s){let{max:l=0,ttl:_,ttlResolution:m=1,ttlAutopurge:b,updateAgeOnGet:D,updateAgeOnHas:A,allowStale:M,dispose:U,disposeAfter:ie,noDisposeOnSet:se,noUpdateTTL:Z,maxSize:Re=0,maxEntrySize:Pe=0,sizeCalculation:ke,fetchMethod:wt,memoMethod:At,noDeleteOnFetchRejection:yr,noDeleteOnStaleGet:zr,allowStaleOnFetchRejection:en,allowStaleOnFetchAbort:hn,ignoreFetchAbort:br}=s;if(l!==0&&!e3(l))throw new TypeError("max option must be a nonnegative integer");let mr=l?Wat(l):Array;if(!mr)throw new Error("invalid max value: "+l);if(this.#r=l,this.#n=Re,this.maxEntrySize=Pe||this.#n,this.sizeCalculation=ke,this.sizeCalculation){if(!this.#n&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(At!==void 0&&typeof At!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#p=At,wt!==void 0&&typeof wt!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#s=wt,this.#E=!!wt,this.#c=new Map,this.#l=new Array(l).fill(void 0),this.#i=new Array(l).fill(void 0),this.#f=new mr(l),this.#v=new mr(l),this.#d=0,this.#u=0,this.#m=c6e.create(l),this.#a=0,this.#_=0,typeof U=="function"&&(this.#e=U),typeof ie=="function"?(this.#t=ie,this.#g=[]):(this.#t=void 0,this.#g=void 0),this.#k=!!this.#e,this.#y=!!this.#t,this.noDisposeOnSet=!!se,this.noUpdateTTL=!!Z,this.noDeleteOnFetchRejection=!!yr,this.allowStaleOnFetchRejection=!!en,this.allowStaleOnFetchAbort=!!hn,this.ignoreFetchAbort=!!br,this.maxEntrySize!==0){if(this.#n!==0&&!e3(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!e3(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#T()}if(this.allowStale=!!M,this.noDeleteOnStaleGet=!!zr,this.updateAgeOnGet=!!D,this.updateAgeOnHas=!!A,this.ttlResolution=e3(m)||m===0?m:1,this.ttlAutopurge=!!b,this.ttl=_||0,this.ttl){if(!e3(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#D()}if(this.#r===0&&this.ttl===0&&this.#n===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#r&&!this.#n){let Is="LRU_CACHE_UNBOUNDED";bZt(Is)&&(qat.add(Is),Vat("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Is,a))}}getRemainingTTL(s){return this.#c.has(s)?1/0:0}#D(){let s=new tM(this.#r),l=new tM(this.#r);this.#b=s,this.#x=l,this.#N=(b,D,A=eM.now())=>{if(l[b]=D!==0?A:0,s[b]=D,D!==0&&this.ttlAutopurge){let M=setTimeout(()=>{this.#S(b)&&this.#O(this.#l[b],"expire")},D+1);M.unref&&M.unref()}},this.#w=b=>{l[b]=s[b]!==0?eM.now():0},this.#o=(b,D)=>{if(s[D]){let A=s[D],M=l[D];if(!A||!M)return;b.ttl=A,b.start=M,b.now=_||m();let U=b.now-M;b.remainingTTL=A-U}};let _=0,m=t(()=>{let b=eM.now();if(this.ttlResolution>0){_=b;let D=setTimeout(()=>_=0,this.ttlResolution);D.unref&&D.unref()}return b},"getNow");this.getRemainingTTL=b=>{let D=this.#c.get(b);if(D===void 0)return 0;let A=s[D],M=l[D];if(!A||!M)return 1/0;let U=(_||m())-M;return A-U},this.#S=b=>{let D=l[b],A=s[b];return!!A&&!!D&&(_||m())-D>A}}#w=t(()=>{},"#updateItemAge");#o=t(()=>{},"#statusTTL");#N=t(()=>{},"#setItemTTL");#S=t(()=>!1,"#isStale");#T(){let s=new tM(this.#r);this.#_=0,this.#C=s,this.#I=l=>{this.#_-=s[l],s[l]=0},this.#L=(l,_,m,b)=>{if(this.#h(_))return 0;if(!e3(m))if(b){if(typeof b!="function")throw new TypeError("sizeCalculation must be a function");if(m=b(_,l),!e3(m))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return m},this.#F=(l,_,m)=>{if(s[l]=_,this.#n){let b=this.#n-s[l];for(;this.#_>b;)this.#M(!0)}this.#_+=s[l],m&&(m.entrySize=_,m.totalCalculatedSize=this.#_)}}#I=t(s=>{},"#removeItemSize");#F=t((s,l,_)=>{},"#addItemSize");#L=t((s,l,_,m)=>{if(_||m)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#P({allowStale:s=this.allowStale}={}){if(this.#a)for(let l=this.#u;!(!this.#R(l)||((s||!this.#S(l))&&(yield l),l===this.#d));)l=this.#v[l]}*#A({allowStale:s=this.allowStale}={}){if(this.#a)for(let l=this.#d;!(!this.#R(l)||((s||!this.#S(l))&&(yield l),l===this.#u));)l=this.#f[l]}#R(s){return s!==void 0&&this.#c.get(this.#l[s])===s}*entries(){for(let s of this.#P())this.#i[s]!==void 0&&this.#l[s]!==void 0&&!this.#h(this.#i[s])&&(yield[this.#l[s],this.#i[s]])}*rentries(){for(let s of this.#A())this.#i[s]!==void 0&&this.#l[s]!==void 0&&!this.#h(this.#i[s])&&(yield[this.#l[s],this.#i[s]])}*keys(){for(let s of this.#P()){let l=this.#l[s];l!==void 0&&!this.#h(this.#i[s])&&(yield l)}}*rkeys(){for(let s of this.#A()){let l=this.#l[s];l!==void 0&&!this.#h(this.#i[s])&&(yield l)}}*values(){for(let s of this.#P())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}*rvalues(){for(let s of this.#A())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(s,l={}){for(let _ of this.#P()){let m=this.#i[_],b=this.#h(m)?m.__staleWhileFetching:m;if(b!==void 0&&s(b,this.#l[_],this))return this.get(this.#l[_],l)}}forEach(s,l=this){for(let _ of this.#P()){let m=this.#i[_],b=this.#h(m)?m.__staleWhileFetching:m;b!==void 0&&s.call(l,b,this.#l[_],this)}}rforEach(s,l=this){for(let _ of this.#A()){let m=this.#i[_],b=this.#h(m)?m.__staleWhileFetching:m;b!==void 0&&s.call(l,b,this.#l[_],this)}}purgeStale(){let s=!1;for(let l of this.#A({allowStale:!0}))this.#S(l)&&(this.#O(this.#l[l],"expire"),s=!0);return s}info(s){let l=this.#c.get(s);if(l===void 0)return;let _=this.#i[l],m=this.#h(_)?_.__staleWhileFetching:_;if(m===void 0)return;let b={value:m};if(this.#b&&this.#x){let D=this.#b[l],A=this.#x[l];if(D&&A){let M=D-(eM.now()-A);b.ttl=M,b.start=Date.now()}}return this.#C&&(b.size=this.#C[l]),b}dump(){let s=[];for(let l of this.#P({allowStale:!0})){let _=this.#l[l],m=this.#i[l],b=this.#h(m)?m.__staleWhileFetching:m;if(b===void 0||_===void 0)continue;let D={value:b};if(this.#b&&this.#x){D.ttl=this.#b[l];let A=eM.now()-this.#x[l];D.start=Math.floor(Date.now()-A)}this.#C&&(D.size=this.#C[l]),s.unshift([_,D])}return s}load(s){this.clear();for(let[l,_]of s){if(_.start){let m=Date.now()-_.start;_.start=eM.now()-m}this.set(l,_.value,_)}}set(s,l,_={}){if(l===void 0)return this.delete(s),this;let{ttl:m=this.ttl,start:b,noDisposeOnSet:D=this.noDisposeOnSet,sizeCalculation:A=this.sizeCalculation,status:M}=_,{noUpdateTTL:U=this.noUpdateTTL}=_,ie=this.#L(s,l,_.size||0,A);if(this.maxEntrySize&&ie>this.maxEntrySize)return M&&(M.set="miss",M.maxEntrySizeExceeded=!0),this.#O(s,"set"),this;let se=this.#a===0?void 0:this.#c.get(s);if(se===void 0)se=this.#a===0?this.#u:this.#m.length!==0?this.#m.pop():this.#a===this.#r?this.#M(!1):this.#a,this.#l[se]=s,this.#i[se]=l,this.#c.set(s,se),this.#f[this.#u]=se,this.#v[se]=this.#u,this.#u=se,this.#a++,this.#F(se,ie,M),M&&(M.set="add"),U=!1;else{this.#U(se);let Z=this.#i[se];if(l!==Z){if(this.#E&&this.#h(Z)){Z.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Re}=Z;Re!==void 0&&!D&&(this.#k&&this.#e?.(Re,s,"set"),this.#y&&this.#g?.push([Re,s,"set"]))}else D||(this.#k&&this.#e?.(Z,s,"set"),this.#y&&this.#g?.push([Z,s,"set"]));if(this.#I(se),this.#F(se,ie,M),this.#i[se]=l,M){M.set="replace";let Re=Z&&this.#h(Z)?Z.__staleWhileFetching:Z;Re!==void 0&&(M.oldValue=Re)}}else M&&(M.set="update")}if(m!==0&&!this.#b&&this.#D(),this.#b&&(U||this.#N(se,m,b),M&&this.#o(M,se)),!D&&this.#y&&this.#g){let Z=this.#g,Re;for(;Re=Z?.shift();)this.#t?.(...Re)}return this}pop(){try{for(;this.#a;){let s=this.#i[this.#d];if(this.#M(!0),this.#h(s)){if(s.__staleWhileFetching)return s.__staleWhileFetching}else if(s!==void 0)return s}}finally{if(this.#y&&this.#g){let s=this.#g,l;for(;l=s?.shift();)this.#t?.(...l)}}}#M(s){let l=this.#d,_=this.#l[l],m=this.#i[l];return this.#E&&this.#h(m)?m.__abortController.abort(new Error("evicted")):(this.#k||this.#y)&&(this.#k&&this.#e?.(m,_,"evict"),this.#y&&this.#g?.push([m,_,"evict"])),this.#I(l),s&&(this.#l[l]=void 0,this.#i[l]=void 0,this.#m.push(l)),this.#a===1?(this.#d=this.#u=0,this.#m.length=0):this.#d=this.#f[l],this.#c.delete(_),this.#a--,l}has(s,l={}){let{updateAgeOnHas:_=this.updateAgeOnHas,status:m}=l,b=this.#c.get(s);if(b!==void 0){let D=this.#i[b];if(this.#h(D)&&D.__staleWhileFetching===void 0)return!1;if(this.#S(b))m&&(m.has="stale",this.#o(m,b));else return _&&this.#w(b),m&&(m.has="hit",this.#o(m,b)),!0}else m&&(m.has="miss");return!1}peek(s,l={}){let{allowStale:_=this.allowStale}=l,m=this.#c.get(s);if(m===void 0||!_&&this.#S(m))return;let b=this.#i[m];return this.#h(b)?b.__staleWhileFetching:b}#j(s,l,_,m){let b=l===void 0?void 0:this.#i[l];if(this.#h(b))return b;let D=new Dce,{signal:A}=_;A?.addEventListener("abort",()=>D.abort(A.reason),{signal:D.signal});let M={signal:D.signal,options:_,context:m},U=t((ke,wt=!1)=>{let{aborted:At}=D.signal,yr=_.ignoreFetchAbort&&ke!==void 0;if(_.status&&(At&&!wt?(_.status.fetchAborted=!0,_.status.fetchError=D.signal.reason,yr&&(_.status.fetchAbortIgnored=!0)):_.status.fetchResolved=!0),At&&!yr&&!wt)return se(D.signal.reason);let zr=Re;return this.#i[l]===Re&&(ke===void 0?zr.__staleWhileFetching?this.#i[l]=zr.__staleWhileFetching:this.#O(s,"fetch"):(_.status&&(_.status.fetchUpdated=!0),this.set(s,ke,M.options))),ke},"cb"),ie=t(ke=>(_.status&&(_.status.fetchRejected=!0,_.status.fetchError=ke),se(ke)),"eb"),se=t(ke=>{let{aborted:wt}=D.signal,At=wt&&_.allowStaleOnFetchAbort,yr=At||_.allowStaleOnFetchRejection,zr=yr||_.noDeleteOnFetchRejection,en=Re;if(this.#i[l]===Re&&(!zr||en.__staleWhileFetching===void 0?this.#O(s,"fetch"):At||(this.#i[l]=en.__staleWhileFetching)),yr)return _.status&&en.__staleWhileFetching!==void 0&&(_.status.returnedStale=!0),en.__staleWhileFetching;if(en.__returned===en)throw ke},"fetchFail"),Z=t((ke,wt)=>{let At=this.#s?.(s,b,M);At&&At instanceof Promise&&At.then(yr=>ke(yr===void 0?void 0:yr),wt),D.signal.addEventListener("abort",()=>{(!_.ignoreFetchAbort||_.allowStaleOnFetchAbort)&&(ke(void 0),_.allowStaleOnFetchAbort&&(ke=t(yr=>U(yr,!0),"res")))})},"pcall");_.status&&(_.status.fetchDispatched=!0);let Re=new Promise(Z).then(U,ie),Pe=Object.assign(Re,{__abortController:D,__staleWhileFetching:b,__returned:void 0});return l===void 0?(this.set(s,Pe,{...M.options,status:void 0}),l=this.#c.get(s)):this.#i[l]=Pe,Pe}#h(s){if(!this.#E)return!1;let l=s;return!!l&&l instanceof Promise&&l.hasOwnProperty("__staleWhileFetching")&&l.__abortController instanceof Dce}async fetch(s,l={}){let{allowStale:_=this.allowStale,updateAgeOnGet:m=this.updateAgeOnGet,noDeleteOnStaleGet:b=this.noDeleteOnStaleGet,ttl:D=this.ttl,noDisposeOnSet:A=this.noDisposeOnSet,size:M=0,sizeCalculation:U=this.sizeCalculation,noUpdateTTL:ie=this.noUpdateTTL,noDeleteOnFetchRejection:se=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Z=this.allowStaleOnFetchRejection,ignoreFetchAbort:Re=this.ignoreFetchAbort,allowStaleOnFetchAbort:Pe=this.allowStaleOnFetchAbort,context:ke,forceRefresh:wt=!1,status:At,signal:yr}=l;if(!this.#E)return At&&(At.fetch="get"),this.get(s,{allowStale:_,updateAgeOnGet:m,noDeleteOnStaleGet:b,status:At});let zr={allowStale:_,updateAgeOnGet:m,noDeleteOnStaleGet:b,ttl:D,noDisposeOnSet:A,size:M,sizeCalculation:U,noUpdateTTL:ie,noDeleteOnFetchRejection:se,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:Pe,ignoreFetchAbort:Re,status:At,signal:yr},en=this.#c.get(s);if(en===void 0){At&&(At.fetch="miss");let hn=this.#j(s,en,zr,ke);return hn.__returned=hn}else{let hn=this.#i[en];if(this.#h(hn)){let Po=_&&hn.__staleWhileFetching!==void 0;return At&&(At.fetch="inflight",Po&&(At.returnedStale=!0)),Po?hn.__staleWhileFetching:hn.__returned=hn}let br=this.#S(en);if(!wt&&!br)return At&&(At.fetch="hit"),this.#U(en),m&&this.#w(en),At&&this.#o(At,en),hn;let mr=this.#j(s,en,zr,ke),Pi=mr.__staleWhileFetching!==void 0&&_;return At&&(At.fetch=br?"stale":"refresh",Pi&&br&&(At.returnedStale=!0)),Pi?mr.__staleWhileFetching:mr.__returned=mr}}async forceFetch(s,l={}){let _=await this.fetch(s,l);if(_===void 0)throw new Error("fetch() returned undefined");return _}memo(s,l={}){let _=this.#p;if(!_)throw new Error("no memoMethod provided to constructor");let{context:m,forceRefresh:b,...D}=l,A=this.get(s,D);if(!b&&A!==void 0)return A;let M=_(s,A,{options:D,context:m});return this.set(s,M,D),M}get(s,l={}){let{allowStale:_=this.allowStale,updateAgeOnGet:m=this.updateAgeOnGet,noDeleteOnStaleGet:b=this.noDeleteOnStaleGet,status:D}=l,A=this.#c.get(s);if(A!==void 0){let M=this.#i[A],U=this.#h(M);return D&&this.#o(D,A),this.#S(A)?(D&&(D.get="stale"),U?(D&&_&&M.__staleWhileFetching!==void 0&&(D.returnedStale=!0),_?M.__staleWhileFetching:void 0):(b||this.#O(s,"expire"),D&&_&&(D.returnedStale=!0),_?M:void 0)):(D&&(D.get="hit"),U?M.__staleWhileFetching:(this.#U(A),m&&this.#w(A),M))}else D&&(D.get="miss")}#B(s,l){this.#v[l]=s,this.#f[s]=l}#U(s){s!==this.#u&&(s===this.#d?this.#d=this.#f[s]:this.#B(this.#v[s],this.#f[s]),this.#B(this.#u,s),this.#u=s)}delete(s){return this.#O(s,"delete")}#O(s,l){let _=!1;if(this.#a!==0){let m=this.#c.get(s);if(m!==void 0)if(_=!0,this.#a===1)this.#$(l);else{this.#I(m);let b=this.#i[m];if(this.#h(b)?b.__abortController.abort(new Error("deleted")):(this.#k||this.#y)&&(this.#k&&this.#e?.(b,s,l),this.#y&&this.#g?.push([b,s,l])),this.#c.delete(s),this.#l[m]=void 0,this.#i[m]=void 0,m===this.#u)this.#u=this.#v[m];else if(m===this.#d)this.#d=this.#f[m];else{let D=this.#v[m];this.#f[D]=this.#f[m];let A=this.#f[m];this.#v[A]=this.#v[m]}this.#a--,this.#m.push(m)}}if(this.#y&&this.#g?.length){let m=this.#g,b;for(;b=m?.shift();)this.#t?.(...b)}return _}clear(){return this.#$("delete")}#$(s){for(let l of this.#A({allowStale:!0})){let _=this.#i[l];if(this.#h(_))_.__abortController.abort(new Error("deleted"));else{let m=this.#l[l];this.#k&&this.#e?.(_,m,s),this.#y&&this.#g?.push([_,m,s])}}if(this.#c.clear(),this.#i.fill(void 0),this.#l.fill(void 0),this.#b&&this.#x&&(this.#b.fill(0),this.#x.fill(0)),this.#C&&this.#C.fill(0),this.#d=0,this.#u=0,this.#m.length=0,this.#_=0,this.#a=0,this.#y&&this.#g){let l=this.#g,_;for(;_=l?.shift();)this.#t?.(..._)}}};import{posix as NZt,win32 as y6e}from"path";import{fileURLToPath as IZt}from"url";import{lstatSync as OZt,readdir as FZt,readdirSync as LZt,readlinkSync as RZt,realpathSync as MZt}from"fs";import*as jZt from"fs";import{lstat as UZt,readdir as $Zt,readlink as JZt,realpath as zZt}from"fs/promises";import{EventEmitter as m6e}from"events";import Xat from"stream";import{StringDecoder as SZt}from"string_decoder";var Hat=typeof process=="object"&&process?process:{stdout:null,stderr:null},TZt=t(a=>!!a&&typeof a=="object"&&(a instanceof r3||a instanceof Xat||xZt(a)||EZt(a)),"isStream"),xZt=t(a=>!!a&&typeof a=="object"&&a instanceof m6e&&typeof a.pipe=="function"&&a.pipe!==Xat.Writable.prototype.pipe,"isReadable"),EZt=t(a=>!!a&&typeof a=="object"&&a instanceof m6e&&typeof a.write=="function"&&typeof a.end=="function","isWritable"),GP=Symbol("EOF"),KP=Symbol("maybeEmitEnd"),t3=Symbol("emittedEnd"),kce=Symbol("emittingEnd"),vH=Symbol("emittedError"),wce=Symbol("closed"),Gat=Symbol("read"),Pce=Symbol("flush"),Kat=Symbol("flushChunk"),wE=Symbol("encoding"),rM=Symbol("decoder"),Gg=Symbol("flowing"),bH=Symbol("paused"),nM=Symbol("resume"),Kg=Symbol("buffer"),B1=Symbol("pipes"),Yg=Symbol("bufferLength"),l6e=Symbol("bufferPush"),Ace=Symbol("bufferShift"),Ny=Symbol("objectMode"),Gm=Symbol("destroyed"),u6e=Symbol("error"),f6e=Symbol("emitData"),Yat=Symbol("emitEnd"),_6e=Symbol("emitEnd2"),HD=Symbol("async"),p6e=Symbol("abort"),Nce=Symbol("aborted"),SH=Symbol("signal"),TO=Symbol("dataListeners"),U2=Symbol("discarded"),TH=t(a=>Promise.resolve().then(a),"defer"),CZt=t(a=>a(),"nodefer"),DZt=t(a=>a==="end"||a==="finish"||a==="prefinish","isEndish"),kZt=t(a=>a instanceof ArrayBuffer||!!a&&typeof a=="object"&&a.constructor&&a.constructor.name==="ArrayBuffer"&&a.byteLength>=0,"isArrayBufferLike"),wZt=t(a=>!Buffer.isBuffer(a)&&ArrayBuffer.isView(a),"isArrayBufferView"),Ice=class{static{t(this,"Pipe")}src;dest;opts;ondrain;constructor(s,l,_){this.src=s,this.dest=l,this.opts=_,this.ondrain=()=>s[nM](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(s){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},d6e=class extends Ice{static{t(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(s,l,_){super(s,l,_),this.proxyErrors=m=>l.emit("error",m),s.on("error",this.proxyErrors)}},PZt=t(a=>!!a.objectMode,"isObjectModeOptions"),AZt=t(a=>!a.objectMode&&!!a.encoding&&a.encoding!=="buffer","isEncodingOptions"),r3=class extends m6e{static{t(this,"Minipass")}[Gg]=!1;[bH]=!1;[B1]=[];[Kg]=[];[Ny];[wE];[HD];[rM];[GP]=!1;[t3]=!1;[kce]=!1;[wce]=!1;[vH]=null;[Yg]=0;[Gm]=!1;[SH];[Nce]=!1;[TO]=0;[U2]=!1;writable=!0;readable=!0;constructor(...s){let l=s[0]||{};if(super(),l.objectMode&&typeof l.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");PZt(l)?(this[Ny]=!0,this[wE]=null):AZt(l)?(this[wE]=l.encoding,this[Ny]=!1):(this[Ny]=!1,this[wE]=null),this[HD]=!!l.async,this[rM]=this[wE]?new SZt(this[wE]):null,l&&l.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:t(()=>this[Kg],"get")}),l&&l.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:t(()=>this[B1],"get")});let{signal:_}=l;_&&(this[SH]=_,_.aborted?this[p6e]():_.addEventListener("abort",()=>this[p6e]()))}get bufferLength(){return this[Yg]}get encoding(){return this[wE]}set encoding(s){throw new Error("Encoding must be set at instantiation time")}setEncoding(s){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Ny]}set objectMode(s){throw new Error("objectMode must be set at instantiation time")}get async(){return this[HD]}set async(s){this[HD]=this[HD]||!!s}[p6e](){this[Nce]=!0,this.emit("abort",this[SH]?.reason),this.destroy(this[SH]?.reason)}get aborted(){return this[Nce]}set aborted(s){}write(s,l,_){if(this[Nce])return!1;if(this[GP])throw new Error("write after end");if(this[Gm])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof l=="function"&&(_=l,l="utf8"),l||(l="utf8");let m=this[HD]?TH:CZt;if(!this[Ny]&&!Buffer.isBuffer(s)){if(wZt(s))s=Buffer.from(s.buffer,s.byteOffset,s.byteLength);else if(kZt(s))s=Buffer.from(s);else if(typeof s!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Ny]?(this[Gg]&&this[Yg]!==0&&this[Pce](!0),this[Gg]?this.emit("data",s):this[l6e](s),this[Yg]!==0&&this.emit("readable"),_&&m(_),this[Gg]):s.length?(typeof s=="string"&&!(l===this[wE]&&!this[rM]?.lastNeed)&&(s=Buffer.from(s,l)),Buffer.isBuffer(s)&&this[wE]&&(s=this[rM].write(s)),this[Gg]&&this[Yg]!==0&&this[Pce](!0),this[Gg]?this.emit("data",s):this[l6e](s),this[Yg]!==0&&this.emit("readable"),_&&m(_),this[Gg]):(this[Yg]!==0&&this.emit("readable"),_&&m(_),this[Gg])}read(s){if(this[Gm])return null;if(this[U2]=!1,this[Yg]===0||s===0||s&&s>this[Yg])return this[KP](),null;this[Ny]&&(s=null),this[Kg].length>1&&!this[Ny]&&(this[Kg]=[this[wE]?this[Kg].join(""):Buffer.concat(this[Kg],this[Yg])]);let l=this[Gat](s||null,this[Kg][0]);return this[KP](),l}[Gat](s,l){if(this[Ny])this[Ace]();else{let _=l;s===_.length||s===null?this[Ace]():typeof _=="string"?(this[Kg][0]=_.slice(s),l=_.slice(0,s),this[Yg]-=s):(this[Kg][0]=_.subarray(s),l=_.subarray(0,s),this[Yg]-=s)}return this.emit("data",l),!this[Kg].length&&!this[GP]&&this.emit("drain"),l}end(s,l,_){return typeof s=="function"&&(_=s,s=void 0),typeof l=="function"&&(_=l,l="utf8"),s!==void 0&&this.write(s,l),_&&this.once("end",_),this[GP]=!0,this.writable=!1,(this[Gg]||!this[bH])&&this[KP](),this}[nM](){this[Gm]||(!this[TO]&&!this[B1].length&&(this[U2]=!0),this[bH]=!1,this[Gg]=!0,this.emit("resume"),this[Kg].length?this[Pce]():this[GP]?this[KP]():this.emit("drain"))}resume(){return this[nM]()}pause(){this[Gg]=!1,this[bH]=!0,this[U2]=!1}get destroyed(){return this[Gm]}get flowing(){return this[Gg]}get paused(){return this[bH]}[l6e](s){this[Ny]?this[Yg]+=1:this[Yg]+=s.length,this[Kg].push(s)}[Ace](){return this[Ny]?this[Yg]-=1:this[Yg]-=this[Kg][0].length,this[Kg].shift()}[Pce](s=!1){do;while(this[Kat](this[Ace]())&&this[Kg].length);!s&&!this[Kg].length&&!this[GP]&&this.emit("drain")}[Kat](s){return this.emit("data",s),this[Gg]}pipe(s,l){if(this[Gm])return s;this[U2]=!1;let _=this[t3];return l=l||{},s===Hat.stdout||s===Hat.stderr?l.end=!1:l.end=l.end!==!1,l.proxyErrors=!!l.proxyErrors,_?l.end&&s.end():(this[B1].push(l.proxyErrors?new d6e(this,s,l):new Ice(this,s,l)),this[HD]?TH(()=>this[nM]()):this[nM]()),s}unpipe(s){let l=this[B1].find(_=>_.dest===s);l&&(this[B1].length===1?(this[Gg]&&this[TO]===0&&(this[Gg]=!1),this[B1]=[]):this[B1].splice(this[B1].indexOf(l),1),l.unpipe())}addListener(s,l){return this.on(s,l)}on(s,l){let _=super.on(s,l);if(s==="data")this[U2]=!1,this[TO]++,!this[B1].length&&!this[Gg]&&this[nM]();else if(s==="readable"&&this[Yg]!==0)super.emit("readable");else if(DZt(s)&&this[t3])super.emit(s),this.removeAllListeners(s);else if(s==="error"&&this[vH]){let m=l;this[HD]?TH(()=>m.call(this,this[vH])):m.call(this,this[vH])}return _}removeListener(s,l){return this.off(s,l)}off(s,l){let _=super.off(s,l);return s==="data"&&(this[TO]=this.listeners("data").length,this[TO]===0&&!this[U2]&&!this[B1].length&&(this[Gg]=!1)),_}removeAllListeners(s){let l=super.removeAllListeners(s);return(s==="data"||s===void 0)&&(this[TO]=0,!this[U2]&&!this[B1].length&&(this[Gg]=!1)),l}get emittedEnd(){return this[t3]}[KP](){!this[kce]&&!this[t3]&&!this[Gm]&&this[Kg].length===0&&this[GP]&&(this[kce]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[wce]&&this.emit("close"),this[kce]=!1)}emit(s,...l){let _=l[0];if(s!=="error"&&s!=="close"&&s!==Gm&&this[Gm])return!1;if(s==="data")return!this[Ny]&&!_?!1:this[HD]?(TH(()=>this[f6e](_)),!0):this[f6e](_);if(s==="end")return this[Yat]();if(s==="close"){if(this[wce]=!0,!this[t3]&&!this[Gm])return!1;let b=super.emit("close");return this.removeAllListeners("close"),b}else if(s==="error"){this[vH]=_,super.emit(u6e,_);let b=!this[SH]||this.listeners("error").length?super.emit("error",_):!1;return this[KP](),b}else if(s==="resume"){let b=super.emit("resume");return this[KP](),b}else if(s==="finish"||s==="prefinish"){let b=super.emit(s);return this.removeAllListeners(s),b}let m=super.emit(s,...l);return this[KP](),m}[f6e](s){for(let _ of this[B1])_.dest.write(s)===!1&&this.pause();let l=this[U2]?!1:super.emit("data",s);return this[KP](),l}[Yat](){return this[t3]?!1:(this[t3]=!0,this.readable=!1,this[HD]?(TH(()=>this[_6e]()),!0):this[_6e]())}[_6e](){if(this[rM]){let l=this[rM].end();if(l){for(let _ of this[B1])_.dest.write(l);this[U2]||super.emit("data",l)}}for(let l of this[B1])l.end();let s=super.emit("end");return this.removeAllListeners("end"),s}async collect(){let s=Object.assign([],{dataLength:0});this[Ny]||(s.dataLength=0);let l=this.promise();return this.on("data",_=>{s.push(_),this[Ny]||(s.dataLength+=_.length)}),await l,s}async concat(){if(this[Ny])throw new Error("cannot concat in objectMode");let s=await this.collect();return this[wE]?s.join(""):Buffer.concat(s,s.dataLength)}async promise(){return new Promise((s,l)=>{this.on(Gm,()=>l(new Error("stream destroyed"))),this.on("error",_=>l(_)),this.on("end",()=>s())})}[Symbol.asyncIterator](){this[U2]=!1;let s=!1,l=t(async()=>(this.pause(),s=!0,{value:void 0,done:!0}),"stop");return{next:t(()=>{if(s)return l();let m=this.read();if(m!==null)return Promise.resolve({done:!1,value:m});if(this[GP])return l();let b,D,A=t(se=>{this.off("data",M),this.off("end",U),this.off(Gm,ie),l(),D(se)},"onerr"),M=t(se=>{this.off("error",A),this.off("end",U),this.off(Gm,ie),this.pause(),b({value:se,done:!!this[GP]})},"ondata"),U=t(()=>{this.off("error",A),this.off("data",M),this.off(Gm,ie),l(),b({done:!0,value:void 0})},"onend"),ie=t(()=>A(new Error("stream destroyed")),"ondestroy");return new Promise((se,Z)=>{D=Z,b=se,this.once(Gm,ie),this.once("error",A),this.once("end",U),this.once("data",M)})},"next"),throw:l,return:l,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[U2]=!1;let s=!1,l=t(()=>(this.pause(),this.off(u6e,l),this.off(Gm,l),this.off("end",l),s=!0,{done:!0,value:void 0}),"stop"),_=t(()=>{if(s)return l();let m=this.read();return m===null?l():{done:!1,value:m}},"next");return this.once("end",l),this.once(u6e,l),this.once(Gm,l),{next:_,throw:l,return:l,[Symbol.iterator](){return this}}}destroy(s){if(this[Gm])return s?this.emit("error",s):this.emit(Gm),this;this[Gm]=!0,this[U2]=!0,this[Kg].length=0,this[Yg]=0;let l=this;return typeof l.close=="function"&&!this[wce]&&l.close(),s?this.emit("error",s):this.emit(Gm),this}static get isStream(){return TZt}};var BZt=MZt.native,EH={lstatSync:OZt,readdir:FZt,readdirSync:LZt,readlinkSync:RZt,realpathSync:BZt,promises:{lstat:UZt,readdir:$Zt,readlink:JZt,realpath:zZt}},rot=t(a=>!a||a===EH||a===jZt?EH:{...EH,...a,promises:{...EH.promises,...a.promises||{}}},"fsFromOption"),not=/^\\\\\?\\([a-z]:)\\?$/i,qZt=t(a=>a.replace(/\//g,"\\").replace(not,"$1\\"),"uncToDrive"),VZt=/[\\\/]/,bT=0,iot=1,sot=2,GD=4,aot=6,oot=8,xO=10,cot=12,vT=15,xH=~vT,h6e=16,Qat=32,CH=64,PE=128,Oce=256,Lce=512,Zat=CH|PE|Lce,WZt=1023,g6e=t(a=>a.isFile()?oot:a.isDirectory()?GD:a.isSymbolicLink()?xO:a.isCharacterDevice()?sot:a.isBlockDevice()?aot:a.isSocket()?cot:a.isFIFO()?iot:bT,"entToType"),eot=new Map,DH=t(a=>{let s=eot.get(a);if(s)return s;let l=a.normalize("NFKD");return eot.set(a,l),l},"normalize"),tot=new Map,Fce=t(a=>{let s=tot.get(a);if(s)return s;let l=DH(a.toLowerCase());return tot.set(a,l),l},"normalizeNocase"),Rce=class extends yH{static{t(this,"ResolveCache")}constructor(){super({max:256})}},v6e=class extends yH{static{t(this,"ChildrenCache")}constructor(s=16*1024){super({maxSize:s,sizeCalculation:t(l=>l.length+1,"sizeCalculation")})}},lot=Symbol("PathScurry setAsCwd"),Iy=class{static{t(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#r;#n;get dev(){return this.#n}#e;get mode(){return this.#e}#t;get nlink(){return this.#t}#s;get uid(){return this.#s}#p;get gid(){return this.#p}#a;get rdev(){return this.#a}#_;get blksize(){return this.#_}#c;get ino(){return this.#c}#l;get size(){return this.#l}#i;get blocks(){return this.#i}#f;get atimeMs(){return this.#f}#v;get mtimeMs(){return this.#v}#d;get ctimeMs(){return this.#d}#u;get birthtimeMs(){return this.#u}#m;get atime(){return this.#m}#g;get mtime(){return this.#g}#C;get ctime(){return this.#C}#x;get birthtime(){return this.#x}#b;#k;#E;#y;#D;#w;#o;#N;#S;#T;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(s,l=bT,_,m,b,D,A){this.name=s,this.#b=b?Fce(s):DH(s),this.#o=l&WZt,this.nocase=b,this.roots=m,this.root=_||this,this.#N=D,this.#E=A.fullpath,this.#D=A.relative,this.#w=A.relativePosix,this.parent=A.parent,this.parent?this.#r=this.parent.#r:this.#r=rot(A.fs)}depth(){return this.#k!==void 0?this.#k:this.parent?this.#k=this.parent.depth()+1:this.#k=0}childrenCache(){return this.#N}resolve(s){if(!s)return this;let l=this.getRootString(s),m=s.substring(l.length).split(this.splitSep);return l?this.getRoot(l).#I(m):this.#I(m)}#I(s){let l=this;for(let _ of s)l=l.child(_);return l}children(){let s=this.#N.get(this);if(s)return s;let l=Object.assign([],{provisional:0});return this.#N.set(this,l),this.#o&=~h6e,l}child(s,l){if(s===""||s===".")return this;if(s==="..")return this.parent||this;let _=this.children(),m=this.nocase?Fce(s):DH(s);for(let M of _)if(M.#b===m)return M;let b=this.parent?this.sep:"",D=this.#E?this.#E+b+s:void 0,A=this.newChild(s,bT,{...l,parent:this,fullpath:D});return this.canReaddir()||(A.#o|=PE),_.push(A),A}relative(){if(this.isCWD)return"";if(this.#D!==void 0)return this.#D;let s=this.name,l=this.parent;if(!l)return this.#D=this.name;let _=l.relative();return _+(!_||!l.parent?"":this.sep)+s}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let s=this.name,l=this.parent;if(!l)return this.#w=this.fullpathPosix();let _=l.relativePosix();return _+(!_||!l.parent?"":"/")+s}fullpath(){if(this.#E!==void 0)return this.#E;let s=this.name,l=this.parent;if(!l)return this.#E=this.name;let m=l.fullpath()+(l.parent?this.sep:"")+s;return this.#E=m}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let m=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(m)?this.#y=`//?/${m}`:this.#y=m}let s=this.parent,l=s.fullpathPosix(),_=l+(!l||!s.parent?"":"/")+this.name;return this.#y=_}isUnknown(){return(this.#o&vT)===bT}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&vT)===oot}isDirectory(){return(this.#o&vT)===GD}isCharacterDevice(){return(this.#o&vT)===sot}isBlockDevice(){return(this.#o&vT)===aot}isFIFO(){return(this.#o&vT)===iot}isSocket(){return(this.#o&vT)===cot}isSymbolicLink(){return(this.#o&xO)===xO}lstatCached(){return this.#o&Qat?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&vT;return!(s!==bT&&s!==xO||this.#o&Oce||this.#o&PE)}calledReaddir(){return!!(this.#o&h6e)}isENOENT(){return!!(this.#o&PE)}isNamed(s){return this.nocase?this.#b===Fce(s):this.#b===DH(s)}async readlink(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let l=await this.#r.promises.readlink(this.fullpath()),_=(await this.parent.realpath())?.resolve(l);if(_)return this.#S=_}catch(l){this.#h(l.code);return}}readlinkSync(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let l=this.#r.readlinkSync(this.fullpath()),_=this.parent.realpathSync()?.resolve(l);if(_)return this.#S=_}catch(l){this.#h(l.code);return}}#F(s){this.#o|=h6e;for(let l=s.provisional;l<s.length;l++){let _=s[l];_&&_.#L()}}#L(){this.#o&PE||(this.#o=(this.#o|PE)&xH,this.#P())}#P(){let s=this.children();s.provisional=0;for(let l of s)l.#L()}#A(){this.#o|=Lce,this.#R()}#R(){if(this.#o&CH)return;let s=this.#o;(s&vT)===GD&&(s&=xH),this.#o=s|CH,this.#P()}#M(s=""){s==="ENOTDIR"||s==="EPERM"?this.#R():s==="ENOENT"?this.#L():this.children().provisional=0}#j(s=""){s==="ENOTDIR"?this.parent.#R():s==="ENOENT"&&this.#L()}#h(s=""){let l=this.#o;l|=Oce,s==="ENOENT"&&(l|=PE),(s==="EINVAL"||s==="UNKNOWN")&&(l&=xH),this.#o=l,s==="ENOTDIR"&&this.parent&&this.parent.#R()}#B(s,l){return this.#O(s,l)||this.#U(s,l)}#U(s,l){let _=g6e(s),m=this.newChild(s.name,_,{parent:this}),b=m.#o&vT;return b!==GD&&b!==xO&&b!==bT&&(m.#o|=CH),l.unshift(m),l.provisional++,m}#O(s,l){for(let _=l.provisional;_<l.length;_++){let m=l[_];if((this.nocase?Fce(s.name):DH(s.name))===m.#b)return this.#$(s,m,_,l)}}#$(s,l,_,m){let b=l.name;return l.#o=l.#o&xH|g6e(s),b!==s.name&&(l.name=s.name),_!==m.provisional&&(_===m.length-1?m.pop():m.splice(_,1),m.unshift(l)),m.provisional++,l}async lstat(){if(!(this.#o&PE))try{return this.#V(await this.#r.promises.lstat(this.fullpath())),this}catch(s){this.#j(s.code)}}lstatSync(){if(!(this.#o&PE))try{return this.#V(this.#r.lstatSync(this.fullpath())),this}catch(s){this.#j(s.code)}}#V(s){let{atime:l,atimeMs:_,birthtime:m,birthtimeMs:b,blksize:D,blocks:A,ctime:M,ctimeMs:U,dev:ie,gid:se,ino:Z,mode:Re,mtime:Pe,mtimeMs:ke,nlink:wt,rdev:At,size:yr,uid:zr}=s;this.#m=l,this.#f=_,this.#x=m,this.#u=b,this.#_=D,this.#i=A,this.#C=M,this.#d=U,this.#n=ie,this.#p=se,this.#c=Z,this.#e=Re,this.#g=Pe,this.#v=ke,this.#t=wt,this.#a=At,this.#l=yr,this.#s=zr;let en=g6e(s);this.#o=this.#o&xH|en|Qat,en!==bT&&en!==GD&&en!==xO&&(this.#o|=CH)}#z=[];#q=!1;#W(s){this.#q=!1;let l=this.#z.slice();this.#z.length=0,l.forEach(_=>_(null,s))}readdirCB(s,l=!1){if(!this.canReaddir()){l?s(null,[]):queueMicrotask(()=>s(null,[]));return}let _=this.children();if(this.calledReaddir()){let b=_.slice(0,_.provisional);l?s(null,b):queueMicrotask(()=>s(null,b));return}if(this.#z.push(s),this.#q)return;this.#q=!0;let m=this.fullpath();this.#r.readdir(m,{withFileTypes:!0},(b,D)=>{if(b)this.#M(b.code),_.provisional=0;else{for(let A of D)this.#B(A,_);this.#F(_)}this.#W(_.slice(0,_.provisional))})}#J;async readdir(){if(!this.canReaddir())return[];let s=this.children();if(this.calledReaddir())return s.slice(0,s.provisional);let l=this.fullpath();if(this.#J)await this.#J;else{let _=t(()=>{},"resolve");this.#J=new Promise(m=>_=m);try{for(let m of await this.#r.promises.readdir(l,{withFileTypes:!0}))this.#B(m,s);this.#F(s)}catch(m){this.#M(m.code),s.provisional=0}this.#J=void 0,_()}return s.slice(0,s.provisional)}readdirSync(){if(!this.canReaddir())return[];let s=this.children();if(this.calledReaddir())return s.slice(0,s.provisional);let l=this.fullpath();try{for(let _ of this.#r.readdirSync(l,{withFileTypes:!0}))this.#B(_,s);this.#F(s)}catch(_){this.#M(_.code),s.provisional=0}return s.slice(0,s.provisional)}canReaddir(){if(this.#o&Zat)return!1;let s=vT&this.#o;return s===bT||s===GD||s===xO}shouldWalk(s,l){return(this.#o&GD)===GD&&!(this.#o&Zat)&&!s.has(this)&&(!l||l(this))}async realpath(){if(this.#T)return this.#T;if(!((Lce|Oce|PE)&this.#o))try{let s=await this.#r.promises.realpath(this.fullpath());return this.#T=this.resolve(s)}catch{this.#A()}}realpathSync(){if(this.#T)return this.#T;if(!((Lce|Oce|PE)&this.#o))try{let s=this.#r.realpathSync(this.fullpath());return this.#T=this.resolve(s)}catch{this.#A()}}[lot](s){if(s===this)return;s.isCWD=!1,this.isCWD=!0;let l=new Set([]),_=[],m=this;for(;m&&m.parent;)l.add(m),m.#D=_.join(this.sep),m.#w=_.join("/"),m=m.parent,_.push("..");for(m=s;m&&m.parent&&!l.has(m);)m.#D=void 0,m.#w=void 0,m=m.parent}},Mce=class a extends Iy{static{t(this,"PathWin32")}sep="\\";splitSep=VZt;constructor(s,l=bT,_,m,b,D,A){super(s,l,_,m,b,D,A)}newChild(s,l=bT,_={}){return new a(s,l,this.root,this.roots,this.nocase,this.childrenCache(),_)}getRootString(s){return y6e.parse(s).root}getRoot(s){if(s=qZt(s.toUpperCase()),s===this.root.name)return this.root;for(let[l,_]of Object.entries(this.roots))if(this.sameRoot(s,l))return this.roots[s]=_;return this.roots[s]=new iM(s,this).root}sameRoot(s,l=this.root.name){return s=s.toUpperCase().replace(/\//g,"\\").replace(not,"$1\\"),s===l}},jce=class a extends Iy{static{t(this,"PathPosix")}splitSep="/";sep="/";constructor(s,l=bT,_,m,b,D,A){super(s,l,_,m,b,D,A)}getRootString(s){return s.startsWith("/")?"/":""}getRoot(s){return this.root}newChild(s,l=bT,_={}){return new a(s,l,this.root,this.roots,this.nocase,this.childrenCache(),_)}},Bce=class{static{t(this,"PathScurryBase")}root;rootPath;roots;cwd;#r;#n;#e;nocase;#t;constructor(s=process.cwd(),l,_,{nocase:m,childrenCacheSize:b=16*1024,fs:D=EH}={}){this.#t=rot(D),(s instanceof URL||s.startsWith("file://"))&&(s=IZt(s));let A=l.resolve(s);this.roots=Object.create(null),this.rootPath=this.parseRootPath(A),this.#r=new Rce,this.#n=new Rce,this.#e=new v6e(b);let M=A.substring(this.rootPath.length).split(_);if(M.length===1&&!M[0]&&M.pop(),m===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=m,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let U=this.root,ie=M.length-1,se=l.sep,Z=this.rootPath,Re=!1;for(let Pe of M){let ke=ie--;U=U.child(Pe,{relative:new Array(ke).fill("..").join(se),relativePosix:new Array(ke).fill("..").join("/"),fullpath:Z+=(Re?"":se)+Pe}),Re=!0}this.cwd=U}depth(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.depth()}childrenCache(){return this.#e}resolve(...s){let l="";for(let b=s.length-1;b>=0;b--){let D=s[b];if(!(!D||D===".")&&(l=l?`${D}/${l}`:D,this.isAbsolute(D)))break}let _=this.#r.get(l);if(_!==void 0)return _;let m=this.cwd.resolve(l).fullpath();return this.#r.set(l,m),m}resolvePosix(...s){let l="";for(let b=s.length-1;b>=0;b--){let D=s[b];if(!(!D||D===".")&&(l=l?`${D}/${l}`:D,this.isAbsolute(D)))break}let _=this.#n.get(l);if(_!==void 0)return _;let m=this.cwd.resolve(l).fullpathPosix();return this.#n.set(l,m),m}relative(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.relative()}relativePosix(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.relativePosix()}basename(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.name}dirname(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),(s.parent||s).fullpath()}async readdir(s=this.cwd,l={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_}=l;if(s.canReaddir()){let m=await s.readdir();return _?m:m.map(b=>b.name)}else return[]}readdirSync(s=this.cwd,l={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0}=l;return s.canReaddir()?_?s.readdirSync():s.readdirSync().map(m=>m.name):[]}async lstat(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.lstat()}lstatSync(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.lstatSync()}async readlink(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s.withFileTypes,s=this.cwd);let _=await s.readlink();return l?_:_?.fullpath()}readlinkSync(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s.withFileTypes,s=this.cwd);let _=s.readlinkSync();return l?_:_?.fullpath()}async realpath(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s.withFileTypes,s=this.cwd);let _=await s.realpath();return l?_:_?.fullpath()}realpathSync(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s.withFileTypes,s=this.cwd);let _=s.realpathSync();return l?_:_?.fullpath()}async walk(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l,A=[];(!b||b(s))&&A.push(_?s:s.fullpath());let M=new Set,U=t((se,Z)=>{M.add(se),se.readdirCB((Re,Pe)=>{if(Re)return Z(Re);let ke=Pe.length;if(!ke)return Z();let wt=t(()=>{--ke===0&&Z()},"next");for(let At of Pe)(!b||b(At))&&A.push(_?At:At.fullpath()),m&&At.isSymbolicLink()?At.realpath().then(yr=>yr?.isUnknown()?yr.lstat():yr).then(yr=>yr?.shouldWalk(M,D)?U(yr,wt):wt()):At.shouldWalk(M,D)?U(At,wt):wt()},!0)},"walk"),ie=s;return new Promise((se,Z)=>{U(ie,Re=>{if(Re)return Z(Re);se(A)})})}walkSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l,A=[];(!b||b(s))&&A.push(_?s:s.fullpath());let M=new Set([s]);for(let U of M){let ie=U.readdirSync();for(let se of ie){(!b||b(se))&&A.push(_?se:se.fullpath());let Z=se;if(se.isSymbolicLink()){if(!(m&&(Z=se.realpathSync())))continue;Z.isUnknown()&&Z.lstatSync()}Z.shouldWalk(M,D)&&M.add(Z)}}return A}[Symbol.asyncIterator](){return this.iterate()}iterate(s=this.cwd,l={}){return typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd),this.stream(s,l)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l;(!b||b(s))&&(yield _?s:s.fullpath());let A=new Set([s]);for(let M of A){let U=M.readdirSync();for(let ie of U){(!b||b(ie))&&(yield _?ie:ie.fullpath());let se=ie;if(ie.isSymbolicLink()){if(!(m&&(se=ie.realpathSync())))continue;se.isUnknown()&&se.lstatSync()}se.shouldWalk(A,D)&&A.add(se)}}}stream(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l,A=new r3({objectMode:!0});(!b||b(s))&&A.write(_?s:s.fullpath());let M=new Set,U=[s],ie=0,se=t(()=>{let Z=!1;for(;!Z;){let Re=U.shift();if(!Re){ie===0&&A.end();return}ie++,M.add(Re);let Pe=t((wt,At,yr=!1)=>{if(wt)return A.emit("error",wt);if(m&&!yr){let zr=[];for(let en of At)en.isSymbolicLink()&&zr.push(en.realpath().then(hn=>hn?.isUnknown()?hn.lstat():hn));if(zr.length){Promise.all(zr).then(()=>Pe(null,At,!0));return}}for(let zr of At)zr&&(!b||b(zr))&&(A.write(_?zr:zr.fullpath())||(Z=!0));ie--;for(let zr of At){let en=zr.realpathCached()||zr;en.shouldWalk(M,D)&&U.push(en)}Z&&!A.flowing?A.once("drain",se):ke||se()},"onReaddir"),ke=!0;Re.readdirCB(Pe,!0),ke=!1}},"process");return se(),A}streamSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof Iy||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:m=!1,filter:b,walkFilter:D}=l,A=new r3({objectMode:!0}),M=new Set;(!b||b(s))&&A.write(_?s:s.fullpath());let U=[s],ie=0,se=t(()=>{let Z=!1;for(;!Z;){let Re=U.shift();if(!Re){ie===0&&A.end();return}ie++,M.add(Re);let Pe=Re.readdirSync();for(let ke of Pe)(!b||b(ke))&&(A.write(_?ke:ke.fullpath())||(Z=!0));ie--;for(let ke of Pe){let wt=ke;if(ke.isSymbolicLink()){if(!(m&&(wt=ke.realpathSync())))continue;wt.isUnknown()&&wt.lstatSync()}wt.shouldWalk(M,D)&&U.push(wt)}}Z&&!A.flowing&&A.once("drain",se)},"process");return se(),A}chdir(s=this.cwd){let l=this.cwd;this.cwd=typeof s=="string"?this.cwd.resolve(s):s,this.cwd[lot](l)}},iM=class extends Bce{static{t(this,"PathScurryWin32")}sep="\\";constructor(s=process.cwd(),l={}){let{nocase:_=!0}=l;super(s,y6e,"\\",{...l,nocase:_}),this.nocase=_;for(let m=this.cwd;m;m=m.parent)m.nocase=this.nocase}parseRootPath(s){return y6e.parse(s).root.toUpperCase()}newRoot(s){return new Mce(this.rootPath,GD,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")||s.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(s)}},sM=class extends Bce{static{t(this,"PathScurryPosix")}sep="/";constructor(s=process.cwd(),l={}){let{nocase:_=!1}=l;super(s,NZt,"/",{...l,nocase:_}),this.nocase=_}parseRootPath(s){return"/"}newRoot(s){return new jce(this.rootPath,GD,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")}},kH=class extends sM{static{t(this,"PathScurryDarwin")}constructor(s=process.cwd(),l={}){let{nocase:_=!0}=l;super(s,{...l,nocase:_})}},T4r=process.platform==="win32"?Mce:jce,uot=process.platform==="win32"?iM:process.platform==="darwin"?kH:sM;var HZt=t(a=>a.length>=1,"isPatternList"),GZt=t(a=>a.length>=1,"isGlobList"),aM=class a{static{t(this,"Pattern")}#r;#n;#e;length;#t;#s;#p;#a;#_;#c;#l=!0;constructor(s,l,_,m){if(!HZt(s))throw new TypeError("empty pattern list");if(!GZt(l))throw new TypeError("empty glob list");if(l.length!==s.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=s.length,_<0||_>=this.length)throw new TypeError("index out of range");if(this.#r=s,this.#n=l,this.#e=_,this.#t=m,this.#e===0){if(this.isUNC()){let[b,D,A,M,...U]=this.#r,[ie,se,Z,Re,...Pe]=this.#n;U[0]===""&&(U.shift(),Pe.shift());let ke=[b,D,A,M,""].join("/"),wt=[ie,se,Z,Re,""].join("/");this.#r=[ke,...U],this.#n=[wt,...Pe],this.length=this.#r.length}else if(this.isDrive()||this.isAbsolute()){let[b,...D]=this.#r,[A,...M]=this.#n;D[0]===""&&(D.shift(),M.shift());let U=b+"/",ie=A+"/";this.#r=[U,...D],this.#n=[ie,...M],this.length=this.#r.length}}}pattern(){return this.#r[this.#e]}isString(){return typeof this.#r[this.#e]=="string"}isGlobstar(){return this.#r[this.#e]===F0}isRegExp(){return this.#r[this.#e]instanceof RegExp}globString(){return this.#p=this.#p||(this.#e===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#e).join("/"))}hasMore(){return this.length>this.#e+1}rest(){return this.#s!==void 0?this.#s:this.hasMore()?(this.#s=new a(this.#r,this.#n,this.#e+1,this.#t),this.#s.#c=this.#c,this.#s.#_=this.#_,this.#s.#a=this.#a,this.#s):this.#s=null}isUNC(){let s=this.#r;return this.#_!==void 0?this.#_:this.#_=this.#t==="win32"&&this.#e===0&&s[0]===""&&s[1]===""&&typeof s[2]=="string"&&!!s[2]&&typeof s[3]=="string"&&!!s[3]}isDrive(){let s=this.#r;return this.#a!==void 0?this.#a:this.#a=this.#t==="win32"&&this.#e===0&&this.length>1&&typeof s[0]=="string"&&/^[a-z]:$/i.test(s[0])}isAbsolute(){let s=this.#r;return this.#c!==void 0?this.#c:this.#c=s[0]===""&&s.length>1||this.isDrive()||this.isUNC()}root(){let s=this.#r[0];return typeof s=="string"&&this.isAbsolute()&&this.#e===0?s:""}checkFollowGlobstar(){return!(this.#e===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#e===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};var KZt=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",oM=class{static{t(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(s,{nobrace:l,nocase:_,noext:m,noglobstar:b,platform:D=KZt}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=D,this.mmopts={dot:!0,nobrace:l,nocase:_,noext:m,noglobstar:b,optimizationLevel:2,platform:D,nocomment:!0,nonegate:!0};for(let A of s)this.add(A)}add(s){let l=new B2(s,this.mmopts);for(let _=0;_<l.set.length;_++){let m=l.set[_],b=l.globParts[_];if(!m||!b)throw new Error("invalid pattern object");for(;m[0]==="."&&b[0]===".";)m.shift(),b.shift();let D=new aM(m,b,0,this.platform),A=new B2(D.globString(),this.mmopts),M=b[b.length-1]==="**",U=D.isAbsolute();U?this.absolute.push(A):this.relative.push(A),M&&(U?this.absoluteChildren.push(A):this.relativeChildren.push(A))}}ignored(s){let l=s.fullpath(),_=`${l}/`,m=s.relative()||".",b=`${m}/`;for(let D of this.relative)if(D.match(m)||D.match(b))return!0;for(let D of this.absolute)if(D.match(l)||D.match(_))return!0;return!1}childrenIgnored(s){let l=s.fullpath()+"/",_=(s.relative()||".")+"/";for(let m of this.relativeChildren)if(m.match(_))return!0;for(let m of this.absoluteChildren)if(m.match(l))return!0;return!1}};var b6e=class a{static{t(this,"HasWalkedCache")}store;constructor(s=new Map){this.store=s}copy(){return new a(new Map(this.store))}hasWalked(s,l){return this.store.get(s.fullpath())?.has(l.globString())}storeWalked(s,l){let _=s.fullpath(),m=this.store.get(_);m?m.add(l.globString()):this.store.set(_,new Set([l.globString()]))}},S6e=class{static{t(this,"MatchRecord")}store=new Map;add(s,l,_){let m=(l?2:0)|(_?1:0),b=this.store.get(s);this.store.set(s,b===void 0?m:m&b)}entries(){return[...this.store.entries()].map(([s,l])=>[s,!!(l&2),!!(l&1)])}},T6e=class{static{t(this,"SubWalks")}store=new Map;add(s,l){if(!s.canReaddir())return;let _=this.store.get(s);_?_.find(m=>m.globString()===l.globString())||_.push(l):this.store.set(s,[l])}get(s){let l=this.store.get(s);if(!l)throw new Error("attempting to walk unknown path");return l}entries(){return this.keys().map(s=>[s,this.store.get(s)])}keys(){return[...this.store.keys()].filter(s=>s.canReaddir())}},wH=class a{static{t(this,"Processor")}hasWalkedCache;matches=new S6e;subwalks=new T6e;patterns;follow;dot;opts;constructor(s,l){this.opts=s,this.follow=!!s.follow,this.dot=!!s.dot,this.hasWalkedCache=l?l.copy():new b6e}processPatterns(s,l){this.patterns=l;let _=l.map(m=>[s,m]);for(let[m,b]of _){this.hasWalkedCache.storeWalked(m,b);let D=b.root(),A=b.isAbsolute()&&this.opts.absolute!==!1;if(D){m=m.resolve(D==="/"&&this.opts.root!==void 0?this.opts.root:D);let se=b.rest();if(se)b=se;else{this.matches.add(m,!0,!1);continue}}if(m.isENOENT())continue;let M,U,ie=!1;for(;typeof(M=b.pattern())=="string"&&(U=b.rest());)m=m.resolve(M),b=U,ie=!0;if(M=b.pattern(),U=b.rest(),ie){if(this.hasWalkedCache.hasWalked(m,b))continue;this.hasWalkedCache.storeWalked(m,b)}if(typeof M=="string"){let se=M===".."||M===""||M===".";this.matches.add(m.resolve(M),A,se);continue}else if(M===F0){(!m.isSymbolicLink()||this.follow||b.checkFollowGlobstar())&&this.subwalks.add(m,b);let se=U?.pattern(),Z=U?.rest();if(!U||(se===""||se===".")&&!Z)this.matches.add(m,A,se===""||se===".");else if(se===".."){let Re=m.parent||m;Z?this.hasWalkedCache.hasWalked(Re,Z)||this.subwalks.add(Re,Z):this.matches.add(Re,A,!0)}}else M instanceof RegExp&&this.subwalks.add(m,b)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new a(this.opts,this.hasWalkedCache)}filterEntries(s,l){let _=this.subwalks.get(s),m=this.child();for(let b of l)for(let D of _){let A=D.isAbsolute(),M=D.pattern(),U=D.rest();M===F0?m.testGlobstar(b,D,U,A):M instanceof RegExp?m.testRegExp(b,M,U,A):m.testString(b,M,U,A)}return m}testGlobstar(s,l,_,m){if((this.dot||!s.name.startsWith("."))&&(l.hasMore()||this.matches.add(s,m,!1),s.canReaddir()&&(this.follow||!s.isSymbolicLink()?this.subwalks.add(s,l):s.isSymbolicLink()&&(_&&l.checkFollowGlobstar()?this.subwalks.add(s,_):l.markFollowGlobstar()&&this.subwalks.add(s,l)))),_){let b=_.pattern();if(typeof b=="string"&&b!==".."&&b!==""&&b!==".")this.testString(s,b,_.rest(),m);else if(b===".."){let D=s.parent||s;this.subwalks.add(D,_)}else b instanceof RegExp&&this.testRegExp(s,b,_.rest(),m)}}testRegExp(s,l,_,m){l.test(s.name)&&(_?this.subwalks.add(s,_):this.matches.add(s,m,!1))}testString(s,l,_,m){s.isNamed(l)&&(_?this.subwalks.add(s,_):this.matches.add(s,m,!1))}};var YZt=t((a,s)=>typeof a=="string"?new oM([a],s):Array.isArray(a)?new oM(a,s):a,"makeIgnore"),Uce=class{static{t(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#r=[];#n;#e;signal;maxDepth;includeChildMatches;constructor(s,l,_){if(this.patterns=s,this.path=l,this.opts=_,this.#e=!_.posix&&_.platform==="win32"?"\\":"/",this.includeChildMatches=_.includeChildMatches!==!1,(_.ignore||!this.includeChildMatches)&&(this.#n=YZt(_.ignore??[],_),!this.includeChildMatches&&typeof this.#n.add!="function")){let m="cannot ignore child matches, ignore lacks add() method.";throw new Error(m)}this.maxDepth=_.maxDepth||1/0,_.signal&&(this.signal=_.signal,this.signal.addEventListener("abort",()=>{this.#r.length=0}))}#t(s){return this.seen.has(s)||!!this.#n?.ignored?.(s)}#s(s){return!!this.#n?.childrenIgnored?.(s)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let s;for(;!this.paused&&(s=this.#r.shift());)s()}onResume(s){this.signal?.aborted||(this.paused?this.#r.push(s):s())}async matchCheck(s,l){if(l&&this.opts.nodir)return;let _;if(this.opts.realpath){if(_=s.realpathCached()||await s.realpath(),!_)return;s=_}let b=s.isUnknown()||this.opts.stat?await s.lstat():s;if(this.opts.follow&&this.opts.nodir&&b?.isSymbolicLink()){let D=await b.realpath();D&&(D.isUnknown()||this.opts.stat)&&await D.lstat()}return this.matchCheckTest(b,l)}matchCheckTest(s,l){return s&&(this.maxDepth===1/0||s.depth()<=this.maxDepth)&&(!l||s.canReaddir())&&(!this.opts.nodir||!s.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!s.isSymbolicLink()||!s.realpathCached()?.isDirectory())&&!this.#t(s)?s:void 0}matchCheckSync(s,l){if(l&&this.opts.nodir)return;let _;if(this.opts.realpath){if(_=s.realpathCached()||s.realpathSync(),!_)return;s=_}let b=s.isUnknown()||this.opts.stat?s.lstatSync():s;if(this.opts.follow&&this.opts.nodir&&b?.isSymbolicLink()){let D=b.realpathSync();D&&(D?.isUnknown()||this.opts.stat)&&D.lstatSync()}return this.matchCheckTest(b,l)}matchFinish(s,l){if(this.#t(s))return;if(!this.includeChildMatches&&this.#n?.add){let b=`${s.relativePosix()}/**`;this.#n.add(b)}let _=this.opts.absolute===void 0?l:this.opts.absolute;this.seen.add(s);let m=this.opts.mark&&s.isDirectory()?this.#e:"";if(this.opts.withFileTypes)this.matchEmit(s);else if(_){let b=this.opts.posix?s.fullpathPosix():s.fullpath();this.matchEmit(b+m)}else{let b=this.opts.posix?s.relativePosix():s.relative(),D=this.opts.dotRelative&&!b.startsWith(".."+this.#e)?"."+this.#e:"";this.matchEmit(b?D+b+m:"."+m)}}async match(s,l,_){let m=await this.matchCheck(s,_);m&&this.matchFinish(m,l)}matchSync(s,l,_){let m=this.matchCheckSync(s,_);m&&this.matchFinish(m,l)}walkCB(s,l,_){this.signal?.aborted&&_(),this.walkCB2(s,l,new wH(this.opts),_)}walkCB2(s,l,_,m){if(this.#s(s))return m();if(this.signal?.aborted&&m(),this.paused){this.onResume(()=>this.walkCB2(s,l,_,m));return}_.processPatterns(s,l);let b=1,D=t(()=>{--b===0&&m()},"next");for(let[A,M,U]of _.matches.entries())this.#t(A)||(b++,this.match(A,M,U).then(()=>D()));for(let A of _.subwalkTargets()){if(this.maxDepth!==1/0&&A.depth()>=this.maxDepth)continue;b++;let M=A.readdirCached();A.calledReaddir()?this.walkCB3(A,M,_,D):A.readdirCB((U,ie)=>this.walkCB3(A,ie,_,D),!0)}D()}walkCB3(s,l,_,m){_=_.filterEntries(s,l);let b=1,D=t(()=>{--b===0&&m()},"next");for(let[A,M,U]of _.matches.entries())this.#t(A)||(b++,this.match(A,M,U).then(()=>D()));for(let[A,M]of _.subwalks.entries())b++,this.walkCB2(A,M,_.child(),D);D()}walkCBSync(s,l,_){this.signal?.aborted&&_(),this.walkCB2Sync(s,l,new wH(this.opts),_)}walkCB2Sync(s,l,_,m){if(this.#s(s))return m();if(this.signal?.aborted&&m(),this.paused){this.onResume(()=>this.walkCB2Sync(s,l,_,m));return}_.processPatterns(s,l);let b=1,D=t(()=>{--b===0&&m()},"next");for(let[A,M,U]of _.matches.entries())this.#t(A)||this.matchSync(A,M,U);for(let A of _.subwalkTargets()){if(this.maxDepth!==1/0&&A.depth()>=this.maxDepth)continue;b++;let M=A.readdirSync();this.walkCB3Sync(A,M,_,D)}D()}walkCB3Sync(s,l,_,m){_=_.filterEntries(s,l);let b=1,D=t(()=>{--b===0&&m()},"next");for(let[A,M,U]of _.matches.entries())this.#t(A)||this.matchSync(A,M,U);for(let[A,M]of _.subwalks.entries())b++,this.walkCB2Sync(A,M,_.child(),D);D()}},PH=class extends Uce{static{t(this,"GlobWalker")}matches=new Set;constructor(s,l,_){super(s,l,_)}matchEmit(s){this.matches.add(s)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((s,l)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?l(this.signal.reason):s(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},AH=class extends Uce{static{t(this,"GlobStream")}results;constructor(s,l,_){super(s,l,_),this.results=new r3({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(s){this.results.write(s),this.results.flowing||this.pause()}stream(){let s=this.path;return s.isUnknown()?s.lstat().then(()=>{this.walkCB(s,this.patterns,()=>this.results.end())}):this.walkCB(s,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var QZt=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",AE=class{static{t(this,"Glob")}absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(s,l){if(!l)throw new TypeError("glob options required");if(this.withFileTypes=!!l.withFileTypes,this.signal=l.signal,this.follow=!!l.follow,this.dot=!!l.dot,this.dotRelative=!!l.dotRelative,this.nodir=!!l.nodir,this.mark=!!l.mark,l.cwd?(l.cwd instanceof URL||l.cwd.startsWith("file://"))&&(l.cwd=XZt(l.cwd)):this.cwd="",this.cwd=l.cwd||"",this.root=l.root,this.magicalBraces=!!l.magicalBraces,this.nobrace=!!l.nobrace,this.noext=!!l.noext,this.realpath=!!l.realpath,this.absolute=l.absolute,this.includeChildMatches=l.includeChildMatches!==!1,this.noglobstar=!!l.noglobstar,this.matchBase=!!l.matchBase,this.maxDepth=typeof l.maxDepth=="number"?l.maxDepth:1/0,this.stat=!!l.stat,this.ignore=l.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof s=="string"&&(s=[s]),this.windowsPathsNoEscape=!!l.windowsPathsNoEscape||l.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(s=s.map(M=>M.replace(/\\/g,"/"))),this.matchBase){if(l.noglobstar)throw new TypeError("base matching requires globstar");s=s.map(M=>M.includes("/")?M:`./**/${M}`)}if(this.pattern=s,this.platform=l.platform||QZt,this.opts={...l,platform:this.platform},l.scurry){if(this.scurry=l.scurry,l.nocase!==void 0&&l.nocase!==l.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let M=l.platform==="win32"?iM:l.platform==="darwin"?kH:l.platform?sM:uot;this.scurry=new M(this.cwd,{nocase:l.nocase,fs:l.fs})}this.nocase=this.scurry.nocase;let _=this.platform==="darwin"||this.platform==="win32",m={...l,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:_,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},b=this.pattern.map(M=>new B2(M,m)),[D,A]=b.reduce((M,U)=>(M[0].push(...U.set),M[1].push(...U.globParts),M),[[],[]]);this.patterns=D.map((M,U)=>{let ie=A[U];if(!ie)throw new Error("invalid pattern object");return new aM(M,ie,0,this.platform)})}async walk(){return[...await new PH(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 PH(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 AH(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new AH(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var x6e=t((a,s={})=>{Array.isArray(a)||(a=[a]);for(let l of a)if(new B2(l,s).hasMagic())return!0;return!1},"hasMagic");function $ce(a,s={}){return new AE(a,s).streamSync()}t($ce,"globStreamSync");function _ot(a,s={}){return new AE(a,s).stream()}t(_ot,"globStream");function pot(a,s={}){return new AE(a,s).walkSync()}t(pot,"globSync");async function fot(a,s={}){return new AE(a,s).walk()}t(fot,"glob_");function Jce(a,s={}){return new AE(a,s).iterateSync()}t(Jce,"globIterateSync");function dot(a,s={}){return new AE(a,s).iterate()}t(dot,"globIterate");var ZZt=$ce,eer=Object.assign(_ot,{sync:$ce}),ter=Jce,rer=Object.assign(dot,{sync:Jce}),ner=Object.assign(pot,{stream:$ce,iterate:Jce}),NH=Object.assign(fot,{glob:fot,globSync:pot,sync:ner,globStream:_ot,stream:eer,globStreamSync:$ce,streamSync:ZZt,globIterate:dot,iterate:rer,globIterateSync:Jce,iterateSync:ter,Glob:AE,hasMagic:x6e,escape:ZR,unescape:kE});NH.glob=NH;import Jfe from"fs";import e7e from"path";var U1=class extends Error{static{t(this,"CompilationError")}buildMessages;constructor(s){super("An error occurred during compilation."),this.buildMessages=Array.isArray(s)?s:[s]}toBuildResult(){return{content:"",errors:this.buildMessages}}};var ier="[",ser="]",aer="{",oer="}",cer=":",ler=",",uer="true",fer="false",_er="null",per="NaN",der="Infinity",C6e='"',IH=new Map([[34,C6e],[92,"\\"],[47,"/"],[98,"\b"],[110,`
558
558
  `],[102,"\f"],[114,"\r"],[116," "]]),Vce=new Map([...IH,[118,"\v"],[48,"\0"]]),mer=new Map([[C6e,C6e],["\\","\\"],["/","/"],["\b","b"],[`
559
559
  `,"n"],["\f","f"],["\r","r"],[" ","t"]]),o3r=new Map([...mer,["\v","v"],["\0","0"],["\u2028","u2028"],["\u2029","u2029"]]),qce=new Map([[ier,"LBracket"],[ser,"RBracket"],[aer,"LBrace"],[oer,"RBrace"],[cer,"Colon"],[ler,"Comma"],[uer,"Boolean"],[fer,"Boolean"],[_er,"Null"]]),zce=new Map([...qce,[per,"Number"],[der,"Number"]]),D6e=new Set([10,13,8232,8233]),XP=class extends Error{static{t(this,"ErrorWithLocation")}constructor(s,{line:l,column:_,offset:m}){super(`${s} (${l}:${_})`),this.line=l,this.column=_,this.offset=m}},k6e=class extends XP{static{t(this,"UnexpectedChar")}constructor(s,l){super(`Unexpected character '${String.fromCharCode(s)}' found.`,l)}},w6e=class extends XP{static{t(this,"UnexpectedIdentifier")}constructor(s,l){super(`Unexpected identifier '${s}' found.`,l)}},EO=class extends XP{static{t(this,"UnexpectedToken")}constructor(s){super(`Unexpected token ${s.type} found.`,s.loc.start)}},Wce=class extends XP{static{t(this,"UnexpectedEOF")}constructor(s){super("Unexpected end of input found.",s)}},her=/[\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]/,ger=/[\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]/,yer=13,mot=10,P6e=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===yer?(this.#s=!0,this.peek()===mot&&this.#t++):s===mot&&(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}},ver="Infinity",ber="NaN",Ser=new Set([116,102,110]),A6e=new Set([32,9,10,13]),hot=new Set([...A6e,11,12,160,8232,8233,65279,160,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288]),Ter={mode:"json",ranges:!1},xer=new Set(["true","false","null"]),x_={EOF:0,Number:1,String:2,Boolean:3,Null:4,NaN:5,Infinity:6,Identifier:7,Colon:20,LBrace:21,RBrace:22,LBracket:23,RBracket:24,Comma:25,LineComment:40,BlockComment:41};function YP(a){return a>=48&&a<=57}t(YP,"isDigit");function E6e(a){return YP(a)||a>=65&&a<=70||a>=97&&a<=102}t(E6e,"isHexDigit");function Eer(a){return a>=49&&a<=57}t(Eer,"isPositiveDigit");function Cer(a){return Ser.has(a)}t(Cer,"isKeywordStart");function yot(a){return YP(a)||a===46||a===45}t(yot,"isNumberStart");function Der(a){return yot(a)||a===43}t(Der,"isJSON5NumberStart");function got(a,s){return a===34||s&&a===39}t(got,"isStringStart");function vot(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 her.test(s)}t(vot,"isJSON5IdentifierStart");function ker(a){if(vot(a)||YP(a))return!0;let s=String.fromCharCode(a);return ger.test(s)}t(ker,"isJSON5IdentifierPart");var N6e=class{static{t(this,"Tokenizer")}#r;#n;#e;#t;#s;#p;#a;#_;#c;#l;#i;constructor(s,l){this.#n=s,this.#r={...Ter,...l},this.#e=new P6e(s),this.#t=this.#r.mode==="json5",this.#s=this.#r.mode!=="json",this.#p=this.#r.ranges,this.#_=this.#t?Vce.has.bind(Vce):IH.has.bind(IH),this.#c=this.#t?D6e.has.bind(D6e):()=>!1,this.#l=this.#t?_=>_===120:()=>!1,this.#i=this.#t?hot.has.bind(hot):A6e.has.bind(A6e)}#f(s,l=this.#e.locate()){throw new k6e(s,l)}#v(s,l=this.#e.locate()){throw new w6e(s,l)}#d(){throw new Wce(this.#e.locate())}#u(s,l,_,m){let b=_.offset+l,D=this.#r.ranges?{range:[_.offset,b]}:void 0;return{type:s,loc:{start:_,end:m||{line:_.line,column:_.column+l,offset:b}},...D}}#m(s){let l="",_;for(let m=0;m<s;m++){if(_=this.#e.peek(),E6e(_)){this.#e.next(),l+=String.fromCharCode(_);continue}this.#f(_)}return l}#g(s){let l="";do{if(l+=String.fromCharCode(s),s===92&&(s=this.#e.next(),s!==117&&this.#f(s),l+=String.fromCharCode(s),l+=this.#m(4)),s=this.#e.peek(),!ker(s))break;this.#e.next()}while(!0);return l}#C(s){let l=s,_=1;for(s=this.#e.peek();s!==-1&&s!==l;){if(this.#e.next(),_++,s===92)if(s=this.#e.peek(),this.#_(s)||this.#c(s))this.#e.next(),_++;else if(s===117){this.#e.next(),_++;let m=this.#m(4);_+=m.length}else if(this.#l(s)){this.#e.next(),_++;let m=this.#m(2);_+=m.length}else this.#t?(this.#e.next(),_++):this.#f(s);s=this.#e.peek()}return s===-1&&(this.#e.next(),this.#d()),this.#e.next(),_++,_}#x(s){let l=1;if(s===45||this.#t&&s===43){if(s=this.#e.peek(),this.#t&&(s===73||s===78)){this.#e.next();let _=this.#g(s);return _!==ver&&_!==ber&&this.#f(s),l+_.length}YP(s)||this.#f(s),this.#e.next(),l++}if(s===48)if(s=this.#e.peek(),this.#t&&(s===120||s===88)){this.#e.next(),l++,s=this.#e.peek(),E6e(s)||(this.#e.next(),this.#f(s));do this.#e.next(),l++,s=this.#e.peek();while(E6e(s))}else YP(s)&&this.#f(s);else if(!this.#t||s!==46)for(Eer(s)||this.#f(s),s=this.#e.peek();YP(s);)this.#e.next(),l++,s=this.#e.peek();if(s===46){let _=-1;for(this.#e.next(),l++,_++,s=this.#e.peek();YP(s);)this.#e.next(),l++,_++,s=this.#e.peek();!this.#t&&_===0&&(this.#e.next(),s?this.#f(s):this.#d())}if(s===101||s===69)for(this.#e.next(),l++,s=this.#e.peek(),(s===43||s===45)&&(this.#e.next(),l++,s=this.#e.peek()),s===-1&&(this.#e.next(),this.#d()),YP(s)||(this.#e.next(),this.#f(s));YP(s);)this.#e.next(),l++,s=this.#e.peek();return l}#b(s){let l=1;if(s=this.#e.peek(),s===47){do this.#e.next(),l+=1,s=this.#e.peek();while(s>-1&&s!==13&&s!==10);return{length:l,multiline:!1}}if(s===42){for(this.#e.next(),l+=1;s>-1;)if(s=this.#e.peek(),s===42){if(this.#e.next(),l+=1,s=this.#e.peek(),s===47)return this.#e.next(),l+=1,{length:l,multiline:!0}}else this.#e.next(),l+=1;this.#e.next(),this.#d()}this.#e.next(),this.#f(s)}next(){let s=this.#e.next();for(;this.#i(s);)s=this.#e.next();if(s===-1)return x_.EOF;let l=this.#e.locate(),_=String.fromCharCode(s);if(this.#t)if(zce.has(_))this.#a=this.#u(zce.get(_),1,l);else if(vot(s)){let m=this.#g(s);zce.has(m)?this.#a=this.#u(zce.get(m),m.length,l):this.#a=this.#u("Identifier",m.length,l)}else if(Der(s)){let m=this.#x(s);this.#a=this.#u("Number",m,l)}else if(got(s,this.#t)){let m=this.#C(s),b=this.#e.locate();this.#a=this.#u("String",m,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else if(s===47&&this.#s){let m=this.#b(s),b=this.#e.locate();this.#a=this.#u(m.multiline?"BlockComment":"LineComment",m.length,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else this.#f(s);else if(qce.has(_))this.#a=this.#u(qce.get(_),1,l);else if(Cer(s)){let m=this.#g(s);xer.has(m)||this.#v(m,l),this.#a=this.#u(qce.get(m),m.length,l)}else if(yot(s)){let m=this.#x(s);this.#a=this.#u("Number",m,l)}else if(got(s,this.#t)){let m=this.#C(s);this.#a=this.#u("String",m,l)}else if(s===47&&this.#s){let m=this.#b(s),b=this.#e.locate();this.#a=this.#u(m.multiline?"BlockComment":"LineComment",m.length,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else this.#f(s);return x_[this.#a.type]}get token(){return this.#a}};var ST={document(a,s={}){return{type:"Document",body:a,loc:s.loc,...s}},string(a,s={}){return{type:"String",value:a,loc:s.loc,...s}},number(a,s={}){return{type:"Number",value:a,loc:s.loc,...s}},boolean(a,s={}){return{type:"Boolean",value:a,loc:s.loc,...s}},null(a={}){return{type:"Null",loc:a.loc,...a}},array(a,s={}){return{type:"Array",elements:a,loc:s.loc,...s}},element(a,s={}){return{type:"Element",value:a,loc:s.loc,...s}},object(a,s={}){return{type:"Object",members:a,loc:s.loc,...s}},member(a,s,l={}){return{type:"Member",name:a,value:s,loc:l.loc,...l}},identifier(a,s={}){return{type:"Identifier",name:a,loc:s.loc,...s}},nan(a="",s={}){return{type:"NaN",sign:a,loc:s.loc,...s}},infinity(a="",s={}){return{type:"Infinity",sign:a,loc:s.loc,...s}}},wer={mode:"json",ranges:!1,tokens:!1,allowTrailingCommas:!1};function Per(a,s,l=!1){let _="",m=a.indexOf("\\"),b=0;for(;m>=0;){_+=a.slice(b,m);let D=a.charAt(m+1),A=D.charCodeAt(0);if(l&&Vce.has(A))_+=Vce.get(A),b=m+2;else if(IH.has(A))_+=IH.get(A),b=m+2;else if(D==="u"){let M=a.slice(m+2,m+6);if(M.length<4||/[^0-9a-f]/i.test(M))throw new XP(`Invalid unicode escape \\u${M}.`,{line:s.loc.start.line,column:s.loc.start.column+m,offset:s.loc.start.offset+m});_+=String.fromCharCode(parseInt(M,16)),b=m+6}else if(l&&D==="x"){let M=a.slice(m+2,m+4);if(M.length<2||/[^0-9a-f]/i.test(M))throw new XP(`Invalid hex escape \\x${M}.`,{line:s.loc.start.line,column:s.loc.start.column+m,offset:s.loc.start.offset+m});_+=String.fromCharCode(parseInt(M,16)),b=m+4}else if(l&&D6e.has(A))b=m+2,D==="\r"&&a.charAt(b)===`
560
- `&&b++;else if(l)_+=D,b=m+2;else throw new XP(`Invalid escape \\${D}.`,{line:s.loc.start.line,column:s.loc.start.column+m,offset:s.loc.start.offset+m});m=a.indexOf("\\",b)}return _+=a.slice(b),_}t(Per,"getStringValue");function Aer(a,s,l=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return Per(a.slice(1,-1),s,l);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(Aer,"getLiteralValue");function bot(a,s){s=Object.freeze({...wer,...s});let l=[],_=new N6e(a,{mode:s.mode,ranges:s.ranges}),m=s.mode==="json5",b=s.allowTrailingCommas||m;function D(){let br=_.next();return br&&s.tokens&&l.push(_.token),br}t(D,"nextNoComments");function A(){let br=_.next();return br&&s.tokens&&l.push(_.token),br>=x_.LineComment?A():br}t(A,"nextSkipComments");let M=s.mode==="json"?D:A;function U(br,mr){if(br!==mr)throw new EO(_.token)}t(U,"assertTokenType");function ie(br,mr){if(!mr.includes(br))throw new EO(_.token)}t(ie,"assertTokenTypes");function se(br,mr){return s.ranges?{range:[br.offset,mr.offset]}:void 0}t(se,"createRange");function Z(br){let mr=_.token,Is=se(mr.loc.start,mr.loc.end),Pi=Aer(a.slice(mr.loc.start.offset,mr.loc.end.offset),mr,m),Ti={loc:{start:{...mr.loc.start},end:{...mr.loc.end}},...Is};switch(br){case x_.String:return ST.string(Pi,Ti);case x_.Number:return ST.number(Pi,Ti);case x_.Boolean:return ST.boolean(Pi,Ti);default:throw new TypeError(`Unknown token type ${mr.type}.`)}}t(Z,"createLiteralNode");function Re(br){let mr=se(br.loc.start,br.loc.end),Is=a.slice(br.loc.start.offset,br.loc.end.offset),Po={loc:{start:{...br.loc.start},end:{...br.loc.end}},...mr};if(br.type!=="Identifier"){let Ti="";return(Is[0]==="+"||Is[0]==="-")&&(Ti=Is[0]),ST[Is.includes("NaN")?"nan":"infinity"](Ti,Po)}return ST.identifier(Is,Po)}t(Re,"createJSON5IdentifierNode");function Pe(br){let mr=se(br.loc.start,br.loc.end);return ST.null({loc:{start:{...br.loc.start},end:{...br.loc.end}},...mr})}t(Pe,"createNullNode");function ke(br){m?ie(br,[x_.String,x_.Identifier,x_.Number]):U(br,x_.String);let mr=_.token,Is=br===x_.String?Z(br):Re(mr);if(m&&(Is.type==="NaN"||Is.type==="Infinity")){if(Is.sign!=="")throw new EO(_.token);Is=ST.identifier(Is.type,{loc:Is.loc,...se(Is.loc.start,Is.loc.end)})}br=M(),U(br,x_.Colon);let Pi=yr(),Po=se(Is.loc.start,Pi.loc.end);return ST.member(Is,Pi,{loc:{start:{...Is.loc.start},end:{...Pi.loc.end}},...Po})}t(ke,"parseProperty");function wt(br){U(br,x_.LBrace);let mr=_.token,Is=[],Pi=M();if(Pi!==x_.RBrace)do{if(Is.push(ke(Pi)),Pi=M(),!Pi)throw new Wce(Is[Is.length-1].loc.end);if(Pi===x_.Comma){if(Pi=M(),b&&Pi===x_.RBrace)break}else break}while(Pi);U(Pi,x_.RBrace);let Po=_.token,Ti=se(mr.loc.start,Po.loc.end);return ST.object(Is,{loc:{start:{...mr.loc.start},end:{...Po.loc.end}},...Ti})}t(wt,"parseObject");function At(br){U(br,x_.LBracket);let mr=_.token,Is=[],Pi=M();if(Pi!==x_.RBracket)do{let _p=yr(Pi);if(Is.push(ST.element(_p,{loc:_p.loc})),Pi=M(),Pi===x_.Comma){if(Pi=M(),b&&Pi===x_.RBracket)break}else break}while(Pi);U(Pi,x_.RBracket);let Po=_.token,Ti=se(mr.loc.start,Po.loc.end);return ST.array(Is,{loc:{start:{...mr.loc.start},end:{...Po.loc.end}},...Ti})}t(At,"parseArray");function yr(br){br=br??M();let mr=_.token;switch(br){case x_.String:case x_.Boolean:return Z(br);case x_.Number:if(m){let Is=a.slice(mr.loc.start.offset,mr.loc.end.offset);if((Is[0]==="+"||Is[0]==="-")&&(Is=Is.slice(1)),Is==="NaN"||Is==="Infinity")return Re(mr)}return Z(br);case x_.Null:return Pe(mr);case x_.LBrace:return wt(br);case x_.LBracket:return At(br);default:throw new EO(mr)}}t(yr,"parseValue");let zr=yr();if(M())throw new EO(_.token);let hn={loc:{start:{line:1,column:1,offset:0},end:{...zr.loc.end}}};return s.tokens&&(hn.tokens=l),s.ranges&&(hn.range=[hn.loc.start.offset,hn.loc.end.offset]),ST.document(zr,hn)}t(bot,"parse");var Ner=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function Sot(a){return a&&typeof a=="object"}t(Sot,"isObject");function Ier(a){return Sot(a)&&typeof a.type=="string"}t(Ier,"isNode");function Oer(a,s){function l(_,m){typeof s.enter=="function"&&s.enter(_,m);for(let b of Ner.get(_.type)){let D=_[b];Sot(D)&&(Array.isArray(D)?D.forEach(A=>l(A,_)):Ier(D)&&l(D,_))}typeof s.exit=="function"&&s.exit(_,m)}t(l,"visitNode"),l(a)}t(Oer,"traverse");function Tot(a,s=()=>!0){let l=[];return Oer(a,{enter(_,m){l.push({node:_,parent:m,phase:"enter"})},exit(_,m){l.push({node:_,parent:m,phase:"exit"})}}),l.filter(s).values()}t(Tot,"iterator");import Fer from"fs/promises";var OH=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),Hce=t(async a=>{try{return await Fer.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),FH=t(async a=>{try{return bot(a)}catch(s){if(s.column&&s.line&&s.message){let l=OH(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:l}}return}},"getSchemaAST");var xot=t(async(a,s,l)=>{try{if(a.length===0)return;for(let _ of a){let m=await Hce(_),b=await Ler(m,_,s,l);if(b)return b}}catch{}},"getRouteLocationByValue"),Ler=t(async(a,s,l,_)=>{try{if(!a)return;let m=null,b=await FH(a);if(b){for(let{node:D}of Tot(b))if(D.value&&D.value===l){m=D.loc;break}if(m!==null){let D=OH(a,m.start.line);return{file:s,line:m.start.line,column:m.start.column,length:m.end.column-m.start.column,lineText:D,suggestion:_}}}}catch{}},"getRouteLocationByValueFromSchema");import Eot from"fs/promises";import Gce from"path";var I6e="schemas",O6e=".oas.json";var CO=t(async a=>(await Eot.readdir(a)).map(l=>`${a}/${l}`).filter(l=>l.endsWith(O6e)).sort(),"getOpenApiFilesByAlphabetical"),cM=t(async a=>{let s=Gce.resolve(a,"config");return(await Eot.readdir(s)).filter(_=>_.endsWith(O6e)).length>=1},"oasFileInProject");function LH(a,s,l,_,m,b,D){if(b.has(l))return;let A;try{A=_.get(l)}catch(M){throw new M1({text:`Failed to resolve reference: ${l}`,detail:M.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:l,namespace:s,suggestion:"Check the reference and try again."}})}b.set(l,m.length),m.push(l),F6e(L6e(l),s,A,_,m,b,D)}t(LH,"chaseRefs");function F6e(a,s,l,_,m,b,D){if(Array.isArray(l))for(let A of l)F6e(a,s,A,_,m,b,D);else if(typeof l=="object")for(let A in l){if(A==="$ref"){let M=l[A];D&&(l[A]=D(s,M)),LH(a,s,n3(a,M),_,m,b,D)}F6e(a,s,l[A],_,m,b,D)}}t(F6e,"lookForRefs");function n3(a,s){let l=s.indexOf("#");return l>=0?`${Gce.resolve(a,s.substring(0,l))}${s.substring(l)}`:Gce.resolve(Gce.dirname(a),s)}t(n3,"getFullyQualifiedRefName");function L6e(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(L6e,"getFilePathNameFromRefName");var R6e=class{static{t(this,"Environment")}get WORKING_COPY_ENVIRONMENT(){return process.env.WORKING_COPY_ENVIRONMENT??"staging"}get ZUP_HOSTNAME(){return process.env.ZUP_HOSTNAME??"zuplo.app"}get ZUP_WORKING_COPY_HOSTNAME(){return process.env.ZUP_WORKING_COPY_HOSTNAME??this.WORKING_COPY_ENVIRONMENT==="staging"?"d1.zuplo.dev":"d2.zuplo.dev"}},Rer=new R6e,M6e=Rer;var QH=S_(Q4e(),1);var Z4e={};yst(Z4e,{UnsafePathError:()=>Sle,deleteFile:()=>Ssr,deleteFolder:()=>Asr,dirExists:()=>Tle,ensureDirectoryExists:()=>Csr,fileExists:()=>bsr,getParentDirFilename:()=>ksr,isNotFileOrDirectory:()=>Tsr,listFolderContents:()=>Qlt,listFolders:()=>Esr,mkdirForFilePathIfNotExits:()=>eut,mkdirIfNotExists:()=>Zlt,safePath:()=>Dsr,tarFolderContent:()=>wsr,untar:()=>Psr});import Ylt from"child_process";import f3 from"fs/promises";import u3 from"path";var Xlt=[".git","node_modules",".yarn",".DS_Store"];async function bsr(a){try{return(await f3.stat(a)).isFile()}catch{return!1}}t(bsr,"fileExists");async function Ssr(a,s){return await f3.rm(a,s)}t(Ssr,"deleteFile");async function Tle(a){try{return(await f3.stat(a)).isDirectory()}catch{return!1}}t(Tle,"dirExists");async function Tsr(a){try{return await f3.stat(a),!1}catch{return!0}}t(Tsr,"isNotFileOrDirectory");function xsr(a,s){let l=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),_=a.match(l);if(!_)return"";let m=a.split(_[0]);return m[1]===""?"":`/${m[1]}`}t(xsr,"getParentDirectory");async function Esr(a){if(!await Tle(a))return[];let s=await f3.readdir(a,{withFileTypes:!0}),l=[];for await(let _ of s)Xlt.includes(_.name)||_.isDirectory()&&l.push(_.name);return l}t(Esr,"listFolders");async function Qlt(a,s,l=!0){let _=xsr(a,s),m=await f3.readdir(a,{withFileTypes:!0}),b=[];for await(let D of m)if(!Xlt.includes(D.name)||!l)if(D.isDirectory()){let A=await Qlt(u3.join(a,D.name),s,l);b.push(...A)}else b.push(u3.join(_,D.name));return b}t(Qlt,"listFolderContents");var Zlt=t(async a=>{if(await Tle(a))return!0;await f3.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),eut=t(async a=>{let s=u3.dirname(a);return Zlt(s)},"mkdirForFilePathIfNotExits"),Csr=eut,Sle=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function Dsr(a){let s=t(l=>{if(!l.startsWith(a))throw new Sle("Resolved path is not part of the project.");return l},"ensureSafePath");return{resolve:t((...l)=>s(u3.resolve(...l)),"resolve")}}t(Dsr,"safePath");function ksr(a){return`${u3.basename(u3.dirname(a))}/${u3.basename(a)}`}t(ksr,"getParentDirFilename");function wsr(a,s,l,_){let m=u3.join(_,l);return Ylt.execSync(`tar --exclude='.git/' --exclude='dist/' -czf ${m} ${s}`,{cwd:a}),m}t(wsr,"tarFolderContent");function Psr(a,s,l,_=!1){Ylt.execSync(`tar -xf ${s} ${_?"--strip-components=1 ":""}-C ${l}`,{cwd:a})}t(Psr,"untar");async function Asr(a){if(await Tle(a))return await f3.rm(a,{recursive:!0})}t(Asr,"deleteFolder");var wl=Z4e;var CT=S_(Q4e(),1);import{readFile as Nsr}from"fs/promises";var FO=class extends Error{static{t(this,"CustomResolveError")}},_3=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,l){this.sourceDirectory=s,this.logger=l}dereference(s,l){return QH.$RefParser.dereference(s,{resolve:{json:!0,file:xle(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:l?.onDereference}})}bundle(s){return QH.$RefParser.bundle(s,{resolve:{file:xle(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return QH.$RefParser.parse(s,{resolve:{file:xle(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return QH.$RefParser.resolve(s,{resolve:{file:xle(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function xle(a,s){return{order:100,canRead(l){let _=Fsr(l.url);if(!(_===void 0||_==="file"))return!1;let b;try{b=tut(l.url)}catch(D){throw new FO(`Malformed URI: ${l.url}`,{cause:D})}try{wl.safePath(a).resolve(b)}catch(D){return s?.warn(D),!1}return!0},async read(l){let _;try{_=tut(l.url)}catch(m){throw new FO(`Malformed URI: ${l.url}`,{cause:m})}try{return await Nsr(_)}catch(m){throw new FO(`Error opening file "${_}"`,{cause:m})}}}}t(xle,"customResolver");var e3e=/^win/.test(globalThis.process?globalThis.process.platform:""),Isr=/\//g,Osr=/^(\w{2,}):\/\//i,t3e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function Fsr(a){let s=Osr.exec(a);if(s)return s[1].toLowerCase()}t(Fsr,"getProtocol");function tut(a,s){a=decodeURI(a);for(let _=0;_<t3e.length;_+=2)a=a.replace(t3e[_],t3e[_+1]);let l=a.substr(0,7).toLowerCase()==="file://";return l&&(a=a[7]==="/"?a.substr(8):a.substr(7),e3e&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(l=!1,a=e3e?a:"/"+a)),e3e&&!l&&(a=a.replace(Isr,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(tut,"toFileSystemPath");var rut="YOUR_KEY_HERE";async function nut(a){let l=await new _3(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),_=a.openApiDocPath.replace(a.sourceDirectory,"");return Lsr({...a,relativeOpenApiPath:_},l)}t(nut,"buildPublicOpenApiFile");async function Lsr(a,s){Bsr({relativeOpenApiPath:a.relativeOpenApiPath},s);let l=s;return l=Msr(l),Rsr(l,a),l=jsr(l,a),iut(l,"x-zuplo"),l}t(Lsr,"buildRawOpenApiFile");function Rsr(a,{customDomain:s,deploymentName:l,environmentType:_}){let m;s?m=s:_&&l&&(m=_===dce.WORKING_COPY?`${l}.${M6e.ZUP_WORKING_COPY_HOSTNAME}`:`${l}.${M6e.ZUP_HOSTNAME}`),m?a.servers=[{url:`https://${m}`}]:a.servers=void 0}t(Rsr,"addServerHost");function Msr(a){if(!a.paths)return a;let{components:s}=a,l=s?{...s}:void 0,_=[];l&&l.parameters&&(_=Object.entries(l.parameters).reduce((b,[D,A])=>(KR in A&&mce(A[KR])&&(b.push(D),l.parameters&&delete l.parameters[D]),b),[]));let m=Object.entries(a.paths).reduce((b,[D,A])=>{if(!A)return b;let M={...A},U=["delete","get","head","patch","post","put","trace","options"];return U.forEach(ie=>{let se=A[ie];if(!se)return;if(mce(se[KR])){delete M[ie];return}let{parameters:Z}=se;if(!Z)return;let Re=Z.filter(Pe=>{if(KR in Pe&&mce(Pe[KR]))return!1;if("$ref"in Pe){let ke=Pe.$ref.split("/").pop();return ke?!_.includes(ke):!0}return!0});M[ie]={...se,parameters:Re}}),U.some(ie=>!!M[ie])&&(b[D]=M),b},{});return{...a,paths:m,components:l}}t(Msr,"removeHiddenRoutesAndParams");function jsr(a,{policiesConfig:s}){if(!a.paths)return a;let l=Object.entries(a.paths).reduce((_,[m,b])=>{if(!b)return _;let D={...b};return[D.delete,D.get,D.head,D.patch,D.post,D.put,D.trace,D.options].forEach(A=>{if(!A)return;let M=A["x-zuplo-route"]?.policies?.inbound?.reduce((se,Z)=>{let Re=s.policies?.find(({name:wt})=>wt===Z);if(!Re)return se;if(!(Re.handler.export==="CompositeInboundPolicy"))return se.concat(Z);let ke=Re.handler.options?.policies;return ke?se.concat(ke):se},[]),U=[];if(M&&M.forEach(se=>{s.policies?.forEach(Z=>{Z.name===se&&(Z.handler.export==="ApiAuthKeyInboundPolicy"||Z.handler.export==="ApiKeyInboundPolicy")&&!Z.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&U.push(Z)})}),U.length>0){let se=U.length>0&&U[0].handler&&U[0].handler.options&&U[0].handler.options.authHeader?U[0].handler.options.authHeader:"Authorization",Z=U.length>0&&U[0].handler&&U[0].handler.options&&(U[0].handler.options.authScheme||U[0].handler.options.authScheme==="")?U[0].handler.options.authScheme:"Bearer",Re=Z!==""?`${Z} ${rut}`:rut,Pe={name:se,in:"header",required:!0,example:Re,schema:{type:"string"},description:`The \`${se}\` header is used to authenticate with the API using your API key. Value is of the format \`${Re}\`.`};A.parameters?A.parameters.some(yr=>"name"in yr&&yr.name===Pe.name)||A.parameters.unshift(Pe):A.parameters=[Pe];let ke={type:"http",scheme:Z.toLowerCase()},wt="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(yr=>"name"in yr&&yr.type==="apiKey"||"type"in yr&&yr.type==="http"&&yr.scheme===Z)||(a.components.securitySchemes={...a.components.securitySchemes,[wt]:ke}):(a.components||(a.components={}),a.components.securitySchemes={[wt]:ke});let At={[wt]:[]};A.security?A.security.some(yr=>yr[wt]!==void 0)||A.security.unshift(At):A.security=[At]}let ie=[];if(M&&M.forEach(se=>{s.policies?.forEach(Z=>{Z.name===se&&(Z.handler.export==="RateLimitInboundPolicy"||Z.handler.export==="ComplexRateLimitInboundPolicy")&&ie.push(Z)})}),ie.length>0){let se={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},Z={...se,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:se,RateLimitWithRetryAfter:Z},A.responses||(A.responses={});let Re=ie.some(Pe=>Pe.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Re?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),_[m]=D,_},{});return{...a,paths:l}}t(jsr,"enrichSpecWithZuploData");function iut(a,s){for(let l in a)l.startsWith(s)?delete a[l]:typeof a[l]=="object"&&iut(a[l],s)}t(iut,"removePropertiesByPrefix");function Bsr({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new M1({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new M1({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 M1({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(Bsr,"assertIsZuploOpenApiSpec");function Usr(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let U=0;U<s.length;U++)s[U]=255;for(let U=0;U<a.length;U++){let ie=a.charAt(U),se=ie.charCodeAt(0);if(s[se]!==255)throw new TypeError(ie+" is ambiguous");s[se]=U}let l=a.length,_=a.charAt(0),m=Math.log(l)/Math.log(256),b=Math.log(256)/Math.log(l);function D(U){if(U instanceof Uint8Array||(ArrayBuffer.isView(U)?U=new Uint8Array(U.buffer,U.byteOffset,U.byteLength):Array.isArray(U)&&(U=Uint8Array.from(U))),!(U instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(U.length===0)return"";let ie=0,se=0,Z=0,Re=U.length;for(;Z!==Re&&U[Z]===0;)Z++,ie++;let Pe=(Re-Z)*b+1>>>0,ke=new Uint8Array(Pe);for(;Z!==Re;){let yr=U[Z],zr=0;for(let en=Pe-1;(yr!==0||zr<se)&&en!==-1;en--,zr++)yr+=256*ke[en]>>>0,ke[en]=yr%l>>>0,yr=yr/l>>>0;if(yr!==0)throw new Error("Non-zero carry");se=zr,Z++}let wt=Pe-se;for(;wt!==Pe&&ke[wt]===0;)wt++;let At=_.repeat(ie);for(;wt<Pe;++wt)At+=a.charAt(ke[wt]);return At}t(D,"encode");function A(U){if(typeof U!="string")throw new TypeError("Expected String");if(U.length===0)return new Uint8Array;let ie=0,se=0,Z=0;for(;U[ie]===_;)se++,ie++;let Re=(U.length-ie)*m+1>>>0,Pe=new Uint8Array(Re);for(;U[ie];){let yr=s[U.charCodeAt(ie)];if(yr===255)return;let zr=0;for(let en=Re-1;(yr!==0||zr<Z)&&en!==-1;en--,zr++)yr+=l*Pe[en]>>>0,Pe[en]=yr%256>>>0,yr=yr/256>>>0;if(yr!==0)throw new Error("Non-zero carry");Z=zr,ie++}let ke=Re-Z;for(;ke!==Re&&Pe[ke]===0;)ke++;let wt=new Uint8Array(se+(Re-ke)),At=se;for(;ke!==Re;)wt[At++]=Pe[ke++];return wt}t(A,"decodeUnsafe");function M(U){let ie=A(U);if(ie)return ie;throw new Error("Non-base"+l+" character")}return t(M,"decode"),{encode:D,decodeUnsafe:A,decode:M}}t(Usr,"base");var sut=Usr;var $sr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Ele=sut($sr);var r3e="2024-09-02",aut=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 out(){return new DT({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:r3e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:aut[r3e]},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(out,"getMockEnvironment");var DT=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=out()),this.#r}constructor({build:s,runtime:l}){let _;try{if(l.__ZUPLO_CONFIG){let m=atob(l.__ZUPLO_CONFIG);_=JSON.parse(m)}if(l.ZUPLO_SYSTEM_CONFIGURATIONS){let m=new TextDecoder().decode(Ele.decode(l.ZUPLO_SYSTEM_CONFIGURATIONS)),b=JSON.parse(m);for(let D of Object.keys(b))l[D]=b[D]}}catch(m){console.error("Failed to parse runtime configuration",m)}this.config=_??{},this.build=s,this.runtime=l,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get 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 Jsr=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function cut(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!Jsr.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(cut,"isRestrictedEnvVariableName");function lut(a){return!!a.startsWith("ZUPLO_")}t(lut,"isZuploReadableEnvVariableName");var ZIr=new Proxy({},{get(a,s){let l=String(s);switch(l){case"ZUPLO_ENVIRONMENT_TYPE":return DT.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return DT.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return DT.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return DT.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return DT.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return DT.instance.build.BUILD_ID}if(!(cut(l)&&!lut(l)))return DT.instance.runtime[l]}});function ZH(a,s,l){return`_${rA(`${a}_${s}_${l}`)}`}t(ZH,"getRawOperationDataIdentifierName");function n3e(a,s,l,_){return`_${rA(a.toLowerCase())}_${s.toLowerCase()}_${l.toLowerCase()}_${_.toLowerCase()}`}t(n3e,"getIdForParameterSchema");function i3e(a,s,l){return`_${rA(a.toLowerCase())}_${s.toLowerCase()}_rb_${rA(l.toLowerCase())}`}t(i3e,"getIdForRequestBodySchema");function eG(a,s){return`_${rA(a)}_${rA(s)}`}t(eG,"getIdForRefSchema");function rA(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(rA,"sanitizedIdentifierName");var $mt=S_(Zft(),1);import Yue from"path";var hG=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,l,_,m,b){this.type=a,this.name=s,this.prefix=l,this.value=_,this.suffix=m,this.modifier=b}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Rcr=/[$_\p{ID_Start}]/u,Mcr=/[$_\u200C\u200D\p{ID_Continue}]/u,Q3e=".*";function jcr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(jcr,"Re");function r_t(a,s=!1){let l=[],_=0;for(;_<a.length;){let m=a[_],b=t(function(D){if(!s)throw new TypeError(D);l.push({type:"INVALID_CHAR",index:_,value:a[_++]})},"c");if(m==="*"){l.push({type:"ASTERISK",index:_,value:a[_++]});continue}if(m==="+"||m==="?"){l.push({type:"OTHER_MODIFIER",index:_,value:a[_++]});continue}if(m==="\\"){l.push({type:"ESCAPED_CHAR",index:_++,value:a[_++]});continue}if(m==="{"){l.push({type:"OPEN",index:_,value:a[_++]});continue}if(m==="}"){l.push({type:"CLOSE",index:_,value:a[_++]});continue}if(m===":"){let D="",A=_+1;for(;A<a.length;){let M=a.substr(A,1);if(A===_+1&&Rcr.test(M)||A!==_+1&&Mcr.test(M)){D+=a[A++];continue}break}if(!D){b(`Missing parameter name at ${_}`);continue}l.push({type:"NAME",index:_,value:D}),_=A;continue}if(m==="("){let D=1,A="",M=_+1,U=!1;if(a[M]==="?"){b(`Pattern cannot start with "?" at ${M}`);continue}for(;M<a.length;){if(!jcr(a[M],!1)){b(`Invalid character '${a[M]}' at ${M}.`),U=!0;break}if(a[M]==="\\"){A+=a[M++]+a[M++];continue}if(a[M]===")"){if(D--,D===0){M++;break}}else if(a[M]==="("&&(D++,a[M+1]!=="?")){b(`Capturing groups are not allowed at ${M}`),U=!0;break}A+=a[M++]}if(U)continue;if(D){b(`Unbalanced pattern at ${_}`);continue}if(!A){b(`Missing pattern at ${_}`);continue}l.push({type:"REGEX",index:_,value:A}),_=M;continue}l.push({type:"CHAR",index:_,value:a[_++]})}return l.push({type:"END",index:_,value:""}),l}t(r_t,"v");function n_t(a,s={}){let l=r_t(a);s.delimiter??="/#?",s.prefixes??="./";let _=`[^${AT(s.delimiter)}]+?`,m=[],b=0,D=0,A="",M=new Set,U=t(zr=>{if(D<l.length&&l[D].type===zr)return l[D++].value},"a"),ie=t(()=>U("OTHER_MODIFIER")??U("ASTERISK"),"f"),se=t(zr=>{let en=U(zr);if(en!==void 0)return en;let{type:hn,index:br}=l[D];throw new TypeError(`Unexpected ${hn} at ${br}, expected ${zr}`)},"d"),Z=t(()=>{let zr="",en;for(;en=U("CHAR")??U("ESCAPED_CHAR");)zr+=en;return zr},"T"),Re=t(zr=>zr,"Se"),Pe=s.encodePart||Re,ke="",wt=t(zr=>{ke+=zr},"U"),At=t(()=>{ke.length&&(m.push(new hG(3,"","",Pe(ke),"",3)),ke="")},"$"),yr=t((zr,en,hn,br,mr)=>{let Is=3;switch(mr){case"?":Is=1;break;case"*":Is=0;break;case"+":Is=2;break}if(!en&&!hn&&Is===3){wt(zr);return}if(At(),!en&&!hn){if(!zr)return;m.push(new hG(3,"","",Pe(zr),"",Is));return}let Pi;hn?hn==="*"?Pi=Q3e:Pi=hn:Pi=_;let Po=2;Pi===_?(Po=1,Pi=""):Pi===Q3e&&(Po=0,Pi="");let Ti;if(en?Ti=en:hn&&(Ti=b++),M.has(Ti))throw new TypeError(`Duplicate name '${Ti}'.`);M.add(Ti),m.push(new hG(Po,Ti,Pe(zr),Pi,Pe(br),Is))},"V");for(;D<l.length;){let zr=U("CHAR"),en=U("NAME"),hn=U("REGEX");if(!en&&!hn&&(hn=U("ASTERISK")),en||hn){let mr=zr??"";s.prefixes.indexOf(mr)===-1&&(wt(mr),mr=""),At();let Is=ie();yr(mr,en,hn,"",Is);continue}let br=zr??U("ESCAPED_CHAR");if(br){wt(br);continue}if(U("OPEN")){let mr=Z(),Is=U("NAME"),Pi=U("REGEX");!Is&&!Pi&&(Pi=U("ASTERISK"));let Po=Z();se("CLOSE");let Ti=ie();yr(mr,Is,Pi,Po,Ti);continue}At(),se("END")}return m}t(n_t,"D");function AT(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(AT,"S");function e_t(a){return a&&a.ignoreCase?"ui":"u"}t(e_t,"X");function Bcr(a,s,l){return i_t(n_t(a,l),s,l)}t(Bcr,"Z");function IM(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(IM,"k");function i_t(a,s,l={}){l.delimiter??="/#?",l.prefixes??="./",l.sensitive??=!1,l.strict??=!1,l.end??=!0,l.start??=!0,l.endsWith="";let _=l.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?_+=AT(A.value):_+=`(?:${AT(A.value)})${IM(A.modifier)}`;continue}s&&s.push(A.name);let M=`[^${AT(l.delimiter)}]+?`,U=A.value;if(A.type===1?U=M:A.type===0&&(U=Q3e),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?_+=`(${U})${IM(A.modifier)}`:_+=`((?:${U})${IM(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){_+=`(?:${AT(A.prefix)}(${U})${AT(A.suffix)})`,_+=IM(A.modifier);continue}_+=`(?:${AT(A.prefix)}`,_+=`((?:${U})(?:`,_+=AT(A.suffix),_+=AT(A.prefix),_+=`(?:${U}))*)${AT(A.suffix)})`,A.modifier===0&&(_+="?")}let m=`[${AT(l.endsWith)}]|$`,b=`[${AT(l.delimiter)}]`;if(l.end)return l.strict||(_+=`${b}?`),l.endsWith.length?_+=`(?=${m})`:_+="$",new RegExp(_,e_t(l));l.strict||(_+=`(?:${b}(?=${m}))?`);let D=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(D=l.delimiter.indexOf(A)>-1)}return D||(_+=`(?=${b}|${m})`),new RegExp(_,e_t(l))}t(i_t,"F");var h3={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Ucr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},$cr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function Jcr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(Jcr,"J");function s_t(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(s_t,"Q");function zcr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(zcr,"Ee");function a_t(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(a_t,"W");var o_t=["ftp","file","http","https","ws","wss"];function c_t(a){if(!a)return!0;for(let s of o_t)if(a.test(s))return!0;return!1}t(c_t,"N");function qcr(a,s){if(a=s_t(a,"#"),s||a==="")return a;let l=new URL("https://example.com");return l.hash=a,l.hash?l.hash.substring(1,l.hash.length):""}t(qcr,"te");function Vcr(a,s){if(a=s_t(a,"?"),s||a==="")return a;let l=new URL("https://example.com");return l.search=a,l.search?l.search.substring(1,l.search.length):""}t(Vcr,"re");function Wcr(a,s){return s||a===""?a:a_t(a)?f_t(a):u_t(a)}t(Wcr,"ne");function Hcr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.password=a,l.password}t(Hcr,"se");function Gcr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.username=a,l.username}t(Gcr,"ie");function Kcr(a,s,l){if(l||a==="")return a;if(s&&!o_t.includes(s))return new URL(`${s}:${a}`).pathname;let _=a[0]=="/";return a=new URL(_?a:"/-"+a,"https://example.com").pathname,_||(a=a.substring(2,a.length)),a}t(Kcr,"ae");function Ycr(a,s,l){return l_t(s)===a&&(a=""),l||a===""?a:__t(a)}t(Ycr,"oe");function Xcr(a,s){return a=zcr(a,":"),s||a===""?a:Z3e(a)}t(Xcr,"ce");function l_t(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(l_t,"_");function Z3e(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(Z3e,"y");function Qcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Qcr,"le");function Zcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(Zcr,"fe");function u_t(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(u_t,"z");function f_t(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(f_t,"j");function __t(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(__t,"K");function elr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(elr,"he");function tlr(a){return a===""?a:new URL(`data:${a}`).pathname}t(tlr,"ue");function rlr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(rlr,"de");function nlr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(nlr,"pe");var ilr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=r_t(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#w()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#C()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#x()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#x()&&this.#i(5,1);break;case 4:this.#x()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#k()&&!this.#c?this.#i(6,1):this.#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 l=this.#u(a);return l.value===s&&(l.type==="CHAR"||l.type==="ESCAPED_CHAR"||l.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#C(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#x(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#k(){return this.#m(this.#t,":")}#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,"#")}#w(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,h3),a.encodePart=Z3e;let s=Bcr(this.#T(),void 0,a);this.#l=c_t(s)}},X3e=["protocol","username","password","hostname","port","pathname","search","hash"],m3="*";function t_t(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let l=new URL(a,s);return{protocol:l.protocol.substring(0,l.protocol.length-1),username:l.username,password:l.password,hostname:l.hostname,port:l.port,pathname:l.pathname,search:l.search!==""?l.search.substring(1,l.search.length):void 0,hash:l.hash!==""?l.hash.substring(1,l.hash.length):void 0}}t(t_t,"ge");function oA(a,s){return s?mG(a):a}t(oA,"b");function dG(a,s,l){let _;if(typeof s.baseURL=="string")try{_=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=oA(_.protocol.substring(0,_.protocol.length-1),l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=oA(_.username,l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=oA(_.password,l)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=oA(_.hostname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=oA(_.port,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=oA(_.pathname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=oA(_.search.substring(1,_.search.length),l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=oA(_.hash.substring(1,_.hash.length),l))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Xcr(s.protocol,l)),typeof s.username=="string"&&(a.username=Gcr(s.username,l)),typeof s.password=="string"&&(a.password=Hcr(s.password,l)),typeof s.hostname=="string"&&(a.hostname=Wcr(s.hostname,l)),typeof s.port=="string"&&(a.port=Ycr(s.port,a.protocol,l)),typeof s.pathname=="string"){if(a.pathname=s.pathname,_&&!Jcr(a.pathname,l)){let m=_.pathname.lastIndexOf("/");m>=0&&(a.pathname=oA(_.pathname.substring(0,m+1),l)+a.pathname)}a.pathname=Kcr(a.pathname,a.protocol,l)}return typeof s.search=="string"&&(a.search=Vcr(s.search,l)),typeof s.hash=="string"&&(a.hash=qcr(s.hash,l)),a}t(dG,"w");function mG(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(mG,"C");function slr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(slr,"Oe");function alr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let l=".*",_=`[^${slr(s.delimiter)}]+?`,m=/[$_\u200C\u200D\p{ID_Continue}]/u,b="";for(let D=0;D<a.length;++D){let A=a[D];if(A.type===3){if(A.modifier===3){b+=mG(A.value);continue}b+=`{${mG(A.value)}}${IM(A.modifier)}`;continue}let M=A.hasCustomName(),U=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),ie=D>0?a[D-1]:null,se=D<a.length-1?a[D+1]:null;if(!U&&M&&A.type===1&&A.modifier===3&&se&&!se.prefix.length&&!se.suffix.length)if(se.type===3){let Z=se.value.length>0?se.value[0]:"";U=m.test(Z)}else U=!se.hasCustomName();if(!U&&!A.prefix.length&&ie&&ie.type===3){let Z=ie.value[ie.value.length-1];U=s.prefixes.includes(Z)}U&&(b+="{"),b+=mG(A.prefix),M&&(b+=`:${A.name}`),A.type===2?b+=`(${A.value})`:A.type===1?M||(b+=`(${_})`):A.type===0&&(!M&&(!ie||ie.type===3||ie.modifier!==3||U||A.prefix!=="")?b+="*":b+=`(${l})`),A.type===1&&M&&A.suffix.length&&m.test(A.suffix[0])&&(b+="\\"),b+=mG(A.suffix),U&&(b+="}"),A.modifier!==3&&(b+=IM(A.modifier))}return b}t(alr,"ke");var p_t=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,l){try{let _;if(typeof s=="string"?_=s:l=s,typeof a=="string"){let A=new ilr(a);if(A.parse(),a=A.result,_===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=_}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(_)throw new TypeError("parameter 1 is not of type 'string'.")}typeof l>"u"&&(l={ignoreCase:!1});let m={ignoreCase:l.ignoreCase===!0},b={pathname:m3,protocol:m3,username:m3,password:m3,hostname:m3,port:m3,search:m3,hash:m3};this.#r=dG(b,a,!0),l_t(this.#r.protocol)===this.#r.port&&(this.#r.port="");let D;for(D of X3e){if(!(D in this.#r))continue;let A={},M=this.#r[D];switch(this.#e[D]=[],D){case"protocol":Object.assign(A,h3),A.encodePart=Z3e;break;case"username":Object.assign(A,h3),A.encodePart=Qcr;break;case"password":Object.assign(A,h3),A.encodePart=Zcr;break;case"hostname":Object.assign(A,Ucr),a_t(M)?A.encodePart=f_t:A.encodePart=u_t;break;case"port":Object.assign(A,h3),A.encodePart=__t;break;case"pathname":c_t(this.#n.protocol)?(Object.assign(A,$cr,m),A.encodePart=elr):(Object.assign(A,h3,m),A.encodePart=tlr);break;case"search":Object.assign(A,h3,m),A.encodePart=rlr;break;case"hash":Object.assign(A,h3,m),A.encodePart=nlr;break}try{this.#s[D]=n_t(M,A),this.#n[D]=i_t(this.#s[D],this.#e[D],A),this.#t[D]=alr(this.#s[D],A),this.#p=this.#p||this.#s[D].some(U=>U.type===2)}catch{throw new TypeError(`invalid ${D} pattern '${this.#r[D]}'.`)}}}catch(_){throw new TypeError(`Failed to construct 'URLPattern': ${_.message}`)}}test(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?l=dG(l,a,!1):l=dG(l,t_t(a,s),!1)}catch{return!1}let _;for(_ of X3e)if(!this.#n[_].exec(l[_]))return!1;return!0}exec(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?l=dG(l,a,!1):l=dG(l,t_t(a,s),!1)}catch{return null}let _={};s?_.inputs=[a,s]:_.inputs=[a];let m;for(m of X3e){let b=this.#n[m].exec(l[m]);if(!b)return null;let D={};for(let[A,M]of this.#e[m].entries())if(typeof M=="string"||typeof M=="number"){let U=b[A+1];D[M]=U}_[m]={input:l[m]??"",groups:D}}return _}static compareComponent(a,s,l){let _=t((A,M)=>{for(let U of["type","modifier","prefix","value","suffix"]){if(A[U]<M[U])return-1;if(A[U]!==M[U])return 1}return 0},"o"),m=new hG(3,"","","","",3),b=new hG(0,"","","","",3),D=t((A,M)=>{let U=0;for(;U<Math.min(A.length,M.length);++U){let ie=_(A[U],M[U]);if(ie)return ie}return A.length===M.length?0:_(A[U]??m,M[U]??m)},"s");return!s.#t[a]&&!l.#t[a]?0:s.#t[a]&&!l.#t[a]?D(s.#s[a],[b]):!s.#t[a]&&l.#t[a]?D([b],l.#s[a]):D(s.#s[a],l.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=p_t);import{AssertionError as olr}from"assert";function cA(a,s){if(a===!1)throw new olr({message:s})}t(cA,"assert");var Ac;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Ac||(Ac={}));function OM(a){return a.type===Ac.Object}t(OM,"isAstObject");function lA(a){return a.type===Ac.Property}t(lA,"isAstProperty");function d_t(a){return a.type===Ac.Array}t(d_t,"isAstArray");function FM(a){return a.type===Ac.Literal}t(FM,"isAstLiteral");function $O(a){if(a===void 0)throw new Error("Node is undefined");if(!OM(a))throw new Error("Node is not object")}t($O,"assertAstObject");import{findNodeAtLocation as clr,getNodeValue as llr,printParseErrorCode as ulr,visit as flr}from"jsonc-parser";var _lr={DEFAULT:{allowTrailingComma:!1}};function gG(a,s=[],l=_lr.DEFAULT){let _={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function m(M){_.type==="property"&&(_.length=M-_.offset,_=_.parent)}t(m,"ensurePropertyComplete");function b(M){return _.children?.push(M),M}t(b,"onValue"),flr(a,{onObjectBegin:t((M,U,ie)=>{_=b({type:"object",offset:M,length:-1,line:U+1,column:ie+1,parent:_,children:[]})},"onObjectBegin"),onObjectProperty:t((M,U,ie,se,Z)=>{_=b({type:"property",offset:U,length:-1,line:se+1,column:Z+1,parent:_,children:[]}),_.children?.push({type:"string",value:M,offset:U,length:ie,line:se,column:Z,parent:_})},"onObjectProperty"),onObjectEnd:t((M,U)=>{m(M+U),_.length=M+U-_.offset,_=_.parent,m(M+U)},"onObjectEnd"),onArrayBegin:t((M,U,ie,se)=>{_=b({type:"array",offset:M,length:-1,line:ie+1,column:se+1,parent:_,children:[]})},"onArrayBegin"),onArrayEnd:t((M,U)=>{_.length=M+U-_.offset,_=_.parent,m(M+U)},"onArrayEnd"),onLiteralValue:t((M,U,ie,se,Z)=>{b({type:plr(M),offset:U,length:ie,line:se+1,column:Z+1,parent:_,value:M}),m(U+ie)},"onLiteralValue"),onSeparator:t((M,U)=>{_.type==="property"&&(M===":"?_.colonOffset=U:M===","&&m(U))},"onSeparator"),onError:t((M,U,ie,se,Z)=>{s.push({error:M,offset:U,length:ie,line:se+1,column:Z+1})},"onError")},l);let A=_.children[0];return A&&delete A.parent,A}t(gG,"parse");function plr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(plr,"getNodeType");function eNe(a,s){return clr(a,s)}t(eNe,"findNodeAtLocation");function yG(a){return llr(a)}t(yG,"getNodeValue");function m_t(a){return ulr(a)}t(m_t,"printParseErrorCode");var vG=class{static{t(this,"AstAdapter")}parse(s){let _=gG(s,[]);if(_)return this.parseNode(_,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,l){switch(s.type){case"object":return this.createObject(s,l);case"array":return this.createArray(s,l);case"property":return this.createProperty(s,l);case"string":return this.createLiteral(s,l);case"number":return this.createLiteral(s,l);case"boolean":return this.createLiteral(s,l);case"null":return this.createLiteral(s,l)}}createLiteral(s,l){return{type:Ac.Literal,location:{line:s.line,column:s.column},parent:l,value:s.type==="null"?null:s.value}}createObject(s,l){let _={type:Ac.Object,children:[],parent:l,location:{line:s.line,column:s.column}};return s.children?.forEach(m=>{_.children.push(this.parseNode(m,_))}),_}createProperty(s,l){cA(s.children?.length===2,"Invalid property node");let _={type:Ac.Property,location:{line:s.line,column:s.column},parent:l,name:null,value:null};return _.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Ac.Identifier,parent:_},_.value=this.parseNode(s.children[1],_),_}createArray(s,l){let _={type:Ac.Array,location:{line:s.line,column:s.column},parent:l,children:[]};return s.children?.forEach(m=>_.children.push(this.parseNode(m,_))),_}};var $E={createLiteral:t((a,s)=>({type:Ac.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Ac.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Ac.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,l)=>{let _={type:Ac.Property,parent:l,name:null,value:s};return _.name={value:a,type:Ac.Identifier,parent:_},_.value.parent=_,_},"createProperty"),createArrayOfLiterals:t((a,s)=>{let l={type:Ac.Array,parent:s,children:[]};for(let _ of a)l.children.push($E.createLiteral(_,l));return l},"createArrayOfLiterals")};var dlr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,bG=class{static{t(this,"SourceGenerator")}generate(s){let l=[];return this.generateSource(l,s),l.join("")}generateSource(s,l){switch(l.type){case Ac.Array:return this.generateArray(s,l);case Ac.Object:return this.generateObject(s,l);case Ac.Property:return this.generateProperty(s,l);case Ac.Literal:return this.generateLiteral(s,l);case Ac.FunctionCall:return this.generateFunctionCall(s,l);case Ac.Identifier:return this.generateIdentifier(s,l);case Ac.Raw:return this.generateRaw(s,l);case Ac.TemplateString:return this.generateTemplateString(s,l)}}generateArray(s,l){s.push("["),l.children.map(_=>{this.generateSource(s,_),s.push(",")}),s.push("]")}generateObject(s,l){s.push("{"),l.children.forEach(_=>{this.generateSource(s,_),s.push(",")}),s.push("}")}generateProperty(s,l){this.generateIdentifier(s,l.name),s.push(":"),this.generateSource(s,l.value)}generateFunctionCall(s,l){s.push(l.name.value),s.push("("),l.children.forEach((_,m,b)=>{this.generateSource(s,_),m<b.length&&s.push(",")}),s.push(")")}generateRaw(s,l){s.push(l.value)}generateTemplateString(s,l){s.push("`"),s.push(l.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,l){if(l.value===null)return s.push("null");switch(typeof l.value){case"number":case"boolean":return s.push(`${l.value}`);case"string":{let _=l.value,m=JSON.stringify(_);return s.push(`${m}`)}}}generateIdentifier(s,l){let _=dlr.test(l.value)?l.value:`'${l.value}'`;s.push(_)}};import{parse as mlr}from"@swc/core";import hlr from"fs/promises";var h_t=t(async a=>{let s=new Set;try{let l=await hlr.readFile(a,"utf-8");(await mlr(l,{syntax:"typescript"})).body.forEach(m=>{m.type==="ExportDefaultDeclaration"||m.type==="ExportDefaultExpression"?s.add("default"):m.type==="ExportDeclaration"&&m.declaration.type==="FunctionDeclaration"?s.add(m.declaration.identifier.value):m.type==="ExportDeclaration"&&m.declaration.type==="VariableDeclaration"&&m.declaration.declarations[0].id.type==="Identifier"&&s.add(m.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var g_t={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var tNe={$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 y_t={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var rNe={$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 nNe={$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 Nmt=S_(emt(),1),Imt=S_(Amt(),1);var Jue=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new Imt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,Nmt.default)(this.ajv,{mode:"fast"})}addSchema(s,l){this.ajv.addSchema(s,l)}compile(s){let l=this.ajv.compile(s);return t(m=>({isValid:l(m),errors:this.toSimpleErrors(l.errors,m),warnings:[]}),"validator")}toSimpleErrors(s,l){let _=[];return s?.forEach(m=>{m.keyword==="enum"&&m.params.allowedValues&&Array.isArray(m.params.allowedValues)&&(m.message+=`; ${m.params.allowedValues.join(", ")}`),m.instancePath&&(m.instancePath=m.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let b={details:{}},D=m.instancePath.split("/");if(D.length>2){let M=D[1],U=D[2]?parseInt(D[2]):0,ie=D[3],se=isNaN(U)?void 0:l[M][U][ie];b={details:{property:M,index:U,field:ie,fieldValue:se}}}if(m.keyword==="required"&&m.params.missingProperty&&m.instancePath&&(m.message=`A 'path' is missing required property '${m.params.missingProperty}'`),m.keyword==="additionalProperties"&&m.params.additionalProperty&&m.instancePath&&(m.message=`A 'path' should NOT include property '${m.params.additionalProperty}'`),m.keyword==="type"&&m.params.type&&m.instancePath){let M=m.instancePath.split("/"),U=M[M.length-1];m.message=`Value of property '${U}' must be '${m.params.type}'`}let A=Object.assign(m,b);_.push(A)}),_}};var D3=Jue.instance;D3.addSchema(nNe,"route-configuration.schema.json");D3.addSchema(y_t,"policy-configuration.schema.json");D3.addSchema(tNe,"policies.schema.json");D3.addSchema(rNe,"open-api-route-configuration.schema.json");D3.addSchema(g_t,"fragments.schema.json");var Q5r=D3.compile(nNe),Omt=D3.compile(rNe),y8e=D3.compile(tNe);var zue=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=y8e(s),this.results}};var que=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=Omt(s),this.results}};import Thr from"path";var v8e=/\$import\((.*)\)/,Vue=/\$env\((.*?)\)/g;var dA=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,l,_,m){super(s),this.location={file:l,namespace:"",line:_?_.line:0,column:_?_.column:0,length:0,lineText:m??"",suggestion:""}}},Shr=t(a=>{let s=[],l=a;for(;l.parent;)s.push(l),l=l.parent;return s.reverse()},"invertTree"),k3=t((a,s)=>{if(!a)return!1;let l=Shr(a);return s.split("/").every((b,D)=>{let A=l[D];return A?b==="*"||lA(A)&&A.name.value===b?!0:b==="{}"?A.type===Ac.Object:b==="[]"?A.type===Ac.Array:!1:!1})},"testPosition");var Wue=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),OM(s)?s.children.forEach(l=>{this.visitor(l)}):d_t(s)?s.children.forEach(l=>{this.visitor(l)}):lA(s)&&this.visitor(s.value)}},Fmt=t((a,s,l)=>_=>{if(!lA(_)||!FM(_.value)||typeof _.value.value!="string")return;if(!a.some(b=>k3(_,b))){Vue.test(_.value.value)&&s.push(new dA("An $env() statement is not expected at this location.",l,_.location,_.value.value));return}let m=new RegExp(Vue).exec(_.value.value);if(m?.length===2&&m[0]===_.value.value){let b={type:Ac.Raw,parent:null,value:`environment["${m[1]}"]`};_.value=b}else{let b=_.value.value.replaceAll(new RegExp(Vue),(D,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);b!==_.value.value&&(_.value=$E.createTemplateString(b,_))}},"getEnvStatementTransformer");var ZG="config/routes.json",xhr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Ehr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Lmt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],Chr="handler/{}/options/{}/rewritePattern",Dhr="handler/{}/options/{}/baseUrl",Hue=class extends Wue{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let l=this.addedImports.get(s);if(!l)throw new Error("Import name is undefined. This should not happen.");return l}getImports(){let s=[];return this.addedImports.forEach((l,_)=>{s.push({name:l,path:_})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!lA(s)||!FM(s.value)||typeof s.value.value!="string")&&k3(s,Chr)){if(!s.parent||!OM(s.parent)){this.errors.push(new dA("Invalid node, expected object",ZG,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Rmt(l)},m=$E.createProperty("__rewriteFunction",_,s);s.parent.children.push(m)}}rewriteForwardFunction(s){if(!(!lA(s)||!FM(s.value)||typeof s.value.value!="string")&&k3(s,Dhr)){if(!s.parent||!OM(s.parent)){this.errors.push(new dA("Invalid node, expected object",ZG,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Rmt(l)},m=$E.createProperty("__rewriteFunction",_,s);s.parent.children.push(m)}}replaceImportStatements(s){if(!lA(s)||!FM(s.value))return;let l=s.value.value;if(typeof l!="string")return;if(!Ehr.some(A=>k3(s,A))&&!Lmt.some(A=>k3(s,A))){if(v8e.test(l)){if(s.name.value==="$ref")return;this.errors.push(new dA("An $import() statement is not expected at this location.",ZG,s.location,l))}return}let _=v8e.exec(l);if(Lmt.some(A=>k3(s,A))&&!_)return;if(!_){this.errors.push(new dA("Invalid $import() statement",ZG,s.location,l));return}let m=_[1];m.startsWith(".")&&(m=Thr.join("..",m));let b=this.getImportName(m),D={type:Ac.Identifier,parent:s.parent,value:b};s.value=D}replaceEnvStatements=Fmt(xhr,this.errors,ZG)};function Rmt(a){return`(request, context) => {
560
+ `&&b++;else if(l)_+=D,b=m+2;else throw new XP(`Invalid escape \\${D}.`,{line:s.loc.start.line,column:s.loc.start.column+m,offset:s.loc.start.offset+m});m=a.indexOf("\\",b)}return _+=a.slice(b),_}t(Per,"getStringValue");function Aer(a,s,l=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return Per(a.slice(1,-1),s,l);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(Aer,"getLiteralValue");function bot(a,s){s=Object.freeze({...wer,...s});let l=[],_=new N6e(a,{mode:s.mode,ranges:s.ranges}),m=s.mode==="json5",b=s.allowTrailingCommas||m;function D(){let br=_.next();return br&&s.tokens&&l.push(_.token),br}t(D,"nextNoComments");function A(){let br=_.next();return br&&s.tokens&&l.push(_.token),br>=x_.LineComment?A():br}t(A,"nextSkipComments");let M=s.mode==="json"?D:A;function U(br,mr){if(br!==mr)throw new EO(_.token)}t(U,"assertTokenType");function ie(br,mr){if(!mr.includes(br))throw new EO(_.token)}t(ie,"assertTokenTypes");function se(br,mr){return s.ranges?{range:[br.offset,mr.offset]}:void 0}t(se,"createRange");function Z(br){let mr=_.token,Is=se(mr.loc.start,mr.loc.end),Pi=Aer(a.slice(mr.loc.start.offset,mr.loc.end.offset),mr,m),Ti={loc:{start:{...mr.loc.start},end:{...mr.loc.end}},...Is};switch(br){case x_.String:return ST.string(Pi,Ti);case x_.Number:return ST.number(Pi,Ti);case x_.Boolean:return ST.boolean(Pi,Ti);default:throw new TypeError(`Unknown token type ${mr.type}.`)}}t(Z,"createLiteralNode");function Re(br){let mr=se(br.loc.start,br.loc.end),Is=a.slice(br.loc.start.offset,br.loc.end.offset),Po={loc:{start:{...br.loc.start},end:{...br.loc.end}},...mr};if(br.type!=="Identifier"){let Ti="";return(Is[0]==="+"||Is[0]==="-")&&(Ti=Is[0]),ST[Is.includes("NaN")?"nan":"infinity"](Ti,Po)}return ST.identifier(Is,Po)}t(Re,"createJSON5IdentifierNode");function Pe(br){let mr=se(br.loc.start,br.loc.end);return ST.null({loc:{start:{...br.loc.start},end:{...br.loc.end}},...mr})}t(Pe,"createNullNode");function ke(br){m?ie(br,[x_.String,x_.Identifier,x_.Number]):U(br,x_.String);let mr=_.token,Is=br===x_.String?Z(br):Re(mr);if(m&&(Is.type==="NaN"||Is.type==="Infinity")){if(Is.sign!=="")throw new EO(_.token);Is=ST.identifier(Is.type,{loc:Is.loc,...se(Is.loc.start,Is.loc.end)})}br=M(),U(br,x_.Colon);let Pi=yr(),Po=se(Is.loc.start,Pi.loc.end);return ST.member(Is,Pi,{loc:{start:{...Is.loc.start},end:{...Pi.loc.end}},...Po})}t(ke,"parseProperty");function wt(br){U(br,x_.LBrace);let mr=_.token,Is=[],Pi=M();if(Pi!==x_.RBrace)do{if(Is.push(ke(Pi)),Pi=M(),!Pi)throw new Wce(Is[Is.length-1].loc.end);if(Pi===x_.Comma){if(Pi=M(),b&&Pi===x_.RBrace)break}else break}while(Pi);U(Pi,x_.RBrace);let Po=_.token,Ti=se(mr.loc.start,Po.loc.end);return ST.object(Is,{loc:{start:{...mr.loc.start},end:{...Po.loc.end}},...Ti})}t(wt,"parseObject");function At(br){U(br,x_.LBracket);let mr=_.token,Is=[],Pi=M();if(Pi!==x_.RBracket)do{let _p=yr(Pi);if(Is.push(ST.element(_p,{loc:_p.loc})),Pi=M(),Pi===x_.Comma){if(Pi=M(),b&&Pi===x_.RBracket)break}else break}while(Pi);U(Pi,x_.RBracket);let Po=_.token,Ti=se(mr.loc.start,Po.loc.end);return ST.array(Is,{loc:{start:{...mr.loc.start},end:{...Po.loc.end}},...Ti})}t(At,"parseArray");function yr(br){br=br??M();let mr=_.token;switch(br){case x_.String:case x_.Boolean:return Z(br);case x_.Number:if(m){let Is=a.slice(mr.loc.start.offset,mr.loc.end.offset);if((Is[0]==="+"||Is[0]==="-")&&(Is=Is.slice(1)),Is==="NaN"||Is==="Infinity")return Re(mr)}return Z(br);case x_.Null:return Pe(mr);case x_.LBrace:return wt(br);case x_.LBracket:return At(br);default:throw new EO(mr)}}t(yr,"parseValue");let zr=yr();if(M())throw new EO(_.token);let hn={loc:{start:{line:1,column:1,offset:0},end:{...zr.loc.end}}};return s.tokens&&(hn.tokens=l),s.ranges&&(hn.range=[hn.loc.start.offset,hn.loc.end.offset]),ST.document(zr,hn)}t(bot,"parse");var Ner=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function Sot(a){return a&&typeof a=="object"}t(Sot,"isObject");function Ier(a){return Sot(a)&&typeof a.type=="string"}t(Ier,"isNode");function Oer(a,s){function l(_,m){typeof s.enter=="function"&&s.enter(_,m);for(let b of Ner.get(_.type)){let D=_[b];Sot(D)&&(Array.isArray(D)?D.forEach(A=>l(A,_)):Ier(D)&&l(D,_))}typeof s.exit=="function"&&s.exit(_,m)}t(l,"visitNode"),l(a)}t(Oer,"traverse");function Tot(a,s=()=>!0){let l=[];return Oer(a,{enter(_,m){l.push({node:_,parent:m,phase:"enter"})},exit(_,m){l.push({node:_,parent:m,phase:"exit"})}}),l.filter(s).values()}t(Tot,"iterator");import Fer from"fs/promises";var OH=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),Hce=t(async a=>{try{return await Fer.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),FH=t(async a=>{try{return bot(a)}catch(s){if(s.column&&s.line&&s.message){let l=OH(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:l}}return}},"getSchemaAST");var xot=t(async(a,s,l)=>{try{if(a.length===0)return;for(let _ of a){let m=await Hce(_),b=await Ler(m,_,s,l);if(b)return b}}catch{}},"getRouteLocationByValue"),Ler=t(async(a,s,l,_)=>{try{if(!a)return;let m=null,b=await FH(a);if(b){for(let{node:D}of Tot(b))if(D.value&&D.value===l){m=D.loc;break}if(m!==null){let D=OH(a,m.start.line);return{file:s,line:m.start.line,column:m.start.column,length:m.end.column-m.start.column,lineText:D,suggestion:_}}}}catch{}},"getRouteLocationByValueFromSchema");import Eot from"fs/promises";import Gce from"path";var I6e="schemas",O6e=".oas.json";var CO=t(async a=>(await Eot.readdir(a)).map(l=>`${a}/${l}`).filter(l=>l.endsWith(O6e)).sort(),"getOpenApiFilesByAlphabetical"),cM=t(async a=>{let s=Gce.resolve(a,"config");return(await Eot.readdir(s)).filter(_=>_.endsWith(O6e)).length>=1},"oasFileInProject");function LH(a,s,l,_,m,b,D){if(b.has(l))return;let A;try{A=_.get(l)}catch(M){throw new M1({text:`Failed to resolve reference: ${l}`,detail:M.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:l,namespace:s,suggestion:"Check the reference and try again."}})}b.set(l,m.length),m.push(l),F6e(L6e(l),s,A,_,m,b,D)}t(LH,"chaseRefs");function F6e(a,s,l,_,m,b,D){if(Array.isArray(l))for(let A of l)F6e(a,s,A,_,m,b,D);else if(typeof l=="object")for(let A in l){if(A==="$ref"){let M=l[A];D&&(l[A]=D(s,M)),LH(a,s,n3(a,M),_,m,b,D)}F6e(a,s,l[A],_,m,b,D)}}t(F6e,"lookForRefs");function n3(a,s){let l=s.indexOf("#");return l>=0?`${Gce.resolve(a,s.substring(0,l))}${s.substring(l)}`:Gce.resolve(Gce.dirname(a),s)}t(n3,"getFullyQualifiedRefName");function L6e(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(L6e,"getFilePathNameFromRefName");var R6e=class{static{t(this,"Environment")}get WORKING_COPY_ENVIRONMENT(){return process.env.WORKING_COPY_ENVIRONMENT??"staging"}get ZUP_HOSTNAME(){return process.env.ZUP_HOSTNAME??"zuplo.app"}get ZUP_WORKING_COPY_HOSTNAME(){return process.env.ZUP_WORKING_COPY_HOSTNAME?process.env.ZUP_WORKING_COPY_HOSTNAME:this.WORKING_COPY_ENVIRONMENT==="staging"?"d1.zuplo.dev":"d2.zuplo.dev"}},Rer=new R6e,M6e=Rer;var QH=S_(Q4e(),1);var Z4e={};yst(Z4e,{UnsafePathError:()=>Sle,deleteFile:()=>Ssr,deleteFolder:()=>Asr,dirExists:()=>Tle,ensureDirectoryExists:()=>Csr,fileExists:()=>bsr,getParentDirFilename:()=>ksr,isNotFileOrDirectory:()=>Tsr,listFolderContents:()=>Qlt,listFolders:()=>Esr,mkdirForFilePathIfNotExits:()=>eut,mkdirIfNotExists:()=>Zlt,safePath:()=>Dsr,tarFolderContent:()=>wsr,untar:()=>Psr});import Ylt from"child_process";import f3 from"fs/promises";import u3 from"path";var Xlt=[".git","node_modules",".yarn",".DS_Store"];async function bsr(a){try{return(await f3.stat(a)).isFile()}catch{return!1}}t(bsr,"fileExists");async function Ssr(a,s){return await f3.rm(a,s)}t(Ssr,"deleteFile");async function Tle(a){try{return(await f3.stat(a)).isDirectory()}catch{return!1}}t(Tle,"dirExists");async function Tsr(a){try{return await f3.stat(a),!1}catch{return!0}}t(Tsr,"isNotFileOrDirectory");function xsr(a,s){let l=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),_=a.match(l);if(!_)return"";let m=a.split(_[0]);return m[1]===""?"":`/${m[1]}`}t(xsr,"getParentDirectory");async function Esr(a){if(!await Tle(a))return[];let s=await f3.readdir(a,{withFileTypes:!0}),l=[];for await(let _ of s)Xlt.includes(_.name)||_.isDirectory()&&l.push(_.name);return l}t(Esr,"listFolders");async function Qlt(a,s,l=!0){let _=xsr(a,s),m=await f3.readdir(a,{withFileTypes:!0}),b=[];for await(let D of m)if(!Xlt.includes(D.name)||!l)if(D.isDirectory()){let A=await Qlt(u3.join(a,D.name),s,l);b.push(...A)}else b.push(u3.join(_,D.name));return b}t(Qlt,"listFolderContents");var Zlt=t(async a=>{if(await Tle(a))return!0;await f3.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),eut=t(async a=>{let s=u3.dirname(a);return Zlt(s)},"mkdirForFilePathIfNotExits"),Csr=eut,Sle=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function Dsr(a){let s=t(l=>{if(!l.startsWith(a))throw new Sle("Resolved path is not part of the project.");return l},"ensureSafePath");return{resolve:t((...l)=>s(u3.resolve(...l)),"resolve")}}t(Dsr,"safePath");function ksr(a){return`${u3.basename(u3.dirname(a))}/${u3.basename(a)}`}t(ksr,"getParentDirFilename");function wsr(a,s,l,_){let m=u3.join(_,l);return Ylt.execSync(`tar --exclude='.git/' --exclude='dist/' -czf ${m} ${s}`,{cwd:a}),m}t(wsr,"tarFolderContent");function Psr(a,s,l,_=!1){Ylt.execSync(`tar -xf ${s} ${_?"--strip-components=1 ":""}-C ${l}`,{cwd:a})}t(Psr,"untar");async function Asr(a){if(await Tle(a))return await f3.rm(a,{recursive:!0})}t(Asr,"deleteFolder");var wl=Z4e;var CT=S_(Q4e(),1);import{readFile as Nsr}from"fs/promises";var FO=class extends Error{static{t(this,"CustomResolveError")}},_3=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,l){this.sourceDirectory=s,this.logger=l}dereference(s,l){return QH.$RefParser.dereference(s,{resolve:{json:!0,file:xle(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:l?.onDereference}})}bundle(s){return QH.$RefParser.bundle(s,{resolve:{file:xle(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return QH.$RefParser.parse(s,{resolve:{file:xle(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return QH.$RefParser.resolve(s,{resolve:{file:xle(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function xle(a,s){return{order:100,canRead(l){let _=Fsr(l.url);if(!(_===void 0||_==="file"))return!1;let b;try{b=tut(l.url)}catch(D){throw new FO(`Malformed URI: ${l.url}`,{cause:D})}try{wl.safePath(a).resolve(b)}catch(D){return s?.warn(D),!1}return!0},async read(l){let _;try{_=tut(l.url)}catch(m){throw new FO(`Malformed URI: ${l.url}`,{cause:m})}try{return await Nsr(_)}catch(m){throw new FO(`Error opening file "${_}"`,{cause:m})}}}}t(xle,"customResolver");var e3e=/^win/.test(globalThis.process?globalThis.process.platform:""),Isr=/\//g,Osr=/^(\w{2,}):\/\//i,t3e=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function Fsr(a){let s=Osr.exec(a);if(s)return s[1].toLowerCase()}t(Fsr,"getProtocol");function tut(a,s){a=decodeURI(a);for(let _=0;_<t3e.length;_+=2)a=a.replace(t3e[_],t3e[_+1]);let l=a.substr(0,7).toLowerCase()==="file://";return l&&(a=a[7]==="/"?a.substr(8):a.substr(7),e3e&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(l=!1,a=e3e?a:"/"+a)),e3e&&!l&&(a=a.replace(Isr,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(tut,"toFileSystemPath");var rut="YOUR_KEY_HERE";async function nut(a){let l=await new _3(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),_=a.openApiDocPath.replace(a.sourceDirectory,"");return Lsr({...a,relativeOpenApiPath:_},l)}t(nut,"buildPublicOpenApiFile");async function Lsr(a,s){Bsr({relativeOpenApiPath:a.relativeOpenApiPath},s);let l=s;return l=Msr(l),Rsr(l,a),l=jsr(l,a),iut(l,"x-zuplo"),l}t(Lsr,"buildRawOpenApiFile");function Rsr(a,{customDomain:s,deploymentName:l,environmentType:_}){let m;s?m=s:_&&l&&(m=_===dce.WORKING_COPY?`${l}.${M6e.ZUP_WORKING_COPY_HOSTNAME}`:`${l}.${M6e.ZUP_HOSTNAME}`),m?a.servers=[{url:`https://${m}`}]:a.servers=void 0}t(Rsr,"addServerHost");function Msr(a){if(!a.paths)return a;let{components:s}=a,l=s?{...s}:void 0,_=[];l&&l.parameters&&(_=Object.entries(l.parameters).reduce((b,[D,A])=>(KR in A&&mce(A[KR])&&(b.push(D),l.parameters&&delete l.parameters[D]),b),[]));let m=Object.entries(a.paths).reduce((b,[D,A])=>{if(!A)return b;let M={...A},U=["delete","get","head","patch","post","put","trace","options"];return U.forEach(ie=>{let se=A[ie];if(!se)return;if(mce(se[KR])){delete M[ie];return}let{parameters:Z}=se;if(!Z)return;let Re=Z.filter(Pe=>{if(KR in Pe&&mce(Pe[KR]))return!1;if("$ref"in Pe){let ke=Pe.$ref.split("/").pop();return ke?!_.includes(ke):!0}return!0});M[ie]={...se,parameters:Re}}),U.some(ie=>!!M[ie])&&(b[D]=M),b},{});return{...a,paths:m,components:l}}t(Msr,"removeHiddenRoutesAndParams");function jsr(a,{policiesConfig:s}){if(!a.paths)return a;let l=Object.entries(a.paths).reduce((_,[m,b])=>{if(!b)return _;let D={...b};return[D.delete,D.get,D.head,D.patch,D.post,D.put,D.trace,D.options].forEach(A=>{if(!A)return;let M=A["x-zuplo-route"]?.policies?.inbound?.reduce((se,Z)=>{let Re=s.policies?.find(({name:wt})=>wt===Z);if(!Re)return se;if(!(Re.handler.export==="CompositeInboundPolicy"))return se.concat(Z);let ke=Re.handler.options?.policies;return ke?se.concat(ke):se},[]),U=[];if(M&&M.forEach(se=>{s.policies?.forEach(Z=>{Z.name===se&&(Z.handler.export==="ApiAuthKeyInboundPolicy"||Z.handler.export==="ApiKeyInboundPolicy")&&!Z.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&U.push(Z)})}),U.length>0){let se=U.length>0&&U[0].handler&&U[0].handler.options&&U[0].handler.options.authHeader?U[0].handler.options.authHeader:"Authorization",Z=U.length>0&&U[0].handler&&U[0].handler.options&&(U[0].handler.options.authScheme||U[0].handler.options.authScheme==="")?U[0].handler.options.authScheme:"Bearer",Re=Z!==""?`${Z} ${rut}`:rut,Pe={name:se,in:"header",required:!0,example:Re,schema:{type:"string"},description:`The \`${se}\` header is used to authenticate with the API using your API key. Value is of the format \`${Re}\`.`};A.parameters?A.parameters.some(yr=>"name"in yr&&yr.name===Pe.name)||A.parameters.unshift(Pe):A.parameters=[Pe];let ke={type:"http",scheme:Z.toLowerCase()},wt="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(yr=>"name"in yr&&yr.type==="apiKey"||"type"in yr&&yr.type==="http"&&yr.scheme===Z)||(a.components.securitySchemes={...a.components.securitySchemes,[wt]:ke}):(a.components||(a.components={}),a.components.securitySchemes={[wt]:ke});let At={[wt]:[]};A.security?A.security.some(yr=>yr[wt]!==void 0)||A.security.unshift(At):A.security=[At]}let ie=[];if(M&&M.forEach(se=>{s.policies?.forEach(Z=>{Z.name===se&&(Z.handler.export==="RateLimitInboundPolicy"||Z.handler.export==="ComplexRateLimitInboundPolicy")&&ie.push(Z)})}),ie.length>0){let se={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},Z={...se,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:se,RateLimitWithRetryAfter:Z},A.responses||(A.responses={});let Re=ie.some(Pe=>Pe.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Re?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),_[m]=D,_},{});return{...a,paths:l}}t(jsr,"enrichSpecWithZuploData");function iut(a,s){for(let l in a)l.startsWith(s)?delete a[l]:typeof a[l]=="object"&&iut(a[l],s)}t(iut,"removePropertiesByPrefix");function Bsr({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new M1({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new M1({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 M1({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(Bsr,"assertIsZuploOpenApiSpec");function Usr(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let U=0;U<s.length;U++)s[U]=255;for(let U=0;U<a.length;U++){let ie=a.charAt(U),se=ie.charCodeAt(0);if(s[se]!==255)throw new TypeError(ie+" is ambiguous");s[se]=U}let l=a.length,_=a.charAt(0),m=Math.log(l)/Math.log(256),b=Math.log(256)/Math.log(l);function D(U){if(U instanceof Uint8Array||(ArrayBuffer.isView(U)?U=new Uint8Array(U.buffer,U.byteOffset,U.byteLength):Array.isArray(U)&&(U=Uint8Array.from(U))),!(U instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(U.length===0)return"";let ie=0,se=0,Z=0,Re=U.length;for(;Z!==Re&&U[Z]===0;)Z++,ie++;let Pe=(Re-Z)*b+1>>>0,ke=new Uint8Array(Pe);for(;Z!==Re;){let yr=U[Z],zr=0;for(let en=Pe-1;(yr!==0||zr<se)&&en!==-1;en--,zr++)yr+=256*ke[en]>>>0,ke[en]=yr%l>>>0,yr=yr/l>>>0;if(yr!==0)throw new Error("Non-zero carry");se=zr,Z++}let wt=Pe-se;for(;wt!==Pe&&ke[wt]===0;)wt++;let At=_.repeat(ie);for(;wt<Pe;++wt)At+=a.charAt(ke[wt]);return At}t(D,"encode");function A(U){if(typeof U!="string")throw new TypeError("Expected String");if(U.length===0)return new Uint8Array;let ie=0,se=0,Z=0;for(;U[ie]===_;)se++,ie++;let Re=(U.length-ie)*m+1>>>0,Pe=new Uint8Array(Re);for(;U[ie];){let yr=s[U.charCodeAt(ie)];if(yr===255)return;let zr=0;for(let en=Re-1;(yr!==0||zr<Z)&&en!==-1;en--,zr++)yr+=l*Pe[en]>>>0,Pe[en]=yr%256>>>0,yr=yr/256>>>0;if(yr!==0)throw new Error("Non-zero carry");Z=zr,ie++}let ke=Re-Z;for(;ke!==Re&&Pe[ke]===0;)ke++;let wt=new Uint8Array(se+(Re-ke)),At=se;for(;ke!==Re;)wt[At++]=Pe[ke++];return wt}t(A,"decodeUnsafe");function M(U){let ie=A(U);if(ie)return ie;throw new Error("Non-base"+l+" character")}return t(M,"decode"),{encode:D,decodeUnsafe:A,decode:M}}t(Usr,"base");var sut=Usr;var $sr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Ele=sut($sr);var r3e="2024-09-02",aut=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 out(){return new DT({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:r3e,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:aut[r3e]},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(out,"getMockEnvironment");var DT=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=out()),this.#r}constructor({build:s,runtime:l}){let _;try{if(l.__ZUPLO_CONFIG){let m=atob(l.__ZUPLO_CONFIG);_=JSON.parse(m)}if(l.ZUPLO_SYSTEM_CONFIGURATIONS){let m=new TextDecoder().decode(Ele.decode(l.ZUPLO_SYSTEM_CONFIGURATIONS)),b=JSON.parse(m);for(let D of Object.keys(b))l[D]=b[D]}}catch(m){console.error("Failed to parse runtime configuration",m)}this.config=_??{},this.build=s,this.runtime=l,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get 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 Jsr=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function cut(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!Jsr.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(cut,"isRestrictedEnvVariableName");function lut(a){return!!a.startsWith("ZUPLO_")}t(lut,"isZuploReadableEnvVariableName");var ZIr=new Proxy({},{get(a,s){let l=String(s);switch(l){case"ZUPLO_ENVIRONMENT_TYPE":return DT.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return DT.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return DT.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return DT.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return DT.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return DT.instance.build.BUILD_ID}if(!(cut(l)&&!lut(l)))return DT.instance.runtime[l]}});function ZH(a,s,l){return`_${rA(`${a}_${s}_${l}`)}`}t(ZH,"getRawOperationDataIdentifierName");function n3e(a,s,l,_){return`_${rA(a.toLowerCase())}_${s.toLowerCase()}_${l.toLowerCase()}_${_.toLowerCase()}`}t(n3e,"getIdForParameterSchema");function i3e(a,s,l){return`_${rA(a.toLowerCase())}_${s.toLowerCase()}_rb_${rA(l.toLowerCase())}`}t(i3e,"getIdForRequestBodySchema");function eG(a,s){return`_${rA(a)}_${rA(s)}`}t(eG,"getIdForRefSchema");function rA(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(rA,"sanitizedIdentifierName");var $mt=S_(Zft(),1);import Yue from"path";var hG=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,l,_,m,b){this.type=a,this.name=s,this.prefix=l,this.value=_,this.suffix=m,this.modifier=b}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Rcr=/[$_\p{ID_Start}]/u,Mcr=/[$_\u200C\u200D\p{ID_Continue}]/u,Q3e=".*";function jcr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(jcr,"Re");function r_t(a,s=!1){let l=[],_=0;for(;_<a.length;){let m=a[_],b=t(function(D){if(!s)throw new TypeError(D);l.push({type:"INVALID_CHAR",index:_,value:a[_++]})},"c");if(m==="*"){l.push({type:"ASTERISK",index:_,value:a[_++]});continue}if(m==="+"||m==="?"){l.push({type:"OTHER_MODIFIER",index:_,value:a[_++]});continue}if(m==="\\"){l.push({type:"ESCAPED_CHAR",index:_++,value:a[_++]});continue}if(m==="{"){l.push({type:"OPEN",index:_,value:a[_++]});continue}if(m==="}"){l.push({type:"CLOSE",index:_,value:a[_++]});continue}if(m===":"){let D="",A=_+1;for(;A<a.length;){let M=a.substr(A,1);if(A===_+1&&Rcr.test(M)||A!==_+1&&Mcr.test(M)){D+=a[A++];continue}break}if(!D){b(`Missing parameter name at ${_}`);continue}l.push({type:"NAME",index:_,value:D}),_=A;continue}if(m==="("){let D=1,A="",M=_+1,U=!1;if(a[M]==="?"){b(`Pattern cannot start with "?" at ${M}`);continue}for(;M<a.length;){if(!jcr(a[M],!1)){b(`Invalid character '${a[M]}' at ${M}.`),U=!0;break}if(a[M]==="\\"){A+=a[M++]+a[M++];continue}if(a[M]===")"){if(D--,D===0){M++;break}}else if(a[M]==="("&&(D++,a[M+1]!=="?")){b(`Capturing groups are not allowed at ${M}`),U=!0;break}A+=a[M++]}if(U)continue;if(D){b(`Unbalanced pattern at ${_}`);continue}if(!A){b(`Missing pattern at ${_}`);continue}l.push({type:"REGEX",index:_,value:A}),_=M;continue}l.push({type:"CHAR",index:_,value:a[_++]})}return l.push({type:"END",index:_,value:""}),l}t(r_t,"v");function n_t(a,s={}){let l=r_t(a);s.delimiter??="/#?",s.prefixes??="./";let _=`[^${AT(s.delimiter)}]+?`,m=[],b=0,D=0,A="",M=new Set,U=t(zr=>{if(D<l.length&&l[D].type===zr)return l[D++].value},"a"),ie=t(()=>U("OTHER_MODIFIER")??U("ASTERISK"),"f"),se=t(zr=>{let en=U(zr);if(en!==void 0)return en;let{type:hn,index:br}=l[D];throw new TypeError(`Unexpected ${hn} at ${br}, expected ${zr}`)},"d"),Z=t(()=>{let zr="",en;for(;en=U("CHAR")??U("ESCAPED_CHAR");)zr+=en;return zr},"T"),Re=t(zr=>zr,"Se"),Pe=s.encodePart||Re,ke="",wt=t(zr=>{ke+=zr},"U"),At=t(()=>{ke.length&&(m.push(new hG(3,"","",Pe(ke),"",3)),ke="")},"$"),yr=t((zr,en,hn,br,mr)=>{let Is=3;switch(mr){case"?":Is=1;break;case"*":Is=0;break;case"+":Is=2;break}if(!en&&!hn&&Is===3){wt(zr);return}if(At(),!en&&!hn){if(!zr)return;m.push(new hG(3,"","",Pe(zr),"",Is));return}let Pi;hn?hn==="*"?Pi=Q3e:Pi=hn:Pi=_;let Po=2;Pi===_?(Po=1,Pi=""):Pi===Q3e&&(Po=0,Pi="");let Ti;if(en?Ti=en:hn&&(Ti=b++),M.has(Ti))throw new TypeError(`Duplicate name '${Ti}'.`);M.add(Ti),m.push(new hG(Po,Ti,Pe(zr),Pi,Pe(br),Is))},"V");for(;D<l.length;){let zr=U("CHAR"),en=U("NAME"),hn=U("REGEX");if(!en&&!hn&&(hn=U("ASTERISK")),en||hn){let mr=zr??"";s.prefixes.indexOf(mr)===-1&&(wt(mr),mr=""),At();let Is=ie();yr(mr,en,hn,"",Is);continue}let br=zr??U("ESCAPED_CHAR");if(br){wt(br);continue}if(U("OPEN")){let mr=Z(),Is=U("NAME"),Pi=U("REGEX");!Is&&!Pi&&(Pi=U("ASTERISK"));let Po=Z();se("CLOSE");let Ti=ie();yr(mr,Is,Pi,Po,Ti);continue}At(),se("END")}return m}t(n_t,"D");function AT(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(AT,"S");function e_t(a){return a&&a.ignoreCase?"ui":"u"}t(e_t,"X");function Bcr(a,s,l){return i_t(n_t(a,l),s,l)}t(Bcr,"Z");function IM(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(IM,"k");function i_t(a,s,l={}){l.delimiter??="/#?",l.prefixes??="./",l.sensitive??=!1,l.strict??=!1,l.end??=!0,l.start??=!0,l.endsWith="";let _=l.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?_+=AT(A.value):_+=`(?:${AT(A.value)})${IM(A.modifier)}`;continue}s&&s.push(A.name);let M=`[^${AT(l.delimiter)}]+?`,U=A.value;if(A.type===1?U=M:A.type===0&&(U=Q3e),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?_+=`(${U})${IM(A.modifier)}`:_+=`((?:${U})${IM(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){_+=`(?:${AT(A.prefix)}(${U})${AT(A.suffix)})`,_+=IM(A.modifier);continue}_+=`(?:${AT(A.prefix)}`,_+=`((?:${U})(?:`,_+=AT(A.suffix),_+=AT(A.prefix),_+=`(?:${U}))*)${AT(A.suffix)})`,A.modifier===0&&(_+="?")}let m=`[${AT(l.endsWith)}]|$`,b=`[${AT(l.delimiter)}]`;if(l.end)return l.strict||(_+=`${b}?`),l.endsWith.length?_+=`(?=${m})`:_+="$",new RegExp(_,e_t(l));l.strict||(_+=`(?:${b}(?=${m}))?`);let D=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(D=l.delimiter.indexOf(A)>-1)}return D||(_+=`(?=${b}|${m})`),new RegExp(_,e_t(l))}t(i_t,"F");var h3={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Ucr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},$cr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function Jcr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(Jcr,"J");function s_t(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(s_t,"Q");function zcr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(zcr,"Ee");function a_t(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(a_t,"W");var o_t=["ftp","file","http","https","ws","wss"];function c_t(a){if(!a)return!0;for(let s of o_t)if(a.test(s))return!0;return!1}t(c_t,"N");function qcr(a,s){if(a=s_t(a,"#"),s||a==="")return a;let l=new URL("https://example.com");return l.hash=a,l.hash?l.hash.substring(1,l.hash.length):""}t(qcr,"te");function Vcr(a,s){if(a=s_t(a,"?"),s||a==="")return a;let l=new URL("https://example.com");return l.search=a,l.search?l.search.substring(1,l.search.length):""}t(Vcr,"re");function Wcr(a,s){return s||a===""?a:a_t(a)?f_t(a):u_t(a)}t(Wcr,"ne");function Hcr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.password=a,l.password}t(Hcr,"se");function Gcr(a,s){if(s||a==="")return a;let l=new URL("https://example.com");return l.username=a,l.username}t(Gcr,"ie");function Kcr(a,s,l){if(l||a==="")return a;if(s&&!o_t.includes(s))return new URL(`${s}:${a}`).pathname;let _=a[0]=="/";return a=new URL(_?a:"/-"+a,"https://example.com").pathname,_||(a=a.substring(2,a.length)),a}t(Kcr,"ae");function Ycr(a,s,l){return l_t(s)===a&&(a=""),l||a===""?a:__t(a)}t(Ycr,"oe");function Xcr(a,s){return a=zcr(a,":"),s||a===""?a:Z3e(a)}t(Xcr,"ce");function l_t(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(l_t,"_");function Z3e(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(Z3e,"y");function Qcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Qcr,"le");function Zcr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(Zcr,"fe");function u_t(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(u_t,"z");function f_t(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(f_t,"j");function __t(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(__t,"K");function elr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(elr,"he");function tlr(a){return a===""?a:new URL(`data:${a}`).pathname}t(tlr,"ue");function rlr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(rlr,"de");function nlr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(nlr,"pe");var ilr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=r_t(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#w()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#C()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#x()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#x()&&this.#i(5,1);break;case 4:this.#x()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#k()&&!this.#c?this.#i(6,1):this.#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 l=this.#u(a);return l.value===s&&(l.type==="CHAR"||l.type==="ESCAPED_CHAR"||l.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#C(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#x(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#k(){return this.#m(this.#t,":")}#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,"#")}#w(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,h3),a.encodePart=Z3e;let s=Bcr(this.#T(),void 0,a);this.#l=c_t(s)}},X3e=["protocol","username","password","hostname","port","pathname","search","hash"],m3="*";function t_t(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let l=new URL(a,s);return{protocol:l.protocol.substring(0,l.protocol.length-1),username:l.username,password:l.password,hostname:l.hostname,port:l.port,pathname:l.pathname,search:l.search!==""?l.search.substring(1,l.search.length):void 0,hash:l.hash!==""?l.hash.substring(1,l.hash.length):void 0}}t(t_t,"ge");function oA(a,s){return s?mG(a):a}t(oA,"b");function dG(a,s,l){let _;if(typeof s.baseURL=="string")try{_=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=oA(_.protocol.substring(0,_.protocol.length-1),l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=oA(_.username,l)),!l&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=oA(_.password,l)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=oA(_.hostname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=oA(_.port,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=oA(_.pathname,l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=oA(_.search.substring(1,_.search.length),l)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=oA(_.hash.substring(1,_.hash.length),l))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Xcr(s.protocol,l)),typeof s.username=="string"&&(a.username=Gcr(s.username,l)),typeof s.password=="string"&&(a.password=Hcr(s.password,l)),typeof s.hostname=="string"&&(a.hostname=Wcr(s.hostname,l)),typeof s.port=="string"&&(a.port=Ycr(s.port,a.protocol,l)),typeof s.pathname=="string"){if(a.pathname=s.pathname,_&&!Jcr(a.pathname,l)){let m=_.pathname.lastIndexOf("/");m>=0&&(a.pathname=oA(_.pathname.substring(0,m+1),l)+a.pathname)}a.pathname=Kcr(a.pathname,a.protocol,l)}return typeof s.search=="string"&&(a.search=Vcr(s.search,l)),typeof s.hash=="string"&&(a.hash=qcr(s.hash,l)),a}t(dG,"w");function mG(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(mG,"C");function slr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(slr,"Oe");function alr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let l=".*",_=`[^${slr(s.delimiter)}]+?`,m=/[$_\u200C\u200D\p{ID_Continue}]/u,b="";for(let D=0;D<a.length;++D){let A=a[D];if(A.type===3){if(A.modifier===3){b+=mG(A.value);continue}b+=`{${mG(A.value)}}${IM(A.modifier)}`;continue}let M=A.hasCustomName(),U=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),ie=D>0?a[D-1]:null,se=D<a.length-1?a[D+1]:null;if(!U&&M&&A.type===1&&A.modifier===3&&se&&!se.prefix.length&&!se.suffix.length)if(se.type===3){let Z=se.value.length>0?se.value[0]:"";U=m.test(Z)}else U=!se.hasCustomName();if(!U&&!A.prefix.length&&ie&&ie.type===3){let Z=ie.value[ie.value.length-1];U=s.prefixes.includes(Z)}U&&(b+="{"),b+=mG(A.prefix),M&&(b+=`:${A.name}`),A.type===2?b+=`(${A.value})`:A.type===1?M||(b+=`(${_})`):A.type===0&&(!M&&(!ie||ie.type===3||ie.modifier!==3||U||A.prefix!=="")?b+="*":b+=`(${l})`),A.type===1&&M&&A.suffix.length&&m.test(A.suffix[0])&&(b+="\\"),b+=mG(A.suffix),U&&(b+="}"),A.modifier!==3&&(b+=IM(A.modifier))}return b}t(alr,"ke");var p_t=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,l){try{let _;if(typeof s=="string"?_=s:l=s,typeof a=="string"){let A=new ilr(a);if(A.parse(),a=A.result,_===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=_}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(_)throw new TypeError("parameter 1 is not of type 'string'.")}typeof l>"u"&&(l={ignoreCase:!1});let m={ignoreCase:l.ignoreCase===!0},b={pathname:m3,protocol:m3,username:m3,password:m3,hostname:m3,port:m3,search:m3,hash:m3};this.#r=dG(b,a,!0),l_t(this.#r.protocol)===this.#r.port&&(this.#r.port="");let D;for(D of X3e){if(!(D in this.#r))continue;let A={},M=this.#r[D];switch(this.#e[D]=[],D){case"protocol":Object.assign(A,h3),A.encodePart=Z3e;break;case"username":Object.assign(A,h3),A.encodePart=Qcr;break;case"password":Object.assign(A,h3),A.encodePart=Zcr;break;case"hostname":Object.assign(A,Ucr),a_t(M)?A.encodePart=f_t:A.encodePart=u_t;break;case"port":Object.assign(A,h3),A.encodePart=__t;break;case"pathname":c_t(this.#n.protocol)?(Object.assign(A,$cr,m),A.encodePart=elr):(Object.assign(A,h3,m),A.encodePart=tlr);break;case"search":Object.assign(A,h3,m),A.encodePart=rlr;break;case"hash":Object.assign(A,h3,m),A.encodePart=nlr;break}try{this.#s[D]=n_t(M,A),this.#n[D]=i_t(this.#s[D],this.#e[D],A),this.#t[D]=alr(this.#s[D],A),this.#p=this.#p||this.#s[D].some(U=>U.type===2)}catch{throw new TypeError(`invalid ${D} pattern '${this.#r[D]}'.`)}}}catch(_){throw new TypeError(`Failed to construct 'URLPattern': ${_.message}`)}}test(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?l=dG(l,a,!1):l=dG(l,t_t(a,s),!1)}catch{return!1}let _;for(_ of X3e)if(!this.#n[_].exec(l[_]))return!1;return!0}exec(a={},s){let l={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?l=dG(l,a,!1):l=dG(l,t_t(a,s),!1)}catch{return null}let _={};s?_.inputs=[a,s]:_.inputs=[a];let m;for(m of X3e){let b=this.#n[m].exec(l[m]);if(!b)return null;let D={};for(let[A,M]of this.#e[m].entries())if(typeof M=="string"||typeof M=="number"){let U=b[A+1];D[M]=U}_[m]={input:l[m]??"",groups:D}}return _}static compareComponent(a,s,l){let _=t((A,M)=>{for(let U of["type","modifier","prefix","value","suffix"]){if(A[U]<M[U])return-1;if(A[U]!==M[U])return 1}return 0},"o"),m=new hG(3,"","","","",3),b=new hG(0,"","","","",3),D=t((A,M)=>{let U=0;for(;U<Math.min(A.length,M.length);++U){let ie=_(A[U],M[U]);if(ie)return ie}return A.length===M.length?0:_(A[U]??m,M[U]??m)},"s");return!s.#t[a]&&!l.#t[a]?0:s.#t[a]&&!l.#t[a]?D(s.#s[a],[b]):!s.#t[a]&&l.#t[a]?D([b],l.#s[a]):D(s.#s[a],l.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=p_t);import{AssertionError as olr}from"assert";function cA(a,s){if(a===!1)throw new olr({message:s})}t(cA,"assert");var Ac;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Ac||(Ac={}));function OM(a){return a.type===Ac.Object}t(OM,"isAstObject");function lA(a){return a.type===Ac.Property}t(lA,"isAstProperty");function d_t(a){return a.type===Ac.Array}t(d_t,"isAstArray");function FM(a){return a.type===Ac.Literal}t(FM,"isAstLiteral");function $O(a){if(a===void 0)throw new Error("Node is undefined");if(!OM(a))throw new Error("Node is not object")}t($O,"assertAstObject");import{findNodeAtLocation as clr,getNodeValue as llr,printParseErrorCode as ulr,visit as flr}from"jsonc-parser";var _lr={DEFAULT:{allowTrailingComma:!1}};function gG(a,s=[],l=_lr.DEFAULT){let _={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function m(M){_.type==="property"&&(_.length=M-_.offset,_=_.parent)}t(m,"ensurePropertyComplete");function b(M){return _.children?.push(M),M}t(b,"onValue"),flr(a,{onObjectBegin:t((M,U,ie)=>{_=b({type:"object",offset:M,length:-1,line:U+1,column:ie+1,parent:_,children:[]})},"onObjectBegin"),onObjectProperty:t((M,U,ie,se,Z)=>{_=b({type:"property",offset:U,length:-1,line:se+1,column:Z+1,parent:_,children:[]}),_.children?.push({type:"string",value:M,offset:U,length:ie,line:se,column:Z,parent:_})},"onObjectProperty"),onObjectEnd:t((M,U)=>{m(M+U),_.length=M+U-_.offset,_=_.parent,m(M+U)},"onObjectEnd"),onArrayBegin:t((M,U,ie,se)=>{_=b({type:"array",offset:M,length:-1,line:ie+1,column:se+1,parent:_,children:[]})},"onArrayBegin"),onArrayEnd:t((M,U)=>{_.length=M+U-_.offset,_=_.parent,m(M+U)},"onArrayEnd"),onLiteralValue:t((M,U,ie,se,Z)=>{b({type:plr(M),offset:U,length:ie,line:se+1,column:Z+1,parent:_,value:M}),m(U+ie)},"onLiteralValue"),onSeparator:t((M,U)=>{_.type==="property"&&(M===":"?_.colonOffset=U:M===","&&m(U))},"onSeparator"),onError:t((M,U,ie,se,Z)=>{s.push({error:M,offset:U,length:ie,line:se+1,column:Z+1})},"onError")},l);let A=_.children[0];return A&&delete A.parent,A}t(gG,"parse");function plr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(plr,"getNodeType");function eNe(a,s){return clr(a,s)}t(eNe,"findNodeAtLocation");function yG(a){return llr(a)}t(yG,"getNodeValue");function m_t(a){return ulr(a)}t(m_t,"printParseErrorCode");var vG=class{static{t(this,"AstAdapter")}parse(s){let _=gG(s,[]);if(_)return this.parseNode(_,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,l){switch(s.type){case"object":return this.createObject(s,l);case"array":return this.createArray(s,l);case"property":return this.createProperty(s,l);case"string":return this.createLiteral(s,l);case"number":return this.createLiteral(s,l);case"boolean":return this.createLiteral(s,l);case"null":return this.createLiteral(s,l)}}createLiteral(s,l){return{type:Ac.Literal,location:{line:s.line,column:s.column},parent:l,value:s.type==="null"?null:s.value}}createObject(s,l){let _={type:Ac.Object,children:[],parent:l,location:{line:s.line,column:s.column}};return s.children?.forEach(m=>{_.children.push(this.parseNode(m,_))}),_}createProperty(s,l){cA(s.children?.length===2,"Invalid property node");let _={type:Ac.Property,location:{line:s.line,column:s.column},parent:l,name:null,value:null};return _.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Ac.Identifier,parent:_},_.value=this.parseNode(s.children[1],_),_}createArray(s,l){let _={type:Ac.Array,location:{line:s.line,column:s.column},parent:l,children:[]};return s.children?.forEach(m=>_.children.push(this.parseNode(m,_))),_}};var $E={createLiteral:t((a,s)=>({type:Ac.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Ac.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Ac.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,l)=>{let _={type:Ac.Property,parent:l,name:null,value:s};return _.name={value:a,type:Ac.Identifier,parent:_},_.value.parent=_,_},"createProperty"),createArrayOfLiterals:t((a,s)=>{let l={type:Ac.Array,parent:s,children:[]};for(let _ of a)l.children.push($E.createLiteral(_,l));return l},"createArrayOfLiterals")};var dlr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,bG=class{static{t(this,"SourceGenerator")}generate(s){let l=[];return this.generateSource(l,s),l.join("")}generateSource(s,l){switch(l.type){case Ac.Array:return this.generateArray(s,l);case Ac.Object:return this.generateObject(s,l);case Ac.Property:return this.generateProperty(s,l);case Ac.Literal:return this.generateLiteral(s,l);case Ac.FunctionCall:return this.generateFunctionCall(s,l);case Ac.Identifier:return this.generateIdentifier(s,l);case Ac.Raw:return this.generateRaw(s,l);case Ac.TemplateString:return this.generateTemplateString(s,l)}}generateArray(s,l){s.push("["),l.children.map(_=>{this.generateSource(s,_),s.push(",")}),s.push("]")}generateObject(s,l){s.push("{"),l.children.forEach(_=>{this.generateSource(s,_),s.push(",")}),s.push("}")}generateProperty(s,l){this.generateIdentifier(s,l.name),s.push(":"),this.generateSource(s,l.value)}generateFunctionCall(s,l){s.push(l.name.value),s.push("("),l.children.forEach((_,m,b)=>{this.generateSource(s,_),m<b.length&&s.push(",")}),s.push(")")}generateRaw(s,l){s.push(l.value)}generateTemplateString(s,l){s.push("`"),s.push(l.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,l){if(l.value===null)return s.push("null");switch(typeof l.value){case"number":case"boolean":return s.push(`${l.value}`);case"string":{let _=l.value,m=JSON.stringify(_);return s.push(`${m}`)}}}generateIdentifier(s,l){let _=dlr.test(l.value)?l.value:`'${l.value}'`;s.push(_)}};import{parse as mlr}from"@swc/core";import hlr from"fs/promises";var h_t=t(async a=>{let s=new Set;try{let l=await hlr.readFile(a,"utf-8");(await mlr(l,{syntax:"typescript"})).body.forEach(m=>{m.type==="ExportDefaultDeclaration"||m.type==="ExportDefaultExpression"?s.add("default"):m.type==="ExportDeclaration"&&m.declaration.type==="FunctionDeclaration"?s.add(m.declaration.identifier.value):m.type==="ExportDeclaration"&&m.declaration.type==="VariableDeclaration"&&m.declaration.declarations[0].id.type==="Identifier"&&s.add(m.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var g_t={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var tNe={$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 y_t={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var rNe={$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 nNe={$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 Nmt=S_(emt(),1),Imt=S_(Amt(),1);var Jue=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new Imt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,Nmt.default)(this.ajv,{mode:"fast"})}addSchema(s,l){this.ajv.addSchema(s,l)}compile(s){let l=this.ajv.compile(s);return t(m=>({isValid:l(m),errors:this.toSimpleErrors(l.errors,m),warnings:[]}),"validator")}toSimpleErrors(s,l){let _=[];return s?.forEach(m=>{m.keyword==="enum"&&m.params.allowedValues&&Array.isArray(m.params.allowedValues)&&(m.message+=`; ${m.params.allowedValues.join(", ")}`),m.instancePath&&(m.instancePath=m.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let b={details:{}},D=m.instancePath.split("/");if(D.length>2){let M=D[1],U=D[2]?parseInt(D[2]):0,ie=D[3],se=isNaN(U)?void 0:l[M][U][ie];b={details:{property:M,index:U,field:ie,fieldValue:se}}}if(m.keyword==="required"&&m.params.missingProperty&&m.instancePath&&(m.message=`A 'path' is missing required property '${m.params.missingProperty}'`),m.keyword==="additionalProperties"&&m.params.additionalProperty&&m.instancePath&&(m.message=`A 'path' should NOT include property '${m.params.additionalProperty}'`),m.keyword==="type"&&m.params.type&&m.instancePath){let M=m.instancePath.split("/"),U=M[M.length-1];m.message=`Value of property '${U}' must be '${m.params.type}'`}let A=Object.assign(m,b);_.push(A)}),_}};var D3=Jue.instance;D3.addSchema(nNe,"route-configuration.schema.json");D3.addSchema(y_t,"policy-configuration.schema.json");D3.addSchema(tNe,"policies.schema.json");D3.addSchema(rNe,"open-api-route-configuration.schema.json");D3.addSchema(g_t,"fragments.schema.json");var Q5r=D3.compile(nNe),Omt=D3.compile(rNe),y8e=D3.compile(tNe);var zue=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=y8e(s),this.results}};var que=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=Omt(s),this.results}};import Thr from"path";var v8e=/\$import\((.*)\)/,Vue=/\$env\((.*?)\)/g;var dA=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,l,_,m){super(s),this.location={file:l,namespace:"",line:_?_.line:0,column:_?_.column:0,length:0,lineText:m??"",suggestion:""}}},Shr=t(a=>{let s=[],l=a;for(;l.parent;)s.push(l),l=l.parent;return s.reverse()},"invertTree"),k3=t((a,s)=>{if(!a)return!1;let l=Shr(a);return s.split("/").every((b,D)=>{let A=l[D];return A?b==="*"||lA(A)&&A.name.value===b?!0:b==="{}"?A.type===Ac.Object:b==="[]"?A.type===Ac.Array:!1:!1})},"testPosition");var Wue=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),OM(s)?s.children.forEach(l=>{this.visitor(l)}):d_t(s)?s.children.forEach(l=>{this.visitor(l)}):lA(s)&&this.visitor(s.value)}},Fmt=t((a,s,l)=>_=>{if(!lA(_)||!FM(_.value)||typeof _.value.value!="string")return;if(!a.some(b=>k3(_,b))){Vue.test(_.value.value)&&s.push(new dA("An $env() statement is not expected at this location.",l,_.location,_.value.value));return}let m=new RegExp(Vue).exec(_.value.value);if(m?.length===2&&m[0]===_.value.value){let b={type:Ac.Raw,parent:null,value:`environment["${m[1]}"]`};_.value=b}else{let b=_.value.value.replaceAll(new RegExp(Vue),(D,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);b!==_.value.value&&(_.value=$E.createTemplateString(b,_))}},"getEnvStatementTransformer");var ZG="config/routes.json",xhr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Ehr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Lmt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],Chr="handler/{}/options/{}/rewritePattern",Dhr="handler/{}/options/{}/baseUrl",Hue=class extends Wue{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let l=this.addedImports.get(s);if(!l)throw new Error("Import name is undefined. This should not happen.");return l}getImports(){let s=[];return this.addedImports.forEach((l,_)=>{s.push({name:l,path:_})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!lA(s)||!FM(s.value)||typeof s.value.value!="string")&&k3(s,Chr)){if(!s.parent||!OM(s.parent)){this.errors.push(new dA("Invalid node, expected object",ZG,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Rmt(l)},m=$E.createProperty("__rewriteFunction",_,s);s.parent.children.push(m)}}rewriteForwardFunction(s){if(!(!lA(s)||!FM(s.value)||typeof s.value.value!="string")&&k3(s,Dhr)){if(!s.parent||!OM(s.parent)){this.errors.push(new dA("Invalid node, expected object",ZG,s.parent?s.parent.location:s.location,void 0));return}let l=s.value.value,_={type:Ac.Raw,parent:null,value:Rmt(l)},m=$E.createProperty("__rewriteFunction",_,s);s.parent.children.push(m)}}replaceImportStatements(s){if(!lA(s)||!FM(s.value))return;let l=s.value.value;if(typeof l!="string")return;if(!Ehr.some(A=>k3(s,A))&&!Lmt.some(A=>k3(s,A))){if(v8e.test(l)){if(s.name.value==="$ref")return;this.errors.push(new dA("An $import() statement is not expected at this location.",ZG,s.location,l))}return}let _=v8e.exec(l);if(Lmt.some(A=>k3(s,A))&&!_)return;if(!_){this.errors.push(new dA("Invalid $import() statement",ZG,s.location,l));return}let m=_[1];m.startsWith(".")&&(m=Thr.join("..",m));let b=this.getImportName(m),D={type:Ac.Identifier,parent:s.parent,value:b};s.value=D}replaceEnvStatements=Fmt(xhr,this.errors,ZG)};function Rmt(a){return`(request, context) => {
561
561
  const { params, url, query, method, headers } = request;
562
562
  const { host, hostname, origin, pathname, port, search } = new URL(url);
563
563
  const e = encodeURIComponent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/core",
3
- "version": "6.20.17",
3
+ "version": "6.21.0",
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.20.17",
44
- "@zuplo/otel": "^6.20.17",
45
- "@zuplo/runtime": "^6.20.17"
43
+ "@zuplo/graphql": "^6.21.0",
44
+ "@zuplo/otel": "^6.21.0",
45
+ "@zuplo/runtime": "^6.21.0"
46
46
  }
47
47
  }