i){return null}var r=t.loose?o[x]:o[_];if(!r.test(e)){return null}try{return new SemVer(e,t)}catch(e){return null}}t.valid=valid;function valid(e,t){var r=parse(e,t);return r?r.version:null}t.clean=clean;function clean(e,t){var r=parse(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}t.SemVer=SemVer;function SemVer(e,t){if(!t||typeof t!=="object"){t={loose:!!t,includePrerelease:false}}if(e instanceof SemVer){if(e.loose===t.loose){return e}else{e=e.version}}else if(typeof e!=="string"){throw new TypeError("Invalid Version: "+e)}if(e.length>i){throw new TypeError("version is longer than "+i+" characters")}if(!(this instanceof SemVer)){return new SemVer(e,t)}r("SemVer",e,t);this.options=t;this.loose=!!t.loose;var s=e.trim().match(t.loose?o[x]:o[_]);if(!s){throw new TypeError("Invalid Version: "+e)}this.raw=e;this.major=+s[1];this.minor=+s[2];this.patch=+s[3];if(this.major>n||this.major<0){throw new TypeError("Invalid major version")}if(this.minor>n||this.minor<0){throw new TypeError("Invalid minor version")}if(this.patch>n||this.patch<0){throw new TypeError("Invalid patch version")}if(!s[4]){this.prerelease=[]}else{this.prerelease=s[4].split(".").map(function(e){if(/^[0-9]+$/.test(e)){var t=+e;if(t>=0&&t{"use strict";const i=s(6197);const A=s(992);const o=s(8707);const r=s(5076);const n=s(1093);const a=s(9965);const c=s(3440);const{InvalidArgumentError:l}=o;const u=s(6615);const p=s(9136);const g=s(7365);const h=s(7501);const d=s(4004);const E=s(2429);const Q=s(2720);const C=s(3573);const{getGlobalDispatcher:B,setGlobalDispatcher:I}=s(2581);const b=s(8840);const y=s(8299);const w=s(4415);let v;try{s(6982);v=true}catch{v=false}Object.assign(A.prototype,u);e.exports.Dispatcher=A;e.exports.Client=i;e.exports.Pool=r;e.exports.BalancedPool=n;e.exports.Agent=a;e.exports.ProxyAgent=Q;e.exports.RetryHandler=C;e.exports.DecoratorHandler=b;e.exports.RedirectHandler=y;e.exports.createRedirectInterceptor=w;e.exports.buildConnector=p;e.exports.errors=o;function makeDispatcher(e){return(t,s,i)=>{if(typeof s==="function"){i=s;s=null}if(!t||typeof t!=="string"&&typeof t!=="object"&&!(t instanceof URL)){throw new l("invalid url")}if(s!=null&&typeof s!=="object"){throw new l("invalid opts")}if(s&&s.path!=null){if(typeof s.path!=="string"){throw new l("invalid opts.path")}let e=s.path;if(!s.path.startsWith("/")){e=`/${e}`}t=new URL(c.parseOrigin(t).origin+e)}else{if(!s){s=typeof t==="object"?t:{}}t=c.parseURL(t)}const{agent:A,dispatcher:o=B()}=s;if(A){throw new l("unsupported opts.agent. Did you mean opts.client?")}return e.call(o,{...s,origin:t.origin,path:t.search?`${t.pathname}${t.search}`:t.pathname,method:s.method||(s.body?"PUT":"GET")},i)}}e.exports.setGlobalDispatcher=I;e.exports.getGlobalDispatcher=B;if(c.nodeMajor>16||c.nodeMajor===16&&c.nodeMinor>=8){let t=null;e.exports.fetch=async function fetch(e){if(!t){t=s(2315).fetch}try{return await t(...arguments)}catch(e){if(typeof e==="object"){Error.captureStackTrace(e,this)}throw e}};e.exports.Headers=s(6349).Headers;e.exports.Response=s(8676).Response;e.exports.Request=s(5194).Request;e.exports.FormData=s(3073).FormData;e.exports.File=s(3041).File;e.exports.FileReader=s(2160).FileReader;const{setGlobalOrigin:i,getGlobalOrigin:A}=s(5628);e.exports.setGlobalOrigin=i;e.exports.getGlobalOrigin=A;const{CacheStorage:o}=s(4738);const{kConstruct:r}=s(296);e.exports.caches=new o(r)}if(c.nodeMajor>=16){const{deleteCookie:t,getCookies:i,getSetCookies:A,setCookie:o}=s(3168);e.exports.deleteCookie=t;e.exports.getCookies=i;e.exports.getSetCookies=A;e.exports.setCookie=o;const{parseMIMEType:r,serializeAMimeType:n}=s(4322);e.exports.parseMIMEType=r;e.exports.serializeAMimeType=n}if(c.nodeMajor>=18&&v){const{WebSocket:t}=s(5171);e.exports.WebSocket=t}e.exports.request=makeDispatcher(u.request);e.exports.stream=makeDispatcher(u.stream);e.exports.pipeline=makeDispatcher(u.pipeline);e.exports.connect=makeDispatcher(u.connect);e.exports.upgrade=makeDispatcher(u.upgrade);e.exports.MockClient=g;e.exports.MockPool=d;e.exports.MockAgent=h;e.exports.mockErrors=E},9965:(e,t,s)=>{"use strict";const{InvalidArgumentError:i}=s(8707);const{kClients:A,kRunning:o,kClose:r,kDestroy:n,kDispatch:a,kInterceptors:c}=s(6443);const l=s(1);const u=s(5076);const p=s(6197);const g=s(3440);const h=s(4415);const{WeakRef:d,FinalizationRegistry:E}=s(3194)();const Q=Symbol("onConnect");const C=Symbol("onDisconnect");const B=Symbol("onConnectionError");const I=Symbol("maxRedirections");const b=Symbol("onDrain");const y=Symbol("factory");const w=Symbol("finalizer");const v=Symbol("options");function defaultFactory(e,t){return t&&t.connections===1?new p(e,t):new u(e,t)}class Agent extends l{constructor({factory:e=defaultFactory,maxRedirections:t=0,connect:s,...o}={}){super();if(typeof e!=="function"){throw new i("factory must be a function.")}if(s!=null&&typeof s!=="function"&&typeof s!=="object"){throw new i("connect must be a function or an object")}if(!Number.isInteger(t)||t<0){throw new i("maxRedirections must be a positive number")}if(s&&typeof s!=="function"){s={...s}}this[c]=o.interceptors&&o.interceptors.Agent&&Array.isArray(o.interceptors.Agent)?o.interceptors.Agent:[h({maxRedirections:t})];this[v]={...g.deepClone(o),connect:s};this[v].interceptors=o.interceptors?{...o.interceptors}:undefined;this[I]=t;this[y]=e;this[A]=new Map;this[w]=new E((e=>{const t=this[A].get(e);if(t!==undefined&&t.deref()===undefined){this[A].delete(e)}}));const r=this;this[b]=(e,t)=>{r.emit("drain",e,[r,...t])};this[Q]=(e,t)=>{r.emit("connect",e,[r,...t])};this[C]=(e,t,s)=>{r.emit("disconnect",e,[r,...t],s)};this[B]=(e,t,s)=>{r.emit("connectionError",e,[r,...t],s)}}get[o](){let e=0;for(const t of this[A].values()){const s=t.deref();if(s){e+=s[o]}}return e}[a](e,t){let s;if(e.origin&&(typeof e.origin==="string"||e.origin instanceof URL)){s=String(e.origin)}else{throw new i("opts.origin must be a non-empty string or URL.")}const o=this[A].get(s);let r=o?o.deref():null;if(!r){r=this[y](e.origin,this[v]).on("drain",this[b]).on("connect",this[Q]).on("disconnect",this[C]).on("connectionError",this[B]);this[A].set(s,new d(r));this[w].register(r,s)}return r.dispatch(e,t)}async[r](){const e=[];for(const t of this[A].values()){const s=t.deref();if(s){e.push(s.close())}}await Promise.all(e)}async[n](e){const t=[];for(const s of this[A].values()){const i=s.deref();if(i){t.push(i.destroy(e))}}await Promise.all(t)}}e.exports=Agent},158:(e,t,s)=>{const{addAbortListener:i}=s(3440);const{RequestAbortedError:A}=s(8707);const o=Symbol("kListener");const r=Symbol("kSignal");function abort(e){if(e.abort){e.abort()}else{e.onError(new A)}}function addSignal(e,t){e[r]=null;e[o]=null;if(!t){return}if(t.aborted){abort(e);return}e[r]=t;e[o]=()=>{abort(e)};i(e[r],e[o])}function removeSignal(e){if(!e[r]){return}if("removeEventListener"in e[r]){e[r].removeEventListener("abort",e[o])}else{e[r].removeListener("abort",e[o])}e[r]=null;e[o]=null}e.exports={addSignal:addSignal,removeSignal:removeSignal}},4660:(e,t,s)=>{"use strict";const{AsyncResource:i}=s(290);const{InvalidArgumentError:A,RequestAbortedError:o,SocketError:r}=s(8707);const n=s(3440);const{addSignal:a,removeSignal:c}=s(158);class ConnectHandler extends i{constructor(e,t){if(!e||typeof e!=="object"){throw new A("invalid opts")}if(typeof t!=="function"){throw new A("invalid callback")}const{signal:s,opaque:i,responseHeaders:o}=e;if(s&&typeof s.on!=="function"&&typeof s.addEventListener!=="function"){throw new A("signal must be an EventEmitter or EventTarget")}super("UNDICI_CONNECT");this.opaque=i||null;this.responseHeaders=o||null;this.callback=t;this.abort=null;a(this,s)}onConnect(e,t){if(!this.callback){throw new o}this.abort=e;this.context=t}onHeaders(){throw new r("bad connect",null)}onUpgrade(e,t,s){const{callback:i,opaque:A,context:o}=this;c(this);this.callback=null;let r=t;if(r!=null){r=this.responseHeaders==="raw"?n.parseRawHeaders(t):n.parseHeaders(t)}this.runInAsyncScope(i,null,null,{statusCode:e,headers:r,socket:s,opaque:A,context:o})}onError(e){const{callback:t,opaque:s}=this;c(this);if(t){this.callback=null;queueMicrotask((()=>{this.runInAsyncScope(t,null,e,{opaque:s})}))}}}function connect(e,t){if(t===undefined){return new Promise(((t,s)=>{connect.call(this,e,((e,i)=>e?s(e):t(i)))}))}try{const s=new ConnectHandler(e,t);this.dispatch({...e,method:"CONNECT"},s)}catch(s){if(typeof t!=="function"){throw s}const i=e&&e.opaque;queueMicrotask((()=>t(s,{opaque:i})))}}e.exports=connect},6862:(e,t,s)=>{"use strict";const{Readable:i,Duplex:A,PassThrough:o}=s(2203);const{InvalidArgumentError:r,InvalidReturnValueError:n,RequestAbortedError:a}=s(8707);const c=s(3440);const{AsyncResource:l}=s(290);const{addSignal:u,removeSignal:p}=s(158);const g=s(2613);const h=Symbol("resume");class PipelineRequest extends i{constructor(){super({autoDestroy:true});this[h]=null}_read(){const{[h]:e}=this;if(e){this[h]=null;e()}}_destroy(e,t){this._read();t(e)}}class PipelineResponse extends i{constructor(e){super({autoDestroy:true});this[h]=e}_read(){this[h]()}_destroy(e,t){if(!e&&!this._readableState.endEmitted){e=new a}t(e)}}class PipelineHandler extends l{constructor(e,t){if(!e||typeof e!=="object"){throw new r("invalid opts")}if(typeof t!=="function"){throw new r("invalid handler")}const{signal:s,method:i,opaque:o,onInfo:n,responseHeaders:l}=e;if(s&&typeof s.on!=="function"&&typeof s.addEventListener!=="function"){throw new r("signal must be an EventEmitter or EventTarget")}if(i==="CONNECT"){throw new r("invalid method")}if(n&&typeof n!=="function"){throw new r("invalid onInfo callback")}super("UNDICI_PIPELINE");this.opaque=o||null;this.responseHeaders=l||null;this.handler=t;this.abort=null;this.context=null;this.onInfo=n||null;this.req=(new PipelineRequest).on("error",c.nop);this.ret=new A({readableObjectMode:e.objectMode,autoDestroy:true,read:()=>{const{body:e}=this;if(e&&e.resume){e.resume()}},write:(e,t,s)=>{const{req:i}=this;if(i.push(e,t)||i._readableState.destroyed){s()}else{i[h]=s}},destroy:(e,t)=>{const{body:s,req:i,res:A,ret:o,abort:r}=this;if(!e&&!o._readableState.endEmitted){e=new a}if(r&&e){r()}c.destroy(s,e);c.destroy(i,e);c.destroy(A,e);p(this);t(e)}}).on("prefinish",(()=>{const{req:e}=this;e.push(null)}));this.res=null;u(this,s)}onConnect(e,t){const{ret:s,res:i}=this;g(!i,"pipeline cannot be retried");if(s.destroyed){throw new a}this.abort=e;this.context=t}onHeaders(e,t,s){const{opaque:i,handler:A,context:o}=this;if(e<200){if(this.onInfo){const s=this.responseHeaders==="raw"?c.parseRawHeaders(t):c.parseHeaders(t);this.onInfo({statusCode:e,headers:s})}return}this.res=new PipelineResponse(s);let r;try{this.handler=null;const s=this.responseHeaders==="raw"?c.parseRawHeaders(t):c.parseHeaders(t);r=this.runInAsyncScope(A,null,{statusCode:e,headers:s,opaque:i,body:this.res,context:o})}catch(e){this.res.on("error",c.nop);throw e}if(!r||typeof r.on!=="function"){throw new n("expected Readable")}r.on("data",(e=>{const{ret:t,body:s}=this;if(!t.push(e)&&s.pause){s.pause()}})).on("error",(e=>{const{ret:t}=this;c.destroy(t,e)})).on("end",(()=>{const{ret:e}=this;e.push(null)})).on("close",(()=>{const{ret:e}=this;if(!e._readableState.ended){c.destroy(e,new a)}}));this.body=r}onData(e){const{res:t}=this;return t.push(e)}onComplete(e){const{res:t}=this;t.push(null)}onError(e){const{ret:t}=this;this.handler=null;c.destroy(t,e)}}function pipeline(e,t){try{const s=new PipelineHandler(e,t);this.dispatch({...e,body:s.req},s);return s.ret}catch(e){return(new o).destroy(e)}}e.exports=pipeline},4043:(e,t,s)=>{"use strict";const i=s(9927);const{InvalidArgumentError:A,RequestAbortedError:o}=s(8707);const r=s(3440);const{getResolveErrorBodyCallback:n}=s(7655);const{AsyncResource:a}=s(290);const{addSignal:c,removeSignal:l}=s(158);class RequestHandler extends a{constructor(e,t){if(!e||typeof e!=="object"){throw new A("invalid opts")}const{signal:s,method:i,opaque:o,body:n,onInfo:a,responseHeaders:l,throwOnError:u,highWaterMark:p}=e;try{if(typeof t!=="function"){throw new A("invalid callback")}if(p&&(typeof p!=="number"||p<0)){throw new A("invalid highWaterMark")}if(s&&typeof s.on!=="function"&&typeof s.addEventListener!=="function"){throw new A("signal must be an EventEmitter or EventTarget")}if(i==="CONNECT"){throw new A("invalid method")}if(a&&typeof a!=="function"){throw new A("invalid onInfo callback")}super("UNDICI_REQUEST")}catch(e){if(r.isStream(n)){r.destroy(n.on("error",r.nop),e)}throw e}this.responseHeaders=l||null;this.opaque=o||null;this.callback=t;this.res=null;this.abort=null;this.body=n;this.trailers={};this.context=null;this.onInfo=a||null;this.throwOnError=u;this.highWaterMark=p;if(r.isStream(n)){n.on("error",(e=>{this.onError(e)}))}c(this,s)}onConnect(e,t){if(!this.callback){throw new o}this.abort=e;this.context=t}onHeaders(e,t,s,A){const{callback:o,opaque:a,abort:c,context:l,responseHeaders:u,highWaterMark:p}=this;const g=u==="raw"?r.parseRawHeaders(t):r.parseHeaders(t);if(e<200){if(this.onInfo){this.onInfo({statusCode:e,headers:g})}return}const h=u==="raw"?r.parseHeaders(t):g;const d=h["content-type"];const E=new i({resume:s,abort:c,contentType:d,highWaterMark:p});this.callback=null;this.res=E;if(o!==null){if(this.throwOnError&&e>=400){this.runInAsyncScope(n,null,{callback:o,body:E,contentType:d,statusCode:e,statusMessage:A,headers:g})}else{this.runInAsyncScope(o,null,null,{statusCode:e,headers:g,trailers:this.trailers,opaque:a,body:E,context:l})}}}onData(e){const{res:t}=this;return t.push(e)}onComplete(e){const{res:t}=this;l(this);r.parseHeaders(e,this.trailers);t.push(null)}onError(e){const{res:t,callback:s,body:i,opaque:A}=this;l(this);if(s){this.callback=null;queueMicrotask((()=>{this.runInAsyncScope(s,null,e,{opaque:A})}))}if(t){this.res=null;queueMicrotask((()=>{r.destroy(t,e)}))}if(i){this.body=null;r.destroy(i,e)}}}function request(e,t){if(t===undefined){return new Promise(((t,s)=>{request.call(this,e,((e,i)=>e?s(e):t(i)))}))}try{this.dispatch(e,new RequestHandler(e,t))}catch(s){if(typeof t!=="function"){throw s}const i=e&&e.opaque;queueMicrotask((()=>t(s,{opaque:i})))}}e.exports=request;e.exports.RequestHandler=RequestHandler},3560:(e,t,s)=>{"use strict";const{finished:i,PassThrough:A}=s(2203);const{InvalidArgumentError:o,InvalidReturnValueError:r,RequestAbortedError:n}=s(8707);const a=s(3440);const{getResolveErrorBodyCallback:c}=s(7655);const{AsyncResource:l}=s(290);const{addSignal:u,removeSignal:p}=s(158);class StreamHandler extends l{constructor(e,t,s){if(!e||typeof e!=="object"){throw new o("invalid opts")}const{signal:i,method:A,opaque:r,body:n,onInfo:c,responseHeaders:l,throwOnError:p}=e;try{if(typeof s!=="function"){throw new o("invalid callback")}if(typeof t!=="function"){throw new o("invalid factory")}if(i&&typeof i.on!=="function"&&typeof i.addEventListener!=="function"){throw new o("signal must be an EventEmitter or EventTarget")}if(A==="CONNECT"){throw new o("invalid method")}if(c&&typeof c!=="function"){throw new o("invalid onInfo callback")}super("UNDICI_STREAM")}catch(e){if(a.isStream(n)){a.destroy(n.on("error",a.nop),e)}throw e}this.responseHeaders=l||null;this.opaque=r||null;this.factory=t;this.callback=s;this.res=null;this.abort=null;this.context=null;this.trailers=null;this.body=n;this.onInfo=c||null;this.throwOnError=p||false;if(a.isStream(n)){n.on("error",(e=>{this.onError(e)}))}u(this,i)}onConnect(e,t){if(!this.callback){throw new n}this.abort=e;this.context=t}onHeaders(e,t,s,o){const{factory:n,opaque:l,context:u,callback:p,responseHeaders:g}=this;const h=g==="raw"?a.parseRawHeaders(t):a.parseHeaders(t);if(e<200){if(this.onInfo){this.onInfo({statusCode:e,headers:h})}return}this.factory=null;let d;if(this.throwOnError&&e>=400){const s=g==="raw"?a.parseHeaders(t):h;const i=s["content-type"];d=new A;this.callback=null;this.runInAsyncScope(c,null,{callback:p,body:d,contentType:i,statusCode:e,statusMessage:o,headers:h})}else{if(n===null){return}d=this.runInAsyncScope(n,null,{statusCode:e,headers:h,opaque:l,context:u});if(!d||typeof d.write!=="function"||typeof d.end!=="function"||typeof d.on!=="function"){throw new r("expected Writable")}i(d,{readable:false},(e=>{const{callback:t,res:s,opaque:i,trailers:A,abort:o}=this;this.res=null;if(e||!s.readable){a.destroy(s,e)}this.callback=null;this.runInAsyncScope(t,null,e||null,{opaque:i,trailers:A});if(e){o()}}))}d.on("drain",s);this.res=d;const E=d.writableNeedDrain!==undefined?d.writableNeedDrain:d._writableState&&d._writableState.needDrain;return E!==true}onData(e){const{res:t}=this;return t?t.write(e):true}onComplete(e){const{res:t}=this;p(this);if(!t){return}this.trailers=a.parseHeaders(e);t.end()}onError(e){const{res:t,callback:s,opaque:i,body:A}=this;p(this);this.factory=null;if(t){this.res=null;a.destroy(t,e)}else if(s){this.callback=null;queueMicrotask((()=>{this.runInAsyncScope(s,null,e,{opaque:i})}))}if(A){this.body=null;a.destroy(A,e)}}}function stream(e,t,s){if(s===undefined){return new Promise(((s,i)=>{stream.call(this,e,t,((e,t)=>e?i(e):s(t)))}))}try{this.dispatch(e,new StreamHandler(e,t,s))}catch(t){if(typeof s!=="function"){throw t}const i=e&&e.opaque;queueMicrotask((()=>s(t,{opaque:i})))}}e.exports=stream},1882:(e,t,s)=>{"use strict";const{InvalidArgumentError:i,RequestAbortedError:A,SocketError:o}=s(8707);const{AsyncResource:r}=s(290);const n=s(3440);const{addSignal:a,removeSignal:c}=s(158);const l=s(2613);class UpgradeHandler extends r{constructor(e,t){if(!e||typeof e!=="object"){throw new i("invalid opts")}if(typeof t!=="function"){throw new i("invalid callback")}const{signal:s,opaque:A,responseHeaders:o}=e;if(s&&typeof s.on!=="function"&&typeof s.addEventListener!=="function"){throw new i("signal must be an EventEmitter or EventTarget")}super("UNDICI_UPGRADE");this.responseHeaders=o||null;this.opaque=A||null;this.callback=t;this.abort=null;this.context=null;a(this,s)}onConnect(e,t){if(!this.callback){throw new A}this.abort=e;this.context=null}onHeaders(){throw new o("bad upgrade",null)}onUpgrade(e,t,s){const{callback:i,opaque:A,context:o}=this;l.strictEqual(e,101);c(this);this.callback=null;const r=this.responseHeaders==="raw"?n.parseRawHeaders(t):n.parseHeaders(t);this.runInAsyncScope(i,null,null,{headers:r,socket:s,opaque:A,context:o})}onError(e){const{callback:t,opaque:s}=this;c(this);if(t){this.callback=null;queueMicrotask((()=>{this.runInAsyncScope(t,null,e,{opaque:s})}))}}}function upgrade(e,t){if(t===undefined){return new Promise(((t,s)=>{upgrade.call(this,e,((e,i)=>e?s(e):t(i)))}))}try{const s=new UpgradeHandler(e,t);this.dispatch({...e,method:e.method||"GET",upgrade:e.protocol||"Websocket"},s)}catch(s){if(typeof t!=="function"){throw s}const i=e&&e.opaque;queueMicrotask((()=>t(s,{opaque:i})))}}e.exports=upgrade},6615:(e,t,s)=>{"use strict";e.exports.request=s(4043);e.exports.stream=s(3560);e.exports.pipeline=s(6862);e.exports.upgrade=s(1882);e.exports.connect=s(4660)},9927:(e,t,s)=>{"use strict";const i=s(2613);const{Readable:A}=s(2203);const{RequestAbortedError:o,NotSupportedError:r,InvalidArgumentError:n}=s(8707);const a=s(3440);const{ReadableStreamFrom:c,toUSVString:l}=s(3440);let u;const p=Symbol("kConsume");const g=Symbol("kReading");const h=Symbol("kBody");const d=Symbol("abort");const E=Symbol("kContentType");const noop=()=>{};e.exports=class BodyReadable extends A{constructor({resume:e,abort:t,contentType:s="",highWaterMark:i=64*1024}){super({autoDestroy:true,read:e,highWaterMark:i});this._readableState.dataEmitted=false;this[d]=t;this[p]=null;this[h]=null;this[E]=s;this[g]=false}destroy(e){if(this.destroyed){return this}if(!e&&!this._readableState.endEmitted){e=new o}if(e){this[d]()}return super.destroy(e)}emit(e,...t){if(e==="data"){this._readableState.dataEmitted=true}else if(e==="error"){this._readableState.errorEmitted=true}return super.emit(e,...t)}on(e,...t){if(e==="data"||e==="readable"){this[g]=true}return super.on(e,...t)}addListener(e,...t){return this.on(e,...t)}off(e,...t){const s=super.off(e,...t);if(e==="data"||e==="readable"){this[g]=this.listenerCount("data")>0||this.listenerCount("readable")>0}return s}removeListener(e,...t){return this.off(e,...t)}push(e){if(this[p]&&e!==null&&this.readableLength===0){consumePush(this[p],e);return this[g]?super.push(e):true}return super.push(e)}async text(){return consume(this,"text")}async json(){return consume(this,"json")}async blob(){return consume(this,"blob")}async arrayBuffer(){return consume(this,"arrayBuffer")}async formData(){throw new r}get bodyUsed(){return a.isDisturbed(this)}get body(){if(!this[h]){this[h]=c(this);if(this[p]){this[h].getReader();i(this[h].locked)}}return this[h]}dump(e){let t=e&&Number.isFinite(e.limit)?e.limit:262144;const s=e&&e.signal;if(s){try{if(typeof s!=="object"||!("aborted"in s)){throw new n("signal must be an AbortSignal")}a.throwIfAborted(s)}catch(e){return Promise.reject(e)}}if(this.closed){return Promise.resolve(null)}return new Promise(((e,i)=>{const A=s?a.addAbortListener(s,(()=>{this.destroy()})):noop;this.on("close",(function(){A();if(s&&s.aborted){i(s.reason||Object.assign(new Error("The operation was aborted"),{name:"AbortError"}))}else{e(null)}})).on("error",noop).on("data",(function(e){t-=e.length;if(t<=0){this.destroy()}})).resume()}))}};function isLocked(e){return e[h]&&e[h].locked===true||e[p]}function isUnusable(e){return a.isDisturbed(e)||isLocked(e)}async function consume(e,t){if(isUnusable(e)){throw new TypeError("unusable")}i(!e[p]);return new Promise(((s,i)=>{e[p]={type:t,stream:e,resolve:s,reject:i,length:0,body:[]};e.on("error",(function(e){consumeFinish(this[p],e)})).on("close",(function(){if(this[p].body!==null){consumeFinish(this[p],new o)}}));process.nextTick(consumeStart,e[p])}))}function consumeStart(e){if(e.body===null){return}const{_readableState:t}=e.stream;for(const s of t.buffer){consumePush(e,s)}if(t.endEmitted){consumeEnd(this[p])}else{e.stream.on("end",(function(){consumeEnd(this[p])}))}e.stream.resume();while(e.stream.read()!=null){}}function consumeEnd(e){const{type:t,body:i,resolve:A,stream:o,length:r}=e;try{if(t==="text"){A(l(Buffer.concat(i)))}else if(t==="json"){A(JSON.parse(Buffer.concat(i)))}else if(t==="arrayBuffer"){const e=new Uint8Array(r);let t=0;for(const s of i){e.set(s,t);t+=s.byteLength}A(e.buffer)}else if(t==="blob"){if(!u){u=s(181).Blob}A(new u(i,{type:o[E]}))}consumeFinish(e)}catch(e){o.destroy(e)}}function consumePush(e,t){e.length+=t.length;e.body.push(t)}function consumeFinish(e,t){if(e.body===null){return}if(t){e.reject(t)}else{e.resolve()}e.type=null;e.stream=null;e.resolve=null;e.reject=null;e.length=0;e.body=null}},7655:(e,t,s)=>{const i=s(2613);const{ResponseStatusCodeError:A}=s(8707);const{toUSVString:o}=s(3440);async function getResolveErrorBodyCallback({callback:e,body:t,contentType:s,statusCode:r,statusMessage:n,headers:a}){i(t);let c=[];let l=0;for await(const e of t){c.push(e);l+=e.length;if(l>128*1024){c=null;break}}if(r===204||!s||!c){process.nextTick(e,new A(`Response status code ${r}${n?`: ${n}`:""}`,r,a));return}try{if(s.startsWith("application/json")){const t=JSON.parse(o(Buffer.concat(c)));process.nextTick(e,new A(`Response status code ${r}${n?`: ${n}`:""}`,r,a,t));return}if(s.startsWith("text/")){const t=o(Buffer.concat(c));process.nextTick(e,new A(`Response status code ${r}${n?`: ${n}`:""}`,r,a,t));return}}catch(e){}process.nextTick(e,new A(`Response status code ${r}${n?`: ${n}`:""}`,r,a))}e.exports={getResolveErrorBodyCallback:getResolveErrorBodyCallback}},1093:(e,t,s)=>{"use strict";const{BalancedPoolMissingUpstreamError:i,InvalidArgumentError:A}=s(8707);const{PoolBase:o,kClients:r,kNeedDrain:n,kAddClient:a,kRemoveClient:c,kGetDispatcher:l}=s(8640);const u=s(5076);const{kUrl:p,kInterceptors:g}=s(6443);const{parseOrigin:h}=s(3440);const d=Symbol("factory");const E=Symbol("options");const Q=Symbol("kGreatestCommonDivisor");const C=Symbol("kCurrentWeight");const B=Symbol("kIndex");const I=Symbol("kWeight");const b=Symbol("kMaxWeightPerServer");const y=Symbol("kErrorPenalty");function getGreatestCommonDivisor(e,t){if(t===0)return e;return getGreatestCommonDivisor(t,e%t)}function defaultFactory(e,t){return new u(e,t)}class BalancedPool extends o{constructor(e=[],{factory:t=defaultFactory,...s}={}){super();this[E]=s;this[B]=-1;this[C]=0;this[b]=this[E].maxWeightPerServer||100;this[y]=this[E].errorPenalty||15;if(!Array.isArray(e)){e=[e]}if(typeof t!=="function"){throw new A("factory must be a function.")}this[g]=s.interceptors&&s.interceptors.BalancedPool&&Array.isArray(s.interceptors.BalancedPool)?s.interceptors.BalancedPool:[];this[d]=t;for(const t of e){this.addUpstream(t)}this._updateBalancedPoolStats()}addUpstream(e){const t=h(e).origin;if(this[r].find((e=>e[p].origin===t&&e.closed!==true&&e.destroyed!==true))){return this}const s=this[d](t,Object.assign({},this[E]));this[a](s);s.on("connect",(()=>{s[I]=Math.min(this[b],s[I]+this[y])}));s.on("connectionError",(()=>{s[I]=Math.max(1,s[I]-this[y]);this._updateBalancedPoolStats()}));s.on("disconnect",((...e)=>{const t=e[2];if(t&&t.code==="UND_ERR_SOCKET"){s[I]=Math.max(1,s[I]-this[y]);this._updateBalancedPoolStats()}}));for(const e of this[r]){e[I]=this[b]}this._updateBalancedPoolStats();return this}_updateBalancedPoolStats(){this[Q]=this[r].map((e=>e[I])).reduce(getGreatestCommonDivisor,0)}removeUpstream(e){const t=h(e).origin;const s=this[r].find((e=>e[p].origin===t&&e.closed!==true&&e.destroyed!==true));if(s){this[c](s)}return this}get upstreams(){return this[r].filter((e=>e.closed!==true&&e.destroyed!==true)).map((e=>e[p].origin))}[l](){if(this[r].length===0){throw new i}const e=this[r].find((e=>!e[n]&&e.closed!==true&&e.destroyed!==true));if(!e){return}const t=this[r].map((e=>e[n])).reduce(((e,t)=>e&&t),true);if(t){return}let s=0;let A=this[r].findIndex((e=>!e[n]));while(s++