UNPKG

@shopify/cli

Version:

A CLI tool to build for the Shopify platform

6 lines • 165 kB
import{a as cn}from"./chunk-KLMDWDT2.js";import{a as Oo}from"./chunk-FUOIGXI4.js";import{a as R,c as C,e as ee,g as f}from"./chunk-VPRTJUIN.js";var fn=C((Jt,Kt)=>{"use strict";f();Object.defineProperty(Jt,"__esModule",{value:!0});function Do(t){return t.encrypted}var Gt=(t,e)=>{let r;typeof e=="function"?r={connect:e}:r=e;let n=typeof r.connect=="function",s=typeof r.secureConnect=="function",i=typeof r.close=="function",o=()=>{n&&r.connect(),Do(t)&&s&&(t.authorized?r.secureConnect():t.authorizationError||t.once("secureConnect",r.secureConnect)),i&&t.once("close",r.close)};t.writable&&!t.connecting?o():t.connecting?t.once("connect",o):t.destroyed&&i&&r.close(t._hadError)};Jt.default=Gt;Kt.exports=Gt;Kt.exports.default=Gt});var yn=C((il,mn)=>{"use strict";f();var Jo=new Set([200,203,204,206,300,301,308,404,405,410,414,501]),Ko=new Set([200,203,204,300,301,302,303,307,308,404,405,410,414,501]),Yo=new Set([500,502,503,504]),Qo={date:!0,connection:!0,"keep-alive":!0,"proxy-authenticate":!0,"proxy-authorization":!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0},Xo={"content-length":!0,"content-encoding":!0,"transfer-encoding":!0,"content-range":!0};function te(t){let e=parseInt(t,10);return isFinite(e)?e:0}function Zo(t){return t?Yo.has(t.status):!0}function Xt(t){let e={};if(!t)return e;let r=t.trim().split(/,/);for(let n of r){let[s,i]=n.split(/=/,2);e[s.trim()]=i===void 0?!0:i.trim().replace(/^"|"$/g,"")}return e}function ea(t){let e=[];for(let r in t){let n=t[r];e.push(n===!0?r:r+"="+n)}if(e.length)return e.join(", ")}mn.exports=class{constructor(e,r,{shared:n,cacheHeuristic:s,immutableMinTimeToLive:i,ignoreCargoCult:o,_fromObject:a}={}){if(a){this._fromObject(a);return}if(!r||!r.headers)throw Error("Response headers missing");this._assertRequestHasHeaders(e),this._responseTime=this.now(),this._isShared=n!==!1,this._ignoreCargoCult=!!o,this._cacheHeuristic=s!==void 0?s:.1,this._immutableMinTtl=i!==void 0?i:24*3600*1e3,this._status="status"in r?r.status:200,this._resHeaders=r.headers,this._rescc=Xt(r.headers["cache-control"]),this._method="method"in e?e.method:"GET",this._url=e.url,this._host=e.headers.host,this._noAuthorization=!e.headers.authorization,this._reqHeaders=r.headers.vary?e.headers:null,this._reqcc=Xt(e.headers["cache-control"]),this._ignoreCargoCult&&"pre-check"in this._rescc&&"post-check"in this._rescc&&(delete this._rescc["pre-check"],delete this._rescc["post-check"],delete this._rescc["no-cache"],delete this._rescc["no-store"],delete this._rescc["must-revalidate"],this._resHeaders=Object.assign({},this._resHeaders,{"cache-control":ea(this._rescc)}),delete this._resHeaders.expires,delete this._resHeaders.pragma),r.headers["cache-control"]==null&&/no-cache/.test(r.headers.pragma)&&(this._rescc["no-cache"]=!0)}now(){return Date.now()}storable(){return!!(!this._reqcc["no-store"]&&(this._method==="GET"||this._method==="HEAD"||this._method==="POST"&&this._hasExplicitExpiration())&&Ko.has(this._status)&&!this._rescc["no-store"]&&(!this._isShared||!this._rescc.private)&&(!this._isShared||this._noAuthorization||this._allowsStoringAuthenticated())&&(this._resHeaders.expires||this._rescc["max-age"]||this._isShared&&this._rescc["s-maxage"]||this._rescc.public||Jo.has(this._status)))}_hasExplicitExpiration(){return!!(this._isShared&&this._rescc["s-maxage"]||this._rescc["max-age"]||this._resHeaders.expires)}_assertRequestHasHeaders(e){if(!e||!e.headers)throw Error("Request headers missing")}satisfiesWithoutRevalidation(e){return!this.evaluateRequest(e).revalidation}_evaluateRequestHitResult(e){return{response:{headers:this.responseHeaders()},revalidation:e}}_evaluateRequestRevalidation(e,r){return{synchronous:r,headers:this.revalidationHeaders(e)}}_evaluateRequestMissResult(e){return{response:void 0,revalidation:this._evaluateRequestRevalidation(e,!0)}}evaluateRequest(e){if(this._assertRequestHasHeaders(e),this._rescc["must-revalidate"])return this._evaluateRequestMissResult(e);if(!this._requestMatches(e,!1))return this._evaluateRequestMissResult(e);let r=Xt(e.headers["cache-control"]);return r["no-cache"]||/no-cache/.test(e.headers.pragma)?this._evaluateRequestMissResult(e):r["max-age"]&&this.age()>te(r["max-age"])?this._evaluateRequestMissResult(e):r["min-fresh"]&&this.maxAge()-this.age()<te(r["min-fresh"])?this._evaluateRequestMissResult(e):this.stale()?"max-stale"in r&&(r["max-stale"]===!0||r["max-stale"]>this.age()-this.maxAge())?this._evaluateRequestHitResult(void 0):this.useStaleWhileRevalidate()?this._evaluateRequestHitResult(this._evaluateRequestRevalidation(e,!1)):this._evaluateRequestMissResult(e):this._evaluateRequestHitResult(void 0)}_requestMatches(e,r){return!!((!this._url||this._url===e.url)&&this._host===e.headers.host&&(!e.method||this._method===e.method||r&&e.method==="HEAD")&&this._varyMatches(e))}_allowsStoringAuthenticated(){return!!(this._rescc["must-revalidate"]||this._rescc.public||this._rescc["s-maxage"])}_varyMatches(e){if(!this._resHeaders.vary)return!0;if(this._resHeaders.vary==="*")return!1;let r=this._resHeaders.vary.trim().toLowerCase().split(/\s*,\s*/);for(let n of r)if(e.headers[n]!==this._reqHeaders[n])return!1;return!0}_copyWithoutHopByHopHeaders(e){let r={};for(let n in e)Qo[n]||(r[n]=e[n]);if(e.connection){let n=e.connection.trim().split(/\s*,\s*/);for(let s of n)delete r[s]}if(r.warning){let n=r.warning.split(/,/).filter(s=>!/^\s*1[0-9][0-9]/.test(s));n.length?r.warning=n.join(",").trim():delete r.warning}return r}responseHeaders(){let e=this._copyWithoutHopByHopHeaders(this._resHeaders),r=this.age();return r>3600*24&&!this._hasExplicitExpiration()&&this.maxAge()>3600*24&&(e.warning=(e.warning?`${e.warning}, `:"")+'113 - "rfc7234 5.5.4"'),e.age=`${Math.round(r)}`,e.date=new Date(this.now()).toUTCString(),e}date(){let e=Date.parse(this._resHeaders.date);return isFinite(e)?e:this._responseTime}age(){let e=this._ageValue(),r=(this.now()-this._responseTime)/1e3;return e+r}_ageValue(){return te(this._resHeaders.age)}maxAge(){if(!this.storable()||this._rescc["no-cache"]||this._isShared&&this._resHeaders["set-cookie"]&&!this._rescc.public&&!this._rescc.immutable||this._resHeaders.vary==="*")return 0;if(this._isShared){if(this._rescc["proxy-revalidate"])return 0;if(this._rescc["s-maxage"])return te(this._rescc["s-maxage"])}if(this._rescc["max-age"])return te(this._rescc["max-age"]);let e=this._rescc.immutable?this._immutableMinTtl:0,r=this.date();if(this._resHeaders.expires){let n=Date.parse(this._resHeaders.expires);return Number.isNaN(n)||n<r?0:Math.max(e,(n-r)/1e3)}if(this._resHeaders["last-modified"]){let n=Date.parse(this._resHeaders["last-modified"]);if(isFinite(n)&&r>n)return Math.max(e,(r-n)/1e3*this._cacheHeuristic)}return e}timeToLive(){let e=this.maxAge()-this.age(),r=e+te(this._rescc["stale-if-error"]),n=e+te(this._rescc["stale-while-revalidate"]);return Math.round(Math.max(0,e,r,n)*1e3)}stale(){return this.maxAge()<=this.age()}_useStaleIfError(){return this.maxAge()+te(this._rescc["stale-if-error"])>this.age()}useStaleWhileRevalidate(){let e=te(this._rescc["stale-while-revalidate"]);return e>0&&this.maxAge()+e>this.age()}static fromObject(e){return new this(void 0,void 0,{_fromObject:e})}_fromObject(e){if(this._responseTime)throw Error("Reinitialized");if(!e||e.v!==1)throw Error("Invalid serialization");this._responseTime=e.t,this._isShared=e.sh,this._cacheHeuristic=e.ch,this._immutableMinTtl=e.imm!==void 0?e.imm:24*3600*1e3,this._ignoreCargoCult=!!e.icc,this._status=e.st,this._resHeaders=e.resh,this._rescc=e.rescc,this._method=e.m,this._url=e.u,this._host=e.h,this._noAuthorization=e.a,this._reqHeaders=e.reqh,this._reqcc=e.reqcc}toObject(){return{v:1,t:this._responseTime,sh:this._isShared,ch:this._cacheHeuristic,imm:this._immutableMinTtl,icc:this._ignoreCargoCult,st:this._status,resh:this._resHeaders,rescc:this._rescc,m:this._method,u:this._url,h:this._host,a:this._noAuthorization,reqh:this._reqHeaders,reqcc:this._reqcc}}revalidationHeaders(e){this._assertRequestHasHeaders(e);let r=this._copyWithoutHopByHopHeaders(e.headers);if(delete r["if-range"],!this._requestMatches(e,!0)||!this.storable())return delete r["if-none-match"],delete r["if-modified-since"],r;if(this._resHeaders.etag&&(r["if-none-match"]=r["if-none-match"]?`${r["if-none-match"]}, ${this._resHeaders.etag}`:this._resHeaders.etag),r["accept-ranges"]||r["if-match"]||r["if-unmodified-since"]||this._method&&this._method!="GET"){if(delete r["if-modified-since"],r["if-none-match"]){let s=r["if-none-match"].split(/,/).filter(i=>!/^\s*W\//.test(i));s.length?r["if-none-match"]=s.join(",").trim():delete r["if-none-match"]}}else this._resHeaders["last-modified"]&&!r["if-modified-since"]&&(r["if-modified-since"]=this._resHeaders["last-modified"]);return r}revalidatedPolicy(e,r){if(this._assertRequestHasHeaders(e),this._useStaleIfError()&&Zo(r))return{policy:this,modified:!1,matches:!0};if(!r||!r.headers)throw Error("Response headers missing");let n=!1;r.status!==void 0&&r.status!=304?n=!1:r.headers.etag&&!/^\s*W\//.test(r.headers.etag)?n=this._resHeaders.etag&&this._resHeaders.etag.replace(/^\s*W\//,"")===r.headers.etag:this._resHeaders.etag&&r.headers.etag?n=this._resHeaders.etag.replace(/^\s*W\//,"")===r.headers.etag.replace(/^\s*W\//,""):this._resHeaders["last-modified"]?n=this._resHeaders["last-modified"]===r.headers["last-modified"]:!this._resHeaders.etag&&!this._resHeaders["last-modified"]&&!r.headers.etag&&!r.headers["last-modified"]&&(n=!0);let s={shared:this._isShared,cacheHeuristic:this._cacheHeuristic,immutableMinTimeToLive:this._immutableMinTtl,ignoreCargoCult:this._ignoreCargoCult};if(!n)return{policy:new this.constructor(e,r,s),modified:r.status!=304,matches:!1};let i={};for(let a in this._resHeaders)i[a]=a in r.headers&&!Xo[a]?r.headers[a]:this._resHeaders[a];let o=Object.assign({},r,{status:this._status,method:this._method,headers:i});return{policy:new this.constructor(e,o,s),modified:!1,matches:!0}}}});var gn=C(Zt=>{f();Zt.stringify=function t(e){if(typeof e>"u")return e;if(e&&Buffer.isBuffer(e))return JSON.stringify(":base64:"+e.toString("base64"));if(e&&e.toJSON&&(e=e.toJSON()),e&&typeof e=="object"){var r="",n=Array.isArray(e);r=n?"[":"{";var s=!0;for(var i in e){var o=typeof e[i]=="function"||!n&&typeof e[i]>"u";Object.hasOwnProperty.call(e,i)&&!o&&(s||(r+=","),s=!1,n?e[i]==null?r+="null":r+=t(e[i]):e[i]!==void 0&&(r+=t(i)+":"+t(e[i])))}return r+=n?"]":"}",r}else return typeof e=="string"?JSON.stringify(/^:/.test(e)?":"+e:e):typeof e>"u"?"null":JSON.stringify(e)};Zt.parse=function(t){return JSON.parse(t,function(e,r){return typeof r=="string"?/^:base64:/.test(r)?Buffer.from(r.substring(8),"base64"):/^:/.test(r)?r.substring(1):r:r})}});var En=C((ml,wn)=>{"use strict";f();var ra=R("events"),bn=gn(),na=t=>{let e={redis:"@keyv/redis",rediss:"@keyv/redis",mongodb:"@keyv/mongo",mongo:"@keyv/mongo",sqlite:"@keyv/sqlite",postgresql:"@keyv/postgres",postgres:"@keyv/postgres",mysql:"@keyv/mysql",etcd:"@keyv/etcd",offline:"@keyv/offline",tiered:"@keyv/tiered"};if(t.adapter||t.uri){let r=t.adapter||/^[^:+]*/.exec(t.uri)[0];return new(R(e[r]))(t)}return new Map},_n=["sqlite","postgres","mysql","mongo","redis","tiered"],er=class extends ra{constructor(e,{emitErrors:r=!0,...n}={}){if(super(),this.opts={namespace:"keyv",serialize:bn.stringify,deserialize:bn.parse,...typeof e=="string"?{uri:e}:e,...n},!this.opts.store){let i={...this.opts};this.opts.store=na(i)}if(this.opts.compression){let i=this.opts.compression;this.opts.serialize=i.serialize.bind(i),this.opts.deserialize=i.deserialize.bind(i)}typeof this.opts.store.on=="function"&&r&&this.opts.store.on("error",i=>this.emit("error",i)),this.opts.store.namespace=this.opts.namespace;let s=i=>async function*(){for await(let[o,a]of typeof i=="function"?i(this.opts.store.namespace):i){let u=await this.opts.deserialize(a);if(!(this.opts.store.namespace&&!o.includes(this.opts.store.namespace))){if(typeof u.expires=="number"&&Date.now()>u.expires){this.delete(o);continue}yield[this._getKeyUnprefix(o),u.value]}}};typeof this.opts.store[Symbol.iterator]=="function"&&this.opts.store instanceof Map?this.iterator=s(this.opts.store):typeof this.opts.store.iterator=="function"&&this.opts.store.opts&&this._checkIterableAdaptar()&&(this.iterator=s(this.opts.store.iterator.bind(this.opts.store)))}_checkIterableAdaptar(){return _n.includes(this.opts.store.opts.dialect)||_n.findIndex(e=>this.opts.store.opts.url.includes(e))>=0}_getKeyPrefix(e){return`${this.opts.namespace}:${e}`}_getKeyPrefixArray(e){return e.map(r=>`${this.opts.namespace}:${r}`)}_getKeyUnprefix(e){return e.split(":").splice(1).join(":")}get(e,r){let{store:n}=this.opts,s=Array.isArray(e),i=s?this._getKeyPrefixArray(e):this._getKeyPrefix(e);if(s&&n.getMany===void 0){let o=[];for(let a of i)o.push(Promise.resolve().then(()=>n.get(a)).then(u=>typeof u=="string"?this.opts.deserialize(u):this.opts.compression?this.opts.deserialize(u):u).then(u=>{if(u!=null)return typeof u.expires=="number"&&Date.now()>u.expires?this.delete(a).then(()=>{}):r&&r.raw?u:u.value}));return Promise.allSettled(o).then(a=>{let u=[];for(let l of a)u.push(l.value);return u})}return Promise.resolve().then(()=>s?n.getMany(i):n.get(i)).then(o=>typeof o=="string"?this.opts.deserialize(o):this.opts.compression?this.opts.deserialize(o):o).then(o=>{if(o!=null)return s?o.map((a,u)=>{if(typeof a=="string"&&(a=this.opts.deserialize(a)),a!=null){if(typeof a.expires=="number"&&Date.now()>a.expires){this.delete(e[u]).then(()=>{});return}return r&&r.raw?a:a.value}}):typeof o.expires=="number"&&Date.now()>o.expires?this.delete(e).then(()=>{}):r&&r.raw?o:o.value})}set(e,r,n){let s=this._getKeyPrefix(e);typeof n>"u"&&(n=this.opts.ttl),n===0&&(n=void 0);let{store:i}=this.opts;return Promise.resolve().then(()=>{let o=typeof n=="number"?Date.now()+n:null;return typeof r=="symbol"&&this.emit("error","symbol cannot be serialized"),r={value:r,expires:o},this.opts.serialize(r)}).then(o=>i.set(s,o,n)).then(()=>!0)}delete(e){let{store:r}=this.opts;if(Array.isArray(e)){let s=this._getKeyPrefixArray(e);if(r.deleteMany===void 0){let i=[];for(let o of s)i.push(r.delete(o));return Promise.allSettled(i).then(o=>o.every(a=>a.value===!0))}return Promise.resolve().then(()=>r.deleteMany(s))}let n=this._getKeyPrefix(e);return Promise.resolve().then(()=>r.delete(n))}clear(){let{store:e}=this.opts;return Promise.resolve().then(()=>e.clear())}has(e){let r=this._getKeyPrefix(e),{store:n}=this.opts;return Promise.resolve().then(async()=>typeof n.has=="function"?n.has(r):await n.get(r)!==void 0)}disconnect(){let{store:e}=this.opts;if(typeof e.disconnect=="function")return e.disconnect()}};wn.exports=er});var Rn=C((ql,On)=>{"use strict";f();var fa=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];On.exports=(t,e)=>{if(e._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");let r=new Set(Object.keys(t).concat(fa)),n={};for(let s of r)s in e||(n[s]={get(){let i=t[s];return typeof i=="function"?i.bind(t):i},set(i){t[s]=i},enumerable:!0,configurable:!1});return Object.defineProperties(e,n),t.once("aborted",()=>{e.destroy(),e.emit("aborted")}),t.once("close",()=>{t.complete&&e.readable?e.once("end",()=>{e.emit("close")}):e.emit("close")}),e}});var Pn=C((Ll,Cn)=>{"use strict";f();var{Transform:da,PassThrough:pa}=R("stream"),sr=R("zlib"),ma=Rn();Cn.exports=t=>{let e=(t.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(e))return t;let r=e==="br";if(r&&typeof sr.createBrotliDecompress!="function")return t.destroy(new Error("Brotli is not supported on Node.js < 12")),t;let n=!0,s=new da({transform(a,u,l){n=!1,l(null,a)},flush(a){a()}}),i=new pa({autoDestroy:!1,destroy(a,u){t.destroy(),u(a)}}),o=r?sr.createBrotliDecompress():sr.createUnzip();return o.once("error",a=>{if(n&&!t.readable){i.end();return}i.destroy(a)}),ma(t,i),t.pipe(s).pipe(o).pipe(i),i}});var yr=C((Mf,zn)=>{"use strict";f();var mr=class{constructor(e={}){if(!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=e.maxSize,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(e,r){if(this.cache.set(e,r),this._size++,this._size>=this.maxSize){if(this._size=0,typeof this.onEviction=="function")for(let[n,s]of this.oldCache.entries())this.onEviction(n,s);this.oldCache=this.cache,this.cache=new Map}}get(e){if(this.cache.has(e))return this.cache.get(e);if(this.oldCache.has(e)){let r=this.oldCache.get(e);return this.oldCache.delete(e),this._set(e,r),r}}set(e,r){return this.cache.has(e)?this.cache.set(e,r):this._set(e,r),this}has(e){return this.cache.has(e)||this.oldCache.has(e)}peek(e){if(this.cache.has(e))return this.cache.get(e);if(this.oldCache.has(e))return this.oldCache.get(e)}delete(e){let r=this.cache.delete(e);return r&&this._size--,this.oldCache.delete(e)||r}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}*[Symbol.iterator](){for(let e of this.cache)yield e;for(let e of this.oldCache){let[r]=e;this.cache.has(r)||(yield e)}}get size(){let e=0;for(let r of this.oldCache.keys())this.cache.has(r)||e++;return Math.min(this._size+e,this.maxSize)}};zn.exports=mr});var gr=C((Vf,Mn)=>{"use strict";f();Mn.exports=t=>{if(t.listenerCount("error")!==0)return t;t.__destroy=t._destroy,t._destroy=(...r)=>{let n=r.pop();t.__destroy(...r,async s=>{await Promise.resolve(),n(s)})};let e=r=>{Promise.resolve().then(()=>{t.emit("error",r)})};return t.once("error",e),Promise.resolve().then(()=>{t.off("error",e)}),t}});var le=C((Jf,Yn)=>{"use strict";f();var{URL:Wn}=R("url"),Ia=R("events"),Ha=R("tls"),Fa=R("http2"),Da=yr(),$a=gr(),K=Symbol("currentStreamCount"),Vn=Symbol("request"),Y=Symbol("cachedOriginSet"),ce=Symbol("gracefullyClosing"),xt=Symbol("length"),Gn=["createConnection","maxDeflateDynamicTableSize","maxSettings","maxSessionMemory","maxHeaderListPairs","maxOutstandingPings","maxReservedRemoteStreams","maxSendHeaderBlockLength","paddingStrategy","peerMaxConcurrentStreams","settings","family","localAddress","rejectUnauthorized","pskCallback","minDHSize","path","socket","ca","cert","sigalgs","ciphers","clientCertEngine","crl","dhparam","ecdhCurve","honorCipherOrder","key","privateKeyEngine","privateKeyIdentifier","maxVersion","minVersion","pfx","secureOptions","secureProtocol","sessionIdContext","ticketKeys"],Ba=(t,e,r)=>{let n=0,s=t.length;for(;n<s;){let i=n+s>>>1;r(t[i],e)?n=i+1:s=i}return n},Ua=(t,e)=>t.remoteSettings.maxConcurrentStreams>e.remoteSettings.maxConcurrentStreams,br=(t,e)=>{for(let r=0;r<t.length;r++){let n=t[r];n[Y].length>0&&n[Y].length<e[Y].length&&n[Y].every(s=>e[Y].includes(s))&&n[K]+e[K]<=e.remoteSettings.maxConcurrentStreams&&Kn(n)}},Jn=(t,e)=>{for(let r=0;r<t.length;r++){let n=t[r];if(e[Y].length>0&&e[Y].length<n[Y].length&&e[Y].every(s=>n[Y].includes(s))&&e[K]+n[K]<=n.remoteSettings.maxConcurrentStreams)return Kn(e),!0}return!1},Kn=t=>{t[ce]=!0,t[K]===0&&t.close()},Pe=class t extends Ia{constructor({timeout:e=0,maxSessions:r=Number.POSITIVE_INFINITY,maxEmptySessions:n=10,maxCachedTlsSessions:s=100}={}){super(),this.sessions={},this.queue={},this.timeout=e,this.maxSessions=r,this.maxEmptySessions=n,this._emptySessionCount=0,this._sessionCount=0,this.settings={enablePush:!1,initialWindowSize:1024*1024*32},this.tlsSessionCache=new Da({maxSize:s})}get protocol(){return"https:"}normalizeOptions(e){let r="";for(let n=0;n<Gn.length;n++){let s=Gn[n];r+=":",e&&e[s]!==void 0&&(r+=e[s])}return r}_processQueue(){if(this._sessionCount>=this.maxSessions){this.closeEmptySessions(this.maxSessions-this._sessionCount+1);return}for(let e in this.queue)for(let r in this.queue[e]){let n=this.queue[e][r];n.completed||(n.completed=!0,n())}}_isBetterSession(e,r){return e>r}_accept(e,r,n,s){let i=0;for(;i<r.length&&e[K]<e.remoteSettings.maxConcurrentStreams;)r[i].resolve(e),i++;r.splice(0,i),r.length>0&&(this.getSession(n,s,r),r.length=0)}getSession(e,r,n){return new Promise((s,i)=>{Array.isArray(n)&&n.length>0?(n=[...n],s()):n=[{resolve:s,reject:i}];try{if(typeof e=="string")e=new Wn(e);else if(!(e instanceof Wn))throw new TypeError("The `origin` argument needs to be a string or an URL object");if(r){let{servername:d}=r,{hostname:g}=e;if(d&&g!==d)throw new Error(`Origin ${g} differs from servername ${d}`)}}catch(d){for(let g=0;g<n.length;g++)n[g].reject(d);return}let o=this.normalizeOptions(r),a=e.origin;if(o in this.sessions){let d=this.sessions[o],g=-1,m=-1,y;for(let b=0;b<d.length;b++){let p=d[b],v=p.remoteSettings.maxConcurrentStreams;if(v<g)break;if(!p[Y].includes(a))continue;let w=p[K];w>=v||p[ce]||p.destroyed||(y||(g=v),this._isBetterSession(w,m)&&(y=p,m=w))}if(y){this._accept(y,n,a,r);return}}if(o in this.queue){if(a in this.queue[o]){this.queue[o][a].listeners.push(...n);return}}else this.queue[o]={[xt]:0};let u=()=>{o in this.queue&&this.queue[o][a]===l&&(delete this.queue[o][a],--this.queue[o][xt]===0&&delete this.queue[o])},l=async()=>{this._sessionCount++;let d=`${a}:${o}`,g=!1,m;try{let y={...r};y.settings===void 0&&(y.settings=this.settings),y.session===void 0&&(y.session=this.tlsSessionCache.get(d)),m=await(y.createConnection||this.createConnection).call(this,e,y),y.createConnection=()=>m;let p=Fa.connect(e,y);p[K]=0,p[ce]=!1;let v=()=>{let{socket:S}=p,x;return S.servername===!1?(S.servername=S.remoteAddress,x=p.originSet,S.servername=!1):x=p.originSet,x},w=()=>p[K]<p.remoteSettings.maxConcurrentStreams;p.socket.once("session",S=>{this.tlsSessionCache.set(d,S)}),p.once("error",S=>{for(let x=0;x<n.length;x++)n[x].reject(S);this.tlsSessionCache.delete(d)}),p.setTimeout(this.timeout,()=>{p.destroy()}),p.once("close",()=>{if(this._sessionCount--,g){this._emptySessionCount--;let S=this.sessions[o];S.length===1?delete this.sessions[o]:S.splice(S.indexOf(p),1)}else{u();let S=new Error("Session closed without receiving a SETTINGS frame");S.code="HTTP2WRAPPER_NOSETTINGS";for(let x=0;x<n.length;x++)n[x].reject(S)}this._processQueue()});let P=()=>{let S=this.queue[o];if(!S)return;let x=p[Y];for(let T=0;T<x.length;T++){let N=x[T];if(N in S){let{listeners:A,completed:Z}=S[N],O=0;for(;O<A.length&&w();)A[O].resolve(p),O++;if(S[N].listeners.splice(0,O),S[N].listeners.length===0&&!Z&&(delete S[N],--S[xt]===0)){delete this.queue[o];break}if(!w())break}}};p.on("origin",()=>{p[Y]=v()||[],p[ce]=!1,Jn(this.sessions[o],p),!(p[ce]||!w())&&(P(),w()&&br(this.sessions[o],p))}),p.once("remoteSettings",()=>{if(l.destroyed){let S=new Error("Agent has been destroyed");for(let x=0;x<n.length;x++)n[x].reject(S);p.destroy();return}if(p.setLocalWindowSize&&p.setLocalWindowSize(1024*1024*4),p[Y]=v()||[],p.socket.encrypted){let S=p[Y][0];if(S!==a){let x=new Error(`Requested origin ${a} does not match server ${S}`);for(let T=0;T<n.length;T++)n[T].reject(x);p.destroy();return}}u();{let S=this.sessions;if(o in S){let x=S[o];x.splice(Ba(x,p,Ua),0,p)}else S[o]=[p]}g=!0,this._emptySessionCount++,this.emit("session",p),this._accept(p,n,a,r),p[K]===0&&this._emptySessionCount>this.maxEmptySessions&&this.closeEmptySessions(this._emptySessionCount-this.maxEmptySessions),p.on("remoteSettings",()=>{w()&&(P(),w()&&br(this.sessions[o],p))})}),p[Vn]=p.request,p.request=(S,x)=>{if(p[ce])throw new Error("The session is gracefully closing. No new streams are allowed.");let T=p[Vn](S,x);return p.ref(),p[K]++===0&&this._emptySessionCount--,T.once("close",()=>{if(--p[K]===0&&(this._emptySessionCount++,p.unref(),this._emptySessionCount>this.maxEmptySessions||p[ce])){p.close();return}p.destroyed||p.closed||w()&&!Jn(this.sessions[o],p)&&(br(this.sessions[o],p),P(),p[K]===0&&this._processQueue())}),T}}catch(y){u(),this._sessionCount--;for(let b=0;b<n.length;b++)n[b].reject(y)}};l.listeners=n,l.completed=!1,l.destroyed=!1,this.queue[o][a]=l,this.queue[o][xt]++,this._processQueue()})}request(e,r,n,s){return new Promise((i,o)=>{this.getSession(e,r,[{reject:o,resolve:a=>{try{let u=a.request(n,s);$a(u),i(u)}catch(u){o(u)}}}])})}async createConnection(e,r){return t.connect(e,r)}static connect(e,r){r.ALPNProtocols=["h2"];let n=e.port||443,s=e.hostname;typeof r.servername>"u"&&(r.servername=s);let i=Ha.connect(n,s,r);return r.socket&&(i._peername={family:void 0,address:void 0,port:n}),i}closeEmptySessions(e=Number.POSITIVE_INFINITY){let r=0,{sessions:n}=this;for(let s in n){let i=n[s];for(let o=0;o<i.length;o++){let a=i[o];if(a[K]===0&&(r++,a.close(),r>=e))return r}}return r}destroy(e){let{sessions:r,queue:n}=this;for(let s in r){let i=r[s];for(let o=0;o<i.length;o++)i[o].destroy(e)}for(let s in n){let i=n[s];for(let o in i)i[o].destroyed=!0}this.queue={},this.tlsSessionCache.clear()}get emptySessionCount(){return this._emptySessionCount}get pendingSessionCount(){return this._sessionCount-this._emptySessionCount}get sessionCount(){return this._sessionCount}};Pe.kCurrentStreamCount=K;Pe.kGracefullyClosing=ce;Yn.exports={Agent:Pe,globalAgent:new Pe}});var wr=C((Yf,Qn)=>{"use strict";f();var{Readable:za}=R("stream"),_r=class extends za{constructor(e,r){super({emitClose:!1,autoDestroy:!0,highWaterMark:r}),this.statusCode=null,this.statusMessage="",this.httpVersion="2.0",this.httpVersionMajor=2,this.httpVersionMinor=0,this.headers={},this.trailers={},this.req=null,this.aborted=!1,this.complete=!1,this.upgrade=null,this.rawHeaders=[],this.rawTrailers=[],this.socket=e,this._dumped=!1}get connection(){return this.socket}set connection(e){this.socket=e}_destroy(e,r){this.readableEnded||(this.aborted=!0),r(),this.req._request.destroy(e)}setTimeout(e,r){return this.req.setTimeout(e,r),this}_dump(){this._dumped||(this._dumped=!0,this.removeAllListeners("data"),this.resume())}_read(){this.req&&this.req._request.resume()}};Qn.exports=_r});var Zn=C((Xf,Xn)=>{"use strict";f();Xn.exports=(t,e,r)=>{for(let n of r)t.on(n,(...s)=>e.emit(n,...s))}});var Ze=C((td,es)=>{"use strict";f();var fe=(t,e,r)=>{es.exports[e]=class extends t{constructor(...s){super(typeof r=="string"?r:r(s)),this.name=`${super.name} [${e}]`,this.code=e}}};fe(TypeError,"ERR_INVALID_ARG_TYPE",t=>{let e=t[0].includes(".")?"property":"argument",r=t[1],n=Array.isArray(r);return n&&(r=`${r.slice(0,-1).join(", ")} or ${r.slice(-1)}`),`The "${t[0]}" ${e} must be ${n?"one of":"of"} type ${r}. Received ${typeof t[2]}`});fe(TypeError,"ERR_INVALID_PROTOCOL",t=>`Protocol "${t[0]}" not supported. Expected "${t[1]}"`);fe(Error,"ERR_HTTP_HEADERS_SENT",t=>`Cannot ${t[0]} headers after they are sent to the client`);fe(TypeError,"ERR_INVALID_HTTP_TOKEN",t=>`${t[0]} must be a valid HTTP token [${t[1]}]`);fe(TypeError,"ERR_HTTP_INVALID_HEADER_VALUE",t=>`Invalid value "${t[0]} for header "${t[1]}"`);fe(TypeError,"ERR_INVALID_CHAR",t=>`Invalid character in ${t[0]} [${t[1]}]`);fe(Error,"ERR_HTTP2_NO_SOCKET_MANIPULATION","HTTP/2 sockets should not be directly manipulated (e.g. read and written)")});var rs=C((nd,ts)=>{"use strict";f();ts.exports=t=>{switch(t){case":method":case":scheme":case":authority":case":path":return!0;default:return!1}}});var Er=C((id,ns)=>{"use strict";f();var{ERR_INVALID_HTTP_TOKEN:Ma}=Ze(),Wa=rs(),Va=/^[\^`\-\w!#$%&*+.|~]+$/;ns.exports=t=>{if(typeof t!="string"||!Va.test(t)&&!Wa(t))throw new Ma("Header name",t)}});var Sr=C((ad,ss)=>{"use strict";f();var{ERR_HTTP_INVALID_HEADER_VALUE:Ga,ERR_INVALID_CHAR:Ja}=Ze(),Ka=/[^\t\u0020-\u007E\u0080-\u00FF]/;ss.exports=(t,e)=>{if(typeof e>"u")throw new Ga(e,t);if(Ka.test(e))throw new Ja("header content",t)}});var as=C((ud,os)=>{"use strict";f();var{ERR_HTTP2_NO_SOCKET_MANIPULATION:is}=Ze(),Ya={has(t,e){let r=t.session===void 0?t:t.session.socket;return e in t||e in r},get(t,e){switch(e){case"on":case"once":case"end":case"emit":case"destroy":return t[e].bind(t);case"writable":case"destroyed":return t[e];case"readable":return t.destroyed?!1:t.readable;case"setTimeout":{let{session:r}=t;return r!==void 0?r.setTimeout.bind(r):t.setTimeout.bind(t)}case"write":case"read":case"pause":case"resume":throw new is;default:{let r=t.session===void 0?t:t.session.socket,n=r[e];return typeof n=="function"?n.bind(r):n}}},getPrototypeOf(t){return t.session!==void 0?Reflect.getPrototypeOf(t.session.socket):Reflect.getPrototypeOf(t)},set(t,e,r){switch(e){case"writable":case"readable":case"destroyed":case"on":case"once":case"end":case"emit":case"destroy":return t[e]=r,!0;case"setTimeout":{let{session:n}=t;return n===void 0?t.setTimeout=r:n.setTimeout=r,!0}case"write":case"read":case"pause":case"resume":throw new is;default:{let n=t.session===void 0?t:t.session.socket;return n[e]=r,!0}}}};os.exports=Ya});var Rr=C((ld,ds)=>{"use strict";f();var{URL:xr,urlToHttpOptions:cs}=R("url"),Qa=R("http2"),{Writable:Xa}=R("stream"),{Agent:Za,globalAgent:ec}=le(),tc=wr(),rc=Zn(),{ERR_INVALID_ARG_TYPE:vt,ERR_INVALID_PROTOCOL:nc,ERR_HTTP_HEADERS_SENT:us}=Ze(),sc=Er(),ic=Sr(),oc=as(),{HTTP2_HEADER_STATUS:hs,HTTP2_HEADER_METHOD:ls,HTTP2_HEADER_PATH:fs,HTTP2_HEADER_AUTHORITY:et,HTTP2_METHOD_CONNECT:ac}=Qa.constants,V=Symbol("headers"),Te=Symbol("origin"),tt=Symbol("session"),vr=Symbol("options"),Ot=Symbol("flushedHeaders"),Ae=Symbol("jobs"),rt=Symbol("pendingAgentPromise"),Or=class extends Xa{constructor(e,r,n){if(super({autoDestroy:!1,emitClose:!1}),typeof e=="string"?e=cs(new xr(e)):e instanceof xr?e=cs(e):e={...e},typeof r=="function"||r===void 0?(n=r,r=e):r=Object.assign(e,r),r.h2session){if(this[tt]=r.h2session,this[tt].destroyed)throw new Error("The session has been closed already");this.protocol=this[tt].socket.encrypted?"https:":"http:"}else if(r.agent===!1)this.agent=new Za({maxEmptySessions:0});else if(typeof r.agent>"u"||r.agent===null)this.agent=ec;else if(typeof r.agent.request=="function")this.agent=r.agent;else throw new vt("options.agent",["http2wrapper.Agent-like Object","undefined","false"],r.agent);if(this.agent&&(this.protocol=this.agent.protocol),r.protocol&&r.protocol!==this.protocol)throw new nc(r.protocol,this.protocol);r.port||(r.port=r.defaultPort||this.agent&&this.agent.defaultPort||443),r.host=r.hostname||r.host||"localhost",delete r.hostname;let{timeout:s}=r;r.timeout=void 0,this[V]=Object.create(null),this[Ae]=[],this[rt]=void 0,this.socket=null,this.connection=null,this.method=r.method||"GET",this.method==="CONNECT"&&(r.path==="/"||r.path===void 0)||(this.path=r.path),this.res=null,this.aborted=!1,this.reusedSocket=!1;let{headers:i}=r;if(i)for(let a in i)this.setHeader(a,i[a]);r.auth&&!("authorization"in this[V])&&(this[V].authorization="Basic "+Buffer.from(r.auth).toString("base64")),r.session=r.tlsSession,r.path=r.socketPath,this[vr]=r,this[Te]=new xr(`${this.protocol}//${r.servername||r.host}:${r.port}`);let o=r._reuseSocket;o&&(r.createConnection=(...a)=>o.destroyed?this.agent.createConnection(...a):o,this.agent.getSession(this[Te],this[vr]).catch(()=>{})),s&&this.setTimeout(s),n&&this.once("response",n),this[Ot]=!1}get method(){return this[V][ls]}set method(e){e&&(this[V][ls]=e.toUpperCase())}get path(){let e=this.method==="CONNECT"?et:fs;return this[V][e]}set path(e){if(e){let r=this.method==="CONNECT"?et:fs;this[V][r]=e}}get host(){return this[Te].hostname}set host(e){}get _mustNotHaveABody(){return this.method==="GET"||this.method==="HEAD"||this.method==="DELETE"}_write(e,r,n){if(this._mustNotHaveABody){n(new Error("The GET, HEAD and DELETE methods must NOT have a body"));return}this.flushHeaders();let s=()=>this._request.write(e,r,n);this._request?s():this[Ae].push(s)}_final(e){this.flushHeaders();let r=()=>{if(this._mustNotHaveABody||this.method==="CONNECT"){e();return}this._request.end(e)};this._request?r():this[Ae].push(r)}abort(){this.res&&this.res.complete||(this.aborted||process.nextTick(()=>this.emit("abort")),this.aborted=!0,this.destroy())}async _destroy(e,r){this.res&&this.res._dump(),this._request?this._request.destroy():process.nextTick(()=>{this.emit("close")});try{await this[rt]}catch(n){this.aborted&&(e=n)}r(e)}async flushHeaders(){if(this[Ot]||this.destroyed)return;this[Ot]=!0;let e=this.method===ac,r=n=>{if(this._request=n,this.destroyed){n.destroy();return}e||rc(n,this,["timeout","continue"]),n.once("error",i=>{this.destroy(i)}),n.once("aborted",()=>{let{res:i}=this;i?(i.aborted=!0,i.emit("aborted"),i.destroy()):this.destroy(new Error("The server aborted the HTTP/2 stream"))});let s=(i,o,a)=>{let u=new tc(this.socket,n.readableHighWaterMark);this.res=u,u.url=`${this[Te].origin}${this.path}`,u.req=this,u.statusCode=i[hs],u.headers=i,u.rawHeaders=a,u.once("end",()=>{u.complete=!0,u.socket=null,u.connection=null}),e?(u.upgrade=!0,this.emit("connect",u,n,Buffer.alloc(0))?this.emit("close"):n.destroy()):(n.on("data",l=>{!u._dumped&&!u.push(l)&&n.pause()}),n.once("end",()=>{this.aborted||u.push(null)}),this.emit("response",u)||u._dump())};n.once("response",s),n.once("headers",i=>this.emit("information",{statusCode:i[hs]})),n.once("trailers",(i,o,a)=>{let{res:u}=this;if(u===null){s(i,o,a);return}u.trailers=i,u.rawTrailers=a}),n.once("close",()=>{let{aborted:i,res:o}=this;if(o){i&&(o.aborted=!0,o.emit("aborted"),o.destroy());let a=()=>{o.emit("close"),this.destroy(),this.emit("close")};o.readable?o.once("end",a):a();return}if(!this.destroyed){this.destroy(new Error("The HTTP/2 stream has been early terminated")),this.emit("close");return}this.destroy(),this.emit("close")}),this.socket=new Proxy(n,oc);for(let i of this[Ae])i();this[Ae].length=0,this.emit("socket",this.socket)};if(!(et in this[V])&&!e&&(this[V][et]=this[Te].host),this[tt])try{r(this[tt].request(this[V]))}catch(n){this.destroy(n)}else{this.reusedSocket=!0;try{let n=this.agent.request(this[Te],this[vr],this[V]);this[rt]=n,r(await n),this[rt]=!1}catch(n){this[rt]=!1,this.destroy(n)}}}get connection(){return this.socket}set connection(e){this.socket=e}getHeaderNames(){return Object.keys(this[V])}hasHeader(e){if(typeof e!="string")throw new vt("name","string",e);return!!this[V][e.toLowerCase()]}getHeader(e){if(typeof e!="string")throw new vt("name","string",e);return this[V][e.toLowerCase()]}get headersSent(){return this[Ot]}removeHeader(e){if(typeof e!="string")throw new vt("name","string",e);if(this.headersSent)throw new us("remove");delete this[V][e.toLowerCase()]}setHeader(e,r){if(this.headersSent)throw new us("set");sc(e),ic(e,r);let n=e.toLowerCase();if(n==="connection"){if(r.toLowerCase()==="keep-alive")return;throw new Error(`Invalid 'connection' header: ${r}`)}n==="host"&&this.method==="CONNECT"?this[V][et]=r:this[V][n]=r}setNoDelay(){}setSocketKeepAlive(){}setTimeout(e,r){let n=()=>this._request.setTimeout(e,r);return this._request?n():this[Ae].push(n),this}get maxHeadersCount(){if(!this.destroyed&&this._request)return this._request.session.localSettings.maxHeaderListSize}set maxHeadersCount(e){}};ds.exports=Or});var ms=C((dd,ps)=>{"use strict";f();var cc=R("tls");ps.exports=(t={},e=cc.connect)=>new Promise((r,n)=>{let s=!1,i,o=async()=>{await u,i.off("timeout",a),i.off("error",n),t.resolveSocket?(r({alpnProtocol:i.alpnProtocol,socket:i,timeout:s}),s&&(await Promise.resolve(),i.emit("timeout"))):(i.destroy(),r({alpnProtocol:i.alpnProtocol,timeout:s}))},a=async()=>{s=!0,o()},u=(async()=>{try{i=await e(t,o),i.on("error",n),i.once("timeout",a)}catch(l){n(l)}})()})});var gs=C((md,ys)=>{"use strict";f();var{isIP:uc}=R("net"),hc=R("assert"),lc=t=>{if(t[0]==="["){let r=t.indexOf("]");return hc(r!==-1),t.slice(1,r)}let e=t.indexOf(":");return e===-1?t:t.slice(0,e)};ys.exports=t=>{let e=lc(t);return uc(e)?"":e}});var Os=C((gd,nt)=>{"use strict";f();var{URL:bs,urlToHttpOptions:_s}=R("url"),ws=R("http"),Cr=R("https"),fc=ms(),dc=yr(),{Agent:pc,globalAgent:mc}=le(),yc=Rr(),gc=gs(),Es=gr(),Ss=new dc({maxSize:100}),bc=new Map,_c=(t,e,r)=>{e._httpMessage={shouldKeepAlive:!0};let n=()=>{t.emit("free",e,r)};e.on("free",n);let s=()=>{t.removeSocket(e,r)};e.on("close",s);let i=()=>{let{freeSockets:a}=t;for(let u of Object.values(a))if(u.includes(e)){e.destroy();return}};e.on("timeout",i);let o=()=>{t.removeSocket(e,r),e.off("close",s),e.off("free",n),e.off("timeout",i),e.off("agentRemove",o)};e.on("agentRemove",o),t.emit("free",e,r)},xs=(t,e=new Map,r=void 0)=>async n=>{let s=`${n.host}:${n.port}:${n.ALPNProtocols.sort()}`;if(!t.has(s)){if(e.has(s))return{alpnProtocol:(await e.get(s)).alpnProtocol};let{path:i}=n;n.path=n.socketPath;let o=fc(n,r);e.set(s,o);try{let a=await o;return t.set(s,a.alpnProtocol),e.delete(s),n.path=i,a}catch(a){throw e.delete(s),n.path=i,a}}return{alpnProtocol:t.get(s)}},vs=xs(Ss,bc);nt.exports=async(t,e,r)=>{if(typeof t=="string"?t=_s(new bs(t)):t instanceof bs?t=_s(t):t={...t},typeof e=="function"||e===void 0?(r=e,e=t):e=Object.assign(t,e),e.ALPNProtocols=e.ALPNProtocols||["h2","http/1.1"],!Array.isArray(e.ALPNProtocols)||e.ALPNProtocols.length===0)throw new Error("The `ALPNProtocols` option must be an Array with at least one entry");e.protocol=e.protocol||"https:";let n=e.protocol==="https:";e.host=e.hostname||e.host||"localhost",e.session=e.tlsSession,e.servername=e.servername||gc(e.headers&&e.headers.host||e.host),e.port=e.port||(n?443:80),e._defaultAgent=n?Cr.globalAgent:ws.globalAgent;let s=e.resolveProtocol||vs,{agent:i}=e;if(i!==void 0&&i!==!1&&i.constructor.name!=="Object")throw new Error("The `options.agent` can be only an object `http`, `https` or `http2` properties");if(n){e.resolveSocket=!0;let{socket:o,alpnProtocol:a,timeout:u}=await s(e);if(u){o&&o.destroy();let d=new Error(`Timed out resolving ALPN: ${e.timeout} ms`);throw d.code="ETIMEDOUT",d.ms=e.timeout,d}o&&e.createConnection&&(o.destroy(),o=void 0),delete e.resolveSocket;let l=a==="h2";if(i&&(i=l?i.http2:i.https,e.agent=i),i===void 0&&(i=l?mc:Cr.globalAgent),o)if(i===!1)o.destroy();else{let d=(l?pc:Cr.Agent).prototype.createConnection;i.createConnection===d?l?e._reuseSocket=o:_c(i,o,e):o.destroy()}if(l)return Es(new yc(e,r))}else i&&(e.agent=i.http);return e.headers&&(e.headers={...e.headers},e.headers[":authority"]&&(e.headers.host||(e.headers.host=e.headers[":authority"]),delete e.headers[":authority"]),delete e.headers[":method"],delete e.headers[":scheme"],delete e.headers[":path"]),Es(ws.request(e,r))};nt.exports.protocolCache=Ss;nt.exports.resolveProtocol=vs;nt.exports.createResolveProtocol=xs});var Pr=C((_d,Rs)=>{"use strict";f();var wc=R("stream"),Ec=R("tls"),Sc=new Ec.TLSSocket(new wc.PassThrough)._handle._parentWrap.constructor;Rs.exports=Sc});var Ar=C((Ed,Cs)=>{"use strict";f();var Tr=class extends Error{constructor(e,r=""){super(`The proxy server rejected the request with status code ${e} (${r||"empty status message"})`),this.statusCode=e,this.statusMessage=r}};Cs.exports=Tr});var Ts=C((xd,Ps)=>{"use strict";f();var xc=(t,e,r)=>{if(!r.some(s=>typeof s==="string"?typeof e===s:e instanceof s)){let s=r.map(i=>typeof i=="string"?i:i.name);throw new TypeError(`Expected '${t}' to be a type of ${s.join(" or ")}, got ${typeof e}`)}};Ps.exports=xc});var kr=C((Od,ks)=>{"use strict";f();var{URL:As}=R("url"),Rt=Ts();ks.exports=(t,e)=>{Rt("proxyOptions",e,["object"]),Rt("proxyOptions.headers",e.headers,["object","undefined"]),Rt("proxyOptions.raw",e.raw,["boolean","undefined"]),Rt("proxyOptions.url",e.url,[As,"string"]);let r=new As(e.url);t.proxyOptions={raw:!0,...e,headers:{...e.headers},url:r}}});var Ct=C((Cd,js)=>{"use strict";f();js.exports=t=>{let{username:e,password:r}=t.proxyOptions.url;if(e||r){let n=`${e}:${r}`,s=`Basic ${Buffer.from(n).toString("base64")}`;return{"proxy-authorization":s,authorization:s}}return{}}});var Hs=C((Td,Is)=>{"use strict";f();var vc=R("tls"),Oc=R("http"),qs=R("https"),Rc=Pr(),{globalAgent:Cc}=le(),Pc=Ar(),Ns=kr(),Tc=Ct(),Ls=(t,e,r)=>{(async()=>{try{let{proxyOptions:n}=t,{url:s,headers:i,raw:o}=n,a=await Cc.request(s,n,{...Tc(t),...i,":method":"CONNECT",":authority":`${e.host}:${e.port}`});a.once("error",r),a.once("response",u=>{let l=u[":status"];if(l!==200){r(new Pc(l,""));return}let d=t instanceof qs.Agent;if(o&&d){e.socket=a;let m=vc.connect(e);m.once("close",()=>{a.destroy()}),r(null,m);return}let g=new Rc(a);g.encrypted=!1,g._handle.getpeername=m=>{m.family=void 0,m.address=void 0,m.port=void 0},r(null,g)})}catch(n){r(n)}})()},jr=class extends Oc.Agent{constructor(e){super(e),Ns(this,e.proxyOptions)}createConnection(e,r){Ls(this,e,r)}},qr=class extends qs.Agent{constructor(e){super(e),Ns(this,e.proxyOptions)}createConnection(e,r){Ls(this,e,r)}};Is.exports={HttpOverHttp2:jr,HttpsOverHttp2:qr}});var Lr=C((kd,Fs)=>{"use strict";f();var{Agent:Ac}=le(),kc=Pr(),jc=Ar(),qc=kr(),Nr=class extends Ac{constructor(e){super(e),qc(this,e.proxyOptions)}async createConnection(e,r){let n=`${e.hostname}:${e.port||443}`,[s,i,o]=await this._getProxyStream(n);if(i!==200)throw new jc(i,o);if(this.proxyOptions.raw)r.socket=s;else{let a=new kc(s);return a.encrypted=!1,a._handle.getpeername=u=>{u.family=void 0,u.address=void 0,u.port=void 0},a}return super.createConnection(e,r)}};Fs.exports=Nr});var $s=C((qd,Ds)=>{"use strict";f();var{globalAgent:Nc}=le(),Lc=Lr(),Ic=Ct(),Hc=t=>new Promise((e,r)=>{t.once("error",r),t.once("response",n=>{t.off("error",r),e(n[":status"])})}),Ir=class extends Lc{async _getProxyStream(e){let{proxyOptions:r}=this,n={...Ic(this),...r.headers,":method":"CONNECT",":authority":e},s=await Nc.request(r.url,r,n),i=await Hc(s);return[s,i,""]}};Ds.exports=Ir});var Us=C((Ld,Bs)=>{"use strict";f();var Fc=R("http"),Dc=R("https"),$c=Lr(),Bc=Ct(),Uc=t=>new Promise((e,r)=>{let n=(s,i,o)=>{i.unshift(o),t.off("error",r),e([i,s.statusCode,s.statusMessage])};t.once("error",r),t.once("connect",n)}),Pt=class extends $c{async _getProxyStream(e){let{proxyOptions:r}=this,{url:n,headers:s}=this.proxyOptions,o=(n.protocol==="https:"?Dc:Fc).request({...r,hostname:n.hostname,port:n.port,path:e,headers:{...Bc(this),...s,host:e},method:"CONNECT"}).end();return Uc(o)}};Bs.exports={Http2OverHttp:Pt,Http2OverHttps:Pt}});var Ms=C((Hd,zs)=>{"use strict";f();var zc=R("http2"),{Agent:Mc,globalAgent:Wc}=le(),Hr=Rr(),Vc=wr(),Gc=Os(),{HttpOverHttp2:Jc,HttpsOverHttp2:Kc}=Hs(),Yc=$s(),{Http2OverHttp:Qc,Http2OverHttps:Xc}=Us(),Zc=Er(),eu=Sr(),tu=(t,e,r)=>new Hr(t,e,r),ru=(t,e,r)=>{let n=new Hr(t,e,r);return n.end(),n};zs.exports={...zc,ClientRequest:Hr,IncomingMessage:Vc,Agent:Mc,globalAgent:Wc,request:tu,get:ru,auto:Gc,proxies:{HttpOverHttp2:Jc,HttpsOverHttp2:Kc,Http2OverHttp2:Yc,Http2OverHttp:Qc,Http2OverHttps:Xc},validateHeaderName:Zc,validateHeaderValue:eu}});var zr=C(pe=>{f();pe.parse=pe.decode=qu;pe.stringify=pe.encode=si;pe.safe=je;pe.unsafe=Lt;var Ur=typeof process<"u"&&process.platform==="win32"?`\r `:` `;function si(t,e){var r=[],n="";typeof e=="string"?e={section:e,whitespace:!1}:(e=e||{},e.whitespace=e.whitespace===!0);var s=e.whitespace?" = ":"=";return Object.keys(t).forEach(function(i,o,a){var u=t[i];u&&Array.isArray(u)?u.forEach(function(l){n+=je(i+"[]")+s+je(l)+` `}):u&&typeof u=="object"?r.push(i):n+=je(i)+s+je(u)+Ur}),e.section&&n.length&&(n="["+je(e.section)+"]"+Ur+n),r.forEach(function(i,o,a){var u=ii(i).join("\\."),l=(e.section?e.section+".":"")+u,d=si(t[i],{section:l,whitespace:e.whitespace});n.length&&d.length&&(n+=Ur),n+=d}),n}function ii(t){return t.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(function(e){return e.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")})}function qu(t){var e={},r=e,n=null,s=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,i=t.split(/[\r\n]+/g);return i.forEach(function(o,a,u){if(!(!o||o.match(/^\s*[;#]/))){var l=o.match(s);if(l){if(l[1]!==void 0){if(n=Lt(l[1]),n==="__proto__"){r={};return}r=e[n]=e[n]||{};return}var d=Lt(l[2]);if(d!=="__proto__"){var g=l[3]?Lt(l[4]):!0;switch(g){case"true":case"false":case"null":g=JSON.parse(g)}if(d.length>2&&d.slice(-2)==="[]"){if(d=d.substring(0,d.length-2),d==="__proto__")return;r[d]?Array.isArray(r[d])||(r[d]=[r[d]]):r[d]=[]}Array.isArray(r[d])?r[d].push(g):r[d]=g}}}}),Object.keys(e).filter(function(o,a,u){if(!e[o]||typeof e[o]!="object"||Array.isArray(e[o]))return!1;var l=ii(o),d=e,g=l.pop(),m=g.replace(/\\\./g,".");return l.forEach(function(y,b,p){y!=="__proto__"&&((!d[y]||typeof d[y]!="object")&&(d[y]={}),d=d[y])}),d===e&&m===g?!1:(d[m]=e[o],!0)}).forEach(function(o,a,u){delete e[o]}),e}function oi(t){return t.charAt(0)==='"'&&t.slice(-1)==='"'||t.charAt(0)==="'"&&t.slice(-1)==="'"}function je(t){return typeof t!="string"||t.match(/[=\r\n]/)||t.match(/^\[/)||t.length>1&&oi(t)||t!==t.trim()?JSON.stringify(t):t.replace(/;/g,"\\;").replace(/#/g,"\\#")}function Lt(t,e){if(t=(t||"").trim(),oi(t)){t.charAt(0)==="'"&&(t=t.substr(1,t.length-2));try{t=JSON.parse(t)}catch{}}else{for(var r=!1,n="",s=0,i=t.length;s<i;s++){var o=t.charAt(s);if(r)"\\;#".indexOf(o)!==-1?n+=o:n+="\\"+o,r=!1;else{if(";#".indexOf(o)!==-1)break;o==="\\"?r=!0:n+=o}}return r&&(n+="\\"),n.trim()}return t}});var ui=C((am,ci)=>{"use strict";f();var Mr=1,ai=2;function Nu(){return""}function Lu(t,e,r){return t.slice(e,r).replace(/\S/g," ")}ci.exports=function(t,e){e=e||{};for(var r,n,s=!1,i=!1,o=0,a="",u=e.whitespace===!1?Nu:Lu,l=0;l<t.length;l++){if(r=t[l],n=t[l+1],!i&&r==='"'){var d=t[l-1]==="\\"&&t[l-2]!=="\\";d||(s=!s)}if(!s){if(!i&&r+n==="//")a+=t.slice(o,l),o=l,i=Mr,l++;else if(i===Mr&&r+n===`\r `){l++,i=!1,a+=u(t,o,l),o=l;continue}else if(i===Mr&&r===` `)i=!1,a+=u(t,o,l),o=l;else if(!i&&r+n==="/*"){a+=t.slice(o,l),o=l,i=ai,l++;continue}else if(i===ai&&r+n==="*/"){l++,i=!1,a+=u(t,o,l+1),o=l+1;continue}}}return a+(i?u(t.substr(o)):t.substr(o))}});var li=C(qe=>{"use strict";f();var hi=R("fs"),Iu=zr(),it=R("path"),Hu=ui(),Fu=qe.parse=function(t){return/^\s*{/.test(t)?JSON.parse(Hu(t)):Iu.parse(t)},Du=qe.file=function(){var t=[].slice.call(arguments).filter(function(s){return s!=null});for(var e in t)if(typeof t[e]!="string")return;var r=it.join.apply(null,t),n;try{return hi.readFileSync(r,"utf-8")}catch{return}},um=qe.json=function(){var t=Du.apply(null,arguments);return t?Fu(t):null},hm=qe.env=function(t,e){e=e||process.env;var r={},n=t.length;for(var s in e)if(s.toLowerCase().indexOf(t.toLowerCase())===0){for(var i=s.substring(n).split("__"),o;(o=i.indexOf(""))>-1;)i.splice(o,1);var a=r;i.forEach(function(l,d){!l||typeof a!="object"||(d===i.length-1&&(a[l]=e[s]),a[l]===void 0&&(a[l]={}),a=a[l])})}return r},lm=qe.find=function(){var t=it.join.apply(null,[].slice.call(arguments));function e(r,n){var s=it.join(r,n);try{return hi.statSync(s),s}catch{if(it.dirname(r)!==r)return e(it.dirname(r),n)}}return e(process.cwd(),t)}});var gi=C((pm,yi)=>{"use strict";f();function di(t){return t instanceof Buffer||t instanceof Date||t instanceof RegExp}function pi(t){if(t instanceof Buffer){var e=Buffer.alloc?Buffer.alloc(t.length):new Buffer(t.length);return t.copy(e),e}else{if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t);throw new Error("Unexpected situation")}}function mi(t){var e=[];return t.forEach(function(r,n){typeof r=="object"&&r!==null?Array.isArray(r)?e[n]=mi(r):di(r)?e[n]=pi(r):e[n]=Wr({},r):e[n]=r}),e}function fi(t,e){return e==="__proto__"?void 0:t[e]}var Wr=yi.exports=function(){if(arguments.length<1||typeof arguments[0]!="object")return!1;if(arguments.length<2)return arguments[0];var t=arguments[0],e=Array.prototype.slice.call(arguments,1),r,n,s;return e.forEach(function(i){typeof i!="object"||i===null||Array.isArray(i)||Object.keys(i).forEach(function(o){if(n=fi(t,o),r=fi(i,o),r!==t)if(typeof r!="object"||r===null){t[o]=r;return}else if(Array.isArray(r)){t[o]=mi(r);return}else if(di(r)){t[o]=pi(r);return}else if(typeof n!="object"||n===null||Array.isArray(n)){t[o]=Wr({},r);return}else{t[o]=Wr(n,r);return}})}),t}});var Ei=C((ym,wi)=>{"use strict";f();function $u(t,e){var r=t;e.slice(0,-1).forEach(function(s){r=r[s]||{}});var n=e[e.length-1];return n in r}function bi(t){return typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function _i(t,e){return e==="constructor"&&typeof t[e]=="function"||e==="__proto__"}wi.exports=function(t,e){e||(e={});var r={bools:{},strings:{},unknownFn:null};typeof e.unknown=="function"&&(r.unknownFn=e.unknown),typeof e.boolean=="boolean"&&e.boolean?r.allBools=!0:[].concat(e.boolean).filter(Boolean).forEach(function(x){r.bools[x]=!0});var n={};function s(x){return n[x].some(function(T){return r.bools[T]})}Object.keys(e.alias||{}).forEach(function(x){n[x]=[].concat(e.alias[x]),n[x].forEach(function(T){n[T]=[x].concat(n[x].filter(function(N){return T!==N}))})}),[].concat(e.string).filter(Boolean).forEach(function(x){r.strings[x]=!0,n[x]&&[].concat(n[x]).forEach(function(T){r.strings[T]=!0})});var i=e.default||{},o={_:[]};function a(x,T){return r.allBools&&/^--[^=]+$/.test(T)||r.strings[x]||r.bools[x]||n[x]}function u(x,T,N){for(var A=x,Z=0;Z<T.length-1;Z++){var O=T[Z];if(_i(A,O))return;A[O]===void 0&&(A[O]={}),(A[O]===Object.prototype||A[O]===Number.prototype||A[O]===String.prototype)&&(A[O]={}),A[O]===Array.prototype&&(A[O]=[]),A=A[O]}var k=T[T.length-1];_i(A,k)||((A===Object.prototype||A===Number.prototype||A===String.prototype)&&(A={}),A===Array.prototype&&(A=[]),A[k]===void 0||r.bools[k]||typeof A[k]=="boolean"?A[k]=N:Array.isArray(A[k])?A[k].push(N):A[k]=[A[k],N])}function l(x,T,N){if(!(N&&r.unknownFn&&!a(x,N)&&r.unknownFn(N)===!1)){var A=!r.strings[x]&&bi(T)?Number(T):T;u(o,x.split("."),A),(n[x]||[]).forEach(function(Z){u(o,Z.split("."),A)})}}Object.keys(r.bools).forEach(function(x){l(x,i[x]===void 0?!1:i[x])});var d=[];t.indexOf("--")!==-1&&(d=t.slice(t.indexOf("--")+1),t=t.slice(0,t.indexOf("--")));for(var g=0;g<t.length;g++){var m=t[g],y,b;if(/^--.+=/.test(m)){var p=m.match(/^--([^=]+)=([\s\S]*)$/);y=p[1];var v=p[2];r.bools[y]&&(v=v!=="false"),l(y,v,m)}else if(/^--no-.+/.test(m))y=m.match(/^--no-(.+)/)[1],l(y,!1,m);else if(/^--.+/.test(m))y=m.match(/^--(.+)/)[1],b=t[g+1],b!==void 0&&!/^(-|--)[^-]/.test(b)&&!r.bools[y]&&!r.allBools&&(!n[y]||!s(y))?(l(y,b,m),g+=1):/^(true|false)$/.test(b)?(l(y,b==="true",m),g+=1):l(y,r.strings[y]?"":!0,m);else if(/^-[^-]+/.test(m)){for(var w=m.slice(1,-1).split(""),P=!1,S=0;S<w.length;S++){if(b=m.slice(S+2),b==="-"){l(w[S],b,m);continu