UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

14 lines 1.22 MB
"use strict";var SD=Object.create,_C=Object.defineProperty,RD=Object.getOwnPropertyDescriptor,kD=Object.getOwnPropertyNames,MD=Object.getPrototypeOf,mD=Object.prototype.hasOwnProperty,GD=(I,A)=>()=>(I&&(A=I(I=0)),A),U=(I,A)=>()=>(A||I((A={exports:{}}).exports,A),A.exports),gr=(I,A)=>{for(var e in A)_C(I,e,{get:A[e],enumerable:!0})},Ir=(I,A,e,g)=>{if(A&&typeof A=="object"||typeof A=="function")for(let C of kD(A))!mD.call(I,C)&&C!==e&&_C(I,C,{get:()=>A[C],enumerable:!(g=RD(A,C))||g.enumerable});return I},ND=(I,A,e)=>(e=I!=null?SD(MD(I)):{},Ir(A||!I||!I.__esModule?_C(e,"default",{value:I,enumerable:!0}):e,I)),TA=I=>Ir(_C({},"__esModule",{value:!0}),I),Qr=U((MR,Br)=>{"use strict";var aC=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,UD=typeof AbortController=="function",jC=UD?AbortController:class{constructor(){this.signal=new Cr}abort(A=new Error("This operation was aborted")){this.signal.reason=this.signal.reason||A,this.signal.aborted=!0,this.signal.dispatchEvent({type:"abort",target:this.signal})}},LD=typeof AbortSignal=="function",JD=typeof jC.AbortSignal=="function",Cr=LD?AbortSignal:JD?jC.AbortController:class{constructor(){this.reason=void 0,this.aborted=!1,this._listeners=[]}dispatchEvent(A){A.type==="abort"&&(this.aborted=!0,this.onabort(A),this._listeners.forEach(e=>e(A),this))}onabort(){}addEventListener(A,e){A==="abort"&&this._listeners.push(e)}removeEventListener(A,e){A==="abort"&&(this._listeners=this._listeners.filter(g=>g!==e))}},ji=new Set,Zi=(I,A)=>{let e=`LRU_CACHE_OPTION_${I}`;zC(e)&&zi(e,`${I} option`,`options.${A}`,lI)},Xi=(I,A)=>{let e=`LRU_CACHE_METHOD_${I}`;if(zC(e)){let{prototype:g}=lI,{get:C}=Object.getOwnPropertyDescriptor(g,I);zi(e,`${I} method`,`cache.${A}()`,C)}},KD=(I,A)=>{let e=`LRU_CACHE_PROPERTY_${I}`;if(zC(e)){let{prototype:g}=lI,{get:C}=Object.getOwnPropertyDescriptor(g,I);zi(e,`${I} property`,`cache.${A}`,C)}},tr=(...I)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(...I):console.error(...I)},zC=I=>!ji.has(I),zi=(I,A,e,g)=>{ji.add(I);let C=`The ${A} is deprecated. Please use ${e} instead.`;tr(C,"DeprecationWarning",I,g)},bg=I=>I&&I===Math.floor(I)&&I>0&&isFinite(I),ir=I=>bg(I)?I<=Math.pow(2,8)?Uint8Array:I<=Math.pow(2,16)?Uint16Array:I<=Math.pow(2,32)?Uint32Array:I<=Number.MAX_SAFE_INTEGER?hI:null:null,hI=class extends Array{constructor(A){super(A),this.fill(0)}},_i=class{constructor(A){if(A===0)return[];let e=ir(A);this.heap=new e(A),this.length=0}push(A){this.heap[this.length++]=A}pop(){return this.heap[--this.length]}},lI=class I{constructor(A={}){let{max:e=0,ttl:g,ttlResolution:C=1,ttlAutopurge:t,updateAgeOnGet:Q,updateAgeOnHas:u,allowStale:c,dispose:h,disposeAfter:r,noDisposeOnSet:a,noUpdateTTL:s,maxSize:i=0,maxEntrySize:B=0,sizeCalculation:E,fetchMethod:n,fetchContext:D,noDeleteOnFetchRejection:f,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:k,allowStaleOnFetchAbort:M,ignoreFetchAbort:N}=A,{length:J,maxAge:O,stale:b}=A instanceof I?{}:A;if(e!==0&&!bg(e))throw new TypeError("max option must be a nonnegative integer");let AA=e?ir(e):Array;if(!AA)throw new Error("invalid max value: "+e);if(this.max=e,this.maxSize=i,this.maxEntrySize=B||this.maxSize,this.sizeCalculation=E||J,this.sizeCalculation){if(!this.maxSize&&!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(this.fetchMethod=n||null,this.fetchMethod&&typeof this.fetchMethod!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.fetchContext=D,!this.fetchMethod&&D!==void 0)throw new TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=new Array(e).fill(null),this.valList=new Array(e).fill(null),this.next=new AA(e),this.prev=new AA(e),this.head=0,this.tail=0,this.free=new _i(e),this.initialFill=1,this.size=0,typeof h=="function"&&(this.dispose=h),typeof r=="function"?(this.disposeAfter=r,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!a,this.noUpdateTTL=!!s,this.noDeleteOnFetchRejection=!!f,this.allowStaleOnFetchRejection=!!k,this.allowStaleOnFetchAbort=!!M,this.ignoreFetchAbort=!!N,this.maxEntrySize!==0){if(this.maxSize!==0&&!bg(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");if(!bg(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!c||!!b,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!Q,this.updateAgeOnHas=!!u,this.ttlResolution=bg(C)||C===0?C:1,this.ttlAutopurge=!!t,this.ttl=g||O||0,this.ttl){if(!bg(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}if(this.max===0&&this.ttl===0&&this.maxSize===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.max&&!this.maxSize){let W="LRU_CACHE_UNBOUNDED";zC(W)&&(ji.add(W),tr("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",W,I))}b&&Zi("stale","allowStale"),O&&Zi("maxAge","ttl"),J&&Zi("length","sizeCalculation")}getRemainingTTL(A){return this.has(A,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new hI(this.max),this.starts=new hI(this.max),this.setItemTTL=(g,C,t=aC.now())=>{if(this.starts[g]=C!==0?t:0,this.ttls[g]=C,C!==0&&this.ttlAutopurge){let Q=setTimeout(()=>{this.isStale(g)&&this.delete(this.keyList[g])},C+1);Q.unref&&Q.unref()}},this.updateItemAge=g=>{this.starts[g]=this.ttls[g]!==0?aC.now():0},this.statusTTL=(g,C)=>{g&&(g.ttl=this.ttls[C],g.start=this.starts[C],g.now=A||e(),g.remainingTTL=g.now+g.ttl-g.start)};let A=0,e=()=>{let g=aC.now();if(this.ttlResolution>0){A=g;let C=setTimeout(()=>A=0,this.ttlResolution);C.unref&&C.unref()}return g};this.getRemainingTTL=g=>{let C=this.keyMap.get(g);return C===void 0?0:this.ttls[C]===0||this.starts[C]===0?1/0:this.starts[C]+this.ttls[C]-(A||e())},this.isStale=g=>this.ttls[g]!==0&&this.starts[g]!==0&&(A||e())-this.starts[g]>this.ttls[g]}updateItemAge(A){}statusTTL(A,e){}setItemTTL(A,e,g){}isStale(A){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new hI(this.max),this.removeItemSize=A=>{this.calculatedSize-=this.sizes[A],this.sizes[A]=0},this.requireSize=(A,e,g,C)=>{if(this.isBackgroundFetch(e))return 0;if(!bg(g))if(C){if(typeof C!="function")throw new TypeError("sizeCalculation must be a function");if(g=C(e,A),!bg(g))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 g},this.addItemSize=(A,e,g)=>{if(this.sizes[A]=e,this.maxSize){let C=this.maxSize-this.sizes[A];for(;this.calculatedSize>C;)this.evict(!0)}this.calculatedSize+=this.sizes[A],g&&(g.entrySize=e,g.totalCalculatedSize=this.calculatedSize)}}removeItemSize(A){}addItemSize(A,e){}requireSize(A,e,g,C){if(g||C)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}*indexes({allowStale:A=this.allowStale}={}){if(this.size)for(let e=this.tail;!(!this.isValidIndex(e)||((A||!this.isStale(e))&&(yield e),e===this.head));)e=this.prev[e]}*rindexes({allowStale:A=this.allowStale}={}){if(this.size)for(let e=this.head;!(!this.isValidIndex(e)||((A||!this.isStale(e))&&(yield e),e===this.tail));)e=this.next[e]}isValidIndex(A){return A!==void 0&&this.keyMap.get(this.keyList[A])===A}*entries(){for(let A of this.indexes())this.valList[A]!==void 0&&this.keyList[A]!==void 0&&!this.isBackgroundFetch(this.valList[A])&&(yield[this.keyList[A],this.valList[A]])}*rentries(){for(let A of this.rindexes())this.valList[A]!==void 0&&this.keyList[A]!==void 0&&!this.isBackgroundFetch(this.valList[A])&&(yield[this.keyList[A],this.valList[A]])}*keys(){for(let A of this.indexes())this.keyList[A]!==void 0&&!this.isBackgroundFetch(this.valList[A])&&(yield this.keyList[A])}*rkeys(){for(let A of this.rindexes())this.keyList[A]!==void 0&&!this.isBackgroundFetch(this.valList[A])&&(yield this.keyList[A])}*values(){for(let A of this.indexes())this.valList[A]!==void 0&&!this.isBackgroundFetch(this.valList[A])&&(yield this.valList[A])}*rvalues(){for(let A of this.rindexes())this.valList[A]!==void 0&&!this.isBackgroundFetch(this.valList[A])&&(yield this.valList[A])}[Symbol.iterator](){return this.entries()}find(A,e){for(let g of this.indexes()){let C=this.valList[g],t=this.isBackgroundFetch(C)?C.__staleWhileFetching:C;if(t!==void 0&&A(t,this.keyList[g],this))return this.get(this.keyList[g],e)}}forEach(A,e=this){for(let g of this.indexes()){let C=this.valList[g],t=this.isBackgroundFetch(C)?C.__staleWhileFetching:C;t!==void 0&&A.call(e,t,this.keyList[g],this)}}rforEach(A,e=this){for(let g of this.rindexes()){let C=this.valList[g],t=this.isBackgroundFetch(C)?C.__staleWhileFetching:C;t!==void 0&&A.call(e,t,this.keyList[g],this)}}get prune(){return Xi("prune","purgeStale"),this.purgeStale}purgeStale(){let A=!1;for(let e of this.rindexes({allowStale:!0}))this.isStale(e)&&(this.delete(this.keyList[e]),A=!0);return A}dump(){let A=[];for(let e of this.indexes({allowStale:!0})){let g=this.keyList[e],C=this.valList[e],t=this.isBackgroundFetch(C)?C.__staleWhileFetching:C;if(t===void 0)continue;let Q={value:t};if(this.ttls){Q.ttl=this.ttls[e];let u=aC.now()-this.starts[e];Q.start=Math.floor(Date.now()-u)}this.sizes&&(Q.size=this.sizes[e]),A.unshift([g,Q])}return A}load(A){this.clear();for(let[e,g]of A){if(g.start){let C=Date.now()-g.start;g.start=aC.now()-C}this.set(e,g.value,g)}}dispose(A,e,g){}set(A,e,{ttl:g=this.ttl,start:C,noDisposeOnSet:t=this.noDisposeOnSet,size:Q=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,status:h}={}){if(Q=this.requireSize(A,e,Q,u),this.maxEntrySize&&Q>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),this.delete(A),this;let r=this.size===0?void 0:this.keyMap.get(A);if(r===void 0)r=this.newIndex(),this.keyList[r]=A,this.valList[r]=e,this.keyMap.set(A,r),this.next[this.tail]=r,this.prev[r]=this.tail,this.tail=r,this.size++,this.addItemSize(r,Q,h),h&&(h.set="add"),c=!1;else{this.moveToTail(r);let a=this.valList[r];if(e!==a){if(this.isBackgroundFetch(a)?a.__abortController.abort(new Error("replaced")):t||(this.dispose(a,A,"set"),this.disposeAfter&&this.disposed.push([a,A,"set"])),this.removeItemSize(r),this.valList[r]=e,this.addItemSize(r,Q,h),h){h.set="replace";let s=a&&this.isBackgroundFetch(a)?a.__staleWhileFetching:a;s!==void 0&&(h.oldValue=s)}}else h&&(h.set="update")}if(g!==0&&this.ttl===0&&!this.ttls&&this.initializeTTLTracking(),c||this.setItemTTL(r,g,C),this.statusTTL(h,r),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return this.size===0?this.tail:this.size===this.max&&this.max!==0?this.evict(!1):this.free.length!==0?this.free.pop():this.initialFill++}pop(){if(this.size){let A=this.valList[this.head];return this.evict(!0),A}}evict(A){let e=this.head,g=this.keyList[e],C=this.valList[e];return this.isBackgroundFetch(C)?C.__abortController.abort(new Error("evicted")):(this.dispose(C,g,"evict"),this.disposeAfter&&this.disposed.push([C,g,"evict"])),this.removeItemSize(e),A&&(this.keyList[e]=null,this.valList[e]=null,this.free.push(e)),this.head=this.next[e],this.keyMap.delete(g),this.size--,e}has(A,{updateAgeOnHas:e=this.updateAgeOnHas,status:g}={}){let C=this.keyMap.get(A);if(C!==void 0)if(this.isStale(C))g&&(g.has="stale",this.statusTTL(g,C));else return e&&this.updateItemAge(C),g&&(g.has="hit"),this.statusTTL(g,C),!0;else g&&(g.has="miss");return!1}peek(A,{allowStale:e=this.allowStale}={}){let g=this.keyMap.get(A);if(g!==void 0&&(e||!this.isStale(g))){let C=this.valList[g];return this.isBackgroundFetch(C)?C.__staleWhileFetching:C}}backgroundFetch(A,e,g,C){let t=e===void 0?void 0:this.valList[e];if(this.isBackgroundFetch(t))return t;let Q=new jC;g.signal&&g.signal.addEventListener("abort",()=>Q.abort(g.signal.reason));let u={signal:Q.signal,options:g,context:C},c=(i,B=!1)=>{let{aborted:E}=Q.signal,n=g.ignoreFetchAbort&&i!==void 0;return g.status&&(E&&!B?(g.status.fetchAborted=!0,g.status.fetchError=Q.signal.reason,n&&(g.status.fetchAbortIgnored=!0)):g.status.fetchResolved=!0),E&&!n&&!B?r(Q.signal.reason):(this.valList[e]===s&&(i===void 0?s.__staleWhileFetching?this.valList[e]=s.__staleWhileFetching:this.delete(A):(g.status&&(g.status.fetchUpdated=!0),this.set(A,i,u.options))),i)},h=i=>(g.status&&(g.status.fetchRejected=!0,g.status.fetchError=i),r(i)),r=i=>{let{aborted:B}=Q.signal,E=B&&g.allowStaleOnFetchAbort,n=E||g.allowStaleOnFetchRejection,D=n||g.noDeleteOnFetchRejection;if(this.valList[e]===s&&(!D||s.__staleWhileFetching===void 0?this.delete(A):E||(this.valList[e]=s.__staleWhileFetching)),n)return g.status&&s.__staleWhileFetching!==void 0&&(g.status.returnedStale=!0),s.__staleWhileFetching;if(s.__returned===s)throw i},a=(i,B)=>{this.fetchMethod(A,t,u).then(E=>i(E),B),Q.signal.addEventListener("abort",()=>{(!g.ignoreFetchAbort||g.allowStaleOnFetchAbort)&&(i(),g.allowStaleOnFetchAbort&&(i=E=>c(E,!0)))})};g.status&&(g.status.fetchDispatched=!0);let s=new Promise(a).then(c,h);return s.__abortController=Q,s.__staleWhileFetching=t,s.__returned=null,e===void 0?(this.set(A,s,{...u.options,status:void 0}),e=this.keyMap.get(A)):this.valList[e]=s,s}isBackgroundFetch(A){return A&&typeof A=="object"&&typeof A.then=="function"&&Object.prototype.hasOwnProperty.call(A,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call(A,"__returned")&&(A.__returned===A||A.__returned===null)}async fetch(A,{allowStale:e=this.allowStale,updateAgeOnGet:g=this.updateAgeOnGet,noDeleteOnStaleGet:C=this.noDeleteOnStaleGet,ttl:t=this.ttl,noDisposeOnSet:Q=this.noDisposeOnSet,size:u=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:h=this.noUpdateTTL,noDeleteOnFetchRejection:r=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:a=this.allowStaleOnFetchRejection,ignoreFetchAbort:s=this.ignoreFetchAbort,allowStaleOnFetchAbort:i=this.allowStaleOnFetchAbort,fetchContext:B=this.fetchContext,forceRefresh:E=!1,status:n,signal:D}={}){if(!this.fetchMethod)return n&&(n.fetch="get"),this.get(A,{allowStale:e,updateAgeOnGet:g,noDeleteOnStaleGet:C,status:n});let f={allowStale:e,updateAgeOnGet:g,noDeleteOnStaleGet:C,ttl:t,noDisposeOnSet:Q,size:u,sizeCalculation:c,noUpdateTTL:h,noDeleteOnFetchRejection:r,allowStaleOnFetchRejection:a,allowStaleOnFetchAbort:i,ignoreFetchAbort:s,status:n,signal:D},S=this.keyMap.get(A);if(S===void 0){n&&(n.fetch="miss");let k=this.backgroundFetch(A,S,f,B);return k.__returned=k}else{let k=this.valList[S];if(this.isBackgroundFetch(k)){let b=e&&k.__staleWhileFetching!==void 0;return n&&(n.fetch="inflight",b&&(n.returnedStale=!0)),b?k.__staleWhileFetching:k.__returned=k}let M=this.isStale(S);if(!E&&!M)return n&&(n.fetch="hit"),this.moveToTail(S),g&&this.updateItemAge(S),this.statusTTL(n,S),k;let N=this.backgroundFetch(A,S,f,B),J=N.__staleWhileFetching!==void 0,O=J&&e;return n&&(n.fetch=J&&M?"stale":"refresh",O&&M&&(n.returnedStale=!0)),O?N.__staleWhileFetching:N.__returned=N}}get(A,{allowStale:e=this.allowStale,updateAgeOnGet:g=this.updateAgeOnGet,noDeleteOnStaleGet:C=this.noDeleteOnStaleGet,status:t}={}){let Q=this.keyMap.get(A);if(Q!==void 0){let u=this.valList[Q],c=this.isBackgroundFetch(u);return this.statusTTL(t,Q),this.isStale(Q)?(t&&(t.get="stale"),c?(t&&(t.returnedStale=e&&u.__staleWhileFetching!==void 0),e?u.__staleWhileFetching:void 0):(C||this.delete(A),t&&(t.returnedStale=e),e?u:void 0)):(t&&(t.get="hit"),c?u.__staleWhileFetching:(this.moveToTail(Q),g&&this.updateItemAge(Q),u))}else t&&(t.get="miss")}connect(A,e){this.prev[e]=A,this.next[A]=e}moveToTail(A){A!==this.tail&&(A===this.head?this.head=this.next[A]:this.connect(this.prev[A],this.next[A]),this.connect(this.tail,A),this.tail=A)}get del(){return Xi("del","delete"),this.delete}delete(A){let e=!1;if(this.size!==0){let g=this.keyMap.get(A);if(g!==void 0)if(e=!0,this.size===1)this.clear();else{this.removeItemSize(g);let C=this.valList[g];this.isBackgroundFetch(C)?C.__abortController.abort(new Error("deleted")):(this.dispose(C,A,"delete"),this.disposeAfter&&this.disposed.push([C,A,"delete"])),this.keyMap.delete(A),this.keyList[g]=null,this.valList[g]=null,g===this.tail?this.tail=this.prev[g]:g===this.head?this.head=this.next[g]:(this.next[this.prev[g]]=this.next[g],this.prev[this.next[g]]=this.prev[g]),this.size--,this.free.push(g)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return e}clear(){for(let A of this.rindexes({allowStale:!0})){let e=this.valList[A];if(this.isBackgroundFetch(e))e.__abortController.abort(new Error("deleted"));else{let g=this.keyList[A];this.dispose(e,g,"delete"),this.disposeAfter&&this.disposed.push([e,g,"delete"])}}if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return Xi("reset","clear"),this.clear}get length(){return KD("length","size"),this.size}static get AbortController(){return jC}static get AbortSignal(){return Cr}};Br.exports=lI}),sr=U(ke=>{"use strict";var HD=ke&&ke.__createBinding||(Object.create?function(I,A,e,g){g===void 0&&(g=e);var C=Object.getOwnPropertyDescriptor(A,e);(!C||("get"in C?!A.__esModule:C.writable||C.configurable))&&(C={enumerable:!0,get:function(){return A[e]}}),Object.defineProperty(I,g,C)}:function(I,A,e,g){g===void 0&&(g=e),I[g]=A[e]}),bD=ke&&ke.__setModuleDefault||(Object.create?function(I,A){Object.defineProperty(I,"default",{enumerable:!0,value:A})}:function(I,A){I.default=A}),Er=ke&&ke.__importStar||function(I){if(I&&I.__esModule)return I;var A={};if(I!=null)for(var e in I)e!=="default"&&Object.prototype.hasOwnProperty.call(I,e)&&HD(A,I,e);return bD(A,I),A};Object.defineProperty(ke,"__esModule",{value:!0}),ke.req=ke.json=ke.toBuffer=void 0;var YD=Er(require("http")),xD=Er(require("https"));async function rr(I){let A=0,e=[];for await(let g of I)A+=g.length,e.push(g);return Buffer.concat(e,A)}ke.toBuffer=rr;async function vD(I){let e=(await rr(I)).toString("utf8");try{return JSON.parse(e)}catch(g){let C=g;throw C.message+=` (input: ${e})`,C}}ke.json=vD;function TD(I,A={}){let g=((typeof I=="string"?I:I.href).startsWith("https:")?xD:YD).request(I,A),C=new Promise((t,Q)=>{g.once("response",t).once("error",Q).end()});return g.then=C.then.bind(C),g}ke.req=TD}),wI=U(Ne=>{"use strict";var or=Ne&&Ne.__createBinding||(Object.create?function(I,A,e,g){g===void 0&&(g=e);var C=Object.getOwnPropertyDescriptor(A,e);(!C||("get"in C?!A.__esModule:C.writable||C.configurable))&&(C={enumerable:!0,get:function(){return A[e]}}),Object.defineProperty(I,g,C)}:function(I,A,e,g){g===void 0&&(g=e),I[g]=A[e]}),PD=Ne&&Ne.__setModuleDefault||(Object.create?function(I,A){Object.defineProperty(I,"default",{enumerable:!0,value:A})}:function(I,A){I.default=A}),ar=Ne&&Ne.__importStar||function(I){if(I&&I.__esModule)return I;var A={};if(I!=null)for(var e in I)e!=="default"&&Object.prototype.hasOwnProperty.call(I,e)&&or(A,I,e);return PD(A,I),A},qD=Ne&&Ne.__exportStar||function(I,A){for(var e in I)e!=="default"&&!Object.prototype.hasOwnProperty.call(A,e)&&or(A,I,e)};Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.Agent=void 0;var OD=ar(require("net")),nr=ar(require("http")),VD=require("https");qD(sr(),Ne);var sg=Symbol("AgentBaseInternalState"),$i=class extends nr.Agent{constructor(A){super(A),this[sg]={}}isSecureEndpoint(A){if(A){if(typeof A.secureEndpoint=="boolean")return A.secureEndpoint;if(typeof A.protocol=="string")return A.protocol==="https:"}let{stack:e}=new Error;return typeof e!="string"?!1:e.split(` `).some(g=>g.indexOf("(https.js:")!==-1||g.indexOf("node:https:")!==-1)}incrementSockets(A){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;this.sockets[A]||(this.sockets[A]=[]);let e=new OD.Socket({writable:!1});return this.sockets[A].push(e),this.totalSocketCount++,e}decrementSockets(A,e){if(!this.sockets[A]||e===null)return;let g=this.sockets[A],C=g.indexOf(e);C!==-1&&(g.splice(C,1),this.totalSocketCount--,g.length===0&&delete this.sockets[A])}getName(A){return(typeof A.secureEndpoint=="boolean"?A.secureEndpoint:this.isSecureEndpoint(A))?VD.Agent.prototype.getName.call(this,A):super.getName(A)}createSocket(A,e,g){let C={...e,secureEndpoint:this.isSecureEndpoint(e)},t=this.getName(C),Q=this.incrementSockets(t);Promise.resolve().then(()=>this.connect(A,C)).then(u=>{if(this.decrementSockets(t,Q),u instanceof nr.Agent)return u.addRequest(A,C);this[sg].currentSocket=u,super.createSocket(A,e,g)},u=>{this.decrementSockets(t,Q),g(u)})}createConnection(){let A=this[sg].currentSocket;if(this[sg].currentSocket=void 0,!A)throw new Error("No socket was returned in the `connect()` function");return A}get defaultPort(){return this[sg].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(A){this[sg]&&(this[sg].defaultPort=A)}get protocol(){return this[sg].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(A){this[sg]&&(this[sg].protocol=A)}};Ne.Agent=$i}),cr=U((NR,ur)=>{"use strict";var fI=1e3,yI=fI*60,dI=yI*60,tI=dI*24,WD=tI*7,ZD=tI*365.25;ur.exports=function(I,A){A=A||{};var e=typeof I;if(e==="string"&&I.length>0)return XD(I);if(e==="number"&&isFinite(I))return A.long?jD(I):_D(I);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(I))};function XD(I){if(I=String(I),!(I.length>100)){var A=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(I);if(A){var e=parseFloat(A[1]),g=(A[2]||"ms").toLowerCase();switch(g){case"years":case"year":case"yrs":case"yr":case"y":return e*ZD;case"weeks":case"week":case"w":return e*WD;case"days":case"day":case"d":return e*tI;case"hours":case"hour":case"hrs":case"hr":case"h":return e*dI;case"minutes":case"minute":case"mins":case"min":case"m":return e*yI;case"seconds":case"second":case"secs":case"sec":case"s":return e*fI;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function _D(I){var A=Math.abs(I);return A>=tI?Math.round(I/tI)+"d":A>=dI?Math.round(I/dI)+"h":A>=yI?Math.round(I/yI)+"m":A>=fI?Math.round(I/fI)+"s":I+"ms"}function jD(I){var A=Math.abs(I);return A>=tI?$C(I,A,tI,"day"):A>=dI?$C(I,A,dI,"hour"):A>=yI?$C(I,A,yI,"minute"):A>=fI?$C(I,A,fI,"second"):I+" ms"}function $C(I,A,e,g){var C=A>=e*1.5;return Math.round(I/e)+" "+g+(C?"s":"")}}),AB=U((UR,Dr)=>{"use strict";function zD(I){e.debug=e,e.default=e,e.coerce=c,e.disable=t,e.enable=C,e.enabled=Q,e.humanize=cr(),e.destroy=h,Object.keys(I).forEach(r=>{e[r]=I[r]}),e.names=[],e.skips=[],e.formatters={};function A(r){let a=0;for(let s=0;s<r.length;s++)a=(a<<5)-a+r.charCodeAt(s),a|=0;return e.colors[Math.abs(a)%e.colors.length]}e.selectColor=A;function e(r){let a,s=null,i,B;function E(...n){if(!E.enabled)return;let D=E,f=Number(new Date),S=f-(a||f);D.diff=S,D.prev=a,D.curr=f,a=f,n[0]=e.coerce(n[0]),typeof n[0]!="string"&&n.unshift("%O");let k=0;n[0]=n[0].replace(/%([a-zA-Z%])/g,(N,J)=>{if(N==="%%")return"%";k++;let O=e.formatters[J];if(typeof O=="function"){let b=n[k];N=O.call(D,b),n.splice(k,1),k--}return N}),e.formatArgs.call(D,n),(D.log||e.log).apply(D,n)}return E.namespace=r,E.useColors=e.useColors(),E.color=e.selectColor(r),E.extend=g,E.destroy=e.destroy,Object.defineProperty(E,"enabled",{enumerable:!0,configurable:!1,get:()=>s!==null?s:(i!==e.namespaces&&(i=e.namespaces,B=e.enabled(r)),B),set:n=>{s=n}}),typeof e.init=="function"&&e.init(E),E}function g(r,a){let s=e(this.namespace+(typeof a>"u"?":":a)+r);return s.log=this.log,s}function C(r){e.save(r),e.namespaces=r,e.names=[],e.skips=[];let a,s=(typeof r=="string"?r:"").split(/[\s,]+/),i=s.length;for(a=0;a<i;a++)s[a]&&(r=s[a].replace(/\*/g,".*?"),r[0]==="-"?e.skips.push(new RegExp("^"+r.slice(1)+"$")):e.names.push(new RegExp("^"+r+"$")))}function t(){let r=[...e.names.map(u),...e.skips.map(u).map(a=>"-"+a)].join(",");return e.enable(""),r}function Q(r){if(r[r.length-1]==="*")return!0;let a,s;for(a=0,s=e.skips.length;a<s;a++)if(e.skips[a].test(r))return!1;for(a=0,s=e.names.length;a<s;a++)if(e.names[a].test(r))return!0;return!1}function u(r){return r.toString().substring(2,r.toString().length-2).replace(/\.\*\?$/,"*")}function c(r){return r instanceof Error?r.stack||r.message:r}function h(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return e.enable(e.load()),e}Dr.exports=zD}),hr=U((Ue,At)=>{"use strict";Ue.formatArgs=Ah,Ue.save=eh,Ue.load=gh,Ue.useColors=$D,Ue.storage=Ih(),Ue.destroy=(()=>{let I=!1;return()=>{I||(I=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),Ue.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function $D(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let I;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(I=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(I[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Ah(I){if(I[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+I[0]+(this.useColors?"%c ":" ")+"+"+At.exports.humanize(this.diff),!this.useColors)return;let A="color: "+this.color;I.splice(1,0,A,"color: inherit");let e=0,g=0;I[0].replace(/%[a-zA-Z%]/g,C=>{C!=="%%"&&(e++,C==="%c"&&(g=e))}),I.splice(g,0,A)}Ue.log=console.debug||console.log||(()=>{});function eh(I){try{I?Ue.storage.setItem("debug",I):Ue.storage.removeItem("debug")}catch{}}function gh(){let I;try{I=Ue.storage.getItem("debug")}catch{}return!I&&typeof process<"u"&&"env"in process&&(I=process.env.DEBUG),I}function Ih(){try{return localStorage}catch{}}At.exports=AB()(Ue);var{formatters:Ch}=At.exports;Ch.j=function(I){try{return JSON.stringify(I)}catch(A){return"[UnexpectedJSONParseError]: "+A.message}}}),wr=U((LR,lr)=>{"use strict";lr.exports=(I,A=process.argv)=>{let e=I.startsWith("-")?"":I.length===1?"-":"--",g=A.indexOf(e+I),C=A.indexOf("--");return g!==-1&&(C===-1||g<C)}}),dr=U((JR,yr)=>{"use strict";var th=require("os"),fr=require("tty"),Ye=wr(),{env:$A}=process,Yg;Ye("no-color")||Ye("no-colors")||Ye("color=false")||Ye("color=never")?Yg=0:(Ye("color")||Ye("colors")||Ye("color=true")||Ye("color=always"))&&(Yg=1),"FORCE_COLOR"in $A&&($A.FORCE_COLOR==="true"?Yg=1:$A.FORCE_COLOR==="false"?Yg=0:Yg=$A.FORCE_COLOR.length===0?1:Math.min(parseInt($A.FORCE_COLOR,10),3));function eB(I){return I===0?!1:{level:I,hasBasic:!0,has256:I>=2,has16m:I>=3}}function gB(I,A){if(Yg===0)return 0;if(Ye("color=16m")||Ye("color=full")||Ye("color=truecolor"))return 3;if(Ye("color=256"))return 2;if(I&&!A&&Yg===void 0)return 0;let e=Yg||0;if($A.TERM==="dumb")return e;if(process.platform==="win32"){let g=th.release().split(".");return Number(g[0])>=10&&Number(g[2])>=10586?Number(g[2])>=14931?3:2:1}if("CI"in $A)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(g=>g in $A)||$A.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in $A)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test($A.TEAMCITY_VERSION)?1:0;if($A.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in $A){let g=parseInt(($A.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch($A.TERM_PROGRAM){case"iTerm.app":return g>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test($A.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test($A.TERM)||"COLORTERM"in $A?1:e}function ih(I){let A=gB(I,I&&I.isTTY);return eB(A)}yr.exports={supportsColor:ih,stdout:eB(gB(!0,fr.isatty(1))),stderr:eB(gB(!0,fr.isatty(2)))}}),Fr=U((Ae,gt)=>{"use strict";var Bh=require("tty"),et=require("util");Ae.init=ah,Ae.log=sh,Ae.formatArgs=Eh,Ae.save=nh,Ae.load=oh,Ae.useColors=Qh,Ae.destroy=et.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),Ae.colors=[6,2,3,4,5,1];try{let I=dr();I&&(I.stderr||I).level>=2&&(Ae.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}Ae.inspectOpts=Object.keys(process.env).filter(I=>/^debug_/i.test(I)).reduce((I,A)=>{let e=A.substring(6).toLowerCase().replace(/_([a-z])/g,(C,t)=>t.toUpperCase()),g=process.env[A];return/^(yes|on|true|enabled)$/i.test(g)?g=!0:/^(no|off|false|disabled)$/i.test(g)?g=!1:g==="null"?g=null:g=Number(g),I[e]=g,I},{});function Qh(){return"colors"in Ae.inspectOpts?!!Ae.inspectOpts.colors:Bh.isatty(process.stderr.fd)}function Eh(I){let{namespace:A,useColors:e}=this;if(e){let g=this.color,C="\x1B[3"+(g<8?g:"8;5;"+g),t=` ${C};1m${A} \x1B[0m`;I[0]=t+I[0].split(` `).join(` `+t),I.push(C+"m+"+gt.exports.humanize(this.diff)+"\x1B[0m")}else I[0]=rh()+A+" "+I[0]}function rh(){return Ae.inspectOpts.hideDate?"":new Date().toISOString()+" "}function sh(...I){return process.stderr.write(et.formatWithOptions(Ae.inspectOpts,...I)+` `)}function nh(I){I?process.env.DEBUG=I:delete process.env.DEBUG}function oh(){return process.env.DEBUG}function ah(I){I.inspectOpts={};let A=Object.keys(Ae.inspectOpts);for(let e=0;e<A.length;e++)I.inspectOpts[A[e]]=Ae.inspectOpts[A[e]]}gt.exports=AB()(Ae);var{formatters:pr}=gt.exports;pr.o=function(I){return this.inspectOpts.colors=this.useColors,et.inspect(I,this.inspectOpts).split(` `).map(A=>A.trim()).join(" ")},pr.O=function(I){return this.inspectOpts.colors=this.useColors,et.inspect(I,this.inspectOpts)}}),xe=U((KR,IB)=>{"use strict";typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?IB.exports=hr():IB.exports=Fr()}),Rr=U(Sr=>{"use strict";var uh=require("url").parse,ch={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443},Dh=String.prototype.endsWith||function(I){return I.length<=this.length&&this.indexOf(I,this.length-I.length)!==-1};function hh(I){var A=typeof I=="string"?uh(I):I||{},e=A.protocol,g=A.host,C=A.port;if(typeof g!="string"||!g||typeof e!="string"||(e=e.split(":",1)[0],g=g.replace(/:\d*$/,""),C=parseInt(C)||ch[e]||0,!lh(g,C)))return"";var t=pI("npm_config_"+e+"_proxy")||pI(e+"_proxy")||pI("npm_config_proxy")||pI("all_proxy");return t&&t.indexOf("://")===-1&&(t=e+"://"+t),t}function lh(I,A){var e=(pI("npm_config_no_proxy")||pI("no_proxy")).toLowerCase();return e?e==="*"?!1:e.split(/[,\s]/).every(function(g){if(!g)return!0;var C=g.match(/^(.+):(\d+)$/),t=C?C[1]:g,Q=C?parseInt(C[2]):0;return Q&&Q!==A?!0:/^[.*]/.test(t)?(t.charAt(0)==="*"&&(t=t.slice(1)),!Dh.call(I,t)):I!==t}):!0}function pI(I){return process.env[I.toLowerCase()]||process.env[I.toUpperCase()]||""}Sr.getProxyForUrl=hh}),CB=U(ve=>{"use strict";var wh=ve&&ve.__createBinding||(Object.create?function(I,A,e,g){g===void 0&&(g=e);var C=Object.getOwnPropertyDescriptor(A,e);(!C||("get"in C?!A.__esModule:C.writable||C.configurable))&&(C={enumerable:!0,get:function(){return A[e]}}),Object.defineProperty(I,g,C)}:function(I,A,e,g){g===void 0&&(g=e),I[g]=A[e]}),fh=ve&&ve.__setModuleDefault||(Object.create?function(I,A){Object.defineProperty(I,"default",{enumerable:!0,value:A})}:function(I,A){I.default=A}),Mr=ve&&ve.__importStar||function(I){if(I&&I.__esModule)return I;var A={};if(I!=null)for(var e in I)e!=="default"&&Object.prototype.hasOwnProperty.call(I,e)&&wh(A,I,e);return fh(A,I),A},yh=ve&&ve.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(ve,"__esModule",{value:!0}),ve.HttpProxyAgent=void 0;var dh=Mr(require("net")),ph=Mr(require("tls")),Fh=yh(xe()),Sh=require("events"),Rh=wI(),kr=require("url"),FI=(0,Fh.default)("http-proxy-agent"),It=class extends Rh.Agent{constructor(A,e){super(e),this.proxy=typeof A=="string"?new kr.URL(A):A,this.proxyHeaders=e?.headers??{},FI("Creating new HttpProxyAgent instance: %o",this.proxy.href);let g=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),C=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={...e?kh(e,"headers"):null,host:g,port:C}}addRequest(A,e){A._header=null,this.setRequestProps(A,e),super.addRequest(A,e)}setRequestProps(A,e){let{proxy:g}=this,C=e.secureEndpoint?"https:":"http:",t=A.getHeader("host")||"localhost",Q=`${C}//${t}`,u=new kr.URL(A.path,Q);e.port!==80&&(u.port=String(e.port)),A.path=String(u);let c=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders};if(g.username||g.password){let h=`${decodeURIComponent(g.username)}:${decodeURIComponent(g.password)}`;c["Proxy-Authorization"]=`Basic ${Buffer.from(h).toString("base64")}`}c["Proxy-Connection"]||(c["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let h of Object.keys(c)){let r=c[h];r&&A.setHeader(h,r)}}async connect(A,e){A._header=null,A.path.includes("://")||this.setRequestProps(A,e);let g,C;FI("Regenerating stored HTTP header string for request"),A._implicitHeader(),A.outputData&&A.outputData.length>0&&(FI("Patching connection write() output buffer with updated header"),g=A.outputData[0].data,C=g.indexOf(`\r \r `)+4,A.outputData[0].data=A._header+g.substring(C),FI("Output buffer: %o",A.outputData[0].data));let t;return this.proxy.protocol==="https:"?(FI("Creating `tls.Socket`: %o",this.connectOpts),t=ph.connect(this.connectOpts)):(FI("Creating `net.Socket`: %o",this.connectOpts),t=dh.connect(this.connectOpts)),await(0,Sh.once)(t,"connect"),t}};It.protocols=["http","https"],ve.HttpProxyAgent=It;function kh(I,...A){let e={},g;for(g in I)A.includes(g)||(e[g]=I[g]);return e}}),mr=U(SI=>{"use strict";var Mh=SI&&SI.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(SI,"__esModule",{value:!0}),SI.parseProxyResponse=void 0;var mh=Mh(xe()),Ct=(0,mh.default)("https-proxy-agent:parse-proxy-response");function Gh(I){return new Promise((A,e)=>{let g=0,C=[];function t(){let r=I.read();r?h(r):I.once("readable",t)}function Q(){I.removeListener("end",u),I.removeListener("error",c),I.removeListener("readable",t)}function u(){Q(),Ct("onend"),e(new Error("Proxy connection ended before receiving CONNECT response"))}function c(r){Q(),Ct("onerror %o",r),e(r)}function h(r){C.push(r),g+=r.length;let a=Buffer.concat(C,g),s=a.indexOf(`\r \r `);if(s===-1){Ct("have not received end of HTTP headers yet..."),t();return}let i=a.slice(0,s).toString("ascii").split(`\r `),B=i.shift();if(!B)return I.destroy(),e(new Error("No header received from proxy CONNECT response"));let E=B.split(" "),n=+E[1],D=E.slice(2).join(" "),f={};for(let S of i){if(!S)continue;let k=S.indexOf(":");if(k===-1)return I.destroy(),e(new Error(`Invalid header from proxy CONNECT response: "${S}"`));let M=S.slice(0,k).toLowerCase(),N=S.slice(k+1).trimStart(),J=f[M];typeof J=="string"?f[M]=[J,N]:Array.isArray(J)?J.push(N):f[M]=N}Ct("got proxy server response: %o %o",B,f),Q(),A({connect:{statusCode:n,statusText:D,headers:f},buffered:a})}I.on("error",c),I.on("end",u),t()})}SI.parseProxyResponse=Gh}),iB=U(Te=>{"use strict";var Nh=Te&&Te.__createBinding||(Object.create?function(I,A,e,g){g===void 0&&(g=e);var C=Object.getOwnPropertyDescriptor(A,e);(!C||("get"in C?!A.__esModule:C.writable||C.configurable))&&(C={enumerable:!0,get:function(){return A[e]}}),Object.defineProperty(I,g,C)}:function(I,A,e,g){g===void 0&&(g=e),I[g]=A[e]}),Uh=Te&&Te.__setModuleDefault||(Object.create?function(I,A){Object.defineProperty(I,"default",{enumerable:!0,value:A})}:function(I,A){I.default=A}),Ur=Te&&Te.__importStar||function(I){if(I&&I.__esModule)return I;var A={};if(I!=null)for(var e in I)e!=="default"&&Object.prototype.hasOwnProperty.call(I,e)&&Nh(A,I,e);return Uh(A,I),A},Lr=Te&&Te.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(Te,"__esModule",{value:!0}),Te.HttpsProxyAgent=void 0;var tB=Ur(require("net")),Gr=Ur(require("tls")),Lh=Lr(require("assert")),Jh=Lr(xe()),Kh=wI(),Hh=require("url"),bh=mr(),uC=(0,Jh.default)("https-proxy-agent"),tt=class extends Kh.Agent{constructor(A,e){super(e),this.options={path:void 0},this.proxy=typeof A=="string"?new Hh.URL(A):A,this.proxyHeaders=e?.headers??{},uC("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let g=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),C=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...e?Nr(e,"headers"):null,host:g,port:C}}async connect(A,e){let{proxy:g}=this;if(!e.host)throw new TypeError('No "host" provided');let C;if(g.protocol==="https:"){uC("Creating `tls.Socket`: %o",this.connectOpts);let s=this.connectOpts.servername||this.connectOpts.host;C=Gr.connect({...this.connectOpts,servername:s})}else uC("Creating `net.Socket`: %o",this.connectOpts),C=tB.connect(this.connectOpts);let t=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},Q=tB.isIPv6(e.host)?`[${e.host}]`:e.host,u=`CONNECT ${Q}:${e.port} HTTP/1.1\r `;if(g.username||g.password){let s=`${decodeURIComponent(g.username)}:${decodeURIComponent(g.password)}`;t["Proxy-Authorization"]=`Basic ${Buffer.from(s).toString("base64")}`}t.Host=`${Q}:${e.port}`,t["Proxy-Connection"]||(t["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let s of Object.keys(t))u+=`${s}: ${t[s]}\r `;let c=(0,bh.parseProxyResponse)(C);C.write(`${u}\r `);let{connect:h,buffered:r}=await c;if(A.emit("proxyConnect",h),this.emit("proxyConnect",h,A),h.statusCode===200){if(A.once("socket",Yh),e.secureEndpoint){uC("Upgrading socket connection to TLS");let s=e.servername||e.host;return Gr.connect({...Nr(e,"host","path","port"),socket:C,servername:s})}return C}C.destroy();let a=new tB.Socket({writable:!1});return a.readable=!0,A.once("socket",s=>{uC("Replaying proxy buffer for failed request"),(0,Lh.default)(s.listenerCount("data")>0),s.push(r),s.push(null)}),a}};tt.protocols=["http","https"],Te.HttpsProxyAgent=tt;function Yh(I){I.resume()}function Nr(I,...A){let e={},g;for(g in I)A.includes(g)||(e[g]=I[g]);return e}}),br=U(Rg=>{"use strict";Object.defineProperty(Rg,"__esModule",{value:!0});var Jr=require("buffer"),iI={INVALID_ENCODING:"Invalid encoding provided. Please specify a valid encoding the internal Node.js Buffer supports.",INVALID_SMARTBUFFER_SIZE:"Invalid size provided. Size must be a valid integer greater than zero.",INVALID_SMARTBUFFER_BUFFER:"Invalid Buffer provided in SmartBufferOptions.",INVALID_SMARTBUFFER_OBJECT:"Invalid SmartBufferOptions object supplied to SmartBuffer constructor or factory methods.",INVALID_OFFSET:"An invalid offset value was provided.",INVALID_OFFSET_NON_NUMBER:"An invalid offset value was provided. A numeric value is required.",INVALID_LENGTH:"An invalid length value was provided.",INVALID_LENGTH_NON_NUMBER:"An invalid length value was provived. A numeric value is required.",INVALID_TARGET_OFFSET:"Target offset is beyond the bounds of the internal SmartBuffer data.",INVALID_TARGET_LENGTH:"Specified length value moves cursor beyong the bounds of the internal SmartBuffer data.",INVALID_READ_BEYOND_BOUNDS:"Attempted to read beyond the bounds of the managed data.",INVALID_WRITE_BEYOND_BOUNDS:"Attempted to write beyond the bounds of the managed data."};Rg.ERRORS=iI;function xh(I){if(!Jr.Buffer.isEncoding(I))throw new Error(iI.INVALID_ENCODING)}Rg.checkEncoding=xh;function Kr(I){return typeof I=="number"&&isFinite(I)&&qh(I)}Rg.isFiniteInteger=Kr;function Hr(I,A){if(typeof I=="number"){if(!Kr(I)||I<0)throw new Error(A?iI.INVALID_OFFSET:iI.INVALID_LENGTH)}else throw new Error(A?iI.INVALID_OFFSET_NON_NUMBER:iI.INVALID_LENGTH_NON_NUMBER)}function vh(I){Hr(I,!1)}Rg.checkLengthValue=vh;function Th(I){Hr(I,!0)}Rg.checkOffsetValue=Th;function Ph(I,A){if(I<0||I>A.length)throw new Error(iI.INVALID_TARGET_OFFSET)}Rg.checkTargetOffset=Ph;function qh(I){return typeof I=="number"&&isFinite(I)&&Math.floor(I)===I}function Oh(I){if(typeof BigInt>"u")throw new Error("Platform does not support JS BigInt type.");if(typeof Jr.Buffer.prototype[I]>"u")throw new Error(`Platform does not support Buffer.prototype.${I}.`)}Rg.bigIntAndBufferInt64Check=Oh}),xr=U(QB=>{"use strict";Object.defineProperty(QB,"__esModule",{value:!0});var wA=br(),Yr=4096,Vh="utf8",BB=class I{constructor(A){if(this.length=0,this._encoding=Vh,this._writeOffset=0,this._readOffset=0,I.isSmartBufferOptions(A))if(A.encoding&&(wA.checkEncoding(A.encoding),this._encoding=A.encoding),A.size)if(wA.isFiniteInteger(A.size)&&A.size>0)this._buff=Buffer.allocUnsafe(A.size);else throw new Error(wA.ERRORS.INVALID_SMARTBUFFER_SIZE);else if(A.buff)if(Buffer.isBuffer(A.buff))this._buff=A.buff,this.length=A.buff.length;else throw new Error(wA.ERRORS.INVALID_SMARTBUFFER_BUFFER);else this._buff=Buffer.allocUnsafe(Yr);else{if(typeof A<"u")throw new Error(wA.ERRORS.INVALID_SMARTBUFFER_OBJECT);this._buff=Buffer.allocUnsafe(Yr)}}static fromSize(A,e){return new this({size:A,encoding:e})}static fromBuffer(A,e){return new this({buff:A,encoding:e})}static fromOptions(A){return new this(A)}static isSmartBufferOptions(A){let e=A;return e&&(e.encoding!==void 0||e.size!==void 0||e.buff!==void 0)}readInt8(A){return this._readNumberValue(Buffer.prototype.readInt8,1,A)}readInt16BE(A){return this._readNumberValue(Buffer.prototype.readInt16BE,2,A)}readInt16LE(A){return this._readNumberValue(Buffer.prototype.readInt16LE,2,A)}readInt32BE(A){return this._readNumberValue(Buffer.prototype.readInt32BE,4,A)}readInt32LE(A){return this._readNumberValue(Buffer.prototype.readInt32LE,4,A)}readBigInt64BE(A){return wA.bigIntAndBufferInt64Check("readBigInt64BE"),this._readNumberValue(Buffer.prototype.readBigInt64BE,8,A)}readBigInt64LE(A){return wA.bigIntAndBufferInt64Check("readBigInt64LE"),this._readNumberValue(Buffer.prototype.readBigInt64LE,8,A)}writeInt8(A,e){return this._writeNumberValue(Buffer.prototype.writeInt8,1,A,e),this}insertInt8(A,e){return this._insertNumberValue(Buffer.prototype.writeInt8,1,A,e)}writeInt16BE(A,e){return this._writeNumberValue(Buffer.prototype.writeInt16BE,2,A,e)}insertInt16BE(A,e){return this._insertNumberValue(Buffer.prototype.writeInt16BE,2,A,e)}writeInt16LE(A,e){return this._writeNumberValue(Buffer.prototype.writeInt16LE,2,A,e)}insertInt16LE(A,e){return this._insertNumberValue(Buffer.prototype.writeInt16LE,2,A,e)}writeInt32BE(A,e){return this._writeNumberValue(Buffer.prototype.writeInt32BE,4,A,e)}insertInt32BE(A,e){return this._insertNumberValue(Buffer.prototype.writeInt32BE,4,A,e)}writeInt32LE(A,e){return this._writeNumberValue(Buffer.prototype.writeInt32LE,4,A,e)}insertInt32LE(A,e){return this._insertNumberValue(Buffer.prototype.writeInt32LE,4,A,e)}writeBigInt64BE(A,e){return wA.bigIntAndBufferInt64Check("writeBigInt64BE"),this._writeNumberValue(Buffer.prototype.writeBigInt64BE,8,A,e)}insertBigInt64BE(A,e){return wA.bigIntAndBufferInt64Check("writeBigInt64BE"),this._insertNumberValue(Buffer.prototype.writeBigInt64BE,8,A,e)}writeBigInt64LE(A,e){return wA.bigIntAndBufferInt64Check("writeBigInt64LE"),this._writeNumberValue(Buffer.prototype.writeBigInt64LE,8,A,e)}insertBigInt64LE(A,e){return wA.bigIntAndBufferInt64Check("writeBigInt64LE"),this._insertNumberValue(Buffer.prototype.writeBigInt64LE,8,A,e)}readUInt8(A){return this._readNumberValue(Buffer.prototype.readUInt8,1,A)}readUInt16BE(A){return this._readNumberValue(Buffer.prototype.readUInt16BE,2,A)}readUInt16LE(A){return this._readNumberValue(Buffer.prototype.readUInt16LE,2,A)}readUInt32BE(A){return this._readNumberValue(Buffer.prototype.readUInt32BE,4,A)}readUInt32LE(A){return this._readNumberValue(Buffer.prototype.readUInt32LE,4,A)}readBigUInt64BE(A){return wA.bigIntAndBufferInt64Check("readBigUInt64BE"),this._readNumberValue(Buffer.prototype.readBigUInt64BE,8,A)}readBigUInt64LE(A){return wA.bigIntAndBufferInt64Check("readBigUInt64LE"),this._readNumberValue(Buffer.prototype.readBigUInt64LE,8,A)}writeUInt8(A,e){return this._writeNumberValue(Buffer.prototype.writeUInt8,1,A,e)}insertUInt8(A,e){return this._insertNumberValue(Buffer.prototype.writeUInt8,1,A,e)}writeUInt16BE(A,e){return this._writeNumberValue(Buffer.prototype.writeUInt16BE,2,A,e)}insertUInt16BE(A,e){return this._insertNumberValue(Buffer.prototype.writeUInt16BE,2,A,e)}writeUInt16LE(A,e){return this._writeNumberValue(Buffer.prototype.writeUInt16LE,2,A,e)}insertUInt16LE(A,e){return this._insertNumberValue(Buffer.prototype.writeUInt16LE,2,A,e)}writeUInt32BE(A,e){return this._writeNumberValue(Buffer.prototype.writeUInt32BE,4,A,e)}insertUInt32BE(A,e){return this._insertNumberValue(Buffer.prototype.writeUInt32BE,4,A,e)}writeUInt32LE(A,e){return this._writeNumberValue(Buffer.prototype.writeUInt32LE,4,A,e)}insertUInt32LE(A,e){return this._insertNumberValue(Buffer.prototype.writeUInt32LE,4,A,e)}writeBigUInt64BE(A,e){return wA.bigIntAndBufferInt64Check("writeBigUInt64BE"),this._writeNumberValue(Buffer.prototype.writeBigUInt64BE,8,A,e)}insertBigUInt64BE(A,e){return wA.bigIntAndBufferInt64Check("writeBigUInt64BE"),this._insertNumberValue(Buffer.prototype.writeBigUInt64BE,8,A,e)}writeBigUInt64LE(A,e){return wA.bigIntAndBufferInt64Check("writeBigUInt64LE"),this._writeNumberValue(Buffer.prototype.writeBigUInt64LE,8,A,e)}insertBigUInt64LE(A,e){return wA.bigIntAndBufferInt64Check("writeBigUInt64LE"),this._insertNumberValue(Buffer.prototype.writeBigUInt64LE,8,A,e)}readFloatBE(A){return this._readNumberValue(Buffer.prototype.readFloatBE,4,A)}readFloatLE(A){return this._readNumberValue(Buffer.prototype.readFloatLE,4,A)}writeFloatBE(A,e){return this._writeNumberValue(Buffer.prototype.writeFloatBE,4,A,e)}insertFloatBE(A,e){return this._insertNumberValue(Buffer.prototype.writeFloatBE,4,A,e)}writeFloatLE(A,e){return this._writeNumberValue(Buffer.prototype.writeFloatLE,4,A,e)}insertFloatLE(A,e){return this._insertNumberValue(Buffer.prototype.writeFloatLE,4,A,e)}readDoubleBE(A){return this._readNumberValue(Buffer.prototype.readDoubleBE,8,A)}readDoubleLE(A){return this._readNumberValue(Buffer.prototype.readDoubleLE,8,A)}writeDoubleBE(A,e){return this._writeNumberValue(Buffer.prototype.writeDoubleBE,8,A,e)}insertDoubleBE(A,e){return this._insertNumberValue(Buffer.prototype.writeDoubleBE,8,A,e)}writeDoubleLE(A,e){return this._writeNumberValue(Buffer.prototype.writeDoubleLE,8,A,e)}insertDoubleLE(A,e){return this._insertNumberValue(Buffer.prototype.writeDoubleLE,8,A,e)}readString(A,e){let g;typeof A=="number"?(wA.checkLengthValue(A),g=Math.min(A,this.length-this._readOffset)):(e=A,g=this.length-this._readOffset),typeof e<"u"&&wA.checkEncoding(e);let C=this._buff.slice(this._readOffset,this._readOffset+g).toString(e||this._encoding);return this._readOffset+=g,C}insertString(A,e,g){return wA.checkOffsetValue(e),this._handleString(A,!0,e,g)}writeString(A,e,g){return this._handleString(A,!1,e,g)}readStringNT(A){typeof A<"u"&&wA.checkEncoding(A);let e=this.length;for(let C=this._readOffset;C<this.length;C++)if(this._buff[C]===0){e=C;break}let g=this._buff.slice(this._readOffset,e);return this._readOffset=e+1,g.toString(A||this._encoding)}insertStringNT(A,e,g){return wA.checkOffsetValue(e),this.insertString(A,e,g),this.insertUInt8(0,e+A.length),this}writeStringNT(A,e,g){return this.writeString(A,e,g),this.writeUInt8(0,typeof e=="number"?e+A.length:this.writeOffset),this}readBuffer(A){typeof A<"u"&&wA.checkLengthValue(A);let e=typeof A=="number"?A:this.length,g=Math.min(this.length,this._readOffset+e),C=this._buff.slice(this._readOffset,g);return this._readOffset=g,C}insertBuffer(A,e){return wA.checkOffsetValue(e),this._handleBuffer(A,!0,e)}writeBuffer(A,e){return this._handleBuffer(A,!1,e)}readBufferNT(){let A=this.length;for(let g=this._readOffset;g<this.length;g++)if(this._buff[g]===0){A=g;break}let e=this._buff.slice(this._readOffset,A);return this._readOffset=A+1,e}insertBufferNT(A,e){return wA.checkOffsetValue(e),this.insertBuffer(A,e),this.insertUInt8(0,e+A.length),this}writeBufferNT(A,e){return typeof e<"u"&&wA.checkOffsetValue(e),this.writeBuffer(A,e),this.writeUInt8(0,typeof e=="number"?e+A.length:this._writeOffset),this}clear(){return this._writeOffset=0,this._readOffset=0,this.length=0,this}remaining(){return this.length-this._readOffset}get readOffset(){return this._readOffset}set readOffset(A){wA.checkOffsetValue(A),wA.checkTargetOffset(A,this),this._readOffset=A}get writeOffset(){return this._writeOffset}set writeOffset(A){wA.checkOffsetValue(A),wA.checkTargetOffset(A,this),this