diff --git a/.gitignore b/.gitignore index e44428f..b8db8e0 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ node_modules # dotenv environment variables file .env .env.test + +# npm lock file (project uses pnpm) +package-lock.json diff --git a/README.md b/README.md index e4f346f..39772ec 100644 --- a/README.md +++ b/README.md @@ -322,6 +322,19 @@ To use a custom pattern for a specific build tool: strip-hash: '\.([0-9a-f]{8})\.' ``` +### auto-collapse +Default: `true` + +Possible values: `true`, `false` + +When `true`, file rows are automatically collapsed into a `
` section when there are more than 20 files. The **Total** and **Tarball size** rows are always shown outside the collapsible section. + +To disable auto-collapsing: + +```yml +auto-collapse: false +``` + ## πŸ’β€β™€οΈ FAQ ### Can I use this for non-published projects? diff --git a/action.yml b/action.yml index 8912b3e..23a945e 100644 --- a/action.yml +++ b/action.yml @@ -25,6 +25,9 @@ inputs: description: 'Minimum byte difference to consider a file as changed (default: 100)' strip-hash: description: 'Regular expression to strip hashes from file names for comparison. Files that differ only in their hash will be compared as the same file. Set to "false" to disable. Default matches common build tool hash patterns.' + auto-collapse: + description: 'Automatically collapse file rows into a
section when there are more than 20 files: true, false' + default: 'true' runs: using: 'node20' main: 'dist/index.js' diff --git a/dist/index.js b/dist/index.js index b8af162..066dd07 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,8 +1,8 @@ "use strict"; var Pc = require("assert"), IA = require("os"), _c = require("crypto"), dt = require("fs"), kn = require("path"), Fn = require("http"), Tn = require("https"); require("net"); -var xc = require("tls"), Sn = require("events"), Vc = require("util"), He = require("node:assert"), dA = require("node:net"), fA = require("node:http"), ot = require("node:stream"), at = require("node:buffer"), rt = require("node:util"), Wc = require("node:querystring"), Vt = require("node:events"), qc = require("node:diagnostics_channel"), zc = require("node:tls"), jA = require("node:zlib"), Zc = require("node:perf_hooks"), Un = require("node:util/types"), Nn = require("node:worker_threads"), Kc = require("node:url"), Wt = require("node:async_hooks"), jc = require("node:console"), Xc = require("node:dns"), $c = require("string_decoder"), eg = require("child_process"), tg = require("timers"); -function Gt(e) { +var xc = require("tls"), Sn = require("events"), Vc = require("util"), He = require("node:assert"), dA = require("node:net"), fA = require("node:http"), ot = require("node:stream"), at = require("node:buffer"), rt = require("node:util"), Wc = require("node:querystring"), Wt = require("node:events"), qc = require("node:diagnostics_channel"), zc = require("node:tls"), jA = require("node:zlib"), Zc = require("node:perf_hooks"), Un = require("node:util/types"), Nn = require("node:worker_threads"), Kc = require("node:url"), qt = require("node:async_hooks"), jc = require("node:console"), Xc = require("node:dns"), $c = require("string_decoder"), eg = require("child_process"), tg = require("timers"); +function vt(e) { var t = /* @__PURE__ */ Object.create(null); return e && Object.keys(e).forEach(function(A) { if (A !== "default") { @@ -16,8 +16,8 @@ function Gt(e) { } }), t.default = e, Object.freeze(t); } -var ut = /* @__PURE__ */ Gt(IA), Ag = /* @__PURE__ */ Gt(_c), pA = /* @__PURE__ */ Gt(dt), ft = /* @__PURE__ */ Gt(kn), Mn = /* @__PURE__ */ Gt(Sn), rg = /* @__PURE__ */ Gt(eg); -function qt(e) { +var Et = /* @__PURE__ */ vt(IA), Ag = /* @__PURE__ */ vt(_c), pA = /* @__PURE__ */ vt(dt), ft = /* @__PURE__ */ vt(kn), Mn = /* @__PURE__ */ vt(Sn), rg = /* @__PURE__ */ vt(eg); +function zt(e) { return e == null ? "" : typeof e == "string" || e instanceof String ? e : JSON.stringify(e); } function Ln(e) { @@ -30,12 +30,12 @@ function Ln(e) { endColumn: e.endColumn } : {}; } -function zt(e, t, A) { +function Zt(e, t, A) { const s = new sg(e, t, A); - process.stdout.write(s.toString() + ut.EOL); + process.stdout.write(s.toString() + Et.EOL); } function Gn(e, t = "") { - zt(e, {}, t); + Zt(e, {}, t); } const vn = "::"; class sg { @@ -57,10 +57,10 @@ class sg { } } function ng(e) { - return qt(e).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A"); + return zt(e).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A"); } function og(e) { - return qt(e).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/:/g, "%3A").replace(/,/g, "%2C"); + return zt(e).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/:/g, "%3A").replace(/,/g, "%2C"); } function ig(e, t) { const A = process.env[`GITHUB_${e}`]; @@ -68,166 +68,166 @@ function ig(e, t) { throw new Error(`Unable to find environment variable for file command ${e}`); if (!pA.existsSync(A)) throw new Error(`Missing file at path: ${A}`); - pA.appendFileSync(A, `${qt(t)}${ut.EOL}`, { + pA.appendFileSync(A, `${zt(t)}${Et.EOL}`, { encoding: "utf8" }); } function ag(e, t) { - const A = `ghadelimiter_${Ag.randomUUID()}`, s = qt(t); + const A = `ghadelimiter_${Ag.randomUUID()}`, s = zt(t); if (e.includes(A)) throw new Error(`Unexpected input: name should not contain the delimiter "${A}"`); if (s.includes(A)) throw new Error(`Unexpected input: value should not contain the delimiter "${A}"`); - return `${e}<<${A}${ut.EOL}${s}${ut.EOL}${A}`; + return `${e}<<${A}${Et.EOL}${s}${Et.EOL}${A}`; } var Yn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function cg(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } -var kt = {}, Jn; +var Ft = {}, Jn; function gg() { - if (Jn) return kt; + if (Jn) return Ft; Jn = 1; var e = xc, t = Fn, A = Tn, s = Sn, r = Vc; - kt.httpOverHttp = n, kt.httpsOverHttp = o, kt.httpOverHttps = a, kt.httpsOverHttps = u; - function n(C) { - var f = new g(C); - return f.request = t.request, f; - } - function o(C) { - var f = new g(C); - return f.request = t.request, f.createSocket = i, f.defaultPort = 443, f; - } - function a(C) { - var f = new g(C); - return f.request = A.request, f; - } - function u(C) { - var f = new g(C); - return f.request = A.request, f.createSocket = i, f.defaultPort = 443, f; - } - function g(C) { - var f = this; - f.options = C || {}, f.proxyOptions = f.options.proxy || {}, f.maxSockets = f.options.maxSockets || t.Agent.defaultMaxSockets, f.requests = [], f.sockets = [], f.on("free", function(b, R, S, L) { - for (var M = c(R, S, L), d = 0, Q = f.requests.length; d < Q; ++d) { - var w = f.requests[d]; - if (w.host === M.host && w.port === M.port) { - f.requests.splice(d, 1), w.request.onSocket(b); + Ft.httpOverHttp = n, Ft.httpsOverHttp = o, Ft.httpOverHttps = a, Ft.httpsOverHttps = u; + function n(B) { + var d = new l(B); + return d.request = t.request, d; + } + function o(B) { + var d = new l(B); + return d.request = t.request, d.createSocket = i, d.defaultPort = 443, d; + } + function a(B) { + var d = new l(B); + return d.request = A.request, d; + } + function u(B) { + var d = new l(B); + return d.request = A.request, d.createSocket = i, d.defaultPort = 443, d; + } + function l(B) { + var d = this; + d.options = B || {}, d.proxyOptions = d.options.proxy || {}, d.maxSockets = d.options.maxSockets || t.Agent.defaultMaxSockets, d.requests = [], d.sockets = [], d.on("free", function(b, F, M, L) { + for (var N = c(F, M, L), f = 0, E = d.requests.length; f < E; ++f) { + var p = d.requests[f]; + if (p.host === N.host && p.port === N.port) { + d.requests.splice(f, 1), p.request.onSocket(b); return; } } - b.destroy(), f.removeSocket(b); + b.destroy(), d.removeSocket(b); }); } - r.inherits(g, s.EventEmitter), g.prototype.addRequest = function(f, y, b, R) { - var S = this, L = h({ request: f }, S.options, c(y, b, R)); - if (S.sockets.length >= this.maxSockets) { - S.requests.push(L); + r.inherits(l, s.EventEmitter), l.prototype.addRequest = function(d, y, b, F) { + var M = this, L = Q({ request: d }, M.options, c(y, b, F)); + if (M.sockets.length >= this.maxSockets) { + M.requests.push(L); return; } - S.createSocket(L, function(M) { - M.on("free", d), M.on("close", Q), M.on("agentRemove", Q), f.onSocket(M); - function d() { - S.emit("free", M, L); + M.createSocket(L, function(N) { + N.on("free", f), N.on("close", E), N.on("agentRemove", E), d.onSocket(N); + function f() { + M.emit("free", N, L); } - function Q(w) { - S.removeSocket(M), M.removeListener("free", d), M.removeListener("close", Q), M.removeListener("agentRemove", Q); + function E(p) { + M.removeSocket(N), N.removeListener("free", f), N.removeListener("close", E), N.removeListener("agentRemove", E); } }); - }, g.prototype.createSocket = function(f, y) { - var b = this, R = {}; - b.sockets.push(R); - var S = h({}, b.proxyOptions, { + }, l.prototype.createSocket = function(d, y) { + var b = this, F = {}; + b.sockets.push(F); + var M = Q({}, b.proxyOptions, { method: "CONNECT", - path: f.host + ":" + f.port, + path: d.host + ":" + d.port, agent: !1, headers: { - host: f.host + ":" + f.port + host: d.host + ":" + d.port } }); - f.localAddress && (S.localAddress = f.localAddress), S.proxyAuth && (S.headers = S.headers || {}, S.headers["Proxy-Authorization"] = "Basic " + new Buffer(S.proxyAuth).toString("base64")), E("making CONNECT request"); - var L = b.request(S); - L.useChunkedEncodingByDefault = !1, L.once("response", M), L.once("upgrade", d), L.once("connect", Q), L.once("error", w), L.end(); - function M(l) { - l.upgrade = !0; + d.localAddress && (M.localAddress = d.localAddress), M.proxyAuth && (M.headers = M.headers || {}, M.headers["Proxy-Authorization"] = "Basic " + new Buffer(M.proxyAuth).toString("base64")), h("making CONNECT request"); + var L = b.request(M); + L.useChunkedEncodingByDefault = !1, L.once("response", N), L.once("upgrade", f), L.once("connect", E), L.once("error", p), L.end(); + function N(g) { + g.upgrade = !0; } - function d(l, B, p) { + function f(g, C, w) { process.nextTick(function() { - Q(l, B, p); + E(g, C, w); }); } - function Q(l, B, p) { - if (L.removeAllListeners(), B.removeAllListeners(), l.statusCode !== 200) { - E( + function E(g, C, w) { + if (L.removeAllListeners(), C.removeAllListeners(), g.statusCode !== 200) { + h( "tunneling socket could not be established, statusCode=%d", - l.statusCode - ), B.destroy(); - var I = new Error("tunneling socket could not be established, statusCode=" + l.statusCode); - I.code = "ECONNRESET", f.request.emit("error", I), b.removeSocket(R); + g.statusCode + ), C.destroy(); + var I = new Error("tunneling socket could not be established, statusCode=" + g.statusCode); + I.code = "ECONNRESET", d.request.emit("error", I), b.removeSocket(F); return; } - if (p.length > 0) { - E("got illegal response body from proxy"), B.destroy(); + if (w.length > 0) { + h("got illegal response body from proxy"), C.destroy(); var I = new Error("got illegal response body from proxy"); - I.code = "ECONNRESET", f.request.emit("error", I), b.removeSocket(R); + I.code = "ECONNRESET", d.request.emit("error", I), b.removeSocket(F); return; } - return E("tunneling connection has established"), b.sockets[b.sockets.indexOf(R)] = B, y(B); + return h("tunneling connection has established"), b.sockets[b.sockets.indexOf(F)] = C, y(C); } - function w(l) { - L.removeAllListeners(), E( + function p(g) { + L.removeAllListeners(), h( `tunneling socket could not be established, cause=%s `, - l.message, - l.stack + g.message, + g.stack ); - var B = new Error("tunneling socket could not be established, cause=" + l.message); - B.code = "ECONNRESET", f.request.emit("error", B), b.removeSocket(R); + var C = new Error("tunneling socket could not be established, cause=" + g.message); + C.code = "ECONNRESET", d.request.emit("error", C), b.removeSocket(F); } - }, g.prototype.removeSocket = function(f) { - var y = this.sockets.indexOf(f); + }, l.prototype.removeSocket = function(d) { + var y = this.sockets.indexOf(d); if (y !== -1) { this.sockets.splice(y, 1); var b = this.requests.shift(); - b && this.createSocket(b, function(R) { - b.request.onSocket(R); + b && this.createSocket(b, function(F) { + b.request.onSocket(F); }); } }; - function i(C, f) { + function i(B, d) { var y = this; - g.prototype.createSocket.call(y, C, function(b) { - var R = C.request.getHeader("host"), S = h({}, y.options, { + l.prototype.createSocket.call(y, B, function(b) { + var F = B.request.getHeader("host"), M = Q({}, y.options, { socket: b, - servername: R ? R.replace(/:.*$/, "") : C.host - }), L = e.connect(0, S); - y.sockets[y.sockets.indexOf(b)] = L, f(L); + servername: F ? F.replace(/:.*$/, "") : B.host + }), L = e.connect(0, M); + y.sockets[y.sockets.indexOf(b)] = L, d(L); }); } - function c(C, f, y) { - return typeof C == "string" ? { - host: C, - port: f, + function c(B, d, y) { + return typeof B == "string" ? { + host: B, + port: d, localAddress: y - } : C; + } : B; } - function h(C) { - for (var f = 1, y = arguments.length; f < y; ++f) { - var b = arguments[f]; + function Q(B) { + for (var d = 1, y = arguments.length; d < y; ++d) { + var b = arguments[d]; if (typeof b == "object") - for (var R = Object.keys(b), S = 0, L = R.length; S < L; ++S) { - var M = R[S]; - b[M] !== void 0 && (C[M] = b[M]); + for (var F = Object.keys(b), M = 0, L = F.length; M < L; ++M) { + var N = F[M]; + b[N] !== void 0 && (B[N] = b[N]); } } - return C; + return B; } - var E; - return process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG) ? E = function() { - var C = Array.prototype.slice.call(arguments); - typeof C[0] == "string" ? C[0] = "TUNNEL: " + C[0] : C.unshift("TUNNEL:"), console.error.apply(console, C); - } : E = function() { - }, kt.debug = E, kt; + var h; + return process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG) ? h = function() { + var B = Array.prototype.slice.call(arguments); + typeof B[0] == "string" ? B[0] = "TUNNEL: " + B[0] : B.unshift("TUNNEL:"), console.error.apply(console, B); + } : h = function() { + }, Ft.debug = h, Ft; } var XA, Hn; function On() { @@ -349,7 +349,7 @@ function Ye() { [o] = !0; } const u = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_BODY_TIMEOUT"); - class g extends t { + class l extends t { constructor(J) { super(J), this.name = "BodyTimeoutError", this.message = J || "Body Timeout Error", this.code = "UND_ERR_BODY_TIMEOUT"; } @@ -368,25 +368,25 @@ function Ye() { } [i] = !0; } - const h = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_INVALID_ARG"); - class E extends t { + const Q = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_INVALID_ARG"); + class h extends t { constructor(J) { super(J), this.name = "InvalidArgumentError", this.message = J || "Invalid Argument Error", this.code = "UND_ERR_INVALID_ARG"; } static [Symbol.hasInstance](J) { - return J && J[h] === !0; + return J && J[Q] === !0; } - [h] = !0; + [Q] = !0; } - const C = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_INVALID_RETURN_VALUE"); - class f extends t { + const B = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_INVALID_RETURN_VALUE"); + class d extends t { constructor(J) { super(J), this.name = "InvalidReturnValueError", this.message = J || "Invalid Return Value Error", this.code = "UND_ERR_INVALID_RETURN_VALUE"; } static [Symbol.hasInstance](J) { - return J && J[C] === !0; + return J && J[B] === !0; } - [C] = !0; + [B] = !0; } const y = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_ABORT"); class b extends t { @@ -398,18 +398,18 @@ function Ye() { } [y] = !0; } - const R = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_ABORTED"); - class S extends b { + const F = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_ABORTED"); + class M extends b { constructor(J) { super(J), this.name = "AbortError", this.message = J || "Request aborted", this.code = "UND_ERR_ABORTED"; } static [Symbol.hasInstance](J) { - return J && J[R] === !0; + return J && J[F] === !0; } - [R] = !0; + [F] = !0; } const L = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_INFO"); - class M extends t { + class N extends t { constructor(J) { super(J), this.name = "InformationalError", this.message = J || "Request information", this.code = "UND_ERR_INFO"; } @@ -418,35 +418,35 @@ function Ye() { } [L] = !0; } - const d = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_REQ_CONTENT_LENGTH_MISMATCH"); - class Q extends t { + const f = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_REQ_CONTENT_LENGTH_MISMATCH"); + class E extends t { constructor(J) { super(J), this.name = "RequestContentLengthMismatchError", this.message = J || "Request body length does not match content-length header", this.code = "UND_ERR_REQ_CONTENT_LENGTH_MISMATCH"; } static [Symbol.hasInstance](J) { - return J && J[d] === !0; + return J && J[f] === !0; } - [d] = !0; + [f] = !0; } - const w = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_RES_CONTENT_LENGTH_MISMATCH"); - class l extends t { + const p = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_RES_CONTENT_LENGTH_MISMATCH"); + class g extends t { constructor(J) { super(J), this.name = "ResponseContentLengthMismatchError", this.message = J || "Response body length does not match content-length header", this.code = "UND_ERR_RES_CONTENT_LENGTH_MISMATCH"; } static [Symbol.hasInstance](J) { - return J && J[w] === !0; + return J && J[p] === !0; } - [w] = !0; + [p] = !0; } - const B = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_DESTROYED"); - class p extends t { + const C = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_DESTROYED"); + class w extends t { constructor(J) { super(J), this.name = "ClientDestroyedError", this.message = J || "The client is destroyed", this.code = "UND_ERR_DESTROYED"; } static [Symbol.hasInstance](J) { - return J && J[B] === !0; + return J && J[C] === !0; } - [B] = !0; + [C] = !0; } const I = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_CLOSED"); class m extends t { @@ -459,7 +459,7 @@ function Ye() { [I] = !0; } const D = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_SOCKET"); - class N extends t { + class U extends t { constructor(J, V) { super(J), this.name = "SocketError", this.message = J || "Socket error", this.code = "UND_ERR_SOCKET", this.socket = V; } @@ -468,15 +468,15 @@ function Ye() { } [D] = !0; } - const U = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_NOT_SUPPORTED"); + const S = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_NOT_SUPPORTED"); class G extends t { constructor(J) { super(J), this.name = "NotSupportedError", this.message = J || "Not supported error", this.code = "UND_ERR_NOT_SUPPORTED"; } static [Symbol.hasInstance](J) { - return J && J[U] === !0; + return J && J[S] === !0; } - [U] = !0; + [S] = !0; } const v = /* @__PURE__ */ Symbol.for("undici.error.UND_ERR_BPL_MISSING_UPSTREAM"); class $ extends t { @@ -544,19 +544,19 @@ function Ye() { UndiciError: t, HeadersTimeoutError: n, HeadersOverflowError: a, - BodyTimeoutError: g, - RequestContentLengthMismatchError: Q, + BodyTimeoutError: l, + RequestContentLengthMismatchError: E, ConnectTimeoutError: s, ResponseStatusCodeError: c, - InvalidArgumentError: E, - InvalidReturnValueError: f, - RequestAbortedError: S, - ClientDestroyedError: p, + InvalidArgumentError: h, + InvalidReturnValueError: d, + RequestAbortedError: M, + ClientDestroyedError: w, ClientClosedError: m, - InformationalError: M, - SocketError: N, + InformationalError: N, + SocketError: U, NotSupportedError: G, - ResponseContentLengthMismatchError: l, + ResponseContentLengthMismatchError: g, BalancedPoolMissingUpstreamError: $, ResponseExceededMaxSizeError: Be, RequestRetryError: Qe, @@ -713,32 +713,32 @@ function lg() { const u = o.length; if (u === 0) throw new TypeError("Unreachable"); - let g = 0, i = this; + let l = 0, i = this; for (; ; ) { - const c = o.charCodeAt(g); + const c = o.charCodeAt(l); if (c > 127) throw new TypeError("key must be ascii string"); if (i.code === c) - if (u === ++g) { + if (u === ++l) { i.value = a; break; } else if (i.middle !== null) i = i.middle; else { - i.middle = new A(o, a, g); + i.middle = new A(o, a, l); break; } else if (i.code < c) if (i.left !== null) i = i.left; else { - i.left = new A(o, a, g); + i.left = new A(o, a, l); break; } else if (i.right !== null) i = i.right; else { - i.right = new A(o, a, g); + i.right = new A(o, a, l); break; } } @@ -749,17 +749,17 @@ function lg() { */ search(o) { const a = o.length; - let u = 0, g = this; - for (; g !== null && u < a; ) { + let u = 0, l = this; + for (; l !== null && u < a; ) { let i = o[u]; - for (i <= 90 && i >= 65 && (i |= 32); g !== null; ) { - if (i === g.code) { + for (i <= 90 && i >= 65 && (i |= 32); l !== null; ) { + if (i === l.code) { if (a === ++u) - return g; - g = g.middle; + return l; + l = l.middle; break; } - g = g.code < i ? g.left : g.right; + l = l.code < i ? l.left : l.right; } } return null; @@ -797,7 +797,7 @@ var sr, Wn; function Ue() { if (Wn) return sr; Wn = 1; - const e = He, { kDestroyed: t, kBodyUsed: A, kListeners: s, kBody: r } = Ve(), { IncomingMessage: n } = fA, o = ot, a = dA, { Blob: u } = at, g = rt, { stringify: i } = Wc, { EventEmitter: c } = Vt, { InvalidArgumentError: h } = Ye(), { headerNameLowerCasedRecord: E } = Ar(), { tree: C } = lg(), [f, y] = process.versions.node.split(".").map((k) => Number(k)); + const e = He, { kDestroyed: t, kBodyUsed: A, kListeners: s, kBody: r } = Ve(), { IncomingMessage: n } = fA, o = ot, a = dA, { Blob: u } = at, l = rt, { stringify: i } = Wc, { EventEmitter: c } = Wt, { InvalidArgumentError: Q } = Ye(), { headerNameLowerCasedRecord: h } = Ar(), { tree: B } = lg(), [d, y] = process.versions.node.split(".").map((R) => Number(R)); class b { constructor(q) { this[r] = q, this[A] = !1; @@ -806,206 +806,206 @@ function Ue() { e(!this[A], "disturbed"), this[A] = !0, yield* this[r]; } } - function R(k) { - return L(k) ? (U(k) === 0 && k.on("data", function() { + function F(R) { + return L(R) ? (S(R) === 0 && R.on("data", function() { e(!1); - }), typeof k.readableDidRead != "boolean" && (k[A] = !1, c.prototype.on.call(k, "data", function() { + }), typeof R.readableDidRead != "boolean" && (R[A] = !1, c.prototype.on.call(R, "data", function() { this[A] = !0; - })), k) : k && typeof k.pipeTo == "function" ? new b(k) : k && typeof k != "string" && !ArrayBuffer.isView(k) && N(k) ? new b(k) : k; + })), R) : R && typeof R.pipeTo == "function" ? new b(R) : R && typeof R != "string" && !ArrayBuffer.isView(R) && U(R) ? new b(R) : R; } - function S() { + function M() { } - function L(k) { - return k && typeof k == "object" && typeof k.pipe == "function" && typeof k.on == "function"; + function L(R) { + return R && typeof R == "object" && typeof R.pipe == "function" && typeof R.on == "function"; } - function M(k) { - if (k === null) + function N(R) { + if (R === null) return !1; - if (k instanceof u) + if (R instanceof u) return !0; - if (typeof k != "object") + if (typeof R != "object") return !1; { - const q = k[Symbol.toStringTag]; - return (q === "Blob" || q === "File") && ("stream" in k && typeof k.stream == "function" || "arrayBuffer" in k && typeof k.arrayBuffer == "function"); + const q = R[Symbol.toStringTag]; + return (q === "Blob" || q === "File") && ("stream" in R && typeof R.stream == "function" || "arrayBuffer" in R && typeof R.arrayBuffer == "function"); } } - function d(k, q) { - if (k.includes("?") || k.includes("#")) + function f(R, q) { + if (R.includes("?") || R.includes("#")) throw new Error('Query params cannot be passed when url already contains "?" or "#".'); const ie = i(q); - return ie && (k += "?" + ie), k; - } - function Q(k) { - const q = parseInt(k, 10); - return q === Number(k) && q >= 0 && q <= 65535; - } - function w(k) { - return k != null && k[0] === "h" && k[1] === "t" && k[2] === "t" && k[3] === "p" && (k[4] === ":" || k[4] === "s" && k[5] === ":"); - } - function l(k) { - if (typeof k == "string") { - if (k = new URL(k), !w(k.origin || k.protocol)) - throw new h("Invalid URL protocol: the URL must start with `http:` or `https:`."); - return k; - } - if (!k || typeof k != "object") - throw new h("Invalid URL: The URL argument must be a non-null object."); - if (!(k instanceof URL)) { - if (k.port != null && k.port !== "" && Q(k.port) === !1) - throw new h("Invalid URL: port must be a valid integer or a string representation of an integer."); - if (k.path != null && typeof k.path != "string") - throw new h("Invalid URL path: the path must be a string or null/undefined."); - if (k.pathname != null && typeof k.pathname != "string") - throw new h("Invalid URL pathname: the pathname must be a string or null/undefined."); - if (k.hostname != null && typeof k.hostname != "string") - throw new h("Invalid URL hostname: the hostname must be a string or null/undefined."); - if (k.origin != null && typeof k.origin != "string") - throw new h("Invalid URL origin: the origin must be a string or null/undefined."); - if (!w(k.origin || k.protocol)) - throw new h("Invalid URL protocol: the URL must start with `http:` or `https:`."); - const q = k.port != null ? k.port : k.protocol === "https:" ? 443 : 80; - let ie = k.origin != null ? k.origin : `${k.protocol || ""}//${k.hostname || ""}:${q}`, ue = k.path != null ? k.path : `${k.pathname || ""}${k.search || ""}`; + return ie && (R += "?" + ie), R; + } + function E(R) { + const q = parseInt(R, 10); + return q === Number(R) && q >= 0 && q <= 65535; + } + function p(R) { + return R != null && R[0] === "h" && R[1] === "t" && R[2] === "t" && R[3] === "p" && (R[4] === ":" || R[4] === "s" && R[5] === ":"); + } + function g(R) { + if (typeof R == "string") { + if (R = new URL(R), !p(R.origin || R.protocol)) + throw new Q("Invalid URL protocol: the URL must start with `http:` or `https:`."); + return R; + } + if (!R || typeof R != "object") + throw new Q("Invalid URL: The URL argument must be a non-null object."); + if (!(R instanceof URL)) { + if (R.port != null && R.port !== "" && E(R.port) === !1) + throw new Q("Invalid URL: port must be a valid integer or a string representation of an integer."); + if (R.path != null && typeof R.path != "string") + throw new Q("Invalid URL path: the path must be a string or null/undefined."); + if (R.pathname != null && typeof R.pathname != "string") + throw new Q("Invalid URL pathname: the pathname must be a string or null/undefined."); + if (R.hostname != null && typeof R.hostname != "string") + throw new Q("Invalid URL hostname: the hostname must be a string or null/undefined."); + if (R.origin != null && typeof R.origin != "string") + throw new Q("Invalid URL origin: the origin must be a string or null/undefined."); + if (!p(R.origin || R.protocol)) + throw new Q("Invalid URL protocol: the URL must start with `http:` or `https:`."); + const q = R.port != null ? R.port : R.protocol === "https:" ? 443 : 80; + let ie = R.origin != null ? R.origin : `${R.protocol || ""}//${R.hostname || ""}:${q}`, ue = R.path != null ? R.path : `${R.pathname || ""}${R.search || ""}`; return ie[ie.length - 1] === "/" && (ie = ie.slice(0, ie.length - 1)), ue && ue[0] !== "/" && (ue = `/${ue}`), new URL(`${ie}${ue}`); } - if (!w(k.origin || k.protocol)) - throw new h("Invalid URL protocol: the URL must start with `http:` or `https:`."); - return k; + if (!p(R.origin || R.protocol)) + throw new Q("Invalid URL protocol: the URL must start with `http:` or `https:`."); + return R; } - function B(k) { - if (k = l(k), k.pathname !== "/" || k.search || k.hash) - throw new h("invalid url"); - return k; + function C(R) { + if (R = g(R), R.pathname !== "/" || R.search || R.hash) + throw new Q("invalid url"); + return R; } - function p(k) { - if (k[0] === "[") { - const ie = k.indexOf("]"); - return e(ie !== -1), k.substring(1, ie); + function w(R) { + if (R[0] === "[") { + const ie = R.indexOf("]"); + return e(ie !== -1), R.substring(1, ie); } - const q = k.indexOf(":"); - return q === -1 ? k : k.substring(0, q); + const q = R.indexOf(":"); + return q === -1 ? R : R.substring(0, q); } - function I(k) { - if (!k) + function I(R) { + if (!R) return null; - e(typeof k == "string"); - const q = p(k); + e(typeof R == "string"); + const q = w(R); return a.isIP(q) ? "" : q; } - function m(k) { - return JSON.parse(JSON.stringify(k)); + function m(R) { + return JSON.parse(JSON.stringify(R)); } - function D(k) { - return k != null && typeof k[Symbol.asyncIterator] == "function"; + function D(R) { + return R != null && typeof R[Symbol.asyncIterator] == "function"; } - function N(k) { - return k != null && (typeof k[Symbol.iterator] == "function" || typeof k[Symbol.asyncIterator] == "function"); + function U(R) { + return R != null && (typeof R[Symbol.iterator] == "function" || typeof R[Symbol.asyncIterator] == "function"); } - function U(k) { - if (k == null) + function S(R) { + if (R == null) return 0; - if (L(k)) { - const q = k._readableState; + if (L(R)) { + const q = R._readableState; return q && q.objectMode === !1 && q.ended === !0 && Number.isFinite(q.length) ? q.length : null; } else { - if (M(k)) - return k.size != null ? k.size : null; - if (Qe(k)) - return k.byteLength; + if (N(R)) + return R.size != null ? R.size : null; + if (Qe(R)) + return R.byteLength; } return null; } - function G(k) { - return k && !!(k.destroyed || k[t] || o.isDestroyed?.(k)); + function G(R) { + return R && !!(R.destroyed || R[t] || o.isDestroyed?.(R)); } - function v(k, q) { - k == null || !L(k) || G(k) || (typeof k.destroy == "function" ? (Object.getPrototypeOf(k).constructor === n && (k.socket = null), k.destroy(q)) : q && queueMicrotask(() => { - k.emit("error", q); - }), k.destroyed !== !0 && (k[t] = !0)); + function v(R, q) { + R == null || !L(R) || G(R) || (typeof R.destroy == "function" ? (Object.getPrototypeOf(R).constructor === n && (R.socket = null), R.destroy(q)) : q && queueMicrotask(() => { + R.emit("error", q); + }), R.destroyed !== !0 && (R[t] = !0)); } const $ = /timeout=(\d+)/; - function ne(k) { - const q = k.toString().match($); + function ne(R) { + const q = R.toString().match($); return q ? parseInt(q[1], 10) * 1e3 : null; } - function ge(k) { - return typeof k == "string" ? E[k] ?? k.toLowerCase() : C.lookup(k) ?? k.toString("latin1").toLowerCase(); + function ge(R) { + return typeof R == "string" ? h[R] ?? R.toLowerCase() : B.lookup(R) ?? R.toString("latin1").toLowerCase(); } - function ae(k) { - return C.lookup(k) ?? k.toString("latin1").toLowerCase(); + function ae(R) { + return B.lookup(R) ?? R.toString("latin1").toLowerCase(); } - function Be(k, q) { + function Be(R, q) { q === void 0 && (q = {}); - for (let ie = 0; ie < k.length; ie += 2) { - const ue = ge(k[ie]); + for (let ie = 0; ie < R.length; ie += 2) { + const ue = ge(R[ie]); let Ce = q[ue]; if (Ce) - typeof Ce == "string" && (Ce = [Ce], q[ue] = Ce), Ce.push(k[ie + 1].toString("utf8")); + typeof Ce == "string" && (Ce = [Ce], q[ue] = Ce), Ce.push(R[ie + 1].toString("utf8")); else { - const De = k[ie + 1]; + const De = R[ie + 1]; typeof De == "string" ? q[ue] = De : q[ue] = Array.isArray(De) ? De.map((ve) => ve.toString("utf8")) : De.toString("utf8"); } } return "content-length" in q && "content-disposition" in q && (q["content-disposition"] = Buffer.from(q["content-disposition"]).toString("latin1")), q; } - function he(k) { - const q = k.length, ie = new Array(q); + function he(R) { + const q = R.length, ie = new Array(q); let ue = !1, Ce = -1, De, ve, ze = 0; - for (let Ke = 0; Ke < k.length; Ke += 2) - De = k[Ke], ve = k[Ke + 1], typeof De != "string" && (De = De.toString()), typeof ve != "string" && (ve = ve.toString("utf8")), ze = De.length, ze === 14 && De[7] === "-" && (De === "content-length" || De.toLowerCase() === "content-length") ? ue = !0 : ze === 19 && De[7] === "-" && (De === "content-disposition" || De.toLowerCase() === "content-disposition") && (Ce = Ke + 1), ie[Ke] = De, ie[Ke + 1] = ve; + for (let Ke = 0; Ke < R.length; Ke += 2) + De = R[Ke], ve = R[Ke + 1], typeof De != "string" && (De = De.toString()), typeof ve != "string" && (ve = ve.toString("utf8")), ze = De.length, ze === 14 && De[7] === "-" && (De === "content-length" || De.toLowerCase() === "content-length") ? ue = !0 : ze === 19 && De[7] === "-" && (De === "content-disposition" || De.toLowerCase() === "content-disposition") && (Ce = Ke + 1), ie[Ke] = De, ie[Ke + 1] = ve; return ue && Ce !== -1 && (ie[Ce] = Buffer.from(ie[Ce]).toString("latin1")), ie; } - function Qe(k) { - return k instanceof Uint8Array || Buffer.isBuffer(k); - } - function ye(k, q, ie) { - if (!k || typeof k != "object") - throw new h("handler must be an object"); - if (typeof k.onConnect != "function") - throw new h("invalid onConnect method"); - if (typeof k.onError != "function") - throw new h("invalid onError method"); - if (typeof k.onBodySent != "function" && k.onBodySent !== void 0) - throw new h("invalid onBodySent method"); + function Qe(R) { + return R instanceof Uint8Array || Buffer.isBuffer(R); + } + function ye(R, q, ie) { + if (!R || typeof R != "object") + throw new Q("handler must be an object"); + if (typeof R.onConnect != "function") + throw new Q("invalid onConnect method"); + if (typeof R.onError != "function") + throw new Q("invalid onError method"); + if (typeof R.onBodySent != "function" && R.onBodySent !== void 0) + throw new Q("invalid onBodySent method"); if (ie || q === "CONNECT") { - if (typeof k.onUpgrade != "function") - throw new h("invalid onUpgrade method"); + if (typeof R.onUpgrade != "function") + throw new Q("invalid onUpgrade method"); } else { - if (typeof k.onHeaders != "function") - throw new h("invalid onHeaders method"); - if (typeof k.onData != "function") - throw new h("invalid onData method"); - if (typeof k.onComplete != "function") - throw new h("invalid onComplete method"); + if (typeof R.onHeaders != "function") + throw new Q("invalid onHeaders method"); + if (typeof R.onData != "function") + throw new Q("invalid onData method"); + if (typeof R.onComplete != "function") + throw new Q("invalid onComplete method"); } } - function we(k) { - return !!(k && (o.isDisturbed(k) || k[A])); + function we(R) { + return !!(R && (o.isDisturbed(R) || R[A])); } - function X(k) { - return !!(k && o.isErrored(k)); + function X(R) { + return !!(R && o.isErrored(R)); } - function W(k) { - return !!(k && o.isReadable(k)); + function W(R) { + return !!(R && o.isReadable(R)); } - function re(k) { + function re(R) { return { - localAddress: k.localAddress, - localPort: k.localPort, - remoteAddress: k.remoteAddress, - remotePort: k.remotePort, - remoteFamily: k.remoteFamily, - timeout: k.timeout, - bytesWritten: k.bytesWritten, - bytesRead: k.bytesRead + localAddress: R.localAddress, + localPort: R.localPort, + remoteAddress: R.remoteAddress, + remotePort: R.remotePort, + remoteFamily: R.remoteFamily, + timeout: R.timeout, + bytesWritten: R.bytesWritten, + bytesRead: R.bytesRead }; } - function J(k) { + function J(R) { let q; return new ReadableStream( { async start() { - q = k[Symbol.asyncIterator](); + q = R[Symbol.asyncIterator](); }, async pull(ie) { const { done: ue, value: Ce } = await q.next(); @@ -1026,21 +1026,21 @@ function Ue() { } ); } - function V(k) { - return k && typeof k == "object" && typeof k.append == "function" && typeof k.delete == "function" && typeof k.get == "function" && typeof k.getAll == "function" && typeof k.has == "function" && typeof k.set == "function" && k[Symbol.toStringTag] === "FormData"; + function V(R) { + return R && typeof R == "object" && typeof R.append == "function" && typeof R.delete == "function" && typeof R.get == "function" && typeof R.getAll == "function" && typeof R.has == "function" && typeof R.set == "function" && R[Symbol.toStringTag] === "FormData"; } - function P(k, q) { - return "addEventListener" in k ? (k.addEventListener("abort", q, { once: !0 }), () => k.removeEventListener("abort", q)) : (k.addListener("abort", q), () => k.removeListener("abort", q)); + function P(R, q) { + return "addEventListener" in R ? (R.addEventListener("abort", q, { once: !0 }), () => R.removeEventListener("abort", q)) : (R.addListener("abort", q), () => R.removeListener("abort", q)); } const Z = typeof String.prototype.toWellFormed == "function", se = typeof String.prototype.isWellFormed == "function"; - function le(k) { - return Z ? `${k}`.toWellFormed() : g.toUSVString(k); + function le(R) { + return Z ? `${R}`.toWellFormed() : l.toUSVString(R); } - function oe(k) { - return se ? `${k}`.isWellFormed() : le(k) === `${k}`; + function oe(R) { + return se ? `${R}`.isWellFormed() : le(R) === `${R}`; } - function fe(k) { - switch (k) { + function fe(R) { + switch (R) { case 34: case 40: case 41: @@ -1060,43 +1060,43 @@ function Ue() { case 125: return !1; default: - return k >= 33 && k <= 126; + return R >= 33 && R <= 126; } } - function Me(k) { - if (k.length === 0) + function Me(R) { + if (R.length === 0) return !1; - for (let q = 0; q < k.length; ++q) - if (!fe(k.charCodeAt(q))) + for (let q = 0; q < R.length; ++q) + if (!fe(R.charCodeAt(q))) return !1; return !0; } const pe = /[^\t\x20-\x7e\x80-\xff]/; - function Le(k) { - return !pe.test(k); + function Le(R) { + return !pe.test(R); } - function Re(k) { - if (k == null || k === "") return { start: 0, end: null, size: null }; - const q = k ? k.match(/^bytes (\d+)-(\d+)\/(\d+)?$/) : null; + function Re(R) { + if (R == null || R === "") return { start: 0, end: null, size: null }; + const q = R ? R.match(/^bytes (\d+)-(\d+)\/(\d+)?$/) : null; return q ? { start: parseInt(q[1]), end: q[2] ? parseInt(q[2]) : null, size: q[3] ? parseInt(q[3]) : null } : null; } - function ke(k, q, ie) { - return (k[s] ??= []).push([q, ie]), k.on(q, ie), k; + function ke(R, q, ie) { + return (R[s] ??= []).push([q, ie]), R.on(q, ie), R; } - function de(k) { - for (const [q, ie] of k[s] ?? []) - k.removeListener(q, ie); - k[s] = null; + function de(R) { + for (const [q, ie] of R[s] ?? []) + R.removeListener(q, ie); + R[s] = null; } - function We(k, q, ie) { + function We(R, q, ie) { try { q.onError(ie), e(q.aborted); } catch (ue) { - k.emit("error", ue); + R.emit("error", ue); } } const _e = /* @__PURE__ */ Object.create(null); @@ -1121,18 +1121,18 @@ function Ue() { }; return Object.setPrototypeOf(Je, null), Object.setPrototypeOf(j, null), sr = { kEnumerableProperty: _e, - nop: S, + nop: M, isDisturbed: we, isErrored: X, isReadable: W, toUSVString: le, isUSVString: oe, - isBlobLike: M, - parseOrigin: B, - parseURL: l, + isBlobLike: N, + parseOrigin: C, + parseURL: g, getServerName: I, isStream: L, - isIterable: N, + isIterable: U, isAsyncIterable: D, isDestroyed: G, headerNameToString: ge, @@ -1144,14 +1144,14 @@ function Ue() { parseHeaders: Be, parseKeepAliveTimeout: ne, destroy: v, - bodyLength: U, + bodyLength: S, deepClone: m, ReadableStreamFrom: J, isBuffer: Qe, validateHandler: ye, getSocketInfo: re, isFormDataLike: V, - buildURL: d, + buildURL: f, addAbortListener: P, isValidHTTPToken: Me, isValidHeaderValue: Le, @@ -1159,16 +1159,16 @@ function Ue() { parseRangeHeader: Re, normalizedMethodRecordsBase: Je, normalizedMethodRecords: j, - isValidPort: Q, - isHttpOrHttpsPrefixed: w, - nodeMajor: f, + isValidPort: E, + isHttpOrHttpsPrefixed: p, + nodeMajor: d, nodeMinor: y, safeHTTPMethods: ["GET", "HEAD", "OPTIONS", "TRACE"], - wrapRequestBody: R + wrapRequestBody: F }, sr; } var nr, qn; -function Zt() { +function Kt() { if (qn) return nr; qn = 1; const e = qc, t = rt, A = t.debuglog("undici"), s = t.debuglog("fetch"), r = t.debuglog("websocket"); @@ -1196,69 +1196,69 @@ function Zt() { const a = s.enabled ? s : A; e.channel("undici:client:beforeConnect").subscribe((u) => { const { - connectParams: { version: g, protocol: i, port: c, host: h } + connectParams: { version: l, protocol: i, port: c, host: Q } } = u; a( "connecting to %s using %s%s", - `${h}${c ? `:${c}` : ""}`, + `${Q}${c ? `:${c}` : ""}`, i, - g + l ); }), e.channel("undici:client:connected").subscribe((u) => { const { - connectParams: { version: g, protocol: i, port: c, host: h } + connectParams: { version: l, protocol: i, port: c, host: Q } } = u; a( "connected to %s using %s%s", - `${h}${c ? `:${c}` : ""}`, + `${Q}${c ? `:${c}` : ""}`, i, - g + l ); }), e.channel("undici:client:connectError").subscribe((u) => { const { - connectParams: { version: g, protocol: i, port: c, host: h }, - error: E + connectParams: { version: l, protocol: i, port: c, host: Q }, + error: h } = u; a( "connection to %s using %s%s errored - %s", - `${h}${c ? `:${c}` : ""}`, + `${Q}${c ? `:${c}` : ""}`, i, - g, - E.message + l, + h.message ); }), e.channel("undici:client:sendHeaders").subscribe((u) => { const { - request: { method: g, path: i, origin: c } + request: { method: l, path: i, origin: c } } = u; - a("sending request to %s %s/%s", g, c, i); + a("sending request to %s %s/%s", l, c, i); }), e.channel("undici:request:headers").subscribe((u) => { const { - request: { method: g, path: i, origin: c }, - response: { statusCode: h } + request: { method: l, path: i, origin: c }, + response: { statusCode: Q } } = u; a( "received response to %s %s/%s - HTTP %d", - g, + l, c, i, - h + Q ); }), e.channel("undici:request:trailers").subscribe((u) => { const { - request: { method: g, path: i, origin: c } + request: { method: l, path: i, origin: c } } = u; - a("trailers received from %s %s/%s", g, c, i); + a("trailers received from %s %s/%s", l, c, i); }), e.channel("undici:request:error").subscribe((u) => { const { - request: { method: g, path: i, origin: c }, - error: h + request: { method: l, path: i, origin: c }, + error: Q } = u; a( "request to %s %s/%s errored - %s", - g, + l, c, i, - h.message + Q.message ); }), n = !0; } @@ -1267,57 +1267,57 @@ function Zt() { const a = A.enabled ? A : r; e.channel("undici:client:beforeConnect").subscribe((u) => { const { - connectParams: { version: g, protocol: i, port: c, host: h } + connectParams: { version: l, protocol: i, port: c, host: Q } } = u; a( "connecting to %s%s using %s%s", - h, + Q, c ? `:${c}` : "", i, - g + l ); }), e.channel("undici:client:connected").subscribe((u) => { const { - connectParams: { version: g, protocol: i, port: c, host: h } + connectParams: { version: l, protocol: i, port: c, host: Q } } = u; a( "connected to %s%s using %s%s", - h, + Q, c ? `:${c}` : "", i, - g + l ); }), e.channel("undici:client:connectError").subscribe((u) => { const { - connectParams: { version: g, protocol: i, port: c, host: h }, - error: E + connectParams: { version: l, protocol: i, port: c, host: Q }, + error: h } = u; a( "connection to %s%s using %s%s errored - %s", - h, + Q, c ? `:${c}` : "", i, - g, - E.message + l, + h.message ); }), e.channel("undici:client:sendHeaders").subscribe((u) => { const { - request: { method: g, path: i, origin: c } + request: { method: l, path: i, origin: c } } = u; - a("sending request to %s %s/%s", g, c, i); + a("sending request to %s %s/%s", l, c, i); }); } e.channel("undici:websocket:open").subscribe((a) => { const { - address: { address: u, port: g } + address: { address: u, port: l } } = a; - r("connection opened %s%s", u, g ? `:${g}` : ""); + r("connection opened %s%s", u, l ? `:${l}` : ""); }), e.channel("undici:websocket:close").subscribe((a) => { - const { websocket: u, code: g, reason: i } = a; + const { websocket: u, code: l, reason: i } = a; r( "closed connection to %s - %s %s", u.url, - g, + l, i ); }), e.channel("undici:websocket:socket_error").subscribe((a) => { @@ -1346,214 +1346,214 @@ function ug() { destroy: o, isBuffer: a, isFormDataLike: u, - isIterable: g, + isIterable: l, isBlobLike: i, buildURL: c, - validateHandler: h, - getServerName: E, - normalizedMethodRecords: C - } = Ue(), { channels: f } = Zt(), { headerNameLowerCasedRecord: y } = Ar(), b = /[^\u0021-\u00ff]/, R = /* @__PURE__ */ Symbol("handler"); - class S { - constructor(d, { - path: Q, - method: w, - body: l, - headers: B, - query: p, + validateHandler: Q, + getServerName: h, + normalizedMethodRecords: B + } = Ue(), { channels: d } = Kt(), { headerNameLowerCasedRecord: y } = Ar(), b = /[^\u0021-\u00ff]/, F = /* @__PURE__ */ Symbol("handler"); + class M { + constructor(f, { + path: E, + method: p, + body: g, + headers: C, + query: w, idempotent: I, blocking: m, upgrade: D, - headersTimeout: N, - bodyTimeout: U, + headersTimeout: U, + bodyTimeout: S, reset: G, throwOnError: v, expectContinue: $, servername: ne }, ge) { - if (typeof Q != "string") + if (typeof E != "string") throw new e("path must be a string"); - if (Q[0] !== "/" && !(Q.startsWith("http://") || Q.startsWith("https://")) && w !== "CONNECT") + if (E[0] !== "/" && !(E.startsWith("http://") || E.startsWith("https://")) && p !== "CONNECT") throw new e("path must be an absolute URL or start with a slash"); - if (b.test(Q)) + if (b.test(E)) throw new e("invalid request path"); - if (typeof w != "string") + if (typeof p != "string") throw new e("method must be a string"); - if (C[w] === void 0 && !s(w)) + if (B[p] === void 0 && !s(p)) throw new e("invalid request method"); if (D && typeof D != "string") throw new e("upgrade must be a string"); - if (N != null && (!Number.isFinite(N) || N < 0)) - throw new e("invalid headersTimeout"); if (U != null && (!Number.isFinite(U) || U < 0)) + throw new e("invalid headersTimeout"); + if (S != null && (!Number.isFinite(S) || S < 0)) throw new e("invalid bodyTimeout"); if (G != null && typeof G != "boolean") throw new e("invalid reset"); if ($ != null && typeof $ != "boolean") throw new e("invalid expectContinue"); - if (this.headersTimeout = N, this.bodyTimeout = U, this.throwOnError = v === !0, this.method = w, this.abort = null, l == null) + if (this.headersTimeout = U, this.bodyTimeout = S, this.throwOnError = v === !0, this.method = p, this.abort = null, g == null) this.body = null; - else if (n(l)) { - this.body = l; + else if (n(g)) { + this.body = g; const ae = this.body._readableState; (!ae || !ae.autoDestroy) && (this.endHandler = function() { o(this); }, this.body.on("end", this.endHandler)), this.errorHandler = (Be) => { this.abort ? this.abort(Be) : this.error = Be; }, this.body.on("error", this.errorHandler); - } else if (a(l)) - this.body = l.byteLength ? l : null; - else if (ArrayBuffer.isView(l)) - this.body = l.buffer.byteLength ? Buffer.from(l.buffer, l.byteOffset, l.byteLength) : null; - else if (l instanceof ArrayBuffer) - this.body = l.byteLength ? Buffer.from(l) : null; - else if (typeof l == "string") - this.body = l.length ? Buffer.from(l) : null; - else if (u(l) || g(l) || i(l)) - this.body = l; + } else if (a(g)) + this.body = g.byteLength ? g : null; + else if (ArrayBuffer.isView(g)) + this.body = g.buffer.byteLength ? Buffer.from(g.buffer, g.byteOffset, g.byteLength) : null; + else if (g instanceof ArrayBuffer) + this.body = g.byteLength ? Buffer.from(g) : null; + else if (typeof g == "string") + this.body = g.length ? Buffer.from(g) : null; + else if (u(g) || l(g) || i(g)) + this.body = g; 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 = D || null, this.path = p ? c(Q, p) : Q, this.origin = d, this.idempotent = I ?? (w === "HEAD" || w === "GET"), this.blocking = m ?? !1, this.reset = G ?? null, this.host = null, this.contentLength = null, this.contentType = null, this.headers = [], this.expectContinue = $ ?? !1, Array.isArray(B)) { - if (B.length % 2 !== 0) + if (this.completed = !1, this.aborted = !1, this.upgrade = D || null, this.path = w ? c(E, w) : E, this.origin = f, this.idempotent = I ?? (p === "HEAD" || p === "GET"), this.blocking = m ?? !1, this.reset = G ?? null, this.host = null, this.contentLength = null, this.contentType = null, this.headers = [], this.expectContinue = $ ?? !1, Array.isArray(C)) { + if (C.length % 2 !== 0) throw new e("headers array must be even"); - for (let ae = 0; ae < B.length; ae += 2) - L(this, B[ae], B[ae + 1]); - } else if (B && typeof B == "object") - if (B[Symbol.iterator]) - for (const ae of B) { + for (let ae = 0; ae < C.length; ae += 2) + L(this, C[ae], C[ae + 1]); + } else if (C && typeof C == "object") + if (C[Symbol.iterator]) + for (const ae of C) { if (!Array.isArray(ae) || ae.length !== 2) throw new e("headers must be in key-value pair format"); L(this, ae[0], ae[1]); } else { - const ae = Object.keys(B); + const ae = Object.keys(C); for (let Be = 0; Be < ae.length; ++Be) - L(this, ae[Be], B[ae[Be]]); + L(this, ae[Be], C[ae[Be]]); } - else if (B != null) + else if (C != null) throw new e("headers must be an object or an array"); - h(ge, w, D), this.servername = ne || E(this.host), this[R] = ge, f.create.hasSubscribers && f.create.publish({ request: this }); + Q(ge, p, D), this.servername = ne || h(this.host), this[F] = ge, d.create.hasSubscribers && d.create.publish({ request: this }); } - onBodySent(d) { - if (this[R].onBodySent) + onBodySent(f) { + if (this[F].onBodySent) try { - return this[R].onBodySent(d); - } catch (Q) { - this.abort(Q); + return this[F].onBodySent(f); + } catch (E) { + this.abort(E); } } onRequestSent() { - if (f.bodySent.hasSubscribers && f.bodySent.publish({ request: this }), this[R].onRequestSent) + if (d.bodySent.hasSubscribers && d.bodySent.publish({ request: this }), this[F].onRequestSent) try { - return this[R].onRequestSent(); - } catch (d) { - this.abort(d); + return this[F].onRequestSent(); + } catch (f) { + this.abort(f); } } - onConnect(d) { + onConnect(f) { if (A(!this.aborted), A(!this.completed), this.error) - d(this.error); + f(this.error); else - return this.abort = d, this[R].onConnect(d); + return this.abort = f, this[F].onConnect(f); } onResponseStarted() { - return this[R].onResponseStarted?.(); + return this[F].onResponseStarted?.(); } - onHeaders(d, Q, w, l) { - A(!this.aborted), A(!this.completed), f.headers.hasSubscribers && f.headers.publish({ request: this, response: { statusCode: d, headers: Q, statusText: l } }); + onHeaders(f, E, p, g) { + A(!this.aborted), A(!this.completed), d.headers.hasSubscribers && d.headers.publish({ request: this, response: { statusCode: f, headers: E, statusText: g } }); try { - return this[R].onHeaders(d, Q, w, l); - } catch (B) { - this.abort(B); + return this[F].onHeaders(f, E, p, g); + } catch (C) { + this.abort(C); } } - onData(d) { + onData(f) { A(!this.aborted), A(!this.completed); try { - return this[R].onData(d); - } catch (Q) { - return this.abort(Q), !1; + return this[F].onData(f); + } catch (E) { + return this.abort(E), !1; } } - onUpgrade(d, Q, w) { - return A(!this.aborted), A(!this.completed), this[R].onUpgrade(d, Q, w); + onUpgrade(f, E, p) { + return A(!this.aborted), A(!this.completed), this[F].onUpgrade(f, E, p); } - onComplete(d) { - this.onFinally(), A(!this.aborted), this.completed = !0, f.trailers.hasSubscribers && f.trailers.publish({ request: this, trailers: d }); + onComplete(f) { + this.onFinally(), A(!this.aborted), this.completed = !0, d.trailers.hasSubscribers && d.trailers.publish({ request: this, trailers: f }); try { - return this[R].onComplete(d); - } catch (Q) { - this.onError(Q); + return this[F].onComplete(f); + } catch (E) { + this.onError(E); } } - onError(d) { - if (this.onFinally(), f.error.hasSubscribers && f.error.publish({ request: this, error: d }), !this.aborted) - return this.aborted = !0, this[R].onError(d); + onError(f) { + if (this.onFinally(), d.error.hasSubscribers && d.error.publish({ request: this, error: f }), !this.aborted) + return this.aborted = !0, this[F].onError(f); } onFinally() { this.errorHandler && (this.body.off("error", this.errorHandler), this.errorHandler = null), this.endHandler && (this.body.off("end", this.endHandler), this.endHandler = null); } - addHeader(d, Q) { - return L(this, d, Q), this; + addHeader(f, E) { + return L(this, f, E), this; } } - function L(M, d, Q) { - if (Q && typeof Q == "object" && !Array.isArray(Q)) - throw new e(`invalid ${d} header`); - if (Q === void 0) + function L(N, f, E) { + if (E && typeof E == "object" && !Array.isArray(E)) + throw new e(`invalid ${f} header`); + if (E === void 0) return; - let w = y[d]; - if (w === void 0 && (w = d.toLowerCase(), y[w] === void 0 && !s(w))) + let p = y[f]; + if (p === void 0 && (p = f.toLowerCase(), y[p] === void 0 && !s(p))) throw new e("invalid header key"); - if (Array.isArray(Q)) { - const l = []; - for (let B = 0; B < Q.length; B++) - if (typeof Q[B] == "string") { - if (!r(Q[B])) - throw new e(`invalid ${d} header`); - l.push(Q[B]); - } else if (Q[B] === null) - l.push(""); + if (Array.isArray(E)) { + const g = []; + for (let C = 0; C < E.length; C++) + if (typeof E[C] == "string") { + if (!r(E[C])) + throw new e(`invalid ${f} header`); + g.push(E[C]); + } else if (E[C] === null) + g.push(""); else { - if (typeof Q[B] == "object") - throw new e(`invalid ${d} header`); - l.push(`${Q[B]}`); + if (typeof E[C] == "object") + throw new e(`invalid ${f} header`); + g.push(`${E[C]}`); } - Q = l; - } else if (typeof Q == "string") { - if (!r(Q)) - throw new e(`invalid ${d} header`); - } else Q === null ? Q = "" : Q = `${Q}`; - if (M.host === null && w === "host") { - if (typeof Q != "string") + E = g; + } else if (typeof E == "string") { + if (!r(E)) + throw new e(`invalid ${f} header`); + } else E === null ? E = "" : E = `${E}`; + if (N.host === null && p === "host") { + if (typeof E != "string") throw new e("invalid host header"); - M.host = Q; - } else if (M.contentLength === null && w === "content-length") { - if (M.contentLength = parseInt(Q, 10), !Number.isFinite(M.contentLength)) + N.host = E; + } else if (N.contentLength === null && p === "content-length") { + if (N.contentLength = parseInt(E, 10), !Number.isFinite(N.contentLength)) throw new e("invalid content-length header"); - } else if (M.contentType === null && w === "content-type") - M.contentType = Q, M.headers.push(d, Q); + } else if (N.contentType === null && p === "content-type") + N.contentType = E, N.headers.push(f, E); else { - if (w === "transfer-encoding" || w === "keep-alive" || w === "upgrade") - throw new e(`invalid ${w} header`); - if (w === "connection") { - const l = typeof Q == "string" ? Q.toLowerCase() : null; - if (l !== "close" && l !== "keep-alive") + if (p === "transfer-encoding" || p === "keep-alive" || p === "upgrade") + throw new e(`invalid ${p} header`); + if (p === "connection") { + const g = typeof E == "string" ? E.toLowerCase() : null; + if (g !== "close" && g !== "keep-alive") throw new e("invalid connection header"); - l === "close" && (M.reset = !0); + g === "close" && (N.reset = !0); } else { - if (w === "expect") + if (p === "expect") throw new t("expect header not supported"); - M.headers.push(d, Q); + N.headers.push(f, E); } } } - return or = S, or; + return or = M, or; } var ir, Zn; function wA() { if (Zn) return ir; Zn = 1; - const e = Vt; + const e = Wt; class t extends e { dispatch() { throw new Error("not implemented"); @@ -1596,15 +1596,15 @@ function wA() { return ir = t, ir; } var ar, Kn; -function Kt() { +function jt() { if (Kn) return ar; Kn = 1; const e = wA(), { ClientDestroyedError: t, ClientClosedError: A, InvalidArgumentError: s - } = Ye(), { kDestroy: r, kClose: n, kClosed: o, kDestroyed: a, kDispatch: u, kInterceptors: g } = Ve(), i = /* @__PURE__ */ Symbol("onDestroyed"), c = /* @__PURE__ */ Symbol("onClosed"), h = /* @__PURE__ */ Symbol("Intercepted Dispatch"); - class E extends e { + } = Ye(), { kDestroy: r, kClose: n, kClosed: o, kDestroyed: a, kDispatch: u, kInterceptors: l } = Ve(), i = /* @__PURE__ */ Symbol("onDestroyed"), c = /* @__PURE__ */ Symbol("onClosed"), Q = /* @__PURE__ */ Symbol("Intercepted Dispatch"); + class h extends e { constructor() { super(), this[a] = !1, this[i] = null, this[o] = !1, this[c] = []; } @@ -1615,49 +1615,49 @@ function Kt() { return this[o]; } get interceptors() { - return this[g]; + return this[l]; } - set interceptors(f) { - if (f) { - for (let y = f.length - 1; y >= 0; y--) - if (typeof this[g][y] != "function") + set interceptors(d) { + if (d) { + for (let y = d.length - 1; y >= 0; y--) + if (typeof this[l][y] != "function") throw new s("interceptor must be an function"); } - this[g] = f; + this[l] = d; } - close(f) { - if (f === void 0) - return new Promise((b, R) => { - this.close((S, L) => S ? R(S) : b(L)); + close(d) { + if (d === void 0) + return new Promise((b, F) => { + this.close((M, L) => M ? F(M) : b(L)); }); - if (typeof f != "function") + if (typeof d != "function") throw new s("invalid callback"); if (this[a]) { - queueMicrotask(() => f(new t(), null)); + queueMicrotask(() => d(new t(), null)); return; } if (this[o]) { - this[c] ? this[c].push(f) : queueMicrotask(() => f(null, null)); + this[c] ? this[c].push(d) : queueMicrotask(() => d(null, null)); return; } - this[o] = !0, this[c].push(f); + this[o] = !0, this[c].push(d); const y = () => { const b = this[c]; this[c] = null; - for (let R = 0; R < b.length; R++) - b[R](null, null); + for (let F = 0; F < b.length; F++) + b[F](null, null); }; this[n]().then(() => this.destroy()).then(() => { queueMicrotask(y); }); } - destroy(f, y) { - if (typeof f == "function" && (y = f, f = null), y === void 0) - return new Promise((R, S) => { - this.destroy(f, (L, M) => L ? ( + destroy(d, y) { + if (typeof d == "function" && (y = d, d = null), y === void 0) + return new Promise((F, M) => { + this.destroy(d, (L, N) => L ? ( /* istanbul ignore next: should never error */ - S(L) - ) : R(M)); + M(L) + ) : F(N)); }); if (typeof y != "function") throw new s("invalid callback"); @@ -1665,36 +1665,36 @@ function Kt() { this[i] ? this[i].push(y) : queueMicrotask(() => y(null, null)); return; } - f || (f = new t()), this[a] = !0, this[i] = this[i] || [], this[i].push(y); + d || (d = new t()), this[a] = !0, this[i] = this[i] || [], this[i].push(y); const b = () => { - const R = this[i]; + const F = this[i]; this[i] = null; - for (let S = 0; S < R.length; S++) - R[S](null, null); + for (let M = 0; M < F.length; M++) + F[M](null, null); }; - this[r](f).then(() => { + this[r](d).then(() => { queueMicrotask(b); }); } - [h](f, y) { - if (!this[g] || this[g].length === 0) - return this[h] = this[u], this[u](f, y); + [Q](d, y) { + if (!this[l] || this[l].length === 0) + return this[Q] = this[u], this[u](d, y); let b = this[u].bind(this); - for (let R = this[g].length - 1; R >= 0; R--) - b = this[g][R](b); - return this[h] = b, b(f, y); + for (let F = this[l].length - 1; F >= 0; F--) + b = this[l][F](b); + return this[Q] = b, b(d, y); } - dispatch(f, y) { + dispatch(d, y) { if (!y || typeof y != "object") throw new s("handler must be an object"); try { - if (!f || typeof f != "object") + if (!d || typeof d != "object") throw new s("opts must be an object."); if (this[a] || this[i]) throw new t(); if (this[o]) throw new A(); - return this[h](f, y); + return this[Q](d, y); } catch (b) { if (typeof y.onError != "function") throw new s("invalid onError method"); @@ -1702,7 +1702,7 @@ function Kt() { } } } - return ar = E, ar; + return ar = h, ar; } var cr, jn; function Xn() { @@ -1711,20 +1711,20 @@ function Xn() { let e = 0; const t = 1e3, A = (t >> 1) - 1; let s; - const r = /* @__PURE__ */ Symbol("kFastTimer"), n = [], o = -2, a = -1, u = 0, g = 1; + const r = /* @__PURE__ */ Symbol("kFastTimer"), n = [], o = -2, a = -1, u = 0, l = 1; function i() { e += A; - let E = 0, C = n.length; - for (; E < C; ) { - const f = n[E]; - f._state === u ? (f._idleStart = e - A, f._state = g) : f._state === g && e >= f._idleStart + f._idleTimeout && (f._state = a, f._idleStart = -1, f._onTimeout(f._timerArg)), f._state === a ? (f._state = o, --C !== 0 && (n[E] = n[C])) : ++E; + let h = 0, B = n.length; + for (; h < B; ) { + const d = n[h]; + d._state === u ? (d._idleStart = e - A, d._state = l) : d._state === l && e >= d._idleStart + d._idleTimeout && (d._state = a, d._idleStart = -1, d._onTimeout(d._timerArg)), d._state === a ? (d._state = o, --B !== 0 && (n[h] = n[B])) : ++h; } - n.length = C, n.length !== 0 && c(); + n.length = B, n.length !== 0 && c(); } function c() { s ? s.refresh() : (clearTimeout(s), s = setTimeout(i, A), s.unref && s.unref()); } - class h { + class Q { [r] = !0; /** * The state of the timer, which can be one of the following: @@ -1774,8 +1774,8 @@ function Xn() { * before the specified function or code is executed. * @param {*} arg */ - constructor(C, f, y) { - this._onTimeout = C, this._idleTimeout = f, this._timerArg = y, this.refresh(); + constructor(B, d, y) { + this._onTimeout = B, this._idleTimeout = d, this._timerArg = y, this.refresh(); } /** * Sets the timer's start time to the current time, and reschedules the timer @@ -1811,8 +1811,8 @@ function Xn() { * when the timer expires. * @returns {NodeJS.Timeout|FastTimer} */ - setTimeout(E, C, f) { - return C <= t ? setTimeout(E, C, f) : new h(E, C, f); + setTimeout(h, B, d) { + return B <= t ? setTimeout(h, B, d) : new Q(h, B, d); }, /** * The clearTimeout method cancels an instantiated Timer previously created @@ -1820,8 +1820,8 @@ function Xn() { * * @param {NodeJS.Timeout|FastTimer} timeout */ - clearTimeout(E) { - E[r] ? E.clear() : clearTimeout(E); + clearTimeout(h) { + h[r] ? h.clear() : clearTimeout(h); }, /** * The setFastTimeout() method sets a fastTimer which executes a function once @@ -1834,8 +1834,8 @@ function Xn() { * when the timer expires. * @returns {FastTimer} */ - setFastTimeout(E, C, f) { - return new h(E, C, f); + setFastTimeout(h, B, d) { + return new Q(h, B, d); }, /** * The clearTimeout method cancels an instantiated FastTimer previously @@ -1843,8 +1843,8 @@ function Xn() { * * @param {FastTimer} timeout */ - clearFastTimeout(E) { - E.clear(); + clearFastTimeout(h) { + h.clear(); }, /** * The now method returns the value of the internal fast timer clock. @@ -1861,8 +1861,8 @@ function Xn() { * @deprecated * @param {number} [delay=0] The delay in milliseconds to add to the now value. */ - tick(E = 0) { - e += E - t + 1, i(), i(); + tick(h = 0) { + e += h - t + 1, i(), i(); }, /** * Reset FastTimers. @@ -1890,129 +1890,129 @@ function mA() { } let a, u; Yn.FinalizationRegistry && !(process.env.NODE_V8_COVERAGE || process.env.UNDICI_NO_FG) ? u = class { - constructor(E) { - this._maxCachedSessions = E, this._sessionCache = /* @__PURE__ */ new Map(), this._sessionRegistry = new Yn.FinalizationRegistry((C) => { + constructor(h) { + this._maxCachedSessions = h, this._sessionCache = /* @__PURE__ */ new Map(), this._sessionRegistry = new Yn.FinalizationRegistry((B) => { if (this._sessionCache.size < this._maxCachedSessions) return; - const f = this._sessionCache.get(C); - f !== void 0 && f.deref() === void 0 && this._sessionCache.delete(C); + const d = this._sessionCache.get(B); + d !== void 0 && d.deref() === void 0 && this._sessionCache.delete(B); }); } - get(E) { - const C = this._sessionCache.get(E); - return C ? C.deref() : null; + get(h) { + const B = this._sessionCache.get(h); + return B ? B.deref() : null; } - set(E, C) { - this._maxCachedSessions !== 0 && (this._sessionCache.set(E, new WeakRef(C)), this._sessionRegistry.register(C, E)); + set(h, B) { + this._maxCachedSessions !== 0 && (this._sessionCache.set(h, new WeakRef(B)), this._sessionRegistry.register(B, h)); } } : u = class { - constructor(E) { - this._maxCachedSessions = E, this._sessionCache = /* @__PURE__ */ new Map(); + constructor(h) { + this._maxCachedSessions = h, this._sessionCache = /* @__PURE__ */ new Map(); } - get(E) { - return this._sessionCache.get(E); + get(h) { + return this._sessionCache.get(h); } - set(E, C) { + set(h, B) { if (this._maxCachedSessions !== 0) { if (this._sessionCache.size >= this._maxCachedSessions) { - const { value: f } = this._sessionCache.keys().next(); - this._sessionCache.delete(f); + const { value: d } = this._sessionCache.keys().next(); + this._sessionCache.delete(d); } - this._sessionCache.set(E, C); + this._sessionCache.set(h, B); } } }; - function g({ allowH2: h, maxCachedSessions: E, socketPath: C, timeout: f, session: y, ...b }) { - if (E != null && (!Number.isInteger(E) || E < 0)) + function l({ allowH2: Q, maxCachedSessions: h, socketPath: B, timeout: d, session: y, ...b }) { + if (h != null && (!Number.isInteger(h) || h < 0)) throw new s("maxCachedSessions must be a positive integer or zero"); - const R = { path: C, ...b }, S = new u(E ?? 100); - return f = f ?? 1e4, h = h ?? !1, function({ hostname: M, host: d, protocol: Q, port: w, servername: l, localAddress: B, httpSocket: p }, I) { + const F = { path: B, ...b }, M = new u(h ?? 100); + return d = d ?? 1e4, Q = Q ?? !1, function({ hostname: N, host: f, protocol: E, port: p, servername: g, localAddress: C, httpSocket: w }, I) { let m; - if (Q === "https:") { - a || (a = zc), l = l || R.servername || A.getServerName(d) || null; - const N = l || M; - t(N); - const U = y || S.get(N) || null; - w = w || 443, m = a.connect({ + if (E === "https:") { + a || (a = zc), g = g || F.servername || A.getServerName(f) || null; + const U = g || N; + t(U); + const S = y || M.get(U) || null; + p = p || 443, m = a.connect({ highWaterMark: 16384, // TLS in node can't have bigger HWM anyway... - ...R, - servername: l, - session: U, - localAddress: B, + ...F, + servername: g, + session: S, + localAddress: C, // TODO(HTTP/2): Add support for h2c - ALPNProtocols: h ? ["http/1.1", "h2"] : ["http/1.1"], - socket: p, + ALPNProtocols: Q ? ["http/1.1", "h2"] : ["http/1.1"], + socket: w, // upgrade socket connection - port: w, - host: M + port: p, + host: N }), m.on("session", function(G) { - S.set(N, G); + M.set(U, G); }); } else - t(!p, "httpSocket can only be sent on TLS update"), w = w || 80, m = e.connect({ + t(!w, "httpSocket can only be sent on TLS update"), p = p || 80, m = e.connect({ highWaterMark: 64 * 1024, // Same as nodejs fs streams. - ...R, - localAddress: B, - port: w, - host: M + ...F, + localAddress: C, + port: p, + host: N }); - if (R.keepAlive == null || R.keepAlive) { - const N = R.keepAliveInitialDelay === void 0 ? 6e4 : R.keepAliveInitialDelay; - m.setKeepAlive(!0, N); + if (F.keepAlive == null || F.keepAlive) { + const U = F.keepAliveInitialDelay === void 0 ? 6e4 : F.keepAliveInitialDelay; + m.setKeepAlive(!0, U); } - const D = i(new WeakRef(m), { timeout: f, hostname: M, port: w }); - return m.setNoDelay(!0).once(Q === "https:" ? "secureConnect" : "connect", function() { + const D = i(new WeakRef(m), { timeout: d, hostname: N, port: p }); + return m.setNoDelay(!0).once(E === "https:" ? "secureConnect" : "connect", function() { if (queueMicrotask(D), I) { - const N = I; - I = null, N(null, this); + const U = I; + I = null, U(null, this); } - }).on("error", function(N) { + }).on("error", function(U) { if (queueMicrotask(D), I) { - const U = I; - I = null, U(N); + const S = I; + I = null, S(U); } }), m; }; } - const i = process.platform === "win32" ? (h, E) => { - if (!E.timeout) + const i = process.platform === "win32" ? (Q, h) => { + if (!h.timeout) return o; - let C = null, f = null; + let B = null, d = null; const y = n.setFastTimeout(() => { - C = setImmediate(() => { - f = setImmediate(() => c(h.deref(), E)); + B = setImmediate(() => { + d = setImmediate(() => c(Q.deref(), h)); }); - }, E.timeout); + }, h.timeout); return () => { - n.clearFastTimeout(y), clearImmediate(C), clearImmediate(f); + n.clearFastTimeout(y), clearImmediate(B), clearImmediate(d); }; - } : (h, E) => { - if (!E.timeout) + } : (Q, h) => { + if (!h.timeout) return o; - let C = null; - const f = n.setFastTimeout(() => { - C = setImmediate(() => { - c(h.deref(), E); + let B = null; + const d = n.setFastTimeout(() => { + B = setImmediate(() => { + c(Q.deref(), h); }); - }, E.timeout); + }, h.timeout); return () => { - n.clearFastTimeout(f), clearImmediate(C); + n.clearFastTimeout(d), clearImmediate(B); }; }; - function c(h, E) { - if (h == null) + function c(Q, h) { + if (Q == null) return; - let C = "Connect Timeout Error"; - Array.isArray(h.autoSelectFamilyAttemptedAddresses) ? C += ` (attempted addresses: ${h.autoSelectFamilyAttemptedAddresses.join(", ")},` : C += ` (attempted address: ${E.hostname}:${E.port},`, C += ` timeout: ${E.timeout}ms)`, A.destroy(h, new r(C)); + let B = "Connect Timeout Error"; + Array.isArray(Q.autoSelectFamilyAttemptedAddresses) ? B += ` (attempted addresses: ${Q.autoSelectFamilyAttemptedAddresses.join(", ")},` : B += ` (attempted address: ${h.hostname}:${h.port},`, B += ` timeout: ${h.timeout}ms)`, A.destroy(Q, new r(B)); } - return gr = g, gr; + return gr = l, gr; } -var lr = {}, jt = {}, eo; +var lr = {}, Xt = {}, eo; function Eg() { - if (eo) return jt; - eo = 1, Object.defineProperty(jt, "__esModule", { value: !0 }), jt.enumToMap = void 0; + if (eo) return Xt; + eo = 1, Object.defineProperty(Xt, "__esModule", { value: !0 }), Xt.enumToMap = void 0; function e(t) { const A = {}; return Object.keys(t).forEach((s) => { @@ -2020,7 +2020,7 @@ function Eg() { typeof r == "number" && (A[s] = r); }), A; } - return jt.enumToMap = e, jt; + return Xt.enumToMap = e, Xt; } var to; function Qg() { @@ -2338,19 +2338,19 @@ function yA() { "strict-origin-when-cross-origin", "unsafe-url" ] - ), u = new Set(a), g = ( + ), u = new Set(a), l = ( /** @type {const} */ ["follow", "manual", "error"] ), i = ( /** @type {const} */ ["GET", "HEAD", "OPTIONS", "TRACE"] - ), c = new Set(i), h = ( + ), c = new Set(i), Q = ( /** @type {const} */ ["navigate", "same-origin", "no-cors", "cors"] - ), E = ( + ), h = ( /** @type {const} */ ["omit", "same-origin", "include"] - ), C = ( + ), B = ( /** @type {const} */ [ "default", @@ -2360,7 +2360,7 @@ function yA() { "force-cache", "only-if-cached" ] - ), f = ( + ), d = ( /** @type {const} */ [ "content-encoding", @@ -2381,7 +2381,7 @@ function yA() { ), b = ( /** @type {const} */ ["CONNECT", "TRACE", "TRACK"] - ), R = new Set(b), S = ( + ), F = new Set(b), M = ( /** @type {const} */ [ "audio", @@ -2397,16 +2397,16 @@ function yA() { "xslt", "" ] - ), L = new Set(S); + ), L = new Set(M); return Qr = { - subresource: S, + subresource: M, forbiddenMethods: b, - requestBodyHeader: f, + requestBodyHeader: d, referrerPolicy: a, - requestRedirect: g, - requestMode: h, - requestCredentials: E, - requestCache: C, + requestRedirect: l, + requestMode: Q, + requestCredentials: h, + requestCache: B, redirectStatus: s, corsSafeListedMethods: e, nullBodyStatus: A, @@ -2418,7 +2418,7 @@ function yA() { redirectStatusSet: r, corsSafeListedMethodsSet: t, safeMethodsSet: c, - forbiddenMethodsSet: R, + forbiddenMethodsSet: F, referrerPolicySet: u }, Qr; } @@ -2460,88 +2460,88 @@ function st() { if (ao) return Br; ao = 1; const e = He, t = new TextEncoder(), A = /^[!#$%&'*+\-.^_|~A-Za-z0-9]+$/, s = /[\u000A\u000D\u0009\u0020]/, r = /[\u0009\u000A\u000C\u000D\u0020]/g, n = /^[\u0009\u0020-\u007E\u0080-\u00FF]+$/; - function o(l) { - e(l.protocol === "data:"); - let B = a(l, !0); - B = B.slice(5); - const p = { position: 0 }; - let I = g( + function o(g) { + e(g.protocol === "data:"); + let C = a(g, !0); + C = C.slice(5); + const w = { position: 0 }; + let I = l( ",", - B, - p + C, + w ); const m = I.length; - if (I = M(I, !0, !0), p.position >= B.length) + if (I = N(I, !0, !0), w.position >= C.length) return "failure"; - p.position++; - const D = B.slice(m + 1); - let N = i(D); + w.position++; + const D = C.slice(m + 1); + let U = i(D); if (/;(\u0020){0,}base64$/i.test(I)) { - const G = Q(N); - if (N = f(G), N === "failure") + const G = E(U); + if (U = d(G), U === "failure") return "failure"; I = I.slice(0, -6), I = I.replace(/(\u0020)+$/, ""), I = I.slice(0, -1); } I.startsWith(";") && (I = "text/plain" + I); - let U = C(I); - return U === "failure" && (U = C("text/plain;charset=US-ASCII")), { mimeType: U, body: N }; + let S = B(I); + return S === "failure" && (S = B("text/plain;charset=US-ASCII")), { mimeType: S, body: U }; } - function a(l, B = !1) { - if (!B) - return l.href; - const p = l.href, I = l.hash.length, m = I === 0 ? p : p.substring(0, p.length - I); - return !I && p.endsWith("#") ? m.slice(0, -1) : m; + function a(g, C = !1) { + if (!C) + return g.href; + const w = g.href, I = g.hash.length, m = I === 0 ? w : w.substring(0, w.length - I); + return !I && w.endsWith("#") ? m.slice(0, -1) : m; } - function u(l, B, p) { + function u(g, C, w) { let I = ""; - for (; p.position < B.length && l(B[p.position]); ) - I += B[p.position], p.position++; + for (; w.position < C.length && g(C[w.position]); ) + I += C[w.position], w.position++; return I; } - function g(l, B, p) { - const I = B.indexOf(l, p.position), m = p.position; - return I === -1 ? (p.position = B.length, B.slice(m)) : (p.position = I, B.slice(m, p.position)); + function l(g, C, w) { + const I = C.indexOf(g, w.position), m = w.position; + return I === -1 ? (w.position = C.length, C.slice(m)) : (w.position = I, C.slice(m, w.position)); } - function i(l) { - const B = t.encode(l); - return E(B); + function i(g) { + const C = t.encode(g); + return h(C); } - function c(l) { - return l >= 48 && l <= 57 || l >= 65 && l <= 70 || l >= 97 && l <= 102; + function c(g) { + return g >= 48 && g <= 57 || g >= 65 && g <= 70 || g >= 97 && g <= 102; } - function h(l) { + function Q(g) { return ( // 0-9 - l >= 48 && l <= 57 ? l - 48 : (l & 223) - 55 + g >= 48 && g <= 57 ? g - 48 : (g & 223) - 55 ); } - function E(l) { - const B = l.length, p = new Uint8Array(B); + function h(g) { + const C = g.length, w = new Uint8Array(C); let I = 0; - for (let m = 0; m < B; ++m) { - const D = l[m]; - D !== 37 ? p[I++] = D : D === 37 && !(c(l[m + 1]) && c(l[m + 2])) ? p[I++] = 37 : (p[I++] = h(l[m + 1]) << 4 | h(l[m + 2]), m += 2); + for (let m = 0; m < C; ++m) { + const D = g[m]; + D !== 37 ? w[I++] = D : D === 37 && !(c(g[m + 1]) && c(g[m + 2])) ? w[I++] = 37 : (w[I++] = Q(g[m + 1]) << 4 | Q(g[m + 2]), m += 2); } - return B === I ? p : p.subarray(0, I); + return C === I ? w : w.subarray(0, I); } - function C(l) { - l = S(l, !0, !0); - const B = { position: 0 }, p = g( + function B(g) { + g = M(g, !0, !0); + const C = { position: 0 }, w = l( "/", - l, - B + g, + C ); - if (p.length === 0 || !A.test(p) || B.position > l.length) + if (w.length === 0 || !A.test(w) || C.position > g.length) return "failure"; - B.position++; - let I = g( + C.position++; + let I = l( ";", - l, - B + g, + C ); - if (I = S(I, !1, !0), I.length === 0 || !A.test(I)) + if (I = M(I, !1, !0), I.length === 0 || !A.test(I)) return "failure"; - const m = p.toLowerCase(), D = I.toLowerCase(), N = { + const m = w.toLowerCase(), D = I.toLowerCase(), U = { type: m, subtype: D, /** @type {Map} */ @@ -2549,111 +2549,111 @@ function st() { // https://mimesniff.spec.whatwg.org/#mime-type-essence essence: `${m}/${D}` }; - for (; B.position < l.length; ) { - B.position++, u( + for (; C.position < g.length; ) { + C.position++, u( // https://fetch.spec.whatwg.org/#http-whitespace (v) => s.test(v), - l, - B + g, + C ); - let U = u( + let S = u( (v) => v !== ";" && v !== "=", - l, - B + g, + C ); - if (U = U.toLowerCase(), B.position < l.length) { - if (l[B.position] === ";") + if (S = S.toLowerCase(), C.position < g.length) { + if (g[C.position] === ";") continue; - B.position++; + C.position++; } - if (B.position > l.length) + if (C.position > g.length) break; let G = null; - if (l[B.position] === '"') - G = y(l, B, !0), g( + if (g[C.position] === '"') + G = y(g, C, !0), l( ";", - l, - B + g, + C ); - else if (G = g( + else if (G = l( ";", - l, - B - ), G = S(G, !1, !0), G.length === 0) + g, + C + ), G = M(G, !1, !0), G.length === 0) continue; - U.length !== 0 && A.test(U) && (G.length === 0 || n.test(G)) && !N.parameters.has(U) && N.parameters.set(U, G); + S.length !== 0 && A.test(S) && (G.length === 0 || n.test(G)) && !U.parameters.has(S) && U.parameters.set(S, G); } - return N; + return U; } - function f(l) { - l = l.replace(r, ""); - let B = l.length; - if (B % 4 === 0 && l.charCodeAt(B - 1) === 61 && (--B, l.charCodeAt(B - 1) === 61 && --B), B % 4 === 1 || /[^+/0-9A-Za-z]/.test(l.length === B ? l : l.substring(0, B))) + function d(g) { + g = g.replace(r, ""); + let C = g.length; + if (C % 4 === 0 && g.charCodeAt(C - 1) === 61 && (--C, g.charCodeAt(C - 1) === 61 && --C), C % 4 === 1 || /[^+/0-9A-Za-z]/.test(g.length === C ? g : g.substring(0, C))) return "failure"; - const p = Buffer.from(l, "base64"); - return new Uint8Array(p.buffer, p.byteOffset, p.byteLength); + const w = Buffer.from(g, "base64"); + return new Uint8Array(w.buffer, w.byteOffset, w.byteLength); } - function y(l, B, p) { - const I = B.position; + function y(g, C, w) { + const I = C.position; let m = ""; - for (e(l[B.position] === '"'), B.position++; m += u( - (N) => N !== '"' && N !== "\\", - l, - B - ), !(B.position >= l.length); ) { - const D = l[B.position]; - if (B.position++, D === "\\") { - if (B.position >= l.length) { + for (e(g[C.position] === '"'), C.position++; m += u( + (U) => U !== '"' && U !== "\\", + g, + C + ), !(C.position >= g.length); ) { + const D = g[C.position]; + if (C.position++, D === "\\") { + if (C.position >= g.length) { m += "\\"; break; } - m += l[B.position], B.position++; + m += g[C.position], C.position++; } else { e(D === '"'); break; } } - return p ? m : l.slice(I, B.position); + return w ? m : g.slice(I, C.position); } - function b(l) { - e(l !== "failure"); - const { parameters: B, essence: p } = l; - let I = p; - for (let [m, D] of B.entries()) + function b(g) { + e(g !== "failure"); + const { parameters: C, essence: w } = g; + let I = w; + for (let [m, D] of C.entries()) I += ";", I += m, I += "=", A.test(D) || (D = D.replace(/(\\|")/g, "\\$1"), D = '"' + D, D += '"'), I += D; return I; } - function R(l) { - return l === 13 || l === 10 || l === 9 || l === 32; - } - function S(l, B = !0, p = !0) { - return d(l, B, p, R); - } - function L(l) { - return l === 13 || l === 10 || l === 9 || l === 12 || l === 32; - } - function M(l, B = !0, p = !0) { - return d(l, B, p, L); - } - function d(l, B, p, I) { - let m = 0, D = l.length - 1; - if (B) - for (; m < l.length && I(l.charCodeAt(m)); ) m++; - if (p) - for (; D > 0 && I(l.charCodeAt(D)); ) D--; - return m === 0 && D === l.length - 1 ? l : l.slice(m, D + 1); - } - function Q(l) { - const B = l.length; - if (65535 > B) - return String.fromCharCode.apply(null, l); - let p = "", I = 0, m = 65535; - for (; I < B; ) - I + m > B && (m = B - I), p += String.fromCharCode.apply(null, l.subarray(I, I += m)); - return p; - } - function w(l) { - switch (l.essence) { + function F(g) { + return g === 13 || g === 10 || g === 9 || g === 32; + } + function M(g, C = !0, w = !0) { + return f(g, C, w, F); + } + function L(g) { + return g === 13 || g === 10 || g === 9 || g === 12 || g === 32; + } + function N(g, C = !0, w = !0) { + return f(g, C, w, L); + } + function f(g, C, w, I) { + let m = 0, D = g.length - 1; + if (C) + for (; m < g.length && I(g.charCodeAt(m)); ) m++; + if (w) + for (; D > 0 && I(g.charCodeAt(D)); ) D--; + return m === 0 && D === g.length - 1 ? g : g.slice(m, D + 1); + } + function E(g) { + const C = g.length; + if (65535 > C) + return String.fromCharCode.apply(null, g); + let w = "", I = 0, m = 65535; + for (; I < C; ) + I + m > C && (m = C - I), w += String.fromCharCode.apply(null, g.subarray(I, I += m)); + return w; + } + function p(g) { + switch (g.essence) { case "application/ecmascript": case "application/javascript": case "application/x-ecmascript": @@ -2680,22 +2680,22 @@ function st() { case "application/xml": return "application/xml"; } - return l.subtype.endsWith("+json") ? "application/json" : l.subtype.endsWith("+xml") ? "application/xml" : ""; + return g.subtype.endsWith("+json") ? "application/json" : g.subtype.endsWith("+xml") ? "application/xml" : ""; } return Br = { dataURLProcessor: o, URLSerializer: a, collectASequenceOfCodePoints: u, - collectASequenceOfCodePointsFast: g, + collectASequenceOfCodePointsFast: l, stringPercentDecode: i, - parseMIMEType: C, + parseMIMEType: B, collectAnHTTPQuotedString: y, serializeAMimeType: b, - removeChars: d, - removeHTTPWhitespace: S, - minimizeSupportedMimeType: w, + removeChars: f, + removeHTTPWhitespace: M, + minimizeSupportedMimeType: p, HTTP_TOKEN_CODEPOINTS: A, - isomorphicDecode: Q + isomorphicDecode: E }, Br; } var Cr, co; @@ -2757,8 +2757,8 @@ function $e() { } }, r.util.markAsUncloneable = A || (() => { }), r.util.ConvertToInt = function(n, o, a, u) { - let g, i; - o === 64 ? (g = Math.pow(2, 53) - 1, a === "unsigned" ? i = 0 : i = Math.pow(-2, 53) + 1) : a === "unsigned" ? (i = 0, g = Math.pow(2, o) - 1) : (i = Math.pow(-2, o) - 1, g = Math.pow(2, o - 1) - 1); + let l, i; + o === 64 ? (l = Math.pow(2, 53) - 1, a === "unsigned" ? i = 0 : i = Math.pow(-2, 53) + 1) : a === "unsigned" ? (i = 0, l = Math.pow(2, o) - 1) : (i = Math.pow(-2, o) - 1, l = Math.pow(2, o - 1) - 1); let c = Number(n); if (c === 0 && (c = 0), u?.enforceRange === !0) { if (Number.isNaN(c) || c === Number.POSITIVE_INFINITY || c === Number.NEGATIVE_INFINITY) @@ -2766,14 +2766,14 @@ function $e() { header: "Integer conversion", message: `Could not convert ${r.util.Stringify(n)} to an integer.` }); - if (c = r.util.IntegerPart(c), c < i || c > g) + if (c = r.util.IntegerPart(c), c < i || c > l) throw r.errors.exception({ header: "Integer conversion", - message: `Value must be between ${i}-${g}, got ${c}.` + message: `Value must be between ${i}-${l}, got ${c}.` }); return c; } - return !Number.isNaN(c) && u?.clamp === !0 ? (c = Math.min(Math.max(c, i), g), Math.floor(c) % 2 === 0 ? c = Math.floor(c) : c = Math.ceil(c), c) : Number.isNaN(c) || c === 0 && Object.is(0, c) || c === Number.POSITIVE_INFINITY || c === Number.NEGATIVE_INFINITY ? 0 : (c = r.util.IntegerPart(c), c = c % Math.pow(2, o), a === "signed" && c >= Math.pow(2, o) - 1 ? c - Math.pow(2, o) : c); + return !Number.isNaN(c) && u?.clamp === !0 ? (c = Math.min(Math.max(c, i), l), Math.floor(c) % 2 === 0 ? c = Math.floor(c) : c = Math.ceil(c), c) : Number.isNaN(c) || c === 0 && Object.is(0, c) || c === Number.POSITIVE_INFINITY || c === Number.NEGATIVE_INFINITY ? 0 : (c = r.util.IntegerPart(c), c = c % Math.pow(2, o), a === "signed" && c >= Math.pow(2, o) - 1 ? c - Math.pow(2, o) : c); }, r.util.IntegerPart = function(n) { const o = Math.floor(Math.abs(n)); return n < 0 ? -1 * o : o; @@ -2789,54 +2789,54 @@ function $e() { return `${n}`; } }, r.sequenceConverter = function(n) { - return (o, a, u, g) => { + return (o, a, u, l) => { if (r.util.Type(o) !== "Object") throw r.errors.exception({ header: a, message: `${u} (${r.util.Stringify(o)}) is not iterable.` }); - const i = typeof g == "function" ? g() : o?.[Symbol.iterator]?.(), c = []; - let h = 0; + const i = typeof l == "function" ? l() : o?.[Symbol.iterator]?.(), c = []; + let Q = 0; if (i === void 0 || typeof i.next != "function") throw r.errors.exception({ header: a, message: `${u} is not iterable.` }); for (; ; ) { - const { done: E, value: C } = i.next(); - if (E) + const { done: h, value: B } = i.next(); + if (h) break; - c.push(n(C, a, `${u}[${h++}]`)); + c.push(n(B, a, `${u}[${Q++}]`)); } return c; }; }, r.recordConverter = function(n, o) { - return (a, u, g) => { + return (a, u, l) => { if (r.util.Type(a) !== "Object") throw r.errors.exception({ header: u, - message: `${g} ("${r.util.Type(a)}") is not an Object.` + message: `${l} ("${r.util.Type(a)}") is not an Object.` }); const i = {}; if (!e.isProxy(a)) { - const h = [...Object.getOwnPropertyNames(a), ...Object.getOwnPropertySymbols(a)]; - for (const E of h) { - const C = n(E, u, g), f = o(a[E], u, g); - i[C] = f; + const Q = [...Object.getOwnPropertyNames(a), ...Object.getOwnPropertySymbols(a)]; + for (const h of Q) { + const B = n(h, u, l), d = o(a[h], u, l); + i[B] = d; } return i; } const c = Reflect.ownKeys(a); - for (const h of c) - if (Reflect.getOwnPropertyDescriptor(a, h)?.enumerable) { - const C = n(h, u, g), f = o(a[h], u, g); - i[C] = f; + for (const Q of c) + if (Reflect.getOwnPropertyDescriptor(a, Q)?.enumerable) { + const B = n(Q, u, l), d = o(a[Q], u, l); + i[B] = d; } return i; }; }, r.interfaceConverter = function(n) { - return (o, a, u, g) => { - if (g?.strict !== !1 && !(o instanceof n)) + return (o, a, u, l) => { + if (l?.strict !== !1 && !(o instanceof n)) throw r.errors.exception({ header: a, message: `Expected ${u} ("${r.util.Stringify(o)}") to be an instance of ${n.name}.` @@ -2845,30 +2845,30 @@ function $e() { }; }, r.dictionaryConverter = function(n) { return (o, a, u) => { - const g = r.util.Type(o), i = {}; - if (g === "Null" || g === "Undefined") + const l = r.util.Type(o), i = {}; + if (l === "Null" || l === "Undefined") return i; - if (g !== "Object") + if (l !== "Object") throw r.errors.exception({ header: a, message: `Expected ${o} to be one of: Null, Undefined, Object.` }); for (const c of n) { - const { key: h, defaultValue: E, required: C, converter: f } = c; - if (C === !0 && !Object.hasOwn(o, h)) + const { key: Q, defaultValue: h, required: B, converter: d } = c; + if (B === !0 && !Object.hasOwn(o, Q)) throw r.errors.exception({ header: a, - message: `Missing required key "${h}".` + message: `Missing required key "${Q}".` }); - let y = o[h]; + let y = o[Q]; const b = Object.hasOwn(c, "defaultValue"); - if (b && y !== null && (y ??= E()), C || b || y !== void 0) { - if (y = f(y, a, `${u}.${h}`), c.allowedValues && !c.allowedValues.includes(y)) + if (b && y !== null && (y ??= h()), B || b || y !== void 0) { + if (y = d(y, a, `${u}.${Q}`), c.allowedValues && !c.allowedValues.includes(y)) throw r.errors.exception({ header: a, message: `${y} is not an accepted type. Expected one of ${c.allowedValues.join(", ")}.` }); - i[h] = y; + i[Q] = y; } } return i; @@ -2886,10 +2886,10 @@ function $e() { return String(n); }, r.converters.ByteString = function(n, o, a) { const u = r.converters.DOMString(n, o, a); - for (let g = 0; g < u.length; g++) - if (u.charCodeAt(g) > 255) + for (let l = 0; l < u.length; l++) + if (u.charCodeAt(l) > 255) throw new TypeError( - `Cannot convert argument to a ByteString because the character at index ${g} has a value of ${u.charCodeAt(g)} which is greater than 255.` + `Cannot convert argument to a ByteString because the character at index ${l} has a value of ${u.charCodeAt(l)} which is greater than 255.` ); return u; }, r.converters.USVString = s, r.converters.boolean = function(n) { @@ -2922,14 +2922,14 @@ function $e() { message: "Received a resizable ArrayBuffer." }); return n; - }, r.converters.TypedArray = function(n, o, a, u, g) { + }, r.converters.TypedArray = function(n, o, a, u, l) { if (r.util.Type(n) !== "Object" || !e.isTypedArray(n) || n.constructor.name !== o.name) throw r.errors.conversionFailed({ prefix: a, argument: `${u} ("${r.util.Stringify(n)}")`, types: [o.name] }); - if (g?.allowShared === !1 && e.isSharedArrayBuffer(n.buffer)) + if (l?.allowShared === !1 && e.isSharedArrayBuffer(n.buffer)) throw r.errors.exception({ header: "ArrayBuffer", message: "SharedArrayBuffer is not allowed." @@ -2984,63 +2984,63 @@ var Ir, go; function it() { if (go) return Ir; go = 1; - const { Transform: e } = ot, t = jA, { redirectStatusSet: A, referrerPolicySet: s, badPortsSet: r } = yA(), { getGlobalOrigin: n } = io(), { collectASequenceOfCodePoints: o, collectAnHTTPQuotedString: a, removeChars: u, parseMIMEType: g } = st(), { performance: i } = Zc, { isBlobLike: c, ReadableStreamFrom: h, isValidHTTPToken: E, normalizedMethodRecordsBase: C } = Ue(), f = He, { isUint8Array: y } = Un, { webidl: b } = $e(); - let R = [], S; + const { Transform: e } = ot, t = jA, { redirectStatusSet: A, referrerPolicySet: s, badPortsSet: r } = yA(), { getGlobalOrigin: n } = io(), { collectASequenceOfCodePoints: o, collectAnHTTPQuotedString: a, removeChars: u, parseMIMEType: l } = st(), { performance: i } = Zc, { isBlobLike: c, ReadableStreamFrom: Q, isValidHTTPToken: h, normalizedMethodRecordsBase: B } = Ue(), d = He, { isUint8Array: y } = Un, { webidl: b } = $e(); + let F = [], M; try { - S = require("node:crypto"); + M = require("node:crypto"); const T = ["sha256", "sha384", "sha512"]; - R = S.getHashes().filter((x) => T.includes(x)); + F = M.getHashes().filter((x) => T.includes(x)); } catch { } function L(T) { - const x = T.urlList, F = x.length; - return F === 0 ? null : x[F - 1].toString(); + const x = T.urlList, k = x.length; + return k === 0 ? null : x[k - 1].toString(); } - function M(T, x) { + function N(T, x) { if (!A.has(T.status)) return null; - let F = T.headersList.get("location", !0); - return F !== null && m(F) && (d(F) || (F = Q(F)), F = new URL(F, L(T))), F && !F.hash && (F.hash = x), F; + let k = T.headersList.get("location", !0); + return k !== null && m(k) && (f(k) || (k = E(k)), k = new URL(k, L(T))), k && !k.hash && (k.hash = x), k; } - function d(T) { + function f(T) { for (let x = 0; x < T.length; ++x) { - const F = T.charCodeAt(x); - if (F > 126 || // Non-US-ASCII + DEL - F < 32) + const k = T.charCodeAt(x); + if (k > 126 || // Non-US-ASCII + DEL + k < 32) return !1; } return !0; } - function Q(T) { + function E(T) { return Buffer.from(T, "binary").toString("utf8"); } - function w(T) { + function p(T) { return T.urlList[T.urlList.length - 1]; } - function l(T) { - const x = w(T); + function g(T) { + const x = p(T); return Ce(x) && r.has(x.port) ? "blocked" : "allowed"; } - function B(T) { + function C(T) { return T instanceof Error || T?.constructor?.name === "Error" || T?.constructor?.name === "DOMException"; } - function p(T) { + function w(T) { for (let x = 0; x < T.length; ++x) { - const F = T.charCodeAt(x); - if (!(F === 9 || // HTAB - F >= 32 && F <= 126 || // SP / VCHAR - F >= 128 && F <= 255)) + const k = T.charCodeAt(x); + if (!(k === 9 || // HTAB + k >= 32 && k <= 126 || // SP / VCHAR + k >= 128 && k <= 255)) return !1; } return !0; } - const I = E; + const I = h; function m(T) { return (T[0] === " " || T[0] === " " || T[T.length - 1] === " " || T[T.length - 1] === " " || T.includes(` `) || T.includes("\r") || T.includes("\0")) === !1; } function D(T, x) { - const { headersList: F } = x, O = (F.get("referrer-policy", !0) ?? "").split(","); + const { headersList: k } = x, O = (k.get("referrer-policy", !0) ?? "").split(","); let H = ""; if (O.length > 0) for (let _ = O.length; _ !== 0; _--) { @@ -3052,10 +3052,10 @@ function it() { } H !== "" && (T.referrerPolicy = H); } - function N() { + function U() { return "allowed"; } - function U() { + function S() { return "success"; } function G() { @@ -3078,10 +3078,10 @@ function it() { case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - T.origin && ue(T.origin) && !ue(w(T)) && (x = null); + T.origin && ue(T.origin) && !ue(p(T)) && (x = null); break; case "same-origin": - le(T, w(T)) || (x = null); + le(T, p(T)) || (x = null); break; } T.headersList.append("origin", x, !0); @@ -3091,7 +3091,7 @@ function it() { function ne(T, x) { return T; } - function ge(T, x, F) { + function ge(T, x, k) { return !T?.startTime || T.startTime < x ? { domainLookupStartTime: x, domainLookupEndTime: x, @@ -3138,21 +3138,21 @@ function it() { } function ye(T) { const x = T.referrerPolicy; - f(x); - let F = null; + d(x); + let k = null; if (T.referrer === "client") { const z = n(); if (!z || z.origin === "null") return "no-referrer"; - F = new URL(z); - } else T.referrer instanceof URL && (F = T.referrer); - let O = we(F); - const H = we(F, !0); + k = new URL(z); + } else T.referrer instanceof URL && (k = T.referrer); + let O = we(k); + const H = we(k, !0); O.toString().length > 4096 && (O = H); const _ = le(T, O), Ae = X(O) && !X(T.url); switch (x) { case "origin": - return H ?? we(F, !0); + return H ?? we(k, !0); case "unsafe-url": return O; case "same-origin": @@ -3160,7 +3160,7 @@ function it() { case "origin-when-cross-origin": return _ ? O : H; case "strict-origin-when-cross-origin": { - const z = w(T); + const z = p(T); return le(O, z) ? O : X(O) && !X(z) ? "no-referrer" : H; } // eslint-disable-line @@ -3175,29 +3175,29 @@ function it() { } } function we(T, x) { - return f(T instanceof URL), T = new URL(T), T.protocol === "file:" || T.protocol === "about:" || T.protocol === "blank:" ? "no-referrer" : (T.username = "", T.password = "", T.hash = "", x && (T.pathname = "", T.search = ""), T); + return d(T instanceof URL), T = new URL(T), T.protocol === "file:" || T.protocol === "about:" || T.protocol === "blank:" ? "no-referrer" : (T.username = "", T.password = "", T.hash = "", x && (T.pathname = "", T.search = ""), T); } function X(T) { if (!(T instanceof URL)) return !1; if (T.href === "about:blank" || T.href === "about:srcdoc" || T.protocol === "data:" || T.protocol === "file:") return !0; return x(T.origin); - function x(F) { - if (F == null || F === "null") return !1; - const O = new URL(F); + function x(k) { + if (k == null || k === "null") return !1; + const O = new URL(k); return !!(O.protocol === "https:" || O.protocol === "wss:" || /^127(?:\.[0-9]+){0,2}\.[0-9]+$|^\[(?:0*:)*?:?0*1\]$/.test(O.hostname) || O.hostname === "localhost" || O.hostname.includes("localhost.") || O.hostname.endsWith(".localhost")); } } function W(T, x) { - if (S === void 0) + if (M === void 0) return !0; - const F = J(x); - if (F === "no metadata" || F.length === 0) + const k = J(x); + if (k === "no metadata" || k.length === 0) return !0; - const O = V(F), H = P(F, O); + const O = V(k), H = P(k, O); for (const _ of H) { const Ae = _.algo, z = _.hash; - let ce = S.createHash(Ae).update(T).digest("base64"); + let ce = M.createHash(Ae).update(T).digest("base64"); if (ce[ce.length - 1] === "=" && (ce[ce.length - 2] === "=" ? ce = ce.slice(0, -2) : ce = ce.slice(0, -1)), Z(ce, z)) return !0; } @@ -3206,23 +3206,23 @@ function it() { const re = /(?sha256|sha384|sha512)-((?[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i; function J(T) { const x = []; - let F = !0; + let k = !0; for (const O of T.split(" ")) { - F = !1; + k = !1; const H = re.exec(O); if (H === null || H.groups === void 0 || H.groups.algo === void 0) continue; const _ = H.groups.algo.toLowerCase(); - R.includes(_) && x.push(H.groups); + F.includes(_) && x.push(H.groups); } - return F === !0 ? "no metadata" : x; + return k === !0 ? "no metadata" : x; } function V(T) { let x = T[0].algo; if (x[3] === "5") return x; - for (let F = 1; F < T.length; ++F) { - const O = T[F]; + for (let k = 1; k < T.length; ++k) { + const O = T[k]; if (O.algo[3] === "5") { x = "sha512"; break; @@ -3237,17 +3237,17 @@ function it() { function P(T, x) { if (T.length === 1) return T; - let F = 0; + let k = 0; for (let O = 0; O < T.length; ++O) - T[O].algo === x && (T[F++] = T[O]); - return T.length = F, T; + T[O].algo === x && (T[k++] = T[O]); + return T.length = k, T; } function Z(T, x) { if (T.length !== x.length) return !1; - for (let F = 0; F < T.length; ++F) - if (T[F] !== x[F]) { - if (T[F] === "+" && x[F] === "-" || T[F] === "/" && x[F] === "_") + for (let k = 0; k < T.length; ++k) + if (T[k] !== x[k]) { + if (T[k] === "+" && x[k] === "-" || T[k] === "/" && x[k] === "_") continue; return !1; } @@ -3271,16 +3271,16 @@ function it() { return T.controller.state === "aborted" || T.controller.state === "terminated"; } function pe(T) { - return C[T.toLowerCase()] ?? T; + return B[T.toLowerCase()] ?? T; } function Le(T) { const x = JSON.stringify(T); if (x === void 0) throw new TypeError("Value is not JSON serializable"); - return f(typeof x == "string"), x; + return d(typeof x == "string"), x; } const Re = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())); - function ke(T, x, F = 0, O = 1) { + function ke(T, x, k = 0, O = 1) { class H { /** @type {any} */ #e; @@ -3307,7 +3307,7 @@ function it() { value: void 0, done: !0 }; - const { [F]: Fe, [O]: Ge } = z[Ae]; + const { [k]: Fe, [O]: Ge } = z[Ae]; this.#s = Ae + 1; let Ne; switch (this.#t) { @@ -3339,8 +3339,8 @@ function it() { return new H(_, Ae); }; } - function de(T, x, F, O = 0, H = 1) { - const _ = ke(T, F, O, H), Ae = { + function de(T, x, k, O = 0, H = 1) { + const _ = ke(T, k, O, H), Ae = { keys: { writable: !0, enumerable: !0, @@ -3389,8 +3389,8 @@ function it() { } }); } - async function We(T, x, F) { - const O = x, H = F; + async function We(T, x, k) { + const O = x, H = k; let _; try { _ = T.stream.getReader(); @@ -3416,23 +3416,23 @@ function it() { } } const j = /[^\x00-\xFF]/; - function k(T) { - return f(!j.test(T)), T; + function R(T) { + return d(!j.test(T)), T; } async function q(T) { const x = []; - let F = 0; + let k = 0; for (; ; ) { const { done: O, value: H } = await T.read(); if (O) - return Buffer.concat(x, F); + return Buffer.concat(x, k); if (!y(H)) throw new TypeError("Received non-Uint8Array chunk"); - x.push(H), F += H.length; + x.push(H), k += H.length; } } function ie(T) { - f("protocol" in T); + d("protocol" in T); const x = T.protocol; return x === "about:" || x === "blob:" || x === "data:"; } @@ -3440,24 +3440,24 @@ function it() { return typeof T == "string" && T[5] === ":" && T[0] === "h" && T[1] === "t" && T[2] === "t" && T[3] === "p" && T[4] === "s" || T.protocol === "https:"; } function Ce(T) { - f("protocol" in T); + d("protocol" in T); const x = T.protocol; return x === "http:" || x === "https:"; } function De(T, x) { - const F = T; - if (!F.startsWith("bytes")) + const k = T; + if (!k.startsWith("bytes")) return "failure"; const O = { position: 5 }; if (x && o( (ce) => ce === " " || ce === " ", - F, + k, O - ), F.charCodeAt(O.position) !== 61) + ), k.charCodeAt(O.position) !== 61) return "failure"; O.position++, x && o( (ce) => ce === " " || ce === " ", - F, + k, O ); const H = o( @@ -3465,18 +3465,18 @@ function it() { const Fe = ce.charCodeAt(0); return Fe >= 48 && Fe <= 57; }, - F, + k, O ), _ = H.length ? Number(H) : null; if (x && o( (ce) => ce === " " || ce === " ", - F, + k, O - ), F.charCodeAt(O.position) !== 45) + ), k.charCodeAt(O.position) !== 45) return "failure"; O.position++, x && o( (ce) => ce === " " || ce === " ", - F, + k, O ); const Ae = o( @@ -3484,14 +3484,14 @@ function it() { const Fe = ce.charCodeAt(0); return Fe >= 48 && Fe <= 57; }, - F, + k, O ), z = Ae.length ? Number(Ae) : null; - return O.position < F.length || z === null && _ === null || _ > z ? "failure" : { rangeStartValue: _, rangeEndValue: z }; + return O.position < k.length || z === null && _ === null || _ > z ? "failure" : { rangeStartValue: _, rangeEndValue: z }; } - function ve(T, x, F) { + function ve(T, x, k) { let O = "bytes "; - return O += k(`${T}`), O += "-", O += k(`${x}`), O += "/", O += k(`${F}`), O; + return O += R(`${T}`), O += "-", O += R(`${x}`), O += "/", O += R(`${k}`), O; } class ze extends e { #e; @@ -3499,7 +3499,7 @@ function it() { constructor(x) { super(), this.#e = x; } - _transform(x, F, O) { + _transform(x, k, O) { if (!this._inflateStream) { if (x.length === 0) { O(); @@ -3507,7 +3507,7 @@ function it() { } this._inflateStream = (x[0] & 15) === 8 ? t.createInflate(this.#e) : t.createInflateRaw(this.#e), this._inflateStream.on("data", this.push.bind(this)), this._inflateStream.on("end", () => this.push(null)), this._inflateStream.on("error", (H) => this.destroy(H)); } - this._inflateStream.write(x, F, O); + this._inflateStream.write(x, k, O); } _final(x) { this._inflateStream && (this._inflateStream.end(), this._inflateStream = null), x(); @@ -3517,40 +3517,40 @@ function it() { return new ze(T); } function Ie(T) { - let x = null, F = null, O = null; + let x = null, k = null, O = null; const H = ee("content-type", T); if (H === null) return "failure"; for (const _ of H) { - const Ae = g(_); - Ae === "failure" || Ae.essence === "*/*" || (O = Ae, O.essence !== F ? (x = null, O.parameters.has("charset") && (x = O.parameters.get("charset")), F = O.essence) : !O.parameters.has("charset") && x !== null && O.parameters.set("charset", x)); + const Ae = l(_); + Ae === "failure" || Ae.essence === "*/*" || (O = Ae, O.essence !== k ? (x = null, O.parameters.has("charset") && (x = O.parameters.get("charset")), k = O.essence) : !O.parameters.has("charset") && x !== null && O.parameters.set("charset", x)); } return O ?? "failure"; } function Y(T) { - const x = T, F = { position: 0 }, O = []; + const x = T, k = { position: 0 }, O = []; let H = ""; - for (; F.position < x.length; ) { + for (; k.position < x.length; ) { if (H += o( (_) => _ !== '"' && _ !== ",", x, - F - ), F.position < x.length) - if (x.charCodeAt(F.position) === 34) { + k + ), k.position < x.length) + if (x.charCodeAt(k.position) === 34) { if (H += a( x, - F - ), F.position < x.length) + k + ), k.position < x.length) continue; } else - f(x.charCodeAt(F.position) === 44), F.position++; + d(x.charCodeAt(k.position) === 44), k.position++; H = u(H, !0, !0, (_) => _ === 9 || _ === 32), O.push(H), H = ""; } return O; } function ee(T, x) { - const F = x.get(T, !0); - return F === null ? null : Y(F); + const k = x.get(T, !0); + return k === null ? null : Y(k); } const K = new TextDecoder(); function te(T) { @@ -3572,9 +3572,9 @@ function it() { return Ir = { isAborted: fe, isCancelled: Me, - isValidEncodedURL: d, + isValidEncodedURL: f, createDeferredPromise: oe, - ReadableStreamFrom: h, + ReadableStreamFrom: Q, tryUpgradeRequestToAPotentiallyTrustworthyURL: se, clampAndCoarsenConnectionTimingInfo: ge, coarsenedSharedCurrentTime: ae, @@ -3584,18 +3584,18 @@ function it() { appendFetchMetadata: v, appendRequestOriginHeader: $, TAOCheck: G, - corsCheck: U, - crossOriginResourcePolicyCheck: N, + corsCheck: S, + crossOriginResourcePolicyCheck: U, createOpaqueTimingInfo: Be, setRequestReferrerPolicyOnRedirect: D, - isValidHTTPToken: E, - requestBadPort: l, - requestCurrentURL: w, + isValidHTTPToken: h, + requestBadPort: g, + requestCurrentURL: p, responseURL: L, - responseLocationURL: M, + responseLocationURL: N, isBlobLike: c, isURLPotentiallyTrustworthy: X, - isValidReasonPhrase: p, + isValidReasonPhrase: w, sameOrigin: le, normalizeMethod: pe, serializeJavascriptValueToJSONString: Le, @@ -3603,12 +3603,12 @@ function it() { createIterator: ke, isValidHeaderName: I, isValidHeaderValue: m, - isErrorLike: B, + isErrorLike: C, fullyReadBody: We, bytesMatch: W, isReadableStreamLike: _e, readableStreamClose: Je, - isomorphicEncode: k, + isomorphicEncode: R, urlIsLocal: ie, urlHasHttpsScheme: ue, urlIsHttpHttpsScheme: Ce, @@ -3624,7 +3624,7 @@ function it() { }, Ir; } var dr, lo; -function Ft() { +function Tt() { return lo || (lo = 1, dr = { kUrl: /* @__PURE__ */ Symbol("url"), kHeaders: /* @__PURE__ */ Symbol("headers"), @@ -3637,15 +3637,15 @@ var fr, uo; function Eo() { if (uo) return fr; uo = 1; - const { Blob: e, File: t } = at, { kState: A } = Ft(), { webidl: s } = $e(); + const { Blob: e, File: t } = at, { kState: A } = Tt(), { webidl: s } = $e(); class r { - constructor(a, u, g = {}) { - const i = u, c = g.type, h = g.lastModified ?? Date.now(); + constructor(a, u, l = {}) { + const i = u, c = l.type, Q = l.lastModified ?? Date.now(); this[A] = { blobLike: a, name: i, type: c, - lastModified: h + lastModified: Q }; } stream(...a) { @@ -3686,10 +3686,10 @@ var pr, Qo; function DA() { if (Qo) return pr; Qo = 1; - const { isBlobLike: e, iteratorMixin: t } = it(), { kState: A } = Ft(), { kEnumerableProperty: s } = Ue(), { FileLike: r, isFileLike: n } = Eo(), { webidl: o } = $e(), { File: a } = at, u = rt, g = globalThis.File ?? a; + const { isBlobLike: e, iteratorMixin: t } = it(), { kState: A } = Tt(), { kEnumerableProperty: s } = Ue(), { FileLike: r, isFileLike: n } = Eo(), { webidl: o } = $e(), { File: a } = at, u = rt, l = globalThis.File ?? a; class i { - constructor(E) { - if (o.util.markAsUncloneable(this), E !== void 0) + constructor(h) { + if (o.util.markAsUncloneable(this), h !== void 0) throw o.errors.conversionFailed({ prefix: "FormData constructor", argument: "Argument 1", @@ -3697,58 +3697,58 @@ function DA() { }); this[A] = []; } - append(E, C, f = void 0) { + append(h, B, d = void 0) { o.brandCheck(this, i); const y = "FormData.append"; - if (o.argumentLengthCheck(arguments, 2, y), arguments.length === 3 && !e(C)) + if (o.argumentLengthCheck(arguments, 2, y), arguments.length === 3 && !e(B)) throw new TypeError( "Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'" ); - E = o.converters.USVString(E, y, "name"), C = e(C) ? o.converters.Blob(C, y, "value", { strict: !1 }) : o.converters.USVString(C, y, "value"), f = arguments.length === 3 ? o.converters.USVString(f, y, "filename") : void 0; - const b = c(E, C, f); + h = o.converters.USVString(h, y, "name"), B = e(B) ? o.converters.Blob(B, y, "value", { strict: !1 }) : o.converters.USVString(B, y, "value"), d = arguments.length === 3 ? o.converters.USVString(d, y, "filename") : void 0; + const b = c(h, B, d); this[A].push(b); } - delete(E) { + delete(h) { o.brandCheck(this, i); - const C = "FormData.delete"; - o.argumentLengthCheck(arguments, 1, C), E = o.converters.USVString(E, C, "name"), this[A] = this[A].filter((f) => f.name !== E); + const B = "FormData.delete"; + o.argumentLengthCheck(arguments, 1, B), h = o.converters.USVString(h, B, "name"), this[A] = this[A].filter((d) => d.name !== h); } - get(E) { + get(h) { o.brandCheck(this, i); - const C = "FormData.get"; - o.argumentLengthCheck(arguments, 1, C), E = o.converters.USVString(E, C, "name"); - const f = this[A].findIndex((y) => y.name === E); - return f === -1 ? null : this[A][f].value; + const B = "FormData.get"; + o.argumentLengthCheck(arguments, 1, B), h = o.converters.USVString(h, B, "name"); + const d = this[A].findIndex((y) => y.name === h); + return d === -1 ? null : this[A][d].value; } - getAll(E) { + getAll(h) { o.brandCheck(this, i); - const C = "FormData.getAll"; - return o.argumentLengthCheck(arguments, 1, C), E = o.converters.USVString(E, C, "name"), this[A].filter((f) => f.name === E).map((f) => f.value); + const B = "FormData.getAll"; + return o.argumentLengthCheck(arguments, 1, B), h = o.converters.USVString(h, B, "name"), this[A].filter((d) => d.name === h).map((d) => d.value); } - has(E) { + has(h) { o.brandCheck(this, i); - const C = "FormData.has"; - return o.argumentLengthCheck(arguments, 1, C), E = o.converters.USVString(E, C, "name"), this[A].findIndex((f) => f.name === E) !== -1; + const B = "FormData.has"; + return o.argumentLengthCheck(arguments, 1, B), h = o.converters.USVString(h, B, "name"), this[A].findIndex((d) => d.name === h) !== -1; } - set(E, C, f = void 0) { + set(h, B, d = void 0) { o.brandCheck(this, i); const y = "FormData.set"; - if (o.argumentLengthCheck(arguments, 2, y), arguments.length === 3 && !e(C)) + if (o.argumentLengthCheck(arguments, 2, y), arguments.length === 3 && !e(B)) throw new TypeError( "Failed to execute 'set' on 'FormData': parameter 2 is not of type 'Blob'" ); - E = o.converters.USVString(E, y, "name"), C = e(C) ? o.converters.Blob(C, y, "name", { strict: !1 }) : o.converters.USVString(C, y, "name"), f = arguments.length === 3 ? o.converters.USVString(f, y, "name") : void 0; - const b = c(E, C, f), R = this[A].findIndex((S) => S.name === E); - R !== -1 ? this[A] = [ - ...this[A].slice(0, R), + h = o.converters.USVString(h, y, "name"), B = e(B) ? o.converters.Blob(B, y, "name", { strict: !1 }) : o.converters.USVString(B, y, "name"), d = arguments.length === 3 ? o.converters.USVString(d, y, "name") : void 0; + const b = c(h, B, d), F = this[A].findIndex((M) => M.name === h); + F !== -1 ? this[A] = [ + ...this[A].slice(0, F), b, - ...this[A].slice(R + 1).filter((S) => S.name !== E) + ...this[A].slice(F + 1).filter((M) => M.name !== h) ] : this[A].push(b); } - [u.inspect.custom](E, C) { - const f = this[A].reduce((b, R) => (b[R.name] ? Array.isArray(b[R.name]) ? b[R.name].push(R.value) : b[R.name] = [b[R.name], R.value] : b[R.name] = R.value, b), { __proto__: null }); - C.depth ??= E, C.colors ??= !0; - const y = u.formatWithOptions(C, f); + [u.inspect.custom](h, B) { + const d = this[A].reduce((b, F) => (b[F.name] ? Array.isArray(b[F.name]) ? b[F.name].push(F.value) : b[F.name] = [b[F.name], F.value] : b[F.name] = F.value, b), { __proto__: null }); + B.depth ??= h, B.colors ??= !0; + const y = u.formatWithOptions(B, d); return `FormData ${y.slice(y.indexOf("]") + 2)}`; } } @@ -3764,17 +3764,17 @@ function DA() { configurable: !0 } }); - function c(h, E, C) { - if (typeof E != "string") { - if (n(E) || (E = E instanceof Blob ? new g([E], "blob", { type: E.type }) : new r(E, "blob", { type: E.type })), C !== void 0) { - const f = { - type: E.type, - lastModified: E.lastModified + function c(Q, h, B) { + if (typeof h != "string") { + if (n(h) || (h = h instanceof Blob ? new l([h], "blob", { type: h.type }) : new r(h, "blob", { type: h.type })), B !== void 0) { + const d = { + type: h.type, + lastModified: h.lastModified }; - E = E instanceof a ? new g([E], C, f) : new r(E, C, f); + h = h instanceof a ? new l([h], B, d) : new r(h, B, d); } } - return { name: h, value: E }; + return { name: Q, value: h }; } return pr = { FormData: i, makeEntry: c }, pr; } @@ -3782,160 +3782,160 @@ var wr, ho; function Bg() { if (ho) return wr; ho = 1; - const { isUSVString: e, bufferToLowerCasedHeaderName: t } = Ue(), { utf8DecodeBytes: A } = it(), { HTTP_TOKEN_CODEPOINTS: s, isomorphicDecode: r } = st(), { isFileLike: n } = Eo(), { makeEntry: o } = DA(), a = He, { File: u } = at, g = globalThis.File ?? u, i = Buffer.from('form-data; name="'), c = Buffer.from("; filename"), h = Buffer.from("--"), E = Buffer.from(`--\r + const { isUSVString: e, bufferToLowerCasedHeaderName: t } = Ue(), { utf8DecodeBytes: A } = it(), { HTTP_TOKEN_CODEPOINTS: s, isomorphicDecode: r } = st(), { isFileLike: n } = Eo(), { makeEntry: o } = DA(), a = He, { File: u } = at, l = globalThis.File ?? u, i = Buffer.from('form-data; name="'), c = Buffer.from("; filename"), Q = Buffer.from("--"), h = Buffer.from(`--\r `); - function C(d) { - for (let Q = 0; Q < d.length; ++Q) - if ((d.charCodeAt(Q) & -128) !== 0) + function B(f) { + for (let E = 0; E < f.length; ++E) + if ((f.charCodeAt(E) & -128) !== 0) return !1; return !0; } - function f(d) { - const Q = d.length; - if (Q < 27 || Q > 70) + function d(f) { + const E = f.length; + if (E < 27 || E > 70) return !1; - for (let w = 0; w < Q; ++w) { - const l = d.charCodeAt(w); - if (!(l >= 48 && l <= 57 || l >= 65 && l <= 90 || l >= 97 && l <= 122 || l === 39 || l === 45 || l === 95)) + for (let p = 0; p < E; ++p) { + const g = f.charCodeAt(p); + if (!(g >= 48 && g <= 57 || g >= 65 && g <= 90 || g >= 97 && g <= 122 || g === 39 || g === 45 || g === 95)) return !1; } return !0; } - function y(d, Q) { - a(Q !== "failure" && Q.essence === "multipart/form-data"); - const w = Q.parameters.get("boundary"); - if (w === void 0) + function y(f, E) { + a(E !== "failure" && E.essence === "multipart/form-data"); + const p = E.parameters.get("boundary"); + if (p === void 0) return "failure"; - const l = Buffer.from(`--${w}`, "utf8"), B = [], p = { position: 0 }; - for (; d[p.position] === 13 && d[p.position + 1] === 10; ) - p.position += 2; - let I = d.length; - for (; d[I - 1] === 10 && d[I - 2] === 13; ) + const g = Buffer.from(`--${p}`, "utf8"), C = [], w = { position: 0 }; + for (; f[w.position] === 13 && f[w.position + 1] === 10; ) + w.position += 2; + let I = f.length; + for (; f[I - 1] === 10 && f[I - 2] === 13; ) I -= 2; - for (I !== d.length && (d = d.subarray(0, I)); ; ) { - if (d.subarray(p.position, p.position + l.length).equals(l)) - p.position += l.length; + for (I !== f.length && (f = f.subarray(0, I)); ; ) { + if (f.subarray(w.position, w.position + g.length).equals(g)) + w.position += g.length; else return "failure"; - if (p.position === d.length - 2 && M(d, h, p) || p.position === d.length - 4 && M(d, E, p)) - return B; - if (d[p.position] !== 13 || d[p.position + 1] !== 10) + if (w.position === f.length - 2 && N(f, Q, w) || w.position === f.length - 4 && N(f, h, w)) + return C; + if (f[w.position] !== 13 || f[w.position + 1] !== 10) return "failure"; - p.position += 2; - const m = b(d, p); + w.position += 2; + const m = b(f, w); if (m === "failure") return "failure"; - let { name: D, filename: N, contentType: U, encoding: G } = m; - p.position += 2; + let { name: D, filename: U, contentType: S, encoding: G } = m; + w.position += 2; let v; { - const ne = d.indexOf(l.subarray(2), p.position); + const ne = f.indexOf(g.subarray(2), w.position); if (ne === -1) return "failure"; - v = d.subarray(p.position, ne - 4), p.position += v.length, G === "base64" && (v = Buffer.from(v.toString(), "base64")); + v = f.subarray(w.position, ne - 4), w.position += v.length, G === "base64" && (v = Buffer.from(v.toString(), "base64")); } - if (d[p.position] !== 13 || d[p.position + 1] !== 10) + if (f[w.position] !== 13 || f[w.position + 1] !== 10) return "failure"; - p.position += 2; + w.position += 2; let $; - N !== null ? (U ??= "text/plain", C(U) || (U = ""), $ = new g([v], N, { type: U })) : $ = A(Buffer.from(v)), a(e(D)), a(typeof $ == "string" && e($) || n($)), B.push(o(D, $, N)); + U !== null ? (S ??= "text/plain", B(S) || (S = ""), $ = new l([v], U, { type: S })) : $ = A(Buffer.from(v)), a(e(D)), a(typeof $ == "string" && e($) || n($)), C.push(o(D, $, U)); } } - function b(d, Q) { - let w = null, l = null, B = null, p = null; + function b(f, E) { + let p = null, g = null, C = null, w = null; for (; ; ) { - if (d[Q.position] === 13 && d[Q.position + 1] === 10) - return w === null ? "failure" : { name: w, filename: l, contentType: B, encoding: p }; - let I = S( + if (f[E.position] === 13 && f[E.position + 1] === 10) + return p === null ? "failure" : { name: p, filename: g, contentType: C, encoding: w }; + let I = M( (m) => m !== 10 && m !== 13 && m !== 58, - d, - Q + f, + E ); - if (I = L(I, !0, !0, (m) => m === 9 || m === 32), !s.test(I.toString()) || d[Q.position] !== 58) + if (I = L(I, !0, !0, (m) => m === 9 || m === 32), !s.test(I.toString()) || f[E.position] !== 58) return "failure"; - switch (Q.position++, S( + switch (E.position++, M( (m) => m === 32 || m === 9, - d, - Q + f, + E ), t(I)) { case "content-disposition": { - if (w = l = null, !M(d, i, Q) || (Q.position += 17, w = R(d, Q), w === null)) + if (p = g = null, !N(f, i, E) || (E.position += 17, p = F(f, E), p === null)) return "failure"; - if (M(d, c, Q)) { - let m = Q.position + c.length; - if (d[m] === 42 && (Q.position += 1, m += 1), d[m] !== 61 || d[m + 1] !== 34 || (Q.position += 12, l = R(d, Q), l === null)) + if (N(f, c, E)) { + let m = E.position + c.length; + if (f[m] === 42 && (E.position += 1, m += 1), f[m] !== 61 || f[m + 1] !== 34 || (E.position += 12, g = F(f, E), g === null)) return "failure"; } break; } case "content-type": { - let m = S( + let m = M( (D) => D !== 10 && D !== 13, - d, - Q + f, + E ); - m = L(m, !1, !0, (D) => D === 9 || D === 32), B = r(m); + m = L(m, !1, !0, (D) => D === 9 || D === 32), C = r(m); break; } case "content-transfer-encoding": { - let m = S( + let m = M( (D) => D !== 10 && D !== 13, - d, - Q + f, + E ); - m = L(m, !1, !0, (D) => D === 9 || D === 32), p = r(m); + m = L(m, !1, !0, (D) => D === 9 || D === 32), w = r(m); break; } default: - S( + M( (m) => m !== 10 && m !== 13, - d, - Q + f, + E ); } - if (d[Q.position] !== 13 && d[Q.position + 1] !== 10) + if (f[E.position] !== 13 && f[E.position + 1] !== 10) return "failure"; - Q.position += 2; + E.position += 2; } } - function R(d, Q) { - a(d[Q.position - 1] === 34); - let w = S( - (l) => l !== 10 && l !== 13 && l !== 34, - d, - Q + function F(f, E) { + a(f[E.position - 1] === 34); + let p = M( + (g) => g !== 10 && g !== 13 && g !== 34, + f, + E ); - return d[Q.position] !== 34 ? null : (Q.position++, w = new TextDecoder().decode(w).replace(/%0A/ig, ` -`).replace(/%0D/ig, "\r").replace(/%22/g, '"'), w); - } - function S(d, Q, w) { - let l = w.position; - for (; l < Q.length && d(Q[l]); ) - ++l; - return Q.subarray(w.position, w.position = l); - } - function L(d, Q, w, l) { - let B = 0, p = d.length - 1; - if (Q) - for (; B < d.length && l(d[B]); ) B++; - for (; p > 0 && l(d[p]); ) p--; - return B === 0 && p === d.length - 1 ? d : d.subarray(B, p + 1); - } - function M(d, Q, w) { - if (d.length < Q.length) + return f[E.position] !== 34 ? null : (E.position++, p = new TextDecoder().decode(p).replace(/%0A/ig, ` +`).replace(/%0D/ig, "\r").replace(/%22/g, '"'), p); + } + function M(f, E, p) { + let g = p.position; + for (; g < E.length && f(E[g]); ) + ++g; + return E.subarray(p.position, p.position = g); + } + function L(f, E, p, g) { + let C = 0, w = f.length - 1; + if (E) + for (; C < f.length && g(f[C]); ) C++; + for (; w > 0 && g(f[w]); ) w--; + return C === 0 && w === f.length - 1 ? f : f.subarray(C, w + 1); + } + function N(f, E, p) { + if (f.length < E.length) return !1; - for (let l = 0; l < Q.length; l++) - if (Q[l] !== d[w.position + l]) + for (let g = 0; g < E.length; g++) + if (E[g] !== f[p.position + g]) return !1; return !0; } return wr = { multipartFormDataParser: y, - validateBoundary: f + validateBoundary: d }, wr; } var mr, Bo; -function Xt() { +function $t() { if (Bo) return mr; Bo = 1; const e = Ue(), { @@ -3947,24 +3947,24 @@ function Xt() { fullyReadBody: o, extractMimeType: a, utf8DecodeBytes: u - } = it(), { FormData: g } = DA(), { kState: i } = Ft(), { webidl: c } = $e(), { Blob: h } = at, E = He, { isErrored: C, isDisturbed: f } = ot, { isArrayBuffer: y } = Un, { serializeAMimeType: b } = st(), { multipartFormDataParser: R } = Bg(); - let S; + } = it(), { FormData: l } = DA(), { kState: i } = Tt(), { webidl: c } = $e(), { Blob: Q } = at, h = He, { isErrored: B, isDisturbed: d } = ot, { isArrayBuffer: y } = Un, { serializeAMimeType: b } = st(), { multipartFormDataParser: F } = Bg(); + let M; try { const v = require("node:crypto"); - S = ($) => v.randomInt(0, $); + M = ($) => v.randomInt(0, $); } catch { - S = (v) => Math.floor(Math.random(v)); + M = (v) => Math.floor(Math.random(v)); } const L = new TextEncoder(); - function M() { + function N() { } - const d = globalThis.FinalizationRegistry && process.version.indexOf("v18") !== 0; - let Q; - d && (Q = new FinalizationRegistry((v) => { + const f = globalThis.FinalizationRegistry && process.version.indexOf("v18") !== 0; + let E; + f && (E = new FinalizationRegistry((v) => { const $ = v.deref(); - $ && !$.locked && !f($) && !C($) && $.cancel("Response object has been garbage collected").catch(M); + $ && !$.locked && !d($) && !B($) && $.cancel("Response object has been garbage collected").catch(N); })); - function w(v, $ = !1) { + function p(v, $ = !1) { let ne = null; v instanceof ReadableStream ? ne = v : A(v) ? ne = v.stream() : ne = new ReadableStream({ async pull(ye) { @@ -3974,7 +3974,7 @@ function Xt() { start() { }, type: "bytes" - }), E(s(ne)); + }), h(s(ne)); let ge = null, ae = null, Be = null, he = null; if (typeof v == "string") ae = v, he = "text/plain;charset=UTF-8"; @@ -3985,7 +3985,7 @@ function Xt() { else if (ArrayBuffer.isView(v)) ae = new Uint8Array(v.buffer.slice(v.byteOffset, v.byteOffset + v.byteLength)); else if (e.isFormDataLike(v)) { - const ye = `----formdata-undici-0${`${S(1e11)}`.padStart(11, "0")}`, we = `--${ye}\r + const ye = `----formdata-undici-0${`${M(1e11)}`.padStart(11, "0")}`, we = `--${ye}\r Content-Disposition: form-data`; const X = (Z) => Z.replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22"), W = (Z) => Z.replace(/\r?\n|\r/g, `\r `), re = [], J = new Uint8Array([13, 10]); @@ -4034,7 +4034,7 @@ Content-Type: ${se.type || "application/octet-stream"}\r queueMicrotask(() => { we.close(), we.byobRequest?.respond(0); }); - else if (!C(ne)) { + else if (!B(ne)) { const re = new Uint8Array(X); re.byteLength && we.enqueue(re); } @@ -4048,10 +4048,10 @@ Content-Type: ${se.type || "application/octet-stream"}\r } return [{ stream: ne, source: ae, length: Be }, he]; } - function l(v, $ = !1) { - return v instanceof ReadableStream && (E(!e.isDisturbed(v), "The body has already been consumed."), E(!v.locked, "The stream is locked.")), w(v, $); + function g(v, $ = !1) { + return v instanceof ReadableStream && (h(!e.isDisturbed(v), "The body has already been consumed."), h(!v.locked, "The stream is locked.")), p(v, $); } - function B(v, $) { + function C(v, $) { const [ne, ge] = $.stream.tee(); return $.stream = ne, { stream: ge, @@ -4059,7 +4059,7 @@ Content-Type: ${se.type || "application/octet-stream"}\r source: $.source }; } - function p(v) { + function w(v) { if (v.aborted) throw new DOMException("The operation was aborted.", "AbortError"); } @@ -4068,7 +4068,7 @@ Content-Type: ${se.type || "application/octet-stream"}\r blob() { return D(this, (ne) => { let ge = G(this); - return ge === null ? ge = "" : ge && (ge = b(ge)), new h([ne], { type: ge }); + return ge === null ? ge = "" : ge && (ge = b(ge)), new Q([ne], { type: ge }); }, v); }, arrayBuffer() { @@ -4078,7 +4078,7 @@ Content-Type: ${se.type || "application/octet-stream"}\r return D(this, u, v); }, json() { - return D(this, U, v); + return D(this, S, v); }, formData() { return D(this, (ne) => { @@ -4086,14 +4086,14 @@ Content-Type: ${se.type || "application/octet-stream"}\r if (ge !== null) switch (ge.essence) { case "multipart/form-data": { - const ae = R(ne, ge); + const ae = F(ne, ge); if (ae === "failure") throw new TypeError("Failed to parse body as FormData."); - const Be = new g(); + const Be = new l(); return Be[i] = ae, Be; } case "application/x-www-form-urlencoded": { - const ae = new URLSearchParams(ne.toString()), Be = new g(); + const ae = new URLSearchParams(ne.toString()), Be = new l(); for (const [he, Qe] of ae) Be.append(he, Qe); return Be; @@ -4113,9 +4113,9 @@ Content-Type: ${se.type || "application/octet-stream"}\r Object.assign(v.prototype, I(v)); } async function D(v, $, ne) { - if (c.brandCheck(v, ne), N(v)) + if (c.brandCheck(v, ne), U(v)) throw new TypeError("Body is unusable: Body has already been read"); - p(v[i]); + w(v[i]); const ge = n(), ae = (he) => ge.reject(he), Be = (he) => { try { ge.resolve($(he)); @@ -4125,11 +4125,11 @@ Content-Type: ${se.type || "application/octet-stream"}\r }; return v[i].body == null ? (Be(Buffer.allocUnsafe(0)), ge.promise) : (await o(v[i].body, Be, ae), ge.promise); } - function N(v) { + function U(v) { const $ = v[i].body; return $ != null && ($.stream.locked || e.isDisturbed($.stream)); } - function U(v) { + function S(v) { return JSON.parse(u(v)); } function G(v) { @@ -4137,50 +4137,50 @@ Content-Type: ${se.type || "application/octet-stream"}\r return ne === "failure" ? null : ne; } return mr = { - extractBody: w, - safelyExtractBody: l, - cloneBody: B, + extractBody: p, + safelyExtractBody: g, + cloneBody: C, mixinBody: m, - streamRegistry: Q, - hasFinalizationRegistry: d, - bodyUnusable: N + streamRegistry: E, + hasFinalizationRegistry: f, + bodyUnusable: U }, mr; } var yr, Co; function Cg() { if (Co) return yr; Co = 1; - const e = He, t = Ue(), { channels: A } = Zt(), s = Xn(), { + const e = He, t = Ue(), { channels: A } = Kt(), s = Xn(), { RequestContentLengthMismatchError: r, ResponseContentLengthMismatchError: n, RequestAbortedError: o, HeadersTimeoutError: a, HeadersOverflowError: u, - SocketError: g, + SocketError: l, InformationalError: i, BodyTimeoutError: c, - HTTPParserError: h, - ResponseExceededMaxSizeError: E + HTTPParserError: Q, + ResponseExceededMaxSizeError: h } = Ye(), { - kUrl: C, - kReset: f, + kUrl: B, + kReset: d, kClient: y, kParser: b, - kBlocking: R, - kRunning: S, + kBlocking: F, + kRunning: M, kPending: L, - kSize: M, - kWriting: d, - kQueue: Q, - kNoRef: w, - kKeepAliveDefaultTimeout: l, - kHostHeader: B, - kPendingIdx: p, + kSize: N, + kWriting: f, + kQueue: E, + kNoRef: p, + kKeepAliveDefaultTimeout: g, + kHostHeader: C, + kPendingIdx: w, kRunningIdx: I, kError: m, kPipelining: D, - kSocket: N, - kKeepAliveTimeoutValue: U, + kSocket: U, + kKeepAliveTimeoutValue: S, kMaxHeadersSize: G, kKeepAliveMaxTimeout: v, kKeepAliveTimeoutThreshold: $, @@ -4281,7 +4281,7 @@ function Cg() { const T = new Uint8Array(K.memory.buffer, be).indexOf(0); Se = "Response does not match the HTTP/1.1 protocol (" + Buffer.from(K.memory.buffer, be, T).toString() + ")"; } - throw new h(Se, W.ERROR[te], Y.slice(Ee)); + throw new Q(Se, W.ERROR[te], Y.slice(Ee)); } } catch (te) { t.destroy(ee, te); @@ -4297,7 +4297,7 @@ function Cg() { const { socket: Y, client: ee } = this; if (Y.destroyed) return -1; - const K = ee[Q][ee[I]]; + const K = ee[E][ee[I]]; if (!K) return -1; K.onResponseStarted(); @@ -4321,9 +4321,9 @@ function Cg() { } onUpgrade(Y) { const { upgrade: ee, client: K, socket: te, headers: Ee, statusCode: be } = this; - e(ee), e(K[N] === te), e(!te.destroyed), e(!this.paused), e((Ee.length & 1) === 0); - const Se = K[Q][K[I]]; - e(Se), e(Se.upgrade || Se.method === "CONNECT"), this.statusCode = null, this.statusText = "", this.shouldKeepAlive = null, this.headers = [], this.headersSize = 0, te.unshift(Y), te[b].destroy(), te[b] = null, te[y] = null, te[m] = null, P(te), K[N] = null, K[X] = null, K[Q][K[I]++] = null, K.emit("disconnect", K[C], [K], new i("upgrade")); + e(ee), e(K[U] === te), e(!te.destroyed), e(!this.paused), e((Ee.length & 1) === 0); + const Se = K[E][K[I]]; + e(Se), e(Se.upgrade || Se.method === "CONNECT"), this.statusCode = null, this.statusText = "", this.shouldKeepAlive = null, this.headers = [], this.headersSize = 0, te.unshift(Y), te[b].destroy(), te[b] = null, te[y] = null, te[m] = null, P(te), K[U] = null, K[X] = null, K[E][K[I]++] = null, K.emit("disconnect", K[B], [K], new i("upgrade")); try { Se.onUpgrade(be, Ee, te); } catch (T) { @@ -4335,44 +4335,44 @@ function Cg() { const { client: te, socket: Ee, headers: be, statusText: Se } = this; if (Ee.destroyed) return -1; - const T = te[Q][te[I]]; + const T = te[E][te[I]]; if (!T) return -1; if (e(!this.upgrade), e(this.statusCode < 200), Y === 100) - return t.destroy(Ee, new g("bad response", t.getSocketInfo(Ee))), -1; + return t.destroy(Ee, new l("bad response", t.getSocketInfo(Ee))), -1; if (ee && !T.upgrade) - return t.destroy(Ee, new g("bad upgrade", t.getSocketInfo(Ee))), -1; + return t.destroy(Ee, new l("bad upgrade", t.getSocketInfo(Ee))), -1; if (e(this.timeoutType === de), this.statusCode = Y, this.shouldKeepAlive = K || // Override llhttp value which does not allow keepAlive for HEAD. - T.method === "HEAD" && !Ee[f] && this.connection.toLowerCase() === "keep-alive", this.statusCode >= 200) { - const F = T.bodyTimeout != null ? T.bodyTimeout : te[ge]; - this.setTimeout(F, We); + T.method === "HEAD" && !Ee[d] && this.connection.toLowerCase() === "keep-alive", this.statusCode >= 200) { + const k = T.bodyTimeout != null ? T.bodyTimeout : te[ge]; + this.setTimeout(k, We); } else this.timeout && this.timeout.refresh && this.timeout.refresh(); if (T.method === "CONNECT") - return e(te[S] === 1), this.upgrade = !0, 2; + return e(te[M] === 1), this.upgrade = !0, 2; if (ee) - return e(te[S] === 1), this.upgrade = !0, 2; + return e(te[M] === 1), this.upgrade = !0, 2; if (e((this.headers.length & 1) === 0), this.headers = [], this.headersSize = 0, this.shouldKeepAlive && te[D]) { - const F = this.keepAlive ? t.parseKeepAliveTimeout(this.keepAlive) : null; - if (F != null) { + const k = this.keepAlive ? t.parseKeepAliveTimeout(this.keepAlive) : null; + if (k != null) { const O = Math.min( - F - te[$], + k - te[$], te[v] ); - O <= 0 ? Ee[f] = !0 : te[U] = O; + O <= 0 ? Ee[d] = !0 : te[S] = O; } else - te[U] = te[l]; + te[S] = te[g]; } else - Ee[f] = !0; + Ee[d] = !0; const x = T.onHeaders(Y, be, this.resume, Se) === !1; - return T.aborted ? -1 : T.method === "HEAD" || Y < 200 ? 1 : (Ee[R] && (Ee[R] = !1, te[we]()), x ? W.ERROR.PAUSED : 0); + return T.aborted ? -1 : T.method === "HEAD" || Y < 200 ? 1 : (Ee[F] && (Ee[F] = !1, te[we]()), x ? W.ERROR.PAUSED : 0); } onBody(Y) { const { client: ee, socket: K, statusCode: te, maxResponseSize: Ee } = this; if (K.destroyed) return -1; - const be = ee[Q][ee[I]]; + const be = ee[E][ee[I]]; if (e(be), e(this.timeoutType === We), this.timeout && this.timeout.refresh && this.timeout.refresh(), e(te >= 200), Ee > -1 && this.bytesRead + Y.length > Ee) - return t.destroy(K, new E()), -1; + return t.destroy(K, new h()), -1; if (this.bytesRead += Y.length, be.onData(Y) === !1) return W.ERROR.PAUSED; } @@ -4383,14 +4383,14 @@ function Cg() { if (te) return; e(K >= 100), e((this.headers.length & 1) === 0); - const x = Y[Q][Y[I]]; + const x = Y[E][Y[I]]; if (e(x), this.statusCode = null, this.statusText = "", this.bytesRead = 0, this.contentLength = "", this.keepAlive = "", this.connection = "", this.headers = [], this.headersSize = 0, !(K < 200)) { if (x.method !== "HEAD" && be && Se !== parseInt(be, 10)) return t.destroy(ee, new n()), -1; - if (x.onComplete(Ee), Y[Q][Y[I]++] = null, ee[d]) - return e(Y[S] === 0), t.destroy(ee, new i("reset")), W.ERROR.PAUSED; + if (x.onComplete(Ee), Y[E][Y[I]++] = null, ee[f]) + return e(Y[M] === 0), t.destroy(ee, new i("reset")), W.ERROR.PAUSED; if (T) { - if (ee[f] && Y[S] === 0) + if (ee[d] && Y[M] === 0) return t.destroy(ee, new i("reset")), W.ERROR.PAUSED; Y[D] == null || Y[D] === 1 ? setImmediate(() => Y[we]()) : Y[we](); } else return t.destroy(ee, new i("reset")), W.ERROR.PAUSED; @@ -4399,10 +4399,10 @@ function Cg() { } function j(Ie) { const { socket: Y, timeoutType: ee, client: K, paused: te } = Ie.deref(); - ee === de ? (!Y[d] || Y.writableNeedDrain || K[S] > 1) && (e(!te, "cannot be paused while waiting for headers"), t.destroy(Y, new a())) : ee === We ? te || t.destroy(Y, new c()) : ee === _e && (e(K[S] === 0 && K[U]), t.destroy(Y, new i("socket idle timeout"))); + ee === de ? (!Y[f] || Y.writableNeedDrain || K[M] > 1) && (e(!te, "cannot be paused while waiting for headers"), t.destroy(Y, new a())) : ee === We ? te || t.destroy(Y, new c()) : ee === _e && (e(K[M] === 0 && K[S]), t.destroy(Y, new i("socket idle timeout"))); } - async function k(Ie, Y) { - Ie[N] = Y, le || (le = await oe, oe = null), Y[w] = !1, Y[d] = !1, Y[f] = !1, Y[R] = !1, Y[b] = new Je(Ie, Y, le), V(Y, "error", function(K) { + async function R(Ie, Y) { + Ie[U] = Y, le || (le = await oe, oe = null), Y[p] = !1, Y[f] = !1, Y[d] = !1, Y[F] = !1, Y[b] = new Je(Ie, Y, le), V(Y, "error", function(K) { e(K.code !== "ERR_TLS_CERT_ALTNAME_INVALID"); const te = this[b]; if (K.code === "ECONNRESET" && te.statusCode && !te.shouldKeepAlive) { @@ -4419,23 +4419,23 @@ function Cg() { K.onMessageComplete(); return; } - t.destroy(this, new g("other side closed", t.getSocketInfo(this))); + t.destroy(this, new l("other side closed", t.getSocketInfo(this))); }), V(Y, "close", function() { const K = this[y], te = this[b]; te && (!this[m] && te.statusCode && !te.shouldKeepAlive && te.onMessageComplete(), this[b].destroy(), this[b] = null); - const Ee = this[m] || new g("closed", t.getSocketInfo(this)); - if (K[N] = null, K[X] = null, K.destroyed) { + const Ee = this[m] || new l("closed", t.getSocketInfo(this)); + if (K[U] = null, K[X] = null, K.destroyed) { e(K[L] === 0); - const be = K[Q].splice(K[I]); + const be = K[E].splice(K[I]); for (let Se = 0; Se < be.length; Se++) { const T = be[Se]; t.errorRequest(K, T, Ee); } - } else if (K[S] > 0 && Ee.code !== "UND_ERR_INFO") { - const be = K[Q][K[I]]; - K[Q][K[I]++] = null, t.errorRequest(K, be, Ee); + } else if (K[M] > 0 && Ee.code !== "UND_ERR_INFO") { + const be = K[E][K[I]]; + K[E][K[I]++] = null, t.errorRequest(K, be, Ee); } - K[p] = K[I], e(K[S] === 0), K.emit("disconnect", K[C], [K], Ee), K[we](); + K[w] = K[I], e(K[M] === 0), K.emit("disconnect", K[B], [K], Ee), K[we](); }); let ee = !1; return Y.on("close", () => { @@ -4456,17 +4456,17 @@ function Cg() { return Y.destroyed; }, busy(K) { - return !!(Y[d] || Y[f] || Y[R] || K && (Ie[S] > 0 && !K.idempotent || Ie[S] > 0 && (K.upgrade || K.method === "CONNECT") || Ie[S] > 0 && t.bodyLength(K.body) !== 0 && (t.isStream(K.body) || t.isAsyncIterable(K.body) || t.isFormDataLike(K.body)))); + return !!(Y[f] || Y[d] || Y[F] || K && (Ie[M] > 0 && !K.idempotent || Ie[M] > 0 && (K.upgrade || K.method === "CONNECT") || Ie[M] > 0 && t.bodyLength(K.body) !== 0 && (t.isStream(K.body) || t.isAsyncIterable(K.body) || t.isFormDataLike(K.body)))); } }; } function q(Ie) { - const Y = Ie[N]; + const Y = Ie[U]; if (Y && !Y.destroyed) { - if (Ie[M] === 0 ? !Y[w] && Y.unref && (Y.unref(), Y[w] = !0) : Y[w] && Y.ref && (Y.ref(), Y[w] = !1), Ie[M] === 0) - Y[b].timeoutType !== _e && Y[b].setTimeout(Ie[U], _e); - else if (Ie[S] > 0 && Y[b].statusCode < 200 && Y[b].timeoutType !== de) { - const ee = Ie[Q][Ie[I]], K = ee.headersTimeout != null ? ee.headersTimeout : Ie[ne]; + if (Ie[N] === 0 ? !Y[p] && Y.unref && (Y.unref(), Y[p] = !0) : Y[p] && Y.ref && (Y.ref(), Y[p] = !1), Ie[N] === 0) + Y[b].timeoutType !== _e && Y[b].setTimeout(Ie[S], _e); + else if (Ie[M] > 0 && Y[b].statusCode < 200 && Y[b].timeoutType !== de) { + const ee = Ie[E][Ie[I]], K = ee.headersTimeout != null ? ee.headersTimeout : Ie[ne]; Y[b].setTimeout(K, de); } } @@ -4476,21 +4476,21 @@ function Cg() { } function ue(Ie, Y) { const { method: ee, path: K, host: te, upgrade: Ee, blocking: be, reset: Se } = Y; - let { body: T, headers: x, contentLength: F } = Y; + let { body: T, headers: x, contentLength: k } = Y; const O = ee === "PUT" || ee === "POST" || ee === "PATCH" || ee === "QUERY" || ee === "PROPFIND" || ee === "PROPPATCH"; if (t.isFormDataLike(T)) { - Z || (Z = Xt().extractBody); + Z || (Z = $t().extractBody); const [ce, Fe] = Z(T); - Y.contentType == null && x.push("content-type", Fe), T = ce.stream, F = ce.length; + Y.contentType == null && x.push("content-type", Fe), T = ce.stream, k = ce.length; } else t.isBlobLike(T) && Y.contentType == null && T.type && x.push("content-type", T.type); T && typeof T.read == "function" && T.read(0); const H = t.bodyLength(T); - if (F = H ?? F, F === null && (F = Y.contentLength), F === 0 && !O && (F = null), ie(ee) && F > 0 && Y.contentLength !== null && Y.contentLength !== F) { + if (k = H ?? k, k === null && (k = Y.contentLength), k === 0 && !O && (k = null), ie(ee) && k > 0 && Y.contentLength !== null && Y.contentLength !== k) { if (Ie[ae]) return t.errorRequest(Ie, Y, new r()), !1; process.emitWarning(new r()); } - const _ = Ie[N], Ae = (ce) => { + const _ = Ie[U], Ae = (ce) => { Y.aborted || Y.completed || (t.errorRequest(Ie, Y, ce || new o()), t.destroy(T), t.destroy(_, new i("aborted"))); }; try { @@ -4500,13 +4500,13 @@ function Cg() { } if (Y.aborted) return !1; - ee === "HEAD" && (_[f] = !0), (Ee || ee === "CONNECT") && (_[f] = !0), Se != null && (_[f] = Se), Ie[Be] && _[he]++ >= Ie[Be] && (_[f] = !0), be && (_[R] = !0); + ee === "HEAD" && (_[d] = !0), (Ee || ee === "CONNECT") && (_[d] = !0), Se != null && (_[d] = Se), Ie[Be] && _[he]++ >= Ie[Be] && (_[d] = !0), be && (_[F] = !0); let z = `${ee} ${K} HTTP/1.1\r `; if (typeof te == "string" ? z += `host: ${te}\r -` : z += Ie[B], Ee ? z += `connection: upgrade\r +` : z += Ie[C], Ee ? z += `connection: upgrade\r upgrade: ${Ee}\r -` : Ie[D] && !_[f] ? z += `connection: keep-alive\r +` : Ie[D] && !_[d] ? z += `connection: keep-alive\r ` : z += `connection: close\r `, Array.isArray(x)) for (let ce = 0; ce < x.length; ce += 2) { @@ -4519,12 +4519,12 @@ upgrade: ${Ee}\r z += `${Fe}: ${Ge}\r `; } - return A.sendHeaders.hasSubscribers && A.sendHeaders.publish({ request: Y, headers: z, socket: _ }), !T || H === 0 ? De(Ae, null, Ie, Y, _, F, z, O) : t.isBuffer(T) ? De(Ae, T, Ie, Y, _, F, z, O) : t.isBlobLike(T) ? typeof T.stream == "function" ? ze(Ae, T.stream(), Ie, Y, _, F, z, O) : ve(Ae, T, Ie, Y, _, F, z, O) : t.isStream(T) ? Ce(Ae, T, Ie, Y, _, F, z, O) : t.isIterable(T) ? ze(Ae, T, Ie, Y, _, F, z, O) : e(!1), !0; + return A.sendHeaders.hasSubscribers && A.sendHeaders.publish({ request: Y, headers: z, socket: _ }), !T || H === 0 ? De(Ae, null, Ie, Y, _, k, z, O) : t.isBuffer(T) ? De(Ae, T, Ie, Y, _, k, z, O) : t.isBlobLike(T) ? typeof T.stream == "function" ? ze(Ae, T.stream(), Ie, Y, _, k, z, O) : ve(Ae, T, Ie, Y, _, k, z, O) : t.isStream(T) ? Ce(Ae, T, Ie, Y, _, k, z, O) : t.isIterable(T) ? ze(Ae, T, Ie, Y, _, k, z, O) : e(!1), !0; } function Ce(Ie, Y, ee, K, te, Ee, be, Se) { - e(Ee !== 0 || ee[S] === 0, "stream body cannot be pipelined"); + e(Ee !== 0 || ee[M] === 0, "stream body cannot be pipelined"); let T = !1; - const x = new Ke({ abort: Ie, socket: te, request: K, contentLength: Ee, client: ee, expectsPayload: Se, header: be }), F = function(Ae) { + const x = new Ke({ abort: Ie, socket: te, request: K, contentLength: Ee, client: ee, expectsPayload: Se, header: be }), k = function(Ae) { if (!T) try { !x.write(Ae) && this.pause && this.pause(); @@ -4542,7 +4542,7 @@ upgrade: ${Ee}\r } }, _ = function(Ae) { if (!T) { - if (T = !0, e(te.destroyed || te[d] && ee[S] <= 1), te.off("drain", O).off("error", _), Y.removeListener("data", F).removeListener("end", _).removeListener("close", H), !Ae) + if (T = !0, e(te.destroyed || te[f] && ee[M] <= 1), te.off("drain", O).off("error", _), Y.removeListener("data", k).removeListener("end", _).removeListener("close", H), !Ae) try { x.end(); } catch (z) { @@ -4551,13 +4551,13 @@ upgrade: ${Ee}\r x.destroy(Ae), Ae && (Ae.code !== "UND_ERR_INFO" || Ae.message !== "reset") ? t.destroy(Y, Ae) : t.destroy(Y); } }; - Y.on("data", F).on("end", _).on("error", _).on("close", H), Y.resume && Y.resume(), te.on("drain", O).on("error", _), Y.errorEmitted ?? Y.errored ? setImmediate(() => _(Y.errored)) : (Y.endEmitted ?? Y.readableEnded) && setImmediate(() => _(null)), (Y.closeEmitted ?? Y.closed) && setImmediate(H); + Y.on("data", k).on("end", _).on("error", _).on("close", H), Y.resume && Y.resume(), te.on("drain", O).on("error", _), Y.errorEmitted ?? Y.errored ? setImmediate(() => _(Y.errored)) : (Y.endEmitted ?? Y.readableEnded) && setImmediate(() => _(null)), (Y.closeEmitted ?? Y.closed) && setImmediate(H); } function De(Ie, Y, ee, K, te, Ee, be, Se) { try { Y ? t.isBuffer(Y) && (e(Ee === Y.byteLength, "buffer body must have content length"), te.cork(), te.write(`${be}content-length: ${Ee}\r \r -`, "latin1"), te.write(Y), te.uncork(), K.onBodySent(Y), !Se && K.reset !== !1 && (te[f] = !0)) : Ee === 0 ? te.write(`${be}content-length: 0\r +`, "latin1"), te.write(Y), te.uncork(), K.onBodySent(Y), !Se && K.reset !== !1 && (te[d] = !0)) : Ee === 0 ? te.write(`${be}content-length: 0\r \r `, "latin1") : (e(Ee === null, "no body must not have content length"), te.write(`${be}\r `, "latin1")), K.onRequestSent(), ee[we](); @@ -4573,13 +4573,13 @@ upgrade: ${Ee}\r const T = Buffer.from(await Y.arrayBuffer()); te.cork(), te.write(`${be}content-length: ${Ee}\r \r -`, "latin1"), te.write(T), te.uncork(), K.onBodySent(T), K.onRequestSent(), !Se && K.reset !== !1 && (te[f] = !0), ee[we](); +`, "latin1"), te.write(T), te.uncork(), K.onBodySent(T), K.onRequestSent(), !Se && K.reset !== !1 && (te[d] = !0), ee[we](); } catch (T) { Ie(T); } } async function ze(Ie, Y, ee, K, te, Ee, be, Se) { - e(Ee !== 0 || ee[S] === 0, "iterator body cannot be pipelined"); + e(Ee !== 0 || ee[M] === 0, "iterator body cannot be pipelined"); let T = null; function x() { if (T) { @@ -4587,7 +4587,7 @@ upgrade: ${Ee}\r T = null, H(); } } - const F = () => new Promise((H, _) => { + const k = () => new Promise((H, _) => { e(T === null), te[m] ? _(te[m]) : T = H; }); te.on("close", x).on("drain", x); @@ -4596,7 +4596,7 @@ upgrade: ${Ee}\r for await (const H of Y) { if (te[m]) throw te[m]; - O.write(H) || await F(); + O.write(H) || await k(); } O.end(); } catch (H) { @@ -4607,7 +4607,7 @@ upgrade: ${Ee}\r } class Ke { constructor({ abort: Y, socket: ee, request: K, contentLength: te, client: Ee, expectsPayload: be, header: Se }) { - this.socket = ee, this.request = K, this.contentLength = te, this.client = Ee, this.bytesWritten = 0, this.expectsPayload = be, this.header = Se, this.abort = Y, ee[d] = !0; + this.socket = ee, this.request = K, this.contentLength = te, this.client = Ee, this.bytesWritten = 0, this.expectsPayload = be, this.header = Se, this.abort = Y, ee[f] = !0; } write(Y) { const { socket: ee, request: K, contentLength: te, client: Ee, bytesWritten: be, expectsPayload: Se, header: T } = this; @@ -4623,18 +4623,18 @@ upgrade: ${Ee}\r throw new r(); process.emitWarning(new r()); } - ee.cork(), be === 0 && (!Se && K.reset !== !1 && (ee[f] = !0), te === null ? ee.write(`${T}transfer-encoding: chunked\r + ee.cork(), be === 0 && (!Se && K.reset !== !1 && (ee[d] = !0), te === null ? ee.write(`${T}transfer-encoding: chunked\r `, "latin1") : ee.write(`${T}content-length: ${te}\r \r `, "latin1")), te === null && ee.write(`\r ${x.toString(16)}\r `, "latin1"), this.bytesWritten += x; - const F = ee.write(Y); - return ee.uncork(), K.onBodySent(Y), F || ee[b].timeout && ee[b].timeoutType === de && ee[b].timeout.refresh && ee[b].timeout.refresh(), F; + const k = ee.write(Y); + return ee.uncork(), K.onBodySent(Y), k || ee[b].timeout && ee[b].timeoutType === de && ee[b].timeout.refresh && ee[b].timeout.refresh(), k; } end() { const { socket: Y, contentLength: ee, client: K, bytesWritten: te, expectsPayload: Ee, header: be, request: Se } = this; - if (Se.onRequestSent(), Y[d] = !1, Y[m]) + if (Se.onRequestSent(), Y[f] = !1, Y[m]) throw Y[m]; if (!Y.destroyed) { if (te === 0 ? Ee ? Y.write(`${be}content-length: 0\r @@ -4653,10 +4653,10 @@ ${x.toString(16)}\r } destroy(Y) { const { socket: ee, client: K, abort: te } = this; - ee[d] = !1, Y && (e(K[S] <= 1, "pipeline should only contain this request"), te(Y)); + ee[f] = !1, Y && (e(K[M] <= 1, "pipeline should only contain this request"), te(Y)); } } - return yr = k, yr; + return yr = R, yr; } var Dr, Io; function Ig() { @@ -4670,39 +4670,39 @@ function Ig() { } = Ye(), { kUrl: a, kReset: u, - kClient: g, + kClient: l, kRunning: i, kPending: c, - kQueue: h, - kPendingIdx: E, - kRunningIdx: C, - kError: f, + kQueue: Q, + kPendingIdx: h, + kRunningIdx: B, + kError: d, kSocket: y, kStrictContentLength: b, - kOnError: R, - kMaxConcurrentStreams: S, + kOnError: F, + kMaxConcurrentStreams: M, kHTTP2Session: L, - kResume: M, - kSize: d, - kHTTPContext: Q - } = Ve(), w = /* @__PURE__ */ Symbol("open streams"); - let l, B = !1, p; + kResume: N, + kSize: f, + kHTTPContext: E + } = Ve(), p = /* @__PURE__ */ Symbol("open streams"); + let g, C = !1, w; try { - p = require("node:http2"); + w = require("node:http2"); } catch { - p = { constants: {} }; + w = { constants: {} }; } const { constants: { HTTP2_HEADER_AUTHORITY: I, HTTP2_HEADER_METHOD: m, HTTP2_HEADER_PATH: D, - HTTP2_HEADER_SCHEME: N, - HTTP2_HEADER_CONTENT_LENGTH: U, + HTTP2_HEADER_SCHEME: U, + HTTP2_HEADER_CONTENT_LENGTH: S, HTTP2_HEADER_EXPECT: G, HTTP2_HEADER_STATUS: v } - } = p; + } = w; function $(V) { const P = []; for (const [Z, se] of Object.entries(V)) @@ -4714,30 +4714,30 @@ function Ig() { return P; } async function ne(V, P) { - V[y] = P, B || (B = !0, process.emitWarning("H2 support is experimental, expect them to change at any time.", { + V[y] = P, C || (C = !0, process.emitWarning("H2 support is experimental, expect them to change at any time.", { code: "UNDICI-H2" })); - const Z = p.connect(V[a], { + const Z = w.connect(V[a], { createConnection: () => P, - peerMaxConcurrentStreams: V[S] + peerMaxConcurrentStreams: V[M] }); - Z[w] = 0, Z[g] = V, Z[y] = P, A.addListener(Z, "error", ae), A.addListener(Z, "frameError", Be), A.addListener(Z, "end", he), A.addListener(Z, "goaway", Qe), A.addListener(Z, "close", function() { - const { [g]: le } = this, { [y]: oe } = le, fe = this[y][f] || this[f] || new n("closed", A.getSocketInfo(oe)); + Z[p] = 0, Z[l] = V, Z[y] = P, A.addListener(Z, "error", ae), A.addListener(Z, "frameError", Be), A.addListener(Z, "end", he), A.addListener(Z, "goaway", Qe), A.addListener(Z, "close", function() { + const { [l]: le } = this, { [y]: oe } = le, fe = this[y][d] || this[d] || new n("closed", A.getSocketInfo(oe)); if (le[L] = null, le.destroyed) { e(le[c] === 0); - const Me = le[h].splice(le[C]); + const Me = le[Q].splice(le[B]); for (let pe = 0; pe < Me.length; pe++) { const Le = Me[pe]; A.errorRequest(le, Le, fe); } } }), Z.unref(), V[L] = Z, P[L] = Z, A.addListener(P, "error", function(le) { - e(le.code !== "ERR_TLS_CERT_ALTNAME_INVALID"), this[f] = le, this[g][R](le); + e(le.code !== "ERR_TLS_CERT_ALTNAME_INVALID"), this[d] = le, this[l][F](le); }), A.addListener(P, "end", function() { A.destroy(this, new n("other side closed", A.getSocketInfo(this))); }), A.addListener(P, "close", function() { - const le = this[f] || new n("closed", A.getSocketInfo(this)); - V[y] = null, this[L] != null && this[L].destroy(le), V[E] = V[C], e(V[i] === 0), V.emit("disconnect", V[a], [V], le), V[M](); + const le = this[d] || new n("closed", A.getSocketInfo(this)); + V[y] = null, this[L] != null && this[L].destroy(le), V[h] = V[B], e(V[i] === 0), V.emit("disconnect", V[a], [V], le), V[N](); }); let se = !1; return P.on("close", () => { @@ -4764,15 +4764,15 @@ function Ig() { } function ge(V) { const P = V[y]; - P?.destroyed === !1 && (V[d] === 0 && V[S] === 0 ? (P.unref(), V[L].unref()) : (P.ref(), V[L].ref())); + P?.destroyed === !1 && (V[f] === 0 && V[M] === 0 ? (P.unref(), V[L].unref()) : (P.ref(), V[L].ref())); } function ae(V) { - e(V.code !== "ERR_TLS_CERT_ALTNAME_INVALID"), this[y][f] = V, this[g][R](V); + e(V.code !== "ERR_TLS_CERT_ALTNAME_INVALID"), this[y][d] = V, this[l][F](V); } function Be(V, P, Z) { if (Z === 0) { const se = new o(`HTTP/2: "frameError" received - type ${V}, code ${P}`); - this[y][f] = se, this[g][R](se); + this[y][d] = se, this[l][F](se); } } function he() { @@ -4780,12 +4780,12 @@ function Ig() { this.destroy(V), A.destroy(this[y], V); } function Qe(V) { - const P = this[f] || new n(`HTTP/2: "GOAWAY" frame received with code ${V}`, A.getSocketInfo(this)), Z = this[g]; - if (Z[y] = null, Z[Q] = null, this[L] != null && (this[L].destroy(P), this[L] = null), A.destroy(this[y], P), Z[C] < Z[h].length) { - const se = Z[h][Z[C]]; - Z[h][Z[C]++] = null, A.errorRequest(Z, se, P), Z[E] = Z[C]; + const P = this[d] || new n(`HTTP/2: "GOAWAY" frame received with code ${V}`, A.getSocketInfo(this)), Z = this[l]; + if (Z[y] = null, Z[E] = null, this[L] != null && (this[L].destroy(P), this[L] = null), A.destroy(this[y], P), Z[B] < Z[Q].length) { + const se = Z[Q][Z[B]]; + Z[Q][Z[B]++] = null, A.errorRequest(Z, se, P), Z[h] = Z[B]; } - e(Z[i] === 0), Z.emit("disconnect", Z[a], [Z], P), Z[M](); + e(Z[i] === 0), Z.emit("disconnect", Z[a], [Z], P), Z[N](); } function ye(V) { return V !== "GET" && V !== "HEAD" && V !== "OPTIONS" && V !== "TRACE" && V !== "CONNECT"; @@ -4808,7 +4808,7 @@ function Ig() { const { hostname: We, port: _e } = V[a]; ke[I] = oe || `${We}${_e ? `:${_e}` : ""}`, ke[m] = se; const Je = (ue) => { - P.aborted || P.completed || (ue = ue || new r(), A.errorRequest(V, P, ue), de != null && A.destroy(de, ue), A.destroy(Re, ue), V[h][V[C]++] = null, V[M]()); + P.aborted || P.completed || (ue = ue || new r(), A.errorRequest(V, P, ue), de != null && A.destroy(de, ue), A.destroy(Re, ue), V[Q][V[B]++] = null, V[N]()); }; try { P.onConnect(Je); @@ -4818,31 +4818,31 @@ function Ig() { if (P.aborted) return !1; if (se === "CONNECT") - return Z.ref(), de = Z.request(ke, { endStream: !1, signal: pe }), de.id && !de.pending ? (P.onUpgrade(null, null, de), ++Z[w], V[h][V[C]++] = null) : de.once("ready", () => { - P.onUpgrade(null, null, de), ++Z[w], V[h][V[C]++] = null; + return Z.ref(), de = Z.request(ke, { endStream: !1, signal: pe }), de.id && !de.pending ? (P.onUpgrade(null, null, de), ++Z[p], V[Q][V[B]++] = null) : de.once("ready", () => { + P.onUpgrade(null, null, de), ++Z[p], V[Q][V[B]++] = null; }), de.once("close", () => { - Z[w] -= 1, Z[w] === 0 && Z.unref(); + Z[p] -= 1, Z[p] === 0 && Z.unref(); }), !0; - ke[D] = le, ke[N] = "https"; + ke[D] = le, ke[U] = "https"; const j = se === "PUT" || se === "POST" || se === "PATCH"; Re && typeof Re.read == "function" && Re.read(0); - let k = A.bodyLength(Re); + let R = A.bodyLength(Re); if (A.isFormDataLike(Re)) { - l ??= Xt().extractBody; - const [ue, Ce] = l(Re); - ke["content-type"] = Ce, Re = ue.stream, k = ue.length; + g ??= $t().extractBody; + const [ue, Ce] = g(Re); + ke["content-type"] = Ce, Re = ue.stream, R = ue.length; } - if (k == null && (k = P.contentLength), (k === 0 || !j) && (k = null), ye(se) && k > 0 && P.contentLength != null && P.contentLength !== k) { + if (R == null && (R = P.contentLength), (R === 0 || !j) && (R = null), ye(se) && R > 0 && P.contentLength != null && P.contentLength !== R) { if (V[b]) return A.errorRequest(V, P, new s()), !1; process.emitWarning(new s()); } - k != null && (e(Re, "no body must not have content length"), ke[U] = `${k}`), Z.ref(); + R != null && (e(Re, "no body must not have content length"), ke[S] = `${R}`), Z.ref(); const q = se === "GET" || se === "HEAD" || Re === null; return Me ? (ke[G] = "100-continue", de = Z.request(ke, { endStream: q, signal: pe }), de.once("continue", ie)) : (de = Z.request(ke, { endStream: q, signal: pe - }), ie()), ++Z[w], de.once("response", (ue) => { + }), ie()), ++Z[p], de.once("response", (ue) => { const { [v]: Ce, ...De } = ue; if (P.onResponseStarted(), P.aborted) { const ve = new r(); @@ -4853,23 +4853,23 @@ function Ig() { P.onData(ve) === !1 && de.pause(); }); }), de.once("end", () => { - (de.state?.state == null || de.state.state < 6) && P.onComplete([]), Z[w] === 0 && Z.unref(), Je(new o("HTTP/2: stream half-closed (remote)")), V[h][V[C]++] = null, V[E] = V[C], V[M](); + (de.state?.state == null || de.state.state < 6) && P.onComplete([]), Z[p] === 0 && Z.unref(), Je(new o("HTTP/2: stream half-closed (remote)")), V[Q][V[B]++] = null, V[h] = V[B], V[N](); }), de.once("close", () => { - Z[w] -= 1, Z[w] === 0 && Z.unref(); + Z[p] -= 1, Z[p] === 0 && Z.unref(); }), de.once("error", function(ue) { Je(ue); }), de.once("frameError", (ue, Ce) => { Je(new o(`HTTP/2: "frameError" received - type ${ue}, code ${Ce}`)); }), !0; function ie() { - !Re || k === 0 ? X( + !Re || R === 0 ? X( Je, de, null, V, P, V[y], - k, + R, j ) : A.isBuffer(Re) ? X( Je, @@ -4878,7 +4878,7 @@ function Ig() { V, P, V[y], - k, + R, j ) : A.isBlobLike(Re) ? typeof Re.stream == "function" ? J( Je, @@ -4887,7 +4887,7 @@ function Ig() { V, P, V[y], - k, + R, j ) : re( Je, @@ -4896,7 +4896,7 @@ function Ig() { V, P, V[y], - k, + R, j ) : A.isStream(Re) ? W( Je, @@ -4906,7 +4906,7 @@ function Ig() { Re, V, P, - k + R ) : A.isIterable(Re) ? J( Je, de, @@ -4914,14 +4914,14 @@ function Ig() { V, P, V[y], - k, + R, j ) : e(!1); } } function X(V, P, Z, se, le, oe, fe, Me) { try { - Z != null && A.isBuffer(Z) && (e(fe === Z.byteLength, "buffer body must have content length"), P.cork(), P.write(Z), P.uncork(), P.end(), le.onBodySent(Z)), Me || (oe[u] = !0), le.onRequestSent(), se[M](); + Z != null && A.isBuffer(Z) && (e(fe === Z.byteLength, "buffer body must have content length"), P.cork(), P.write(Z), P.uncork(), P.end(), le.onBodySent(Z)), Me || (oe[u] = !0), le.onRequestSent(), se[N](); } catch (pe) { V(pe); } @@ -4932,7 +4932,7 @@ function Ig() { le, se, (Re) => { - Re ? (A.destroy(pe, Re), V(Re)) : (A.removeAllListeners(pe), fe.onRequestSent(), Z || (P[u] = !0), oe[M]()); + Re ? (A.destroy(pe, Re), V(Re)) : (A.removeAllListeners(pe), fe.onRequestSent(), Z || (P[u] = !0), oe[N]()); } ); A.addListener(pe, "data", Le); @@ -4946,7 +4946,7 @@ function Ig() { if (fe != null && fe !== Z.size) throw new s(); const pe = Buffer.from(await Z.arrayBuffer()); - P.cork(), P.write(pe), P.uncork(), P.end(), le.onBodySent(pe), le.onRequestSent(), Me || (oe[u] = !0), se[M](); + P.cork(), P.write(pe), P.uncork(), P.end(), le.onBodySent(pe), le.onRequestSent(), Me || (oe[u] = !0), se[N](); } catch (pe) { V(pe); } @@ -4961,17 +4961,17 @@ function Ig() { } } const Re = () => new Promise((ke, de) => { - e(pe === null), oe[f] ? de(oe[f]) : pe = ke; + e(pe === null), oe[d] ? de(oe[d]) : pe = ke; }); P.on("close", Le).on("drain", Le); try { for await (const ke of Z) { - if (oe[f]) - throw oe[f]; + if (oe[d]) + throw oe[d]; const de = P.write(ke); le.onBodySent(ke), de || await Re(); } - P.end(), le.onRequestSent(), Me || (oe[u] = !0), se[M](); + P.end(), le.onRequestSent(), Me || (oe[u] = !0), se[N](); } catch (ke) { V(ke); } finally { @@ -4984,83 +4984,83 @@ var br, fo; function Rr() { if (fo) return br; fo = 1; - const e = Ue(), { kBodyUsed: t } = Ve(), A = He, { InvalidArgumentError: s } = Ye(), r = Vt, n = [300, 301, 302, 303, 307, 308], o = /* @__PURE__ */ Symbol("body"); + const e = Ue(), { kBodyUsed: t } = Ve(), A = He, { InvalidArgumentError: s } = Ye(), r = Wt, n = [300, 301, 302, 303, 307, 308], o = /* @__PURE__ */ Symbol("body"); class a { - constructor(E) { - this[o] = E, this[t] = !1; + constructor(h) { + this[o] = h, this[t] = !1; } async *[Symbol.asyncIterator]() { A(!this[t], "disturbed"), this[t] = !0, yield* this[o]; } } class u { - constructor(E, C, f, y) { - if (C != null && (!Number.isInteger(C) || C < 0)) + constructor(h, B, d, y) { + if (B != null && (!Number.isInteger(B) || B < 0)) throw new s("maxRedirections must be a positive number"); - e.validateHandler(y, f.method, f.upgrade), this.dispatch = E, this.location = null, this.abort = null, this.opts = { ...f, maxRedirections: 0 }, this.maxRedirections = C, this.handler = y, this.history = [], this.redirectionLimitReached = !1, e.isStream(this.opts.body) ? (e.bodyLength(this.opts.body) === 0 && this.opts.body.on("data", function() { + e.validateHandler(y, d.method, d.upgrade), this.dispatch = h, this.location = null, this.abort = null, this.opts = { ...d, maxRedirections: 0 }, this.maxRedirections = B, this.handler = y, this.history = [], this.redirectionLimitReached = !1, e.isStream(this.opts.body) ? (e.bodyLength(this.opts.body) === 0 && this.opts.body.on("data", function() { A(!1); }), typeof this.opts.body.readableDidRead != "boolean" && (this.opts.body[t] = !1, r.prototype.on.call(this.opts.body, "data", function() { this[t] = !0; }))) : this.opts.body && typeof this.opts.body.pipeTo == "function" ? this.opts.body = new a(this.opts.body) : this.opts.body && typeof this.opts.body != "string" && !ArrayBuffer.isView(this.opts.body) && e.isIterable(this.opts.body) && (this.opts.body = new a(this.opts.body)); } - onConnect(E) { - this.abort = E, this.handler.onConnect(E, { history: this.history }); + onConnect(h) { + this.abort = h, this.handler.onConnect(h, { history: this.history }); } - onUpgrade(E, C, f) { - this.handler.onUpgrade(E, C, f); + onUpgrade(h, B, d) { + this.handler.onUpgrade(h, B, d); } - onError(E) { - this.handler.onError(E); + onError(h) { + this.handler.onError(h); } - onHeaders(E, C, f, y) { - if (this.location = this.history.length >= this.maxRedirections || e.isDisturbed(this.opts.body) ? null : g(E, C), this.opts.throwOnMaxRedirect && this.history.length >= this.maxRedirections) { + onHeaders(h, B, d, y) { + if (this.location = this.history.length >= this.maxRedirections || e.isDisturbed(this.opts.body) ? null : l(h, B), this.opts.throwOnMaxRedirect && this.history.length >= this.maxRedirections) { this.request && this.request.abort(new Error("max redirects")), this.redirectionLimitReached = !0, this.abort(new Error("max redirects")); return; } if (this.opts.origin && this.history.push(new URL(this.opts.path, this.opts.origin)), !this.location) - return this.handler.onHeaders(E, C, f, y); - const { origin: b, pathname: R, search: S } = e.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin))), L = S ? `${R}${S}` : R; - this.opts.headers = c(this.opts.headers, E === 303, this.opts.origin !== b), this.opts.path = L, this.opts.origin = b, this.opts.maxRedirections = 0, this.opts.query = null, E === 303 && this.opts.method !== "HEAD" && (this.opts.method = "GET", this.opts.body = null); + return this.handler.onHeaders(h, B, d, y); + const { origin: b, pathname: F, search: M } = e.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin))), L = M ? `${F}${M}` : F; + this.opts.headers = c(this.opts.headers, h === 303, this.opts.origin !== b), this.opts.path = L, this.opts.origin = b, this.opts.maxRedirections = 0, this.opts.query = null, h === 303 && this.opts.method !== "HEAD" && (this.opts.method = "GET", this.opts.body = null); } - onData(E) { - if (!this.location) return this.handler.onData(E); + onData(h) { + if (!this.location) return this.handler.onData(h); } - onComplete(E) { - this.location ? (this.location = null, this.abort = null, this.dispatch(this.opts, this)) : this.handler.onComplete(E); + onComplete(h) { + this.location ? (this.location = null, this.abort = null, this.dispatch(this.opts, this)) : this.handler.onComplete(h); } - onBodySent(E) { - this.handler.onBodySent && this.handler.onBodySent(E); + onBodySent(h) { + this.handler.onBodySent && this.handler.onBodySent(h); } } - function g(h, E) { - if (n.indexOf(h) === -1) + function l(Q, h) { + if (n.indexOf(Q) === -1) return null; - for (let C = 0; C < E.length; C += 2) - if (E[C].length === 8 && e.headerNameToString(E[C]) === "location") - return E[C + 1]; - } - function i(h, E, C) { - if (h.length === 4) - return e.headerNameToString(h) === "host"; - if (E && e.headerNameToString(h).startsWith("content-")) + for (let B = 0; B < h.length; B += 2) + if (h[B].length === 8 && e.headerNameToString(h[B]) === "location") + return h[B + 1]; + } + function i(Q, h, B) { + if (Q.length === 4) + return e.headerNameToString(Q) === "host"; + if (h && e.headerNameToString(Q).startsWith("content-")) return !0; - if (C && (h.length === 13 || h.length === 6 || h.length === 19)) { - const f = e.headerNameToString(h); - return f === "authorization" || f === "cookie" || f === "proxy-authorization"; + if (B && (Q.length === 13 || Q.length === 6 || Q.length === 19)) { + const d = e.headerNameToString(Q); + return d === "authorization" || d === "cookie" || d === "proxy-authorization"; } return !1; } - function c(h, E, C) { - const f = []; - if (Array.isArray(h)) - for (let y = 0; y < h.length; y += 2) - i(h[y], E, C) || f.push(h[y], h[y + 1]); - else if (h && typeof h == "object") - for (const y of Object.keys(h)) - i(y, E, C) || f.push(y, h[y]); + function c(Q, h, B) { + const d = []; + if (Array.isArray(Q)) + for (let y = 0; y < Q.length; y += 2) + i(Q[y], h, B) || d.push(Q[y], Q[y + 1]); + else if (Q && typeof Q == "object") + for (const y of Object.keys(Q)) + i(y, h, B) || d.push(y, Q[y]); else - A(h == null, "headers must be an object or an array"); - return f; + A(Q == null, "headers must be an object or an array"); + return d; } return br = u, br; } @@ -5081,36 +5081,36 @@ function Fr() { return kr = t, kr; } var Tr, wo; -function $t() { +function eA() { if (wo) return Tr; wo = 1; - const e = He, t = dA, A = fA, s = Ue(), { channels: r } = Zt(), n = ug(), o = Kt(), { + const e = He, t = dA, A = fA, s = Ue(), { channels: r } = Kt(), n = ug(), o = jt(), { InvalidArgumentError: a, InformationalError: u, - ClientDestroyedError: g + ClientDestroyedError: l } = Ye(), i = mA(), { kUrl: c, - kServerName: h, - kClient: E, - kBusy: C, - kConnect: f, + kServerName: Q, + kClient: h, + kBusy: B, + kConnect: d, kResuming: y, kRunning: b, - kPending: R, - kSize: S, + kPending: F, + kSize: M, kQueue: L, - kConnected: M, - kConnecting: d, - kNeedDrain: Q, - kKeepAliveDefaultTimeout: w, - kHostHeader: l, - kPendingIdx: B, - kRunningIdx: p, + kConnected: N, + kConnecting: f, + kNeedDrain: E, + kKeepAliveDefaultTimeout: p, + kHostHeader: g, + kPendingIdx: C, + kRunningIdx: w, kError: I, kPipelining: m, kKeepAliveTimeoutValue: D, - kMaxHeadersSize: N, - kKeepAliveMaxTimeout: U, + kMaxHeadersSize: U, + kKeepAliveMaxTimeout: S, kKeepAliveTimeoutThreshold: G, kHeadersTimeout: v, kBodyTimeout: $, @@ -5142,7 +5142,7 @@ function $t() { * @param {string|URL} url * @param {import('../../types/client.js').Client.Options} options */ - constructor(k, { + constructor(R, { interceptors: q, maxHeaderSize: ie, headersTimeout: ue, @@ -5161,7 +5161,7 @@ function $t() { tls: Se, strictContentLength: T, maxCachedSessions: x, - maxRedirections: F, + maxRedirections: k, connect: O, maxRequestsPerClient: H, localAddress: _, @@ -5200,7 +5200,7 @@ function $t() { throw new a("bodyTimeout must be a positive integer or zero"); if (O != null && typeof O != "function" && typeof O != "object") throw new a("connect must be a function or an object"); - if (F != null && (!Number.isInteger(F) || F < 0)) + if (k != null && (!Number.isInteger(k) || k < 0)) throw new a("maxRedirections must be a positive number"); if (H != null && (!Number.isInteger(H) || H < 0)) throw new a("maxRequestsPerClient must be a positive number"); @@ -5224,86 +5224,86 @@ function $t() { ...O })), q?.Client && Array.isArray(q.Client) ? (this[X] = q.Client, oe || (oe = !0, process.emitWarning("Client.Options#interceptor is deprecated. Use Dispatcher#compose instead.", { code: "UNDICI-CLIENT-INTERCEPTOR-DEPRECATED" - }))) : this[X] = [Re({ maxRedirections: F })], this[c] = s.parseOrigin(k), this[ge] = O, this[m] = be ?? 1, this[N] = ie || A.maxHeaderSize, this[w] = Y ?? 4e3, this[U] = K ?? 6e5, this[G] = te ?? 2e3, this[D] = this[w], this[h] = null, this[W] = _ ?? null, this[y] = 0, this[Q] = 0, this[l] = `host: ${this[c].hostname}${this[c].port ? `:${this[c].port}` : ""}\r -`, this[$] = ze ?? 3e5, this[v] = ue ?? 3e5, this[ne] = T ?? !0, this[ae] = F, this[Be] = H, this[fe] = null, this[re] = Ae > -1 ? Ae : -1, this[P] = Fe ?? 100, this[V] = null, this[L] = [], this[p] = 0, this[B] = 0, this[Z] = (Ne) => _e(this, Ne), this[J] = (Ne) => ke(this, Ne); + }))) : this[X] = [Re({ maxRedirections: k })], this[c] = s.parseOrigin(R), this[ge] = O, this[m] = be ?? 1, this[U] = ie || A.maxHeaderSize, this[p] = Y ?? 4e3, this[S] = K ?? 6e5, this[G] = te ?? 2e3, this[D] = this[p], this[Q] = null, this[W] = _ ?? null, this[y] = 0, this[E] = 0, this[g] = `host: ${this[c].hostname}${this[c].port ? `:${this[c].port}` : ""}\r +`, this[$] = ze ?? 3e5, this[v] = ue ?? 3e5, this[ne] = T ?? !0, this[ae] = k, this[Be] = H, this[fe] = null, this[re] = Ae > -1 ? Ae : -1, this[P] = Fe ?? 100, this[V] = null, this[L] = [], this[w] = 0, this[C] = 0, this[Z] = (Ne) => _e(this, Ne), this[J] = (Ne) => ke(this, Ne); } get pipelining() { return this[m]; } - set pipelining(k) { - this[m] = k, this[Z](!0); + set pipelining(R) { + this[m] = R, this[Z](!0); } - get [R]() { - return this[L].length - this[B]; + get [F]() { + return this[L].length - this[C]; } get [b]() { - return this[B] - this[p]; - } - get [S]() { - return this[L].length - this[p]; + return this[C] - this[w]; } get [M]() { - return !!this[V] && !this[d] && !this[V].destroyed; + return this[L].length - this[w]; + } + get [N]() { + return !!this[V] && !this[f] && !this[V].destroyed; } - get [C]() { - return !!(this[V]?.busy(null) || this[S] >= (pe(this) || 1) || this[R] > 0); + get [B]() { + return !!(this[V]?.busy(null) || this[M] >= (pe(this) || 1) || this[F] > 0); } /* istanbul ignore: only used for test */ - [f](k) { - de(this), this.once("connect", k); + [d](R) { + de(this), this.once("connect", R); } - [we](k, q) { - const ie = k.origin || this[c].origin, ue = new n(ie, k, q); - return this[L].push(ue), this[y] || (s.bodyLength(ue.body) == null && s.isIterable(ue.body) ? (this[y] = 1, queueMicrotask(() => _e(this))) : this[Z](!0)), this[y] && this[Q] !== 2 && this[C] && (this[Q] = 2), this[Q] < 2; + [we](R, q) { + const ie = R.origin || this[c].origin, ue = new n(ie, R, q); + return this[L].push(ue), this[y] || (s.bodyLength(ue.body) == null && s.isIterable(ue.body) ? (this[y] = 1, queueMicrotask(() => _e(this))) : this[Z](!0)), this[y] && this[E] !== 2 && this[B] && (this[E] = 2), this[E] < 2; } async [Qe]() { - return new Promise((k) => { - this[S] ? this[fe] = k : k(null); + return new Promise((R) => { + this[M] ? this[fe] = R : R(null); }); } - async [ye](k) { + async [ye](R) { return new Promise((q) => { - const ie = this[L].splice(this[B]); + const ie = this[L].splice(this[C]); for (let Ce = 0; Ce < ie.length; Ce++) { const De = ie[Ce]; - s.errorRequest(this, De, k); + s.errorRequest(this, De, R); } const ue = () => { this[fe] && (this[fe](), this[fe] = null), q(null); }; - this[V] ? (this[V].destroy(k, ue), this[V] = null) : queueMicrotask(ue), this[Z](); + this[V] ? (this[V].destroy(R, ue), this[V] = null) : queueMicrotask(ue), this[Z](); }); } } const Re = Fr(); - function ke(j, k) { - if (j[b] === 0 && k.code !== "UND_ERR_INFO" && k.code !== "UND_ERR_SOCKET") { - e(j[B] === j[p]); - const q = j[L].splice(j[p]); + function ke(j, R) { + if (j[b] === 0 && R.code !== "UND_ERR_INFO" && R.code !== "UND_ERR_SOCKET") { + e(j[C] === j[w]); + const q = j[L].splice(j[w]); for (let ie = 0; ie < q.length; ie++) { const ue = q[ie]; - s.errorRequest(j, ue, k); + s.errorRequest(j, ue, R); } - e(j[S] === 0); + e(j[M] === 0); } } async function de(j) { - e(!j[d]), e(!j[V]); - let { host: k, hostname: q, protocol: ie, port: ue } = j[c]; + e(!j[f]), e(!j[V]); + let { host: R, hostname: q, protocol: ie, port: ue } = j[c]; if (q[0] === "[") { const Ce = q.indexOf("]"); e(Ce !== -1); const De = q.substring(1, Ce); e(t.isIP(De)), q = De; } - j[d] = !0, r.beforeConnect.hasSubscribers && r.beforeConnect.publish({ + j[f] = !0, r.beforeConnect.hasSubscribers && r.beforeConnect.publish({ connectParams: { - host: k, + host: R, hostname: q, protocol: ie, port: ue, version: j[V]?.version, - servername: j[h], + servername: j[Q], localAddress: j[W] }, connector: j[ge] @@ -5311,18 +5311,18 @@ function $t() { try { const Ce = await new Promise((De, ve) => { j[ge]({ - host: k, + host: R, hostname: q, protocol: ie, port: ue, - servername: j[h], + servername: j[Q], localAddress: j[W] }, (ze, Ke) => { ze ? ve(ze) : De(Ke); }); }); if (j.destroyed) { - s.destroy(Ce.on("error", Me), new g()); + s.destroy(Ce.on("error", Me), new l()); return; } e(Ce); @@ -5331,14 +5331,14 @@ function $t() { } catch (De) { throw Ce.destroy().on("error", Me), De; } - j[d] = !1, Ce[he] = 0, Ce[Be] = j[Be], Ce[E] = j, Ce[I] = null, r.connected.hasSubscribers && r.connected.publish({ + j[f] = !1, Ce[he] = 0, Ce[Be] = j[Be], Ce[h] = j, Ce[I] = null, r.connected.hasSubscribers && r.connected.publish({ connectParams: { - host: k, + host: R, hostname: q, protocol: ie, port: ue, version: j[V]?.version, - servername: j[h], + servername: j[Q], localAddress: j[W] }, connector: j[ge], @@ -5347,21 +5347,21 @@ function $t() { } catch (Ce) { if (j.destroyed) return; - if (j[d] = !1, r.connectError.hasSubscribers && r.connectError.publish({ + if (j[f] = !1, r.connectError.hasSubscribers && r.connectError.publish({ connectParams: { - host: k, + host: R, hostname: q, protocol: ie, port: ue, version: j[V]?.version, - servername: j[h], + servername: j[Q], localAddress: j[W] }, connector: j[ge], error: Ce }), Ce.code === "ERR_TLS_CERT_ALTNAME_INVALID") - for (e(j[b] === 0); j[R] > 0 && j[L][j[B]].servername === j[h]; ) { - const De = j[L][j[B]++]; + for (e(j[b] === 0); j[F] > 0 && j[L][j[C]].servername === j[Q]; ) { + const De = j[L][j[C]++]; s.errorRequest(j, De, Ce); } else @@ -5371,38 +5371,38 @@ function $t() { j[Z](); } function We(j) { - j[Q] = 0, j.emit("drain", j[c], [j]); + j[E] = 0, j.emit("drain", j[c], [j]); } - function _e(j, k) { - j[y] !== 2 && (j[y] = 2, Je(j, k), j[y] = 0, j[p] > 256 && (j[L].splice(0, j[p]), j[B] -= j[p], j[p] = 0)); + function _e(j, R) { + j[y] !== 2 && (j[y] = 2, Je(j, R), j[y] = 0, j[w] > 256 && (j[L].splice(0, j[w]), j[C] -= j[w], j[w] = 0)); } - function Je(j, k) { + function Je(j, R) { for (; ; ) { if (j.destroyed) { - e(j[R] === 0); + e(j[F] === 0); return; } - if (j[fe] && !j[S]) { + if (j[fe] && !j[M]) { j[fe](), j[fe] = null; return; } - if (j[V] && j[V].resume(), j[C]) - j[Q] = 2; - else if (j[Q] === 2) { - k ? (j[Q] = 1, queueMicrotask(() => We(j))) : We(j); + if (j[V] && j[V].resume(), j[B]) + j[E] = 2; + else if (j[E] === 2) { + R ? (j[E] = 1, queueMicrotask(() => We(j))) : We(j); continue; } - if (j[R] === 0 || j[b] >= (pe(j) || 1)) + if (j[F] === 0 || j[b] >= (pe(j) || 1)) return; - const q = j[L][j[B]]; - if (j[c].protocol === "https:" && j[h] !== q.servername) { + const q = j[L][j[C]]; + if (j[c].protocol === "https:" && j[Q] !== q.servername) { if (j[b] > 0) return; - j[h] = q.servername, j[V]?.destroy(new u("servername changed"), () => { + j[Q] = q.servername, j[V]?.destroy(new u("servername changed"), () => { j[V] = null, _e(j); }); } - if (j[d]) + if (j[f]) return; if (!j[V]) { de(j); @@ -5410,7 +5410,7 @@ function $t() { } if (j[V].destroyed || j[V].busy(q)) return; - !q.aborted && j[V].write(q) ? j[B]++ : j[L].splice(j[B], 1); + !q.aborted && j[V].write(q) ? j[C]++ : j[L].splice(j[C], 1); } } return Tr = Le, Tr; @@ -5460,8 +5460,8 @@ function dg() { Do = 1; const { kFree: e, kConnected: t, kPending: A, kQueued: s, kRunning: r, kSize: n } = Ve(), o = /* @__PURE__ */ Symbol("pool"); class a { - constructor(g) { - this[o] = g; + constructor(l) { + this[o] = l; } get connected() { return this[o][t]; @@ -5488,61 +5488,61 @@ var Nr, bo; function Ro() { if (bo) return Nr; bo = 1; - const e = Kt(), t = yo(), { kConnected: A, kSize: s, kRunning: r, kPending: n, kQueued: o, kBusy: a, kFree: u, kUrl: g, kClose: i, kDestroy: c, kDispatch: h } = Ve(), E = dg(), C = /* @__PURE__ */ Symbol("clients"), f = /* @__PURE__ */ Symbol("needDrain"), y = /* @__PURE__ */ Symbol("queue"), b = /* @__PURE__ */ Symbol("closed resolve"), R = /* @__PURE__ */ Symbol("onDrain"), S = /* @__PURE__ */ Symbol("onConnect"), L = /* @__PURE__ */ Symbol("onDisconnect"), M = /* @__PURE__ */ Symbol("onConnectionError"), d = /* @__PURE__ */ Symbol("get dispatcher"), Q = /* @__PURE__ */ Symbol("add client"), w = /* @__PURE__ */ Symbol("remove client"), l = /* @__PURE__ */ Symbol("stats"); - class B extends e { + const e = jt(), t = yo(), { kConnected: A, kSize: s, kRunning: r, kPending: n, kQueued: o, kBusy: a, kFree: u, kUrl: l, kClose: i, kDestroy: c, kDispatch: Q } = Ve(), h = dg(), B = /* @__PURE__ */ Symbol("clients"), d = /* @__PURE__ */ Symbol("needDrain"), y = /* @__PURE__ */ Symbol("queue"), b = /* @__PURE__ */ Symbol("closed resolve"), F = /* @__PURE__ */ Symbol("onDrain"), M = /* @__PURE__ */ Symbol("onConnect"), L = /* @__PURE__ */ Symbol("onDisconnect"), N = /* @__PURE__ */ Symbol("onConnectionError"), f = /* @__PURE__ */ Symbol("get dispatcher"), E = /* @__PURE__ */ Symbol("add client"), p = /* @__PURE__ */ Symbol("remove client"), g = /* @__PURE__ */ Symbol("stats"); + class C extends e { constructor() { - super(), this[y] = new t(), this[C] = [], this[o] = 0; + super(), this[y] = new t(), this[B] = [], this[o] = 0; const I = this; - this[R] = function(D, N) { - const U = I[y]; + this[F] = function(D, U) { + const S = I[y]; let G = !1; for (; !G; ) { - const v = U.shift(); + const v = S.shift(); if (!v) break; I[o]--, G = !this.dispatch(v.opts, v.handler); } - this[f] = G, !this[f] && I[f] && (I[f] = !1, I.emit("drain", D, [I, ...N])), I[b] && U.isEmpty() && Promise.all(I[C].map((v) => v.close())).then(I[b]); - }, this[S] = (m, D) => { + this[d] = G, !this[d] && I[d] && (I[d] = !1, I.emit("drain", D, [I, ...U])), I[b] && S.isEmpty() && Promise.all(I[B].map((v) => v.close())).then(I[b]); + }, this[M] = (m, D) => { I.emit("connect", m, [I, ...D]); - }, this[L] = (m, D, N) => { - I.emit("disconnect", m, [I, ...D], N); - }, this[M] = (m, D, N) => { - I.emit("connectionError", m, [I, ...D], N); - }, this[l] = new E(this); + }, this[L] = (m, D, U) => { + I.emit("disconnect", m, [I, ...D], U); + }, this[N] = (m, D, U) => { + I.emit("connectionError", m, [I, ...D], U); + }, this[g] = new h(this); } get [a]() { - return this[f]; + return this[d]; } get [A]() { - return this[C].filter((I) => I[A]).length; + return this[B].filter((I) => I[A]).length; } get [u]() { - return this[C].filter((I) => I[A] && !I[f]).length; + return this[B].filter((I) => I[A] && !I[d]).length; } get [n]() { let I = this[o]; - for (const { [n]: m } of this[C]) + for (const { [n]: m } of this[B]) I += m; return I; } get [r]() { let I = 0; - for (const { [r]: m } of this[C]) + for (const { [r]: m } of this[B]) I += m; return I; } get [s]() { let I = this[o]; - for (const { [s]: m } of this[C]) + for (const { [s]: m } of this[B]) I += m; return I; } get stats() { - return this[l]; + return this[g]; } async [i]() { - this[y].isEmpty() ? await Promise.all(this[C].map((I) => I.close())) : await new Promise((I) => { + this[y].isEmpty() ? await Promise.all(this[B].map((I) => I.close())) : await new Promise((I) => { this[b] = I; }); } @@ -5553,35 +5553,35 @@ function Ro() { break; m.handler.onError(I); } - await Promise.all(this[C].map((m) => m.destroy(I))); + await Promise.all(this[B].map((m) => m.destroy(I))); } - [h](I, m) { - const D = this[d](); - return D ? D.dispatch(I, m) || (D[f] = !0, this[f] = !this[d]()) : (this[f] = !0, this[y].push({ opts: I, handler: m }), this[o]++), !this[f]; + [Q](I, m) { + const D = this[f](); + return D ? D.dispatch(I, m) || (D[d] = !0, this[d] = !this[f]()) : (this[d] = !0, this[y].push({ opts: I, handler: m }), this[o]++), !this[d]; } - [Q](I) { - return I.on("drain", this[R]).on("connect", this[S]).on("disconnect", this[L]).on("connectionError", this[M]), this[C].push(I), this[f] && queueMicrotask(() => { - this[f] && this[R](I[g], [this, I]); + [E](I) { + return I.on("drain", this[F]).on("connect", this[M]).on("disconnect", this[L]).on("connectionError", this[N]), this[B].push(I), this[d] && queueMicrotask(() => { + this[d] && this[F](I[l], [this, I]); }), this; } - [w](I) { + [p](I) { I.close(() => { - const m = this[C].indexOf(I); - m !== -1 && this[C].splice(m, 1); - }), this[f] = this[C].some((m) => !m[f] && m.closed !== !0 && m.destroyed !== !0); + const m = this[B].indexOf(I); + m !== -1 && this[B].splice(m, 1); + }), this[d] = this[B].some((m) => !m[d] && m.closed !== !0 && m.destroyed !== !0); } } return Nr = { - PoolBase: B, - kClients: C, - kNeedDrain: f, - kAddClient: Q, - kRemoveClient: w, - kGetDispatcher: d + PoolBase: C, + kClients: B, + kNeedDrain: d, + kAddClient: E, + kRemoveClient: p, + kGetDispatcher: f }, Nr; } var Mr, ko; -function eA() { +function tA() { if (ko) return Mr; ko = 1; const { @@ -5590,43 +5590,43 @@ function eA() { kNeedDrain: A, kAddClient: s, kGetDispatcher: r - } = Ro(), n = $t(), { + } = Ro(), n = eA(), { InvalidArgumentError: o - } = Ye(), a = Ue(), { kUrl: u, kInterceptors: g } = Ve(), i = mA(), c = /* @__PURE__ */ Symbol("options"), h = /* @__PURE__ */ Symbol("connections"), E = /* @__PURE__ */ Symbol("factory"); - function C(y, b) { + } = Ye(), a = Ue(), { kUrl: u, kInterceptors: l } = Ve(), i = mA(), c = /* @__PURE__ */ Symbol("options"), Q = /* @__PURE__ */ Symbol("connections"), h = /* @__PURE__ */ Symbol("factory"); + function B(y, b) { return new n(y, b); } - class f extends e { + class d extends e { constructor(b, { - connections: R, - factory: S = C, + connections: F, + factory: M = B, connect: L, - connectTimeout: M, - tls: d, - maxCachedSessions: Q, - socketPath: w, - autoSelectFamily: l, - autoSelectFamilyAttemptTimeout: B, - allowH2: p, + connectTimeout: N, + tls: f, + maxCachedSessions: E, + socketPath: p, + autoSelectFamily: g, + autoSelectFamilyAttemptTimeout: C, + allowH2: w, ...I } = {}) { - if (super(), R != null && (!Number.isFinite(R) || R < 0)) + if (super(), F != null && (!Number.isFinite(F) || F < 0)) throw new o("invalid connections"); - if (typeof S != "function") + if (typeof M != "function") throw new o("factory must be a function."); if (L != null && typeof L != "function" && typeof L != "object") throw new o("connect must be a function or an object"); typeof L != "function" && (L = i({ - ...d, - maxCachedSessions: Q, - allowH2: p, - socketPath: w, - timeout: M, - ...l ? { autoSelectFamily: l, autoSelectFamilyAttemptTimeout: B } : void 0, + ...f, + maxCachedSessions: E, + allowH2: w, + socketPath: p, + timeout: N, + ...g ? { autoSelectFamily: g, autoSelectFamilyAttemptTimeout: C } : void 0, ...L - })), this[g] = I.interceptors?.Pool && Array.isArray(I.interceptors.Pool) ? I.interceptors.Pool : [], this[h] = R || null, this[u] = a.parseOrigin(b), this[c] = { ...a.deepClone(I), connect: L, allowH2: p }, this[c].interceptors = I.interceptors ? { ...I.interceptors } : void 0, this[E] = S, this.on("connectionError", (m, D, N) => { - for (const U of D) { - const G = this[t].indexOf(U); + })), this[l] = I.interceptors?.Pool && Array.isArray(I.interceptors.Pool) ? I.interceptors.Pool : [], this[Q] = F || null, this[u] = a.parseOrigin(b), this[c] = { ...a.deepClone(I), connect: L, allowH2: w }, this[c].interceptors = I.interceptors ? { ...I.interceptors } : void 0, this[h] = M, this.on("connectionError", (m, D, U) => { + for (const S of D) { + const G = this[t].indexOf(S); G !== -1 && this[t].splice(G, 1); } }); @@ -5635,13 +5635,13 @@ function eA() { for (const b of this[t]) if (!b[A]) return b; - if (!this[h] || this[t].length < this[h]) { - const b = this[E](this[u], this[c]); + if (!this[Q] || this[t].length < this[Q]) { + const b = this[h](this[u], this[c]); return this[s](b), b; } } } - return Mr = f, Mr; + return Mr = d, Mr; } var Lr, Fo; function fg() { @@ -5657,126 +5657,126 @@ function fg() { kAddClient: n, kRemoveClient: o, kGetDispatcher: a - } = Ro(), u = eA(), { kUrl: g, kInterceptors: i } = Ve(), { parseOrigin: c } = Ue(), h = /* @__PURE__ */ Symbol("factory"), E = /* @__PURE__ */ Symbol("options"), C = /* @__PURE__ */ Symbol("kGreatestCommonDivisor"), f = /* @__PURE__ */ Symbol("kCurrentWeight"), y = /* @__PURE__ */ Symbol("kIndex"), b = /* @__PURE__ */ Symbol("kWeight"), R = /* @__PURE__ */ Symbol("kMaxWeightPerServer"), S = /* @__PURE__ */ Symbol("kErrorPenalty"); - function L(Q, w) { - if (Q === 0) return w; - for (; w !== 0; ) { - const l = w; - w = Q % w, Q = l; + } = Ro(), u = tA(), { kUrl: l, kInterceptors: i } = Ve(), { parseOrigin: c } = Ue(), Q = /* @__PURE__ */ Symbol("factory"), h = /* @__PURE__ */ Symbol("options"), B = /* @__PURE__ */ Symbol("kGreatestCommonDivisor"), d = /* @__PURE__ */ Symbol("kCurrentWeight"), y = /* @__PURE__ */ Symbol("kIndex"), b = /* @__PURE__ */ Symbol("kWeight"), F = /* @__PURE__ */ Symbol("kMaxWeightPerServer"), M = /* @__PURE__ */ Symbol("kErrorPenalty"); + function L(E, p) { + if (E === 0) return p; + for (; p !== 0; ) { + const g = p; + p = E % p, E = g; } - return Q; + return E; } - function M(Q, w) { - return new u(Q, w); + function N(E, p) { + return new u(E, p); } - class d extends A { - constructor(w = [], { factory: l = M, ...B } = {}) { - if (super(), this[E] = B, this[y] = -1, this[f] = 0, this[R] = this[E].maxWeightPerServer || 100, this[S] = this[E].errorPenalty || 15, Array.isArray(w) || (w = [w]), typeof l != "function") + class f extends A { + constructor(p = [], { factory: g = N, ...C } = {}) { + if (super(), this[h] = C, this[y] = -1, this[d] = 0, this[F] = this[h].maxWeightPerServer || 100, this[M] = this[h].errorPenalty || 15, Array.isArray(p) || (p = [p]), typeof g != "function") throw new t("factory must be a function."); - this[i] = B.interceptors?.BalancedPool && Array.isArray(B.interceptors.BalancedPool) ? B.interceptors.BalancedPool : [], this[h] = l; - for (const p of w) - this.addUpstream(p); + this[i] = C.interceptors?.BalancedPool && Array.isArray(C.interceptors.BalancedPool) ? C.interceptors.BalancedPool : [], this[Q] = g; + for (const w of p) + this.addUpstream(w); this._updateBalancedPoolStats(); } - addUpstream(w) { - const l = c(w).origin; - if (this[s].find((p) => p[g].origin === l && p.closed !== !0 && p.destroyed !== !0)) + addUpstream(p) { + const g = c(p).origin; + if (this[s].find((w) => w[l].origin === g && w.closed !== !0 && w.destroyed !== !0)) return this; - const B = this[h](l, Object.assign({}, this[E])); - this[n](B), B.on("connect", () => { - B[b] = Math.min(this[R], B[b] + this[S]); - }), B.on("connectionError", () => { - B[b] = Math.max(1, B[b] - this[S]), this._updateBalancedPoolStats(); - }), B.on("disconnect", (...p) => { - const I = p[2]; - I && I.code === "UND_ERR_SOCKET" && (B[b] = Math.max(1, B[b] - this[S]), this._updateBalancedPoolStats()); + const C = this[Q](g, Object.assign({}, this[h])); + this[n](C), C.on("connect", () => { + C[b] = Math.min(this[F], C[b] + this[M]); + }), C.on("connectionError", () => { + C[b] = Math.max(1, C[b] - this[M]), this._updateBalancedPoolStats(); + }), C.on("disconnect", (...w) => { + const I = w[2]; + I && I.code === "UND_ERR_SOCKET" && (C[b] = Math.max(1, C[b] - this[M]), this._updateBalancedPoolStats()); }); - for (const p of this[s]) - p[b] = this[R]; + for (const w of this[s]) + w[b] = this[F]; return this._updateBalancedPoolStats(), this; } _updateBalancedPoolStats() { - let w = 0; - for (let l = 0; l < this[s].length; l++) - w = L(this[s][l][b], w); - this[C] = w; + let p = 0; + for (let g = 0; g < this[s].length; g++) + p = L(this[s][g][b], p); + this[B] = p; } - removeUpstream(w) { - const l = c(w).origin, B = this[s].find((p) => p[g].origin === l && p.closed !== !0 && p.destroyed !== !0); - return B && this[o](B), this; + removeUpstream(p) { + const g = c(p).origin, C = this[s].find((w) => w[l].origin === g && w.closed !== !0 && w.destroyed !== !0); + return C && this[o](C), this; } get upstreams() { - return this[s].filter((w) => w.closed !== !0 && w.destroyed !== !0).map((w) => w[g].origin); + return this[s].filter((p) => p.closed !== !0 && p.destroyed !== !0).map((p) => p[l].origin); } [a]() { if (this[s].length === 0) throw new e(); if (!this[s].find((I) => !I[r] && I.closed !== !0 && I.destroyed !== !0) || this[s].map((I) => I[r]).reduce((I, m) => I && m, !0)) return; - let B = 0, p = this[s].findIndex((I) => !I[r]); - for (; B++ < this[s].length; ) { + let C = 0, w = this[s].findIndex((I) => !I[r]); + for (; C++ < this[s].length; ) { this[y] = (this[y] + 1) % this[s].length; const I = this[s][this[y]]; - if (I[b] > this[s][p][b] && !I[r] && (p = this[y]), this[y] === 0 && (this[f] = this[f] - this[C], this[f] <= 0 && (this[f] = this[R])), I[b] >= this[f] && !I[r]) + if (I[b] > this[s][w][b] && !I[r] && (w = this[y]), this[y] === 0 && (this[d] = this[d] - this[B], this[d] <= 0 && (this[d] = this[F])), I[b] >= this[d] && !I[r]) return I; } - return this[f] = this[s][p][b], this[y] = p, this[s][p]; + return this[d] = this[s][w][b], this[y] = w, this[s][w]; } } - return Lr = d, Lr; + return Lr = f, Lr; } var Gr, To; -function tA() { +function AA() { if (To) return Gr; To = 1; - const { InvalidArgumentError: e } = Ye(), { kClients: t, kRunning: A, kClose: s, kDestroy: r, kDispatch: n, kInterceptors: o } = Ve(), a = Kt(), u = eA(), g = $t(), i = Ue(), c = Fr(), h = /* @__PURE__ */ Symbol("onConnect"), E = /* @__PURE__ */ Symbol("onDisconnect"), C = /* @__PURE__ */ Symbol("onConnectionError"), f = /* @__PURE__ */ Symbol("maxRedirections"), y = /* @__PURE__ */ Symbol("onDrain"), b = /* @__PURE__ */ Symbol("factory"), R = /* @__PURE__ */ Symbol("options"); - function S(M, d) { - return d && d.connections === 1 ? new g(M, d) : new u(M, d); + const { InvalidArgumentError: e } = Ye(), { kClients: t, kRunning: A, kClose: s, kDestroy: r, kDispatch: n, kInterceptors: o } = Ve(), a = jt(), u = tA(), l = eA(), i = Ue(), c = Fr(), Q = /* @__PURE__ */ Symbol("onConnect"), h = /* @__PURE__ */ Symbol("onDisconnect"), B = /* @__PURE__ */ Symbol("onConnectionError"), d = /* @__PURE__ */ Symbol("maxRedirections"), y = /* @__PURE__ */ Symbol("onDrain"), b = /* @__PURE__ */ Symbol("factory"), F = /* @__PURE__ */ Symbol("options"); + function M(N, f) { + return f && f.connections === 1 ? new l(N, f) : new u(N, f); } class L extends a { - constructor({ factory: d = S, maxRedirections: Q = 0, connect: w, ...l } = {}) { - if (super(), typeof d != "function") + constructor({ factory: f = M, maxRedirections: E = 0, connect: p, ...g } = {}) { + if (super(), typeof f != "function") throw new e("factory must be a function."); - if (w != null && typeof w != "function" && typeof w != "object") + if (p != null && typeof p != "function" && typeof p != "object") throw new e("connect must be a function or an object"); - if (!Number.isInteger(Q) || Q < 0) + if (!Number.isInteger(E) || E < 0) throw new e("maxRedirections must be a positive number"); - w && typeof w != "function" && (w = { ...w }), this[o] = l.interceptors?.Agent && Array.isArray(l.interceptors.Agent) ? l.interceptors.Agent : [c({ maxRedirections: Q })], this[R] = { ...i.deepClone(l), connect: w }, this[R].interceptors = l.interceptors ? { ...l.interceptors } : void 0, this[f] = Q, this[b] = d, this[t] = /* @__PURE__ */ new Map(), this[y] = (B, p) => { - this.emit("drain", B, [this, ...p]); - }, this[h] = (B, p) => { - this.emit("connect", B, [this, ...p]); - }, this[E] = (B, p, I) => { - this.emit("disconnect", B, [this, ...p], I); - }, this[C] = (B, p, I) => { - this.emit("connectionError", B, [this, ...p], I); + p && typeof p != "function" && (p = { ...p }), this[o] = g.interceptors?.Agent && Array.isArray(g.interceptors.Agent) ? g.interceptors.Agent : [c({ maxRedirections: E })], this[F] = { ...i.deepClone(g), connect: p }, this[F].interceptors = g.interceptors ? { ...g.interceptors } : void 0, this[d] = E, this[b] = f, this[t] = /* @__PURE__ */ new Map(), this[y] = (C, w) => { + this.emit("drain", C, [this, ...w]); + }, this[Q] = (C, w) => { + this.emit("connect", C, [this, ...w]); + }, this[h] = (C, w, I) => { + this.emit("disconnect", C, [this, ...w], I); + }, this[B] = (C, w, I) => { + this.emit("connectionError", C, [this, ...w], I); }; } get [A]() { - let d = 0; - for (const Q of this[t].values()) - d += Q[A]; - return d; + let f = 0; + for (const E of this[t].values()) + f += E[A]; + return f; } - [n](d, Q) { - let w; - if (d.origin && (typeof d.origin == "string" || d.origin instanceof URL)) - w = String(d.origin); + [n](f, E) { + let p; + if (f.origin && (typeof f.origin == "string" || f.origin instanceof URL)) + p = String(f.origin); else throw new e("opts.origin must be a non-empty string or URL."); - let l = this[t].get(w); - return l || (l = this[b](d.origin, this[R]).on("drain", this[y]).on("connect", this[h]).on("disconnect", this[E]).on("connectionError", this[C]), this[t].set(w, l)), l.dispatch(d, Q); + let g = this[t].get(p); + return g || (g = this[b](f.origin, this[F]).on("drain", this[y]).on("connect", this[Q]).on("disconnect", this[h]).on("connectionError", this[B]), this[t].set(p, g)), g.dispatch(f, E); } async [s]() { - const d = []; - for (const Q of this[t].values()) - d.push(Q.close()); - this[t].clear(), await Promise.all(d); + const f = []; + for (const E of this[t].values()) + f.push(E.close()); + this[t].clear(), await Promise.all(f); } - async [r](d) { - const Q = []; - for (const w of this[t].values()) - Q.push(w.destroy(d)); - this[t].clear(), await Promise.all(Q); + async [r](f) { + const E = []; + for (const p of this[t].values()) + E.push(p.destroy(f)); + this[t].clear(), await Promise.all(E); } } return Gr = L, Gr; @@ -5785,33 +5785,33 @@ var vr, So; function Uo() { if (So) return vr; So = 1; - const { kProxy: e, kClose: t, kDestroy: A, kDispatch: s, kInterceptors: r } = Ve(), { URL: n } = Kc, o = tA(), a = eA(), u = Kt(), { InvalidArgumentError: g, RequestAbortedError: i, SecureProxyConnectionError: c } = Ye(), h = mA(), E = $t(), C = /* @__PURE__ */ Symbol("proxy agent"), f = /* @__PURE__ */ Symbol("proxy client"), y = /* @__PURE__ */ Symbol("proxy headers"), b = /* @__PURE__ */ Symbol("request tls settings"), R = /* @__PURE__ */ Symbol("proxy tls settings"), S = /* @__PURE__ */ Symbol("connect endpoint function"), L = /* @__PURE__ */ Symbol("tunnel proxy"); - function M(m) { + const { kProxy: e, kClose: t, kDestroy: A, kDispatch: s, kInterceptors: r } = Ve(), { URL: n } = Kc, o = AA(), a = tA(), u = jt(), { InvalidArgumentError: l, RequestAbortedError: i, SecureProxyConnectionError: c } = Ye(), Q = mA(), h = eA(), B = /* @__PURE__ */ Symbol("proxy agent"), d = /* @__PURE__ */ Symbol("proxy client"), y = /* @__PURE__ */ Symbol("proxy headers"), b = /* @__PURE__ */ Symbol("request tls settings"), F = /* @__PURE__ */ Symbol("proxy tls settings"), M = /* @__PURE__ */ Symbol("connect endpoint function"), L = /* @__PURE__ */ Symbol("tunnel proxy"); + function N(m) { return m === "https:" ? 443 : 80; } - function d(m, D) { + function f(m, D) { return new a(m, D); } - const Q = () => { + const E = () => { }; - function w(m, D) { - return D.connections === 1 ? new E(m, D) : new a(m, D); + function p(m, D) { + return D.connections === 1 ? new h(m, D) : new a(m, D); } - class l extends u { + class g extends u { #e; - constructor(D, { headers: N = {}, connect: U, factory: G }) { + constructor(D, { headers: U = {}, connect: S, factory: G }) { if (super(), !D) - throw new g("Proxy URL is mandatory"); - this[y] = N, G ? this.#e = G(D, { connect: U }) : this.#e = new E(D, { connect: U }); + throw new l("Proxy URL is mandatory"); + this[y] = U, G ? this.#e = G(D, { connect: S }) : this.#e = new h(D, { connect: S }); } - [s](D, N) { - const U = N.onHeaders; - N.onHeaders = function(ne, ge, ae) { + [s](D, U) { + const S = U.onHeaders; + U.onHeaders = function(ne, ge, ae) { if (ne === 407) { - typeof N.onError == "function" && N.onError(new g("Proxy Authentication Required (407)")); + typeof U.onError == "function" && U.onError(new l("Proxy Authentication Required (407)")); return; } - U && U.call(this, ne, ge, ae); + S && S.call(this, ne, ge, ae); }; const { origin: G, @@ -5822,7 +5822,7 @@ function Uo() { const { host: ne } = new n(G); $.host = ne; } - return D.headers = { ...this[y], ...$ }, this.#e[s](D, N); + return D.headers = { ...this[y], ...$ }, this.#e[s](D, U); } async [t]() { return this.#e.close(); @@ -5831,35 +5831,35 @@ function Uo() { return this.#e.destroy(D); } } - class B extends u { + class C extends u { constructor(D) { if (super(), !D || typeof D == "object" && !(D instanceof n) && !D.uri) - throw new g("Proxy uri is mandatory"); - const { clientFactory: N = d } = D; - if (typeof N != "function") - throw new g("Proxy opts.clientFactory must be a function."); - const { proxyTunnel: U = !0 } = D, G = this.#e(D), { href: v, origin: $, port: ne, protocol: ge, username: ae, password: Be, hostname: he } = G; - if (this[e] = { uri: v, protocol: ge }, this[r] = D.interceptors?.ProxyAgent && Array.isArray(D.interceptors.ProxyAgent) ? D.interceptors.ProxyAgent : [], this[b] = D.requestTls, this[R] = D.proxyTls, this[y] = D.headers || {}, this[L] = U, D.auth && D.token) - throw new g("opts.auth cannot be used in combination with opts.token"); + throw new l("Proxy uri is mandatory"); + const { clientFactory: U = f } = D; + if (typeof U != "function") + throw new l("Proxy opts.clientFactory must be a function."); + const { proxyTunnel: S = !0 } = D, G = this.#e(D), { href: v, origin: $, port: ne, protocol: ge, username: ae, password: Be, hostname: he } = G; + if (this[e] = { uri: v, protocol: ge }, this[r] = D.interceptors?.ProxyAgent && Array.isArray(D.interceptors.ProxyAgent) ? D.interceptors.ProxyAgent : [], this[b] = D.requestTls, this[F] = D.proxyTls, this[y] = D.headers || {}, this[L] = S, D.auth && D.token) + throw new l("opts.auth cannot be used in combination with opts.token"); D.auth ? this[y]["proxy-authorization"] = `Basic ${D.auth}` : D.token ? this[y]["proxy-authorization"] = D.token : ae && Be && (this[y]["proxy-authorization"] = `Basic ${Buffer.from(`${decodeURIComponent(ae)}:${decodeURIComponent(Be)}`).toString("base64")}`); - const Qe = h({ ...D.proxyTls }); - this[S] = h({ ...D.requestTls }); - const ye = D.factory || w, we = (X, W) => { + const Qe = Q({ ...D.proxyTls }); + this[M] = Q({ ...D.requestTls }); + const ye = D.factory || p, we = (X, W) => { const { protocol: re } = new n(X); - return !this[L] && re === "http:" && this[e].protocol === "http:" ? new l(this[e].uri, { + return !this[L] && re === "http:" && this[e].protocol === "http:" ? new g(this[e].uri, { headers: this[y], connect: Qe, factory: ye }) : ye(X, W); }; - this[f] = N(G, { connect: Qe }), this[C] = new o({ + this[d] = U(G, { connect: Qe }), this[B] = new o({ ...D, factory: we, connect: async (X, W) => { let re = X.host; - X.port || (re += `:${M(X.protocol)}`); + X.port || (re += `:${N(X.protocol)}`); try { - const { socket: J, statusCode: V } = await this[f].connect({ + const { socket: J, statusCode: V } = await this[d].connect({ origin: $, port: ne, path: re, @@ -5868,32 +5868,32 @@ function Uo() { ...this[y], host: X.host }, - servername: this[R]?.servername || he + servername: this[F]?.servername || he }); - if (V !== 200 && (J.on("error", Q).destroy(), W(new i(`Proxy response (${V}) !== 200 when HTTP Tunneling`))), X.protocol !== "https:") { + if (V !== 200 && (J.on("error", E).destroy(), W(new i(`Proxy response (${V}) !== 200 when HTTP Tunneling`))), X.protocol !== "https:") { W(null, J); return; } let P; - this[b] ? P = this[b].servername : P = X.servername, this[S]({ ...X, servername: P, httpSocket: J }, W); + this[b] ? P = this[b].servername : P = X.servername, this[M]({ ...X, servername: P, httpSocket: J }, W); } catch (J) { J.code === "ERR_TLS_CERT_ALTNAME_INVALID" ? W(new c(J)) : W(J); } } }); } - dispatch(D, N) { - const U = p(D.headers); - if (I(U), U && !("host" in U) && !("Host" in U)) { + dispatch(D, U) { + const S = w(D.headers); + if (I(S), S && !("host" in S) && !("Host" in S)) { const { host: G } = new n(D.origin); - U.host = G; + S.host = G; } - return this[C].dispatch( + return this[B].dispatch( { ...D, - headers: U + headers: S }, - N + U ); } /** @@ -5904,95 +5904,95 @@ function Uo() { return typeof D == "string" ? new n(D) : D instanceof n ? D : new n(D.uri); } async [t]() { - await this[C].close(), await this[f].close(); + await this[B].close(), await this[d].close(); } async [A]() { - await this[C].destroy(), await this[f].destroy(); + await this[B].destroy(), await this[d].destroy(); } } - function p(m) { + function w(m) { if (Array.isArray(m)) { const D = {}; - for (let N = 0; N < m.length; N += 2) - D[m[N]] = m[N + 1]; + for (let U = 0; U < m.length; U += 2) + D[m[U]] = m[U + 1]; return D; } return m; } function I(m) { - if (m && Object.keys(m).find((N) => N.toLowerCase() === "proxy-authorization")) - throw new g("Proxy-Authorization should be sent in ProxyAgent constructor"); + if (m && Object.keys(m).find((U) => U.toLowerCase() === "proxy-authorization")) + throw new l("Proxy-Authorization should be sent in ProxyAgent constructor"); } - return vr = B, vr; + return vr = C, vr; } var Yr, No; function pg() { if (No) return Yr; No = 1; - const e = Kt(), { kClose: t, kDestroy: A, kClosed: s, kDestroyed: r, kDispatch: n, kNoProxyAgent: o, kHttpProxyAgent: a, kHttpsProxyAgent: u } = Ve(), g = Uo(), i = tA(), c = { + const e = jt(), { kClose: t, kDestroy: A, kClosed: s, kDestroyed: r, kDispatch: n, kNoProxyAgent: o, kHttpProxyAgent: a, kHttpsProxyAgent: u } = Ve(), l = Uo(), i = AA(), c = { "http:": 80, "https:": 443 }; - let h = !1; - class E extends e { + let Q = !1; + class h extends e { #e = null; #t = null; #s = null; - constructor(f = {}) { - super(), this.#s = f, h || (h = !0, process.emitWarning("EnvHttpProxyAgent is experimental, expect them to change at any time.", { + constructor(d = {}) { + super(), this.#s = d, Q || (Q = !0, process.emitWarning("EnvHttpProxyAgent is experimental, expect them to change at any time.", { code: "UNDICI-EHPA" })); - const { httpProxy: y, httpsProxy: b, noProxy: R, ...S } = f; - this[o] = new i(S); + const { httpProxy: y, httpsProxy: b, noProxy: F, ...M } = d; + this[o] = new i(M); const L = y ?? process.env.http_proxy ?? process.env.HTTP_PROXY; - L ? this[a] = new g({ ...S, uri: L }) : this[a] = this[o]; - const M = b ?? process.env.https_proxy ?? process.env.HTTPS_PROXY; - M ? this[u] = new g({ ...S, uri: M }) : this[u] = this[a], this.#n(); + L ? this[a] = new l({ ...M, uri: L }) : this[a] = this[o]; + const N = b ?? process.env.https_proxy ?? process.env.HTTPS_PROXY; + N ? this[u] = new l({ ...M, uri: N }) : this[u] = this[a], this.#n(); } - [n](f, y) { - const b = new URL(f.origin); - return this.#r(b).dispatch(f, y); + [n](d, y) { + const b = new URL(d.origin); + return this.#r(b).dispatch(d, y); } async [t]() { await this[o].close(), this[a][s] || await this[a].close(), this[u][s] || await this[u].close(); } - async [A](f) { - await this[o].destroy(f), this[a][r] || await this[a].destroy(f), this[u][r] || await this[u].destroy(f); + async [A](d) { + await this[o].destroy(d), this[a][r] || await this[a].destroy(d), this[u][r] || await this[u].destroy(d); } - #r(f) { - let { protocol: y, host: b, port: R } = f; - return b = b.replace(/:\d*$/, "").toLowerCase(), R = Number.parseInt(R, 10) || c[y] || 0, this.#A(b, R) ? y === "https:" ? this[u] : this[a] : this[o]; + #r(d) { + let { protocol: y, host: b, port: F } = d; + return b = b.replace(/:\d*$/, "").toLowerCase(), F = Number.parseInt(F, 10) || c[y] || 0, this.#A(b, F) ? y === "https:" ? this[u] : this[a] : this[o]; } - #A(f, y) { + #A(d, y) { if (this.#o && this.#n(), this.#t.length === 0) return !0; if (this.#e === "*") return !1; for (let b = 0; b < this.#t.length; b++) { - const R = this.#t[b]; - if (!(R.port && R.port !== y)) { - if (/^[.*]/.test(R.hostname)) { - if (f.endsWith(R.hostname.replace(/^\*/, ""))) + const F = this.#t[b]; + if (!(F.port && F.port !== y)) { + if (/^[.*]/.test(F.hostname)) { + if (d.endsWith(F.hostname.replace(/^\*/, ""))) return !1; - } else if (f === R.hostname) + } else if (d === F.hostname) return !1; } } return !0; } #n() { - const f = this.#s.noProxy ?? this.#i, y = f.split(/[,\s]/), b = []; - for (let R = 0; R < y.length; R++) { - const S = y[R]; - if (!S) + const d = this.#s.noProxy ?? this.#i, y = d.split(/[,\s]/), b = []; + for (let F = 0; F < y.length; F++) { + const M = y[F]; + if (!M) continue; - const L = S.match(/^(.+):(\d+)$/); + const L = M.match(/^(.+):(\d+)$/); b.push({ - hostname: (L ? L[1] : S).toLowerCase(), + hostname: (L ? L[1] : M).toLowerCase(), port: L ? Number.parseInt(L[2], 10) : 0 }); } - this.#e = f, this.#t = b; + this.#e = d, this.#t = b; } get #o() { return this.#s.noProxy !== void 0 ? !1 : this.#e !== this.#i; @@ -6001,7 +6001,7 @@ function pg() { return process.env.no_proxy ?? process.env.NO_PROXY ?? ""; } } - return Yr = E, Yr; + return Yr = h, Yr; } var Jr, Mo; function Hr() { @@ -6013,38 +6013,38 @@ function Hr() { parseRangeHeader: n, wrapRequestBody: o } = Ue(); - function a(g) { + function a(l) { const i = Date.now(); - return new Date(g).getTime() - i; + return new Date(l).getTime() - i; } class u { constructor(i, c) { - const { retryOptions: h, ...E } = i, { + const { retryOptions: Q, ...h } = i, { // Retry scoped - retry: C, - maxRetries: f, + retry: B, + maxRetries: d, maxTimeout: y, minTimeout: b, - timeoutFactor: R, + timeoutFactor: F, // Response scoped - methods: S, + methods: M, errorCodes: L, - retryAfter: M, - statusCodes: d - } = h ?? {}; - this.dispatch = c.dispatch, this.handler = c.handler, this.opts = { ...E, body: o(i.body) }, this.abort = null, this.aborted = !1, this.retryOpts = { - retry: C ?? u[t], - retryAfter: M ?? !0, + retryAfter: N, + statusCodes: f + } = Q ?? {}; + this.dispatch = c.dispatch, this.handler = c.handler, this.opts = { ...h, body: o(i.body) }, this.abort = null, this.aborted = !1, this.retryOpts = { + retry: B ?? u[t], + retryAfter: N ?? !0, maxTimeout: y ?? 30 * 1e3, // 30s, minTimeout: b ?? 500, // .5s - timeoutFactor: R ?? 2, - maxRetries: f ?? 5, + timeoutFactor: F ?? 2, + maxRetries: d ?? 5, // What errors we should retry - methods: S ?? ["GET", "HEAD", "OPTIONS", "PUT", "DELETE", "TRACE"], + methods: M ?? ["GET", "HEAD", "OPTIONS", "PUT", "DELETE", "TRACE"], // Indicates which errors to retry - statusCodes: d ?? [500, 502, 503, 504, 429], + statusCodes: f ?? [500, 502, 503, 504, 429], // List of errors to retry errorCodes: L ?? [ "ECONNRESET", @@ -6057,15 +6057,15 @@ function Hr() { "EPIPE", "UND_ERR_SOCKET" ] - }, this.retryCount = 0, this.retryCountCheckpoint = 0, this.start = 0, this.end = null, this.etag = null, this.resume = null, this.handler.onConnect((Q) => { - this.aborted = !0, this.abort ? this.abort(Q) : this.reason = Q; + }, this.retryCount = 0, this.retryCountCheckpoint = 0, this.start = 0, this.end = null, this.etag = null, this.resume = null, this.handler.onConnect((E) => { + this.aborted = !0, this.abort ? this.abort(E) : this.reason = E; }); } onRequestSent() { this.handler.onRequestSent && this.handler.onRequestSent(); } - onUpgrade(i, c, h) { - this.handler.onUpgrade && this.handler.onUpgrade(i, c, h); + onUpgrade(i, c, Q) { + this.handler.onUpgrade && this.handler.onUpgrade(i, c, Q); } onConnect(i) { this.aborted ? i(this.reason) : this.abort = i; @@ -6073,48 +6073,48 @@ function Hr() { onBodySent(i) { if (this.handler.onBodySent) return this.handler.onBodySent(i); } - static [t](i, { state: c, opts: h }, E) { - const { statusCode: C, code: f, headers: y } = i, { method: b, retryOptions: R } = h, { - maxRetries: S, + static [t](i, { state: c, opts: Q }, h) { + const { statusCode: B, code: d, headers: y } = i, { method: b, retryOptions: F } = Q, { + maxRetries: M, minTimeout: L, - maxTimeout: M, - timeoutFactor: d, - statusCodes: Q, - errorCodes: w, - methods: l - } = R, { counter: B } = c; - if (f && f !== "UND_ERR_REQ_RETRY" && !w.includes(f)) { - E(i); + maxTimeout: N, + timeoutFactor: f, + statusCodes: E, + errorCodes: p, + methods: g + } = F, { counter: C } = c; + if (d && d !== "UND_ERR_REQ_RETRY" && !p.includes(d)) { + h(i); return; } - if (Array.isArray(l) && !l.includes(b)) { - E(i); + if (Array.isArray(g) && !g.includes(b)) { + h(i); return; } - if (C != null && Array.isArray(Q) && !Q.includes(C)) { - E(i); + if (B != null && Array.isArray(E) && !E.includes(B)) { + h(i); return; } - if (B > S) { - E(i); + if (C > M) { + h(i); return; } - let p = y?.["retry-after"]; - p && (p = Number(p), p = Number.isNaN(p) ? a(p) : p * 1e3); - const I = p > 0 ? Math.min(p, M) : Math.min(L * d ** (B - 1), M); - setTimeout(() => E(null), I); + let w = y?.["retry-after"]; + w && (w = Number(w), w = Number.isNaN(w) ? a(w) : w * 1e3); + const I = w > 0 ? Math.min(w, N) : Math.min(L * f ** (C - 1), N); + setTimeout(() => h(null), I); } - onHeaders(i, c, h, E) { - const C = r(c); + onHeaders(i, c, Q, h) { + const B = r(c); if (this.retryCount += 1, i >= 300) return this.retryOpts.statusCodes.includes(i) === !1 ? this.handler.onHeaders( i, c, - h, - E + Q, + h ) : (this.abort( new A("Request failed", i, { - headers: C, + headers: B, data: { count: this.retryCount } @@ -6124,63 +6124,63 @@ function Hr() { if (this.resume = null, i !== 206 && (this.start > 0 || i !== 200)) return this.abort( new A("server does not support the range header and the payload was partially consumed", i, { - headers: C, + headers: B, data: { count: this.retryCount } }) ), !1; - const y = n(C["content-range"]); + const y = n(B["content-range"]); if (!y) return this.abort( new A("Content-Range mismatch", i, { - headers: C, + headers: B, data: { count: this.retryCount } }) ), !1; - if (this.etag != null && this.etag !== C.etag) + if (this.etag != null && this.etag !== B.etag) return this.abort( new A("ETag mismatch", i, { - headers: C, + headers: B, data: { count: this.retryCount } }) ), !1; - const { start: b, size: R, end: S = R - 1 } = y; - return e(this.start === b, "content-range mismatch"), e(this.end == null || this.end === S, "content-range mismatch"), this.resume = h, !0; + const { start: b, size: F, end: M = F - 1 } = y; + return e(this.start === b, "content-range mismatch"), e(this.end == null || this.end === M, "content-range mismatch"), this.resume = Q, !0; } if (this.end == null) { if (i === 206) { - const y = n(C["content-range"]); + const y = n(B["content-range"]); if (y == null) return this.handler.onHeaders( i, c, - h, - E + Q, + h ); - const { start: b, size: R, end: S = R - 1 } = y; + const { start: b, size: F, end: M = F - 1 } = y; e( b != null && Number.isFinite(b), "content-range mismatch" - ), e(S != null && Number.isFinite(S), "invalid content-length"), this.start = b, this.end = S; + ), e(M != null && Number.isFinite(M), "invalid content-length"), this.start = b, this.end = M; } if (this.end == null) { - const y = C["content-length"]; + const y = B["content-length"]; this.end = y != null ? Number(y) - 1 : null; } return e(Number.isFinite(this.start)), e( this.end == null || Number.isFinite(this.end), "invalid content-length" - ), this.resume = h, this.etag = C.etag != null ? C.etag : null, this.etag != null && this.etag.startsWith("W/") && (this.etag = null), this.handler.onHeaders( + ), this.resume = Q, this.etag = B.etag != null ? B.etag : null, this.etag != null && this.etag.startsWith("W/") && (this.etag = null), this.handler.onHeaders( i, c, - h, - E + Q, + h ); } - const f = new A("Request failed", i, { - headers: C, + const d = new A("Request failed", i, { + headers: B, data: { count: this.retryCount } }); - return this.abort(f), !1; + return this.abort(d), !1; } onData(i) { return this.start += i.length, this.handler.onData(i); @@ -6199,23 +6199,23 @@ function Hr() { }, c.bind(this) ); - function c(h) { - if (h != null || this.aborted || s(this.opts.body)) - return this.handler.onError(h); + function c(Q) { + if (Q != null || this.aborted || s(this.opts.body)) + return this.handler.onError(Q); if (this.start !== 0) { - const E = { range: `bytes=${this.start}-${this.end ?? ""}` }; - this.etag != null && (E["if-match"] = this.etag), this.opts = { + const h = { range: `bytes=${this.start}-${this.end ?? ""}` }; + this.etag != null && (h["if-match"] = this.etag), this.opts = { ...this.opts, headers: { ...this.opts.headers, - ...E + ...h } }; } try { this.retryCountCheckpoint = this.retryCount, this.dispatch(this.opts, this); - } catch (E) { - this.handler.onError(E); + } catch (h) { + this.handler.onError(h); } } } @@ -6252,16 +6252,16 @@ function wg() { } return Or = A, Or; } -var Tt = {}, bA = { exports: {} }, Pr, Go; +var St = {}, bA = { exports: {} }, Pr, Go; function vo() { if (Go) return Pr; Go = 1; - const e = He, { Readable: t } = ot, { RequestAbortedError: A, NotSupportedError: s, InvalidArgumentError: r, AbortError: n } = Ye(), o = Ue(), { ReadableStreamFrom: a } = Ue(), u = /* @__PURE__ */ Symbol("kConsume"), g = /* @__PURE__ */ Symbol("kReading"), i = /* @__PURE__ */ Symbol("kBody"), c = /* @__PURE__ */ Symbol("kAbort"), h = /* @__PURE__ */ Symbol("kContentType"), E = /* @__PURE__ */ Symbol("kContentLength"), C = () => { + const e = He, { Readable: t } = ot, { RequestAbortedError: A, NotSupportedError: s, InvalidArgumentError: r, AbortError: n } = Ye(), o = Ue(), { ReadableStreamFrom: a } = Ue(), u = /* @__PURE__ */ Symbol("kConsume"), l = /* @__PURE__ */ Symbol("kReading"), i = /* @__PURE__ */ Symbol("kBody"), c = /* @__PURE__ */ Symbol("kAbort"), Q = /* @__PURE__ */ Symbol("kContentType"), h = /* @__PURE__ */ Symbol("kContentLength"), B = () => { }; - class f extends t { + class d extends t { constructor({ - resume: B, - abort: p, + resume: C, + abort: w, contentType: I = "", contentLength: m, highWaterMark: D = 64 * 1024 @@ -6269,53 +6269,53 @@ function vo() { }) { super({ autoDestroy: !0, - read: B, + read: C, highWaterMark: D - }), this._readableState.dataEmitted = !1, this[c] = p, this[u] = null, this[i] = null, this[h] = I, this[E] = m, this[g] = !1; + }), this._readableState.dataEmitted = !1, this[c] = w, this[u] = null, this[i] = null, this[Q] = I, this[h] = m, this[l] = !1; } - destroy(B) { - return !B && !this._readableState.endEmitted && (B = new A()), B && this[c](), super.destroy(B); + destroy(C) { + return !C && !this._readableState.endEmitted && (C = new A()), C && this[c](), super.destroy(C); } - _destroy(B, p) { - this[g] ? p(B) : setImmediate(() => { - p(B); + _destroy(C, w) { + this[l] ? w(C) : setImmediate(() => { + w(C); }); } - on(B, ...p) { - return (B === "data" || B === "readable") && (this[g] = !0), super.on(B, ...p); + on(C, ...w) { + return (C === "data" || C === "readable") && (this[l] = !0), super.on(C, ...w); } - addListener(B, ...p) { - return this.on(B, ...p); + addListener(C, ...w) { + return this.on(C, ...w); } - off(B, ...p) { - const I = super.off(B, ...p); - return (B === "data" || B === "readable") && (this[g] = this.listenerCount("data") > 0 || this.listenerCount("readable") > 0), I; + off(C, ...w) { + const I = super.off(C, ...w); + return (C === "data" || C === "readable") && (this[l] = this.listenerCount("data") > 0 || this.listenerCount("readable") > 0), I; } - removeListener(B, ...p) { - return this.off(B, ...p); + removeListener(C, ...w) { + return this.off(C, ...w); } - push(B) { - return this[u] && B !== null ? (Q(this[u], B), this[g] ? super.push(B) : !0) : super.push(B); + push(C) { + return this[u] && C !== null ? (E(this[u], C), this[l] ? super.push(C) : !0) : super.push(C); } // https://fetch.spec.whatwg.org/#dom-body-text async text() { - return R(this, "text"); + return F(this, "text"); } // https://fetch.spec.whatwg.org/#dom-body-json async json() { - return R(this, "json"); + return F(this, "json"); } // https://fetch.spec.whatwg.org/#dom-body-blob async blob() { - return R(this, "blob"); + return F(this, "blob"); } // https://fetch.spec.whatwg.org/#dom-body-bytes async bytes() { - return R(this, "bytes"); + return F(this, "bytes"); } // https://fetch.spec.whatwg.org/#dom-body-arraybuffer async arrayBuffer() { - return R(this, "arrayBuffer"); + return F(this, "arrayBuffer"); } // https://fetch.spec.whatwg.org/#dom-body-formdata async formData() { @@ -6329,106 +6329,106 @@ function vo() { get body() { return this[i] || (this[i] = a(this), this[u] && (this[i].getReader(), e(this[i].locked))), this[i]; } - async dump(B) { - let p = Number.isFinite(B?.limit) ? B.limit : 131072; - const I = B?.signal; + async dump(C) { + let w = Number.isFinite(C?.limit) ? C.limit : 131072; + const I = C?.signal; if (I != null && (typeof I != "object" || !("aborted" in I))) throw new r("signal must be an AbortSignal"); return I?.throwIfAborted(), this._readableState.closeEmitted ? null : await new Promise((m, D) => { - this[E] > p && this.destroy(new n()); - const N = () => { + this[h] > w && this.destroy(new n()); + const U = () => { this.destroy(I.reason ?? new n()); }; - I?.addEventListener("abort", N), this.on("close", function() { - I?.removeEventListener("abort", N), I?.aborted ? D(I.reason ?? new n()) : m(null); - }).on("error", C).on("data", function(U) { - p -= U.length, p <= 0 && this.destroy(); + I?.addEventListener("abort", U), this.on("close", function() { + I?.removeEventListener("abort", U), I?.aborted ? D(I.reason ?? new n()) : m(null); + }).on("error", B).on("data", function(S) { + w -= S.length, w <= 0 && this.destroy(); }).resume(); }); } } - function y(l) { - return l[i] && l[i].locked === !0 || l[u]; + function y(g) { + return g[i] && g[i].locked === !0 || g[u]; } - function b(l) { - return o.isDisturbed(l) || y(l); + function b(g) { + return o.isDisturbed(g) || y(g); } - async function R(l, B) { - return e(!l[u]), new Promise((p, I) => { - if (b(l)) { - const m = l._readableState; - m.destroyed && m.closeEmitted === !1 ? l.on("error", (D) => { + async function F(g, C) { + return e(!g[u]), new Promise((w, I) => { + if (b(g)) { + const m = g._readableState; + m.destroyed && m.closeEmitted === !1 ? g.on("error", (D) => { I(D); }).on("close", () => { I(new TypeError("unusable")); }) : I(m.errored ?? new TypeError("unusable")); } else queueMicrotask(() => { - l[u] = { - type: B, - stream: l, - resolve: p, + g[u] = { + type: C, + stream: g, + resolve: w, reject: I, length: 0, body: [] - }, l.on("error", function(m) { - w(this[u], m); + }, g.on("error", function(m) { + p(this[u], m); }).on("close", function() { - this[u].body !== null && w(this[u], new A()); - }), S(l[u]); + this[u].body !== null && p(this[u], new A()); + }), M(g[u]); }); }); } - function S(l) { - if (l.body === null) + function M(g) { + if (g.body === null) return; - const { _readableState: B } = l.stream; - if (B.bufferIndex) { - const p = B.bufferIndex, I = B.buffer.length; - for (let m = p; m < I; m++) - Q(l, B.buffer[m]); + const { _readableState: C } = g.stream; + if (C.bufferIndex) { + const w = C.bufferIndex, I = C.buffer.length; + for (let m = w; m < I; m++) + E(g, C.buffer[m]); } else - for (const p of B.buffer) - Q(l, p); - for (B.endEmitted ? d(this[u]) : l.stream.on("end", function() { - d(this[u]); - }), l.stream.resume(); l.stream.read() != null; ) + for (const w of C.buffer) + E(g, w); + for (C.endEmitted ? f(this[u]) : g.stream.on("end", function() { + f(this[u]); + }), g.stream.resume(); g.stream.read() != null; ) ; } - function L(l, B) { - if (l.length === 0 || B === 0) + function L(g, C) { + if (g.length === 0 || C === 0) return ""; - const p = l.length === 1 ? l[0] : Buffer.concat(l, B), I = p.length, m = I > 2 && p[0] === 239 && p[1] === 187 && p[2] === 191 ? 3 : 0; - return p.utf8Slice(m, I); + const w = g.length === 1 ? g[0] : Buffer.concat(g, C), I = w.length, m = I > 2 && w[0] === 239 && w[1] === 187 && w[2] === 191 ? 3 : 0; + return w.utf8Slice(m, I); } - function M(l, B) { - if (l.length === 0 || B === 0) + function N(g, C) { + if (g.length === 0 || C === 0) return new Uint8Array(0); - if (l.length === 1) - return new Uint8Array(l[0]); - const p = new Uint8Array(Buffer.allocUnsafeSlow(B).buffer); + if (g.length === 1) + return new Uint8Array(g[0]); + const w = new Uint8Array(Buffer.allocUnsafeSlow(C).buffer); let I = 0; - for (let m = 0; m < l.length; ++m) { - const D = l[m]; - p.set(D, I), I += D.length; + for (let m = 0; m < g.length; ++m) { + const D = g[m]; + w.set(D, I), I += D.length; } - return p; + return w; } - function d(l) { - const { type: B, body: p, resolve: I, stream: m, length: D } = l; + function f(g) { + const { type: C, body: w, resolve: I, stream: m, length: D } = g; try { - B === "text" ? I(L(p, D)) : B === "json" ? I(JSON.parse(L(p, D))) : B === "arrayBuffer" ? I(M(p, D).buffer) : B === "blob" ? I(new Blob(p, { type: m[h] })) : B === "bytes" && I(M(p, D)), w(l); - } catch (N) { - m.destroy(N); + C === "text" ? I(L(w, D)) : C === "json" ? I(JSON.parse(L(w, D))) : C === "arrayBuffer" ? I(N(w, D).buffer) : C === "blob" ? I(new Blob(w, { type: m[Q] })) : C === "bytes" && I(N(w, D)), p(g); + } catch (U) { + m.destroy(U); } } - function Q(l, B) { - l.length += B.length, l.body.push(B); + function E(g, C) { + g.length += C.length, g.body.push(C); } - function w(l, B) { - l.body !== null && (B ? l.reject(B) : l.resolve(), l.type = null, l.stream = null, l.resolve = null, l.reject = null, l.length = 0, l.body = null); + function p(g, C) { + g.body !== null && (C ? g.reject(C) : g.resolve(), g.type = null, g.stream = null, g.resolve = null, g.reject = null, g.length = 0, g.body = null); } - return Pr = { Readable: f, chunksDecode: L }, Pr; + return Pr = { Readable: d, chunksDecode: L }, Pr; } var _r, Yo; function Jo() { @@ -6437,33 +6437,33 @@ function Jo() { const e = He, { ResponseStatusCodeError: t } = Ye(), { chunksDecode: A } = vo(), s = 128 * 1024; - async function r({ callback: a, body: u, contentType: g, statusCode: i, statusMessage: c, headers: h }) { + async function r({ callback: a, body: u, contentType: l, statusCode: i, statusMessage: c, headers: Q }) { e(u); - let E = [], C = 0; + let h = [], B = 0; try { - for await (const R of u) - if (E.push(R), C += R.length, C > s) { - E = [], C = 0; + for await (const F of u) + if (h.push(F), B += F.length, B > s) { + h = [], B = 0; break; } } catch { - E = [], C = 0; + h = [], B = 0; } - const f = `Response status code ${i}${c ? `: ${c}` : ""}`; - if (i === 204 || !g || !C) { - queueMicrotask(() => a(new t(f, i, h))); + const d = `Response status code ${i}${c ? `: ${c}` : ""}`; + if (i === 204 || !l || !B) { + queueMicrotask(() => a(new t(d, i, Q))); return; } const y = Error.stackTraceLimit; Error.stackTraceLimit = 0; let b; try { - n(g) ? b = JSON.parse(A(E, C)) : o(g) && (b = A(E, C)); + n(l) ? b = JSON.parse(A(h, B)) : o(l) && (b = A(h, B)); } catch { } finally { Error.stackTraceLimit = y; } - queueMicrotask(() => a(new t(f, i, h, b))); + queueMicrotask(() => a(new t(d, i, Q, b))); } const n = (a) => a.length > 15 && a[11] === "/" && a[0] === "a" && a[1] === "p" && a[2] === "p" && a[3] === "l" && a[4] === "i" && a[5] === "c" && a[6] === "a" && a[7] === "t" && a[8] === "i" && a[9] === "o" && a[10] === "n" && a[12] === "j" && a[13] === "s" && a[14] === "o" && a[15] === "n", o = (a) => a.length > 4 && a[4] === "/" && a[0] === "t" && a[1] === "e" && a[2] === "x" && a[3] === "t"; return _r = { @@ -6476,28 +6476,28 @@ var Ho; function mg() { if (Ho) return bA.exports; Ho = 1; - const e = He, { Readable: t } = vo(), { InvalidArgumentError: A, RequestAbortedError: s } = Ye(), r = Ue(), { getResolveErrorBodyCallback: n } = Jo(), { AsyncResource: o } = Wt; + const e = He, { Readable: t } = vo(), { InvalidArgumentError: A, RequestAbortedError: s } = Ye(), r = Ue(), { getResolveErrorBodyCallback: n } = Jo(), { AsyncResource: o } = qt; class a extends o { constructor(i, c) { if (!i || typeof i != "object") throw new A("invalid opts"); - const { signal: h, method: E, opaque: C, body: f, onInfo: y, responseHeaders: b, throwOnError: R, highWaterMark: S } = i; + const { signal: Q, method: h, opaque: B, body: d, onInfo: y, responseHeaders: b, throwOnError: F, highWaterMark: M } = i; try { if (typeof c != "function") throw new A("invalid callback"); - if (S && (typeof S != "number" || S < 0)) + if (M && (typeof M != "number" || M < 0)) throw new A("invalid highWaterMark"); - if (h && typeof h.on != "function" && typeof h.addEventListener != "function") + if (Q && typeof Q.on != "function" && typeof Q.addEventListener != "function") throw new A("signal must be an EventEmitter or EventTarget"); - if (E === "CONNECT") + if (h === "CONNECT") throw new A("invalid method"); if (y && typeof y != "function") throw new A("invalid onInfo callback"); super("UNDICI_REQUEST"); } catch (L) { - throw r.isStream(f) && r.destroy(f.on("error", r.nop), L), L; + throw r.isStream(d) && r.destroy(d.on("error", r.nop), L), L; } - this.method = E, this.responseHeaders = b || null, this.opaque = C || null, this.callback = c, this.res = null, this.abort = null, this.body = f, this.trailers = {}, this.context = null, this.onInfo = y || null, this.throwOnError = R, this.highWaterMark = S, this.signal = h, this.reason = null, this.removeAbortListener = null, r.isStream(f) && f.on("error", (L) => { + this.method = h, this.responseHeaders = b || null, this.opaque = B || null, this.callback = c, this.res = null, this.abort = null, this.body = d, this.trailers = {}, this.context = null, this.onInfo = y || null, this.throwOnError = F, this.highWaterMark = M, this.signal = Q, this.reason = null, this.removeAbortListener = null, r.isStream(d) && d.on("error", (L) => { this.onError(L); }), this.signal && (this.signal.aborted ? this.reason = this.signal.reason ?? new s() : this.removeAbortListener = r.addAbortListener(this.signal, () => { this.reason = this.signal.reason ?? new s(), this.res ? r.destroy(this.res.on("error", r.nop), this.reason) : this.abort && this.abort(this.reason), this.removeAbortListener && (this.res?.off("close", this.removeAbortListener), this.removeAbortListener(), this.removeAbortListener = null); @@ -6510,29 +6510,29 @@ function mg() { } e(this.callback), this.abort = i, this.context = c; } - onHeaders(i, c, h, E) { - const { callback: C, opaque: f, abort: y, context: b, responseHeaders: R, highWaterMark: S } = this, L = R === "raw" ? r.parseRawHeaders(c) : r.parseHeaders(c); + onHeaders(i, c, Q, h) { + const { callback: B, opaque: d, abort: y, context: b, responseHeaders: F, highWaterMark: M } = this, L = F === "raw" ? r.parseRawHeaders(c) : r.parseHeaders(c); if (i < 200) { this.onInfo && this.onInfo({ statusCode: i, headers: L }); return; } - const M = R === "raw" ? r.parseHeaders(c) : L, d = M["content-type"], Q = M["content-length"], w = new t({ - resume: h, + const N = F === "raw" ? r.parseHeaders(c) : L, f = N["content-type"], E = N["content-length"], p = new t({ + resume: Q, abort: y, - contentType: d, - contentLength: this.method !== "HEAD" && Q ? Number(Q) : null, - highWaterMark: S + contentType: f, + contentLength: this.method !== "HEAD" && E ? Number(E) : null, + highWaterMark: M }); - this.removeAbortListener && w.on("close", this.removeAbortListener), this.callback = null, this.res = w, C !== null && (this.throwOnError && i >= 400 ? this.runInAsyncScope( + this.removeAbortListener && p.on("close", this.removeAbortListener), this.callback = null, this.res = p, B !== null && (this.throwOnError && i >= 400 ? this.runInAsyncScope( n, null, - { callback: C, body: w, contentType: d, statusCode: i, statusMessage: E, headers: L } - ) : this.runInAsyncScope(C, null, null, { + { callback: B, body: p, contentType: f, statusCode: i, statusMessage: h, headers: L } + ) : this.runInAsyncScope(B, null, null, { statusCode: i, headers: L, trailers: this.trailers, - opaque: f, - body: w, + opaque: d, + body: p, context: b })); } @@ -6543,26 +6543,26 @@ function mg() { r.parseHeaders(i, this.trailers), this.res.push(null); } onError(i) { - const { res: c, callback: h, body: E, opaque: C } = this; - h && (this.callback = null, queueMicrotask(() => { - this.runInAsyncScope(h, null, i, { opaque: C }); + const { res: c, callback: Q, body: h, opaque: B } = this; + Q && (this.callback = null, queueMicrotask(() => { + this.runInAsyncScope(Q, null, i, { opaque: B }); })), c && (this.res = null, queueMicrotask(() => { r.destroy(c, i); - })), E && (this.body = null, r.destroy(E, i)), this.removeAbortListener && (c?.off("close", this.removeAbortListener), this.removeAbortListener(), this.removeAbortListener = null); + })), h && (this.body = null, r.destroy(h, i)), this.removeAbortListener && (c?.off("close", this.removeAbortListener), this.removeAbortListener(), this.removeAbortListener = null); } } - function u(g, i) { + function u(l, i) { if (i === void 0) - return new Promise((c, h) => { - u.call(this, g, (E, C) => E ? h(E) : c(C)); + return new Promise((c, Q) => { + u.call(this, l, (h, B) => h ? Q(h) : c(B)); }); try { - this.dispatch(g, new a(g, i)); + this.dispatch(l, new a(l, i)); } catch (c) { if (typeof i != "function") throw c; - const h = g?.opaque; - queueMicrotask(() => i(c, { opaque: h })); + const Q = l?.opaque; + queueMicrotask(() => i(c, { opaque: Q })); } } return bA.exports = u, bA.exports.RequestHandler = a, bA.exports; @@ -6598,16 +6598,16 @@ var Vr, Po; function yg() { if (Po) return Vr; Po = 1; - const e = He, { finished: t, PassThrough: A } = ot, { InvalidArgumentError: s, InvalidReturnValueError: r } = Ye(), n = Ue(), { getResolveErrorBodyCallback: o } = Jo(), { AsyncResource: a } = Wt, { addSignal: u, removeSignal: g } = RA(); + const e = He, { finished: t, PassThrough: A } = ot, { InvalidArgumentError: s, InvalidReturnValueError: r } = Ye(), n = Ue(), { getResolveErrorBodyCallback: o } = Jo(), { AsyncResource: a } = qt, { addSignal: u, removeSignal: l } = RA(); class i extends a { - constructor(E, C, f) { - if (!E || typeof E != "object") + constructor(h, B, d) { + if (!h || typeof h != "object") throw new s("invalid opts"); - const { signal: y, method: b, opaque: R, body: S, onInfo: L, responseHeaders: M, throwOnError: d } = E; + const { signal: y, method: b, opaque: F, body: M, onInfo: L, responseHeaders: N, throwOnError: f } = h; try { - if (typeof f != "function") + if (typeof d != "function") throw new s("invalid callback"); - if (typeof C != "function") + if (typeof B != "function") throw new s("invalid factory"); if (y && typeof y.on != "function" && typeof y.addEventListener != "function") throw new s("signal must be an EventEmitter or EventTarget"); @@ -6616,79 +6616,79 @@ function yg() { if (L && typeof L != "function") throw new s("invalid onInfo callback"); super("UNDICI_STREAM"); - } catch (Q) { - throw n.isStream(S) && n.destroy(S.on("error", n.nop), Q), Q; + } catch (E) { + throw n.isStream(M) && n.destroy(M.on("error", n.nop), E), E; } - this.responseHeaders = M || null, this.opaque = R || null, this.factory = C, this.callback = f, this.res = null, this.abort = null, this.context = null, this.trailers = null, this.body = S, this.onInfo = L || null, this.throwOnError = d || !1, n.isStream(S) && S.on("error", (Q) => { - this.onError(Q); + this.responseHeaders = N || null, this.opaque = F || null, this.factory = B, this.callback = d, this.res = null, this.abort = null, this.context = null, this.trailers = null, this.body = M, this.onInfo = L || null, this.throwOnError = f || !1, n.isStream(M) && M.on("error", (E) => { + this.onError(E); }), u(this, y); } - onConnect(E, C) { + onConnect(h, B) { if (this.reason) { - E(this.reason); + h(this.reason); return; } - e(this.callback), this.abort = E, this.context = C; + e(this.callback), this.abort = h, this.context = B; } - onHeaders(E, C, f, y) { - const { factory: b, opaque: R, context: S, callback: L, responseHeaders: M } = this, d = M === "raw" ? n.parseRawHeaders(C) : n.parseHeaders(C); - if (E < 200) { - this.onInfo && this.onInfo({ statusCode: E, headers: d }); + onHeaders(h, B, d, y) { + const { factory: b, opaque: F, context: M, callback: L, responseHeaders: N } = this, f = N === "raw" ? n.parseRawHeaders(B) : n.parseHeaders(B); + if (h < 200) { + this.onInfo && this.onInfo({ statusCode: h, headers: f }); return; } this.factory = null; - let Q; - if (this.throwOnError && E >= 400) { - const B = (M === "raw" ? n.parseHeaders(C) : d)["content-type"]; - Q = new A(), this.callback = null, this.runInAsyncScope( + let E; + if (this.throwOnError && h >= 400) { + const C = (N === "raw" ? n.parseHeaders(B) : f)["content-type"]; + E = new A(), this.callback = null, this.runInAsyncScope( o, null, - { callback: L, body: Q, contentType: B, statusCode: E, statusMessage: y, headers: d } + { callback: L, body: E, contentType: C, statusCode: h, statusMessage: y, headers: f } ); } else { if (b === null) return; - if (Q = this.runInAsyncScope(b, null, { - statusCode: E, - headers: d, - opaque: R, - context: S - }), !Q || typeof Q.write != "function" || typeof Q.end != "function" || typeof Q.on != "function") + if (E = this.runInAsyncScope(b, null, { + statusCode: h, + headers: f, + opaque: F, + context: M + }), !E || typeof E.write != "function" || typeof E.end != "function" || typeof E.on != "function") throw new r("expected Writable"); - t(Q, { readable: !1 }, (l) => { - const { callback: B, res: p, opaque: I, trailers: m, abort: D } = this; - this.res = null, (l || !p.readable) && n.destroy(p, l), this.callback = null, this.runInAsyncScope(B, null, l || null, { opaque: I, trailers: m }), l && D(); + t(E, { readable: !1 }, (g) => { + const { callback: C, res: w, opaque: I, trailers: m, abort: D } = this; + this.res = null, (g || !w.readable) && n.destroy(w, g), this.callback = null, this.runInAsyncScope(C, null, g || null, { opaque: I, trailers: m }), g && D(); }); } - return Q.on("drain", f), this.res = Q, (Q.writableNeedDrain !== void 0 ? Q.writableNeedDrain : Q._writableState?.needDrain) !== !0; + return E.on("drain", d), this.res = E, (E.writableNeedDrain !== void 0 ? E.writableNeedDrain : E._writableState?.needDrain) !== !0; } - onData(E) { - const { res: C } = this; - return C ? C.write(E) : !0; + onData(h) { + const { res: B } = this; + return B ? B.write(h) : !0; } - onComplete(E) { - const { res: C } = this; - g(this), C && (this.trailers = n.parseHeaders(E), C.end()); + onComplete(h) { + const { res: B } = this; + l(this), B && (this.trailers = n.parseHeaders(h), B.end()); } - onError(E) { - const { res: C, callback: f, opaque: y, body: b } = this; - g(this), this.factory = null, C ? (this.res = null, n.destroy(C, E)) : f && (this.callback = null, queueMicrotask(() => { - this.runInAsyncScope(f, null, E, { opaque: y }); - })), b && (this.body = null, n.destroy(b, E)); + onError(h) { + const { res: B, callback: d, opaque: y, body: b } = this; + l(this), this.factory = null, B ? (this.res = null, n.destroy(B, h)) : d && (this.callback = null, queueMicrotask(() => { + this.runInAsyncScope(d, null, h, { opaque: y }); + })), b && (this.body = null, n.destroy(b, h)); } } - function c(h, E, C) { - if (C === void 0) - return new Promise((f, y) => { - c.call(this, h, E, (b, R) => b ? y(b) : f(R)); + function c(Q, h, B) { + if (B === void 0) + return new Promise((d, y) => { + c.call(this, Q, h, (b, F) => b ? y(b) : d(F)); }); try { - this.dispatch(h, new i(h, E, C)); - } catch (f) { - if (typeof C != "function") - throw f; - const y = h?.opaque; - queueMicrotask(() => C(f, { opaque: y })); + this.dispatch(Q, new i(Q, h, B)); + } catch (d) { + if (typeof B != "function") + throw d; + const y = Q?.opaque; + queueMicrotask(() => B(d, { opaque: y })); } } return Vr = c, Vr; @@ -6705,8 +6705,8 @@ function Dg() { InvalidArgumentError: s, InvalidReturnValueError: r, RequestAbortedError: n - } = Ye(), o = Ue(), { AsyncResource: a } = Wt, { addSignal: u, removeSignal: g } = RA(), i = He, c = /* @__PURE__ */ Symbol("resume"); - class h extends e { + } = Ye(), o = Ue(), { AsyncResource: a } = qt, { addSignal: u, removeSignal: l } = RA(), i = He, c = /* @__PURE__ */ Symbol("resume"); + class Q extends e { constructor() { super({ autoDestroy: !0 }), this[c] = null; } @@ -6714,140 +6714,140 @@ function Dg() { const { [c]: b } = this; b && (this[c] = null, b()); } - _destroy(b, R) { - this._read(), R(b); + _destroy(b, F) { + this._read(), F(b); } } - class E extends e { + class h extends e { constructor(b) { super({ autoDestroy: !0 }), this[c] = b; } _read() { this[c](); } - _destroy(b, R) { - !b && !this._readableState.endEmitted && (b = new n()), R(b); + _destroy(b, F) { + !b && !this._readableState.endEmitted && (b = new n()), F(b); } } - class C extends a { - constructor(b, R) { + class B extends a { + constructor(b, F) { if (!b || typeof b != "object") throw new s("invalid opts"); - if (typeof R != "function") + if (typeof F != "function") throw new s("invalid handler"); - const { signal: S, method: L, opaque: M, onInfo: d, responseHeaders: Q } = b; - if (S && typeof S.on != "function" && typeof S.addEventListener != "function") + const { signal: M, method: L, opaque: N, onInfo: f, responseHeaders: E } = b; + if (M && typeof M.on != "function" && typeof M.addEventListener != "function") throw new s("signal must be an EventEmitter or EventTarget"); if (L === "CONNECT") throw new s("invalid method"); - if (d && typeof d != "function") + if (f && typeof f != "function") throw new s("invalid onInfo callback"); - super("UNDICI_PIPELINE"), this.opaque = M || null, this.responseHeaders = Q || null, this.handler = R, this.abort = null, this.context = null, this.onInfo = d || null, this.req = new h().on("error", o.nop), this.ret = new t({ + super("UNDICI_PIPELINE"), this.opaque = N || null, this.responseHeaders = E || null, this.handler = F, this.abort = null, this.context = null, this.onInfo = f || null, this.req = new Q().on("error", o.nop), this.ret = new t({ readableObjectMode: b.objectMode, autoDestroy: !0, read: () => { - const { body: w } = this; - w?.resume && w.resume(); + const { body: p } = this; + p?.resume && p.resume(); }, - write: (w, l, B) => { - const { req: p } = this; - p.push(w, l) || p._readableState.destroyed ? B() : p[c] = B; + write: (p, g, C) => { + const { req: w } = this; + w.push(p, g) || w._readableState.destroyed ? C() : w[c] = C; }, - destroy: (w, l) => { - const { body: B, req: p, res: I, ret: m, abort: D } = this; - !w && !m._readableState.endEmitted && (w = new n()), D && w && D(), o.destroy(B, w), o.destroy(p, w), o.destroy(I, w), g(this), l(w); + destroy: (p, g) => { + const { body: C, req: w, res: I, ret: m, abort: D } = this; + !p && !m._readableState.endEmitted && (p = new n()), D && p && D(), o.destroy(C, p), o.destroy(w, p), o.destroy(I, p), l(this), g(p); } }).on("prefinish", () => { - const { req: w } = this; - w.push(null); - }), this.res = null, u(this, S); + const { req: p } = this; + p.push(null); + }), this.res = null, u(this, M); } - onConnect(b, R) { - const { ret: S, res: L } = this; + onConnect(b, F) { + const { ret: M, res: L } = this; if (this.reason) { b(this.reason); return; } - i(!L, "pipeline cannot be retried"), i(!S.destroyed), this.abort = b, this.context = R; + i(!L, "pipeline cannot be retried"), i(!M.destroyed), this.abort = b, this.context = F; } - onHeaders(b, R, S) { - const { opaque: L, handler: M, context: d } = this; + onHeaders(b, F, M) { + const { opaque: L, handler: N, context: f } = this; if (b < 200) { if (this.onInfo) { - const w = this.responseHeaders === "raw" ? o.parseRawHeaders(R) : o.parseHeaders(R); - this.onInfo({ statusCode: b, headers: w }); + const p = this.responseHeaders === "raw" ? o.parseRawHeaders(F) : o.parseHeaders(F); + this.onInfo({ statusCode: b, headers: p }); } return; } - this.res = new E(S); - let Q; + this.res = new h(M); + let E; try { this.handler = null; - const w = this.responseHeaders === "raw" ? o.parseRawHeaders(R) : o.parseHeaders(R); - Q = this.runInAsyncScope(M, null, { + const p = this.responseHeaders === "raw" ? o.parseRawHeaders(F) : o.parseHeaders(F); + E = this.runInAsyncScope(N, null, { statusCode: b, - headers: w, + headers: p, opaque: L, body: this.res, - context: d + context: f }); - } catch (w) { - throw this.res.on("error", o.nop), w; + } catch (p) { + throw this.res.on("error", o.nop), p; } - if (!Q || typeof Q.on != "function") + if (!E || typeof E.on != "function") throw new r("expected Readable"); - Q.on("data", (w) => { - const { ret: l, body: B } = this; - !l.push(w) && B.pause && B.pause(); - }).on("error", (w) => { - const { ret: l } = this; - o.destroy(l, w); + E.on("data", (p) => { + const { ret: g, body: C } = this; + !g.push(p) && C.pause && C.pause(); + }).on("error", (p) => { + const { ret: g } = this; + o.destroy(g, p); }).on("end", () => { - const { ret: w } = this; - w.push(null); + const { ret: p } = this; + p.push(null); }).on("close", () => { - const { ret: w } = this; - w._readableState.ended || o.destroy(w, new n()); - }), this.body = Q; + const { ret: p } = this; + p._readableState.ended || o.destroy(p, new n()); + }), this.body = E; } onData(b) { - const { res: R } = this; - return R.push(b); + const { res: F } = this; + return F.push(b); } onComplete(b) { - const { res: R } = this; - R.push(null); + const { res: F } = this; + F.push(null); } onError(b) { - const { ret: R } = this; - this.handler = null, o.destroy(R, b); + const { ret: F } = this; + this.handler = null, o.destroy(F, b); } } - function f(y, b) { + function d(y, b) { try { - const R = new C(y, b); - return this.dispatch({ ...y, body: R.req }, R), R.ret; - } catch (R) { - return new A().destroy(R); + const F = new B(y, b); + return this.dispatch({ ...y, body: F.req }, F), F.ret; + } catch (F) { + return new A().destroy(F); } } - return Wr = f, Wr; + return Wr = d, Wr; } var qr, xo; function bg() { if (xo) return qr; xo = 1; - const { InvalidArgumentError: e, SocketError: t } = Ye(), { AsyncResource: A } = Wt, s = Ue(), { addSignal: r, removeSignal: n } = RA(), o = He; + const { InvalidArgumentError: e, SocketError: t } = Ye(), { AsyncResource: A } = qt, s = Ue(), { addSignal: r, removeSignal: n } = RA(), o = He; class a extends A { constructor(i, c) { if (!i || typeof i != "object") throw new e("invalid opts"); if (typeof c != "function") throw new e("invalid callback"); - const { signal: h, opaque: E, responseHeaders: C } = i; - if (h && typeof h.on != "function" && typeof h.addEventListener != "function") + const { signal: Q, opaque: h, responseHeaders: B } = i; + if (Q && typeof Q.on != "function" && typeof Q.addEventListener != "function") throw new e("signal must be an EventEmitter or EventTarget"); - super("UNDICI_UPGRADE"), this.responseHeaders = C || null, this.opaque = E || null, this.callback = c, this.abort = null, this.context = null, r(this, h); + super("UNDICI_UPGRADE"), this.responseHeaders = B || null, this.opaque = h || null, this.callback = c, this.abort = null, this.context = null, r(this, Q); } onConnect(i, c) { if (this.reason) { @@ -6859,42 +6859,42 @@ function bg() { onHeaders() { throw new t("bad upgrade", null); } - onUpgrade(i, c, h) { + onUpgrade(i, c, Q) { o(i === 101); - const { callback: E, opaque: C, context: f } = this; + const { callback: h, opaque: B, context: d } = this; n(this), this.callback = null; const y = this.responseHeaders === "raw" ? s.parseRawHeaders(c) : s.parseHeaders(c); - this.runInAsyncScope(E, null, null, { + this.runInAsyncScope(h, null, null, { headers: y, - socket: h, - opaque: C, - context: f + socket: Q, + opaque: B, + context: d }); } onError(i) { - const { callback: c, opaque: h } = this; + const { callback: c, opaque: Q } = this; n(this), c && (this.callback = null, queueMicrotask(() => { - this.runInAsyncScope(c, null, i, { opaque: h }); + this.runInAsyncScope(c, null, i, { opaque: Q }); })); } } - function u(g, i) { + function u(l, i) { if (i === void 0) - return new Promise((c, h) => { - u.call(this, g, (E, C) => E ? h(E) : c(C)); + return new Promise((c, Q) => { + u.call(this, l, (h, B) => h ? Q(h) : c(B)); }); try { - const c = new a(g, i); + const c = new a(l, i); this.dispatch({ - ...g, - method: g.method || "GET", - upgrade: g.protocol || "Websocket" + ...l, + method: l.method || "GET", + upgrade: l.protocol || "Websocket" }, c); } catch (c) { if (typeof i != "function") throw c; - const h = g?.opaque; - queueMicrotask(() => i(c, { opaque: h })); + const Q = l?.opaque; + queueMicrotask(() => i(c, { opaque: Q })); } } return qr = u, qr; @@ -6903,17 +6903,17 @@ var zr, Vo; function Rg() { if (Vo) return zr; Vo = 1; - const e = He, { AsyncResource: t } = Wt, { InvalidArgumentError: A, SocketError: s } = Ye(), r = Ue(), { addSignal: n, removeSignal: o } = RA(); + const e = He, { AsyncResource: t } = qt, { InvalidArgumentError: A, SocketError: s } = Ye(), r = Ue(), { addSignal: n, removeSignal: o } = RA(); class a extends t { constructor(i, c) { if (!i || typeof i != "object") throw new A("invalid opts"); if (typeof c != "function") throw new A("invalid callback"); - const { signal: h, opaque: E, responseHeaders: C } = i; - if (h && typeof h.on != "function" && typeof h.addEventListener != "function") + const { signal: Q, opaque: h, responseHeaders: B } = i; + if (Q && typeof Q.on != "function" && typeof Q.addEventListener != "function") throw new A("signal must be an EventEmitter or EventTarget"); - super("UNDICI_CONNECT"), this.opaque = E || null, this.responseHeaders = C || null, this.callback = c, this.abort = null, n(this, h); + super("UNDICI_CONNECT"), this.opaque = h || null, this.responseHeaders = B || null, this.callback = c, this.abort = null, n(this, Q); } onConnect(i, c) { if (this.reason) { @@ -6925,45 +6925,45 @@ function Rg() { onHeaders() { throw new s("bad connect", null); } - onUpgrade(i, c, h) { - const { callback: E, opaque: C, context: f } = this; + onUpgrade(i, c, Q) { + const { callback: h, opaque: B, context: d } = this; o(this), this.callback = null; let y = c; - y != null && (y = this.responseHeaders === "raw" ? r.parseRawHeaders(c) : r.parseHeaders(c)), this.runInAsyncScope(E, null, null, { + y != null && (y = this.responseHeaders === "raw" ? r.parseRawHeaders(c) : r.parseHeaders(c)), this.runInAsyncScope(h, null, null, { statusCode: i, headers: y, - socket: h, - opaque: C, - context: f + socket: Q, + opaque: B, + context: d }); } onError(i) { - const { callback: c, opaque: h } = this; + const { callback: c, opaque: Q } = this; o(this), c && (this.callback = null, queueMicrotask(() => { - this.runInAsyncScope(c, null, i, { opaque: h }); + this.runInAsyncScope(c, null, i, { opaque: Q }); })); } } - function u(g, i) { + function u(l, i) { if (i === void 0) - return new Promise((c, h) => { - u.call(this, g, (E, C) => E ? h(E) : c(C)); + return new Promise((c, Q) => { + u.call(this, l, (h, B) => h ? Q(h) : c(B)); }); try { - const c = new a(g, i); - this.dispatch({ ...g, method: "CONNECT" }, c); + const c = new a(l, i); + this.dispatch({ ...l, method: "CONNECT" }, c); } catch (c) { if (typeof i != "function") throw c; - const h = g?.opaque; - queueMicrotask(() => i(c, { opaque: h })); + const Q = l?.opaque; + queueMicrotask(() => i(c, { opaque: Q })); } } return zr = u, zr; } var Wo; function kg() { - return Wo || (Wo = 1, Tt.request = mg(), Tt.stream = yg(), Tt.pipeline = Dg(), Tt.upgrade = bg(), Tt.connect = Rg()), Tt; + return Wo || (Wo = 1, St.request = mg(), St.stream = yg(), St.pipeline = Dg(), St.upgrade = bg(), St.connect = Rg()), St; } var Zr, qo; function zo() { @@ -6984,7 +6984,7 @@ function zo() { }, Zr; } var Kr, Zo; -function AA() { +function rA() { return Zo || (Zo = 1, Kr = { kAgent: /* @__PURE__ */ Symbol("agent"), kOptions: /* @__PURE__ */ Symbol("options"), @@ -7017,12 +7017,12 @@ function kA() { kOriginalDispatch: s, kOrigin: r, kGetNetConnect: n - } = AA(), { buildURL: o } = Ue(), { STATUS_CODES: a } = fA, { + } = rA(), { buildURL: o } = Ue(), { STATUS_CODES: a } = fA, { types: { isPromise: u } } = rt; - function g(I, m) { + function l(I, m) { return typeof I == "string" ? I === m : I instanceof RegExp ? I.test(m) : typeof I == "function" ? I(m) === !0 : !1; } function i(I) { @@ -7038,27 +7038,27 @@ function kA() { return; } else return typeof I.get == "function" ? I.get(m) : i(I)[m.toLocaleLowerCase()]; } - function h(I) { + function Q(I) { const m = I.slice(), D = []; - for (let N = 0; N < m.length; N += 2) - D.push([m[N], m[N + 1]]); + for (let U = 0; U < m.length; U += 2) + D.push([m[U], m[U + 1]]); return Object.fromEntries(D); } - function E(I, m) { + function h(I, m) { if (typeof I.headers == "function") - return Array.isArray(m) && (m = h(m)), I.headers(m ? i(m) : {}); + return Array.isArray(m) && (m = Q(m)), I.headers(m ? i(m) : {}); if (typeof I.headers > "u") return !0; if (typeof m != "object" || typeof I.headers != "object") return !1; - for (const [D, N] of Object.entries(I.headers)) { - const U = c(m, D); - if (!g(N, U)) + for (const [D, U] of Object.entries(I.headers)) { + const S = c(m, D); + if (!l(U, S)) return !1; } return !0; } - function C(I) { + function B(I) { if (typeof I != "string") return I; const m = I.split("?"); @@ -7067,50 +7067,50 @@ function kA() { const D = new URLSearchParams(m.pop()); return D.sort(), [...m, D.toString()].join("?"); } - function f(I, { path: m, method: D, body: N, headers: U }) { - const G = g(I.path, m), v = g(I.method, D), $ = typeof I.body < "u" ? g(I.body, N) : !0, ne = E(I, U); + function d(I, { path: m, method: D, body: U, headers: S }) { + const G = l(I.path, m), v = l(I.method, D), $ = typeof I.body < "u" ? l(I.body, U) : !0, ne = h(I, S); return G && v && $ && ne; } function y(I) { return Buffer.isBuffer(I) || I instanceof Uint8Array || I instanceof ArrayBuffer ? I : typeof I == "object" ? JSON.stringify(I) : I.toString(); } function b(I, m) { - const D = m.query ? o(m.path, m.query) : m.path, N = typeof D == "string" ? C(D) : D; - let U = I.filter(({ consumed: G }) => !G).filter(({ path: G }) => g(C(G), N)); - if (U.length === 0) - throw new e(`Mock dispatch not matched for path '${N}'`); - if (U = U.filter(({ method: G }) => g(G, m.method)), U.length === 0) - throw new e(`Mock dispatch not matched for method '${m.method}' on path '${N}'`); - if (U = U.filter(({ body: G }) => typeof G < "u" ? g(G, m.body) : !0), U.length === 0) - throw new e(`Mock dispatch not matched for body '${m.body}' on path '${N}'`); - if (U = U.filter((G) => E(G, m.headers)), U.length === 0) { + const D = m.query ? o(m.path, m.query) : m.path, U = typeof D == "string" ? B(D) : D; + let S = I.filter(({ consumed: G }) => !G).filter(({ path: G }) => l(B(G), U)); + if (S.length === 0) + throw new e(`Mock dispatch not matched for path '${U}'`); + if (S = S.filter(({ method: G }) => l(G, m.method)), S.length === 0) + throw new e(`Mock dispatch not matched for method '${m.method}' on path '${U}'`); + if (S = S.filter(({ body: G }) => typeof G < "u" ? l(G, m.body) : !0), S.length === 0) + throw new e(`Mock dispatch not matched for body '${m.body}' on path '${U}'`); + if (S = S.filter((G) => h(G, m.headers)), S.length === 0) { const G = typeof m.headers == "object" ? JSON.stringify(m.headers) : m.headers; - throw new e(`Mock dispatch not matched for headers '${G}' on path '${N}'`); + throw new e(`Mock dispatch not matched for headers '${G}' on path '${U}'`); } - return U[0]; + return S[0]; } - function R(I, m, D) { - const N = { timesInvoked: 0, times: 1, persist: !1, consumed: !1 }, U = typeof D == "function" ? { callback: D } : { ...D }, G = { ...N, ...m, pending: !0, data: { error: null, ...U } }; + function F(I, m, D) { + const U = { timesInvoked: 0, times: 1, persist: !1, consumed: !1 }, S = typeof D == "function" ? { callback: D } : { ...D }, G = { ...U, ...m, pending: !0, data: { error: null, ...S } }; return I.push(G), G; } - function S(I, m) { - const D = I.findIndex((N) => N.consumed ? f(N, m) : !1); + function M(I, m) { + const D = I.findIndex((U) => U.consumed ? d(U, m) : !1); D !== -1 && I.splice(D, 1); } function L(I) { - const { path: m, method: D, body: N, headers: U, query: G } = I; + const { path: m, method: D, body: U, headers: S, query: G } = I; return { path: m, method: D, - body: N, - headers: U, + body: U, + headers: S, query: G }; } - function M(I) { + function N(I) { const m = Object.keys(I), D = []; - for (let N = 0; N < m.length; ++N) { - const U = m[N], G = I[U], v = Buffer.from(`${U}`); + for (let U = 0; U < m.length; ++U) { + const S = m[U], G = I[S], v = Buffer.from(`${S}`); if (Array.isArray(G)) for (let $ = 0; $ < G.length; ++$) D.push(v, Buffer.from(`${G[$]}`)); @@ -7119,64 +7119,64 @@ function kA() { } return D; } - function d(I) { + function f(I) { return a[I] || "unknown"; } - async function Q(I) { + async function E(I) { const m = []; for await (const D of I) m.push(D); return Buffer.concat(m).toString("utf8"); } - function w(I, m) { - const D = L(I), N = b(this[t], D); - N.timesInvoked++, N.data.callback && (N.data = { ...N.data, ...N.data.callback(I) }); - const { data: { statusCode: U, data: G, headers: v, trailers: $, error: ne }, delay: ge, persist: ae } = N, { timesInvoked: Be, times: he } = N; - if (N.consumed = !ae && Be >= he, N.pending = Be < he, ne !== null) - return S(this[t], D), m.onError(ne), !0; + function p(I, m) { + const D = L(I), U = b(this[t], D); + U.timesInvoked++, U.data.callback && (U.data = { ...U.data, ...U.data.callback(I) }); + const { data: { statusCode: S, data: G, headers: v, trailers: $, error: ne }, delay: ge, persist: ae } = U, { timesInvoked: Be, times: he } = U; + if (U.consumed = !ae && Be >= he, U.pending = Be < he, ne !== null) + return M(this[t], D), m.onError(ne), !0; typeof ge == "number" && ge > 0 ? setTimeout(() => { Qe(this[t]); }, ge) : Qe(this[t]); function Qe(we, X = G) { - const W = Array.isArray(I.headers) ? h(I.headers) : I.headers, re = typeof X == "function" ? X({ ...I, headers: W }) : X; + const W = Array.isArray(I.headers) ? Q(I.headers) : I.headers, re = typeof X == "function" ? X({ ...I, headers: W }) : X; if (u(re)) { re.then((Z) => Qe(we, Z)); return; } - const J = y(re), V = M(v), P = M($); - m.onConnect?.((Z) => m.onError(Z), null), m.onHeaders?.(U, V, ye, d(U)), m.onData?.(Buffer.from(J)), m.onComplete?.(P), S(we, D); + const J = y(re), V = N(v), P = N($); + m.onConnect?.((Z) => m.onError(Z), null), m.onHeaders?.(S, V, ye, f(S)), m.onData?.(Buffer.from(J)), m.onComplete?.(P), M(we, D); } function ye() { } return !0; } - function l() { + function g() { const I = this[A], m = this[r], D = this[s]; - return function(U, G) { + return function(S, G) { if (I.isMockActive) try { - w.call(this, U, G); + p.call(this, S, G); } catch (v) { if (v instanceof e) { const $ = I[n](); if ($ === !1) throw new e(`${v.message}: subsequent request to origin ${m} was not allowed (net.connect disabled)`); - if (B($, m)) - D.call(this, U, G); + if (C($, m)) + D.call(this, S, G); else throw new e(`${v.message}: subsequent request to origin ${m} was not allowed (net.connect is not enabled for this origin)`); } else throw v; } else - D.call(this, U, G); + D.call(this, S, G); }; } - function B(I, m) { + function C(I, m) { const D = new URL(m); - return I === !0 ? !0 : !!(Array.isArray(I) && I.some((N) => g(N, D.host))); + return I === !0 ? !0 : !!(Array.isArray(I) && I.some((U) => l(U, D.host))); } - function p(I) { + function w(I) { if (I) { const { agent: m, ...D } = I; return D; @@ -7185,19 +7185,19 @@ function kA() { return jr = { getResponseData: y, getMockDispatch: b, - addMockDispatch: R, - deleteMockDispatch: S, + addMockDispatch: F, + deleteMockDispatch: M, buildKey: L, - generateKeyValues: M, - matchValue: g, - getResponse: Q, - getStatusText: d, - mockDispatch: w, - buildMockDispatch: l, - checkNetConnect: B, - buildMockOptions: p, + generateKeyValues: N, + matchValue: l, + getResponse: E, + getStatusText: f, + mockDispatch: p, + buildMockDispatch: g, + checkNetConnect: C, + buildMockOptions: w, getHeaderByName: c, - buildHeadersFromArray: h + buildHeadersFromArray: Q }, jr; } var FA = {}, jo; @@ -7211,18 +7211,18 @@ function Xo() { kDefaultTrailers: o, kContentLength: a, kMockDispatch: u - } = AA(), { InvalidArgumentError: g } = Ye(), { buildURL: i } = Ue(); + } = rA(), { InvalidArgumentError: l } = Ye(), { buildURL: i } = Ue(); class c { - constructor(C) { - this[u] = C; + constructor(B) { + this[u] = B; } /** * Delay a reply by a set amount in ms. */ - delay(C) { - if (typeof C != "number" || !Number.isInteger(C) || C <= 0) - throw new g("waitInMs must be a valid integer > 0"); - return this[u].delay = C, this; + delay(B) { + if (typeof B != "number" || !Number.isInteger(B) || B <= 0) + throw new l("waitInMs must be a valid integer > 0"); + return this[u].delay = B, this; } /** * For a defined reply, never mark as consumed. @@ -7233,86 +7233,86 @@ function Xo() { /** * Allow one to define a reply for a set amount of matching requests. */ - times(C) { - if (typeof C != "number" || !Number.isInteger(C) || C <= 0) - throw new g("repeatTimes must be a valid integer > 0"); - return this[u].times = C, this; - } - } - class h { - constructor(C, f) { - if (typeof C != "object") - throw new g("opts must be an object"); - if (typeof C.path > "u") - throw new g("opts.path must be defined"); - if (typeof C.method > "u" && (C.method = "GET"), typeof C.path == "string") - if (C.query) - C.path = i(C.path, C.query); + times(B) { + if (typeof B != "number" || !Number.isInteger(B) || B <= 0) + throw new l("repeatTimes must be a valid integer > 0"); + return this[u].times = B, this; + } + } + class Q { + constructor(B, d) { + if (typeof B != "object") + throw new l("opts must be an object"); + if (typeof B.path > "u") + throw new l("opts.path must be defined"); + if (typeof B.method > "u" && (B.method = "GET"), typeof B.path == "string") + if (B.query) + B.path = i(B.path, B.query); else { - const y = new URL(C.path, "data://"); - C.path = y.pathname + y.search; + const y = new URL(B.path, "data://"); + B.path = y.pathname + y.search; } - typeof C.method == "string" && (C.method = C.method.toUpperCase()), this[r] = t(C), this[s] = f, this[n] = {}, this[o] = {}, this[a] = !1; + typeof B.method == "string" && (B.method = B.method.toUpperCase()), this[r] = t(B), this[s] = d, this[n] = {}, this[o] = {}, this[a] = !1; } - createMockScopeDispatchData({ statusCode: C, data: f, responseOptions: y }) { - const b = e(f), R = this[a] ? { "content-length": b.length } : {}, S = { ...this[n], ...R, ...y.headers }, L = { ...this[o], ...y.trailers }; - return { statusCode: C, data: f, headers: S, trailers: L }; + createMockScopeDispatchData({ statusCode: B, data: d, responseOptions: y }) { + const b = e(d), F = this[a] ? { "content-length": b.length } : {}, M = { ...this[n], ...F, ...y.headers }, L = { ...this[o], ...y.trailers }; + return { statusCode: B, data: d, headers: M, trailers: L }; } - validateReplyParameters(C) { - if (typeof C.statusCode > "u") - throw new g("statusCode must be defined"); - if (typeof C.responseOptions != "object" || C.responseOptions === null) - throw new g("responseOptions must be an object"); + validateReplyParameters(B) { + if (typeof B.statusCode > "u") + throw new l("statusCode must be defined"); + if (typeof B.responseOptions != "object" || B.responseOptions === null) + throw new l("responseOptions must be an object"); } /** * Mock an undici request with a defined reply. */ - reply(C) { - if (typeof C == "function") { - const R = (L) => { - const M = C(L); - if (typeof M != "object" || M === null) - throw new g("reply options callback must return an object"); - const d = { data: "", responseOptions: {}, ...M }; - return this.validateReplyParameters(d), { - ...this.createMockScopeDispatchData(d) + reply(B) { + if (typeof B == "function") { + const F = (L) => { + const N = B(L); + if (typeof N != "object" || N === null) + throw new l("reply options callback must return an object"); + const f = { data: "", responseOptions: {}, ...N }; + return this.validateReplyParameters(f), { + ...this.createMockScopeDispatchData(f) }; - }, S = A(this[s], this[r], R); - return new c(S); + }, M = A(this[s], this[r], F); + return new c(M); } - const f = { - statusCode: C, + const d = { + statusCode: B, data: arguments[1] === void 0 ? "" : arguments[1], responseOptions: arguments[2] === void 0 ? {} : arguments[2] }; - this.validateReplyParameters(f); - const y = this.createMockScopeDispatchData(f), b = A(this[s], this[r], y); + this.validateReplyParameters(d); + const y = this.createMockScopeDispatchData(d), b = A(this[s], this[r], y); return new c(b); } /** * Mock an undici request with a defined error. */ - replyWithError(C) { - if (typeof C > "u") - throw new g("error must be defined"); - const f = A(this[s], this[r], { error: C }); - return new c(f); + replyWithError(B) { + if (typeof B > "u") + throw new l("error must be defined"); + const d = A(this[s], this[r], { error: B }); + return new c(d); } /** * Set default reply headers on the interceptor for subsequent replies */ - defaultReplyHeaders(C) { - if (typeof C > "u") - throw new g("headers must be defined"); - return this[n] = C, this; + defaultReplyHeaders(B) { + if (typeof B > "u") + throw new l("headers must be defined"); + return this[n] = B, this; } /** * Set default reply trailers on the interceptor for subsequent replies */ - defaultReplyTrailers(C) { - if (typeof C > "u") - throw new g("trailers must be defined"); - return this[o] = C, this; + defaultReplyTrailers(B) { + if (typeof B > "u") + throw new l("trailers must be defined"); + return this[o] = B, this; } /** * Set reply content length header for replies on the interceptor @@ -7321,75 +7321,75 @@ function Xo() { return this[a] = !0, this; } } - return FA.MockInterceptor = h, FA.MockScope = c, FA; + return FA.MockInterceptor = Q, FA.MockScope = c, FA; } var Xr, $o; function ei() { if ($o) return Xr; $o = 1; - const { promisify: e } = rt, t = $t(), { buildMockDispatch: A } = kA(), { + const { promisify: e } = rt, t = eA(), { buildMockDispatch: A } = kA(), { kDispatches: s, kMockAgent: r, kClose: n, kOriginalClose: o, kOrigin: a, kOriginalDispatch: u, - kConnected: g - } = AA(), { MockInterceptor: i } = Xo(), c = Ve(), { InvalidArgumentError: h } = Ye(); - class E extends t { - constructor(f, y) { - if (super(f, y), !y || !y.agent || typeof y.agent.dispatch != "function") - throw new h("Argument opts.agent must implement Agent"); - this[r] = y.agent, this[a] = f, this[s] = [], this[g] = 1, this[u] = this.dispatch, this[o] = this.close.bind(this), this.dispatch = A.call(this), this.close = this[n]; + kConnected: l + } = rA(), { MockInterceptor: i } = Xo(), c = Ve(), { InvalidArgumentError: Q } = Ye(); + class h extends t { + constructor(d, y) { + if (super(d, y), !y || !y.agent || typeof y.agent.dispatch != "function") + throw new Q("Argument opts.agent must implement Agent"); + this[r] = y.agent, this[a] = d, this[s] = [], this[l] = 1, this[u] = this.dispatch, this[o] = this.close.bind(this), this.dispatch = A.call(this), this.close = this[n]; } get [c.kConnected]() { - return this[g]; + return this[l]; } /** * Sets up the base interceptor for mocking replies from undici. */ - intercept(f) { - return new i(f, this[s]); + intercept(d) { + return new i(d, this[s]); } async [n]() { - await e(this[o])(), this[g] = 0, this[r][c.kClients].delete(this[a]); + await e(this[o])(), this[l] = 0, this[r][c.kClients].delete(this[a]); } } - return Xr = E, Xr; + return Xr = h, Xr; } var $r, ti; function Ai() { if (ti) return $r; ti = 1; - const { promisify: e } = rt, t = eA(), { buildMockDispatch: A } = kA(), { + const { promisify: e } = rt, t = tA(), { buildMockDispatch: A } = kA(), { kDispatches: s, kMockAgent: r, kClose: n, kOriginalClose: o, kOrigin: a, kOriginalDispatch: u, - kConnected: g - } = AA(), { MockInterceptor: i } = Xo(), c = Ve(), { InvalidArgumentError: h } = Ye(); - class E extends t { - constructor(f, y) { - if (super(f, y), !y || !y.agent || typeof y.agent.dispatch != "function") - throw new h("Argument opts.agent must implement Agent"); - this[r] = y.agent, this[a] = f, this[s] = [], this[g] = 1, this[u] = this.dispatch, this[o] = this.close.bind(this), this.dispatch = A.call(this), this.close = this[n]; + kConnected: l + } = rA(), { MockInterceptor: i } = Xo(), c = Ve(), { InvalidArgumentError: Q } = Ye(); + class h extends t { + constructor(d, y) { + if (super(d, y), !y || !y.agent || typeof y.agent.dispatch != "function") + throw new Q("Argument opts.agent must implement Agent"); + this[r] = y.agent, this[a] = d, this[s] = [], this[l] = 1, this[u] = this.dispatch, this[o] = this.close.bind(this), this.dispatch = A.call(this), this.close = this[n]; } get [c.kConnected]() { - return this[g]; + return this[l]; } /** * Sets up the base interceptor for mocking replies from undici. */ - intercept(f) { - return new i(f, this[s]); + intercept(d) { + return new i(d, this[s]); } async [n]() { - await e(this[o])(), this[g] = 0, this[r][c.kClients].delete(this[a]); + await e(this[o])(), this[l] = 0, this[r][c.kClients].delete(this[a]); } } - return $r = E, $r; + return $r = h, $r; } var es, ri; function Fg() { @@ -7436,14 +7436,14 @@ function Tg() { } format(n) { const o = n.map( - ({ method: a, path: u, data: { statusCode: g }, persist: i, times: c, timesInvoked: h, origin: E }) => ({ + ({ method: a, path: u, data: { statusCode: l }, persist: i, times: c, timesInvoked: Q, origin: h }) => ({ Method: a, - Origin: E, + Origin: h, Path: u, - "Status code": g, + "Status code": l, Persistent: i ? A : s, - Invocations: h, - Remaining: i ? 1 / 0 : c - h + Invocations: Q, + Remaining: i ? 1 / 0 : c - Q }) ); return this.logger.table(o), this.transform.read().toString(); @@ -7454,7 +7454,7 @@ var As, ni; function Sg() { if (ni) return As; ni = 1; - const { kClients: e } = Ve(), t = tA(), { + const { kClients: e } = Ve(), t = AA(), { kAgent: A, kMockAgentSet: s, kMockAgentGet: r, @@ -7462,22 +7462,22 @@ function Sg() { kIsMockActive: o, kNetConnect: a, kGetNetConnect: u, - kOptions: g, + kOptions: l, kFactory: i - } = AA(), c = ei(), h = Ai(), { matchValue: E, buildMockOptions: C } = kA(), { InvalidArgumentError: f, UndiciError: y } = Ye(), b = wA(), R = Fg(), S = Tg(); + } = rA(), c = ei(), Q = Ai(), { matchValue: h, buildMockOptions: B } = kA(), { InvalidArgumentError: d, UndiciError: y } = Ye(), b = wA(), F = Fg(), M = Tg(); class L extends b { - constructor(d) { - if (super(d), this[a] = !0, this[o] = !0, d?.agent && typeof d.agent.dispatch != "function") - throw new f("Argument opts.agent must implement Agent"); - const Q = d?.agent ? d.agent : new t(d); - this[A] = Q, this[e] = Q[e], this[g] = C(d); + constructor(f) { + if (super(f), this[a] = !0, this[o] = !0, f?.agent && typeof f.agent.dispatch != "function") + throw new d("Argument opts.agent must implement Agent"); + const E = f?.agent ? f.agent : new t(f); + this[A] = E, this[e] = E[e], this[l] = B(f); } - get(d) { - let Q = this[r](d); - return Q || (Q = this[i](d), this[s](d, Q)), Q; + get(f) { + let E = this[r](f); + return E || (E = this[i](f), this[s](f, E)), E; } - dispatch(d, Q) { - return this.get(d.origin), this[A].dispatch(d, Q); + dispatch(f, E) { + return this.get(f.origin), this[A].dispatch(f, E); } async close() { await this[A].close(), this[e].clear(); @@ -7488,13 +7488,13 @@ function Sg() { activate() { this[o] = !0; } - enableNetConnect(d) { - if (typeof d == "string" || typeof d == "function" || d instanceof RegExp) - Array.isArray(this[a]) ? this[a].push(d) : this[a] = [d]; - else if (typeof d > "u") + enableNetConnect(f) { + if (typeof f == "string" || typeof f == "function" || f instanceof RegExp) + Array.isArray(this[a]) ? this[a].push(f) : this[a] = [f]; + else if (typeof f > "u") this[a] = !0; else - throw new f("Unsupported matcher. Must be one of String|Function|RegExp."); + throw new d("Unsupported matcher. Must be one of String|Function|RegExp."); } disableNetConnect() { this[a] = !1; @@ -7504,43 +7504,43 @@ function Sg() { get isMockActive() { return this[o]; } - [s](d, Q) { - this[e].set(d, Q); + [s](f, E) { + this[e].set(f, E); } - [i](d) { - const Q = Object.assign({ agent: this }, this[g]); - return this[g] && this[g].connections === 1 ? new c(d, Q) : new h(d, Q); + [i](f) { + const E = Object.assign({ agent: this }, this[l]); + return this[l] && this[l].connections === 1 ? new c(f, E) : new Q(f, E); } - [r](d) { - const Q = this[e].get(d); - if (Q) - return Q; - if (typeof d != "string") { - const w = this[i]("http://localhost:9999"); - return this[s](d, w), w; + [r](f) { + const E = this[e].get(f); + if (E) + return E; + if (typeof f != "string") { + const p = this[i]("http://localhost:9999"); + return this[s](f, p), p; } - for (const [w, l] of Array.from(this[e])) - if (l && typeof w != "string" && E(w, d)) { - const B = this[i](d); - return this[s](d, B), B[n] = l[n], B; + for (const [p, g] of Array.from(this[e])) + if (g && typeof p != "string" && h(p, f)) { + const C = this[i](f); + return this[s](f, C), C[n] = g[n], C; } } [u]() { return this[a]; } pendingInterceptors() { - const d = this[e]; - return Array.from(d.entries()).flatMap(([Q, w]) => w[n].map((l) => ({ ...l, origin: Q }))).filter(({ pending: Q }) => Q); + const f = this[e]; + return Array.from(f.entries()).flatMap(([E, p]) => p[n].map((g) => ({ ...g, origin: E }))).filter(({ pending: E }) => E); } - assertNoPendingInterceptors({ pendingInterceptorsFormatter: d = new S() } = {}) { - const Q = this.pendingInterceptors(); - if (Q.length === 0) + assertNoPendingInterceptors({ pendingInterceptorsFormatter: f = new M() } = {}) { + const E = this.pendingInterceptors(); + if (E.length === 0) return; - const w = new R("interceptor", "interceptors").pluralize(Q.length); + const p = new F("interceptor", "interceptors").pluralize(E.length); throw new y(` -${w.count} ${w.noun} ${w.is} pending: +${p.count} ${p.noun} ${p.is} pending: -${d.format(Q)} +${f.format(E)} `.trim()); } } @@ -7550,7 +7550,7 @@ var rs, oi; function ss() { if (oi) return rs; oi = 1; - const e = /* @__PURE__ */ Symbol.for("undici.globalDispatcher.1"), { InvalidArgumentError: t } = Ye(), A = tA(); + const e = /* @__PURE__ */ Symbol.for("undici.globalDispatcher.1"), { InvalidArgumentError: t } = Ye(), A = AA(); r() === void 0 && s(new A()); function s(n) { if (!n || typeof n.dispatch != "function") @@ -7616,13 +7616,13 @@ function Ug() { const { maxRedirections: a = A, ...u } = n; if (!a) return s(n, o); - const g = new e( + const l = new e( s, a, n, o ); - return s(u, g); + return s(u, l); }; }, is; } @@ -7669,16 +7669,16 @@ function Mg() { this.#r = !0, this.#n = a; } // TODO: will require adjustment after new hooks are out - onHeaders(a, u, g, i) { - const h = e.parseHeaders(u)["content-length"]; - if (h != null && h > this.#e) + onHeaders(a, u, l, i) { + const Q = e.parseHeaders(u)["content-length"]; + if (Q != null && Q > this.#e) throw new A( - `Response size (${h}) larger than maxSize (${this.#e})` + `Response size (${Q}) larger than maxSize (${this.#e})` ); return this.#r ? !0 : this.#o.onHeaders( a, u, - g, + l, i ); } @@ -7701,12 +7701,12 @@ function Mg() { function n({ maxSize: o } = { maxSize: 1024 * 1024 }) { - return (a) => function(g, i) { - const { dumpMaxSize: c = o } = g, h = new r( + return (a) => function(l, i) { + const { dumpMaxSize: c = o } = l, Q = new r( { maxSize: c }, i ); - return a(g, h); + return a(l, Q); }; } return cs = n, cs; @@ -7724,19 +7724,19 @@ function Lg() { affinity = null; lookup = null; pick = null; - constructor(g) { - this.#e = g.maxTTL, this.#t = g.maxItems, this.dualStack = g.dualStack, this.affinity = g.affinity, this.lookup = g.lookup ?? this.#r, this.pick = g.pick ?? this.#A; + constructor(l) { + this.#e = l.maxTTL, this.#t = l.maxItems, this.dualStack = l.dualStack, this.affinity = l.affinity, this.lookup = l.lookup ?? this.#r, this.pick = l.pick ?? this.#A; } get full() { return this.#s.size === this.#t; } - runLookup(g, i, c) { - const h = this.#s.get(g.hostname); - if (h == null && this.full) { - c(null, g.origin); + runLookup(l, i, c) { + const Q = this.#s.get(l.hostname); + if (Q == null && this.full) { + c(null, l.origin); return; } - const E = { + const h = { affinity: this.affinity, dualStack: this.dualStack, lookup: this.lookup, @@ -7745,80 +7745,80 @@ function Lg() { maxTTL: this.#e, maxItems: this.#t }; - if (h == null) - this.lookup(g, E, (C, f) => { - if (C || f == null || f.length === 0) { - c(C ?? new r("No DNS entries found")); + if (Q == null) + this.lookup(l, h, (B, d) => { + if (B || d == null || d.length === 0) { + c(B ?? new r("No DNS entries found")); return; } - this.setRecords(g, f); - const y = this.#s.get(g.hostname), b = this.pick( - g, + this.setRecords(l, d); + const y = this.#s.get(l.hostname), b = this.pick( + l, y, - E.affinity + h.affinity ); - let R; - typeof b.port == "number" ? R = `:${b.port}` : g.port !== "" ? R = `:${g.port}` : R = "", c( + let F; + typeof b.port == "number" ? F = `:${b.port}` : l.port !== "" ? F = `:${l.port}` : F = "", c( null, - `${g.protocol}//${b.family === 6 ? `[${b.address}]` : b.address}${R}` + `${l.protocol}//${b.family === 6 ? `[${b.address}]` : b.address}${F}` ); }); else { - const C = this.pick( - g, - h, - E.affinity + const B = this.pick( + l, + Q, + h.affinity ); - if (C == null) { - this.#s.delete(g.hostname), this.runLookup(g, i, c); + if (B == null) { + this.#s.delete(l.hostname), this.runLookup(l, i, c); return; } - let f; - typeof C.port == "number" ? f = `:${C.port}` : g.port !== "" ? f = `:${g.port}` : f = "", c( + let d; + typeof B.port == "number" ? d = `:${B.port}` : l.port !== "" ? d = `:${l.port}` : d = "", c( null, - `${g.protocol}//${C.family === 6 ? `[${C.address}]` : C.address}${f}` + `${l.protocol}//${B.family === 6 ? `[${B.address}]` : B.address}${d}` ); } } - #r(g, i, c) { + #r(l, i, c) { t( - g.hostname, + l.hostname, { all: !0, family: this.dualStack === !1 ? this.affinity : 0, order: "ipv4first" }, - (h, E) => { - if (h) - return c(h); - const C = /* @__PURE__ */ new Map(); - for (const f of E) - C.set(`${f.address}:${f.family}`, f); - c(null, C.values()); + (Q, h) => { + if (Q) + return c(Q); + const B = /* @__PURE__ */ new Map(); + for (const d of h) + B.set(`${d.address}:${d.family}`, d); + c(null, B.values()); } ); } - #A(g, i, c) { - let h = null; - const { records: E, offset: C } = i; - let f; - if (this.dualStack ? (c == null && (C == null || C === n ? (i.offset = 0, c = 4) : (i.offset++, c = (i.offset & 1) === 1 ? 6 : 4)), E[c] != null && E[c].ips.length > 0 ? f = E[c] : f = E[c === 4 ? 6 : 4]) : f = E[c], f == null || f.ips.length === 0) - return h; - f.offset == null || f.offset === n ? f.offset = 0 : f.offset++; - const y = f.offset % f.ips.length; - return h = f.ips[y] ?? null, h == null ? h : Date.now() - h.timestamp > h.ttl ? (f.ips.splice(y, 1), this.pick(g, i, c)) : h; - } - setRecords(g, i) { - const c = Date.now(), h = { records: { 4: null, 6: null } }; - for (const E of i) { - E.timestamp = c, typeof E.ttl == "number" ? E.ttl = Math.min(E.ttl, this.#e) : E.ttl = this.#e; - const C = h.records[E.family] ?? { ips: [] }; - C.ips.push(E), h.records[E.family] = C; + #A(l, i, c) { + let Q = null; + const { records: h, offset: B } = i; + let d; + if (this.dualStack ? (c == null && (B == null || B === n ? (i.offset = 0, c = 4) : (i.offset++, c = (i.offset & 1) === 1 ? 6 : 4)), h[c] != null && h[c].ips.length > 0 ? d = h[c] : d = h[c === 4 ? 6 : 4]) : d = h[c], d == null || d.ips.length === 0) + return Q; + d.offset == null || d.offset === n ? d.offset = 0 : d.offset++; + const y = d.offset % d.ips.length; + return Q = d.ips[y] ?? null, Q == null ? Q : Date.now() - Q.timestamp > Q.ttl ? (d.ips.splice(y, 1), this.pick(l, i, c)) : Q; + } + setRecords(l, i) { + const c = Date.now(), Q = { records: { 4: null, 6: null } }; + for (const h of i) { + h.timestamp = c, typeof h.ttl == "number" ? h.ttl = Math.min(h.ttl, this.#e) : h.ttl = this.#e; + const B = Q.records[h.family] ?? { ips: [] }; + B.ips.push(h), Q.records[h.family] = B; } - this.#s.set(g.hostname, h); + this.#s.set(l.hostname, Q); } - getHandler(g, i) { - return new a(this, g, i); + getHandler(l, i) { + return new a(this, l, i); } } class a extends A { @@ -7827,33 +7827,33 @@ function Lg() { #s = null; #r = null; #A = null; - constructor(g, { origin: i, handler: c, dispatch: h }, E) { - super(c), this.#A = i, this.#r = c, this.#t = { ...E }, this.#e = g, this.#s = h; + constructor(l, { origin: i, handler: c, dispatch: Q }, h) { + super(c), this.#A = i, this.#r = c, this.#t = { ...h }, this.#e = l, this.#s = Q; } - onError(g) { - switch (g.code) { + onError(l) { + switch (l.code) { case "ETIMEDOUT": case "ECONNREFUSED": { if (this.#e.dualStack) { this.#e.runLookup(this.#A, this.#t, (i, c) => { if (i) return this.#r.onError(i); - const h = { + const Q = { ...this.#t, origin: c }; - this.#s(h, this); + this.#s(Q, this); }); return; } - this.#r.onError(g); + this.#r.onError(l); return; } case "ENOTFOUND": this.#e.deleteRecord(this.#A); // eslint-disable-next-line no-fallthrough default: - this.#r.onError(g); + this.#r.onError(l); break; } } @@ -7873,74 +7873,74 @@ function Lg() { throw new s("Invalid lookup. Must be a function"); if (u?.pick != null && typeof u?.pick != "function") throw new s("Invalid pick. Must be a function"); - const g = u?.dualStack ?? !0; + const l = u?.dualStack ?? !0; let i; - g ? i = u?.affinity ?? null : i = u?.affinity ?? 4; + l ? i = u?.affinity ?? null : i = u?.affinity ?? 4; const c = { maxTTL: u?.maxTTL ?? 1e4, // Expressed in ms lookup: u?.lookup ?? null, pick: u?.pick ?? null, - dualStack: g, + dualStack: l, affinity: i, maxItems: u?.maxItems ?? 1 / 0 - }, h = new o(c); - return (E) => function(f, y) { - const b = f.origin.constructor === URL ? f.origin : new URL(f.origin); - return e(b.hostname) !== 0 ? E(f, y) : (h.runLookup(b, f, (R, S) => { - if (R) - return y.onError(R); + }, Q = new o(c); + return (h) => function(d, y) { + const b = d.origin.constructor === URL ? d.origin : new URL(d.origin); + return e(b.hostname) !== 0 ? h(d, y) : (Q.runLookup(b, d, (F, M) => { + if (F) + return y.onError(F); let L = null; L = { - ...f, + ...d, servername: b.hostname, // For SNI on TLS - origin: S, + origin: M, headers: { host: b.hostname, - ...f.headers + ...d.headers } - }, E( + }, h( L, - h.getHandler({ origin: b, dispatch: E, handler: y }, f) + Q.getHandler({ origin: b, dispatch: h, handler: y }, d) ); }), !0); }; }, gs; } var ls, ui; -function vt() { +function Yt() { if (ui) return ls; ui = 1; const { kConstruct: e } = Ve(), { kEnumerableProperty: t } = Ue(), { iteratorMixin: A, isValidHeaderName: s, isValidHeaderValue: r - } = it(), { webidl: n } = $e(), o = He, a = rt, u = /* @__PURE__ */ Symbol("headers map"), g = /* @__PURE__ */ Symbol("headers map sorted"); - function i(M) { - return M === 10 || M === 13 || M === 9 || M === 32; - } - function c(M) { - let d = 0, Q = M.length; - for (; Q > d && i(M.charCodeAt(Q - 1)); ) --Q; - for (; Q > d && i(M.charCodeAt(d)); ) ++d; - return d === 0 && Q === M.length ? M : M.substring(d, Q); - } - function h(M, d) { - if (Array.isArray(d)) - for (let Q = 0; Q < d.length; ++Q) { - const w = d[Q]; - if (w.length !== 2) + } = it(), { webidl: n } = $e(), o = He, a = rt, u = /* @__PURE__ */ Symbol("headers map"), l = /* @__PURE__ */ Symbol("headers map sorted"); + function i(N) { + return N === 10 || N === 13 || N === 9 || N === 32; + } + function c(N) { + let f = 0, E = N.length; + for (; E > f && i(N.charCodeAt(E - 1)); ) --E; + for (; E > f && i(N.charCodeAt(f)); ) ++f; + return f === 0 && E === N.length ? N : N.substring(f, E); + } + function Q(N, f) { + if (Array.isArray(f)) + for (let E = 0; E < f.length; ++E) { + const p = f[E]; + if (p.length !== 2) throw n.errors.exception({ header: "Headers constructor", - message: `expected name/value pair to be length 2, found ${w.length}.` + message: `expected name/value pair to be length 2, found ${p.length}.` }); - E(M, w[0], w[1]); + h(N, p[0], p[1]); } - else if (typeof d == "object" && d !== null) { - const Q = Object.keys(d); - for (let w = 0; w < Q.length; ++w) - E(M, Q[w], d[Q[w]]); + else if (typeof f == "object" && f !== null) { + const E = Object.keys(f); + for (let p = 0; p < E.length; ++p) + h(N, E[p], f[E[p]]); } else throw n.errors.conversionFailed({ prefix: "Headers constructor", @@ -7948,42 +7948,42 @@ function vt() { types: ["sequence>", "record"] }); } - function E(M, d, Q) { - if (Q = c(Q), s(d)) { - if (!r(Q)) + function h(N, f, E) { + if (E = c(E), s(f)) { + if (!r(E)) throw n.errors.invalidArgument({ prefix: "Headers.append", - value: Q, + value: E, type: "header value" }); } else throw n.errors.invalidArgument({ prefix: "Headers.append", - value: d, + value: f, type: "header name" }); - if (b(M) === "immutable") + if (b(N) === "immutable") throw new TypeError("immutable"); - return S(M).append(d, Q, !1); + return M(N).append(f, E, !1); } - function C(M, d) { - return M[0] < d[0] ? -1 : 1; + function B(N, f) { + return N[0] < f[0] ? -1 : 1; } - class f { + class d { /** @type {[string, string][]|null} */ cookies = null; - constructor(d) { - d instanceof f ? (this[u] = new Map(d[u]), this[g] = d[g], this.cookies = d.cookies === null ? null : [...d.cookies]) : (this[u] = new Map(d), this[g] = null); + constructor(f) { + f instanceof d ? (this[u] = new Map(f[u]), this[l] = f[l], this.cookies = f.cookies === null ? null : [...f.cookies]) : (this[u] = new Map(f), this[l] = null); } /** * @see https://fetch.spec.whatwg.org/#header-list-contains * @param {string} name * @param {boolean} isLowerCase */ - contains(d, Q) { - return this[u].has(Q ? d : d.toLowerCase()); + contains(f, E) { + return this[u].has(E ? f : f.toLowerCase()); } clear() { - this[u].clear(), this[g] = null, this.cookies = null; + this[u].clear(), this[l] = null, this.cookies = null; } /** * @see https://fetch.spec.whatwg.org/#concept-header-list-append @@ -7991,18 +7991,18 @@ function vt() { * @param {string} value * @param {boolean} isLowerCase */ - append(d, Q, w) { - this[g] = null; - const l = w ? d : d.toLowerCase(), B = this[u].get(l); - if (B) { - const p = l === "cookie" ? "; " : ", "; - this[u].set(l, { - name: B.name, - value: `${B.value}${p}${Q}` + append(f, E, p) { + this[l] = null; + const g = p ? f : f.toLowerCase(), C = this[u].get(g); + if (C) { + const w = g === "cookie" ? "; " : ", "; + this[u].set(g, { + name: C.name, + value: `${C.value}${w}${E}` }); } else - this[u].set(l, { name: d, value: Q }); - l === "set-cookie" && (this.cookies ??= []).push(Q); + this[u].set(g, { name: f, value: E }); + g === "set-cookie" && (this.cookies ??= []).push(E); } /** * @see https://fetch.spec.whatwg.org/#concept-header-list-set @@ -8010,18 +8010,18 @@ function vt() { * @param {string} value * @param {boolean} isLowerCase */ - set(d, Q, w) { - this[g] = null; - const l = w ? d : d.toLowerCase(); - l === "set-cookie" && (this.cookies = [Q]), this[u].set(l, { name: d, value: Q }); + set(f, E, p) { + this[l] = null; + const g = p ? f : f.toLowerCase(); + g === "set-cookie" && (this.cookies = [E]), this[u].set(g, { name: f, value: E }); } /** * @see https://fetch.spec.whatwg.org/#concept-header-list-delete * @param {string} name * @param {boolean} isLowerCase */ - delete(d, Q) { - this[g] = null, Q || (d = d.toLowerCase()), d === "set-cookie" && (this.cookies = null), this[u].delete(d); + delete(f, E) { + this[l] = null, E || (f = f.toLowerCase()), f === "set-cookie" && (this.cookies = null), this[u].delete(f); } /** * @see https://fetch.spec.whatwg.org/#concept-header-list-get @@ -8029,171 +8029,171 @@ function vt() { * @param {boolean} isLowerCase * @returns {string | null} */ - get(d, Q) { - return this[u].get(Q ? d : d.toLowerCase())?.value ?? null; + get(f, E) { + return this[u].get(E ? f : f.toLowerCase())?.value ?? null; } *[Symbol.iterator]() { - for (const { 0: d, 1: { value: Q } } of this[u]) - yield [d, Q]; + for (const { 0: f, 1: { value: E } } of this[u]) + yield [f, E]; } get entries() { - const d = {}; + const f = {}; if (this[u].size !== 0) - for (const { name: Q, value: w } of this[u].values()) - d[Q] = w; - return d; + for (const { name: E, value: p } of this[u].values()) + f[E] = p; + return f; } rawValues() { return this[u].values(); } get entriesList() { - const d = []; + const f = []; if (this[u].size !== 0) - for (const { 0: Q, 1: { name: w, value: l } } of this[u]) - if (Q === "set-cookie") - for (const B of this.cookies) - d.push([w, B]); + for (const { 0: E, 1: { name: p, value: g } } of this[u]) + if (E === "set-cookie") + for (const C of this.cookies) + f.push([p, C]); else - d.push([w, l]); - return d; + f.push([p, g]); + return f; } // https://fetch.spec.whatwg.org/#convert-header-names-to-a-sorted-lowercase-set toSortedArray() { - const d = this[u].size, Q = new Array(d); - if (d <= 32) { - if (d === 0) - return Q; - const w = this[u][Symbol.iterator](), l = w.next().value; - Q[0] = [l[0], l[1].value], o(l[1].value !== null); - for (let B = 1, p = 0, I = 0, m = 0, D = 0, N, U; B < d; ++B) { - for (U = w.next().value, N = Q[B] = [U[0], U[1].value], o(N[1] !== null), m = 0, I = B; m < I; ) - D = m + (I - m >> 1), Q[D][0] <= N[0] ? m = D + 1 : I = D; - if (B !== D) { - for (p = B; p > m; ) - Q[p] = Q[--p]; - Q[m] = N; + const f = this[u].size, E = new Array(f); + if (f <= 32) { + if (f === 0) + return E; + const p = this[u][Symbol.iterator](), g = p.next().value; + E[0] = [g[0], g[1].value], o(g[1].value !== null); + for (let C = 1, w = 0, I = 0, m = 0, D = 0, U, S; C < f; ++C) { + for (S = p.next().value, U = E[C] = [S[0], S[1].value], o(U[1] !== null), m = 0, I = C; m < I; ) + D = m + (I - m >> 1), E[D][0] <= U[0] ? m = D + 1 : I = D; + if (C !== D) { + for (w = C; w > m; ) + E[w] = E[--w]; + E[m] = U; } } - if (!w.next().done) + if (!p.next().done) throw new TypeError("Unreachable"); - return Q; + return E; } else { - let w = 0; - for (const { 0: l, 1: { value: B } } of this[u]) - Q[w++] = [l, B], o(B !== null); - return Q.sort(C); + let p = 0; + for (const { 0: g, 1: { value: C } } of this[u]) + E[p++] = [g, C], o(C !== null); + return E.sort(B); } } } class y { #e; #t; - constructor(d = void 0) { - n.util.markAsUncloneable(this), d !== e && (this.#t = new f(), this.#e = "none", d !== void 0 && (d = n.converters.HeadersInit(d, "Headers contructor", "init"), h(this, d))); + constructor(f = void 0) { + n.util.markAsUncloneable(this), f !== e && (this.#t = new d(), this.#e = "none", f !== void 0 && (f = n.converters.HeadersInit(f, "Headers contructor", "init"), Q(this, f))); } // https://fetch.spec.whatwg.org/#dom-headers-append - append(d, Q) { + append(f, E) { n.brandCheck(this, y), n.argumentLengthCheck(arguments, 2, "Headers.append"); - const w = "Headers.append"; - return d = n.converters.ByteString(d, w, "name"), Q = n.converters.ByteString(Q, w, "value"), E(this, d, Q); + const p = "Headers.append"; + return f = n.converters.ByteString(f, p, "name"), E = n.converters.ByteString(E, p, "value"), h(this, f, E); } // https://fetch.spec.whatwg.org/#dom-headers-delete - delete(d) { - if (n.brandCheck(this, y), n.argumentLengthCheck(arguments, 1, "Headers.delete"), d = n.converters.ByteString(d, "Headers.delete", "name"), !s(d)) + delete(f) { + if (n.brandCheck(this, y), n.argumentLengthCheck(arguments, 1, "Headers.delete"), f = n.converters.ByteString(f, "Headers.delete", "name"), !s(f)) throw n.errors.invalidArgument({ prefix: "Headers.delete", - value: d, + value: f, type: "header name" }); if (this.#e === "immutable") throw new TypeError("immutable"); - this.#t.contains(d, !1) && this.#t.delete(d, !1); + this.#t.contains(f, !1) && this.#t.delete(f, !1); } // https://fetch.spec.whatwg.org/#dom-headers-get - get(d) { + get(f) { n.brandCheck(this, y), n.argumentLengthCheck(arguments, 1, "Headers.get"); - const Q = "Headers.get"; - if (d = n.converters.ByteString(d, Q, "name"), !s(d)) + const E = "Headers.get"; + if (f = n.converters.ByteString(f, E, "name"), !s(f)) throw n.errors.invalidArgument({ - prefix: Q, - value: d, + prefix: E, + value: f, type: "header name" }); - return this.#t.get(d, !1); + return this.#t.get(f, !1); } // https://fetch.spec.whatwg.org/#dom-headers-has - has(d) { + has(f) { n.brandCheck(this, y), n.argumentLengthCheck(arguments, 1, "Headers.has"); - const Q = "Headers.has"; - if (d = n.converters.ByteString(d, Q, "name"), !s(d)) + const E = "Headers.has"; + if (f = n.converters.ByteString(f, E, "name"), !s(f)) throw n.errors.invalidArgument({ - prefix: Q, - value: d, + prefix: E, + value: f, type: "header name" }); - return this.#t.contains(d, !1); + return this.#t.contains(f, !1); } // https://fetch.spec.whatwg.org/#dom-headers-set - set(d, Q) { + set(f, E) { n.brandCheck(this, y), n.argumentLengthCheck(arguments, 2, "Headers.set"); - const w = "Headers.set"; - if (d = n.converters.ByteString(d, w, "name"), Q = n.converters.ByteString(Q, w, "value"), Q = c(Q), s(d)) { - if (!r(Q)) + const p = "Headers.set"; + if (f = n.converters.ByteString(f, p, "name"), E = n.converters.ByteString(E, p, "value"), E = c(E), s(f)) { + if (!r(E)) throw n.errors.invalidArgument({ - prefix: w, - value: Q, + prefix: p, + value: E, type: "header value" }); } else throw n.errors.invalidArgument({ - prefix: w, - value: d, + prefix: p, + value: f, type: "header name" }); if (this.#e === "immutable") throw new TypeError("immutable"); - this.#t.set(d, Q, !1); + this.#t.set(f, E, !1); } // https://fetch.spec.whatwg.org/#dom-headers-getsetcookie getSetCookie() { n.brandCheck(this, y); - const d = this.#t.cookies; - return d ? [...d] : []; + const f = this.#t.cookies; + return f ? [...f] : []; } // https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine - get [g]() { - if (this.#t[g]) - return this.#t[g]; - const d = [], Q = this.#t.toSortedArray(), w = this.#t.cookies; - if (w === null || w.length === 1) - return this.#t[g] = Q; - for (let l = 0; l < Q.length; ++l) { - const { 0: B, 1: p } = Q[l]; - if (B === "set-cookie") - for (let I = 0; I < w.length; ++I) - d.push([B, w[I]]); + get [l]() { + if (this.#t[l]) + return this.#t[l]; + const f = [], E = this.#t.toSortedArray(), p = this.#t.cookies; + if (p === null || p.length === 1) + return this.#t[l] = E; + for (let g = 0; g < E.length; ++g) { + const { 0: C, 1: w } = E[g]; + if (C === "set-cookie") + for (let I = 0; I < p.length; ++I) + f.push([C, p[I]]); else - d.push([B, p]); + f.push([C, w]); } - return this.#t[g] = d; + return this.#t[l] = f; } - [a.inspect.custom](d, Q) { - return Q.depth ??= d, `Headers ${a.formatWithOptions(Q, this.#t.entries)}`; + [a.inspect.custom](f, E) { + return E.depth ??= f, `Headers ${a.formatWithOptions(E, this.#t.entries)}`; } - static getHeadersGuard(d) { - return d.#e; + static getHeadersGuard(f) { + return f.#e; } - static setHeadersGuard(d, Q) { - d.#e = Q; + static setHeadersGuard(f, E) { + f.#e = E; } - static getHeadersList(d) { - return d.#t; + static getHeadersList(f) { + return f.#t; } - static setHeadersList(d, Q) { - d.#t = Q; + static setHeadersList(f, E) { + f.#t = E; } } - const { getHeadersGuard: b, setHeadersGuard: R, getHeadersList: S, setHeadersList: L } = y; - return Reflect.deleteProperty(y, "getHeadersGuard"), Reflect.deleteProperty(y, "setHeadersGuard"), Reflect.deleteProperty(y, "getHeadersList"), Reflect.deleteProperty(y, "setHeadersList"), A("Headers", y, g, 0, 1), Object.defineProperties(y.prototype, { + const { getHeadersGuard: b, setHeadersGuard: F, getHeadersList: M, setHeadersList: L } = y; + return Reflect.deleteProperty(y, "getHeadersGuard"), Reflect.deleteProperty(y, "setHeadersGuard"), Reflect.deleteProperty(y, "getHeadersList"), Reflect.deleteProperty(y, "setHeadersList"), A("Headers", y, l, 0, 1), Object.defineProperties(y.prototype, { append: t, delete: t, get: t, @@ -8207,15 +8207,15 @@ function vt() { [a.inspect.custom]: { enumerable: !1 } - }), n.converters.HeadersInit = function(M, d, Q) { - if (n.util.Type(M) === "Object") { - const w = Reflect.get(M, Symbol.iterator); - if (!a.types.isProxy(M) && w === y.prototype.entries) + }), n.converters.HeadersInit = function(N, f, E) { + if (n.util.Type(N) === "Object") { + const p = Reflect.get(N, Symbol.iterator); + if (!a.types.isProxy(N) && p === y.prototype.entries) try { - return S(M).entriesList; + return M(N).entriesList; } catch { } - return typeof w == "function" ? n.converters["sequence>"](M, d, Q, w.bind(M)) : n.converters["record"](M, d, Q); + return typeof p == "function" ? n.converters["sequence>"](N, f, E, p.bind(N)) : n.converters["record"](N, f, E); } throw n.errors.conversionFailed({ prefix: "Headers constructor", @@ -8223,34 +8223,34 @@ function vt() { types: ["sequence>", "record"] }); }, ls = { - fill: h, + fill: Q, // for test. - compareHeaderName: C, + compareHeaderName: B, Headers: y, - HeadersList: f, + HeadersList: d, getHeadersGuard: b, - setHeadersGuard: R, + setHeadersGuard: F, setHeadersList: L, - getHeadersList: S + getHeadersList: M }, ls; } var us, Ei; function TA() { if (Ei) return us; Ei = 1; - const { Headers: e, HeadersList: t, fill: A, getHeadersGuard: s, setHeadersGuard: r, setHeadersList: n } = vt(), { extractBody: o, cloneBody: a, mixinBody: u, hasFinalizationRegistry: g, streamRegistry: i, bodyUnusable: c } = Xt(), h = Ue(), E = rt, { kEnumerableProperty: C } = h, { - isValidReasonPhrase: f, + const { Headers: e, HeadersList: t, fill: A, getHeadersGuard: s, setHeadersGuard: r, setHeadersList: n } = Yt(), { extractBody: o, cloneBody: a, mixinBody: u, hasFinalizationRegistry: l, streamRegistry: i, bodyUnusable: c } = $t(), Q = Ue(), h = rt, { kEnumerableProperty: B } = Q, { + isValidReasonPhrase: d, isCancelled: y, isAborted: b, - isBlobLike: R, - serializeJavascriptValueToJSONString: S, + isBlobLike: F, + serializeJavascriptValueToJSONString: M, isErrorLike: L, - isomorphicEncode: M, - environmentSettingsObject: d + isomorphicEncode: N, + environmentSettingsObject: f } = it(), { - redirectStatusSet: Q, - nullBodyStatus: w - } = yA(), { kState: l, kHeaders: B } = Ft(), { webidl: p } = $e(), { FormData: I } = DA(), { URLSerializer: m } = st(), { kConstruct: D } = Ve(), N = He, { types: U } = rt, G = new TextEncoder("utf-8"); + redirectStatusSet: E, + nullBodyStatus: p + } = yA(), { kState: g, kHeaders: C } = Tt(), { webidl: w } = $e(), { FormData: I } = DA(), { URLSerializer: m } = st(), { kConstruct: D } = Ve(), U = He, { types: S } = rt, G = new TextEncoder("utf-8"); class v { // Creates network error Response. static error() { @@ -8258,33 +8258,33 @@ function TA() { } // https://fetch.spec.whatwg.org/#dom-response-json static json(W, re = {}) { - p.argumentLengthCheck(arguments, 1, "Response.json"), re !== null && (re = p.converters.ResponseInit(re)); + w.argumentLengthCheck(arguments, 1, "Response.json"), re !== null && (re = w.converters.ResponseInit(re)); const J = G.encode( - S(W) + M(W) ), V = o(J), P = we(ne({}), "response"); return ye(P, re, { body: V[0], type: "application/json" }), P; } // Creates a redirect Response that redirects to url with status status. static redirect(W, re = 302) { - p.argumentLengthCheck(arguments, 1, "Response.redirect"), W = p.converters.USVString(W), re = p.converters["unsigned short"](re); + w.argumentLengthCheck(arguments, 1, "Response.redirect"), W = w.converters.USVString(W), re = w.converters["unsigned short"](re); let J; try { - J = new URL(W, d.settingsObject.baseUrl); + J = new URL(W, f.settingsObject.baseUrl); } catch (Z) { throw new TypeError(`Failed to parse URL from ${W}`, { cause: Z }); } - if (!Q.has(re)) + if (!E.has(re)) throw new RangeError(`Invalid status code ${re}`); const V = we(ne({}), "immutable"); - V[l].status = re; - const P = M(m(J)); - return V[l].headersList.append("location", P, !0), V; + V[g].status = re; + const P = N(m(J)); + return V[g].headersList.append("location", P, !0), V; } // https://fetch.spec.whatwg.org/#dom-response constructor(W = null, re = {}) { - if (p.util.markAsUncloneable(this), W === D) + if (w.util.markAsUncloneable(this), W === D) return; - W !== null && (W = p.converters.BodyInit(W)), re = p.converters.ResponseInit(re), this[l] = ne({}), this[B] = new e(D), r(this[B], "response"), n(this[B], this[l].headersList); + W !== null && (W = w.converters.BodyInit(W)), re = w.converters.ResponseInit(re), this[g] = ne({}), this[C] = new e(D), r(this[C], "response"), n(this[C], this[g].headersList); let J = null; if (W != null) { const [V, P] = o(W); @@ -8294,51 +8294,51 @@ function TA() { } // Returns response’s type, e.g., "cors". get type() { - return p.brandCheck(this, v), this[l].type; + return w.brandCheck(this, v), this[g].type; } // Returns response’s URL, if it has one; otherwise the empty string. get url() { - p.brandCheck(this, v); - const W = this[l].urlList, re = W[W.length - 1] ?? null; + w.brandCheck(this, v); + const W = this[g].urlList, re = W[W.length - 1] ?? null; return re === null ? "" : m(re, !0); } // Returns whether response was obtained through a redirect. get redirected() { - return p.brandCheck(this, v), this[l].urlList.length > 1; + return w.brandCheck(this, v), this[g].urlList.length > 1; } // Returns response’s status. get status() { - return p.brandCheck(this, v), this[l].status; + return w.brandCheck(this, v), this[g].status; } // Returns whether response’s status is an ok status. get ok() { - return p.brandCheck(this, v), this[l].status >= 200 && this[l].status <= 299; + return w.brandCheck(this, v), this[g].status >= 200 && this[g].status <= 299; } // Returns response’s status message. get statusText() { - return p.brandCheck(this, v), this[l].statusText; + return w.brandCheck(this, v), this[g].statusText; } // Returns response’s headers as Headers. get headers() { - return p.brandCheck(this, v), this[B]; + return w.brandCheck(this, v), this[C]; } get body() { - return p.brandCheck(this, v), this[l].body ? this[l].body.stream : null; + return w.brandCheck(this, v), this[g].body ? this[g].body.stream : null; } get bodyUsed() { - return p.brandCheck(this, v), !!this[l].body && h.isDisturbed(this[l].body.stream); + return w.brandCheck(this, v), !!this[g].body && Q.isDisturbed(this[g].body.stream); } // Returns a clone of response. clone() { - if (p.brandCheck(this, v), c(this)) - throw p.errors.exception({ + if (w.brandCheck(this, v), c(this)) + throw w.errors.exception({ header: "Response.clone", message: "Body has already been consumed." }); - const W = $(this[l]); - return g && this[l].body?.stream && i.register(this, new WeakRef(this[l].body.stream)), we(W, s(this[B])); + const W = $(this[g]); + return l && this[g].body?.stream && i.register(this, new WeakRef(this[g].body.stream)), we(W, s(this[C])); } - [E.inspect.custom](W, re) { + [h.inspect.custom](W, re) { re.depth === null && (re.depth = 2), re.colors ??= !0; const J = { status: this.status, @@ -8351,28 +8351,28 @@ function TA() { type: this.type, url: this.url }; - return `Response ${E.formatWithOptions(re, J)}`; + return `Response ${h.formatWithOptions(re, J)}`; } } u(v), Object.defineProperties(v.prototype, { - type: C, - url: C, - status: C, - ok: C, - redirected: C, - statusText: C, - headers: C, - clone: C, - body: C, - bodyUsed: C, + type: B, + url: B, + status: B, + ok: B, + redirected: B, + statusText: B, + headers: B, + clone: B, + body: B, + bodyUsed: B, [Symbol.toStringTag]: { value: "Response", configurable: !0 } }), Object.defineProperties(v, { - json: C, - redirect: C, - error: C + json: B, + redirect: B, + error: B }); function $(X) { if (X.internalResponse) @@ -8424,7 +8424,7 @@ function TA() { return J in W ? W[J] : re[J]; }, set(re, J, V) { - return N(!(J in W)), re[J] = V, !0; + return U(!(J in W)), re[J] = V, !0; } }); } @@ -8455,53 +8455,53 @@ function TA() { headersList: [], body: null }); - N(!1); + U(!1); } function Qe(X, W = null) { - return N(y(X)), b(X) ? ge(Object.assign(new DOMException("The operation was aborted.", "AbortError"), { cause: W })) : ge(Object.assign(new DOMException("Request was cancelled."), { cause: W })); + return U(y(X)), b(X) ? ge(Object.assign(new DOMException("The operation was aborted.", "AbortError"), { cause: W })) : ge(Object.assign(new DOMException("Request was cancelled."), { cause: W })); } function ye(X, W, re) { if (W.status !== null && (W.status < 200 || W.status > 599)) throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.'); - if ("statusText" in W && W.statusText != null && !f(String(W.statusText))) + if ("statusText" in W && W.statusText != null && !d(String(W.statusText))) throw new TypeError("Invalid statusText"); - if ("status" in W && W.status != null && (X[l].status = W.status), "statusText" in W && W.statusText != null && (X[l].statusText = W.statusText), "headers" in W && W.headers != null && A(X[B], W.headers), re) { - if (w.includes(X.status)) - throw p.errors.exception({ + if ("status" in W && W.status != null && (X[g].status = W.status), "statusText" in W && W.statusText != null && (X[g].statusText = W.statusText), "headers" in W && W.headers != null && A(X[C], W.headers), re) { + if (p.includes(X.status)) + throw w.errors.exception({ header: "Response constructor", message: `Invalid response status code ${X.status}` }); - X[l].body = re.body, re.type != null && !X[l].headersList.contains("content-type", !0) && X[l].headersList.append("content-type", re.type, !0); + X[g].body = re.body, re.type != null && !X[g].headersList.contains("content-type", !0) && X[g].headersList.append("content-type", re.type, !0); } } function we(X, W) { const re = new v(D); - return re[l] = X, re[B] = new e(D), n(re[B], X.headersList), r(re[B], W), g && X.body?.stream && i.register(re, new WeakRef(X.body.stream)), re; + return re[g] = X, re[C] = new e(D), n(re[C], X.headersList), r(re[C], W), l && X.body?.stream && i.register(re, new WeakRef(X.body.stream)), re; } - return p.converters.ReadableStream = p.interfaceConverter( + return w.converters.ReadableStream = w.interfaceConverter( ReadableStream - ), p.converters.FormData = p.interfaceConverter( + ), w.converters.FormData = w.interfaceConverter( I - ), p.converters.URLSearchParams = p.interfaceConverter( + ), w.converters.URLSearchParams = w.interfaceConverter( URLSearchParams - ), p.converters.XMLHttpRequestBodyInit = function(X, W, re) { - return typeof X == "string" ? p.converters.USVString(X, W, re) : R(X) ? p.converters.Blob(X, W, re, { strict: !1 }) : ArrayBuffer.isView(X) || U.isArrayBuffer(X) ? p.converters.BufferSource(X, W, re) : h.isFormDataLike(X) ? p.converters.FormData(X, W, re, { strict: !1 }) : X instanceof URLSearchParams ? p.converters.URLSearchParams(X, W, re) : p.converters.DOMString(X, W, re); - }, p.converters.BodyInit = function(X, W, re) { - return X instanceof ReadableStream ? p.converters.ReadableStream(X, W, re) : X?.[Symbol.asyncIterator] ? X : p.converters.XMLHttpRequestBodyInit(X, W, re); - }, p.converters.ResponseInit = p.dictionaryConverter([ + ), w.converters.XMLHttpRequestBodyInit = function(X, W, re) { + return typeof X == "string" ? w.converters.USVString(X, W, re) : F(X) ? w.converters.Blob(X, W, re, { strict: !1 }) : ArrayBuffer.isView(X) || S.isArrayBuffer(X) ? w.converters.BufferSource(X, W, re) : Q.isFormDataLike(X) ? w.converters.FormData(X, W, re, { strict: !1 }) : X instanceof URLSearchParams ? w.converters.URLSearchParams(X, W, re) : w.converters.DOMString(X, W, re); + }, w.converters.BodyInit = function(X, W, re) { + return X instanceof ReadableStream ? w.converters.ReadableStream(X, W, re) : X?.[Symbol.asyncIterator] ? X : w.converters.XMLHttpRequestBodyInit(X, W, re); + }, w.converters.ResponseInit = w.dictionaryConverter([ { key: "status", - converter: p.converters["unsigned short"], + converter: w.converters["unsigned short"], defaultValue: () => 200 }, { key: "statusText", - converter: p.converters.ByteString, + converter: w.converters.ByteString, defaultValue: () => "" }, { key: "headers", - converter: p.converters.HeadersInit + converter: w.converters.HeadersInit } ]), us = { isNetworkError: ae, @@ -8547,23 +8547,23 @@ function Gg() { }, Es; } var Qs, hi; -function rA() { +function sA() { if (hi) return Qs; hi = 1; - const { extractBody: e, mixinBody: t, cloneBody: A, bodyUnusable: s } = Xt(), { Headers: r, fill: n, HeadersList: o, setHeadersGuard: a, getHeadersGuard: u, setHeadersList: g, getHeadersList: i } = vt(), { FinalizationRegistry: c } = Gg()(), h = Ue(), E = rt, { - isValidHTTPToken: C, - sameOrigin: f, + const { extractBody: e, mixinBody: t, cloneBody: A, bodyUnusable: s } = $t(), { Headers: r, fill: n, HeadersList: o, setHeadersGuard: a, getHeadersGuard: u, setHeadersList: l, getHeadersList: i } = Yt(), { FinalizationRegistry: c } = Gg()(), Q = Ue(), h = rt, { + isValidHTTPToken: B, + sameOrigin: d, environmentSettingsObject: y } = it(), { forbiddenMethodsSet: b, - corsSafeListedMethodsSet: R, - referrerPolicy: S, + corsSafeListedMethodsSet: F, + referrerPolicy: M, requestRedirect: L, - requestMode: M, - requestCredentials: d, - requestCache: Q, - requestDuplex: w - } = yA(), { kEnumerableProperty: l, normalizedMethodRecordsBase: B, normalizedMethodRecords: p } = h, { kHeaders: I, kSignal: m, kState: D, kDispatcher: N } = Ft(), { webidl: U } = $e(), { URLSerializer: G } = st(), { kConstruct: v } = Ve(), $ = He, { getMaxListeners: ne, setMaxListeners: ge, getEventListeners: ae, defaultMaxListeners: Be } = Vt, he = /* @__PURE__ */ Symbol("abortController"), Qe = new c(({ signal: P, abort: Z }) => { + requestMode: N, + requestCredentials: f, + requestCache: E, + requestDuplex: p + } = yA(), { kEnumerableProperty: g, normalizedMethodRecordsBase: C, normalizedMethodRecords: w } = Q, { kHeaders: I, kSignal: m, kState: D, kDispatcher: U } = Tt(), { webidl: S } = $e(), { URLSerializer: G } = st(), { kConstruct: v } = Ve(), $ = He, { getMaxListeners: ne, setMaxListeners: ge, getEventListeners: ae, defaultMaxListeners: Be } = Wt, he = /* @__PURE__ */ Symbol("abortController"), Qe = new c(({ signal: P, abort: Z }) => { P.removeEventListener("abort", Z); }), ye = /* @__PURE__ */ new WeakMap(); function we(P) { @@ -8590,15 +8590,15 @@ function rA() { class W { // https://fetch.spec.whatwg.org/#dom-request constructor(Z, se = {}) { - if (U.util.markAsUncloneable(this), Z === v) + if (S.util.markAsUncloneable(this), Z === v) return; const le = "Request constructor"; - U.argumentLengthCheck(arguments, 1, le), Z = U.converters.RequestInfo(Z, le, "input"), se = U.converters.RequestInit(se, le, "init"); + S.argumentLengthCheck(arguments, 1, le), Z = S.converters.RequestInfo(Z, le, "input"), se = S.converters.RequestInit(se, le, "init"); let oe = null, fe = null; const Me = y.settingsObject.baseUrl; let pe = null; if (typeof Z == "string") { - this[N] = se.dispatcher; + this[U] = se.dispatcher; let q; try { q = new URL(Z, Me); @@ -8611,10 +8611,10 @@ function rA() { ); oe = re({ urlList: [q] }), fe = "cors"; } else - this[N] = se.dispatcher || Z[N], $(Z instanceof W), oe = Z[D], pe = Z[m]; + this[U] = se.dispatcher || Z[U], $(Z instanceof W), oe = Z[D], pe = Z[m]; const Le = y.settingsObject.origin; let Re = "client"; - if (oe.window?.constructor?.name === "EnvironmentSettingsObject" && f(oe.window, Le) && (Re = oe.window), se.window != null) + if (oe.window?.constructor?.name === "EnvironmentSettingsObject" && d(oe.window, Le) && (Re = oe.window), se.window != null) throw new TypeError(`'window' option '${Re}' must be null`); "window" in se && (Re = "no-window"), oe = re({ // URL request’s URL. @@ -8671,13 +8671,13 @@ function rA() { } catch (ue) { throw new TypeError(`Referrer "${q}" is not a valid URL.`, { cause: ue }); } - ie.protocol === "about:" && ie.hostname === "client" || Le && !f(ie, y.settingsObject.baseUrl) ? oe.referrer = "client" : oe.referrer = ie; + ie.protocol === "about:" && ie.hostname === "client" || Le && !d(ie, y.settingsObject.baseUrl) ? oe.referrer = "client" : oe.referrer = ie; } } se.referrerPolicy !== void 0 && (oe.referrerPolicy = se.referrerPolicy); let de; if (se.mode !== void 0 ? de = se.mode : de = fe, de === "navigate") - throw U.errors.exception({ + throw S.errors.exception({ header: "Request constructor", message: "invalid request mode navigate." }); @@ -8687,16 +8687,16 @@ function rA() { ); if (se.redirect !== void 0 && (oe.redirect = se.redirect), se.integrity != null && (oe.integrity = String(se.integrity)), se.keepalive !== void 0 && (oe.keepalive = !!se.keepalive), se.method !== void 0) { let q = se.method; - const ie = p[q]; + const ie = w[q]; if (ie !== void 0) oe.method = ie; else { - if (!C(q)) + if (!B(q)) throw new TypeError(`'${q}' is not a valid HTTP method.`); const ue = q.toUpperCase(); if (b.has(ue)) throw new TypeError(`'${q}' HTTP method is unsupported.`); - q = B[ue] ?? q, oe.method = q; + q = C[ue] ?? q, oe.method = q; } !X && oe.method === "patch" && (process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.", { code: "UNDICI-FETCH-patch" @@ -8718,11 +8718,11 @@ function rA() { (typeof ne == "function" && ne(pe) === Be || ae(pe, "abort").length >= Be) && ge(1500, pe); } catch { } - h.addAbortListener(pe, ie), Qe.register(We, { signal: pe, abort: ie }, ie); + Q.addAbortListener(pe, ie), Qe.register(We, { signal: pe, abort: ie }, ie); } } - if (this[I] = new r(v), g(this[I], oe.headersList), a(this[I], "request"), de === "no-cors") { - if (!R.has(oe.method)) + if (this[I] = new r(v), l(this[I], oe.headersList), a(this[I], "request"), de === "no-cors") { + if (!F.has(oe.method)) throw new TypeError( `'${oe.method} is unsupported in no-cors mode.` ); @@ -8758,39 +8758,39 @@ function rA() { ); oe.useCORSPreflightFlag = !0; } - let k = j; + let R = j; if (Je == null && _e != null) { if (s(Z)) throw new TypeError( "Cannot construct a Request with a Request object that has already been used." ); const q = new TransformStream(); - _e.stream.pipeThrough(q), k = { + _e.stream.pipeThrough(q), R = { source: _e.source, length: _e.length, stream: q.readable }; } - this[D].body = k; + this[D].body = R; } // Returns request’s HTTP method, which is "GET" by default. get method() { - return U.brandCheck(this, W), this[D].method; + return S.brandCheck(this, W), this[D].method; } // Returns the URL of request as a string. get url() { - return U.brandCheck(this, W), G(this[D].url); + return S.brandCheck(this, W), G(this[D].url); } // Returns a Headers object consisting of the headers associated with request. // Note that headers added in the network layer by the user agent will not // be accounted for in this object, e.g., the "Host" header. get headers() { - return U.brandCheck(this, W), this[I]; + return S.brandCheck(this, W), this[I]; } // Returns the kind of resource requested by request, e.g., "document" // or "script". get destination() { - return U.brandCheck(this, W), this[D].destination; + return S.brandCheck(this, W), this[D].destination; } // Returns the referrer of request. Its value can be a same-origin URL if // explicitly set in init, the empty string to indicate no referrer, and @@ -8798,19 +8798,19 @@ function rA() { // during fetching to determine the value of the `Referer` header of the // request being made. get referrer() { - return U.brandCheck(this, W), this[D].referrer === "no-referrer" ? "" : this[D].referrer === "client" ? "about:client" : this[D].referrer.toString(); + return S.brandCheck(this, W), this[D].referrer === "no-referrer" ? "" : this[D].referrer === "client" ? "about:client" : this[D].referrer.toString(); } // Returns the referrer policy associated with request. // This is used during fetching to compute the value of the request’s // referrer. get referrerPolicy() { - return U.brandCheck(this, W), this[D].referrerPolicy; + return S.brandCheck(this, W), this[D].referrerPolicy; } // Returns the mode associated with request, which is a string indicating // whether the request will use CORS, or will be restricted to same-origin // URLs. get mode() { - return U.brandCheck(this, W), this[D].mode; + return S.brandCheck(this, W), this[D].mode; } // Returns the credentials mode associated with request, // which is a string indicating whether credentials will be sent with the @@ -8822,54 +8822,54 @@ function rA() { // which is a string indicating how the request will // interact with the browser’s cache when fetching. get cache() { - return U.brandCheck(this, W), this[D].cache; + return S.brandCheck(this, W), this[D].cache; } // Returns the redirect mode associated with request, // which is a string indicating how redirects for the // request will be handled during fetching. A request // will follow redirects by default. get redirect() { - return U.brandCheck(this, W), this[D].redirect; + return S.brandCheck(this, W), this[D].redirect; } // Returns request’s subresource integrity metadata, which is a // cryptographic hash of the resource being fetched. Its value // consists of multiple hashes separated by whitespace. [SRI] get integrity() { - return U.brandCheck(this, W), this[D].integrity; + return S.brandCheck(this, W), this[D].integrity; } // Returns a boolean indicating whether or not request can outlive the // global in which it was created. get keepalive() { - return U.brandCheck(this, W), this[D].keepalive; + return S.brandCheck(this, W), this[D].keepalive; } // Returns a boolean indicating whether or not request is for a reload // navigation. get isReloadNavigation() { - return U.brandCheck(this, W), this[D].reloadNavigation; + return S.brandCheck(this, W), this[D].reloadNavigation; } // Returns a boolean indicating whether or not request is for a history // navigation (a.k.a. back-forward navigation). get isHistoryNavigation() { - return U.brandCheck(this, W), this[D].historyNavigation; + return S.brandCheck(this, W), this[D].historyNavigation; } // Returns the signal associated with request, which is an AbortSignal // object indicating whether or not request has been aborted, and its // abort event handler. get signal() { - return U.brandCheck(this, W), this[m]; + return S.brandCheck(this, W), this[m]; } get body() { - return U.brandCheck(this, W), this[D].body ? this[D].body.stream : null; + return S.brandCheck(this, W), this[D].body ? this[D].body.stream : null; } get bodyUsed() { - return U.brandCheck(this, W), !!this[D].body && h.isDisturbed(this[D].body.stream); + return S.brandCheck(this, W), !!this[D].body && Q.isDisturbed(this[D].body.stream); } get duplex() { - return U.brandCheck(this, W), "half"; + return S.brandCheck(this, W), "half"; } // Returns a clone of request. clone() { - if (U.brandCheck(this, W), s(this)) + if (S.brandCheck(this, W), s(this)) throw new TypeError("unusable"); const Z = J(this[D]), se = new AbortController(); if (this.signal.aborted) @@ -8878,14 +8878,14 @@ function rA() { let le = ye.get(this.signal); le === void 0 && (le = /* @__PURE__ */ new Set(), ye.set(this.signal, le)); const oe = new WeakRef(se); - le.add(oe), h.addAbortListener( + le.add(oe), Q.addAbortListener( se.signal, we(oe) ); } return V(Z, se.signal, u(this[I])); } - [E.inspect.custom](Z, se) { + [h.inspect.custom](Z, se) { se.depth === null && (se.depth = 2), se.colors ??= !0; const le = { method: this.method, @@ -8904,7 +8904,7 @@ function rA() { isHistoryNavigation: this.isHistoryNavigation, signal: this.signal }; - return `Request ${E.formatWithOptions(se, le)}`; + return `Request ${h.formatWithOptions(se, le)}`; } } t(W); @@ -8956,100 +8956,100 @@ function rA() { } function V(P, Z, se) { const le = new W(v); - return le[D] = P, le[m] = Z, le[I] = new r(v), g(le[I], P.headersList), a(le[I], se), le; + return le[D] = P, le[m] = Z, le[I] = new r(v), l(le[I], P.headersList), a(le[I], se), le; } return Object.defineProperties(W.prototype, { - method: l, - url: l, - headers: l, - redirect: l, - clone: l, - signal: l, - duplex: l, - destination: l, - body: l, - bodyUsed: l, - isHistoryNavigation: l, - isReloadNavigation: l, - keepalive: l, - integrity: l, - cache: l, - credentials: l, - attribute: l, - referrerPolicy: l, - referrer: l, - mode: l, + method: g, + url: g, + headers: g, + redirect: g, + clone: g, + signal: g, + duplex: g, + destination: g, + body: g, + bodyUsed: g, + isHistoryNavigation: g, + isReloadNavigation: g, + keepalive: g, + integrity: g, + cache: g, + credentials: g, + attribute: g, + referrerPolicy: g, + referrer: g, + mode: g, [Symbol.toStringTag]: { value: "Request", configurable: !0 } - }), U.converters.Request = U.interfaceConverter( + }), S.converters.Request = S.interfaceConverter( W - ), U.converters.RequestInfo = function(P, Z, se) { - return typeof P == "string" ? U.converters.USVString(P, Z, se) : P instanceof W ? U.converters.Request(P, Z, se) : U.converters.USVString(P, Z, se); - }, U.converters.AbortSignal = U.interfaceConverter( + ), S.converters.RequestInfo = function(P, Z, se) { + return typeof P == "string" ? S.converters.USVString(P, Z, se) : P instanceof W ? S.converters.Request(P, Z, se) : S.converters.USVString(P, Z, se); + }, S.converters.AbortSignal = S.interfaceConverter( AbortSignal - ), U.converters.RequestInit = U.dictionaryConverter([ + ), S.converters.RequestInit = S.dictionaryConverter([ { key: "method", - converter: U.converters.ByteString + converter: S.converters.ByteString }, { key: "headers", - converter: U.converters.HeadersInit + converter: S.converters.HeadersInit }, { key: "body", - converter: U.nullableConverter( - U.converters.BodyInit + converter: S.nullableConverter( + S.converters.BodyInit ) }, { key: "referrer", - converter: U.converters.USVString + converter: S.converters.USVString }, { key: "referrerPolicy", - converter: U.converters.DOMString, + converter: S.converters.DOMString, // https://w3c.github.io/webappsec-referrer-policy/#referrer-policy - allowedValues: S + allowedValues: M }, { key: "mode", - converter: U.converters.DOMString, + converter: S.converters.DOMString, // https://fetch.spec.whatwg.org/#concept-request-mode - allowedValues: M + allowedValues: N }, { key: "credentials", - converter: U.converters.DOMString, + converter: S.converters.DOMString, // https://fetch.spec.whatwg.org/#requestcredentials - allowedValues: d + allowedValues: f }, { key: "cache", - converter: U.converters.DOMString, + converter: S.converters.DOMString, // https://fetch.spec.whatwg.org/#requestcache - allowedValues: Q + allowedValues: E }, { key: "redirect", - converter: U.converters.DOMString, + converter: S.converters.DOMString, // https://fetch.spec.whatwg.org/#requestredirect allowedValues: L }, { key: "integrity", - converter: U.converters.DOMString + converter: S.converters.DOMString }, { key: "keepalive", - converter: U.converters.boolean + converter: S.converters.boolean }, { key: "signal", - converter: U.nullableConverter( - (P) => U.converters.AbortSignal( + converter: S.nullableConverter( + (P) => S.converters.AbortSignal( P, "RequestInit", "signal", @@ -9059,17 +9059,17 @@ function rA() { }, { key: "window", - converter: U.converters.any + converter: S.converters.any }, { key: "duplex", - converter: U.converters.DOMString, - allowedValues: w + converter: S.converters.DOMString, + allowedValues: p }, { key: "dispatcher", // undici specific option - converter: U.converters.any + converter: S.converters.any } ]), Qs = { Request: W, makeRequest: re, fromInnerRequest: V, cloneRequest: J }, Qs; } @@ -9083,31 +9083,31 @@ function SA() { filterResponse: A, makeResponse: s, fromInnerResponse: r - } = TA(), { HeadersList: n } = vt(), { Request: o, cloneRequest: a } = rA(), u = jA, { - bytesMatch: g, + } = TA(), { HeadersList: n } = Yt(), { Request: o, cloneRequest: a } = sA(), u = jA, { + bytesMatch: l, makePolicyContainer: i, clonePolicyContainer: c, - requestBadPort: h, - TAOCheck: E, - appendRequestOriginHeader: C, - responseLocationURL: f, + requestBadPort: Q, + TAOCheck: h, + appendRequestOriginHeader: B, + responseLocationURL: d, requestCurrentURL: y, setRequestReferrerPolicyOnRedirect: b, - tryUpgradeRequestToAPotentiallyTrustworthyURL: R, - createOpaqueTimingInfo: S, + tryUpgradeRequestToAPotentiallyTrustworthyURL: F, + createOpaqueTimingInfo: M, appendFetchMetadata: L, - corsCheck: M, - crossOriginResourcePolicyCheck: d, - determineRequestsReferrer: Q, - coarsenedSharedCurrentTime: w, - createDeferredPromise: l, - isBlobLike: B, - sameOrigin: p, + corsCheck: N, + crossOriginResourcePolicyCheck: f, + determineRequestsReferrer: E, + coarsenedSharedCurrentTime: p, + createDeferredPromise: g, + isBlobLike: C, + sameOrigin: w, isCancelled: I, isAborted: m, isErrorLike: D, - fullyReadBody: N, - readableStreamClose: U, + fullyReadBody: U, + readableStreamClose: S, isomorphicEncode: G, urlIsLocal: v, urlIsHttpHttpsScheme: $, @@ -9117,13 +9117,13 @@ function SA() { buildContentRange: Be, createInflate: he, extractMimeType: Qe - } = it(), { kState: ye, kDispatcher: we } = Ft(), X = He, { safelyExtractBody: W, extractBody: re } = Xt(), { + } = it(), { kState: ye, kDispatcher: we } = Tt(), X = He, { safelyExtractBody: W, extractBody: re } = $t(), { redirectStatusSet: J, nullBodyStatus: V, safeMethodsSet: P, requestBodyHeader: Z, subresourceSet: se - } = yA(), le = Vt, { Readable: oe, pipeline: fe, finished: Me } = ot, { addAbortListener: pe, isErrored: Le, isReadable: Re, bufferToLowerCasedHeaderName: ke } = Ue(), { dataURLProcessor: de, serializeAMimeType: We, minimizeSupportedMimeType: _e } = st(), { getGlobalDispatcher: Je } = ss(), { webidl: j } = $e(), { STATUS_CODES: k } = fA, q = ["GET", "HEAD"], ie = typeof __UNDICI_IS_NODE__ < "u" || typeof esbuildDetection < "u" ? "node" : "undici"; + } = yA(), le = Wt, { Readable: oe, pipeline: fe, finished: Me } = ot, { addAbortListener: pe, isErrored: Le, isReadable: Re, bufferToLowerCasedHeaderName: ke } = Ue(), { dataURLProcessor: de, serializeAMimeType: We, minimizeSupportedMimeType: _e } = st(), { getGlobalDispatcher: Je } = ss(), { webidl: j } = $e(), { STATUS_CODES: R } = fA, q = ["GET", "HEAD"], ie = typeof __UNDICI_IS_NODE__ < "u" || typeof esbuildDetection < "u" ? "node" : "undici"; let ue; class Ce extends le { constructor(O) { @@ -9137,14 +9137,14 @@ function SA() { this.state === "ongoing" && (this.state = "aborted", O || (O = new DOMException("The operation was aborted.", "AbortError")), this.serializedAbortReason = O, this.connection?.destroy(O), this.emit("terminated", O)); } } - function De(F) { - ze(F, "fetch"); + function De(k) { + ze(k, "fetch"); } - function ve(F, O = void 0) { + function ve(k, O = void 0) { j.argumentLengthCheck(arguments, 1, "globalThis.fetch"); - let H = l(), _; + let H = g(), _; try { - _ = new o(F, O); + _ = new o(k, O); } catch (xe) { return H.reject(xe), H.promise; } @@ -9180,14 +9180,14 @@ function SA() { // undici }), H.promise; } - function ze(F, O = "other") { - if (F.type === "error" && F.aborted || !F.urlList?.length) + function ze(k, O = "other") { + if (k.type === "error" && k.aborted || !k.urlList?.length) return; - const H = F.urlList[0]; - let _ = F.timingInfo, Ae = F.cacheState; - $(H) && _ !== null && (F.timingAllowPassed || (_ = S({ + const H = k.urlList[0]; + let _ = k.timingInfo, Ae = k.cacheState; + $(H) && _ !== null && (k.timingAllowPassed || (_ = M({ startTime: _.startTime - }), Ae = ""), _.endTime = w(), F.timingInfo = _, Ke( + }), Ae = ""), _.endTime = p(), k.timingInfo = _, Ke( _, H.href, O, @@ -9196,8 +9196,8 @@ function SA() { )); } const Ke = performance.markResourceTiming; - function Ie(F, O, H, _) { - if (F && F.reject(_), O.body != null && Re(O.body?.stream) && O.body.stream.cancel(_).catch((z) => { + function Ie(k, O, H, _) { + if (k && k.reject(_), O.body != null && Re(O.body?.stream) && O.body.stream.cancel(_).catch((z) => { if (z.code !== "ERR_INVALID_STATE") throw z; }), H == null) @@ -9209,7 +9209,7 @@ function SA() { }); } function Y({ - request: F, + request: k, processRequestBodyChunkLength: O, processRequestEndOfBody: H, processResponse: _, @@ -9221,13 +9221,13 @@ function SA() { }) { X(Fe); let Ge = null, Ne = !1; - F.client != null && (Ge = F.client.globalObject, Ne = F.client.crossOriginIsolatedCapability); - const xe = w(Ne), gt = S({ + k.client != null && (Ge = k.client.globalObject, Ne = k.client.crossOriginIsolatedCapability); + const xe = p(Ne), lt = M({ startTime: xe }), Te = { controller: new Ce(Fe), - request: F, - timingInfo: gt, + request: k, + timingInfo: lt, processRequestBodyChunkLength: O, processRequestEndOfBody: H, processResponse: _, @@ -9236,51 +9236,51 @@ function SA() { taskDestination: Ge, crossOriginIsolatedCapability: Ne }; - return X(!F.body || F.body.stream), F.window === "client" && (F.window = F.client?.globalObject?.constructor?.name === "Window" ? F.client : "no-window"), F.origin === "client" && (F.origin = F.client.origin), F.policyContainer === "client" && (F.client != null ? F.policyContainer = c( - F.client.policyContainer - ) : F.policyContainer = i()), F.headersList.contains("accept", !0) || F.headersList.append("accept", "*/*", !0), F.headersList.contains("accept-language", !0) || F.headersList.append("accept-language", "*", !0), F.priority, se.has(F.destination), ee(Te).catch((je) => { + return X(!k.body || k.body.stream), k.window === "client" && (k.window = k.client?.globalObject?.constructor?.name === "Window" ? k.client : "no-window"), k.origin === "client" && (k.origin = k.client.origin), k.policyContainer === "client" && (k.client != null ? k.policyContainer = c( + k.client.policyContainer + ) : k.policyContainer = i()), k.headersList.contains("accept", !0) || k.headersList.append("accept", "*/*", !0), k.headersList.contains("accept-language", !0) || k.headersList.append("accept-language", "*", !0), k.priority, se.has(k.destination), ee(Te).catch((je) => { Te.controller.terminate(je); }), Te.controller; } - async function ee(F, O = !1) { - const H = F.request; + async function ee(k, O = !1) { + const H = k.request; let _ = null; - if (H.localURLsOnly && !v(y(H)) && (_ = e("local URLs only")), R(H), h(H) === "blocked" && (_ = e("bad port")), H.referrerPolicy === "" && (H.referrerPolicy = H.policyContainer.referrerPolicy), H.referrer !== "no-referrer" && (H.referrer = Q(H)), _ === null && (_ = await (async () => { + if (H.localURLsOnly && !v(y(H)) && (_ = e("local URLs only")), F(H), Q(H) === "blocked" && (_ = e("bad port")), H.referrerPolicy === "" && (H.referrerPolicy = H.policyContainer.referrerPolicy), H.referrer !== "no-referrer" && (H.referrer = E(H)), _ === null && (_ = await (async () => { const z = y(H); return ( // - request’s current URL’s origin is same origin with request’s origin, // and request’s response tainting is "basic" - p(z, H.url) && H.responseTainting === "basic" || // request’s current URL’s scheme is "data" + w(z, H.url) && H.responseTainting === "basic" || // request’s current URL’s scheme is "data" z.protocol === "data:" || // - request’s mode is "navigate" or "websocket" - H.mode === "navigate" || H.mode === "websocket" ? (H.responseTainting = "basic", await K(F)) : H.mode === "same-origin" ? e('request mode cannot be "same-origin"') : H.mode === "no-cors" ? H.redirect !== "follow" ? e( + H.mode === "navigate" || H.mode === "websocket" ? (H.responseTainting = "basic", await K(k)) : H.mode === "same-origin" ? e('request mode cannot be "same-origin"') : H.mode === "no-cors" ? H.redirect !== "follow" ? e( 'redirect mode cannot be "follow" for "no-cors" request' - ) : (H.responseTainting = "opaque", await K(F)) : $(y(H)) ? (H.responseTainting = "cors", await be(F)) : e("URL scheme must be a HTTP(S) scheme") + ) : (H.responseTainting = "opaque", await K(k)) : $(y(H)) ? (H.responseTainting = "cors", await be(k)) : e("URL scheme must be a HTTP(S) scheme") ); })()), O) return _; _.status !== 0 && !_.internalResponse && (H.responseTainting, H.responseTainting === "basic" ? _ = A(_, "basic") : H.responseTainting === "cors" ? _ = A(_, "cors") : H.responseTainting === "opaque" ? _ = A(_, "opaque") : X(!1)); let Ae = _.status === 0 ? _ : _.internalResponse; - if (Ae.urlList.length === 0 && Ae.urlList.push(...H.urlList), H.timingAllowFailed || (_.timingAllowPassed = !0), _.type === "opaque" && Ae.status === 206 && Ae.rangeRequested && !H.headers.contains("range", !0) && (_ = Ae = e()), _.status !== 0 && (H.method === "HEAD" || H.method === "CONNECT" || V.includes(Ae.status)) && (Ae.body = null, F.controller.dump = !0), H.integrity) { - const z = (Fe) => Ee(F, e(Fe)); + if (Ae.urlList.length === 0 && Ae.urlList.push(...H.urlList), H.timingAllowFailed || (_.timingAllowPassed = !0), _.type === "opaque" && Ae.status === 206 && Ae.rangeRequested && !H.headers.contains("range", !0) && (_ = Ae = e()), _.status !== 0 && (H.method === "HEAD" || H.method === "CONNECT" || V.includes(Ae.status)) && (Ae.body = null, k.controller.dump = !0), H.integrity) { + const z = (Fe) => Ee(k, e(Fe)); if (H.responseTainting === "opaque" || _.body == null) { z(_.error); return; } const ce = (Fe) => { - if (!g(Fe, H.integrity)) { + if (!l(Fe, H.integrity)) { z("integrity mismatch"); return; } - _.body = W(Fe)[0], Ee(F, _); + _.body = W(Fe)[0], Ee(k, _); }; - await N(_.body, ce, z); + await U(_.body, ce, z); } else - Ee(F, _); + Ee(k, _); } - function K(F) { - if (I(F) && F.request.redirectCount === 0) - return Promise.resolve(t(F)); - const { request: O } = F, { protocol: H } = y(O); + function K(k) { + if (I(k) && k.request.redirectCount === 0) + return Promise.resolve(t(k)); + const { request: O } = k, { protocol: H } = y(O); switch (H) { case "about:": return Promise.resolve(e("about scheme is not supported")); @@ -9290,7 +9290,7 @@ function SA() { if (_.search.length !== 0) return Promise.resolve(e("NetworkError when attempting to fetch resource.")); const Ae = ue(_.toString()); - if (O.method !== "GET" || !B(Ae)) + if (O.method !== "GET" || !C(Ae)) return Promise.resolve(e("invalid method")); const z = s(), ce = Ae.size, Fe = G(`${ce}`), Ge = Ae.type; if (O.headersList.contains("range", !0)) { @@ -9298,17 +9298,17 @@ function SA() { const Ne = O.headersList.get("range", !0), xe = ae(Ne, !0); if (xe === "failure") return Promise.resolve(e("failed to fetch the data URL")); - let { rangeStartValue: gt, rangeEndValue: Te } = xe; - if (gt === null) - gt = ce - Te, Te = gt + Te - 1; + let { rangeStartValue: lt, rangeEndValue: Te } = xe; + if (lt === null) + lt = ce - Te, Te = lt + Te - 1; else { - if (gt >= ce) + if (lt >= ce) return Promise.resolve(e("Range start is greater than the blob's size.")); (Te === null || Te >= ce) && (Te = ce - 1); } - const je = Ae.slice(gt, Te, Ge), nt = re(je); + const je = Ae.slice(lt, Te, Ge), nt = re(je); z.body = nt[0]; - const qe = G(`${je.size}`), It = Be(gt, Te, ce); + const qe = G(`${je.size}`), It = Be(lt, Te, ce); z.status = 206, z.statusText = "Partial Content", z.headersList.set("content-length", qe, !0), z.headersList.set("content-type", Ge, !0), z.headersList.set("content-range", It, !0); } else { const Ne = re(Ae); @@ -9333,67 +9333,67 @@ function SA() { return Promise.resolve(e("not implemented... yet...")); case "http:": case "https:": - return be(F).catch((_) => e(_)); + return be(k).catch((_) => e(_)); default: return Promise.resolve(e("unknown scheme")); } } - function te(F, O) { - F.request.done = !0, F.processResponseDone != null && queueMicrotask(() => F.processResponseDone(O)); + function te(k, O) { + k.request.done = !0, k.processResponseDone != null && queueMicrotask(() => k.processResponseDone(O)); } - function Ee(F, O) { - let H = F.timingInfo; + function Ee(k, O) { + let H = k.timingInfo; const _ = () => { const z = Date.now(); - F.request.destination === "document" && (F.controller.fullTimingInfo = H), F.controller.reportTimingSteps = () => { - if (F.request.url.protocol !== "https:") + k.request.destination === "document" && (k.controller.fullTimingInfo = H), k.controller.reportTimingSteps = () => { + if (k.request.url.protocol !== "https:") return; H.endTime = z; let Fe = O.cacheState; const Ge = O.bodyInfo; - O.timingAllowPassed || (H = S(H), Fe = ""); + O.timingAllowPassed || (H = M(H), Fe = ""); let Ne = 0; - if (F.request.mode !== "navigator" || !O.hasCrossOriginRedirects) { + if (k.request.mode !== "navigator" || !O.hasCrossOriginRedirects) { Ne = O.status; const xe = Qe(O.headersList); xe !== "failure" && (Ge.contentType = _e(xe)); } - F.request.initiatorType != null && Ke(H, F.request.url.href, F.request.initiatorType, globalThis, Fe, Ge, Ne); + k.request.initiatorType != null && Ke(H, k.request.url.href, k.request.initiatorType, globalThis, Fe, Ge, Ne); }; const ce = () => { - F.request.done = !0, F.processResponseEndOfBody != null && queueMicrotask(() => F.processResponseEndOfBody(O)), F.request.initiatorType != null && F.controller.reportTimingSteps(); + k.request.done = !0, k.processResponseEndOfBody != null && queueMicrotask(() => k.processResponseEndOfBody(O)), k.request.initiatorType != null && k.controller.reportTimingSteps(); }; queueMicrotask(() => ce()); }; - F.processResponse != null && queueMicrotask(() => { - F.processResponse(O), F.processResponse = null; + k.processResponse != null && queueMicrotask(() => { + k.processResponse(O), k.processResponse = null; }); const Ae = O.type === "error" ? O : O.internalResponse ?? O; Ae.body == null ? _() : Me(Ae.body.stream, () => { _(); }); } - async function be(F) { - const O = F.request; + async function be(k) { + const O = k.request; let H = null, _ = null; - const Ae = F.timingInfo; + const Ae = k.timingInfo; if (O.serviceWorkers, H === null) { - if (O.redirect === "follow" && (O.serviceWorkers = "none"), _ = H = await T(F), O.responseTainting === "cors" && M(O, H) === "failure") + if (O.redirect === "follow" && (O.serviceWorkers = "none"), _ = H = await T(k), O.responseTainting === "cors" && N(O, H) === "failure") return e("cors failure"); - E(O, H) === "failure" && (O.timingAllowFailed = !0); + h(O, H) === "failure" && (O.timingAllowFailed = !0); } - return (O.responseTainting === "opaque" || H.type === "opaque") && d( + return (O.responseTainting === "opaque" || H.type === "opaque") && f( O.origin, O.client, O.destination, _ - ) === "blocked" ? e("blocked") : (J.has(_.status) && (O.redirect !== "manual" && F.controller.connection.destroy(void 0, !1), O.redirect === "error" ? H = e("unexpected redirect") : O.redirect === "manual" ? H = _ : O.redirect === "follow" ? H = await Se(F, H) : X(!1)), H.timingInfo = Ae, H); + ) === "blocked" ? e("blocked") : (J.has(_.status) && (O.redirect !== "manual" && k.controller.connection.destroy(void 0, !1), O.redirect === "error" ? H = e("unexpected redirect") : O.redirect === "manual" ? H = _ : O.redirect === "follow" ? H = await Se(k, H) : X(!1)), H.timingInfo = Ae, H); } - function Se(F, O) { - const H = F.request, _ = O.internalResponse ? O.internalResponse : O; + function Se(k, O) { + const H = k.request, _ = O.internalResponse ? O.internalResponse : O; let Ae; try { - if (Ae = f( + if (Ae = d( _, y(H).hash ), Ae == null) @@ -9405,7 +9405,7 @@ function SA() { return Promise.resolve(e("URL scheme must be a HTTP(S) scheme")); if (H.redirectCount === 20) return Promise.resolve(e("redirect count exceeded")); - if (H.redirectCount += 1, H.mode === "cors" && (Ae.username || Ae.password) && !p(H, Ae)) + if (H.redirectCount += 1, H.mode === "cors" && (Ae.username || Ae.password) && !w(H, Ae)) return Promise.resolve(e('cross origin not allowed for request mode "cors"')); if (H.responseTainting === "cors" && (Ae.username || Ae.password)) return Promise.resolve(e( @@ -9418,17 +9418,17 @@ function SA() { for (const ce of Z) H.headersList.delete(ce); } - p(y(H), Ae) || (H.headersList.delete("authorization", !0), H.headersList.delete("proxy-authorization", !0), H.headersList.delete("cookie", !0), H.headersList.delete("host", !0)), H.body != null && (X(H.body.source != null), H.body = W(H.body.source)[0]); - const z = F.timingInfo; - return z.redirectEndTime = z.postRedirectStartTime = w(F.crossOriginIsolatedCapability), z.redirectStartTime === 0 && (z.redirectStartTime = z.startTime), H.urlList.push(Ae), b(H, _), ee(F, !0); + w(y(H), Ae) || (H.headersList.delete("authorization", !0), H.headersList.delete("proxy-authorization", !0), H.headersList.delete("cookie", !0), H.headersList.delete("host", !0)), H.body != null && (X(H.body.source != null), H.body = W(H.body.source)[0]); + const z = k.timingInfo; + return z.redirectEndTime = z.postRedirectStartTime = p(k.crossOriginIsolatedCapability), z.redirectStartTime === 0 && (z.redirectStartTime = z.startTime), H.urlList.push(Ae), b(H, _), ee(k, !0); } - async function T(F, O = !1, H = !1) { - const _ = F.request; + async function T(k, O = !1, H = !1) { + const _ = k.request; let Ae = null, z = null, ce = null; - _.window === "no-window" && _.redirect === "error" ? (Ae = F, z = _) : (z = a(_), Ae = { ...F }, Ae.request = z); + _.window === "no-window" && _.redirect === "error" ? (Ae = k, z = _) : (z = a(_), Ae = { ...k }, Ae.request = z); const Fe = _.credentials === "include" || _.credentials === "same-origin" && _.responseTainting === "basic", Ge = z.body ? z.body.length : null; let Ne = null; - if (z.body == null && ["POST", "PUT"].includes(z.method) && (Ne = "0"), Ge != null && (Ne = G(`${Ge}`)), Ne != null && z.headersList.append("content-length", Ne, !0), Ge != null && z.keepalive, z.referrer instanceof URL && z.headersList.append("referer", G(z.referrer.href), !0), C(z), L(z), z.headersList.contains("user-agent", !0) || z.headersList.append("user-agent", ie), z.cache === "default" && (z.headersList.contains("if-modified-since", !0) || z.headersList.contains("if-none-match", !0) || z.headersList.contains("if-unmodified-since", !0) || z.headersList.contains("if-match", !0) || z.headersList.contains("if-range", !0)) && (z.cache = "no-store"), z.cache === "no-cache" && !z.preventNoCacheCacheControlHeaderModification && !z.headersList.contains("cache-control", !0) && z.headersList.append("cache-control", "max-age=0", !0), (z.cache === "no-store" || z.cache === "reload") && (z.headersList.contains("pragma", !0) || z.headersList.append("pragma", "no-cache", !0), z.headersList.contains("cache-control", !0) || z.headersList.append("cache-control", "no-cache", !0)), z.headersList.contains("range", !0) && z.headersList.append("accept-encoding", "identity", !0), z.headersList.contains("accept-encoding", !0) || (ne(y(z)) ? z.headersList.append("accept-encoding", "br, gzip, deflate", !0) : z.headersList.append("accept-encoding", "gzip, deflate", !0)), z.headersList.delete("host", !0), z.cache = "no-store", z.cache !== "no-store" && z.cache, ce == null) { + if (z.body == null && ["POST", "PUT"].includes(z.method) && (Ne = "0"), Ge != null && (Ne = G(`${Ge}`)), Ne != null && z.headersList.append("content-length", Ne, !0), Ge != null && z.keepalive, z.referrer instanceof URL && z.headersList.append("referer", G(z.referrer.href), !0), B(z), L(z), z.headersList.contains("user-agent", !0) || z.headersList.append("user-agent", ie), z.cache === "default" && (z.headersList.contains("if-modified-since", !0) || z.headersList.contains("if-none-match", !0) || z.headersList.contains("if-unmodified-since", !0) || z.headersList.contains("if-match", !0) || z.headersList.contains("if-range", !0)) && (z.cache = "no-store"), z.cache === "no-cache" && !z.preventNoCacheCacheControlHeaderModification && !z.headersList.contains("cache-control", !0) && z.headersList.append("cache-control", "max-age=0", !0), (z.cache === "no-store" || z.cache === "reload") && (z.headersList.contains("pragma", !0) || z.headersList.append("pragma", "no-cache", !0), z.headersList.contains("cache-control", !0) || z.headersList.append("cache-control", "no-cache", !0)), z.headersList.contains("range", !0) && z.headersList.append("accept-encoding", "identity", !0), z.headersList.contains("accept-encoding", !0) || (ne(y(z)) ? z.headersList.append("accept-encoding", "br, gzip, deflate", !0) : z.headersList.append("accept-encoding", "gzip, deflate", !0)), z.headersList.delete("host", !0), z.cache = "no-store", z.cache !== "no-store" && z.cache, ce == null) { if (z.cache === "only-if-cached") return e("only if cached"); const xe = await x( @@ -9439,45 +9439,45 @@ function SA() { !P.has(z.method) && xe.status >= 200 && xe.status <= 399, ce == null && (ce = xe); } if (ce.urlList = [...z.urlList], z.headersList.contains("range", !0) && (ce.rangeRequested = !0), ce.requestIncludesCredentials = Fe, ce.status === 407) - return _.window === "no-window" ? e() : I(F) ? t(F) : e("proxy authentication required"); + return _.window === "no-window" ? e() : I(k) ? t(k) : e("proxy authentication required"); if ( // response’s status is 421 ce.status === 421 && // isNewConnectionFetch is false !H && // request’s body is null, or request’s body is non-null and request’s body’s source is non-null (_.body == null || _.body.source != null) ) { - if (I(F)) - return t(F); - F.controller.connection.destroy(), ce = await T( - F, + if (I(k)) + return t(k); + k.controller.connection.destroy(), ce = await T( + k, O, !0 ); } return ce; } - async function x(F, O = !1, H = !1) { - X(!F.controller.connection || F.controller.connection.destroyed), F.controller.connection = { + async function x(k, O = !1, H = !1) { + X(!k.controller.connection || k.controller.connection.destroyed), k.controller.connection = { abort: null, destroyed: !1, destroy(Te, je = !0) { this.destroyed || (this.destroyed = !0, je && this.abort?.(Te ?? new DOMException("The operation was aborted.", "AbortError"))); } }; - const _ = F.request; + const _ = k.request; let Ae = null; - const z = F.timingInfo; + const z = k.timingInfo; _.cache = "no-store", _.mode; let ce = null; - if (_.body == null && F.processRequestEndOfBody) - queueMicrotask(() => F.processRequestEndOfBody()); + if (_.body == null && k.processRequestEndOfBody) + queueMicrotask(() => k.processRequestEndOfBody()); else if (_.body != null) { const Te = async function* (qe) { - I(F) || (yield qe, F.processRequestBodyChunkLength?.(qe.byteLength)); + I(k) || (yield qe, k.processRequestBodyChunkLength?.(qe.byteLength)); }, je = () => { - I(F) || F.processRequestEndOfBody && F.processRequestEndOfBody(); + I(k) || k.processRequestEndOfBody && k.processRequestEndOfBody(); }, nt = (qe) => { - I(F) || (qe.name === "AbortError" ? F.controller.abort() : F.controller.terminate(qe)); + I(k) || (qe.name === "AbortError" ? k.controller.abort() : k.controller.terminate(qe)); }; ce = (async function* () { try { @@ -9490,24 +9490,24 @@ function SA() { })(); } try { - const { body: Te, status: je, statusText: nt, headersList: qe, socket: It } = await gt({ body: ce }); + const { body: Te, status: je, statusText: nt, headersList: qe, socket: It } = await lt({ body: ce }); if (It) Ae = s({ status: je, statusText: nt, headersList: qe, socket: It }); else { const Ze = Te[Symbol.asyncIterator](); - F.controller.next = () => Ze.next(), Ae = s({ status: je, statusText: nt, headersList: qe }); + k.controller.next = () => Ze.next(), Ae = s({ status: je, statusText: nt, headersList: qe }); } } catch (Te) { - return Te.name === "AbortError" ? (F.controller.connection.destroy(), t(F, Te)) : e(Te); + return Te.name === "AbortError" ? (k.controller.connection.destroy(), t(k, Te)) : e(Te); } const Fe = async () => { - await F.controller.resume(); + await k.controller.resume(); }, Ge = (Te) => { - I(F) || F.controller.abort(Te); + I(k) || k.controller.abort(Te); }, Ne = new ReadableStream( { async start(Te) { - F.controller.controller = Te; + k.controller.controller = Te; }, async pull(Te) { await Fe(); @@ -9518,44 +9518,44 @@ function SA() { type: "bytes" } ); - Ae.body = { stream: Ne, source: null, length: null }, F.controller.onAborted = xe, F.controller.on("terminated", xe), F.controller.resume = async () => { + Ae.body = { stream: Ne, source: null, length: null }, k.controller.onAborted = xe, k.controller.on("terminated", xe), k.controller.resume = async () => { for (; ; ) { let Te, je; try { - const { done: qe, value: It } = await F.controller.next(); - if (m(F)) + const { done: qe, value: It } = await k.controller.next(); + if (m(k)) break; Te = qe ? void 0 : It; } catch (qe) { - F.controller.ended && !z.encodedBodySize ? Te = void 0 : (Te = qe, je = !0); + k.controller.ended && !z.encodedBodySize ? Te = void 0 : (Te = qe, je = !0); } if (Te === void 0) { - U(F.controller.controller), te(F, Ae); + S(k.controller.controller), te(k, Ae); return; } if (z.decodedBodySize += Te?.byteLength ?? 0, je) { - F.controller.terminate(Te); + k.controller.terminate(Te); return; } const nt = new Uint8Array(Te); - if (nt.byteLength && F.controller.controller.enqueue(nt), Le(Ne)) { - F.controller.terminate(); + if (nt.byteLength && k.controller.controller.enqueue(nt), Le(Ne)) { + k.controller.terminate(); return; } - if (F.controller.controller.desiredSize <= 0) + if (k.controller.controller.desiredSize <= 0) return; } }; function xe(Te) { - m(F) ? (Ae.aborted = !0, Re(Ne) && F.controller.controller.error( - F.controller.serializedAbortReason - )) : Re(Ne) && F.controller.controller.error(new TypeError("terminated", { + m(k) ? (Ae.aborted = !0, Re(Ne) && k.controller.controller.error( + k.controller.serializedAbortReason + )) : Re(Ne) && k.controller.controller.error(new TypeError("terminated", { cause: D(Te) ? Te : void 0 - })), F.controller.connection.destroy(); + })), k.controller.connection.destroy(); } return Ae; - function gt({ body: Te }) { - const je = y(_), nt = F.controller.dispatcher; + function lt({ body: Te }) { + const je = y(_), nt = k.controller.dispatcher; return new Promise((qe, It) => nt.dispatch( { path: je.pathname + je.search, @@ -9570,29 +9570,29 @@ function SA() { body: null, abort: null, onConnect(Ze) { - const { connection: At } = F.controller; - z.finalConnectionTimingInfo = ge(void 0, z.postRedirectStartTime, F.crossOriginIsolatedCapability), At.destroyed ? Ze(new DOMException("The operation was aborted.", "AbortError")) : (F.controller.on("terminated", Ze), this.abort = At.abort = Ze), z.finalNetworkRequestStartTime = w(F.crossOriginIsolatedCapability); + const { connection: At } = k.controller; + z.finalConnectionTimingInfo = ge(void 0, z.postRedirectStartTime, k.crossOriginIsolatedCapability), At.destroyed ? Ze(new DOMException("The operation was aborted.", "AbortError")) : (k.controller.on("terminated", Ze), this.abort = At.abort = Ze), z.finalNetworkRequestStartTime = p(k.crossOriginIsolatedCapability); }, onResponseStarted() { - z.finalNetworkResponseStartTime = w(F.crossOriginIsolatedCapability); + z.finalNetworkResponseStartTime = p(k.crossOriginIsolatedCapability); }, onHeaders(Ze, At, ZA, QA) { if (Ze < 200) return; - let Rt = ""; + let kt = ""; const hA = new n(); - for (let lt = 0; lt < At.length; lt += 2) - hA.append(ke(At[lt]), At[lt + 1].toString("latin1"), !0); - Rt = hA.get("location", !0), this.body = new oe({ read: ZA }); - const Lt = [], Oc = Rt && _.redirect === "follow" && J.has(Ze); + for (let ut = 0; ut < At.length; ut += 2) + hA.append(ke(At[ut]), At[ut + 1].toString("latin1"), !0); + kt = hA.get("location", !0), this.body = new oe({ read: ZA }); + const Gt = [], Oc = kt && _.redirect === "follow" && J.has(Ze); if (_.method !== "HEAD" && _.method !== "CONNECT" && !V.includes(Ze) && !Oc) { - const lt = hA.get("content-encoding", !0), BA = lt ? lt.toLowerCase().split(",") : [], Rn = 5; + const ut = hA.get("content-encoding", !0), BA = ut ? ut.toLowerCase().split(",") : [], Rn = 5; if (BA.length > Rn) return It(new Error(`too many content-encodings in response: ${BA.length}, maximum allowed is ${Rn}`)), !0; for (let KA = BA.length - 1; KA >= 0; --KA) { const CA = BA[KA].trim(); if (CA === "x-gzip" || CA === "gzip") - Lt.push(u.createGunzip({ + Gt.push(u.createGunzip({ // Be less strict when decoding compressed responses, since sometimes // servers send slightly invalid responses that are still accepted // by common browsers. @@ -9601,17 +9601,17 @@ function SA() { finishFlush: u.constants.Z_SYNC_FLUSH })); else if (CA === "deflate") - Lt.push(he({ + Gt.push(he({ flush: u.constants.Z_SYNC_FLUSH, finishFlush: u.constants.Z_SYNC_FLUSH })); else if (CA === "br") - Lt.push(u.createBrotliDecompress({ + Gt.push(u.createBrotliDecompress({ flush: u.constants.BROTLI_OPERATION_FLUSH, finishFlush: u.constants.BROTLI_OPERATION_FLUSH })); else { - Lt.length = 0; + Gt.length = 0; break; } } @@ -9621,32 +9621,32 @@ function SA() { status: Ze, statusText: QA, headersList: hA, - body: Lt.length ? fe(this.body, ...Lt, (lt) => { - lt && this.onError(lt); + body: Gt.length ? fe(this.body, ...Gt, (ut) => { + ut && this.onError(ut); }).on("error", bn) : this.body.on("error", bn) }), !0; }, onData(Ze) { - if (F.controller.dump) + if (k.controller.dump) return; const At = Ze; return z.encodedBodySize += At.byteLength, this.body.push(At); }, onComplete() { - this.abort && F.controller.off("terminated", this.abort), F.controller.onAborted && F.controller.off("terminated", F.controller.onAborted), F.controller.ended = !0, this.body.push(null); + this.abort && k.controller.off("terminated", this.abort), k.controller.onAborted && k.controller.off("terminated", k.controller.onAborted), k.controller.ended = !0, this.body.push(null); }, onError(Ze) { - this.abort && F.controller.off("terminated", this.abort), this.body?.destroy(Ze), F.controller.terminate(Ze), It(Ze); + this.abort && k.controller.off("terminated", this.abort), this.body?.destroy(Ze), k.controller.terminate(Ze), It(Ze); }, onUpgrade(Ze, At, ZA) { if (Ze !== 101) return; const QA = new n(); - for (let Rt = 0; Rt < At.length; Rt += 2) - QA.append(ke(At[Rt]), At[Rt + 1].toString("latin1"), !0); + for (let kt = 0; kt < At.length; kt += 2) + QA.append(ke(At[kt]), At[kt + 1].toString("latin1"), !0); return qe({ status: Ze, - statusText: k[Ze], + statusText: R[Ze], headersList: QA, socket: ZA }), !0; @@ -10024,109 +10024,109 @@ function Jg() { kResult: A, kAborted: s, kLastProgressEventFired: r - } = Ii(), { ProgressEvent: n } = vg(), { getEncoding: o } = Yg(), { serializeAMimeType: a, parseMIMEType: u } = st(), { types: g } = rt, { StringDecoder: i } = $c, { btoa: c } = at, h = { + } = Ii(), { ProgressEvent: n } = vg(), { getEncoding: o } = Yg(), { serializeAMimeType: a, parseMIMEType: u } = st(), { types: l } = rt, { StringDecoder: i } = $c, { btoa: c } = at, Q = { enumerable: !0, writable: !1, configurable: !1 }; - function E(S, L, M, d) { - if (S[e] === "loading") + function h(M, L, N, f) { + if (M[e] === "loading") throw new DOMException("Invalid state", "InvalidStateError"); - S[e] = "loading", S[A] = null, S[t] = null; - const w = L.stream().getReader(), l = []; - let B = w.read(), p = !0; + M[e] = "loading", M[A] = null, M[t] = null; + const p = L.stream().getReader(), g = []; + let C = p.read(), w = !0; (async () => { - for (; !S[s]; ) + for (; !M[s]; ) try { - const { done: I, value: m } = await B; - if (p && !S[s] && queueMicrotask(() => { - C("loadstart", S); - }), p = !1, !I && g.isUint8Array(m)) - l.push(m), (S[r] === void 0 || Date.now() - S[r] >= 50) && !S[s] && (S[r] = Date.now(), queueMicrotask(() => { - C("progress", S); - })), B = w.read(); + const { done: I, value: m } = await C; + if (w && !M[s] && queueMicrotask(() => { + B("loadstart", M); + }), w = !1, !I && l.isUint8Array(m)) + g.push(m), (M[r] === void 0 || Date.now() - M[r] >= 50) && !M[s] && (M[r] = Date.now(), queueMicrotask(() => { + B("progress", M); + })), C = p.read(); else if (I) { queueMicrotask(() => { - S[e] = "done"; + M[e] = "done"; try { - const D = f(l, M, L.type, d); - if (S[s]) + const D = d(g, N, L.type, f); + if (M[s]) return; - S[A] = D, C("load", S); + M[A] = D, B("load", M); } catch (D) { - S[t] = D, C("error", S); + M[t] = D, B("error", M); } - S[e] !== "loading" && C("loadend", S); + M[e] !== "loading" && B("loadend", M); }); break; } } catch (I) { - if (S[s]) + if (M[s]) return; queueMicrotask(() => { - S[e] = "done", S[t] = I, C("error", S), S[e] !== "loading" && C("loadend", S); + M[e] = "done", M[t] = I, B("error", M), M[e] !== "loading" && B("loadend", M); }); break; } })(); } - function C(S, L) { - const M = new n(S, { + function B(M, L) { + const N = new n(M, { bubbles: !1, cancelable: !1 }); - L.dispatchEvent(M); + L.dispatchEvent(N); } - function f(S, L, M, d) { + function d(M, L, N, f) { switch (L) { case "DataURL": { - let Q = "data:"; - const w = u(M || "application/octet-stream"); - w !== "failure" && (Q += a(w)), Q += ";base64,"; - const l = new i("latin1"); - for (const B of S) - Q += c(l.write(B)); - return Q += c(l.end()), Q; + let E = "data:"; + const p = u(N || "application/octet-stream"); + p !== "failure" && (E += a(p)), E += ";base64,"; + const g = new i("latin1"); + for (const C of M) + E += c(g.write(C)); + return E += c(g.end()), E; } case "Text": { - let Q = "failure"; - if (d && (Q = o(d)), Q === "failure" && M) { - const w = u(M); - w !== "failure" && (Q = o(w.parameters.get("charset"))); + let E = "failure"; + if (f && (E = o(f)), E === "failure" && N) { + const p = u(N); + p !== "failure" && (E = o(p.parameters.get("charset"))); } - return Q === "failure" && (Q = "UTF-8"), y(S, Q); + return E === "failure" && (E = "UTF-8"), y(M, E); } case "ArrayBuffer": - return R(S).buffer; + return F(M).buffer; case "BinaryString": { - let Q = ""; - const w = new i("latin1"); - for (const l of S) - Q += w.write(l); - return Q += w.end(), Q; + let E = ""; + const p = new i("latin1"); + for (const g of M) + E += p.write(g); + return E += p.end(), E; } } } - function y(S, L) { - const M = R(S), d = b(M); - let Q = 0; - d !== null && (L = d, Q = d === "UTF-8" ? 3 : 2); - const w = M.slice(Q); - return new TextDecoder(L).decode(w); + function y(M, L) { + const N = F(M), f = b(N); + let E = 0; + f !== null && (L = f, E = f === "UTF-8" ? 3 : 2); + const p = N.slice(E); + return new TextDecoder(L).decode(p); } - function b(S) { - const [L, M, d] = S; - return L === 239 && M === 187 && d === 191 ? "UTF-8" : L === 254 && M === 255 ? "UTF-16BE" : L === 255 && M === 254 ? "UTF-16LE" : null; + function b(M) { + const [L, N, f] = M; + return L === 239 && N === 187 && f === 191 ? "UTF-8" : L === 254 && N === 255 ? "UTF-16BE" : L === 255 && N === 254 ? "UTF-16LE" : null; } - function R(S) { - const L = S.reduce((d, Q) => d + Q.byteLength, 0); - let M = 0; - return S.reduce((d, Q) => (d.set(Q, M), M += Q.byteLength, d), new Uint8Array(L)); + function F(M) { + const L = M.reduce((f, E) => f + E.byteLength, 0); + let N = 0; + return M.reduce((f, E) => (f.set(E, N), N += E.byteLength, f), new Uint8Array(L)); } return ds = { - staticPropertyDescriptors: h, - readOperation: E, - fireAProgressEvent: C + staticPropertyDescriptors: Q, + readOperation: h, + fireAProgressEvent: B }, ds; } var fs, wi; @@ -10143,7 +10143,7 @@ function Hg() { kResult: n, kEvents: o, kAborted: a - } = Ii(), { webidl: u } = $e(), { kEnumerableProperty: g } = Ue(); + } = Ii(), { webidl: u } = $e(), { kEnumerableProperty: l } = Ue(); class i extends EventTarget { constructor() { super(), this[s] = "empty", this[n] = null, this[r] = null, this[o] = { @@ -10159,30 +10159,30 @@ function Hg() { * @see https://w3c.github.io/FileAPI/#dfn-readAsArrayBuffer * @param {import('buffer').Blob} blob */ - readAsArrayBuffer(h) { - u.brandCheck(this, i), u.argumentLengthCheck(arguments, 1, "FileReader.readAsArrayBuffer"), h = u.converters.Blob(h, { strict: !1 }), t(this, h, "ArrayBuffer"); + readAsArrayBuffer(Q) { + u.brandCheck(this, i), u.argumentLengthCheck(arguments, 1, "FileReader.readAsArrayBuffer"), Q = u.converters.Blob(Q, { strict: !1 }), t(this, Q, "ArrayBuffer"); } /** * @see https://w3c.github.io/FileAPI/#readAsBinaryString * @param {import('buffer').Blob} blob */ - readAsBinaryString(h) { - u.brandCheck(this, i), u.argumentLengthCheck(arguments, 1, "FileReader.readAsBinaryString"), h = u.converters.Blob(h, { strict: !1 }), t(this, h, "BinaryString"); + readAsBinaryString(Q) { + u.brandCheck(this, i), u.argumentLengthCheck(arguments, 1, "FileReader.readAsBinaryString"), Q = u.converters.Blob(Q, { strict: !1 }), t(this, Q, "BinaryString"); } /** * @see https://w3c.github.io/FileAPI/#readAsDataText * @param {import('buffer').Blob} blob * @param {string?} encoding */ - readAsText(h, E = void 0) { - u.brandCheck(this, i), u.argumentLengthCheck(arguments, 1, "FileReader.readAsText"), h = u.converters.Blob(h, { strict: !1 }), E !== void 0 && (E = u.converters.DOMString(E, "FileReader.readAsText", "encoding")), t(this, h, "Text", E); + readAsText(Q, h = void 0) { + u.brandCheck(this, i), u.argumentLengthCheck(arguments, 1, "FileReader.readAsText"), Q = u.converters.Blob(Q, { strict: !1 }), h !== void 0 && (h = u.converters.DOMString(h, "FileReader.readAsText", "encoding")), t(this, Q, "Text", h); } /** * @see https://w3c.github.io/FileAPI/#dfn-readAsDataURL * @param {import('buffer').Blob} blob */ - readAsDataURL(h) { - u.brandCheck(this, i), u.argumentLengthCheck(arguments, 1, "FileReader.readAsDataURL"), h = u.converters.Blob(h, { strict: !1 }), t(this, h, "DataURL"); + readAsDataURL(Q) { + u.brandCheck(this, i), u.argumentLengthCheck(arguments, 1, "FileReader.readAsDataURL"), Q = u.converters.Blob(Q, { strict: !1 }), t(this, Q, "DataURL"); } /** * @see https://w3c.github.io/FileAPI/#dfn-abort @@ -10222,58 +10222,58 @@ function Hg() { get onloadend() { return u.brandCheck(this, i), this[o].loadend; } - set onloadend(h) { - u.brandCheck(this, i), this[o].loadend && this.removeEventListener("loadend", this[o].loadend), typeof h == "function" ? (this[o].loadend = h, this.addEventListener("loadend", h)) : this[o].loadend = null; + set onloadend(Q) { + u.brandCheck(this, i), this[o].loadend && this.removeEventListener("loadend", this[o].loadend), typeof Q == "function" ? (this[o].loadend = Q, this.addEventListener("loadend", Q)) : this[o].loadend = null; } get onerror() { return u.brandCheck(this, i), this[o].error; } - set onerror(h) { - u.brandCheck(this, i), this[o].error && this.removeEventListener("error", this[o].error), typeof h == "function" ? (this[o].error = h, this.addEventListener("error", h)) : this[o].error = null; + set onerror(Q) { + u.brandCheck(this, i), this[o].error && this.removeEventListener("error", this[o].error), typeof Q == "function" ? (this[o].error = Q, this.addEventListener("error", Q)) : this[o].error = null; } get onloadstart() { return u.brandCheck(this, i), this[o].loadstart; } - set onloadstart(h) { - u.brandCheck(this, i), this[o].loadstart && this.removeEventListener("loadstart", this[o].loadstart), typeof h == "function" ? (this[o].loadstart = h, this.addEventListener("loadstart", h)) : this[o].loadstart = null; + set onloadstart(Q) { + u.brandCheck(this, i), this[o].loadstart && this.removeEventListener("loadstart", this[o].loadstart), typeof Q == "function" ? (this[o].loadstart = Q, this.addEventListener("loadstart", Q)) : this[o].loadstart = null; } get onprogress() { return u.brandCheck(this, i), this[o].progress; } - set onprogress(h) { - u.brandCheck(this, i), this[o].progress && this.removeEventListener("progress", this[o].progress), typeof h == "function" ? (this[o].progress = h, this.addEventListener("progress", h)) : this[o].progress = null; + set onprogress(Q) { + u.brandCheck(this, i), this[o].progress && this.removeEventListener("progress", this[o].progress), typeof Q == "function" ? (this[o].progress = Q, this.addEventListener("progress", Q)) : this[o].progress = null; } get onload() { return u.brandCheck(this, i), this[o].load; } - set onload(h) { - u.brandCheck(this, i), this[o].load && this.removeEventListener("load", this[o].load), typeof h == "function" ? (this[o].load = h, this.addEventListener("load", h)) : this[o].load = null; + set onload(Q) { + u.brandCheck(this, i), this[o].load && this.removeEventListener("load", this[o].load), typeof Q == "function" ? (this[o].load = Q, this.addEventListener("load", Q)) : this[o].load = null; } get onabort() { return u.brandCheck(this, i), this[o].abort; } - set onabort(h) { - u.brandCheck(this, i), this[o].abort && this.removeEventListener("abort", this[o].abort), typeof h == "function" ? (this[o].abort = h, this.addEventListener("abort", h)) : this[o].abort = null; + set onabort(Q) { + u.brandCheck(this, i), this[o].abort && this.removeEventListener("abort", this[o].abort), typeof Q == "function" ? (this[o].abort = Q, this.addEventListener("abort", Q)) : this[o].abort = null; } } return i.EMPTY = i.prototype.EMPTY = 0, i.LOADING = i.prototype.LOADING = 1, i.DONE = i.prototype.DONE = 2, Object.defineProperties(i.prototype, { EMPTY: e, LOADING: e, DONE: e, - readAsArrayBuffer: g, - readAsBinaryString: g, - readAsText: g, - readAsDataURL: g, - abort: g, - readyState: g, - result: g, - error: g, - onloadstart: g, - onprogress: g, - onload: g, - onabort: g, - onerror: g, - onloadend: g, + readAsArrayBuffer: l, + readAsBinaryString: l, + readAsText: l, + readAsDataURL: l, + abort: l, + readyState: l, + result: l, + error: l, + onloadstart: l, + onprogress: l, + onload: l, + onabort: l, + onerror: l, + onloadend: l, [Symbol.toStringTag]: { value: "FileReader", writable: !1, @@ -10300,8 +10300,8 @@ function Og() { yi = 1; const e = He, { URLSerializer: t } = st(), { isValidHeaderName: A } = it(); function s(n, o, a = !1) { - const u = t(n, a), g = t(o, a); - return u === g; + const u = t(n, a), l = t(o, a); + return u === l; } function r(n) { e(n !== null); @@ -10319,7 +10319,7 @@ var ys, Di; function Pg() { if (Di) return ys; Di = 1; - const { kConstruct: e } = ws(), { urlEquals: t, getFieldValues: A } = Og(), { kEnumerableProperty: s, isDisturbed: r } = Ue(), { webidl: n } = $e(), { Response: o, cloneResponse: a, fromInnerResponse: u } = TA(), { Request: g, fromInnerRequest: i } = rA(), { kState: c } = Ft(), { fetching: h } = SA(), { urlIsHttpHttpsScheme: E, createDeferredPromise: C, readAllBytes: f } = it(), y = He; + const { kConstruct: e } = ws(), { urlEquals: t, getFieldValues: A } = Og(), { kEnumerableProperty: s, isDisturbed: r } = Ue(), { webidl: n } = $e(), { Response: o, cloneResponse: a, fromInnerResponse: u } = TA(), { Request: l, fromInnerRequest: i } = sA(), { kState: c } = Tt(), { fetching: Q } = SA(), { urlIsHttpHttpsScheme: h, createDeferredPromise: B, readAllBytes: d } = it(), y = He; class b { /** * @see https://w3c.github.io/ServiceWorker/#dfn-relevant-request-response-list @@ -10329,59 +10329,59 @@ function Pg() { constructor() { arguments[0] !== e && n.illegalConstructor(), n.util.markAsUncloneable(this), this.#e = arguments[1]; } - async match(L, M = {}) { + async match(L, N = {}) { n.brandCheck(this, b); - const d = "Cache.match"; - n.argumentLengthCheck(arguments, 1, d), L = n.converters.RequestInfo(L, d, "request"), M = n.converters.CacheQueryOptions(M, d, "options"); - const Q = this.#A(L, M, 1); - if (Q.length !== 0) - return Q[0]; + const f = "Cache.match"; + n.argumentLengthCheck(arguments, 1, f), L = n.converters.RequestInfo(L, f, "request"), N = n.converters.CacheQueryOptions(N, f, "options"); + const E = this.#A(L, N, 1); + if (E.length !== 0) + return E[0]; } - async matchAll(L = void 0, M = {}) { + async matchAll(L = void 0, N = {}) { n.brandCheck(this, b); - const d = "Cache.matchAll"; - return L !== void 0 && (L = n.converters.RequestInfo(L, d, "request")), M = n.converters.CacheQueryOptions(M, d, "options"), this.#A(L, M); + const f = "Cache.matchAll"; + return L !== void 0 && (L = n.converters.RequestInfo(L, f, "request")), N = n.converters.CacheQueryOptions(N, f, "options"), this.#A(L, N); } async add(L) { n.brandCheck(this, b); - const M = "Cache.add"; - n.argumentLengthCheck(arguments, 1, M), L = n.converters.RequestInfo(L, M, "request"); - const d = [L]; - return await this.addAll(d); + const N = "Cache.add"; + n.argumentLengthCheck(arguments, 1, N), L = n.converters.RequestInfo(L, N, "request"); + const f = [L]; + return await this.addAll(f); } async addAll(L) { n.brandCheck(this, b); - const M = "Cache.addAll"; - n.argumentLengthCheck(arguments, 1, M); - const d = [], Q = []; - for (let N of L) { - if (N === void 0) + const N = "Cache.addAll"; + n.argumentLengthCheck(arguments, 1, N); + const f = [], E = []; + for (let U of L) { + if (U === void 0) throw n.errors.conversionFailed({ - prefix: M, + prefix: N, argument: "Argument 1", types: ["undefined is not allowed"] }); - if (N = n.converters.RequestInfo(N), typeof N == "string") + if (U = n.converters.RequestInfo(U), typeof U == "string") continue; - const U = N[c]; - if (!E(U.url) || U.method !== "GET") + const S = U[c]; + if (!h(S.url) || S.method !== "GET") throw n.errors.exception({ - header: M, + header: N, message: "Expected http/s scheme when method is not GET." }); } - const w = []; - for (const N of L) { - const U = new g(N)[c]; - if (!E(U.url)) + const p = []; + for (const U of L) { + const S = new l(U)[c]; + if (!h(S.url)) throw n.errors.exception({ - header: M, + header: N, message: "Expected http/s scheme." }); - U.initiator = "fetch", U.destination = "subresource", Q.push(U); - const G = C(); - w.push(h({ - request: U, + S.initiator = "fetch", S.destination = "subresource", E.push(S); + const G = B(); + p.push(Q({ + request: S, processResponse(v) { if (v.type === "error" || v.status === 206 || v.status < 200 || v.status > 299) G.reject(n.errors.exception({ @@ -10396,7 +10396,7 @@ function Pg() { header: "Cache.addAll", message: "invalid vary field value" })); - for (const ge of w) + for (const ge of p) ge.abort(); return; } @@ -10409,116 +10409,116 @@ function Pg() { } G.resolve(v); } - })), d.push(G.promise); + })), f.push(G.promise); } - const B = await Promise.all(d), p = []; + const C = await Promise.all(f), w = []; let I = 0; - for (const N of B) { - const U = { + for (const U of C) { + const S = { type: "put", // 7.3.2 - request: Q[I], + request: E[I], // 7.3.3 - response: N + response: U // 7.3.4 }; - p.push(U), I++; + w.push(S), I++; } - const m = C(); + const m = B(); let D = null; try { - this.#t(p); - } catch (N) { - D = N; + this.#t(w); + } catch (U) { + D = U; } return queueMicrotask(() => { D === null ? m.resolve(void 0) : m.reject(D); }), m.promise; } - async put(L, M) { + async put(L, N) { n.brandCheck(this, b); - const d = "Cache.put"; - n.argumentLengthCheck(arguments, 2, d), L = n.converters.RequestInfo(L, d, "request"), M = n.converters.Response(M, d, "response"); - let Q = null; - if (L instanceof g ? Q = L[c] : Q = new g(L)[c], !E(Q.url) || Q.method !== "GET") + const f = "Cache.put"; + n.argumentLengthCheck(arguments, 2, f), L = n.converters.RequestInfo(L, f, "request"), N = n.converters.Response(N, f, "response"); + let E = null; + if (L instanceof l ? E = L[c] : E = new l(L)[c], !h(E.url) || E.method !== "GET") throw n.errors.exception({ - header: d, + header: f, message: "Expected an http/s scheme when method is not GET" }); - const w = M[c]; - if (w.status === 206) + const p = N[c]; + if (p.status === 206) throw n.errors.exception({ - header: d, + header: f, message: "Got 206 status" }); - if (w.headersList.contains("vary")) { - const U = A(w.headersList.get("vary")); - for (const G of U) + if (p.headersList.contains("vary")) { + const S = A(p.headersList.get("vary")); + for (const G of S) if (G === "*") throw n.errors.exception({ - header: d, + header: f, message: "Got * vary field value" }); } - if (w.body && (r(w.body.stream) || w.body.stream.locked)) + if (p.body && (r(p.body.stream) || p.body.stream.locked)) throw n.errors.exception({ - header: d, + header: f, message: "Response body is locked or disturbed" }); - const l = a(w), B = C(); - if (w.body != null) { - const G = w.body.stream.getReader(); - f(G).then(B.resolve, B.reject); + const g = a(p), C = B(); + if (p.body != null) { + const G = p.body.stream.getReader(); + d(G).then(C.resolve, C.reject); } else - B.resolve(void 0); - const p = [], I = { + C.resolve(void 0); + const w = [], I = { type: "put", // 14. - request: Q, + request: E, // 15. - response: l + response: g // 16. }; - p.push(I); - const m = await B.promise; - l.body != null && (l.body.source = m); - const D = C(); - let N = null; + w.push(I); + const m = await C.promise; + g.body != null && (g.body.source = m); + const D = B(); + let U = null; try { - this.#t(p); - } catch (U) { - N = U; + this.#t(w); + } catch (S) { + U = S; } return queueMicrotask(() => { - N === null ? D.resolve() : D.reject(N); + U === null ? D.resolve() : D.reject(U); }), D.promise; } - async delete(L, M = {}) { + async delete(L, N = {}) { n.brandCheck(this, b); - const d = "Cache.delete"; - n.argumentLengthCheck(arguments, 1, d), L = n.converters.RequestInfo(L, d, "request"), M = n.converters.CacheQueryOptions(M, d, "options"); - let Q = null; - if (L instanceof g) { - if (Q = L[c], Q.method !== "GET" && !M.ignoreMethod) + const f = "Cache.delete"; + n.argumentLengthCheck(arguments, 1, f), L = n.converters.RequestInfo(L, f, "request"), N = n.converters.CacheQueryOptions(N, f, "options"); + let E = null; + if (L instanceof l) { + if (E = L[c], E.method !== "GET" && !N.ignoreMethod) return !1; } else - y(typeof L == "string"), Q = new g(L)[c]; - const w = [], l = { + y(typeof L == "string"), E = new l(L)[c]; + const p = [], g = { type: "delete", - request: Q, - options: M + request: E, + options: N }; - w.push(l); - const B = C(); - let p = null, I; + p.push(g); + const C = B(); + let w = null, I; try { - I = this.#t(w); + I = this.#t(p); } catch (m) { - p = m; + w = m; } return queueMicrotask(() => { - p === null ? B.resolve(!!I?.length) : B.reject(p); - }), B.promise; + w === null ? C.resolve(!!I?.length) : C.reject(w); + }), C.promise; } /** * @see https://w3c.github.io/ServiceWorker/#dom-cache-keys @@ -10526,37 +10526,37 @@ function Pg() { * @param {import('../../types/cache').CacheQueryOptions} options * @returns {Promise} */ - async keys(L = void 0, M = {}) { + async keys(L = void 0, N = {}) { n.brandCheck(this, b); - const d = "Cache.keys"; - L !== void 0 && (L = n.converters.RequestInfo(L, d, "request")), M = n.converters.CacheQueryOptions(M, d, "options"); - let Q = null; + const f = "Cache.keys"; + L !== void 0 && (L = n.converters.RequestInfo(L, f, "request")), N = n.converters.CacheQueryOptions(N, f, "options"); + let E = null; if (L !== void 0) - if (L instanceof g) { - if (Q = L[c], Q.method !== "GET" && !M.ignoreMethod) + if (L instanceof l) { + if (E = L[c], E.method !== "GET" && !N.ignoreMethod) return []; - } else typeof L == "string" && (Q = new g(L)[c]); - const w = C(), l = []; + } else typeof L == "string" && (E = new l(L)[c]); + const p = B(), g = []; if (L === void 0) - for (const B of this.#e) - l.push(B[0]); + for (const C of this.#e) + g.push(C[0]); else { - const B = this.#s(Q, M); - for (const p of B) - l.push(p[0]); + const C = this.#s(E, N); + for (const w of C) + g.push(w[0]); } return queueMicrotask(() => { - const B = []; - for (const p of l) { + const C = []; + for (const w of g) { const I = i( - p, + w, new AbortController().signal, "immutable" ); - B.push(I); + C.push(I); } - w.resolve(Object.freeze(B)); - }), w.promise; + p.resolve(Object.freeze(C)); + }), p.promise; } /** * @see https://w3c.github.io/ServiceWorker/#batch-cache-operations-algorithm @@ -10564,63 +10564,63 @@ function Pg() { * @returns {requestResponseList} */ #t(L) { - const M = this.#e, d = [...M], Q = [], w = []; + const N = this.#e, f = [...N], E = [], p = []; try { - for (const l of L) { - if (l.type !== "delete" && l.type !== "put") + for (const g of L) { + if (g.type !== "delete" && g.type !== "put") throw n.errors.exception({ header: "Cache.#batchCacheOperations", message: 'operation type does not match "delete" or "put"' }); - if (l.type === "delete" && l.response != null) + if (g.type === "delete" && g.response != null) throw n.errors.exception({ header: "Cache.#batchCacheOperations", message: "delete operation should not have an associated response" }); - if (this.#s(l.request, l.options, Q).length) + if (this.#s(g.request, g.options, E).length) throw new DOMException("???", "InvalidStateError"); - let B; - if (l.type === "delete") { - if (B = this.#s(l.request, l.options), B.length === 0) + let C; + if (g.type === "delete") { + if (C = this.#s(g.request, g.options), C.length === 0) return []; - for (const p of B) { - const I = M.indexOf(p); - y(I !== -1), M.splice(I, 1); + for (const w of C) { + const I = N.indexOf(w); + y(I !== -1), N.splice(I, 1); } - } else if (l.type === "put") { - if (l.response == null) + } else if (g.type === "put") { + if (g.response == null) throw n.errors.exception({ header: "Cache.#batchCacheOperations", message: "put operation should have an associated response" }); - const p = l.request; - if (!E(p.url)) + const w = g.request; + if (!h(w.url)) throw n.errors.exception({ header: "Cache.#batchCacheOperations", message: "expected http or https scheme" }); - if (p.method !== "GET") + if (w.method !== "GET") throw n.errors.exception({ header: "Cache.#batchCacheOperations", message: "not get method" }); - if (l.options != null) + if (g.options != null) throw n.errors.exception({ header: "Cache.#batchCacheOperations", message: "options must not be defined" }); - B = this.#s(l.request); - for (const I of B) { - const m = M.indexOf(I); - y(m !== -1), M.splice(m, 1); + C = this.#s(g.request); + for (const I of C) { + const m = N.indexOf(I); + y(m !== -1), N.splice(m, 1); } - M.push([l.request, l.response]), Q.push([l.request, l.response]); + N.push([g.request, g.response]), E.push([g.request, g.response]); } - w.push([l.request, l.response]); + p.push([g.request, g.response]); } - return w; - } catch (l) { - throw this.#e.length = 0, this.#e = d, l; + return p; + } catch (g) { + throw this.#e.length = 0, this.#e = f, g; } } /** @@ -10630,13 +10630,13 @@ function Pg() { * @param {requestResponseList} targetStorage * @returns {requestResponseList} */ - #s(L, M, d) { - const Q = [], w = d ?? this.#e; - for (const l of w) { - const [B, p] = l; - this.#r(L, B, p, M) && Q.push(l); + #s(L, N, f) { + const E = [], p = f ?? this.#e; + for (const g of p) { + const [C, w] = g; + this.#r(L, C, w, N) && E.push(g); } - return Q; + return E; } /** * @see https://w3c.github.io/ServiceWorker/#request-matches-cached-item-algorithm @@ -10646,45 +10646,45 @@ function Pg() { * @param {import('../../types/cache').CacheQueryOptions | undefined} options * @returns {boolean} */ - #r(L, M, d = null, Q) { - const w = new URL(L.url), l = new URL(M.url); - if (Q?.ignoreSearch && (l.search = "", w.search = ""), !t(w, l, !0)) + #r(L, N, f = null, E) { + const p = new URL(L.url), g = new URL(N.url); + if (E?.ignoreSearch && (g.search = "", p.search = ""), !t(p, g, !0)) return !1; - if (d == null || Q?.ignoreVary || !d.headersList.contains("vary")) + if (f == null || E?.ignoreVary || !f.headersList.contains("vary")) return !0; - const B = A(d.headersList.get("vary")); - for (const p of B) { - if (p === "*") + const C = A(f.headersList.get("vary")); + for (const w of C) { + if (w === "*") return !1; - const I = M.headersList.get(p), m = L.headersList.get(p); + const I = N.headersList.get(w), m = L.headersList.get(w); if (I !== m) return !1; } return !0; } - #A(L, M, d = 1 / 0) { - let Q = null; + #A(L, N, f = 1 / 0) { + let E = null; if (L !== void 0) - if (L instanceof g) { - if (Q = L[c], Q.method !== "GET" && !M.ignoreMethod) + if (L instanceof l) { + if (E = L[c], E.method !== "GET" && !N.ignoreMethod) return []; - } else typeof L == "string" && (Q = new g(L)[c]); - const w = []; + } else typeof L == "string" && (E = new l(L)[c]); + const p = []; if (L === void 0) - for (const B of this.#e) - w.push(B[1]); + for (const C of this.#e) + p.push(C[1]); else { - const B = this.#s(Q, M); - for (const p of B) - w.push(p[1]); + const C = this.#s(E, N); + for (const w of C) + p.push(w[1]); } - const l = []; - for (const B of w) { - const p = u(B, "immutable"); - if (l.push(p.clone()), l.length >= d) + const g = []; + for (const C of p) { + const w = u(C, "immutable"); + if (g.push(w.clone()), g.length >= f) break; } - return Object.freeze(l); + return Object.freeze(g); } } Object.defineProperties(b.prototype, { @@ -10700,7 +10700,7 @@ function Pg() { delete: s, keys: s }); - const R = [ + const F = [ { key: "ignoreSearch", converter: n.converters.boolean, @@ -10717,8 +10717,8 @@ function Pg() { defaultValue: () => !1 } ]; - return n.converters.CacheQueryOptions = n.dictionaryConverter(R), n.converters.MultiCacheQueryOptions = n.dictionaryConverter([ - ...R, + return n.converters.CacheQueryOptions = n.dictionaryConverter(F), n.converters.MultiCacheQueryOptions = n.dictionaryConverter([ + ...F, { key: "cacheName", converter: n.converters.DOMString @@ -10775,8 +10775,8 @@ function _g() { A.brandCheck(this, r); const a = "CacheStorage.open"; if (A.argumentLengthCheck(arguments, 1, a), o = A.converters.DOMString(o, a, "cacheName"), this.#e.has(o)) { - const g = this.#e.get(o); - return new t(e, g); + const l = this.#e.get(o); + return new t(e, l); } const u = []; return this.#e.set(o, u), new t(e, u); @@ -10825,62 +10825,62 @@ function Fi() { if (ki) return Rs; ki = 1; function e(c) { - for (let h = 0; h < c.length; ++h) { - const E = c.charCodeAt(h); - if (E >= 0 && E <= 8 || E >= 10 && E <= 31 || E === 127) + for (let Q = 0; Q < c.length; ++Q) { + const h = c.charCodeAt(Q); + if (h >= 0 && h <= 8 || h >= 10 && h <= 31 || h === 127) return !0; } return !1; } function t(c) { - for (let h = 0; h < c.length; ++h) { - const E = c.charCodeAt(h); - if (E < 33 || // exclude CTLs (0-31), SP and HT - E > 126 || // exclude non-ascii and DEL - E === 34 || // " - E === 40 || // ( - E === 41 || // ) - E === 60 || // < - E === 62 || // > - E === 64 || // @ - E === 44 || // , - E === 59 || // ; - E === 58 || // : - E === 92 || // \ - E === 47 || // / - E === 91 || // [ - E === 93 || // ] - E === 63 || // ? - E === 61 || // = - E === 123 || // { - E === 125) + for (let Q = 0; Q < c.length; ++Q) { + const h = c.charCodeAt(Q); + if (h < 33 || // exclude CTLs (0-31), SP and HT + h > 126 || // exclude non-ascii and DEL + h === 34 || // " + h === 40 || // ( + h === 41 || // ) + h === 60 || // < + h === 62 || // > + h === 64 || // @ + h === 44 || // , + h === 59 || // ; + h === 58 || // : + h === 92 || // \ + h === 47 || // / + h === 91 || // [ + h === 93 || // ] + h === 63 || // ? + h === 61 || // = + h === 123 || // { + h === 125) throw new Error("Invalid cookie name"); } } function A(c) { - let h = c.length, E = 0; + let Q = c.length, h = 0; if (c[0] === '"') { - if (h === 1 || c[h - 1] !== '"') + if (Q === 1 || c[Q - 1] !== '"') throw new Error("Invalid cookie value"); - --h, ++E; - } - for (; E < h; ) { - const C = c.charCodeAt(E++); - if (C < 33 || // exclude CTLs (0-31) - C > 126 || // non-ascii and DEL (127) - C === 34 || // " - C === 44 || // , - C === 59 || // ; - C === 92) + --Q, ++h; + } + for (; h < Q; ) { + const B = c.charCodeAt(h++); + if (B < 33 || // exclude CTLs (0-31) + B > 126 || // non-ascii and DEL (127) + B === 34 || // " + B === 44 || // , + B === 59 || // ; + B === 92) throw new Error("Invalid cookie value"); } } function s(c) { - for (let h = 0; h < c.length; ++h) { - const E = c.charCodeAt(h); - if (E < 32 || // exclude CTLs (0-31) - E === 127 || // DEL - E === 59) + for (let Q = 0; Q < c.length; ++Q) { + const h = c.charCodeAt(Q); + if (h < 32 || // exclude CTLs (0-31) + h === 127 || // DEL + h === 59) throw new Error("Invalid cookie path"); } } @@ -10909,11 +10909,11 @@ function Fi() { "Oct", "Nov", "Dec" - ], a = Array(61).fill(0).map((c, h) => h.toString().padStart(2, "0")); + ], a = Array(61).fill(0).map((c, Q) => Q.toString().padStart(2, "0")); function u(c) { return typeof c == "number" && (c = new Date(c)), `${n[c.getUTCDay()]}, ${a[c.getUTCDate()]} ${o[c.getUTCMonth()]} ${c.getUTCFullYear()} ${a[c.getUTCHours()]}:${a[c.getUTCMinutes()]}:${a[c.getUTCSeconds()]} GMT`; } - function g(c) { + function l(c) { if (c < 0) throw new Error("Invalid cookie max-age"); } @@ -10921,15 +10921,15 @@ function Fi() { if (c.name.length === 0) return null; t(c.name), A(c.value); - const h = [`${c.name}=${c.value}`]; - c.name.startsWith("__Secure-") && (c.secure = !0), c.name.startsWith("__Host-") && (c.secure = !0, c.domain = null, c.path = "/"), c.secure && h.push("Secure"), c.httpOnly && h.push("HttpOnly"), typeof c.maxAge == "number" && (g(c.maxAge), h.push(`Max-Age=${c.maxAge}`)), c.domain && (r(c.domain), h.push(`Domain=${c.domain}`)), c.path && (s(c.path), h.push(`Path=${c.path}`)), c.expires && c.expires.toString() !== "Invalid Date" && h.push(`Expires=${u(c.expires)}`), c.sameSite && h.push(`SameSite=${c.sameSite}`); - for (const E of c.unparsed) { - if (!E.includes("=")) + const Q = [`${c.name}=${c.value}`]; + c.name.startsWith("__Secure-") && (c.secure = !0), c.name.startsWith("__Host-") && (c.secure = !0, c.domain = null, c.path = "/"), c.secure && Q.push("Secure"), c.httpOnly && Q.push("HttpOnly"), typeof c.maxAge == "number" && (l(c.maxAge), Q.push(`Max-Age=${c.maxAge}`)), c.domain && (r(c.domain), Q.push(`Domain=${c.domain}`)), c.path && (s(c.path), Q.push(`Path=${c.path}`)), c.expires && c.expires.toString() !== "Invalid Date" && Q.push(`Expires=${u(c.expires)}`), c.sameSite && Q.push(`SameSite=${c.sameSite}`); + for (const h of c.unparsed) { + if (!h.includes("=")) throw new Error("Invalid unparsed"); - const [C, ...f] = E.split("="); - h.push(`${C.trim()}=${f.join("=")}`); + const [B, ...d] = h.split("="); + Q.push(`${B.trim()}=${d.join("=")}`); } - return h.join("; "); + return Q.join("; "); } return Rs = { isCTLExcludingHtab: e, @@ -10948,74 +10948,74 @@ function Vg() { function n(a) { if (A(a)) return null; - let u = "", g = "", i = "", c = ""; + let u = "", l = "", i = "", c = ""; if (a.includes(";")) { - const h = { position: 0 }; - u = s(";", a, h), g = a.slice(h.position); + const Q = { position: 0 }; + u = s(";", a, Q), l = a.slice(Q.position); } else u = a; if (!u.includes("=")) c = u; else { - const h = { position: 0 }; + const Q = { position: 0 }; i = s( "=", u, - h - ), c = u.slice(h.position + 1); + Q + ), c = u.slice(Q.position + 1); } return i = i.trim(), c = c.trim(), i.length + c.length > e ? null : { name: i, value: c, - ...o(g) + ...o(l) }; } function o(a, u = {}) { if (a.length === 0) return u; r(a[0] === ";"), a = a.slice(1); - let g = ""; - a.includes(";") ? (g = s( + let l = ""; + a.includes(";") ? (l = s( ";", a, { position: 0 } - ), a = a.slice(g.length)) : (g = a, a = ""); + ), a = a.slice(l.length)) : (l = a, a = ""); let i = "", c = ""; - if (g.includes("=")) { - const E = { position: 0 }; + if (l.includes("=")) { + const h = { position: 0 }; i = s( "=", - g, - E - ), c = g.slice(E.position + 1); + l, + h + ), c = l.slice(h.position + 1); } else - i = g; + i = l; if (i = i.trim(), c = c.trim(), c.length > t) return o(a, u); - const h = i.toLowerCase(); - if (h === "expires") { - const E = new Date(c); - u.expires = E; - } else if (h === "max-age") { - const E = c.charCodeAt(0); - if ((E < 48 || E > 57) && c[0] !== "-" || !/^\d+$/.test(c)) + const Q = i.toLowerCase(); + if (Q === "expires") { + const h = new Date(c); + u.expires = h; + } else if (Q === "max-age") { + const h = c.charCodeAt(0); + if ((h < 48 || h > 57) && c[0] !== "-" || !/^\d+$/.test(c)) return o(a, u); - const C = Number(c); - u.maxAge = C; - } else if (h === "domain") { - let E = c; - E[0] === "." && (E = E.slice(1)), E = E.toLowerCase(), u.domain = E; - } else if (h === "path") { - let E = ""; - c.length === 0 || c[0] !== "/" ? E = "/" : E = c, u.path = E; - } else if (h === "secure") + const B = Number(c); + u.maxAge = B; + } else if (Q === "domain") { + let h = c; + h[0] === "." && (h = h.slice(1)), h = h.toLowerCase(), u.domain = h; + } else if (Q === "path") { + let h = ""; + c.length === 0 || c[0] !== "/" ? h = "/" : h = c, u.path = h; + } else if (Q === "secure") u.secure = !0; - else if (h === "httponly") + else if (Q === "httponly") u.httpOnly = !0; - else if (h === "samesite") { - let E = "Default"; - const C = c.toLowerCase(); - C.includes("none") && (E = "None"), C.includes("strict") && (E = "Strict"), C.includes("lax") && (E = "Lax"), u.sameSite = E; + else if (Q === "samesite") { + let h = "Default"; + const B = c.toLowerCase(); + B.includes("none") && (h = "None"), B.includes("strict") && (h = "Strict"), B.includes("lax") && (h = "Lax"), u.sameSite = h; } else u.unparsed ??= [], u.unparsed.push(`${i}=${c}`); return o(a, u); @@ -11029,23 +11029,23 @@ var Fs, Si; function Wg() { if (Si) return Fs; Si = 1; - const { parseSetCookie: e } = Vg(), { stringify: t } = Fi(), { webidl: A } = $e(), { Headers: s } = vt(); + const { parseSetCookie: e } = Vg(), { stringify: t } = Fi(), { webidl: A } = $e(), { Headers: s } = Yt(); function r(u) { A.argumentLengthCheck(arguments, 1, "getCookies"), A.brandCheck(u, s, { strict: !1 }); - const g = u.get("cookie"), i = {}; - if (!g) + const l = u.get("cookie"), i = {}; + if (!l) return i; - for (const c of g.split(";")) { - const [h, ...E] = c.split("="); - i[h.trim()] = E.join("="); + for (const c of l.split(";")) { + const [Q, ...h] = c.split("="); + i[Q.trim()] = h.join("="); } return i; } - function n(u, g, i) { + function n(u, l, i) { A.brandCheck(u, s, { strict: !1 }); const c = "deleteCookie"; - A.argumentLengthCheck(arguments, 2, c), g = A.converters.DOMString(g, c, "name"), i = A.converters.DeleteCookieAttributes(i), a(u, { - name: g, + A.argumentLengthCheck(arguments, 2, c), l = A.converters.DOMString(l, c, "name"), i = A.converters.DeleteCookieAttributes(i), a(u, { + name: l, value: "", expires: /* @__PURE__ */ new Date(0), ...i @@ -11053,12 +11053,12 @@ function Wg() { } function o(u) { A.argumentLengthCheck(arguments, 1, "getSetCookies"), A.brandCheck(u, s, { strict: !1 }); - const g = u.getSetCookie(); - return g ? g.map((i) => e(i)) : []; + const l = u.getSetCookie(); + return l ? l.map((i) => e(i)) : []; } - function a(u, g) { - A.argumentLengthCheck(arguments, 2, "setCookie"), A.brandCheck(u, s, { strict: !1 }), g = A.converters.Cookie(g); - const i = t(g); + function a(u, l) { + A.argumentLengthCheck(arguments, 2, "setCookie"), A.brandCheck(u, s, { strict: !1 }), l = A.converters.Cookie(l); + const i = t(l); i && u.append("Set-Cookie", i); } return A.converters.DeleteCookieAttributes = A.dictionaryConverter([ @@ -11129,7 +11129,7 @@ function Wg() { }, Fs; } var Ts, Ui; -function sA() { +function nA() { if (Ui) return Ts; Ui = 1; const { webidl: e } = $e(), { kEnumerableProperty: t } = Ue(), { kConstruct: A } = Ve(), { MessagePort: s } = Nn; @@ -11140,8 +11140,8 @@ function sA() { super(arguments[1], arguments[2]), e.util.markAsUncloneable(this); return; } - const h = "MessageEvent constructor"; - e.argumentLengthCheck(arguments, 1, h), i = e.converters.DOMString(i, h, "type"), c = e.converters.MessageEventInit(c, h, "eventInitDict"), super(i, c), this.#e = c, e.util.markAsUncloneable(this); + const Q = "MessageEvent constructor"; + e.argumentLengthCheck(arguments, 1, Q), i = e.converters.DOMString(i, Q, "type"), c = e.converters.MessageEventInit(c, Q, "eventInitDict"), super(i, c), this.#e = c, e.util.markAsUncloneable(this); } get data() { return e.brandCheck(this, r), this.#e.data; @@ -11158,20 +11158,20 @@ function sA() { get ports() { return e.brandCheck(this, r), Object.isFrozen(this.#e.ports) || Object.freeze(this.#e.ports), this.#e.ports; } - initMessageEvent(i, c = !1, h = !1, E = null, C = "", f = "", y = null, b = []) { + initMessageEvent(i, c = !1, Q = !1, h = null, B = "", d = "", y = null, b = []) { return e.brandCheck(this, r), e.argumentLengthCheck(arguments, 1, "MessageEvent.initMessageEvent"), new r(i, { bubbles: c, - cancelable: h, - data: E, - origin: C, - lastEventId: f, + cancelable: Q, + data: h, + origin: B, + lastEventId: d, source: y, ports: b }); } static createFastMessageEvent(i, c) { - const h = new r(A, i, c); - return h.#e = c, h.#e.data ??= null, h.#e.origin ??= "", h.#e.lastEventId ??= "", h.#e.source ??= null, h.#e.ports ??= [], h; + const Q = new r(A, i, c); + return Q.#e = c, Q.#e.data ??= null, Q.#e.origin ??= "", Q.#e.lastEventId ??= "", Q.#e.source ??= null, Q.#e.ports ??= [], Q; } } const { createFastMessageEvent: n } = r; @@ -11179,8 +11179,8 @@ function sA() { class o extends Event { #e; constructor(i, c = {}) { - const h = "CloseEvent constructor"; - e.argumentLengthCheck(arguments, 1, h), i = e.converters.DOMString(i, h, "type"), c = e.converters.CloseEventInit(c), super(i, c), this.#e = c, e.util.markAsUncloneable(this); + const Q = "CloseEvent constructor"; + e.argumentLengthCheck(arguments, 1, Q), i = e.converters.DOMString(i, Q, "type"), c = e.converters.CloseEventInit(c), super(i, c), this.#e = c, e.util.markAsUncloneable(this); } get wasClean() { return e.brandCheck(this, o), this.#e.wasClean; @@ -11195,8 +11195,8 @@ function sA() { class a extends Event { #e; constructor(i, c) { - const h = "ErrorEvent constructor"; - e.argumentLengthCheck(arguments, 1, h), super(i, c), e.util.markAsUncloneable(this), i = e.converters.DOMString(i, h, "type"), c = e.converters.ErrorEventInit(c ?? {}), this.#e = c; + const Q = "ErrorEvent constructor"; + e.argumentLengthCheck(arguments, 1, Q), super(i, c), e.util.markAsUncloneable(this), i = e.converters.DOMString(i, Q, "type"), c = e.converters.ErrorEventInit(c ?? {}), this.#e = c; } get message() { return e.brandCheck(this, a), this.#e.message; @@ -11343,7 +11343,7 @@ function sA() { }, Ts; } var Ss, Ni; -function Yt() { +function Jt() { if (Ni) return Ss; Ni = 1; const e = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11", t = { @@ -11406,48 +11406,48 @@ var Ns, Li; function NA() { if (Li) return Ns; Li = 1; - const { kReadyState: e, kController: t, kResponse: A, kBinaryType: s, kWebSocketURL: r } = UA(), { states: n, opcodes: o } = Yt(), { ErrorEvent: a, createFastMessageEvent: u } = sA(), { isUtf8: g } = at, { collectASequenceOfCodePointsFast: i, removeHTTPWhitespace: c } = st(); - function h(N) { - return N[e] === n.CONNECTING; + const { kReadyState: e, kController: t, kResponse: A, kBinaryType: s, kWebSocketURL: r } = UA(), { states: n, opcodes: o } = Jt(), { ErrorEvent: a, createFastMessageEvent: u } = nA(), { isUtf8: l } = at, { collectASequenceOfCodePointsFast: i, removeHTTPWhitespace: c } = st(); + function Q(U) { + return U[e] === n.CONNECTING; } - function E(N) { - return N[e] === n.OPEN; + function h(U) { + return U[e] === n.OPEN; } - function C(N) { - return N[e] === n.CLOSING; + function B(U) { + return U[e] === n.CLOSING; } - function f(N) { - return N[e] === n.CLOSED; + function d(U) { + return U[e] === n.CLOSED; } - function y(N, U, G = ($, ne) => new Event($, ne), v = {}) { - const $ = G(N, v); - U.dispatchEvent($); + function y(U, S, G = ($, ne) => new Event($, ne), v = {}) { + const $ = G(U, v); + S.dispatchEvent($); } - function b(N, U, G) { - if (N[e] !== n.OPEN) + function b(U, S, G) { + if (U[e] !== n.OPEN) return; let v; - if (U === o.TEXT) + if (S === o.TEXT) try { v = D(G); } catch { - M(N, "Received invalid UTF-8 in text frame."); + N(U, "Received invalid UTF-8 in text frame."); return; } - else U === o.BINARY && (N[s] === "blob" ? v = new Blob([G]) : v = R(G)); - y("message", N, u, { - origin: N[r].origin, + else S === o.BINARY && (U[s] === "blob" ? v = new Blob([G]) : v = F(G)); + y("message", U, u, { + origin: U[r].origin, data: v }); } - function R(N) { - return N.byteLength === N.buffer.byteLength ? N.buffer : N.buffer.slice(N.byteOffset, N.byteOffset + N.byteLength); + function F(U) { + return U.byteLength === U.buffer.byteLength ? U.buffer : U.buffer.slice(U.byteOffset, U.byteOffset + U.byteLength); } - function S(N) { - if (N.length === 0) + function M(U) { + if (U.length === 0) return !1; - for (let U = 0; U < N.length; ++U) { - const G = N.charCodeAt(U); + for (let S = 0; S < U.length; ++S) { + const G = U.charCodeAt(S); if (G < 33 || // CTL, contains SP (0x20) and HT (0x09) G > 126 || G === 34 || // " G === 40 || // ( @@ -11470,85 +11470,85 @@ function NA() { } return !0; } - function L(N) { - return N >= 1e3 && N < 1015 ? N !== 1004 && // reserved - N !== 1005 && // "MUST NOT be set as a status code" - N !== 1006 : N >= 3e3 && N <= 4999; + function L(U) { + return U >= 1e3 && U < 1015 ? U !== 1004 && // reserved + U !== 1005 && // "MUST NOT be set as a status code" + U !== 1006 : U >= 3e3 && U <= 4999; } - function M(N, U) { - const { [t]: G, [A]: v } = N; - G.abort(), v?.socket && !v.socket.destroyed && v.socket.destroy(), U && y("error", N, ($, ne) => new a($, ne), { - error: new Error(U), - message: U + function N(U, S) { + const { [t]: G, [A]: v } = U; + G.abort(), v?.socket && !v.socket.destroyed && v.socket.destroy(), S && y("error", U, ($, ne) => new a($, ne), { + error: new Error(S), + message: S }); } - function d(N) { - return N === o.CLOSE || N === o.PING || N === o.PONG; + function f(U) { + return U === o.CLOSE || U === o.PING || U === o.PONG; } - function Q(N) { - return N === o.CONTINUATION; + function E(U) { + return U === o.CONTINUATION; } - function w(N) { - return N === o.TEXT || N === o.BINARY; + function p(U) { + return U === o.TEXT || U === o.BINARY; } - function l(N) { - return w(N) || Q(N) || d(N); + function g(U) { + return p(U) || E(U) || f(U); } - function B(N) { - const U = { position: 0 }, G = /* @__PURE__ */ new Map(); - for (; U.position < N.length; ) { - const v = i(";", N, U), [$, ne = ""] = v.split("="); + function C(U) { + const S = { position: 0 }, G = /* @__PURE__ */ new Map(); + for (; S.position < U.length; ) { + const v = i(";", U, S), [$, ne = ""] = v.split("="); G.set( c($, !0, !1), c(ne, !1, !0) - ), U.position++; + ), S.position++; } return G; } - function p(N) { - for (let U = 0; U < N.length; U++) { - const G = N.charCodeAt(U); + function w(U) { + for (let S = 0; S < U.length; S++) { + const G = U.charCodeAt(S); if (G < 48 || G > 57) return !1; } return !0; } - const I = typeof process.versions.icu == "string", m = I ? new TextDecoder("utf-8", { fatal: !0 }) : void 0, D = I ? m.decode.bind(m) : function(N) { - if (g(N)) - return N.toString("utf-8"); + const I = typeof process.versions.icu == "string", m = I ? new TextDecoder("utf-8", { fatal: !0 }) : void 0, D = I ? m.decode.bind(m) : function(U) { + if (l(U)) + return U.toString("utf-8"); throw new TypeError("Invalid utf-8 received."); }; return Ns = { - isConnecting: h, - isEstablished: E, - isClosing: C, - isClosed: f, + isConnecting: Q, + isEstablished: h, + isClosing: B, + isClosed: d, fireEvent: y, - isValidSubprotocol: S, + isValidSubprotocol: M, isValidStatusCode: L, - failWebsocketConnection: M, + failWebsocketConnection: N, websocketMessageReceived: b, utf8Decode: D, - isControlFrame: d, - isContinuationFrame: Q, - isTextBinaryFrame: w, - isValidOpcode: l, - parseExtensions: B, - isValidClientWindowBits: p + isControlFrame: f, + isContinuationFrame: E, + isTextBinaryFrame: p, + isValidOpcode: g, + parseExtensions: C, + isValidClientWindowBits: w }, Ns; } var Ms, Gi; function Ls() { if (Gi) return Ms; Gi = 1; - const { maxUnsigned16Bit: e } = Yt(), t = 16386; + const { maxUnsigned16Bit: e } = Jt(), t = 16386; let A, s = null, r = t; try { A = require("node:crypto"); } catch { A = { // not full compatibility, but minimum. - randomFillSync: function(u, g, i) { + randomFillSync: function(u, l, i) { for (let c = 0; c < u.length; ++c) u[c] = Math.random() * 255 | 0; return u; @@ -11566,15 +11566,15 @@ function Ls() { this.frameData = u; } createFrame(u) { - const g = this.frameData, i = n(), c = g?.byteLength ?? 0; - let h = c, E = 6; - c > e ? (E += 8, h = 127) : c > 125 && (E += 2, h = 126); - const C = Buffer.allocUnsafe(c + E); - C[0] = C[1] = 0, C[0] |= 128, C[0] = (C[0] & 240) + u; - C[E - 4] = i[0], C[E - 3] = i[1], C[E - 2] = i[2], C[E - 1] = i[3], C[1] = h, h === 126 ? C.writeUInt16BE(c, 2) : h === 127 && (C[2] = C[3] = 0, C.writeUIntBE(c, 4, 6)), C[1] |= 128; - for (let f = 0; f < c; ++f) - C[E + f] = g[f] ^ i[f & 3]; - return C; + const l = this.frameData, i = n(), c = l?.byteLength ?? 0; + let Q = c, h = 6; + c > e ? (h += 8, Q = 127) : c > 125 && (h += 2, Q = 126); + const B = Buffer.allocUnsafe(c + h); + B[0] = B[1] = 0, B[0] |= 128, B[0] = (B[0] & 240) + u; + B[h - 4] = i[0], B[h - 3] = i[1], B[h - 2] = i[2], B[h - 1] = i[3], B[1] = Q, Q === 126 ? B.writeUInt16BE(c, 2) : Q === 127 && (B[2] = B[3] = 0, B.writeUIntBE(c, 4, 6)), B[1] |= 128; + for (let d = 0; d < c; ++d) + B[h + d] = l[d] ^ i[d & 3]; + return B; } } return Ms = { @@ -11585,24 +11585,24 @@ var Gs, vi; function Yi() { if (vi) return Gs; vi = 1; - const { uid: e, states: t, sentCloseFrameState: A, emptyBuffer: s, opcodes: r } = Yt(), { + const { uid: e, states: t, sentCloseFrameState: A, emptyBuffer: s, opcodes: r } = Jt(), { kReadyState: n, kSentClose: o, kByteParser: a, kReceivedClose: u, - kResponse: g - } = UA(), { fireEvent: i, failWebsocketConnection: c, isClosing: h, isClosed: E, isEstablished: C, parseExtensions: f } = NA(), { channels: y } = Zt(), { CloseEvent: b } = sA(), { makeRequest: R } = rA(), { fetching: S } = SA(), { Headers: L, getHeadersList: M } = vt(), { getDecodeSplit: d } = it(), { WebsocketFrameSend: Q } = Ls(); - let w; + kResponse: l + } = UA(), { fireEvent: i, failWebsocketConnection: c, isClosing: Q, isClosed: h, isEstablished: B, parseExtensions: d } = NA(), { channels: y } = Kt(), { CloseEvent: b } = nA(), { makeRequest: F } = sA(), { fetching: M } = SA(), { Headers: L, getHeadersList: N } = Yt(), { getDecodeSplit: f } = it(), { WebsocketFrameSend: E } = Ls(); + let p; try { - w = require("node:crypto"); + p = require("node:crypto"); } catch { } - function l(D, N, U, G, v, $) { + function g(D, U, S, G, v, $) { const ne = D; ne.protocol = D.protocol === "ws:" ? "http:" : "https:"; - const ge = R({ + const ge = F({ urlList: [ne], - client: U, + client: S, serviceWorkers: "none", referrer: "no-referrer", mode: "websocket", @@ -11611,14 +11611,14 @@ function Yi() { redirect: "error" }); if ($.headers) { - const Qe = M(new L($.headers)); + const Qe = N(new L($.headers)); ge.headersList = Qe; } - const ae = w.randomBytes(16).toString("base64"); + const ae = p.randomBytes(16).toString("base64"); ge.headersList.append("sec-websocket-key", ae), ge.headersList.append("sec-websocket-version", "13"); - for (const Qe of N) + for (const Qe of U) ge.headersList.append("sec-websocket-protocol", Qe); - return ge.headersList.append("sec-websocket-extensions", "permessage-deflate; client_max_window_bits"), S({ + return ge.headersList.append("sec-websocket-extensions", "permessage-deflate; client_max_window_bits"), M({ request: ge, useParallelQueue: !0, dispatcher: $.dispatcher, @@ -11627,7 +11627,7 @@ function Yi() { c(G, "Received network error or non-101 status code."); return; } - if (N.length !== 0 && !Qe.headersList.get("Sec-WebSocket-Protocol")) { + if (U.length !== 0 && !Qe.headersList.get("Sec-WebSocket-Protocol")) { c(G, "Server did not respond with sent protocols."); return; } @@ -11639,23 +11639,23 @@ function Yi() { c(G, 'Server did not set Connection header to "upgrade".'); return; } - const ye = Qe.headersList.get("Sec-WebSocket-Accept"), we = w.createHash("sha1").update(ae + e).digest("base64"); + const ye = Qe.headersList.get("Sec-WebSocket-Accept"), we = p.createHash("sha1").update(ae + e).digest("base64"); if (ye !== we) { c(G, "Incorrect hash received in Sec-WebSocket-Accept header."); return; } const X = Qe.headersList.get("Sec-WebSocket-Extensions"); let W; - if (X !== null && (W = f(X), !W.has("permessage-deflate"))) { + if (X !== null && (W = d(X), !W.has("permessage-deflate"))) { c(G, "Sec-WebSocket-Extensions header does not match."); return; } const re = Qe.headersList.get("Sec-WebSocket-Protocol"); - if (re !== null && !d("sec-websocket-protocol", ge.headersList).includes(re)) { + if (re !== null && !f("sec-websocket-protocol", ge.headersList).includes(re)) { c(G, "Protocol was not set in the opening handshake."); return; } - Qe.socket.on("data", p), Qe.socket.on("close", I), Qe.socket.on("error", m), y.open.hasSubscribers && y.open.publish({ + Qe.socket.on("data", w), Qe.socket.on("close", I), Qe.socket.on("error", m), y.open.hasSubscribers && y.open.publish({ address: Qe.socket.address(), protocol: re, extensions: X @@ -11663,27 +11663,27 @@ function Yi() { } }); } - function B(D, N, U, G) { - if (!(h(D) || E(D))) if (!C(D)) + function C(D, U, S, G) { + if (!(Q(D) || h(D))) if (!B(D)) c(D, "Connection was closed before it was established."), D[n] = t.CLOSING; else if (D[o] === A.NOT_SENT) { D[o] = A.PROCESSING; - const v = new Q(); - N !== void 0 && U === void 0 ? (v.frameData = Buffer.allocUnsafe(2), v.frameData.writeUInt16BE(N, 0)) : N !== void 0 && U !== void 0 ? (v.frameData = Buffer.allocUnsafe(2 + G), v.frameData.writeUInt16BE(N, 0), v.frameData.write(U, 2, "utf-8")) : v.frameData = s, D[g].socket.write(v.createFrame(r.CLOSE)), D[o] = A.SENT, D[n] = t.CLOSING; + const v = new E(); + U !== void 0 && S === void 0 ? (v.frameData = Buffer.allocUnsafe(2), v.frameData.writeUInt16BE(U, 0)) : U !== void 0 && S !== void 0 ? (v.frameData = Buffer.allocUnsafe(2 + G), v.frameData.writeUInt16BE(U, 0), v.frameData.write(S, 2, "utf-8")) : v.frameData = s, D[l].socket.write(v.createFrame(r.CLOSE)), D[o] = A.SENT, D[n] = t.CLOSING; } else D[n] = t.CLOSING; } - function p(D) { + function w(D) { this.ws[a].write(D) || this.pause(); } function I() { - const { ws: D } = this, { [g]: N } = D; - N.socket.off("data", p), N.socket.off("close", I), N.socket.off("error", m); - const U = D[o] === A.SENT && D[u]; + const { ws: D } = this, { [l]: U } = D; + U.socket.off("data", w), U.socket.off("close", I), U.socket.off("error", m); + const S = D[o] === A.SENT && D[u]; let G = 1005, v = ""; const $ = D[a].closingInfo; $ && !$.error ? (G = $.code ?? 1005, v = $.reason) : D[u] || (G = 1006), D[n] = t.CLOSED, i("close", D, (ne, ge) => new b(ne, ge), { - wasClean: U, + wasClean: S, code: G, reason: v }), y.close.hasSubscribers && y.close.publish({ @@ -11693,12 +11693,12 @@ function Yi() { }); } function m(D) { - const { ws: N } = this; - N[n] = t.CLOSING, y.socketError.hasSubscribers && y.socketError.publish(D), this.destroy(); + const { ws: U } = this; + U[n] = t.CLOSING, y.socketError.hasSubscribers && y.socketError.publish(D), this.destroy(); } return Gs = { - establishWebSocketConnection: l, - closeWebSocketConnection: B + establishWebSocketConnection: g, + closeWebSocketConnection: C }, Gs; } var vs, Ji; @@ -11713,7 +11713,7 @@ function qg() { constructor(u) { this.#t.serverNoContextTakeover = u.has("server_no_context_takeover"), this.#t.serverMaxWindowBits = u.get("server_max_window_bits"); } - decompress(u, g, i) { + decompress(u, l, i) { if (!this.#e) { let c = t; if (this.#t.serverMaxWindowBits) { @@ -11723,13 +11723,13 @@ function qg() { } c = Number.parseInt(this.#t.serverMaxWindowBits); } - this.#e = e({ windowBits: c }), this.#e[r] = [], this.#e[n] = 0, this.#e.on("data", (h) => { - this.#e[r].push(h), this.#e[n] += h.length; - }), this.#e.on("error", (h) => { - this.#e = null, i(h); + this.#e = e({ windowBits: c }), this.#e[r] = [], this.#e[n] = 0, this.#e.on("data", (Q) => { + this.#e[r].push(Q), this.#e[n] += Q.length; + }), this.#e.on("error", (Q) => { + this.#e = null, i(Q); }); } - this.#e.write(u), g && this.#e.write(s), this.#e.flush(() => { + this.#e.write(u), l && this.#e.write(s), this.#e.flush(() => { const c = Buffer.concat(this.#e[r], this.#e[n]); this.#e[r].length = 0, this.#e[n] = 0, i(null, c); }); @@ -11741,17 +11741,17 @@ var Ys, Hi; function zg() { if (Hi) return Ys; Hi = 1; - const { Writable: e } = ot, t = He, { parserStates: A, opcodes: s, states: r, emptyBuffer: n, sentCloseFrameState: o } = Yt(), { kReadyState: a, kSentClose: u, kResponse: g, kReceivedClose: i } = UA(), { channels: c } = Zt(), { - isValidStatusCode: h, - isValidOpcode: E, - failWebsocketConnection: C, - websocketMessageReceived: f, + const { Writable: e } = ot, t = He, { parserStates: A, opcodes: s, states: r, emptyBuffer: n, sentCloseFrameState: o } = Jt(), { kReadyState: a, kSentClose: u, kResponse: l, kReceivedClose: i } = UA(), { channels: c } = Kt(), { + isValidStatusCode: Q, + isValidOpcode: h, + failWebsocketConnection: B, + websocketMessageReceived: d, utf8Decode: y, isControlFrame: b, - isTextBinaryFrame: R, - isContinuationFrame: S - } = NA(), { WebsocketFrameSend: L } = Ls(), { closeWebSocketConnection: M } = Yi(), { PerMessageDeflate: d } = qg(); - class Q extends e { + isTextBinaryFrame: F, + isContinuationFrame: M + } = NA(), { WebsocketFrameSend: L } = Ls(), { closeWebSocketConnection: N } = Yi(), { PerMessageDeflate: f } = qg(); + class E extends e { #e = []; #t = 0; #s = !1; @@ -11760,98 +11760,98 @@ function zg() { #n = []; /** @type {Map} */ #o; - constructor(l, B) { - super(), this.ws = l, this.#o = B ?? /* @__PURE__ */ new Map(), this.#o.has("permessage-deflate") && this.#o.set("permessage-deflate", new d(B)); + constructor(g, C) { + super(), this.ws = g, this.#o = C ?? /* @__PURE__ */ new Map(), this.#o.has("permessage-deflate") && this.#o.set("permessage-deflate", new f(C)); } /** * @param {Buffer} chunk * @param {() => void} callback */ - _write(l, B, p) { - this.#e.push(l), this.#t += l.length, this.#s = !0, this.run(p); + _write(g, C, w) { + this.#e.push(g), this.#t += g.length, this.#s = !0, this.run(w); } /** * Runs whenever a new chunk is received. * Callback is called whenever there are no more chunks buffering, * or not enough bytes are buffered to parse. */ - run(l) { + run(g) { for (; this.#s; ) if (this.#r === A.INFO) { if (this.#t < 2) - return l(); - const B = this.consume(2), p = (B[0] & 128) !== 0, I = B[0] & 15, m = (B[1] & 128) === 128, D = !p && I !== s.CONTINUATION, N = B[1] & 127, U = B[0] & 64, G = B[0] & 32, v = B[0] & 16; - if (!E(I)) - return C(this.ws, "Invalid opcode received"), l(); + return g(); + const C = this.consume(2), w = (C[0] & 128) !== 0, I = C[0] & 15, m = (C[1] & 128) === 128, D = !w && I !== s.CONTINUATION, U = C[1] & 127, S = C[0] & 64, G = C[0] & 32, v = C[0] & 16; + if (!h(I)) + return B(this.ws, "Invalid opcode received"), g(); if (m) - return C(this.ws, "Frame cannot be masked"), l(); - if (U !== 0 && !this.#o.has("permessage-deflate")) { - C(this.ws, "Expected RSV1 to be clear."); + return B(this.ws, "Frame cannot be masked"), g(); + if (S !== 0 && !this.#o.has("permessage-deflate")) { + B(this.ws, "Expected RSV1 to be clear."); return; } if (G !== 0 || v !== 0) { - C(this.ws, "RSV1, RSV2, RSV3 must be clear"); + B(this.ws, "RSV1, RSV2, RSV3 must be clear"); return; } - if (D && !R(I)) { - C(this.ws, "Invalid frame type was fragmented."); + if (D && !F(I)) { + B(this.ws, "Invalid frame type was fragmented."); return; } - if (R(I) && this.#n.length > 0) { - C(this.ws, "Expected continuation frame"); + if (F(I) && this.#n.length > 0) { + B(this.ws, "Expected continuation frame"); return; } if (this.#A.fragmented && D) { - C(this.ws, "Fragmented frame exceeded 125 bytes."); + B(this.ws, "Fragmented frame exceeded 125 bytes."); return; } - if ((N > 125 || D) && b(I)) { - C(this.ws, "Control frame either too large or fragmented"); + if ((U > 125 || D) && b(I)) { + B(this.ws, "Control frame either too large or fragmented"); return; } - if (S(I) && this.#n.length === 0 && !this.#A.compressed) { - C(this.ws, "Unexpected continuation frame"); + if (M(I) && this.#n.length === 0 && !this.#A.compressed) { + B(this.ws, "Unexpected continuation frame"); return; } - N <= 125 ? (this.#A.payloadLength = N, this.#r = A.READ_DATA) : N === 126 ? this.#r = A.PAYLOADLENGTH_16 : N === 127 && (this.#r = A.PAYLOADLENGTH_64), R(I) && (this.#A.binaryType = I, this.#A.compressed = U !== 0), this.#A.opcode = I, this.#A.masked = m, this.#A.fin = p, this.#A.fragmented = D; + U <= 125 ? (this.#A.payloadLength = U, this.#r = A.READ_DATA) : U === 126 ? this.#r = A.PAYLOADLENGTH_16 : U === 127 && (this.#r = A.PAYLOADLENGTH_64), F(I) && (this.#A.binaryType = I, this.#A.compressed = S !== 0), this.#A.opcode = I, this.#A.masked = m, this.#A.fin = w, this.#A.fragmented = D; } else if (this.#r === A.PAYLOADLENGTH_16) { if (this.#t < 2) - return l(); - const B = this.consume(2); - this.#A.payloadLength = B.readUInt16BE(0), this.#r = A.READ_DATA; + return g(); + const C = this.consume(2); + this.#A.payloadLength = C.readUInt16BE(0), this.#r = A.READ_DATA; } else if (this.#r === A.PAYLOADLENGTH_64) { if (this.#t < 8) - return l(); - const B = this.consume(8), p = B.readUInt32BE(0); - if (p > 2 ** 31 - 1) { - C(this.ws, "Received payload length > 2^31 bytes."); + return g(); + const C = this.consume(8), w = C.readUInt32BE(0); + if (w > 2 ** 31 - 1) { + B(this.ws, "Received payload length > 2^31 bytes."); return; } - const I = B.readUInt32BE(4); - this.#A.payloadLength = (p << 8) + I, this.#r = A.READ_DATA; + const I = C.readUInt32BE(4); + this.#A.payloadLength = (w << 8) + I, this.#r = A.READ_DATA; } else if (this.#r === A.READ_DATA) { if (this.#t < this.#A.payloadLength) - return l(); - const B = this.consume(this.#A.payloadLength); + return g(); + const C = this.consume(this.#A.payloadLength); if (b(this.#A.opcode)) - this.#s = this.parseControlFrame(B), this.#r = A.INFO; + this.#s = this.parseControlFrame(C), this.#r = A.INFO; else if (this.#A.compressed) { - this.#o.get("permessage-deflate").decompress(B, this.#A.fin, (p, I) => { - if (p) { - M(this.ws, 1007, p.message, p.message.length); + this.#o.get("permessage-deflate").decompress(C, this.#A.fin, (w, I) => { + if (w) { + N(this.ws, 1007, w.message, w.message.length); return; } if (this.#n.push(I), !this.#A.fin) { - this.#r = A.INFO, this.#s = !0, this.run(l); + this.#r = A.INFO, this.#s = !0, this.run(g); return; } - f(this.ws, this.#A.binaryType, Buffer.concat(this.#n)), this.#s = !0, this.#r = A.INFO, this.#n.length = 0, this.run(l); + d(this.ws, this.#A.binaryType, Buffer.concat(this.#n)), this.#s = !0, this.#r = A.INFO, this.#n.length = 0, this.run(g); }), this.#s = !1; break; } else { - if (this.#n.push(B), !this.#A.fragmented && this.#A.fin) { - const p = Buffer.concat(this.#n); - f(this.ws, this.#A.binaryType, p), this.#n.length = 0; + if (this.#n.push(C), !this.#A.fragmented && this.#A.fin) { + const w = Buffer.concat(this.#n); + d(this.ws, this.#A.binaryType, w), this.#n.length = 0; } this.#r = A.INFO; } @@ -11862,60 +11862,60 @@ function zg() { * @param {number} n * @returns {Buffer} */ - consume(l) { - if (l > this.#t) + consume(g) { + if (g > this.#t) throw new Error("Called consume() before buffers satiated."); - if (l === 0) + if (g === 0) return n; - if (this.#e[0].length === l) + if (this.#e[0].length === g) return this.#t -= this.#e[0].length, this.#e.shift(); - const B = Buffer.allocUnsafe(l); - let p = 0; - for (; p !== l; ) { + const C = Buffer.allocUnsafe(g); + let w = 0; + for (; w !== g; ) { const I = this.#e[0], { length: m } = I; - if (m + p === l) { - B.set(this.#e.shift(), p); + if (m + w === g) { + C.set(this.#e.shift(), w); break; - } else if (m + p > l) { - B.set(I.subarray(0, l - p), p), this.#e[0] = I.subarray(l - p); + } else if (m + w > g) { + C.set(I.subarray(0, g - w), w), this.#e[0] = I.subarray(g - w); break; } else - B.set(this.#e.shift(), p), p += I.length; + C.set(this.#e.shift(), w), w += I.length; } - return this.#t -= l, B; + return this.#t -= g, C; } - parseCloseBody(l) { - t(l.length !== 1); - let B; - if (l.length >= 2 && (B = l.readUInt16BE(0)), B !== void 0 && !h(B)) + parseCloseBody(g) { + t(g.length !== 1); + let C; + if (g.length >= 2 && (C = g.readUInt16BE(0)), C !== void 0 && !Q(C)) return { code: 1002, reason: "Invalid status code", error: !0 }; - let p = l.subarray(2); - p[0] === 239 && p[1] === 187 && p[2] === 191 && (p = p.subarray(3)); + let w = g.subarray(2); + w[0] === 239 && w[1] === 187 && w[2] === 191 && (w = w.subarray(3)); try { - p = y(p); + w = y(w); } catch { return { code: 1007, reason: "Invalid UTF-8", error: !0 }; } - return { code: B, reason: p, error: !1 }; + return { code: C, reason: w, error: !1 }; } /** * Parses control frames. * @param {Buffer} body */ - parseControlFrame(l) { - const { opcode: B, payloadLength: p } = this.#A; - if (B === s.CLOSE) { - if (p === 1) - return C(this.ws, "Received close frame with a 1-byte body."), !1; - if (this.#A.closeInfo = this.parseCloseBody(l), this.#A.closeInfo.error) { + parseControlFrame(g) { + const { opcode: C, payloadLength: w } = this.#A; + if (C === s.CLOSE) { + if (w === 1) + return B(this.ws, "Received close frame with a 1-byte body."), !1; + if (this.#A.closeInfo = this.parseCloseBody(g), this.#A.closeInfo.error) { const { code: I, reason: m } = this.#A.closeInfo; - return M(this.ws, I, m, m.length), C(this.ws, m), !1; + return N(this.ws, I, m, m.length), B(this.ws, m), !1; } if (this.ws[u] !== o.SENT) { let I = n; this.#A.closeInfo.code && (I = Buffer.allocUnsafe(2), I.writeUInt16BE(this.#A.closeInfo.code, 0)); const m = new L(I); - this.ws[g].socket.write( + this.ws[l].socket.write( m.createFrame(s.CLOSE), (D) => { D || (this.ws[u] = o.SENT); @@ -11923,15 +11923,15 @@ function zg() { ); } return this.ws[a] = r.CLOSING, this.ws[i] = !0, !1; - } else if (B === s.PING) { + } else if (C === s.PING) { if (!this.ws[i]) { - const I = new L(l); - this.ws[g].socket.write(I.createFrame(s.PONG)), c.ping.hasSubscribers && c.ping.publish({ - payload: l + const I = new L(g); + this.ws[l].socket.write(I.createFrame(s.PONG)), c.ping.hasSubscribers && c.ping.publish({ + payload: g }); } - } else B === s.PONG && c.pong.hasSubscribers && c.pong.publish({ - payload: l + } else C === s.PONG && c.pong.hasSubscribers && c.pong.publish({ + payload: g }); return !0; } @@ -11940,14 +11940,14 @@ function zg() { } } return Ys = { - ByteParser: Q + ByteParser: E }, Ys; } var Js, Oi; function Zg() { if (Oi) return Js; Oi = 1; - const { WebsocketFrameSend: e } = Ls(), { opcodes: t, sendHints: A } = Yt(), s = yo(), r = Buffer[Symbol.species]; + const { WebsocketFrameSend: e } = Ls(), { opcodes: t, sendHints: A } = Jt(), s = yo(), r = Buffer[Symbol.species]; class n { /** * @type {FixedQueue} @@ -11959,48 +11959,48 @@ function Zg() { #t = !1; /** @type {import('node:net').Socket} */ #s; - constructor(g) { - this.#s = g; + constructor(l) { + this.#s = l; } - add(g, i, c) { + add(l, i, c) { if (c !== A.blob) { - const E = o(g, c); + const h = o(l, c); if (!this.#t) - this.#s.write(E, i); + this.#s.write(h, i); else { - const C = { + const B = { promise: null, callback: i, - frame: E + frame: h }; - this.#e.push(C); + this.#e.push(B); } return; } - const h = { - promise: g.arrayBuffer().then((E) => { - h.promise = null, h.frame = o(E, c); + const Q = { + promise: l.arrayBuffer().then((h) => { + Q.promise = null, Q.frame = o(h, c); }), callback: i, frame: null }; - this.#e.push(h), this.#t || this.#r(); + this.#e.push(Q), this.#t || this.#r(); } async #r() { this.#t = !0; - const g = this.#e; - for (; !g.isEmpty(); ) { - const i = g.shift(); + const l = this.#e; + for (; !l.isEmpty(); ) { + const i = l.shift(); i.promise !== null && await i.promise, this.#s.write(i.frame, i.callback), i.callback = i.frame = null; } this.#t = !1; } } - function o(u, g) { - return new e(a(u, g)).createFrame(g === A.string ? t.TEXT : t.BINARY); + function o(u, l) { + return new e(a(u, l)).createFrame(l === A.string ? t.TEXT : t.BINARY); } - function a(u, g) { - switch (g) { + function a(u, l) { + switch (l) { case A.string: return Buffer.from(u); case A.arrayBuffer: @@ -12016,21 +12016,21 @@ var Hs, Pi; function Kg() { if (Pi) return Hs; Pi = 1; - const { webidl: e } = $e(), { URLSerializer: t } = st(), { environmentSettingsObject: A } = it(), { staticPropertyDescriptors: s, states: r, sentCloseFrameState: n, sendHints: o } = Yt(), { + const { webidl: e } = $e(), { URLSerializer: t } = st(), { environmentSettingsObject: A } = it(), { staticPropertyDescriptors: s, states: r, sentCloseFrameState: n, sendHints: o } = Jt(), { kWebSocketURL: a, kReadyState: u, - kController: g, + kController: l, kBinaryType: i, kResponse: c, - kSentClose: h, - kByteParser: E + kSentClose: Q, + kByteParser: h } = UA(), { - isConnecting: C, - isEstablished: f, + isConnecting: B, + isEstablished: d, isClosing: y, isValidSubprotocol: b, - fireEvent: R - } = NA(), { establishWebSocketConnection: S, closeWebSocketConnection: L } = Yi(), { ByteParser: M } = zg(), { kEnumerableProperty: d, isBlobLike: Q } = Ue(), { getGlobalDispatcher: w } = ss(), { types: l } = rt, { ErrorEvent: B, CloseEvent: p } = sA(), { SendQueue: I } = Zg(); + fireEvent: F + } = NA(), { establishWebSocketConnection: M, closeWebSocketConnection: L } = Yi(), { ByteParser: N } = zg(), { kEnumerableProperty: f, isBlobLike: E } = Ue(), { getGlobalDispatcher: p } = ss(), { types: g } = rt, { ErrorEvent: C, CloseEvent: w } = nA(), { SendQueue: I } = Zg(); class m extends EventTarget { #e = { open: null, @@ -12073,14 +12073,14 @@ function Kg() { throw new DOMException("Invalid Sec-WebSocket-Protocol value", "SyntaxError"); this[a] = new URL(ae.href); const Be = A.settingsObject; - this[g] = S( + this[l] = M( ae, v, Be, this, (he, Qe) => this.#n(he, Qe), ne - ), this[u] = m.CONNECTING, this[h] = n.NOT_SENT, this[i] = "blob"; + ), this[u] = m.CONNECTING, this[Q] = n.NOT_SENT, this[i] = "blob"; } /** * @see https://websockets.spec.whatwg.org/#dom-websocket-close @@ -12107,19 +12107,19 @@ function Kg() { send(G) { e.brandCheck(this, m); const v = "WebSocket.send"; - if (e.argumentLengthCheck(arguments, 1, v), G = e.converters.WebSocketSendData(G, v, "data"), C(this)) + if (e.argumentLengthCheck(arguments, 1, v), G = e.converters.WebSocketSendData(G, v, "data"), B(this)) throw new DOMException("Sent before connected.", "InvalidStateError"); - if (!(!f(this) || y(this))) + if (!(!d(this) || y(this))) if (typeof G == "string") { const $ = Buffer.byteLength(G); this.#t += $, this.#A.add(G, () => { this.#t -= $; }, o.string); - } else l.isArrayBuffer(G) ? (this.#t += G.byteLength, this.#A.add(G, () => { + } else g.isArrayBuffer(G) ? (this.#t += G.byteLength, this.#A.add(G, () => { this.#t -= G.byteLength; }, o.arrayBuffer)) : ArrayBuffer.isView(G) ? (this.#t += G.byteLength, this.#A.add(G, () => { this.#t -= G.byteLength; - }, o.typedArray)) : Q(G) && (this.#t += G.size, this.#A.add(G, () => { + }, o.typedArray)) : E(G) && (this.#t += G.size, this.#A.add(G, () => { this.#t -= G.size; }, o.blob)); } @@ -12173,12 +12173,12 @@ function Kg() { */ #n(G, v) { this[c] = G; - const $ = new M(this, v); - $.on("drain", D), $.on("error", N.bind(this)), G.socket.ws = this, this[E] = $, this.#A = new I(G.socket), this[u] = r.OPEN; + const $ = new N(this, v); + $.on("drain", D), $.on("error", U.bind(this)), G.socket.ws = this, this[h] = $, this.#A = new I(G.socket), this[u] = r.OPEN; const ne = G.headersList.get("sec-websocket-extensions"); ne !== null && (this.#r = ne); const ge = G.headersList.get("sec-websocket-protocol"); - ge !== null && (this.#s = ge), R("open", this); + ge !== null && (this.#s = ge), F("open", this); } } m.CONNECTING = m.prototype.CONNECTING = r.CONNECTING, m.OPEN = m.prototype.OPEN = r.OPEN, m.CLOSING = m.prototype.CLOSING = r.CLOSING, m.CLOSED = m.prototype.CLOSED = r.CLOSED, Object.defineProperties(m.prototype, { @@ -12186,18 +12186,18 @@ function Kg() { OPEN: s, CLOSING: s, CLOSED: s, - url: d, - readyState: d, - bufferedAmount: d, - onopen: d, - onerror: d, - onclose: d, - close: d, - onmessage: d, - binaryType: d, - send: d, - extensions: d, - protocol: d, + url: f, + readyState: f, + bufferedAmount: f, + onopen: f, + onerror: f, + onclose: f, + close: f, + onmessage: f, + binaryType: f, + send: f, + extensions: f, + protocol: f, [Symbol.toStringTag]: { value: "WebSocket", writable: !1, @@ -12211,8 +12211,8 @@ function Kg() { CLOSED: s }), e.converters["sequence"] = e.sequenceConverter( e.converters.DOMString - ), e.converters["DOMString or sequence"] = function(U, G, v) { - return e.util.Type(U) === "Object" && Symbol.iterator in U ? e.converters["sequence"](U) : e.converters.DOMString(U, G, v); + ), e.converters["DOMString or sequence"] = function(S, G, v) { + return e.util.Type(S) === "Object" && Symbol.iterator in S ? e.converters["sequence"](S) : e.converters.DOMString(S, G, v); }, e.converters.WebSocketInit = e.dictionaryConverter([ { key: "protocols", @@ -12222,29 +12222,29 @@ function Kg() { { key: "dispatcher", converter: e.converters.any, - defaultValue: () => w() + defaultValue: () => p() }, { key: "headers", converter: e.nullableConverter(e.converters.HeadersInit) } - ]), e.converters["DOMString or sequence or WebSocketInit"] = function(U) { - return e.util.Type(U) === "Object" && !(Symbol.iterator in U) ? e.converters.WebSocketInit(U) : { protocols: e.converters["DOMString or sequence"](U) }; - }, e.converters.WebSocketSendData = function(U) { - if (e.util.Type(U) === "Object") { - if (Q(U)) - return e.converters.Blob(U, { strict: !1 }); - if (ArrayBuffer.isView(U) || l.isArrayBuffer(U)) - return e.converters.BufferSource(U); + ]), e.converters["DOMString or sequence or WebSocketInit"] = function(S) { + return e.util.Type(S) === "Object" && !(Symbol.iterator in S) ? e.converters.WebSocketInit(S) : { protocols: e.converters["DOMString or sequence"](S) }; + }, e.converters.WebSocketSendData = function(S) { + if (e.util.Type(S) === "Object") { + if (E(S)) + return e.converters.Blob(S, { strict: !1 }); + if (ArrayBuffer.isView(S) || g.isArrayBuffer(S)) + return e.converters.BufferSource(S); } - return e.converters.USVString(U); + return e.converters.USVString(S); }; function D() { this.ws[c].socket.resume(); } - function N(U) { + function U(S) { let G, v; - U instanceof p ? (G = U.reason, v = U.code) : G = U.message, R("error", this, () => new B("error", { error: U, message: G })), L(this, v); + S instanceof w ? (G = S.reason, v = S.code) : G = S.message, F("error", this, () => new C("error", { error: S, message: G })), L(this, v); } return Hs = { WebSocket: m @@ -12322,30 +12322,30 @@ function jg() { * @param {Function} callback * @returns {void} */ - _transform(i, c, h) { + _transform(i, c, Q) { if (i.length === 0) { - h(); + Q(); return; } if (this.buffer ? this.buffer = Buffer.concat([this.buffer, i]) : this.buffer = i, this.checkBOM) switch (this.buffer.length) { case 1: if (this.buffer[0] === s[0]) { - h(); + Q(); return; } - this.checkBOM = !1, h(); + this.checkBOM = !1, Q(); return; case 2: if (this.buffer[0] === s[0] && this.buffer[1] === s[1]) { - h(); + Q(); return; } this.checkBOM = !1; break; case 3: if (this.buffer[0] === s[0] && this.buffer[1] === s[1] && this.buffer[2] === s[2]) { - this.buffer = Buffer.alloc(0), this.checkBOM = !1, h(); + this.buffer = Buffer.alloc(0), this.checkBOM = !1, Q(); return; } this.checkBOM = !1; @@ -12376,7 +12376,7 @@ function jg() { } this.pos++; } - h(); + Q(); } /** * @param {Buffer} line @@ -12385,29 +12385,29 @@ function jg() { parseLine(i, c) { if (i.length === 0) return; - const h = i.indexOf(o); - if (h === 0) + const Q = i.indexOf(o); + if (Q === 0) return; - let E = "", C = ""; - if (h !== -1) { - E = i.subarray(0, h).toString("utf8"); - let f = h + 1; - i[f] === a && ++f, C = i.subarray(f).toString("utf8"); + let h = "", B = ""; + if (Q !== -1) { + h = i.subarray(0, Q).toString("utf8"); + let d = Q + 1; + i[d] === a && ++d, B = i.subarray(d).toString("utf8"); } else - E = i.toString("utf8"), C = ""; - switch (E) { + h = i.toString("utf8"), B = ""; + switch (h) { case "data": - c[E] === void 0 ? c[E] = C : c[E] += ` -${C}`; + c[h] === void 0 ? c[h] = B : c[h] += ` +${B}`; break; case "retry": - t(C) && (c[E] = C); + t(B) && (c[h] = B); break; case "id": - A(C) && (c[E] = C); + A(B) && (c[h] = B); break; case "event": - C.length > 0 && (c[E] = C); + B.length > 0 && (c[h] = B); break; } } @@ -12441,10 +12441,10 @@ var _s, Wi; function Xg() { if (Wi) return _s; Wi = 1; - const { pipeline: e } = ot, { fetching: t } = SA(), { makeRequest: A } = rA(), { webidl: s } = $e(), { EventSourceStream: r } = jg(), { parseMIMEType: n } = st(), { createFastMessageEvent: o } = sA(), { isNetworkError: a } = TA(), { delay: u } = xi(), { kEnumerableProperty: g } = Ue(), { environmentSettingsObject: i } = it(); + const { pipeline: e } = ot, { fetching: t } = SA(), { makeRequest: A } = sA(), { webidl: s } = $e(), { EventSourceStream: r } = jg(), { parseMIMEType: n } = st(), { createFastMessageEvent: o } = nA(), { isNetworkError: a } = TA(), { delay: u } = xi(), { kEnumerableProperty: l } = Ue(), { environmentSettingsObject: i } = it(); let c = !1; - const h = 3e3, E = 0, C = 1, f = 2, y = "anonymous", b = "use-credentials"; - class R extends EventTarget { + const Q = 3e3, h = 0, B = 1, d = 2, y = "anonymous", b = "use-credentials"; + class F extends EventTarget { #e = { open: null, error: null, @@ -12452,7 +12452,7 @@ function Xg() { }; #t = null; #s = !1; - #r = E; + #r = h; #A = null; #n = null; #o; @@ -12466,34 +12466,34 @@ function Xg() { * @param {EventSourceInit} [eventSourceInitDict] * @see https://html.spec.whatwg.org/multipage/server-sent-events.html#the-eventsource-interface */ - constructor(M, d = {}) { + constructor(N, f = {}) { super(), s.util.markAsUncloneable(this); - const Q = "EventSource constructor"; - s.argumentLengthCheck(arguments, 1, Q), c || (c = !0, process.emitWarning("EventSource is experimental, expect them to change at any time.", { + const E = "EventSource constructor"; + s.argumentLengthCheck(arguments, 1, E), c || (c = !0, process.emitWarning("EventSource is experimental, expect them to change at any time.", { code: "UNDICI-ES" - })), M = s.converters.USVString(M, Q, "url"), d = s.converters.EventSourceInitDict(d, Q, "eventSourceInitDict"), this.#o = d.dispatcher, this.#i = { + })), N = s.converters.USVString(N, E, "url"), f = s.converters.EventSourceInitDict(f, E, "eventSourceInitDict"), this.#o = f.dispatcher, this.#i = { lastEventId: "", - reconnectionTime: h + reconnectionTime: Q }; - const w = i; - let l; + const p = i; + let g; try { - l = new URL(M, w.settingsObject.baseUrl), this.#i.origin = l.origin; + g = new URL(N, p.settingsObject.baseUrl), this.#i.origin = g.origin; } catch (I) { throw new DOMException(I, "SyntaxError"); } - this.#t = l.href; - let B = y; - d.withCredentials && (B = b, this.#s = !0); - const p = { + this.#t = g.href; + let C = y; + f.withCredentials && (C = b, this.#s = !0); + const w = { redirect: "follow", keepalive: !0, // @see https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attributes mode: "cors", - credentials: B === "anonymous" ? "same-origin" : "omit", + credentials: C === "anonymous" ? "same-origin" : "omit", referrer: "no-referrer" }; - p.client = i.settingsObject, p.headersList = [["accept", { name: "accept", value: "text/event-stream" }]], p.cache = "no-store", p.initiator = "other", p.urlList = [new URL(this.#t)], this.#A = A(p), this.#a(); + w.client = i.settingsObject, w.headersList = [["accept", { name: "accept", value: "text/event-stream" }]], w.cache = "no-store", w.initiator = "other", w.urlList = [new URL(this.#t)], this.#A = A(w), this.#a(); } /** * Returns the state of this EventSource object's connection. It can have the @@ -12520,30 +12520,30 @@ function Xg() { return this.#s; } #a() { - if (this.#r === f) return; - this.#r = E; - const M = { + if (this.#r === d) return; + this.#r = h; + const N = { request: this.#A, dispatcher: this.#o - }, d = (Q) => { - a(Q) && (this.dispatchEvent(new Event("error")), this.close()), this.#c(); + }, f = (E) => { + a(E) && (this.dispatchEvent(new Event("error")), this.close()), this.#c(); }; - M.processResponseEndOfBody = d, M.processResponse = (Q) => { - if (a(Q)) - if (Q.aborted) { + N.processResponseEndOfBody = f, N.processResponse = (E) => { + if (a(E)) + if (E.aborted) { this.close(), this.dispatchEvent(new Event("error")); return; } else { this.#c(); return; } - const w = Q.headersList.get("content-type", !0), l = w !== null ? n(w) : "failure", B = l !== "failure" && l.essence === "text/event-stream"; - if (Q.status !== 200 || B === !1) { + const p = E.headersList.get("content-type", !0), g = p !== null ? n(p) : "failure", C = g !== "failure" && g.essence === "text/event-stream"; + if (E.status !== 200 || C === !1) { this.close(), this.dispatchEvent(new Event("error")); return; } - this.#r = C, this.dispatchEvent(new Event("open")), this.#i.origin = Q.urlList[Q.urlList.length - 1].origin; - const p = new r({ + this.#r = B, this.dispatchEvent(new Event("open")), this.#i.origin = E.urlList[E.urlList.length - 1].origin; + const w = new r({ eventSourceSettings: this.#i, push: (I) => { this.dispatchEvent(o( @@ -12553,78 +12553,78 @@ function Xg() { } }); e( - Q.body.stream, - p, + E.body.stream, + w, (I) => { I?.aborted === !1 && (this.close(), this.dispatchEvent(new Event("error"))); } ); - }, this.#n = t(M); + }, this.#n = t(N); } /** * @see https://html.spec.whatwg.org/multipage/server-sent-events.html#sse-processing-model * @returns {Promise} */ async #c() { - this.#r !== f && (this.#r = E, this.dispatchEvent(new Event("error")), await u(this.#i.reconnectionTime), this.#r === E && (this.#i.lastEventId.length && this.#A.headersList.set("last-event-id", this.#i.lastEventId, !0), this.#a())); + this.#r !== d && (this.#r = h, this.dispatchEvent(new Event("error")), await u(this.#i.reconnectionTime), this.#r === h && (this.#i.lastEventId.length && this.#A.headersList.set("last-event-id", this.#i.lastEventId, !0), this.#a())); } /** * Closes the connection, if any, and sets the readyState attribute to * CLOSED. */ close() { - s.brandCheck(this, R), this.#r !== f && (this.#r = f, this.#n.abort(), this.#A = null); + s.brandCheck(this, F), this.#r !== d && (this.#r = d, this.#n.abort(), this.#A = null); } get onopen() { return this.#e.open; } - set onopen(M) { - this.#e.open && this.removeEventListener("open", this.#e.open), typeof M == "function" ? (this.#e.open = M, this.addEventListener("open", M)) : this.#e.open = null; + set onopen(N) { + this.#e.open && this.removeEventListener("open", this.#e.open), typeof N == "function" ? (this.#e.open = N, this.addEventListener("open", N)) : this.#e.open = null; } get onmessage() { return this.#e.message; } - set onmessage(M) { - this.#e.message && this.removeEventListener("message", this.#e.message), typeof M == "function" ? (this.#e.message = M, this.addEventListener("message", M)) : this.#e.message = null; + set onmessage(N) { + this.#e.message && this.removeEventListener("message", this.#e.message), typeof N == "function" ? (this.#e.message = N, this.addEventListener("message", N)) : this.#e.message = null; } get onerror() { return this.#e.error; } - set onerror(M) { - this.#e.error && this.removeEventListener("error", this.#e.error), typeof M == "function" ? (this.#e.error = M, this.addEventListener("error", M)) : this.#e.error = null; + set onerror(N) { + this.#e.error && this.removeEventListener("error", this.#e.error), typeof N == "function" ? (this.#e.error = N, this.addEventListener("error", N)) : this.#e.error = null; } } - const S = { + const M = { CONNECTING: { __proto__: null, configurable: !1, enumerable: !0, - value: E, + value: h, writable: !1 }, OPEN: { __proto__: null, configurable: !1, enumerable: !0, - value: C, + value: B, writable: !1 }, CLOSED: { __proto__: null, configurable: !1, enumerable: !0, - value: f, + value: d, writable: !1 } }; - return Object.defineProperties(R, S), Object.defineProperties(R.prototype, S), Object.defineProperties(R.prototype, { - close: g, - onerror: g, - onmessage: g, - onopen: g, - readyState: g, - url: g, - withCredentials: g + return Object.defineProperties(F, M), Object.defineProperties(F.prototype, M), Object.defineProperties(F.prototype, { + close: l, + onerror: l, + onmessage: l, + onopen: l, + readyState: l, + url: l, + withCredentials: l }), s.converters.EventSourceInitDict = s.dictionaryConverter([ { key: "withCredentials", @@ -12637,25 +12637,25 @@ function Xg() { converter: s.converters.any } ]), _s = { - EventSource: R, - defaultReconnectionTime: h + EventSource: F, + defaultReconnectionTime: Q }, _s; } var qi; function zi() { if (qi) return me; qi = 1; - const e = $t(), t = wA(), A = eA(), s = fg(), r = tA(), n = Uo(), o = pg(), a = wg(), u = Ye(), g = Ue(), { InvalidArgumentError: i } = u, c = kg(), h = mA(), E = ei(), C = Sg(), f = Ai(), y = zo(), b = Hr(), { getGlobalDispatcher: R, setGlobalDispatcher: S } = ss(), L = os(), M = Rr(), d = Fr(); - Object.assign(t.prototype, c), me.Dispatcher = t, me.Client = e, me.Pool = A, me.BalancedPool = s, me.Agent = r, me.ProxyAgent = n, me.EnvHttpProxyAgent = o, me.RetryAgent = a, me.RetryHandler = b, me.DecoratorHandler = L, me.RedirectHandler = M, me.createRedirectInterceptor = d, me.interceptors = { + const e = eA(), t = wA(), A = tA(), s = fg(), r = AA(), n = Uo(), o = pg(), a = wg(), u = Ye(), l = Ue(), { InvalidArgumentError: i } = u, c = kg(), Q = mA(), h = ei(), B = Sg(), d = Ai(), y = zo(), b = Hr(), { getGlobalDispatcher: F, setGlobalDispatcher: M } = ss(), L = os(), N = Rr(), f = Fr(); + Object.assign(t.prototype, c), me.Dispatcher = t, me.Client = e, me.Pool = A, me.BalancedPool = s, me.Agent = r, me.ProxyAgent = n, me.EnvHttpProxyAgent = o, me.RetryAgent = a, me.RetryHandler = b, me.DecoratorHandler = L, me.RedirectHandler = N, me.createRedirectInterceptor = f, me.interceptors = { redirect: Ug(), retry: Ng(), dump: Mg(), dns: Lg() - }, me.buildConnector = h, me.errors = u, me.util = { - parseHeaders: g.parseHeaders, - headerNameToString: g.headerNameToString + }, me.buildConnector = Q, me.errors = u, me.util = { + parseHeaders: l.parseHeaders, + headerNameToString: l.headerNameToString }; - function Q(Be) { + function E(Be) { return (he, Qe, ye) => { if (typeof Qe == "function" && (ye = Qe, Qe = null), !he || typeof he != "string" && typeof he != "object" && !(he instanceof URL)) throw new i("invalid url"); @@ -12665,10 +12665,10 @@ function zi() { if (typeof Qe.path != "string") throw new i("invalid opts.path"); let W = Qe.path; - Qe.path.startsWith("/") || (W = `/${W}`), he = new URL(g.parseOrigin(he).origin + W); + Qe.path.startsWith("/") || (W = `/${W}`), he = new URL(l.parseOrigin(he).origin + W); } else - Qe || (Qe = typeof he == "object" ? he : {}), he = g.parseURL(he); - const { agent: we, dispatcher: X = R() } = Qe; + Qe || (Qe = typeof he == "object" ? he : {}), he = l.parseURL(he); + const { agent: we, dispatcher: X = F() } = Qe; if (we) throw new i("unsupported opts.agent. Did you mean opts.client?"); return Be.call(X, { @@ -12679,32 +12679,32 @@ function zi() { }, ye); }; } - me.setGlobalDispatcher = S, me.getGlobalDispatcher = R; - const w = SA().fetch; + me.setGlobalDispatcher = M, me.getGlobalDispatcher = F; + const p = SA().fetch; me.fetch = async function(he, Qe = void 0) { try { - return await w(he, Qe); + return await p(he, Qe); } catch (ye) { throw ye && typeof ye == "object" && Error.captureStackTrace(ye), ye; } - }, me.Headers = vt().Headers, me.Response = TA().Response, me.Request = rA().Request, me.FormData = DA().FormData, me.File = globalThis.File ?? at.File, me.FileReader = Hg().FileReader; - const { setGlobalOrigin: l, getGlobalOrigin: B } = io(); - me.setGlobalOrigin = l, me.getGlobalOrigin = B; - const { CacheStorage: p } = _g(), { kConstruct: I } = ws(); - me.caches = new p(I); - const { deleteCookie: m, getCookies: D, getSetCookies: N, setCookie: U } = Wg(); - me.deleteCookie = m, me.getCookies = D, me.getSetCookies = N, me.setCookie = U; + }, me.Headers = Yt().Headers, me.Response = TA().Response, me.Request = sA().Request, me.FormData = DA().FormData, me.File = globalThis.File ?? at.File, me.FileReader = Hg().FileReader; + const { setGlobalOrigin: g, getGlobalOrigin: C } = io(); + me.setGlobalOrigin = g, me.getGlobalOrigin = C; + const { CacheStorage: w } = _g(), { kConstruct: I } = ws(); + me.caches = new w(I); + const { deleteCookie: m, getCookies: D, getSetCookies: U, setCookie: S } = Wg(); + me.deleteCookie = m, me.getCookies = D, me.getSetCookies = U, me.setCookie = S; const { parseMIMEType: G, serializeAMimeType: v } = st(); me.parseMIMEType = G, me.serializeAMimeType = v; - const { CloseEvent: $, ErrorEvent: ne, MessageEvent: ge } = sA(); - me.WebSocket = Kg().WebSocket, me.CloseEvent = $, me.ErrorEvent = ne, me.MessageEvent = ge, me.request = Q(c.request), me.stream = Q(c.stream), me.pipeline = Q(c.pipeline), me.connect = Q(c.connect), me.upgrade = Q(c.upgrade), me.MockClient = E, me.MockPool = f, me.MockAgent = C, me.mockErrors = y; + const { CloseEvent: $, ErrorEvent: ne, MessageEvent: ge } = nA(); + me.WebSocket = Kg().WebSocket, me.CloseEvent = $, me.ErrorEvent = ne, me.MessageEvent = ge, me.request = E(c.request), me.stream = E(c.stream), me.pipeline = E(c.pipeline), me.connect = E(c.connect), me.upgrade = E(c.upgrade), me.MockClient = h, me.MockPool = d, me.MockAgent = B, me.mockErrors = y; const { EventSource: ae } = Xg(); return me.EventSource = ae, me; } -var $g = zi(), Et; +var $g = zi(), Qt; (function(e) { e[e.OK = 200] = "OK", e[e.MultipleChoices = 300] = "MultipleChoices", e[e.MovedPermanently = 301] = "MovedPermanently", e[e.ResourceMoved = 302] = "ResourceMoved", e[e.SeeOther = 303] = "SeeOther", e[e.NotModified = 304] = "NotModified", e[e.UseProxy = 305] = "UseProxy", e[e.SwitchProxy = 306] = "SwitchProxy", e[e.TemporaryRedirect = 307] = "TemporaryRedirect", e[e.PermanentRedirect = 308] = "PermanentRedirect", e[e.BadRequest = 400] = "BadRequest", e[e.Unauthorized = 401] = "Unauthorized", e[e.PaymentRequired = 402] = "PaymentRequired", e[e.Forbidden = 403] = "Forbidden", e[e.NotFound = 404] = "NotFound", e[e.MethodNotAllowed = 405] = "MethodNotAllowed", e[e.NotAcceptable = 406] = "NotAcceptable", e[e.ProxyAuthenticationRequired = 407] = "ProxyAuthenticationRequired", e[e.RequestTimeout = 408] = "RequestTimeout", e[e.Conflict = 409] = "Conflict", e[e.Gone = 410] = "Gone", e[e.TooManyRequests = 429] = "TooManyRequests", e[e.InternalServerError = 500] = "InternalServerError", e[e.NotImplemented = 501] = "NotImplemented", e[e.BadGateway = 502] = "BadGateway", e[e.ServiceUnavailable = 503] = "ServiceUnavailable", e[e.GatewayTimeout = 504] = "GatewayTimeout"; -})(Et || (Et = {})); +})(Qt || (Qt = {})); var Zi; (function(e) { e.Accept = "accept", e.ContentType = "content-type"; @@ -12712,8 +12712,8 @@ var Zi; var Ki; (function(e) { e.ApplicationJson = "application/json"; -})(Ki || (Ki = {})), Et.MovedPermanently, Et.ResourceMoved, Et.SeeOther, Et.TemporaryRedirect, Et.PermanentRedirect, Et.BadGateway, Et.ServiceUnavailable, Et.GatewayTimeout; -const { access: PB, appendFile: _B, writeFile: xB } = dt.promises; +})(Ki || (Ki = {})), Qt.MovedPermanently, Qt.ResourceMoved, Qt.SeeOther, Qt.TemporaryRedirect, Qt.PermanentRedirect, Qt.BadGateway, Qt.ServiceUnavailable, Qt.GatewayTimeout; +const { access: xB, appendFile: VB, writeFile: WB } = dt.promises; var ji = function(e, t, A, s) { function r(n) { return n instanceof A ? n : new A(function(o) { @@ -12723,25 +12723,25 @@ var ji = function(e, t, A, s) { return new (A || (A = Promise))(function(n, o) { function a(i) { try { - g(s.next(i)); + l(s.next(i)); } catch (c) { o(c); } } function u(i) { try { - g(s.throw(i)); + l(s.throw(i)); } catch (c) { o(c); } } - function g(i) { + function l(i) { i.done ? n(i.value) : r(i.value).then(a, u); } - g((s = s.apply(e, t || [])).next()); + l((s = s.apply(e, t || [])).next()); }); }; -const { chmod: VB, copyFile: WB, lstat: qB, mkdir: zB, open: ZB, readdir: el, rename: KB, rm: tl, rmdir: jB, stat: xs, symlink: XB, unlink: $B } = pA.promises, St = process.platform === "win32"; +const { chmod: qB, copyFile: zB, lstat: ZB, mkdir: KB, open: jB, readdir: el, rename: XB, rm: tl, rmdir: $B, stat: xs, symlink: eC, unlink: tC } = pA.promises, Ut = process.platform === "win32"; pA.constants.O_RDONLY; function Al(e) { return ji(this, void 0, void 0, function* () { @@ -12758,7 +12758,7 @@ function Al(e) { function Xi(e) { if (e = rl(e), !e) throw new Error('isRooted() parameter "p" cannot be empty'); - return St ? e.startsWith("\\") || /^[A-Z]:/i.test(e) : e.startsWith("/"); + return Ut ? e.startsWith("\\") || /^[A-Z]:/i.test(e) : e.startsWith("/"); } function $i(e, t) { return ji(this, void 0, void 0, function* () { @@ -12769,7 +12769,7 @@ function $i(e, t) { r.code !== "ENOENT" && console.log(`Unexpected error attempting to determine if executable file exists '${e}': ${r}`); } if (A && A.isFile()) { - if (St) { + if (Ut) { const r = ft.extname(e).toUpperCase(); if (t.some((n) => n.toUpperCase() === r)) return e; @@ -12785,7 +12785,7 @@ function $i(e, t) { n.code !== "ENOENT" && console.log(`Unexpected error attempting to determine if executable file exists '${e}': ${n}`); } if (A && A.isFile()) { - if (St) { + if (Ut) { try { const n = ft.dirname(e), o = ft.basename(e).toUpperCase(); for (const a of yield el(n)) @@ -12805,7 +12805,7 @@ function $i(e, t) { }); } function rl(e) { - return e = e || "", St ? (e = e.replace(/\//g, "\\"), e.replace(/\\\\+/g, "\\")) : e.replace(/\/\/+/g, "/"); + return e = e || "", Ut ? (e = e.replace(/\//g, "\\"), e.replace(/\\\\+/g, "\\")) : e.replace(/\/\/+/g, "/"); } function ea(e) { return (e.mode & 1) > 0 || (e.mode & 8) > 0 && process.getgid !== void 0 && e.gid === process.getgid() || (e.mode & 64) > 0 && process.getuid !== void 0 && e.uid === process.getuid(); @@ -12819,27 +12819,27 @@ var Vs = function(e, t, A, s) { return new (A || (A = Promise))(function(n, o) { function a(i) { try { - g(s.next(i)); + l(s.next(i)); } catch (c) { o(c); } } function u(i) { try { - g(s.throw(i)); + l(s.throw(i)); } catch (c) { o(c); } } - function g(i) { + function l(i) { i.done ? n(i.value) : r(i.value).then(a, u); } - g((s = s.apply(e, t || [])).next()); + l((s = s.apply(e, t || [])).next()); }); }; function sl(e) { return Vs(this, void 0, void 0, function* () { - if (St && /[*"<>|]/.test(e)) + if (Ut && /[*"<>|]/.test(e)) throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows'); try { yield tl(e, { @@ -12860,7 +12860,7 @@ function ta(e, t) { if (t) { const s = yield ta(e, !1); if (!s) - throw St ? new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`) : new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`); + throw Ut ? new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`) : new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`); return s; } const A = yield nl(e); @@ -12872,7 +12872,7 @@ function nl(e) { if (!e) throw new Error("parameter 'tool' is required"); const t = []; - if (St && process.env.PATHEXT) + if (Ut && process.env.PATHEXT) for (const r of process.env.PATHEXT.split(ft.delimiter)) r && t.push(r); if (Xi(e)) { @@ -12902,22 +12902,22 @@ var Aa = function(e, t, A, s) { return new (A || (A = Promise))(function(n, o) { function a(i) { try { - g(s.next(i)); + l(s.next(i)); } catch (c) { o(c); } } function u(i) { try { - g(s.throw(i)); + l(s.throw(i)); } catch (c) { o(c); } } - function g(i) { + function l(i) { i.done ? n(i.value) : r(i.value).then(a, u); } - g((s = s.apply(e, t || [])).next()); + l((s = s.apply(e, t || [])).next()); }); }; const MA = process.platform === "win32"; @@ -12956,10 +12956,10 @@ class ol extends Mn.EventEmitter { } _processLineBuffer(t, A, s) { try { - let r = A + t.toString(), n = r.indexOf(ut.EOL); + let r = A + t.toString(), n = r.indexOf(Et.EOL); for (; n > -1; ) { const o = r.substring(0, n); - s(o), r = r.substring(n + ut.EOL.length), n = r.indexOf(ut.EOL); + s(o), r = r.substring(n + Et.EOL.length), n = r.indexOf(Et.EOL); } return r; } catch (r) { @@ -13070,35 +13070,35 @@ class ol extends Mn.EventEmitter { return Aa(this, void 0, void 0, function* () { return !Xi(this.toolPath) && (this.toolPath.includes("/") || MA && this.toolPath.includes("\\")) && (this.toolPath = ft.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath)), this.toolPath = yield ta(this.toolPath, !0), new Promise((t, A) => Aa(this, void 0, void 0, function* () { this._debug(`exec tool: ${this.toolPath}`), this._debug("arguments:"); - for (const g of this.args) - this._debug(` ${g}`); + for (const l of this.args) + this._debug(` ${l}`); const s = this._cloneExecOptions(this.options); - !s.silent && s.outStream && s.outStream.write(this._getCommandString(s) + ut.EOL); + !s.silent && s.outStream && s.outStream.write(this._getCommandString(s) + Et.EOL); const r = new Dn(s, this.toolPath); - if (r.on("debug", (g) => { - this._debug(g); + if (r.on("debug", (l) => { + this._debug(l); }), this.options.cwd && !(yield Al(this.options.cwd))) return A(new Error(`The cwd: ${this.options.cwd} does not exist!`)); const n = this._getSpawnFileName(), o = rg.spawn(n, this._getSpawnArgs(s), this._getSpawnOptions(this.options, n)); let a = ""; - o.stdout && o.stdout.on("data", (g) => { - this.options.listeners && this.options.listeners.stdout && this.options.listeners.stdout(g), !s.silent && s.outStream && s.outStream.write(g), a = this._processLineBuffer(g, a, (i) => { + o.stdout && o.stdout.on("data", (l) => { + this.options.listeners && this.options.listeners.stdout && this.options.listeners.stdout(l), !s.silent && s.outStream && s.outStream.write(l), a = this._processLineBuffer(l, a, (i) => { this.options.listeners && this.options.listeners.stdline && this.options.listeners.stdline(i); }); }); let u = ""; - if (o.stderr && o.stderr.on("data", (g) => { - r.processStderr = !0, this.options.listeners && this.options.listeners.stderr && this.options.listeners.stderr(g), !s.silent && s.errStream && s.outStream && (s.failOnStdErr ? s.errStream : s.outStream).write(g), u = this._processLineBuffer(g, u, (i) => { + if (o.stderr && o.stderr.on("data", (l) => { + r.processStderr = !0, this.options.listeners && this.options.listeners.stderr && this.options.listeners.stderr(l), !s.silent && s.errStream && s.outStream && (s.failOnStdErr ? s.errStream : s.outStream).write(l), u = this._processLineBuffer(l, u, (i) => { this.options.listeners && this.options.listeners.errline && this.options.listeners.errline(i); }); - }), o.on("error", (g) => { - r.processError = g.message, r.processExited = !0, r.processClosed = !0, r.CheckComplete(); - }), o.on("exit", (g) => { - r.processExitCode = g, r.processExited = !0, this._debug(`Exit code ${g} received from tool '${this.toolPath}'`), r.CheckComplete(); - }), o.on("close", (g) => { - r.processExitCode = g, r.processExited = !0, r.processClosed = !0, this._debug(`STDIO streams have closed for tool '${this.toolPath}'`), r.CheckComplete(); - }), r.on("done", (g, i) => { - a.length > 0 && this.emit("stdline", a), u.length > 0 && this.emit("errline", u), o.removeAllListeners(), g ? A(g) : t(i); + }), o.on("error", (l) => { + r.processError = l.message, r.processExited = !0, r.processClosed = !0, r.CheckComplete(); + }), o.on("exit", (l) => { + r.processExitCode = l, r.processExited = !0, this._debug(`Exit code ${l} received from tool '${this.toolPath}'`), r.CheckComplete(); + }), o.on("close", (l) => { + r.processExitCode = l, r.processExited = !0, r.processClosed = !0, this._debug(`STDIO streams have closed for tool '${this.toolPath}'`), r.CheckComplete(); + }), r.on("done", (l, i) => { + a.length > 0 && this.emit("stdline", a), u.length > 0 && this.emit("errline", u), o.removeAllListeners(), l ? A(l) : t(i); }), this.options.input) { if (!o.stdin) throw new Error("child process missing stdin"); @@ -13171,22 +13171,22 @@ var al = function(e, t, A, s) { return new (A || (A = Promise))(function(n, o) { function a(i) { try { - g(s.next(i)); + l(s.next(i)); } catch (c) { o(c); } } function u(i) { try { - g(s.throw(i)); + l(s.throw(i)); } catch (c) { o(c); } } - function g(i) { + function l(i) { i.done ? n(i.value) : r(i.value).then(a, u); } - g((s = s.apply(e, t || [])).next()); + l((s = s.apply(e, t || [])).next()); }); }; function cl(e, t, A) { @@ -13203,28 +13203,28 @@ var Ws; (function(e) { e[e.Success = 0] = "Success", e[e.Failure = 1] = "Failure"; })(Ws || (Ws = {})); -function Qt(e, t) { +function ct(e, t) { return (process.env[`INPUT_${e.replace(/ /g, "_").toUpperCase()}`] || "").trim(); } function qs(e, t) { if (process.env.GITHUB_OUTPUT || "") return ig("OUTPUT", ag(e, t)); - process.stdout.write(ut.EOL), zt("set-output", { name: e }, qt(t)); + process.stdout.write(Et.EOL), Zt("set-output", { name: e }, zt(t)); } function gl(e) { process.exitCode = Ws.Failure, ll(e); } function ra(e) { - zt("debug", {}, e); + Zt("debug", {}, e); } function ll(e, t = {}) { - zt("error", Ln(t), e instanceof Error ? e.toString() : e); + Zt("error", Ln(t), e instanceof Error ? e.toString() : e); } function zs(e, t = {}) { - zt("warning", Ln(t), e instanceof Error ? e.toString() : e); + Zt("warning", Ln(t), e instanceof Error ? e.toString() : e); } function Xe(e) { - process.stdout.write(e + ut.EOL); + process.stdout.write(e + Et.EOL); } function LA(e) { Gn("group", e); @@ -13264,10 +13264,10 @@ class sa { throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'"); } } -var Oe = {}, nA = {}, na; +var Oe = {}, oA = {}, na; function ul() { - if (na) return nA; - na = 1, Object.defineProperty(nA, "__esModule", { value: !0 }), nA.getProxyUrl = e, nA.checkBypass = t; + if (na) return oA; + na = 1, Object.defineProperty(oA, "__esModule", { value: !0 }), oA.getProxyUrl = e, oA.checkBypass = t; function e(r) { const n = r.protocol === "https:"; if (t(r)) @@ -13296,8 +13296,8 @@ function ul() { r.port ? a = Number(r.port) : r.protocol === "http:" ? a = 80 : r.protocol === "https:" && (a = 443); const u = [r.hostname.toUpperCase()]; typeof a == "number" && u.push(`${u[0]}:${a}`); - for (const g of o.split(",").map((i) => i.trim().toUpperCase()).filter((i) => i)) - if (g === "*" || u.some((i) => i === g || i.endsWith(`.${g}`) || g.startsWith(".") && i.endsWith(`${g}`))) + for (const l of o.split(",").map((i) => i.trim().toUpperCase()).filter((i) => i)) + if (l === "*" || u.some((i) => i === l || i.endsWith(`.${l}`) || l.startsWith(".") && i.endsWith(`${l}`))) return !0; return !1; } @@ -13316,209 +13316,209 @@ function ul() { return this._decodedPassword; } } - return nA; + return oA; } var oa; function El() { if (oa) return Oe; oa = 1; - var e = Oe && Oe.__createBinding || (Object.create ? (function(Q, w, l, B) { - B === void 0 && (B = l); - var p = Object.getOwnPropertyDescriptor(w, l); - (!p || ("get" in p ? !w.__esModule : p.writable || p.configurable)) && (p = { enumerable: !0, get: function() { - return w[l]; - } }), Object.defineProperty(Q, B, p); - }) : (function(Q, w, l, B) { - B === void 0 && (B = l), Q[B] = w[l]; - })), t = Oe && Oe.__setModuleDefault || (Object.create ? (function(Q, w) { - Object.defineProperty(Q, "default", { enumerable: !0, value: w }); - }) : function(Q, w) { - Q.default = w; + var e = Oe && Oe.__createBinding || (Object.create ? (function(E, p, g, C) { + C === void 0 && (C = g); + var w = Object.getOwnPropertyDescriptor(p, g); + (!w || ("get" in w ? !p.__esModule : w.writable || w.configurable)) && (w = { enumerable: !0, get: function() { + return p[g]; + } }), Object.defineProperty(E, C, w); + }) : (function(E, p, g, C) { + C === void 0 && (C = g), E[C] = p[g]; + })), t = Oe && Oe.__setModuleDefault || (Object.create ? (function(E, p) { + Object.defineProperty(E, "default", { enumerable: !0, value: p }); + }) : function(E, p) { + E.default = p; }), A = Oe && Oe.__importStar || /* @__PURE__ */ (function() { - var Q = function(w) { - return Q = Object.getOwnPropertyNames || function(l) { - var B = []; - for (var p in l) Object.prototype.hasOwnProperty.call(l, p) && (B[B.length] = p); - return B; - }, Q(w); + var E = function(p) { + return E = Object.getOwnPropertyNames || function(g) { + var C = []; + for (var w in g) Object.prototype.hasOwnProperty.call(g, w) && (C[C.length] = w); + return C; + }, E(p); }; - return function(w) { - if (w && w.__esModule) return w; - var l = {}; - if (w != null) for (var B = Q(w), p = 0; p < B.length; p++) B[p] !== "default" && e(l, w, B[p]); - return t(l, w), l; + return function(p) { + if (p && p.__esModule) return p; + var g = {}; + if (p != null) for (var C = E(p), w = 0; w < C.length; w++) C[w] !== "default" && e(g, p, C[w]); + return t(g, p), g; }; - })(), s = Oe && Oe.__awaiter || function(Q, w, l, B) { - function p(I) { - return I instanceof l ? I : new l(function(m) { + })(), s = Oe && Oe.__awaiter || function(E, p, g, C) { + function w(I) { + return I instanceof g ? I : new g(function(m) { m(I); }); } - return new (l || (l = Promise))(function(I, m) { + return new (g || (g = Promise))(function(I, m) { function D(G) { try { - U(B.next(G)); + S(C.next(G)); } catch (v) { m(v); } } - function N(G) { + function U(G) { try { - U(B.throw(G)); + S(C.throw(G)); } catch (v) { m(v); } } - function U(G) { - G.done ? I(G.value) : p(G.value).then(D, N); + function S(G) { + G.done ? I(G.value) : w(G.value).then(D, U); } - U((B = B.apply(Q, w || [])).next()); + S((C = C.apply(E, p || [])).next()); }); }; - Object.defineProperty(Oe, "__esModule", { value: !0 }), Oe.HttpClient = Oe.HttpClientResponse = Oe.HttpClientError = Oe.MediaTypes = Oe.Headers = Oe.HttpCodes = void 0, Oe.getProxyUrl = h, Oe.isHttps = L; + Object.defineProperty(Oe, "__esModule", { value: !0 }), Oe.HttpClient = Oe.HttpClientResponse = Oe.HttpClientError = Oe.MediaTypes = Oe.Headers = Oe.HttpCodes = void 0, Oe.getProxyUrl = Q, Oe.isHttps = L; const r = A(Fn), n = A(Tn), o = A(ul()), a = A(On()), u = zi(); - var g; - (function(Q) { - Q[Q.OK = 200] = "OK", Q[Q.MultipleChoices = 300] = "MultipleChoices", Q[Q.MovedPermanently = 301] = "MovedPermanently", Q[Q.ResourceMoved = 302] = "ResourceMoved", Q[Q.SeeOther = 303] = "SeeOther", Q[Q.NotModified = 304] = "NotModified", Q[Q.UseProxy = 305] = "UseProxy", Q[Q.SwitchProxy = 306] = "SwitchProxy", Q[Q.TemporaryRedirect = 307] = "TemporaryRedirect", Q[Q.PermanentRedirect = 308] = "PermanentRedirect", Q[Q.BadRequest = 400] = "BadRequest", Q[Q.Unauthorized = 401] = "Unauthorized", Q[Q.PaymentRequired = 402] = "PaymentRequired", Q[Q.Forbidden = 403] = "Forbidden", Q[Q.NotFound = 404] = "NotFound", Q[Q.MethodNotAllowed = 405] = "MethodNotAllowed", Q[Q.NotAcceptable = 406] = "NotAcceptable", Q[Q.ProxyAuthenticationRequired = 407] = "ProxyAuthenticationRequired", Q[Q.RequestTimeout = 408] = "RequestTimeout", Q[Q.Conflict = 409] = "Conflict", Q[Q.Gone = 410] = "Gone", Q[Q.TooManyRequests = 429] = "TooManyRequests", Q[Q.InternalServerError = 500] = "InternalServerError", Q[Q.NotImplemented = 501] = "NotImplemented", Q[Q.BadGateway = 502] = "BadGateway", Q[Q.ServiceUnavailable = 503] = "ServiceUnavailable", Q[Q.GatewayTimeout = 504] = "GatewayTimeout"; - })(g || (Oe.HttpCodes = g = {})); + var l; + (function(E) { + E[E.OK = 200] = "OK", E[E.MultipleChoices = 300] = "MultipleChoices", E[E.MovedPermanently = 301] = "MovedPermanently", E[E.ResourceMoved = 302] = "ResourceMoved", E[E.SeeOther = 303] = "SeeOther", E[E.NotModified = 304] = "NotModified", E[E.UseProxy = 305] = "UseProxy", E[E.SwitchProxy = 306] = "SwitchProxy", E[E.TemporaryRedirect = 307] = "TemporaryRedirect", E[E.PermanentRedirect = 308] = "PermanentRedirect", E[E.BadRequest = 400] = "BadRequest", E[E.Unauthorized = 401] = "Unauthorized", E[E.PaymentRequired = 402] = "PaymentRequired", E[E.Forbidden = 403] = "Forbidden", E[E.NotFound = 404] = "NotFound", E[E.MethodNotAllowed = 405] = "MethodNotAllowed", E[E.NotAcceptable = 406] = "NotAcceptable", E[E.ProxyAuthenticationRequired = 407] = "ProxyAuthenticationRequired", E[E.RequestTimeout = 408] = "RequestTimeout", E[E.Conflict = 409] = "Conflict", E[E.Gone = 410] = "Gone", E[E.TooManyRequests = 429] = "TooManyRequests", E[E.InternalServerError = 500] = "InternalServerError", E[E.NotImplemented = 501] = "NotImplemented", E[E.BadGateway = 502] = "BadGateway", E[E.ServiceUnavailable = 503] = "ServiceUnavailable", E[E.GatewayTimeout = 504] = "GatewayTimeout"; + })(l || (Oe.HttpCodes = l = {})); var i; - (function(Q) { - Q.Accept = "accept", Q.ContentType = "content-type"; + (function(E) { + E.Accept = "accept", E.ContentType = "content-type"; })(i || (Oe.Headers = i = {})); var c; - (function(Q) { - Q.ApplicationJson = "application/json"; + (function(E) { + E.ApplicationJson = "application/json"; })(c || (Oe.MediaTypes = c = {})); - function h(Q) { - const w = o.getProxyUrl(new URL(Q)); - return w ? w.href : ""; - } - const E = [ - g.MovedPermanently, - g.ResourceMoved, - g.SeeOther, - g.TemporaryRedirect, - g.PermanentRedirect - ], C = [ - g.BadGateway, - g.ServiceUnavailable, - g.GatewayTimeout - ], f = ["OPTIONS", "GET", "DELETE", "HEAD"], y = 10, b = 5; - class R extends Error { - constructor(w, l) { - super(w), this.name = "HttpClientError", this.statusCode = l, Object.setPrototypeOf(this, R.prototype); - } - } - Oe.HttpClientError = R; - class S { - constructor(w) { - this.message = w; + function Q(E) { + const p = o.getProxyUrl(new URL(E)); + return p ? p.href : ""; + } + const h = [ + l.MovedPermanently, + l.ResourceMoved, + l.SeeOther, + l.TemporaryRedirect, + l.PermanentRedirect + ], B = [ + l.BadGateway, + l.ServiceUnavailable, + l.GatewayTimeout + ], d = ["OPTIONS", "GET", "DELETE", "HEAD"], y = 10, b = 5; + class F extends Error { + constructor(p, g) { + super(p), this.name = "HttpClientError", this.statusCode = g, Object.setPrototypeOf(this, F.prototype); + } + } + Oe.HttpClientError = F; + class M { + constructor(p) { + this.message = p; } readBody() { return s(this, void 0, void 0, function* () { - return new Promise((w) => s(this, void 0, void 0, function* () { - let l = Buffer.alloc(0); - this.message.on("data", (B) => { - l = Buffer.concat([l, B]); + return new Promise((p) => s(this, void 0, void 0, function* () { + let g = Buffer.alloc(0); + this.message.on("data", (C) => { + g = Buffer.concat([g, C]); }), this.message.on("end", () => { - w(l.toString()); + p(g.toString()); }); })); }); } readBodyBuffer() { return s(this, void 0, void 0, function* () { - return new Promise((w) => s(this, void 0, void 0, function* () { - const l = []; - this.message.on("data", (B) => { - l.push(B); + return new Promise((p) => s(this, void 0, void 0, function* () { + const g = []; + this.message.on("data", (C) => { + g.push(C); }), this.message.on("end", () => { - w(Buffer.concat(l)); + p(Buffer.concat(g)); }); })); }); } } - Oe.HttpClientResponse = S; - function L(Q) { - return new URL(Q).protocol === "https:"; + Oe.HttpClientResponse = M; + function L(E) { + return new URL(E).protocol === "https:"; } - class M { - constructor(w, l, B) { - this._ignoreSslError = !1, this._allowRedirects = !0, this._allowRedirectDowngrade = !1, this._maxRedirects = 50, this._allowRetries = !1, this._maxRetries = 1, this._keepAlive = !1, this._disposed = !1, this.userAgent = this._getUserAgentWithOrchestrationId(w), this.handlers = l || [], this.requestOptions = B, B && (B.ignoreSslError != null && (this._ignoreSslError = B.ignoreSslError), this._socketTimeout = B.socketTimeout, B.allowRedirects != null && (this._allowRedirects = B.allowRedirects), B.allowRedirectDowngrade != null && (this._allowRedirectDowngrade = B.allowRedirectDowngrade), B.maxRedirects != null && (this._maxRedirects = Math.max(B.maxRedirects, 0)), B.keepAlive != null && (this._keepAlive = B.keepAlive), B.allowRetries != null && (this._allowRetries = B.allowRetries), B.maxRetries != null && (this._maxRetries = B.maxRetries)); + class N { + constructor(p, g, C) { + this._ignoreSslError = !1, this._allowRedirects = !0, this._allowRedirectDowngrade = !1, this._maxRedirects = 50, this._allowRetries = !1, this._maxRetries = 1, this._keepAlive = !1, this._disposed = !1, this.userAgent = this._getUserAgentWithOrchestrationId(p), this.handlers = g || [], this.requestOptions = C, C && (C.ignoreSslError != null && (this._ignoreSslError = C.ignoreSslError), this._socketTimeout = C.socketTimeout, C.allowRedirects != null && (this._allowRedirects = C.allowRedirects), C.allowRedirectDowngrade != null && (this._allowRedirectDowngrade = C.allowRedirectDowngrade), C.maxRedirects != null && (this._maxRedirects = Math.max(C.maxRedirects, 0)), C.keepAlive != null && (this._keepAlive = C.keepAlive), C.allowRetries != null && (this._allowRetries = C.allowRetries), C.maxRetries != null && (this._maxRetries = C.maxRetries)); } - options(w, l) { + options(p, g) { return s(this, void 0, void 0, function* () { - return this.request("OPTIONS", w, null, l || {}); + return this.request("OPTIONS", p, null, g || {}); }); } - get(w, l) { + get(p, g) { return s(this, void 0, void 0, function* () { - return this.request("GET", w, null, l || {}); + return this.request("GET", p, null, g || {}); }); } - del(w, l) { + del(p, g) { return s(this, void 0, void 0, function* () { - return this.request("DELETE", w, null, l || {}); + return this.request("DELETE", p, null, g || {}); }); } - post(w, l, B) { + post(p, g, C) { return s(this, void 0, void 0, function* () { - return this.request("POST", w, l, B || {}); + return this.request("POST", p, g, C || {}); }); } - patch(w, l, B) { + patch(p, g, C) { return s(this, void 0, void 0, function* () { - return this.request("PATCH", w, l, B || {}); + return this.request("PATCH", p, g, C || {}); }); } - put(w, l, B) { + put(p, g, C) { return s(this, void 0, void 0, function* () { - return this.request("PUT", w, l, B || {}); + return this.request("PUT", p, g, C || {}); }); } - head(w, l) { + head(p, g) { return s(this, void 0, void 0, function* () { - return this.request("HEAD", w, null, l || {}); + return this.request("HEAD", p, null, g || {}); }); } - sendStream(w, l, B, p) { + sendStream(p, g, C, w) { return s(this, void 0, void 0, function* () { - return this.request(w, l, B, p); + return this.request(p, g, C, w); }); } /** * Gets a typed object from an endpoint * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise */ - getJson(w) { - return s(this, arguments, void 0, function* (l, B = {}) { - B[i.Accept] = this._getExistingOrDefaultHeader(B, i.Accept, c.ApplicationJson); - const p = yield this.get(l, B); - return this._processResponse(p, this.requestOptions); + getJson(p) { + return s(this, arguments, void 0, function* (g, C = {}) { + C[i.Accept] = this._getExistingOrDefaultHeader(C, i.Accept, c.ApplicationJson); + const w = yield this.get(g, C); + return this._processResponse(w, this.requestOptions); }); } - postJson(w, l) { - return s(this, arguments, void 0, function* (B, p, I = {}) { - const m = JSON.stringify(p, null, 2); + postJson(p, g) { + return s(this, arguments, void 0, function* (C, w, I = {}) { + const m = JSON.stringify(w, null, 2); I[i.Accept] = this._getExistingOrDefaultHeader(I, i.Accept, c.ApplicationJson), I[i.ContentType] = this._getExistingOrDefaultContentTypeHeader(I, c.ApplicationJson); - const D = yield this.post(B, m, I); + const D = yield this.post(C, m, I); return this._processResponse(D, this.requestOptions); }); } - putJson(w, l) { - return s(this, arguments, void 0, function* (B, p, I = {}) { - const m = JSON.stringify(p, null, 2); + putJson(p, g) { + return s(this, arguments, void 0, function* (C, w, I = {}) { + const m = JSON.stringify(w, null, 2); I[i.Accept] = this._getExistingOrDefaultHeader(I, i.Accept, c.ApplicationJson), I[i.ContentType] = this._getExistingOrDefaultContentTypeHeader(I, c.ApplicationJson); - const D = yield this.put(B, m, I); + const D = yield this.put(C, m, I); return this._processResponse(D, this.requestOptions); }); } - patchJson(w, l) { - return s(this, arguments, void 0, function* (B, p, I = {}) { - const m = JSON.stringify(p, null, 2); + patchJson(p, g) { + return s(this, arguments, void 0, function* (C, w, I = {}) { + const m = JSON.stringify(w, null, 2); I[i.Accept] = this._getExistingOrDefaultHeader(I, i.Accept, c.ApplicationJson), I[i.ContentType] = this._getExistingOrDefaultContentTypeHeader(I, c.ApplicationJson); - const D = yield this.patch(B, m, I); + const D = yield this.patch(C, m, I); return this._processResponse(D, this.requestOptions); }); } @@ -13527,42 +13527,42 @@ function El() { * All other methods such as get, post, patch, and request ultimately call this. * Prefer get, del, post and patch */ - request(w, l, B, p) { + request(p, g, C, w) { return s(this, void 0, void 0, function* () { if (this._disposed) throw new Error("Client has already been disposed."); - const I = new URL(l); - let m = this._prepareRequest(w, I, p); - const D = this._allowRetries && f.includes(w) ? this._maxRetries + 1 : 1; - let N = 0, U; + const I = new URL(g); + let m = this._prepareRequest(p, I, w); + const D = this._allowRetries && d.includes(p) ? this._maxRetries + 1 : 1; + let U = 0, S; do { - if (U = yield this.requestRaw(m, B), U && U.message && U.message.statusCode === g.Unauthorized) { + if (S = yield this.requestRaw(m, C), S && S.message && S.message.statusCode === l.Unauthorized) { let v; for (const $ of this.handlers) - if ($.canHandleAuthentication(U)) { + if ($.canHandleAuthentication(S)) { v = $; break; } - return v ? v.handleAuthentication(this, m, B) : U; + return v ? v.handleAuthentication(this, m, C) : S; } let G = this._maxRedirects; - for (; U.message.statusCode && E.includes(U.message.statusCode) && this._allowRedirects && G > 0; ) { - const v = U.message.headers.location; + for (; S.message.statusCode && h.includes(S.message.statusCode) && this._allowRedirects && G > 0; ) { + const v = S.message.headers.location; if (!v) break; const $ = new URL(v); if (I.protocol === "https:" && I.protocol !== $.protocol && !this._allowRedirectDowngrade) throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true."); - if (yield U.readBody(), $.hostname !== I.hostname) - for (const ne in p) - ne.toLowerCase() === "authorization" && delete p[ne]; - m = this._prepareRequest(w, $, p), U = yield this.requestRaw(m, B), G--; + if (yield S.readBody(), $.hostname !== I.hostname) + for (const ne in w) + ne.toLowerCase() === "authorization" && delete w[ne]; + m = this._prepareRequest(p, $, w), S = yield this.requestRaw(m, C), G--; } - if (!U.message.statusCode || !C.includes(U.message.statusCode)) - return U; - N += 1, N < D && (yield U.readBody(), yield this._performExponentialBackoff(N)); - } while (N < D); - return U; + if (!S.message.statusCode || !B.includes(S.message.statusCode)) + return S; + U += 1, U < D && (yield S.readBody(), yield this._performExponentialBackoff(U)); + } while (U < D); + return S; }); } /** @@ -13576,13 +13576,13 @@ function El() { * @param info * @param data */ - requestRaw(w, l) { + requestRaw(p, g) { return s(this, void 0, void 0, function* () { - return new Promise((B, p) => { + return new Promise((C, w) => { function I(m, D) { - m ? p(m) : D ? B(D) : p(new Error("Unknown error")); + m ? w(m) : D ? C(D) : w(new Error("Unknown error")); } - this.requestRawWithCallback(w, l, I); + this.requestRawWithCallback(p, g, I); }); }); } @@ -13592,54 +13592,54 @@ function El() { * @param data * @param onResult */ - requestRawWithCallback(w, l, B) { - typeof l == "string" && (w.options.headers || (w.options.headers = {}), w.options.headers["Content-Length"] = Buffer.byteLength(l, "utf8")); - let p = !1; - function I(N, U) { - p || (p = !0, B(N, U)); + requestRawWithCallback(p, g, C) { + typeof g == "string" && (p.options.headers || (p.options.headers = {}), p.options.headers["Content-Length"] = Buffer.byteLength(g, "utf8")); + let w = !1; + function I(U, S) { + w || (w = !0, C(U, S)); } - const m = w.httpModule.request(w.options, (N) => { - const U = new S(N); - I(void 0, U); + const m = p.httpModule.request(p.options, (U) => { + const S = new M(U); + I(void 0, S); }); let D; - m.on("socket", (N) => { - D = N; + m.on("socket", (U) => { + D = U; }), m.setTimeout(this._socketTimeout || 3 * 6e4, () => { - D && D.end(), I(new Error(`Request timeout: ${w.options.path}`)); - }), m.on("error", function(N) { - I(N); - }), l && typeof l == "string" && m.write(l, "utf8"), l && typeof l != "string" ? (l.on("close", function() { + D && D.end(), I(new Error(`Request timeout: ${p.options.path}`)); + }), m.on("error", function(U) { + I(U); + }), g && typeof g == "string" && m.write(g, "utf8"), g && typeof g != "string" ? (g.on("close", function() { m.end(); - }), l.pipe(m)) : m.end(); + }), g.pipe(m)) : m.end(); } /** * Gets an http agent. This function is useful when you need an http agent that handles * routing through a proxy server - depending upon the url and proxy environment variables. * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com */ - getAgent(w) { - const l = new URL(w); - return this._getAgent(l); - } - getAgentDispatcher(w) { - const l = new URL(w), B = o.getProxyUrl(l); - if (B && B.hostname) - return this._getProxyAgentDispatcher(l, B); - } - _prepareRequest(w, l, B) { - const p = {}; - p.parsedUrl = l; - const I = p.parsedUrl.protocol === "https:"; - p.httpModule = I ? n : r; + getAgent(p) { + const g = new URL(p); + return this._getAgent(g); + } + getAgentDispatcher(p) { + const g = new URL(p), C = o.getProxyUrl(g); + if (C && C.hostname) + return this._getProxyAgentDispatcher(g, C); + } + _prepareRequest(p, g, C) { + const w = {}; + w.parsedUrl = g; + const I = w.parsedUrl.protocol === "https:"; + w.httpModule = I ? n : r; const m = I ? 443 : 80; - if (p.options = {}, p.options.host = p.parsedUrl.hostname, p.options.port = p.parsedUrl.port ? parseInt(p.parsedUrl.port) : m, p.options.path = (p.parsedUrl.pathname || "") + (p.parsedUrl.search || ""), p.options.method = w, p.options.headers = this._mergeHeaders(B), this.userAgent != null && (p.options.headers["user-agent"] = this.userAgent), p.options.agent = this._getAgent(p.parsedUrl), this.handlers) + if (w.options = {}, w.options.host = w.parsedUrl.hostname, w.options.port = w.parsedUrl.port ? parseInt(w.parsedUrl.port) : m, w.options.path = (w.parsedUrl.pathname || "") + (w.parsedUrl.search || ""), w.options.method = p, w.options.headers = this._mergeHeaders(C), this.userAgent != null && (w.options.headers["user-agent"] = this.userAgent), w.options.agent = this._getAgent(w.parsedUrl), this.handlers) for (const D of this.handlers) - D.prepareRequest(p.options); - return p; + D.prepareRequest(w.options); + return w; } - _mergeHeaders(w) { - return this.requestOptions && this.requestOptions.headers ? Object.assign({}, d(this.requestOptions.headers), d(w || {})) : d(w || {}); + _mergeHeaders(p) { + return this.requestOptions && this.requestOptions.headers ? Object.assign({}, f(this.requestOptions.headers), f(p || {})) : f(p || {}); } /** * Gets an existing header value or returns a default. @@ -13648,14 +13648,14 @@ function El() { * For headers that must always be a single string (like Content-Type), use the * specialized _getExistingOrDefaultContentTypeHeader method instead. */ - _getExistingOrDefaultHeader(w, l, B) { - let p; + _getExistingOrDefaultHeader(p, g, C) { + let w; if (this.requestOptions && this.requestOptions.headers) { - const m = d(this.requestOptions.headers)[l]; - m && (p = typeof m == "number" ? m.toString() : m); + const m = f(this.requestOptions.headers)[g]; + m && (w = typeof m == "number" ? m.toString() : m); } - const I = w[l]; - return I !== void 0 ? typeof I == "number" ? I.toString() : I : p !== void 0 ? p : B; + const I = p[g]; + return I !== void 0 ? typeof I == "number" ? I.toString() : I : w !== void 0 ? w : C; } /** * Specialized version of _getExistingOrDefaultHeader for Content-Type header. @@ -13664,77 +13664,77 @@ function El() { * This was split from _getExistingOrDefaultHeader to provide stricter typing for callers * that assign the result to places expecting a string (e.g., additionalHeaders[Headers.ContentType]). */ - _getExistingOrDefaultContentTypeHeader(w, l) { - let B; + _getExistingOrDefaultContentTypeHeader(p, g) { + let C; if (this.requestOptions && this.requestOptions.headers) { - const I = d(this.requestOptions.headers)[i.ContentType]; - I && (typeof I == "number" ? B = String(I) : Array.isArray(I) ? B = I.join(", ") : B = I); + const I = f(this.requestOptions.headers)[i.ContentType]; + I && (typeof I == "number" ? C = String(I) : Array.isArray(I) ? C = I.join(", ") : C = I); } - const p = w[i.ContentType]; - return p !== void 0 ? typeof p == "number" ? String(p) : Array.isArray(p) ? p.join(", ") : p : B !== void 0 ? B : l; - } - _getAgent(w) { - let l; - const B = o.getProxyUrl(w), p = B && B.hostname; - if (this._keepAlive && p && (l = this._proxyAgent), p || (l = this._agent), l) - return l; - const I = w.protocol === "https:"; + const w = p[i.ContentType]; + return w !== void 0 ? typeof w == "number" ? String(w) : Array.isArray(w) ? w.join(", ") : w : C !== void 0 ? C : g; + } + _getAgent(p) { + let g; + const C = o.getProxyUrl(p), w = C && C.hostname; + if (this._keepAlive && w && (g = this._proxyAgent), w || (g = this._agent), g) + return g; + const I = p.protocol === "https:"; let m = 100; - if (this.requestOptions && (m = this.requestOptions.maxSockets || r.globalAgent.maxSockets), B && B.hostname) { + if (this.requestOptions && (m = this.requestOptions.maxSockets || r.globalAgent.maxSockets), C && C.hostname) { const D = { maxSockets: m, keepAlive: this._keepAlive, - proxy: Object.assign(Object.assign({}, (B.username || B.password) && { - proxyAuth: `${B.username}:${B.password}` - }), { host: B.hostname, port: B.port }) + proxy: Object.assign(Object.assign({}, (C.username || C.password) && { + proxyAuth: `${C.username}:${C.password}` + }), { host: C.hostname, port: C.port }) }; - let N; - const U = B.protocol === "https:"; - I ? N = U ? a.httpsOverHttps : a.httpsOverHttp : N = U ? a.httpOverHttps : a.httpOverHttp, l = N(D), this._proxyAgent = l; + let U; + const S = C.protocol === "https:"; + I ? U = S ? a.httpsOverHttps : a.httpsOverHttp : U = S ? a.httpOverHttps : a.httpOverHttp, g = U(D), this._proxyAgent = g; } - if (!l) { + if (!g) { const D = { keepAlive: this._keepAlive, maxSockets: m }; - l = I ? new n.Agent(D) : new r.Agent(D), this._agent = l; + g = I ? new n.Agent(D) : new r.Agent(D), this._agent = g; } - return I && this._ignoreSslError && (l.options = Object.assign(l.options || {}, { + return I && this._ignoreSslError && (g.options = Object.assign(g.options || {}, { rejectUnauthorized: !1 - })), l; - } - _getProxyAgentDispatcher(w, l) { - let B; - if (this._keepAlive && (B = this._proxyAgentDispatcher), B) - return B; - const p = w.protocol === "https:"; - return B = new u.ProxyAgent(Object.assign({ uri: l.href, pipelining: this._keepAlive ? 1 : 0 }, (l.username || l.password) && { - token: `Basic ${Buffer.from(`${l.username}:${l.password}`).toString("base64")}` - })), this._proxyAgentDispatcher = B, p && this._ignoreSslError && (B.options = Object.assign(B.options.requestTls || {}, { + })), g; + } + _getProxyAgentDispatcher(p, g) { + let C; + if (this._keepAlive && (C = this._proxyAgentDispatcher), C) + return C; + const w = p.protocol === "https:"; + return C = new u.ProxyAgent(Object.assign({ uri: g.href, pipelining: this._keepAlive ? 1 : 0 }, (g.username || g.password) && { + token: `Basic ${Buffer.from(`${g.username}:${g.password}`).toString("base64")}` + })), this._proxyAgentDispatcher = C, w && this._ignoreSslError && (C.options = Object.assign(C.options.requestTls || {}, { rejectUnauthorized: !1 - })), B; + })), C; } - _getUserAgentWithOrchestrationId(w) { - const l = w || "actions/http-client", B = process.env.ACTIONS_ORCHESTRATION_ID; - if (B) { - const p = B.replace(/[^a-z0-9_.-]/gi, "_"); - return `${l} actions_orchestration_id/${p}`; + _getUserAgentWithOrchestrationId(p) { + const g = p || "actions/http-client", C = process.env.ACTIONS_ORCHESTRATION_ID; + if (C) { + const w = C.replace(/[^a-z0-9_.-]/gi, "_"); + return `${g} actions_orchestration_id/${w}`; } - return l; + return g; } - _performExponentialBackoff(w) { + _performExponentialBackoff(p) { return s(this, void 0, void 0, function* () { - w = Math.min(y, w); - const l = b * Math.pow(2, w); - return new Promise((B) => setTimeout(() => B(), l)); + p = Math.min(y, p); + const g = b * Math.pow(2, p); + return new Promise((C) => setTimeout(() => C(), g)); }); } - _processResponse(w, l) { + _processResponse(p, g) { return s(this, void 0, void 0, function* () { - return new Promise((B, p) => s(this, void 0, void 0, function* () { - const I = w.message.statusCode || 0, m = { + return new Promise((C, w) => s(this, void 0, void 0, function* () { + const I = p.message.statusCode || 0, m = { statusCode: I, result: null, headers: {} }; - I === g.NotFound && B(m); + I === l.NotFound && C(m); function D(G, v) { if (typeof v == "string") { const $ = new Date(v); @@ -13743,24 +13743,24 @@ function El() { } return v; } - let N, U; + let U, S; try { - U = yield w.readBody(), U && U.length > 0 && (l && l.deserializeDates ? N = JSON.parse(U, D) : N = JSON.parse(U), m.result = N), m.headers = w.message.headers; + S = yield p.readBody(), S && S.length > 0 && (g && g.deserializeDates ? U = JSON.parse(S, D) : U = JSON.parse(S), m.result = U), m.headers = p.message.headers; } catch { } if (I > 299) { let G; - N && N.message ? G = N.message : U && U.length > 0 ? G = U : G = `Failed request: (${I})`; - const v = new R(G, I); - v.result = m.result, p(v); + U && U.message ? G = U.message : S && S.length > 0 ? G = S : G = `Failed request: (${I})`; + const v = new F(G, I); + v.result = m.result, w(v); } else - B(m); + C(m); })); }); } } - Oe.HttpClient = M; - const d = (Q) => Object.keys(Q).reduce((w, l) => (w[l.toLowerCase()] = Q[l], w), {}); + Oe.HttpClient = N; + const f = (E) => Object.keys(E).reduce((p, g) => (p[g.toLowerCase()] = E[g], p), {}); return Oe; } var ia = El(), Ql = function(e, t, A, s) { @@ -13772,22 +13772,22 @@ var ia = El(), Ql = function(e, t, A, s) { return new (A || (A = Promise))(function(n, o) { function a(i) { try { - g(s.next(i)); + l(s.next(i)); } catch (c) { o(c); } } function u(i) { try { - g(s.throw(i)); + l(s.throw(i)); } catch (c) { o(c); } } - function g(i) { + function l(i) { i.done ? n(i.value) : r(i.value).then(a, u); } - g((s = s.apply(e, t || [])).next()); + l((s = s.apply(e, t || [])).next()); }); }; function hl(e, t) { @@ -13920,15 +13920,15 @@ function Qa(e) { return /%[0-9A-Fa-f]/.test(t) || (t = encodeURI(t).replace(/%5B/g, "[").replace(/%5D/g, "]")), t; }).join(""); } -function Jt(e) { +function Ht(e) { return encodeURIComponent(e).replace(/[!'()*]/g, function(t) { return "%" + t.charCodeAt(0).toString(16).toUpperCase(); }); } -function oA(e, t, A) { - return t = e === "+" || e === "#" ? Qa(t) : Jt(t), A ? Jt(A) + "=" + t : t; +function iA(e, t, A) { + return t = e === "+" || e === "#" ? Qa(t) : Ht(t), A ? Ht(A) + "=" + t : t; } -function Ht(e) { +function Ot(e) { return e != null; } function Ks(e) { @@ -13936,29 +13936,29 @@ function Ks(e) { } function Ml(e, t, A, s) { var r = e[A], n = []; - if (Ht(r) && r !== "") + if (Ot(r) && r !== "") if (typeof r == "string" || typeof r == "number" || typeof r == "bigint" || typeof r == "boolean") r = r.toString(), s && s !== "*" && (r = r.substring(0, parseInt(s, 10))), n.push( - oA(t, r, Ks(t) ? A : "") + iA(t, r, Ks(t) ? A : "") ); else if (s === "*") - Array.isArray(r) ? r.filter(Ht).forEach(function(o) { + Array.isArray(r) ? r.filter(Ot).forEach(function(o) { n.push( - oA(t, o, Ks(t) ? A : "") + iA(t, o, Ks(t) ? A : "") ); }) : Object.keys(r).forEach(function(o) { - Ht(r[o]) && n.push(oA(t, r[o], o)); + Ot(r[o]) && n.push(iA(t, r[o], o)); }); else { const o = []; - Array.isArray(r) ? r.filter(Ht).forEach(function(a) { - o.push(oA(t, a)); + Array.isArray(r) ? r.filter(Ot).forEach(function(a) { + o.push(iA(t, a)); }) : Object.keys(r).forEach(function(a) { - Ht(r[a]) && (o.push(Jt(a)), o.push(oA(t, r[a].toString()))); - }), Ks(t) ? n.push(Jt(A) + "=" + o.join(",")) : o.length !== 0 && n.push(o.join(",")); + Ot(r[a]) && (o.push(Ht(a)), o.push(iA(t, r[a].toString()))); + }), Ks(t) ? n.push(Ht(A) + "=" + o.join(",")) : o.length !== 0 && n.push(o.join(",")); } else - t === ";" ? Ht(r) && n.push(Jt(A)) : r === "" && (t === "&" || t === "?") ? n.push(Jt(A) + "=") : r === "" && n.push(""); + t === ";" ? Ot(r) && n.push(Ht(A)) : r === "" && (t === "&" || t === "?") ? n.push(Ht(A) + "=") : r === "" && n.push(""); return n; } function Ll(e) { @@ -13974,8 +13974,8 @@ function Gl(e, t) { if (r) { let a = ""; const u = []; - if (A.indexOf(r.charAt(0)) !== -1 && (a = r.charAt(0), r = r.substr(1)), r.split(/,/g).forEach(function(g) { - var i = /([^:\*]*)(?::(\d+)|(\*))?/.exec(g); + if (A.indexOf(r.charAt(0)) !== -1 && (a = r.charAt(0), r = r.substr(1)), r.split(/,/g).forEach(function(l) { + var i = /([^:\*]*)(?::(\d+)|(\*))?/.exec(l); u.push(Ml(t, a, i[1], i[2] || i[3])); }), a && a !== "+") { var o = ","; @@ -14007,8 +14007,8 @@ function ha(e) { ).join(",")), A.endsWith("/graphql") && e.mediaType.previews?.length)) { const i = s.accept.match(/(? { - const h = e.mediaType.format ? `.${e.mediaType.format}` : "+json"; - return `application/vnd.github.${c}-preview${h}`; + const Q = e.mediaType.format ? `.${e.mediaType.format}` : "+json"; + return `application/vnd.github.${c}-preview${Q}`; }).join(","); } return ["GET", "HEAD"].includes(t) ? A = Tl(A, u) : "data" in u ? r = u.data : Object.keys(u).length && (r = u), !s["content-type"] && typeof r < "u" && (s["content-type"] = "application/json; charset=utf-8"), ["PATCH", "PUT"].includes(t) && typeof r > "u" && (r = ""), Object.assign( @@ -14029,9 +14029,9 @@ function Ba(e, t) { parse: ha }); } -var Yl = Ba(null, Rl), Ot = {}, Ca; +var Yl = Ba(null, Rl), Pt = {}, Ca; function Jl() { - if (Ca) return Ot; + if (Ca) return Pt; Ca = 1; const e = function() { }; @@ -14042,20 +14042,20 @@ function Jl() { if (typeof a != "string") throw new TypeError("argument header is required and must be a string"); let u = a.indexOf(";"); - const g = u !== -1 ? a.slice(0, u).trim() : a.trim(); - if (s.test(g) === !1) + const l = u !== -1 ? a.slice(0, u).trim() : a.trim(); + if (s.test(l) === !1) throw new TypeError("invalid media type"); const i = { - type: g.toLowerCase(), + type: l.toLowerCase(), parameters: new e() }; if (u === -1) return i; - let c, h, E; - for (t.lastIndex = u; h = t.exec(a); ) { - if (h.index !== u) + let c, Q, h; + for (t.lastIndex = u; Q = t.exec(a); ) { + if (Q.index !== u) throw new TypeError("invalid parameter format"); - u += h[0].length, c = h[1].toLowerCase(), E = h[2], E[0] === '"' && (E = E.slice(1, E.length - 1), A.test(E) && (E = E.replace(A, "$1"))), i.parameters[c] = E; + u += Q[0].length, c = Q[1].toLowerCase(), h = Q[2], h[0] === '"' && (h = h.slice(1, h.length - 1), A.test(h) && (h = h.replace(A, "$1"))), i.parameters[c] = h; } if (u !== a.length) throw new TypeError("invalid parameter format"); @@ -14065,24 +14065,24 @@ function Jl() { if (typeof a != "string") return r; let u = a.indexOf(";"); - const g = u !== -1 ? a.slice(0, u).trim() : a.trim(); - if (s.test(g) === !1) + const l = u !== -1 ? a.slice(0, u).trim() : a.trim(); + if (s.test(l) === !1) return r; const i = { - type: g.toLowerCase(), + type: l.toLowerCase(), parameters: new e() }; if (u === -1) return i; - let c, h, E; - for (t.lastIndex = u; h = t.exec(a); ) { - if (h.index !== u) + let c, Q, h; + for (t.lastIndex = u; Q = t.exec(a); ) { + if (Q.index !== u) return r; - u += h[0].length, c = h[1].toLowerCase(), E = h[2], E[0] === '"' && (E = E.slice(1, E.length - 1), A.test(E) && (E = E.replace(A, "$1"))), i.parameters[c] = E; + u += Q[0].length, c = Q[1].toLowerCase(), h = Q[2], h[0] === '"' && (h = h.slice(1, h.length - 1), A.test(h) && (h = h.replace(A, "$1"))), i.parameters[c] = h; } return u !== a.length ? r : i; } - return Ot.default = { parse: n, safeParse: o }, Ot.parse = n, Ot.safeParse = o, Ot.defaultContentType = r, Ot; + return Pt.default = { parse: n, safeParse: o }, Pt.parse = n, Pt.safeParse = o, Pt.defaultContentType = r, Pt; } var Hl = Jl(); const Ol = /^-?\d+$/, Ia = /^-?\d+n+$/, js = JSON.stringify, da = JSON.parse, Pl = /^-?\d+n$/, _l = /([\[:])?"(-?\d+)n"($|([\\n]|\s)*(\s|[\\n])*[,\}\]])/g, xl = /([\[:])?("-?\d+n+)n("$|"([\\n]|\s)*(\s|[\\n])*[,\}\]])/g, Vl = (e, t, A) => "rawJSON" in JSON ? js( @@ -14107,8 +14107,8 @@ const Ol = /^-?\d+$/, Ia = /^-?\d+n+$/, js = JSON.stringify, da = JSON.parse, Pl (s, r, n, o) => { const a = s[0] === '"'; if (a && !!s.match(Kl)) return s.substring(0, s.length - 1) + 'n"'; - const g = n || o, i = r && (r.length < pa || r.length === pa && r <= fa); - return a || g || i ? s : '"' + s + 'n"'; + const l = n || o, i = r && (r.length < pa || r.length === pa && r <= fa); + return a || l || i ? s : '"' + s + 'n"'; } ); return da( @@ -14162,9 +14162,9 @@ async function ma(e) { "fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing" ); const A = e.request?.log || console, s = e.request?.parseSuccessResponseBody !== !1, r = eu(e.body) || Array.isArray(e.body) ? Vl(e.body) : e.body, n = Object.fromEntries( - Object.entries(e.headers).map(([c, h]) => [ + Object.entries(e.headers).map(([c, Q]) => [ c, - String(h) + String(Q) ]) ); let o; @@ -14180,30 +14180,30 @@ async function ma(e) { ...e.body && { duplex: "half" } }); } catch (c) { - let h = "Unknown Error"; + let Q = "Unknown Error"; if (c instanceof Error) { if (c.name === "AbortError") throw c.status = 500, c; - h = c.message, c.name === "TypeError" && "cause" in c && (c.cause instanceof Error ? h = c.cause.message : typeof c.cause == "string" && (h = c.cause)); + Q = c.message, c.name === "TypeError" && "cause" in c && (c.cause instanceof Error ? Q = c.cause.message : typeof c.cause == "string" && (Q = c.cause)); } - const E = new YA(h, 500, { + const h = new YA(Q, 500, { request: e }); - throw E.cause = c, E; + throw h.cause = c, h; } - const a = o.status, u = o.url, g = {}; - for (const [c, h] of o.headers) - g[c] = h; + const a = o.status, u = o.url, l = {}; + for (const [c, Q] of o.headers) + l[c] = Q; const i = { url: u, status: a, - headers: g, + headers: l, data: "" }; - if ("deprecation" in g) { - const c = g.link && g.link.match(/<([^<>]+)>; rel="deprecation"/), h = c && c.pop(); + if ("deprecation" in l) { + const c = l.link && l.link.match(/<([^<>]+)>; rel="deprecation"/), Q = c && c.pop(); A.warn( - `[@octokit/request] "${e.method} ${e.url}" is deprecated. It is scheduled to be removed on ${g.sunset}${h ? `. See ${h}` : ""}` + `[@octokit/request] "${e.method} ${e.url}" is deprecated. It is scheduled to be removed on ${l.sunset}${Q ? `. See ${Q}` : ""}` ); } if (a === 204 || a === 205) @@ -14265,8 +14265,8 @@ function $s(e, t) { const o = A.merge(r, n); if (!o.request || !o.request.hook) return ma(A.parse(o)); - const a = (u, g) => ma( - A.parse(A.merge(u, g)) + const a = (u, l) => ma( + A.parse(A.merge(u, l)) ); return Object.assign(a, { endpoint: A, @@ -16767,26 +16767,26 @@ const du = "17.0.0", fu = { } }; var pu = fu; -const Ut = /* @__PURE__ */ new Map(); +const Nt = /* @__PURE__ */ new Map(); for (const [e, t] of Object.entries(pu)) for (const [A, s] of Object.entries(t)) { - const [r, n, o] = s, [a, u] = r.split(/ /), g = Object.assign( + const [r, n, o] = s, [a, u] = r.split(/ /), l = Object.assign( { method: a, url: u }, n ); - Ut.has(e) || Ut.set(e, /* @__PURE__ */ new Map()), Ut.get(e).set(A, { + Nt.has(e) || Nt.set(e, /* @__PURE__ */ new Map()), Nt.get(e).set(A, { scope: e, methodName: A, - endpointDefaults: g, + endpointDefaults: l, decorations: o }); } const wu = { has({ scope: e }, t) { - return Ut.get(e).has(t); + return Nt.get(e).has(t); }, getOwnPropertyDescriptor(e, t) { return { @@ -16804,7 +16804,7 @@ const wu = { return delete e.cache[t], !0; }, ownKeys({ scope: e }) { - return [...Ut.get(e).keys()]; + return [...Nt.get(e).keys()]; }, set(e, t, A) { return e.cache[t] = A; @@ -16812,7 +16812,7 @@ const wu = { get({ octokit: e, scope: t, cache: A }, s) { if (A[s]) return A[s]; - const r = Ut.get(t).get(s); + const r = Nt.get(t).get(s); if (!r) return; const { endpointDefaults: n, decorations: o } = r; @@ -16827,7 +16827,7 @@ const wu = { }; function mu(e) { const t = {}; - for (const A of Ut.keys()) + for (const A of Nt.keys()) t[A] = new Proxy({ octokit: e, scope: A, cache: {} }, wu); return t; } @@ -16841,20 +16841,20 @@ function yu(e, t, A, s, r) { [r.mapToData]: void 0 }), n(u); if (r.renamed) { - const [g, i] = r.renamed; + const [l, i] = r.renamed; e.log.warn( - `octokit.${t}.${A}() has been renamed to octokit.${g}.${i}()` + `octokit.${t}.${A}() has been renamed to octokit.${l}.${i}()` ); } if (r.deprecated && e.log.warn(r.deprecated), r.renamedParameters) { - const g = n.endpoint.merge(...a); + const l = n.endpoint.merge(...a); for (const [i, c] of Object.entries( r.renamedParameters )) - i in g && (e.log.warn( + i in l && (e.log.warn( `"${i}" parameter is deprecated for "octokit.${t}.${A}()". Use "${c}" instead` - ), c in g || (g[c] = g[i]), delete g[i]); - return n(g); + ), c in l || (l[c] = l[i]), delete l[i]); + return n(l); } return n(...a); } @@ -16887,14 +16887,14 @@ function rn(e, t, A) { async next() { if (!a) return { done: !0 }; try { - const u = await r({ method: n, url: a, headers: o }), g = bu(u); - if (a = ((g.headers.link || "").match( + const u = await r({ method: n, url: a, headers: o }), l = bu(u); + if (a = ((l.headers.link || "").match( /<([^<>]+)>;\s*rel="next"/ - ) || [])[1], !a && "total_commits" in g.data) { - const i = new URL(g.url), c = i.searchParams, h = parseInt(c.get("page") || "1", 10), E = parseInt(c.get("per_page") || "250", 10); - h * E < g.data.total_commits && (c.set("page", String(h + 1)), a = i.toString()); + ) || [])[1], !a && "total_commits" in l.data) { + const i = new URL(l.url), c = i.searchParams, Q = parseInt(c.get("page") || "1", 10), h = parseInt(c.get("per_page") || "250", 10); + Q * h < l.data.total_commits && (c.set("page", String(Q + 1)), a = i.toString()); } - return { value: g }; + return { value: l }; } catch (u) { if (u.status !== 409) throw u; return a = "", { @@ -17069,66 +17069,66 @@ tt.defaultOptions = function(e) { function Mu(e) { return e.length; } -function iA(e, t) { +function pt(e, t) { const A = t || {}, s = (A.align || []).concat(), r = A.stringLength || Mu, n = [], o = [], a = [], u = []; - let g = 0, i = -1; + let l = 0, i = -1; for (; ++i < e.length; ) { - const f = [], y = []; + const d = [], y = []; let b = -1; - for (e[i].length > g && (g = e[i].length); ++b < e[i].length; ) { - const R = Lu(e[i][b]); + for (e[i].length > l && (l = e[i].length); ++b < e[i].length; ) { + const F = Lu(e[i][b]); if (A.alignDelimiters !== !1) { - const S = r(R); - y[b] = S, (u[b] === void 0 || S > u[b]) && (u[b] = S); + const M = r(F); + y[b] = M, (u[b] === void 0 || M > u[b]) && (u[b] = M); } - f.push(R); + d.push(F); } - o[i] = f, a[i] = y; + o[i] = d, a[i] = y; } let c = -1; if (typeof s == "object" && "length" in s) - for (; ++c < g; ) + for (; ++c < l; ) n[c] = Ya(s[c]); else { - const f = Ya(s); - for (; ++c < g; ) - n[c] = f; + const d = Ya(s); + for (; ++c < l; ) + n[c] = d; } c = -1; - const h = [], E = []; - for (; ++c < g; ) { - const f = n[c]; + const Q = [], h = []; + for (; ++c < l; ) { + const d = n[c]; let y = "", b = ""; - f === 99 ? (y = ":", b = ":") : f === 108 ? y = ":" : f === 114 && (b = ":"); - let R = A.alignDelimiters === !1 ? 1 : Math.max( + d === 99 ? (y = ":", b = ":") : d === 108 ? y = ":" : d === 114 && (b = ":"); + let F = A.alignDelimiters === !1 ? 1 : Math.max( 1, u[c] - y.length - b.length ); - const S = y + "-".repeat(R) + b; - A.alignDelimiters !== !1 && (R = y.length + R + b.length, R > u[c] && (u[c] = R), E[c] = R), h[c] = S; + const M = y + "-".repeat(F) + b; + A.alignDelimiters !== !1 && (F = y.length + F + b.length, F > u[c] && (u[c] = F), h[c] = F), Q[c] = M; } - o.splice(1, 0, h), a.splice(1, 0, E), i = -1; - const C = []; + o.splice(1, 0, Q), a.splice(1, 0, h), i = -1; + const B = []; for (; ++i < o.length; ) { - const f = o[i], y = a[i]; + const d = o[i], y = a[i]; c = -1; const b = []; - for (; ++c < g; ) { - const R = f[c] || ""; - let S = "", L = ""; + for (; ++c < l; ) { + const F = d[c] || ""; + let M = "", L = ""; if (A.alignDelimiters !== !1) { - const M = u[c] - (y[c] || 0), d = n[c]; - d === 114 ? S = " ".repeat(M) : d === 99 ? M % 2 ? (S = " ".repeat(M / 2 + 0.5), L = " ".repeat(M / 2 - 0.5)) : (S = " ".repeat(M / 2), L = S) : L = " ".repeat(M); + const N = u[c] - (y[c] || 0), f = n[c]; + f === 114 ? M = " ".repeat(N) : f === 99 ? N % 2 ? (M = " ".repeat(N / 2 + 0.5), L = " ".repeat(N / 2 - 0.5)) : (M = " ".repeat(N / 2), L = M) : L = " ".repeat(N); } A.delimiterStart !== !1 && !c && b.push("|"), A.padding !== !1 && // Don’t add the opening space if we’re not aligning and the cell is // empty: there will be a closing space. - !(A.alignDelimiters === !1 && R === "") && (A.delimiterStart !== !1 || c) && b.push(" "), A.alignDelimiters !== !1 && b.push(S), b.push(R), A.alignDelimiters !== !1 && b.push(L), A.padding !== !1 && b.push(" "), (A.delimiterEnd !== !1 || c !== g - 1) && b.push("|"); + !(A.alignDelimiters === !1 && F === "") && (A.delimiterStart !== !1 || c) && b.push(" "), A.alignDelimiters !== !1 && b.push(M), b.push(F), A.alignDelimiters !== !1 && b.push(L), A.padding !== !1 && b.push(" "), (A.delimiterEnd !== !1 || c !== l - 1) && b.push("|"); } - C.push( + B.push( A.delimiterEnd === !1 ? b.join("").replace(/ +$/, "") : b.join("") ); } - return C.join(` + return B.join(` `); } function Lu(e) { @@ -17168,12 +17168,12 @@ function Ha(e, t, A) { r && (s = r[1].length); var n = "(\\r\\n|\\r|\\n).{0," + s + "}", o = new RegExp(n, "g"); t && (e = e.slice(1)); - var a = A.newline, u = A.trimLeadingNewline, g = A.trimTrailingNewline, i = typeof a == "string", c = e.length, h = e.map(function(E, C) { - return E = E.replace(o, "$1"), C === 0 && u && (E = E.replace(Yu, "")), C === c - 1 && g && (E = E.replace(Ju, "")), i && (E = E.replace(/\r\n|\n|\r/g, function(f) { + var a = A.newline, u = A.trimLeadingNewline, l = A.trimTrailingNewline, i = typeof a == "string", c = e.length, Q = e.map(function(h, B) { + return h = h.replace(o, "$1"), B === 0 && u && (h = h.replace(Yu, "")), B === c - 1 && l && (h = h.replace(Ju, "")), i && (h = h.replace(/\r\n|\n|\r/g, function(d) { return a; - })), E; + })), h; }); - return h; + return Q; } function _u(e, t) { for (var A = "", s = 0, r = e.length; s < r; s++) @@ -17189,11 +17189,11 @@ function Oa(e) { for (var o = [], a = 1; a < arguments.length; a++) o[a - 1] = arguments[a]; if (xu(n)) { - var u = n, g = (o[0] === s || o[0] === pt) && Pu.test(u[0]) && Hu.test(u[1]), i = g ? A : t, c = i.get(u); - if (c || (c = Ha(u, g, e), i.set(u, c)), o.length === 0) + var u = n, l = (o[0] === s || o[0] === wt) && Pu.test(u[0]) && Hu.test(u[1]), i = l ? A : t, c = i.get(u); + if (c || (c = Ha(u, l, e), i.set(u, c)), o.length === 0) return c[0]; - var h = _u(c, g ? o.slice(1) : o); - return h; + var Q = _u(c, l ? o.slice(1) : o); + return Q; } else return Oa(an(an({}, e), n || {})); } @@ -17204,16 +17204,16 @@ function Oa(e) { }); return r; } -var pt = Oa({ +var wt = Oa({ trimLeadingNewline: !0, trimTrailingNewline: !0 }); if (typeof module < "u") try { - module.exports = pt, Object.defineProperty(pt, "__esModule", { value: !0 }), pt.default = pt, pt.outdent = pt; + module.exports = wt, Object.defineProperty(wt, "__esModule", { value: !0 }), wt.default = wt, wt.outdent = wt; } catch { } -var Pa = typeof global == "object" && global && global.Object === Object && global, Vu = typeof self == "object" && self && self.Object === Object && self, ht = Pa || Vu || Function("return this")(), Dt = ht.Symbol, _a = Object.prototype, Wu = _a.hasOwnProperty, qu = _a.toString, aA = Dt ? Dt.toStringTag : void 0; +var Pa = typeof global == "object" && global && global.Object === Object && global, Vu = typeof self == "object" && self && self.Object === Object && self, ht = Pa || Vu || Function("return this")(), bt = ht.Symbol, _a = Object.prototype, Wu = _a.hasOwnProperty, qu = _a.toString, aA = bt ? bt.toStringTag : void 0; function zu(e) { var t = Wu.call(e, aA), A = e[aA]; try { @@ -17228,23 +17228,23 @@ var Zu = Object.prototype, Ku = Zu.toString; function ju(e) { return Ku.call(e); } -var Xu = "[object Null]", $u = "[object Undefined]", xa = Dt ? Dt.toStringTag : void 0; -function Pt(e) { +var Xu = "[object Null]", $u = "[object Undefined]", xa = bt ? bt.toStringTag : void 0; +function _t(e) { return e == null ? e === void 0 ? $u : Xu : xa && xa in Object(e) ? zu(e) : ju(e); } -function _t(e) { +function xt(e) { return e != null && typeof e == "object"; } var eE = "[object Symbol]"; function PA(e) { - return typeof e == "symbol" || _t(e) && Pt(e) == eE; + return typeof e == "symbol" || xt(e) && _t(e) == eE; } function tE(e, t) { for (var A = -1, s = e == null ? 0 : e.length, r = Array(s); ++A < s; ) r[A] = t(e[A], A, e); return r; } -var Bt = Array.isArray, Va = Dt ? Dt.prototype : void 0, Wa = Va ? Va.toString : void 0; +var Bt = Array.isArray, Va = bt ? bt.prototype : void 0, Wa = Va ? Va.toString : void 0; function qa(e) { if (typeof e == "string") return e; @@ -17306,7 +17306,7 @@ var QE = "[object AsyncFunction]", hE = "[object Function]", BE = "[object Gener function ja(e) { if (!cA(e)) return !1; - var t = Pt(e); + var t = _t(e); return t == hE || t == BE || t == QE || t == CE; } var cn = ht["__core-js_shared__"], Xa = (function() { @@ -17317,7 +17317,7 @@ function IE(e) { return !!Xa && Xa in e; } var dE = Function.prototype, fE = dE.toString; -function Nt(e) { +function Mt(e) { if (e != null) { try { return fE.call(e); @@ -17337,16 +17337,16 @@ function kE(e) { if (!cA(e) || IE(e)) return !1; var t = ja(e) ? RE : wE; - return t.test(Nt(e)); + return t.test(Mt(e)); } function FE(e, t) { return e?.[t]; } -function xt(e, t) { +function Vt(e, t) { var A = FE(e, t); return kE(A) ? A : void 0; } -var gn = xt(ht, "WeakMap"), TE = 9007199254740991, SE = /^(?:0|[1-9]\d*)$/; +var gn = Vt(ht, "WeakMap"), TE = 9007199254740991, SE = /^(?:0|[1-9]\d*)$/; function $a(e, t) { var A = typeof e; return t = t ?? TE, !!t && (A == "number" || A != "symbol" && SE.test(e)) && e > -1 && e % 1 == 0 && e < t; @@ -17373,12 +17373,12 @@ function LE(e, t) { } var GE = "[object Arguments]"; function Ac(e) { - return _t(e) && Pt(e) == GE; + return xt(e) && _t(e) == GE; } var rc = Object.prototype, vE = rc.hasOwnProperty, YE = rc.propertyIsEnumerable, sc = Ac(/* @__PURE__ */ (function() { return arguments; })()) ? Ac : function(e) { - return _t(e) && vE.call(e, "callee") && !YE.call(e, "callee"); + return xt(e) && vE.call(e, "callee") && !YE.call(e, "callee"); }; function JE() { return !1; @@ -17386,7 +17386,7 @@ function JE() { var nc = typeof exports == "object" && exports && !exports.nodeType && exports, oc = nc && typeof module == "object" && module && !module.nodeType && module, HE = oc && oc.exports === nc, ic = HE ? ht.Buffer : void 0, OE = ic ? ic.isBuffer : void 0, un = OE || JE, PE = "[object Arguments]", _E = "[object Array]", xE = "[object Boolean]", VE = "[object Date]", WE = "[object Error]", qE = "[object Function]", zE = "[object Map]", ZE = "[object Number]", KE = "[object Object]", jE = "[object RegExp]", XE = "[object Set]", $E = "[object String]", eQ = "[object WeakMap]", tQ = "[object ArrayBuffer]", AQ = "[object DataView]", rQ = "[object Float32Array]", sQ = "[object Float64Array]", nQ = "[object Int8Array]", oQ = "[object Int16Array]", iQ = "[object Int32Array]", aQ = "[object Uint8Array]", cQ = "[object Uint8ClampedArray]", gQ = "[object Uint16Array]", lQ = "[object Uint32Array]", Pe = {}; Pe[rQ] = Pe[sQ] = Pe[nQ] = Pe[oQ] = Pe[iQ] = Pe[aQ] = Pe[cQ] = Pe[gQ] = Pe[lQ] = !0, Pe[PE] = Pe[_E] = Pe[tQ] = Pe[xE] = Pe[AQ] = Pe[VE] = Pe[WE] = Pe[qE] = Pe[zE] = Pe[ZE] = Pe[KE] = Pe[jE] = Pe[XE] = Pe[$E] = Pe[eQ] = !1; function uQ(e) { - return _t(e) && ln(e.length) && !!Pe[Pt(e)]; + return xt(e) && ln(e.length) && !!Pe[_t(e)]; } function EQ(e) { return function(t) { @@ -17402,12 +17402,12 @@ var ac = typeof exports == "object" && exports && !exports.nodeType && exports, })(), gc = cc && cc.isTypedArray, lc = gc ? EQ(gc) : uQ, hQ = Object.prototype, BQ = hQ.hasOwnProperty; function CQ(e, t) { var A = Bt(e), s = !A && sc(e), r = !A && !s && un(e), n = !A && !s && !r && lc(e), o = A || s || r || n, a = o ? LE(e.length, String) : [], u = a.length; - for (var g in e) - BQ.call(e, g) && !(o && // Safari 9 has enumerable `arguments.length` in strict mode. - (g == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. - r && (g == "offset" || g == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. - n && (g == "buffer" || g == "byteLength" || g == "byteOffset") || // Skip index properties. - $a(g, u))) && a.push(g); + for (var l in e) + BQ.call(e, l) && !(o && // Safari 9 has enumerable `arguments.length` in strict mode. + (l == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. + r && (l == "offset" || l == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + n && (l == "buffer" || l == "byteLength" || l == "byteOffset") || // Skip index properties. + $a(l, u))) && a.push(l); return a; } function IQ(e, t) { @@ -17434,7 +17434,7 @@ function hn(e, t) { var A = typeof e; return A == "number" || A == "symbol" || A == "boolean" || e == null || PA(e) ? !0 : yQ.test(e) || !mQ.test(e) || t != null && e in Object(t); } -var lA = xt(Object, "create"); +var lA = Vt(Object, "create"); function DQ() { this.__data__ = lA ? lA(null) : {}, this.size = 0; } @@ -17461,14 +17461,14 @@ function LQ(e, t) { var A = this.__data__; return this.size += this.has(e) ? 0 : 1, A[e] = lA && t === void 0 ? MQ : t, this; } -function Mt(e) { +function Lt(e) { var t = -1, A = e == null ? 0 : e.length; for (this.clear(); ++t < A; ) { var s = e[t]; this.set(s[0], s[1]); } } -Mt.prototype.clear = DQ, Mt.prototype.delete = bQ, Mt.prototype.get = TQ, Mt.prototype.has = NQ, Mt.prototype.set = LQ; +Lt.prototype.clear = DQ, Lt.prototype.delete = bQ, Lt.prototype.get = TQ, Lt.prototype.has = NQ, Lt.prototype.set = LQ; function GQ() { this.__data__ = [], this.size = 0; } @@ -17497,20 +17497,20 @@ function PQ(e, t) { var A = this.__data__, s = _A(A, e); return s < 0 ? (++this.size, A.push([e, t])) : A[s][1] = t, this; } -function wt(e) { +function mt(e) { var t = -1, A = e == null ? 0 : e.length; for (this.clear(); ++t < A; ) { var s = e[t]; this.set(s[0], s[1]); } } -wt.prototype.clear = GQ, wt.prototype.delete = JQ, wt.prototype.get = HQ, wt.prototype.has = OQ, wt.prototype.set = PQ; -var uA = xt(ht, "Map"); +mt.prototype.clear = GQ, mt.prototype.delete = JQ, mt.prototype.get = HQ, mt.prototype.has = OQ, mt.prototype.set = PQ; +var uA = Vt(ht, "Map"); function _Q() { this.size = 0, this.__data__ = { - hash: new Mt(), - map: new (uA || wt)(), - string: new Mt() + hash: new Lt(), + map: new (uA || mt)(), + string: new Lt() }; } function xQ(e) { @@ -17535,14 +17535,14 @@ function zQ(e, t) { var A = xA(this, e), s = A.size; return A.set(e, t), this.size += A.size == s ? 0 : 1, this; } -function mt(e) { +function yt(e) { var t = -1, A = e == null ? 0 : e.length; for (this.clear(); ++t < A; ) { var s = e[t]; this.set(s[0], s[1]); } } -mt.prototype.clear = _Q, mt.prototype.delete = VQ, mt.prototype.get = WQ, mt.prototype.has = qQ, mt.prototype.set = zQ; +yt.prototype.clear = _Q, yt.prototype.delete = VQ, yt.prototype.get = WQ, yt.prototype.has = qQ, yt.prototype.set = zQ; var ZQ = "Expected a function"; function Bn(e, t) { if (typeof e != "function" || t != null && typeof t != "function") @@ -17554,9 +17554,9 @@ function Bn(e, t) { var o = e.apply(this, s); return A.cache = n.set(r, o) || n, o; }; - return A.cache = new (Bn.Cache || mt)(), A; + return A.cache = new (Bn.Cache || yt)(), A; } -Bn.Cache = mt; +Bn.Cache = yt; var KQ = 500; function jQ(e) { var t = Bn(e, function(s) { @@ -17609,7 +17609,7 @@ function nh(e) { }; } function oh() { - this.__data__ = new wt(), this.size = 0; + this.__data__ = new mt(), this.size = 0; } function ih(e) { var t = this.__data__, A = t.delete(e); @@ -17624,19 +17624,19 @@ function ch(e) { var gh = 200; function lh(e, t) { var A = this.__data__; - if (A instanceof wt) { + if (A instanceof mt) { var s = A.__data__; if (!uA || s.length < gh - 1) return s.push([e, t]), this.size = ++A.size, this; - A = this.__data__ = new mt(s); + A = this.__data__ = new yt(s); } return A.set(e, t), this.size = A.size, this; } -function yt(e) { - var t = this.__data__ = new wt(e); +function Dt(e) { + var t = this.__data__ = new mt(e); this.size = t.size; } -yt.prototype.clear = oh, yt.prototype.delete = ih, yt.prototype.get = ah, yt.prototype.has = ch, yt.prototype.set = lh; +Dt.prototype.clear = oh, Dt.prototype.delete = ih, Dt.prototype.get = ah, Dt.prototype.has = ch, Dt.prototype.set = lh; function uh(e, t) { for (var A = -1, s = e == null ? 0 : e.length, r = 0, n = []; ++A < s; ) { var o = e[A]; @@ -17659,9 +17659,9 @@ function Ch(e, t, A) { function hc(e) { return Ch(e, Qn, Bh); } -var In = xt(ht, "DataView"), dn = xt(ht, "Promise"), fn = xt(ht, "Set"), Bc = "[object Map]", Ih = "[object Object]", Cc = "[object Promise]", Ic = "[object Set]", dc = "[object WeakMap]", fc = "[object DataView]", dh = Nt(In), fh = Nt(uA), ph = Nt(dn), wh = Nt(fn), mh = Nt(gn), bt = Pt; -(In && bt(new In(new ArrayBuffer(1))) != fc || uA && bt(new uA()) != Bc || dn && bt(dn.resolve()) != Cc || fn && bt(new fn()) != Ic || gn && bt(new gn()) != dc) && (bt = function(e) { - var t = Pt(e), A = t == Ih ? e.constructor : void 0, s = A ? Nt(A) : ""; +var In = Vt(ht, "DataView"), dn = Vt(ht, "Promise"), fn = Vt(ht, "Set"), Bc = "[object Map]", Ih = "[object Object]", Cc = "[object Promise]", Ic = "[object Set]", dc = "[object WeakMap]", fc = "[object DataView]", dh = Mt(In), fh = Mt(uA), ph = Mt(dn), wh = Mt(fn), mh = Mt(gn), Rt = _t; +(In && Rt(new In(new ArrayBuffer(1))) != fc || uA && Rt(new uA()) != Bc || dn && Rt(dn.resolve()) != Cc || fn && Rt(new fn()) != Ic || gn && Rt(new gn()) != dc) && (Rt = function(e) { + var t = _t(e), A = t == Ih ? e.constructor : void 0, s = A ? Mt(A) : ""; if (s) switch (s) { case dh: @@ -17686,7 +17686,7 @@ function bh(e) { } function WA(e) { var t = -1, A = e == null ? 0 : e.length; - for (this.__data__ = new mt(); ++t < A; ) + for (this.__data__ = new yt(); ++t < A; ) this.add(e[t]); } WA.prototype.add = WA.prototype.push = Dh, WA.prototype.has = bh; @@ -17704,34 +17704,34 @@ function wc(e, t, A, s, r, n) { var o = A & Fh, a = e.length, u = t.length; if (a != u && !(o && u > a)) return !1; - var g = n.get(e), i = n.get(t); - if (g && i) - return g == t && i == e; - var c = -1, h = !0, E = A & Th ? new WA() : void 0; + var l = n.get(e), i = n.get(t); + if (l && i) + return l == t && i == e; + var c = -1, Q = !0, h = A & Th ? new WA() : void 0; for (n.set(e, t), n.set(t, e); ++c < a; ) { - var C = e[c], f = t[c]; + var B = e[c], d = t[c]; if (s) - var y = o ? s(f, C, c, t, e, n) : s(C, f, c, e, t, n); + var y = o ? s(d, B, c, t, e, n) : s(B, d, c, e, t, n); if (y !== void 0) { if (y) continue; - h = !1; + Q = !1; break; } - if (E) { - if (!Rh(t, function(b, R) { - if (!kh(E, R) && (C === b || r(C, b, A, s, n))) - return E.push(R); + if (h) { + if (!Rh(t, function(b, F) { + if (!kh(h, F) && (B === b || r(B, b, A, s, n))) + return h.push(F); })) { - h = !1; + Q = !1; break; } - } else if (!(C === f || r(C, f, A, s, n))) { - h = !1; + } else if (!(B === d || r(B, d, A, s, n))) { + Q = !1; break; } } - return n.delete(e), n.delete(t), h; + return n.delete(e), n.delete(t), Q; } function Sh(e) { var t = -1, A = Array(e.size); @@ -17745,7 +17745,7 @@ function Uh(e) { A[++t] = s; }), A; } -var Nh = 1, Mh = 2, Lh = "[object Boolean]", Gh = "[object Date]", vh = "[object Error]", Yh = "[object Map]", Jh = "[object Number]", Hh = "[object RegExp]", Oh = "[object Set]", Ph = "[object String]", _h = "[object Symbol]", xh = "[object ArrayBuffer]", Vh = "[object DataView]", mc = Dt ? Dt.prototype : void 0, pn = mc ? mc.valueOf : void 0; +var Nh = 1, Mh = 2, Lh = "[object Boolean]", Gh = "[object Date]", vh = "[object Error]", Yh = "[object Map]", Jh = "[object Number]", Hh = "[object RegExp]", Oh = "[object Set]", Ph = "[object String]", _h = "[object Symbol]", xh = "[object ArrayBuffer]", Vh = "[object DataView]", mc = bt ? bt.prototype : void 0, pn = mc ? mc.valueOf : void 0; function Wh(e, t, A, s, r, n, o) { switch (A) { case Vh: @@ -17769,9 +17769,9 @@ function Wh(e, t, A, s, r, n, o) { var u = s & Nh; if (a || (a = Uh), e.size != t.size && !u) return !1; - var g = o.get(e); - if (g) - return g == t; + var l = o.get(e); + if (l) + return l == t; s |= Mh, o.set(e, t); var i = wc(a(e), a(t), s, r, n, o); return o.delete(e), i; @@ -17783,59 +17783,59 @@ function Wh(e, t, A, s, r, n, o) { } var qh = 1, zh = Object.prototype, Zh = zh.hasOwnProperty; function Kh(e, t, A, s, r, n) { - var o = A & qh, a = hc(e), u = a.length, g = hc(t), i = g.length; + var o = A & qh, a = hc(e), u = a.length, l = hc(t), i = l.length; if (u != i && !o) return !1; for (var c = u; c--; ) { - var h = a[c]; - if (!(o ? h in t : Zh.call(t, h))) + var Q = a[c]; + if (!(o ? Q in t : Zh.call(t, Q))) return !1; } - var E = n.get(e), C = n.get(t); - if (E && C) - return E == t && C == e; - var f = !0; + var h = n.get(e), B = n.get(t); + if (h && B) + return h == t && B == e; + var d = !0; n.set(e, t), n.set(t, e); for (var y = o; ++c < u; ) { - h = a[c]; - var b = e[h], R = t[h]; + Q = a[c]; + var b = e[Q], F = t[Q]; if (s) - var S = o ? s(R, b, h, t, e, n) : s(b, R, h, e, t, n); - if (!(S === void 0 ? b === R || r(b, R, A, s, n) : S)) { - f = !1; + var M = o ? s(F, b, Q, t, e, n) : s(b, F, Q, e, t, n); + if (!(M === void 0 ? b === F || r(b, F, A, s, n) : M)) { + d = !1; break; } - y || (y = h == "constructor"); + y || (y = Q == "constructor"); } - if (f && !y) { - var L = e.constructor, M = t.constructor; - L != M && "constructor" in e && "constructor" in t && !(typeof L == "function" && L instanceof L && typeof M == "function" && M instanceof M) && (f = !1); + if (d && !y) { + var L = e.constructor, N = t.constructor; + L != N && "constructor" in e && "constructor" in t && !(typeof L == "function" && L instanceof L && typeof N == "function" && N instanceof N) && (d = !1); } - return n.delete(e), n.delete(t), f; + return n.delete(e), n.delete(t), d; } var jh = 1, yc = "[object Arguments]", Dc = "[object Array]", qA = "[object Object]", Xh = Object.prototype, bc = Xh.hasOwnProperty; function $h(e, t, A, s, r, n) { - var o = Bt(e), a = Bt(t), u = o ? Dc : bt(e), g = a ? Dc : bt(t); - u = u == yc ? qA : u, g = g == yc ? qA : g; - var i = u == qA, c = g == qA, h = u == g; - if (h && un(e)) { + var o = Bt(e), a = Bt(t), u = o ? Dc : Rt(e), l = a ? Dc : Rt(t); + u = u == yc ? qA : u, l = l == yc ? qA : l; + var i = u == qA, c = l == qA, Q = u == l; + if (Q && un(e)) { if (!un(t)) return !1; o = !0, i = !1; } - if (h && !i) - return n || (n = new yt()), o || lc(e) ? wc(e, t, A, s, r, n) : Wh(e, t, u, A, s, r, n); + if (Q && !i) + return n || (n = new Dt()), o || lc(e) ? wc(e, t, A, s, r, n) : Wh(e, t, u, A, s, r, n); if (!(A & jh)) { - var E = i && bc.call(e, "__wrapped__"), C = c && bc.call(t, "__wrapped__"); - if (E || C) { - var f = E ? e.value() : e, y = C ? t.value() : t; - return n || (n = new yt()), r(f, y, A, s, n); + var h = i && bc.call(e, "__wrapped__"), B = c && bc.call(t, "__wrapped__"); + if (h || B) { + var d = h ? e.value() : e, y = B ? t.value() : t; + return n || (n = new Dt()), r(d, y, A, s, n); } } - return h ? (n || (n = new yt()), Kh(e, t, A, s, r, n)) : !1; + return Q ? (n || (n = new Dt()), Kh(e, t, A, s, r, n)) : !1; } function wn(e, t, A, s, r) { - return e === t ? !0 : e == null || t == null || !_t(e) && !_t(t) ? e !== e && t !== t : $h(e, t, A, s, wn, r); + return e === t ? !0 : e == null || t == null || !xt(e) && !xt(t) ? e !== e && t !== t : $h(e, t, A, s, wn, r); } var eB = 1, tB = 2; function AB(e, t, A, s) { @@ -17849,13 +17849,13 @@ function AB(e, t, A, s) { } for (; ++r < n; ) { o = A[r]; - var a = o[0], u = e[a], g = o[1]; + var a = o[0], u = e[a], l = o[1]; if (o[2]) { if (u === void 0 && !(a in e)) return !1; } else { - var i = new yt(), c; - if (!(c === void 0 ? wn(g, u, eB | tB, s, i) : c)) + var i = new Dt(), c; + if (!(c === void 0 ? wn(l, u, eB | tB, s, i) : c)) return !1; } } @@ -17974,8 +17974,8 @@ function mB() { return Tc || (Tc = 1, yn = function(e, t) { if (typeof e != "string") throw new TypeError("Expected a string"); - for (var A = String(e), s = "", r = t ? !!t.extended : !1, n = t ? !!t.globstar : !1, o = !1, a = t && typeof t.flags == "string" ? t.flags : "", u, g = 0, i = A.length; g < i; g++) - switch (u = A[g], u) { + for (var A = String(e), s = "", r = t ? !!t.extended : !1, n = t ? !!t.globstar : !1, o = !1, a = t && typeof t.flags == "string" ? t.flags : "", u, l = 0, i = A.length; l < i; l++) + switch (u = A[l], u) { case "/": case "$": case "^": @@ -18017,14 +18017,14 @@ function mB() { s += "\\" + u; break; case "*": - for (var c = A[g - 1], h = 1; A[g + 1] === "*"; ) - h++, g++; - var E = A[g + 1]; + for (var c = A[l - 1], Q = 1; A[l + 1] === "*"; ) + Q++, l++; + var h = A[l + 1]; if (!n) s += ".*"; else { - var C = h > 1 && (c === "/" || c === void 0) && (E === "/" || E === void 0); - C ? (s += "((?:[^/]*(?:/|$))*)", g++) : s += "([^/]*)"; + var B = Q > 1 && (c === "/" || c === void 0) && (h === "/" || h === void 0); + B ? (s += "((?:[^/]*(?:/|$))*)", l++) : s += "([^/]*)"; } break; default: @@ -18119,11 +18119,11 @@ function kB(e, t, { } = {}) { const a = {}, u = bB(o); vc(a, "head", e, u), vc(a, "base", t, u); - const g = Object.values(a); - Lc(g, A, s); - const [i, c] = Sc(r, g), [h, E] = Fc( + const l = Object.values(a); + Lc(l, A, s); + const [i, c] = Sc(r, l), [Q, h] = Fc( c, - (C) => C.diff && C.diff.size && Math.abs(C.diff.size.delta) < n + (B) => B.diff && B.diff.size && Math.abs(B.diff.size.delta) < n ); return { head: e, @@ -18133,14 +18133,14 @@ function kB(e, t, { tarballSize: zA(e, t, "tarballSize") }, files: { - changed: E, - unchanged: h, + changed: h, + unchanged: Q, hidden: i } }; } -const FB = (e) => e < 0 ? "\u2193" : e > 0 ? "\u2191" : "", EA = ({ delta: e, percent: t }) => e ? t + FB(e) : ""; -function TB({ +const FB = (e) => e < 0 ? "\u2193" : e > 0 ? "\u2191" : "", EA = ({ delta: e, percent: t }) => e ? t + FB(e) : "", TB = 20; +function SB({ headPkgData: e, basePkgData: t, sortBy: A, @@ -18149,128 +18149,179 @@ function TB({ unchangedFiles: n, displaySize: o, ignoreThreshold: a, - stripHash: u + autoCollapse: u, + stripHash: l }) { - const g = kB(e, t, { + const i = kB(e, t, { sortBy: A, sortOrder: s, hideFiles: r, ignoreThreshold: a, - stripHash: u + stripHash: l }); - qs("regressionData", g); - const { changed: i, unchanged: c, hidden: h } = g.files, E = Mc(o), C = Uc(E), f = iA([ - ["File", `Before${C}`, `After${C}`], - ...[ - ...i, - ...n === "show" ? c : [] - ].map((R) => [ - R.label, - R.base && R.base.size ? Ct(E, (S) => et(tt(R.base[S]))) : "\u2014", - R.head && R.head.size ? Ct( - E, - (S) => (R.base && R.base[S] ? JA(EA(R.diff[S])) : "") + et(tt(R.head[S])) - ) : "\u2014" - ]), + qs("regressionData", i); + const { changed: c, unchanged: Q, hidden: h } = i.files, B = Mc(o), d = Uc(B), y = [ + ...c, + ...n === "show" ? Q : [] + ], b = (p) => [ + p.label, + p.base && p.base.size ? Ct(B, (g) => et(tt(p.base[g]))) : "\u2014", + p.head && p.head.size ? Ct( + B, + (g) => (p.base && p.base[g] ? JA(EA(p.diff[g])) : "") + et(tt(p.head[g])) + ) : "\u2014" + ], F = [ [ `${HA("Total")} ${n === "show" ? "" : Ma("_(Includes all files)_")}`, - Ct(E, (R) => et(tt(g.base[R]))), - Ct(E, (R) => JA(EA(g.diff[R])) + et(tt(g.head[R]))) + Ct(B, (p) => et(tt(i.base[p]))), + Ct(B, (p) => JA(EA(i.diff[p])) + et(tt(i.head[p]))) ], [ HA("Tarball size"), - et(tt(g.base.tarballSize)), - JA(EA(g.diff.tarballSize)) + et(tt(g.head.tarballSize)) + et(tt(i.base.tarballSize)), + JA(EA(i.diff.tarballSize)) + et(tt(i.head.tarballSize)) ] - ], { - align: ["", "r", "r"] - }); - let y = ""; - n === "collapse" && c.length > 0 && (y = iA([ - ["File", `Size${C}`], - ...c.map((R) => [ - R.label, - Ct(E, (S) => et(tt(R.base[S]))) + ], M = u && y.length > TB; + let L, N = ""; + if (M) { + L = pt([ + ["File", `Before${d}`, `After${d}`], + ...F + ], { + align: ["", "r", "r"] + }); + const p = pt([ + ["File", `Before${d}`, `After${d}`], + ...y.map(b) + ], { + align: ["", "r", "r"] + }); + N = `
Show files (${y.length} files) + +${p} +
`; + } else + L = pt([ + ["File", `Before${d}`, `After${d}`], + ...y.map(b), + ...F + ], { + align: ["", "r", "r"] + }); + let f = ""; + n === "collapse" && Q.length > 0 && (f = pt([ + ["File", `Size${d}`], + ...Q.map((p) => [ + p.label, + Ct(B, (g) => et(tt(p.base[g]))) ]) ], { align: ["", "r"] - }), y = `
Unchanged files + }), f = `
Unchanged files -${y} +${f}
`); - let b = ""; - return h.length > 0 && (b = iA([ - ["File", `Before${C}`, `After${C}`], - ...h.map((R) => [ - R.label, - R.base && R.base.size ? Ct(E, (S) => et(tt(R.base[S]))) : "\u2014", - R.head && R.head.size ? Ct( - E, - (S) => (R.base && R.base[S] ? JA(EA(R.diff[S])) : "") + et(tt(R.head[S])) + let E = ""; + return h.length > 0 && (E = pt([ + ["File", `Before${d}`, `After${d}`], + ...h.map((p) => [ + p.label, + p.base && p.base.size ? Ct(B, (g) => et(tt(p.base[g]))) : "\u2014", + p.head && p.head.size ? Ct( + B, + (g) => (p.base && p.base[g] ? JA(EA(p.diff[g])) : "") + et(tt(p.head[g])) ) : "\u2014" ]) ], { align: ["", "r", "r"] - }), b = `
Hidden files + }), E = `
Hidden files -${b} -
`), pt` - ### πŸ“Š Package size report   ${EA(g.diff.size) || "No changes"} +${E} +
`), wt` + ### πŸ“Š Package size report   ${EA(i.diff.size) || "No changes"} - ${f} + ${L} + + ${N} - ${y} + ${f} - ${b} + ${E} `; } -function SB({ +const UB = 20; +function NB({ headPkgData: e, hideFiles: t, displaySize: A, sortBy: s, - sortOrder: r + sortOrder: r, + autoCollapse: n }) { - const n = Mc(A), o = Uc(n); + const o = Mc(A), a = Uc(o); Lc(e.files, s, r); - const [a, u] = Sc(t, e.files), g = iA([ - ["File", `Size${o}`], - ...u.map((c) => [ - c.label, - Ct(n, (h) => et(tt(c[h]))) - ]), + const [u, l] = Sc(t, e.files), i = (y) => [ + y.label, + Ct(o, (b) => et(tt(y[b]))) + ], c = [ [ HA("Total"), - Ct(n, (c) => et(tt(e[c]))) + Ct(o, (y) => et(tt(e[y]))) ], [ HA("Tarball size"), et(tt(e.tarballSize)) ] - ], { - align: ["", "r"] - }); - let i = ""; - return a.length > 0 && (i = iA([ - ["File", `Size${o}`], - ...a.map((c) => [ - c.label, - Ct(n, (h) => et(tt(c[h]))) + ], Q = n && l.length > UB; + let h, B = ""; + if (Q) { + h = pt([ + ["File", `Size${a}`], + ...c + ], { + align: ["", "r"] + }); + const y = pt([ + ["File", `Size${a}`], + ...l.map(i) + ], { + align: ["", "r"] + }); + B = `
Show files (${l.length} files) + +${y} +
`; + } else + h = pt([ + ["File", `Size${a}`], + ...l.map(i), + ...c + ], { + align: ["", "r"] + }); + let d = ""; + return u.length > 0 && (d = pt([ + ["File", `Size${a}`], + ...u.map((y) => [ + y.label, + Ct(o, (b) => et(tt(y[b]))) ]) ], { align: ["", "r"] - }), i = `
Hidden files + }), d = `
Hidden files -${i} -
`), pt` +${d} +
`), wt` ### πŸ“Š Package size report - ${g} + ${h} + + ${B} - ${i} + ${d} `; } -async function ct(e, t) { +async function gt(e, t) { let A = "", s = ""; const r = Date.now(), n = await cl(e, null, { ...t, @@ -18291,16 +18342,16 @@ async function ct(e, t) { stderr: s }; } -async function UB(e) { +async function MB(e) { try { - await ct(`git fetch origin ${e} --depth=1`); + await gt(`git fetch origin ${e} --depth=1`); } catch (A) { throw new Error(`Failed to git fetch ${e} ${A.message}`); } - const { exitCode: t } = await ct(`git diff --quiet origin/${e}`, { ignoreReturnCode: !0 }); + const { exitCode: t } = await gt(`git diff --quiet origin/${e}`, { ignoreReturnCode: !0 }); return t !== 0; } -async function NB({ cwd: e } = {}) { +async function LB({ cwd: e } = {}) { dt.existsSync("node_modules") && (Xe("Cleaning node_modules"), await sl(kn.join(e, "node_modules"))); const t = { cwd: e, @@ -18308,13 +18359,13 @@ async function NB({ cwd: e } = {}) { }; let A = ""; dt.existsSync("package-lock.json") ? (Xe("Installing dependencies with npm"), A = "npm ci") : dt.existsSync("yarn.lock") ? (Xe("Installing dependencies with yarn"), A = "yarn install --frozen-lockfile") : dt.existsSync("pnpm-lock.yaml") ? (Xe("Installing dependencies with pnpm"), A = "npx pnpm i --frozen-lockfile") : (Xe("No lock file detected. Installing dependencies with npm"), A = "npm i"); - const { exitCode: s, stdout: r, stderr: n } = await ct(A, t); + const { exitCode: s, stdout: r, stderr: n } = await gt(A, t); if (s > 0) throw new Error(`${n} ${r}`); } -async function MB(e) { - const { exitCode: t } = await ct(`git ls-files --error-unmatch ${e}`, { ignoreReturnCode: !0 }); +async function GB(e) { + const { exitCode: t } = await gt(`git ls-files --error-unmatch ${e}`, { ignoreReturnCode: !0 }); return t === 0; } let Yc = !1; @@ -18324,7 +18375,7 @@ async function Jc({ buildCommand: A }) { const s = process.cwd(); - if (Xe(`Current working directory: ${s}`), e && (Xe(`Checking out ref '${e}'`), await ct(`git checkout -f ${e}`)), A !== "false") { + if (Xe(`Current working directory: ${s}`), e && (Xe(`Checking out ref '${e}'`), await gt(`git checkout -f ${e}`)), A !== "false") { if (!A) { let a; try { @@ -18335,19 +18386,19 @@ async function Jc({ a && a.scripts && a.scripts.build && (Xe("Build script found in package.json"), A = "npm run build"); } if (A) { - await NB({ cwd: s }).catch((u) => { + await LB({ cwd: s }).catch((u) => { throw new Error(`Failed to install dependencies: ${u.message}`); }), Xe(`Running build command: ${A}`); const a = Date.now(); - await ct(A, { cwd: s }).catch((u) => { + await gt(A, { cwd: s }).catch((u) => { throw new Error(`Failed to run build command: ${A} ${u.message}`); }), Xe(`Build completed in ${(Date.now() - a) / 1e3}s`); } } - Yc || (Xe("Installing pkg-size globally"), await ct("npm i -g pkg-size"), Yc = !0), Xe("Getting package size"); - const r = await ct("pkg-size --json", { cwd: s }).catch((a) => { + Yc || (Xe("Installing pkg-size globally"), await gt("npm i -g pkg-size"), Yc = !0), Xe("Getting package size"); + const r = await gt("pkg-size --json", { cwd: s }).catch((a) => { throw new Error(`Failed to determine package size: ${a.message}`); }); ra(JSON.stringify(r, null, 4)); @@ -18360,13 +18411,13 @@ ${u.message}`); }; await Promise.all(n.files.map(async (a) => { n.size += a.size, n.sizeGzip += a.sizeGzip, n.sizeBrotli += a.sizeBrotli; - const u = await MB(a.path); + const u = await GB(a.path); a.isTracked = u, a.label = u ? Su(et(a.path), `${t.repo.html_url}/blob/${t.ref}/${a.path}`) : et(a.path); - })), Xe("Cleaning up"), await ct("git reset --hard"); - const { stdout: o } = await ct("git clean -dfx"); + })), Xe("Cleaning up"), await gt("git reset --hard"); + const { stdout: o } = await gt("git clean -dfx"); return ra(o), n; } -async function LB({ +async function vB({ pr: e, buildCommand: t, commentReport: A, @@ -18376,64 +18427,68 @@ async function LB({ sortBy: o, sortOrder: a, displaySize: u, - ignoreThreshold: g, - stripHash: i + ignoreThreshold: l, + autoCollapse: i, + stripHash: c }) { LA("Build HEAD"); - const c = await Jc({ + const Q = await Jc({ refData: e.head, buildCommand: t }); - if (qs("headPkgData", c), GA(), s === "head-only") - return A !== "false" ? SB({ - headPkgData: c, + if (qs("headPkgData", Q), GA(), s === "head-only") + return A !== "false" ? NB({ + headPkgData: Q, displaySize: u, sortBy: o, sortOrder: a, - hideFiles: n + hideFiles: n, + autoCollapse: i }) : !1; const { ref: h } = e.base; - let E; - return await UB(h) ? (Xe("HEAD is different from BASE. Triggering build."), LA("Build BASE"), E = await Jc({ + let B; + return await MB(h) ? (Xe("HEAD is different from BASE. Triggering build."), LA("Build BASE"), B = await Jc({ checkoutRef: h, refData: e.base, buildCommand: t - }), GA()) : (Xe("HEAD is identical to BASE. Skipping base build."), E = { - ...c, + }), GA()) : (Xe("HEAD is identical to BASE. Skipping base build."), B = { + ...Q, ref: e.base - }), qs("basePkgData", E), A !== "false" ? TB({ - headPkgData: c, - basePkgData: E, + }), qs("basePkgData", B), A !== "false" ? SB({ + headPkgData: Q, + basePkgData: B, displaySize: u, sortBy: o, sortOrder: a, hideFiles: n, unchangedFiles: r, - ignoreThreshold: g, - stripHash: i + ignoreThreshold: l, + autoCollapse: i, + stripHash: c }) : !1; } const Hc = Ma("\u{1F916} This report was automatically generated by [pkg-size-action](https://github.com/pkg-size/action/)"); (async () => { const { GITHUB_TOKEN: e } = process.env; Pc(e, 'Environment variable "GITHUB_TOKEN" not set. Required for accessing and reporting on the PR.'); - const { pull_request: t } = nn.payload, A = await LB({ + const { pull_request: t } = nn.payload, A = await vB({ pr: t, - buildCommand: Qt("build-command"), - commentReport: Qt("comment-report"), - mode: Qt("mode") || "regression", - unchangedFiles: Qt("unchanged-files") || "collapse", - hideFiles: Qt("hide-files"), - sortBy: Qt("sort-by") || "delta", - sortOrder: Qt("sort-order") || "desc", - displaySize: Qt("display-size") || "uncompressed", - ignoreThreshold: Number(Qt("ignore-threshold") || 100), + buildCommand: ct("build-command"), + commentReport: ct("comment-report"), + mode: ct("mode") || "regression", + unchangedFiles: ct("unchanged-files") || "collapse", + hideFiles: ct("hide-files"), + sortBy: ct("sort-by") || "delta", + sortOrder: ct("sort-order") || "desc", + displaySize: ct("display-size") || "uncompressed", + ignoreThreshold: Number(ct("ignore-threshold") || 100), + autoCollapse: ct("auto-collapse") !== "false", stripHash: (() => { - const s = Qt("strip-hash"); + const s = ct("strip-hash"); return s === "false" ? "" : s || "[.-]([0-9a-zA-Z_-]{8,})[.-]"; })() }); - await ct(`git checkout -f ${nn.sha}`), A && (t.head.repo && t.head.repo.full_name !== t.base.repo.full_name ? (LA("\u{1F4CB} Size Report (fork PR \u2014 copy to post as a comment)"), Xe(`${A} + await gt(`git checkout -f ${nn.sha}`), A && (t.head.repo && t.head.repo.full_name !== t.base.repo.full_name ? (LA("\u{1F4CB} Size Report (fork PR \u2014 copy to post as a comment)"), Xe(`${A} ${Hc}`), GA(), zs( `This PR is from a fork. GitHub Actions restricts write access for fork PRs, so the size report could not be posted as a comment automatically. diff --git a/src/index.js b/src/index.js index 6b7532d..40c5c48 100644 --- a/src/index.js +++ b/src/index.js @@ -26,6 +26,7 @@ const COMMENT_SIGNATURE = sub('πŸ€– This report was automatically generated by [ sortOrder: getInput('sort-order') || 'desc', displaySize: getInput('display-size') || 'uncompressed', ignoreThreshold: Number(getInput('ignore-threshold') || 100), + autoCollapse: getInput('auto-collapse') !== 'false', stripHash: (() => { const input = getInput('strip-hash'); if (input === 'false') { diff --git a/src/lib/generate-size-report.js b/src/lib/generate-size-report.js index 6369be9..2c9b2a5 100644 --- a/src/lib/generate-size-report.js +++ b/src/lib/generate-size-report.js @@ -15,6 +15,7 @@ async function generateSizeReport({ sortOrder, displaySize, ignoreThreshold, + autoCollapse, stripHash, }) { log.startGroup('Build HEAD'); @@ -33,6 +34,7 @@ async function generateSizeReport({ sortBy, sortOrder, hideFiles, + autoCollapse, }); } return false; @@ -68,6 +70,7 @@ async function generateSizeReport({ hideFiles, unchangedFiles, ignoreThreshold, + autoCollapse, stripHash, }); } diff --git a/src/report-templates/head-only.js b/src/report-templates/head-only.js index 9bc9651..35baed5 100644 --- a/src/report-templates/head-only.js +++ b/src/report-templates/head-only.js @@ -10,12 +10,15 @@ import { sortFiles, } from './utils.js'; +const AUTO_COLLAPSE_THRESHOLD = 20; + function headOnly({ headPkgData, hideFiles, displaySize, sortBy, sortOrder, + autoCollapse, }) { const displaySizes = parseDisplaySize(displaySize); const sizeHeadingLabel = getSizeLabels(displaySizes); @@ -23,12 +26,12 @@ function headOnly({ sortFiles(headPkgData.files, sortBy, sortOrder); const [hidden, files] = partionHidden(hideFiles, headPkgData.files); - const table = markdownTable([ - ['File', `Size${sizeHeadingLabel}`], - ...files.map(file => [ - file.label, - listSizes(displaySizes, p => c(byteSize(file[p]))), - ]), + const mapFileRow = file => [ + file.label, + listSizes(displaySizes, p => c(byteSize(file[p]))), + ]; + + const totalRows = [ [ strong('Total'), listSizes(displaySizes, p => c(byteSize(headPkgData[p]))), @@ -37,10 +40,38 @@ function headOnly({ strong('Tarball size'), c(byteSize(headPkgData.tarballSize)), ], + ]; + + const shouldAutoCollapse = autoCollapse && files.length > AUTO_COLLAPSE_THRESHOLD; + + let table; + let autoCollapseSection = ''; + + if (shouldAutoCollapse) { + table = markdownTable([ + ['File', `Size${sizeHeadingLabel}`], + ...totalRows, + ], { + align: ['', 'r'], + }); + + const filesTable = markdownTable([ + ['File', `Size${sizeHeadingLabel}`], + ...files.map(mapFileRow), + ], { + align: ['', 'r'], + }); - ], { - align: ['', 'r'], - }); + autoCollapseSection = `
Show files (${files.length} files)\n\n${filesTable}\n
`; + } else { + table = markdownTable([ + ['File', `Size${sizeHeadingLabel}`], + ...files.map(mapFileRow), + ...totalRows, + ], { + align: ['', 'r'], + }); + } let hiddenTable = ''; if (hidden.length > 0) { @@ -62,6 +93,8 @@ function headOnly({ ${table} + ${autoCollapseSection} + ${hiddenTable} `; } diff --git a/src/report-templates/head-only.test.mjs b/src/report-templates/head-only.test.mjs new file mode 100644 index 0000000..4a2352b --- /dev/null +++ b/src/report-templates/head-only.test.mjs @@ -0,0 +1,108 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import headOnly from './head-only.js'; + +function makePkgData(files, totals = {}) { + return { + files: files.map(([path, size = 1000, sizeGzip = 500, sizeBrotli = 400]) => ({ + path, + label: path, + size, + sizeGzip, + sizeBrotli, + })), + size: totals.size ?? files.reduce((sum, [, s = 1000]) => sum + s, 0), + sizeGzip: totals.sizeGzip ?? 500, + sizeBrotli: totals.sizeBrotli ?? 400, + tarballSize: totals.tarballSize ?? 2000, + }; +} + +function makeFiles(count, prefix = 'file') { + return Array.from({ length: count }, (_, i) => [`dist/${prefix}${i}.js`]); +} + +test('head-only: auto-collapse is not triggered when files <= 20', () => { + const headPkgData = makePkgData(makeFiles(20)); + + const output = headOnly({ + headPkgData, + displaySize: 'uncompressed', + sortBy: 'delta', + sortOrder: 'desc', + autoCollapse: true, + }); + + assert.ok(!output.includes('
Show files'), 'Should not auto-collapse when <= 20 files'); + assert.ok(output.includes('**Total**'), 'Total row should be present'); + assert.ok(output.includes('**Tarball size**'), 'Tarball size row should be present'); +}); + +test('head-only: auto-collapse is triggered when files > 20', () => { + const headPkgData = makePkgData(makeFiles(21)); + + const output = headOnly({ + headPkgData, + displaySize: 'uncompressed', + sortBy: 'delta', + sortOrder: 'desc', + autoCollapse: true, + }); + + assert.ok(output.includes('
Show files (21 files)'), 'Should auto-collapse when > 20 files'); + assert.ok(output.includes('**Total**'), 'Total row should always be visible'); + assert.ok(output.includes('**Tarball size**'), 'Tarball size row should always be visible'); +}); + +test('head-only: auto-collapse is not triggered when autoCollapse is false, even with > 20 files', () => { + const headPkgData = makePkgData(makeFiles(25)); + + const output = headOnly({ + headPkgData, + displaySize: 'uncompressed', + sortBy: 'delta', + sortOrder: 'desc', + autoCollapse: false, + }); + + assert.ok(!output.includes('
Show files'), 'Should not auto-collapse when autoCollapse is false'); + assert.ok(output.includes('**Total**'), 'Total row should be present'); + assert.ok(output.includes('**Tarball size**'), 'Tarball size row should be present'); +}); + +test('head-only: total rows appear outside the details section when auto-collapsing', () => { + const headPkgData = makePkgData(makeFiles(21)); + + const output = headOnly({ + headPkgData, + displaySize: 'uncompressed', + sortBy: 'delta', + sortOrder: 'desc', + autoCollapse: true, + }); + + const detailsIndex = output.indexOf('
'); + const totalIndex = output.indexOf('**Total**'); + const tarballIndex = output.indexOf('**Tarball size**'); + + assert.ok(totalIndex < detailsIndex, 'Total row should appear before the collapsed details section'); + assert.ok(tarballIndex < detailsIndex, 'Tarball size row should appear before the collapsed details section'); +}); + +test('head-only: file names appear inside the details section when auto-collapsing', () => { + const headPkgData = makePkgData(makeFiles(21)); + + const output = headOnly({ + headPkgData, + displaySize: 'uncompressed', + sortBy: 'delta', + sortOrder: 'desc', + autoCollapse: true, + }); + + const detailsStart = output.indexOf('
Show files'); + const detailsEnd = output.indexOf('
'); + const detailsContent = output.slice(detailsStart, detailsEnd); + + assert.ok(detailsContent.includes('dist/file0.js'), 'File names should appear inside the details section'); +}); diff --git a/src/report-templates/regression/index.js b/src/report-templates/regression/index.js index 1d05808..7c1efc2 100644 --- a/src/report-templates/regression/index.js +++ b/src/report-templates/regression/index.js @@ -26,6 +26,8 @@ const directionSymbol = (value) => { const formatDelta = ({ delta, percent }) => (delta ? (percent + directionSymbol(delta)) : ''); +const AUTO_COLLAPSE_THRESHOLD = 20; + function generateComment({ headPkgData, basePkgData, @@ -35,6 +37,7 @@ function generateComment({ unchangedFiles, displaySize, ignoreThreshold, + autoCollapse, stripHash, }) { const regressionData = comparePackages(headPkgData, basePkgData, { @@ -51,23 +54,25 @@ function generateComment({ const displaySizes = parseDisplaySize(displaySize); const sizeHeadingLabel = getSizeLabels(displaySizes); - const table = markdownTable([ - ['File', `Before${sizeHeadingLabel}`, `After${sizeHeadingLabel}`], - ...[ - ...changed, - ...(unchangedFiles === 'show' ? unchanged : []), - ].map(file => [ - file.label, - file.base && file.base.size - ? listSizes(displaySizes, p => c(byteSize(file.base[p]))) - : 'β€”', - file.head && file.head.size - ? listSizes( - displaySizes, - p => (file.base && file.base[p] ? sup(formatDelta(file.diff[p])) : '') + c(byteSize(file.head[p])), - ) - : 'β€”', - ]), + const fileRows = [ + ...changed, + ...(unchangedFiles === 'show' ? unchanged : []), + ]; + + const mapFileRow = file => [ + file.label, + file.base && file.base.size + ? listSizes(displaySizes, p => c(byteSize(file.base[p]))) + : 'β€”', + file.head && file.head.size + ? listSizes( + displaySizes, + p => (file.base && file.base[p] ? sup(formatDelta(file.diff[p])) : '') + c(byteSize(file.head[p])), + ) + : 'β€”', + ]; + + const totalRows = [ [ `${strong('Total')} ${(unchangedFiles === 'show' ? '' : sub('_(Includes all files)_'))}`, listSizes(displaySizes, p => c(byteSize(regressionData.base[p]))), @@ -84,9 +89,38 @@ function generateComment({ + c(byteSize(regressionData.head.tarballSize)) ), ], - ], { - align: ['', 'r', 'r'], - }); + ]; + + const shouldAutoCollapse = autoCollapse && fileRows.length > AUTO_COLLAPSE_THRESHOLD; + + let table; + let autoCollapseSection = ''; + + if (shouldAutoCollapse) { + table = markdownTable([ + ['File', `Before${sizeHeadingLabel}`, `After${sizeHeadingLabel}`], + ...totalRows, + ], { + align: ['', 'r', 'r'], + }); + + const filesTable = markdownTable([ + ['File', `Before${sizeHeadingLabel}`, `After${sizeHeadingLabel}`], + ...fileRows.map(mapFileRow), + ], { + align: ['', 'r', 'r'], + }); + + autoCollapseSection = `
Show files (${fileRows.length} files)\n\n${filesTable}\n
`; + } else { + table = markdownTable([ + ['File', `Before${sizeHeadingLabel}`, `After${sizeHeadingLabel}`], + ...fileRows.map(mapFileRow), + ...totalRows, + ], { + align: ['', 'r', 'r'], + }); + } let unchangedTable = ''; if (unchangedFiles === 'collapse' && unchanged.length > 0) { @@ -131,6 +165,8 @@ function generateComment({ ${table} + ${autoCollapseSection} + ${unchangedTable} ${hiddenTable} diff --git a/src/report-templates/regression/index.test.mjs b/src/report-templates/regression/index.test.mjs new file mode 100644 index 0000000..35a6cf6 --- /dev/null +++ b/src/report-templates/regression/index.test.mjs @@ -0,0 +1,129 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import generateComment from './index.js'; + +function makePkgData(files, totals = {}) { + return { + files: files.map(([path, size = 1000, sizeGzip = 500, sizeBrotli = 400]) => ({ + path, + label: path, + size, + sizeGzip, + sizeBrotli, + })), + size: totals.size ?? files.reduce((sum, [, s = 1000]) => sum + s, 0), + sizeGzip: totals.sizeGzip ?? 500, + sizeBrotli: totals.sizeBrotli ?? 400, + tarballSize: totals.tarballSize ?? 2000, + }; +} + +function makeFiles(count, prefix = 'file', sizeDelta = 200) { + return Array.from({ length: count }, (_, i) => [`dist/${prefix}${i}.js`, 1000 + sizeDelta, 500, 400]); +} + +test('regression: auto-collapse is not triggered when file rows <= 20', () => { + const headPkgData = makePkgData(makeFiles(20)); + const basePkgData = makePkgData(makeFiles(20, 'file', 0)); + + const output = generateComment({ + headPkgData, + basePkgData, + displaySize: 'uncompressed', + sortBy: 'delta', + sortOrder: 'desc', + unchangedFiles: 'collapse', + ignoreThreshold: 0, + autoCollapse: true, + }); + + assert.ok(!output.includes('
Show files'), 'Should not auto-collapse when <= 20 rows'); + assert.ok(output.includes('**Total**'), 'Total row should be present'); + assert.ok(output.includes('**Tarball size**'), 'Tarball size row should be present'); +}); + +test('regression: auto-collapse is triggered when file rows > 20', () => { + const headPkgData = makePkgData(makeFiles(21)); + const basePkgData = makePkgData(makeFiles(21, 'file', 0)); + + const output = generateComment({ + headPkgData, + basePkgData, + displaySize: 'uncompressed', + sortBy: 'delta', + sortOrder: 'desc', + unchangedFiles: 'collapse', + ignoreThreshold: 0, + autoCollapse: true, + }); + + assert.ok(output.includes('
Show files (21 files)'), 'Should auto-collapse when > 20 rows'); + assert.ok(output.includes('**Total**'), 'Total row should always be visible'); + assert.ok(output.includes('**Tarball size**'), 'Tarball size row should always be visible'); +}); + +test('regression: auto-collapse is not triggered when autoCollapse is false, even with > 20 rows', () => { + const headPkgData = makePkgData(makeFiles(25)); + const basePkgData = makePkgData(makeFiles(25, 'file', 0)); + + const output = generateComment({ + headPkgData, + basePkgData, + displaySize: 'uncompressed', + sortBy: 'delta', + sortOrder: 'desc', + unchangedFiles: 'collapse', + ignoreThreshold: 0, + autoCollapse: false, + }); + + assert.ok(!output.includes('
Show files'), 'Should not auto-collapse when autoCollapse is false'); + assert.ok(output.includes('**Total**'), 'Total row should be present'); + assert.ok(output.includes('**Tarball size**'), 'Tarball size row should be present'); +}); + +test('regression: total rows appear outside the details section when auto-collapsing', () => { + const headPkgData = makePkgData(makeFiles(21)); + const basePkgData = makePkgData(makeFiles(21, 'file', 0)); + + const output = generateComment({ + headPkgData, + basePkgData, + displaySize: 'uncompressed', + sortBy: 'delta', + sortOrder: 'desc', + unchangedFiles: 'collapse', + ignoreThreshold: 0, + autoCollapse: true, + }); + + // The total rows should appear before the
section + const detailsIndex = output.indexOf('
'); + const totalIndex = output.indexOf('**Total**'); + const tarballIndex = output.indexOf('**Tarball size**'); + + assert.ok(totalIndex < detailsIndex, 'Total row should appear before the collapsed details section'); + assert.ok(tarballIndex < detailsIndex, 'Tarball size row should appear before the collapsed details section'); +}); + +test('regression: file names appear inside the details section when auto-collapsing', () => { + const headPkgData = makePkgData(makeFiles(21)); + const basePkgData = makePkgData(makeFiles(21, 'file', 0)); + + const output = generateComment({ + headPkgData, + basePkgData, + displaySize: 'uncompressed', + sortBy: 'delta', + sortOrder: 'desc', + unchangedFiles: 'collapse', + ignoreThreshold: 0, + autoCollapse: true, + }); + + const detailsStart = output.indexOf('
Show files'); + const detailsEnd = output.indexOf('
'); + const detailsContent = output.slice(detailsStart, detailsEnd); + + assert.ok(detailsContent.includes('dist/file0.js'), 'File names should appear inside the details section'); +});