setup-cpp/dist/modern/proxy-agent.74b39078.js

31 lines
334 KiB
JavaScript
Raw Normal View History

2024-09-02 17:30:54 +08:00
function A(A,e,t,Q){Object.defineProperty(A,e,{get:t,set:Q,enumerable:!0,configurable:!0});}var e=require("url"),t=require("events"),Q=require("assert"),E=require("net"),r=require("http"),g=require("stream"),B=require("buffer"),C=require("util"),o=require("querystring"),I=require("stream"),i=require("util"),s=require("events"),n=require("perf_hooks"),a=require("worker_threads"),h=require("tls"),l=globalThis,c=l.parcelRequire810d,u=c.register;u("3z4gn",function(A,t){var Q,E,r,g,B,C,o,I,i,s,n,a,h;function l(A,e){return new I(A,e);}E=(Q=c("heqcE")).kProxy,r=Q.kClose,g=Q.kDestroy,B=Q.kInterceptors,C=e.URL,o=c("iOr8X"),I=c("5gSoc"),i=c("8jk4s"),n=(s=c("eCuXV")).InvalidArgumentError,a=s.RequestAbortedError,h=c("8fhlK");let u=Symbol(),d=Symbol(),D=Symbol(),R=Symbol(),f=Symbol(),y=Symbol();A.exports=class extends i{constructor(A){if(super(A),this[E]=function(A){if("string"==typeof A&&(A={uri:A}),!A||!A.uri)throw new n("Proxy opts.uri is mandatory");return{uri:A.uri,protocol:A.protocol||"https"};}(A),this[u]=new o(A),this[B]=A.interceptors&&A.interceptors.ProxyAgent&&Array.isArray(A.interceptors.ProxyAgent)?A.interceptors.ProxyAgent:[],"string"==typeof A&&(A={uri:A}),!A||!A.uri)throw new n("Proxy opts.uri is mandatory");let{clientFactory:e=l}=A;if("function"!=typeof e)throw new n("Proxy opts.clientFactory must be a function.");this[R]=A.requestTls,this[f]=A.proxyTls,this[D]=A.headers||{};let t=new C(A.uri),{origin:Q,port:r,host:g,username:I,password:i}=t;if(A.auth&&A.token)throw new n("opts.auth cannot be used in combination with opts.token");A.auth?this[D]["proxy-authorization"]="Basic "+A.auth:A.token?this[D]["proxy-authorization"]=A.token:I&&i&&(this[D]["proxy-authorization"]="Basic "+Buffer.from(`${decodeURIComponent(I)}:${decodeURIComponent(i)}`).toString("base64"));let s=h({...A.proxyTls});this[y]=h({...A.requestTls}),this[d]=e(t,{connect:s}),this[u]=new o({...A,connect:async(A,e)=>{let t=A.host;!A.port&&(t+=":"+("https:"===A.protocol?443:80));try{let E;let{socket:B,statusCode:C}=await this[d].connect({origin:Q,port:r,path:t,signal:A.signal,headers:{...this[D],host:g}});if(200!==C&&(B.on("error",()=>{}).destroy(),e(new a(`Proxy response (${C}) !== 200 when HTTP Tunneling`))),"https:"!==A.protocol){e(null,B);return;}E=this[R]?this[R].servername:A.servername,this[y]({...A,servername:E,httpSocket:B},e);}catch(A){e(A);}}});}dispatch(A,e){let{host:t}=new C(A.origin),Q=function(A){if(Array.isArray(A)){let e={};for(let t=0;t<A.length;t+=2)e[A[t]]=A[t+1];return e;}return A;}(A.headers);return function(A){if(A&&Object.keys(A).find(A=>"proxy-authorization"===A.toLowerCase()))throw new n("Proxy-Authorization should be sent in ProxyAgent constructor");}(Q),this[u].dispatch({...A,headers:{...Q,host:t}},e);}async[r](){await this[u].close(),await this[d].close();}async[g](){await this[u].destroy(),await this[d].destroy();}};}),u("heqcE",function(A,e){A.exports={kClose:Symbol(),kDestroy:Symbol(),kDispatch:Symbol(),kUrl:Symbol(),kWriting:Symbol(),kResuming:Symbol(),kQueue:Symbol(),kConnect:Symbol(),kConnecting:Symbol(),kHeadersList:Symbol(),kKeepAliveDefaultTimeout:Symbol(),kKeepAliveMaxTimeout:Symbol(),kKeepAliveTimeoutThreshold:Symbol(),kKeepAliveTimeoutValue:Symbol(),kKeepAlive:Symbol(),kHeadersTimeout:Symbol(),kBodyTimeout:Symbol(),kServerName:Symbol(),kLocalAddress:Symbol(),kHost:Symbol(),kNoRef:Symbol(),kBodyUsed:Symbol(),kRunning:Symbol(),kBlocking:Symbol(),kPending:Symbol(),kSize:Symbol(),kBusy:Symbol(),kQueued:Symbol(),kFree:Symbol(),kConnected:Symbol(),kClosed:Symbol(),kNeedDrain:Symbol(),kReset:Symbol(),kDestroyed:Symbol.for("nodejs.stream.destroyed"),kMaxHeadersSize:Symbol(),kRunningIdx:Symbol(),kPendingIdx:Symbol(),kError:Symbol(),kClients:Symbol(),kClient:Symbol(),kParser:Symbol(),kOnDestroyed:Symbol(),kPipelining:Symbol(),kSocket:Symbol(),kHostHeader:Symbol(),kConnector:Symbol(),kStrictContentLength:Symbol(),kMaxRedirections:Symbol(),kMaxRequests:Symbol(),kProxy:Symbol(),kCounter:Symbol(),kInterceptors:Symbol(),kMaxResponseSize:Symbol(),kHTTP2Session:Symbol(),kHTTP2SessionState:Symbol(),kHTTP2BuildRequest:Symbol(),kHTTP1Buil
`;return"string"==typeof g?d+=`host: ${g}\r
`:d+=A[P],C?d+=`connection: upgrade\r
upgrade: ${C}\r
`:A[j]&&!u[p]?d+="connection: keep-alive\r\n":d+="connection: close\r\n",I&&(d+=I),A0.sendHeaders.hasSubscribers&&A0.sendHeaders.publish({request:e,headers:d,socket:u}),t&&0!==l?B.isBuffer(t)?(Q(c===t.byteLength,"buffer body must have content length"),u.cork(),u.write(`${d}content-length: ${c}\r
\r
`,"latin1"),u.write(t),u.uncork(),e.onBodySent(t),e.onRequestSent(),a||(u[p]=!0)):B.isBlobLike(t)?"function"==typeof t.stream?AW({body:t.stream(),client:A,request:e,socket:u,contentLength:c,header:d,expectsPayload:a}):A_({body:t,client:A,request:e,socket:u,contentLength:c,header:d,expectsPayload:a}):B.isStream(t)?AV({body:t,client:A,request:e,socket:u,contentLength:c,header:d,expectsPayload:a}):B.isIterable(t)?AW({body:t,client:A,request:e,socket:u,contentLength:c,header:d,expectsPayload:a}):Q(!1):(0===c?u.write(`${d}content-length: 0\r
\r
`,"latin1"):(Q(null===c,"no body must not have content length"),u.write(`${d}\r
`,"latin1")),e.onRequestSent()),!0;}(A,E)?A[O]++:A[V].splice(A[O],1);}}(A,e),A[Y]=0,A[Z]>256&&(A[V].splice(0,A[Z]),A[O]-=A[Z],A[Z]=0));}function AH(A){return"GET"!==A&&"HEAD"!==A&&"OPTIONS"!==A&&"TRACE"!==A&&"CONNECT"!==A;}function AV({h2stream:A,body:e,client:E,request:r,socket:g,contentLength:C,header:o,expectsPayload:I}){if(Q(0!==C||0===E[J],"stream body cannot be pipelined"),"h2"===E[Ah]){function i(A){r.onBodySent(A);}let Q=t(e,A,t=>{t?(B.destroy(e,t),B.destroy(A,t)):r.onRequestSent();});Q.on("data",i),Q.once("end",()=>{Q.removeListener("data",i),B.destroy(Q);});return;}let s=!1,n=new et({socket:g,request:r,contentLength:C,client:E,expectsPayload:I,header:o}),a=function(A){if(!s)try{!n.write(A)&&this.pause&&this.pause();}catch(A){B.destroy(this,A);}},l=function(){!s&&e.resume&&e.resume();},c=function(){if(s)return;let A=new h();queueMicrotask(()=>u(A));},u=function(A){if(!s){if(s=!0,Q(g.destroyed||g[H]&&E[J]<=1),g.off("drain",l).off("error",u),e.removeListener("data",a).removeListener("end",u).removeListener("error",u).removeListener("close",c),!A)try{n.end();}catch(e){A=e;}n.destroy(A),A&&("UND_ERR_INFO"!==A.code||"reset"!==A.message)?B.destroy(e,A):B.destroy(e);}};e.on("data",a).on("end",u).on("error",u).on("close",c),e.resume&&e.resume(),g.on("drain",l).on("error",u);}async function A_({h2stream:A,body:e,client:t,request:E,socket:r,contentLength:g,header:C,expectsPayload:o}){Q(g===e.size,"blob body must have content length");let I="h2"===t[Ah];try{if(null!=g&&g!==e.size)throw new s();let Q=Buffer.from(await e.arrayBuffer());I?(A.cork(),A.write(Q),A.uncork()):(r.cork(),r.write(`${C}content-length: ${g}\r
\r
`,"latin1"),r.write(Q),r.uncork()),E.onBodySent(Q),E.onRequestSent(),o||(r[p]=!0),AT(t);}catch(e){B.destroy(I?A:r,e);}}async function AW({h2stream:A,body:e,client:t,request:E,socket:r,contentLength:g,header:B,expectsPayload:C}){function o(){if(I){let A=I;I=null,A();}}Q(0!==g||0===t[J],"iterator body cannot be pipelined");let I=null,i=()=>new Promise((A,e)=>{Q(null===I),r[X]?e(r[X]):I=A;});if("h2"===t[Ah]){A.on("close",o).on("drain",o);try{for await(let t of e){if(r[X])throw r[X];let e=A.write(t);E.onBodySent(t),e||(await i());}}catch(e){A.destroy(e);}finally{E.onRequestSent(),A.end(),A.off("close",o).off("drain",o);}return;}r.on("close",o).on("drain",o);let s=new et({socket:r,request:E,contentLength:g,client:t,expectsPayload:C,header:B});try{for await(let A of e){if(r[X])throw r[X];s.write(A)||(await i());}s.end();}catch(A){s.destroy(A);}finally{r.off("close",o).off("drain",o);}}function Av(A,e,t){try{e.onError(t),Q(e.aborted);}catch(e){A.emit("error",e);}}t=g.pipeline,B=c("jqWlt"),C=c("8zzvT"),o=c("8XvZr"),I=c("8jk4s"),s=(i=c("eCuXV")).RequestContentLengthMismatchError,n=i.ResponseContentLengthMismatchError,a=i.InvalidArgumentError,h=i.RequestAbortedError,l=i.HeadersTimeoutError,u=i.HeadersOverflowError,d=i.SocketError,D=i.InformationalError,R=i.BodyTimeoutError,f=i.HTTPParserError,y=i.ResponseExceededMaxSizeError,w=i.ClientDestroyedError,F=c("8fhlK"),S=(N=c("heqcE")).kUrl,p=N.kReset,b=N.kServerName,k=N.kClient,U=N.kBusy,m=N.kParser,L=N.kConnect,M=N.kBlocking,Y=N.kResuming,J=N.kRunning,G=N.kPending,T=N.kSize,H=N.kWriting,V=N.kQueue,_=N.kConnected,W=N.kConnecting,v=N.kNeedDrain,x=N.kNoRef,q=N.kKeepAliveDefaultTimeout,P=N.kHostHeader,O=N.kPendingIdx,Z=N.kRunningIdx,X=N.kError,j=N.kPipelining,z=N.kSocket,K=N.kKeepAliveTimeoutValue,$=N.kMaxHeadersSize,AA=N.kKeepAliveMaxTimeout,Ae=N.kKeepAliveTimeoutThreshold,At=N.kHeadersTimeout,AQ=N.kBodyTimeout,AE=N.kStrictContentLength,Ar=N.kConnector,Ag=N.kMaxRedirections,AB=N.kMaxRequests,AC=N.kCounter,Ao=N.kClose,AI=N.kDestroy,Ai=N.kDispatch,As=N.kInterceptors,An=N.kLocalAddress,Aa=N.kMaxResponseSize,Ah=N.kHTTPConnVersion,Al=N.kHost,Ac=N.kHTTP2Session,Au=N.kHTTP2SessionState,Ad=N.kHTTP2BuildRequest,AD=N.kHTTP2CopyHeaders,AR=N.kHTTP1BuildRequest;try{Aw=$2321944cfe4ffd56$import$44c8f355160d282b;}catch{Aw={constants:{}};}let{constants:{HTTP2_HEADER_AUTHORITY:Ax,HTTP2_HEADER_METHOD:Aq,HTTP2_HEADER_PATH:AP,HTTP2_HEADER_SCHEME:AO,HTTP2_HEADER_CONTENT_LENGTH:AZ,HTTP2_HEADER_EXPECT:AX,HTTP2_HEADER_STATUS:Aj}}=Aw,Az=!1,AK=Buffer[Symbol.species],A$=Symbol(),A0={};try{let A=c("dfobN");A0.sendHeaders=A.channel("undici:client:sendHeaders"),A0.beforeConnect=A.channel("undici:client:beforeConnect"),A0.connectError=A.channel("undici:client:connectError"),A0.connected=A.channel("undici:client:connected");}catch{A0.sendHeaders={hasSubscribers:!1},A0.beforeConnect={hasSubscribers:!1},A0.connectError={hasSubscribers:!1},A0.connected={hasSubscribers:!1};}Af=c("51KgU"),Ay=c("lx1W2");let A2=Buffer.alloc(0),A1=null,A9=Ab();A9.catch();let A4=null,A8=null,A3=0,A5=null,A6=1,A7=2,eA=3;class ee{constructor(A,e,{exports:t}){Q(Number.isFinite(A[$])&&A[$]>0),this.llhttp=t,this.ptr=this.llhttp.llhttp_alloc(Af.TYPE.RESPONSE),this.client=A,this.socket=e,this.timeout=null,this.timeoutValue=null,this.timeoutType=null,this.statusCode=null,this.statusText="",this.upgrade=!1,this.headers=[],this.headersSize=0,this.headersMaxSize=A[$],this.shouldKeepAlive=!1,this.paused=!1,this.resume=this.resume.bind(this),this.bytesRead=0,this.keepAlive="",this.contentLength="",this.connection="",this.maxResponseSize=A[Aa];}setTimeout(A,e){this.timeoutType=e,A!==this.timeoutValue?(C.clearTimeout(this.timeout),A?(this.timeout=C.setTimeout(Ak,A,this),this.timeout.unref&&this.timeout.unref()):this.timeout=null,this.timeoutValue=A):this.timeout&&this.timeout.refresh&&this.timeout.refresh();}resume(){!this.socket.destroyed&&this.paused&&(Q(null!=this.ptr),Q(null==A4),this.llhttp.llhttp_resume(this.ptr),Q(this.timeoutType===A7),this.timeout&&this.timeout.refresh&&this.timeout.refresh(),this.paused=!1,this.execute(this.socket.read()||A2),this.re
`,"latin1"):e.write(`${B}content-length: ${Q}\r
\r
`,"latin1")),null===Q&&e.write(`\r
${C.toString(16)}\r
`,"latin1"),this.bytesWritten+=C;let o=e.write(A);return e.uncork(),t.onBodySent(A),!o&&e[m].timeout&&e[m].timeoutType===A6&&e[m].timeout.refresh&&e[m].timeout.refresh(),o;}end(){let{socket:A,contentLength:e,client:t,bytesWritten:Q,expectsPayload:E,header:r,request:g}=this;if(g.onRequestSent(),A[H]=!1,A[X])throw A[X];if(!A.destroyed){if(0===Q?E?A.write(`${r}content-length: 0\r
\r
`,"latin1"):A.write(`${r}\r
`,"latin1"):null===e&&A.write("\r\n0\r\n\r\n","latin1"),null!==e&&Q!==e){if(t[AE])throw new s();process.emitWarning(new s());}A[m].timeout&&A[m].timeoutType===A6&&A[m].timeout.refresh&&A[m].timeout.refresh(),AT(t);}}destroy(A){let{socket:e,client:t}=this;e[H]=!1,A&&(Q(t[J]<=1,"pipeline should only contain this request"),B.destroy(e,A));}}A.exports=class extends I{constructor(A,{interceptors:e,maxHeaderSize:t,headersTimeout:Q,socketTimeout:g,requestTimeout:C,connectTimeout:o,bodyTimeout:I,idleTimeout:i,keepAlive:s,keepAliveTimeout:n,maxKeepAliveTimeout:h,keepAliveMaxTimeout:l,keepAliveTimeoutThreshold:c,socketPath:u,pipelining:d,tls:D,strictContentLength:R,maxCachedSessions:f,maxRedirections:y,connect:w,maxRequestsPerClient:N,localAddress:p,maxResponseSize:k,autoSelectFamily:U,autoSelectFamilyAttemptTimeout:m,allowH2:L,maxConcurrentStreams:M}={}){if(super(),void 0!==s)throw new a("unsupported keepAlive, use pipelining=0 instead");if(void 0!==g)throw new a("unsupported socketTimeout, use headersTimeout & bodyTimeout instead");if(void 0!==C)throw new a("unsupported requestTimeout, use headersTimeout & bodyTimeout instead");if(void 0!==i)throw new a("unsupported idleTimeout, use keepAliveTimeout instead");if(void 0!==h)throw new a("unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead");if(null!=t&&!Number.isFinite(t))throw new a("invalid maxHeaderSize");if(null!=u&&"string"!=typeof u)throw new a("invalid socketPath");if(null!=o&&(!Number.isFinite(o)||o<0))throw new a("invalid connectTimeout");if(null!=n&&(!Number.isFinite(n)||n<=0))throw new a("invalid keepAliveTimeout");if(null!=l&&(!Number.isFinite(l)||l<=0))throw new a("invalid keepAliveMaxTimeout");if(null!=c&&!Number.isFinite(c))throw new a("invalid keepAliveTimeoutThreshold");if(null!=Q&&(!Number.isInteger(Q)||Q<0))throw new a("headersTimeout must be a positive integer or zero");if(null!=I&&(!Number.isInteger(I)||I<0))throw new a("bodyTimeout must be a positive integer or zero");if(null!=w&&"function"!=typeof w&&"object"!=typeof w)throw new a("connect must be a function or an object");if(null!=y&&(!Number.isInteger(y)||y<0))throw new a("maxRedirections must be a positive number");if(null!=N&&(!Number.isInteger(N)||N<0))throw new a("maxRequestsPerClient must be a positive number");if(null!=p&&("string"!=typeof p||0===E.isIP(p)))throw new a("localAddress must be valid string IP address");if(null!=k&&(!Number.isInteger(k)||k<-1))throw new a("maxResponseSize must be a positive number");if(null!=m&&(!Number.isInteger(m)||m<-1))throw new a("autoSelectFamilyAttemptTimeout must be a positive number");if(null!=L&&"boolean"!=typeof L)throw new a("allowH2 must be a valid boolean value");if(null!=M&&("number"!=typeof M||M<1))throw new a("maxConcurrentStreams must be a possitive integer, greater than 0");"function"!=typeof w&&(w=F({...D,maxCachedSessions:f,allowH2:L,socketPath:u,timeout:o,...(B.nodeHasAutoSelectFamily&&U?{autoSelectFamily:U,autoSelectFamilyAttemptTimeout:m}:void 0),...w})),this[As]=e&&e.Client&&Array.isArray(e.Client)?e.Client:[Ay({maxRedirections:y})],this[S]=B.parseOrigin(A),this[Ar]=w,this[z]=null,this[j]=null!=d?d:1,this[$]=t||r.maxHeaderSize,this[q]=null==n?4e3:n,this[AA]=null==l?6e5:l,this[Ae]=null==c?1e3:c,this[K]=this[q],this[b]=null,this[An]=null!=p?p:null,this[Y]=0,this[v]=0,this[P]=`host: ${this[S].hostname}${this[S].port?":"+this[S].port:""}\r
`,this[AQ]=null!=I?I:3e5,this[At]=null!=Q?Q:3e5,this[AE]=null==R||R,this[Ag]=y,this[AB]=N,this[A$]=null,this[Aa]=k>-1?k:-1,this[Ah]="h1",this[Ac]=null,this[Au]=L?{openStreams:0,maxConcurrentStreams:null!=M?M:100}:null,this[Al]=`${this[S].hostname}${this[S].port?":"+this[S].port:""}`,this[V]=[],this[Z]=0,this[O]=0;}get pipelining(){return this[j];}set pipelining(A){this[j]=A,AT(this,!0);}get[G](){return this[V].length-this[O];}get[J](){return this[O]-this[Z];}get[T](){return this[V].length-this[Z];}get[_](){return!!this[z]&&!this[W]&&!this[z].destroyed;}get[U](){let A=this[z];return A&&(A[p]||A[H]||A[M])||this[T]>=(this[j]||1)||this[G]>0;}[L](A){AJ(this),this.once("connect",A);}[Ai](A,e){let t=A.origin||this[S].origin,Q="h2"===this[Ah]?o[Ad](t,A,e):o[AR](t,A,e);return this[V].push(Q),this[Y]||(null==B.bodyLength(Q.body)&&B.isIterable(Q.body)?(this[Y]=1,process.nextTick(AT,this)):AT(this,!0)),this[Y]&&2!==this[v]&&this[U]&&(this[v]=2),this[v]<2;}async[Ao](){return new Promise(A=>{this[T]?this[A$]=A:A(null);});}async[AI](A){return new Promise(e=>{let t=this[V].splice(this[O]);for(let e=0;e<t.length;e++)Av(this,t[e],A);let Q=()=>{this[A$]&&(this[A$](),this[A$]=null),e();};null!=this[Ac]&&(B.destroy(this[Ac],A),this[Ac]=null,this[Au]=null),this[z]?B.destroy(this[z].on("close",Q),A):queueMicrotask(Q),AT(this);});}};}),u("jqWlt",function(A,e){var t,I,i,s,n,a,h,l;let u;function d(A){return A&&"object"==typeof A&&"function"==typeof A.pipe&&"function"==typeof A.on;}function D(A){return a&&A instanceof a||A&&"object"==typeof A&&("function"==typeof A.stream||"function"==typeof A.arrayBuffer)&&/^(Blob|File)$/.test(A[Symbol.toStringTag]);}function R(A){if("string"==typeof A){if(A=new URL(A),!/^https?:/.test(A.origin||A.protocol))throw new n("Invalid URL protocol: the URL must start with `http:` or `https:`.");return A;}if(!A||"object"!=typeof A)throw new n("Invalid URL: The URL argument must be a non-null object.");if(!/^https?:/.test(A.origin||A.protocol))throw new n("Invalid URL protocol: the URL must start with `http:` or `https:`.");if(!(A instanceof URL)){if(null!=A.port&&""!==A.port&&!Number.isFinite(parseInt(A.port)))throw new n("Invalid URL: port must be a valid integer or a string representation of an integer.");if(null!=A.path&&"string"!=typeof A.path)throw new n("Invalid URL path: the path must be a string or null/undefined.");if(null!=A.pathname&&"string"!=typeof A.pathname)throw new n("Invalid URL pathname: the pathname must be a string or null/undefined.");if(null!=A.hostname&&"string"!=typeof A.hostname)throw new n("Invalid URL hostname: the hostname must be a string or null/undefined.");if(null!=A.origin&&"string"!=typeof A.origin)throw new n("Invalid URL origin: the origin must be a string or null/undefined.");let e=null!=A.port?A.port:"https:"===A.protocol?443:80,t=null!=A.origin?A.origin:`${A.protocol}//${A.hostname}:${e}`,Q=null!=A.path?A.path:`${A.pathname||""}${A.search||""}`;t.endsWith("/")&&(t=t.substring(0,t.length-1)),Q&&!Q.startsWith("/")&&(Q="/"+Q),A=new URL(t+Q);}return A;}function f(A){return!A||!!(A.destroyed||A[I]);}function y(A){let e=A&&A._readableState;return f(A)&&e&&!e.endEmitted;}function w(A){return A instanceof Uint8Array||Buffer.isBuffer(A);}async function*F(A){for await(let e of A)yield Buffer.isBuffer(e)?e:Buffer.from(e);}I=(t=c("heqcE")).kDestroyed,i=t.kBodyUsed,s=r.IncomingMessage,n=c("eCuXV").InvalidArgumentError,a=B.Blob,h=o.stringify,l=c("9yhov").headerNameLowerCasedRecord;let[N,S]=process.versions.node.split(".").map(A=>+A),p=!!String.prototype.toWellFormed,b=Object.create(null);b.enumerable=!0,A.exports={kEnumerableProperty:b,nop:function(){},isDisturbed:function(A){return!!(A&&(g.isDisturbed?g.isDisturbed(A)||A[i]:A[i]||A.readableDidRead||A._readableState&&A._readableState.dataEmitted||y(A)));},isErrored:function(A){return!!(A&&(g.isErrored?g.isErrored(A):/state: 'errored'/.test(C.inspect(A))));},isReadable:function(A){return!!(A&&(g.isReadable?g.isReadable(A):/state: 'readable'/.test(C.inspect(A))));},toUSVString:function(A){return p?(""+A).toWellFormed():C.toUSVString?C.toUSVString
`;}function n(A,e,t,Q=!1){if(t&&"object"==typeof t&&!Array.isArray(t))throw new E(`invalid ${e} header`);if(void 0!==t){if(null===A.host&&4===e.length&&"host"===e.toLowerCase()){if(null!==h.exec(t))throw new E(`invalid ${e} header`);A.host=t;}else if(null===A.contentLength&&14===e.length&&"content-length"===e.toLowerCase()){if(A.contentLength=parseInt(t,10),!Number.isFinite(A.contentLength))throw new E("invalid content-length header");}else if(null===A.contentType&&12===e.length&&"content-type"===e.toLowerCase())A.contentType=t,Q?A.headers[e]=s(e,t,Q):A.headers+=s(e,t);else if(17===e.length&&"transfer-encoding"===e.toLowerCase())throw new E("invalid transfer-encoding header");else if(10===e.length&&"connection"===e.toLowerCase()){let e="string"==typeof t?t.toLowerCase():null;if("close"!==e&&"keep-alive"!==e)throw new E("invalid connection header");"close"===e&&(A.reset=!0);}else if(10===e.length&&"keep-alive"===e.toLowerCase())throw new E("invalid keep-alive header");else if(7===e.length&&"upgrade"===e.toLowerCase())throw new E("invalid upgrade header");else if(6===e.length&&"expect"===e.toLowerCase())throw new r("expect header not supported");else if(null===a.exec(e))throw new E("invalid header key");else if(Array.isArray(t))for(let E=0;E<t.length;E++)Q?A.headers[e]?A.headers[e]+=","+s(e,t[E],Q):A.headers[e]=s(e,t[E],Q):A.headers+=s(e,t[E]);else Q?A.headers[e]=s(e,t,Q):A.headers+=s(e,t);}}E=(t=c("eCuXV")).InvalidArgumentError,r=t.NotSupportedError,B=(g=c("heqcE")).kHTTP2BuildRequest,C=g.kHTTP2CopyHeaders,o=g.kHTTP1BuildRequest,I=c("jqWlt");let a=/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/,h=/[^\t\x20-\x7e\x80-\xff]/,l=Symbol(),u={};try{let A=c("dfobN");u.create=A.channel("undici:request:create"),u.bodySent=A.channel("undici:request:bodySent"),u.headers=A.channel("undici:request:headers"),u.trailers=A.channel("undici:request:trailers"),u.error=A.channel("undici:request:error");}catch{u.create={hasSubscribers:!1},u.bodySent={hasSubscribers:!1},u.headers={hasSubscribers:!1},u.trailers={hasSubscribers:!1},u.error={hasSubscribers:!1};}class d{constructor(A,{path:e,method:t,body:Q,headers:r,query:g,idempotent:B,blocking:C,upgrade:o,headersTimeout:s,bodyTimeout:h,reset:d,throwOnError:D,expectContinue:R},f){if("string"!=typeof e)throw new E("path must be a string");if("/"===e[0]||e.startsWith("http://")||e.startsWith("https://")||"CONNECT"===t){if(null!==/[^\u0021-\u00ff]/.exec(e))throw new E("invalid request path");}else throw new E("path must be an absolute URL or start with a slash");if("string"!=typeof t)throw new E("method must be a string");if(null===a.exec(t))throw new E("invalid request method");if(o&&"string"!=typeof o)throw new E("upgrade must be a string");if(null!=s&&(!Number.isFinite(s)||s<0))throw new E("invalid headersTimeout");if(null!=h&&(!Number.isFinite(h)||h<0))throw new E("invalid bodyTimeout");if(null!=d&&"boolean"!=typeof d)throw new E("invalid reset");if(null!=R&&"boolean"!=typeof R)throw new E("invalid expectContinue");if(this.headersTimeout=s,this.bodyTimeout=h,this.throwOnError=!0===D,this.method=t,this.abort=null,null==Q)this.body=null;else if(I.isStream(Q)){this.body=Q;let A=this.body._readableState;A&&A.autoDestroy||(this.endHandler=function(){I.destroy(this);},this.body.on("end",this.endHandler)),this.errorHandler=A=>{this.abort?this.abort(A):this.error=A;},this.body.on("error",this.errorHandler);}else if(I.isBuffer(Q))this.body=Q.byteLength?Q:null;else if(ArrayBuffer.isView(Q))this.body=Q.buffer.byteLength?Buffer.from(Q.buffer,Q.byteOffset,Q.byteLength):null;else if(Q instanceof ArrayBuffer)this.body=Q.byteLength?Buffer.from(Q):null;else if("string"==typeof Q)this.body=Q.length?Buffer.from(Q):null;else if(I.isFormDataLike(Q)||I.isIterable(Q)||I.isBlobLike(Q))this.body=Q;else throw new E("body must be a string, a Buffer, a Readable stream, an iterable, or an async iterable");if(this.completed=!1,this.aborted=!1,this.upgrade=o||null,this.path=g?I.buildURL(e,g):e,this.origin=A,this.idempotent=null==B?"HEAD"===t||"GET"===t:B,this.blocking=null!=C&&C,this.reset=null==d?null:d,this.host=null,this.contentLength=
`),this.body=A.stream,this.contentLength=A.length;}else I.isBlobLike(Q)&&null==this.contentType&&Q.type&&(this.contentType=Q.type,this.headers+=`content-type: ${Q.type}\r
`);I.validateHandler(f,t,o),this.servername=I.getServerName(this.host),this[l]=f,u.create.hasSubscribers&&u.create.publish({request:this});}onBodySent(A){if(this[l].onBodySent)try{return this[l].onBodySent(A);}catch(A){this.abort(A);}}onRequestSent(){if(u.bodySent.hasSubscribers&&u.bodySent.publish({request:this}),this[l].onRequestSent)try{return this[l].onRequestSent();}catch(A){this.abort(A);}}onConnect(A){if(Q(!this.aborted),Q(!this.completed),!this.error)return this.abort=A,this[l].onConnect(A);A(this.error);}onHeaders(A,e,t,E){Q(!this.aborted),Q(!this.completed),u.headers.hasSubscribers&&u.headers.publish({request:this,response:{statusCode:A,headers:e,statusText:E}});try{return this[l].onHeaders(A,e,t,E);}catch(A){this.abort(A);}}onData(A){Q(!this.aborted),Q(!this.completed);try{return this[l].onData(A);}catch(A){return this.abort(A),!1;}}onUpgrade(A,e,t){return Q(!this.aborted),Q(!this.completed),this[l].onUpgrade(A,e,t);}onComplete(A){this.onFinally(),Q(!this.aborted),this.completed=!0,u.trailers.hasSubscribers&&u.trailers.publish({request:this,trailers:A});try{return this[l].onComplete(A);}catch(A){this.onError(A);}}onError(A){if(this.onFinally(),u.error.hasSubscribers&&u.error.publish({request:this,error:A}),!this.aborted)return this.aborted=!0,this[l].onError(A);}onFinally(){this.errorHandler&&(this.body.off("error",this.errorHandler),this.errorHandler=null),this.endHandler&&(this.body.off("end",this.endHandler),this.endHandler=null);}addHeader(A,e){return n(this,A,e),this;}static[o](A,e,t){return new d(A,e,t);}static[B](A,e,t){let Q=e.headers,r=new d(A,e={...e,headers:null},t);if(r.headers={},Array.isArray(Q)){if(Q.length%2!=0)throw new E("headers array must be even");for(let A=0;A<Q.length;A+=2)n(r,Q[A],Q[A+1],!0);}else if(Q&&"object"==typeof Q){let A=Object.keys(Q);for(let e=0;e<A.length;e++){let t=A[e];n(r,t,Q[t],!0);}}else if(null!=Q)throw new E("headers must be an object or an array");return r;}static[C](A){let e=A.split("\r\n"),t={};for(let A of e){let[e,Q]=A.split(": ");null!=Q&&0!==Q.length&&(t[e]?t[e]+=","+Q:t[e]=Q);}return t;}}A.exports=d;}),u("dfobN",function(A,e){class t extends TypeError{constructor(A,e){if(super(),null==e)A+=". Received "+e;else if("function"==typeof e&&e.name)A+=". Received function "+e.name;else if("object"==typeof e)e.constructor&&e.constructor.name?A+=". Received an instance of "+e.constructor.name:A+=". Received "+C.inspect(e,{depth:-1});else{let t=C.inspect(e,{colors:!1});t.length>25&&(t=`${t.slice(0,25)}...`),A+=`. Received type ${typeof e} (${t})`;}this.code=this.constructor.name,Object.defineProperties(this,{message:{value:A,enumerable:!1,writable:!0,configurable:!0},toString:{value(){return`${this.name} [${this.code}]: ${this.message}`;},enumerable:!1,writable:!0,configurable:!0}});}}class Q{subscribe(A){if("function"!=typeof A)throw new t('The "subscription" argument must be of type function',A);this._subscribers.push(A);}unsubscribe(A){let e=this._subscribers.indexOf(A);return-1!==e&&(this._subscribers.splice(e,1),this._subscribers.length||Object.setPrototypeOf(this,E.prototype),!0);}get hasSubscribers(){return!0;}publish(A){for(let e=0;e<this._subscribers.length;e++)try{(0,this._subscribers[e])(A,this.name);}catch(A){process.nextTick(()=>{throw A;});}}}class E{constructor(A){this._subscribers=void 0,this.name=A;}static[Symbol.hasInstance](A){let e=Object.getPrototypeOf(A);return e===E.prototype||e===Q.prototype;}subscribe(A){Object.setPrototypeOf(this,Q.prototype),this._subscribers=[],this.subscribe(A);}unsubscribe(){return!1;}get hasSubscribers(){return!1;}publish(){}}let r={};A.exports={channel:function(A){let e=r[A];if(e)return e;if("string"!=typeof A&&"symbol"!=typeof A)throw new t('The "channel" argument must be one of type string or symbol',A);return r[A]=new E(A);},hasSubscribers:function(A){let e=r[A];return!!e&&e.hasSubscribers;},Channel:E,deleteChannel:function(A){return!!r[A]&&(r[A]=null,!0);}};}),u("8oEYI",function(A,e){var t,E,r,g,C,o,I,i,s,n,a,h,l,u,d,D,R,f,y,w,F,N,S,p,b,k;function U(A,e=!1){G||(G=c("j5cOJ").ReadableStream);let t=null;t=A instanceof G?
Content-Disposition: form-data`,Q=A=>A.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),E=A=>A.replace(/\r?\n|\r/g,"\r\n"),g=[],C=new Uint8Array([13,10]);i=0;let o=!1;for(let[e,r]of A)if("string"==typeof r){let A=H.encode(t+`; name="${Q(E(e))}"`+`\r
\r
${E(r)}\r
`);g.push(A),i+=A.byteLength;}else{let A=H.encode(`${t}; name="${Q(E(e))}"`+(r.name?`; filename="${Q(r.name)}"`:"")+"\r\n"+`Content-Type: ${r.type||"application/octet-stream"}\r
\r
`);g.push(A,r,C),"number"==typeof r.size?i+=A.byteLength+r.size+C.byteLength:o=!0;}let I=H.encode(`--${e}--`);g.push(I),i+=I.byteLength,o&&(i=null),B=A,r=async function*(){for(let A of g)A.stream?yield*A.stream():yield A;},s="multipart/form-data; boundary="+e;}else if(C(A))B=A,i=A.size,A.type&&(s=A.type);else if("function"==typeof A[Symbol.asyncIterator]){if(e)throw TypeError("keepalive");if(E.isDisturbed(A)||A.locked)throw TypeError("Response body object should not be disturbed or locked");t=A instanceof G?A:g(A);}if(("string"==typeof B||E.isBuffer(B))&&(i=Buffer.byteLength(B)),null!=r){let e;t=new G({async start(){e=r(A)[Symbol.asyncIterator]();},async pull(A){let{value:Q,done:E}=await e.next();return E?queueMicrotask(()=>{A.close();}):y(t)||A.enqueue(new Uint8Array(Q)),A.desiredSize>0;},async cancel(A){await e.return();},type:void 0});}return[{stream:t,source:B,length:i},s];}async function*m(A){if(A){if(F(A))yield A;else{let e=A.stream;if(E.isDisturbed(e))throw TypeError("The body has already been consumed.");if(e.locked)throw TypeError("The stream is locked.");e[f]=!0,yield*e;}}}function L(A){if(A.aborted)throw new u("The operation was aborted.","AbortError");}async function M(A,e,t){var Q;if(h.brandCheck(A,t),L(A[a]),null!=(Q=A[a].body)&&(Q.stream.locked||E.isDisturbed(Q.stream)))throw TypeError("Body is unusable");let r=i(),g=A=>r.reject(A),B=A=>{try{r.resolve(e(A));}catch(A){g(A);}};return null==A[a].body?B(new Uint8Array()):await s(A[a].body,B,g),r.promise;}function Y(A){return 0===A.length?"":(239===A[0]&&187===A[1]&&191===A[2]&&(A=A.subarray(3)),V.decode(A));}function J(A){return JSON.parse(Y(A));}t=c("l16hu"),E=c("jqWlt"),g=(r=c("2Ib5S")).ReadableStreamFrom,C=r.isBlobLike,o=r.isReadableStreamLike,I=r.readableStreamClose,i=r.createDeferredPromise,s=r.fullyReadBody,n=c("6moLW").FormData,a=c("cZP2a").kState,h=c("cACdG").webidl,u=(l=c("7M1Hs")).DOMException,d=l.structuredClone,D=B.Blob,R=B.File,f=c("heqcE").kBodyUsed,y=(E=c("jqWlt")).isErrored,F=(w=c("jq6Nm")).isUint8Array,N=w.isArrayBuffer,S=c("9qyC1").File,b=(p=c("dyddI")).parseMIMEType,k=p.serializeAMimeType;let G=globalThis.ReadableStream,T=R??S,H=new TextEncoder(),V=new TextDecoder();A.exports={extractBody:U,safelyExtractBody:function(A,e=!1){return G||(G=c("j5cOJ").ReadableStream),A instanceof G&&(Q(!E.isDisturbed(A),"The body has already been consumed."),Q(!A.locked,"The stream is locked.")),U(A,e);},cloneBody:function(A){let[e,t]=A.stream.tee(),[,Q]=d(t,{transfer:[t]}).tee();return A.stream=e,{stream:Q,length:A.length,source:A.source};},mixinBody:function(A){Object.assign(A.prototype,{blob(){return M(this,A=>{let e=function(A){let{headersList:e}=A[a],t=e.get("content-type");return null===t?"failure":b(t);}(this);return"failure"===e?e="":e&&(e=k(e)),new D([A],{type:e});},A);},arrayBuffer(){return M(this,A=>new Uint8Array(A).buffer,A);},text(){return M(this,Y,A);},json(){return M(this,J,A);},async formData(){h.brandCheck(this,A),L(this[a]);let e=this.headers.get("Content-Type");if(/multipart\/form-data/.test(e)){let A;let e={};for(let[A,t]of this.headers)e[A.toLowerCase()]=t;let Q=new n();try{A=new t({headers:e,preservePath:!0});}catch(A){throw new u(""+A,"AbortError");}A.on("field",(A,e)=>{Q.append(A,e);}),A.on("file",(A,e,t,E,r)=>{let g=[];if("base64"===E||"base64"===E.toLowerCase()){let E="";e.on("data",A=>{let e=(E+=A.toString().replace(/[\r\n]/gm,"")).length-E.length%4;g.push(Buffer.from(E.slice(0,e),"base64")),E=E.slice(e);}),e.on("end",()=>{g.push(Buffer.from(E,"base64")),Q.append(A,new T(g,t,{type:r}));});}else e.on("data",A=>{g.push(A);}),e.on("end",()=>{Q.append(A,new T(g,t,{type:r}));});});let E=new Promise((e,t)=>{A.on("finish",e),A.on("error",A=>t(TypeError(A)));});if(null!==this.body)for await(let e of m(this[a].body))A.write(e);return A.end(),await E,Q;}if(/application\/x-www-form-urlencoded/.test(e)){let A;try{let e="",t=new TextDecoder("utf-8",{ignoreBOM:!0});for await(let A of m(this[a].body)){if(!F(A))throw TypeError("Expected Uint8Array chunk");e+=t.decode(A,{stream:!0});}e+=t.decode(),A=new URLSearchParams(e);}catch(A){throw Object.assi
//# sourceMappingURL=proxy-agent.74b39078.js.map