eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 502 kB
JavaScript
import{i as e,t}from"./chunk-BTyA9uPd.js";var n=t(((e,t)=>{t.exports={kClose:Symbol(`close`),kDestroy:Symbol(`destroy`),kDispatch:Symbol(`dispatch`),kUrl:Symbol(`url`),kWriting:Symbol(`writing`),kResuming:Symbol(`resuming`),kQueue:Symbol(`queue`),kConnect:Symbol(`connect`),kConnecting:Symbol(`connecting`),kKeepAliveDefaultTimeout:Symbol(`default keep alive timeout`),kKeepAliveMaxTimeout:Symbol(`max keep alive timeout`),kKeepAliveTimeoutThreshold:Symbol(`keep alive timeout threshold`),kKeepAliveTimeoutValue:Symbol(`keep alive timeout`),kKeepAlive:Symbol(`keep alive`),kHeadersTimeout:Symbol(`headers timeout`),kBodyTimeout:Symbol(`body timeout`),kServerName:Symbol(`server name`),kLocalAddress:Symbol(`local address`),kHost:Symbol(`host`),kNoRef:Symbol(`no ref`),kBodyUsed:Symbol(`used`),kBody:Symbol(`abstracted request body`),kRunning:Symbol(`running`),kBlocking:Symbol(`blocking`),kPending:Symbol(`pending`),kSize:Symbol(`size`),kBusy:Symbol(`busy`),kQueued:Symbol(`queued`),kFree:Symbol(`free`),kConnected:Symbol(`connected`),kClosed:Symbol(`closed`),kNeedDrain:Symbol(`need drain`),kReset:Symbol(`reset`),kDestroyed:Symbol.for(`nodejs.stream.destroyed`),kResume:Symbol(`resume`),kOnError:Symbol(`on error`),kMaxHeadersSize:Symbol(`max headers size`),kRunningIdx:Symbol(`running index`),kPendingIdx:Symbol(`pending index`),kError:Symbol(`error`),kClients:Symbol(`clients`),kClient:Symbol(`client`),kParser:Symbol(`parser`),kOnDestroyed:Symbol(`destroy callbacks`),kPipelining:Symbol(`pipelining`),kSocket:Symbol(`socket`),kHostHeader:Symbol(`host header`),kConnector:Symbol(`connector`),kStrictContentLength:Symbol(`strict content length`),kMaxRedirections:Symbol(`maxRedirections`),kMaxRequests:Symbol(`maxRequestsPerClient`),kProxy:Symbol(`proxy agent options`),kCounter:Symbol(`socket request counter`),kMaxResponseSize:Symbol(`max response size`),kHTTP2Session:Symbol(`http2Session`),kHTTP2SessionState:Symbol(`http2Session state`),kRetryHandlerDefaultRetry:Symbol(`retry agent default retry`),kConstruct:Symbol(`constructable`),kListeners:Symbol(`listeners`),kHTTPContext:Symbol(`http context`),kMaxConcurrentStreams:Symbol(`max concurrent streams`),kHTTP2InitialWindowSize:Symbol(`http2 initial window size`),kHTTP2ConnectionWindowSize:Symbol(`http2 connection window size`),kEnableConnectProtocol:Symbol(`http2session connect protocol`),kRemoteSettings:Symbol(`http2session remote settings`),kHTTP2Stream:Symbol(`http2session client stream`),kPingInterval:Symbol(`ping interval`),kNoProxyAgent:Symbol(`no proxy agent`),kHttpProxyAgent:Symbol(`http proxy agent`),kHttpsProxyAgent:Symbol(`https proxy agent`),kSocks5ProxyAgent:Symbol(`socks5 proxy agent`)}})),r=t(((e,t)=>{let n=0,r=1e3,i,a=Symbol(`kFastTimer`),o=[];function s(){n+=499;let e=0,t=o.length;for(;e<t;){let r=o[e];r._state===0?(r._idleStart=n-499,r._state=1):r._state===1&&n>=r._idleStart+r._idleTimeout&&(r._state=-1,r._idleStart=-1,r._onTimeout(r._timerArg)),r._state===-1?(r._state=-2,--t!==0&&(o[e]=o[t])):++e}o.length=t,o.length!==0&&c()}function c(){i?.refresh?i.refresh():(clearTimeout(i),i=setTimeout(s,499),i?.unref())}var l=class{[a]=!0;_state=-2;_idleTimeout=-1;_idleStart=-1;_onTimeout;_timerArg;constructor(e,t,n){this._onTimeout=e,this._idleTimeout=t,this._timerArg=n,this.refresh()}refresh(){this._state===-2&&o.push(this),(!i||o.length===1)&&c(),this._state=0}clear(){this._state=-1,this._idleStart=-1}};t.exports={setTimeout(e,t,n){return t<=r?setTimeout(e,t,n):new l(e,t,n)},clearTimeout(e){e[a]?e.clear():clearTimeout(e)},setFastTimeout(e,t,n){return new l(e,t,n)},clearFastTimeout(e){e.clear()},now(){return n},tick(e=0){n+=e-r+1,s(),s()},reset(){n=0,o.length=0,clearTimeout(i),i=null},kFastTimer:a}})),i=t(((e,t)=>{let n=Symbol.for(`undici.error.UND_ERR`);var r=class extends Error{constructor(e,t){super(e,t),this.name=`UndiciError`,this.code=`UND_ERR`}static[Symbol.hasInstance](e){return e&&e[n]===!0}get[n](){return!0}};let i=Symbol.for(`undici.error.UND_ERR_CONNECT_TIMEOUT`);var a=class extends r{constructor(e){super(e),this.name=`ConnectTimeoutError`,this.message=e||`Connect Timeout Error`,this.code=`UND_ERR_CONNECT_TIMEOUT`}static[Symbol.hasInstance](e){return e&&e[i]===!0}get[i](){return!0}};let o=Symbol.for(`undici.error.UND_ERR_HEADERS_TIMEOUT`);var s=class extends r{constructor(e){super(e),this.name=`HeadersTimeoutError`,this.message=e||`Headers Timeout Error`,this.code=`UND_ERR_HEADERS_TIMEOUT`}static[Symbol.hasInstance](e){return e&&e[o]===!0}get[o](){return!0}};let c=Symbol.for(`undici.error.UND_ERR_HEADERS_OVERFLOW`);var l=class extends r{constructor(e){super(e),this.name=`HeadersOverflowError`,this.message=e||`Headers Overflow Error`,this.code=`UND_ERR_HEADERS_OVERFLOW`}static[Symbol.hasInstance](e){return e&&e[c]===!0}get[c](){return!0}};let u=Symbol.for(`undici.error.UND_ERR_BODY_TIMEOUT`);var d=class extends r{constructor(e){super(e),this.name=`BodyTimeoutError`,this.message=e||`Body Timeout Error`,this.code=`UND_ERR_BODY_TIMEOUT`}static[Symbol.hasInstance](e){return e&&e[u]===!0}get[u](){return!0}};let f=Symbol.for(`undici.error.UND_ERR_INVALID_ARG`);var p=class extends r{constructor(e){super(e),this.name=`InvalidArgumentError`,this.message=e||`Invalid Argument Error`,this.code=`UND_ERR_INVALID_ARG`}static[Symbol.hasInstance](e){return e&&e[f]===!0}get[f](){return!0}};let m=Symbol.for(`undici.error.UND_ERR_INVALID_RETURN_VALUE`);var h=class extends r{constructor(e){super(e),this.name=`InvalidReturnValueError`,this.message=e||`Invalid Return Value Error`,this.code=`UND_ERR_INVALID_RETURN_VALUE`}static[Symbol.hasInstance](e){return e&&e[m]===!0}get[m](){return!0}};let g=Symbol.for(`undici.error.UND_ERR_ABORT`);var _=class extends r{constructor(e){super(e),this.name=`AbortError`,this.message=e||`The operation was aborted`,this.code=`UND_ERR_ABORT`}static[Symbol.hasInstance](e){return e&&e[g]===!0}get[g](){return!0}};let v=Symbol.for(`undici.error.UND_ERR_ABORTED`);var y=class extends _{constructor(e){super(e),this.name=`AbortError`,this.message=e||`Request aborted`,this.code=`UND_ERR_ABORTED`}static[Symbol.hasInstance](e){return e&&e[v]===!0}get[v](){return!0}};let b=Symbol.for(`undici.error.UND_ERR_INFO`);var x=class extends r{constructor(e){super(e),this.name=`InformationalError`,this.message=e||`Request information`,this.code=`UND_ERR_INFO`}static[Symbol.hasInstance](e){return e&&e[b]===!0}get[b](){return!0}};let S=Symbol.for(`undici.error.UND_ERR_REQ_CONTENT_LENGTH_MISMATCH`);var C=class extends r{constructor(e){super(e),this.name=`RequestContentLengthMismatchError`,this.message=e||`Request body length does not match content-length header`,this.code=`UND_ERR_REQ_CONTENT_LENGTH_MISMATCH`}static[Symbol.hasInstance](e){return e&&e[S]===!0}get[S](){return!0}};let w=Symbol.for(`undici.error.UND_ERR_RES_CONTENT_LENGTH_MISMATCH`);var T=class extends r{constructor(e){super(e),this.name=`ResponseContentLengthMismatchError`,this.message=e||`Response body length does not match content-length header`,this.code=`UND_ERR_RES_CONTENT_LENGTH_MISMATCH`}static[Symbol.hasInstance](e){return e&&e[w]===!0}get[w](){return!0}};let E=Symbol.for(`undici.error.UND_ERR_DESTROYED`);var D=class extends r{constructor(e){super(e),this.name=`ClientDestroyedError`,this.message=e||`The client is destroyed`,this.code=`UND_ERR_DESTROYED`}static[Symbol.hasInstance](e){return e&&e[E]===!0}get[E](){return!0}};let O=Symbol.for(`undici.error.UND_ERR_CLOSED`);var k=class extends r{constructor(e){super(e),this.name=`ClientClosedError`,this.message=e||`The client is closed`,this.code=`UND_ERR_CLOSED`}static[Symbol.hasInstance](e){return e&&e[O]===!0}get[O](){return!0}};let A=Symbol.for(`undici.error.UND_ERR_SOCKET`);var j=class extends r{constructor(e,t){super(e),this.name=`SocketError`,this.message=e||`Socket error`,this.code=`UND_ERR_SOCKET`,this.socket=t}static[Symbol.hasInstance](e){return e&&e[A]===!0}get[A](){return!0}};let M=Symbol.for(`undici.error.UND_ERR_NOT_SUPPORTED`);var N=class extends r{constructor(e){super(e),this.name=`NotSupportedError`,this.message=e||`Not supported error`,this.code=`UND_ERR_NOT_SUPPORTED`}static[Symbol.hasInstance](e){return e&&e[M]===!0}get[M](){return!0}};let P=Symbol.for(`undici.error.UND_ERR_BPL_MISSING_UPSTREAM`);var F=class extends r{constructor(e){super(e),this.name=`MissingUpstreamError`,this.message=e||`No upstream has been added to the BalancedPool`,this.code=`UND_ERR_BPL_MISSING_UPSTREAM`}static[Symbol.hasInstance](e){return e&&e[P]===!0}get[P](){return!0}};let I=Symbol.for(`undici.error.UND_ERR_HTTP_PARSER`);var L=class extends Error{constructor(e,t,n){super(e),this.name=`HTTPParserError`,this.code=t?`HPE_${t}`:void 0,this.data=n?n.toString():void 0}static[Symbol.hasInstance](e){return e&&e[I]===!0}get[I](){return!0}};let R=Symbol.for(`undici.error.UND_ERR_RES_EXCEEDED_MAX_SIZE`);var z=class extends r{constructor(e){super(e),this.name=`ResponseExceededMaxSizeError`,this.message=e||`Response content exceeded max size`,this.code=`UND_ERR_RES_EXCEEDED_MAX_SIZE`}static[Symbol.hasInstance](e){return e&&e[R]===!0}get[R](){return!0}};let B=Symbol.for(`undici.error.UND_ERR_REQ_RETRY`);var V=class extends r{constructor(e,t,{headers:n,data:r}){super(e),this.name=`RequestRetryError`,this.message=e||`Request retry error`,this.code=`UND_ERR_REQ_RETRY`,this.statusCode=t,this.data=r,this.headers=n}static[Symbol.hasInstance](e){return e&&e[B]===!0}get[B](){return!0}};let H=Symbol.for(`undici.error.UND_ERR_RESPONSE`);var U=class extends r{constructor(e,t,{headers:n,body:r}){super(e),this.name=`ResponseError`,this.message=e||`Response error`,this.code=`UND_ERR_RESPONSE`,this.statusCode=t,this.body=r,this.headers=n}static[Symbol.hasInstance](e){return e&&e[H]===!0}get[H](){return!0}};let W=Symbol.for(`undici.error.UND_ERR_PRX_TLS`);var ee=class extends r{constructor(e,t,n={}){super(t,{cause:e,...n}),this.name=`SecureProxyConnectionError`,this.message=t||`Secure Proxy Connection failed`,this.code=`UND_ERR_PRX_TLS`,this.cause=e}static[Symbol.hasInstance](e){return e&&e[W]===!0}get[W](){return!0}};let G=Symbol.for(`undici.error.UND_ERR_MAX_ORIGINS_REACHED`);var te=class extends r{constructor(e){super(e),this.name=`MaxOriginsReachedError`,this.message=e||`Maximum allowed origins reached`,this.code=`UND_ERR_MAX_ORIGINS_REACHED`}static[Symbol.hasInstance](e){return e&&e[G]===!0}get[G](){return!0}},ne=class extends r{constructor(e,t){super(e),this.name=`Socks5ProxyError`,this.message=e||`SOCKS5 proxy error`,this.code=t||`UND_ERR_SOCKS5`}};let re=Symbol.for(`undici.error.UND_ERR_WS_MESSAGE_SIZE_EXCEEDED`);t.exports={AbortError:_,HTTPParserError:L,UndiciError:r,HeadersTimeoutError:s,HeadersOverflowError:l,BodyTimeoutError:d,RequestContentLengthMismatchError:C,ConnectTimeoutError:a,InvalidArgumentError:p,InvalidReturnValueError:h,RequestAbortedError:y,ClientDestroyedError:D,ClientClosedError:k,InformationalError:x,SocketError:j,NotSupportedError:N,ResponseContentLengthMismatchError:T,BalancedPoolMissingUpstreamError:F,ResponseExceededMaxSizeError:z,RequestRetryError:V,ResponseError:U,SecureProxyConnectionError:ee,MaxOriginsReachedError:te,Socks5ProxyError:ne,MessageSizeExceededError:class extends r{constructor(e){super(e),this.name=`MessageSizeExceededError`,this.message=e||`Max decompressed message size exceeded`,this.code=`UND_ERR_WS_MESSAGE_SIZE_EXCEEDED`}static[Symbol.hasInstance](e){return e&&e[re]===!0}get[re](){return!0}}}})),a=t(((e,t)=>{let n=`Accept.Accept-Encoding.Accept-Language.Accept-Ranges.Access-Control-Allow-Credentials.Access-Control-Allow-Headers.Access-Control-Allow-Methods.Access-Control-Allow-Origin.Access-Control-Expose-Headers.Access-Control-Max-Age.Access-Control-Request-Headers.Access-Control-Request-Method.Age.Allow.Alt-Svc.Alt-Used.Authorization.Cache-Control.Clear-Site-Data.Connection.Content-Disposition.Content-Encoding.Content-Language.Content-Length.Content-Location.Content-Range.Content-Security-Policy.Content-Security-Policy-Report-Only.Content-Type.Cookie.Cross-Origin-Embedder-Policy.Cross-Origin-Opener-Policy.Cross-Origin-Resource-Policy.Date.Device-Memory.Downlink.ECT.ETag.Expect.Expect-CT.Expires.Forwarded.From.Host.If-Match.If-Modified-Since.If-None-Match.If-Range.If-Unmodified-Since.Keep-Alive.Last-Modified.Link.Location.Max-Forwards.Origin.Permissions-Policy.Pragma.Proxy-Authenticate.Proxy-Authorization.RTT.Range.Referer.Referrer-Policy.Refresh.Retry-After.Sec-WebSocket-Accept.Sec-WebSocket-Extensions.Sec-WebSocket-Key.Sec-WebSocket-Protocol.Sec-WebSocket-Version.Server.Server-Timing.Service-Worker-Allowed.Service-Worker-Navigation-Preload.Set-Cookie.SourceMap.Strict-Transport-Security.Supports-Loading-Mode.TE.Timing-Allow-Origin.Trailer.Transfer-Encoding.Upgrade.Upgrade-Insecure-Requests.User-Agent.Vary.Via.WWW-Authenticate.X-Content-Type-Options.X-DNS-Prefetch-Control.X-Frame-Options.X-Permitted-Cross-Domain-Policies.X-Powered-By.X-Requested-With.X-XSS-Protection`.split(`.`),r={};Object.setPrototypeOf(r,null);let i={};Object.setPrototypeOf(i,null);function a(e){let t=i[e];return t===void 0&&(t=Buffer.from(e)),t}for(let e=0;e<n.length;++e){let t=n[e],i=t.toLowerCase();r[t]=r[i]=i}t.exports={wellknownHeaderNames:n,headerNameLowerCasedRecord:r,getHeaderNameAsBuffer:a}})),o=t(((e,t)=>{let{wellknownHeaderNames:n,headerNameLowerCasedRecord:r}=a();var i=class e{value=null;left=null;middle=null;right=null;code;constructor(t,n,r){if(r===void 0||r>=t.length)throw TypeError(`Unreachable`);if((this.code=t.charCodeAt(r))>127)throw TypeError(`key must be ascii string`);t.length===++r?this.value=n:this.middle=new e(t,n,r)}add(t,n){let r=t.length;if(r===0)throw TypeError(`Unreachable`);let i=0,a=this;for(;;){let o=t.charCodeAt(i);if(o>127)throw TypeError(`key must be ascii string`);if(a.code===o)if(r===++i){a.value=n;break}else if(a.middle!==null)a=a.middle;else{a.middle=new e(t,n,i);break}else if(a.code<o)if(a.left!==null)a=a.left;else{a.left=new e(t,n,i);break}else if(a.right!==null)a=a.right;else{a.right=new e(t,n,i);break}}}search(e){let t=e.length,n=0,r=this;for(;r!==null&&n<t;){let i=e[n];for(i<=90&&i>=65&&(i|=32);r!==null;){if(i===r.code){if(t===++n)return r;r=r.middle;break}r=r.code<i?r.left:r.right}}return null}},o=class{node=null;insert(e,t){this.node===null?this.node=new i(e,t,0):this.node.add(e,t)}lookup(e){return this.node?.search(e)?.value??null}};let s=new o;for(let e=0;e<n.length;++e){let t=r[n[e]];s.insert(t,t)}t.exports={TernarySearchTree:o,tree:s}})),s=t(((t,s)=>{let c=e(`node:assert`),{kDestroyed:l,kBodyUsed:u,kListeners:d,kBody:f}=n(),{IncomingMessage:p}=e(`node:http`),m=e(`node:stream`),h=e(`node:net`),{stringify:g}=e(`node:querystring`),{EventEmitter:_}=e(`node:events`),v=r(),{InvalidArgumentError:y,ConnectTimeoutError:b}=i(),{headerNameLowerCasedRecord:x}=a(),{tree:S}=o(),[C,w]=process.versions.node.split(`.`,2).map(e=>Number(e));var T=class{constructor(e){this[f]=e,this[u]=!1}async*[Symbol.asyncIterator](){c(!this[u],`disturbed`),this[u]=!0,yield*this[f]}};function E(){}function D(e){return O(e)?(H(e)===0&&e.on(`data`,function(){c(!1)}),typeof e.readableDidRead!=`boolean`&&(e[u]=!1,_.prototype.on.call(e,`data`,function(){this[u]=!0})),e):e&&typeof e.pipeTo==`function`?new T(e):e&&X(e)?e:e&&typeof e!=`string`&&!ArrayBuffer.isView(e)&&B(e)?new T(e):e}function O(e){return e&&typeof e==`object`&&typeof e.pipe==`function`&&typeof e.on==`function`}function k(e){if(e===null)return!1;if(e instanceof Blob)return!0;if(typeof e!=`object`)return!1;{let t=e[Symbol.toStringTag];return(t===`Blob`||t===`File`)&&(`stream`in e&&typeof e.stream==`function`||`arrayBuffer`in e&&typeof e.arrayBuffer==`function`)}}function A(e){return e.includes(`?`)||e.includes(`#`)}function j(e,t){if(A(e))throw Error(`Query params cannot be passed when url already contains "?" or "#".`);let n=g(t);return n&&(e+=`?`+n),e}function M(e){let t=parseInt(e,10);return t===Number(e)&&t>=0&&t<=65535}function N(e){return e!=null&&e[0]===`h`&&e[1]===`t`&&e[2]===`t`&&e[3]===`p`&&(e[4]===`:`||e[4]===`s`&&e[5]===`:`)}function P(e){if(typeof e==`string`){if(e=new URL(e),!N(e.origin||e.protocol))throw new y("Invalid URL protocol: the URL must start with `http:` or `https:`.");return e}if(!e||typeof e!=`object`)throw new y(`Invalid URL: The URL argument must be a non-null object.`);if(!(e instanceof URL)){if(e.port!=null&&e.port!==``&&M(e.port)===!1)throw new y(`Invalid URL: port must be a valid integer or a string representation of an integer.`);if(e.path!=null&&typeof e.path!=`string`)throw new y(`Invalid URL path: the path must be a string or null/undefined.`);if(e.pathname!=null&&typeof e.pathname!=`string`)throw new y(`Invalid URL pathname: the pathname must be a string or null/undefined.`);if(e.hostname!=null&&typeof e.hostname!=`string`)throw new y(`Invalid URL hostname: the hostname must be a string or null/undefined.`);if(e.origin!=null&&typeof e.origin!=`string`)throw new y(`Invalid URL origin: the origin must be a string or null/undefined.`);if(!N(e.origin||e.protocol))throw new y("Invalid URL protocol: the URL must start with `http:` or `https:`.");let t=e.port==null?e.protocol===`https:`?443:80:e.port,n=e.origin==null?`${e.protocol||``}//${e.hostname||``}:${t}`:e.origin,r=e.path==null?`${e.pathname||``}${e.search||``}`:e.path;return n[n.length-1]===`/`&&(n=n.slice(0,n.length-1)),r&&r[0]!==`/`&&(r=`/${r}`),new URL(`${n}${r}`)}if(!N(e.origin||e.protocol))throw new y("Invalid URL protocol: the URL must start with `http:` or `https:`.");return e}function F(e){if(e=P(e),e.pathname!==`/`||e.search||e.hash)throw new y(`invalid url`);return e}function I(e){if(e[0]===`[`){let t=e.indexOf(`]`);return c(t!==-1),e.substring(1,t)}let t=e.indexOf(`:`);return t===-1?e:e.substring(0,t)}function L(e){if(!e)return null;c(typeof e==`string`);let t=I(e);return h.isIP(t)?``:t}function R(e){return JSON.parse(JSON.stringify(e))}function z(e){return e!=null&&typeof e[Symbol.asyncIterator]==`function`}function B(e){return e!=null&&(typeof e[Symbol.iterator]==`function`||typeof e[Symbol.asyncIterator]==`function`)}function V(e){let t=Object.getPrototypeOf(e);return Object.prototype.hasOwnProperty.call(e,Symbol.iterator)||t!=null&&t!==Object.prototype&&typeof e[Symbol.iterator]==`function`}function H(e){if(e==null)return 0;if(O(e)){let t=e._readableState;return t&&t.objectMode===!1&&t.ended===!0&&Number.isFinite(t.length)?t.length:null}else if(k(e))return e.size==null?null:e.size;else if(J(e))return e.byteLength;return null}function U(e){return e&&!!(e.destroyed||e[l]||m.isDestroyed?.(e))}function W(e,t){e==null||!O(e)||U(e)||(typeof e.destroy==`function`?(Object.getPrototypeOf(e).constructor===p&&(e.socket=null),e.destroy(t)):t&&queueMicrotask(()=>{e.emit(`error`,t)}),e.destroyed!==!0&&(e[l]=!0))}let ee=/timeout=(\d+)/;function G(e){let t=e.match(ee);return t?parseInt(t[1],10)*1e3:null}function te(e){return typeof e==`string`?x[e]??e.toLowerCase():S.lookup(e)??e.toString(`latin1`).toLowerCase()}function ne(e){return S.lookup(e)??e.toString(`latin1`).toLowerCase()}function re(e,t){t===void 0&&(t={});for(let n=0;n<e.length;n+=2){let r=te(e[n]),i=t[r];if(i!==void 0)if(Object.hasOwn(t,r))typeof i==`string`&&(i=[i],t[r]=i),i.push(e[n+1].toString(`latin1`));else{let i=typeof e[n+1]==`string`?e[n+1]:Array.isArray(e[n+1])?e[n+1].map(e=>e.toString(`latin1`)):e[n+1].toString(`latin1`);r===`__proto__`?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i}else{let i=typeof e[n+1]==`string`?e[n+1]:Array.isArray(e[n+1])?e[n+1].map(e=>e.toString(`latin1`)):e[n+1].toString(`latin1`);t[r]=i}}return t}function K(e){let t=e.length,n=Array(t),r,i;for(let a=0;a<t;a+=2)r=e[a],i=e[a+1],typeof r!=`string`&&(r=r.toString()),typeof i!=`string`&&(i=i.toString(`latin1`)),n[a]=r,n[a+1]=i;return n}function q(e){if(!Array.isArray(e))throw TypeError(`expected headers to be an array`);return e.map(e=>Buffer.from(e))}function J(e){return e instanceof Uint8Array||Buffer.isBuffer(e)}function ie(e,t,n){if(!e||typeof e!=`object`)throw new y(`handler must be an object`);if(typeof e.onRequestStart!=`function`){if(typeof e.onConnect!=`function`)throw new y(`invalid onConnect method`);if(typeof e.onError!=`function`)throw new y(`invalid onError method`);if(typeof e.onBodySent!=`function`&&e.onBodySent!==void 0)throw new y(`invalid onBodySent method`);if(n||t===`CONNECT`){if(typeof e.onUpgrade!=`function`)throw new y(`invalid onUpgrade method`)}else{if(typeof e.onHeaders!=`function`)throw new y(`invalid onHeaders method`);if(typeof e.onData!=`function`)throw new y(`invalid onData method`);if(typeof e.onComplete!=`function`)throw new y(`invalid onComplete method`)}}}function ae(e){return!!(e&&(m.isDisturbed(e)||e[u]))}function oe(e){return{localAddress:e.localAddress,localPort:e.localPort,remoteAddress:e.remoteAddress,remotePort:e.remotePort,remoteFamily:e.remoteFamily,timeout:e.timeout,bytesWritten:e.bytesWritten,bytesRead:e.bytesRead}}function Y(e){let t;return new ReadableStream({start(){t=e[Symbol.asyncIterator]()},pull(e){return t.next().then(({done:t,value:n})=>{if(t)return queueMicrotask(()=>{e.close(),e.byobRequest?.respond(0)});{let t=Buffer.isBuffer(n)?n:Buffer.from(n);return t.byteLength?e.enqueue(new Uint8Array(t)):this.pull(e)}})},cancel(){return t.return()},type:`bytes`})}function X(e){return e&&typeof e==`object`&&typeof e.append==`function`&&typeof e.delete==`function`&&typeof e.get==`function`&&typeof e.getAll==`function`&&typeof e.has==`function`&&typeof e.set==`function`&&e[Symbol.toStringTag]===`FormData`}function Z(e,t){return`addEventListener`in e?(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)):(e.once(`abort`,t),()=>e.removeListener(`abort`,t))}let se=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function Q(e){return se[e]===1}let ce=/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;function le(e){if(e.length>=12)return ce.test(e);if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(se[e.charCodeAt(t)]!==1)return!1;return!0}let ue=/[^\t\x20-\x7e\x80-\xff]/;function de(e){return!ue.test(e)}let fe=/^bytes (\d+)-(\d+)\/(\d+)?$/;function pe(e){if(e==null||e===``)return{start:0,end:null,size:null};let t=e?e.match(fe):null;return t?{start:parseInt(t[1]),end:t[2]?parseInt(t[2]):null,size:t[3]?parseInt(t[3]):null}:null}function me(e,t,n){return(e[d]??=[]).push([t,n]),e.on(t,n),e}function $(e){if(e[d]!=null){for(let[t,n]of e[d])e.removeListener(t,n);e[d]=null}return e}function he(e,t,n){try{t.onError(n),c(t.aborted)}catch(t){e.emit(`error`,t)}}let ge=process.platform===`win32`?(e,t)=>{if(!t.timeout)return E;let n=null,r=null,i=v.setFastTimeout(()=>{n=setImmediate(()=>{r=setImmediate(()=>_e(e.deref(),t))})},t.timeout);return()=>{v.clearFastTimeout(i),clearImmediate(n),clearImmediate(r)}}:(e,t)=>{if(!t.timeout)return E;let n=null,r=v.setFastTimeout(()=>{n=setImmediate(()=>{_e(e.deref(),t)})},t.timeout);return()=>{v.clearFastTimeout(r),clearImmediate(n)}};function _e(e,t){if(e==null)return;let n=`Connect Timeout Error`;Array.isArray(e.autoSelectFamilyAttemptedAddresses)?n+=` (attempted addresses: ${e.autoSelectFamilyAttemptedAddresses.join(`, `)},`:n+=` (attempted address: ${t.hostname}:${t.port},`,n+=` timeout: ${t.timeout}ms)`,W(e,new b(n))}function ve(e){if(e[0]===`h`&&e[1]===`t`&&e[2]===`t`&&e[3]===`p`)switch(e[4]){case`:`:return`http:`;case`s`:if(e[5]===`:`)return`https:`}return e.slice(0,e.indexOf(`:`)+1)}let ye=Object.create(null);ye.enumerable=!0;let be={delete:`DELETE`,DELETE:`DELETE`,get:`GET`,GET:`GET`,head:`HEAD`,HEAD:`HEAD`,options:`OPTIONS`,OPTIONS:`OPTIONS`,post:`POST`,POST:`POST`,put:`PUT`,PUT:`PUT`},xe={...be,patch:`patch`,PATCH:`PATCH`};Object.setPrototypeOf(be,null),Object.setPrototypeOf(xe,null),s.exports={kEnumerableProperty:ye,isDisturbed:ae,isBlobLike:k,parseOrigin:F,parseURL:P,getServerName:L,isStream:O,isIterable:B,hasSafeIterator:V,isAsyncIterable:z,isDestroyed:U,headerNameToString:te,bufferToLowerCasedHeaderName:ne,addListener:me,removeAllListeners:$,errorRequest:he,parseRawHeaders:K,encodeRawHeaders:q,parseHeaders:re,parseKeepAliveTimeout:G,destroy:W,bodyLength:H,deepClone:R,ReadableStreamFrom:Y,isBuffer:J,assertRequestHandler:ie,getSocketInfo:oe,isFormDataLike:X,pathHasQueryOrFragment:A,serializePathWithQuery:j,addAbortListener:Z,isValidHTTPToken:le,isValidHeaderValue:de,isTokenCharCode:Q,parseRangeHeader:pe,normalizedMethodRecordsBase:be,normalizedMethodRecords:xe,isValidPort:M,isHttpOrHttpsPrefixed:N,nodeMajor:C,nodeMinor:w,safeHTTPMethods:Object.freeze([`GET`,`HEAD`,`OPTIONS`,`TRACE`]),wrapRequestBody:D,setupConnectTimeout:ge,getProtocolFromUrlString:ve}})),c=t(((e,t)=>{let{kConnected:r,kPending:i,kRunning:a,kSize:o,kFree:s,kQueued:c}=n();t.exports={ClientStats:class{constructor(e){this.connected=e[r],this.pending=e[i],this.running=e[a],this.size=e[o]}},PoolStats:class{constructor(e){this.connected=e[r],this.free=e[s],this.pending=e[i],this.queued=e[c],this.running=e[a],this.size=e[o]}}}})),l=t(((t,n)=>{let r=e(`node:diagnostics_channel`),i=e(`node:util`),a=i.debuglog(`undici`),o=i.debuglog(`fetch`),s=i.debuglog(`websocket`),c={beforeConnect:r.channel(`undici:client:beforeConnect`),connected:r.channel(`undici:client:connected`),connectError:r.channel(`undici:client:connectError`),sendHeaders:r.channel(`undici:client:sendHeaders`),create:r.channel(`undici:request:create`),bodySent:r.channel(`undici:request:bodySent`),bodyChunkSent:r.channel(`undici:request:bodyChunkSent`),bodyChunkReceived:r.channel(`undici:request:bodyChunkReceived`),headers:r.channel(`undici:request:headers`),trailers:r.channel(`undici:request:trailers`),error:r.channel(`undici:request:error`),open:r.channel(`undici:websocket:open`),close:r.channel(`undici:websocket:close`),socketError:r.channel(`undici:websocket:socket_error`),ping:r.channel(`undici:websocket:ping`),pong:r.channel(`undici:websocket:pong`),proxyConnected:r.channel(`undici:proxy:connected`)},l=!1;function u(e=a){if(!l){if(c.beforeConnect.hasSubscribers||c.connected.hasSubscribers||c.connectError.hasSubscribers||c.sendHeaders.hasSubscribers){l=!0;return}l=!0,r.subscribe(`undici:client:beforeConnect`,t=>{let{connectParams:{version:n,protocol:r,port:i,host:a}}=t;e(`connecting to %s%s using %s%s`,a,i?`:${i}`:``,r,n)}),r.subscribe(`undici:client:connected`,t=>{let{connectParams:{version:n,protocol:r,port:i,host:a}}=t;e(`connected to %s%s using %s%s`,a,i?`:${i}`:``,r,n)}),r.subscribe(`undici:client:connectError`,t=>{let{connectParams:{version:n,protocol:r,port:i,host:a},error:o}=t;e(`connection to %s%s using %s%s errored - %s`,a,i?`:${i}`:``,r,n,o.message)}),r.subscribe(`undici:client:sendHeaders`,t=>{let{request:{method:n,path:r,origin:i}}=t;e(`sending request to %s %s%s`,n,i,r)})}}let d=!1;function f(e=a){if(!d){if(c.headers.hasSubscribers||c.trailers.hasSubscribers||c.error.hasSubscribers){d=!0;return}d=!0,r.subscribe(`undici:request:headers`,t=>{let{request:{method:n,path:r,origin:i},response:{statusCode:a}}=t;e(`received response to %s %s%s - HTTP %d`,n,i,r,a)}),r.subscribe(`undici:request:trailers`,t=>{let{request:{method:n,path:r,origin:i}}=t;e(`trailers received from %s %s%s`,n,i,r)}),r.subscribe(`undici:request:error`,t=>{let{request:{method:n,path:r,origin:i},error:a}=t;e(`request to %s %s%s errored - %s`,n,i,r,a.message)})}}let p=!1;function m(e=s){if(!p){if(c.open.hasSubscribers||c.close.hasSubscribers||c.socketError.hasSubscribers||c.ping.hasSubscribers||c.pong.hasSubscribers){p=!0;return}p=!0,r.subscribe(`undici:websocket:open`,t=>{if(t.address!=null){let{address:n,port:r}=t.address;e(`connection opened %s%s`,n,r?`:${r}`:``)}else e(`connection opened`)}),r.subscribe(`undici:websocket:close`,t=>{let{websocket:n,code:r,reason:i}=t;e(`closed connection to %s - %s %s`,n.url,r,i)}),r.subscribe(`undici:websocket:socket_error`,t=>{e(`connection errored - %s`,t.message)}),r.subscribe(`undici:websocket:ping`,t=>{e(`ping received`)}),r.subscribe(`undici:websocket:pong`,t=>{e(`pong received`)})}}(a.enabled||o.enabled)&&(u(o.enabled?o:a),f(o.enabled?o:a)),s.enabled&&(u(a.enabled?a:s),m(s)),n.exports={channels:c}})),u=t(((t,n)=>{let{InvalidArgumentError:r,NotSupportedError:o}=i(),c=e(`node:assert`),{isValidHTTPToken:u,isValidHeaderValue:d,isStream:f,destroy:p,isBuffer:m,isFormDataLike:h,isIterable:g,hasSafeIterator:_,isBlobLike:v,serializePathWithQuery:y,assertRequestHandler:b,getServerName:x,normalizedMethodRecords:S,getProtocolFromUrlString:C}=s(),{channels:w}=l(),{headerNameLowerCasedRecord:T}=a(),E=/[^\u0021-\u00ff]/;function D(e){if(typeof e!=`string`||e.length===0)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<48||n>57)return!1}return!0}let O=Symbol(`handler`);var k=class{constructor(e,{path:t,method:n,body:i,headers:a,query:o,idempotent:s,blocking:c,upgrade:l,headersTimeout:T,bodyTimeout:D,reset:k,expectContinue:j,servername:M,throwOnError:N,maxRedirections:P,typeOfService:F},I){if(typeof t!=`string`)throw new r(`path must be a string`);if(t[0]!==`/`&&!(t.startsWith(`http://`)||t.startsWith(`https://`))&&n!==`CONNECT`)throw new r(`path must be an absolute URL or start with a slash`);if(E.test(t))throw new r(`invalid request path`);if(typeof n!=`string`)throw new r(`method must be a string`);if(S[n]===void 0&&!u(n))throw new r(`invalid request method`);if(l&&typeof l!=`string`)throw new r(`upgrade must be a string`);if(l&&!d(l))throw new r(`invalid upgrade header`);if(T!=null&&(!Number.isFinite(T)||T<0))throw new r(`invalid headersTimeout`);if(D!=null&&(!Number.isFinite(D)||D<0))throw new r(`invalid bodyTimeout`);if(k!=null&&typeof k!=`boolean`)throw new r(`invalid reset`);if(j!=null&&typeof j!=`boolean`)throw new r(`invalid expectContinue`);if(N!=null)throw new r(`invalid throwOnError`);if(P!=null&&P!==0)throw new r(`maxRedirections is not supported, use the redirect interceptor`);if(F!=null&&(!Number.isInteger(F)||F<0||F>255))throw new r(`typeOfService must be an integer between 0 and 255`);if(this.headersTimeout=T,this.bodyTimeout=D,this.method=n,this.typeOfService=F??0,this.abort=null,i==null)this.body=null;else if(f(i)){this.body=i;let e=this.body._readableState;(!e||!e.autoDestroy)&&(this.endHandler=function(){p(this)},this.body.on(`end`,this.endHandler)),this.errorHandler=e=>{this.abort?this.abort(e):this.error=e},this.body.on(`error`,this.errorHandler)}else if(m(i))this.body=i.byteLength?i:null;else if(ArrayBuffer.isView(i))this.body=i.buffer.byteLength?Buffer.from(i.buffer,i.byteOffset,i.byteLength):null;else if(i instanceof ArrayBuffer)this.body=i.byteLength?Buffer.from(i):null;else if(typeof i==`string`)this.body=i.length?Buffer.from(i):null;else if(h(i)||g(i)||v(i))this.body=i;else throw new r(`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=l||null,this.path=o?y(t,o):t,this.origin=e,this.protocol=C(e),this.idempotent=s??(n===`HEAD`||n===`GET`),this.blocking=c??this.method!==`HEAD`,this.reset=k??null,this.host=null,this.contentLength=null,this.contentType=null,this.headers=[],this.expectContinue=j??!1,Array.isArray(a)){if(a.length%2!=0)throw new r(`headers array must be even`);for(let e=0;e<a.length;e+=2)A(this,a[e],a[e+1])}else if(a&&typeof a==`object`)if(_(a))for(let e of a){if(!Array.isArray(e)||e.length!==2)throw new r(`headers must be in key-value pair format`);A(this,e[0],e[1])}else{let e=Object.keys(a);for(let t=0;t<e.length;++t)A(this,e[t],a[e[t]])}else if(a!=null)throw new r(`headers must be an object or an array`);b(I,n,l),this.servername=M||x(this.host)||null,this[O]=I,w.create.hasSubscribers&&w.create.publish({request:this})}onBodySent(e){if(w.bodyChunkSent.hasSubscribers&&w.bodyChunkSent.publish({request:this,chunk:e}),this[O].onBodySent)try{return this[O].onBodySent(e)}catch(e){this.abort(e)}}onRequestSent(){if(w.bodySent.hasSubscribers&&w.bodySent.publish({request:this}),this[O].onRequestSent)try{return this[O].onRequestSent()}catch(e){this.abort(e)}}onConnect(e){if(c(!this.aborted),c(!this.completed),this.error)e(this.error);else return this.abort=e,this[O].onConnect(e)}onResponseStarted(){return this[O].onResponseStarted?.()}onHeaders(e,t,n,r){c(!this.aborted),c(!this.completed),w.headers.hasSubscribers&&w.headers.publish({request:this,response:{statusCode:e,headers:t,statusText:r}});try{return this[O].onHeaders(e,t,n,r)}catch(e){this.abort(e)}}onData(e){c(!this.aborted),c(!this.completed),w.bodyChunkReceived.hasSubscribers&&w.bodyChunkReceived.publish({request:this,chunk:e});try{return this[O].onData(e)}catch(e){return this.abort(e),!1}}onUpgrade(e,t,n){return c(!this.aborted),c(!this.completed),this[O].onUpgrade(e,t,n)}onComplete(e){this.onFinally(),c(!this.aborted),c(!this.completed),this.completed=!0,w.trailers.hasSubscribers&&w.trailers.publish({request:this,trailers:e});try{return this[O].onComplete(e)}catch(e){this.onError(e)}}onError(e){if(this.onFinally(),w.error.hasSubscribers&&w.error.publish({request:this,error:e}),!this.aborted)return this.aborted=!0,this[O].onError(e)}onFinally(){this.errorHandler&&=(this.body.off(`error`,this.errorHandler),null),this.endHandler&&=(this.body.off(`end`,this.endHandler),null)}addHeader(e,t){return A(this,e,t),this}};function A(e,t,n){if(n&&typeof n==`object`&&!Array.isArray(n))throw new r(`invalid ${t} header`);if(n===void 0)return;let i=T[t];if(i===void 0&&(i=t.toLowerCase(),T[i]===void 0&&!u(i)))throw new r(`invalid header key`);if(Array.isArray(n)){let e=[];for(let i=0;i<n.length;i++)if(typeof n[i]==`string`){if(!d(n[i]))throw new r(`invalid ${t} header`);e.push(n[i])}else if(n[i]===null)e.push(``);else if(typeof n[i]==`object`)throw new r(`invalid ${t} header`);else e.push(`${n[i]}`);n=e}else if(typeof n==`string`){if(!d(n))throw new r(`invalid ${t} header`)}else n=n===null?``:`${n}`;if(i===`host`){if(e.host!==null)throw new r(`duplicate host header`);if(typeof n!=`string`)throw new r(`invalid host header`);e.host=n}else if(i===`content-length`){if(e.contentLength!==null)throw new r(`duplicate content-length header`);if(!D(n))throw new r(`invalid content-length header`);e.contentLength=parseInt(n,10)}else if(e.contentType===null&&i===`content-type`)e.contentType=n,e.headers.push(t,n);else if(i===`transfer-encoding`||i===`keep-alive`||i===`upgrade`)throw new r(`invalid ${i} header`);else if(i===`connection`){let t=typeof n==`string`?n:null;if(t===null)throw new r(`invalid connection header`);for(let n of t.toLowerCase().split(`,`)){let t=n.trim();if(!u(t))throw new r(`invalid connection header`);t===`close`&&(e.reset=!0)}}else if(i===`expect`)throw new o(`expect header not supported`);else e.headers.push(t,n)}n.exports=k})),d=t(((e,t)=>{let{InvalidArgumentError:n}=i();t.exports=class e{#e;constructor(e){this.#e=e}static wrap(t){return t.onRequestStart?t:new e(t)}onConnect(e,t){return this.#e.onConnect?.(e,t)}onResponseStarted(){return this.#e.onResponseStarted?.()}onHeaders(e,t,n,r){return this.#e.onHeaders?.(e,t,n,r)}onUpgrade(e,t,n){return this.#e.onUpgrade?.(e,t,n)}onData(e){return this.#e.onData?.(e)}onComplete(e){return this.#e.onComplete?.(e)}onError(e){if(!this.#e.onError)throw e;return this.#e.onError?.(e)}onRequestStart(e,t){this.#e.onConnect?.(t=>e.abort(t),t)}onRequestUpgrade(e,t,n,i){let a=[];for(let[e,t]of Object.entries(n))a.push(Buffer.from(e,`latin1`),r(t));this.#e.onUpgrade?.(t,a,i)}onResponseStart(e,t,n,i){let a=[];for(let[e,t]of Object.entries(n))a.push(Buffer.from(e,`latin1`),r(t));this.#e.onHeaders?.(t,a,()=>e.resume(),i)===!1&&e.pause()}onResponseData(e,t){this.#e.onData?.(t)===!1&&e.pause()}onResponseEnd(e,t){let n=[];for(let[e,i]of Object.entries(t))n.push(Buffer.from(e,`latin1`),r(i));this.#e.onComplete?.(n)}onResponseError(e,t){if(!this.#e.onError)throw new n(`invalid onError method`);this.#e.onError?.(t)}};function r(e){return Array.isArray(e)?e.map(e=>Buffer.from(e,`latin1`)):Buffer.from(e,`latin1`)}})),f=t(((t,n)=>{let r=e(`node:events`),i=d(),a=e=>(t,n)=>e(t,i.wrap(n));n.exports=class extends r{dispatch(){throw Error(`not implemented`)}close(){throw Error(`not implemented`)}destroy(){throw Error(`not implemented`)}compose(...e){let t=Array.isArray(e[0])?e[0]:e,n=this.dispatch.bind(this);for(let e of t)if(e!=null){if(typeof e!=`function`)throw TypeError(`invalid interceptor, expected function received ${typeof e}`);if(n=e(n),n=a(n),n==null||typeof n!=`function`||n.length!==2)throw TypeError(`invalid interceptor`)}return new Proxy(this,{get:(e,t)=>t===`dispatch`?n:e[t]})}}})),p=t(((e,t)=>{let{parseHeaders:n}=s(),{InvalidArgumentError:r}=i(),a=Symbol(`resume`);var o=class{#e=!1;#t=null;#n=!1;#r;[a]=null;rawHeaders=null;rawTrailers=null;constructor(e){this.#r=e}pause(){this.#e=!0}resume(){this.#e&&(this.#e=!1,this[a]?.())}abort(e){this.#n||(this.#n=!0,this.#t=e,this.#r(e))}get aborted(){return this.#n}get reason(){return this.#t}get paused(){return this.#e}};t.exports=class e{#e;#t;constructor(e){this.#e=e}static unwrap(t){return t.onRequestStart?new e(t):t}onConnect(e,t){this.#t=new o(e),this.#e.onRequestStart?.(this.#t,t)}onResponseStarted(){return this.#e.onResponseStarted?.()}onUpgrade(e,t,r){this.#t.rawHeaders=t,this.#e.onRequestUpgrade?.(this.#t,e,n(t),r)}onHeaders(e,t,r,i){return this.#t[a]=r,this.#t.rawHeaders=t,this.#e.onResponseStart?.(this.#t,e,n(t),i),!this.#t.paused}onData(e){return this.#e.onResponseData?.(this.#t,e),!this.#t.paused}onComplete(e){this.#t.rawTrailers=e,this.#e.onResponseEnd?.(this.#t,n(e))}onError(e){if(!this.#e.onResponseError)throw new r(`invalid onError method`);this.#e.onResponseError?.(this.#t,e)}}})),m=t(((e,t)=>{let r=f(),a=p(),{ClientDestroyedError:o,ClientClosedError:s,InvalidArgumentError:c}=i(),{kDestroy:l,kClose:u,kClosed:d,kDestroyed:m,kDispatch:h}=n(),g=Symbol(`onDestroyed`),_=Symbol(`onClosed`),v=Symbol(`webSocketOptions`);t.exports=class extends r{[m]=!1;[g]=null;[d]=!1;[_]=null;constructor(e){super(),this[v]=e?.webSocket??{}}get webSocketOptions(){return{maxFragments:this[v].maxFragments??131072,maxPayloadSize:this[v].maxPayloadSize??128*1024*1024}}get destroyed(){return this[m]}get closed(){return this[d]}close(e){if(e===void 0)return new Promise((e,t)=>{this.close((n,r)=>n?t(n):e(r))});if(typeof e!=`function`)throw new c(`invalid callback`);if(this[m]){let t=new o;queueMicrotask(()=>e(t,null));return}if(this[d]){this[_]?this[_].push(e):queueMicrotask(()=>e(null,null));return}this[d]=!0,this[_]??=[],this[_].push(e);let t=()=>{let e=this[_];this[_]=null;for(let t=0;t<e.length;t++)e[t](null,null)};this[u]().then(()=>this.destroy()).then(()=>queueMicrotask(t))}destroy(e,t){if(typeof e==`function`&&(t=e,e=null),t===void 0)return new Promise((t,n)=>{this.destroy(e,(e,r)=>e?n(e):t(r))});if(typeof t!=`function`)throw new c(`invalid callback`);if(this[m]){this[g]?this[g].push(t):queueMicrotask(()=>t(null,null));return}e||=new o,this[m]=!0,this[g]??=[],this[g].push(t);let n=()=>{let e=this[g];this[g]=null;for(let t=0;t<e.length;t++)e[t](null,null)};this[l](e).then(()=>queueMicrotask(n))}dispatch(e,t){if(!t||typeof t!=`object`)throw new c(`handler must be an object`);t=a.unwrap(t);try{if(!e||typeof e!=`object`)throw new c(`opts must be an object.`);if(this[m]||this[g])throw new o;if(this[d])throw new s;return this[h](e,t)}catch(e){if(typeof t.onError!=`function`)throw e;return t.onError(e),!1}}}})),h=t(((t,n)=>{let r=e(`node:net`),a=e(`node:assert`),o=s(),{InvalidArgumentError:c}=i(),l,u=class{constructor(e){this._maxCachedSessions=e,this._sessionCache=new Map,this._sessionRegistry=new FinalizationRegistry(e=>{if(this._sessionCache.size<this._maxCachedSessions)return;let t=this._sessionCache.get(e);t!==void 0&&t.deref()===void 0&&this._sessionCache.delete(e)})}get(e){let t=this._sessionCache.get(e);return t?t.deref():null}set(e,t){if(this._maxCachedSessions!==0){if(this._sessionCache.has(e))this._sessionCache.delete(e);else if(this._sessionCache.size>=this._maxCachedSessions){for(let[e,t]of this._sessionCache)if(t.deref()===void 0){this._sessionCache.delete(e);return}let e=this._sessionCache.keys().next();e.done||this._sessionCache.delete(e.value)}this._sessionCache.set(e,new WeakRef(t)),this._sessionRegistry.register(t,e)}}};function d({allowH2:t,useH2c:n,maxCachedSessions:i,socketPath:s,timeout:d,session:f,...p}){if(i!=null&&(!Number.isInteger(i)||i<0))throw new c(`maxCachedSessions must be a positive integer or zero`);let m={path:s,...p},h=new u(i??100);return d??=1e4,t??=!1,function({hostname:i,host:s,protocol:c,port:u,servername:p,localAddress:g,httpSocket:_},v){let y;if(c===`https:`){l||=e(`node:tls`),p=p||m.servername||o.getServerName(s)||null;let n=p||i;a(n);let r=f||h.get(n)||null;u||=443,y=l.connect({highWaterMark:16384,...m,servername:p,session:r,localAddress:g,ALPNProtocols:t?[`http/1.1`,`h2`]:[`http/1.1`],socket:_,port:u,host:i}),y.on(`session`,function(e){h.set(n,e)})}else a(!_,`httpSocket can only be sent on TLS update`),u||=80,y=r.connect({highWaterMark:64*1024,...m,localAddress:g,port:u,host:i}),n===!0&&(y.alpnProtocol=`h2`);if(m.keepAlive==null||m.keepAlive){let e=m.keepAliveInitialDelay===void 0?6e4:m.keepAliveInitialDelay;y.setKeepAlive(!0,e)}let b=o.setupConnectTimeout(new WeakRef(y),{timeout:d,hostname:i,port:u});return y.setNoDelay(!0).once(c===`https:`?`secureConnect`:`connect`,function(){if(queueMicrotask(b),v){let e=v;v=null,e(null,this)}}).on(`error`,function(e){if(queueMicrotask(b),v){let t=v;v=null,t(e)}}),y}}n.exports=d})),g=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.enumToMap=t;function t(e,t=[],n=[]){let r=(t?.length??0)===0,i=(n?.length??0)===0;return Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`number`&&(r||t.includes(e))&&(i||!n.includes(e))))}})),_=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SPECIAL_HEADERS=e.MINOR=e.MAJOR=e.HTAB_SP_VCHAR_OBS_TEXT=e.QUOTED_STRING=e.CONNECTION_TOKEN_CHARS=e.HEADER_CHARS=e.TOKEN=e.HEX=e.URL_CHAR=e.USERINFO_CHARS=e.MARK=e.ALPHANUM=e.NUM=e.HEX_MAP=e.NUM_MAP=e.ALPHA=e.STATUSES_HTTP=e.H_METHOD_MAP=e.METHOD_MAP=e.METHODS_RTSP=e.METHODS_ICE=e.METHODS_HTTP=e.HEADER_STATE=e.FINISH=e.STATUSES=e.METHODS=e.LENIENT_FLAGS=e.FLAGS=e.TYPE=e.ERROR=void 0;let t=g();e.ERROR={OK:0,INTERNAL:1,STRICT:2,CR_EXPECTED:25,LF_EXPECTED:3,UNEXPECTED_CONTENT_LENGTH:4,UNEXPECTED_SPACE:30,CLOSED_CONNECTION:5,INVALID_METHOD:6,INVALID_URL:7,INVALID_CONSTANT:8,INVALID_VERSION:9,INVALID_HEADER_TOKEN:10,INVALID_CONTENT_LENGTH:11,INVALID_CHUNK_SIZE:12,INVALID_STATUS:13,INVALID_EOF_STATE:14,INVALID_TRANSFER_ENCODING:15,CB_MESSAGE_BEGIN:16,CB_HEADERS_COMPLETE:17,CB_MESSAGE_COMPLETE:18,CB_CHUNK_HEADER:19,CB_CHUNK_COMPLETE:20,PAUSED:21,PAUSED_UPGRADE:22,PAUSED_H2_UPGRADE:23,USER:24,CB_URL_COMPLETE:26,CB_STATUS_COMPLETE:27,CB_METHOD_COMPLETE:32,CB_VERSION_COMPLETE:33,CB_HEADER_FIELD_COMPLETE:28,CB_HEADER_VALUE_COMPLETE:29,CB_CHUNK_EXTENSION_NAME_COMPLETE:34,CB_CHUNK_EXTENSION_VALUE_COMPLETE:35,CB_RESET:31,CB_PROTOCOL_COMPLETE:38},e.TYPE={BOTH:0,REQUEST:1,RESPONSE:2},e.FLAGS={CONNECTION_KEEP_ALIVE:1,CONNECTION_CLOSE:2,CONNECTION_UPGRADE:4,CHUNKED:8,UPGRADE:16,CONTENT_LENGTH:32,SKIPBODY:64,TRAILING:128,TRANSFER_ENCODING:512},e.LENIENT_FLAGS={HEADERS:1,CHUNKED_LENGTH:2,KEEP_ALIVE:4,TRANSFER_ENCODING:8,VERSION:16,DATA_AFTER_CLOSE:32,OPTIONAL_LF_AFTER_CR:64,OPTIONAL_CRLF_AFTER_CHUNK:128,OPTIONAL_CR_BEFORE_LF:256,SPACES_AFTER_CHUNK_SIZE:512},e.METHODS={DELETE:0,GET:1,HEAD:2,POST:3,PUT:4,CONNECT:5,OPTIONS:6,TRACE:7,COPY:8,LOCK:9,MKCOL:10,MOVE:11,PROPFIND:12,PROPPATCH:13,SEARCH:14,UNLOCK:15,BIND:16,REBIND:17,UNBIND:18,ACL:19,REPORT:20,MKACTIVITY:21,CHECKOUT:22,MERGE:23,"M-SEARCH":24,NOTIFY:25,SUBSCRIBE:26,UNSUBSCRIBE:27,PATCH:28,PURGE:29,MKCALENDAR:30,LINK:31,UNLINK:32,SOURCE:33,PRI:34,DESCRIBE:35,ANNOUNCE:36,SETUP:37,PLAY:38,PAUSE:39,TEARDOWN:40,GET_PARAMETER:41,SET_PARAMETER:42,REDIRECT:43,RECORD:44,FLUSH:45,QUERY:46},e.STATUSES={CONTINUE:100,SWITCHING_PROTOCOLS:101,PROCESSING:102,EARLY_HINTS:103,RESPONSE_IS_STALE:110,REVALIDATION_FAILED:111,DISCONNECTED_OPERATION:112,HEURISTIC_EXPIRATION:113,MISCELLANEOUS_WARNING:199,OK:200,CREATED:201,ACCEPTED:202,NON_AUTHORITATIVE_INFORMATION:203,NO_CONTENT:204,RESET_CONTENT:205,PARTIAL_CONTENT:206,MULTI_STATUS:207,ALREADY_REPORTED:208,TRANSFORMATION_APPLIED:214,IM_USED:226,MISCELLANEOUS_PERSISTENT_WARNING:299,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,USE_PROXY:305,SWITCH_PROXY:306,TEMPORARY_REDIRECT:307,PERMANENT_REDIRECT:308,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,IM_A_TEAPOT:418,PAGE_EXPIRED:419,ENHANCE_YOUR_CALM:420,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL:430,REQUEST_HEADER_FIELDS_TOO_LARGE:431,LOGIN_TIMEOUT:440,NO_RESPONSE:444,RETRY_WITH:449,BLOCKED_BY_PARENTAL_CONTROL:450,UNAVAILABLE_FOR_LEGAL_REASONS:451,CLIENT_CLOSED_LOAD_BALANCED_REQUEST:460,INVALID_X_FORWARDED_FOR:463,REQUEST_HEADER_TOO_LARGE:494,SSL_CERTIFICATE_ERROR:495,SSL_CERTIFICATE_REQUIRED:496,HTTP_REQUEST_SENT_TO_HTTPS_PORT:497,INVALID_TOKEN:498,CLIENT_CLOSED_REQUEST:499,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,BANDWIDTH_LIMIT_EXCEEDED:509,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511,WEB_SERVER_UNKNOWN_ERROR:520,WEB_SERVER_IS_DOWN:521,CONNECTION_TIMEOUT:522,ORIGIN_IS_UNREACHABLE:523,TIMEOUT_OCCURED:524,SSL_HANDSHAKE_FAILED:525,INVALID_SSL_CERTIFICATE:526,RAILGUN_ERROR:527,SITE_IS_OVERLOADED:529,SITE_IS_FROZEN:530,IDENTITY_PROVIDER_AUTHENTICATION_ERROR:561,NETWORK_READ_TIMEOUT:598,NETWORK_CONNECT_TIMEOUT:599},e.FINISH={SAFE:0,SAFE_WITH_CB:1,UNSAFE:2},e.HEADER_STATE={GENERAL:0,CONNECTION:1,CONTENT_LENGTH:2,TRANSFER_ENCODING:3,UPGRADE:4,CONNECTION_KEEP_ALIVE:5,CONNECTION_CLOSE:6,CONNECTION_UPGRADE:7,TRANSFER_ENCODING_CHUNKED:8},e.METHODS_HTTP=[e.METHODS.DELETE,e.METHODS.GET,e.METHODS.HEAD,e.METHODS.POST,e.METHODS.PUT,e.METHODS.CONNECT,e.METHODS.OPTIONS,e.METHODS.TRACE,e.METHODS.COPY,e.METHODS.LOCK,e.METHODS.MKCOL,e.METHODS.MOVE,e.METHODS.PROPFIND,e.METHODS.PROPPATCH,e.METHODS.SEARCH,e.METHODS.UNLOCK,e.METHODS.BIND,e.METHODS.REBIND,e.METHODS.UNBIND,e.METHODS.ACL,e.METHODS.REPORT,e.METHODS.MKACTIVITY,e.METHODS.CHECKOUT,e.METHODS.MERGE,e.METHODS[`M-SEARCH`],e.METHODS.NOTIFY,e.METHODS.SUBSCRIBE,e.METHODS.UNSUBSCRIBE,e.METHODS.PATCH,e.METHODS.PURGE,e.METHODS.MKCALENDAR,e.METHODS.LINK,e.METHODS.UNLINK,e.METHODS.PRI,e.METHODS.SOURCE,e.METHODS.QUERY],e.METHODS_ICE=[e.METHODS.SOURCE],e.METHODS_RTSP=[e.METHODS.OPTIONS,e.METHODS.DESCRIBE,e.METHODS.ANNOUNCE,e.METHODS.SETUP,e.METHODS.PLAY,e.METHODS.PAUSE,e.METHODS.TEARDOWN,e.METHODS.GET_PARAMETER,e.METHODS.SET_PARAMETER,e.METHODS.REDIRECT,e.METHODS.RECORD,e.METHODS.FLUSH,e.METHODS.GET,e.METHODS.POST],e.METHOD_MAP=(0,t.enumToMap)(e.METHODS),e.H_METHOD_MAP=Object.fromEntries(Object.entries(e.METHODS).filter(([e])=>e.startsWith(`H`))),e.STATUSES_HTTP=[e.STATUSES.CONTINUE,e.STATUSES.SWITCHING_PROTOCOLS,e.STATUSES.PROCESSING,e.STATUSES.EARLY_HINTS,e.STATUSES.RESPONSE_IS_STALE,e.STATUSES.REVALIDATION_FAILED,e.STATUSES.DISCONNECTED_OPERATION,e.STATUSES.HEURISTIC_EXPIRATION,e.STATUSES.MISCELLANEOUS_WARNING,e.STATUSES.OK,e.STATUSES.CREATED,e.STATUSES.ACCEPTED,e.STATUSES.NON_AUTHORITATIVE_INFORMATION,e.STATUSES.NO_CONTENT,e.STATUSES.RESET_CONTENT,e.STATUSES.PARTIAL_CONTENT,e.STATUSES.MULTI_STATUS,e.STATUSES.ALREADY_REPORTED,e.STATUSES.TRANSFORMATION_APPLIED,e.STATUSES.IM_USED,e.STATUSES.MISCELLANEOUS_PERSISTENT_WARNING,e.STATUSES.MULTIPLE_CHOICES,e.STATUSES.MOVED_PERMANENTLY,e.STATUSES.FOUND,e.STATUSES.SEE_OTHER,e.STATUSES.NOT_MODIFIED,e.STATUSES.USE_PROXY,e.STATUSES.SWITCH_PROXY,e.STATUSES.TEMPORARY_REDIRECT,e.STATUSES.PERMANENT_REDIRECT,e.STATUSES.BAD_REQUEST,e.STATUSES.UNAUTHORIZED,e.STATUSES.PAYMENT_REQUIRED,e.STATUSES.FORBIDDEN,e.STATUSES.NOT_FOUND,e.STATUSES.METHOD_NOT_ALLOWED,e.STATUSES.NOT_ACCEPTABLE,e.STATUSES.PROXY_AUTHENTICATION_REQUIRED,e.STATUSES.REQUEST_TIMEOUT,e.STATUSES.CONFLICT,e.STATUSES.GONE,e.STATUSES.LENGTH_REQUIRED,e.STATUSES.PRECONDITION_FAILED,e.STATUSES.PAYLOAD_TOO_LARGE,e.STATUSES.URI_TOO_LONG,e.STATUSES.UNSUPPORTED_MEDIA_TYPE,e.STATUSES.RANGE_NOT_SATISFIABLE,e.STATUSES.EXPECTATION_FAILED,e.STATUSES.IM_A_TEAPOT,e.STATUSES.PAGE_EXPIRED,e.STATUSES.ENHANCE_YOUR_CALM,e.STATUSES.MISDIRECTED_REQUEST,e.STATUSES.UNPROCESSABLE_ENTITY,e.STATUSES.LOCKED,e.STATUSES.FAILED_DEPENDENCY,e.STATUSES.TOO_EARLY,e.STATUSES.UPGRADE_REQUIRED,e.STATUSES.PRECONDITION_REQUIRED,e.STATUSES.TOO_MANY_REQUESTS,e.STATUSES.REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL,e.STATUSES.REQUEST_HEADER_FIELDS_TOO_LARGE,e.STATUSES.LOGIN_TIMEOUT,e.STATUSES.NO_RESPONSE,e.STATUSES.RETRY_WITH,e.STATUSES.BLOCKED_BY_PARENTAL_CONTROL,e.STATUSES.UNAVAILABLE_FOR_LEGAL_REASONS,e.STATUSES.CLIENT_CLOSED_LOAD_BALANCED_REQUEST,e.STATUSES.INVALID_X_FORWARDED_FOR,e.STATUSES.REQUEST_HEADER_TOO_LARGE,e.STATUSES.SSL_CERTIFICATE_ERROR,e.STATUSES.SSL_CERTIFICATE_REQUIRED,e.STATUSES.HTTP_REQUEST_SENT_TO_HTTPS_PORT,e.STATUSES.INVALID_TOKEN,e.STATUSES.CLIENT_CLOSED_REQUEST,e.STATUSES.INTERNAL_SERVER_ERROR,e.STATUSES.NOT_IMPLEMENTED,e.STATUSES.BAD_GATEWAY,e.STATUSES.SERVICE_UNAVAILABLE,e.STATUSES.GATEWAY_TIMEOUT,e.STATUSES.HTTP_VERSION_NOT_SUPPORTED,e.STATUSES.VARIANT_ALSO_NEGOTIATES,e.STATUSES.INSUFFICIENT_STORAGE,e.STATUSES.LOOP_DETECTED,e.STATUSES.BANDWIDTH_LIMIT_EXCEEDED,e.