From e7b46a65debdd7e1cd113e289d3801df031563fb Mon Sep 17 00:00:00 2001 From: Angular Robot Date: Sat, 15 Feb 2025 02:34:30 +0000 Subject: [PATCH] build: update octokit dependencies --- .github/local-actions/branch-manager/main.js | 5131 ++++++++++------- .github/local-actions/labels-sync/main.js | 3641 ++++++++---- .github/local-actions/lock-closed/main.js | 3641 ++++++++---- github-actions/branch-manager/main.js | 3641 ++++++++---- .../commit-message-based-labels/main.js | 3657 +++++++----- github-actions/create-pr-for-changes/main.js | 2634 +++++---- github-actions/feature-request/main.js | 3641 ++++++++---- github-actions/google-internal-tests/main.js | 2650 +++++---- github-actions/org-file-sync/main.js | 3641 ++++++++---- github-actions/post-approval-changes/main.js | 3641 ++++++++---- .../fetch-workflow-artifact.js | 648 ++- github-actions/unified-status-check/main.js | 3641 ++++++++---- ng-dev/package.json | 2 +- package.json | 14 +- yarn.lock | 194 +- 15 files changed, 25995 insertions(+), 14422 deletions(-) diff --git a/.github/local-actions/branch-manager/main.js b/.github/local-actions/branch-manager/main.js index a58d3402d..91ef8f664 100644 --- a/.github/local-actions/branch-manager/main.js +++ b/.github/local-actions/branch-manager/main.js @@ -3703,11 +3703,11 @@ var require_util2 = __commonJS({ } return location; } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -3773,7 +3773,7 @@ var require_util2 = __commonJS({ } return true; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const { headersList } = actualResponse; const policyHeader = (headersList.get("referrer-policy") ?? "").split(","); let policy = ""; @@ -3787,7 +3787,7 @@ var require_util2 = __commonJS({ } } if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -3804,33 +3804,33 @@ var require_util2 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; - if (request2.responseTainting === "cors" || request2.mode === "websocket") { + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; + if (request4.responseTainting === "cors" || request4.mode === "websocket") { if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } } } @@ -3862,26 +3862,26 @@ var require_util2 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert2(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (request2.referrer instanceof URL) { - referrerSource = request2.referrer; + } else if (request4.referrer instanceof URL) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); if (referrerURL.toString().length > 4096) { referrerURL = referrerOrigin; } - const areSameOrigin = sameOrigin(request2, referrerURL); - const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request2.url); + const areSameOrigin = sameOrigin(request4, referrerURL); + const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request4.url); switch (policy) { case "origin": return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true); @@ -3892,7 +3892,7 @@ var require_util2 = __commonJS({ case "origin-when-cross-origin": return areSameOrigin ? referrerURL : referrerOrigin; case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -4041,7 +4041,7 @@ var require_util2 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -5927,25 +5927,25 @@ var require_request = __commonJS({ static [kHTTP2BuildRequest](origin, opts, handler2) { const headers = opts.headers; opts = { ...opts, headers: null }; - const request2 = new Request(origin, opts, handler2); - request2.headers = {}; + const request4 = new Request(origin, opts, handler2); + request4.headers = {}; if (Array.isArray(headers)) { if (headers.length % 2 !== 0) { throw new InvalidArgumentError("headers array must be even"); } for (let i = 0; i < headers.length; i += 2) { - processHeader(request2, headers[i], headers[i + 1], true); + processHeader(request4, headers[i], headers[i + 1], true); } } else if (headers && typeof headers === "object") { const keys = Object.keys(headers); for (let i = 0; i < keys.length; i++) { const key = keys[i]; - processHeader(request2, key, headers[key], true); + processHeader(request4, key, headers[key], true); } } else if (headers != null) { throw new InvalidArgumentError("headers must be an object or an array"); } - return request2; + return request4; } static [kHTTP2CopyHeaders](raw) { const rawHeaders = raw.split("\r\n"); @@ -5973,28 +5973,28 @@ var require_request = __commonJS({ return skipAppend ? val : `${key}: ${val}\r `; } - function processHeader(request2, key, val, skipAppend = false) { + function processHeader(request4, key, val, skipAppend = false) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { return; } - if (request2.host === null && key.length === 4 && key.toLowerCase() === "host") { + if (request4.host === null && key.length === 4 && key.toLowerCase() === "host") { if (headerCharRegex.exec(val) !== null) { throw new InvalidArgumentError(`invalid ${key} header`); } - request2.host = val; - } else if (request2.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { - request2.contentType = val; + } else if (request4.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { + request4.contentType = val; if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } else if (key.length === 17 && key.toLowerCase() === "transfer-encoding") { throw new InvalidArgumentError("invalid transfer-encoding header"); } else if (key.length === 10 && key.toLowerCase() === "connection") { @@ -6002,7 +6002,7 @@ var require_request = __commonJS({ if (value !== "close" && value !== "keep-alive") { throw new InvalidArgumentError("invalid connection header"); } else if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (key.length === 10 && key.toLowerCase() === "keep-alive") { throw new InvalidArgumentError("invalid keep-alive header"); @@ -6016,19 +6016,19 @@ var require_request = __commonJS({ if (Array.isArray(val)) { for (let i = 0; i < val.length; i++) { if (skipAppend) { - if (request2.headers[key]) - request2.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; + if (request4.headers[key]) + request4.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; else - request2.headers[key] = processHeaderValue(key, val[i], skipAppend); + request4.headers[key] = processHeaderValue(key, val[i], skipAppend); } else { - request2.headers += processHeaderValue(key, val[i]); + request4.headers += processHeaderValue(key, val[i]); } } } else { if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } } } @@ -7172,10 +7172,10 @@ var require_client = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); - this[kQueue].push(request2); + const request4 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; process.nextTick(resume, this); } else { @@ -7199,8 +7199,8 @@ var require_client = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -7248,13 +7248,13 @@ var require_client = __commonJS({ assert2(this[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } } else if (client[kRunning] > 0) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert2(client[kRunning] === 0); @@ -7460,8 +7460,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } } @@ -7501,12 +7501,12 @@ var require_client = __commonJS({ onUpgrade(head) { const { upgrade, client, socket, headers, statusCode } = this; assert2(upgrade); - const request2 = client[kQueue][client[kRunningIdx]]; - assert2(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert2(request4); assert2(!socket.destroyed); assert2(socket === client[kSocket]); assert2(!this.paused); - assert2(request2.upgrade || request2.method === "CONNECT"); + assert2(request4.upgrade || request4.method === "CONNECT"); this.statusCode = null; this.statusText = ""; this.shouldKeepAlive = null; @@ -7523,7 +7523,7 @@ var require_client = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -7534,8 +7534,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert2(!this.upgrade); @@ -7544,22 +7544,22 @@ var require_client = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert2.strictEqual(this.timeoutType, TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert2(client[kRunning] === 1); this.upgrade = true; return 2; @@ -7590,11 +7590,11 @@ var require_client = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -7611,8 +7611,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert2(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert2(request4); assert2.strictEqual(this.timeoutType, TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -7625,7 +7625,7 @@ var require_client = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } } @@ -7637,8 +7637,8 @@ var require_client = __commonJS({ if (upgrade) { return; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert2(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert2(request4); assert2(statusCode >= 100); this.statusCode = null; this.statusText = ""; @@ -7652,11 +7652,11 @@ var require_client = __commonJS({ if (statusCode < 200) { return; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert2.strictEqual(client[kRunning], 0); @@ -7714,8 +7714,8 @@ var require_client = __commonJS({ assert2(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } assert2(client[kSize] === 0); } @@ -7745,13 +7745,13 @@ var require_client = __commonJS({ assert2(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert2(client[kRunning] === 0); @@ -7884,8 +7884,8 @@ var require_client = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert2(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + errorRequest(client, request4, err); } } else { onError(client, err); @@ -7939,8 +7939,8 @@ var require_client = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request3 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request3.headersTimeout != null ? request3.headersTimeout : client[kHeadersTimeout]; + const request5 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request5.headersTimeout != null ? request5.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -7962,13 +7962,13 @@ var require_client = __commonJS({ if (client[kRunning] >= (client[kPipelining] || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; - if (socket && socket.servername !== request2.servername) { + client[kServerName] = request4.servername; + if (socket && socket.servername !== request4.servername) { util.destroy(socket, new InformationalError("servername changed")); return; } @@ -7983,16 +7983,16 @@ var require_client = __commonJS({ if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) { return; } - if (client[kRunning] > 0 && !request2.idempotent) { + if (client[kRunning] > 0 && !request4.idempotent) { return; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body))) { return; } - if (!request2.aborted && write(client, request2)) { + if (!request4.aborted && write(client, request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -8002,12 +8002,12 @@ var require_client = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function write(client, request2) { + function write(client, request4) { if (client[kHTTPConnVersion] === "h2") { - writeH2(client, client[kHTTP2Session], request2); + writeH2(client, client[kHTTP2Session], request4); return; } - const { body, method, path: path4, host, upgrade, headers, blocking, reset: reset2 } = request2; + const { body, method, path: path4, host, upgrade, headers, blocking, reset: reset2 } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { body.read(0); @@ -8015,31 +8015,31 @@ var require_client = __commonJS({ const bodyLength = util.bodyLength(body); let contentLength = bodyLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(socket, new InformationalError("aborted")); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -8078,7 +8078,7 @@ upgrade: ${upgrade}\r header += headers; } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { if (contentLength === 0) { @@ -8090,7 +8090,7 @@ upgrade: ${upgrade}\r socket.write(`${header}\r `, "latin1"); } - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert2(contentLength === body.byteLength, "buffer body must have content length"); socket.cork(); @@ -8099,48 +8099,48 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable({ body: body.stream(), client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body: body.stream(), client, request: request4, socket, contentLength, header, expectsPayload }); } else { - writeBlob({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeBlob({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } } else if (util.isStream(body)) { - writeStream({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeStream({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else if (util.isIterable(body)) { - writeIterable({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else { assert2(false); } return true; } - function writeH2(client, session, request2) { - const { body, method, path: path4, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; + function writeH2(client, session, request4) { + const { body, method, path: path4, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; let headers; if (typeof reqHeaders === "string") headers = Request[kHTTP2CopyHeaders](reqHeaders.trim()); else headers = reqHeaders; if (upgrade) { - errorRequest(client, request2, new Error("Upgrade not supported for H2")); + errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } let stream; @@ -8151,11 +8151,11 @@ upgrade: ${upgrade}\r session.ref(); stream = session.request(headers, { endStream: false, signal }); if (stream.id && !stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; }); } @@ -8174,14 +8174,14 @@ upgrade: ${upgrade}\r } let contentLength = util.bodyLength(body); if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -8206,15 +8206,15 @@ upgrade: ${upgrade}\r ++h2State.openStreams; stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - if (request2.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.once("end", () => { - request2.onComplete([]); + request4.onComplete([]); }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -8232,7 +8232,7 @@ upgrade: ${upgrade}\r }); stream.once("frameError", (type, code) => { const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`); - errorRequest(client, request2, err); + errorRequest(client, request4, err); if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { h2State.streams -= 1; util.destroy(stream, err); @@ -8241,20 +8241,20 @@ upgrade: ${upgrade}\r return true; function writeBodyH2() { if (!body) { - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert2(contentLength === body.byteLength, "buffer body must have content length"); stream.cork(); stream.write(body); stream.uncork(); stream.end(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { writeIterable({ client, - request: request2, + request: request4, contentLength, h2stream: stream, expectsPayload, @@ -8266,7 +8266,7 @@ upgrade: ${upgrade}\r writeBlob({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, h2stream: stream, @@ -8278,7 +8278,7 @@ upgrade: ${upgrade}\r writeStream({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, socket: client[kSocket], @@ -8289,7 +8289,7 @@ upgrade: ${upgrade}\r writeIterable({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, header: "", @@ -8301,11 +8301,11 @@ upgrade: ${upgrade}\r } } } - function writeStream({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + function writeStream({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert2(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); if (client[kHTTPConnVersion] === "h2") { let onPipeData = function(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); }; const pipe = pipeline( body, @@ -8315,7 +8315,7 @@ upgrade: ${upgrade}\r util.destroy(body, err); util.destroy(h2stream, err); } else { - request2.onRequestSent(); + request4.onRequestSent(); } } ); @@ -8327,7 +8327,7 @@ upgrade: ${upgrade}\r return; } let finished = false; - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -8383,7 +8383,7 @@ upgrade: ${upgrade}\r } socket.on("drain", onDrain).on("error", onFinished); } - async function writeBlob({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeBlob({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert2(contentLength === body.size, "blob body must have content length"); const isH2 = client[kHTTPConnVersion] === "h2"; try { @@ -8403,8 +8403,8 @@ upgrade: ${upgrade}\r socket.write(buffer); socket.uncork(); } - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -8413,7 +8413,7 @@ upgrade: ${upgrade}\r util.destroy(isH2 ? h2stream : socket, err); } } - async function writeIterable({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeIterable({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert2(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -8439,7 +8439,7 @@ upgrade: ${upgrade}\r throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } @@ -8447,14 +8447,14 @@ upgrade: ${upgrade}\r } catch (err) { h2stream.destroy(err); } finally { - request2.onRequestSent(); + request4.onRequestSent(); h2stream.end(); h2stream.off("close", onDrain).off("drain", onDrain); } return; } socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -8472,9 +8472,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -8483,7 +8483,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -8522,7 +8522,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -8533,8 +8533,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -8577,10 +8577,10 @@ ${len.toString(16)}\r } } }; - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert2(request2.aborted); + request4.onError(err); + assert2(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -9675,10 +9675,10 @@ var require_api_request = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -9693,7 +9693,7 @@ var require_api_request = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -10407,7 +10407,7 @@ var require_mock_utils = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (typeof data === "object") { @@ -10512,7 +10512,7 @@ var require_mock_utils = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); handler2.abort = nop; @@ -10569,7 +10569,7 @@ var require_mock_utils = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -10591,7 +10591,7 @@ var require_mock_utils = __commonJS({ var require_mock_interceptor = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils(); var { kDispatches, kDispatchKey, @@ -10654,7 +10654,7 @@ var require_mock_interceptor = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData(statusCode, data, responseOptions = {}) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -12303,7 +12303,7 @@ var require_request2 = __commonJS({ policyContainer: makePolicyContainer() } }; - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = this[kRealm].settingsObject.baseUrl; let signal = null; @@ -12319,17 +12319,17 @@ var require_request2 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert2(input instanceof Request); - request2 = input[kState]; + request4 = input[kState]; signal = input[kSignal]; } const origin = this[kRealm].settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request4.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -12337,43 +12337,43 @@ var require_request2 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: this[kRealm].settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -12382,14 +12382,14 @@ var require_request2 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, this[kRealm].settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -12404,27 +12404,27 @@ var require_request2 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; @@ -12435,12 +12435,12 @@ var require_request2 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizeMethodRecord[method] ?? normalizeMethod(method); - request2.method = method; + request4.method = method; } if (init.signal !== void 0) { signal = init.signal; } - this[kState] = request2; + this[kState] = request4; const ac = new AbortController(); this[kSignal] = ac.signal; this[kSignal][kRealm] = this[kRealm]; @@ -12474,13 +12474,13 @@ var require_request2 = __commonJS({ } } this[kHeaders] = new Headers(kConstruct); - this[kHeaders][kHeadersList] = request2.headersList; + this[kHeaders][kHeadersList] = request4.headersList; this[kHeaders][kGuard] = "request"; this[kHeaders][kRealm] = this[kRealm]; if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } this[kHeaders][kGuard] = "request-no-cors"; @@ -12499,14 +12499,14 @@ var require_request2 = __commonJS({ } } const inputBody = input instanceof Request ? input[kState].body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !this[kHeaders][kHeadersList].contains("content-type")) { @@ -12518,12 +12518,12 @@ var require_request2 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -12653,7 +12653,7 @@ var require_request2 = __commonJS({ }; mixinBody(Request); function makeRequest(init) { - const request2 = { + const request4 = { method: "GET", localURLsOnly: false, unsafeRequest: false, @@ -12692,13 +12692,13 @@ var require_request2 = __commonJS({ ...init, headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; - request2.url = request2.urlList[0]; - return request2; + request4.url = request4.urlList[0]; + return request4; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(request4.body); } return newRequest; } @@ -12928,14 +12928,14 @@ var require_fetch = __commonJS({ p.reject(e); return p.promise; } - const request2 = requestObject[kState]; + const request4 = requestObject[kState]; if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; const relevantRealm = null; @@ -12947,7 +12947,7 @@ var require_fetch = __commonJS({ locallyAborted = true; assert2(controller != null); controller.abort(requestObject.signal.reason); - abortFetch(p, request2, responseObject, requestObject.signal.reason); + abortFetch(p, request4, responseObject, requestObject.signal.reason); } ); const handleFetchDone = (response) => finalizeAndReportTiming(response, "fetch"); @@ -12956,7 +12956,7 @@ var require_fetch = __commonJS({ return Promise.resolve(); } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return Promise.resolve(); } if (response.type === "error") { @@ -12974,7 +12974,7 @@ var require_fetch = __commonJS({ p.resolve(responseObject); }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: init.dispatcher ?? getGlobalDispatcher() @@ -13019,14 +13019,14 @@ var require_fetch = __commonJS({ performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis2, cacheState); } } - function abortFetch(p, request2, responseObject, error2) { + function abortFetch(p, request4, responseObject, error2) { var _a, _b; if (!error2) { error2 = new DOMException2("The operation was aborted.", "AbortError"); } p.reject(error2); - if (request2.body != null && isReadable((_a = request2.body) == null ? void 0 : _a.stream)) { - request2.body.stream.cancel(error2).catch((err) => { + if (request4.body != null && isReadable((_a = request4.body) == null ? void 0 : _a.stream)) { + request4.body.stream.cancel(error2).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -13047,7 +13047,7 @@ var require_fetch = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -13059,9 +13059,9 @@ var require_fetch = __commonJS({ var _a, _b, _c, _d; let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currenTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -13069,7 +13069,7 @@ var require_fetch = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -13079,32 +13079,32 @@ var require_fetch = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert2(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert2(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a = request4.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = (_d = request2.client) == null ? void 0 : _d.origin; + if (request4.origin === "client") { + request4.origin = (_d = request4.client) == null ? void 0 : _d.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept")) { + if (!request4.headersList.contains("accept")) { const value = "*/*"; - request2.headersList.append("accept", value); + request4.headersList.append("accept", value); } - if (!request2.headersList.contains("accept-language")) { - request2.headersList.append("accept-language", "*"); + if (!request4.headersList.contains("accept-language")) { + request4.headersList.append("accept-language", "*"); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -13112,44 +13112,44 @@ var require_fetch = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { response = await (async () => { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; return await schemeFetch(fetchParams); } - if (request2.mode === "same-origin") { + if (request4.mode === "same-origin") { return makeNetworkError('request mode cannot be "same-origin"'); } - if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { return makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; return await schemeFetch(fetchParams); } - if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { return makeNetworkError("URL scheme must be a HTTP(S) scheme"); } - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; return await httpFetch(fetchParams); })(); } @@ -13157,13 +13157,13 @@ var require_fetch = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert2(false); @@ -13171,26 +13171,26 @@ var require_fetch = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range")) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range")) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -13206,8 +13206,8 @@ var require_fetch = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -13216,12 +13216,12 @@ var require_fetch = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blobURLEntryObject = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !isBlobLike(blobURLEntryObject)) { + if (request4.method !== "GET" || !isBlobLike(blobURLEntryObject)) { return Promise.resolve(makeNetworkError("invalid method")); } const bodyWithType = safelyExtractBody(blobURLEntryObject); @@ -13239,7 +13239,7 @@ var require_fetch = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -13321,41 +13321,41 @@ var require_fetch = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert2(false); @@ -13365,13 +13365,13 @@ var require_fetch = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -13382,63 +13382,63 @@ var require_fetch = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization"); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie"); - request2.headersList.delete("host"); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization"); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie"); + request4.headersList.delete("host"); } - if (request2.body != null) { - assert2(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert2(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = makeRequest(request2); + httpRequest = makeRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -13515,7 +13515,7 @@ var require_fetch = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -13523,7 +13523,7 @@ var require_fetch = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -13551,21 +13551,21 @@ var require_fetch = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -13594,7 +13594,7 @@ var require_fetch = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -13706,17 +13706,17 @@ var require_fetch = __commonJS({ } return response; async function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: fetchParams.controller.dispatcher.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: fetchParams.controller.dispatcher.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -13762,8 +13762,8 @@ var require_fetch = __commonJS({ } this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = request2.redirect === "follow" && location && redirectStatusSet.has(status); - if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = request4.redirect === "follow" && location && redirectStatusSet.has(status); + if (request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (const coding of codings) { if (coding === "x-gzip" || coding === "gzip") { decoders.push(zlib.createGunzip({ @@ -14697,36 +14697,36 @@ var require_cache = __commonJS({ } this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); - const p = await this.matchAll(request2, options); + const p = await this.matchAll(request4, options); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { var _a; webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -14748,11 +14748,11 @@ var require_cache = __commonJS({ } return Object.freeze(responseList); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.add" }); - request2 = webidl.converters.RequestInfo(request2); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -14762,11 +14762,11 @@ var require_cache = __commonJS({ requests = webidl.converters["sequence"](requests); const responsePromises = []; const requestList = []; - for (const request2 of requests) { - if (typeof request2 === "string") { + for (const request4 of requests) { + if (typeof request4 === "string") { continue; } - const r = request2[kState]; + const r = request4[kState]; if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14775,8 +14775,8 @@ var require_cache = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = new Request(request2)[kState]; + for (const request4 of requests) { + const r = new Request(request4)[kState]; if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14851,16 +14851,16 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 2, { header: "Cache.put" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); response = webidl.converters.Response(response); let innerRequest = null; - if (request2 instanceof Request) { - innerRequest = request2[kState]; + if (request4 instanceof Request) { + innerRequest = request4[kState]; } else { - innerRequest = new Request(request2)[kState]; + innerRequest = new Request(request4)[kState]; } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -14928,20 +14928,20 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.delete" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert2(typeof request2 === "string"); - r = new Request(request2)[kState]; + assert2(typeof request4 === "string"); + r = new Request(request4)[kState]; } const operations = []; const operation = { @@ -14967,25 +14967,25 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -14997,12 +14997,12 @@ var require_cache = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = new Request("https://a"); - requestObject[kState] = request3; - requestObject[kHeaders][kHeadersList] = request3.headersList; + requestObject[kState] = request5; + requestObject[kHeaders][kHeadersList] = request5.headersList; requestObject[kHeaders][kGuard] = "immutable"; - requestObject[kRealm] = request3.client; + requestObject[kRealm] = request5.client; requestList.push(requestObject); } promise.resolve(Object.freeze(requestList)); @@ -15097,9 +15097,9 @@ var require_cache = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -15115,7 +15115,7 @@ var require_cache = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -15187,21 +15187,21 @@ var require_cachestorage = __commonJS({ webidl.illegalConstructor(); } } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, { header: "CacheStorage.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -16114,7 +16114,7 @@ var require_connection = __commonJS({ function establishWebSocketConnection(url, protocols, ws, onEstablish, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], serviceWorkers: "none", referrer: "no-referrer", @@ -16125,17 +16125,17 @@ var require_connection = __commonJS({ }); if (options.headers) { const headersList = new Headers(options.headers)[kHeadersList]; - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue); - request2.headersList.append("sec-websocket-version", "13"); + request4.headersList.append("sec-websocket-key", keyValue); + request4.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol); + request4.headersList.append("sec-websocket-protocol", protocol); } const permessageDeflate = ""; const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher ?? getGlobalDispatcher(), processResponse(response) { @@ -16168,7 +16168,7 @@ var require_connection = __commonJS({ return; } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); - if (secProtocol !== null && secProtocol !== request2.headersList.get("Sec-WebSocket-Protocol")) { + if (secProtocol !== null && secProtocol !== request4.headersList.get("Sec-WebSocket-Protocol")) { failWebsocketConnection(ws, "Protocol was not set in the opening handshake."); return; } @@ -17213,7 +17213,7 @@ var require_lib = __commonJS({ } exports.isHttps = isHttps; var HttpClient = class { - constructor(userAgent2, handlers, requestOptions) { + constructor(userAgent4, handlers, requestOptions) { this._ignoreSslError = false; this._allowRedirects = true; this._allowRedirectDowngrade = false; @@ -17222,7 +17222,7 @@ var require_lib = __commonJS({ this._maxRetries = 1; this._keepAlive = false; this._disposed = false; - this.userAgent = userAgent2; + this.userAgent = userAgent4; this.handlers = handlers || []; this.requestOptions = requestOptions; if (requestOptions) { @@ -17487,14 +17487,14 @@ var require_lib = __commonJS({ } _mergeHeaders(headers) { if (this.requestOptions && this.requestOptions.headers) { - return Object.assign({}, lowercaseKeys2(this.requestOptions.headers), lowercaseKeys2(headers || {})); + return Object.assign({}, lowercaseKeys4(this.requestOptions.headers), lowercaseKeys4(headers || {})); } - return lowercaseKeys2(headers || {}); + return lowercaseKeys4(headers || {}); } _getExistingOrDefaultHeader(additionalHeaders, header, _default) { let clientHeader; if (this.requestOptions && this.requestOptions.headers) { - clientHeader = lowercaseKeys2(this.requestOptions.headers)[header]; + clientHeader = lowercaseKeys4(this.requestOptions.headers)[header]; } return additionalHeaders[header] || clientHeader || _default; } @@ -17629,7 +17629,7 @@ var require_lib = __commonJS({ } }; exports.HttpClient = HttpClient; - var lowercaseKeys2 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + var lowercaseKeys4 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); } }); @@ -19852,7 +19852,7 @@ var require_semver = __commonJS({ var require_parse2 = __commonJS({ ""(exports, module) { var SemVer = require_semver(); - var parse4 = (version, options, throwErrors = false) => { + var parse6 = (version, options, throwErrors = false) => { if (version instanceof SemVer) { return version; } @@ -19865,16 +19865,16 @@ var require_parse2 = __commonJS({ throw er; } }; - module.exports = parse4; + module.exports = parse6; } }); // var require_valid = __commonJS({ ""(exports, module) { - var parse4 = require_parse2(); + var parse6 = require_parse2(); var valid = (version, options) => { - const v = parse4(version, options); + const v = parse6(version, options); return v ? v.version : null; }; module.exports = valid; @@ -19884,9 +19884,9 @@ var require_valid = __commonJS({ // var require_clean = __commonJS({ ""(exports, module) { - var parse4 = require_parse2(); + var parse6 = require_parse2(); var clean = (version, options) => { - const s = parse4(version.trim().replace(/^[=v]+/, ""), options); + const s = parse6(version.trim().replace(/^[=v]+/, ""), options); return s ? s.version : null; }; module.exports = clean; @@ -19919,10 +19919,10 @@ var require_inc = __commonJS({ // var require_diff = __commonJS({ ""(exports, module) { - var parse4 = require_parse2(); + var parse6 = require_parse2(); var diff = (version1, version2) => { - const v1 = parse4(version1, null, true); - const v2 = parse4(version2, null, true); + const v1 = parse6(version1, null, true); + const v2 = parse6(version2, null, true); const comparison = v1.compare(v2); if (comparison === 0) { return null; @@ -19989,9 +19989,9 @@ var require_patch = __commonJS({ // var require_prerelease = __commonJS({ ""(exports, module) { - var parse4 = require_parse2(); + var parse6 = require_parse2(); var prerelease = (version, options) => { - const parsed = parse4(version, options); + const parsed = parse6(version, options); return parsed && parsed.prerelease.length ? parsed.prerelease : null; }; module.exports = prerelease; @@ -20163,7 +20163,7 @@ var require_cmp = __commonJS({ var require_coerce = __commonJS({ ""(exports, module) { var SemVer = require_semver(); - var parse4 = require_parse2(); + var parse6 = require_parse2(); var { safeRe: re, t } = require_re(); var coerce = (version, options) => { if (version instanceof SemVer) { @@ -20198,7 +20198,7 @@ var require_coerce = __commonJS({ const patch = match2[4] || "0"; const prerelease = options.includePrerelease && match2[5] ? `-${match2[5]}` : ""; const build = options.includePrerelease && match2[6] ? `+${match2[6]}` : ""; - return parse4(`${major}.${minor}.${patch}${prerelease}${build}`, options); + return parse6(`${major}.${minor}.${patch}${prerelease}${build}`, options); }; module.exports = coerce; } @@ -21196,7 +21196,7 @@ var require_semver2 = __commonJS({ var constants = require_constants6(); var SemVer = require_semver(); var identifiers = require_identifiers(); - var parse4 = require_parse2(); + var parse6 = require_parse2(); var valid = require_valid(); var clean = require_clean(); var inc = require_inc(); @@ -21234,7 +21234,7 @@ var require_semver2 = __commonJS({ var simplifyRange = require_simplify(); var subset = require_subset(); module.exports = { - parse: parse4, + parse: parse6, valid, clean, inc, @@ -32734,7 +32734,7 @@ var require_fast_content_type_parse = __commonJS({ var defaultContentType = { type: "", parameters: new NullObject() }; Object.freeze(defaultContentType.parameters); Object.freeze(defaultContentType); - function parse4(header) { + function parse6(header) { if (typeof header !== "string") { throw new TypeError("argument header is required and must be a string"); } @@ -32772,7 +32772,7 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - function safeParse2(header) { + function safeParse4(header) { if (typeof header !== "string") { return defaultContentType; } @@ -32810,9 +32810,9 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - module.exports.default = { parse: parse4, safeParse: safeParse2 }; - module.exports.parse = parse4; - module.exports.safeParse = safeParse2; + module.exports.default = { parse: parse6, safeParse: safeParse4 }; + module.exports.parse = parse6; + module.exports.safeParse = safeParse4; module.exports.defaultContentType = defaultContentType; } }); @@ -32920,7 +32920,7 @@ var require_parser = __commonJS({ let footer = null; let header = null; const mentions = []; - let merge2 = null; + let merge4 = null; const notes = []; const references = []; let revert = null; @@ -32930,7 +32930,7 @@ var require_parser = __commonJS({ footer, header, mentions, - merge: merge2, + merge: merge4, notes, references, revert, @@ -32939,14 +32939,14 @@ var require_parser = __commonJS({ type: null }; } - merge2 = lines2.shift(); + merge4 = lines2.shift(); const mergeParts = {}; const headerParts = {}; body = ""; footer = ""; - const mergeMatch = merge2.match(options.mergePattern); + const mergeMatch = merge4.match(options.mergePattern); if (mergeMatch && options.mergePattern) { - merge2 = mergeMatch[0]; + merge4 = mergeMatch[0]; header = lines2.shift(); while (header !== void 0 && !header.trim()) { header = lines2.shift(); @@ -32959,8 +32959,8 @@ var require_parser = __commonJS({ mergeParts[partName] = partValue; }); } else { - header = merge2; - merge2 = null; + header = merge4; + merge4 = null; mergeCorrespondence.forEach(function(partName) { mergeParts[partName] = null; }); @@ -33059,7 +33059,7 @@ var require_parser = __commonJS({ const msg = { ...headerParts, ...mergeParts, - merge: merge2, + merge: merge4, header, body: body ? trimOffNewlines(body) : null, footer: footer ? trimOffNewlines(footer) : null, @@ -33325,7 +33325,7 @@ var require_brace_expansion = __commonJS({ if (str.substr(0, 2) === "{}") { str = "\\{\\}" + str.substr(2); } - return expand3(escapeBraces(str), true).map(unescapeBraces); + return expand5(escapeBraces(str), true).map(unescapeBraces); } function embrace(str) { return "{" + str + "}"; @@ -33339,13 +33339,13 @@ var require_brace_expansion = __commonJS({ function gte(i, y) { return i >= y; } - function expand3(str, isTop) { + function expand5(str, isTop) { var expansions = []; var m = balanced("{", "}", str); if (!m) return [str]; var pre = m.pre; - var post = m.post.length ? expand3(m.post, false) : [""]; + var post = m.post.length ? expand5(m.post, false) : [""]; if (/\$$/.test(m.pre)) { for (var k = 0; k < post.length; k++) { var expansion = pre + "{" + m.body + "}" + post[k]; @@ -33359,7 +33359,7 @@ var require_brace_expansion = __commonJS({ if (!isSequence && !isOptions) { if (m.post.match(/,.*\}/)) { str = m.pre + "{" + m.body + escClose + m.post; - return expand3(str); + return expand5(str); } return [str]; } @@ -33369,7 +33369,7 @@ var require_brace_expansion = __commonJS({ } else { n = parseCommaParts(m.body); if (n.length === 1) { - n = expand3(n[0], false).map(embrace); + n = expand5(n[0], false).map(embrace); if (n.length === 1) { return post.map(function(p) { return m.pre + n[0] + p; @@ -33415,7 +33415,7 @@ var require_brace_expansion = __commonJS({ } else { N = []; for (var j = 0; j < n.length; j++) { - N.push.apply(N, expand3(n[j], false)); + N.push.apply(N, expand5(n[j], false)); } } for (var j = 0; j < N.length; j++) { @@ -34265,7 +34265,7 @@ var require_jsonc_parser = __commonJS({ } }; } - function parse4(text, errors = [], options = ParseOptions.DEFAULT) { + function parse6(text, errors = [], options = ParseOptions.DEFAULT) { let currentProperty = null; let currentParent = []; const previousParents = []; @@ -34920,7 +34920,7 @@ var require_jsonc_parser = __commonJS({ SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF"; })(SyntaxKind || (SyntaxKind = {})); var getLocation2 = getLocation; - var parse22 = parse4; + var parse22 = parse6; var parseTree2 = parseTree; var findNodeAtLocation2 = findNodeAtLocation; var findNodeAtOffset2 = findNodeAtOffset; @@ -36051,10 +36051,10 @@ var require_util8 = __commonJS({ } return obj; } - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert2(request2.aborted); + request4.onError(err); + assert2(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -36582,7 +36582,7 @@ var require_request3 = __commonJS({ return this; } }; - function processHeader(request2, key, val) { + function processHeader(request4, key, val) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { @@ -36621,19 +36621,19 @@ var require_request3 = __commonJS({ } else { val = `${val}`; } - if (request2.host === null && headerName === "host") { + if (request4.host === null && headerName === "host") { if (typeof val !== "string") { throw new InvalidArgumentError("invalid host header"); } - request2.host = val; - } else if (request2.contentLength === null && headerName === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && headerName === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && headerName === "content-type") { - request2.contentType = val; - request2.headers.push(key, val); + } else if (request4.contentType === null && headerName === "content-type") { + request4.contentType = val; + request4.headers.push(key, val); } else if (headerName === "transfer-encoding" || headerName === "keep-alive" || headerName === "upgrade") { throw new InvalidArgumentError(`invalid ${headerName} header`); } else if (headerName === "connection") { @@ -36642,12 +36642,12 @@ var require_request3 = __commonJS({ throw new InvalidArgumentError("invalid connection header"); } if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (headerName === "expect") { throw new NotSupportedError("expect header not supported"); } else { - request2.headers.push(key, val); + request4.headers.push(key, val); } } module.exports = Request; @@ -38960,11 +38960,11 @@ var require_util9 = __commonJS({ function normalizeBinaryStringToUtf8(value) { return Buffer.from(value, "binary").toString("utf8"); } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -39001,10 +39001,10 @@ var require_util9 = __commonJS({ } return policy; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const policy = parseReferrerPolicy(actualResponse); if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -39021,33 +39021,33 @@ var require_util9 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header, true); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; if (serializedOrigin === "client" || serializedOrigin === void 0) { return; } - if (request2.responseTainting === "cors" || request2.mode === "websocket") { - request2.headersList.append("origin", serializedOrigin, true); - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + if (request4.responseTainting === "cors" || request4.mode === "websocket") { + request4.headersList.append("origin", serializedOrigin, true); + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } - request2.headersList.append("origin", serializedOrigin, true); + request4.headersList.append("origin", serializedOrigin, true); } } function coarsenTime(timestamp, crossOriginIsolatedCapability) { @@ -39101,18 +39101,18 @@ var require_util9 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert2(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (webidl.is.URL(request2.referrer)) { - referrerSource = request2.referrer; + } else if (webidl.is.URL(request4.referrer)) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); @@ -39130,14 +39130,14 @@ var require_util9 = __commonJS({ case "unsafe-url": return referrerURL; case "strict-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } return referrerOrigin; } case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -39147,17 +39147,17 @@ var require_util9 = __commonJS({ return referrerOrigin; } case "same-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return "no-referrer"; case "origin-when-cross-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return referrerOrigin; case "no-referrer-when-downgrade": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } @@ -39321,7 +39321,7 @@ var require_util9 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -40794,11 +40794,11 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } - request2.onResponseStarted(); + request4.onResponseStarted(); return 0; } onHeaderField(buf) { @@ -40846,9 +40846,9 @@ var require_client_h1 = __commonJS({ assert2(!socket.destroyed); assert2(!this.paused); assert2((headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert2(request2); - assert2(request2.upgrade || request2.method === "CONNECT"); + const request4 = client[kQueue][client[kRunningIdx]]; + assert2(request4); + assert2(request4.upgrade || request4.method === "CONNECT"); this.statusCode = 0; this.statusText = ""; this.shouldKeepAlive = false; @@ -40865,7 +40865,7 @@ var require_client_h1 = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -40876,8 +40876,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert2(!this.upgrade); @@ -40886,22 +40886,22 @@ var require_client_h1 = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert2(this.timeoutType === TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert2(client[kRunning] === 1); this.upgrade = true; return 2; @@ -40932,11 +40932,11 @@ var require_client_h1 = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -40953,8 +40953,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert2(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert2(request4); assert2(this.timeoutType === TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -40967,7 +40967,7 @@ var require_client_h1 = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } return 0; @@ -40982,8 +40982,8 @@ var require_client_h1 = __commonJS({ } assert2(statusCode >= 100); assert2((this.headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert2(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert2(request4); this.statusCode = 0; this.statusText = ""; this.bytesRead = 0; @@ -40995,11 +40995,11 @@ var require_client_h1 = __commonJS({ if (statusCode < 200) { return 0; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert2(client[kRunning] === 0); @@ -41065,8 +41065,8 @@ var require_client_h1 = __commonJS({ return { version: "h1", defaultPipelining: 1, - write(request2) { - return writeH1(client, request2); + write(request4) { + return writeH1(client, request4); }, resume() { resumeH1(client); @@ -41082,18 +41082,18 @@ var require_client_h1 = __commonJS({ get destroyed() { return socket.destroyed; }, - busy(request2) { + busy(request4) { if (socket[kWriting] || socket[kReset] || socket[kBlocking]) { return true; } - if (request2) { - if (client[kRunning] > 0 && !request2.idempotent) { + if (request4) { + if (client[kRunning] > 0 && !request4.idempotent) { return true; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return true; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body) || util.isFormDataLike(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body) || util.isFormDataLike(request4.body))) { return true; } } @@ -41140,13 +41140,13 @@ var require_client_h1 = __commonJS({ assert2(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert2(client[kRunning] === 0); @@ -41174,8 +41174,8 @@ var require_client_h1 = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request2 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request2.headersTimeout != null ? request2.headersTimeout : client[kHeadersTimeout]; + const request4 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request4.headersTimeout != null ? request4.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -41184,21 +41184,21 @@ var require_client_h1 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH1(client, request2) { - const { method, path: path4, host, upgrade, blocking, reset: reset2 } = request2; - let { body, headers, contentLength } = request2; + function writeH1(client, request4) { + const { method, path: path4, host, upgrade, blocking, reset: reset2 } = request4; + let { body, headers, contentLength } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH"; if (util.isFormDataLike(body)) { if (!extractBody) { extractBody = require_body2().extractBody; } const [bodyStream, contentType] = extractBody(body); - if (request2.contentType == null) { + if (request4.contentType == null) { headers.push("content-type", contentType); } body = bodyStream.stream; contentLength = bodyStream.length; - } else if (util.isBlobLike(body) && request2.contentType == null && body.type) { + } else if (util.isBlobLike(body) && request4.contentType == null && body.type) { headers.push("content-type", body.type); } if (body && typeof body.read === "function") { @@ -41207,33 +41207,33 @@ var require_client_h1 = __commonJS({ const bodyLength = util.bodyLength(body); contentLength = bodyLength ?? contentLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - util.errorRequest(client, request2, err || new RequestAbortedError()); + util.errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(body); util.destroy(socket, new InformationalError("aborted")); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -41284,31 +41284,31 @@ upgrade: ${upgrade}\r } } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { - writeBuffer(abort, null, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, null, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBuffer(body)) { - writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable(abort, body.stream(), client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body.stream(), client, request4, socket, contentLength, header, expectsPayload); } else { - writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload); } } else if (util.isStream(body)) { - writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isIterable(body)) { - writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else { assert2(false); } return true; } - function writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert2(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); let finished = false; - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -41374,7 +41374,7 @@ upgrade: ${upgrade}\r setImmediate(onClose); } } - function writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload) { try { if (!body) { if (contentLength === 0) { @@ -41394,18 +41394,18 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(body); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (err) { abort(err); } } - async function writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert2(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -41418,9 +41418,9 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(buffer); socket.uncork(); - request2.onBodySent(buffer); - request2.onRequestSent(); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(buffer); + request4.onRequestSent(); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } client[kResume](); @@ -41428,7 +41428,7 @@ upgrade: ${upgrade}\r abort(err); } } - async function writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert2(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -41447,7 +41447,7 @@ upgrade: ${upgrade}\r } }); socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -41465,9 +41465,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ abort, socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ abort, socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -41477,7 +41477,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -41496,7 +41496,7 @@ upgrade: ${upgrade}\r } socket.cork(); if (bytesWritten === 0) { - if (!expectsPayload && request2.reset !== false) { + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } if (contentLength === null) { @@ -41516,7 +41516,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -41527,8 +41527,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -41671,8 +41671,8 @@ var require_client_h2 = __commonJS({ return { version: "h2", defaultPipelining: Infinity, - write(request2) { - return writeH2(client, request2); + write(request4) { + return writeH2(client, request4); }, resume() { resumeH2(client); @@ -41730,9 +41730,9 @@ var require_client_h2 = __commonJS({ this[kHTTP2Session] = null; util.destroy(this[kSocket], err); if (client[kRunningIdx] < client[kQueue].length) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); client[kPendingIdx] = client[kRunningIdx]; } assert2(client[kRunning] === 0); @@ -41749,8 +41749,8 @@ var require_client_h2 = __commonJS({ assert2(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } } @@ -41781,13 +41781,13 @@ var require_client_h2 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH2(client, request2) { - const requestTimeout = request2.bodyTimeout ?? client[kBodyTimeout]; + function writeH2(client, request4) { + const requestTimeout = request4.bodyTimeout ?? client[kBodyTimeout]; const session = client[kHTTP2Session]; - const { method, path: path4, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; - let { body } = request2; + const { method, path: path4, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; + let { body } = request4; if (upgrade) { - util.errorRequest(client, request2, new Error("Upgrade not supported for H2")); + util.errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } const headers = {}; @@ -41811,11 +41811,11 @@ var require_client_h2 = __commonJS({ headers[HTTP2_HEADER_AUTHORITY] = host || `${hostname}${port ? `:${port}` : ""}`; headers[HTTP2_HEADER_METHOD] = method; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } err = err || new RequestAbortedError(); - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); if (stream != null) { stream.removeAllListeners("data"); stream.close(); @@ -41825,23 +41825,23 @@ var require_client_h2 = __commonJS({ util.destroy(body, err); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "CONNECT") { session.ref(); stream = session.request(headers, { endStream: false, signal }); if (!stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; }); @@ -41869,14 +41869,14 @@ var require_client_h2 = __commonJS({ contentLength = bodyStream.length; } if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -41892,7 +41892,7 @@ var require_client_h2 = __commonJS({ header += `${key}: ${headers[key]}\r `; } - channels.sendHeaders.publish({ request: request2, headers: header, socket: session[kSocket] }); + channels.sendHeaders.publish({ request: request4, headers: header, socket: session[kSocket] }); } const shouldEndStream = method === "GET" || method === "HEAD" || body === null; if (expectContinue) { @@ -41910,17 +41910,17 @@ var require_client_h2 = __commonJS({ stream.setTimeout(requestTimeout); stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - request2.onResponseStarted(); - if (request2.aborted) { + request4.onResponseStarted(); + if (request4.aborted) { stream.removeAllListeners("data"); return; } - if (request2.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -41928,8 +41928,8 @@ var require_client_h2 = __commonJS({ var _a; stream.removeAllListeners("data"); if (((_a = stream.state) == null ? void 0 : _a.state) == null || stream.state.state < 6) { - if (!request2.aborted && !request2.completed) { - request2.onComplete({}); + if (!request4.aborted && !request4.completed) { + request4.onComplete({}); } client[kQueue][client[kRunningIdx]++] = null; client[kResume](); @@ -41972,10 +41972,10 @@ var require_client_h2 = __commonJS({ abort(err); }); stream.once("trailers", (trailers) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - request2.onComplete(trailers); + request4.onComplete(trailers); }); return true; function writeBodyH2() { @@ -41985,7 +41985,7 @@ var require_client_h2 = __commonJS({ stream, null, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -41996,7 +41996,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -42008,7 +42008,7 @@ var require_client_h2 = __commonJS({ stream, body.stream(), client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -42019,7 +42019,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -42033,7 +42033,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, contentLength ); } else if (util.isIterable(body)) { @@ -42042,7 +42042,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -42052,7 +42052,7 @@ var require_client_h2 = __commonJS({ } } } - function writeBuffer(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + function writeBuffer(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { try { if (body != null && util.isBuffer(body)) { assert2(contentLength === body.byteLength, "buffer body must have content length"); @@ -42060,18 +42060,18 @@ var require_client_h2 = __commonJS({ h2stream.write(body); h2stream.uncork(); h2stream.end(); - request2.onBodySent(body); + request4.onBodySent(body); } if (!expectsPayload) { socket[kReset] = true; } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (error2) { abort(error2); } } - function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) { + function writeStream(abort, socket, expectsPayload, h2stream, body, client, request4, contentLength) { assert2(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); const pipe = pipeline( body, @@ -42082,7 +42082,7 @@ var require_client_h2 = __commonJS({ abort(err); } else { util.removeAllListeners(pipe); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -42092,10 +42092,10 @@ var require_client_h2 = __commonJS({ ); util.addListener(pipe, "data", onPipeData); function onPipeData(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); } } - async function writeBlob(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeBlob(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert2(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -42106,8 +42106,8 @@ var require_client_h2 = __commonJS({ h2stream.write(buffer); h2stream.uncork(); h2stream.end(); - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -42116,7 +42116,7 @@ var require_client_h2 = __commonJS({ abort(err); } } - async function writeIterable(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeIterable(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert2(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -42141,13 +42141,13 @@ var require_client_h2 = __commonJS({ throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } } h2stream.end(); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -42394,10 +42394,10 @@ var require_client2 = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = new Request(origin, opts, handler2); - this[kQueue].push(request2); + const request4 = new Request(origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; queueMicrotask(() => resume(this)); } else { @@ -42421,8 +42421,8 @@ var require_client2 = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(this, request2, err); + const request4 = requests[i]; + util.errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -42446,8 +42446,8 @@ var require_client2 = __commonJS({ assert2(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } assert2(client[kSize] === 0); } @@ -42551,8 +42551,8 @@ var require_client2 = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert2(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - util.errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + util.errorRequest(client, request4, err); } } else { onError(client, err); @@ -42610,12 +42610,12 @@ var require_client2 = __commonJS({ if (client[kRunning] >= (getPipelining(client) || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; + client[kServerName] = request4.servername; (_a = client[kHTTPContext]) == null ? void 0 : _a.destroy(new InformationalError("servername changed"), () => { client[kHTTPContext] = null; resume(client); @@ -42631,10 +42631,10 @@ var require_client2 = __commonJS({ if (client[kHTTPContext].destroyed) { return; } - if (client[kHTTPContext].busy(request2)) { + if (client[kHTTPContext].busy(request4)) { return; } - if (!request2.aborted && client[kHTTPContext].write(request2)) { + if (!request4.aborted && client[kHTTPContext].write(request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -44248,10 +44248,10 @@ var require_api_request2 = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -44267,7 +44267,7 @@ var require_api_request2 = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -45033,7 +45033,7 @@ var require_mock_utils2 = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (data instanceof Uint8Array) { @@ -45166,7 +45166,7 @@ var require_mock_utils2 = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); (_a = handler2.onConnect) == null ? void 0 : _a.call(handler2, (err) => handler2.onError(err), null); @@ -45223,7 +45223,7 @@ var require_mock_utils2 = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -45246,7 +45246,7 @@ var require_mock_utils2 = __commonJS({ var require_mock_interceptor2 = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils2(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils2(); var { kDispatches, kDispatchKey, @@ -45311,7 +45311,7 @@ var require_mock_interceptor2 = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData({ statusCode, data, responseOptions }) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -47611,7 +47611,7 @@ var require_sqlite_cache_store = __commonJS({ var { Writable } = __require("stream"); var { assertCacheKey, assertCacheValue } = require_cache2(); var DatabaseSync; - var VERSION13 = 3; + var VERSION18 = 3; var MAX_ENTRY_SIZE = 2 * 1e3 * 1e3 * 1e3; module.exports = class SqliteCacheStore { #maxEntrySize = MAX_ENTRY_SIZE; @@ -47650,7 +47650,7 @@ var require_sqlite_cache_store = __commonJS({ } this.#db = new DatabaseSync((opts == null ? void 0 : opts.location) ?? ":memory:"); this.#db.exec(` - CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION13} ( + CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION18} ( -- Data specific to us id INTEGER PRIMARY KEY AUTOINCREMENT, url TEXT NOT NULL, @@ -47669,9 +47669,9 @@ var require_sqlite_cache_store = __commonJS({ staleAt INTEGER NOT NULL ); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_url ON cacheInterceptorV${VERSION13}(url); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_method ON cacheInterceptorV${VERSION13}(method); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_deleteAt ON cacheInterceptorV${VERSION13}(deleteAt); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION18}_url ON cacheInterceptorV${VERSION18}(url); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION18}_method ON cacheInterceptorV${VERSION18}(method); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION18}_deleteAt ON cacheInterceptorV${VERSION18}(deleteAt); `); this.#getValuesQuery = this.#db.prepare(` SELECT @@ -47686,7 +47686,7 @@ var require_sqlite_cache_store = __commonJS({ vary, cachedAt, staleAt - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION18} WHERE url = ? AND method = ? @@ -47694,7 +47694,7 @@ var require_sqlite_cache_store = __commonJS({ deleteAt ASC `); this.#updateValueQuery = this.#db.prepare(` - UPDATE cacheInterceptorV${VERSION13} SET + UPDATE cacheInterceptorV${VERSION18} SET body = ?, deleteAt = ?, statusCode = ?, @@ -47708,7 +47708,7 @@ var require_sqlite_cache_store = __commonJS({ id = ? `); this.#insertValueQuery = this.#db.prepare(` - INSERT INTO cacheInterceptorV${VERSION13} ( + INSERT INTO cacheInterceptorV${VERSION18} ( url, method, body, @@ -47724,20 +47724,20 @@ var require_sqlite_cache_store = __commonJS({ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `); this.#deleteByUrlQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE url = ?` + `DELETE FROM cacheInterceptorV${VERSION18} WHERE url = ?` ); this.#countEntriesQuery = this.#db.prepare( - `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION13}` + `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION18}` ); this.#deleteExpiredValuesQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE deleteAt <= ?` + `DELETE FROM cacheInterceptorV${VERSION18} WHERE deleteAt <= ?` ); this.#deleteOldValuesQuery = this.#maxCount === Infinity ? null : this.#db.prepare(` - DELETE FROM cacheInterceptorV${VERSION13} + DELETE FROM cacheInterceptorV${VERSION18} WHERE id IN ( SELECT id - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION18} ORDER BY cachedAt DESC LIMIT ? ) @@ -48828,7 +48828,7 @@ var require_request4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); input = webidl.converters.RequestInfo(input, prefix, "input"); init = webidl.converters.RequestInit(init, prefix, "init"); - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = environmentSettingsObject.settingsObject.baseUrl; let signal = null; @@ -48845,18 +48845,18 @@ var require_request4 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert2(webidl.is.Request(input)); - request2 = input.#state; + request4 = input.#state; signal = input.#signal; this.#dispatcher = init.dispatcher || input.#dispatcher; } const origin = environmentSettingsObject.settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request4.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -48864,43 +48864,43 @@ var require_request4 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: environmentSettingsObject.settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -48909,14 +48909,14 @@ var require_request4 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, environmentSettingsObject.settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -48931,33 +48931,33 @@ var require_request4 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; const mayBeNormalized = normalizedMethodRecords[method]; if (mayBeNormalized !== void 0) { - request2.method = mayBeNormalized; + request4.method = mayBeNormalized; } else { if (!isValidHTTPToken(method)) { throw new TypeError(`'${method}' is not a valid HTTP method.`); @@ -48967,9 +48967,9 @@ var require_request4 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizedMethodRecordsBase[upperCase] ?? method; - request2.method = method; + request4.method = method; } - if (!patchMethodWarning && request2.method === "patch") { + if (!patchMethodWarning && request4.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" }); @@ -48979,7 +48979,7 @@ var require_request4 = __commonJS({ if (init.signal !== void 0) { signal = init.signal; } - this.#state = request2; + this.#state = request4; const ac = new AbortController(); this.#signal = ac.signal; if (signal != null) { @@ -49000,12 +49000,12 @@ var require_request4 = __commonJS({ } } this.#headers = new Headers(kConstruct); - setHeadersList(this.#headers, request2.headersList); + setHeadersList(this.#headers, request4.headersList); setHeadersGuard(this.#headers, "request"); if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } setHeadersGuard(this.#headers, "request-no-cors"); @@ -49024,14 +49024,14 @@ var require_request4 = __commonJS({ } } const inputBody = webidl.is.Request(input) ? input.#state.body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !getHeadersList(this.#headers).contains("content-type", true)) { @@ -49043,12 +49043,12 @@ var require_request4 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -49193,24 +49193,24 @@ var require_request4 = __commonJS({ }; return `Request ${nodeUtil.formatWithOptions(options, properties)}`; } - static setRequestSignal(request2, newSignal) { - request2.#signal = newSignal; - return request2; + static setRequestSignal(request4, newSignal) { + request4.#signal = newSignal; + return request4; } - static getRequestDispatcher(request2) { - return request2.#dispatcher; + static getRequestDispatcher(request4) { + return request4.#dispatcher; } - static setRequestDispatcher(request2, newDispatcher) { - request2.#dispatcher = newDispatcher; + static setRequestDispatcher(request4, newDispatcher) { + request4.#dispatcher = newDispatcher; } - static setRequestHeaders(request2, newHeaders) { - request2.#headers = newHeaders; + static setRequestHeaders(request4, newHeaders) { + request4.#headers = newHeaders; } - static getRequestState(request2) { - return request2.#state; + static getRequestState(request4) { + return request4.#state; } - static setRequestState(request2, newState) { - request2.#state = newState; + static setRequestState(request4, newState) { + request4.#state = newState; } }; var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState } = Request; @@ -49263,23 +49263,23 @@ var require_request4 = __commonJS({ headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(newRequest, request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(newRequest, request4.body); } return newRequest; } function fromInnerRequest(innerRequest, dispatcher, signal, guard) { - const request2 = new Request(kConstruct); - setRequestState(request2, innerRequest); - setRequestDispatcher(request2, dispatcher); - setRequestSignal(request2, signal); + const request4 = new Request(kConstruct); + setRequestState(request4, innerRequest); + setRequestDispatcher(request4, dispatcher); + setRequestSignal(request4, signal); const headers = new Headers(kConstruct); - setRequestHeaders(request2, headers); + setRequestHeaders(request4, headers); setHeadersList(headers, innerRequest.headersList); setHeadersGuard(headers, guard); - return request2; + return request4; } Object.defineProperties(Request.prototype, { method: kEnumerableProperty, @@ -49517,14 +49517,14 @@ var require_fetch2 = __commonJS({ p.reject(e); return p.promise; } - const request2 = getRequestState(requestObject); + const request4 = getRequestState(requestObject); if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; let locallyAborted = false; @@ -49536,7 +49536,7 @@ var require_fetch2 = __commonJS({ assert2(controller != null); controller.abort(requestObject.signal.reason); const realResponse = responseObject == null ? void 0 : responseObject.deref(); - abortFetch(p, request2, realResponse, requestObject.signal.reason); + abortFetch(p, request4, realResponse, requestObject.signal.reason); } ); const processResponse = (response) => { @@ -49544,7 +49544,7 @@ var require_fetch2 = __commonJS({ return; } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return; } if (response.type === "error") { @@ -49556,7 +49556,7 @@ var require_fetch2 = __commonJS({ p = null; }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: getRequestDispatcher(requestObject) @@ -49597,13 +49597,13 @@ var require_fetch2 = __commonJS({ ); } var markResourceTiming = performance.markResourceTiming; - function abortFetch(p, request2, responseObject, error2) { + function abortFetch(p, request4, responseObject, error2) { var _a, _b; if (p) { p.reject(error2); } - if (((_a = request2.body) == null ? void 0 : _a.stream) != null && isReadable(request2.body.stream)) { - request2.body.stream.cancel(error2).catch((err) => { + if (((_a = request4.body) == null ? void 0 : _a.stream) != null && isReadable(request4.body.stream)) { + request4.body.stream.cancel(error2).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -49624,7 +49624,7 @@ var require_fetch2 = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -49637,9 +49637,9 @@ var require_fetch2 = __commonJS({ assert2(dispatcher); let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currentTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -49647,7 +49647,7 @@ var require_fetch2 = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -49657,32 +49657,32 @@ var require_fetch2 = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert2(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert2(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a = request4.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = request2.client.origin; + if (request4.origin === "client") { + request4.origin = request4.client.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept", true)) { + if (!request4.headersList.contains("accept", true)) { const value = "*/*"; - request2.headersList.append("accept", value, true); + request4.headersList.append("accept", value, true); } - if (!request2.headersList.contains("accept-language", true)) { - request2.headersList.append("accept-language", "*", true); + if (!request4.headersList.contains("accept-language", true)) { + request4.headersList.append("accept-language", "*", true); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -49690,41 +49690,41 @@ var require_fetch2 = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; response = await schemeFetch(fetchParams); - } else if (request2.mode === "same-origin") { + } else if (request4.mode === "same-origin") { response = makeNetworkError('request mode cannot be "same-origin"'); - } else if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + } else if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { response = makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } else { - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; response = await schemeFetch(fetchParams); } - } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { response = makeNetworkError("URL scheme must be a HTTP(S) scheme"); } else { - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; response = await httpFetch(fetchParams); } } @@ -49732,13 +49732,13 @@ var require_fetch2 = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert2(false); @@ -49746,26 +49746,26 @@ var require_fetch2 = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range", true)) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range", true)) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -49781,8 +49781,8 @@ var require_fetch2 = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -49791,19 +49791,19 @@ var require_fetch2 = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("node:buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blob = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !webidl.is.Blob(blob)) { + if (request4.method !== "GET" || !webidl.is.Blob(blob)) { return Promise.resolve(makeNetworkError("invalid method")); } const response = makeResponse(); const fullLength = blob.size; const serializedFullLength = isomorphicEncode(`${fullLength}`); const type = blob.type; - if (!request2.headersList.contains("range", true)) { + if (!request4.headersList.contains("range", true)) { const bodyWithType = extractBody(blob); response.statusText = "OK"; response.body = bodyWithType[0]; @@ -49811,7 +49811,7 @@ var require_fetch2 = __commonJS({ response.headersList.set("content-type", type, true); } else { response.rangeRequested = true; - const rangeHeader = request2.headersList.get("range", true); + const rangeHeader = request4.headersList.get("range", true); const rangeValue = simpleRangeHeaderValue(rangeHeader, true); if (rangeValue === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -49842,7 +49842,7 @@ var require_fetch2 = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -49931,41 +49931,41 @@ var require_fetch2 = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(void 0, false); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert2(false); @@ -49975,13 +49975,13 @@ var require_fetch2 = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -49992,63 +49992,63 @@ var require_fetch2 = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization", true); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie", true); - request2.headersList.delete("host", true); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization", true); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie", true); + request4.headersList.delete("host", true); } - if (request2.body != null) { - assert2(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert2(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = cloneRequest(request2); + httpRequest = cloneRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -50125,7 +50125,7 @@ var require_fetch2 = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -50133,7 +50133,7 @@ var require_fetch2 = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -50163,21 +50163,21 @@ var require_fetch2 = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -50206,7 +50206,7 @@ var require_fetch2 = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -50317,17 +50317,17 @@ var require_fetch2 = __commonJS({ } return response; function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: agent.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -50363,8 +50363,8 @@ var require_fetch2 = __commonJS({ location = headersList.get("location", true); this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status); - if (codings.length !== 0 && request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = location && request4.redirect === "follow" && redirectStatusSet.has(status); + if (codings.length !== 0 && request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (let i = codings.length - 1; i >= 0; --i) { const coding = codings[i]; if (coding === "x-gzip" || coding === "gzip") { @@ -50506,32 +50506,32 @@ var require_cache4 = __commonJS({ webidl.util.markAsUncloneable(this); this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.match"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - const p = this.#internalMatchAll(request2, options, 1); + const p = this.#internalMatchAll(request4, options, 1); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.matchAll"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - return this.#internalMatchAll(request2, options); + return this.#internalMatchAll(request4, options); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); const prefix = "Cache.add"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -50541,19 +50541,19 @@ var require_cache4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); const responsePromises = []; const requestList = []; - for (let request2 of requests) { - if (request2 === void 0) { + for (let request4 of requests) { + if (request4 === void 0) { throw webidl.errors.conversionFailed({ prefix, argument: "Argument 1", types: ["undefined is not allowed"] }); } - request2 = webidl.converters.RequestInfo(request2); - if (typeof request2 === "string") { + request4 = webidl.converters.RequestInfo(request4); + if (typeof request4 === "string") { continue; } - const r = getRequestState(request2); + const r = getRequestState(request4); if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: prefix, @@ -50562,8 +50562,8 @@ var require_cache4 = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = getRequestState(new Request(request2)); + for (const request4 of requests) { + const r = getRequestState(new Request(request4)); if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: prefix, @@ -50637,17 +50637,17 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); const prefix = "Cache.put"; webidl.argumentLengthCheck(arguments, 2, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); response = webidl.converters.Response(response, prefix, "response"); let innerRequest = null; - if (webidl.is.Request(request2)) { - innerRequest = getRequestState(request2); + if (webidl.is.Request(request4)) { + innerRequest = getRequestState(request4); } else { - innerRequest = getRequestState(new Request(request2)); + innerRequest = getRequestState(new Request(request4)); } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -50715,21 +50715,21 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.delete"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert2(typeof request2 === "string"); - r = getRequestState(new Request(request2)); + assert2(typeof request4 === "string"); + r = getRequestState(new Request(request4)); } const operations = []; const operation = { @@ -50755,26 +50755,26 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.keys"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -50786,9 +50786,9 @@ var require_cache4 = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = fromInnerRequest( - request3, + request5, void 0, new AbortController().signal, "immutable" @@ -50887,9 +50887,9 @@ var require_cache4 = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -50905,7 +50905,7 @@ var require_cache4 = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -50913,20 +50913,20 @@ var require_cache4 = __commonJS({ } return true; } - #internalMatchAll(request2, options, maxResponses = Infinity) { + #internalMatchAll(request4, options, maxResponses = Infinity) { let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -51014,21 +51014,21 @@ var require_cachestorage2 = __commonJS({ } webidl.util.markAsUncloneable(this); } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, "CacheStorage.match"); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -52118,7 +52118,7 @@ var require_connection2 = __commonJS({ function establishWebSocketConnection(url, protocols, client, handler2, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], client, serviceWorkers: "none", @@ -52130,18 +52130,18 @@ var require_connection2 = __commonJS({ }); if (options.headers) { const headersList = getHeadersList(new Headers(options.headers)); - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue, true); - request2.headersList.append("sec-websocket-version", "13", true); + request4.headersList.append("sec-websocket-key", keyValue, true); + request4.headersList.append("sec-websocket-version", "13", true); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol, true); + request4.headersList.append("sec-websocket-protocol", protocol, true); } const permessageDeflate = "permessage-deflate; client_max_window_bits"; - request2.headersList.append("sec-websocket-extensions", permessageDeflate, true); + request4.headersList.append("sec-websocket-extensions", permessageDeflate, true); const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher, processResponse(response) { @@ -52182,7 +52182,7 @@ var require_connection2 = __commonJS({ } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); if (secProtocol !== null) { - const requestProtocols = getDecodeSplit("sec-websocket-protocol", request2.headersList); + const requestProtocols = getDecodeSplit("sec-websocket-protocol", request4.headersList); if (!requestProtocols.includes(secProtocol)) { failWebsocketConnection(handler2, 1002, "Protocol was not set in the opening handshake."); return; @@ -54382,24 +54382,24 @@ var require_dist_node3 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - endpoint: () => endpoint2 + endpoint: () => endpoint4 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node2(); - var VERSION13 = "9.0.5"; - var userAgent2 = `octokit-endpoint.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; - var DEFAULTS2 = { + var import_universal_user_agent14 = require_dist_node2(); + var VERSION18 = "9.0.5"; + var userAgent4 = `octokit-endpoint.js/${VERSION18} ${(0, import_universal_user_agent14.getUserAgent)()}`; + var DEFAULTS4 = { method: "GET", baseUrl: "https://api.github.com", headers: { accept: "application/vnd.github.v3+json", - "user-agent": userAgent2 + "user-agent": userAgent4 }, mediaType: { format: "" } }; - function lowercaseKeys2(object) { + function lowercaseKeys4(object) { if (!object) { return {}; } @@ -54408,7 +54408,7 @@ var require_dist_node3 = __commonJS({ return newObj; }, {}); } - function isPlainObject4(value) { + function isPlainObject8(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -54419,21 +54419,21 @@ var require_dist_node3 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto2, "constructor") && proto2.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - function mergeDeep2(defaults2, options) { + function mergeDeep4(defaults2, options) { const result = Object.assign({}, defaults2); Object.keys(options).forEach((key) => { - if (isPlainObject4(options[key])) { + if (isPlainObject8(options[key])) { if (!(key in defaults2)) Object.assign(result, { [key]: options[key] }); else - result[key] = mergeDeep2(defaults2[key], options[key]); + result[key] = mergeDeep4(defaults2[key], options[key]); } else { Object.assign(result, { [key]: options[key] }); } }); return result; } - function removeUndefinedProperties2(obj) { + function removeUndefinedProperties4(obj) { for (const key in obj) { if (obj[key] === void 0) { delete obj[key]; @@ -54441,7 +54441,7 @@ var require_dist_node3 = __commonJS({ } return obj; } - function merge2(defaults2, route, options) { + function merge4(defaults2, route, options) { var _a; if (typeof route === "string") { let [method, url] = route.split(" "); @@ -54449,10 +54449,10 @@ var require_dist_node3 = __commonJS({ } else { options = Object.assign({}, route); } - options.headers = lowercaseKeys2(options.headers); - removeUndefinedProperties2(options); - removeUndefinedProperties2(options.headers); - const mergedOptions = mergeDeep2(defaults2 || {}, options); + options.headers = lowercaseKeys4(options.headers); + removeUndefinedProperties4(options); + removeUndefinedProperties4(options.headers); + const mergedOptions = mergeDeep4(defaults2 || {}, options); if (options.url === "/graphql") { if (defaults2 && ((_a = defaults2.mediaType.previews) == null ? void 0 : _a.length)) { mergedOptions.mediaType.previews = defaults2.mediaType.previews.filter( @@ -54463,7 +54463,7 @@ var require_dist_node3 = __commonJS({ } return mergedOptions; } - function addQueryParameters2(url, parameters) { + function addQueryParameters4(url, parameters) { const separator = /\?/.test(url) ? "&" : "?"; const names = Object.keys(parameters); if (names.length === 0) { @@ -54476,18 +54476,18 @@ var require_dist_node3 = __commonJS({ return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } - var urlVariableRegex2 = /\{[^}]+\}/g; - function removeNonChars2(variableName) { + var urlVariableRegex4 = /\{[^}]+\}/g; + function removeNonChars4(variableName) { return variableName.replace(/^\W+|\W+$/g, "").split(/,/); } - function extractUrlVariableNames2(url) { - const matches = url.match(urlVariableRegex2); + function extractUrlVariableNames4(url) { + const matches = url.match(urlVariableRegex4); if (!matches) { return []; } - return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); + return matches.map(removeNonChars4).reduce((a, b) => a.concat(b), []); } - function omit2(object, keysToOmit) { + function omit4(object, keysToOmit) { const result = { __proto__: null }; for (const key of Object.keys(object)) { if (keysToOmit.indexOf(key) === -1) { @@ -54496,7 +54496,7 @@ var require_dist_node3 = __commonJS({ } return result; } - function encodeReserved2(str) { + function encodeReserved4(str) { return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { if (!/%[0-9A-Fa-f]/.test(part)) { part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); @@ -54504,67 +54504,67 @@ var require_dist_node3 = __commonJS({ return part; }).join(""); } - function encodeUnreserved2(str) { + function encodeUnreserved4(str) { return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { return "%" + c.charCodeAt(0).toString(16).toUpperCase(); }); } - function encodeValue2(operator, value, key) { - value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + function encodeValue4(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved4(value) : encodeUnreserved4(value); if (key) { - return encodeUnreserved2(key) + "=" + value; + return encodeUnreserved4(key) + "=" + value; } else { return value; } } - function isDefined2(value) { + function isDefined4(value) { return value !== void 0 && value !== null; } - function isKeyOperator2(operator) { + function isKeyOperator4(operator) { return operator === ";" || operator === "&" || operator === "?"; } - function getValues2(context2, operator, key, modifier) { + function getValues4(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined2(value) && value !== "") { + if (isDefined4(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { value = value.substring(0, parseInt(modifier, 10)); } result.push( - encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value, isKeyOperator4(operator) ? key : "") ); } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { + value.filter(isDefined4).forEach(function(value2) { result.push( - encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value2, isKeyOperator4(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - result.push(encodeValue2(operator, value[k], k)); + if (isDefined4(value[k])) { + result.push(encodeValue4(operator, value[k], k)); } }); } } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { - tmp.push(encodeValue2(operator, value2)); + value.filter(isDefined4).forEach(function(value2) { + tmp.push(encodeValue4(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - tmp.push(encodeUnreserved2(k)); - tmp.push(encodeValue2(operator, value[k].toString())); + if (isDefined4(value[k])) { + tmp.push(encodeUnreserved4(k)); + tmp.push(encodeValue4(operator, value[k].toString())); } }); } - if (isKeyOperator2(operator)) { - result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + if (isKeyOperator4(operator)) { + result.push(encodeUnreserved4(key) + "=" + tmp.join(",")); } else if (tmp.length !== 0) { result.push(tmp.join(",")); } @@ -54572,23 +54572,23 @@ var require_dist_node3 = __commonJS({ } } else { if (operator === ";") { - if (isDefined2(value)) { - result.push(encodeUnreserved2(key)); + if (isDefined4(value)) { + result.push(encodeUnreserved4(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { - result.push(encodeUnreserved2(key) + "="); + result.push(encodeUnreserved4(key) + "="); } else if (value === "") { result.push(""); } } return result; } - function parseUrl2(template) { + function parseUrl4(template) { return { - expand: expand3.bind(null, template) + expand: expand5.bind(null, template) }; } - function expand3(template, context2) { + function expand5(template, context2) { var operators = ["+", "#", ".", "/", ";", "?", "&"]; template = template.replace( /\{([^\{\}]+)\}|([^\{\}]+)/g, @@ -54602,7 +54602,7 @@ var require_dist_node3 = __commonJS({ } expression.split(/,/g).forEach(function(variable) { var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); - values.push(getValues2(context2, operator, tmp[1], tmp[2] || tmp[3])); + values.push(getValues4(context2, operator, tmp[1], tmp[2] || tmp[3])); }); if (operator && operator !== "+") { var separator = ","; @@ -54616,7 +54616,7 @@ var require_dist_node3 = __commonJS({ return values.join(","); } } else { - return encodeReserved2(literal); + return encodeReserved4(literal); } } ); @@ -54626,13 +54626,13 @@ var require_dist_node3 = __commonJS({ return template.replace(/\/$/, ""); } } - function parse4(options) { + function parse6(options) { var _a; let method = options.method.toUpperCase(); let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); let headers = Object.assign({}, options.headers); let body; - let parameters = omit2(options, [ + let parameters = omit4(options, [ "method", "baseUrl", "url", @@ -54640,13 +54640,13 @@ var require_dist_node3 = __commonJS({ "request", "mediaType" ]); - const urlVariableNames = extractUrlVariableNames2(url); - url = parseUrl2(url).expand(parameters); + const urlVariableNames = extractUrlVariableNames4(url); + url = parseUrl4(url).expand(parameters); if (!/^http/.test(url)) { url = options.baseUrl + url; } const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); - const remainingParameters = omit2(parameters, omittedParameters); + const remainingParameters = omit4(parameters, omittedParameters); const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); if (!isBinaryRequest) { if (options.mediaType.format) { @@ -54668,7 +54668,7 @@ var require_dist_node3 = __commonJS({ } } if (["GET", "HEAD"].includes(method)) { - url = addQueryParameters2(url, remainingParameters); + url = addQueryParameters4(url, remainingParameters); } else { if ("data" in remainingParameters) { body = remainingParameters.data; @@ -54690,20 +54690,20 @@ var require_dist_node3 = __commonJS({ options.request ? { request: options.request } : null ); } - function endpointWithDefaults2(defaults2, route, options) { - return parse4(merge2(defaults2, route, options)); + function endpointWithDefaults4(defaults2, route, options) { + return parse6(merge4(defaults2, route, options)); } - function withDefaults4(oldDefaults, newDefaults) { - const DEFAULTS22 = merge2(oldDefaults, newDefaults); - const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + function withDefaults9(oldDefaults, newDefaults) { + const DEFAULTS22 = merge4(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults4.bind(null, DEFAULTS22); return Object.assign(endpoint22, { DEFAULTS: DEFAULTS22, - defaults: withDefaults4.bind(null, DEFAULTS22), - merge: merge2.bind(null, DEFAULTS22), - parse: parse4 + defaults: withDefaults9.bind(null, DEFAULTS22), + merge: merge4.bind(null, DEFAULTS22), + parse: parse6 }); } - var endpoint2 = withDefaults4(null, DEFAULTS2); + var endpoint4 = withDefaults9(null, DEFAULTS4); } }); @@ -54830,14 +54830,14 @@ var require_dist_node5 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - RequestError: () => RequestError2 + RequestError: () => RequestError4 }); module.exports = __toCommonJS(dist_src_exports); var import_deprecation = require_dist_node4(); var import_once = __toESM2(require_once()); var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation)); var logOnceHeaders = (0, import_once.default)((deprecation) => console.warn(deprecation)); - var RequestError2 = class extends Error { + var RequestError4 = class extends Error { constructor(message, statusCode, options) { super(message); if (Error.captureStackTrace) { @@ -54912,13 +54912,13 @@ var require_dist_node6 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - request: () => request2 + request: () => request4 }); module.exports = __toCommonJS(dist_src_exports); - var import_endpoint2 = require_dist_node3(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "8.4.0"; - function isPlainObject4(value) { + var import_endpoint4 = require_dist_node3(); + var import_universal_user_agent14 = require_dist_node(); + var VERSION18 = "8.4.0"; + function isPlainObject8(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -54929,15 +54929,15 @@ var require_dist_node6 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto2, "constructor") && proto2.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - var import_request_error3 = require_dist_node5(); + var import_request_error6 = require_dist_node5(); function getBufferResponse(response) { return response.arrayBuffer(); } - function fetchWrapper2(requestOptions) { + function fetchWrapper4(requestOptions) { var _a, _b, _c, _d; const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console; const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false; - if (isPlainObject4(requestOptions.body) || Array.isArray(requestOptions.body)) { + if (isPlainObject8(requestOptions.body) || Array.isArray(requestOptions.body)) { requestOptions.body = JSON.stringify(requestOptions.body); } let headers = {}; @@ -54979,7 +54979,7 @@ var require_dist_node6 = __commonJS({ if (status < 400) { return; } - throw new import_request_error3.RequestError(response.statusText, status, { + throw new import_request_error6.RequestError(response.statusText, status, { response: { url, status, @@ -54990,19 +54990,19 @@ var require_dist_node6 = __commonJS({ }); } if (status === 304) { - throw new import_request_error3.RequestError("Not modified", status, { + throw new import_request_error6.RequestError("Not modified", status, { response: { url, status, headers, - data: await getResponseData2(response) + data: await getResponseData4(response) }, request: requestOptions }); } if (status >= 400) { - const data = await getResponseData2(response); - const error2 = new import_request_error3.RequestError(toErrorMessage2(data), status, { + const data = await getResponseData4(response); + const error2 = new import_request_error6.RequestError(toErrorMessage4(data), status, { response: { url, status, @@ -55013,7 +55013,7 @@ var require_dist_node6 = __commonJS({ }); throw error2; } - return parseSuccessResponseBody ? await getResponseData2(response) : response.body; + return parseSuccessResponseBody ? await getResponseData4(response) : response.body; }).then((data) => { return { status, @@ -55022,7 +55022,7 @@ var require_dist_node6 = __commonJS({ data }; }).catch((error2) => { - if (error2 instanceof import_request_error3.RequestError) + if (error2 instanceof import_request_error6.RequestError) throw error2; else if (error2.name === "AbortError") throw error2; @@ -55034,12 +55034,12 @@ var require_dist_node6 = __commonJS({ message = error2.cause; } } - throw new import_request_error3.RequestError(message, 500, { + throw new import_request_error6.RequestError(message, 500, { request: requestOptions }); }); } - async function getResponseData2(response) { + async function getResponseData4(response) { const contentType = response.headers.get("content-type"); if (/application\/json/.test(contentType)) { return response.json().catch(() => response.text()).catch(() => ""); @@ -55049,7 +55049,7 @@ var require_dist_node6 = __commonJS({ } return getBufferResponse(response); } - function toErrorMessage2(data) { + function toErrorMessage4(data) { if (typeof data === "string") return data; let suffix; @@ -55066,32 +55066,32 @@ var require_dist_node6 = __commonJS({ } return `Unknown error: ${JSON.stringify(data)}`; } - function withDefaults4(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + function withDefaults9(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper2(endpoint2.parse(endpointOptions)); + return fetchWrapper4(endpoint22.parse(endpointOptions)); } const request22 = (route2, parameters2) => { - return fetchWrapper2( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + return fetchWrapper4( + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; Object.assign(request22, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults9.bind(null, endpoint22) }); return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults9.bind(null, endpoint22) }); } - var request2 = withDefaults4(import_endpoint2.endpoint, { + var request4 = withDefaults9(import_endpoint4.endpoint, { headers: { - "user-agent": `octokit-request.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-request.js/${VERSION18} ${(0, import_universal_user_agent14.getUserAgent)()}` } }); } @@ -55120,24 +55120,24 @@ var require_dist_node7 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - GraphqlResponseError: () => GraphqlResponseError2, - graphql: () => graphql22, + GraphqlResponseError: () => GraphqlResponseError3, + graphql: () => graphql23, withCustomRequest: () => withCustomRequest2 }); module.exports = __toCommonJS(dist_src_exports); var import_request32 = require_dist_node6(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "7.1.0"; + var import_universal_user_agent14 = require_dist_node(); + var VERSION18 = "7.1.0"; var import_request22 = require_dist_node6(); - var import_request15 = require_dist_node6(); - function _buildMessageForResponseErrors2(data) { + var import_request16 = require_dist_node6(); + function _buildMessageForResponseErrors3(data) { return `Request failed due to following response errors: ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } - var GraphqlResponseError2 = class extends Error { - constructor(request2, headers, response) { - super(_buildMessageForResponseErrors2(response)); - this.request = request2; + var GraphqlResponseError3 = class extends Error { + constructor(request22, headers, response) { + super(_buildMessageForResponseErrors3(response)); + this.request = request22; this.headers = headers; this.response = response; this.name = "GraphqlResponseError"; @@ -55148,7 +55148,7 @@ var require_dist_node7 = __commonJS({ } } }; - var NON_VARIABLE_OPTIONS2 = [ + var NON_VARIABLE_OPTIONS3 = [ "method", "baseUrl", "url", @@ -55157,9 +55157,9 @@ var require_dist_node7 = __commonJS({ "query", "mediaType" ]; - var FORBIDDEN_VARIABLE_OPTIONS2 = ["query", "method", "url"]; - var GHES_V3_SUFFIX_REGEX2 = /\/api\/v3\/?$/; - function graphql3(request2, query2, options) { + var FORBIDDEN_VARIABLE_OPTIONS3 = ["query", "method", "url"]; + var GHES_V3_SUFFIX_REGEX3 = /\/api\/v3\/?$/; + function graphql4(request22, query2, options) { if (options) { if (typeof query2 === "string" && "query" in options) { return Promise.reject( @@ -55167,7 +55167,7 @@ var require_dist_node7 = __commonJS({ ); } for (const key in options) { - if (!FORBIDDEN_VARIABLE_OPTIONS2.includes(key)) + if (!FORBIDDEN_VARIABLE_OPTIONS3.includes(key)) continue; return Promise.reject( new Error( @@ -55180,7 +55180,7 @@ var require_dist_node7 = __commonJS({ const requestOptions = Object.keys( parsedOptions ).reduce((result, key) => { - if (NON_VARIABLE_OPTIONS2.includes(key)) { + if (NON_VARIABLE_OPTIONS3.includes(key)) { result[key] = parsedOptions[key]; return result; } @@ -55190,17 +55190,17 @@ var require_dist_node7 = __commonJS({ result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; - if (GHES_V3_SUFFIX_REGEX2.test(baseUrl)) { - requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX2, "/api/graphql"); + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; + if (GHES_V3_SUFFIX_REGEX3.test(baseUrl)) { + requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX3, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { headers[key] = response.headers[key]; } - throw new GraphqlResponseError2( + throw new GraphqlResponseError3( requestOptions, headers, response.data @@ -55209,25 +55209,25 @@ var require_dist_node7 = __commonJS({ return response.data.data; }); } - function withDefaults4(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); + function withDefaults9(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query2, options) => { - return graphql3(newRequest, query2, options); + return graphql4(newRequest, query2, options); }; return Object.assign(newApi, { - defaults: withDefaults4.bind(null, newRequest), + defaults: withDefaults9.bind(null, newRequest), endpoint: newRequest.endpoint }); } - var graphql22 = withDefaults4(import_request32.request, { + var graphql23 = withDefaults9(import_request32.request, { headers: { - "user-agent": `octokit-graphql.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-graphql.js/${VERSION18} ${(0, import_universal_user_agent14.getUserAgent)()}` }, method: "POST", url: "/graphql" }); function withCustomRequest2(customRequest) { - return withDefaults4(customRequest, { + return withDefaults9(customRequest, { method: "POST", url: "/graphql" }); @@ -55281,13 +55281,13 @@ var require_dist_node8 = __commonJS({ } return `token ${token2}`; } - async function hook6(token2, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( + async function hook6(token2, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix2(token2); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix2(token2); + return request4(endpoint4); } var createTokenAuth3 = function createTokenAuth22(token2) { if (!token2) { @@ -55332,17 +55332,17 @@ var require_dist_node9 = __commonJS({ Octokit: () => Octokit3 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node(); + var import_universal_user_agent14 = require_dist_node(); var import_before_after_hook2 = require_before_after_hook(); - var import_request15 = require_dist_node6(); + var import_request16 = require_dist_node6(); var import_graphql3 = require_dist_node7(); var import_auth_token2 = require_dist_node8(); - var VERSION13 = "5.2.0"; + var VERSION18 = "5.2.0"; var noop2 = () => { }; var consoleWarn2 = console.warn.bind(console); var consoleError2 = console.error.bind(console); - var userAgentTrail2 = `octokit-core.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; + var userAgentTrail2 = `octokit-core.js/${VERSION18} ${(0, import_universal_user_agent14.getUserAgent)()}`; var _a; var Octokit3 = (_a = class { static defaults(defaults2) { @@ -55381,7 +55381,7 @@ var require_dist_node9 = __commonJS({ constructor(options = {}) { const hook6 = new import_before_after_hook2.Collection(); const requestDefaults = { - baseUrl: import_request15.request.endpoint.DEFAULTS.baseUrl, + baseUrl: import_request16.request.endpoint.DEFAULTS.baseUrl, headers: {}, request: Object.assign({}, options.request, { hook: hook6.bind(null, "request") @@ -55401,7 +55401,7 @@ var require_dist_node9 = __commonJS({ if (options.timeZone) { requestDefaults.headers["time-zone"] = options.timeZone; } - this.request = import_request15.request.defaults(requestDefaults); + this.request = import_request16.request.defaults(requestDefaults); this.graphql = (0, import_graphql3.withCustomRequest)(this.request).defaults(requestDefaults); this.log = Object.assign( { @@ -55445,7 +55445,7 @@ var require_dist_node9 = __commonJS({ } } }, (() => { - _a.VERSION = VERSION13; + _a.VERSION = VERSION18; })(), (() => { _a.plugins = []; })(), _a); @@ -55479,7 +55479,7 @@ var require_dist_node10 = __commonJS({ restEndpointMethods: () => restEndpointMethods2 }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "10.4.1"; + var VERSION18 = "10.4.1"; var Endpoints2 = { actions: { addCustomLabelsToSelfHostedRunnerForOrg: [ @@ -57471,8 +57471,8 @@ var require_dist_node10 = __commonJS({ var endpoints_default2 = Endpoints2; var endpointMethodsMap2 = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default2)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults2, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults2, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -57595,7 +57595,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - restEndpointMethods2.VERSION = VERSION13; + restEndpointMethods2.VERSION = VERSION18; function legacyRestEndpointMethods2(octokit) { const api = endpointsToMethods2(octokit); return { @@ -57603,7 +57603,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - legacyRestEndpointMethods2.VERSION = VERSION13; + legacyRestEndpointMethods2.VERSION = VERSION18; } }); @@ -57636,7 +57636,7 @@ var require_dist_node11 = __commonJS({ paginatingEndpoints: () => paginatingEndpoints }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "9.2.1"; + var VERSION18 = "9.2.1"; function normalizePaginatedListResponse2(response) { if (!response.data) { return { @@ -57982,7 +57982,7 @@ var require_dist_node11 = __commonJS({ }) }; } - paginateRest2.VERSION = VERSION13; + paginateRest2.VERSION = VERSION18; } }); @@ -61592,9 +61592,9 @@ function addQueryParameters(url, parameters) { return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } -var urlVariableRegex = /\{[^}]+\}/g; +var urlVariableRegex = /\{[^{}}]+\}/g; function removeNonChars(variableName) { - return variableName.replace(/^\W+|\W+$/g, "").split(/,/); + return variableName.replace(/(?:^\W+)|(?:(? { const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; return `application/vnd.github.${preview}-preview${format}`; @@ -61810,12 +61810,12 @@ function endpointWithDefaults(defaults2, route, options) { return parse(merge(defaults2, route, options)); } function withDefaults(oldDefaults, newDefaults) { - const DEFAULTS2 = merge(oldDefaults, newDefaults); - const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2); - return Object.assign(endpoint2, { - DEFAULTS: DEFAULTS2, - defaults: withDefaults.bind(null, DEFAULTS2), - merge: merge.bind(null, DEFAULTS2), + const DEFAULTS22 = merge(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults.bind(null, DEFAULTS22), + merge: merge.bind(null, DEFAULTS22), parse }); } @@ -61844,7 +61844,7 @@ var RequestError = class extends Error { if (options.request.headers.authorization) { requestCopy.headers = Object.assign({}, options.request.headers, { authorization: options.request.headers.authorization.replace( - / .*$/, + /(?]+)>; rel="deprecation"/); + const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/); const deprecationLink = matches && matches.pop(); log.warn( `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` @@ -62007,26 +62007,26 @@ function toErrorMessage(data) { return `Unknown error: ${JSON.stringify(data)}`; } function withDefaults2(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper(endpoint2.parse(endpointOptions)); + return fetchWrapper(endpoint22.parse(endpointOptions)); } - const request2 = (route2, parameters2) => { + const request22 = (route2, parameters2) => { return fetchWrapper( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; - Object.assign(request2, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); - return endpointOptions.request.hook(request2, endpointOptions); + return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); } var request = withDefaults2(endpoint, defaults_default); @@ -62038,9 +62038,9 @@ function _buildMessageForResponseErrors(data) { ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.errors = response.errors; @@ -62065,7 +62065,7 @@ var NON_VARIABLE_OPTIONS = [ ]; var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; -function graphql(request2, query2, options) { +function graphql(request22, query2, options) { if (options) { if (typeof query2 === "string" && "query" in options) { return Promise.reject( @@ -62096,11 +62096,11 @@ function graphql(request2, query2, options) { result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -62115,8 +62115,8 @@ function graphql(request2, query2, options) { return response.data.data; }); } -function withDefaults3(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); +function withDefaults3(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query2, options) => { return graphql(newRequest, query2, options); }; @@ -62132,12 +62132,6 @@ var graphql2 = withDefaults3(request, { method: "POST", url: "/graphql" }); -function withCustomRequest(customRequest) { - return withDefaults3(customRequest, { - method: "POST", - url: "/graphql" - }); -} // async function getPr(prSchema, prNumber, git) { @@ -64768,329 +64762,967 @@ function Collection() { var before_after_hook_default = { Singular, Collection }; // -var b64url = "(?:[a-zA-Z0-9_-]+)"; -var sep2 = "\\."; -var jwtRE = new RegExp(`^${b64url}${sep2}${b64url}${sep2}${b64url}$`); -var isJWT = jwtRE.test.bind(jwtRE); -async function auth(token2) { - const isApp = isJWT(token2); - const isInstallation = token2.startsWith("v1.") || token2.startsWith("ghs_"); - const isUserToServer = token2.startsWith("ghu_"); - const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth"; - return { - type: "token", - token: token2, - tokenType - }; -} -function withAuthorizationPrefix(token2) { - if (token2.split(/\./).length === 3) { - return `bearer ${token2}`; +var VERSION4 = "0.0.0-development"; +var userAgent2 = `octokit-endpoint.js/${VERSION4} ${getUserAgent()}`; +var DEFAULTS2 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent2 + }, + mediaType: { + format: "" } - return `token ${token2}`; +}; +function lowercaseKeys2(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); } -async function hook(token2, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( - route, - parameters - ); - endpoint2.headers.authorization = withAuthorizationPrefix(token2); - return request2(endpoint2); +function isPlainObject4(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto2 = Object.getPrototypeOf(value); + if (proto2 === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto2, "constructor") && proto2.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } -var createTokenAuth = function createTokenAuth2(token2) { - if (!token2) { - throw new Error("[@octokit/auth-token] No token passed to createTokenAuth"); - } - if (typeof token2 !== "string") { - throw new Error( - "[@octokit/auth-token] Token passed to createTokenAuth is not a string" - ); - } - token2 = token2.replace(/^(token|bearer) +/i, ""); - return Object.assign(auth.bind(null, token2), { - hook: hook.bind(null, token2) +function mergeDeep2(defaults2, options) { + const result = Object.assign({}, defaults2); + Object.keys(options).forEach((key) => { + if (isPlainObject4(options[key])) { + if (!(key in defaults2)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep2(defaults2[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } }); -}; - -// -var VERSION4 = "6.1.3"; - -// -var noop = () => { -}; -var consoleWarn = console.warn.bind(console); -var consoleError = console.error.bind(console); -var userAgentTrail = `octokit-core.js/${VERSION4} ${getUserAgent()}`; -var Octokit = class { - static defaults(defaults2) { - const OctokitWithDefaults = class extends this { - constructor(...args) { - const options = args[0] || {}; - if (typeof defaults2 === "function") { - super(defaults2(options)); - return; - } - super( - Object.assign( - {}, - defaults2, - options, - options.userAgent && defaults2.userAgent ? { - userAgent: `${options.userAgent} ${defaults2.userAgent}` - } : null - ) - ); - } - }; - return OctokitWithDefaults; + return result; +} +function removeUndefinedProperties2(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } } - static plugin(...newPlugins) { - const currentPlugins = this.plugins; - const NewOctokit = class extends this { - static plugins = currentPlugins.concat( - newPlugins.filter((plugin) => !currentPlugins.includes(plugin)) - ); - }; - return NewOctokit; + return obj; +} +function merge2(defaults2, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); } - constructor(options = {}) { - const hook6 = new before_after_hook_default.Collection(); - const requestDefaults = { - baseUrl: request.endpoint.DEFAULTS.baseUrl, - headers: {}, - request: Object.assign({}, options.request, { - hook: hook6.bind(null, "request") - }), - mediaType: { - previews: [], - format: "" - } - }; - requestDefaults.headers["user-agent"] = options.userAgent ? `${options.userAgent} ${userAgentTrail}` : userAgentTrail; - if (options.baseUrl) { - requestDefaults.baseUrl = options.baseUrl; - } - if (options.previews) { - requestDefaults.mediaType.previews = options.previews; - } - if (options.timeZone) { - requestDefaults.headers["time-zone"] = options.timeZone; + options.headers = lowercaseKeys2(options.headers); + removeUndefinedProperties2(options); + removeUndefinedProperties2(options.headers); + const mergedOptions = mergeDeep2(defaults2 || {}, options); + if (options.url === "/graphql") { + if (defaults2 && ((_a = defaults2.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults2.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); } - this.request = request.defaults(requestDefaults); - this.graphql = withCustomRequest(this.request).defaults(requestDefaults); - this.log = Object.assign( - { - debug: noop, - info: noop, - warn: consoleWarn, - error: consoleError - }, - options.log - ); - this.hook = hook6; - if (!options.authStrategy) { - if (!options.auth) { - this.auth = async () => ({ - type: "unauthenticated" - }); - } else { - const auth6 = createTokenAuth(options.auth); - hook6.wrap("request", auth6.hook); - this.auth = auth6; - } - } else { - const { authStrategy, ...otherOptions } = options; - const auth6 = authStrategy( - Object.assign( - { - request: this.request, - log: this.log, - octokit: this, - octokitOptions: otherOptions - }, - options.auth - ) - ); - hook6.wrap("request", auth6.hook); - this.auth = auth6; + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters2(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); } - const classConstructor = this.constructor; - for (let i = 0; i < classConstructor.plugins.length; ++i) { - Object.assign(this, classConstructor.plugins[i](this, options)); + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex2 = /\{[^}]+\}/g; +function removeNonChars2(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames2(url) { + const matches = url.match(urlVariableRegex2); + if (!matches) { + return []; + } + return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); +} +function omit2(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; } } - request; - graphql; - log; - hook; - auth; -}; -__publicField(Octokit, "VERSION", VERSION4); -__publicField(Octokit, "plugins", []); - -// -var VERSION5 = "5.3.1"; - -// -function requestLog(octokit) { - octokit.hook.wrap("request", (request2, options) => { - octokit.log.debug("request", options); - const start = Date.now(); - const requestOptions = octokit.request.endpoint.parse(options); - const path4 = requestOptions.url.replace(options.baseUrl, ""); - return request2(options).then((response) => { - const requestId = response.headers["x-github-request-id"]; - octokit.log.info( - `${requestOptions.method} ${path4} - ${response.status} with id ${requestId} in ${Date.now() - start}ms` - ); - return response; - }).catch((error2) => { - var _a; - const requestId = ((_a = error2.response) == null ? void 0 : _a.headers["x-github-request-id"]) || "UNKNOWN"; - octokit.log.error( - `${requestOptions.method} ${path4} - ${error2.status} with id ${requestId} in ${Date.now() - start}ms` - ); - throw error2; - }); + return result; +} +function encodeReserved2(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved2(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); }); } -requestLog.VERSION = VERSION5; - -// -var VERSION6 = "0.0.0-development"; -function normalizePaginatedListResponse(response) { - if (!response.data) { - return { - ...response, - data: [] - }; - } - const responseNeedsNormalization = "total_count" in response.data && !("url" in response.data); - if (!responseNeedsNormalization) - return response; - const incompleteResults = response.data.incomplete_results; - const repositorySelection = response.data.repository_selection; - const totalCount = response.data.total_count; - delete response.data.incomplete_results; - delete response.data.repository_selection; - delete response.data.total_count; - const namespaceKey = Object.keys(response.data)[0]; - const data = response.data[namespaceKey]; - response.data = data; - if (typeof incompleteResults !== "undefined") { - response.data.incomplete_results = incompleteResults; - } - if (typeof repositorySelection !== "undefined") { - response.data.repository_selection = repositorySelection; +function encodeValue2(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + if (key) { + return encodeUnreserved2(key) + "=" + value; + } else { + return value; } - response.data.total_count = totalCount; - return response; } -function iterator(octokit, route, parameters) { - const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters); - const requestMethod = typeof route === "function" ? route : octokit.request; - const method = options.method; - const headers = options.headers; - let url = options.url; - return { - [Symbol.asyncIterator]: () => ({ - async next() { - if (!url) - return { done: true }; - try { - const response = await requestMethod({ method, url, headers }); - const normalizedResponse = normalizePaginatedListResponse(response); - url = ((normalizedResponse.headers.link || "").match( - /<([^>]+)>;\s*rel="next"/ - ) || [])[1]; - return { value: normalizedResponse }; - } catch (error2) { - if (error2.status !== 409) - throw error2; - url = ""; - return { - value: { - status: 200, - headers: {}, - data: [] +function isDefined2(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator2(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues2(context2, operator, key, modifier) { + var value = context2[key], result = []; + if (isDefined2(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + result.push( + encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + result.push(encodeValue2(operator, value[k], k)); } - }; + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + tmp.push(encodeValue2(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + tmp.push(encodeUnreserved2(k)); + tmp.push(encodeValue2(operator, value[k].toString())); + } + }); + } + if (isKeyOperator2(operator)) { + result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); } } - }) + } + } else { + if (operator === ";") { + if (isDefined2(value)) { + result.push(encodeUnreserved2(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved2(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl2(template) { + return { + expand: expand3.bind(null, template) }; } -function paginate(octokit, route, parameters, mapFn) { - if (typeof parameters === "function") { - mapFn = parameters; - parameters = void 0; - } - return gather( - octokit, - [], - iterator(octokit, route, parameters)[Symbol.asyncIterator](), - mapFn +function expand3(template, context2) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues2(context2, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved2(literal); + } + } ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } } -function gather(octokit, results, iterator2, mapFn) { - return iterator2.next().then((result) => { - if (result.done) { - return results; +function parse4(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit2(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames2(url); + url = parseUrl2(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit2(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); } - let earlyExit = false; - function done() { - earlyExit = true; + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } } - results = results.concat( - mapFn ? mapFn(result.value, done) : result.value.data - ); - if (earlyExit) { - return results; + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters2(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } } - return gather(octokit, results, iterator2, mapFn); - }); + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); } -var composePaginateRest = Object.assign(paginate, { - iterator -}); -function paginateRest(octokit) { - return { - paginate: Object.assign(paginate.bind(null, octokit), { - iterator: iterator.bind(null, octokit) - }) - }; +function endpointWithDefaults2(defaults2, route, options) { + return parse4(merge2(defaults2, route, options)); +} +function withDefaults4(oldDefaults, newDefaults) { + const DEFAULTS22 = merge2(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults4.bind(null, DEFAULTS22), + merge: merge2.bind(null, DEFAULTS22), + parse: parse4 + }); } -paginateRest.VERSION = VERSION6; +var endpoint2 = withDefaults4(null, DEFAULTS2); // -var VERSION7 = "13.3.1"; +var import_fast_content_type_parse2 = __toESM(require_fast_content_type_parse(), 1); // -var Endpoints = { - actions: { - addCustomLabelsToSelfHostedRunnerForOrg: [ - "POST /orgs/{org}/actions/runners/{runner_id}/labels" - ], - addCustomLabelsToSelfHostedRunnerForRepo: [ - "POST /repos/{owner}/{repo}/actions/runners/{runner_id}/labels" - ], - addRepoAccessToSelfHostedRunnerGroupInOrg: [ - "PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id}" - ], - addSelectedRepoToOrgSecret: [ - "PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}" - ], - addSelectedRepoToOrgVariable: [ - "PUT /orgs/{org}/actions/variables/{name}/repositories/{repository_id}" - ], - approveWorkflowRun: [ - "POST /repos/{owner}/{repo}/actions/runs/{run_id}/approve" - ], - cancelWorkflowRun: [ - "POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel" - ], - createEnvironmentVariable: [ - "POST /repos/{owner}/{repo}/environments/{environment_name}/variables" +var RequestError2 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION5 = "0.0.0-development"; +var defaults_default2 = { + headers: { + "user-agent": `octokit-request.js/${VERSION5} ${getUserAgent()}` + } +}; +function isPlainObject5(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto2 = Object.getPrototypeOf(value); + if (proto2 === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto2, "constructor") && proto2.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper2(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch2 = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject5(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error2) { + let message = "Unknown Error"; + if (error2 instanceof Error) { + if (error2.name === "AbortError") { + error2.status = 500; + throw error2; + } + message = error2.message; + if (error2.name === "TypeError" && "cause" in error2) { + if (error2.cause instanceof Error) { + message = error2.cause.message; + } else if (typeof error2.cause === "string") { + message = error2.cause; + } + } + } + const requestError = new RequestError2(message, 500, { + request: requestOptions + }); + requestError.cause = error2; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError2(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2(toErrorMessage2(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData2(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData2(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse2.safeParse)(contentType); + if (isJSONResponse2(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse2(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage2(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults5(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper2(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper2( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults5.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults5.bind(null, endpoint22) + }); +} +var request2 = withDefaults5(endpoint2, defaults_default2); + +// +var VERSION6 = "0.0.0-development"; +function _buildMessageForResponseErrors2(data) { + return `Request failed due to following response errors: +` + data.errors.map((e) => ` - ${e.message}`).join("\n"); +} +var GraphqlResponseError2 = class extends Error { + constructor(request22, headers, response) { + super(_buildMessageForResponseErrors2(response)); + this.request = request22; + this.headers = headers; + this.response = response; + this.errors = response.errors; + this.data = response.data; + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + } + name = "GraphqlResponseError"; + errors; + data; +}; +var NON_VARIABLE_OPTIONS2 = [ + "method", + "baseUrl", + "url", + "headers", + "request", + "query", + "mediaType", + "operationName" +]; +var FORBIDDEN_VARIABLE_OPTIONS2 = ["query", "method", "url"]; +var GHES_V3_SUFFIX_REGEX2 = /\/api\/v3\/?$/; +function graphql3(request22, query2, options) { + if (options) { + if (typeof query2 === "string" && "query" in options) { + return Promise.reject( + new Error(`[@octokit/graphql] "query" cannot be used as variable name`) + ); + } + for (const key in options) { + if (!FORBIDDEN_VARIABLE_OPTIONS2.includes(key)) + continue; + return Promise.reject( + new Error( + `[@octokit/graphql] "${key}" cannot be used as variable name` + ) + ); + } + } + const parsedOptions = typeof query2 === "string" ? Object.assign({ query: query2 }, options) : query2; + const requestOptions = Object.keys( + parsedOptions + ).reduce((result, key) => { + if (NON_VARIABLE_OPTIONS2.includes(key)) { + result[key] = parsedOptions[key]; + return result; + } + if (!result.variables) { + result.variables = {}; + } + result.variables[key] = parsedOptions[key]; + return result; + }, {}); + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; + if (GHES_V3_SUFFIX_REGEX2.test(baseUrl)) { + requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX2, "/api/graphql"); + } + return request22(requestOptions).then((response) => { + if (response.data.errors) { + const headers = {}; + for (const key of Object.keys(response.headers)) { + headers[key] = response.headers[key]; + } + throw new GraphqlResponseError2( + requestOptions, + headers, + response.data + ); + } + return response.data.data; + }); +} +function withDefaults6(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); + const newApi = (query2, options) => { + return graphql3(newRequest, query2, options); + }; + return Object.assign(newApi, { + defaults: withDefaults6.bind(null, newRequest), + endpoint: newRequest.endpoint + }); +} +var graphql22 = withDefaults6(request2, { + headers: { + "user-agent": `octokit-graphql.js/${VERSION6} ${getUserAgent()}` + }, + method: "POST", + url: "/graphql" +}); +function withCustomRequest(customRequest) { + return withDefaults6(customRequest, { + method: "POST", + url: "/graphql" + }); +} + +// +var b64url = "(?:[a-zA-Z0-9_-]+)"; +var sep2 = "\\."; +var jwtRE = new RegExp(`^${b64url}${sep2}${b64url}${sep2}${b64url}$`); +var isJWT = jwtRE.test.bind(jwtRE); +async function auth(token2) { + const isApp = isJWT(token2); + const isInstallation = token2.startsWith("v1.") || token2.startsWith("ghs_"); + const isUserToServer = token2.startsWith("ghu_"); + const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth"; + return { + type: "token", + token: token2, + tokenType + }; +} +function withAuthorizationPrefix(token2) { + if (token2.split(/\./).length === 3) { + return `bearer ${token2}`; + } + return `token ${token2}`; +} +async function hook(token2, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( + route, + parameters + ); + endpoint4.headers.authorization = withAuthorizationPrefix(token2); + return request4(endpoint4); +} +var createTokenAuth = function createTokenAuth2(token2) { + if (!token2) { + throw new Error("[@octokit/auth-token] No token passed to createTokenAuth"); + } + if (typeof token2 !== "string") { + throw new Error( + "[@octokit/auth-token] Token passed to createTokenAuth is not a string" + ); + } + token2 = token2.replace(/^(token|bearer) +/i, ""); + return Object.assign(auth.bind(null, token2), { + hook: hook.bind(null, token2) + }); +}; + +// +var VERSION7 = "6.1.4"; + +// +var noop = () => { +}; +var consoleWarn = console.warn.bind(console); +var consoleError = console.error.bind(console); +var userAgentTrail = `octokit-core.js/${VERSION7} ${getUserAgent()}`; +var Octokit = class { + static defaults(defaults2) { + const OctokitWithDefaults = class extends this { + constructor(...args) { + const options = args[0] || {}; + if (typeof defaults2 === "function") { + super(defaults2(options)); + return; + } + super( + Object.assign( + {}, + defaults2, + options, + options.userAgent && defaults2.userAgent ? { + userAgent: `${options.userAgent} ${defaults2.userAgent}` + } : null + ) + ); + } + }; + return OctokitWithDefaults; + } + static plugin(...newPlugins) { + const currentPlugins = this.plugins; + const NewOctokit = class extends this { + static plugins = currentPlugins.concat( + newPlugins.filter((plugin) => !currentPlugins.includes(plugin)) + ); + }; + return NewOctokit; + } + constructor(options = {}) { + const hook6 = new before_after_hook_default.Collection(); + const requestDefaults = { + baseUrl: request.endpoint.DEFAULTS.baseUrl, + headers: {}, + request: Object.assign({}, options.request, { + hook: hook6.bind(null, "request") + }), + mediaType: { + previews: [], + format: "" + } + }; + requestDefaults.headers["user-agent"] = options.userAgent ? `${options.userAgent} ${userAgentTrail}` : userAgentTrail; + if (options.baseUrl) { + requestDefaults.baseUrl = options.baseUrl; + } + if (options.previews) { + requestDefaults.mediaType.previews = options.previews; + } + if (options.timeZone) { + requestDefaults.headers["time-zone"] = options.timeZone; + } + this.request = request.defaults(requestDefaults); + this.graphql = withCustomRequest(this.request).defaults(requestDefaults); + this.log = Object.assign( + { + debug: noop, + info: noop, + warn: consoleWarn, + error: consoleError + }, + options.log + ); + this.hook = hook6; + if (!options.authStrategy) { + if (!options.auth) { + this.auth = async () => ({ + type: "unauthenticated" + }); + } else { + const auth6 = createTokenAuth(options.auth); + hook6.wrap("request", auth6.hook); + this.auth = auth6; + } + } else { + const { authStrategy, ...otherOptions } = options; + const auth6 = authStrategy( + Object.assign( + { + request: this.request, + log: this.log, + octokit: this, + octokitOptions: otherOptions + }, + options.auth + ) + ); + hook6.wrap("request", auth6.hook); + this.auth = auth6; + } + const classConstructor = this.constructor; + for (let i = 0; i < classConstructor.plugins.length; ++i) { + Object.assign(this, classConstructor.plugins[i](this, options)); + } + } + request; + graphql; + log; + hook; + auth; +}; +__publicField(Octokit, "VERSION", VERSION7); +__publicField(Octokit, "plugins", []); + +// +var VERSION8 = "5.3.1"; + +// +function requestLog(octokit) { + octokit.hook.wrap("request", (request4, options) => { + octokit.log.debug("request", options); + const start = Date.now(); + const requestOptions = octokit.request.endpoint.parse(options); + const path4 = requestOptions.url.replace(options.baseUrl, ""); + return request4(options).then((response) => { + const requestId = response.headers["x-github-request-id"]; + octokit.log.info( + `${requestOptions.method} ${path4} - ${response.status} with id ${requestId} in ${Date.now() - start}ms` + ); + return response; + }).catch((error2) => { + var _a; + const requestId = ((_a = error2.response) == null ? void 0 : _a.headers["x-github-request-id"]) || "UNKNOWN"; + octokit.log.error( + `${requestOptions.method} ${path4} - ${error2.status} with id ${requestId} in ${Date.now() - start}ms` + ); + throw error2; + }); + }); +} +requestLog.VERSION = VERSION8; + +// +var VERSION9 = "0.0.0-development"; +function normalizePaginatedListResponse(response) { + if (!response.data) { + return { + ...response, + data: [] + }; + } + const responseNeedsNormalization = "total_count" in response.data && !("url" in response.data); + if (!responseNeedsNormalization) + return response; + const incompleteResults = response.data.incomplete_results; + const repositorySelection = response.data.repository_selection; + const totalCount = response.data.total_count; + delete response.data.incomplete_results; + delete response.data.repository_selection; + delete response.data.total_count; + const namespaceKey = Object.keys(response.data)[0]; + const data = response.data[namespaceKey]; + response.data = data; + if (typeof incompleteResults !== "undefined") { + response.data.incomplete_results = incompleteResults; + } + if (typeof repositorySelection !== "undefined") { + response.data.repository_selection = repositorySelection; + } + response.data.total_count = totalCount; + return response; +} +function iterator(octokit, route, parameters) { + const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters); + const requestMethod = typeof route === "function" ? route : octokit.request; + const method = options.method; + const headers = options.headers; + let url = options.url; + return { + [Symbol.asyncIterator]: () => ({ + async next() { + if (!url) + return { done: true }; + try { + const response = await requestMethod({ method, url, headers }); + const normalizedResponse = normalizePaginatedListResponse(response); + url = ((normalizedResponse.headers.link || "").match( + /<([^<>]+)>;\s*rel="next"/ + ) || [])[1]; + return { value: normalizedResponse }; + } catch (error2) { + if (error2.status !== 409) + throw error2; + url = ""; + return { + value: { + status: 200, + headers: {}, + data: [] + } + }; + } + } + }) + }; +} +function paginate(octokit, route, parameters, mapFn) { + if (typeof parameters === "function") { + mapFn = parameters; + parameters = void 0; + } + return gather( + octokit, + [], + iterator(octokit, route, parameters)[Symbol.asyncIterator](), + mapFn + ); +} +function gather(octokit, results, iterator2, mapFn) { + return iterator2.next().then((result) => { + if (result.done) { + return results; + } + let earlyExit = false; + function done() { + earlyExit = true; + } + results = results.concat( + mapFn ? mapFn(result.value, done) : result.value.data + ); + if (earlyExit) { + return results; + } + return gather(octokit, results, iterator2, mapFn); + }); +} +var composePaginateRest = Object.assign(paginate, { + iterator +}); +function paginateRest(octokit) { + return { + paginate: Object.assign(paginate.bind(null, octokit), { + iterator: iterator.bind(null, octokit) + }) + }; +} +paginateRest.VERSION = VERSION9; + +// +var VERSION10 = "13.3.1"; + +// +var Endpoints = { + actions: { + addCustomLabelsToSelfHostedRunnerForOrg: [ + "POST /orgs/{org}/actions/runners/{runner_id}/labels" + ], + addCustomLabelsToSelfHostedRunnerForRepo: [ + "POST /repos/{owner}/{repo}/actions/runners/{runner_id}/labels" + ], + addRepoAccessToSelfHostedRunnerGroupInOrg: [ + "PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id}" + ], + addSelectedRepoToOrgSecret: [ + "PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}" + ], + addSelectedRepoToOrgVariable: [ + "PUT /orgs/{org}/actions/variables/{name}/repositories/{repository_id}" + ], + approveWorkflowRun: [ + "POST /repos/{owner}/{repo}/actions/runs/{run_id}/approve" + ], + cancelWorkflowRun: [ + "POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel" + ], + createEnvironmentVariable: [ + "POST /repos/{owner}/{repo}/environments/{environment_name}/variables" ], createOrUpdateEnvironmentSecret: [ "PUT /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name}" @@ -67130,429 +67762,1164 @@ var Endpoints = { unfollow: ["DELETE /user/following/{username}"], updateAuthenticated: ["PATCH /user"] } -}; -var endpoints_default = Endpoints; +}; +var endpoints_default = Endpoints; + +// +var endpointMethodsMap = /* @__PURE__ */ new Map(); +for (const [scope, endpoints] of Object.entries(endpoints_default)) { + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults2, decorations] = endpoint4; + const [method, url] = route.split(/ /); + const endpointDefaults = Object.assign( + { + method, + url + }, + defaults2 + ); + if (!endpointMethodsMap.has(scope)) { + endpointMethodsMap.set(scope, /* @__PURE__ */ new Map()); + } + endpointMethodsMap.get(scope).set(methodName, { + scope, + methodName, + endpointDefaults, + decorations + }); + } +} +var handler = { + has({ scope }, methodName) { + return endpointMethodsMap.get(scope).has(methodName); + }, + getOwnPropertyDescriptor(target, methodName) { + return { + value: this.get(target, methodName), + configurable: true, + writable: true, + enumerable: true + }; + }, + defineProperty(target, methodName, descriptor) { + Object.defineProperty(target.cache, methodName, descriptor); + return true; + }, + deleteProperty(target, methodName) { + delete target.cache[methodName]; + return true; + }, + ownKeys({ scope }) { + return [...endpointMethodsMap.get(scope).keys()]; + }, + set(target, methodName, value) { + return target.cache[methodName] = value; + }, + get({ octokit, scope, cache }, methodName) { + if (cache[methodName]) { + return cache[methodName]; + } + const method = endpointMethodsMap.get(scope).get(methodName); + if (!method) { + return void 0; + } + const { endpointDefaults, decorations } = method; + if (decorations) { + cache[methodName] = decorate( + octokit, + scope, + methodName, + endpointDefaults, + decorations + ); + } else { + cache[methodName] = octokit.request.defaults(endpointDefaults); + } + return cache[methodName]; + } +}; +function endpointsToMethods(octokit) { + const newMethods = {}; + for (const scope of endpointMethodsMap.keys()) { + newMethods[scope] = new Proxy({ octokit, scope, cache: {} }, handler); + } + return newMethods; +} +function decorate(octokit, scope, methodName, defaults2, decorations) { + const requestWithDefaults = octokit.request.defaults(defaults2); + function withDecorations(...args) { + let options = requestWithDefaults.endpoint.merge(...args); + if (decorations.mapToData) { + options = Object.assign({}, options, { + data: options[decorations.mapToData], + [decorations.mapToData]: void 0 + }); + return requestWithDefaults(options); + } + if (decorations.renamed) { + const [newScope, newMethodName] = decorations.renamed; + octokit.log.warn( + `octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()` + ); + } + if (decorations.deprecated) { + octokit.log.warn(decorations.deprecated); + } + if (decorations.renamedParameters) { + const options2 = requestWithDefaults.endpoint.merge(...args); + for (const [name, alias2] of Object.entries( + decorations.renamedParameters + )) { + if (name in options2) { + octokit.log.warn( + `"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias2}" instead` + ); + if (!(alias2 in options2)) { + options2[alias2] = options2[name]; + } + delete options2[name]; + } + } + return requestWithDefaults(options2); + } + return requestWithDefaults(...args); + } + return Object.assign(withDecorations, requestWithDefaults); +} + +// +function restEndpointMethods(octokit) { + const api = endpointsToMethods(octokit); + return { + rest: api + }; +} +restEndpointMethods.VERSION = VERSION10; +function legacyRestEndpointMethods(octokit) { + const api = endpointsToMethods(octokit); + return { + ...api, + rest: api + }; +} +legacyRestEndpointMethods.VERSION = VERSION10; + +// +var VERSION11 = "21.1.1"; + +// +var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRest).defaults( + { + userAgent: `octokit-rest.js/${VERSION11}` + } +); + +// +var import_typed_graphqlify4 = __toESM(require_dist()); +var GithubClient = class { + constructor(_octokitOptions) { + this._octokitOptions = _octokitOptions; + this._octokit = new Octokit2({ ...this._octokitOptions }); + this.pulls = this._octokit.pulls; + this.orgs = this._octokit.orgs; + this.repos = this._octokit.repos; + this.issues = this._octokit.issues; + this.git = this._octokit.git; + this.rateLimit = this._octokit.rateLimit; + this.teams = this._octokit.teams; + this.search = this._octokit.search; + this.rest = this._octokit.rest; + this.paginate = this._octokit.paginate; + this.checks = this._octokit.checks; + } +}; +var AuthenticatedGithubClient = class extends GithubClient { + constructor(_token) { + super({ auth: _token }); + this._token = _token; + this._graphql = this._octokit.graphql.defaults({ + headers: { authorization: `token ${this._token}` } + }); + } + async graphql(queryObject, params4 = {}) { + return await this._graphql((0, import_typed_graphqlify4.query)(queryObject).toString(), params4); + } +}; + +// +import { URL as URL2 } from "url"; +var GITHUB_TOKEN_SETTINGS_URL = "https://github.com/settings/tokens"; +var GITHUB_TOKEN_GENERATE_URL = "https://github.com/settings/tokens/new"; +function addTokenToGitHttpsUrl(githubHttpsUrl, token2) { + const url = new URL2(githubHttpsUrl); + url.password = token2; + url.username = "x-access-token"; + return url.href; +} +function getRepositoryGitUrl(config, githubToken) { + if (config.useSsh) { + return `git@github.com:${config.owner}/${config.name}.git`; + } + const baseHttpUrl = `https://github.com/${config.owner}/${config.name}.git`; + if (githubToken !== void 0) { + return addTokenToGitHttpsUrl(baseHttpUrl, githubToken); + } + return baseHttpUrl; +} + +// +var GitCommandError = class extends Error { + constructor(client, unsanitizedArgs) { + super(`Command failed: git ${client.sanitizeConsoleOutput(unsanitizedArgs.join(" "))}`); + } +}; +var GitClient = class { + constructor(config, baseDir = determineRepoBaseDirFromCwd()) { + this.baseDir = baseDir; + this.github = new GithubClient(); + this.gitBinPath = "git"; + this.config = config; + this.remoteConfig = config.github; + this.remoteParams = { owner: config.github.owner, repo: config.github.name }; + this.mainBranchName = config.github.mainBranchName; + } + run(args, options) { + const result = this.runGraceful(args, options); + if (result.status !== 0) { + throw new GitCommandError(this, args); + } + return result; + } + runGraceful(args, options = {}) { + const gitCommand = args[0]; + if (isDryRun() && gitCommand === "push") { + Log.debug(`"git push" is not able to be run in dryRun mode.`); + throw new DryRunError(); + } + args = ["-c", "credential.helper=", ...args]; + Log.debug("Executing: git", this.sanitizeConsoleOutput(args.join(" "))); + const result = spawnSync(this.gitBinPath, args, { + cwd: this.baseDir, + stdio: "pipe", + ...options, + encoding: "utf8" + }); + Log.debug(`Status: ${result.status}, Error: ${!!result.error}, Signal: ${result.signal}`); + if (result.status !== 0 && result.stderr !== null) { + process.stderr.write(this.sanitizeConsoleOutput(result.stderr)); + } + Log.debug("Stdout:", result.stdout); + Log.debug("Stderr:", result.stderr); + Log.debug("Process Error:", result.error); + if (result.error !== void 0) { + process.stderr.write(this.sanitizeConsoleOutput(result.error.message)); + } + return result; + } + getRepoGitUrl() { + return getRepositoryGitUrl(this.remoteConfig); + } + hasCommit(branchName, sha) { + return this.run(["branch", branchName, "--contains", sha]).stdout !== ""; + } + isShallowRepo() { + return this.run(["rev-parse", "--is-shallow-repository"]).stdout.trim() === "true"; + } + getCurrentBranchOrRevision() { + const branchName = this.run(["rev-parse", "--abbrev-ref", "HEAD"]).stdout.trim(); + if (branchName === "HEAD") { + return this.run(["rev-parse", "HEAD"]).stdout.trim(); + } + return branchName; + } + hasUncommittedChanges() { + this.runGraceful(["update-index", "-q", "--refresh"]); + return this.runGraceful(["diff-index", "--quiet", "HEAD"]).status !== 0; + } + checkout(branchOrRevision, cleanState) { + if (cleanState) { + this.runGraceful(["am", "--abort"], { stdio: "ignore" }); + this.runGraceful(["cherry-pick", "--abort"], { stdio: "ignore" }); + this.runGraceful(["rebase", "--abort"], { stdio: "ignore" }); + this.runGraceful(["reset", "--hard"], { stdio: "ignore" }); + } + return this.runGraceful(["checkout", branchOrRevision], { stdio: "ignore" }).status === 0; + } + allChangesFilesSince(shaOrRef = "HEAD") { + return Array.from(/* @__PURE__ */ new Set([ + ...gitOutputAsArray(this.runGraceful(["diff", "--name-only", "--diff-filter=d", shaOrRef])), + ...gitOutputAsArray(this.runGraceful(["ls-files", "--others", "--exclude-standard"])) + ])); + } + allStagedFiles() { + return gitOutputAsArray(this.runGraceful(["diff", "--name-only", "--diff-filter=ACM", "--staged"])); + } + allFiles() { + return gitOutputAsArray(this.runGraceful(["ls-files"])); + } + sanitizeConsoleOutput(value) { + return value; + } + static async get() { + if (GitClient._unauthenticatedInstance === null) { + GitClient._unauthenticatedInstance = (async () => { + return new GitClient(await getConfig([assertValidGithubConfig])); + })(); + } + return GitClient._unauthenticatedInstance; + } +}; +GitClient._unauthenticatedInstance = null; +function gitOutputAsArray(gitCommandResult) { + return gitCommandResult.stdout.split("\n").map((x) => x.trim()).filter((x) => !!x); +} + +// +var AuthenticatedGitClient = class extends GitClient { + constructor(githubToken, userType, config, baseDir) { + super(config, baseDir); + this.githubToken = githubToken; + this.userType = userType; + this._githubTokenRegex = new RegExp(this.githubToken, "g"); + this._cachedOauthScopes = null; + this._cachedForkRepositories = null; + this.github = new AuthenticatedGithubClient(this.githubToken); + } + sanitizeConsoleOutput(value) { + return value.replace(this._githubTokenRegex, ""); + } + getRepoGitUrl() { + return getRepositoryGitUrl(this.remoteConfig, this.githubToken); + } + async hasOauthScopes(testFn) { + if (this.userType === "bot") { + return true; + } + const scopes = await this._fetchAuthScopesForToken(); + const missingScopes = []; + testFn(scopes, missingScopes); + if (missingScopes.length === 0) { + return true; + } + const error2 = `The provided does not have required permissions due to missing scope(s): ${yellow(missingScopes.join(", "))} + +Update the token in use at: + ${GITHUB_TOKEN_SETTINGS_URL} + +Alternatively, a new token can be created at: ${GITHUB_TOKEN_GENERATE_URL} +`; + return { error: error2 }; + } + async getForkOfAuthenticatedUser() { + const forks = await this.getAllForksOfAuthenticatedUser(); + if (forks.length === 0) { + throw Error("Unable to find fork a for currently authenticated user."); + } + return forks[0]; + } + async getAllForksOfAuthenticatedUser() { + if (this._cachedForkRepositories !== null) { + return this._cachedForkRepositories; + } + const { owner: owner2, name } = this.remoteConfig; + const result = await this.github.graphql(findOwnedForksOfRepoQuery, { owner: owner2, name }); + return this._cachedForkRepositories = result.repository.forks.nodes.map((node) => ({ + owner: node.owner.login, + name: node.name + })); + } + _fetchAuthScopesForToken() { + if (this._cachedOauthScopes !== null) { + return this._cachedOauthScopes; + } + return this._cachedOauthScopes = this.github.rateLimit.get().then((response) => { + const scopes = response.headers["x-oauth-scopes"]; + if (scopes === void 0) { + throw Error("Unable to retrieve OAuth scopes for token provided to Git client."); + } + return scopes.split(",").map((scope) => scope.trim()).filter((scope) => scope !== ""); + }); + } + static async get() { + if (AuthenticatedGitClient._token === null) { + throw new Error("No instance of `AuthenticatedGitClient` has been configured."); + } + if (AuthenticatedGitClient._authenticatedInstance === null) { + AuthenticatedGitClient._authenticatedInstance = (async (token2, userType) => { + return new AuthenticatedGitClient(token2, userType, await getConfig([assertValidGithubConfig])); + })(AuthenticatedGitClient._token, AuthenticatedGitClient._userType); + } + return AuthenticatedGitClient._authenticatedInstance; + } + static configure(token2, userType = "user") { + if (AuthenticatedGitClient._token) { + throw Error("Unable to configure `AuthenticatedGitClient` as it has been configured already."); + } + AuthenticatedGitClient._token = token2; + AuthenticatedGitClient._userType = userType; + } +}; +AuthenticatedGitClient._token = null; +AuthenticatedGitClient._authenticatedInstance = null; + +// +var import_core17 = __toESM(require_core()); + +// +function requestToOAuthBaseUrl(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; + return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); +} +async function oauthRequest(request4, route, parameters) { + const withOAuthParameters = { + baseUrl: requestToOAuthBaseUrl(request4), + headers: { + accept: "application/json" + }, + ...parameters + }; + const response = await request4(route, withOAuthParameters); + if ("error" in response.data) { + const error2 = new RequestError( + `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, + 400, + { + request: request4.endpoint.merge( + route, + withOAuthParameters + ) + } + ); + error2.response = response; + throw error2; + } + return response; +} +async function createDeviceCode(options) { + const request4 = options.request || request; + const parameters = { + client_id: options.clientId + }; + if ("scopes" in options && Array.isArray(options.scopes)) { + parameters.scope = options.scopes.join(" "); + } + return oauthRequest(request4, "POST /login/device/code", parameters); +} +async function exchangeDeviceCode(options) { + const request4 = options.request || request; + const response = await oauthRequest( + request4, + "POST /login/oauth/access_token", + { + client_id: options.clientId, + device_code: options.code, + grant_type: "urn:ietf:params:oauth:grant-type:device_code" + } + ); + const authentication = { + clientType: options.clientType, + clientId: options.clientId, + token: response.data.access_token, + scopes: response.data.scope.split(/\s+/).filter(Boolean) + }; + if ("clientSecret" in options) { + authentication.clientSecret = options.clientSecret; + } + if (options.clientType === "github-app") { + if ("refresh_token" in response.data) { + const apiTimeInMs = new Date(response.headers.date).getTime(); + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( + apiTimeInMs, + response.data.expires_in + ), authentication.refreshTokenExpiresAt = toTimestamp2( + apiTimeInMs, + response.data.refresh_token_expires_in + ); + } + delete authentication.scopes; + } + return { ...response, authentication }; +} +function toTimestamp2(apiTimeInMs, expirationInSeconds) { + return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); +} // -var endpointMethodsMap = /* @__PURE__ */ new Map(); -for (const [scope, endpoints] of Object.entries(endpoints_default)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults2, decorations] = endpoint2; - const [method, url] = route.split(/ /); - const endpointDefaults = Object.assign( - { - method, - url - }, - defaults2 - ); - if (!endpointMethodsMap.has(scope)) { - endpointMethodsMap.set(scope, /* @__PURE__ */ new Map()); - } - endpointMethodsMap.get(scope).set(methodName, { - scope, - methodName, - endpointDefaults, - decorations - }); +async function getOAuthAccessToken(state, options) { + const cachedAuthentication = getCachedAuthentication(state, options.auth); + if (cachedAuthentication) + return cachedAuthentication; + const { data: verification } = await createDeviceCode({ + clientType: state.clientType, + clientId: state.clientId, + request: options.request || state.request, + scopes: options.auth.scopes || state.scopes + }); + await state.onVerification(verification); + const authentication = await waitForAccessToken( + options.request || state.request, + state.clientId, + state.clientType, + verification + ); + state.authentication = authentication; + return authentication; +} +function getCachedAuthentication(state, auth22) { + if (auth22.refresh === true) + return false; + if (!state.authentication) + return false; + if (state.clientType === "github-app") { + return state.authentication; } + const authentication = state.authentication; + const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( + " " + ); + const currentScope = authentication.scopes.join(" "); + return newScope === currentScope ? authentication : false; } -var handler = { - has({ scope }, methodName) { - return endpointMethodsMap.get(scope).has(methodName); - }, - getOwnPropertyDescriptor(target, methodName) { +async function wait(seconds) { + await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); +} +async function waitForAccessToken(request4, clientId, clientType, verification) { + try { + const options = { + clientId, + request: request4, + code: verification.device_code + }; + const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ + ...options, + clientType: "oauth-app" + }) : await exchangeDeviceCode({ + ...options, + clientType: "github-app" + }); return { - value: this.get(target, methodName), - configurable: true, - writable: true, - enumerable: true + type: "token", + tokenType: "oauth", + ...authentication }; - }, - defineProperty(target, methodName, descriptor) { - Object.defineProperty(target.cache, methodName, descriptor); - return true; - }, - deleteProperty(target, methodName) { - delete target.cache[methodName]; - return true; - }, - ownKeys({ scope }) { - return [...endpointMethodsMap.get(scope).keys()]; - }, - set(target, methodName, value) { - return target.cache[methodName] = value; - }, - get({ octokit, scope, cache }, methodName) { - if (cache[methodName]) { - return cache[methodName]; + } catch (error2) { + if (!error2.response) + throw error2; + const errorType = error2.response.data.error; + if (errorType === "authorization_pending") { + await wait(verification.interval); + return waitForAccessToken(request4, clientId, clientType, verification); } - const method = endpointMethodsMap.get(scope).get(methodName); - if (!method) { - return void 0; + if (errorType === "slow_down") { + await wait(verification.interval + 5); + return waitForAccessToken(request4, clientId, clientType, verification); } - const { endpointDefaults, decorations } = method; - if (decorations) { - cache[methodName] = decorate( - octokit, - scope, - methodName, - endpointDefaults, - decorations - ); - } else { - cache[methodName] = octokit.request.defaults(endpointDefaults); + throw error2; + } +} +async function auth2(state, authOptions) { + return getOAuthAccessToken(state, { + auth: authOptions + }); +} +async function hook2(state, request4, route, parameters) { + let endpoint4 = request4.endpoint.merge( + route, + parameters + ); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); + } + const { token: token2 } = await getOAuthAccessToken(state, { + request: request4, + auth: { type: "oauth" } + }); + endpoint4.headers.authorization = `token ${token2}`; + return request4(endpoint4); +} +var VERSION12 = "0.0.0-development"; +function createOAuthDeviceAuth(options) { + const requestWithDefaults = options.request || request.defaults({ + headers: { + "user-agent": `octokit-auth-oauth-device.js/${VERSION12} ${getUserAgent()}` } - return cache[methodName]; + }); + const { request: request4 = requestWithDefaults, ...otherOptions } = options; + const state = options.clientType === "github-app" ? { + ...otherOptions, + clientType: "github-app", + request: request4 + } : { + ...otherOptions, + clientType: "oauth-app", + request: request4, + scopes: options.scopes || [] + }; + if (!options.clientId) { + throw new Error( + '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' + ); + } + if (!options.onVerification) { + throw new Error( + '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' + ); + } + return Object.assign(auth2.bind(null, state), { + hook: hook2.bind(null, state) + }); +} + +// +var VERSION13 = "0.0.0-development"; +var userAgent3 = `octokit-endpoint.js/${VERSION13} ${getUserAgent()}`; +var DEFAULTS3 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent3 + }, + mediaType: { + format: "" } }; -function endpointsToMethods(octokit) { - const newMethods = {}; - for (const scope of endpointMethodsMap.keys()) { - newMethods[scope] = new Proxy({ octokit, scope, cache: {} }, handler); +function lowercaseKeys3(object) { + if (!object) { + return {}; } - return newMethods; + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); } -function decorate(octokit, scope, methodName, defaults2, decorations) { - const requestWithDefaults = octokit.request.defaults(defaults2); - function withDecorations(...args) { - let options = requestWithDefaults.endpoint.merge(...args); - if (decorations.mapToData) { - options = Object.assign({}, options, { - data: options[decorations.mapToData], - [decorations.mapToData]: void 0 - }); - return requestWithDefaults(options); +function isPlainObject6(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto2 = Object.getPrototypeOf(value); + if (proto2 === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto2, "constructor") && proto2.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep3(defaults2, options) { + const result = Object.assign({}, defaults2); + Object.keys(options).forEach((key) => { + if (isPlainObject6(options[key])) { + if (!(key in defaults2)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep3(defaults2[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); } - if (decorations.renamed) { - const [newScope, newMethodName] = decorations.renamed; - octokit.log.warn( - `octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()` - ); + }); + return result; +} +function removeUndefinedProperties3(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; } - if (decorations.deprecated) { - octokit.log.warn(decorations.deprecated); + } + return obj; +} +function merge3(defaults2, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys3(options.headers); + removeUndefinedProperties3(options); + removeUndefinedProperties3(options.headers); + const mergedOptions = mergeDeep3(defaults2 || {}, options); + if (options.url === "/graphql") { + if (defaults2 && ((_a = defaults2.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults2.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); } - if (decorations.renamedParameters) { - const options2 = requestWithDefaults.endpoint.merge(...args); - for (const [name, alias2] of Object.entries( - decorations.renamedParameters - )) { - if (name in options2) { - octokit.log.warn( - `"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias2}" instead` - ); - if (!(alias2 in options2)) { - options2[alias2] = options2[name]; - } - delete options2[name]; + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters3(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex3 = /\{[^}]+\}/g; +function removeNonChars3(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames3(url) { + const matches = url.match(urlVariableRegex3); + if (!matches) { + return []; + } + return matches.map(removeNonChars3).reduce((a, b) => a.concat(b), []); +} +function omit3(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved3(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved3(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue3(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved3(value) : encodeUnreserved3(value); + if (key) { + return encodeUnreserved3(key) + "=" + value; + } else { + return value; + } +} +function isDefined3(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator3(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues3(context2, operator, key, modifier) { + var value = context2[key], result = []; + if (isDefined3(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue3(operator, value, isKeyOperator3(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + result.push( + encodeValue3(operator, value2, isKeyOperator3(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + result.push(encodeValue3(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + tmp.push(encodeValue3(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + tmp.push(encodeUnreserved3(k)); + tmp.push(encodeValue3(operator, value[k].toString())); + } + }); + } + if (isKeyOperator3(operator)) { + result.push(encodeUnreserved3(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); } } - return requestWithDefaults(options2); } - return requestWithDefaults(...args); + } else { + if (operator === ";") { + if (isDefined3(value)) { + result.push(encodeUnreserved3(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved3(key) + "="); + } else if (value === "") { + result.push(""); + } } - return Object.assign(withDecorations, requestWithDefaults); -} - -// -function restEndpointMethods(octokit) { - const api = endpointsToMethods(octokit); - return { - rest: api - }; + return result; } -restEndpointMethods.VERSION = VERSION7; -function legacyRestEndpointMethods(octokit) { - const api = endpointsToMethods(octokit); +function parseUrl3(template) { return { - ...api, - rest: api + expand: expand4.bind(null, template) }; } -legacyRestEndpointMethods.VERSION = VERSION7; - -// -var VERSION8 = "21.1.0"; - -// -var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRest).defaults( - { - userAgent: `octokit-rest.js/${VERSION8}` - } -); - -// -var import_typed_graphqlify4 = __toESM(require_dist()); -var GithubClient = class { - constructor(_octokitOptions) { - this._octokitOptions = _octokitOptions; - this._octokit = new Octokit2({ ...this._octokitOptions }); - this.pulls = this._octokit.pulls; - this.orgs = this._octokit.orgs; - this.repos = this._octokit.repos; - this.issues = this._octokit.issues; - this.git = this._octokit.git; - this.rateLimit = this._octokit.rateLimit; - this.teams = this._octokit.teams; - this.search = this._octokit.search; - this.rest = this._octokit.rest; - this.paginate = this._octokit.paginate; - this.checks = this._octokit.checks; - } -}; -var AuthenticatedGithubClient = class extends GithubClient { - constructor(_token) { - super({ auth: _token }); - this._token = _token; - this._graphql = this._octokit.graphql.defaults({ - headers: { authorization: `token ${this._token}` } - }); - } - async graphql(queryObject, params4 = {}) { - return await this._graphql((0, import_typed_graphqlify4.query)(queryObject).toString(), params4); +function expand4(template, context2) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues3(context2, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved3(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); } -}; - -// -import { URL as URL2 } from "url"; -var GITHUB_TOKEN_SETTINGS_URL = "https://github.com/settings/tokens"; -var GITHUB_TOKEN_GENERATE_URL = "https://github.com/settings/tokens/new"; -function addTokenToGitHttpsUrl(githubHttpsUrl, token2) { - const url = new URL2(githubHttpsUrl); - url.password = token2; - url.username = "x-access-token"; - return url.href; } -function getRepositoryGitUrl(config, githubToken) { - if (config.useSsh) { - return `git@github.com:${config.owner}/${config.name}.git`; +function parse5(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit3(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames3(url); + url = parseUrl3(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit3(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } } - const baseHttpUrl = `https://github.com/${config.owner}/${config.name}.git`; - if (githubToken !== void 0) { - return addTokenToGitHttpsUrl(baseHttpUrl, githubToken); + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters3(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } } - return baseHttpUrl; + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults3(defaults2, route, options) { + return parse5(merge3(defaults2, route, options)); } +function withDefaults7(oldDefaults, newDefaults) { + const DEFAULTS22 = merge3(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults3.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults7.bind(null, DEFAULTS22), + merge: merge3.bind(null, DEFAULTS22), + parse: parse5 + }); +} +var endpoint3 = withDefaults7(null, DEFAULTS3); // -var GitCommandError = class extends Error { - constructor(client, unsanitizedArgs) { - super(`Command failed: git ${client.sanitizeConsoleOutput(unsanitizedArgs.join(" "))}`); +var import_fast_content_type_parse3 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError3 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; } }; -var GitClient = class { - constructor(config, baseDir = determineRepoBaseDirFromCwd()) { - this.baseDir = baseDir; - this.github = new GithubClient(); - this.gitBinPath = "git"; - this.config = config; - this.remoteConfig = config.github; - this.remoteParams = { owner: config.github.owner, repo: config.github.name }; - this.mainBranchName = config.github.mainBranchName; + +// +var VERSION14 = "0.0.0-development"; +var defaults_default3 = { + headers: { + "user-agent": `octokit-request.js/${VERSION14} ${getUserAgent()}` } - run(args, options) { - const result = this.runGraceful(args, options); - if (result.status !== 0) { - throw new GitCommandError(this, args); - } - return result; +}; +function isPlainObject7(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto2 = Object.getPrototypeOf(value); + if (proto2 === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto2, "constructor") && proto2.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper3(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch2 = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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" + ); } - runGraceful(args, options = {}) { - const gitCommand = args[0]; - if (isDryRun() && gitCommand === "push") { - Log.debug(`"git push" is not able to be run in dryRun mode.`); - throw new DryRunError(); - } - args = ["-c", "credential.helper=", ...args]; - Log.debug("Executing: git", this.sanitizeConsoleOutput(args.join(" "))); - const result = spawnSync(this.gitBinPath, args, { - cwd: this.baseDir, - stdio: "pipe", - ...options, - encoding: "utf8" + const log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject7(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } }); - Log.debug(`Status: ${result.status}, Error: ${!!result.error}, Signal: ${result.signal}`); - if (result.status !== 0 && result.stderr !== null) { - process.stderr.write(this.sanitizeConsoleOutput(result.stderr)); - } - Log.debug("Stdout:", result.stdout); - Log.debug("Stderr:", result.stderr); - Log.debug("Process Error:", result.error); - if (result.error !== void 0) { - process.stderr.write(this.sanitizeConsoleOutput(result.error.message)); + } catch (error2) { + let message = "Unknown Error"; + if (error2 instanceof Error) { + if (error2.name === "AbortError") { + error2.status = 500; + throw error2; + } + message = error2.message; + if (error2.name === "TypeError" && "cause" in error2) { + if (error2.cause instanceof Error) { + message = error2.cause.message; + } else if (typeof error2.cause === "string") { + message = error2.cause; + } + } } - return result; - } - getRepoGitUrl() { - return getRepositoryGitUrl(this.remoteConfig); - } - hasCommit(branchName, sha) { - return this.run(["branch", branchName, "--contains", sha]).stdout !== ""; + const requestError = new RequestError3(message, 500, { + request: requestOptions + }); + requestError.cause = error2; + throw requestError; } - isShallowRepo() { - return this.run(["rev-parse", "--is-shallow-repository"]).stdout.trim() === "true"; + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; } - getCurrentBranchOrRevision() { - const branchName = this.run(["rev-parse", "--abbrev-ref", "HEAD"]).stdout.trim(); - if (branchName === "HEAD") { - return this.run(["rev-parse", "HEAD"]).stdout.trim(); - } - return branchName; + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); } - hasUncommittedChanges() { - this.runGraceful(["update-index", "-q", "--refresh"]); - return this.runGraceful(["diff-index", "--quiet", "HEAD"]).status !== 0; + if (status === 204 || status === 205) { + return octokitResponse; } - checkout(branchOrRevision, cleanState) { - if (cleanState) { - this.runGraceful(["am", "--abort"], { stdio: "ignore" }); - this.runGraceful(["cherry-pick", "--abort"], { stdio: "ignore" }); - this.runGraceful(["rebase", "--abort"], { stdio: "ignore" }); - this.runGraceful(["reset", "--hard"], { stdio: "ignore" }); + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; } - return this.runGraceful(["checkout", branchOrRevision], { stdio: "ignore" }).status === 0; - } - allChangesFilesSince(shaOrRef = "HEAD") { - return Array.from(/* @__PURE__ */ new Set([ - ...gitOutputAsArray(this.runGraceful(["diff", "--name-only", "--diff-filter=d", shaOrRef])), - ...gitOutputAsArray(this.runGraceful(["ls-files", "--others", "--exclude-standard"])) - ])); + throw new RequestError3(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); } - allStagedFiles() { - return gitOutputAsArray(this.runGraceful(["diff", "--name-only", "--diff-filter=ACM", "--staged"])); + if (status === 304) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); } - allFiles() { - return gitOutputAsArray(this.runGraceful(["ls-files"])); + if (status >= 400) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3(toErrorMessage3(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); } - sanitizeConsoleOutput(value) { - return value; + octokitResponse.data = parseSuccessResponseBody ? await getResponseData3(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData3(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); } - static async get() { - if (GitClient._unauthenticatedInstance === null) { - GitClient._unauthenticatedInstance = (async () => { - return new GitClient(await getConfig([assertValidGithubConfig])); - })(); + const mimetype = (0, import_fast_content_type_parse3.safeParse)(contentType); + if (isJSONResponse3(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; } - return GitClient._unauthenticatedInstance; + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); } -}; -GitClient._unauthenticatedInstance = null; -function gitOutputAsArray(gitCommandResult) { - return gitCommandResult.stdout.split("\n").map((x) => x.trim()).filter((x) => !!x); } - -// -var AuthenticatedGitClient = class extends GitClient { - constructor(githubToken, userType, config, baseDir) { - super(config, baseDir); - this.githubToken = githubToken; - this.userType = userType; - this._githubTokenRegex = new RegExp(this.githubToken, "g"); - this._cachedOauthScopes = null; - this._cachedForkRepositories = null; - this.github = new AuthenticatedGithubClient(this.githubToken); - } - sanitizeConsoleOutput(value) { - return value.replace(this._githubTokenRegex, ""); - } - getRepoGitUrl() { - return getRepositoryGitUrl(this.remoteConfig, this.githubToken); - } - async hasOauthScopes(testFn) { - if (this.userType === "bot") { - return true; - } - const scopes = await this._fetchAuthScopesForToken(); - const missingScopes = []; - testFn(scopes, missingScopes); - if (missingScopes.length === 0) { - return true; - } - const error2 = `The provided does not have required permissions due to missing scope(s): ${yellow(missingScopes.join(", "))} - -Update the token in use at: - ${GITHUB_TOKEN_SETTINGS_URL} - -Alternatively, a new token can be created at: ${GITHUB_TOKEN_GENERATE_URL} -`; - return { error: error2 }; +function isJSONResponse3(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage3(data) { + if (typeof data === "string") { + return data; } - async getForkOfAuthenticatedUser() { - const forks = await this.getAllForksOfAuthenticatedUser(); - if (forks.length === 0) { - throw Error("Unable to find fork a for currently authenticated user."); - } - return forks[0]; + if (data instanceof ArrayBuffer) { + return "Unknown error"; } - async getAllForksOfAuthenticatedUser() { - if (this._cachedForkRepositories !== null) { - return this._cachedForkRepositories; - } - const { owner: owner2, name } = this.remoteConfig; - const result = await this.github.graphql(findOwnedForksOfRepoQuery, { owner: owner2, name }); - return this._cachedForkRepositories = result.repository.forks.nodes.map((node) => ({ - owner: node.owner.login, - name: node.name - })); + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; } - _fetchAuthScopesForToken() { - if (this._cachedOauthScopes !== null) { - return this._cachedOauthScopes; + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults8(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper3(endpoint22.parse(endpointOptions)); } - return this._cachedOauthScopes = this.github.rateLimit.get().then((response) => { - const scopes = response.headers["x-oauth-scopes"]; - if (scopes === void 0) { - throw Error("Unable to retrieve OAuth scopes for token provided to Git client."); - } - return scopes.split(",").map((scope) => scope.trim()).filter((scope) => scope !== ""); + const request22 = (route2, parameters2) => { + return fetchWrapper3( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); - } - static async get() { - if (AuthenticatedGitClient._token === null) { - throw new Error("No instance of `AuthenticatedGitClient` has been configured."); - } - if (AuthenticatedGitClient._authenticatedInstance === null) { - AuthenticatedGitClient._authenticatedInstance = (async (token2, userType) => { - return new AuthenticatedGitClient(token2, userType, await getConfig([assertValidGithubConfig])); - })(AuthenticatedGitClient._token, AuthenticatedGitClient._userType); - } - return AuthenticatedGitClient._authenticatedInstance; - } - static configure(token2, userType = "user") { - if (AuthenticatedGitClient._token) { - throw Error("Unable to configure `AuthenticatedGitClient` as it has been configured already."); - } - AuthenticatedGitClient._token = token2; - AuthenticatedGitClient._userType = userType; - } -}; -AuthenticatedGitClient._token = null; -AuthenticatedGitClient._authenticatedInstance = null; - -// -var import_core17 = __toESM(require_core()); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) + }); +} +var request3 = withDefaults8(endpoint3, defaults_default3); // -function requestToOAuthBaseUrl(request2) { - const endpointDefaults = request2.endpoint.DEFAULTS; +function requestToOAuthBaseUrl2(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); } -async function oauthRequest(request2, route, parameters) { +async function oauthRequest2(request4, route, parameters) { const withOAuthParameters = { - baseUrl: requestToOAuthBaseUrl(request2), + baseUrl: requestToOAuthBaseUrl2(request4), headers: { accept: "application/json" }, ...parameters }; - const response = await request2(route, withOAuthParameters); + const response = await request4(route, withOAuthParameters); if ("error" in response.data) { - const error2 = new RequestError( + const error2 = new RequestError3( `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, 400, { - request: request2.endpoint.merge( + request: request4.endpoint.merge( route, withOAuthParameters ) @@ -67564,9 +68931,9 @@ async function oauthRequest(request2, route, parameters) { return response; } async function exchangeWebFlowCode(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, @@ -67600,57 +68967,9 @@ async function exchangeWebFlowCode(options) { function toTimestamp(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } -async function createDeviceCode(options) { - const request2 = options.request || request; - const parameters = { - client_id: options.clientId - }; - if ("scopes" in options && Array.isArray(options.scopes)) { - parameters.scope = options.scopes.join(" "); - } - return oauthRequest(request2, "POST /login/device/code", parameters); -} -async function exchangeDeviceCode(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, - "POST /login/oauth/access_token", - { - client_id: options.clientId, - device_code: options.code, - grant_type: "urn:ietf:params:oauth:grant-type:device_code" - } - ); - const authentication = { - clientType: options.clientType, - clientId: options.clientId, - token: response.data.access_token, - scopes: response.data.scope.split(/\s+/).filter(Boolean) - }; - if ("clientSecret" in options) { - authentication.clientSecret = options.clientSecret; - } - if (options.clientType === "github-app") { - if ("refresh_token" in response.data) { - const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( - apiTimeInMs, - response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp2( - apiTimeInMs, - response.data.refresh_token_expires_in - ); - } - delete authentication.scopes; - } - return { ...response, authentication }; -} -function toTimestamp2(apiTimeInMs, expirationInSeconds) { - return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); -} async function checkToken(options) { - const request2 = options.request || request; - const response = await request2("POST /applications/{client_id}/token", { + const request4 = options.request || request3; + const response = await request4("POST /applications/{client_id}/token", { headers: { authorization: `basic ${btoa( `${options.clientId}:${options.clientSecret}` @@ -67674,9 +68993,9 @@ async function checkToken(options) { return { ...response, authentication }; } async function refreshToken(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, @@ -67704,9 +69023,9 @@ function toTimestamp3(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function resetToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - const response = await request2( + const response = await request4( "PATCH /applications/{client_id}/token", { headers: { @@ -67731,9 +69050,9 @@ async function resetToken(options) { return { ...response, authentication }; } async function deleteToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/token", { headers: { @@ -67745,9 +69064,9 @@ async function deleteToken(options) { ); } async function deleteAuthorization(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/grant", { headers: { @@ -67760,133 +69079,7 @@ async function deleteAuthorization(options) { } // -async function getOAuthAccessToken(state, options) { - const cachedAuthentication = getCachedAuthentication(state, options.auth); - if (cachedAuthentication) - return cachedAuthentication; - const { data: verification } = await createDeviceCode({ - clientType: state.clientType, - clientId: state.clientId, - request: options.request || state.request, - scopes: options.auth.scopes || state.scopes - }); - await state.onVerification(verification); - const authentication = await waitForAccessToken( - options.request || state.request, - state.clientId, - state.clientType, - verification - ); - state.authentication = authentication; - return authentication; -} -function getCachedAuthentication(state, auth22) { - if (auth22.refresh === true) - return false; - if (!state.authentication) - return false; - if (state.clientType === "github-app") { - return state.authentication; - } - const authentication = state.authentication; - const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( - " " - ); - const currentScope = authentication.scopes.join(" "); - return newScope === currentScope ? authentication : false; -} -async function wait(seconds) { - await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); -} -async function waitForAccessToken(request2, clientId, clientType, verification) { - try { - const options = { - clientId, - request: request2, - code: verification.device_code - }; - const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ - ...options, - clientType: "oauth-app" - }) : await exchangeDeviceCode({ - ...options, - clientType: "github-app" - }); - return { - type: "token", - tokenType: "oauth", - ...authentication - }; - } catch (error2) { - if (!error2.response) - throw error2; - const errorType = error2.response.data.error; - if (errorType === "authorization_pending") { - await wait(verification.interval); - return waitForAccessToken(request2, clientId, clientType, verification); - } - if (errorType === "slow_down") { - await wait(verification.interval + 5); - return waitForAccessToken(request2, clientId, clientType, verification); - } - throw error2; - } -} -async function auth2(state, authOptions) { - return getOAuthAccessToken(state, { - auth: authOptions - }); -} -async function hook2(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( - route, - parameters - ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); - } - const { token: token2 } = await getOAuthAccessToken(state, { - request: request2, - auth: { type: "oauth" } - }); - endpoint2.headers.authorization = `token ${token2}`; - return request2(endpoint2); -} -var VERSION9 = "0.0.0-development"; -function createOAuthDeviceAuth(options) { - const requestWithDefaults = options.request || request.defaults({ - headers: { - "user-agent": `octokit-auth-oauth-device.js/${VERSION9} ${getUserAgent()}` - } - }); - const { request: request2 = requestWithDefaults, ...otherOptions } = options; - const state = options.clientType === "github-app" ? { - ...otherOptions, - clientType: "github-app", - request: request2 - } : { - ...otherOptions, - clientType: "oauth-app", - request: request2, - scopes: options.scopes || [] - }; - if (!options.clientId) { - throw new Error( - '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - if (!options.onVerification) { - throw new Error( - '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - return Object.assign(auth2.bind(null, state), { - hook: hook2.bind(null, state) - }); -} - -// -var VERSION10 = "0.0.0-development"; +var VERSION15 = "0.0.0-development"; async function getAuthentication(state) { if ("code" in state.strategyOptions) { const { authentication } = await exchangeWebFlowCode({ @@ -68022,30 +69215,30 @@ var ROUTES_REQUIRING_BASIC_AUTH = /\/applications\/[^/]+\/(token|grant)s?/; function requiresBasicAuth(url) { return url && ROUTES_REQUIRING_BASIC_AUTH.test(url); } -async function hook3(state, request2, route, parameters = {}) { - const endpoint2 = request2.endpoint.merge( +async function hook3(state, request4, route, parameters = {}) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); } - if (requiresBasicAuth(endpoint2.url)) { + if (requiresBasicAuth(endpoint4.url)) { const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; - return request2(endpoint2); + endpoint4.headers.authorization = `basic ${credentials}`; + return request4(endpoint4); } - const { token: token2 } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request2 }) : await auth3({ ...state, request: request2 }); - endpoint2.headers.authorization = "token " + token2; - return request2(endpoint2); + const { token: token2 } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request4 }) : await auth3({ ...state, request: request4 }); + endpoint4.headers.authorization = "token " + token2; + return request4(endpoint4); } function createOAuthUserAuth({ clientId, clientSecret, clientType = "oauth-app", - request: request2 = request.defaults({ + request: request4 = request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION10} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION15} ${getUserAgent()}` } }), onTokenCreated, @@ -68057,13 +69250,13 @@ function createOAuthUserAuth({ clientSecret, onTokenCreated, strategyOptions, - request: request2 + request: request4 }); return Object.assign(auth3.bind(null, state), { hook: hook3.bind(null, state) }); } -createOAuthUserAuth.VERSION = VERSION10; +createOAuthUserAuth.VERSION = VERSION15; // async function auth4(state, authOptions) { @@ -68102,37 +69295,37 @@ async function auth4(state, authOptions) { }); return userAuth(); } -async function hook4(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( +async function hook4(state, request22, route, parameters) { + let endpoint4 = request22.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request22(endpoint4); } - if (state.clientType === "github-app" && !requiresBasicAuth(endpoint2.url)) { + if (state.clientType === "github-app" && !requiresBasicAuth(endpoint4.url)) { throw new Error( - `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint2.method} ${endpoint2.url}" is not supported.` + `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint4.method} ${endpoint4.url}" is not supported.` ); } const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; + endpoint4.headers.authorization = `basic ${credentials}`; try { - return await request2(endpoint2); + return await request22(endpoint4); } catch (error2) { if (error2.status !== 401) throw error2; - error2.message = `[@octokit/auth-oauth-app] "${endpoint2.method} ${endpoint2.url}" does not support clientId/clientSecret basic authentication.`; + error2.message = `[@octokit/auth-oauth-app] "${endpoint4.method} ${endpoint4.url}" does not support clientId/clientSecret basic authentication.`; throw error2; } } -var VERSION11 = "0.0.0-development"; +var VERSION16 = "0.0.0-development"; function createOAuthAppAuth(options) { const state = Object.assign( { request: request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION11} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION16} ${getUserAgent()}` } }), clientType: "oauth-app" @@ -68576,7 +69769,7 @@ async function getInstallationAuthentication(state, options, customRequest) { } } const appAuthentication = await getAppAuthentication(state); - const request2 = customRequest || state.request; + const request4 = customRequest || state.request; const payload = { installation_id: installationId, mediaType: { @@ -68606,7 +69799,7 @@ async function getInstallationAuthentication(state, options, customRequest) { repository_selection: repositorySelectionOptional, single_file: singleFileName } - } = await request2( + } = await request4( "POST /app/installations/{installation_id}/access_tokens", payload ); @@ -68703,18 +69896,18 @@ function isNotTimeSkewError(error2) { /'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/ )); } -async function hook5(state, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge(route, parameters); - const url = endpoint2.url; +async function hook5(state, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge(route, parameters); + const url = endpoint4.url; if (/\/login\/oauth\/access_token$/.test(url)) { - return request2(endpoint2); + return request4(endpoint4); } - if (requiresAppAuth(url.replace(request2.endpoint.DEFAULTS.baseUrl, ""))) { + if (requiresAppAuth(url.replace(request4.endpoint.DEFAULTS.baseUrl, ""))) { const { token: token22 } = await getAppAuthentication(state); - endpoint2.headers.authorization = `bearer ${token22}`; + endpoint4.headers.authorization = `bearer ${token22}`; let response; try { - response = await request2(endpoint2); + response = await request4(endpoint4); } catch (error2) { if (isNotTimeSkewError(error2)) { throw error2; @@ -68733,33 +69926,33 @@ async function hook5(state, request2, route, parameters) { ...state, timeDifference: diff }); - endpoint2.headers.authorization = `bearer ${token3}`; - return request2(endpoint2); + endpoint4.headers.authorization = `bearer ${token3}`; + return request4(endpoint4); } return response; } if (requiresBasicAuth(url)) { const authentication = await state.oauthApp({ type: "oauth-app" }); - endpoint2.headers.authorization = authentication.headers.authorization; - return request2(endpoint2); + endpoint4.headers.authorization = authentication.headers.authorization; + return request4(endpoint4); } const { token: token2, createdAt } = await getInstallationAuthentication( state, {}, - request2.defaults({ baseUrl: endpoint2.baseUrl }) + request4.defaults({ baseUrl: endpoint4.baseUrl }) ); - endpoint2.headers.authorization = `token ${token2}`; + endpoint4.headers.authorization = `token ${token2}`; return sendRequestWithRetries( state, - request2, - endpoint2, + request4, + endpoint4, createdAt ); } -async function sendRequestWithRetries(state, request2, options, createdAt, retries = 0) { +async function sendRequestWithRetries(state, request4, options, createdAt, retries = 0) { const timeSinceTokenCreationInMs = +/* @__PURE__ */ new Date() - +new Date(createdAt); try { - return await request2(options); + return await request4(options); } catch (error2) { if (error2.status !== 401) { throw error2; @@ -68776,10 +69969,10 @@ async function sendRequestWithRetries(state, request2, options, createdAt, retri `[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${retries}, wait: ${awaitTime / 1e3}s)` ); await new Promise((resolve) => setTimeout(resolve, awaitTime)); - return sendRequestWithRetries(state, request2, options, createdAt, retries); + return sendRequestWithRetries(state, request4, options, createdAt, retries); } } -var VERSION12 = "7.1.4"; +var VERSION17 = "7.1.5"; function createAppAuth(options) { if (!options.appId) { throw new Error("[@octokit/auth-app] appId option is required"); @@ -68798,14 +69991,14 @@ function createAppAuth(options) { }, options.log ); - const request2 = options.request || request.defaults({ + const request4 = options.request || request.defaults({ headers: { - "user-agent": `octokit-auth-app.js/${VERSION12} ${getUserAgent()}` + "user-agent": `octokit-auth-app.js/${VERSION17} ${getUserAgent()}` } }); const state = Object.assign( { - request: request2, + request: request4, cache: getCache() }, options, @@ -68816,7 +70009,7 @@ function createAppAuth(options) { clientType: "github-app", clientId: options.clientId || "", clientSecret: options.clientSecret || "", - request: request2 + request: request4 }) } ); diff --git a/.github/local-actions/labels-sync/main.js b/.github/local-actions/labels-sync/main.js index bcaf2ba07..8f5d5eac4 100644 --- a/.github/local-actions/labels-sync/main.js +++ b/.github/local-actions/labels-sync/main.js @@ -3699,11 +3699,11 @@ var require_util2 = __commonJS({ } return location; } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -3769,7 +3769,7 @@ var require_util2 = __commonJS({ } return true; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const { headersList } = actualResponse; const policyHeader = (headersList.get("referrer-policy") ?? "").split(","); let policy = ""; @@ -3783,7 +3783,7 @@ var require_util2 = __commonJS({ } } if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -3800,33 +3800,33 @@ var require_util2 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; - if (request2.responseTainting === "cors" || request2.mode === "websocket") { + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; + if (request4.responseTainting === "cors" || request4.mode === "websocket") { if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } } } @@ -3858,26 +3858,26 @@ var require_util2 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (request2.referrer instanceof URL) { - referrerSource = request2.referrer; + } else if (request4.referrer instanceof URL) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); if (referrerURL.toString().length > 4096) { referrerURL = referrerOrigin; } - const areSameOrigin = sameOrigin(request2, referrerURL); - const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request2.url); + const areSameOrigin = sameOrigin(request4, referrerURL); + const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request4.url); switch (policy) { case "origin": return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true); @@ -3888,7 +3888,7 @@ var require_util2 = __commonJS({ case "origin-when-cross-origin": return areSameOrigin ? referrerURL : referrerOrigin; case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -4037,7 +4037,7 @@ var require_util2 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -5923,25 +5923,25 @@ var require_request = __commonJS({ static [kHTTP2BuildRequest](origin, opts, handler2) { const headers = opts.headers; opts = { ...opts, headers: null }; - const request2 = new Request(origin, opts, handler2); - request2.headers = {}; + const request4 = new Request(origin, opts, handler2); + request4.headers = {}; if (Array.isArray(headers)) { if (headers.length % 2 !== 0) { throw new InvalidArgumentError("headers array must be even"); } for (let i = 0; i < headers.length; i += 2) { - processHeader(request2, headers[i], headers[i + 1], true); + processHeader(request4, headers[i], headers[i + 1], true); } } else if (headers && typeof headers === "object") { const keys = Object.keys(headers); for (let i = 0; i < keys.length; i++) { const key = keys[i]; - processHeader(request2, key, headers[key], true); + processHeader(request4, key, headers[key], true); } } else if (headers != null) { throw new InvalidArgumentError("headers must be an object or an array"); } - return request2; + return request4; } static [kHTTP2CopyHeaders](raw) { const rawHeaders = raw.split("\r\n"); @@ -5969,28 +5969,28 @@ var require_request = __commonJS({ return skipAppend ? val : `${key}: ${val}\r `; } - function processHeader(request2, key, val, skipAppend = false) { + function processHeader(request4, key, val, skipAppend = false) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { return; } - if (request2.host === null && key.length === 4 && key.toLowerCase() === "host") { + if (request4.host === null && key.length === 4 && key.toLowerCase() === "host") { if (headerCharRegex.exec(val) !== null) { throw new InvalidArgumentError(`invalid ${key} header`); } - request2.host = val; - } else if (request2.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { - request2.contentType = val; + } else if (request4.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { + request4.contentType = val; if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } else if (key.length === 17 && key.toLowerCase() === "transfer-encoding") { throw new InvalidArgumentError("invalid transfer-encoding header"); } else if (key.length === 10 && key.toLowerCase() === "connection") { @@ -5998,7 +5998,7 @@ var require_request = __commonJS({ if (value !== "close" && value !== "keep-alive") { throw new InvalidArgumentError("invalid connection header"); } else if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (key.length === 10 && key.toLowerCase() === "keep-alive") { throw new InvalidArgumentError("invalid keep-alive header"); @@ -6012,19 +6012,19 @@ var require_request = __commonJS({ if (Array.isArray(val)) { for (let i = 0; i < val.length; i++) { if (skipAppend) { - if (request2.headers[key]) - request2.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; + if (request4.headers[key]) + request4.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; else - request2.headers[key] = processHeaderValue(key, val[i], skipAppend); + request4.headers[key] = processHeaderValue(key, val[i], skipAppend); } else { - request2.headers += processHeaderValue(key, val[i]); + request4.headers += processHeaderValue(key, val[i]); } } } else { if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } } } @@ -7168,10 +7168,10 @@ var require_client = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); - this[kQueue].push(request2); + const request4 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; process.nextTick(resume, this); } else { @@ -7195,8 +7195,8 @@ var require_client = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -7244,13 +7244,13 @@ var require_client = __commonJS({ assert(this[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } } else if (client[kRunning] > 0) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7456,8 +7456,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } } @@ -7497,12 +7497,12 @@ var require_client = __commonJS({ onUpgrade(head) { const { upgrade, client, socket, headers, statusCode } = this; assert(upgrade); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(!socket.destroyed); assert(socket === client[kSocket]); assert(!this.paused); - assert(request2.upgrade || request2.method === "CONNECT"); + assert(request4.upgrade || request4.method === "CONNECT"); this.statusCode = null; this.statusText = ""; this.shouldKeepAlive = null; @@ -7519,7 +7519,7 @@ var require_client = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -7530,8 +7530,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert(!this.upgrade); @@ -7540,22 +7540,22 @@ var require_client = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert.strictEqual(this.timeoutType, TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -7586,11 +7586,11 @@ var require_client = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -7607,8 +7607,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert.strictEqual(this.timeoutType, TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -7621,7 +7621,7 @@ var require_client = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } } @@ -7633,8 +7633,8 @@ var require_client = __commonJS({ if (upgrade) { return; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(statusCode >= 100); this.statusCode = null; this.statusText = ""; @@ -7648,11 +7648,11 @@ var require_client = __commonJS({ if (statusCode < 200) { return; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert.strictEqual(client[kRunning], 0); @@ -7710,8 +7710,8 @@ var require_client = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } assert(client[kSize] === 0); } @@ -7741,13 +7741,13 @@ var require_client = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7880,8 +7880,8 @@ var require_client = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + errorRequest(client, request4, err); } } else { onError(client, err); @@ -7935,8 +7935,8 @@ var require_client = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request3 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request3.headersTimeout != null ? request3.headersTimeout : client[kHeadersTimeout]; + const request5 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request5.headersTimeout != null ? request5.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -7958,13 +7958,13 @@ var require_client = __commonJS({ if (client[kRunning] >= (client[kPipelining] || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; - if (socket && socket.servername !== request2.servername) { + client[kServerName] = request4.servername; + if (socket && socket.servername !== request4.servername) { util.destroy(socket, new InformationalError("servername changed")); return; } @@ -7979,16 +7979,16 @@ var require_client = __commonJS({ if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) { return; } - if (client[kRunning] > 0 && !request2.idempotent) { + if (client[kRunning] > 0 && !request4.idempotent) { return; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body))) { return; } - if (!request2.aborted && write(client, request2)) { + if (!request4.aborted && write(client, request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -7998,12 +7998,12 @@ var require_client = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function write(client, request2) { + function write(client, request4) { if (client[kHTTPConnVersion] === "h2") { - writeH2(client, client[kHTTP2Session], request2); + writeH2(client, client[kHTTP2Session], request4); return; } - const { body, method, path, host, upgrade, headers, blocking, reset } = request2; + const { body, method, path, host, upgrade, headers, blocking, reset } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { body.read(0); @@ -8011,31 +8011,31 @@ var require_client = __commonJS({ const bodyLength = util.bodyLength(body); let contentLength = bodyLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(socket, new InformationalError("aborted")); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -8074,7 +8074,7 @@ upgrade: ${upgrade}\r header += headers; } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { if (contentLength === 0) { @@ -8086,7 +8086,7 @@ upgrade: ${upgrade}\r socket.write(`${header}\r `, "latin1"); } - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); socket.cork(); @@ -8095,48 +8095,48 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable({ body: body.stream(), client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body: body.stream(), client, request: request4, socket, contentLength, header, expectsPayload }); } else { - writeBlob({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeBlob({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } } else if (util.isStream(body)) { - writeStream({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeStream({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else if (util.isIterable(body)) { - writeIterable({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else { assert(false); } return true; } - function writeH2(client, session, request2) { - const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; + function writeH2(client, session, request4) { + const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; let headers; if (typeof reqHeaders === "string") headers = Request[kHTTP2CopyHeaders](reqHeaders.trim()); else headers = reqHeaders; if (upgrade) { - errorRequest(client, request2, new Error("Upgrade not supported for H2")); + errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } let stream; @@ -8147,11 +8147,11 @@ upgrade: ${upgrade}\r session.ref(); stream = session.request(headers, { endStream: false, signal }); if (stream.id && !stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; }); } @@ -8170,14 +8170,14 @@ upgrade: ${upgrade}\r } let contentLength = util.bodyLength(body); if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -8202,15 +8202,15 @@ upgrade: ${upgrade}\r ++h2State.openStreams; stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - if (request2.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.once("end", () => { - request2.onComplete([]); + request4.onComplete([]); }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -8228,7 +8228,7 @@ upgrade: ${upgrade}\r }); stream.once("frameError", (type, code) => { const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`); - errorRequest(client, request2, err); + errorRequest(client, request4, err); if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { h2State.streams -= 1; util.destroy(stream, err); @@ -8237,20 +8237,20 @@ upgrade: ${upgrade}\r return true; function writeBodyH2() { if (!body) { - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); stream.cork(); stream.write(body); stream.uncork(); stream.end(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { writeIterable({ client, - request: request2, + request: request4, contentLength, h2stream: stream, expectsPayload, @@ -8262,7 +8262,7 @@ upgrade: ${upgrade}\r writeBlob({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, h2stream: stream, @@ -8274,7 +8274,7 @@ upgrade: ${upgrade}\r writeStream({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, socket: client[kSocket], @@ -8285,7 +8285,7 @@ upgrade: ${upgrade}\r writeIterable({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, header: "", @@ -8297,11 +8297,11 @@ upgrade: ${upgrade}\r } } } - function writeStream({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + function writeStream({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); if (client[kHTTPConnVersion] === "h2") { let onPipeData = function(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); }; const pipe = pipeline( body, @@ -8311,7 +8311,7 @@ upgrade: ${upgrade}\r util.destroy(body, err); util.destroy(h2stream, err); } else { - request2.onRequestSent(); + request4.onRequestSent(); } } ); @@ -8323,7 +8323,7 @@ upgrade: ${upgrade}\r return; } let finished = false; - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -8379,7 +8379,7 @@ upgrade: ${upgrade}\r } socket.on("drain", onDrain).on("error", onFinished); } - async function writeBlob({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeBlob({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength === body.size, "blob body must have content length"); const isH2 = client[kHTTPConnVersion] === "h2"; try { @@ -8399,8 +8399,8 @@ upgrade: ${upgrade}\r socket.write(buffer); socket.uncork(); } - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -8409,7 +8409,7 @@ upgrade: ${upgrade}\r util.destroy(isH2 ? h2stream : socket, err); } } - async function writeIterable({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeIterable({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -8435,7 +8435,7 @@ upgrade: ${upgrade}\r throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } @@ -8443,14 +8443,14 @@ upgrade: ${upgrade}\r } catch (err) { h2stream.destroy(err); } finally { - request2.onRequestSent(); + request4.onRequestSent(); h2stream.end(); h2stream.off("close", onDrain).off("drain", onDrain); } return; } socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -8468,9 +8468,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -8479,7 +8479,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -8518,7 +8518,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -8529,8 +8529,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -8573,10 +8573,10 @@ ${len.toString(16)}\r } } }; - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert(request2.aborted); + request4.onError(err); + assert(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -9671,10 +9671,10 @@ var require_api_request = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -9689,7 +9689,7 @@ var require_api_request = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -10403,7 +10403,7 @@ var require_mock_utils = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (typeof data === "object") { @@ -10508,7 +10508,7 @@ var require_mock_utils = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); handler2.abort = nop; @@ -10565,7 +10565,7 @@ var require_mock_utils = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -10587,7 +10587,7 @@ var require_mock_utils = __commonJS({ var require_mock_interceptor = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils(); var { kDispatches, kDispatchKey, @@ -10650,7 +10650,7 @@ var require_mock_interceptor = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData(statusCode, data, responseOptions = {}) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -12299,7 +12299,7 @@ var require_request2 = __commonJS({ policyContainer: makePolicyContainer() } }; - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = this[kRealm].settingsObject.baseUrl; let signal = null; @@ -12315,17 +12315,17 @@ var require_request2 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(input instanceof Request); - request2 = input[kState]; + request4 = input[kState]; signal = input[kSignal]; } const origin = this[kRealm].settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request4.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -12333,43 +12333,43 @@ var require_request2 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: this[kRealm].settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -12378,14 +12378,14 @@ var require_request2 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, this[kRealm].settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -12400,27 +12400,27 @@ var require_request2 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; @@ -12431,12 +12431,12 @@ var require_request2 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizeMethodRecord[method] ?? normalizeMethod(method); - request2.method = method; + request4.method = method; } if (init.signal !== void 0) { signal = init.signal; } - this[kState] = request2; + this[kState] = request4; const ac = new AbortController(); this[kSignal] = ac.signal; this[kSignal][kRealm] = this[kRealm]; @@ -12470,13 +12470,13 @@ var require_request2 = __commonJS({ } } this[kHeaders] = new Headers(kConstruct); - this[kHeaders][kHeadersList] = request2.headersList; + this[kHeaders][kHeadersList] = request4.headersList; this[kHeaders][kGuard] = "request"; this[kHeaders][kRealm] = this[kRealm]; if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } this[kHeaders][kGuard] = "request-no-cors"; @@ -12495,14 +12495,14 @@ var require_request2 = __commonJS({ } } const inputBody = input instanceof Request ? input[kState].body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !this[kHeaders][kHeadersList].contains("content-type")) { @@ -12514,12 +12514,12 @@ var require_request2 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -12649,7 +12649,7 @@ var require_request2 = __commonJS({ }; mixinBody(Request); function makeRequest(init) { - const request2 = { + const request4 = { method: "GET", localURLsOnly: false, unsafeRequest: false, @@ -12688,13 +12688,13 @@ var require_request2 = __commonJS({ ...init, headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; - request2.url = request2.urlList[0]; - return request2; + request4.url = request4.urlList[0]; + return request4; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(request4.body); } return newRequest; } @@ -12924,14 +12924,14 @@ var require_fetch = __commonJS({ p.reject(e); return p.promise; } - const request2 = requestObject[kState]; + const request4 = requestObject[kState]; if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; const relevantRealm = null; @@ -12943,7 +12943,7 @@ var require_fetch = __commonJS({ locallyAborted = true; assert(controller != null); controller.abort(requestObject.signal.reason); - abortFetch(p, request2, responseObject, requestObject.signal.reason); + abortFetch(p, request4, responseObject, requestObject.signal.reason); } ); const handleFetchDone = (response) => finalizeAndReportTiming(response, "fetch"); @@ -12952,7 +12952,7 @@ var require_fetch = __commonJS({ return Promise.resolve(); } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return Promise.resolve(); } if (response.type === "error") { @@ -12970,7 +12970,7 @@ var require_fetch = __commonJS({ p.resolve(responseObject); }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: init.dispatcher ?? getGlobalDispatcher() @@ -13015,14 +13015,14 @@ var require_fetch = __commonJS({ performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis2, cacheState); } } - function abortFetch(p, request2, responseObject, error) { + function abortFetch(p, request4, responseObject, error) { var _a, _b; if (!error) { error = new DOMException2("The operation was aborted.", "AbortError"); } p.reject(error); - if (request2.body != null && isReadable((_a = request2.body) == null ? void 0 : _a.stream)) { - request2.body.stream.cancel(error).catch((err) => { + if (request4.body != null && isReadable((_a = request4.body) == null ? void 0 : _a.stream)) { + request4.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -13043,7 +13043,7 @@ var require_fetch = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -13055,9 +13055,9 @@ var require_fetch = __commonJS({ var _a, _b, _c, _d; let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currenTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -13065,7 +13065,7 @@ var require_fetch = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -13075,32 +13075,32 @@ var require_fetch = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a = request4.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = (_d = request2.client) == null ? void 0 : _d.origin; + if (request4.origin === "client") { + request4.origin = (_d = request4.client) == null ? void 0 : _d.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept")) { + if (!request4.headersList.contains("accept")) { const value = "*/*"; - request2.headersList.append("accept", value); + request4.headersList.append("accept", value); } - if (!request2.headersList.contains("accept-language")) { - request2.headersList.append("accept-language", "*"); + if (!request4.headersList.contains("accept-language")) { + request4.headersList.append("accept-language", "*"); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -13108,44 +13108,44 @@ var require_fetch = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { response = await (async () => { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; return await schemeFetch(fetchParams); } - if (request2.mode === "same-origin") { + if (request4.mode === "same-origin") { return makeNetworkError('request mode cannot be "same-origin"'); } - if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { return makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; return await schemeFetch(fetchParams); } - if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { return makeNetworkError("URL scheme must be a HTTP(S) scheme"); } - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; return await httpFetch(fetchParams); })(); } @@ -13153,13 +13153,13 @@ var require_fetch = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -13167,26 +13167,26 @@ var require_fetch = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range")) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range")) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -13202,8 +13202,8 @@ var require_fetch = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -13212,12 +13212,12 @@ var require_fetch = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blobURLEntryObject = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !isBlobLike(blobURLEntryObject)) { + if (request4.method !== "GET" || !isBlobLike(blobURLEntryObject)) { return Promise.resolve(makeNetworkError("invalid method")); } const bodyWithType = safelyExtractBody(blobURLEntryObject); @@ -13235,7 +13235,7 @@ var require_fetch = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -13317,41 +13317,41 @@ var require_fetch = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -13361,13 +13361,13 @@ var require_fetch = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -13378,63 +13378,63 @@ var require_fetch = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization"); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie"); - request2.headersList.delete("host"); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization"); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie"); + request4.headersList.delete("host"); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = makeRequest(request2); + httpRequest = makeRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -13511,7 +13511,7 @@ var require_fetch = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -13519,7 +13519,7 @@ var require_fetch = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -13547,21 +13547,21 @@ var require_fetch = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -13590,7 +13590,7 @@ var require_fetch = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -13702,17 +13702,17 @@ var require_fetch = __commonJS({ } return response; async function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: fetchParams.controller.dispatcher.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: fetchParams.controller.dispatcher.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -13758,8 +13758,8 @@ var require_fetch = __commonJS({ } this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = request2.redirect === "follow" && location && redirectStatusSet.has(status); - if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = request4.redirect === "follow" && location && redirectStatusSet.has(status); + if (request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (const coding of codings) { if (coding === "x-gzip" || coding === "gzip") { decoders.push(zlib.createGunzip({ @@ -14693,36 +14693,36 @@ var require_cache = __commonJS({ } this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); - const p = await this.matchAll(request2, options); + const p = await this.matchAll(request4, options); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { var _a; webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -14744,11 +14744,11 @@ var require_cache = __commonJS({ } return Object.freeze(responseList); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.add" }); - request2 = webidl.converters.RequestInfo(request2); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -14758,11 +14758,11 @@ var require_cache = __commonJS({ requests = webidl.converters["sequence"](requests); const responsePromises = []; const requestList = []; - for (const request2 of requests) { - if (typeof request2 === "string") { + for (const request4 of requests) { + if (typeof request4 === "string") { continue; } - const r = request2[kState]; + const r = request4[kState]; if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14771,8 +14771,8 @@ var require_cache = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = new Request(request2)[kState]; + for (const request4 of requests) { + const r = new Request(request4)[kState]; if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14847,16 +14847,16 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 2, { header: "Cache.put" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); response = webidl.converters.Response(response); let innerRequest = null; - if (request2 instanceof Request) { - innerRequest = request2[kState]; + if (request4 instanceof Request) { + innerRequest = request4[kState]; } else { - innerRequest = new Request(request2)[kState]; + innerRequest = new Request(request4)[kState]; } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -14924,20 +14924,20 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.delete" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = new Request(request2)[kState]; + assert(typeof request4 === "string"); + r = new Request(request4)[kState]; } const operations = []; const operation = { @@ -14963,25 +14963,25 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -14993,12 +14993,12 @@ var require_cache = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = new Request("https://a"); - requestObject[kState] = request3; - requestObject[kHeaders][kHeadersList] = request3.headersList; + requestObject[kState] = request5; + requestObject[kHeaders][kHeadersList] = request5.headersList; requestObject[kHeaders][kGuard] = "immutable"; - requestObject[kRealm] = request3.client; + requestObject[kRealm] = request5.client; requestList.push(requestObject); } promise.resolve(Object.freeze(requestList)); @@ -15093,9 +15093,9 @@ var require_cache = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -15111,7 +15111,7 @@ var require_cache = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -15183,21 +15183,21 @@ var require_cachestorage = __commonJS({ webidl.illegalConstructor(); } } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, { header: "CacheStorage.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -16110,7 +16110,7 @@ var require_connection = __commonJS({ function establishWebSocketConnection(url, protocols, ws, onEstablish, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], serviceWorkers: "none", referrer: "no-referrer", @@ -16121,17 +16121,17 @@ var require_connection = __commonJS({ }); if (options.headers) { const headersList = new Headers(options.headers)[kHeadersList]; - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue); - request2.headersList.append("sec-websocket-version", "13"); + request4.headersList.append("sec-websocket-key", keyValue); + request4.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol); + request4.headersList.append("sec-websocket-protocol", protocol); } const permessageDeflate = ""; const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher ?? getGlobalDispatcher(), processResponse(response) { @@ -16164,7 +16164,7 @@ var require_connection = __commonJS({ return; } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); - if (secProtocol !== null && secProtocol !== request2.headersList.get("Sec-WebSocket-Protocol")) { + if (secProtocol !== null && secProtocol !== request4.headersList.get("Sec-WebSocket-Protocol")) { failWebsocketConnection(ws, "Protocol was not set in the opening handshake."); return; } @@ -17209,7 +17209,7 @@ var require_lib = __commonJS({ } exports.isHttps = isHttps; var HttpClient = class { - constructor(userAgent2, handlers, requestOptions) { + constructor(userAgent4, handlers, requestOptions) { this._ignoreSslError = false; this._allowRedirects = true; this._allowRedirectDowngrade = false; @@ -17218,7 +17218,7 @@ var require_lib = __commonJS({ this._maxRetries = 1; this._keepAlive = false; this._disposed = false; - this.userAgent = userAgent2; + this.userAgent = userAgent4; this.handlers = handlers || []; this.requestOptions = requestOptions; if (requestOptions) { @@ -17483,14 +17483,14 @@ var require_lib = __commonJS({ } _mergeHeaders(headers) { if (this.requestOptions && this.requestOptions.headers) { - return Object.assign({}, lowercaseKeys2(this.requestOptions.headers), lowercaseKeys2(headers || {})); + return Object.assign({}, lowercaseKeys4(this.requestOptions.headers), lowercaseKeys4(headers || {})); } - return lowercaseKeys2(headers || {}); + return lowercaseKeys4(headers || {}); } _getExistingOrDefaultHeader(additionalHeaders, header, _default) { let clientHeader; if (this.requestOptions && this.requestOptions.headers) { - clientHeader = lowercaseKeys2(this.requestOptions.headers)[header]; + clientHeader = lowercaseKeys4(this.requestOptions.headers)[header]; } return additionalHeaders[header] || clientHeader || _default; } @@ -17625,7 +17625,7 @@ var require_lib = __commonJS({ } }; exports.HttpClient = HttpClient; - var lowercaseKeys2 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + var lowercaseKeys4 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); } }); @@ -20462,10 +20462,10 @@ var require_util8 = __commonJS({ } return obj; } - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert(request2.aborted); + request4.onError(err); + assert(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -20993,7 +20993,7 @@ var require_request3 = __commonJS({ return this; } }; - function processHeader(request2, key, val) { + function processHeader(request4, key, val) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { @@ -21032,19 +21032,19 @@ var require_request3 = __commonJS({ } else { val = `${val}`; } - if (request2.host === null && headerName === "host") { + if (request4.host === null && headerName === "host") { if (typeof val !== "string") { throw new InvalidArgumentError("invalid host header"); } - request2.host = val; - } else if (request2.contentLength === null && headerName === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && headerName === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && headerName === "content-type") { - request2.contentType = val; - request2.headers.push(key, val); + } else if (request4.contentType === null && headerName === "content-type") { + request4.contentType = val; + request4.headers.push(key, val); } else if (headerName === "transfer-encoding" || headerName === "keep-alive" || headerName === "upgrade") { throw new InvalidArgumentError(`invalid ${headerName} header`); } else if (headerName === "connection") { @@ -21053,12 +21053,12 @@ var require_request3 = __commonJS({ throw new InvalidArgumentError("invalid connection header"); } if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (headerName === "expect") { throw new NotSupportedError("expect header not supported"); } else { - request2.headers.push(key, val); + request4.headers.push(key, val); } } module.exports = Request; @@ -23371,11 +23371,11 @@ var require_util9 = __commonJS({ function normalizeBinaryStringToUtf8(value) { return Buffer.from(value, "binary").toString("utf8"); } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -23412,10 +23412,10 @@ var require_util9 = __commonJS({ } return policy; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const policy = parseReferrerPolicy(actualResponse); if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -23432,33 +23432,33 @@ var require_util9 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header, true); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; if (serializedOrigin === "client" || serializedOrigin === void 0) { return; } - if (request2.responseTainting === "cors" || request2.mode === "websocket") { - request2.headersList.append("origin", serializedOrigin, true); - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + if (request4.responseTainting === "cors" || request4.mode === "websocket") { + request4.headersList.append("origin", serializedOrigin, true); + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } - request2.headersList.append("origin", serializedOrigin, true); + request4.headersList.append("origin", serializedOrigin, true); } } function coarsenTime(timestamp, crossOriginIsolatedCapability) { @@ -23512,18 +23512,18 @@ var require_util9 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (webidl.is.URL(request2.referrer)) { - referrerSource = request2.referrer; + } else if (webidl.is.URL(request4.referrer)) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); @@ -23541,14 +23541,14 @@ var require_util9 = __commonJS({ case "unsafe-url": return referrerURL; case "strict-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } return referrerOrigin; } case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -23558,17 +23558,17 @@ var require_util9 = __commonJS({ return referrerOrigin; } case "same-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return "no-referrer"; case "origin-when-cross-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return referrerOrigin; case "no-referrer-when-downgrade": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } @@ -23732,7 +23732,7 @@ var require_util9 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -25205,11 +25205,11 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } - request2.onResponseStarted(); + request4.onResponseStarted(); return 0; } onHeaderField(buf) { @@ -25257,9 +25257,9 @@ var require_client_h1 = __commonJS({ assert(!socket.destroyed); assert(!this.paused); assert((headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); - assert(request2.upgrade || request2.method === "CONNECT"); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); + assert(request4.upgrade || request4.method === "CONNECT"); this.statusCode = 0; this.statusText = ""; this.shouldKeepAlive = false; @@ -25276,7 +25276,7 @@ var require_client_h1 = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -25287,8 +25287,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert(!this.upgrade); @@ -25297,22 +25297,22 @@ var require_client_h1 = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert(this.timeoutType === TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -25343,11 +25343,11 @@ var require_client_h1 = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -25364,8 +25364,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(this.timeoutType === TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -25378,7 +25378,7 @@ var require_client_h1 = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } return 0; @@ -25393,8 +25393,8 @@ var require_client_h1 = __commonJS({ } assert(statusCode >= 100); assert((this.headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); this.statusCode = 0; this.statusText = ""; this.bytesRead = 0; @@ -25406,11 +25406,11 @@ var require_client_h1 = __commonJS({ if (statusCode < 200) { return 0; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert(client[kRunning] === 0); @@ -25476,8 +25476,8 @@ var require_client_h1 = __commonJS({ return { version: "h1", defaultPipelining: 1, - write(request2) { - return writeH1(client, request2); + write(request4) { + return writeH1(client, request4); }, resume() { resumeH1(client); @@ -25493,18 +25493,18 @@ var require_client_h1 = __commonJS({ get destroyed() { return socket.destroyed; }, - busy(request2) { + busy(request4) { if (socket[kWriting] || socket[kReset] || socket[kBlocking]) { return true; } - if (request2) { - if (client[kRunning] > 0 && !request2.idempotent) { + if (request4) { + if (client[kRunning] > 0 && !request4.idempotent) { return true; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return true; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body) || util.isFormDataLike(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body) || util.isFormDataLike(request4.body))) { return true; } } @@ -25551,13 +25551,13 @@ var require_client_h1 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -25585,8 +25585,8 @@ var require_client_h1 = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request2 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request2.headersTimeout != null ? request2.headersTimeout : client[kHeadersTimeout]; + const request4 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request4.headersTimeout != null ? request4.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -25595,21 +25595,21 @@ var require_client_h1 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH1(client, request2) { - const { method, path, host, upgrade, blocking, reset } = request2; - let { body, headers, contentLength } = request2; + function writeH1(client, request4) { + const { method, path, host, upgrade, blocking, reset } = request4; + let { body, headers, contentLength } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH"; if (util.isFormDataLike(body)) { if (!extractBody) { extractBody = require_body2().extractBody; } const [bodyStream, contentType] = extractBody(body); - if (request2.contentType == null) { + if (request4.contentType == null) { headers.push("content-type", contentType); } body = bodyStream.stream; contentLength = bodyStream.length; - } else if (util.isBlobLike(body) && request2.contentType == null && body.type) { + } else if (util.isBlobLike(body) && request4.contentType == null && body.type) { headers.push("content-type", body.type); } if (body && typeof body.read === "function") { @@ -25618,33 +25618,33 @@ var require_client_h1 = __commonJS({ const bodyLength = util.bodyLength(body); contentLength = bodyLength ?? contentLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - util.errorRequest(client, request2, err || new RequestAbortedError()); + util.errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(body); util.destroy(socket, new InformationalError("aborted")); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -25695,31 +25695,31 @@ upgrade: ${upgrade}\r } } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { - writeBuffer(abort, null, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, null, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBuffer(body)) { - writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable(abort, body.stream(), client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body.stream(), client, request4, socket, contentLength, header, expectsPayload); } else { - writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload); } } else if (util.isStream(body)) { - writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isIterable(body)) { - writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else { assert(false); } return true; } - function writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); let finished = false; - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -25785,7 +25785,7 @@ upgrade: ${upgrade}\r setImmediate(onClose); } } - function writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload) { try { if (!body) { if (contentLength === 0) { @@ -25805,18 +25805,18 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(body); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (err) { abort(err); } } - async function writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -25829,9 +25829,9 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(buffer); socket.uncork(); - request2.onBodySent(buffer); - request2.onRequestSent(); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(buffer); + request4.onRequestSent(); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } client[kResume](); @@ -25839,7 +25839,7 @@ upgrade: ${upgrade}\r abort(err); } } - async function writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -25858,7 +25858,7 @@ upgrade: ${upgrade}\r } }); socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -25876,9 +25876,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ abort, socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ abort, socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -25888,7 +25888,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -25907,7 +25907,7 @@ upgrade: ${upgrade}\r } socket.cork(); if (bytesWritten === 0) { - if (!expectsPayload && request2.reset !== false) { + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } if (contentLength === null) { @@ -25927,7 +25927,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -25938,8 +25938,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -26082,8 +26082,8 @@ var require_client_h2 = __commonJS({ return { version: "h2", defaultPipelining: Infinity, - write(request2) { - return writeH2(client, request2); + write(request4) { + return writeH2(client, request4); }, resume() { resumeH2(client); @@ -26141,9 +26141,9 @@ var require_client_h2 = __commonJS({ this[kHTTP2Session] = null; util.destroy(this[kSocket], err); if (client[kRunningIdx] < client[kQueue].length) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); client[kPendingIdx] = client[kRunningIdx]; } assert(client[kRunning] === 0); @@ -26160,8 +26160,8 @@ var require_client_h2 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } } @@ -26192,13 +26192,13 @@ var require_client_h2 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH2(client, request2) { - const requestTimeout = request2.bodyTimeout ?? client[kBodyTimeout]; + function writeH2(client, request4) { + const requestTimeout = request4.bodyTimeout ?? client[kBodyTimeout]; const session = client[kHTTP2Session]; - const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; - let { body } = request2; + const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; + let { body } = request4; if (upgrade) { - util.errorRequest(client, request2, new Error("Upgrade not supported for H2")); + util.errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } const headers = {}; @@ -26222,11 +26222,11 @@ var require_client_h2 = __commonJS({ headers[HTTP2_HEADER_AUTHORITY] = host || `${hostname}${port ? `:${port}` : ""}`; headers[HTTP2_HEADER_METHOD] = method; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } err = err || new RequestAbortedError(); - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); if (stream != null) { stream.removeAllListeners("data"); stream.close(); @@ -26236,23 +26236,23 @@ var require_client_h2 = __commonJS({ util.destroy(body, err); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "CONNECT") { session.ref(); stream = session.request(headers, { endStream: false, signal }); if (!stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; }); @@ -26280,14 +26280,14 @@ var require_client_h2 = __commonJS({ contentLength = bodyStream.length; } if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -26303,7 +26303,7 @@ var require_client_h2 = __commonJS({ header += `${key}: ${headers[key]}\r `; } - channels.sendHeaders.publish({ request: request2, headers: header, socket: session[kSocket] }); + channels.sendHeaders.publish({ request: request4, headers: header, socket: session[kSocket] }); } const shouldEndStream = method === "GET" || method === "HEAD" || body === null; if (expectContinue) { @@ -26321,17 +26321,17 @@ var require_client_h2 = __commonJS({ stream.setTimeout(requestTimeout); stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - request2.onResponseStarted(); - if (request2.aborted) { + request4.onResponseStarted(); + if (request4.aborted) { stream.removeAllListeners("data"); return; } - if (request2.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -26339,8 +26339,8 @@ var require_client_h2 = __commonJS({ var _a; stream.removeAllListeners("data"); if (((_a = stream.state) == null ? void 0 : _a.state) == null || stream.state.state < 6) { - if (!request2.aborted && !request2.completed) { - request2.onComplete({}); + if (!request4.aborted && !request4.completed) { + request4.onComplete({}); } client[kQueue][client[kRunningIdx]++] = null; client[kResume](); @@ -26383,10 +26383,10 @@ var require_client_h2 = __commonJS({ abort(err); }); stream.once("trailers", (trailers) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - request2.onComplete(trailers); + request4.onComplete(trailers); }); return true; function writeBodyH2() { @@ -26396,7 +26396,7 @@ var require_client_h2 = __commonJS({ stream, null, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26407,7 +26407,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26419,7 +26419,7 @@ var require_client_h2 = __commonJS({ stream, body.stream(), client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26430,7 +26430,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26444,7 +26444,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, contentLength ); } else if (util.isIterable(body)) { @@ -26453,7 +26453,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26463,7 +26463,7 @@ var require_client_h2 = __commonJS({ } } } - function writeBuffer(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + function writeBuffer(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { try { if (body != null && util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); @@ -26471,18 +26471,18 @@ var require_client_h2 = __commonJS({ h2stream.write(body); h2stream.uncork(); h2stream.end(); - request2.onBodySent(body); + request4.onBodySent(body); } if (!expectsPayload) { socket[kReset] = true; } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (error) { abort(error); } } - function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) { + function writeStream(abort, socket, expectsPayload, h2stream, body, client, request4, contentLength) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); const pipe = pipeline( body, @@ -26493,7 +26493,7 @@ var require_client_h2 = __commonJS({ abort(err); } else { util.removeAllListeners(pipe); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26503,10 +26503,10 @@ var require_client_h2 = __commonJS({ ); util.addListener(pipe, "data", onPipeData); function onPipeData(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); } } - async function writeBlob(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeBlob(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -26517,8 +26517,8 @@ var require_client_h2 = __commonJS({ h2stream.write(buffer); h2stream.uncork(); h2stream.end(); - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26527,7 +26527,7 @@ var require_client_h2 = __commonJS({ abort(err); } } - async function writeIterable(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeIterable(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -26552,13 +26552,13 @@ var require_client_h2 = __commonJS({ throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } } h2stream.end(); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26805,10 +26805,10 @@ var require_client2 = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = new Request(origin, opts, handler2); - this[kQueue].push(request2); + const request4 = new Request(origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; queueMicrotask(() => resume(this)); } else { @@ -26832,8 +26832,8 @@ var require_client2 = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(this, request2, err); + const request4 = requests[i]; + util.errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -26857,8 +26857,8 @@ var require_client2 = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } assert(client[kSize] === 0); } @@ -26962,8 +26962,8 @@ var require_client2 = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - util.errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + util.errorRequest(client, request4, err); } } else { onError(client, err); @@ -27021,12 +27021,12 @@ var require_client2 = __commonJS({ if (client[kRunning] >= (getPipelining(client) || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; + client[kServerName] = request4.servername; (_a = client[kHTTPContext]) == null ? void 0 : _a.destroy(new InformationalError("servername changed"), () => { client[kHTTPContext] = null; resume(client); @@ -27042,10 +27042,10 @@ var require_client2 = __commonJS({ if (client[kHTTPContext].destroyed) { return; } - if (client[kHTTPContext].busy(request2)) { + if (client[kHTTPContext].busy(request4)) { return; } - if (!request2.aborted && client[kHTTPContext].write(request2)) { + if (!request4.aborted && client[kHTTPContext].write(request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -28659,10 +28659,10 @@ var require_api_request2 = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -28678,7 +28678,7 @@ var require_api_request2 = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -29444,7 +29444,7 @@ var require_mock_utils2 = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (data instanceof Uint8Array) { @@ -29577,7 +29577,7 @@ var require_mock_utils2 = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); (_a = handler2.onConnect) == null ? void 0 : _a.call(handler2, (err) => handler2.onError(err), null); @@ -29634,7 +29634,7 @@ var require_mock_utils2 = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -29657,7 +29657,7 @@ var require_mock_utils2 = __commonJS({ var require_mock_interceptor2 = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils2(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils2(); var { kDispatches, kDispatchKey, @@ -29722,7 +29722,7 @@ var require_mock_interceptor2 = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData({ statusCode, data, responseOptions }) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -32022,7 +32022,7 @@ var require_sqlite_cache_store = __commonJS({ var { Writable } = __require("stream"); var { assertCacheKey, assertCacheValue } = require_cache2(); var DatabaseSync; - var VERSION13 = 3; + var VERSION17 = 3; var MAX_ENTRY_SIZE = 2 * 1e3 * 1e3 * 1e3; module.exports = class SqliteCacheStore { #maxEntrySize = MAX_ENTRY_SIZE; @@ -32061,7 +32061,7 @@ var require_sqlite_cache_store = __commonJS({ } this.#db = new DatabaseSync((opts == null ? void 0 : opts.location) ?? ":memory:"); this.#db.exec(` - CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION13} ( + CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION17} ( -- Data specific to us id INTEGER PRIMARY KEY AUTOINCREMENT, url TEXT NOT NULL, @@ -32080,9 +32080,9 @@ var require_sqlite_cache_store = __commonJS({ staleAt INTEGER NOT NULL ); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_url ON cacheInterceptorV${VERSION13}(url); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_method ON cacheInterceptorV${VERSION13}(method); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_deleteAt ON cacheInterceptorV${VERSION13}(deleteAt); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_url ON cacheInterceptorV${VERSION17}(url); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_method ON cacheInterceptorV${VERSION17}(method); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_deleteAt ON cacheInterceptorV${VERSION17}(deleteAt); `); this.#getValuesQuery = this.#db.prepare(` SELECT @@ -32097,7 +32097,7 @@ var require_sqlite_cache_store = __commonJS({ vary, cachedAt, staleAt - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION17} WHERE url = ? AND method = ? @@ -32105,7 +32105,7 @@ var require_sqlite_cache_store = __commonJS({ deleteAt ASC `); this.#updateValueQuery = this.#db.prepare(` - UPDATE cacheInterceptorV${VERSION13} SET + UPDATE cacheInterceptorV${VERSION17} SET body = ?, deleteAt = ?, statusCode = ?, @@ -32119,7 +32119,7 @@ var require_sqlite_cache_store = __commonJS({ id = ? `); this.#insertValueQuery = this.#db.prepare(` - INSERT INTO cacheInterceptorV${VERSION13} ( + INSERT INTO cacheInterceptorV${VERSION17} ( url, method, body, @@ -32135,20 +32135,20 @@ var require_sqlite_cache_store = __commonJS({ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `); this.#deleteByUrlQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE url = ?` + `DELETE FROM cacheInterceptorV${VERSION17} WHERE url = ?` ); this.#countEntriesQuery = this.#db.prepare( - `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION13}` + `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION17}` ); this.#deleteExpiredValuesQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE deleteAt <= ?` + `DELETE FROM cacheInterceptorV${VERSION17} WHERE deleteAt <= ?` ); this.#deleteOldValuesQuery = this.#maxCount === Infinity ? null : this.#db.prepare(` - DELETE FROM cacheInterceptorV${VERSION13} + DELETE FROM cacheInterceptorV${VERSION17} WHERE id IN ( SELECT id - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION17} ORDER BY cachedAt DESC LIMIT ? ) @@ -33239,7 +33239,7 @@ var require_request4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); input = webidl.converters.RequestInfo(input, prefix, "input"); init = webidl.converters.RequestInit(init, prefix, "init"); - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = environmentSettingsObject.settingsObject.baseUrl; let signal = null; @@ -33256,18 +33256,18 @@ var require_request4 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(webidl.is.Request(input)); - request2 = input.#state; + request4 = input.#state; signal = input.#signal; this.#dispatcher = init.dispatcher || input.#dispatcher; } const origin = environmentSettingsObject.settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request4.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -33275,43 +33275,43 @@ var require_request4 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: environmentSettingsObject.settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -33320,14 +33320,14 @@ var require_request4 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, environmentSettingsObject.settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -33342,33 +33342,33 @@ var require_request4 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; const mayBeNormalized = normalizedMethodRecords[method]; if (mayBeNormalized !== void 0) { - request2.method = mayBeNormalized; + request4.method = mayBeNormalized; } else { if (!isValidHTTPToken(method)) { throw new TypeError(`'${method}' is not a valid HTTP method.`); @@ -33378,9 +33378,9 @@ var require_request4 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizedMethodRecordsBase[upperCase] ?? method; - request2.method = method; + request4.method = method; } - if (!patchMethodWarning && request2.method === "patch") { + if (!patchMethodWarning && request4.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" }); @@ -33390,7 +33390,7 @@ var require_request4 = __commonJS({ if (init.signal !== void 0) { signal = init.signal; } - this.#state = request2; + this.#state = request4; const ac = new AbortController(); this.#signal = ac.signal; if (signal != null) { @@ -33411,12 +33411,12 @@ var require_request4 = __commonJS({ } } this.#headers = new Headers(kConstruct); - setHeadersList(this.#headers, request2.headersList); + setHeadersList(this.#headers, request4.headersList); setHeadersGuard(this.#headers, "request"); if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } setHeadersGuard(this.#headers, "request-no-cors"); @@ -33435,14 +33435,14 @@ var require_request4 = __commonJS({ } } const inputBody = webidl.is.Request(input) ? input.#state.body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !getHeadersList(this.#headers).contains("content-type", true)) { @@ -33454,12 +33454,12 @@ var require_request4 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -33604,24 +33604,24 @@ var require_request4 = __commonJS({ }; return `Request ${nodeUtil.formatWithOptions(options, properties)}`; } - static setRequestSignal(request2, newSignal) { - request2.#signal = newSignal; - return request2; + static setRequestSignal(request4, newSignal) { + request4.#signal = newSignal; + return request4; } - static getRequestDispatcher(request2) { - return request2.#dispatcher; + static getRequestDispatcher(request4) { + return request4.#dispatcher; } - static setRequestDispatcher(request2, newDispatcher) { - request2.#dispatcher = newDispatcher; + static setRequestDispatcher(request4, newDispatcher) { + request4.#dispatcher = newDispatcher; } - static setRequestHeaders(request2, newHeaders) { - request2.#headers = newHeaders; + static setRequestHeaders(request4, newHeaders) { + request4.#headers = newHeaders; } - static getRequestState(request2) { - return request2.#state; + static getRequestState(request4) { + return request4.#state; } - static setRequestState(request2, newState) { - request2.#state = newState; + static setRequestState(request4, newState) { + request4.#state = newState; } }; var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState } = Request; @@ -33674,23 +33674,23 @@ var require_request4 = __commonJS({ headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(newRequest, request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(newRequest, request4.body); } return newRequest; } function fromInnerRequest(innerRequest, dispatcher, signal, guard) { - const request2 = new Request(kConstruct); - setRequestState(request2, innerRequest); - setRequestDispatcher(request2, dispatcher); - setRequestSignal(request2, signal); + const request4 = new Request(kConstruct); + setRequestState(request4, innerRequest); + setRequestDispatcher(request4, dispatcher); + setRequestSignal(request4, signal); const headers = new Headers(kConstruct); - setRequestHeaders(request2, headers); + setRequestHeaders(request4, headers); setHeadersList(headers, innerRequest.headersList); setHeadersGuard(headers, guard); - return request2; + return request4; } Object.defineProperties(Request.prototype, { method: kEnumerableProperty, @@ -33928,14 +33928,14 @@ var require_fetch2 = __commonJS({ p.reject(e); return p.promise; } - const request2 = getRequestState(requestObject); + const request4 = getRequestState(requestObject); if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; let locallyAborted = false; @@ -33947,7 +33947,7 @@ var require_fetch2 = __commonJS({ assert(controller != null); controller.abort(requestObject.signal.reason); const realResponse = responseObject == null ? void 0 : responseObject.deref(); - abortFetch(p, request2, realResponse, requestObject.signal.reason); + abortFetch(p, request4, realResponse, requestObject.signal.reason); } ); const processResponse = (response) => { @@ -33955,7 +33955,7 @@ var require_fetch2 = __commonJS({ return; } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return; } if (response.type === "error") { @@ -33967,7 +33967,7 @@ var require_fetch2 = __commonJS({ p = null; }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: getRequestDispatcher(requestObject) @@ -34008,13 +34008,13 @@ var require_fetch2 = __commonJS({ ); } var markResourceTiming = performance.markResourceTiming; - function abortFetch(p, request2, responseObject, error) { + function abortFetch(p, request4, responseObject, error) { var _a, _b; if (p) { p.reject(error); } - if (((_a = request2.body) == null ? void 0 : _a.stream) != null && isReadable(request2.body.stream)) { - request2.body.stream.cancel(error).catch((err) => { + if (((_a = request4.body) == null ? void 0 : _a.stream) != null && isReadable(request4.body.stream)) { + request4.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -34035,7 +34035,7 @@ var require_fetch2 = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -34048,9 +34048,9 @@ var require_fetch2 = __commonJS({ assert(dispatcher); let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currentTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -34058,7 +34058,7 @@ var require_fetch2 = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -34068,32 +34068,32 @@ var require_fetch2 = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a = request4.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = request2.client.origin; + if (request4.origin === "client") { + request4.origin = request4.client.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept", true)) { + if (!request4.headersList.contains("accept", true)) { const value = "*/*"; - request2.headersList.append("accept", value, true); + request4.headersList.append("accept", value, true); } - if (!request2.headersList.contains("accept-language", true)) { - request2.headersList.append("accept-language", "*", true); + if (!request4.headersList.contains("accept-language", true)) { + request4.headersList.append("accept-language", "*", true); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -34101,41 +34101,41 @@ var require_fetch2 = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; response = await schemeFetch(fetchParams); - } else if (request2.mode === "same-origin") { + } else if (request4.mode === "same-origin") { response = makeNetworkError('request mode cannot be "same-origin"'); - } else if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + } else if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { response = makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } else { - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; response = await schemeFetch(fetchParams); } - } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { response = makeNetworkError("URL scheme must be a HTTP(S) scheme"); } else { - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; response = await httpFetch(fetchParams); } } @@ -34143,13 +34143,13 @@ var require_fetch2 = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -34157,26 +34157,26 @@ var require_fetch2 = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range", true)) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range", true)) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -34192,8 +34192,8 @@ var require_fetch2 = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -34202,19 +34202,19 @@ var require_fetch2 = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("node:buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blob = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !webidl.is.Blob(blob)) { + if (request4.method !== "GET" || !webidl.is.Blob(blob)) { return Promise.resolve(makeNetworkError("invalid method")); } const response = makeResponse(); const fullLength = blob.size; const serializedFullLength = isomorphicEncode(`${fullLength}`); const type = blob.type; - if (!request2.headersList.contains("range", true)) { + if (!request4.headersList.contains("range", true)) { const bodyWithType = extractBody(blob); response.statusText = "OK"; response.body = bodyWithType[0]; @@ -34222,7 +34222,7 @@ var require_fetch2 = __commonJS({ response.headersList.set("content-type", type, true); } else { response.rangeRequested = true; - const rangeHeader = request2.headersList.get("range", true); + const rangeHeader = request4.headersList.get("range", true); const rangeValue = simpleRangeHeaderValue(rangeHeader, true); if (rangeValue === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34253,7 +34253,7 @@ var require_fetch2 = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34342,41 +34342,41 @@ var require_fetch2 = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(void 0, false); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -34386,13 +34386,13 @@ var require_fetch2 = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -34403,63 +34403,63 @@ var require_fetch2 = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization", true); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie", true); - request2.headersList.delete("host", true); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization", true); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie", true); + request4.headersList.delete("host", true); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = cloneRequest(request2); + httpRequest = cloneRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -34536,7 +34536,7 @@ var require_fetch2 = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -34544,7 +34544,7 @@ var require_fetch2 = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -34574,21 +34574,21 @@ var require_fetch2 = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -34617,7 +34617,7 @@ var require_fetch2 = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -34728,17 +34728,17 @@ var require_fetch2 = __commonJS({ } return response; function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: agent.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -34774,8 +34774,8 @@ var require_fetch2 = __commonJS({ location = headersList.get("location", true); this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status); - if (codings.length !== 0 && request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = location && request4.redirect === "follow" && redirectStatusSet.has(status); + if (codings.length !== 0 && request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (let i = codings.length - 1; i >= 0; --i) { const coding = codings[i]; if (coding === "x-gzip" || coding === "gzip") { @@ -34917,32 +34917,32 @@ var require_cache4 = __commonJS({ webidl.util.markAsUncloneable(this); this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.match"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - const p = this.#internalMatchAll(request2, options, 1); + const p = this.#internalMatchAll(request4, options, 1); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.matchAll"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - return this.#internalMatchAll(request2, options); + return this.#internalMatchAll(request4, options); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); const prefix = "Cache.add"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -34952,19 +34952,19 @@ var require_cache4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); const responsePromises = []; const requestList = []; - for (let request2 of requests) { - if (request2 === void 0) { + for (let request4 of requests) { + if (request4 === void 0) { throw webidl.errors.conversionFailed({ prefix, argument: "Argument 1", types: ["undefined is not allowed"] }); } - request2 = webidl.converters.RequestInfo(request2); - if (typeof request2 === "string") { + request4 = webidl.converters.RequestInfo(request4); + if (typeof request4 === "string") { continue; } - const r = getRequestState(request2); + const r = getRequestState(request4); if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: prefix, @@ -34973,8 +34973,8 @@ var require_cache4 = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = getRequestState(new Request(request2)); + for (const request4 of requests) { + const r = getRequestState(new Request(request4)); if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: prefix, @@ -35048,17 +35048,17 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); const prefix = "Cache.put"; webidl.argumentLengthCheck(arguments, 2, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); response = webidl.converters.Response(response, prefix, "response"); let innerRequest = null; - if (webidl.is.Request(request2)) { - innerRequest = getRequestState(request2); + if (webidl.is.Request(request4)) { + innerRequest = getRequestState(request4); } else { - innerRequest = getRequestState(new Request(request2)); + innerRequest = getRequestState(new Request(request4)); } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -35126,21 +35126,21 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.delete"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = getRequestState(new Request(request2)); + assert(typeof request4 === "string"); + r = getRequestState(new Request(request4)); } const operations = []; const operation = { @@ -35166,26 +35166,26 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.keys"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -35197,9 +35197,9 @@ var require_cache4 = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = fromInnerRequest( - request3, + request5, void 0, new AbortController().signal, "immutable" @@ -35298,9 +35298,9 @@ var require_cache4 = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -35316,7 +35316,7 @@ var require_cache4 = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -35324,20 +35324,20 @@ var require_cache4 = __commonJS({ } return true; } - #internalMatchAll(request2, options, maxResponses = Infinity) { + #internalMatchAll(request4, options, maxResponses = Infinity) { let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -35425,21 +35425,21 @@ var require_cachestorage2 = __commonJS({ } webidl.util.markAsUncloneable(this); } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, "CacheStorage.match"); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -36529,7 +36529,7 @@ var require_connection2 = __commonJS({ function establishWebSocketConnection(url, protocols, client, handler2, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], client, serviceWorkers: "none", @@ -36541,18 +36541,18 @@ var require_connection2 = __commonJS({ }); if (options.headers) { const headersList = getHeadersList(new Headers(options.headers)); - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue, true); - request2.headersList.append("sec-websocket-version", "13", true); + request4.headersList.append("sec-websocket-key", keyValue, true); + request4.headersList.append("sec-websocket-version", "13", true); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol, true); + request4.headersList.append("sec-websocket-protocol", protocol, true); } const permessageDeflate = "permessage-deflate; client_max_window_bits"; - request2.headersList.append("sec-websocket-extensions", permessageDeflate, true); + request4.headersList.append("sec-websocket-extensions", permessageDeflate, true); const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher, processResponse(response) { @@ -36593,7 +36593,7 @@ var require_connection2 = __commonJS({ } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); if (secProtocol !== null) { - const requestProtocols = getDecodeSplit("sec-websocket-protocol", request2.headersList); + const requestProtocols = getDecodeSplit("sec-websocket-protocol", request4.headersList); if (!requestProtocols.includes(secProtocol)) { failWebsocketConnection(handler2, 1002, "Protocol was not set in the opening handshake."); return; @@ -38793,24 +38793,24 @@ var require_dist_node3 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - endpoint: () => endpoint2 + endpoint: () => endpoint4 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node2(); - var VERSION13 = "9.0.5"; - var userAgent2 = `octokit-endpoint.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; - var DEFAULTS2 = { + var import_universal_user_agent13 = require_dist_node2(); + var VERSION17 = "9.0.5"; + var userAgent4 = `octokit-endpoint.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}`; + var DEFAULTS4 = { method: "GET", baseUrl: "https://api.github.com", headers: { accept: "application/vnd.github.v3+json", - "user-agent": userAgent2 + "user-agent": userAgent4 }, mediaType: { format: "" } }; - function lowercaseKeys2(object) { + function lowercaseKeys4(object) { if (!object) { return {}; } @@ -38819,7 +38819,7 @@ var require_dist_node3 = __commonJS({ return newObj; }, {}); } - function isPlainObject3(value) { + function isPlainObject7(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -38830,21 +38830,21 @@ var require_dist_node3 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - function mergeDeep2(defaults, options) { + function mergeDeep4(defaults, options) { const result = Object.assign({}, defaults); Object.keys(options).forEach((key) => { - if (isPlainObject3(options[key])) { + if (isPlainObject7(options[key])) { if (!(key in defaults)) Object.assign(result, { [key]: options[key] }); else - result[key] = mergeDeep2(defaults[key], options[key]); + result[key] = mergeDeep4(defaults[key], options[key]); } else { Object.assign(result, { [key]: options[key] }); } }); return result; } - function removeUndefinedProperties2(obj) { + function removeUndefinedProperties4(obj) { for (const key in obj) { if (obj[key] === void 0) { delete obj[key]; @@ -38852,7 +38852,7 @@ var require_dist_node3 = __commonJS({ } return obj; } - function merge2(defaults, route, options) { + function merge4(defaults, route, options) { var _a; if (typeof route === "string") { let [method, url] = route.split(" "); @@ -38860,10 +38860,10 @@ var require_dist_node3 = __commonJS({ } else { options = Object.assign({}, route); } - options.headers = lowercaseKeys2(options.headers); - removeUndefinedProperties2(options); - removeUndefinedProperties2(options.headers); - const mergedOptions = mergeDeep2(defaults || {}, options); + options.headers = lowercaseKeys4(options.headers); + removeUndefinedProperties4(options); + removeUndefinedProperties4(options.headers); + const mergedOptions = mergeDeep4(defaults || {}, options); if (options.url === "/graphql") { if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( @@ -38874,7 +38874,7 @@ var require_dist_node3 = __commonJS({ } return mergedOptions; } - function addQueryParameters2(url, parameters) { + function addQueryParameters4(url, parameters) { const separator = /\?/.test(url) ? "&" : "?"; const names = Object.keys(parameters); if (names.length === 0) { @@ -38887,18 +38887,18 @@ var require_dist_node3 = __commonJS({ return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } - var urlVariableRegex2 = /\{[^}]+\}/g; - function removeNonChars2(variableName) { + var urlVariableRegex4 = /\{[^}]+\}/g; + function removeNonChars4(variableName) { return variableName.replace(/^\W+|\W+$/g, "").split(/,/); } - function extractUrlVariableNames2(url) { - const matches = url.match(urlVariableRegex2); + function extractUrlVariableNames4(url) { + const matches = url.match(urlVariableRegex4); if (!matches) { return []; } - return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); + return matches.map(removeNonChars4).reduce((a, b) => a.concat(b), []); } - function omit2(object, keysToOmit) { + function omit4(object, keysToOmit) { const result = { __proto__: null }; for (const key of Object.keys(object)) { if (keysToOmit.indexOf(key) === -1) { @@ -38907,7 +38907,7 @@ var require_dist_node3 = __commonJS({ } return result; } - function encodeReserved2(str) { + function encodeReserved4(str) { return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { if (!/%[0-9A-Fa-f]/.test(part)) { part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); @@ -38915,67 +38915,67 @@ var require_dist_node3 = __commonJS({ return part; }).join(""); } - function encodeUnreserved2(str) { + function encodeUnreserved4(str) { return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { return "%" + c.charCodeAt(0).toString(16).toUpperCase(); }); } - function encodeValue2(operator, value, key) { - value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + function encodeValue4(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved4(value) : encodeUnreserved4(value); if (key) { - return encodeUnreserved2(key) + "=" + value; + return encodeUnreserved4(key) + "=" + value; } else { return value; } } - function isDefined2(value) { + function isDefined4(value) { return value !== void 0 && value !== null; } - function isKeyOperator2(operator) { + function isKeyOperator4(operator) { return operator === ";" || operator === "&" || operator === "?"; } - function getValues2(context3, operator, key, modifier) { + function getValues4(context3, operator, key, modifier) { var value = context3[key], result = []; - if (isDefined2(value) && value !== "") { + if (isDefined4(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { value = value.substring(0, parseInt(modifier, 10)); } result.push( - encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value, isKeyOperator4(operator) ? key : "") ); } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { + value.filter(isDefined4).forEach(function(value2) { result.push( - encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value2, isKeyOperator4(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - result.push(encodeValue2(operator, value[k], k)); + if (isDefined4(value[k])) { + result.push(encodeValue4(operator, value[k], k)); } }); } } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { - tmp.push(encodeValue2(operator, value2)); + value.filter(isDefined4).forEach(function(value2) { + tmp.push(encodeValue4(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - tmp.push(encodeUnreserved2(k)); - tmp.push(encodeValue2(operator, value[k].toString())); + if (isDefined4(value[k])) { + tmp.push(encodeUnreserved4(k)); + tmp.push(encodeValue4(operator, value[k].toString())); } }); } - if (isKeyOperator2(operator)) { - result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + if (isKeyOperator4(operator)) { + result.push(encodeUnreserved4(key) + "=" + tmp.join(",")); } else if (tmp.length !== 0) { result.push(tmp.join(",")); } @@ -38983,23 +38983,23 @@ var require_dist_node3 = __commonJS({ } } else { if (operator === ";") { - if (isDefined2(value)) { - result.push(encodeUnreserved2(key)); + if (isDefined4(value)) { + result.push(encodeUnreserved4(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { - result.push(encodeUnreserved2(key) + "="); + result.push(encodeUnreserved4(key) + "="); } else if (value === "") { result.push(""); } } return result; } - function parseUrl2(template) { + function parseUrl4(template) { return { - expand: expand2.bind(null, template) + expand: expand4.bind(null, template) }; } - function expand2(template, context3) { + function expand4(template, context3) { var operators = ["+", "#", ".", "/", ";", "?", "&"]; template = template.replace( /\{([^\{\}]+)\}|([^\{\}]+)/g, @@ -39013,7 +39013,7 @@ var require_dist_node3 = __commonJS({ } expression.split(/,/g).forEach(function(variable) { var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); - values.push(getValues2(context3, operator, tmp[1], tmp[2] || tmp[3])); + values.push(getValues4(context3, operator, tmp[1], tmp[2] || tmp[3])); }); if (operator && operator !== "+") { var separator = ","; @@ -39027,7 +39027,7 @@ var require_dist_node3 = __commonJS({ return values.join(","); } } else { - return encodeReserved2(literal); + return encodeReserved4(literal); } } ); @@ -39037,13 +39037,13 @@ var require_dist_node3 = __commonJS({ return template.replace(/\/$/, ""); } } - function parse2(options) { + function parse4(options) { var _a; let method = options.method.toUpperCase(); let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); let headers = Object.assign({}, options.headers); let body; - let parameters = omit2(options, [ + let parameters = omit4(options, [ "method", "baseUrl", "url", @@ -39051,13 +39051,13 @@ var require_dist_node3 = __commonJS({ "request", "mediaType" ]); - const urlVariableNames = extractUrlVariableNames2(url); - url = parseUrl2(url).expand(parameters); + const urlVariableNames = extractUrlVariableNames4(url); + url = parseUrl4(url).expand(parameters); if (!/^http/.test(url)) { url = options.baseUrl + url; } const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); - const remainingParameters = omit2(parameters, omittedParameters); + const remainingParameters = omit4(parameters, omittedParameters); const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); if (!isBinaryRequest) { if (options.mediaType.format) { @@ -39079,7 +39079,7 @@ var require_dist_node3 = __commonJS({ } } if (["GET", "HEAD"].includes(method)) { - url = addQueryParameters2(url, remainingParameters); + url = addQueryParameters4(url, remainingParameters); } else { if ("data" in remainingParameters) { body = remainingParameters.data; @@ -39101,20 +39101,20 @@ var require_dist_node3 = __commonJS({ options.request ? { request: options.request } : null ); } - function endpointWithDefaults2(defaults, route, options) { - return parse2(merge2(defaults, route, options)); + function endpointWithDefaults4(defaults, route, options) { + return parse4(merge4(defaults, route, options)); } - function withDefaults4(oldDefaults, newDefaults) { - const DEFAULTS22 = merge2(oldDefaults, newDefaults); - const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + function withDefaults8(oldDefaults, newDefaults) { + const DEFAULTS22 = merge4(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults4.bind(null, DEFAULTS22); return Object.assign(endpoint22, { DEFAULTS: DEFAULTS22, - defaults: withDefaults4.bind(null, DEFAULTS22), - merge: merge2.bind(null, DEFAULTS22), - parse: parse2 + defaults: withDefaults8.bind(null, DEFAULTS22), + merge: merge4.bind(null, DEFAULTS22), + parse: parse4 }); } - var endpoint2 = withDefaults4(null, DEFAULTS2); + var endpoint4 = withDefaults8(null, DEFAULTS4); } }); @@ -39241,14 +39241,14 @@ var require_dist_node5 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - RequestError: () => RequestError2 + RequestError: () => RequestError4 }); module.exports = __toCommonJS(dist_src_exports); var import_deprecation = require_dist_node4(); var import_once = __toESM2(require_once()); var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation)); var logOnceHeaders = (0, import_once.default)((deprecation) => console.warn(deprecation)); - var RequestError2 = class extends Error { + var RequestError4 = class extends Error { constructor(message, statusCode, options) { super(message); if (Error.captureStackTrace) { @@ -39323,13 +39323,13 @@ var require_dist_node6 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - request: () => request2 + request: () => request4 }); module.exports = __toCommonJS(dist_src_exports); - var import_endpoint2 = require_dist_node3(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "8.4.0"; - function isPlainObject3(value) { + var import_endpoint4 = require_dist_node3(); + var import_universal_user_agent13 = require_dist_node(); + var VERSION17 = "8.4.0"; + function isPlainObject7(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -39340,15 +39340,15 @@ var require_dist_node6 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - var import_request_error3 = require_dist_node5(); + var import_request_error6 = require_dist_node5(); function getBufferResponse(response) { return response.arrayBuffer(); } - function fetchWrapper2(requestOptions) { + function fetchWrapper4(requestOptions) { var _a, _b, _c, _d; const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console; const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false; - if (isPlainObject3(requestOptions.body) || Array.isArray(requestOptions.body)) { + if (isPlainObject7(requestOptions.body) || Array.isArray(requestOptions.body)) { requestOptions.body = JSON.stringify(requestOptions.body); } let headers = {}; @@ -39390,7 +39390,7 @@ var require_dist_node6 = __commonJS({ if (status < 400) { return; } - throw new import_request_error3.RequestError(response.statusText, status, { + throw new import_request_error6.RequestError(response.statusText, status, { response: { url, status, @@ -39401,19 +39401,19 @@ var require_dist_node6 = __commonJS({ }); } if (status === 304) { - throw new import_request_error3.RequestError("Not modified", status, { + throw new import_request_error6.RequestError("Not modified", status, { response: { url, status, headers, - data: await getResponseData2(response) + data: await getResponseData4(response) }, request: requestOptions }); } if (status >= 400) { - const data = await getResponseData2(response); - const error = new import_request_error3.RequestError(toErrorMessage2(data), status, { + const data = await getResponseData4(response); + const error = new import_request_error6.RequestError(toErrorMessage4(data), status, { response: { url, status, @@ -39424,7 +39424,7 @@ var require_dist_node6 = __commonJS({ }); throw error; } - return parseSuccessResponseBody ? await getResponseData2(response) : response.body; + return parseSuccessResponseBody ? await getResponseData4(response) : response.body; }).then((data) => { return { status, @@ -39433,7 +39433,7 @@ var require_dist_node6 = __commonJS({ data }; }).catch((error) => { - if (error instanceof import_request_error3.RequestError) + if (error instanceof import_request_error6.RequestError) throw error; else if (error.name === "AbortError") throw error; @@ -39445,12 +39445,12 @@ var require_dist_node6 = __commonJS({ message = error.cause; } } - throw new import_request_error3.RequestError(message, 500, { + throw new import_request_error6.RequestError(message, 500, { request: requestOptions }); }); } - async function getResponseData2(response) { + async function getResponseData4(response) { const contentType = response.headers.get("content-type"); if (/application\/json/.test(contentType)) { return response.json().catch(() => response.text()).catch(() => ""); @@ -39460,7 +39460,7 @@ var require_dist_node6 = __commonJS({ } return getBufferResponse(response); } - function toErrorMessage2(data) { + function toErrorMessage4(data) { if (typeof data === "string") return data; let suffix; @@ -39477,32 +39477,32 @@ var require_dist_node6 = __commonJS({ } return `Unknown error: ${JSON.stringify(data)}`; } - function withDefaults4(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + function withDefaults8(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper2(endpoint2.parse(endpointOptions)); + return fetchWrapper4(endpoint22.parse(endpointOptions)); } const request22 = (route2, parameters2) => { - return fetchWrapper2( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + return fetchWrapper4( + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; Object.assign(request22, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); } - var request2 = withDefaults4(import_endpoint2.endpoint, { + var request4 = withDefaults8(import_endpoint4.endpoint, { headers: { - "user-agent": `octokit-request.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-request.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}` } }); } @@ -39537,8 +39537,8 @@ var require_dist_node7 = __commonJS({ }); module.exports = __toCommonJS(dist_src_exports); var import_request32 = require_dist_node6(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "7.1.0"; + var import_universal_user_agent13 = require_dist_node(); + var VERSION17 = "7.1.0"; var import_request22 = require_dist_node6(); var import_request15 = require_dist_node6(); function _buildMessageForResponseErrors2(data) { @@ -39546,9 +39546,9 @@ var require_dist_node7 = __commonJS({ ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError2 = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors2(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.name = "GraphqlResponseError"; @@ -39570,7 +39570,7 @@ var require_dist_node7 = __commonJS({ ]; var FORBIDDEN_VARIABLE_OPTIONS2 = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX2 = /\/api\/v3\/?$/; - function graphql3(request2, query, options) { + function graphql3(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -39601,11 +39601,11 @@ var require_dist_node7 = __commonJS({ result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX2.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX2, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -39620,25 +39620,25 @@ var require_dist_node7 = __commonJS({ return response.data.data; }); } - function withDefaults4(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); + function withDefaults8(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql3(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults4.bind(null, newRequest), + defaults: withDefaults8.bind(null, newRequest), endpoint: newRequest.endpoint }); } - var graphql22 = withDefaults4(import_request32.request, { + var graphql22 = withDefaults8(import_request32.request, { headers: { - "user-agent": `octokit-graphql.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-graphql.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}` }, method: "POST", url: "/graphql" }); function withCustomRequest2(customRequest) { - return withDefaults4(customRequest, { + return withDefaults8(customRequest, { method: "POST", url: "/graphql" }); @@ -39692,13 +39692,13 @@ var require_dist_node8 = __commonJS({ } return `token ${token}`; } - async function hook6(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( + async function hook6(token, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix2(token); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix2(token); + return request4(endpoint4); } var createTokenAuth3 = function createTokenAuth22(token) { if (!token) { @@ -39743,17 +39743,17 @@ var require_dist_node9 = __commonJS({ Octokit: () => Octokit3 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node(); + var import_universal_user_agent13 = require_dist_node(); var import_before_after_hook2 = require_before_after_hook(); var import_request15 = require_dist_node6(); var import_graphql2 = require_dist_node7(); var import_auth_token2 = require_dist_node8(); - var VERSION13 = "5.2.0"; + var VERSION17 = "5.2.0"; var noop2 = () => { }; var consoleWarn2 = console.warn.bind(console); var consoleError2 = console.error.bind(console); - var userAgentTrail2 = `octokit-core.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; + var userAgentTrail2 = `octokit-core.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}`; var _a; var Octokit3 = (_a = class { static defaults(defaults) { @@ -39856,7 +39856,7 @@ var require_dist_node9 = __commonJS({ } } }, (() => { - _a.VERSION = VERSION13; + _a.VERSION = VERSION17; })(), (() => { _a.plugins = []; })(), _a); @@ -39890,7 +39890,7 @@ var require_dist_node10 = __commonJS({ restEndpointMethods: () => restEndpointMethods2 }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "10.4.1"; + var VERSION17 = "10.4.1"; var Endpoints2 = { actions: { addCustomLabelsToSelfHostedRunnerForOrg: [ @@ -41882,8 +41882,8 @@ var require_dist_node10 = __commonJS({ var endpoints_default2 = Endpoints2; var endpointMethodsMap2 = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default2)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -42006,7 +42006,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - restEndpointMethods2.VERSION = VERSION13; + restEndpointMethods2.VERSION = VERSION17; function legacyRestEndpointMethods2(octokit) { const api = endpointsToMethods2(octokit); return { @@ -42014,7 +42014,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - legacyRestEndpointMethods2.VERSION = VERSION13; + legacyRestEndpointMethods2.VERSION = VERSION17; } }); @@ -42047,7 +42047,7 @@ var require_dist_node11 = __commonJS({ paginatingEndpoints: () => paginatingEndpoints }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "9.2.1"; + var VERSION17 = "9.2.1"; function normalizePaginatedListResponse2(response) { if (!response.data) { return { @@ -42393,7 +42393,7 @@ var require_dist_node11 = __commonJS({ }) }; } - paginateRest2.VERSION = VERSION13; + paginateRest2.VERSION = VERSION17; } }); @@ -42524,7 +42524,7 @@ var require_fast_content_type_parse = __commonJS({ var defaultContentType = { type: "", parameters: new NullObject() }; Object.freeze(defaultContentType.parameters); Object.freeze(defaultContentType); - function parse2(header) { + function parse4(header) { if (typeof header !== "string") { throw new TypeError("argument header is required and must be a string"); } @@ -42562,7 +42562,7 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - function safeParse2(header) { + function safeParse4(header) { if (typeof header !== "string") { return defaultContentType; } @@ -42600,9 +42600,9 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - module.exports.default = { parse: parse2, safeParse: safeParse2 }; - module.exports.parse = parse2; - module.exports.safeParse = safeParse2; + module.exports.default = { parse: parse4, safeParse: safeParse4 }; + module.exports.parse = parse4; + module.exports.safeParse = safeParse4; module.exports.defaultContentType = defaultContentType; } }); @@ -42819,9 +42819,9 @@ function addQueryParameters(url, parameters) { return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } -var urlVariableRegex = /\{[^}]+\}/g; +var urlVariableRegex = /\{[^{}}]+\}/g; function removeNonChars(variableName) { - return variableName.replace(/^\W+|\W+$/g, "").split(/,/); + return variableName.replace(/(?:^\W+)|(?:(? { const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; return `application/vnd.github.${preview}-preview${format}`; @@ -43037,12 +43037,12 @@ function endpointWithDefaults(defaults, route, options) { return parse(merge(defaults, route, options)); } function withDefaults(oldDefaults, newDefaults) { - const DEFAULTS2 = merge(oldDefaults, newDefaults); - const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2); - return Object.assign(endpoint2, { - DEFAULTS: DEFAULTS2, - defaults: withDefaults.bind(null, DEFAULTS2), - merge: merge.bind(null, DEFAULTS2), + const DEFAULTS22 = merge(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults.bind(null, DEFAULTS22), + merge: merge.bind(null, DEFAULTS22), parse }); } @@ -43071,7 +43071,7 @@ var RequestError = class extends Error { if (options.request.headers.authorization) { requestCopy.headers = Object.assign({}, options.request.headers, { authorization: options.request.headers.authorization.replace( - / .*$/, + /(?]+)>; rel="deprecation"/); + const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/); const deprecationLink = matches && matches.pop(); log.warn( `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` @@ -43234,40 +43234,570 @@ function toErrorMessage(data) { return `Unknown error: ${JSON.stringify(data)}`; } function withDefaults2(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper(endpoint2.parse(endpointOptions)); + return fetchWrapper(endpoint22.parse(endpointOptions)); } - const request2 = (route2, parameters2) => { + const request22 = (route2, parameters2) => { return fetchWrapper( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; - Object.assign(request2, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); - return endpointOptions.request.hook(request2, endpointOptions); + return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); } var request = withDefaults2(endpoint, defaults_default); // var VERSION3 = "0.0.0-development"; +var userAgent2 = `octokit-endpoint.js/${VERSION3} ${getUserAgent()}`; +var DEFAULTS2 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent2 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys2(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject3(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep2(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject3(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep2(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties2(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge2(defaults, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys2(options.headers); + removeUndefinedProperties2(options); + removeUndefinedProperties2(options.headers); + const mergedOptions = mergeDeep2(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters2(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex2 = /\{[^}]+\}/g; +function removeNonChars2(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames2(url) { + const matches = url.match(urlVariableRegex2); + if (!matches) { + return []; + } + return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); +} +function omit2(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved2(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved2(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue2(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + if (key) { + return encodeUnreserved2(key) + "=" + value; + } else { + return value; + } +} +function isDefined2(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator2(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues2(context3, operator, key, modifier) { + var value = context3[key], result = []; + if (isDefined2(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + result.push( + encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + result.push(encodeValue2(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + tmp.push(encodeValue2(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + tmp.push(encodeUnreserved2(k)); + tmp.push(encodeValue2(operator, value[k].toString())); + } + }); + } + if (isKeyOperator2(operator)) { + result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined2(value)) { + result.push(encodeUnreserved2(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved2(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl2(template) { + return { + expand: expand2.bind(null, template) + }; +} +function expand2(template, context3) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues2(context3, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved2(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse2(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit2(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames2(url); + url = parseUrl2(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit2(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters2(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults2(defaults, route, options) { + return parse2(merge2(defaults, route, options)); +} +function withDefaults3(oldDefaults, newDefaults) { + const DEFAULTS22 = merge2(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults3.bind(null, DEFAULTS22), + merge: merge2.bind(null, DEFAULTS22), + parse: parse2 + }); +} +var endpoint2 = withDefaults3(null, DEFAULTS2); + +// +var import_fast_content_type_parse2 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError2 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION4 = "0.0.0-development"; +var defaults_default2 = { + headers: { + "user-agent": `octokit-request.js/${VERSION4} ${getUserAgent()}` + } +}; +function isPlainObject4(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper2(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch2 = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject4(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error) { + let message = "Unknown Error"; + if (error instanceof Error) { + if (error.name === "AbortError") { + error.status = 500; + throw error; + } + message = error.message; + if (error.name === "TypeError" && "cause" in error) { + if (error.cause instanceof Error) { + message = error.cause.message; + } else if (typeof error.cause === "string") { + message = error.cause; + } + } + } + const requestError = new RequestError2(message, 500, { + request: requestOptions + }); + requestError.cause = error; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError2(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2(toErrorMessage2(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData2(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData2(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse2.safeParse)(contentType); + if (isJSONResponse2(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse2(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage2(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults4(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper2(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper2( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); +} +var request2 = withDefaults4(endpoint2, defaults_default2); + +// +var VERSION5 = "0.0.0-development"; function _buildMessageForResponseErrors(data) { return `Request failed due to following response errors: ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.errors = response.errors; @@ -43292,7 +43822,7 @@ var NON_VARIABLE_OPTIONS = [ ]; var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; -function graphql(request2, query, options) { +function graphql(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -43323,11 +43853,11 @@ function graphql(request2, query, options) { result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -43342,25 +43872,25 @@ function graphql(request2, query, options) { return response.data.data; }); } -function withDefaults3(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); +function withDefaults5(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults3.bind(null, newRequest), + defaults: withDefaults5.bind(null, newRequest), endpoint: newRequest.endpoint }); } -var graphql2 = withDefaults3(request, { +var graphql2 = withDefaults5(request2, { headers: { - "user-agent": `octokit-graphql.js/${VERSION3} ${getUserAgent()}` + "user-agent": `octokit-graphql.js/${VERSION5} ${getUserAgent()}` }, method: "POST", url: "/graphql" }); function withCustomRequest(customRequest) { - return withDefaults3(customRequest, { + return withDefaults5(customRequest, { method: "POST", url: "/graphql" }); @@ -43388,13 +43918,13 @@ function withAuthorizationPrefix(token) { } return `token ${token}`; } -async function hook(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( +async function hook(token, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix(token); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix(token); + return request4(endpoint4); } var createTokenAuth = function createTokenAuth2(token) { if (!token) { @@ -43412,14 +43942,14 @@ var createTokenAuth = function createTokenAuth2(token) { }; // -var VERSION4 = "6.1.3"; +var VERSION6 = "6.1.4"; // var noop = () => { }; var consoleWarn = console.warn.bind(console); var consoleError = console.error.bind(console); -var userAgentTrail = `octokit-core.js/${VERSION4} ${getUserAgent()}`; +var userAgentTrail = `octokit-core.js/${VERSION6} ${getUserAgent()}`; var Octokit = class { static defaults(defaults) { const OctokitWithDefaults = class extends this { @@ -43524,20 +44054,20 @@ var Octokit = class { hook; auth; }; -__publicField(Octokit, "VERSION", VERSION4); +__publicField(Octokit, "VERSION", VERSION6); __publicField(Octokit, "plugins", []); // -var VERSION5 = "5.3.1"; +var VERSION7 = "5.3.1"; // function requestLog(octokit) { - octokit.hook.wrap("request", (request2, options) => { + octokit.hook.wrap("request", (request4, options) => { octokit.log.debug("request", options); const start = Date.now(); const requestOptions = octokit.request.endpoint.parse(options); const path = requestOptions.url.replace(options.baseUrl, ""); - return request2(options).then((response) => { + return request4(options).then((response) => { const requestId = response.headers["x-github-request-id"]; octokit.log.info( `${requestOptions.method} ${path} - ${response.status} with id ${requestId} in ${Date.now() - start}ms` @@ -43553,10 +44083,10 @@ function requestLog(octokit) { }); }); } -requestLog.VERSION = VERSION5; +requestLog.VERSION = VERSION7; // -var VERSION6 = "0.0.0-development"; +var VERSION8 = "0.0.0-development"; function normalizePaginatedListResponse(response) { if (!response.data) { return { @@ -43600,7 +44130,7 @@ function iterator(octokit, route, parameters) { const response = await requestMethod({ method, url, headers }); const normalizedResponse = normalizePaginatedListResponse(response); url = ((normalizedResponse.headers.link || "").match( - /<([^>]+)>;\s*rel="next"/ + /<([^<>]+)>;\s*rel="next"/ ) || [])[1]; return { value: normalizedResponse }; } catch (error) { @@ -43659,10 +44189,10 @@ function paginateRest(octokit) { }) }; } -paginateRest.VERSION = VERSION6; +paginateRest.VERSION = VERSION8; // -var VERSION7 = "13.3.1"; +var VERSION9 = "13.3.1"; // var Endpoints = { @@ -45735,8 +46265,8 @@ var endpoints_default = Endpoints; // var endpointMethodsMap = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -45861,7 +46391,7 @@ function restEndpointMethods(octokit) { rest: api }; } -restEndpointMethods.VERSION = VERSION7; +restEndpointMethods.VERSION = VERSION9; function legacyRestEndpointMethods(octokit) { const api = endpointsToMethods(octokit); return { @@ -45869,15 +46399,15 @@ function legacyRestEndpointMethods(octokit) { rest: api }; } -legacyRestEndpointMethods.VERSION = VERSION7; +legacyRestEndpointMethods.VERSION = VERSION9; // -var VERSION8 = "21.1.0"; +var VERSION10 = "21.1.1"; // var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRest).defaults( { - userAgent: `octokit-rest.js/${VERSION8}` + userAgent: `octokit-rest.js/${VERSION10}` } ); @@ -46147,25 +46677,25 @@ var allLabels = { var import_core2 = __toESM(require_core()); // -function requestToOAuthBaseUrl(request2) { - const endpointDefaults = request2.endpoint.DEFAULTS; +function requestToOAuthBaseUrl(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); } -async function oauthRequest(request2, route, parameters) { +async function oauthRequest(request4, route, parameters) { const withOAuthParameters = { - baseUrl: requestToOAuthBaseUrl(request2), + baseUrl: requestToOAuthBaseUrl(request4), headers: { accept: "application/json" }, ...parameters }; - const response = await request2(route, withOAuthParameters); + const response = await request4(route, withOAuthParameters); if ("error" in response.data) { const error = new RequestError( `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, 400, { - request: request2.endpoint.merge( + request: request4.endpoint.merge( route, withOAuthParameters ) @@ -46176,32 +46706,43 @@ async function oauthRequest(request2, route, parameters) { } return response; } -async function exchangeWebFlowCode(options) { - const request2 = options.request || request; +async function createDeviceCode(options) { + const request4 = options.request || request; + const parameters = { + client_id: options.clientId + }; + if ("scopes" in options && Array.isArray(options.scopes)) { + parameters.scope = options.scopes.join(" "); + } + return oauthRequest(request4, "POST /login/device/code", parameters); +} +async function exchangeDeviceCode(options) { + const request4 = options.request || request; const response = await oauthRequest( - request2, + request4, "POST /login/oauth/access_token", { client_id: options.clientId, - client_secret: options.clientSecret, - code: options.code, - redirect_uri: options.redirectUrl + device_code: options.code, + grant_type: "urn:ietf:params:oauth:grant-type:device_code" } ); const authentication = { clientType: options.clientType, clientId: options.clientId, - clientSecret: options.clientSecret, token: response.data.access_token, scopes: response.data.scope.split(/\s+/).filter(Boolean) }; + if ("clientSecret" in options) { + authentication.clientSecret = options.clientSecret; + } if (options.clientType === "github-app") { if ("refresh_token" in response.data) { const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp( + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( apiTimeInMs, response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp( + ), authentication.refreshTokenExpiresAt = toTimestamp2( apiTimeInMs, response.data.refresh_token_expires_in ); @@ -46210,46 +46751,722 @@ async function exchangeWebFlowCode(options) { } return { ...response, authentication }; } -function toTimestamp(apiTimeInMs, expirationInSeconds) { +function toTimestamp2(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } -async function createDeviceCode(options) { - const request2 = options.request || request; - const parameters = { - client_id: options.clientId + +// +async function getOAuthAccessToken(state, options) { + const cachedAuthentication = getCachedAuthentication(state, options.auth); + if (cachedAuthentication) + return cachedAuthentication; + const { data: verification } = await createDeviceCode({ + clientType: state.clientType, + clientId: state.clientId, + request: options.request || state.request, + scopes: options.auth.scopes || state.scopes + }); + await state.onVerification(verification); + const authentication = await waitForAccessToken( + options.request || state.request, + state.clientId, + state.clientType, + verification + ); + state.authentication = authentication; + return authentication; +} +function getCachedAuthentication(state, auth22) { + if (auth22.refresh === true) + return false; + if (!state.authentication) + return false; + if (state.clientType === "github-app") { + return state.authentication; + } + const authentication = state.authentication; + const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( + " " + ); + const currentScope = authentication.scopes.join(" "); + return newScope === currentScope ? authentication : false; +} +async function wait(seconds) { + await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); +} +async function waitForAccessToken(request4, clientId, clientType, verification) { + try { + const options = { + clientId, + request: request4, + code: verification.device_code + }; + const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ + ...options, + clientType: "oauth-app" + }) : await exchangeDeviceCode({ + ...options, + clientType: "github-app" + }); + return { + type: "token", + tokenType: "oauth", + ...authentication + }; + } catch (error) { + if (!error.response) + throw error; + const errorType = error.response.data.error; + if (errorType === "authorization_pending") { + await wait(verification.interval); + return waitForAccessToken(request4, clientId, clientType, verification); + } + if (errorType === "slow_down") { + await wait(verification.interval + 5); + return waitForAccessToken(request4, clientId, clientType, verification); + } + throw error; + } +} +async function auth2(state, authOptions) { + return getOAuthAccessToken(state, { + auth: authOptions + }); +} +async function hook2(state, request4, route, parameters) { + let endpoint4 = request4.endpoint.merge( + route, + parameters + ); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); + } + const { token } = await getOAuthAccessToken(state, { + request: request4, + auth: { type: "oauth" } + }); + endpoint4.headers.authorization = `token ${token}`; + return request4(endpoint4); +} +var VERSION11 = "0.0.0-development"; +function createOAuthDeviceAuth(options) { + const requestWithDefaults = options.request || request.defaults({ + headers: { + "user-agent": `octokit-auth-oauth-device.js/${VERSION11} ${getUserAgent()}` + } + }); + const { request: request4 = requestWithDefaults, ...otherOptions } = options; + const state = options.clientType === "github-app" ? { + ...otherOptions, + clientType: "github-app", + request: request4 + } : { + ...otherOptions, + clientType: "oauth-app", + request: request4, + scopes: options.scopes || [] }; - if ("scopes" in options && Array.isArray(options.scopes)) { - parameters.scope = options.scopes.join(" "); + if (!options.clientId) { + throw new Error( + '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' + ); + } + if (!options.onVerification) { + throw new Error( + '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' + ); } - return oauthRequest(request2, "POST /login/device/code", parameters); + return Object.assign(auth2.bind(null, state), { + hook: hook2.bind(null, state) + }); } -async function exchangeDeviceCode(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + +// +var VERSION12 = "0.0.0-development"; +var userAgent3 = `octokit-endpoint.js/${VERSION12} ${getUserAgent()}`; +var DEFAULTS3 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent3 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys3(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject5(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep3(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject5(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep3(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties3(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge3(defaults, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys3(options.headers); + removeUndefinedProperties3(options); + removeUndefinedProperties3(options.headers); + const mergedOptions = mergeDeep3(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters3(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex3 = /\{[^}]+\}/g; +function removeNonChars3(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames3(url) { + const matches = url.match(urlVariableRegex3); + if (!matches) { + return []; + } + return matches.map(removeNonChars3).reduce((a, b) => a.concat(b), []); +} +function omit3(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved3(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved3(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue3(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved3(value) : encodeUnreserved3(value); + if (key) { + return encodeUnreserved3(key) + "=" + value; + } else { + return value; + } +} +function isDefined3(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator3(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues3(context3, operator, key, modifier) { + var value = context3[key], result = []; + if (isDefined3(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue3(operator, value, isKeyOperator3(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + result.push( + encodeValue3(operator, value2, isKeyOperator3(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + result.push(encodeValue3(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + tmp.push(encodeValue3(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + tmp.push(encodeUnreserved3(k)); + tmp.push(encodeValue3(operator, value[k].toString())); + } + }); + } + if (isKeyOperator3(operator)) { + result.push(encodeUnreserved3(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined3(value)) { + result.push(encodeUnreserved3(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved3(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl3(template) { + return { + expand: expand3.bind(null, template) + }; +} +function expand3(template, context3) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues3(context3, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved3(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse3(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit3(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames3(url); + url = parseUrl3(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit3(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters3(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults3(defaults, route, options) { + return parse3(merge3(defaults, route, options)); +} +function withDefaults6(oldDefaults, newDefaults) { + const DEFAULTS22 = merge3(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults3.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults6.bind(null, DEFAULTS22), + merge: merge3.bind(null, DEFAULTS22), + parse: parse3 + }); +} +var endpoint3 = withDefaults6(null, DEFAULTS3); + +// +var import_fast_content_type_parse3 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError3 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION13 = "0.0.0-development"; +var defaults_default3 = { + headers: { + "user-agent": `octokit-request.js/${VERSION13} ${getUserAgent()}` + } +}; +function isPlainObject6(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper3(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch2 = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject6(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error) { + let message = "Unknown Error"; + if (error instanceof Error) { + if (error.name === "AbortError") { + error.status = 500; + throw error; + } + message = error.message; + if (error.name === "TypeError" && "cause" in error) { + if (error.cause instanceof Error) { + message = error.cause.message; + } else if (typeof error.cause === "string") { + message = error.cause; + } + } + } + const requestError = new RequestError3(message, 500, { + request: requestOptions + }); + requestError.cause = error; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError3(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3(toErrorMessage3(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData3(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData3(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse3.safeParse)(contentType); + if (isJSONResponse3(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse3(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage3(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults7(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper3(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper3( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults7.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults7.bind(null, endpoint22) + }); +} +var request3 = withDefaults7(endpoint3, defaults_default3); + +// +function requestToOAuthBaseUrl2(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; + return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); +} +async function oauthRequest2(request4, route, parameters) { + const withOAuthParameters = { + baseUrl: requestToOAuthBaseUrl2(request4), + headers: { + accept: "application/json" + }, + ...parameters + }; + const response = await request4(route, withOAuthParameters); + if ("error" in response.data) { + const error = new RequestError3( + `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, + 400, + { + request: request4.endpoint.merge( + route, + withOAuthParameters + ) + } + ); + error.response = response; + throw error; + } + return response; +} +async function exchangeWebFlowCode(options) { + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, - device_code: options.code, - grant_type: "urn:ietf:params:oauth:grant-type:device_code" + client_secret: options.clientSecret, + code: options.code, + redirect_uri: options.redirectUrl } ); const authentication = { clientType: options.clientType, clientId: options.clientId, + clientSecret: options.clientSecret, token: response.data.access_token, scopes: response.data.scope.split(/\s+/).filter(Boolean) }; - if ("clientSecret" in options) { - authentication.clientSecret = options.clientSecret; - } if (options.clientType === "github-app") { if ("refresh_token" in response.data) { const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp( apiTimeInMs, response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp2( + ), authentication.refreshTokenExpiresAt = toTimestamp( apiTimeInMs, response.data.refresh_token_expires_in ); @@ -46258,12 +47475,12 @@ async function exchangeDeviceCode(options) { } return { ...response, authentication }; } -function toTimestamp2(apiTimeInMs, expirationInSeconds) { +function toTimestamp(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function checkToken(options) { - const request2 = options.request || request; - const response = await request2("POST /applications/{client_id}/token", { + const request4 = options.request || request3; + const response = await request4("POST /applications/{client_id}/token", { headers: { authorization: `basic ${btoa( `${options.clientId}:${options.clientSecret}` @@ -46287,9 +47504,9 @@ async function checkToken(options) { return { ...response, authentication }; } async function refreshToken(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, @@ -46317,9 +47534,9 @@ function toTimestamp3(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function resetToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - const response = await request2( + const response = await request4( "PATCH /applications/{client_id}/token", { headers: { @@ -46344,9 +47561,9 @@ async function resetToken(options) { return { ...response, authentication }; } async function deleteToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/token", { headers: { @@ -46358,9 +47575,9 @@ async function deleteToken(options) { ); } async function deleteAuthorization(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/grant", { headers: { @@ -46373,133 +47590,7 @@ async function deleteAuthorization(options) { } // -async function getOAuthAccessToken(state, options) { - const cachedAuthentication = getCachedAuthentication(state, options.auth); - if (cachedAuthentication) - return cachedAuthentication; - const { data: verification } = await createDeviceCode({ - clientType: state.clientType, - clientId: state.clientId, - request: options.request || state.request, - scopes: options.auth.scopes || state.scopes - }); - await state.onVerification(verification); - const authentication = await waitForAccessToken( - options.request || state.request, - state.clientId, - state.clientType, - verification - ); - state.authentication = authentication; - return authentication; -} -function getCachedAuthentication(state, auth22) { - if (auth22.refresh === true) - return false; - if (!state.authentication) - return false; - if (state.clientType === "github-app") { - return state.authentication; - } - const authentication = state.authentication; - const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( - " " - ); - const currentScope = authentication.scopes.join(" "); - return newScope === currentScope ? authentication : false; -} -async function wait(seconds) { - await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); -} -async function waitForAccessToken(request2, clientId, clientType, verification) { - try { - const options = { - clientId, - request: request2, - code: verification.device_code - }; - const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ - ...options, - clientType: "oauth-app" - }) : await exchangeDeviceCode({ - ...options, - clientType: "github-app" - }); - return { - type: "token", - tokenType: "oauth", - ...authentication - }; - } catch (error) { - if (!error.response) - throw error; - const errorType = error.response.data.error; - if (errorType === "authorization_pending") { - await wait(verification.interval); - return waitForAccessToken(request2, clientId, clientType, verification); - } - if (errorType === "slow_down") { - await wait(verification.interval + 5); - return waitForAccessToken(request2, clientId, clientType, verification); - } - throw error; - } -} -async function auth2(state, authOptions) { - return getOAuthAccessToken(state, { - auth: authOptions - }); -} -async function hook2(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( - route, - parameters - ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); - } - const { token } = await getOAuthAccessToken(state, { - request: request2, - auth: { type: "oauth" } - }); - endpoint2.headers.authorization = `token ${token}`; - return request2(endpoint2); -} -var VERSION9 = "0.0.0-development"; -function createOAuthDeviceAuth(options) { - const requestWithDefaults = options.request || request.defaults({ - headers: { - "user-agent": `octokit-auth-oauth-device.js/${VERSION9} ${getUserAgent()}` - } - }); - const { request: request2 = requestWithDefaults, ...otherOptions } = options; - const state = options.clientType === "github-app" ? { - ...otherOptions, - clientType: "github-app", - request: request2 - } : { - ...otherOptions, - clientType: "oauth-app", - request: request2, - scopes: options.scopes || [] - }; - if (!options.clientId) { - throw new Error( - '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - if (!options.onVerification) { - throw new Error( - '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - return Object.assign(auth2.bind(null, state), { - hook: hook2.bind(null, state) - }); -} - -// -var VERSION10 = "0.0.0-development"; +var VERSION14 = "0.0.0-development"; async function getAuthentication(state) { if ("code" in state.strategyOptions) { const { authentication } = await exchangeWebFlowCode({ @@ -46635,30 +47726,30 @@ var ROUTES_REQUIRING_BASIC_AUTH = /\/applications\/[^/]+\/(token|grant)s?/; function requiresBasicAuth(url) { return url && ROUTES_REQUIRING_BASIC_AUTH.test(url); } -async function hook3(state, request2, route, parameters = {}) { - const endpoint2 = request2.endpoint.merge( +async function hook3(state, request4, route, parameters = {}) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); } - if (requiresBasicAuth(endpoint2.url)) { + if (requiresBasicAuth(endpoint4.url)) { const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; - return request2(endpoint2); + endpoint4.headers.authorization = `basic ${credentials}`; + return request4(endpoint4); } - const { token } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request2 }) : await auth3({ ...state, request: request2 }); - endpoint2.headers.authorization = "token " + token; - return request2(endpoint2); + const { token } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request4 }) : await auth3({ ...state, request: request4 }); + endpoint4.headers.authorization = "token " + token; + return request4(endpoint4); } function createOAuthUserAuth({ clientId, clientSecret, clientType = "oauth-app", - request: request2 = request.defaults({ + request: request4 = request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION10} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION14} ${getUserAgent()}` } }), onTokenCreated, @@ -46670,13 +47761,13 @@ function createOAuthUserAuth({ clientSecret, onTokenCreated, strategyOptions, - request: request2 + request: request4 }); return Object.assign(auth3.bind(null, state), { hook: hook3.bind(null, state) }); } -createOAuthUserAuth.VERSION = VERSION10; +createOAuthUserAuth.VERSION = VERSION14; // async function auth4(state, authOptions) { @@ -46715,37 +47806,37 @@ async function auth4(state, authOptions) { }); return userAuth(); } -async function hook4(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( +async function hook4(state, request22, route, parameters) { + let endpoint4 = request22.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request22(endpoint4); } - if (state.clientType === "github-app" && !requiresBasicAuth(endpoint2.url)) { + if (state.clientType === "github-app" && !requiresBasicAuth(endpoint4.url)) { throw new Error( - `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint2.method} ${endpoint2.url}" is not supported.` + `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint4.method} ${endpoint4.url}" is not supported.` ); } const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; + endpoint4.headers.authorization = `basic ${credentials}`; try { - return await request2(endpoint2); + return await request22(endpoint4); } catch (error) { if (error.status !== 401) throw error; - error.message = `[@octokit/auth-oauth-app] "${endpoint2.method} ${endpoint2.url}" does not support clientId/clientSecret basic authentication.`; + error.message = `[@octokit/auth-oauth-app] "${endpoint4.method} ${endpoint4.url}" does not support clientId/clientSecret basic authentication.`; throw error; } } -var VERSION11 = "0.0.0-development"; +var VERSION15 = "0.0.0-development"; function createOAuthAppAuth(options) { const state = Object.assign( { request: request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION11} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION15} ${getUserAgent()}` } }), clientType: "oauth-app" @@ -47189,7 +48280,7 @@ async function getInstallationAuthentication(state, options, customRequest) { } } const appAuthentication = await getAppAuthentication(state); - const request2 = customRequest || state.request; + const request4 = customRequest || state.request; const payload = { installation_id: installationId, mediaType: { @@ -47219,7 +48310,7 @@ async function getInstallationAuthentication(state, options, customRequest) { repository_selection: repositorySelectionOptional, single_file: singleFileName } - } = await request2( + } = await request4( "POST /app/installations/{installation_id}/access_tokens", payload ); @@ -47316,18 +48407,18 @@ function isNotTimeSkewError(error) { /'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/ )); } -async function hook5(state, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge(route, parameters); - const url = endpoint2.url; +async function hook5(state, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge(route, parameters); + const url = endpoint4.url; if (/\/login\/oauth\/access_token$/.test(url)) { - return request2(endpoint2); + return request4(endpoint4); } - if (requiresAppAuth(url.replace(request2.endpoint.DEFAULTS.baseUrl, ""))) { + if (requiresAppAuth(url.replace(request4.endpoint.DEFAULTS.baseUrl, ""))) { const { token: token2 } = await getAppAuthentication(state); - endpoint2.headers.authorization = `bearer ${token2}`; + endpoint4.headers.authorization = `bearer ${token2}`; let response; try { - response = await request2(endpoint2); + response = await request4(endpoint4); } catch (error) { if (isNotTimeSkewError(error)) { throw error; @@ -47346,33 +48437,33 @@ async function hook5(state, request2, route, parameters) { ...state, timeDifference: diff }); - endpoint2.headers.authorization = `bearer ${token3}`; - return request2(endpoint2); + endpoint4.headers.authorization = `bearer ${token3}`; + return request4(endpoint4); } return response; } if (requiresBasicAuth(url)) { const authentication = await state.oauthApp({ type: "oauth-app" }); - endpoint2.headers.authorization = authentication.headers.authorization; - return request2(endpoint2); + endpoint4.headers.authorization = authentication.headers.authorization; + return request4(endpoint4); } const { token, createdAt } = await getInstallationAuthentication( state, {}, - request2.defaults({ baseUrl: endpoint2.baseUrl }) + request4.defaults({ baseUrl: endpoint4.baseUrl }) ); - endpoint2.headers.authorization = `token ${token}`; + endpoint4.headers.authorization = `token ${token}`; return sendRequestWithRetries( state, - request2, - endpoint2, + request4, + endpoint4, createdAt ); } -async function sendRequestWithRetries(state, request2, options, createdAt, retries = 0) { +async function sendRequestWithRetries(state, request4, options, createdAt, retries = 0) { const timeSinceTokenCreationInMs = +/* @__PURE__ */ new Date() - +new Date(createdAt); try { - return await request2(options); + return await request4(options); } catch (error) { if (error.status !== 401) { throw error; @@ -47389,10 +48480,10 @@ async function sendRequestWithRetries(state, request2, options, createdAt, retri `[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${retries}, wait: ${awaitTime / 1e3}s)` ); await new Promise((resolve) => setTimeout(resolve, awaitTime)); - return sendRequestWithRetries(state, request2, options, createdAt, retries); + return sendRequestWithRetries(state, request4, options, createdAt, retries); } } -var VERSION12 = "7.1.4"; +var VERSION16 = "7.1.5"; function createAppAuth(options) { if (!options.appId) { throw new Error("[@octokit/auth-app] appId option is required"); @@ -47411,14 +48502,14 @@ function createAppAuth(options) { }, options.log ); - const request2 = options.request || request.defaults({ + const request4 = options.request || request.defaults({ headers: { - "user-agent": `octokit-auth-app.js/${VERSION12} ${getUserAgent()}` + "user-agent": `octokit-auth-app.js/${VERSION16} ${getUserAgent()}` } }); const state = Object.assign( { - request: request2, + request: request4, cache: getCache() }, options, @@ -47429,7 +48520,7 @@ function createAppAuth(options) { clientType: "github-app", clientId: options.clientId || "", clientSecret: options.clientSecret || "", - request: request2 + request: request4 }) } ); diff --git a/.github/local-actions/lock-closed/main.js b/.github/local-actions/lock-closed/main.js index 62ec731c9..6e78a4032 100644 --- a/.github/local-actions/lock-closed/main.js +++ b/.github/local-actions/lock-closed/main.js @@ -3699,11 +3699,11 @@ var require_util2 = __commonJS({ } return location; } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -3769,7 +3769,7 @@ var require_util2 = __commonJS({ } return true; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const { headersList } = actualResponse; const policyHeader = (headersList.get("referrer-policy") ?? "").split(","); let policy = ""; @@ -3783,7 +3783,7 @@ var require_util2 = __commonJS({ } } if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -3800,33 +3800,33 @@ var require_util2 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; - if (request2.responseTainting === "cors" || request2.mode === "websocket") { + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; + if (request4.responseTainting === "cors" || request4.mode === "websocket") { if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } } } @@ -3858,26 +3858,26 @@ var require_util2 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (request2.referrer instanceof URL) { - referrerSource = request2.referrer; + } else if (request4.referrer instanceof URL) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); if (referrerURL.toString().length > 4096) { referrerURL = referrerOrigin; } - const areSameOrigin = sameOrigin(request2, referrerURL); - const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request2.url); + const areSameOrigin = sameOrigin(request4, referrerURL); + const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request4.url); switch (policy) { case "origin": return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true); @@ -3888,7 +3888,7 @@ var require_util2 = __commonJS({ case "origin-when-cross-origin": return areSameOrigin ? referrerURL : referrerOrigin; case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -4037,7 +4037,7 @@ var require_util2 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -5923,25 +5923,25 @@ var require_request = __commonJS({ static [kHTTP2BuildRequest](origin, opts, handler2) { const headers = opts.headers; opts = { ...opts, headers: null }; - const request2 = new Request(origin, opts, handler2); - request2.headers = {}; + const request4 = new Request(origin, opts, handler2); + request4.headers = {}; if (Array.isArray(headers)) { if (headers.length % 2 !== 0) { throw new InvalidArgumentError("headers array must be even"); } for (let i = 0; i < headers.length; i += 2) { - processHeader(request2, headers[i], headers[i + 1], true); + processHeader(request4, headers[i], headers[i + 1], true); } } else if (headers && typeof headers === "object") { const keys = Object.keys(headers); for (let i = 0; i < keys.length; i++) { const key = keys[i]; - processHeader(request2, key, headers[key], true); + processHeader(request4, key, headers[key], true); } } else if (headers != null) { throw new InvalidArgumentError("headers must be an object or an array"); } - return request2; + return request4; } static [kHTTP2CopyHeaders](raw) { const rawHeaders = raw.split("\r\n"); @@ -5969,28 +5969,28 @@ var require_request = __commonJS({ return skipAppend ? val : `${key}: ${val}\r `; } - function processHeader(request2, key, val, skipAppend = false) { + function processHeader(request4, key, val, skipAppend = false) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { return; } - if (request2.host === null && key.length === 4 && key.toLowerCase() === "host") { + if (request4.host === null && key.length === 4 && key.toLowerCase() === "host") { if (headerCharRegex.exec(val) !== null) { throw new InvalidArgumentError(`invalid ${key} header`); } - request2.host = val; - } else if (request2.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { - request2.contentType = val; + } else if (request4.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { + request4.contentType = val; if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } else if (key.length === 17 && key.toLowerCase() === "transfer-encoding") { throw new InvalidArgumentError("invalid transfer-encoding header"); } else if (key.length === 10 && key.toLowerCase() === "connection") { @@ -5998,7 +5998,7 @@ var require_request = __commonJS({ if (value !== "close" && value !== "keep-alive") { throw new InvalidArgumentError("invalid connection header"); } else if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (key.length === 10 && key.toLowerCase() === "keep-alive") { throw new InvalidArgumentError("invalid keep-alive header"); @@ -6012,19 +6012,19 @@ var require_request = __commonJS({ if (Array.isArray(val)) { for (let i = 0; i < val.length; i++) { if (skipAppend) { - if (request2.headers[key]) - request2.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; + if (request4.headers[key]) + request4.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; else - request2.headers[key] = processHeaderValue(key, val[i], skipAppend); + request4.headers[key] = processHeaderValue(key, val[i], skipAppend); } else { - request2.headers += processHeaderValue(key, val[i]); + request4.headers += processHeaderValue(key, val[i]); } } } else { if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } } } @@ -7168,10 +7168,10 @@ var require_client = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); - this[kQueue].push(request2); + const request4 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; process.nextTick(resume, this); } else { @@ -7195,8 +7195,8 @@ var require_client = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -7244,13 +7244,13 @@ var require_client = __commonJS({ assert(this[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } } else if (client[kRunning] > 0) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7456,8 +7456,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } } @@ -7497,12 +7497,12 @@ var require_client = __commonJS({ onUpgrade(head) { const { upgrade, client, socket, headers, statusCode } = this; assert(upgrade); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(!socket.destroyed); assert(socket === client[kSocket]); assert(!this.paused); - assert(request2.upgrade || request2.method === "CONNECT"); + assert(request4.upgrade || request4.method === "CONNECT"); this.statusCode = null; this.statusText = ""; this.shouldKeepAlive = null; @@ -7519,7 +7519,7 @@ var require_client = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -7530,8 +7530,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert(!this.upgrade); @@ -7540,22 +7540,22 @@ var require_client = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert.strictEqual(this.timeoutType, TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -7586,11 +7586,11 @@ var require_client = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -7607,8 +7607,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert.strictEqual(this.timeoutType, TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -7621,7 +7621,7 @@ var require_client = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } } @@ -7633,8 +7633,8 @@ var require_client = __commonJS({ if (upgrade) { return; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(statusCode >= 100); this.statusCode = null; this.statusText = ""; @@ -7648,11 +7648,11 @@ var require_client = __commonJS({ if (statusCode < 200) { return; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert.strictEqual(client[kRunning], 0); @@ -7710,8 +7710,8 @@ var require_client = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } assert(client[kSize] === 0); } @@ -7741,13 +7741,13 @@ var require_client = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7880,8 +7880,8 @@ var require_client = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + errorRequest(client, request4, err); } } else { onError(client, err); @@ -7935,8 +7935,8 @@ var require_client = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request3 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request3.headersTimeout != null ? request3.headersTimeout : client[kHeadersTimeout]; + const request5 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request5.headersTimeout != null ? request5.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -7958,13 +7958,13 @@ var require_client = __commonJS({ if (client[kRunning] >= (client[kPipelining] || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; - if (socket && socket.servername !== request2.servername) { + client[kServerName] = request4.servername; + if (socket && socket.servername !== request4.servername) { util.destroy(socket, new InformationalError("servername changed")); return; } @@ -7979,16 +7979,16 @@ var require_client = __commonJS({ if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) { return; } - if (client[kRunning] > 0 && !request2.idempotent) { + if (client[kRunning] > 0 && !request4.idempotent) { return; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body))) { return; } - if (!request2.aborted && write(client, request2)) { + if (!request4.aborted && write(client, request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -7998,12 +7998,12 @@ var require_client = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function write(client, request2) { + function write(client, request4) { if (client[kHTTPConnVersion] === "h2") { - writeH2(client, client[kHTTP2Session], request2); + writeH2(client, client[kHTTP2Session], request4); return; } - const { body, method, path, host, upgrade, headers, blocking, reset } = request2; + const { body, method, path, host, upgrade, headers, blocking, reset } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { body.read(0); @@ -8011,31 +8011,31 @@ var require_client = __commonJS({ const bodyLength = util.bodyLength(body); let contentLength = bodyLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(socket, new InformationalError("aborted")); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -8074,7 +8074,7 @@ upgrade: ${upgrade}\r header += headers; } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { if (contentLength === 0) { @@ -8086,7 +8086,7 @@ upgrade: ${upgrade}\r socket.write(`${header}\r `, "latin1"); } - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); socket.cork(); @@ -8095,48 +8095,48 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable({ body: body.stream(), client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body: body.stream(), client, request: request4, socket, contentLength, header, expectsPayload }); } else { - writeBlob({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeBlob({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } } else if (util.isStream(body)) { - writeStream({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeStream({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else if (util.isIterable(body)) { - writeIterable({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else { assert(false); } return true; } - function writeH2(client, session, request2) { - const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; + function writeH2(client, session, request4) { + const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; let headers; if (typeof reqHeaders === "string") headers = Request[kHTTP2CopyHeaders](reqHeaders.trim()); else headers = reqHeaders; if (upgrade) { - errorRequest(client, request2, new Error("Upgrade not supported for H2")); + errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } let stream; @@ -8147,11 +8147,11 @@ upgrade: ${upgrade}\r session.ref(); stream = session.request(headers, { endStream: false, signal }); if (stream.id && !stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; }); } @@ -8170,14 +8170,14 @@ upgrade: ${upgrade}\r } let contentLength = util.bodyLength(body); if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -8202,15 +8202,15 @@ upgrade: ${upgrade}\r ++h2State.openStreams; stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - if (request2.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.once("end", () => { - request2.onComplete([]); + request4.onComplete([]); }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -8228,7 +8228,7 @@ upgrade: ${upgrade}\r }); stream.once("frameError", (type, code) => { const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`); - errorRequest(client, request2, err); + errorRequest(client, request4, err); if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { h2State.streams -= 1; util.destroy(stream, err); @@ -8237,20 +8237,20 @@ upgrade: ${upgrade}\r return true; function writeBodyH2() { if (!body) { - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); stream.cork(); stream.write(body); stream.uncork(); stream.end(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { writeIterable({ client, - request: request2, + request: request4, contentLength, h2stream: stream, expectsPayload, @@ -8262,7 +8262,7 @@ upgrade: ${upgrade}\r writeBlob({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, h2stream: stream, @@ -8274,7 +8274,7 @@ upgrade: ${upgrade}\r writeStream({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, socket: client[kSocket], @@ -8285,7 +8285,7 @@ upgrade: ${upgrade}\r writeIterable({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, header: "", @@ -8297,11 +8297,11 @@ upgrade: ${upgrade}\r } } } - function writeStream({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + function writeStream({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); if (client[kHTTPConnVersion] === "h2") { let onPipeData = function(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); }; const pipe = pipeline( body, @@ -8311,7 +8311,7 @@ upgrade: ${upgrade}\r util.destroy(body, err); util.destroy(h2stream, err); } else { - request2.onRequestSent(); + request4.onRequestSent(); } } ); @@ -8323,7 +8323,7 @@ upgrade: ${upgrade}\r return; } let finished = false; - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -8379,7 +8379,7 @@ upgrade: ${upgrade}\r } socket.on("drain", onDrain).on("error", onFinished); } - async function writeBlob({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeBlob({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength === body.size, "blob body must have content length"); const isH2 = client[kHTTPConnVersion] === "h2"; try { @@ -8399,8 +8399,8 @@ upgrade: ${upgrade}\r socket.write(buffer); socket.uncork(); } - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -8409,7 +8409,7 @@ upgrade: ${upgrade}\r util.destroy(isH2 ? h2stream : socket, err); } } - async function writeIterable({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeIterable({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -8435,7 +8435,7 @@ upgrade: ${upgrade}\r throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } @@ -8443,14 +8443,14 @@ upgrade: ${upgrade}\r } catch (err) { h2stream.destroy(err); } finally { - request2.onRequestSent(); + request4.onRequestSent(); h2stream.end(); h2stream.off("close", onDrain).off("drain", onDrain); } return; } socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -8468,9 +8468,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -8479,7 +8479,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -8518,7 +8518,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -8529,8 +8529,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -8573,10 +8573,10 @@ ${len.toString(16)}\r } } }; - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert(request2.aborted); + request4.onError(err); + assert(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -9671,10 +9671,10 @@ var require_api_request = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -9689,7 +9689,7 @@ var require_api_request = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -10403,7 +10403,7 @@ var require_mock_utils = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (typeof data === "object") { @@ -10508,7 +10508,7 @@ var require_mock_utils = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); handler2.abort = nop; @@ -10565,7 +10565,7 @@ var require_mock_utils = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -10587,7 +10587,7 @@ var require_mock_utils = __commonJS({ var require_mock_interceptor = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils(); var { kDispatches, kDispatchKey, @@ -10650,7 +10650,7 @@ var require_mock_interceptor = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData(statusCode, data, responseOptions = {}) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -12299,7 +12299,7 @@ var require_request2 = __commonJS({ policyContainer: makePolicyContainer() } }; - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = this[kRealm].settingsObject.baseUrl; let signal = null; @@ -12315,17 +12315,17 @@ var require_request2 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(input instanceof Request); - request2 = input[kState]; + request4 = input[kState]; signal = input[kSignal]; } const origin = this[kRealm].settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request4.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -12333,43 +12333,43 @@ var require_request2 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: this[kRealm].settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -12378,14 +12378,14 @@ var require_request2 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, this[kRealm].settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -12400,27 +12400,27 @@ var require_request2 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; @@ -12431,12 +12431,12 @@ var require_request2 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizeMethodRecord[method] ?? normalizeMethod(method); - request2.method = method; + request4.method = method; } if (init.signal !== void 0) { signal = init.signal; } - this[kState] = request2; + this[kState] = request4; const ac = new AbortController(); this[kSignal] = ac.signal; this[kSignal][kRealm] = this[kRealm]; @@ -12470,13 +12470,13 @@ var require_request2 = __commonJS({ } } this[kHeaders] = new Headers(kConstruct); - this[kHeaders][kHeadersList] = request2.headersList; + this[kHeaders][kHeadersList] = request4.headersList; this[kHeaders][kGuard] = "request"; this[kHeaders][kRealm] = this[kRealm]; if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } this[kHeaders][kGuard] = "request-no-cors"; @@ -12495,14 +12495,14 @@ var require_request2 = __commonJS({ } } const inputBody = input instanceof Request ? input[kState].body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !this[kHeaders][kHeadersList].contains("content-type")) { @@ -12514,12 +12514,12 @@ var require_request2 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -12649,7 +12649,7 @@ var require_request2 = __commonJS({ }; mixinBody(Request); function makeRequest(init) { - const request2 = { + const request4 = { method: "GET", localURLsOnly: false, unsafeRequest: false, @@ -12688,13 +12688,13 @@ var require_request2 = __commonJS({ ...init, headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; - request2.url = request2.urlList[0]; - return request2; + request4.url = request4.urlList[0]; + return request4; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(request4.body); } return newRequest; } @@ -12924,14 +12924,14 @@ var require_fetch = __commonJS({ p.reject(e); return p.promise; } - const request2 = requestObject[kState]; + const request4 = requestObject[kState]; if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; const relevantRealm = null; @@ -12943,7 +12943,7 @@ var require_fetch = __commonJS({ locallyAborted = true; assert(controller != null); controller.abort(requestObject.signal.reason); - abortFetch(p, request2, responseObject, requestObject.signal.reason); + abortFetch(p, request4, responseObject, requestObject.signal.reason); } ); const handleFetchDone = (response) => finalizeAndReportTiming(response, "fetch"); @@ -12952,7 +12952,7 @@ var require_fetch = __commonJS({ return Promise.resolve(); } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return Promise.resolve(); } if (response.type === "error") { @@ -12970,7 +12970,7 @@ var require_fetch = __commonJS({ p.resolve(responseObject); }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: init.dispatcher ?? getGlobalDispatcher() @@ -13015,14 +13015,14 @@ var require_fetch = __commonJS({ performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis2, cacheState); } } - function abortFetch(p, request2, responseObject, error2) { + function abortFetch(p, request4, responseObject, error2) { var _a, _b; if (!error2) { error2 = new DOMException2("The operation was aborted.", "AbortError"); } p.reject(error2); - if (request2.body != null && isReadable((_a = request2.body) == null ? void 0 : _a.stream)) { - request2.body.stream.cancel(error2).catch((err) => { + if (request4.body != null && isReadable((_a = request4.body) == null ? void 0 : _a.stream)) { + request4.body.stream.cancel(error2).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -13043,7 +13043,7 @@ var require_fetch = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -13055,9 +13055,9 @@ var require_fetch = __commonJS({ var _a, _b, _c, _d; let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currenTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -13065,7 +13065,7 @@ var require_fetch = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -13075,32 +13075,32 @@ var require_fetch = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a = request4.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = (_d = request2.client) == null ? void 0 : _d.origin; + if (request4.origin === "client") { + request4.origin = (_d = request4.client) == null ? void 0 : _d.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept")) { + if (!request4.headersList.contains("accept")) { const value = "*/*"; - request2.headersList.append("accept", value); + request4.headersList.append("accept", value); } - if (!request2.headersList.contains("accept-language")) { - request2.headersList.append("accept-language", "*"); + if (!request4.headersList.contains("accept-language")) { + request4.headersList.append("accept-language", "*"); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -13108,44 +13108,44 @@ var require_fetch = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { response = await (async () => { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; return await schemeFetch(fetchParams); } - if (request2.mode === "same-origin") { + if (request4.mode === "same-origin") { return makeNetworkError('request mode cannot be "same-origin"'); } - if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { return makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; return await schemeFetch(fetchParams); } - if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { return makeNetworkError("URL scheme must be a HTTP(S) scheme"); } - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; return await httpFetch(fetchParams); })(); } @@ -13153,13 +13153,13 @@ var require_fetch = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -13167,26 +13167,26 @@ var require_fetch = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range")) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range")) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -13202,8 +13202,8 @@ var require_fetch = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -13212,12 +13212,12 @@ var require_fetch = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blobURLEntryObject = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !isBlobLike(blobURLEntryObject)) { + if (request4.method !== "GET" || !isBlobLike(blobURLEntryObject)) { return Promise.resolve(makeNetworkError("invalid method")); } const bodyWithType = safelyExtractBody(blobURLEntryObject); @@ -13235,7 +13235,7 @@ var require_fetch = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -13317,41 +13317,41 @@ var require_fetch = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -13361,13 +13361,13 @@ var require_fetch = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -13378,63 +13378,63 @@ var require_fetch = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization"); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie"); - request2.headersList.delete("host"); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization"); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie"); + request4.headersList.delete("host"); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = makeRequest(request2); + httpRequest = makeRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -13511,7 +13511,7 @@ var require_fetch = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -13519,7 +13519,7 @@ var require_fetch = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -13547,21 +13547,21 @@ var require_fetch = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -13590,7 +13590,7 @@ var require_fetch = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -13702,17 +13702,17 @@ var require_fetch = __commonJS({ } return response; async function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: fetchParams.controller.dispatcher.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: fetchParams.controller.dispatcher.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -13758,8 +13758,8 @@ var require_fetch = __commonJS({ } this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = request2.redirect === "follow" && location && redirectStatusSet.has(status); - if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = request4.redirect === "follow" && location && redirectStatusSet.has(status); + if (request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (const coding of codings) { if (coding === "x-gzip" || coding === "gzip") { decoders.push(zlib.createGunzip({ @@ -14693,36 +14693,36 @@ var require_cache = __commonJS({ } this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); - const p = await this.matchAll(request2, options); + const p = await this.matchAll(request4, options); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { var _a; webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -14744,11 +14744,11 @@ var require_cache = __commonJS({ } return Object.freeze(responseList); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.add" }); - request2 = webidl.converters.RequestInfo(request2); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -14758,11 +14758,11 @@ var require_cache = __commonJS({ requests = webidl.converters["sequence"](requests); const responsePromises = []; const requestList = []; - for (const request2 of requests) { - if (typeof request2 === "string") { + for (const request4 of requests) { + if (typeof request4 === "string") { continue; } - const r = request2[kState]; + const r = request4[kState]; if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14771,8 +14771,8 @@ var require_cache = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = new Request(request2)[kState]; + for (const request4 of requests) { + const r = new Request(request4)[kState]; if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14847,16 +14847,16 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 2, { header: "Cache.put" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); response = webidl.converters.Response(response); let innerRequest = null; - if (request2 instanceof Request) { - innerRequest = request2[kState]; + if (request4 instanceof Request) { + innerRequest = request4[kState]; } else { - innerRequest = new Request(request2)[kState]; + innerRequest = new Request(request4)[kState]; } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -14924,20 +14924,20 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.delete" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = new Request(request2)[kState]; + assert(typeof request4 === "string"); + r = new Request(request4)[kState]; } const operations = []; const operation = { @@ -14963,25 +14963,25 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -14993,12 +14993,12 @@ var require_cache = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = new Request("https://a"); - requestObject[kState] = request3; - requestObject[kHeaders][kHeadersList] = request3.headersList; + requestObject[kState] = request5; + requestObject[kHeaders][kHeadersList] = request5.headersList; requestObject[kHeaders][kGuard] = "immutable"; - requestObject[kRealm] = request3.client; + requestObject[kRealm] = request5.client; requestList.push(requestObject); } promise.resolve(Object.freeze(requestList)); @@ -15093,9 +15093,9 @@ var require_cache = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -15111,7 +15111,7 @@ var require_cache = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -15183,21 +15183,21 @@ var require_cachestorage = __commonJS({ webidl.illegalConstructor(); } } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, { header: "CacheStorage.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -16110,7 +16110,7 @@ var require_connection = __commonJS({ function establishWebSocketConnection(url, protocols, ws, onEstablish, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], serviceWorkers: "none", referrer: "no-referrer", @@ -16121,17 +16121,17 @@ var require_connection = __commonJS({ }); if (options.headers) { const headersList = new Headers(options.headers)[kHeadersList]; - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue); - request2.headersList.append("sec-websocket-version", "13"); + request4.headersList.append("sec-websocket-key", keyValue); + request4.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol); + request4.headersList.append("sec-websocket-protocol", protocol); } const permessageDeflate = ""; const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher ?? getGlobalDispatcher(), processResponse(response) { @@ -16164,7 +16164,7 @@ var require_connection = __commonJS({ return; } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); - if (secProtocol !== null && secProtocol !== request2.headersList.get("Sec-WebSocket-Protocol")) { + if (secProtocol !== null && secProtocol !== request4.headersList.get("Sec-WebSocket-Protocol")) { failWebsocketConnection(ws, "Protocol was not set in the opening handshake."); return; } @@ -17209,7 +17209,7 @@ var require_lib = __commonJS({ } exports.isHttps = isHttps; var HttpClient = class { - constructor(userAgent2, handlers, requestOptions) { + constructor(userAgent4, handlers, requestOptions) { this._ignoreSslError = false; this._allowRedirects = true; this._allowRedirectDowngrade = false; @@ -17218,7 +17218,7 @@ var require_lib = __commonJS({ this._maxRetries = 1; this._keepAlive = false; this._disposed = false; - this.userAgent = userAgent2; + this.userAgent = userAgent4; this.handlers = handlers || []; this.requestOptions = requestOptions; if (requestOptions) { @@ -17483,14 +17483,14 @@ var require_lib = __commonJS({ } _mergeHeaders(headers) { if (this.requestOptions && this.requestOptions.headers) { - return Object.assign({}, lowercaseKeys2(this.requestOptions.headers), lowercaseKeys2(headers || {})); + return Object.assign({}, lowercaseKeys4(this.requestOptions.headers), lowercaseKeys4(headers || {})); } - return lowercaseKeys2(headers || {}); + return lowercaseKeys4(headers || {}); } _getExistingOrDefaultHeader(additionalHeaders, header, _default) { let clientHeader; if (this.requestOptions && this.requestOptions.headers) { - clientHeader = lowercaseKeys2(this.requestOptions.headers)[header]; + clientHeader = lowercaseKeys4(this.requestOptions.headers)[header]; } return additionalHeaders[header] || clientHeader || _default; } @@ -17625,7 +17625,7 @@ var require_lib = __commonJS({ } }; exports.HttpClient = HttpClient; - var lowercaseKeys2 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + var lowercaseKeys4 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); } }); @@ -20462,10 +20462,10 @@ var require_util8 = __commonJS({ } return obj; } - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert(request2.aborted); + request4.onError(err); + assert(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -20993,7 +20993,7 @@ var require_request3 = __commonJS({ return this; } }; - function processHeader(request2, key, val) { + function processHeader(request4, key, val) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { @@ -21032,19 +21032,19 @@ var require_request3 = __commonJS({ } else { val = `${val}`; } - if (request2.host === null && headerName === "host") { + if (request4.host === null && headerName === "host") { if (typeof val !== "string") { throw new InvalidArgumentError("invalid host header"); } - request2.host = val; - } else if (request2.contentLength === null && headerName === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && headerName === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && headerName === "content-type") { - request2.contentType = val; - request2.headers.push(key, val); + } else if (request4.contentType === null && headerName === "content-type") { + request4.contentType = val; + request4.headers.push(key, val); } else if (headerName === "transfer-encoding" || headerName === "keep-alive" || headerName === "upgrade") { throw new InvalidArgumentError(`invalid ${headerName} header`); } else if (headerName === "connection") { @@ -21053,12 +21053,12 @@ var require_request3 = __commonJS({ throw new InvalidArgumentError("invalid connection header"); } if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (headerName === "expect") { throw new NotSupportedError("expect header not supported"); } else { - request2.headers.push(key, val); + request4.headers.push(key, val); } } module.exports = Request; @@ -23371,11 +23371,11 @@ var require_util9 = __commonJS({ function normalizeBinaryStringToUtf8(value) { return Buffer.from(value, "binary").toString("utf8"); } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -23412,10 +23412,10 @@ var require_util9 = __commonJS({ } return policy; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const policy = parseReferrerPolicy(actualResponse); if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -23432,33 +23432,33 @@ var require_util9 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header, true); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; if (serializedOrigin === "client" || serializedOrigin === void 0) { return; } - if (request2.responseTainting === "cors" || request2.mode === "websocket") { - request2.headersList.append("origin", serializedOrigin, true); - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + if (request4.responseTainting === "cors" || request4.mode === "websocket") { + request4.headersList.append("origin", serializedOrigin, true); + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } - request2.headersList.append("origin", serializedOrigin, true); + request4.headersList.append("origin", serializedOrigin, true); } } function coarsenTime(timestamp, crossOriginIsolatedCapability) { @@ -23512,18 +23512,18 @@ var require_util9 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (webidl.is.URL(request2.referrer)) { - referrerSource = request2.referrer; + } else if (webidl.is.URL(request4.referrer)) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); @@ -23541,14 +23541,14 @@ var require_util9 = __commonJS({ case "unsafe-url": return referrerURL; case "strict-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } return referrerOrigin; } case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -23558,17 +23558,17 @@ var require_util9 = __commonJS({ return referrerOrigin; } case "same-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return "no-referrer"; case "origin-when-cross-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return referrerOrigin; case "no-referrer-when-downgrade": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } @@ -23732,7 +23732,7 @@ var require_util9 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -25205,11 +25205,11 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } - request2.onResponseStarted(); + request4.onResponseStarted(); return 0; } onHeaderField(buf) { @@ -25257,9 +25257,9 @@ var require_client_h1 = __commonJS({ assert(!socket.destroyed); assert(!this.paused); assert((headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); - assert(request2.upgrade || request2.method === "CONNECT"); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); + assert(request4.upgrade || request4.method === "CONNECT"); this.statusCode = 0; this.statusText = ""; this.shouldKeepAlive = false; @@ -25276,7 +25276,7 @@ var require_client_h1 = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -25287,8 +25287,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert(!this.upgrade); @@ -25297,22 +25297,22 @@ var require_client_h1 = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert(this.timeoutType === TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -25343,11 +25343,11 @@ var require_client_h1 = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -25364,8 +25364,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(this.timeoutType === TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -25378,7 +25378,7 @@ var require_client_h1 = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } return 0; @@ -25393,8 +25393,8 @@ var require_client_h1 = __commonJS({ } assert(statusCode >= 100); assert((this.headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); this.statusCode = 0; this.statusText = ""; this.bytesRead = 0; @@ -25406,11 +25406,11 @@ var require_client_h1 = __commonJS({ if (statusCode < 200) { return 0; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert(client[kRunning] === 0); @@ -25476,8 +25476,8 @@ var require_client_h1 = __commonJS({ return { version: "h1", defaultPipelining: 1, - write(request2) { - return writeH1(client, request2); + write(request4) { + return writeH1(client, request4); }, resume() { resumeH1(client); @@ -25493,18 +25493,18 @@ var require_client_h1 = __commonJS({ get destroyed() { return socket.destroyed; }, - busy(request2) { + busy(request4) { if (socket[kWriting] || socket[kReset] || socket[kBlocking]) { return true; } - if (request2) { - if (client[kRunning] > 0 && !request2.idempotent) { + if (request4) { + if (client[kRunning] > 0 && !request4.idempotent) { return true; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return true; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body) || util.isFormDataLike(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body) || util.isFormDataLike(request4.body))) { return true; } } @@ -25551,13 +25551,13 @@ var require_client_h1 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -25585,8 +25585,8 @@ var require_client_h1 = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request2 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request2.headersTimeout != null ? request2.headersTimeout : client[kHeadersTimeout]; + const request4 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request4.headersTimeout != null ? request4.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -25595,21 +25595,21 @@ var require_client_h1 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH1(client, request2) { - const { method, path, host, upgrade, blocking, reset } = request2; - let { body, headers, contentLength } = request2; + function writeH1(client, request4) { + const { method, path, host, upgrade, blocking, reset } = request4; + let { body, headers, contentLength } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH"; if (util.isFormDataLike(body)) { if (!extractBody) { extractBody = require_body2().extractBody; } const [bodyStream, contentType] = extractBody(body); - if (request2.contentType == null) { + if (request4.contentType == null) { headers.push("content-type", contentType); } body = bodyStream.stream; contentLength = bodyStream.length; - } else if (util.isBlobLike(body) && request2.contentType == null && body.type) { + } else if (util.isBlobLike(body) && request4.contentType == null && body.type) { headers.push("content-type", body.type); } if (body && typeof body.read === "function") { @@ -25618,33 +25618,33 @@ var require_client_h1 = __commonJS({ const bodyLength = util.bodyLength(body); contentLength = bodyLength ?? contentLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - util.errorRequest(client, request2, err || new RequestAbortedError()); + util.errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(body); util.destroy(socket, new InformationalError("aborted")); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -25695,31 +25695,31 @@ upgrade: ${upgrade}\r } } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { - writeBuffer(abort, null, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, null, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBuffer(body)) { - writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable(abort, body.stream(), client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body.stream(), client, request4, socket, contentLength, header, expectsPayload); } else { - writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload); } } else if (util.isStream(body)) { - writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isIterable(body)) { - writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else { assert(false); } return true; } - function writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); let finished = false; - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -25785,7 +25785,7 @@ upgrade: ${upgrade}\r setImmediate(onClose); } } - function writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload) { try { if (!body) { if (contentLength === 0) { @@ -25805,18 +25805,18 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(body); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (err) { abort(err); } } - async function writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -25829,9 +25829,9 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(buffer); socket.uncork(); - request2.onBodySent(buffer); - request2.onRequestSent(); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(buffer); + request4.onRequestSent(); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } client[kResume](); @@ -25839,7 +25839,7 @@ upgrade: ${upgrade}\r abort(err); } } - async function writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -25858,7 +25858,7 @@ upgrade: ${upgrade}\r } }); socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -25876,9 +25876,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ abort, socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ abort, socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -25888,7 +25888,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -25907,7 +25907,7 @@ upgrade: ${upgrade}\r } socket.cork(); if (bytesWritten === 0) { - if (!expectsPayload && request2.reset !== false) { + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } if (contentLength === null) { @@ -25927,7 +25927,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -25938,8 +25938,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -26082,8 +26082,8 @@ var require_client_h2 = __commonJS({ return { version: "h2", defaultPipelining: Infinity, - write(request2) { - return writeH2(client, request2); + write(request4) { + return writeH2(client, request4); }, resume() { resumeH2(client); @@ -26141,9 +26141,9 @@ var require_client_h2 = __commonJS({ this[kHTTP2Session] = null; util.destroy(this[kSocket], err); if (client[kRunningIdx] < client[kQueue].length) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); client[kPendingIdx] = client[kRunningIdx]; } assert(client[kRunning] === 0); @@ -26160,8 +26160,8 @@ var require_client_h2 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } } @@ -26192,13 +26192,13 @@ var require_client_h2 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH2(client, request2) { - const requestTimeout = request2.bodyTimeout ?? client[kBodyTimeout]; + function writeH2(client, request4) { + const requestTimeout = request4.bodyTimeout ?? client[kBodyTimeout]; const session = client[kHTTP2Session]; - const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; - let { body } = request2; + const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; + let { body } = request4; if (upgrade) { - util.errorRequest(client, request2, new Error("Upgrade not supported for H2")); + util.errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } const headers = {}; @@ -26222,11 +26222,11 @@ var require_client_h2 = __commonJS({ headers[HTTP2_HEADER_AUTHORITY] = host || `${hostname}${port ? `:${port}` : ""}`; headers[HTTP2_HEADER_METHOD] = method; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } err = err || new RequestAbortedError(); - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); if (stream != null) { stream.removeAllListeners("data"); stream.close(); @@ -26236,23 +26236,23 @@ var require_client_h2 = __commonJS({ util.destroy(body, err); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "CONNECT") { session.ref(); stream = session.request(headers, { endStream: false, signal }); if (!stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; }); @@ -26280,14 +26280,14 @@ var require_client_h2 = __commonJS({ contentLength = bodyStream.length; } if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -26303,7 +26303,7 @@ var require_client_h2 = __commonJS({ header += `${key}: ${headers[key]}\r `; } - channels.sendHeaders.publish({ request: request2, headers: header, socket: session[kSocket] }); + channels.sendHeaders.publish({ request: request4, headers: header, socket: session[kSocket] }); } const shouldEndStream = method === "GET" || method === "HEAD" || body === null; if (expectContinue) { @@ -26321,17 +26321,17 @@ var require_client_h2 = __commonJS({ stream.setTimeout(requestTimeout); stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - request2.onResponseStarted(); - if (request2.aborted) { + request4.onResponseStarted(); + if (request4.aborted) { stream.removeAllListeners("data"); return; } - if (request2.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -26339,8 +26339,8 @@ var require_client_h2 = __commonJS({ var _a; stream.removeAllListeners("data"); if (((_a = stream.state) == null ? void 0 : _a.state) == null || stream.state.state < 6) { - if (!request2.aborted && !request2.completed) { - request2.onComplete({}); + if (!request4.aborted && !request4.completed) { + request4.onComplete({}); } client[kQueue][client[kRunningIdx]++] = null; client[kResume](); @@ -26383,10 +26383,10 @@ var require_client_h2 = __commonJS({ abort(err); }); stream.once("trailers", (trailers) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - request2.onComplete(trailers); + request4.onComplete(trailers); }); return true; function writeBodyH2() { @@ -26396,7 +26396,7 @@ var require_client_h2 = __commonJS({ stream, null, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26407,7 +26407,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26419,7 +26419,7 @@ var require_client_h2 = __commonJS({ stream, body.stream(), client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26430,7 +26430,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26444,7 +26444,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, contentLength ); } else if (util.isIterable(body)) { @@ -26453,7 +26453,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26463,7 +26463,7 @@ var require_client_h2 = __commonJS({ } } } - function writeBuffer(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + function writeBuffer(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { try { if (body != null && util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); @@ -26471,18 +26471,18 @@ var require_client_h2 = __commonJS({ h2stream.write(body); h2stream.uncork(); h2stream.end(); - request2.onBodySent(body); + request4.onBodySent(body); } if (!expectsPayload) { socket[kReset] = true; } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (error2) { abort(error2); } } - function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) { + function writeStream(abort, socket, expectsPayload, h2stream, body, client, request4, contentLength) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); const pipe = pipeline( body, @@ -26493,7 +26493,7 @@ var require_client_h2 = __commonJS({ abort(err); } else { util.removeAllListeners(pipe); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26503,10 +26503,10 @@ var require_client_h2 = __commonJS({ ); util.addListener(pipe, "data", onPipeData); function onPipeData(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); } } - async function writeBlob(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeBlob(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -26517,8 +26517,8 @@ var require_client_h2 = __commonJS({ h2stream.write(buffer); h2stream.uncork(); h2stream.end(); - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26527,7 +26527,7 @@ var require_client_h2 = __commonJS({ abort(err); } } - async function writeIterable(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeIterable(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -26552,13 +26552,13 @@ var require_client_h2 = __commonJS({ throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } } h2stream.end(); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26805,10 +26805,10 @@ var require_client2 = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = new Request(origin, opts, handler2); - this[kQueue].push(request2); + const request4 = new Request(origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; queueMicrotask(() => resume(this)); } else { @@ -26832,8 +26832,8 @@ var require_client2 = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(this, request2, err); + const request4 = requests[i]; + util.errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -26857,8 +26857,8 @@ var require_client2 = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } assert(client[kSize] === 0); } @@ -26962,8 +26962,8 @@ var require_client2 = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - util.errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + util.errorRequest(client, request4, err); } } else { onError(client, err); @@ -27021,12 +27021,12 @@ var require_client2 = __commonJS({ if (client[kRunning] >= (getPipelining(client) || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; + client[kServerName] = request4.servername; (_a = client[kHTTPContext]) == null ? void 0 : _a.destroy(new InformationalError("servername changed"), () => { client[kHTTPContext] = null; resume(client); @@ -27042,10 +27042,10 @@ var require_client2 = __commonJS({ if (client[kHTTPContext].destroyed) { return; } - if (client[kHTTPContext].busy(request2)) { + if (client[kHTTPContext].busy(request4)) { return; } - if (!request2.aborted && client[kHTTPContext].write(request2)) { + if (!request4.aborted && client[kHTTPContext].write(request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -28659,10 +28659,10 @@ var require_api_request2 = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -28678,7 +28678,7 @@ var require_api_request2 = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -29444,7 +29444,7 @@ var require_mock_utils2 = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (data instanceof Uint8Array) { @@ -29577,7 +29577,7 @@ var require_mock_utils2 = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); (_a = handler2.onConnect) == null ? void 0 : _a.call(handler2, (err) => handler2.onError(err), null); @@ -29634,7 +29634,7 @@ var require_mock_utils2 = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -29657,7 +29657,7 @@ var require_mock_utils2 = __commonJS({ var require_mock_interceptor2 = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils2(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils2(); var { kDispatches, kDispatchKey, @@ -29722,7 +29722,7 @@ var require_mock_interceptor2 = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData({ statusCode, data, responseOptions }) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -32022,7 +32022,7 @@ var require_sqlite_cache_store = __commonJS({ var { Writable } = __require("stream"); var { assertCacheKey, assertCacheValue } = require_cache2(); var DatabaseSync; - var VERSION13 = 3; + var VERSION17 = 3; var MAX_ENTRY_SIZE = 2 * 1e3 * 1e3 * 1e3; module.exports = class SqliteCacheStore { #maxEntrySize = MAX_ENTRY_SIZE; @@ -32061,7 +32061,7 @@ var require_sqlite_cache_store = __commonJS({ } this.#db = new DatabaseSync((opts == null ? void 0 : opts.location) ?? ":memory:"); this.#db.exec(` - CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION13} ( + CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION17} ( -- Data specific to us id INTEGER PRIMARY KEY AUTOINCREMENT, url TEXT NOT NULL, @@ -32080,9 +32080,9 @@ var require_sqlite_cache_store = __commonJS({ staleAt INTEGER NOT NULL ); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_url ON cacheInterceptorV${VERSION13}(url); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_method ON cacheInterceptorV${VERSION13}(method); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_deleteAt ON cacheInterceptorV${VERSION13}(deleteAt); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_url ON cacheInterceptorV${VERSION17}(url); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_method ON cacheInterceptorV${VERSION17}(method); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_deleteAt ON cacheInterceptorV${VERSION17}(deleteAt); `); this.#getValuesQuery = this.#db.prepare(` SELECT @@ -32097,7 +32097,7 @@ var require_sqlite_cache_store = __commonJS({ vary, cachedAt, staleAt - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION17} WHERE url = ? AND method = ? @@ -32105,7 +32105,7 @@ var require_sqlite_cache_store = __commonJS({ deleteAt ASC `); this.#updateValueQuery = this.#db.prepare(` - UPDATE cacheInterceptorV${VERSION13} SET + UPDATE cacheInterceptorV${VERSION17} SET body = ?, deleteAt = ?, statusCode = ?, @@ -32119,7 +32119,7 @@ var require_sqlite_cache_store = __commonJS({ id = ? `); this.#insertValueQuery = this.#db.prepare(` - INSERT INTO cacheInterceptorV${VERSION13} ( + INSERT INTO cacheInterceptorV${VERSION17} ( url, method, body, @@ -32135,20 +32135,20 @@ var require_sqlite_cache_store = __commonJS({ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `); this.#deleteByUrlQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE url = ?` + `DELETE FROM cacheInterceptorV${VERSION17} WHERE url = ?` ); this.#countEntriesQuery = this.#db.prepare( - `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION13}` + `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION17}` ); this.#deleteExpiredValuesQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE deleteAt <= ?` + `DELETE FROM cacheInterceptorV${VERSION17} WHERE deleteAt <= ?` ); this.#deleteOldValuesQuery = this.#maxCount === Infinity ? null : this.#db.prepare(` - DELETE FROM cacheInterceptorV${VERSION13} + DELETE FROM cacheInterceptorV${VERSION17} WHERE id IN ( SELECT id - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION17} ORDER BY cachedAt DESC LIMIT ? ) @@ -33239,7 +33239,7 @@ var require_request4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); input = webidl.converters.RequestInfo(input, prefix, "input"); init = webidl.converters.RequestInit(init, prefix, "init"); - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = environmentSettingsObject.settingsObject.baseUrl; let signal = null; @@ -33256,18 +33256,18 @@ var require_request4 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(webidl.is.Request(input)); - request2 = input.#state; + request4 = input.#state; signal = input.#signal; this.#dispatcher = init.dispatcher || input.#dispatcher; } const origin = environmentSettingsObject.settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request4.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -33275,43 +33275,43 @@ var require_request4 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: environmentSettingsObject.settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -33320,14 +33320,14 @@ var require_request4 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, environmentSettingsObject.settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -33342,33 +33342,33 @@ var require_request4 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; const mayBeNormalized = normalizedMethodRecords[method]; if (mayBeNormalized !== void 0) { - request2.method = mayBeNormalized; + request4.method = mayBeNormalized; } else { if (!isValidHTTPToken(method)) { throw new TypeError(`'${method}' is not a valid HTTP method.`); @@ -33378,9 +33378,9 @@ var require_request4 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizedMethodRecordsBase[upperCase] ?? method; - request2.method = method; + request4.method = method; } - if (!patchMethodWarning && request2.method === "patch") { + if (!patchMethodWarning && request4.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" }); @@ -33390,7 +33390,7 @@ var require_request4 = __commonJS({ if (init.signal !== void 0) { signal = init.signal; } - this.#state = request2; + this.#state = request4; const ac = new AbortController(); this.#signal = ac.signal; if (signal != null) { @@ -33411,12 +33411,12 @@ var require_request4 = __commonJS({ } } this.#headers = new Headers(kConstruct); - setHeadersList(this.#headers, request2.headersList); + setHeadersList(this.#headers, request4.headersList); setHeadersGuard(this.#headers, "request"); if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } setHeadersGuard(this.#headers, "request-no-cors"); @@ -33435,14 +33435,14 @@ var require_request4 = __commonJS({ } } const inputBody = webidl.is.Request(input) ? input.#state.body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !getHeadersList(this.#headers).contains("content-type", true)) { @@ -33454,12 +33454,12 @@ var require_request4 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -33604,24 +33604,24 @@ var require_request4 = __commonJS({ }; return `Request ${nodeUtil.formatWithOptions(options, properties)}`; } - static setRequestSignal(request2, newSignal) { - request2.#signal = newSignal; - return request2; + static setRequestSignal(request4, newSignal) { + request4.#signal = newSignal; + return request4; } - static getRequestDispatcher(request2) { - return request2.#dispatcher; + static getRequestDispatcher(request4) { + return request4.#dispatcher; } - static setRequestDispatcher(request2, newDispatcher) { - request2.#dispatcher = newDispatcher; + static setRequestDispatcher(request4, newDispatcher) { + request4.#dispatcher = newDispatcher; } - static setRequestHeaders(request2, newHeaders) { - request2.#headers = newHeaders; + static setRequestHeaders(request4, newHeaders) { + request4.#headers = newHeaders; } - static getRequestState(request2) { - return request2.#state; + static getRequestState(request4) { + return request4.#state; } - static setRequestState(request2, newState) { - request2.#state = newState; + static setRequestState(request4, newState) { + request4.#state = newState; } }; var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState } = Request; @@ -33674,23 +33674,23 @@ var require_request4 = __commonJS({ headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(newRequest, request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(newRequest, request4.body); } return newRequest; } function fromInnerRequest(innerRequest, dispatcher, signal, guard) { - const request2 = new Request(kConstruct); - setRequestState(request2, innerRequest); - setRequestDispatcher(request2, dispatcher); - setRequestSignal(request2, signal); + const request4 = new Request(kConstruct); + setRequestState(request4, innerRequest); + setRequestDispatcher(request4, dispatcher); + setRequestSignal(request4, signal); const headers = new Headers(kConstruct); - setRequestHeaders(request2, headers); + setRequestHeaders(request4, headers); setHeadersList(headers, innerRequest.headersList); setHeadersGuard(headers, guard); - return request2; + return request4; } Object.defineProperties(Request.prototype, { method: kEnumerableProperty, @@ -33928,14 +33928,14 @@ var require_fetch2 = __commonJS({ p.reject(e); return p.promise; } - const request2 = getRequestState(requestObject); + const request4 = getRequestState(requestObject); if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; let locallyAborted = false; @@ -33947,7 +33947,7 @@ var require_fetch2 = __commonJS({ assert(controller != null); controller.abort(requestObject.signal.reason); const realResponse = responseObject == null ? void 0 : responseObject.deref(); - abortFetch(p, request2, realResponse, requestObject.signal.reason); + abortFetch(p, request4, realResponse, requestObject.signal.reason); } ); const processResponse = (response) => { @@ -33955,7 +33955,7 @@ var require_fetch2 = __commonJS({ return; } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return; } if (response.type === "error") { @@ -33967,7 +33967,7 @@ var require_fetch2 = __commonJS({ p = null; }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: getRequestDispatcher(requestObject) @@ -34008,13 +34008,13 @@ var require_fetch2 = __commonJS({ ); } var markResourceTiming = performance.markResourceTiming; - function abortFetch(p, request2, responseObject, error2) { + function abortFetch(p, request4, responseObject, error2) { var _a, _b; if (p) { p.reject(error2); } - if (((_a = request2.body) == null ? void 0 : _a.stream) != null && isReadable(request2.body.stream)) { - request2.body.stream.cancel(error2).catch((err) => { + if (((_a = request4.body) == null ? void 0 : _a.stream) != null && isReadable(request4.body.stream)) { + request4.body.stream.cancel(error2).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -34035,7 +34035,7 @@ var require_fetch2 = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -34048,9 +34048,9 @@ var require_fetch2 = __commonJS({ assert(dispatcher); let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currentTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -34058,7 +34058,7 @@ var require_fetch2 = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -34068,32 +34068,32 @@ var require_fetch2 = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a = request4.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = request2.client.origin; + if (request4.origin === "client") { + request4.origin = request4.client.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept", true)) { + if (!request4.headersList.contains("accept", true)) { const value = "*/*"; - request2.headersList.append("accept", value, true); + request4.headersList.append("accept", value, true); } - if (!request2.headersList.contains("accept-language", true)) { - request2.headersList.append("accept-language", "*", true); + if (!request4.headersList.contains("accept-language", true)) { + request4.headersList.append("accept-language", "*", true); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -34101,41 +34101,41 @@ var require_fetch2 = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; response = await schemeFetch(fetchParams); - } else if (request2.mode === "same-origin") { + } else if (request4.mode === "same-origin") { response = makeNetworkError('request mode cannot be "same-origin"'); - } else if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + } else if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { response = makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } else { - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; response = await schemeFetch(fetchParams); } - } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { response = makeNetworkError("URL scheme must be a HTTP(S) scheme"); } else { - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; response = await httpFetch(fetchParams); } } @@ -34143,13 +34143,13 @@ var require_fetch2 = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -34157,26 +34157,26 @@ var require_fetch2 = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range", true)) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range", true)) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -34192,8 +34192,8 @@ var require_fetch2 = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -34202,19 +34202,19 @@ var require_fetch2 = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("node:buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blob = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !webidl.is.Blob(blob)) { + if (request4.method !== "GET" || !webidl.is.Blob(blob)) { return Promise.resolve(makeNetworkError("invalid method")); } const response = makeResponse(); const fullLength = blob.size; const serializedFullLength = isomorphicEncode(`${fullLength}`); const type = blob.type; - if (!request2.headersList.contains("range", true)) { + if (!request4.headersList.contains("range", true)) { const bodyWithType = extractBody(blob); response.statusText = "OK"; response.body = bodyWithType[0]; @@ -34222,7 +34222,7 @@ var require_fetch2 = __commonJS({ response.headersList.set("content-type", type, true); } else { response.rangeRequested = true; - const rangeHeader = request2.headersList.get("range", true); + const rangeHeader = request4.headersList.get("range", true); const rangeValue = simpleRangeHeaderValue(rangeHeader, true); if (rangeValue === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34253,7 +34253,7 @@ var require_fetch2 = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34342,41 +34342,41 @@ var require_fetch2 = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(void 0, false); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -34386,13 +34386,13 @@ var require_fetch2 = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -34403,63 +34403,63 @@ var require_fetch2 = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization", true); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie", true); - request2.headersList.delete("host", true); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization", true); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie", true); + request4.headersList.delete("host", true); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = cloneRequest(request2); + httpRequest = cloneRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -34536,7 +34536,7 @@ var require_fetch2 = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -34544,7 +34544,7 @@ var require_fetch2 = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -34574,21 +34574,21 @@ var require_fetch2 = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -34617,7 +34617,7 @@ var require_fetch2 = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -34728,17 +34728,17 @@ var require_fetch2 = __commonJS({ } return response; function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: agent.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -34774,8 +34774,8 @@ var require_fetch2 = __commonJS({ location = headersList.get("location", true); this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status); - if (codings.length !== 0 && request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = location && request4.redirect === "follow" && redirectStatusSet.has(status); + if (codings.length !== 0 && request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (let i = codings.length - 1; i >= 0; --i) { const coding = codings[i]; if (coding === "x-gzip" || coding === "gzip") { @@ -34917,32 +34917,32 @@ var require_cache4 = __commonJS({ webidl.util.markAsUncloneable(this); this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.match"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - const p = this.#internalMatchAll(request2, options, 1); + const p = this.#internalMatchAll(request4, options, 1); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.matchAll"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - return this.#internalMatchAll(request2, options); + return this.#internalMatchAll(request4, options); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); const prefix = "Cache.add"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -34952,19 +34952,19 @@ var require_cache4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); const responsePromises = []; const requestList = []; - for (let request2 of requests) { - if (request2 === void 0) { + for (let request4 of requests) { + if (request4 === void 0) { throw webidl.errors.conversionFailed({ prefix, argument: "Argument 1", types: ["undefined is not allowed"] }); } - request2 = webidl.converters.RequestInfo(request2); - if (typeof request2 === "string") { + request4 = webidl.converters.RequestInfo(request4); + if (typeof request4 === "string") { continue; } - const r = getRequestState(request2); + const r = getRequestState(request4); if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: prefix, @@ -34973,8 +34973,8 @@ var require_cache4 = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = getRequestState(new Request(request2)); + for (const request4 of requests) { + const r = getRequestState(new Request(request4)); if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: prefix, @@ -35048,17 +35048,17 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); const prefix = "Cache.put"; webidl.argumentLengthCheck(arguments, 2, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); response = webidl.converters.Response(response, prefix, "response"); let innerRequest = null; - if (webidl.is.Request(request2)) { - innerRequest = getRequestState(request2); + if (webidl.is.Request(request4)) { + innerRequest = getRequestState(request4); } else { - innerRequest = getRequestState(new Request(request2)); + innerRequest = getRequestState(new Request(request4)); } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -35126,21 +35126,21 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.delete"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = getRequestState(new Request(request2)); + assert(typeof request4 === "string"); + r = getRequestState(new Request(request4)); } const operations = []; const operation = { @@ -35166,26 +35166,26 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.keys"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -35197,9 +35197,9 @@ var require_cache4 = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = fromInnerRequest( - request3, + request5, void 0, new AbortController().signal, "immutable" @@ -35298,9 +35298,9 @@ var require_cache4 = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -35316,7 +35316,7 @@ var require_cache4 = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -35324,20 +35324,20 @@ var require_cache4 = __commonJS({ } return true; } - #internalMatchAll(request2, options, maxResponses = Infinity) { + #internalMatchAll(request4, options, maxResponses = Infinity) { let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -35425,21 +35425,21 @@ var require_cachestorage2 = __commonJS({ } webidl.util.markAsUncloneable(this); } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, "CacheStorage.match"); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -36529,7 +36529,7 @@ var require_connection2 = __commonJS({ function establishWebSocketConnection(url, protocols, client, handler2, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], client, serviceWorkers: "none", @@ -36541,18 +36541,18 @@ var require_connection2 = __commonJS({ }); if (options.headers) { const headersList = getHeadersList(new Headers(options.headers)); - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue, true); - request2.headersList.append("sec-websocket-version", "13", true); + request4.headersList.append("sec-websocket-key", keyValue, true); + request4.headersList.append("sec-websocket-version", "13", true); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol, true); + request4.headersList.append("sec-websocket-protocol", protocol, true); } const permessageDeflate = "permessage-deflate; client_max_window_bits"; - request2.headersList.append("sec-websocket-extensions", permessageDeflate, true); + request4.headersList.append("sec-websocket-extensions", permessageDeflate, true); const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher, processResponse(response) { @@ -36593,7 +36593,7 @@ var require_connection2 = __commonJS({ } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); if (secProtocol !== null) { - const requestProtocols = getDecodeSplit("sec-websocket-protocol", request2.headersList); + const requestProtocols = getDecodeSplit("sec-websocket-protocol", request4.headersList); if (!requestProtocols.includes(secProtocol)) { failWebsocketConnection(handler2, 1002, "Protocol was not set in the opening handshake."); return; @@ -38793,24 +38793,24 @@ var require_dist_node3 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - endpoint: () => endpoint2 + endpoint: () => endpoint4 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node2(); - var VERSION13 = "9.0.5"; - var userAgent2 = `octokit-endpoint.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; - var DEFAULTS2 = { + var import_universal_user_agent13 = require_dist_node2(); + var VERSION17 = "9.0.5"; + var userAgent4 = `octokit-endpoint.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}`; + var DEFAULTS4 = { method: "GET", baseUrl: "https://api.github.com", headers: { accept: "application/vnd.github.v3+json", - "user-agent": userAgent2 + "user-agent": userAgent4 }, mediaType: { format: "" } }; - function lowercaseKeys2(object) { + function lowercaseKeys4(object) { if (!object) { return {}; } @@ -38819,7 +38819,7 @@ var require_dist_node3 = __commonJS({ return newObj; }, {}); } - function isPlainObject3(value) { + function isPlainObject7(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -38830,21 +38830,21 @@ var require_dist_node3 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - function mergeDeep2(defaults, options) { + function mergeDeep4(defaults, options) { const result = Object.assign({}, defaults); Object.keys(options).forEach((key) => { - if (isPlainObject3(options[key])) { + if (isPlainObject7(options[key])) { if (!(key in defaults)) Object.assign(result, { [key]: options[key] }); else - result[key] = mergeDeep2(defaults[key], options[key]); + result[key] = mergeDeep4(defaults[key], options[key]); } else { Object.assign(result, { [key]: options[key] }); } }); return result; } - function removeUndefinedProperties2(obj) { + function removeUndefinedProperties4(obj) { for (const key in obj) { if (obj[key] === void 0) { delete obj[key]; @@ -38852,7 +38852,7 @@ var require_dist_node3 = __commonJS({ } return obj; } - function merge2(defaults, route, options) { + function merge4(defaults, route, options) { var _a; if (typeof route === "string") { let [method, url] = route.split(" "); @@ -38860,10 +38860,10 @@ var require_dist_node3 = __commonJS({ } else { options = Object.assign({}, route); } - options.headers = lowercaseKeys2(options.headers); - removeUndefinedProperties2(options); - removeUndefinedProperties2(options.headers); - const mergedOptions = mergeDeep2(defaults || {}, options); + options.headers = lowercaseKeys4(options.headers); + removeUndefinedProperties4(options); + removeUndefinedProperties4(options.headers); + const mergedOptions = mergeDeep4(defaults || {}, options); if (options.url === "/graphql") { if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( @@ -38874,7 +38874,7 @@ var require_dist_node3 = __commonJS({ } return mergedOptions; } - function addQueryParameters2(url, parameters) { + function addQueryParameters4(url, parameters) { const separator = /\?/.test(url) ? "&" : "?"; const names = Object.keys(parameters); if (names.length === 0) { @@ -38887,18 +38887,18 @@ var require_dist_node3 = __commonJS({ return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } - var urlVariableRegex2 = /\{[^}]+\}/g; - function removeNonChars2(variableName) { + var urlVariableRegex4 = /\{[^}]+\}/g; + function removeNonChars4(variableName) { return variableName.replace(/^\W+|\W+$/g, "").split(/,/); } - function extractUrlVariableNames2(url) { - const matches = url.match(urlVariableRegex2); + function extractUrlVariableNames4(url) { + const matches = url.match(urlVariableRegex4); if (!matches) { return []; } - return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); + return matches.map(removeNonChars4).reduce((a, b) => a.concat(b), []); } - function omit2(object, keysToOmit) { + function omit4(object, keysToOmit) { const result = { __proto__: null }; for (const key of Object.keys(object)) { if (keysToOmit.indexOf(key) === -1) { @@ -38907,7 +38907,7 @@ var require_dist_node3 = __commonJS({ } return result; } - function encodeReserved2(str) { + function encodeReserved4(str) { return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { if (!/%[0-9A-Fa-f]/.test(part)) { part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); @@ -38915,67 +38915,67 @@ var require_dist_node3 = __commonJS({ return part; }).join(""); } - function encodeUnreserved2(str) { + function encodeUnreserved4(str) { return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { return "%" + c.charCodeAt(0).toString(16).toUpperCase(); }); } - function encodeValue2(operator, value, key) { - value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + function encodeValue4(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved4(value) : encodeUnreserved4(value); if (key) { - return encodeUnreserved2(key) + "=" + value; + return encodeUnreserved4(key) + "=" + value; } else { return value; } } - function isDefined2(value) { + function isDefined4(value) { return value !== void 0 && value !== null; } - function isKeyOperator2(operator) { + function isKeyOperator4(operator) { return operator === ";" || operator === "&" || operator === "?"; } - function getValues2(context3, operator, key, modifier) { + function getValues4(context3, operator, key, modifier) { var value = context3[key], result = []; - if (isDefined2(value) && value !== "") { + if (isDefined4(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { value = value.substring(0, parseInt(modifier, 10)); } result.push( - encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value, isKeyOperator4(operator) ? key : "") ); } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { + value.filter(isDefined4).forEach(function(value2) { result.push( - encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value2, isKeyOperator4(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - result.push(encodeValue2(operator, value[k], k)); + if (isDefined4(value[k])) { + result.push(encodeValue4(operator, value[k], k)); } }); } } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { - tmp.push(encodeValue2(operator, value2)); + value.filter(isDefined4).forEach(function(value2) { + tmp.push(encodeValue4(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - tmp.push(encodeUnreserved2(k)); - tmp.push(encodeValue2(operator, value[k].toString())); + if (isDefined4(value[k])) { + tmp.push(encodeUnreserved4(k)); + tmp.push(encodeValue4(operator, value[k].toString())); } }); } - if (isKeyOperator2(operator)) { - result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + if (isKeyOperator4(operator)) { + result.push(encodeUnreserved4(key) + "=" + tmp.join(",")); } else if (tmp.length !== 0) { result.push(tmp.join(",")); } @@ -38983,23 +38983,23 @@ var require_dist_node3 = __commonJS({ } } else { if (operator === ";") { - if (isDefined2(value)) { - result.push(encodeUnreserved2(key)); + if (isDefined4(value)) { + result.push(encodeUnreserved4(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { - result.push(encodeUnreserved2(key) + "="); + result.push(encodeUnreserved4(key) + "="); } else if (value === "") { result.push(""); } } return result; } - function parseUrl2(template) { + function parseUrl4(template) { return { - expand: expand2.bind(null, template) + expand: expand4.bind(null, template) }; } - function expand2(template, context3) { + function expand4(template, context3) { var operators = ["+", "#", ".", "/", ";", "?", "&"]; template = template.replace( /\{([^\{\}]+)\}|([^\{\}]+)/g, @@ -39013,7 +39013,7 @@ var require_dist_node3 = __commonJS({ } expression.split(/,/g).forEach(function(variable) { var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); - values.push(getValues2(context3, operator, tmp[1], tmp[2] || tmp[3])); + values.push(getValues4(context3, operator, tmp[1], tmp[2] || tmp[3])); }); if (operator && operator !== "+") { var separator = ","; @@ -39027,7 +39027,7 @@ var require_dist_node3 = __commonJS({ return values.join(","); } } else { - return encodeReserved2(literal); + return encodeReserved4(literal); } } ); @@ -39037,13 +39037,13 @@ var require_dist_node3 = __commonJS({ return template.replace(/\/$/, ""); } } - function parse2(options) { + function parse4(options) { var _a; let method = options.method.toUpperCase(); let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); let headers = Object.assign({}, options.headers); let body; - let parameters = omit2(options, [ + let parameters = omit4(options, [ "method", "baseUrl", "url", @@ -39051,13 +39051,13 @@ var require_dist_node3 = __commonJS({ "request", "mediaType" ]); - const urlVariableNames = extractUrlVariableNames2(url); - url = parseUrl2(url).expand(parameters); + const urlVariableNames = extractUrlVariableNames4(url); + url = parseUrl4(url).expand(parameters); if (!/^http/.test(url)) { url = options.baseUrl + url; } const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); - const remainingParameters = omit2(parameters, omittedParameters); + const remainingParameters = omit4(parameters, omittedParameters); const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); if (!isBinaryRequest) { if (options.mediaType.format) { @@ -39079,7 +39079,7 @@ var require_dist_node3 = __commonJS({ } } if (["GET", "HEAD"].includes(method)) { - url = addQueryParameters2(url, remainingParameters); + url = addQueryParameters4(url, remainingParameters); } else { if ("data" in remainingParameters) { body = remainingParameters.data; @@ -39101,20 +39101,20 @@ var require_dist_node3 = __commonJS({ options.request ? { request: options.request } : null ); } - function endpointWithDefaults2(defaults, route, options) { - return parse2(merge2(defaults, route, options)); + function endpointWithDefaults4(defaults, route, options) { + return parse4(merge4(defaults, route, options)); } - function withDefaults4(oldDefaults, newDefaults) { - const DEFAULTS22 = merge2(oldDefaults, newDefaults); - const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + function withDefaults8(oldDefaults, newDefaults) { + const DEFAULTS22 = merge4(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults4.bind(null, DEFAULTS22); return Object.assign(endpoint22, { DEFAULTS: DEFAULTS22, - defaults: withDefaults4.bind(null, DEFAULTS22), - merge: merge2.bind(null, DEFAULTS22), - parse: parse2 + defaults: withDefaults8.bind(null, DEFAULTS22), + merge: merge4.bind(null, DEFAULTS22), + parse: parse4 }); } - var endpoint2 = withDefaults4(null, DEFAULTS2); + var endpoint4 = withDefaults8(null, DEFAULTS4); } }); @@ -39241,14 +39241,14 @@ var require_dist_node5 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - RequestError: () => RequestError2 + RequestError: () => RequestError4 }); module.exports = __toCommonJS(dist_src_exports); var import_deprecation = require_dist_node4(); var import_once = __toESM2(require_once()); var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation)); var logOnceHeaders = (0, import_once.default)((deprecation) => console.warn(deprecation)); - var RequestError2 = class extends Error { + var RequestError4 = class extends Error { constructor(message, statusCode, options) { super(message); if (Error.captureStackTrace) { @@ -39323,13 +39323,13 @@ var require_dist_node6 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - request: () => request2 + request: () => request4 }); module.exports = __toCommonJS(dist_src_exports); - var import_endpoint2 = require_dist_node3(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "8.4.0"; - function isPlainObject3(value) { + var import_endpoint4 = require_dist_node3(); + var import_universal_user_agent13 = require_dist_node(); + var VERSION17 = "8.4.0"; + function isPlainObject7(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -39340,15 +39340,15 @@ var require_dist_node6 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - var import_request_error3 = require_dist_node5(); + var import_request_error6 = require_dist_node5(); function getBufferResponse(response) { return response.arrayBuffer(); } - function fetchWrapper2(requestOptions) { + function fetchWrapper4(requestOptions) { var _a, _b, _c, _d; const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console; const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false; - if (isPlainObject3(requestOptions.body) || Array.isArray(requestOptions.body)) { + if (isPlainObject7(requestOptions.body) || Array.isArray(requestOptions.body)) { requestOptions.body = JSON.stringify(requestOptions.body); } let headers = {}; @@ -39390,7 +39390,7 @@ var require_dist_node6 = __commonJS({ if (status < 400) { return; } - throw new import_request_error3.RequestError(response.statusText, status, { + throw new import_request_error6.RequestError(response.statusText, status, { response: { url, status, @@ -39401,19 +39401,19 @@ var require_dist_node6 = __commonJS({ }); } if (status === 304) { - throw new import_request_error3.RequestError("Not modified", status, { + throw new import_request_error6.RequestError("Not modified", status, { response: { url, status, headers, - data: await getResponseData2(response) + data: await getResponseData4(response) }, request: requestOptions }); } if (status >= 400) { - const data = await getResponseData2(response); - const error2 = new import_request_error3.RequestError(toErrorMessage2(data), status, { + const data = await getResponseData4(response); + const error2 = new import_request_error6.RequestError(toErrorMessage4(data), status, { response: { url, status, @@ -39424,7 +39424,7 @@ var require_dist_node6 = __commonJS({ }); throw error2; } - return parseSuccessResponseBody ? await getResponseData2(response) : response.body; + return parseSuccessResponseBody ? await getResponseData4(response) : response.body; }).then((data) => { return { status, @@ -39433,7 +39433,7 @@ var require_dist_node6 = __commonJS({ data }; }).catch((error2) => { - if (error2 instanceof import_request_error3.RequestError) + if (error2 instanceof import_request_error6.RequestError) throw error2; else if (error2.name === "AbortError") throw error2; @@ -39445,12 +39445,12 @@ var require_dist_node6 = __commonJS({ message = error2.cause; } } - throw new import_request_error3.RequestError(message, 500, { + throw new import_request_error6.RequestError(message, 500, { request: requestOptions }); }); } - async function getResponseData2(response) { + async function getResponseData4(response) { const contentType = response.headers.get("content-type"); if (/application\/json/.test(contentType)) { return response.json().catch(() => response.text()).catch(() => ""); @@ -39460,7 +39460,7 @@ var require_dist_node6 = __commonJS({ } return getBufferResponse(response); } - function toErrorMessage2(data) { + function toErrorMessage4(data) { if (typeof data === "string") return data; let suffix; @@ -39477,32 +39477,32 @@ var require_dist_node6 = __commonJS({ } return `Unknown error: ${JSON.stringify(data)}`; } - function withDefaults4(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + function withDefaults8(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper2(endpoint2.parse(endpointOptions)); + return fetchWrapper4(endpoint22.parse(endpointOptions)); } const request22 = (route2, parameters2) => { - return fetchWrapper2( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + return fetchWrapper4( + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; Object.assign(request22, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); } - var request2 = withDefaults4(import_endpoint2.endpoint, { + var request4 = withDefaults8(import_endpoint4.endpoint, { headers: { - "user-agent": `octokit-request.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-request.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}` } }); } @@ -39537,8 +39537,8 @@ var require_dist_node7 = __commonJS({ }); module.exports = __toCommonJS(dist_src_exports); var import_request32 = require_dist_node6(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "7.1.0"; + var import_universal_user_agent13 = require_dist_node(); + var VERSION17 = "7.1.0"; var import_request22 = require_dist_node6(); var import_request15 = require_dist_node6(); function _buildMessageForResponseErrors2(data) { @@ -39546,9 +39546,9 @@ var require_dist_node7 = __commonJS({ ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError2 = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors2(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.name = "GraphqlResponseError"; @@ -39570,7 +39570,7 @@ var require_dist_node7 = __commonJS({ ]; var FORBIDDEN_VARIABLE_OPTIONS2 = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX2 = /\/api\/v3\/?$/; - function graphql3(request2, query, options) { + function graphql3(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -39601,11 +39601,11 @@ var require_dist_node7 = __commonJS({ result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX2.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX2, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -39620,25 +39620,25 @@ var require_dist_node7 = __commonJS({ return response.data.data; }); } - function withDefaults4(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); + function withDefaults8(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql3(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults4.bind(null, newRequest), + defaults: withDefaults8.bind(null, newRequest), endpoint: newRequest.endpoint }); } - var graphql22 = withDefaults4(import_request32.request, { + var graphql22 = withDefaults8(import_request32.request, { headers: { - "user-agent": `octokit-graphql.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-graphql.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}` }, method: "POST", url: "/graphql" }); function withCustomRequest2(customRequest) { - return withDefaults4(customRequest, { + return withDefaults8(customRequest, { method: "POST", url: "/graphql" }); @@ -39692,13 +39692,13 @@ var require_dist_node8 = __commonJS({ } return `token ${token}`; } - async function hook6(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( + async function hook6(token, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix2(token); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix2(token); + return request4(endpoint4); } var createTokenAuth3 = function createTokenAuth22(token) { if (!token) { @@ -39743,17 +39743,17 @@ var require_dist_node9 = __commonJS({ Octokit: () => Octokit3 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node(); + var import_universal_user_agent13 = require_dist_node(); var import_before_after_hook2 = require_before_after_hook(); var import_request15 = require_dist_node6(); var import_graphql2 = require_dist_node7(); var import_auth_token2 = require_dist_node8(); - var VERSION13 = "5.2.0"; + var VERSION17 = "5.2.0"; var noop2 = () => { }; var consoleWarn2 = console.warn.bind(console); var consoleError2 = console.error.bind(console); - var userAgentTrail2 = `octokit-core.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; + var userAgentTrail2 = `octokit-core.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}`; var _a; var Octokit3 = (_a = class { static defaults(defaults) { @@ -39856,7 +39856,7 @@ var require_dist_node9 = __commonJS({ } } }, (() => { - _a.VERSION = VERSION13; + _a.VERSION = VERSION17; })(), (() => { _a.plugins = []; })(), _a); @@ -39890,7 +39890,7 @@ var require_dist_node10 = __commonJS({ restEndpointMethods: () => restEndpointMethods2 }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "10.4.1"; + var VERSION17 = "10.4.1"; var Endpoints2 = { actions: { addCustomLabelsToSelfHostedRunnerForOrg: [ @@ -41882,8 +41882,8 @@ var require_dist_node10 = __commonJS({ var endpoints_default2 = Endpoints2; var endpointMethodsMap2 = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default2)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -42006,7 +42006,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - restEndpointMethods2.VERSION = VERSION13; + restEndpointMethods2.VERSION = VERSION17; function legacyRestEndpointMethods2(octokit) { const api = endpointsToMethods2(octokit); return { @@ -42014,7 +42014,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - legacyRestEndpointMethods2.VERSION = VERSION13; + legacyRestEndpointMethods2.VERSION = VERSION17; } }); @@ -42047,7 +42047,7 @@ var require_dist_node11 = __commonJS({ paginatingEndpoints: () => paginatingEndpoints }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "9.2.1"; + var VERSION17 = "9.2.1"; function normalizePaginatedListResponse2(response) { if (!response.data) { return { @@ -42393,7 +42393,7 @@ var require_dist_node11 = __commonJS({ }) }; } - paginateRest2.VERSION = VERSION13; + paginateRest2.VERSION = VERSION17; } }); @@ -42524,7 +42524,7 @@ var require_fast_content_type_parse = __commonJS({ var defaultContentType = { type: "", parameters: new NullObject() }; Object.freeze(defaultContentType.parameters); Object.freeze(defaultContentType); - function parse2(header) { + function parse4(header) { if (typeof header !== "string") { throw new TypeError("argument header is required and must be a string"); } @@ -42562,7 +42562,7 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - function safeParse2(header) { + function safeParse4(header) { if (typeof header !== "string") { return defaultContentType; } @@ -42600,9 +42600,9 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - module.exports.default = { parse: parse2, safeParse: safeParse2 }; - module.exports.parse = parse2; - module.exports.safeParse = safeParse2; + module.exports.default = { parse: parse4, safeParse: safeParse4 }; + module.exports.parse = parse4; + module.exports.safeParse = safeParse4; module.exports.defaultContentType = defaultContentType; } }); @@ -42819,9 +42819,9 @@ function addQueryParameters(url, parameters) { return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } -var urlVariableRegex = /\{[^}]+\}/g; +var urlVariableRegex = /\{[^{}}]+\}/g; function removeNonChars(variableName) { - return variableName.replace(/^\W+|\W+$/g, "").split(/,/); + return variableName.replace(/(?:^\W+)|(?:(? { const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; return `application/vnd.github.${preview}-preview${format}`; @@ -43037,12 +43037,12 @@ function endpointWithDefaults(defaults, route, options) { return parse(merge(defaults, route, options)); } function withDefaults(oldDefaults, newDefaults) { - const DEFAULTS2 = merge(oldDefaults, newDefaults); - const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2); - return Object.assign(endpoint2, { - DEFAULTS: DEFAULTS2, - defaults: withDefaults.bind(null, DEFAULTS2), - merge: merge.bind(null, DEFAULTS2), + const DEFAULTS22 = merge(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults.bind(null, DEFAULTS22), + merge: merge.bind(null, DEFAULTS22), parse }); } @@ -43071,7 +43071,7 @@ var RequestError = class extends Error { if (options.request.headers.authorization) { requestCopy.headers = Object.assign({}, options.request.headers, { authorization: options.request.headers.authorization.replace( - / .*$/, + /(?]+)>; rel="deprecation"/); + const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/); const deprecationLink = matches && matches.pop(); log.warn( `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` @@ -43234,40 +43234,570 @@ function toErrorMessage(data) { return `Unknown error: ${JSON.stringify(data)}`; } function withDefaults2(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper(endpoint2.parse(endpointOptions)); + return fetchWrapper(endpoint22.parse(endpointOptions)); } - const request2 = (route2, parameters2) => { + const request22 = (route2, parameters2) => { return fetchWrapper( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; - Object.assign(request2, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); - return endpointOptions.request.hook(request2, endpointOptions); + return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); } var request = withDefaults2(endpoint, defaults_default); // var VERSION3 = "0.0.0-development"; +var userAgent2 = `octokit-endpoint.js/${VERSION3} ${getUserAgent()}`; +var DEFAULTS2 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent2 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys2(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject3(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep2(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject3(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep2(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties2(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge2(defaults, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys2(options.headers); + removeUndefinedProperties2(options); + removeUndefinedProperties2(options.headers); + const mergedOptions = mergeDeep2(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters2(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex2 = /\{[^}]+\}/g; +function removeNonChars2(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames2(url) { + const matches = url.match(urlVariableRegex2); + if (!matches) { + return []; + } + return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); +} +function omit2(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved2(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved2(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue2(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + if (key) { + return encodeUnreserved2(key) + "=" + value; + } else { + return value; + } +} +function isDefined2(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator2(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues2(context3, operator, key, modifier) { + var value = context3[key], result = []; + if (isDefined2(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + result.push( + encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + result.push(encodeValue2(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + tmp.push(encodeValue2(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + tmp.push(encodeUnreserved2(k)); + tmp.push(encodeValue2(operator, value[k].toString())); + } + }); + } + if (isKeyOperator2(operator)) { + result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined2(value)) { + result.push(encodeUnreserved2(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved2(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl2(template) { + return { + expand: expand2.bind(null, template) + }; +} +function expand2(template, context3) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues2(context3, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved2(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse2(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit2(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames2(url); + url = parseUrl2(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit2(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters2(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults2(defaults, route, options) { + return parse2(merge2(defaults, route, options)); +} +function withDefaults3(oldDefaults, newDefaults) { + const DEFAULTS22 = merge2(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults3.bind(null, DEFAULTS22), + merge: merge2.bind(null, DEFAULTS22), + parse: parse2 + }); +} +var endpoint2 = withDefaults3(null, DEFAULTS2); + +// +var import_fast_content_type_parse2 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError2 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION4 = "0.0.0-development"; +var defaults_default2 = { + headers: { + "user-agent": `octokit-request.js/${VERSION4} ${getUserAgent()}` + } +}; +function isPlainObject4(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper2(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch2 = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject4(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error2) { + let message = "Unknown Error"; + if (error2 instanceof Error) { + if (error2.name === "AbortError") { + error2.status = 500; + throw error2; + } + message = error2.message; + if (error2.name === "TypeError" && "cause" in error2) { + if (error2.cause instanceof Error) { + message = error2.cause.message; + } else if (typeof error2.cause === "string") { + message = error2.cause; + } + } + } + const requestError = new RequestError2(message, 500, { + request: requestOptions + }); + requestError.cause = error2; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError2(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2(toErrorMessage2(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData2(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData2(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse2.safeParse)(contentType); + if (isJSONResponse2(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse2(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage2(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults4(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper2(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper2( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); +} +var request2 = withDefaults4(endpoint2, defaults_default2); + +// +var VERSION5 = "0.0.0-development"; function _buildMessageForResponseErrors(data) { return `Request failed due to following response errors: ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.errors = response.errors; @@ -43292,7 +43822,7 @@ var NON_VARIABLE_OPTIONS = [ ]; var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; -function graphql(request2, query, options) { +function graphql(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -43323,11 +43853,11 @@ function graphql(request2, query, options) { result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -43342,25 +43872,25 @@ function graphql(request2, query, options) { return response.data.data; }); } -function withDefaults3(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); +function withDefaults5(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults3.bind(null, newRequest), + defaults: withDefaults5.bind(null, newRequest), endpoint: newRequest.endpoint }); } -var graphql2 = withDefaults3(request, { +var graphql2 = withDefaults5(request2, { headers: { - "user-agent": `octokit-graphql.js/${VERSION3} ${getUserAgent()}` + "user-agent": `octokit-graphql.js/${VERSION5} ${getUserAgent()}` }, method: "POST", url: "/graphql" }); function withCustomRequest(customRequest) { - return withDefaults3(customRequest, { + return withDefaults5(customRequest, { method: "POST", url: "/graphql" }); @@ -43388,13 +43918,13 @@ function withAuthorizationPrefix(token) { } return `token ${token}`; } -async function hook(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( +async function hook(token, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix(token); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix(token); + return request4(endpoint4); } var createTokenAuth = function createTokenAuth2(token) { if (!token) { @@ -43412,14 +43942,14 @@ var createTokenAuth = function createTokenAuth2(token) { }; // -var VERSION4 = "6.1.3"; +var VERSION6 = "6.1.4"; // var noop = () => { }; var consoleWarn = console.warn.bind(console); var consoleError = console.error.bind(console); -var userAgentTrail = `octokit-core.js/${VERSION4} ${getUserAgent()}`; +var userAgentTrail = `octokit-core.js/${VERSION6} ${getUserAgent()}`; var Octokit = class { static defaults(defaults) { const OctokitWithDefaults = class extends this { @@ -43524,20 +44054,20 @@ var Octokit = class { hook; auth; }; -__publicField(Octokit, "VERSION", VERSION4); +__publicField(Octokit, "VERSION", VERSION6); __publicField(Octokit, "plugins", []); // -var VERSION5 = "5.3.1"; +var VERSION7 = "5.3.1"; // function requestLog(octokit) { - octokit.hook.wrap("request", (request2, options) => { + octokit.hook.wrap("request", (request4, options) => { octokit.log.debug("request", options); const start = Date.now(); const requestOptions = octokit.request.endpoint.parse(options); const path = requestOptions.url.replace(options.baseUrl, ""); - return request2(options).then((response) => { + return request4(options).then((response) => { const requestId = response.headers["x-github-request-id"]; octokit.log.info( `${requestOptions.method} ${path} - ${response.status} with id ${requestId} in ${Date.now() - start}ms` @@ -43553,10 +44083,10 @@ function requestLog(octokit) { }); }); } -requestLog.VERSION = VERSION5; +requestLog.VERSION = VERSION7; // -var VERSION6 = "0.0.0-development"; +var VERSION8 = "0.0.0-development"; function normalizePaginatedListResponse(response) { if (!response.data) { return { @@ -43600,7 +44130,7 @@ function iterator(octokit, route, parameters) { const response = await requestMethod({ method, url, headers }); const normalizedResponse = normalizePaginatedListResponse(response); url = ((normalizedResponse.headers.link || "").match( - /<([^>]+)>;\s*rel="next"/ + /<([^<>]+)>;\s*rel="next"/ ) || [])[1]; return { value: normalizedResponse }; } catch (error2) { @@ -43659,10 +44189,10 @@ function paginateRest(octokit) { }) }; } -paginateRest.VERSION = VERSION6; +paginateRest.VERSION = VERSION8; // -var VERSION7 = "13.3.1"; +var VERSION9 = "13.3.1"; // var Endpoints = { @@ -45735,8 +46265,8 @@ var endpoints_default = Endpoints; // var endpointMethodsMap = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -45861,7 +46391,7 @@ function restEndpointMethods(octokit) { rest: api }; } -restEndpointMethods.VERSION = VERSION7; +restEndpointMethods.VERSION = VERSION9; function legacyRestEndpointMethods(octokit) { const api = endpointsToMethods(octokit); return { @@ -45869,15 +46399,15 @@ function legacyRestEndpointMethods(octokit) { rest: api }; } -legacyRestEndpointMethods.VERSION = VERSION7; +legacyRestEndpointMethods.VERSION = VERSION9; // -var VERSION8 = "21.1.0"; +var VERSION10 = "21.1.1"; // var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRest).defaults( { - userAgent: `octokit-rest.js/${VERSION8}` + userAgent: `octokit-rest.js/${VERSION10}` } ); @@ -45885,25 +46415,25 @@ var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRes var import_core2 = __toESM(require_core()); // -function requestToOAuthBaseUrl(request2) { - const endpointDefaults = request2.endpoint.DEFAULTS; +function requestToOAuthBaseUrl(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); } -async function oauthRequest(request2, route, parameters) { +async function oauthRequest(request4, route, parameters) { const withOAuthParameters = { - baseUrl: requestToOAuthBaseUrl(request2), + baseUrl: requestToOAuthBaseUrl(request4), headers: { accept: "application/json" }, ...parameters }; - const response = await request2(route, withOAuthParameters); + const response = await request4(route, withOAuthParameters); if ("error" in response.data) { const error2 = new RequestError( `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, 400, { - request: request2.endpoint.merge( + request: request4.endpoint.merge( route, withOAuthParameters ) @@ -45914,32 +46444,43 @@ async function oauthRequest(request2, route, parameters) { } return response; } -async function exchangeWebFlowCode(options) { - const request2 = options.request || request; +async function createDeviceCode(options) { + const request4 = options.request || request; + const parameters = { + client_id: options.clientId + }; + if ("scopes" in options && Array.isArray(options.scopes)) { + parameters.scope = options.scopes.join(" "); + } + return oauthRequest(request4, "POST /login/device/code", parameters); +} +async function exchangeDeviceCode(options) { + const request4 = options.request || request; const response = await oauthRequest( - request2, + request4, "POST /login/oauth/access_token", { client_id: options.clientId, - client_secret: options.clientSecret, - code: options.code, - redirect_uri: options.redirectUrl + device_code: options.code, + grant_type: "urn:ietf:params:oauth:grant-type:device_code" } ); const authentication = { clientType: options.clientType, clientId: options.clientId, - clientSecret: options.clientSecret, token: response.data.access_token, scopes: response.data.scope.split(/\s+/).filter(Boolean) }; + if ("clientSecret" in options) { + authentication.clientSecret = options.clientSecret; + } if (options.clientType === "github-app") { if ("refresh_token" in response.data) { const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp( + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( apiTimeInMs, response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp( + ), authentication.refreshTokenExpiresAt = toTimestamp2( apiTimeInMs, response.data.refresh_token_expires_in ); @@ -45948,46 +46489,722 @@ async function exchangeWebFlowCode(options) { } return { ...response, authentication }; } -function toTimestamp(apiTimeInMs, expirationInSeconds) { +function toTimestamp2(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } -async function createDeviceCode(options) { - const request2 = options.request || request; - const parameters = { - client_id: options.clientId + +// +async function getOAuthAccessToken(state, options) { + const cachedAuthentication = getCachedAuthentication(state, options.auth); + if (cachedAuthentication) + return cachedAuthentication; + const { data: verification } = await createDeviceCode({ + clientType: state.clientType, + clientId: state.clientId, + request: options.request || state.request, + scopes: options.auth.scopes || state.scopes + }); + await state.onVerification(verification); + const authentication = await waitForAccessToken( + options.request || state.request, + state.clientId, + state.clientType, + verification + ); + state.authentication = authentication; + return authentication; +} +function getCachedAuthentication(state, auth22) { + if (auth22.refresh === true) + return false; + if (!state.authentication) + return false; + if (state.clientType === "github-app") { + return state.authentication; + } + const authentication = state.authentication; + const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( + " " + ); + const currentScope = authentication.scopes.join(" "); + return newScope === currentScope ? authentication : false; +} +async function wait(seconds) { + await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); +} +async function waitForAccessToken(request4, clientId, clientType, verification) { + try { + const options = { + clientId, + request: request4, + code: verification.device_code + }; + const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ + ...options, + clientType: "oauth-app" + }) : await exchangeDeviceCode({ + ...options, + clientType: "github-app" + }); + return { + type: "token", + tokenType: "oauth", + ...authentication + }; + } catch (error2) { + if (!error2.response) + throw error2; + const errorType = error2.response.data.error; + if (errorType === "authorization_pending") { + await wait(verification.interval); + return waitForAccessToken(request4, clientId, clientType, verification); + } + if (errorType === "slow_down") { + await wait(verification.interval + 5); + return waitForAccessToken(request4, clientId, clientType, verification); + } + throw error2; + } +} +async function auth2(state, authOptions) { + return getOAuthAccessToken(state, { + auth: authOptions + }); +} +async function hook2(state, request4, route, parameters) { + let endpoint4 = request4.endpoint.merge( + route, + parameters + ); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); + } + const { token } = await getOAuthAccessToken(state, { + request: request4, + auth: { type: "oauth" } + }); + endpoint4.headers.authorization = `token ${token}`; + return request4(endpoint4); +} +var VERSION11 = "0.0.0-development"; +function createOAuthDeviceAuth(options) { + const requestWithDefaults = options.request || request.defaults({ + headers: { + "user-agent": `octokit-auth-oauth-device.js/${VERSION11} ${getUserAgent()}` + } + }); + const { request: request4 = requestWithDefaults, ...otherOptions } = options; + const state = options.clientType === "github-app" ? { + ...otherOptions, + clientType: "github-app", + request: request4 + } : { + ...otherOptions, + clientType: "oauth-app", + request: request4, + scopes: options.scopes || [] }; - if ("scopes" in options && Array.isArray(options.scopes)) { - parameters.scope = options.scopes.join(" "); + if (!options.clientId) { + throw new Error( + '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' + ); + } + if (!options.onVerification) { + throw new Error( + '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' + ); } - return oauthRequest(request2, "POST /login/device/code", parameters); + return Object.assign(auth2.bind(null, state), { + hook: hook2.bind(null, state) + }); } -async function exchangeDeviceCode(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + +// +var VERSION12 = "0.0.0-development"; +var userAgent3 = `octokit-endpoint.js/${VERSION12} ${getUserAgent()}`; +var DEFAULTS3 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent3 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys3(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject5(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep3(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject5(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep3(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties3(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge3(defaults, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys3(options.headers); + removeUndefinedProperties3(options); + removeUndefinedProperties3(options.headers); + const mergedOptions = mergeDeep3(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters3(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex3 = /\{[^}]+\}/g; +function removeNonChars3(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames3(url) { + const matches = url.match(urlVariableRegex3); + if (!matches) { + return []; + } + return matches.map(removeNonChars3).reduce((a, b) => a.concat(b), []); +} +function omit3(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved3(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved3(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue3(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved3(value) : encodeUnreserved3(value); + if (key) { + return encodeUnreserved3(key) + "=" + value; + } else { + return value; + } +} +function isDefined3(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator3(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues3(context3, operator, key, modifier) { + var value = context3[key], result = []; + if (isDefined3(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue3(operator, value, isKeyOperator3(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + result.push( + encodeValue3(operator, value2, isKeyOperator3(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + result.push(encodeValue3(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + tmp.push(encodeValue3(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + tmp.push(encodeUnreserved3(k)); + tmp.push(encodeValue3(operator, value[k].toString())); + } + }); + } + if (isKeyOperator3(operator)) { + result.push(encodeUnreserved3(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined3(value)) { + result.push(encodeUnreserved3(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved3(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl3(template) { + return { + expand: expand3.bind(null, template) + }; +} +function expand3(template, context3) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues3(context3, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved3(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse3(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit3(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames3(url); + url = parseUrl3(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit3(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters3(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults3(defaults, route, options) { + return parse3(merge3(defaults, route, options)); +} +function withDefaults6(oldDefaults, newDefaults) { + const DEFAULTS22 = merge3(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults3.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults6.bind(null, DEFAULTS22), + merge: merge3.bind(null, DEFAULTS22), + parse: parse3 + }); +} +var endpoint3 = withDefaults6(null, DEFAULTS3); + +// +var import_fast_content_type_parse3 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError3 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION13 = "0.0.0-development"; +var defaults_default3 = { + headers: { + "user-agent": `octokit-request.js/${VERSION13} ${getUserAgent()}` + } +}; +function isPlainObject6(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper3(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch2 = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject6(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error2) { + let message = "Unknown Error"; + if (error2 instanceof Error) { + if (error2.name === "AbortError") { + error2.status = 500; + throw error2; + } + message = error2.message; + if (error2.name === "TypeError" && "cause" in error2) { + if (error2.cause instanceof Error) { + message = error2.cause.message; + } else if (typeof error2.cause === "string") { + message = error2.cause; + } + } + } + const requestError = new RequestError3(message, 500, { + request: requestOptions + }); + requestError.cause = error2; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError3(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3(toErrorMessage3(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData3(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData3(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse3.safeParse)(contentType); + if (isJSONResponse3(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse3(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage3(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults7(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper3(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper3( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults7.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults7.bind(null, endpoint22) + }); +} +var request3 = withDefaults7(endpoint3, defaults_default3); + +// +function requestToOAuthBaseUrl2(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; + return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); +} +async function oauthRequest2(request4, route, parameters) { + const withOAuthParameters = { + baseUrl: requestToOAuthBaseUrl2(request4), + headers: { + accept: "application/json" + }, + ...parameters + }; + const response = await request4(route, withOAuthParameters); + if ("error" in response.data) { + const error2 = new RequestError3( + `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, + 400, + { + request: request4.endpoint.merge( + route, + withOAuthParameters + ) + } + ); + error2.response = response; + throw error2; + } + return response; +} +async function exchangeWebFlowCode(options) { + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, - device_code: options.code, - grant_type: "urn:ietf:params:oauth:grant-type:device_code" + client_secret: options.clientSecret, + code: options.code, + redirect_uri: options.redirectUrl } ); const authentication = { clientType: options.clientType, clientId: options.clientId, + clientSecret: options.clientSecret, token: response.data.access_token, scopes: response.data.scope.split(/\s+/).filter(Boolean) }; - if ("clientSecret" in options) { - authentication.clientSecret = options.clientSecret; - } if (options.clientType === "github-app") { if ("refresh_token" in response.data) { const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp( apiTimeInMs, response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp2( + ), authentication.refreshTokenExpiresAt = toTimestamp( apiTimeInMs, response.data.refresh_token_expires_in ); @@ -45996,12 +47213,12 @@ async function exchangeDeviceCode(options) { } return { ...response, authentication }; } -function toTimestamp2(apiTimeInMs, expirationInSeconds) { +function toTimestamp(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function checkToken(options) { - const request2 = options.request || request; - const response = await request2("POST /applications/{client_id}/token", { + const request4 = options.request || request3; + const response = await request4("POST /applications/{client_id}/token", { headers: { authorization: `basic ${btoa( `${options.clientId}:${options.clientSecret}` @@ -46025,9 +47242,9 @@ async function checkToken(options) { return { ...response, authentication }; } async function refreshToken(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, @@ -46055,9 +47272,9 @@ function toTimestamp3(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function resetToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - const response = await request2( + const response = await request4( "PATCH /applications/{client_id}/token", { headers: { @@ -46082,9 +47299,9 @@ async function resetToken(options) { return { ...response, authentication }; } async function deleteToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/token", { headers: { @@ -46096,9 +47313,9 @@ async function deleteToken(options) { ); } async function deleteAuthorization(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/grant", { headers: { @@ -46111,133 +47328,7 @@ async function deleteAuthorization(options) { } // -async function getOAuthAccessToken(state, options) { - const cachedAuthentication = getCachedAuthentication(state, options.auth); - if (cachedAuthentication) - return cachedAuthentication; - const { data: verification } = await createDeviceCode({ - clientType: state.clientType, - clientId: state.clientId, - request: options.request || state.request, - scopes: options.auth.scopes || state.scopes - }); - await state.onVerification(verification); - const authentication = await waitForAccessToken( - options.request || state.request, - state.clientId, - state.clientType, - verification - ); - state.authentication = authentication; - return authentication; -} -function getCachedAuthentication(state, auth22) { - if (auth22.refresh === true) - return false; - if (!state.authentication) - return false; - if (state.clientType === "github-app") { - return state.authentication; - } - const authentication = state.authentication; - const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( - " " - ); - const currentScope = authentication.scopes.join(" "); - return newScope === currentScope ? authentication : false; -} -async function wait(seconds) { - await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); -} -async function waitForAccessToken(request2, clientId, clientType, verification) { - try { - const options = { - clientId, - request: request2, - code: verification.device_code - }; - const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ - ...options, - clientType: "oauth-app" - }) : await exchangeDeviceCode({ - ...options, - clientType: "github-app" - }); - return { - type: "token", - tokenType: "oauth", - ...authentication - }; - } catch (error2) { - if (!error2.response) - throw error2; - const errorType = error2.response.data.error; - if (errorType === "authorization_pending") { - await wait(verification.interval); - return waitForAccessToken(request2, clientId, clientType, verification); - } - if (errorType === "slow_down") { - await wait(verification.interval + 5); - return waitForAccessToken(request2, clientId, clientType, verification); - } - throw error2; - } -} -async function auth2(state, authOptions) { - return getOAuthAccessToken(state, { - auth: authOptions - }); -} -async function hook2(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( - route, - parameters - ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); - } - const { token } = await getOAuthAccessToken(state, { - request: request2, - auth: { type: "oauth" } - }); - endpoint2.headers.authorization = `token ${token}`; - return request2(endpoint2); -} -var VERSION9 = "0.0.0-development"; -function createOAuthDeviceAuth(options) { - const requestWithDefaults = options.request || request.defaults({ - headers: { - "user-agent": `octokit-auth-oauth-device.js/${VERSION9} ${getUserAgent()}` - } - }); - const { request: request2 = requestWithDefaults, ...otherOptions } = options; - const state = options.clientType === "github-app" ? { - ...otherOptions, - clientType: "github-app", - request: request2 - } : { - ...otherOptions, - clientType: "oauth-app", - request: request2, - scopes: options.scopes || [] - }; - if (!options.clientId) { - throw new Error( - '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - if (!options.onVerification) { - throw new Error( - '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - return Object.assign(auth2.bind(null, state), { - hook: hook2.bind(null, state) - }); -} - -// -var VERSION10 = "0.0.0-development"; +var VERSION14 = "0.0.0-development"; async function getAuthentication(state) { if ("code" in state.strategyOptions) { const { authentication } = await exchangeWebFlowCode({ @@ -46373,30 +47464,30 @@ var ROUTES_REQUIRING_BASIC_AUTH = /\/applications\/[^/]+\/(token|grant)s?/; function requiresBasicAuth(url) { return url && ROUTES_REQUIRING_BASIC_AUTH.test(url); } -async function hook3(state, request2, route, parameters = {}) { - const endpoint2 = request2.endpoint.merge( +async function hook3(state, request4, route, parameters = {}) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); } - if (requiresBasicAuth(endpoint2.url)) { + if (requiresBasicAuth(endpoint4.url)) { const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; - return request2(endpoint2); + endpoint4.headers.authorization = `basic ${credentials}`; + return request4(endpoint4); } - const { token } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request2 }) : await auth3({ ...state, request: request2 }); - endpoint2.headers.authorization = "token " + token; - return request2(endpoint2); + const { token } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request4 }) : await auth3({ ...state, request: request4 }); + endpoint4.headers.authorization = "token " + token; + return request4(endpoint4); } function createOAuthUserAuth({ clientId, clientSecret, clientType = "oauth-app", - request: request2 = request.defaults({ + request: request4 = request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION10} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION14} ${getUserAgent()}` } }), onTokenCreated, @@ -46408,13 +47499,13 @@ function createOAuthUserAuth({ clientSecret, onTokenCreated, strategyOptions, - request: request2 + request: request4 }); return Object.assign(auth3.bind(null, state), { hook: hook3.bind(null, state) }); } -createOAuthUserAuth.VERSION = VERSION10; +createOAuthUserAuth.VERSION = VERSION14; // async function auth4(state, authOptions) { @@ -46453,37 +47544,37 @@ async function auth4(state, authOptions) { }); return userAuth(); } -async function hook4(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( +async function hook4(state, request22, route, parameters) { + let endpoint4 = request22.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request22(endpoint4); } - if (state.clientType === "github-app" && !requiresBasicAuth(endpoint2.url)) { + if (state.clientType === "github-app" && !requiresBasicAuth(endpoint4.url)) { throw new Error( - `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint2.method} ${endpoint2.url}" is not supported.` + `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint4.method} ${endpoint4.url}" is not supported.` ); } const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; + endpoint4.headers.authorization = `basic ${credentials}`; try { - return await request2(endpoint2); + return await request22(endpoint4); } catch (error2) { if (error2.status !== 401) throw error2; - error2.message = `[@octokit/auth-oauth-app] "${endpoint2.method} ${endpoint2.url}" does not support clientId/clientSecret basic authentication.`; + error2.message = `[@octokit/auth-oauth-app] "${endpoint4.method} ${endpoint4.url}" does not support clientId/clientSecret basic authentication.`; throw error2; } } -var VERSION11 = "0.0.0-development"; +var VERSION15 = "0.0.0-development"; function createOAuthAppAuth(options) { const state = Object.assign( { request: request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION11} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION15} ${getUserAgent()}` } }), clientType: "oauth-app" @@ -46927,7 +48018,7 @@ async function getInstallationAuthentication(state, options, customRequest) { } } const appAuthentication = await getAppAuthentication(state); - const request2 = customRequest || state.request; + const request4 = customRequest || state.request; const payload = { installation_id: installationId, mediaType: { @@ -46957,7 +48048,7 @@ async function getInstallationAuthentication(state, options, customRequest) { repository_selection: repositorySelectionOptional, single_file: singleFileName } - } = await request2( + } = await request4( "POST /app/installations/{installation_id}/access_tokens", payload ); @@ -47054,18 +48145,18 @@ function isNotTimeSkewError(error2) { /'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/ )); } -async function hook5(state, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge(route, parameters); - const url = endpoint2.url; +async function hook5(state, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge(route, parameters); + const url = endpoint4.url; if (/\/login\/oauth\/access_token$/.test(url)) { - return request2(endpoint2); + return request4(endpoint4); } - if (requiresAppAuth(url.replace(request2.endpoint.DEFAULTS.baseUrl, ""))) { + if (requiresAppAuth(url.replace(request4.endpoint.DEFAULTS.baseUrl, ""))) { const { token: token2 } = await getAppAuthentication(state); - endpoint2.headers.authorization = `bearer ${token2}`; + endpoint4.headers.authorization = `bearer ${token2}`; let response; try { - response = await request2(endpoint2); + response = await request4(endpoint4); } catch (error2) { if (isNotTimeSkewError(error2)) { throw error2; @@ -47084,33 +48175,33 @@ async function hook5(state, request2, route, parameters) { ...state, timeDifference: diff }); - endpoint2.headers.authorization = `bearer ${token3}`; - return request2(endpoint2); + endpoint4.headers.authorization = `bearer ${token3}`; + return request4(endpoint4); } return response; } if (requiresBasicAuth(url)) { const authentication = await state.oauthApp({ type: "oauth-app" }); - endpoint2.headers.authorization = authentication.headers.authorization; - return request2(endpoint2); + endpoint4.headers.authorization = authentication.headers.authorization; + return request4(endpoint4); } const { token, createdAt } = await getInstallationAuthentication( state, {}, - request2.defaults({ baseUrl: endpoint2.baseUrl }) + request4.defaults({ baseUrl: endpoint4.baseUrl }) ); - endpoint2.headers.authorization = `token ${token}`; + endpoint4.headers.authorization = `token ${token}`; return sendRequestWithRetries( state, - request2, - endpoint2, + request4, + endpoint4, createdAt ); } -async function sendRequestWithRetries(state, request2, options, createdAt, retries = 0) { +async function sendRequestWithRetries(state, request4, options, createdAt, retries = 0) { const timeSinceTokenCreationInMs = +/* @__PURE__ */ new Date() - +new Date(createdAt); try { - return await request2(options); + return await request4(options); } catch (error2) { if (error2.status !== 401) { throw error2; @@ -47127,10 +48218,10 @@ async function sendRequestWithRetries(state, request2, options, createdAt, retri `[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${retries}, wait: ${awaitTime / 1e3}s)` ); await new Promise((resolve) => setTimeout(resolve, awaitTime)); - return sendRequestWithRetries(state, request2, options, createdAt, retries); + return sendRequestWithRetries(state, request4, options, createdAt, retries); } } -var VERSION12 = "7.1.4"; +var VERSION16 = "7.1.5"; function createAppAuth(options) { if (!options.appId) { throw new Error("[@octokit/auth-app] appId option is required"); @@ -47149,14 +48240,14 @@ function createAppAuth(options) { }, options.log ); - const request2 = options.request || request.defaults({ + const request4 = options.request || request.defaults({ headers: { - "user-agent": `octokit-auth-app.js/${VERSION12} ${getUserAgent()}` + "user-agent": `octokit-auth-app.js/${VERSION16} ${getUserAgent()}` } }); const state = Object.assign( { - request: request2, + request: request4, cache: getCache() }, options, @@ -47167,7 +48258,7 @@ function createAppAuth(options) { clientType: "github-app", clientId: options.clientId || "", clientSecret: options.clientSecret || "", - request: request2 + request: request4 }) } ); diff --git a/github-actions/branch-manager/main.js b/github-actions/branch-manager/main.js index 0faceabee..b23716087 100644 --- a/github-actions/branch-manager/main.js +++ b/github-actions/branch-manager/main.js @@ -3699,11 +3699,11 @@ var require_util2 = __commonJS({ } return location; } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -3769,7 +3769,7 @@ var require_util2 = __commonJS({ } return true; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const { headersList } = actualResponse; const policyHeader = (headersList.get("referrer-policy") ?? "").split(","); let policy = ""; @@ -3783,7 +3783,7 @@ var require_util2 = __commonJS({ } } if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -3800,33 +3800,33 @@ var require_util2 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; - if (request2.responseTainting === "cors" || request2.mode === "websocket") { + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; + if (request4.responseTainting === "cors" || request4.mode === "websocket") { if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } } } @@ -3858,26 +3858,26 @@ var require_util2 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (request2.referrer instanceof URL) { - referrerSource = request2.referrer; + } else if (request4.referrer instanceof URL) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); if (referrerURL.toString().length > 4096) { referrerURL = referrerOrigin; } - const areSameOrigin = sameOrigin(request2, referrerURL); - const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request2.url); + const areSameOrigin = sameOrigin(request4, referrerURL); + const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request4.url); switch (policy) { case "origin": return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true); @@ -3888,7 +3888,7 @@ var require_util2 = __commonJS({ case "origin-when-cross-origin": return areSameOrigin ? referrerURL : referrerOrigin; case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -4037,7 +4037,7 @@ var require_util2 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -5923,25 +5923,25 @@ var require_request = __commonJS({ static [kHTTP2BuildRequest](origin, opts, handler2) { const headers = opts.headers; opts = { ...opts, headers: null }; - const request2 = new Request(origin, opts, handler2); - request2.headers = {}; + const request4 = new Request(origin, opts, handler2); + request4.headers = {}; if (Array.isArray(headers)) { if (headers.length % 2 !== 0) { throw new InvalidArgumentError("headers array must be even"); } for (let i = 0; i < headers.length; i += 2) { - processHeader(request2, headers[i], headers[i + 1], true); + processHeader(request4, headers[i], headers[i + 1], true); } } else if (headers && typeof headers === "object") { const keys = Object.keys(headers); for (let i = 0; i < keys.length; i++) { const key = keys[i]; - processHeader(request2, key, headers[key], true); + processHeader(request4, key, headers[key], true); } } else if (headers != null) { throw new InvalidArgumentError("headers must be an object or an array"); } - return request2; + return request4; } static [kHTTP2CopyHeaders](raw) { const rawHeaders = raw.split("\r\n"); @@ -5969,28 +5969,28 @@ var require_request = __commonJS({ return skipAppend ? val : `${key}: ${val}\r `; } - function processHeader(request2, key, val, skipAppend = false) { + function processHeader(request4, key, val, skipAppend = false) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { return; } - if (request2.host === null && key.length === 4 && key.toLowerCase() === "host") { + if (request4.host === null && key.length === 4 && key.toLowerCase() === "host") { if (headerCharRegex.exec(val) !== null) { throw new InvalidArgumentError(`invalid ${key} header`); } - request2.host = val; - } else if (request2.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { - request2.contentType = val; + } else if (request4.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { + request4.contentType = val; if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } else if (key.length === 17 && key.toLowerCase() === "transfer-encoding") { throw new InvalidArgumentError("invalid transfer-encoding header"); } else if (key.length === 10 && key.toLowerCase() === "connection") { @@ -5998,7 +5998,7 @@ var require_request = __commonJS({ if (value !== "close" && value !== "keep-alive") { throw new InvalidArgumentError("invalid connection header"); } else if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (key.length === 10 && key.toLowerCase() === "keep-alive") { throw new InvalidArgumentError("invalid keep-alive header"); @@ -6012,19 +6012,19 @@ var require_request = __commonJS({ if (Array.isArray(val)) { for (let i = 0; i < val.length; i++) { if (skipAppend) { - if (request2.headers[key]) - request2.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; + if (request4.headers[key]) + request4.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; else - request2.headers[key] = processHeaderValue(key, val[i], skipAppend); + request4.headers[key] = processHeaderValue(key, val[i], skipAppend); } else { - request2.headers += processHeaderValue(key, val[i]); + request4.headers += processHeaderValue(key, val[i]); } } } else { if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } } } @@ -7168,10 +7168,10 @@ var require_client = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); - this[kQueue].push(request2); + const request4 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; process.nextTick(resume, this); } else { @@ -7195,8 +7195,8 @@ var require_client = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -7244,13 +7244,13 @@ var require_client = __commonJS({ assert(this[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } } else if (client[kRunning] > 0) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7456,8 +7456,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } } @@ -7497,12 +7497,12 @@ var require_client = __commonJS({ onUpgrade(head) { const { upgrade, client, socket, headers, statusCode } = this; assert(upgrade); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(!socket.destroyed); assert(socket === client[kSocket]); assert(!this.paused); - assert(request2.upgrade || request2.method === "CONNECT"); + assert(request4.upgrade || request4.method === "CONNECT"); this.statusCode = null; this.statusText = ""; this.shouldKeepAlive = null; @@ -7519,7 +7519,7 @@ var require_client = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -7530,8 +7530,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert(!this.upgrade); @@ -7540,22 +7540,22 @@ var require_client = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert.strictEqual(this.timeoutType, TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -7586,11 +7586,11 @@ var require_client = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -7607,8 +7607,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert.strictEqual(this.timeoutType, TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -7621,7 +7621,7 @@ var require_client = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } } @@ -7633,8 +7633,8 @@ var require_client = __commonJS({ if (upgrade) { return; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(statusCode >= 100); this.statusCode = null; this.statusText = ""; @@ -7648,11 +7648,11 @@ var require_client = __commonJS({ if (statusCode < 200) { return; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert.strictEqual(client[kRunning], 0); @@ -7710,8 +7710,8 @@ var require_client = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } assert(client[kSize] === 0); } @@ -7741,13 +7741,13 @@ var require_client = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7880,8 +7880,8 @@ var require_client = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + errorRequest(client, request4, err); } } else { onError(client, err); @@ -7935,8 +7935,8 @@ var require_client = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request3 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request3.headersTimeout != null ? request3.headersTimeout : client[kHeadersTimeout]; + const request5 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request5.headersTimeout != null ? request5.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -7958,13 +7958,13 @@ var require_client = __commonJS({ if (client[kRunning] >= (client[kPipelining] || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; - if (socket && socket.servername !== request2.servername) { + client[kServerName] = request4.servername; + if (socket && socket.servername !== request4.servername) { util.destroy(socket, new InformationalError("servername changed")); return; } @@ -7979,16 +7979,16 @@ var require_client = __commonJS({ if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) { return; } - if (client[kRunning] > 0 && !request2.idempotent) { + if (client[kRunning] > 0 && !request4.idempotent) { return; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body))) { return; } - if (!request2.aborted && write(client, request2)) { + if (!request4.aborted && write(client, request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -7998,12 +7998,12 @@ var require_client = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function write(client, request2) { + function write(client, request4) { if (client[kHTTPConnVersion] === "h2") { - writeH2(client, client[kHTTP2Session], request2); + writeH2(client, client[kHTTP2Session], request4); return; } - const { body, method, path, host, upgrade, headers, blocking, reset } = request2; + const { body, method, path, host, upgrade, headers, blocking, reset } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { body.read(0); @@ -8011,31 +8011,31 @@ var require_client = __commonJS({ const bodyLength = util.bodyLength(body); let contentLength = bodyLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(socket, new InformationalError("aborted")); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -8074,7 +8074,7 @@ upgrade: ${upgrade}\r header += headers; } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { if (contentLength === 0) { @@ -8086,7 +8086,7 @@ upgrade: ${upgrade}\r socket.write(`${header}\r `, "latin1"); } - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); socket.cork(); @@ -8095,48 +8095,48 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable({ body: body.stream(), client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body: body.stream(), client, request: request4, socket, contentLength, header, expectsPayload }); } else { - writeBlob({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeBlob({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } } else if (util.isStream(body)) { - writeStream({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeStream({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else if (util.isIterable(body)) { - writeIterable({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else { assert(false); } return true; } - function writeH2(client, session, request2) { - const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; + function writeH2(client, session, request4) { + const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; let headers; if (typeof reqHeaders === "string") headers = Request[kHTTP2CopyHeaders](reqHeaders.trim()); else headers = reqHeaders; if (upgrade) { - errorRequest(client, request2, new Error("Upgrade not supported for H2")); + errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } let stream; @@ -8147,11 +8147,11 @@ upgrade: ${upgrade}\r session.ref(); stream = session.request(headers, { endStream: false, signal }); if (stream.id && !stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; }); } @@ -8170,14 +8170,14 @@ upgrade: ${upgrade}\r } let contentLength = util.bodyLength(body); if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -8202,15 +8202,15 @@ upgrade: ${upgrade}\r ++h2State.openStreams; stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - if (request2.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.once("end", () => { - request2.onComplete([]); + request4.onComplete([]); }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -8228,7 +8228,7 @@ upgrade: ${upgrade}\r }); stream.once("frameError", (type, code) => { const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`); - errorRequest(client, request2, err); + errorRequest(client, request4, err); if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { h2State.streams -= 1; util.destroy(stream, err); @@ -8237,20 +8237,20 @@ upgrade: ${upgrade}\r return true; function writeBodyH2() { if (!body) { - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); stream.cork(); stream.write(body); stream.uncork(); stream.end(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { writeIterable({ client, - request: request2, + request: request4, contentLength, h2stream: stream, expectsPayload, @@ -8262,7 +8262,7 @@ upgrade: ${upgrade}\r writeBlob({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, h2stream: stream, @@ -8274,7 +8274,7 @@ upgrade: ${upgrade}\r writeStream({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, socket: client[kSocket], @@ -8285,7 +8285,7 @@ upgrade: ${upgrade}\r writeIterable({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, header: "", @@ -8297,11 +8297,11 @@ upgrade: ${upgrade}\r } } } - function writeStream({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + function writeStream({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); if (client[kHTTPConnVersion] === "h2") { let onPipeData = function(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); }; const pipe = pipeline( body, @@ -8311,7 +8311,7 @@ upgrade: ${upgrade}\r util.destroy(body, err); util.destroy(h2stream, err); } else { - request2.onRequestSent(); + request4.onRequestSent(); } } ); @@ -8323,7 +8323,7 @@ upgrade: ${upgrade}\r return; } let finished = false; - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -8379,7 +8379,7 @@ upgrade: ${upgrade}\r } socket.on("drain", onDrain).on("error", onFinished); } - async function writeBlob({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeBlob({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength === body.size, "blob body must have content length"); const isH2 = client[kHTTPConnVersion] === "h2"; try { @@ -8399,8 +8399,8 @@ upgrade: ${upgrade}\r socket.write(buffer); socket.uncork(); } - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -8409,7 +8409,7 @@ upgrade: ${upgrade}\r util.destroy(isH2 ? h2stream : socket, err); } } - async function writeIterable({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeIterable({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -8435,7 +8435,7 @@ upgrade: ${upgrade}\r throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } @@ -8443,14 +8443,14 @@ upgrade: ${upgrade}\r } catch (err) { h2stream.destroy(err); } finally { - request2.onRequestSent(); + request4.onRequestSent(); h2stream.end(); h2stream.off("close", onDrain).off("drain", onDrain); } return; } socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -8468,9 +8468,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -8479,7 +8479,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -8518,7 +8518,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -8529,8 +8529,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -8573,10 +8573,10 @@ ${len.toString(16)}\r } } }; - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert(request2.aborted); + request4.onError(err); + assert(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -9671,10 +9671,10 @@ var require_api_request = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -9689,7 +9689,7 @@ var require_api_request = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -10403,7 +10403,7 @@ var require_mock_utils = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (typeof data === "object") { @@ -10508,7 +10508,7 @@ var require_mock_utils = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); handler2.abort = nop; @@ -10565,7 +10565,7 @@ var require_mock_utils = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -10587,7 +10587,7 @@ var require_mock_utils = __commonJS({ var require_mock_interceptor = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils(); var { kDispatches, kDispatchKey, @@ -10650,7 +10650,7 @@ var require_mock_interceptor = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData(statusCode, data, responseOptions = {}) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -12299,7 +12299,7 @@ var require_request2 = __commonJS({ policyContainer: makePolicyContainer() } }; - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = this[kRealm].settingsObject.baseUrl; let signal = null; @@ -12315,17 +12315,17 @@ var require_request2 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(input instanceof Request); - request2 = input[kState]; + request4 = input[kState]; signal = input[kSignal]; } const origin = this[kRealm].settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request4.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -12333,43 +12333,43 @@ var require_request2 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: this[kRealm].settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -12378,14 +12378,14 @@ var require_request2 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, this[kRealm].settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -12400,27 +12400,27 @@ var require_request2 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; @@ -12431,12 +12431,12 @@ var require_request2 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizeMethodRecord[method] ?? normalizeMethod(method); - request2.method = method; + request4.method = method; } if (init.signal !== void 0) { signal = init.signal; } - this[kState] = request2; + this[kState] = request4; const ac = new AbortController(); this[kSignal] = ac.signal; this[kSignal][kRealm] = this[kRealm]; @@ -12470,13 +12470,13 @@ var require_request2 = __commonJS({ } } this[kHeaders] = new Headers(kConstruct); - this[kHeaders][kHeadersList] = request2.headersList; + this[kHeaders][kHeadersList] = request4.headersList; this[kHeaders][kGuard] = "request"; this[kHeaders][kRealm] = this[kRealm]; if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } this[kHeaders][kGuard] = "request-no-cors"; @@ -12495,14 +12495,14 @@ var require_request2 = __commonJS({ } } const inputBody = input instanceof Request ? input[kState].body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !this[kHeaders][kHeadersList].contains("content-type")) { @@ -12514,12 +12514,12 @@ var require_request2 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -12649,7 +12649,7 @@ var require_request2 = __commonJS({ }; mixinBody(Request); function makeRequest(init) { - const request2 = { + const request4 = { method: "GET", localURLsOnly: false, unsafeRequest: false, @@ -12688,13 +12688,13 @@ var require_request2 = __commonJS({ ...init, headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; - request2.url = request2.urlList[0]; - return request2; + request4.url = request4.urlList[0]; + return request4; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(request4.body); } return newRequest; } @@ -12924,14 +12924,14 @@ var require_fetch = __commonJS({ p.reject(e); return p.promise; } - const request2 = requestObject[kState]; + const request4 = requestObject[kState]; if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; const relevantRealm = null; @@ -12943,7 +12943,7 @@ var require_fetch = __commonJS({ locallyAborted = true; assert(controller != null); controller.abort(requestObject.signal.reason); - abortFetch(p, request2, responseObject, requestObject.signal.reason); + abortFetch(p, request4, responseObject, requestObject.signal.reason); } ); const handleFetchDone = (response) => finalizeAndReportTiming(response, "fetch"); @@ -12952,7 +12952,7 @@ var require_fetch = __commonJS({ return Promise.resolve(); } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return Promise.resolve(); } if (response.type === "error") { @@ -12970,7 +12970,7 @@ var require_fetch = __commonJS({ p.resolve(responseObject); }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: init.dispatcher ?? getGlobalDispatcher() @@ -13015,14 +13015,14 @@ var require_fetch = __commonJS({ performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis2, cacheState); } } - function abortFetch(p, request2, responseObject, error) { + function abortFetch(p, request4, responseObject, error) { var _a, _b; if (!error) { error = new DOMException2("The operation was aborted.", "AbortError"); } p.reject(error); - if (request2.body != null && isReadable((_a = request2.body) == null ? void 0 : _a.stream)) { - request2.body.stream.cancel(error).catch((err) => { + if (request4.body != null && isReadable((_a = request4.body) == null ? void 0 : _a.stream)) { + request4.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -13043,7 +13043,7 @@ var require_fetch = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -13055,9 +13055,9 @@ var require_fetch = __commonJS({ var _a, _b, _c, _d; let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currenTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -13065,7 +13065,7 @@ var require_fetch = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -13075,32 +13075,32 @@ var require_fetch = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a = request4.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = (_d = request2.client) == null ? void 0 : _d.origin; + if (request4.origin === "client") { + request4.origin = (_d = request4.client) == null ? void 0 : _d.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept")) { + if (!request4.headersList.contains("accept")) { const value = "*/*"; - request2.headersList.append("accept", value); + request4.headersList.append("accept", value); } - if (!request2.headersList.contains("accept-language")) { - request2.headersList.append("accept-language", "*"); + if (!request4.headersList.contains("accept-language")) { + request4.headersList.append("accept-language", "*"); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -13108,44 +13108,44 @@ var require_fetch = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { response = await (async () => { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; return await schemeFetch(fetchParams); } - if (request2.mode === "same-origin") { + if (request4.mode === "same-origin") { return makeNetworkError('request mode cannot be "same-origin"'); } - if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { return makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; return await schemeFetch(fetchParams); } - if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { return makeNetworkError("URL scheme must be a HTTP(S) scheme"); } - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; return await httpFetch(fetchParams); })(); } @@ -13153,13 +13153,13 @@ var require_fetch = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -13167,26 +13167,26 @@ var require_fetch = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range")) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range")) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -13202,8 +13202,8 @@ var require_fetch = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -13212,12 +13212,12 @@ var require_fetch = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blobURLEntryObject = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !isBlobLike(blobURLEntryObject)) { + if (request4.method !== "GET" || !isBlobLike(blobURLEntryObject)) { return Promise.resolve(makeNetworkError("invalid method")); } const bodyWithType = safelyExtractBody(blobURLEntryObject); @@ -13235,7 +13235,7 @@ var require_fetch = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -13317,41 +13317,41 @@ var require_fetch = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -13361,13 +13361,13 @@ var require_fetch = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -13378,63 +13378,63 @@ var require_fetch = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization"); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie"); - request2.headersList.delete("host"); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization"); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie"); + request4.headersList.delete("host"); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = makeRequest(request2); + httpRequest = makeRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -13511,7 +13511,7 @@ var require_fetch = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -13519,7 +13519,7 @@ var require_fetch = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -13547,21 +13547,21 @@ var require_fetch = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -13590,7 +13590,7 @@ var require_fetch = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -13702,17 +13702,17 @@ var require_fetch = __commonJS({ } return response; async function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: fetchParams.controller.dispatcher.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: fetchParams.controller.dispatcher.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -13758,8 +13758,8 @@ var require_fetch = __commonJS({ } this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = request2.redirect === "follow" && location && redirectStatusSet.has(status); - if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = request4.redirect === "follow" && location && redirectStatusSet.has(status); + if (request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (const coding of codings) { if (coding === "x-gzip" || coding === "gzip") { decoders.push(zlib.createGunzip({ @@ -14693,36 +14693,36 @@ var require_cache = __commonJS({ } this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); - const p = await this.matchAll(request2, options); + const p = await this.matchAll(request4, options); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { var _a; webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -14744,11 +14744,11 @@ var require_cache = __commonJS({ } return Object.freeze(responseList); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.add" }); - request2 = webidl.converters.RequestInfo(request2); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -14758,11 +14758,11 @@ var require_cache = __commonJS({ requests = webidl.converters["sequence"](requests); const responsePromises = []; const requestList = []; - for (const request2 of requests) { - if (typeof request2 === "string") { + for (const request4 of requests) { + if (typeof request4 === "string") { continue; } - const r = request2[kState]; + const r = request4[kState]; if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14771,8 +14771,8 @@ var require_cache = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = new Request(request2)[kState]; + for (const request4 of requests) { + const r = new Request(request4)[kState]; if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14847,16 +14847,16 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 2, { header: "Cache.put" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); response = webidl.converters.Response(response); let innerRequest = null; - if (request2 instanceof Request) { - innerRequest = request2[kState]; + if (request4 instanceof Request) { + innerRequest = request4[kState]; } else { - innerRequest = new Request(request2)[kState]; + innerRequest = new Request(request4)[kState]; } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -14924,20 +14924,20 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.delete" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = new Request(request2)[kState]; + assert(typeof request4 === "string"); + r = new Request(request4)[kState]; } const operations = []; const operation = { @@ -14963,25 +14963,25 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -14993,12 +14993,12 @@ var require_cache = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = new Request("https://a"); - requestObject[kState] = request3; - requestObject[kHeaders][kHeadersList] = request3.headersList; + requestObject[kState] = request5; + requestObject[kHeaders][kHeadersList] = request5.headersList; requestObject[kHeaders][kGuard] = "immutable"; - requestObject[kRealm] = request3.client; + requestObject[kRealm] = request5.client; requestList.push(requestObject); } promise.resolve(Object.freeze(requestList)); @@ -15093,9 +15093,9 @@ var require_cache = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -15111,7 +15111,7 @@ var require_cache = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -15183,21 +15183,21 @@ var require_cachestorage = __commonJS({ webidl.illegalConstructor(); } } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, { header: "CacheStorage.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -16110,7 +16110,7 @@ var require_connection = __commonJS({ function establishWebSocketConnection(url, protocols, ws, onEstablish, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], serviceWorkers: "none", referrer: "no-referrer", @@ -16121,17 +16121,17 @@ var require_connection = __commonJS({ }); if (options.headers) { const headersList = new Headers(options.headers)[kHeadersList]; - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue); - request2.headersList.append("sec-websocket-version", "13"); + request4.headersList.append("sec-websocket-key", keyValue); + request4.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol); + request4.headersList.append("sec-websocket-protocol", protocol); } const permessageDeflate = ""; const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher ?? getGlobalDispatcher(), processResponse(response) { @@ -16164,7 +16164,7 @@ var require_connection = __commonJS({ return; } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); - if (secProtocol !== null && secProtocol !== request2.headersList.get("Sec-WebSocket-Protocol")) { + if (secProtocol !== null && secProtocol !== request4.headersList.get("Sec-WebSocket-Protocol")) { failWebsocketConnection(ws, "Protocol was not set in the opening handshake."); return; } @@ -17209,7 +17209,7 @@ var require_lib = __commonJS({ } exports.isHttps = isHttps; var HttpClient = class { - constructor(userAgent2, handlers, requestOptions) { + constructor(userAgent4, handlers, requestOptions) { this._ignoreSslError = false; this._allowRedirects = true; this._allowRedirectDowngrade = false; @@ -17218,7 +17218,7 @@ var require_lib = __commonJS({ this._maxRetries = 1; this._keepAlive = false; this._disposed = false; - this.userAgent = userAgent2; + this.userAgent = userAgent4; this.handlers = handlers || []; this.requestOptions = requestOptions; if (requestOptions) { @@ -17483,14 +17483,14 @@ var require_lib = __commonJS({ } _mergeHeaders(headers) { if (this.requestOptions && this.requestOptions.headers) { - return Object.assign({}, lowercaseKeys2(this.requestOptions.headers), lowercaseKeys2(headers || {})); + return Object.assign({}, lowercaseKeys4(this.requestOptions.headers), lowercaseKeys4(headers || {})); } - return lowercaseKeys2(headers || {}); + return lowercaseKeys4(headers || {}); } _getExistingOrDefaultHeader(additionalHeaders, header, _default) { let clientHeader; if (this.requestOptions && this.requestOptions.headers) { - clientHeader = lowercaseKeys2(this.requestOptions.headers)[header]; + clientHeader = lowercaseKeys4(this.requestOptions.headers)[header]; } return additionalHeaders[header] || clientHeader || _default; } @@ -17625,7 +17625,7 @@ var require_lib = __commonJS({ } }; exports.HttpClient = HttpClient; - var lowercaseKeys2 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + var lowercaseKeys4 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); } }); @@ -20462,10 +20462,10 @@ var require_util8 = __commonJS({ } return obj; } - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert(request2.aborted); + request4.onError(err); + assert(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -20993,7 +20993,7 @@ var require_request3 = __commonJS({ return this; } }; - function processHeader(request2, key, val) { + function processHeader(request4, key, val) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { @@ -21032,19 +21032,19 @@ var require_request3 = __commonJS({ } else { val = `${val}`; } - if (request2.host === null && headerName === "host") { + if (request4.host === null && headerName === "host") { if (typeof val !== "string") { throw new InvalidArgumentError("invalid host header"); } - request2.host = val; - } else if (request2.contentLength === null && headerName === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && headerName === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && headerName === "content-type") { - request2.contentType = val; - request2.headers.push(key, val); + } else if (request4.contentType === null && headerName === "content-type") { + request4.contentType = val; + request4.headers.push(key, val); } else if (headerName === "transfer-encoding" || headerName === "keep-alive" || headerName === "upgrade") { throw new InvalidArgumentError(`invalid ${headerName} header`); } else if (headerName === "connection") { @@ -21053,12 +21053,12 @@ var require_request3 = __commonJS({ throw new InvalidArgumentError("invalid connection header"); } if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (headerName === "expect") { throw new NotSupportedError("expect header not supported"); } else { - request2.headers.push(key, val); + request4.headers.push(key, val); } } module.exports = Request; @@ -23371,11 +23371,11 @@ var require_util9 = __commonJS({ function normalizeBinaryStringToUtf8(value) { return Buffer.from(value, "binary").toString("utf8"); } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -23412,10 +23412,10 @@ var require_util9 = __commonJS({ } return policy; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const policy = parseReferrerPolicy(actualResponse); if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -23432,33 +23432,33 @@ var require_util9 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header, true); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; if (serializedOrigin === "client" || serializedOrigin === void 0) { return; } - if (request2.responseTainting === "cors" || request2.mode === "websocket") { - request2.headersList.append("origin", serializedOrigin, true); - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + if (request4.responseTainting === "cors" || request4.mode === "websocket") { + request4.headersList.append("origin", serializedOrigin, true); + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } - request2.headersList.append("origin", serializedOrigin, true); + request4.headersList.append("origin", serializedOrigin, true); } } function coarsenTime(timestamp, crossOriginIsolatedCapability) { @@ -23512,18 +23512,18 @@ var require_util9 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (webidl.is.URL(request2.referrer)) { - referrerSource = request2.referrer; + } else if (webidl.is.URL(request4.referrer)) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); @@ -23541,14 +23541,14 @@ var require_util9 = __commonJS({ case "unsafe-url": return referrerURL; case "strict-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } return referrerOrigin; } case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -23558,17 +23558,17 @@ var require_util9 = __commonJS({ return referrerOrigin; } case "same-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return "no-referrer"; case "origin-when-cross-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return referrerOrigin; case "no-referrer-when-downgrade": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } @@ -23732,7 +23732,7 @@ var require_util9 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -25205,11 +25205,11 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } - request2.onResponseStarted(); + request4.onResponseStarted(); return 0; } onHeaderField(buf) { @@ -25257,9 +25257,9 @@ var require_client_h1 = __commonJS({ assert(!socket.destroyed); assert(!this.paused); assert((headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); - assert(request2.upgrade || request2.method === "CONNECT"); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); + assert(request4.upgrade || request4.method === "CONNECT"); this.statusCode = 0; this.statusText = ""; this.shouldKeepAlive = false; @@ -25276,7 +25276,7 @@ var require_client_h1 = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -25287,8 +25287,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert(!this.upgrade); @@ -25297,22 +25297,22 @@ var require_client_h1 = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert(this.timeoutType === TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -25343,11 +25343,11 @@ var require_client_h1 = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -25364,8 +25364,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(this.timeoutType === TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -25378,7 +25378,7 @@ var require_client_h1 = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } return 0; @@ -25393,8 +25393,8 @@ var require_client_h1 = __commonJS({ } assert(statusCode >= 100); assert((this.headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); this.statusCode = 0; this.statusText = ""; this.bytesRead = 0; @@ -25406,11 +25406,11 @@ var require_client_h1 = __commonJS({ if (statusCode < 200) { return 0; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert(client[kRunning] === 0); @@ -25476,8 +25476,8 @@ var require_client_h1 = __commonJS({ return { version: "h1", defaultPipelining: 1, - write(request2) { - return writeH1(client, request2); + write(request4) { + return writeH1(client, request4); }, resume() { resumeH1(client); @@ -25493,18 +25493,18 @@ var require_client_h1 = __commonJS({ get destroyed() { return socket.destroyed; }, - busy(request2) { + busy(request4) { if (socket[kWriting] || socket[kReset] || socket[kBlocking]) { return true; } - if (request2) { - if (client[kRunning] > 0 && !request2.idempotent) { + if (request4) { + if (client[kRunning] > 0 && !request4.idempotent) { return true; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return true; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body) || util.isFormDataLike(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body) || util.isFormDataLike(request4.body))) { return true; } } @@ -25551,13 +25551,13 @@ var require_client_h1 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -25585,8 +25585,8 @@ var require_client_h1 = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request2 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request2.headersTimeout != null ? request2.headersTimeout : client[kHeadersTimeout]; + const request4 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request4.headersTimeout != null ? request4.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -25595,21 +25595,21 @@ var require_client_h1 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH1(client, request2) { - const { method, path, host, upgrade, blocking, reset } = request2; - let { body, headers, contentLength } = request2; + function writeH1(client, request4) { + const { method, path, host, upgrade, blocking, reset } = request4; + let { body, headers, contentLength } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH"; if (util.isFormDataLike(body)) { if (!extractBody) { extractBody = require_body2().extractBody; } const [bodyStream, contentType] = extractBody(body); - if (request2.contentType == null) { + if (request4.contentType == null) { headers.push("content-type", contentType); } body = bodyStream.stream; contentLength = bodyStream.length; - } else if (util.isBlobLike(body) && request2.contentType == null && body.type) { + } else if (util.isBlobLike(body) && request4.contentType == null && body.type) { headers.push("content-type", body.type); } if (body && typeof body.read === "function") { @@ -25618,33 +25618,33 @@ var require_client_h1 = __commonJS({ const bodyLength = util.bodyLength(body); contentLength = bodyLength ?? contentLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - util.errorRequest(client, request2, err || new RequestAbortedError()); + util.errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(body); util.destroy(socket, new InformationalError("aborted")); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -25695,31 +25695,31 @@ upgrade: ${upgrade}\r } } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { - writeBuffer(abort, null, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, null, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBuffer(body)) { - writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable(abort, body.stream(), client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body.stream(), client, request4, socket, contentLength, header, expectsPayload); } else { - writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload); } } else if (util.isStream(body)) { - writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isIterable(body)) { - writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else { assert(false); } return true; } - function writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); let finished = false; - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -25785,7 +25785,7 @@ upgrade: ${upgrade}\r setImmediate(onClose); } } - function writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload) { try { if (!body) { if (contentLength === 0) { @@ -25805,18 +25805,18 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(body); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (err) { abort(err); } } - async function writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -25829,9 +25829,9 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(buffer); socket.uncork(); - request2.onBodySent(buffer); - request2.onRequestSent(); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(buffer); + request4.onRequestSent(); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } client[kResume](); @@ -25839,7 +25839,7 @@ upgrade: ${upgrade}\r abort(err); } } - async function writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -25858,7 +25858,7 @@ upgrade: ${upgrade}\r } }); socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -25876,9 +25876,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ abort, socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ abort, socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -25888,7 +25888,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -25907,7 +25907,7 @@ upgrade: ${upgrade}\r } socket.cork(); if (bytesWritten === 0) { - if (!expectsPayload && request2.reset !== false) { + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } if (contentLength === null) { @@ -25927,7 +25927,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -25938,8 +25938,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -26082,8 +26082,8 @@ var require_client_h2 = __commonJS({ return { version: "h2", defaultPipelining: Infinity, - write(request2) { - return writeH2(client, request2); + write(request4) { + return writeH2(client, request4); }, resume() { resumeH2(client); @@ -26141,9 +26141,9 @@ var require_client_h2 = __commonJS({ this[kHTTP2Session] = null; util.destroy(this[kSocket], err); if (client[kRunningIdx] < client[kQueue].length) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); client[kPendingIdx] = client[kRunningIdx]; } assert(client[kRunning] === 0); @@ -26160,8 +26160,8 @@ var require_client_h2 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } } @@ -26192,13 +26192,13 @@ var require_client_h2 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH2(client, request2) { - const requestTimeout = request2.bodyTimeout ?? client[kBodyTimeout]; + function writeH2(client, request4) { + const requestTimeout = request4.bodyTimeout ?? client[kBodyTimeout]; const session = client[kHTTP2Session]; - const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; - let { body } = request2; + const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; + let { body } = request4; if (upgrade) { - util.errorRequest(client, request2, new Error("Upgrade not supported for H2")); + util.errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } const headers = {}; @@ -26222,11 +26222,11 @@ var require_client_h2 = __commonJS({ headers[HTTP2_HEADER_AUTHORITY] = host || `${hostname}${port ? `:${port}` : ""}`; headers[HTTP2_HEADER_METHOD] = method; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } err = err || new RequestAbortedError(); - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); if (stream != null) { stream.removeAllListeners("data"); stream.close(); @@ -26236,23 +26236,23 @@ var require_client_h2 = __commonJS({ util.destroy(body, err); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "CONNECT") { session.ref(); stream = session.request(headers, { endStream: false, signal }); if (!stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; }); @@ -26280,14 +26280,14 @@ var require_client_h2 = __commonJS({ contentLength = bodyStream.length; } if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -26303,7 +26303,7 @@ var require_client_h2 = __commonJS({ header += `${key}: ${headers[key]}\r `; } - channels.sendHeaders.publish({ request: request2, headers: header, socket: session[kSocket] }); + channels.sendHeaders.publish({ request: request4, headers: header, socket: session[kSocket] }); } const shouldEndStream = method === "GET" || method === "HEAD" || body === null; if (expectContinue) { @@ -26321,17 +26321,17 @@ var require_client_h2 = __commonJS({ stream.setTimeout(requestTimeout); stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - request2.onResponseStarted(); - if (request2.aborted) { + request4.onResponseStarted(); + if (request4.aborted) { stream.removeAllListeners("data"); return; } - if (request2.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -26339,8 +26339,8 @@ var require_client_h2 = __commonJS({ var _a; stream.removeAllListeners("data"); if (((_a = stream.state) == null ? void 0 : _a.state) == null || stream.state.state < 6) { - if (!request2.aborted && !request2.completed) { - request2.onComplete({}); + if (!request4.aborted && !request4.completed) { + request4.onComplete({}); } client[kQueue][client[kRunningIdx]++] = null; client[kResume](); @@ -26383,10 +26383,10 @@ var require_client_h2 = __commonJS({ abort(err); }); stream.once("trailers", (trailers) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - request2.onComplete(trailers); + request4.onComplete(trailers); }); return true; function writeBodyH2() { @@ -26396,7 +26396,7 @@ var require_client_h2 = __commonJS({ stream, null, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26407,7 +26407,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26419,7 +26419,7 @@ var require_client_h2 = __commonJS({ stream, body.stream(), client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26430,7 +26430,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26444,7 +26444,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, contentLength ); } else if (util.isIterable(body)) { @@ -26453,7 +26453,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26463,7 +26463,7 @@ var require_client_h2 = __commonJS({ } } } - function writeBuffer(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + function writeBuffer(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { try { if (body != null && util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); @@ -26471,18 +26471,18 @@ var require_client_h2 = __commonJS({ h2stream.write(body); h2stream.uncork(); h2stream.end(); - request2.onBodySent(body); + request4.onBodySent(body); } if (!expectsPayload) { socket[kReset] = true; } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (error) { abort(error); } } - function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) { + function writeStream(abort, socket, expectsPayload, h2stream, body, client, request4, contentLength) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); const pipe = pipeline( body, @@ -26493,7 +26493,7 @@ var require_client_h2 = __commonJS({ abort(err); } else { util.removeAllListeners(pipe); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26503,10 +26503,10 @@ var require_client_h2 = __commonJS({ ); util.addListener(pipe, "data", onPipeData); function onPipeData(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); } } - async function writeBlob(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeBlob(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -26517,8 +26517,8 @@ var require_client_h2 = __commonJS({ h2stream.write(buffer); h2stream.uncork(); h2stream.end(); - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26527,7 +26527,7 @@ var require_client_h2 = __commonJS({ abort(err); } } - async function writeIterable(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeIterable(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -26552,13 +26552,13 @@ var require_client_h2 = __commonJS({ throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } } h2stream.end(); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26805,10 +26805,10 @@ var require_client2 = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = new Request(origin, opts, handler2); - this[kQueue].push(request2); + const request4 = new Request(origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; queueMicrotask(() => resume(this)); } else { @@ -26832,8 +26832,8 @@ var require_client2 = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(this, request2, err); + const request4 = requests[i]; + util.errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -26857,8 +26857,8 @@ var require_client2 = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } assert(client[kSize] === 0); } @@ -26962,8 +26962,8 @@ var require_client2 = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - util.errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + util.errorRequest(client, request4, err); } } else { onError(client, err); @@ -27021,12 +27021,12 @@ var require_client2 = __commonJS({ if (client[kRunning] >= (getPipelining(client) || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; + client[kServerName] = request4.servername; (_a = client[kHTTPContext]) == null ? void 0 : _a.destroy(new InformationalError("servername changed"), () => { client[kHTTPContext] = null; resume(client); @@ -27042,10 +27042,10 @@ var require_client2 = __commonJS({ if (client[kHTTPContext].destroyed) { return; } - if (client[kHTTPContext].busy(request2)) { + if (client[kHTTPContext].busy(request4)) { return; } - if (!request2.aborted && client[kHTTPContext].write(request2)) { + if (!request4.aborted && client[kHTTPContext].write(request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -28659,10 +28659,10 @@ var require_api_request2 = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -28678,7 +28678,7 @@ var require_api_request2 = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -29444,7 +29444,7 @@ var require_mock_utils2 = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (data instanceof Uint8Array) { @@ -29577,7 +29577,7 @@ var require_mock_utils2 = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); (_a = handler2.onConnect) == null ? void 0 : _a.call(handler2, (err) => handler2.onError(err), null); @@ -29634,7 +29634,7 @@ var require_mock_utils2 = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -29657,7 +29657,7 @@ var require_mock_utils2 = __commonJS({ var require_mock_interceptor2 = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils2(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils2(); var { kDispatches, kDispatchKey, @@ -29722,7 +29722,7 @@ var require_mock_interceptor2 = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData({ statusCode, data, responseOptions }) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -32022,7 +32022,7 @@ var require_sqlite_cache_store = __commonJS({ var { Writable } = __require("stream"); var { assertCacheKey, assertCacheValue } = require_cache2(); var DatabaseSync; - var VERSION13 = 3; + var VERSION17 = 3; var MAX_ENTRY_SIZE = 2 * 1e3 * 1e3 * 1e3; module.exports = class SqliteCacheStore { #maxEntrySize = MAX_ENTRY_SIZE; @@ -32061,7 +32061,7 @@ var require_sqlite_cache_store = __commonJS({ } this.#db = new DatabaseSync((opts == null ? void 0 : opts.location) ?? ":memory:"); this.#db.exec(` - CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION13} ( + CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION17} ( -- Data specific to us id INTEGER PRIMARY KEY AUTOINCREMENT, url TEXT NOT NULL, @@ -32080,9 +32080,9 @@ var require_sqlite_cache_store = __commonJS({ staleAt INTEGER NOT NULL ); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_url ON cacheInterceptorV${VERSION13}(url); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_method ON cacheInterceptorV${VERSION13}(method); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_deleteAt ON cacheInterceptorV${VERSION13}(deleteAt); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_url ON cacheInterceptorV${VERSION17}(url); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_method ON cacheInterceptorV${VERSION17}(method); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_deleteAt ON cacheInterceptorV${VERSION17}(deleteAt); `); this.#getValuesQuery = this.#db.prepare(` SELECT @@ -32097,7 +32097,7 @@ var require_sqlite_cache_store = __commonJS({ vary, cachedAt, staleAt - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION17} WHERE url = ? AND method = ? @@ -32105,7 +32105,7 @@ var require_sqlite_cache_store = __commonJS({ deleteAt ASC `); this.#updateValueQuery = this.#db.prepare(` - UPDATE cacheInterceptorV${VERSION13} SET + UPDATE cacheInterceptorV${VERSION17} SET body = ?, deleteAt = ?, statusCode = ?, @@ -32119,7 +32119,7 @@ var require_sqlite_cache_store = __commonJS({ id = ? `); this.#insertValueQuery = this.#db.prepare(` - INSERT INTO cacheInterceptorV${VERSION13} ( + INSERT INTO cacheInterceptorV${VERSION17} ( url, method, body, @@ -32135,20 +32135,20 @@ var require_sqlite_cache_store = __commonJS({ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `); this.#deleteByUrlQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE url = ?` + `DELETE FROM cacheInterceptorV${VERSION17} WHERE url = ?` ); this.#countEntriesQuery = this.#db.prepare( - `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION13}` + `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION17}` ); this.#deleteExpiredValuesQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE deleteAt <= ?` + `DELETE FROM cacheInterceptorV${VERSION17} WHERE deleteAt <= ?` ); this.#deleteOldValuesQuery = this.#maxCount === Infinity ? null : this.#db.prepare(` - DELETE FROM cacheInterceptorV${VERSION13} + DELETE FROM cacheInterceptorV${VERSION17} WHERE id IN ( SELECT id - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION17} ORDER BY cachedAt DESC LIMIT ? ) @@ -33239,7 +33239,7 @@ var require_request4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); input = webidl.converters.RequestInfo(input, prefix, "input"); init = webidl.converters.RequestInit(init, prefix, "init"); - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = environmentSettingsObject.settingsObject.baseUrl; let signal = null; @@ -33256,18 +33256,18 @@ var require_request4 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(webidl.is.Request(input)); - request2 = input.#state; + request4 = input.#state; signal = input.#signal; this.#dispatcher = init.dispatcher || input.#dispatcher; } const origin = environmentSettingsObject.settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request4.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -33275,43 +33275,43 @@ var require_request4 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: environmentSettingsObject.settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -33320,14 +33320,14 @@ var require_request4 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, environmentSettingsObject.settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -33342,33 +33342,33 @@ var require_request4 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; const mayBeNormalized = normalizedMethodRecords[method]; if (mayBeNormalized !== void 0) { - request2.method = mayBeNormalized; + request4.method = mayBeNormalized; } else { if (!isValidHTTPToken(method)) { throw new TypeError(`'${method}' is not a valid HTTP method.`); @@ -33378,9 +33378,9 @@ var require_request4 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizedMethodRecordsBase[upperCase] ?? method; - request2.method = method; + request4.method = method; } - if (!patchMethodWarning && request2.method === "patch") { + if (!patchMethodWarning && request4.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" }); @@ -33390,7 +33390,7 @@ var require_request4 = __commonJS({ if (init.signal !== void 0) { signal = init.signal; } - this.#state = request2; + this.#state = request4; const ac = new AbortController(); this.#signal = ac.signal; if (signal != null) { @@ -33411,12 +33411,12 @@ var require_request4 = __commonJS({ } } this.#headers = new Headers(kConstruct); - setHeadersList(this.#headers, request2.headersList); + setHeadersList(this.#headers, request4.headersList); setHeadersGuard(this.#headers, "request"); if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } setHeadersGuard(this.#headers, "request-no-cors"); @@ -33435,14 +33435,14 @@ var require_request4 = __commonJS({ } } const inputBody = webidl.is.Request(input) ? input.#state.body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !getHeadersList(this.#headers).contains("content-type", true)) { @@ -33454,12 +33454,12 @@ var require_request4 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -33604,24 +33604,24 @@ var require_request4 = __commonJS({ }; return `Request ${nodeUtil.formatWithOptions(options, properties)}`; } - static setRequestSignal(request2, newSignal) { - request2.#signal = newSignal; - return request2; + static setRequestSignal(request4, newSignal) { + request4.#signal = newSignal; + return request4; } - static getRequestDispatcher(request2) { - return request2.#dispatcher; + static getRequestDispatcher(request4) { + return request4.#dispatcher; } - static setRequestDispatcher(request2, newDispatcher) { - request2.#dispatcher = newDispatcher; + static setRequestDispatcher(request4, newDispatcher) { + request4.#dispatcher = newDispatcher; } - static setRequestHeaders(request2, newHeaders) { - request2.#headers = newHeaders; + static setRequestHeaders(request4, newHeaders) { + request4.#headers = newHeaders; } - static getRequestState(request2) { - return request2.#state; + static getRequestState(request4) { + return request4.#state; } - static setRequestState(request2, newState) { - request2.#state = newState; + static setRequestState(request4, newState) { + request4.#state = newState; } }; var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState } = Request; @@ -33674,23 +33674,23 @@ var require_request4 = __commonJS({ headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(newRequest, request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(newRequest, request4.body); } return newRequest; } function fromInnerRequest(innerRequest, dispatcher, signal, guard) { - const request2 = new Request(kConstruct); - setRequestState(request2, innerRequest); - setRequestDispatcher(request2, dispatcher); - setRequestSignal(request2, signal); + const request4 = new Request(kConstruct); + setRequestState(request4, innerRequest); + setRequestDispatcher(request4, dispatcher); + setRequestSignal(request4, signal); const headers = new Headers(kConstruct); - setRequestHeaders(request2, headers); + setRequestHeaders(request4, headers); setHeadersList(headers, innerRequest.headersList); setHeadersGuard(headers, guard); - return request2; + return request4; } Object.defineProperties(Request.prototype, { method: kEnumerableProperty, @@ -33928,14 +33928,14 @@ var require_fetch2 = __commonJS({ p.reject(e); return p.promise; } - const request2 = getRequestState(requestObject); + const request4 = getRequestState(requestObject); if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; let locallyAborted = false; @@ -33947,7 +33947,7 @@ var require_fetch2 = __commonJS({ assert(controller != null); controller.abort(requestObject.signal.reason); const realResponse = responseObject == null ? void 0 : responseObject.deref(); - abortFetch(p, request2, realResponse, requestObject.signal.reason); + abortFetch(p, request4, realResponse, requestObject.signal.reason); } ); const processResponse = (response) => { @@ -33955,7 +33955,7 @@ var require_fetch2 = __commonJS({ return; } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return; } if (response.type === "error") { @@ -33967,7 +33967,7 @@ var require_fetch2 = __commonJS({ p = null; }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: getRequestDispatcher(requestObject) @@ -34008,13 +34008,13 @@ var require_fetch2 = __commonJS({ ); } var markResourceTiming = performance.markResourceTiming; - function abortFetch(p, request2, responseObject, error) { + function abortFetch(p, request4, responseObject, error) { var _a, _b; if (p) { p.reject(error); } - if (((_a = request2.body) == null ? void 0 : _a.stream) != null && isReadable(request2.body.stream)) { - request2.body.stream.cancel(error).catch((err) => { + if (((_a = request4.body) == null ? void 0 : _a.stream) != null && isReadable(request4.body.stream)) { + request4.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -34035,7 +34035,7 @@ var require_fetch2 = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -34048,9 +34048,9 @@ var require_fetch2 = __commonJS({ assert(dispatcher); let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currentTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -34058,7 +34058,7 @@ var require_fetch2 = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -34068,32 +34068,32 @@ var require_fetch2 = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a = request4.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = request2.client.origin; + if (request4.origin === "client") { + request4.origin = request4.client.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept", true)) { + if (!request4.headersList.contains("accept", true)) { const value = "*/*"; - request2.headersList.append("accept", value, true); + request4.headersList.append("accept", value, true); } - if (!request2.headersList.contains("accept-language", true)) { - request2.headersList.append("accept-language", "*", true); + if (!request4.headersList.contains("accept-language", true)) { + request4.headersList.append("accept-language", "*", true); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -34101,41 +34101,41 @@ var require_fetch2 = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; response = await schemeFetch(fetchParams); - } else if (request2.mode === "same-origin") { + } else if (request4.mode === "same-origin") { response = makeNetworkError('request mode cannot be "same-origin"'); - } else if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + } else if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { response = makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } else { - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; response = await schemeFetch(fetchParams); } - } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { response = makeNetworkError("URL scheme must be a HTTP(S) scheme"); } else { - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; response = await httpFetch(fetchParams); } } @@ -34143,13 +34143,13 @@ var require_fetch2 = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -34157,26 +34157,26 @@ var require_fetch2 = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range", true)) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range", true)) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -34192,8 +34192,8 @@ var require_fetch2 = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -34202,19 +34202,19 @@ var require_fetch2 = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("node:buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blob = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !webidl.is.Blob(blob)) { + if (request4.method !== "GET" || !webidl.is.Blob(blob)) { return Promise.resolve(makeNetworkError("invalid method")); } const response = makeResponse(); const fullLength = blob.size; const serializedFullLength = isomorphicEncode(`${fullLength}`); const type = blob.type; - if (!request2.headersList.contains("range", true)) { + if (!request4.headersList.contains("range", true)) { const bodyWithType = extractBody(blob); response.statusText = "OK"; response.body = bodyWithType[0]; @@ -34222,7 +34222,7 @@ var require_fetch2 = __commonJS({ response.headersList.set("content-type", type, true); } else { response.rangeRequested = true; - const rangeHeader = request2.headersList.get("range", true); + const rangeHeader = request4.headersList.get("range", true); const rangeValue = simpleRangeHeaderValue(rangeHeader, true); if (rangeValue === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34253,7 +34253,7 @@ var require_fetch2 = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34342,41 +34342,41 @@ var require_fetch2 = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(void 0, false); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -34386,13 +34386,13 @@ var require_fetch2 = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -34403,63 +34403,63 @@ var require_fetch2 = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization", true); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie", true); - request2.headersList.delete("host", true); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization", true); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie", true); + request4.headersList.delete("host", true); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = cloneRequest(request2); + httpRequest = cloneRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -34536,7 +34536,7 @@ var require_fetch2 = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -34544,7 +34544,7 @@ var require_fetch2 = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -34574,21 +34574,21 @@ var require_fetch2 = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -34617,7 +34617,7 @@ var require_fetch2 = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -34728,17 +34728,17 @@ var require_fetch2 = __commonJS({ } return response; function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: agent.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -34774,8 +34774,8 @@ var require_fetch2 = __commonJS({ location = headersList.get("location", true); this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status); - if (codings.length !== 0 && request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = location && request4.redirect === "follow" && redirectStatusSet.has(status); + if (codings.length !== 0 && request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (let i = codings.length - 1; i >= 0; --i) { const coding = codings[i]; if (coding === "x-gzip" || coding === "gzip") { @@ -34917,32 +34917,32 @@ var require_cache4 = __commonJS({ webidl.util.markAsUncloneable(this); this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.match"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - const p = this.#internalMatchAll(request2, options, 1); + const p = this.#internalMatchAll(request4, options, 1); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.matchAll"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - return this.#internalMatchAll(request2, options); + return this.#internalMatchAll(request4, options); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); const prefix = "Cache.add"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -34952,19 +34952,19 @@ var require_cache4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); const responsePromises = []; const requestList = []; - for (let request2 of requests) { - if (request2 === void 0) { + for (let request4 of requests) { + if (request4 === void 0) { throw webidl.errors.conversionFailed({ prefix, argument: "Argument 1", types: ["undefined is not allowed"] }); } - request2 = webidl.converters.RequestInfo(request2); - if (typeof request2 === "string") { + request4 = webidl.converters.RequestInfo(request4); + if (typeof request4 === "string") { continue; } - const r = getRequestState(request2); + const r = getRequestState(request4); if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: prefix, @@ -34973,8 +34973,8 @@ var require_cache4 = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = getRequestState(new Request(request2)); + for (const request4 of requests) { + const r = getRequestState(new Request(request4)); if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: prefix, @@ -35048,17 +35048,17 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); const prefix = "Cache.put"; webidl.argumentLengthCheck(arguments, 2, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); response = webidl.converters.Response(response, prefix, "response"); let innerRequest = null; - if (webidl.is.Request(request2)) { - innerRequest = getRequestState(request2); + if (webidl.is.Request(request4)) { + innerRequest = getRequestState(request4); } else { - innerRequest = getRequestState(new Request(request2)); + innerRequest = getRequestState(new Request(request4)); } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -35126,21 +35126,21 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.delete"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = getRequestState(new Request(request2)); + assert(typeof request4 === "string"); + r = getRequestState(new Request(request4)); } const operations = []; const operation = { @@ -35166,26 +35166,26 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.keys"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -35197,9 +35197,9 @@ var require_cache4 = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = fromInnerRequest( - request3, + request5, void 0, new AbortController().signal, "immutable" @@ -35298,9 +35298,9 @@ var require_cache4 = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -35316,7 +35316,7 @@ var require_cache4 = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -35324,20 +35324,20 @@ var require_cache4 = __commonJS({ } return true; } - #internalMatchAll(request2, options, maxResponses = Infinity) { + #internalMatchAll(request4, options, maxResponses = Infinity) { let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -35425,21 +35425,21 @@ var require_cachestorage2 = __commonJS({ } webidl.util.markAsUncloneable(this); } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, "CacheStorage.match"); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -36529,7 +36529,7 @@ var require_connection2 = __commonJS({ function establishWebSocketConnection(url, protocols, client, handler2, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], client, serviceWorkers: "none", @@ -36541,18 +36541,18 @@ var require_connection2 = __commonJS({ }); if (options.headers) { const headersList = getHeadersList(new Headers(options.headers)); - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue, true); - request2.headersList.append("sec-websocket-version", "13", true); + request4.headersList.append("sec-websocket-key", keyValue, true); + request4.headersList.append("sec-websocket-version", "13", true); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol, true); + request4.headersList.append("sec-websocket-protocol", protocol, true); } const permessageDeflate = "permessage-deflate; client_max_window_bits"; - request2.headersList.append("sec-websocket-extensions", permessageDeflate, true); + request4.headersList.append("sec-websocket-extensions", permessageDeflate, true); const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher, processResponse(response) { @@ -36593,7 +36593,7 @@ var require_connection2 = __commonJS({ } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); if (secProtocol !== null) { - const requestProtocols = getDecodeSplit("sec-websocket-protocol", request2.headersList); + const requestProtocols = getDecodeSplit("sec-websocket-protocol", request4.headersList); if (!requestProtocols.includes(secProtocol)) { failWebsocketConnection(handler2, 1002, "Protocol was not set in the opening handshake."); return; @@ -38793,24 +38793,24 @@ var require_dist_node3 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - endpoint: () => endpoint2 + endpoint: () => endpoint4 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node2(); - var VERSION13 = "9.0.5"; - var userAgent2 = `octokit-endpoint.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; - var DEFAULTS2 = { + var import_universal_user_agent13 = require_dist_node2(); + var VERSION17 = "9.0.5"; + var userAgent4 = `octokit-endpoint.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}`; + var DEFAULTS4 = { method: "GET", baseUrl: "https://api.github.com", headers: { accept: "application/vnd.github.v3+json", - "user-agent": userAgent2 + "user-agent": userAgent4 }, mediaType: { format: "" } }; - function lowercaseKeys2(object) { + function lowercaseKeys4(object) { if (!object) { return {}; } @@ -38819,7 +38819,7 @@ var require_dist_node3 = __commonJS({ return newObj; }, {}); } - function isPlainObject3(value) { + function isPlainObject7(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -38830,21 +38830,21 @@ var require_dist_node3 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - function mergeDeep2(defaults, options) { + function mergeDeep4(defaults, options) { const result = Object.assign({}, defaults); Object.keys(options).forEach((key) => { - if (isPlainObject3(options[key])) { + if (isPlainObject7(options[key])) { if (!(key in defaults)) Object.assign(result, { [key]: options[key] }); else - result[key] = mergeDeep2(defaults[key], options[key]); + result[key] = mergeDeep4(defaults[key], options[key]); } else { Object.assign(result, { [key]: options[key] }); } }); return result; } - function removeUndefinedProperties2(obj) { + function removeUndefinedProperties4(obj) { for (const key in obj) { if (obj[key] === void 0) { delete obj[key]; @@ -38852,7 +38852,7 @@ var require_dist_node3 = __commonJS({ } return obj; } - function merge2(defaults, route, options) { + function merge4(defaults, route, options) { var _a; if (typeof route === "string") { let [method, url] = route.split(" "); @@ -38860,10 +38860,10 @@ var require_dist_node3 = __commonJS({ } else { options = Object.assign({}, route); } - options.headers = lowercaseKeys2(options.headers); - removeUndefinedProperties2(options); - removeUndefinedProperties2(options.headers); - const mergedOptions = mergeDeep2(defaults || {}, options); + options.headers = lowercaseKeys4(options.headers); + removeUndefinedProperties4(options); + removeUndefinedProperties4(options.headers); + const mergedOptions = mergeDeep4(defaults || {}, options); if (options.url === "/graphql") { if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( @@ -38874,7 +38874,7 @@ var require_dist_node3 = __commonJS({ } return mergedOptions; } - function addQueryParameters2(url, parameters) { + function addQueryParameters4(url, parameters) { const separator = /\?/.test(url) ? "&" : "?"; const names = Object.keys(parameters); if (names.length === 0) { @@ -38887,18 +38887,18 @@ var require_dist_node3 = __commonJS({ return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } - var urlVariableRegex2 = /\{[^}]+\}/g; - function removeNonChars2(variableName) { + var urlVariableRegex4 = /\{[^}]+\}/g; + function removeNonChars4(variableName) { return variableName.replace(/^\W+|\W+$/g, "").split(/,/); } - function extractUrlVariableNames2(url) { - const matches = url.match(urlVariableRegex2); + function extractUrlVariableNames4(url) { + const matches = url.match(urlVariableRegex4); if (!matches) { return []; } - return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); + return matches.map(removeNonChars4).reduce((a, b) => a.concat(b), []); } - function omit2(object, keysToOmit) { + function omit4(object, keysToOmit) { const result = { __proto__: null }; for (const key of Object.keys(object)) { if (keysToOmit.indexOf(key) === -1) { @@ -38907,7 +38907,7 @@ var require_dist_node3 = __commonJS({ } return result; } - function encodeReserved2(str) { + function encodeReserved4(str) { return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { if (!/%[0-9A-Fa-f]/.test(part)) { part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); @@ -38915,67 +38915,67 @@ var require_dist_node3 = __commonJS({ return part; }).join(""); } - function encodeUnreserved2(str) { + function encodeUnreserved4(str) { return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { return "%" + c.charCodeAt(0).toString(16).toUpperCase(); }); } - function encodeValue2(operator, value, key) { - value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + function encodeValue4(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved4(value) : encodeUnreserved4(value); if (key) { - return encodeUnreserved2(key) + "=" + value; + return encodeUnreserved4(key) + "=" + value; } else { return value; } } - function isDefined2(value) { + function isDefined4(value) { return value !== void 0 && value !== null; } - function isKeyOperator2(operator) { + function isKeyOperator4(operator) { return operator === ";" || operator === "&" || operator === "?"; } - function getValues2(context3, operator, key, modifier) { + function getValues4(context3, operator, key, modifier) { var value = context3[key], result = []; - if (isDefined2(value) && value !== "") { + if (isDefined4(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { value = value.substring(0, parseInt(modifier, 10)); } result.push( - encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value, isKeyOperator4(operator) ? key : "") ); } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { + value.filter(isDefined4).forEach(function(value2) { result.push( - encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value2, isKeyOperator4(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - result.push(encodeValue2(operator, value[k], k)); + if (isDefined4(value[k])) { + result.push(encodeValue4(operator, value[k], k)); } }); } } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { - tmp.push(encodeValue2(operator, value2)); + value.filter(isDefined4).forEach(function(value2) { + tmp.push(encodeValue4(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - tmp.push(encodeUnreserved2(k)); - tmp.push(encodeValue2(operator, value[k].toString())); + if (isDefined4(value[k])) { + tmp.push(encodeUnreserved4(k)); + tmp.push(encodeValue4(operator, value[k].toString())); } }); } - if (isKeyOperator2(operator)) { - result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + if (isKeyOperator4(operator)) { + result.push(encodeUnreserved4(key) + "=" + tmp.join(",")); } else if (tmp.length !== 0) { result.push(tmp.join(",")); } @@ -38983,23 +38983,23 @@ var require_dist_node3 = __commonJS({ } } else { if (operator === ";") { - if (isDefined2(value)) { - result.push(encodeUnreserved2(key)); + if (isDefined4(value)) { + result.push(encodeUnreserved4(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { - result.push(encodeUnreserved2(key) + "="); + result.push(encodeUnreserved4(key) + "="); } else if (value === "") { result.push(""); } } return result; } - function parseUrl2(template) { + function parseUrl4(template) { return { - expand: expand2.bind(null, template) + expand: expand4.bind(null, template) }; } - function expand2(template, context3) { + function expand4(template, context3) { var operators = ["+", "#", ".", "/", ";", "?", "&"]; template = template.replace( /\{([^\{\}]+)\}|([^\{\}]+)/g, @@ -39013,7 +39013,7 @@ var require_dist_node3 = __commonJS({ } expression.split(/,/g).forEach(function(variable) { var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); - values.push(getValues2(context3, operator, tmp[1], tmp[2] || tmp[3])); + values.push(getValues4(context3, operator, tmp[1], tmp[2] || tmp[3])); }); if (operator && operator !== "+") { var separator = ","; @@ -39027,7 +39027,7 @@ var require_dist_node3 = __commonJS({ return values.join(","); } } else { - return encodeReserved2(literal); + return encodeReserved4(literal); } } ); @@ -39037,13 +39037,13 @@ var require_dist_node3 = __commonJS({ return template.replace(/\/$/, ""); } } - function parse2(options) { + function parse4(options) { var _a; let method = options.method.toUpperCase(); let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); let headers = Object.assign({}, options.headers); let body; - let parameters = omit2(options, [ + let parameters = omit4(options, [ "method", "baseUrl", "url", @@ -39051,13 +39051,13 @@ var require_dist_node3 = __commonJS({ "request", "mediaType" ]); - const urlVariableNames = extractUrlVariableNames2(url); - url = parseUrl2(url).expand(parameters); + const urlVariableNames = extractUrlVariableNames4(url); + url = parseUrl4(url).expand(parameters); if (!/^http/.test(url)) { url = options.baseUrl + url; } const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); - const remainingParameters = omit2(parameters, omittedParameters); + const remainingParameters = omit4(parameters, omittedParameters); const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); if (!isBinaryRequest) { if (options.mediaType.format) { @@ -39079,7 +39079,7 @@ var require_dist_node3 = __commonJS({ } } if (["GET", "HEAD"].includes(method)) { - url = addQueryParameters2(url, remainingParameters); + url = addQueryParameters4(url, remainingParameters); } else { if ("data" in remainingParameters) { body = remainingParameters.data; @@ -39101,20 +39101,20 @@ var require_dist_node3 = __commonJS({ options.request ? { request: options.request } : null ); } - function endpointWithDefaults2(defaults, route, options) { - return parse2(merge2(defaults, route, options)); + function endpointWithDefaults4(defaults, route, options) { + return parse4(merge4(defaults, route, options)); } - function withDefaults4(oldDefaults, newDefaults) { - const DEFAULTS22 = merge2(oldDefaults, newDefaults); - const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + function withDefaults8(oldDefaults, newDefaults) { + const DEFAULTS22 = merge4(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults4.bind(null, DEFAULTS22); return Object.assign(endpoint22, { DEFAULTS: DEFAULTS22, - defaults: withDefaults4.bind(null, DEFAULTS22), - merge: merge2.bind(null, DEFAULTS22), - parse: parse2 + defaults: withDefaults8.bind(null, DEFAULTS22), + merge: merge4.bind(null, DEFAULTS22), + parse: parse4 }); } - var endpoint2 = withDefaults4(null, DEFAULTS2); + var endpoint4 = withDefaults8(null, DEFAULTS4); } }); @@ -39241,14 +39241,14 @@ var require_dist_node5 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - RequestError: () => RequestError2 + RequestError: () => RequestError4 }); module.exports = __toCommonJS(dist_src_exports); var import_deprecation = require_dist_node4(); var import_once = __toESM2(require_once()); var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation)); var logOnceHeaders = (0, import_once.default)((deprecation) => console.warn(deprecation)); - var RequestError2 = class extends Error { + var RequestError4 = class extends Error { constructor(message, statusCode, options) { super(message); if (Error.captureStackTrace) { @@ -39323,13 +39323,13 @@ var require_dist_node6 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - request: () => request2 + request: () => request4 }); module.exports = __toCommonJS(dist_src_exports); - var import_endpoint2 = require_dist_node3(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "8.4.0"; - function isPlainObject3(value) { + var import_endpoint4 = require_dist_node3(); + var import_universal_user_agent13 = require_dist_node(); + var VERSION17 = "8.4.0"; + function isPlainObject7(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -39340,15 +39340,15 @@ var require_dist_node6 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - var import_request_error3 = require_dist_node5(); + var import_request_error6 = require_dist_node5(); function getBufferResponse(response) { return response.arrayBuffer(); } - function fetchWrapper2(requestOptions) { + function fetchWrapper4(requestOptions) { var _a, _b, _c, _d; const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console; const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false; - if (isPlainObject3(requestOptions.body) || Array.isArray(requestOptions.body)) { + if (isPlainObject7(requestOptions.body) || Array.isArray(requestOptions.body)) { requestOptions.body = JSON.stringify(requestOptions.body); } let headers = {}; @@ -39390,7 +39390,7 @@ var require_dist_node6 = __commonJS({ if (status < 400) { return; } - throw new import_request_error3.RequestError(response.statusText, status, { + throw new import_request_error6.RequestError(response.statusText, status, { response: { url, status, @@ -39401,19 +39401,19 @@ var require_dist_node6 = __commonJS({ }); } if (status === 304) { - throw new import_request_error3.RequestError("Not modified", status, { + throw new import_request_error6.RequestError("Not modified", status, { response: { url, status, headers, - data: await getResponseData2(response) + data: await getResponseData4(response) }, request: requestOptions }); } if (status >= 400) { - const data = await getResponseData2(response); - const error = new import_request_error3.RequestError(toErrorMessage2(data), status, { + const data = await getResponseData4(response); + const error = new import_request_error6.RequestError(toErrorMessage4(data), status, { response: { url, status, @@ -39424,7 +39424,7 @@ var require_dist_node6 = __commonJS({ }); throw error; } - return parseSuccessResponseBody ? await getResponseData2(response) : response.body; + return parseSuccessResponseBody ? await getResponseData4(response) : response.body; }).then((data) => { return { status, @@ -39433,7 +39433,7 @@ var require_dist_node6 = __commonJS({ data }; }).catch((error) => { - if (error instanceof import_request_error3.RequestError) + if (error instanceof import_request_error6.RequestError) throw error; else if (error.name === "AbortError") throw error; @@ -39445,12 +39445,12 @@ var require_dist_node6 = __commonJS({ message = error.cause; } } - throw new import_request_error3.RequestError(message, 500, { + throw new import_request_error6.RequestError(message, 500, { request: requestOptions }); }); } - async function getResponseData2(response) { + async function getResponseData4(response) { const contentType = response.headers.get("content-type"); if (/application\/json/.test(contentType)) { return response.json().catch(() => response.text()).catch(() => ""); @@ -39460,7 +39460,7 @@ var require_dist_node6 = __commonJS({ } return getBufferResponse(response); } - function toErrorMessage2(data) { + function toErrorMessage4(data) { if (typeof data === "string") return data; let suffix; @@ -39477,32 +39477,32 @@ var require_dist_node6 = __commonJS({ } return `Unknown error: ${JSON.stringify(data)}`; } - function withDefaults4(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + function withDefaults8(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper2(endpoint2.parse(endpointOptions)); + return fetchWrapper4(endpoint22.parse(endpointOptions)); } const request22 = (route2, parameters2) => { - return fetchWrapper2( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + return fetchWrapper4( + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; Object.assign(request22, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); } - var request2 = withDefaults4(import_endpoint2.endpoint, { + var request4 = withDefaults8(import_endpoint4.endpoint, { headers: { - "user-agent": `octokit-request.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-request.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}` } }); } @@ -39537,8 +39537,8 @@ var require_dist_node7 = __commonJS({ }); module.exports = __toCommonJS(dist_src_exports); var import_request32 = require_dist_node6(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "7.1.0"; + var import_universal_user_agent13 = require_dist_node(); + var VERSION17 = "7.1.0"; var import_request22 = require_dist_node6(); var import_request15 = require_dist_node6(); function _buildMessageForResponseErrors2(data) { @@ -39546,9 +39546,9 @@ var require_dist_node7 = __commonJS({ ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError2 = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors2(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.name = "GraphqlResponseError"; @@ -39570,7 +39570,7 @@ var require_dist_node7 = __commonJS({ ]; var FORBIDDEN_VARIABLE_OPTIONS2 = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX2 = /\/api\/v3\/?$/; - function graphql3(request2, query, options) { + function graphql3(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -39601,11 +39601,11 @@ var require_dist_node7 = __commonJS({ result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX2.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX2, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -39620,25 +39620,25 @@ var require_dist_node7 = __commonJS({ return response.data.data; }); } - function withDefaults4(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); + function withDefaults8(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql3(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults4.bind(null, newRequest), + defaults: withDefaults8.bind(null, newRequest), endpoint: newRequest.endpoint }); } - var graphql22 = withDefaults4(import_request32.request, { + var graphql22 = withDefaults8(import_request32.request, { headers: { - "user-agent": `octokit-graphql.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-graphql.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}` }, method: "POST", url: "/graphql" }); function withCustomRequest2(customRequest) { - return withDefaults4(customRequest, { + return withDefaults8(customRequest, { method: "POST", url: "/graphql" }); @@ -39692,13 +39692,13 @@ var require_dist_node8 = __commonJS({ } return `token ${token}`; } - async function hook6(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( + async function hook6(token, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix2(token); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix2(token); + return request4(endpoint4); } var createTokenAuth3 = function createTokenAuth22(token) { if (!token) { @@ -39743,17 +39743,17 @@ var require_dist_node9 = __commonJS({ Octokit: () => Octokit3 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node(); + var import_universal_user_agent13 = require_dist_node(); var import_before_after_hook2 = require_before_after_hook(); var import_request15 = require_dist_node6(); var import_graphql2 = require_dist_node7(); var import_auth_token2 = require_dist_node8(); - var VERSION13 = "5.2.0"; + var VERSION17 = "5.2.0"; var noop2 = () => { }; var consoleWarn2 = console.warn.bind(console); var consoleError2 = console.error.bind(console); - var userAgentTrail2 = `octokit-core.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; + var userAgentTrail2 = `octokit-core.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}`; var _a; var Octokit3 = (_a = class { static defaults(defaults) { @@ -39856,7 +39856,7 @@ var require_dist_node9 = __commonJS({ } } }, (() => { - _a.VERSION = VERSION13; + _a.VERSION = VERSION17; })(), (() => { _a.plugins = []; })(), _a); @@ -39890,7 +39890,7 @@ var require_dist_node10 = __commonJS({ restEndpointMethods: () => restEndpointMethods2 }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "10.4.1"; + var VERSION17 = "10.4.1"; var Endpoints2 = { actions: { addCustomLabelsToSelfHostedRunnerForOrg: [ @@ -41882,8 +41882,8 @@ var require_dist_node10 = __commonJS({ var endpoints_default2 = Endpoints2; var endpointMethodsMap2 = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default2)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -42006,7 +42006,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - restEndpointMethods2.VERSION = VERSION13; + restEndpointMethods2.VERSION = VERSION17; function legacyRestEndpointMethods2(octokit) { const api = endpointsToMethods2(octokit); return { @@ -42014,7 +42014,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - legacyRestEndpointMethods2.VERSION = VERSION13; + legacyRestEndpointMethods2.VERSION = VERSION17; } }); @@ -42047,7 +42047,7 @@ var require_dist_node11 = __commonJS({ paginatingEndpoints: () => paginatingEndpoints }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "9.2.1"; + var VERSION17 = "9.2.1"; function normalizePaginatedListResponse2(response) { if (!response.data) { return { @@ -42393,7 +42393,7 @@ var require_dist_node11 = __commonJS({ }) }; } - paginateRest2.VERSION = VERSION13; + paginateRest2.VERSION = VERSION17; } }); @@ -42524,7 +42524,7 @@ var require_fast_content_type_parse = __commonJS({ var defaultContentType = { type: "", parameters: new NullObject() }; Object.freeze(defaultContentType.parameters); Object.freeze(defaultContentType); - function parse2(header) { + function parse4(header) { if (typeof header !== "string") { throw new TypeError("argument header is required and must be a string"); } @@ -42562,7 +42562,7 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - function safeParse2(header) { + function safeParse4(header) { if (typeof header !== "string") { return defaultContentType; } @@ -42600,9 +42600,9 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - module.exports.default = { parse: parse2, safeParse: safeParse2 }; - module.exports.parse = parse2; - module.exports.safeParse = safeParse2; + module.exports.default = { parse: parse4, safeParse: safeParse4 }; + module.exports.parse = parse4; + module.exports.safeParse = safeParse4; module.exports.defaultContentType = defaultContentType; } }); @@ -42819,9 +42819,9 @@ function addQueryParameters(url, parameters) { return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } -var urlVariableRegex = /\{[^}]+\}/g; +var urlVariableRegex = /\{[^{}}]+\}/g; function removeNonChars(variableName) { - return variableName.replace(/^\W+|\W+$/g, "").split(/,/); + return variableName.replace(/(?:^\W+)|(?:(? { const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; return `application/vnd.github.${preview}-preview${format}`; @@ -43037,12 +43037,12 @@ function endpointWithDefaults(defaults, route, options) { return parse(merge(defaults, route, options)); } function withDefaults(oldDefaults, newDefaults) { - const DEFAULTS2 = merge(oldDefaults, newDefaults); - const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2); - return Object.assign(endpoint2, { - DEFAULTS: DEFAULTS2, - defaults: withDefaults.bind(null, DEFAULTS2), - merge: merge.bind(null, DEFAULTS2), + const DEFAULTS22 = merge(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults.bind(null, DEFAULTS22), + merge: merge.bind(null, DEFAULTS22), parse }); } @@ -43071,7 +43071,7 @@ var RequestError = class extends Error { if (options.request.headers.authorization) { requestCopy.headers = Object.assign({}, options.request.headers, { authorization: options.request.headers.authorization.replace( - / .*$/, + /(?]+)>; rel="deprecation"/); + const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/); const deprecationLink = matches && matches.pop(); log.warn( `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` @@ -43234,40 +43234,570 @@ function toErrorMessage(data) { return `Unknown error: ${JSON.stringify(data)}`; } function withDefaults2(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper(endpoint2.parse(endpointOptions)); + return fetchWrapper(endpoint22.parse(endpointOptions)); } - const request2 = (route2, parameters2) => { + const request22 = (route2, parameters2) => { return fetchWrapper( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; - Object.assign(request2, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); - return endpointOptions.request.hook(request2, endpointOptions); + return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); } var request = withDefaults2(endpoint, defaults_default); // var VERSION3 = "0.0.0-development"; +var userAgent2 = `octokit-endpoint.js/${VERSION3} ${getUserAgent()}`; +var DEFAULTS2 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent2 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys2(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject3(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep2(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject3(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep2(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties2(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge2(defaults, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys2(options.headers); + removeUndefinedProperties2(options); + removeUndefinedProperties2(options.headers); + const mergedOptions = mergeDeep2(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters2(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex2 = /\{[^}]+\}/g; +function removeNonChars2(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames2(url) { + const matches = url.match(urlVariableRegex2); + if (!matches) { + return []; + } + return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); +} +function omit2(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved2(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved2(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue2(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + if (key) { + return encodeUnreserved2(key) + "=" + value; + } else { + return value; + } +} +function isDefined2(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator2(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues2(context3, operator, key, modifier) { + var value = context3[key], result = []; + if (isDefined2(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + result.push( + encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + result.push(encodeValue2(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + tmp.push(encodeValue2(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + tmp.push(encodeUnreserved2(k)); + tmp.push(encodeValue2(operator, value[k].toString())); + } + }); + } + if (isKeyOperator2(operator)) { + result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined2(value)) { + result.push(encodeUnreserved2(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved2(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl2(template) { + return { + expand: expand2.bind(null, template) + }; +} +function expand2(template, context3) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues2(context3, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved2(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse2(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit2(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames2(url); + url = parseUrl2(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit2(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters2(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults2(defaults, route, options) { + return parse2(merge2(defaults, route, options)); +} +function withDefaults3(oldDefaults, newDefaults) { + const DEFAULTS22 = merge2(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults3.bind(null, DEFAULTS22), + merge: merge2.bind(null, DEFAULTS22), + parse: parse2 + }); +} +var endpoint2 = withDefaults3(null, DEFAULTS2); + +// +var import_fast_content_type_parse2 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError2 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION4 = "0.0.0-development"; +var defaults_default2 = { + headers: { + "user-agent": `octokit-request.js/${VERSION4} ${getUserAgent()}` + } +}; +function isPlainObject4(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper2(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch2 = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject4(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error) { + let message = "Unknown Error"; + if (error instanceof Error) { + if (error.name === "AbortError") { + error.status = 500; + throw error; + } + message = error.message; + if (error.name === "TypeError" && "cause" in error) { + if (error.cause instanceof Error) { + message = error.cause.message; + } else if (typeof error.cause === "string") { + message = error.cause; + } + } + } + const requestError = new RequestError2(message, 500, { + request: requestOptions + }); + requestError.cause = error; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError2(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2(toErrorMessage2(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData2(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData2(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse2.safeParse)(contentType); + if (isJSONResponse2(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse2(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage2(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults4(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper2(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper2( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); +} +var request2 = withDefaults4(endpoint2, defaults_default2); + +// +var VERSION5 = "0.0.0-development"; function _buildMessageForResponseErrors(data) { return `Request failed due to following response errors: ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.errors = response.errors; @@ -43292,7 +43822,7 @@ var NON_VARIABLE_OPTIONS = [ ]; var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; -function graphql(request2, query, options) { +function graphql(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -43323,11 +43853,11 @@ function graphql(request2, query, options) { result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -43342,25 +43872,25 @@ function graphql(request2, query, options) { return response.data.data; }); } -function withDefaults3(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); +function withDefaults5(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults3.bind(null, newRequest), + defaults: withDefaults5.bind(null, newRequest), endpoint: newRequest.endpoint }); } -var graphql2 = withDefaults3(request, { +var graphql2 = withDefaults5(request2, { headers: { - "user-agent": `octokit-graphql.js/${VERSION3} ${getUserAgent()}` + "user-agent": `octokit-graphql.js/${VERSION5} ${getUserAgent()}` }, method: "POST", url: "/graphql" }); function withCustomRequest(customRequest) { - return withDefaults3(customRequest, { + return withDefaults5(customRequest, { method: "POST", url: "/graphql" }); @@ -43388,13 +43918,13 @@ function withAuthorizationPrefix(token) { } return `token ${token}`; } -async function hook(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( +async function hook(token, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix(token); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix(token); + return request4(endpoint4); } var createTokenAuth = function createTokenAuth2(token) { if (!token) { @@ -43412,14 +43942,14 @@ var createTokenAuth = function createTokenAuth2(token) { }; // -var VERSION4 = "6.1.3"; +var VERSION6 = "6.1.4"; // var noop = () => { }; var consoleWarn = console.warn.bind(console); var consoleError = console.error.bind(console); -var userAgentTrail = `octokit-core.js/${VERSION4} ${getUserAgent()}`; +var userAgentTrail = `octokit-core.js/${VERSION6} ${getUserAgent()}`; var Octokit = class { static defaults(defaults) { const OctokitWithDefaults = class extends this { @@ -43524,20 +44054,20 @@ var Octokit = class { hook; auth; }; -__publicField(Octokit, "VERSION", VERSION4); +__publicField(Octokit, "VERSION", VERSION6); __publicField(Octokit, "plugins", []); // -var VERSION5 = "5.3.1"; +var VERSION7 = "5.3.1"; // function requestLog(octokit) { - octokit.hook.wrap("request", (request2, options) => { + octokit.hook.wrap("request", (request4, options) => { octokit.log.debug("request", options); const start = Date.now(); const requestOptions = octokit.request.endpoint.parse(options); const path = requestOptions.url.replace(options.baseUrl, ""); - return request2(options).then((response) => { + return request4(options).then((response) => { const requestId = response.headers["x-github-request-id"]; octokit.log.info( `${requestOptions.method} ${path} - ${response.status} with id ${requestId} in ${Date.now() - start}ms` @@ -43553,10 +44083,10 @@ function requestLog(octokit) { }); }); } -requestLog.VERSION = VERSION5; +requestLog.VERSION = VERSION7; // -var VERSION6 = "0.0.0-development"; +var VERSION8 = "0.0.0-development"; function normalizePaginatedListResponse(response) { if (!response.data) { return { @@ -43600,7 +44130,7 @@ function iterator(octokit, route, parameters) { const response = await requestMethod({ method, url, headers }); const normalizedResponse = normalizePaginatedListResponse(response); url = ((normalizedResponse.headers.link || "").match( - /<([^>]+)>;\s*rel="next"/ + /<([^<>]+)>;\s*rel="next"/ ) || [])[1]; return { value: normalizedResponse }; } catch (error) { @@ -43659,10 +44189,10 @@ function paginateRest(octokit) { }) }; } -paginateRest.VERSION = VERSION6; +paginateRest.VERSION = VERSION8; // -var VERSION7 = "13.3.1"; +var VERSION9 = "13.3.1"; // var Endpoints = { @@ -45735,8 +46265,8 @@ var endpoints_default = Endpoints; // var endpointMethodsMap = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -45861,7 +46391,7 @@ function restEndpointMethods(octokit) { rest: api }; } -restEndpointMethods.VERSION = VERSION7; +restEndpointMethods.VERSION = VERSION9; function legacyRestEndpointMethods(octokit) { const api = endpointsToMethods(octokit); return { @@ -45869,15 +46399,15 @@ function legacyRestEndpointMethods(octokit) { rest: api }; } -legacyRestEndpointMethods.VERSION = VERSION7; +legacyRestEndpointMethods.VERSION = VERSION9; // -var VERSION8 = "21.1.0"; +var VERSION10 = "21.1.1"; // var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRest).defaults( { - userAgent: `octokit-rest.js/${VERSION8}` + userAgent: `octokit-rest.js/${VERSION10}` } ); @@ -46147,25 +46677,25 @@ var allLabels = { var import_core2 = __toESM(require_core()); // -function requestToOAuthBaseUrl(request2) { - const endpointDefaults = request2.endpoint.DEFAULTS; +function requestToOAuthBaseUrl(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); } -async function oauthRequest(request2, route, parameters) { +async function oauthRequest(request4, route, parameters) { const withOAuthParameters = { - baseUrl: requestToOAuthBaseUrl(request2), + baseUrl: requestToOAuthBaseUrl(request4), headers: { accept: "application/json" }, ...parameters }; - const response = await request2(route, withOAuthParameters); + const response = await request4(route, withOAuthParameters); if ("error" in response.data) { const error = new RequestError( `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, 400, { - request: request2.endpoint.merge( + request: request4.endpoint.merge( route, withOAuthParameters ) @@ -46176,32 +46706,43 @@ async function oauthRequest(request2, route, parameters) { } return response; } -async function exchangeWebFlowCode(options) { - const request2 = options.request || request; +async function createDeviceCode(options) { + const request4 = options.request || request; + const parameters = { + client_id: options.clientId + }; + if ("scopes" in options && Array.isArray(options.scopes)) { + parameters.scope = options.scopes.join(" "); + } + return oauthRequest(request4, "POST /login/device/code", parameters); +} +async function exchangeDeviceCode(options) { + const request4 = options.request || request; const response = await oauthRequest( - request2, + request4, "POST /login/oauth/access_token", { client_id: options.clientId, - client_secret: options.clientSecret, - code: options.code, - redirect_uri: options.redirectUrl + device_code: options.code, + grant_type: "urn:ietf:params:oauth:grant-type:device_code" } ); const authentication = { clientType: options.clientType, clientId: options.clientId, - clientSecret: options.clientSecret, token: response.data.access_token, scopes: response.data.scope.split(/\s+/).filter(Boolean) }; + if ("clientSecret" in options) { + authentication.clientSecret = options.clientSecret; + } if (options.clientType === "github-app") { if ("refresh_token" in response.data) { const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp( + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( apiTimeInMs, response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp( + ), authentication.refreshTokenExpiresAt = toTimestamp2( apiTimeInMs, response.data.refresh_token_expires_in ); @@ -46210,46 +46751,722 @@ async function exchangeWebFlowCode(options) { } return { ...response, authentication }; } -function toTimestamp(apiTimeInMs, expirationInSeconds) { +function toTimestamp2(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } -async function createDeviceCode(options) { - const request2 = options.request || request; - const parameters = { - client_id: options.clientId + +// +async function getOAuthAccessToken(state, options) { + const cachedAuthentication = getCachedAuthentication(state, options.auth); + if (cachedAuthentication) + return cachedAuthentication; + const { data: verification } = await createDeviceCode({ + clientType: state.clientType, + clientId: state.clientId, + request: options.request || state.request, + scopes: options.auth.scopes || state.scopes + }); + await state.onVerification(verification); + const authentication = await waitForAccessToken( + options.request || state.request, + state.clientId, + state.clientType, + verification + ); + state.authentication = authentication; + return authentication; +} +function getCachedAuthentication(state, auth22) { + if (auth22.refresh === true) + return false; + if (!state.authentication) + return false; + if (state.clientType === "github-app") { + return state.authentication; + } + const authentication = state.authentication; + const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( + " " + ); + const currentScope = authentication.scopes.join(" "); + return newScope === currentScope ? authentication : false; +} +async function wait(seconds) { + await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); +} +async function waitForAccessToken(request4, clientId, clientType, verification) { + try { + const options = { + clientId, + request: request4, + code: verification.device_code + }; + const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ + ...options, + clientType: "oauth-app" + }) : await exchangeDeviceCode({ + ...options, + clientType: "github-app" + }); + return { + type: "token", + tokenType: "oauth", + ...authentication + }; + } catch (error) { + if (!error.response) + throw error; + const errorType = error.response.data.error; + if (errorType === "authorization_pending") { + await wait(verification.interval); + return waitForAccessToken(request4, clientId, clientType, verification); + } + if (errorType === "slow_down") { + await wait(verification.interval + 5); + return waitForAccessToken(request4, clientId, clientType, verification); + } + throw error; + } +} +async function auth2(state, authOptions) { + return getOAuthAccessToken(state, { + auth: authOptions + }); +} +async function hook2(state, request4, route, parameters) { + let endpoint4 = request4.endpoint.merge( + route, + parameters + ); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); + } + const { token } = await getOAuthAccessToken(state, { + request: request4, + auth: { type: "oauth" } + }); + endpoint4.headers.authorization = `token ${token}`; + return request4(endpoint4); +} +var VERSION11 = "0.0.0-development"; +function createOAuthDeviceAuth(options) { + const requestWithDefaults = options.request || request.defaults({ + headers: { + "user-agent": `octokit-auth-oauth-device.js/${VERSION11} ${getUserAgent()}` + } + }); + const { request: request4 = requestWithDefaults, ...otherOptions } = options; + const state = options.clientType === "github-app" ? { + ...otherOptions, + clientType: "github-app", + request: request4 + } : { + ...otherOptions, + clientType: "oauth-app", + request: request4, + scopes: options.scopes || [] }; - if ("scopes" in options && Array.isArray(options.scopes)) { - parameters.scope = options.scopes.join(" "); + if (!options.clientId) { + throw new Error( + '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' + ); + } + if (!options.onVerification) { + throw new Error( + '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' + ); } - return oauthRequest(request2, "POST /login/device/code", parameters); + return Object.assign(auth2.bind(null, state), { + hook: hook2.bind(null, state) + }); } -async function exchangeDeviceCode(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + +// +var VERSION12 = "0.0.0-development"; +var userAgent3 = `octokit-endpoint.js/${VERSION12} ${getUserAgent()}`; +var DEFAULTS3 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent3 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys3(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject5(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep3(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject5(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep3(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties3(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge3(defaults, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys3(options.headers); + removeUndefinedProperties3(options); + removeUndefinedProperties3(options.headers); + const mergedOptions = mergeDeep3(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters3(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex3 = /\{[^}]+\}/g; +function removeNonChars3(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames3(url) { + const matches = url.match(urlVariableRegex3); + if (!matches) { + return []; + } + return matches.map(removeNonChars3).reduce((a, b) => a.concat(b), []); +} +function omit3(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved3(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved3(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue3(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved3(value) : encodeUnreserved3(value); + if (key) { + return encodeUnreserved3(key) + "=" + value; + } else { + return value; + } +} +function isDefined3(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator3(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues3(context3, operator, key, modifier) { + var value = context3[key], result = []; + if (isDefined3(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue3(operator, value, isKeyOperator3(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + result.push( + encodeValue3(operator, value2, isKeyOperator3(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + result.push(encodeValue3(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + tmp.push(encodeValue3(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + tmp.push(encodeUnreserved3(k)); + tmp.push(encodeValue3(operator, value[k].toString())); + } + }); + } + if (isKeyOperator3(operator)) { + result.push(encodeUnreserved3(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined3(value)) { + result.push(encodeUnreserved3(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved3(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl3(template) { + return { + expand: expand3.bind(null, template) + }; +} +function expand3(template, context3) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues3(context3, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved3(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse3(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit3(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames3(url); + url = parseUrl3(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit3(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters3(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults3(defaults, route, options) { + return parse3(merge3(defaults, route, options)); +} +function withDefaults6(oldDefaults, newDefaults) { + const DEFAULTS22 = merge3(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults3.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults6.bind(null, DEFAULTS22), + merge: merge3.bind(null, DEFAULTS22), + parse: parse3 + }); +} +var endpoint3 = withDefaults6(null, DEFAULTS3); + +// +var import_fast_content_type_parse3 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError3 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION13 = "0.0.0-development"; +var defaults_default3 = { + headers: { + "user-agent": `octokit-request.js/${VERSION13} ${getUserAgent()}` + } +}; +function isPlainObject6(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper3(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch2 = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject6(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error) { + let message = "Unknown Error"; + if (error instanceof Error) { + if (error.name === "AbortError") { + error.status = 500; + throw error; + } + message = error.message; + if (error.name === "TypeError" && "cause" in error) { + if (error.cause instanceof Error) { + message = error.cause.message; + } else if (typeof error.cause === "string") { + message = error.cause; + } + } + } + const requestError = new RequestError3(message, 500, { + request: requestOptions + }); + requestError.cause = error; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError3(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3(toErrorMessage3(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData3(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData3(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse3.safeParse)(contentType); + if (isJSONResponse3(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse3(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage3(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults7(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper3(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper3( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults7.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults7.bind(null, endpoint22) + }); +} +var request3 = withDefaults7(endpoint3, defaults_default3); + +// +function requestToOAuthBaseUrl2(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; + return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); +} +async function oauthRequest2(request4, route, parameters) { + const withOAuthParameters = { + baseUrl: requestToOAuthBaseUrl2(request4), + headers: { + accept: "application/json" + }, + ...parameters + }; + const response = await request4(route, withOAuthParameters); + if ("error" in response.data) { + const error = new RequestError3( + `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, + 400, + { + request: request4.endpoint.merge( + route, + withOAuthParameters + ) + } + ); + error.response = response; + throw error; + } + return response; +} +async function exchangeWebFlowCode(options) { + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, - device_code: options.code, - grant_type: "urn:ietf:params:oauth:grant-type:device_code" + client_secret: options.clientSecret, + code: options.code, + redirect_uri: options.redirectUrl } ); const authentication = { clientType: options.clientType, clientId: options.clientId, + clientSecret: options.clientSecret, token: response.data.access_token, scopes: response.data.scope.split(/\s+/).filter(Boolean) }; - if ("clientSecret" in options) { - authentication.clientSecret = options.clientSecret; - } if (options.clientType === "github-app") { if ("refresh_token" in response.data) { const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp( apiTimeInMs, response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp2( + ), authentication.refreshTokenExpiresAt = toTimestamp( apiTimeInMs, response.data.refresh_token_expires_in ); @@ -46258,12 +47475,12 @@ async function exchangeDeviceCode(options) { } return { ...response, authentication }; } -function toTimestamp2(apiTimeInMs, expirationInSeconds) { +function toTimestamp(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function checkToken(options) { - const request2 = options.request || request; - const response = await request2("POST /applications/{client_id}/token", { + const request4 = options.request || request3; + const response = await request4("POST /applications/{client_id}/token", { headers: { authorization: `basic ${btoa( `${options.clientId}:${options.clientSecret}` @@ -46287,9 +47504,9 @@ async function checkToken(options) { return { ...response, authentication }; } async function refreshToken(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, @@ -46317,9 +47534,9 @@ function toTimestamp3(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function resetToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - const response = await request2( + const response = await request4( "PATCH /applications/{client_id}/token", { headers: { @@ -46344,9 +47561,9 @@ async function resetToken(options) { return { ...response, authentication }; } async function deleteToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/token", { headers: { @@ -46358,9 +47575,9 @@ async function deleteToken(options) { ); } async function deleteAuthorization(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/grant", { headers: { @@ -46373,133 +47590,7 @@ async function deleteAuthorization(options) { } // -async function getOAuthAccessToken(state, options) { - const cachedAuthentication = getCachedAuthentication(state, options.auth); - if (cachedAuthentication) - return cachedAuthentication; - const { data: verification } = await createDeviceCode({ - clientType: state.clientType, - clientId: state.clientId, - request: options.request || state.request, - scopes: options.auth.scopes || state.scopes - }); - await state.onVerification(verification); - const authentication = await waitForAccessToken( - options.request || state.request, - state.clientId, - state.clientType, - verification - ); - state.authentication = authentication; - return authentication; -} -function getCachedAuthentication(state, auth22) { - if (auth22.refresh === true) - return false; - if (!state.authentication) - return false; - if (state.clientType === "github-app") { - return state.authentication; - } - const authentication = state.authentication; - const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( - " " - ); - const currentScope = authentication.scopes.join(" "); - return newScope === currentScope ? authentication : false; -} -async function wait(seconds) { - await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); -} -async function waitForAccessToken(request2, clientId, clientType, verification) { - try { - const options = { - clientId, - request: request2, - code: verification.device_code - }; - const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ - ...options, - clientType: "oauth-app" - }) : await exchangeDeviceCode({ - ...options, - clientType: "github-app" - }); - return { - type: "token", - tokenType: "oauth", - ...authentication - }; - } catch (error) { - if (!error.response) - throw error; - const errorType = error.response.data.error; - if (errorType === "authorization_pending") { - await wait(verification.interval); - return waitForAccessToken(request2, clientId, clientType, verification); - } - if (errorType === "slow_down") { - await wait(verification.interval + 5); - return waitForAccessToken(request2, clientId, clientType, verification); - } - throw error; - } -} -async function auth2(state, authOptions) { - return getOAuthAccessToken(state, { - auth: authOptions - }); -} -async function hook2(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( - route, - parameters - ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); - } - const { token } = await getOAuthAccessToken(state, { - request: request2, - auth: { type: "oauth" } - }); - endpoint2.headers.authorization = `token ${token}`; - return request2(endpoint2); -} -var VERSION9 = "0.0.0-development"; -function createOAuthDeviceAuth(options) { - const requestWithDefaults = options.request || request.defaults({ - headers: { - "user-agent": `octokit-auth-oauth-device.js/${VERSION9} ${getUserAgent()}` - } - }); - const { request: request2 = requestWithDefaults, ...otherOptions } = options; - const state = options.clientType === "github-app" ? { - ...otherOptions, - clientType: "github-app", - request: request2 - } : { - ...otherOptions, - clientType: "oauth-app", - request: request2, - scopes: options.scopes || [] - }; - if (!options.clientId) { - throw new Error( - '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - if (!options.onVerification) { - throw new Error( - '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - return Object.assign(auth2.bind(null, state), { - hook: hook2.bind(null, state) - }); -} - -// -var VERSION10 = "0.0.0-development"; +var VERSION14 = "0.0.0-development"; async function getAuthentication(state) { if ("code" in state.strategyOptions) { const { authentication } = await exchangeWebFlowCode({ @@ -46635,30 +47726,30 @@ var ROUTES_REQUIRING_BASIC_AUTH = /\/applications\/[^/]+\/(token|grant)s?/; function requiresBasicAuth(url) { return url && ROUTES_REQUIRING_BASIC_AUTH.test(url); } -async function hook3(state, request2, route, parameters = {}) { - const endpoint2 = request2.endpoint.merge( +async function hook3(state, request4, route, parameters = {}) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); } - if (requiresBasicAuth(endpoint2.url)) { + if (requiresBasicAuth(endpoint4.url)) { const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; - return request2(endpoint2); + endpoint4.headers.authorization = `basic ${credentials}`; + return request4(endpoint4); } - const { token } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request2 }) : await auth3({ ...state, request: request2 }); - endpoint2.headers.authorization = "token " + token; - return request2(endpoint2); + const { token } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request4 }) : await auth3({ ...state, request: request4 }); + endpoint4.headers.authorization = "token " + token; + return request4(endpoint4); } function createOAuthUserAuth({ clientId, clientSecret, clientType = "oauth-app", - request: request2 = request.defaults({ + request: request4 = request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION10} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION14} ${getUserAgent()}` } }), onTokenCreated, @@ -46670,13 +47761,13 @@ function createOAuthUserAuth({ clientSecret, onTokenCreated, strategyOptions, - request: request2 + request: request4 }); return Object.assign(auth3.bind(null, state), { hook: hook3.bind(null, state) }); } -createOAuthUserAuth.VERSION = VERSION10; +createOAuthUserAuth.VERSION = VERSION14; // async function auth4(state, authOptions) { @@ -46715,37 +47806,37 @@ async function auth4(state, authOptions) { }); return userAuth(); } -async function hook4(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( +async function hook4(state, request22, route, parameters) { + let endpoint4 = request22.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request22(endpoint4); } - if (state.clientType === "github-app" && !requiresBasicAuth(endpoint2.url)) { + if (state.clientType === "github-app" && !requiresBasicAuth(endpoint4.url)) { throw new Error( - `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint2.method} ${endpoint2.url}" is not supported.` + `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint4.method} ${endpoint4.url}" is not supported.` ); } const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; + endpoint4.headers.authorization = `basic ${credentials}`; try { - return await request2(endpoint2); + return await request22(endpoint4); } catch (error) { if (error.status !== 401) throw error; - error.message = `[@octokit/auth-oauth-app] "${endpoint2.method} ${endpoint2.url}" does not support clientId/clientSecret basic authentication.`; + error.message = `[@octokit/auth-oauth-app] "${endpoint4.method} ${endpoint4.url}" does not support clientId/clientSecret basic authentication.`; throw error; } } -var VERSION11 = "0.0.0-development"; +var VERSION15 = "0.0.0-development"; function createOAuthAppAuth(options) { const state = Object.assign( { request: request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION11} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION15} ${getUserAgent()}` } }), clientType: "oauth-app" @@ -47189,7 +48280,7 @@ async function getInstallationAuthentication(state, options, customRequest) { } } const appAuthentication = await getAppAuthentication(state); - const request2 = customRequest || state.request; + const request4 = customRequest || state.request; const payload = { installation_id: installationId, mediaType: { @@ -47219,7 +48310,7 @@ async function getInstallationAuthentication(state, options, customRequest) { repository_selection: repositorySelectionOptional, single_file: singleFileName } - } = await request2( + } = await request4( "POST /app/installations/{installation_id}/access_tokens", payload ); @@ -47316,18 +48407,18 @@ function isNotTimeSkewError(error) { /'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/ )); } -async function hook5(state, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge(route, parameters); - const url = endpoint2.url; +async function hook5(state, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge(route, parameters); + const url = endpoint4.url; if (/\/login\/oauth\/access_token$/.test(url)) { - return request2(endpoint2); + return request4(endpoint4); } - if (requiresAppAuth(url.replace(request2.endpoint.DEFAULTS.baseUrl, ""))) { + if (requiresAppAuth(url.replace(request4.endpoint.DEFAULTS.baseUrl, ""))) { const { token: token2 } = await getAppAuthentication(state); - endpoint2.headers.authorization = `bearer ${token2}`; + endpoint4.headers.authorization = `bearer ${token2}`; let response; try { - response = await request2(endpoint2); + response = await request4(endpoint4); } catch (error) { if (isNotTimeSkewError(error)) { throw error; @@ -47346,33 +48437,33 @@ async function hook5(state, request2, route, parameters) { ...state, timeDifference: diff }); - endpoint2.headers.authorization = `bearer ${token3}`; - return request2(endpoint2); + endpoint4.headers.authorization = `bearer ${token3}`; + return request4(endpoint4); } return response; } if (requiresBasicAuth(url)) { const authentication = await state.oauthApp({ type: "oauth-app" }); - endpoint2.headers.authorization = authentication.headers.authorization; - return request2(endpoint2); + endpoint4.headers.authorization = authentication.headers.authorization; + return request4(endpoint4); } const { token, createdAt } = await getInstallationAuthentication( state, {}, - request2.defaults({ baseUrl: endpoint2.baseUrl }) + request4.defaults({ baseUrl: endpoint4.baseUrl }) ); - endpoint2.headers.authorization = `token ${token}`; + endpoint4.headers.authorization = `token ${token}`; return sendRequestWithRetries( state, - request2, - endpoint2, + request4, + endpoint4, createdAt ); } -async function sendRequestWithRetries(state, request2, options, createdAt, retries = 0) { +async function sendRequestWithRetries(state, request4, options, createdAt, retries = 0) { const timeSinceTokenCreationInMs = +/* @__PURE__ */ new Date() - +new Date(createdAt); try { - return await request2(options); + return await request4(options); } catch (error) { if (error.status !== 401) { throw error; @@ -47389,10 +48480,10 @@ async function sendRequestWithRetries(state, request2, options, createdAt, retri `[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${retries}, wait: ${awaitTime / 1e3}s)` ); await new Promise((resolve) => setTimeout(resolve, awaitTime)); - return sendRequestWithRetries(state, request2, options, createdAt, retries); + return sendRequestWithRetries(state, request4, options, createdAt, retries); } } -var VERSION12 = "7.1.4"; +var VERSION16 = "7.1.5"; function createAppAuth(options) { if (!options.appId) { throw new Error("[@octokit/auth-app] appId option is required"); @@ -47411,14 +48502,14 @@ function createAppAuth(options) { }, options.log ); - const request2 = options.request || request.defaults({ + const request4 = options.request || request.defaults({ headers: { - "user-agent": `octokit-auth-app.js/${VERSION12} ${getUserAgent()}` + "user-agent": `octokit-auth-app.js/${VERSION16} ${getUserAgent()}` } }); const state = Object.assign( { - request: request2, + request: request4, cache: getCache() }, options, @@ -47429,7 +48520,7 @@ function createAppAuth(options) { clientType: "github-app", clientId: options.clientId || "", clientSecret: options.clientSecret || "", - request: request2 + request: request4 }) } ); diff --git a/github-actions/commit-message-based-labels/main.js b/github-actions/commit-message-based-labels/main.js index 2ea3814c3..282edccba 100644 --- a/github-actions/commit-message-based-labels/main.js +++ b/github-actions/commit-message-based-labels/main.js @@ -3699,11 +3699,11 @@ var require_util2 = __commonJS({ } return location; } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -3769,7 +3769,7 @@ var require_util2 = __commonJS({ } return true; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const { headersList } = actualResponse; const policyHeader = (headersList.get("referrer-policy") ?? "").split(","); let policy = ""; @@ -3783,7 +3783,7 @@ var require_util2 = __commonJS({ } } if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -3800,33 +3800,33 @@ var require_util2 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; - if (request2.responseTainting === "cors" || request2.mode === "websocket") { + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; + if (request4.responseTainting === "cors" || request4.mode === "websocket") { if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } } } @@ -3858,26 +3858,26 @@ var require_util2 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (request2.referrer instanceof URL) { - referrerSource = request2.referrer; + } else if (request4.referrer instanceof URL) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); if (referrerURL.toString().length > 4096) { referrerURL = referrerOrigin; } - const areSameOrigin = sameOrigin(request2, referrerURL); - const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request2.url); + const areSameOrigin = sameOrigin(request4, referrerURL); + const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request4.url); switch (policy) { case "origin": return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true); @@ -3888,7 +3888,7 @@ var require_util2 = __commonJS({ case "origin-when-cross-origin": return areSameOrigin ? referrerURL : referrerOrigin; case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -4037,7 +4037,7 @@ var require_util2 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -5923,25 +5923,25 @@ var require_request = __commonJS({ static [kHTTP2BuildRequest](origin, opts, handler2) { const headers = opts.headers; opts = { ...opts, headers: null }; - const request2 = new Request(origin, opts, handler2); - request2.headers = {}; + const request4 = new Request(origin, opts, handler2); + request4.headers = {}; if (Array.isArray(headers)) { if (headers.length % 2 !== 0) { throw new InvalidArgumentError("headers array must be even"); } for (let i = 0; i < headers.length; i += 2) { - processHeader(request2, headers[i], headers[i + 1], true); + processHeader(request4, headers[i], headers[i + 1], true); } } else if (headers && typeof headers === "object") { const keys = Object.keys(headers); for (let i = 0; i < keys.length; i++) { const key = keys[i]; - processHeader(request2, key, headers[key], true); + processHeader(request4, key, headers[key], true); } } else if (headers != null) { throw new InvalidArgumentError("headers must be an object or an array"); } - return request2; + return request4; } static [kHTTP2CopyHeaders](raw) { const rawHeaders = raw.split("\r\n"); @@ -5969,28 +5969,28 @@ var require_request = __commonJS({ return skipAppend ? val : `${key}: ${val}\r `; } - function processHeader(request2, key, val, skipAppend = false) { + function processHeader(request4, key, val, skipAppend = false) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { return; } - if (request2.host === null && key.length === 4 && key.toLowerCase() === "host") { + if (request4.host === null && key.length === 4 && key.toLowerCase() === "host") { if (headerCharRegex.exec(val) !== null) { throw new InvalidArgumentError(`invalid ${key} header`); } - request2.host = val; - } else if (request2.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { - request2.contentType = val; + } else if (request4.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { + request4.contentType = val; if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } else if (key.length === 17 && key.toLowerCase() === "transfer-encoding") { throw new InvalidArgumentError("invalid transfer-encoding header"); } else if (key.length === 10 && key.toLowerCase() === "connection") { @@ -5998,7 +5998,7 @@ var require_request = __commonJS({ if (value !== "close" && value !== "keep-alive") { throw new InvalidArgumentError("invalid connection header"); } else if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (key.length === 10 && key.toLowerCase() === "keep-alive") { throw new InvalidArgumentError("invalid keep-alive header"); @@ -6012,19 +6012,19 @@ var require_request = __commonJS({ if (Array.isArray(val)) { for (let i = 0; i < val.length; i++) { if (skipAppend) { - if (request2.headers[key]) - request2.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; + if (request4.headers[key]) + request4.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; else - request2.headers[key] = processHeaderValue(key, val[i], skipAppend); + request4.headers[key] = processHeaderValue(key, val[i], skipAppend); } else { - request2.headers += processHeaderValue(key, val[i]); + request4.headers += processHeaderValue(key, val[i]); } } } else { if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } } } @@ -7168,10 +7168,10 @@ var require_client = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); - this[kQueue].push(request2); + const request4 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; process.nextTick(resume, this); } else { @@ -7195,8 +7195,8 @@ var require_client = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -7244,13 +7244,13 @@ var require_client = __commonJS({ assert(this[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } } else if (client[kRunning] > 0) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7456,8 +7456,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } } @@ -7497,12 +7497,12 @@ var require_client = __commonJS({ onUpgrade(head) { const { upgrade, client, socket, headers, statusCode } = this; assert(upgrade); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(!socket.destroyed); assert(socket === client[kSocket]); assert(!this.paused); - assert(request2.upgrade || request2.method === "CONNECT"); + assert(request4.upgrade || request4.method === "CONNECT"); this.statusCode = null; this.statusText = ""; this.shouldKeepAlive = null; @@ -7519,7 +7519,7 @@ var require_client = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -7530,8 +7530,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert(!this.upgrade); @@ -7540,22 +7540,22 @@ var require_client = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert.strictEqual(this.timeoutType, TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -7586,11 +7586,11 @@ var require_client = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -7607,8 +7607,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert.strictEqual(this.timeoutType, TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -7621,7 +7621,7 @@ var require_client = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } } @@ -7633,8 +7633,8 @@ var require_client = __commonJS({ if (upgrade) { return; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(statusCode >= 100); this.statusCode = null; this.statusText = ""; @@ -7648,11 +7648,11 @@ var require_client = __commonJS({ if (statusCode < 200) { return; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert.strictEqual(client[kRunning], 0); @@ -7710,8 +7710,8 @@ var require_client = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } assert(client[kSize] === 0); } @@ -7741,13 +7741,13 @@ var require_client = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7880,8 +7880,8 @@ var require_client = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + errorRequest(client, request4, err); } } else { onError(client, err); @@ -7935,8 +7935,8 @@ var require_client = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request3 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request3.headersTimeout != null ? request3.headersTimeout : client[kHeadersTimeout]; + const request5 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request5.headersTimeout != null ? request5.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -7958,13 +7958,13 @@ var require_client = __commonJS({ if (client[kRunning] >= (client[kPipelining] || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; - if (socket && socket.servername !== request2.servername) { + client[kServerName] = request4.servername; + if (socket && socket.servername !== request4.servername) { util.destroy(socket, new InformationalError("servername changed")); return; } @@ -7979,16 +7979,16 @@ var require_client = __commonJS({ if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) { return; } - if (client[kRunning] > 0 && !request2.idempotent) { + if (client[kRunning] > 0 && !request4.idempotent) { return; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body))) { return; } - if (!request2.aborted && write(client, request2)) { + if (!request4.aborted && write(client, request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -7998,12 +7998,12 @@ var require_client = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function write(client, request2) { + function write(client, request4) { if (client[kHTTPConnVersion] === "h2") { - writeH2(client, client[kHTTP2Session], request2); + writeH2(client, client[kHTTP2Session], request4); return; } - const { body, method, path, host, upgrade, headers, blocking, reset } = request2; + const { body, method, path, host, upgrade, headers, blocking, reset } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { body.read(0); @@ -8011,31 +8011,31 @@ var require_client = __commonJS({ const bodyLength = util.bodyLength(body); let contentLength = bodyLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(socket, new InformationalError("aborted")); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -8074,7 +8074,7 @@ upgrade: ${upgrade}\r header += headers; } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { if (contentLength === 0) { @@ -8086,7 +8086,7 @@ upgrade: ${upgrade}\r socket.write(`${header}\r `, "latin1"); } - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); socket.cork(); @@ -8095,48 +8095,48 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable({ body: body.stream(), client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body: body.stream(), client, request: request4, socket, contentLength, header, expectsPayload }); } else { - writeBlob({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeBlob({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } } else if (util.isStream(body)) { - writeStream({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeStream({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else if (util.isIterable(body)) { - writeIterable({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else { assert(false); } return true; } - function writeH2(client, session, request2) { - const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; + function writeH2(client, session, request4) { + const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; let headers; if (typeof reqHeaders === "string") headers = Request[kHTTP2CopyHeaders](reqHeaders.trim()); else headers = reqHeaders; if (upgrade) { - errorRequest(client, request2, new Error("Upgrade not supported for H2")); + errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } let stream; @@ -8147,11 +8147,11 @@ upgrade: ${upgrade}\r session.ref(); stream = session.request(headers, { endStream: false, signal }); if (stream.id && !stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; }); } @@ -8170,14 +8170,14 @@ upgrade: ${upgrade}\r } let contentLength = util.bodyLength(body); if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -8202,15 +8202,15 @@ upgrade: ${upgrade}\r ++h2State.openStreams; stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - if (request2.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.once("end", () => { - request2.onComplete([]); + request4.onComplete([]); }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -8228,7 +8228,7 @@ upgrade: ${upgrade}\r }); stream.once("frameError", (type, code) => { const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`); - errorRequest(client, request2, err); + errorRequest(client, request4, err); if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { h2State.streams -= 1; util.destroy(stream, err); @@ -8237,20 +8237,20 @@ upgrade: ${upgrade}\r return true; function writeBodyH2() { if (!body) { - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); stream.cork(); stream.write(body); stream.uncork(); stream.end(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { writeIterable({ client, - request: request2, + request: request4, contentLength, h2stream: stream, expectsPayload, @@ -8262,7 +8262,7 @@ upgrade: ${upgrade}\r writeBlob({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, h2stream: stream, @@ -8274,7 +8274,7 @@ upgrade: ${upgrade}\r writeStream({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, socket: client[kSocket], @@ -8285,7 +8285,7 @@ upgrade: ${upgrade}\r writeIterable({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, header: "", @@ -8297,11 +8297,11 @@ upgrade: ${upgrade}\r } } } - function writeStream({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + function writeStream({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); if (client[kHTTPConnVersion] === "h2") { let onPipeData = function(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); }; const pipe = pipeline( body, @@ -8311,7 +8311,7 @@ upgrade: ${upgrade}\r util.destroy(body, err); util.destroy(h2stream, err); } else { - request2.onRequestSent(); + request4.onRequestSent(); } } ); @@ -8323,7 +8323,7 @@ upgrade: ${upgrade}\r return; } let finished = false; - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -8379,7 +8379,7 @@ upgrade: ${upgrade}\r } socket.on("drain", onDrain).on("error", onFinished); } - async function writeBlob({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeBlob({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength === body.size, "blob body must have content length"); const isH2 = client[kHTTPConnVersion] === "h2"; try { @@ -8399,8 +8399,8 @@ upgrade: ${upgrade}\r socket.write(buffer); socket.uncork(); } - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -8409,7 +8409,7 @@ upgrade: ${upgrade}\r util.destroy(isH2 ? h2stream : socket, err); } } - async function writeIterable({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeIterable({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -8435,7 +8435,7 @@ upgrade: ${upgrade}\r throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } @@ -8443,14 +8443,14 @@ upgrade: ${upgrade}\r } catch (err) { h2stream.destroy(err); } finally { - request2.onRequestSent(); + request4.onRequestSent(); h2stream.end(); h2stream.off("close", onDrain).off("drain", onDrain); } return; } socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -8468,9 +8468,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -8479,7 +8479,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -8518,7 +8518,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -8529,8 +8529,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -8573,10 +8573,10 @@ ${len.toString(16)}\r } } }; - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert(request2.aborted); + request4.onError(err); + assert(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -9671,10 +9671,10 @@ var require_api_request = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -9689,7 +9689,7 @@ var require_api_request = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -10403,7 +10403,7 @@ var require_mock_utils = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (typeof data === "object") { @@ -10508,7 +10508,7 @@ var require_mock_utils = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); handler2.abort = nop; @@ -10565,7 +10565,7 @@ var require_mock_utils = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -10587,7 +10587,7 @@ var require_mock_utils = __commonJS({ var require_mock_interceptor = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils(); var { kDispatches, kDispatchKey, @@ -10650,7 +10650,7 @@ var require_mock_interceptor = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData(statusCode, data, responseOptions = {}) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -12299,7 +12299,7 @@ var require_request2 = __commonJS({ policyContainer: makePolicyContainer() } }; - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = this[kRealm].settingsObject.baseUrl; let signal = null; @@ -12315,17 +12315,17 @@ var require_request2 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(input instanceof Request); - request2 = input[kState]; + request4 = input[kState]; signal = input[kSignal]; } const origin = this[kRealm].settingsObject.origin; let window = "client"; - if (((_b = (_a2 = request2.window) == null ? void 0 : _a2.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a2 = request4.window) == null ? void 0 : _a2.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -12333,43 +12333,43 @@ var require_request2 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: this[kRealm].settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -12378,14 +12378,14 @@ var require_request2 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, this[kRealm].settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -12400,27 +12400,27 @@ var require_request2 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; @@ -12431,12 +12431,12 @@ var require_request2 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizeMethodRecord[method] ?? normalizeMethod(method); - request2.method = method; + request4.method = method; } if (init.signal !== void 0) { signal = init.signal; } - this[kState] = request2; + this[kState] = request4; const ac = new AbortController(); this[kSignal] = ac.signal; this[kSignal][kRealm] = this[kRealm]; @@ -12470,13 +12470,13 @@ var require_request2 = __commonJS({ } } this[kHeaders] = new Headers(kConstruct); - this[kHeaders][kHeadersList] = request2.headersList; + this[kHeaders][kHeadersList] = request4.headersList; this[kHeaders][kGuard] = "request"; this[kHeaders][kRealm] = this[kRealm]; if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } this[kHeaders][kGuard] = "request-no-cors"; @@ -12495,14 +12495,14 @@ var require_request2 = __commonJS({ } } const inputBody = input instanceof Request ? input[kState].body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !this[kHeaders][kHeadersList].contains("content-type")) { @@ -12514,12 +12514,12 @@ var require_request2 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -12649,7 +12649,7 @@ var require_request2 = __commonJS({ }; mixinBody(Request); function makeRequest(init) { - const request2 = { + const request4 = { method: "GET", localURLsOnly: false, unsafeRequest: false, @@ -12688,13 +12688,13 @@ var require_request2 = __commonJS({ ...init, headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; - request2.url = request2.urlList[0]; - return request2; + request4.url = request4.urlList[0]; + return request4; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(request4.body); } return newRequest; } @@ -12924,14 +12924,14 @@ var require_fetch = __commonJS({ p.reject(e); return p.promise; } - const request2 = requestObject[kState]; + const request4 = requestObject[kState]; if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a2 = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a2.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; const relevantRealm = null; @@ -12943,7 +12943,7 @@ var require_fetch = __commonJS({ locallyAborted = true; assert(controller != null); controller.abort(requestObject.signal.reason); - abortFetch(p, request2, responseObject, requestObject.signal.reason); + abortFetch(p, request4, responseObject, requestObject.signal.reason); } ); const handleFetchDone = (response) => finalizeAndReportTiming(response, "fetch"); @@ -12952,7 +12952,7 @@ var require_fetch = __commonJS({ return Promise.resolve(); } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return Promise.resolve(); } if (response.type === "error") { @@ -12970,7 +12970,7 @@ var require_fetch = __commonJS({ p.resolve(responseObject); }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: init.dispatcher ?? getGlobalDispatcher() @@ -13015,14 +13015,14 @@ var require_fetch = __commonJS({ performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis2, cacheState); } } - function abortFetch(p, request2, responseObject, error2) { + function abortFetch(p, request4, responseObject, error2) { var _a2, _b; if (!error2) { error2 = new DOMException2("The operation was aborted.", "AbortError"); } p.reject(error2); - if (request2.body != null && isReadable((_a2 = request2.body) == null ? void 0 : _a2.stream)) { - request2.body.stream.cancel(error2).catch((err) => { + if (request4.body != null && isReadable((_a2 = request4.body) == null ? void 0 : _a2.stream)) { + request4.body.stream.cancel(error2).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -13043,7 +13043,7 @@ var require_fetch = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -13055,9 +13055,9 @@ var require_fetch = __commonJS({ var _a2, _b, _c, _d; let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currenTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -13065,7 +13065,7 @@ var require_fetch = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -13075,32 +13075,32 @@ var require_fetch = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a2 = request2.client) == null ? void 0 : _a2.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a2 = request4.client) == null ? void 0 : _a2.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = (_d = request2.client) == null ? void 0 : _d.origin; + if (request4.origin === "client") { + request4.origin = (_d = request4.client) == null ? void 0 : _d.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept")) { + if (!request4.headersList.contains("accept")) { const value = "*/*"; - request2.headersList.append("accept", value); + request4.headersList.append("accept", value); } - if (!request2.headersList.contains("accept-language")) { - request2.headersList.append("accept-language", "*"); + if (!request4.headersList.contains("accept-language")) { + request4.headersList.append("accept-language", "*"); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -13108,44 +13108,44 @@ var require_fetch = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { response = await (async () => { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; return await schemeFetch(fetchParams); } - if (request2.mode === "same-origin") { + if (request4.mode === "same-origin") { return makeNetworkError('request mode cannot be "same-origin"'); } - if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { return makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; return await schemeFetch(fetchParams); } - if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { return makeNetworkError("URL scheme must be a HTTP(S) scheme"); } - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; return await httpFetch(fetchParams); })(); } @@ -13153,13 +13153,13 @@ var require_fetch = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -13167,26 +13167,26 @@ var require_fetch = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range")) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range")) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -13202,8 +13202,8 @@ var require_fetch = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -13212,12 +13212,12 @@ var require_fetch = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blobURLEntryObject = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !isBlobLike(blobURLEntryObject)) { + if (request4.method !== "GET" || !isBlobLike(blobURLEntryObject)) { return Promise.resolve(makeNetworkError("invalid method")); } const bodyWithType = safelyExtractBody(blobURLEntryObject); @@ -13235,7 +13235,7 @@ var require_fetch = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -13317,41 +13317,41 @@ var require_fetch = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -13361,13 +13361,13 @@ var require_fetch = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -13378,63 +13378,63 @@ var require_fetch = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization"); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie"); - request2.headersList.delete("host"); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization"); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie"); + request4.headersList.delete("host"); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = makeRequest(request2); + httpRequest = makeRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -13511,7 +13511,7 @@ var require_fetch = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -13519,7 +13519,7 @@ var require_fetch = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -13547,21 +13547,21 @@ var require_fetch = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a2; if (isCancelled(fetchParams)) { @@ -13590,7 +13590,7 @@ var require_fetch = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -13702,17 +13702,17 @@ var require_fetch = __commonJS({ } return response; async function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: fetchParams.controller.dispatcher.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: fetchParams.controller.dispatcher.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -13758,8 +13758,8 @@ var require_fetch = __commonJS({ } this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = request2.redirect === "follow" && location && redirectStatusSet.has(status); - if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = request4.redirect === "follow" && location && redirectStatusSet.has(status); + if (request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (const coding of codings) { if (coding === "x-gzip" || coding === "gzip") { decoders.push(zlib.createGunzip({ @@ -14693,36 +14693,36 @@ var require_cache = __commonJS({ } this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); - const p = await this.matchAll(request2, options); + const p = await this.matchAll(request4, options); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { var _a2; webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -14744,11 +14744,11 @@ var require_cache = __commonJS({ } return Object.freeze(responseList); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.add" }); - request2 = webidl.converters.RequestInfo(request2); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -14758,11 +14758,11 @@ var require_cache = __commonJS({ requests = webidl.converters["sequence"](requests); const responsePromises = []; const requestList = []; - for (const request2 of requests) { - if (typeof request2 === "string") { + for (const request4 of requests) { + if (typeof request4 === "string") { continue; } - const r = request2[kState]; + const r = request4[kState]; if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14771,8 +14771,8 @@ var require_cache = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = new Request(request2)[kState]; + for (const request4 of requests) { + const r = new Request(request4)[kState]; if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14847,16 +14847,16 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 2, { header: "Cache.put" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); response = webidl.converters.Response(response); let innerRequest = null; - if (request2 instanceof Request) { - innerRequest = request2[kState]; + if (request4 instanceof Request) { + innerRequest = request4[kState]; } else { - innerRequest = new Request(request2)[kState]; + innerRequest = new Request(request4)[kState]; } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -14924,20 +14924,20 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.delete" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = new Request(request2)[kState]; + assert(typeof request4 === "string"); + r = new Request(request4)[kState]; } const operations = []; const operation = { @@ -14963,25 +14963,25 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -14993,12 +14993,12 @@ var require_cache = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = new Request("https://a"); - requestObject[kState] = request3; - requestObject[kHeaders][kHeadersList] = request3.headersList; + requestObject[kState] = request5; + requestObject[kHeaders][kHeadersList] = request5.headersList; requestObject[kHeaders][kGuard] = "immutable"; - requestObject[kRealm] = request3.client; + requestObject[kRealm] = request5.client; requestList.push(requestObject); } promise.resolve(Object.freeze(requestList)); @@ -15093,9 +15093,9 @@ var require_cache = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -15111,7 +15111,7 @@ var require_cache = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -15183,21 +15183,21 @@ var require_cachestorage = __commonJS({ webidl.illegalConstructor(); } } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, { header: "CacheStorage.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -16110,7 +16110,7 @@ var require_connection = __commonJS({ function establishWebSocketConnection(url, protocols, ws, onEstablish, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], serviceWorkers: "none", referrer: "no-referrer", @@ -16121,17 +16121,17 @@ var require_connection = __commonJS({ }); if (options.headers) { const headersList = new Headers(options.headers)[kHeadersList]; - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue); - request2.headersList.append("sec-websocket-version", "13"); + request4.headersList.append("sec-websocket-key", keyValue); + request4.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol); + request4.headersList.append("sec-websocket-protocol", protocol); } const permessageDeflate = ""; const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher ?? getGlobalDispatcher(), processResponse(response) { @@ -16164,7 +16164,7 @@ var require_connection = __commonJS({ return; } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); - if (secProtocol !== null && secProtocol !== request2.headersList.get("Sec-WebSocket-Protocol")) { + if (secProtocol !== null && secProtocol !== request4.headersList.get("Sec-WebSocket-Protocol")) { failWebsocketConnection(ws, "Protocol was not set in the opening handshake."); return; } @@ -17209,7 +17209,7 @@ var require_lib = __commonJS({ } exports.isHttps = isHttps; var HttpClient = class { - constructor(userAgent2, handlers, requestOptions) { + constructor(userAgent4, handlers, requestOptions) { this._ignoreSslError = false; this._allowRedirects = true; this._allowRedirectDowngrade = false; @@ -17218,7 +17218,7 @@ var require_lib = __commonJS({ this._maxRetries = 1; this._keepAlive = false; this._disposed = false; - this.userAgent = userAgent2; + this.userAgent = userAgent4; this.handlers = handlers || []; this.requestOptions = requestOptions; if (requestOptions) { @@ -17483,14 +17483,14 @@ var require_lib = __commonJS({ } _mergeHeaders(headers) { if (this.requestOptions && this.requestOptions.headers) { - return Object.assign({}, lowercaseKeys2(this.requestOptions.headers), lowercaseKeys2(headers || {})); + return Object.assign({}, lowercaseKeys4(this.requestOptions.headers), lowercaseKeys4(headers || {})); } - return lowercaseKeys2(headers || {}); + return lowercaseKeys4(headers || {}); } _getExistingOrDefaultHeader(additionalHeaders, header, _default) { let clientHeader; if (this.requestOptions && this.requestOptions.headers) { - clientHeader = lowercaseKeys2(this.requestOptions.headers)[header]; + clientHeader = lowercaseKeys4(this.requestOptions.headers)[header]; } return additionalHeaders[header] || clientHeader || _default; } @@ -17625,7 +17625,7 @@ var require_lib = __commonJS({ } }; exports.HttpClient = HttpClient; - var lowercaseKeys2 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + var lowercaseKeys4 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); } }); @@ -20462,10 +20462,10 @@ var require_util8 = __commonJS({ } return obj; } - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert(request2.aborted); + request4.onError(err); + assert(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -20993,7 +20993,7 @@ var require_request3 = __commonJS({ return this; } }; - function processHeader(request2, key, val) { + function processHeader(request4, key, val) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { @@ -21032,19 +21032,19 @@ var require_request3 = __commonJS({ } else { val = `${val}`; } - if (request2.host === null && headerName === "host") { + if (request4.host === null && headerName === "host") { if (typeof val !== "string") { throw new InvalidArgumentError("invalid host header"); } - request2.host = val; - } else if (request2.contentLength === null && headerName === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && headerName === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && headerName === "content-type") { - request2.contentType = val; - request2.headers.push(key, val); + } else if (request4.contentType === null && headerName === "content-type") { + request4.contentType = val; + request4.headers.push(key, val); } else if (headerName === "transfer-encoding" || headerName === "keep-alive" || headerName === "upgrade") { throw new InvalidArgumentError(`invalid ${headerName} header`); } else if (headerName === "connection") { @@ -21053,12 +21053,12 @@ var require_request3 = __commonJS({ throw new InvalidArgumentError("invalid connection header"); } if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (headerName === "expect") { throw new NotSupportedError("expect header not supported"); } else { - request2.headers.push(key, val); + request4.headers.push(key, val); } } module.exports = Request; @@ -23371,11 +23371,11 @@ var require_util9 = __commonJS({ function normalizeBinaryStringToUtf8(value) { return Buffer.from(value, "binary").toString("utf8"); } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -23412,10 +23412,10 @@ var require_util9 = __commonJS({ } return policy; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const policy = parseReferrerPolicy(actualResponse); if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -23432,33 +23432,33 @@ var require_util9 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header, true); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; if (serializedOrigin === "client" || serializedOrigin === void 0) { return; } - if (request2.responseTainting === "cors" || request2.mode === "websocket") { - request2.headersList.append("origin", serializedOrigin, true); - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + if (request4.responseTainting === "cors" || request4.mode === "websocket") { + request4.headersList.append("origin", serializedOrigin, true); + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } - request2.headersList.append("origin", serializedOrigin, true); + request4.headersList.append("origin", serializedOrigin, true); } } function coarsenTime(timestamp, crossOriginIsolatedCapability) { @@ -23512,18 +23512,18 @@ var require_util9 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (webidl.is.URL(request2.referrer)) { - referrerSource = request2.referrer; + } else if (webidl.is.URL(request4.referrer)) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); @@ -23541,14 +23541,14 @@ var require_util9 = __commonJS({ case "unsafe-url": return referrerURL; case "strict-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } return referrerOrigin; } case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -23558,17 +23558,17 @@ var require_util9 = __commonJS({ return referrerOrigin; } case "same-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return "no-referrer"; case "origin-when-cross-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return referrerOrigin; case "no-referrer-when-downgrade": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } @@ -23732,7 +23732,7 @@ var require_util9 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -25205,11 +25205,11 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } - request2.onResponseStarted(); + request4.onResponseStarted(); return 0; } onHeaderField(buf) { @@ -25257,9 +25257,9 @@ var require_client_h1 = __commonJS({ assert(!socket.destroyed); assert(!this.paused); assert((headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); - assert(request2.upgrade || request2.method === "CONNECT"); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); + assert(request4.upgrade || request4.method === "CONNECT"); this.statusCode = 0; this.statusText = ""; this.shouldKeepAlive = false; @@ -25276,7 +25276,7 @@ var require_client_h1 = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -25287,8 +25287,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert(!this.upgrade); @@ -25297,22 +25297,22 @@ var require_client_h1 = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert(this.timeoutType === TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -25343,11 +25343,11 @@ var require_client_h1 = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -25364,8 +25364,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(this.timeoutType === TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -25378,7 +25378,7 @@ var require_client_h1 = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } return 0; @@ -25393,8 +25393,8 @@ var require_client_h1 = __commonJS({ } assert(statusCode >= 100); assert((this.headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); this.statusCode = 0; this.statusText = ""; this.bytesRead = 0; @@ -25406,11 +25406,11 @@ var require_client_h1 = __commonJS({ if (statusCode < 200) { return 0; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert(client[kRunning] === 0); @@ -25476,8 +25476,8 @@ var require_client_h1 = __commonJS({ return { version: "h1", defaultPipelining: 1, - write(request2) { - return writeH1(client, request2); + write(request4) { + return writeH1(client, request4); }, resume() { resumeH1(client); @@ -25493,18 +25493,18 @@ var require_client_h1 = __commonJS({ get destroyed() { return socket.destroyed; }, - busy(request2) { + busy(request4) { if (socket[kWriting] || socket[kReset] || socket[kBlocking]) { return true; } - if (request2) { - if (client[kRunning] > 0 && !request2.idempotent) { + if (request4) { + if (client[kRunning] > 0 && !request4.idempotent) { return true; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return true; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body) || util.isFormDataLike(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body) || util.isFormDataLike(request4.body))) { return true; } } @@ -25551,13 +25551,13 @@ var require_client_h1 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -25585,8 +25585,8 @@ var require_client_h1 = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request2 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request2.headersTimeout != null ? request2.headersTimeout : client[kHeadersTimeout]; + const request4 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request4.headersTimeout != null ? request4.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -25595,21 +25595,21 @@ var require_client_h1 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH1(client, request2) { - const { method, path, host, upgrade, blocking, reset } = request2; - let { body, headers, contentLength } = request2; + function writeH1(client, request4) { + const { method, path, host, upgrade, blocking, reset } = request4; + let { body, headers, contentLength } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH"; if (util.isFormDataLike(body)) { if (!extractBody) { extractBody = require_body2().extractBody; } const [bodyStream, contentType] = extractBody(body); - if (request2.contentType == null) { + if (request4.contentType == null) { headers.push("content-type", contentType); } body = bodyStream.stream; contentLength = bodyStream.length; - } else if (util.isBlobLike(body) && request2.contentType == null && body.type) { + } else if (util.isBlobLike(body) && request4.contentType == null && body.type) { headers.push("content-type", body.type); } if (body && typeof body.read === "function") { @@ -25618,33 +25618,33 @@ var require_client_h1 = __commonJS({ const bodyLength = util.bodyLength(body); contentLength = bodyLength ?? contentLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - util.errorRequest(client, request2, err || new RequestAbortedError()); + util.errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(body); util.destroy(socket, new InformationalError("aborted")); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -25695,31 +25695,31 @@ upgrade: ${upgrade}\r } } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { - writeBuffer(abort, null, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, null, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBuffer(body)) { - writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable(abort, body.stream(), client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body.stream(), client, request4, socket, contentLength, header, expectsPayload); } else { - writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload); } } else if (util.isStream(body)) { - writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isIterable(body)) { - writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else { assert(false); } return true; } - function writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); let finished = false; - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -25785,7 +25785,7 @@ upgrade: ${upgrade}\r setImmediate(onClose); } } - function writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload) { try { if (!body) { if (contentLength === 0) { @@ -25805,18 +25805,18 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(body); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (err) { abort(err); } } - async function writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -25829,9 +25829,9 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(buffer); socket.uncork(); - request2.onBodySent(buffer); - request2.onRequestSent(); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(buffer); + request4.onRequestSent(); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } client[kResume](); @@ -25839,7 +25839,7 @@ upgrade: ${upgrade}\r abort(err); } } - async function writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -25858,7 +25858,7 @@ upgrade: ${upgrade}\r } }); socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -25876,9 +25876,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ abort, socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ abort, socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -25888,7 +25888,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -25907,7 +25907,7 @@ upgrade: ${upgrade}\r } socket.cork(); if (bytesWritten === 0) { - if (!expectsPayload && request2.reset !== false) { + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } if (contentLength === null) { @@ -25927,7 +25927,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -25938,8 +25938,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -26082,8 +26082,8 @@ var require_client_h2 = __commonJS({ return { version: "h2", defaultPipelining: Infinity, - write(request2) { - return writeH2(client, request2); + write(request4) { + return writeH2(client, request4); }, resume() { resumeH2(client); @@ -26141,9 +26141,9 @@ var require_client_h2 = __commonJS({ this[kHTTP2Session] = null; util.destroy(this[kSocket], err); if (client[kRunningIdx] < client[kQueue].length) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); client[kPendingIdx] = client[kRunningIdx]; } assert(client[kRunning] === 0); @@ -26160,8 +26160,8 @@ var require_client_h2 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } } @@ -26192,13 +26192,13 @@ var require_client_h2 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH2(client, request2) { - const requestTimeout = request2.bodyTimeout ?? client[kBodyTimeout]; + function writeH2(client, request4) { + const requestTimeout = request4.bodyTimeout ?? client[kBodyTimeout]; const session = client[kHTTP2Session]; - const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; - let { body } = request2; + const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; + let { body } = request4; if (upgrade) { - util.errorRequest(client, request2, new Error("Upgrade not supported for H2")); + util.errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } const headers = {}; @@ -26222,11 +26222,11 @@ var require_client_h2 = __commonJS({ headers[HTTP2_HEADER_AUTHORITY] = host || `${hostname}${port ? `:${port}` : ""}`; headers[HTTP2_HEADER_METHOD] = method; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } err = err || new RequestAbortedError(); - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); if (stream != null) { stream.removeAllListeners("data"); stream.close(); @@ -26236,23 +26236,23 @@ var require_client_h2 = __commonJS({ util.destroy(body, err); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "CONNECT") { session.ref(); stream = session.request(headers, { endStream: false, signal }); if (!stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; }); @@ -26280,14 +26280,14 @@ var require_client_h2 = __commonJS({ contentLength = bodyStream.length; } if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -26303,7 +26303,7 @@ var require_client_h2 = __commonJS({ header += `${key}: ${headers[key]}\r `; } - channels.sendHeaders.publish({ request: request2, headers: header, socket: session[kSocket] }); + channels.sendHeaders.publish({ request: request4, headers: header, socket: session[kSocket] }); } const shouldEndStream = method === "GET" || method === "HEAD" || body === null; if (expectContinue) { @@ -26321,17 +26321,17 @@ var require_client_h2 = __commonJS({ stream.setTimeout(requestTimeout); stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - request2.onResponseStarted(); - if (request2.aborted) { + request4.onResponseStarted(); + if (request4.aborted) { stream.removeAllListeners("data"); return; } - if (request2.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -26339,8 +26339,8 @@ var require_client_h2 = __commonJS({ var _a2; stream.removeAllListeners("data"); if (((_a2 = stream.state) == null ? void 0 : _a2.state) == null || stream.state.state < 6) { - if (!request2.aborted && !request2.completed) { - request2.onComplete({}); + if (!request4.aborted && !request4.completed) { + request4.onComplete({}); } client[kQueue][client[kRunningIdx]++] = null; client[kResume](); @@ -26383,10 +26383,10 @@ var require_client_h2 = __commonJS({ abort(err); }); stream.once("trailers", (trailers) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - request2.onComplete(trailers); + request4.onComplete(trailers); }); return true; function writeBodyH2() { @@ -26396,7 +26396,7 @@ var require_client_h2 = __commonJS({ stream, null, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26407,7 +26407,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26419,7 +26419,7 @@ var require_client_h2 = __commonJS({ stream, body.stream(), client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26430,7 +26430,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26444,7 +26444,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, contentLength ); } else if (util.isIterable(body)) { @@ -26453,7 +26453,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26463,7 +26463,7 @@ var require_client_h2 = __commonJS({ } } } - function writeBuffer(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + function writeBuffer(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { try { if (body != null && util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); @@ -26471,18 +26471,18 @@ var require_client_h2 = __commonJS({ h2stream.write(body); h2stream.uncork(); h2stream.end(); - request2.onBodySent(body); + request4.onBodySent(body); } if (!expectsPayload) { socket[kReset] = true; } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (error2) { abort(error2); } } - function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) { + function writeStream(abort, socket, expectsPayload, h2stream, body, client, request4, contentLength) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); const pipe = pipeline( body, @@ -26493,7 +26493,7 @@ var require_client_h2 = __commonJS({ abort(err); } else { util.removeAllListeners(pipe); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26503,10 +26503,10 @@ var require_client_h2 = __commonJS({ ); util.addListener(pipe, "data", onPipeData); function onPipeData(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); } } - async function writeBlob(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeBlob(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -26517,8 +26517,8 @@ var require_client_h2 = __commonJS({ h2stream.write(buffer); h2stream.uncork(); h2stream.end(); - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26527,7 +26527,7 @@ var require_client_h2 = __commonJS({ abort(err); } } - async function writeIterable(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeIterable(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -26552,13 +26552,13 @@ var require_client_h2 = __commonJS({ throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } } h2stream.end(); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26805,10 +26805,10 @@ var require_client2 = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = new Request(origin, opts, handler2); - this[kQueue].push(request2); + const request4 = new Request(origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; queueMicrotask(() => resume(this)); } else { @@ -26832,8 +26832,8 @@ var require_client2 = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(this, request2, err); + const request4 = requests[i]; + util.errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -26857,8 +26857,8 @@ var require_client2 = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } assert(client[kSize] === 0); } @@ -26962,8 +26962,8 @@ var require_client2 = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - util.errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + util.errorRequest(client, request4, err); } } else { onError(client, err); @@ -27021,12 +27021,12 @@ var require_client2 = __commonJS({ if (client[kRunning] >= (getPipelining(client) || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; + client[kServerName] = request4.servername; (_a2 = client[kHTTPContext]) == null ? void 0 : _a2.destroy(new InformationalError("servername changed"), () => { client[kHTTPContext] = null; resume(client); @@ -27042,10 +27042,10 @@ var require_client2 = __commonJS({ if (client[kHTTPContext].destroyed) { return; } - if (client[kHTTPContext].busy(request2)) { + if (client[kHTTPContext].busy(request4)) { return; } - if (!request2.aborted && client[kHTTPContext].write(request2)) { + if (!request4.aborted && client[kHTTPContext].write(request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -28659,10 +28659,10 @@ var require_api_request2 = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -28678,7 +28678,7 @@ var require_api_request2 = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -29444,7 +29444,7 @@ var require_mock_utils2 = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (data instanceof Uint8Array) { @@ -29577,7 +29577,7 @@ var require_mock_utils2 = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); (_a2 = handler2.onConnect) == null ? void 0 : _a2.call(handler2, (err) => handler2.onError(err), null); @@ -29634,7 +29634,7 @@ var require_mock_utils2 = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -29657,7 +29657,7 @@ var require_mock_utils2 = __commonJS({ var require_mock_interceptor2 = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils2(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils2(); var { kDispatches, kDispatchKey, @@ -29722,7 +29722,7 @@ var require_mock_interceptor2 = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData({ statusCode, data, responseOptions }) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -32022,7 +32022,7 @@ var require_sqlite_cache_store = __commonJS({ var { Writable } = __require("stream"); var { assertCacheKey, assertCacheValue } = require_cache2(); var DatabaseSync; - var VERSION13 = 3; + var VERSION17 = 3; var MAX_ENTRY_SIZE = 2 * 1e3 * 1e3 * 1e3; module.exports = class SqliteCacheStore { #maxEntrySize = MAX_ENTRY_SIZE; @@ -32061,7 +32061,7 @@ var require_sqlite_cache_store = __commonJS({ } this.#db = new DatabaseSync((opts == null ? void 0 : opts.location) ?? ":memory:"); this.#db.exec(` - CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION13} ( + CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION17} ( -- Data specific to us id INTEGER PRIMARY KEY AUTOINCREMENT, url TEXT NOT NULL, @@ -32080,9 +32080,9 @@ var require_sqlite_cache_store = __commonJS({ staleAt INTEGER NOT NULL ); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_url ON cacheInterceptorV${VERSION13}(url); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_method ON cacheInterceptorV${VERSION13}(method); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_deleteAt ON cacheInterceptorV${VERSION13}(deleteAt); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_url ON cacheInterceptorV${VERSION17}(url); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_method ON cacheInterceptorV${VERSION17}(method); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_deleteAt ON cacheInterceptorV${VERSION17}(deleteAt); `); this.#getValuesQuery = this.#db.prepare(` SELECT @@ -32097,7 +32097,7 @@ var require_sqlite_cache_store = __commonJS({ vary, cachedAt, staleAt - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION17} WHERE url = ? AND method = ? @@ -32105,7 +32105,7 @@ var require_sqlite_cache_store = __commonJS({ deleteAt ASC `); this.#updateValueQuery = this.#db.prepare(` - UPDATE cacheInterceptorV${VERSION13} SET + UPDATE cacheInterceptorV${VERSION17} SET body = ?, deleteAt = ?, statusCode = ?, @@ -32119,7 +32119,7 @@ var require_sqlite_cache_store = __commonJS({ id = ? `); this.#insertValueQuery = this.#db.prepare(` - INSERT INTO cacheInterceptorV${VERSION13} ( + INSERT INTO cacheInterceptorV${VERSION17} ( url, method, body, @@ -32135,20 +32135,20 @@ var require_sqlite_cache_store = __commonJS({ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `); this.#deleteByUrlQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE url = ?` + `DELETE FROM cacheInterceptorV${VERSION17} WHERE url = ?` ); this.#countEntriesQuery = this.#db.prepare( - `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION13}` + `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION17}` ); this.#deleteExpiredValuesQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE deleteAt <= ?` + `DELETE FROM cacheInterceptorV${VERSION17} WHERE deleteAt <= ?` ); this.#deleteOldValuesQuery = this.#maxCount === Infinity ? null : this.#db.prepare(` - DELETE FROM cacheInterceptorV${VERSION13} + DELETE FROM cacheInterceptorV${VERSION17} WHERE id IN ( SELECT id - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION17} ORDER BY cachedAt DESC LIMIT ? ) @@ -33239,7 +33239,7 @@ var require_request4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); input = webidl.converters.RequestInfo(input, prefix, "input"); init = webidl.converters.RequestInit(init, prefix, "init"); - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = environmentSettingsObject.settingsObject.baseUrl; let signal = null; @@ -33256,18 +33256,18 @@ var require_request4 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(webidl.is.Request(input)); - request2 = input.#state; + request4 = input.#state; signal = input.#signal; this.#dispatcher = init.dispatcher || input.#dispatcher; } const origin = environmentSettingsObject.settingsObject.origin; let window = "client"; - if (((_b = (_a2 = request2.window) == null ? void 0 : _a2.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a2 = request4.window) == null ? void 0 : _a2.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -33275,43 +33275,43 @@ var require_request4 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: environmentSettingsObject.settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -33320,14 +33320,14 @@ var require_request4 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, environmentSettingsObject.settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -33342,33 +33342,33 @@ var require_request4 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; const mayBeNormalized = normalizedMethodRecords[method]; if (mayBeNormalized !== void 0) { - request2.method = mayBeNormalized; + request4.method = mayBeNormalized; } else { if (!isValidHTTPToken(method)) { throw new TypeError(`'${method}' is not a valid HTTP method.`); @@ -33378,9 +33378,9 @@ var require_request4 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizedMethodRecordsBase[upperCase] ?? method; - request2.method = method; + request4.method = method; } - if (!patchMethodWarning && request2.method === "patch") { + if (!patchMethodWarning && request4.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" }); @@ -33390,7 +33390,7 @@ var require_request4 = __commonJS({ if (init.signal !== void 0) { signal = init.signal; } - this.#state = request2; + this.#state = request4; const ac = new AbortController(); this.#signal = ac.signal; if (signal != null) { @@ -33411,12 +33411,12 @@ var require_request4 = __commonJS({ } } this.#headers = new Headers(kConstruct); - setHeadersList(this.#headers, request2.headersList); + setHeadersList(this.#headers, request4.headersList); setHeadersGuard(this.#headers, "request"); if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } setHeadersGuard(this.#headers, "request-no-cors"); @@ -33435,14 +33435,14 @@ var require_request4 = __commonJS({ } } const inputBody = webidl.is.Request(input) ? input.#state.body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !getHeadersList(this.#headers).contains("content-type", true)) { @@ -33454,12 +33454,12 @@ var require_request4 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -33604,24 +33604,24 @@ var require_request4 = __commonJS({ }; return `Request ${nodeUtil.formatWithOptions(options, properties)}`; } - static setRequestSignal(request2, newSignal) { - request2.#signal = newSignal; - return request2; + static setRequestSignal(request4, newSignal) { + request4.#signal = newSignal; + return request4; } - static getRequestDispatcher(request2) { - return request2.#dispatcher; + static getRequestDispatcher(request4) { + return request4.#dispatcher; } - static setRequestDispatcher(request2, newDispatcher) { - request2.#dispatcher = newDispatcher; + static setRequestDispatcher(request4, newDispatcher) { + request4.#dispatcher = newDispatcher; } - static setRequestHeaders(request2, newHeaders) { - request2.#headers = newHeaders; + static setRequestHeaders(request4, newHeaders) { + request4.#headers = newHeaders; } - static getRequestState(request2) { - return request2.#state; + static getRequestState(request4) { + return request4.#state; } - static setRequestState(request2, newState) { - request2.#state = newState; + static setRequestState(request4, newState) { + request4.#state = newState; } }; var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState } = Request; @@ -33674,23 +33674,23 @@ var require_request4 = __commonJS({ headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(newRequest, request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(newRequest, request4.body); } return newRequest; } function fromInnerRequest(innerRequest, dispatcher, signal, guard) { - const request2 = new Request(kConstruct); - setRequestState(request2, innerRequest); - setRequestDispatcher(request2, dispatcher); - setRequestSignal(request2, signal); + const request4 = new Request(kConstruct); + setRequestState(request4, innerRequest); + setRequestDispatcher(request4, dispatcher); + setRequestSignal(request4, signal); const headers = new Headers(kConstruct); - setRequestHeaders(request2, headers); + setRequestHeaders(request4, headers); setHeadersList(headers, innerRequest.headersList); setHeadersGuard(headers, guard); - return request2; + return request4; } Object.defineProperties(Request.prototype, { method: kEnumerableProperty, @@ -33928,14 +33928,14 @@ var require_fetch2 = __commonJS({ p.reject(e); return p.promise; } - const request2 = getRequestState(requestObject); + const request4 = getRequestState(requestObject); if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a2 = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a2.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; let locallyAborted = false; @@ -33947,7 +33947,7 @@ var require_fetch2 = __commonJS({ assert(controller != null); controller.abort(requestObject.signal.reason); const realResponse = responseObject == null ? void 0 : responseObject.deref(); - abortFetch(p, request2, realResponse, requestObject.signal.reason); + abortFetch(p, request4, realResponse, requestObject.signal.reason); } ); const processResponse = (response) => { @@ -33955,7 +33955,7 @@ var require_fetch2 = __commonJS({ return; } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return; } if (response.type === "error") { @@ -33967,7 +33967,7 @@ var require_fetch2 = __commonJS({ p = null; }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: getRequestDispatcher(requestObject) @@ -34008,13 +34008,13 @@ var require_fetch2 = __commonJS({ ); } var markResourceTiming = performance.markResourceTiming; - function abortFetch(p, request2, responseObject, error2) { + function abortFetch(p, request4, responseObject, error2) { var _a2, _b; if (p) { p.reject(error2); } - if (((_a2 = request2.body) == null ? void 0 : _a2.stream) != null && isReadable(request2.body.stream)) { - request2.body.stream.cancel(error2).catch((err) => { + if (((_a2 = request4.body) == null ? void 0 : _a2.stream) != null && isReadable(request4.body.stream)) { + request4.body.stream.cancel(error2).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -34035,7 +34035,7 @@ var require_fetch2 = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -34048,9 +34048,9 @@ var require_fetch2 = __commonJS({ assert(dispatcher); let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currentTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -34058,7 +34058,7 @@ var require_fetch2 = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -34068,32 +34068,32 @@ var require_fetch2 = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a2 = request2.client) == null ? void 0 : _a2.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a2 = request4.client) == null ? void 0 : _a2.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = request2.client.origin; + if (request4.origin === "client") { + request4.origin = request4.client.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept", true)) { + if (!request4.headersList.contains("accept", true)) { const value = "*/*"; - request2.headersList.append("accept", value, true); + request4.headersList.append("accept", value, true); } - if (!request2.headersList.contains("accept-language", true)) { - request2.headersList.append("accept-language", "*", true); + if (!request4.headersList.contains("accept-language", true)) { + request4.headersList.append("accept-language", "*", true); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -34101,41 +34101,41 @@ var require_fetch2 = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; response = await schemeFetch(fetchParams); - } else if (request2.mode === "same-origin") { + } else if (request4.mode === "same-origin") { response = makeNetworkError('request mode cannot be "same-origin"'); - } else if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + } else if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { response = makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } else { - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; response = await schemeFetch(fetchParams); } - } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { response = makeNetworkError("URL scheme must be a HTTP(S) scheme"); } else { - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; response = await httpFetch(fetchParams); } } @@ -34143,13 +34143,13 @@ var require_fetch2 = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -34157,26 +34157,26 @@ var require_fetch2 = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range", true)) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range", true)) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -34192,8 +34192,8 @@ var require_fetch2 = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -34202,19 +34202,19 @@ var require_fetch2 = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("node:buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blob = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !webidl.is.Blob(blob)) { + if (request4.method !== "GET" || !webidl.is.Blob(blob)) { return Promise.resolve(makeNetworkError("invalid method")); } const response = makeResponse(); const fullLength = blob.size; const serializedFullLength = isomorphicEncode(`${fullLength}`); const type = blob.type; - if (!request2.headersList.contains("range", true)) { + if (!request4.headersList.contains("range", true)) { const bodyWithType = extractBody(blob); response.statusText = "OK"; response.body = bodyWithType[0]; @@ -34222,7 +34222,7 @@ var require_fetch2 = __commonJS({ response.headersList.set("content-type", type, true); } else { response.rangeRequested = true; - const rangeHeader = request2.headersList.get("range", true); + const rangeHeader = request4.headersList.get("range", true); const rangeValue = simpleRangeHeaderValue(rangeHeader, true); if (rangeValue === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34253,7 +34253,7 @@ var require_fetch2 = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34342,41 +34342,41 @@ var require_fetch2 = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(void 0, false); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -34386,13 +34386,13 @@ var require_fetch2 = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -34403,63 +34403,63 @@ var require_fetch2 = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization", true); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie", true); - request2.headersList.delete("host", true); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization", true); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie", true); + request4.headersList.delete("host", true); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = cloneRequest(request2); + httpRequest = cloneRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -34536,7 +34536,7 @@ var require_fetch2 = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -34544,7 +34544,7 @@ var require_fetch2 = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -34574,21 +34574,21 @@ var require_fetch2 = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a2; if (isCancelled(fetchParams)) { @@ -34617,7 +34617,7 @@ var require_fetch2 = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -34728,17 +34728,17 @@ var require_fetch2 = __commonJS({ } return response; function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: agent.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -34774,8 +34774,8 @@ var require_fetch2 = __commonJS({ location = headersList.get("location", true); this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status); - if (codings.length !== 0 && request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = location && request4.redirect === "follow" && redirectStatusSet.has(status); + if (codings.length !== 0 && request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (let i = codings.length - 1; i >= 0; --i) { const coding = codings[i]; if (coding === "x-gzip" || coding === "gzip") { @@ -34917,32 +34917,32 @@ var require_cache4 = __commonJS({ webidl.util.markAsUncloneable(this); this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.match"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - const p = this.#internalMatchAll(request2, options, 1); + const p = this.#internalMatchAll(request4, options, 1); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.matchAll"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - return this.#internalMatchAll(request2, options); + return this.#internalMatchAll(request4, options); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); const prefix = "Cache.add"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -34952,19 +34952,19 @@ var require_cache4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); const responsePromises = []; const requestList = []; - for (let request2 of requests) { - if (request2 === void 0) { + for (let request4 of requests) { + if (request4 === void 0) { throw webidl.errors.conversionFailed({ prefix, argument: "Argument 1", types: ["undefined is not allowed"] }); } - request2 = webidl.converters.RequestInfo(request2); - if (typeof request2 === "string") { + request4 = webidl.converters.RequestInfo(request4); + if (typeof request4 === "string") { continue; } - const r = getRequestState(request2); + const r = getRequestState(request4); if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: prefix, @@ -34973,8 +34973,8 @@ var require_cache4 = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = getRequestState(new Request(request2)); + for (const request4 of requests) { + const r = getRequestState(new Request(request4)); if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: prefix, @@ -35048,17 +35048,17 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); const prefix = "Cache.put"; webidl.argumentLengthCheck(arguments, 2, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); response = webidl.converters.Response(response, prefix, "response"); let innerRequest = null; - if (webidl.is.Request(request2)) { - innerRequest = getRequestState(request2); + if (webidl.is.Request(request4)) { + innerRequest = getRequestState(request4); } else { - innerRequest = getRequestState(new Request(request2)); + innerRequest = getRequestState(new Request(request4)); } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -35126,21 +35126,21 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.delete"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = getRequestState(new Request(request2)); + assert(typeof request4 === "string"); + r = getRequestState(new Request(request4)); } const operations = []; const operation = { @@ -35166,26 +35166,26 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.keys"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -35197,9 +35197,9 @@ var require_cache4 = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = fromInnerRequest( - request3, + request5, void 0, new AbortController().signal, "immutable" @@ -35298,9 +35298,9 @@ var require_cache4 = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -35316,7 +35316,7 @@ var require_cache4 = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -35324,20 +35324,20 @@ var require_cache4 = __commonJS({ } return true; } - #internalMatchAll(request2, options, maxResponses = Infinity) { + #internalMatchAll(request4, options, maxResponses = Infinity) { let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -35425,21 +35425,21 @@ var require_cachestorage2 = __commonJS({ } webidl.util.markAsUncloneable(this); } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, "CacheStorage.match"); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -36529,7 +36529,7 @@ var require_connection2 = __commonJS({ function establishWebSocketConnection(url, protocols, client, handler2, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], client, serviceWorkers: "none", @@ -36541,18 +36541,18 @@ var require_connection2 = __commonJS({ }); if (options.headers) { const headersList = getHeadersList(new Headers(options.headers)); - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue, true); - request2.headersList.append("sec-websocket-version", "13", true); + request4.headersList.append("sec-websocket-key", keyValue, true); + request4.headersList.append("sec-websocket-version", "13", true); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol, true); + request4.headersList.append("sec-websocket-protocol", protocol, true); } const permessageDeflate = "permessage-deflate; client_max_window_bits"; - request2.headersList.append("sec-websocket-extensions", permessageDeflate, true); + request4.headersList.append("sec-websocket-extensions", permessageDeflate, true); const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher, processResponse(response) { @@ -36593,7 +36593,7 @@ var require_connection2 = __commonJS({ } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); if (secProtocol !== null) { - const requestProtocols = getDecodeSplit("sec-websocket-protocol", request2.headersList); + const requestProtocols = getDecodeSplit("sec-websocket-protocol", request4.headersList); if (!requestProtocols.includes(secProtocol)) { failWebsocketConnection(handler2, 1002, "Protocol was not set in the opening handshake."); return; @@ -38793,24 +38793,24 @@ var require_dist_node3 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - endpoint: () => endpoint2 + endpoint: () => endpoint4 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node2(); - var VERSION13 = "9.0.5"; - var userAgent2 = `octokit-endpoint.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; - var DEFAULTS2 = { + var import_universal_user_agent13 = require_dist_node2(); + var VERSION17 = "9.0.5"; + var userAgent4 = `octokit-endpoint.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}`; + var DEFAULTS4 = { method: "GET", baseUrl: "https://api.github.com", headers: { accept: "application/vnd.github.v3+json", - "user-agent": userAgent2 + "user-agent": userAgent4 }, mediaType: { format: "" } }; - function lowercaseKeys2(object) { + function lowercaseKeys4(object) { if (!object) { return {}; } @@ -38819,7 +38819,7 @@ var require_dist_node3 = __commonJS({ return newObj; }, {}); } - function isPlainObject3(value) { + function isPlainObject7(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -38830,21 +38830,21 @@ var require_dist_node3 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - function mergeDeep2(defaults, options) { + function mergeDeep4(defaults, options) { const result = Object.assign({}, defaults); Object.keys(options).forEach((key) => { - if (isPlainObject3(options[key])) { + if (isPlainObject7(options[key])) { if (!(key in defaults)) Object.assign(result, { [key]: options[key] }); else - result[key] = mergeDeep2(defaults[key], options[key]); + result[key] = mergeDeep4(defaults[key], options[key]); } else { Object.assign(result, { [key]: options[key] }); } }); return result; } - function removeUndefinedProperties2(obj) { + function removeUndefinedProperties4(obj) { for (const key in obj) { if (obj[key] === void 0) { delete obj[key]; @@ -38852,7 +38852,7 @@ var require_dist_node3 = __commonJS({ } return obj; } - function merge2(defaults, route, options) { + function merge4(defaults, route, options) { var _a2; if (typeof route === "string") { let [method, url] = route.split(" "); @@ -38860,10 +38860,10 @@ var require_dist_node3 = __commonJS({ } else { options = Object.assign({}, route); } - options.headers = lowercaseKeys2(options.headers); - removeUndefinedProperties2(options); - removeUndefinedProperties2(options.headers); - const mergedOptions = mergeDeep2(defaults || {}, options); + options.headers = lowercaseKeys4(options.headers); + removeUndefinedProperties4(options); + removeUndefinedProperties4(options.headers); + const mergedOptions = mergeDeep4(defaults || {}, options); if (options.url === "/graphql") { if (defaults && ((_a2 = defaults.mediaType.previews) == null ? void 0 : _a2.length)) { mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( @@ -38874,7 +38874,7 @@ var require_dist_node3 = __commonJS({ } return mergedOptions; } - function addQueryParameters2(url, parameters) { + function addQueryParameters4(url, parameters) { const separator = /\?/.test(url) ? "&" : "?"; const names = Object.keys(parameters); if (names.length === 0) { @@ -38887,18 +38887,18 @@ var require_dist_node3 = __commonJS({ return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } - var urlVariableRegex2 = /\{[^}]+\}/g; - function removeNonChars2(variableName) { + var urlVariableRegex4 = /\{[^}]+\}/g; + function removeNonChars4(variableName) { return variableName.replace(/^\W+|\W+$/g, "").split(/,/); } - function extractUrlVariableNames2(url) { - const matches = url.match(urlVariableRegex2); + function extractUrlVariableNames4(url) { + const matches = url.match(urlVariableRegex4); if (!matches) { return []; } - return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); + return matches.map(removeNonChars4).reduce((a, b) => a.concat(b), []); } - function omit2(object, keysToOmit) { + function omit4(object, keysToOmit) { const result = { __proto__: null }; for (const key of Object.keys(object)) { if (keysToOmit.indexOf(key) === -1) { @@ -38907,7 +38907,7 @@ var require_dist_node3 = __commonJS({ } return result; } - function encodeReserved2(str) { + function encodeReserved4(str) { return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { if (!/%[0-9A-Fa-f]/.test(part)) { part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); @@ -38915,67 +38915,67 @@ var require_dist_node3 = __commonJS({ return part; }).join(""); } - function encodeUnreserved2(str) { + function encodeUnreserved4(str) { return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { return "%" + c.charCodeAt(0).toString(16).toUpperCase(); }); } - function encodeValue2(operator, value, key) { - value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + function encodeValue4(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved4(value) : encodeUnreserved4(value); if (key) { - return encodeUnreserved2(key) + "=" + value; + return encodeUnreserved4(key) + "=" + value; } else { return value; } } - function isDefined2(value) { + function isDefined4(value) { return value !== void 0 && value !== null; } - function isKeyOperator2(operator) { + function isKeyOperator4(operator) { return operator === ";" || operator === "&" || operator === "?"; } - function getValues2(context3, operator, key, modifier) { + function getValues4(context3, operator, key, modifier) { var value = context3[key], result = []; - if (isDefined2(value) && value !== "") { + if (isDefined4(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { value = value.substring(0, parseInt(modifier, 10)); } result.push( - encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value, isKeyOperator4(operator) ? key : "") ); } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { + value.filter(isDefined4).forEach(function(value2) { result.push( - encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value2, isKeyOperator4(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - result.push(encodeValue2(operator, value[k], k)); + if (isDefined4(value[k])) { + result.push(encodeValue4(operator, value[k], k)); } }); } } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { - tmp.push(encodeValue2(operator, value2)); + value.filter(isDefined4).forEach(function(value2) { + tmp.push(encodeValue4(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - tmp.push(encodeUnreserved2(k)); - tmp.push(encodeValue2(operator, value[k].toString())); + if (isDefined4(value[k])) { + tmp.push(encodeUnreserved4(k)); + tmp.push(encodeValue4(operator, value[k].toString())); } }); } - if (isKeyOperator2(operator)) { - result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + if (isKeyOperator4(operator)) { + result.push(encodeUnreserved4(key) + "=" + tmp.join(",")); } else if (tmp.length !== 0) { result.push(tmp.join(",")); } @@ -38983,23 +38983,23 @@ var require_dist_node3 = __commonJS({ } } else { if (operator === ";") { - if (isDefined2(value)) { - result.push(encodeUnreserved2(key)); + if (isDefined4(value)) { + result.push(encodeUnreserved4(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { - result.push(encodeUnreserved2(key) + "="); + result.push(encodeUnreserved4(key) + "="); } else if (value === "") { result.push(""); } } return result; } - function parseUrl2(template) { + function parseUrl4(template) { return { - expand: expand2.bind(null, template) + expand: expand4.bind(null, template) }; } - function expand2(template, context3) { + function expand4(template, context3) { var operators = ["+", "#", ".", "/", ";", "?", "&"]; template = template.replace( /\{([^\{\}]+)\}|([^\{\}]+)/g, @@ -39013,7 +39013,7 @@ var require_dist_node3 = __commonJS({ } expression.split(/,/g).forEach(function(variable) { var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); - values.push(getValues2(context3, operator, tmp[1], tmp[2] || tmp[3])); + values.push(getValues4(context3, operator, tmp[1], tmp[2] || tmp[3])); }); if (operator && operator !== "+") { var separator = ","; @@ -39027,7 +39027,7 @@ var require_dist_node3 = __commonJS({ return values.join(","); } } else { - return encodeReserved2(literal); + return encodeReserved4(literal); } } ); @@ -39037,13 +39037,13 @@ var require_dist_node3 = __commonJS({ return template.replace(/\/$/, ""); } } - function parse3(options) { + function parse5(options) { var _a2; let method = options.method.toUpperCase(); let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); let headers = Object.assign({}, options.headers); let body; - let parameters = omit2(options, [ + let parameters = omit4(options, [ "method", "baseUrl", "url", @@ -39051,13 +39051,13 @@ var require_dist_node3 = __commonJS({ "request", "mediaType" ]); - const urlVariableNames = extractUrlVariableNames2(url); - url = parseUrl2(url).expand(parameters); + const urlVariableNames = extractUrlVariableNames4(url); + url = parseUrl4(url).expand(parameters); if (!/^http/.test(url)) { url = options.baseUrl + url; } const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); - const remainingParameters = omit2(parameters, omittedParameters); + const remainingParameters = omit4(parameters, omittedParameters); const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); if (!isBinaryRequest) { if (options.mediaType.format) { @@ -39079,7 +39079,7 @@ var require_dist_node3 = __commonJS({ } } if (["GET", "HEAD"].includes(method)) { - url = addQueryParameters2(url, remainingParameters); + url = addQueryParameters4(url, remainingParameters); } else { if ("data" in remainingParameters) { body = remainingParameters.data; @@ -39101,20 +39101,20 @@ var require_dist_node3 = __commonJS({ options.request ? { request: options.request } : null ); } - function endpointWithDefaults2(defaults, route, options) { - return parse3(merge2(defaults, route, options)); + function endpointWithDefaults4(defaults, route, options) { + return parse5(merge4(defaults, route, options)); } - function withDefaults4(oldDefaults, newDefaults) { - const DEFAULTS22 = merge2(oldDefaults, newDefaults); - const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + function withDefaults8(oldDefaults, newDefaults) { + const DEFAULTS22 = merge4(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults4.bind(null, DEFAULTS22); return Object.assign(endpoint22, { DEFAULTS: DEFAULTS22, - defaults: withDefaults4.bind(null, DEFAULTS22), - merge: merge2.bind(null, DEFAULTS22), - parse: parse3 + defaults: withDefaults8.bind(null, DEFAULTS22), + merge: merge4.bind(null, DEFAULTS22), + parse: parse5 }); } - var endpoint2 = withDefaults4(null, DEFAULTS2); + var endpoint4 = withDefaults8(null, DEFAULTS4); } }); @@ -39241,14 +39241,14 @@ var require_dist_node5 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - RequestError: () => RequestError2 + RequestError: () => RequestError4 }); module.exports = __toCommonJS(dist_src_exports); var import_deprecation = require_dist_node4(); var import_once = __toESM2(require_once()); var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation)); var logOnceHeaders = (0, import_once.default)((deprecation) => console.warn(deprecation)); - var RequestError2 = class extends Error { + var RequestError4 = class extends Error { constructor(message, statusCode, options) { super(message); if (Error.captureStackTrace) { @@ -39323,13 +39323,13 @@ var require_dist_node6 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - request: () => request2 + request: () => request4 }); module.exports = __toCommonJS(dist_src_exports); - var import_endpoint2 = require_dist_node3(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "8.4.0"; - function isPlainObject3(value) { + var import_endpoint4 = require_dist_node3(); + var import_universal_user_agent13 = require_dist_node(); + var VERSION17 = "8.4.0"; + function isPlainObject7(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -39340,15 +39340,15 @@ var require_dist_node6 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - var import_request_error3 = require_dist_node5(); + var import_request_error6 = require_dist_node5(); function getBufferResponse(response) { return response.arrayBuffer(); } - function fetchWrapper2(requestOptions) { + function fetchWrapper4(requestOptions) { var _a2, _b, _c, _d; const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console; const parseSuccessResponseBody = ((_a2 = requestOptions.request) == null ? void 0 : _a2.parseSuccessResponseBody) !== false; - if (isPlainObject3(requestOptions.body) || Array.isArray(requestOptions.body)) { + if (isPlainObject7(requestOptions.body) || Array.isArray(requestOptions.body)) { requestOptions.body = JSON.stringify(requestOptions.body); } let headers = {}; @@ -39390,7 +39390,7 @@ var require_dist_node6 = __commonJS({ if (status < 400) { return; } - throw new import_request_error3.RequestError(response.statusText, status, { + throw new import_request_error6.RequestError(response.statusText, status, { response: { url, status, @@ -39401,19 +39401,19 @@ var require_dist_node6 = __commonJS({ }); } if (status === 304) { - throw new import_request_error3.RequestError("Not modified", status, { + throw new import_request_error6.RequestError("Not modified", status, { response: { url, status, headers, - data: await getResponseData2(response) + data: await getResponseData4(response) }, request: requestOptions }); } if (status >= 400) { - const data = await getResponseData2(response); - const error2 = new import_request_error3.RequestError(toErrorMessage2(data), status, { + const data = await getResponseData4(response); + const error2 = new import_request_error6.RequestError(toErrorMessage4(data), status, { response: { url, status, @@ -39424,7 +39424,7 @@ var require_dist_node6 = __commonJS({ }); throw error2; } - return parseSuccessResponseBody ? await getResponseData2(response) : response.body; + return parseSuccessResponseBody ? await getResponseData4(response) : response.body; }).then((data) => { return { status, @@ -39433,7 +39433,7 @@ var require_dist_node6 = __commonJS({ data }; }).catch((error2) => { - if (error2 instanceof import_request_error3.RequestError) + if (error2 instanceof import_request_error6.RequestError) throw error2; else if (error2.name === "AbortError") throw error2; @@ -39445,12 +39445,12 @@ var require_dist_node6 = __commonJS({ message = error2.cause; } } - throw new import_request_error3.RequestError(message, 500, { + throw new import_request_error6.RequestError(message, 500, { request: requestOptions }); }); } - async function getResponseData2(response) { + async function getResponseData4(response) { const contentType = response.headers.get("content-type"); if (/application\/json/.test(contentType)) { return response.json().catch(() => response.text()).catch(() => ""); @@ -39460,7 +39460,7 @@ var require_dist_node6 = __commonJS({ } return getBufferResponse(response); } - function toErrorMessage2(data) { + function toErrorMessage4(data) { if (typeof data === "string") return data; let suffix; @@ -39477,32 +39477,32 @@ var require_dist_node6 = __commonJS({ } return `Unknown error: ${JSON.stringify(data)}`; } - function withDefaults4(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + function withDefaults8(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper2(endpoint2.parse(endpointOptions)); + return fetchWrapper4(endpoint22.parse(endpointOptions)); } const request22 = (route2, parameters2) => { - return fetchWrapper2( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + return fetchWrapper4( + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; Object.assign(request22, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); } - var request2 = withDefaults4(import_endpoint2.endpoint, { + var request4 = withDefaults8(import_endpoint4.endpoint, { headers: { - "user-agent": `octokit-request.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-request.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}` } }); } @@ -39537,8 +39537,8 @@ var require_dist_node7 = __commonJS({ }); module.exports = __toCommonJS(dist_src_exports); var import_request32 = require_dist_node6(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "7.1.0"; + var import_universal_user_agent13 = require_dist_node(); + var VERSION17 = "7.1.0"; var import_request22 = require_dist_node6(); var import_request15 = require_dist_node6(); function _buildMessageForResponseErrors2(data) { @@ -39546,9 +39546,9 @@ var require_dist_node7 = __commonJS({ ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError2 = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors2(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.name = "GraphqlResponseError"; @@ -39570,7 +39570,7 @@ var require_dist_node7 = __commonJS({ ]; var FORBIDDEN_VARIABLE_OPTIONS2 = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX2 = /\/api\/v3\/?$/; - function graphql3(request2, query, options) { + function graphql3(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -39601,11 +39601,11 @@ var require_dist_node7 = __commonJS({ result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX2.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX2, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -39620,25 +39620,25 @@ var require_dist_node7 = __commonJS({ return response.data.data; }); } - function withDefaults4(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); + function withDefaults8(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql3(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults4.bind(null, newRequest), + defaults: withDefaults8.bind(null, newRequest), endpoint: newRequest.endpoint }); } - var graphql22 = withDefaults4(import_request32.request, { + var graphql22 = withDefaults8(import_request32.request, { headers: { - "user-agent": `octokit-graphql.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-graphql.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}` }, method: "POST", url: "/graphql" }); function withCustomRequest2(customRequest) { - return withDefaults4(customRequest, { + return withDefaults8(customRequest, { method: "POST", url: "/graphql" }); @@ -39692,13 +39692,13 @@ var require_dist_node8 = __commonJS({ } return `token ${token}`; } - async function hook6(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( + async function hook6(token, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix2(token); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix2(token); + return request4(endpoint4); } var createTokenAuth3 = function createTokenAuth22(token) { if (!token) { @@ -39743,17 +39743,17 @@ var require_dist_node9 = __commonJS({ Octokit: () => Octokit3 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node(); + var import_universal_user_agent13 = require_dist_node(); var import_before_after_hook2 = require_before_after_hook(); var import_request15 = require_dist_node6(); var import_graphql2 = require_dist_node7(); var import_auth_token2 = require_dist_node8(); - var VERSION13 = "5.2.0"; + var VERSION17 = "5.2.0"; var noop2 = () => { }; var consoleWarn2 = console.warn.bind(console); var consoleError2 = console.error.bind(console); - var userAgentTrail2 = `octokit-core.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; + var userAgentTrail2 = `octokit-core.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}`; var _a2; var Octokit3 = (_a2 = class { static defaults(defaults) { @@ -39856,7 +39856,7 @@ var require_dist_node9 = __commonJS({ } } }, (() => { - _a2.VERSION = VERSION13; + _a2.VERSION = VERSION17; })(), (() => { _a2.plugins = []; })(), _a2); @@ -39890,7 +39890,7 @@ var require_dist_node10 = __commonJS({ restEndpointMethods: () => restEndpointMethods2 }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "10.4.1"; + var VERSION17 = "10.4.1"; var Endpoints2 = { actions: { addCustomLabelsToSelfHostedRunnerForOrg: [ @@ -41882,8 +41882,8 @@ var require_dist_node10 = __commonJS({ var endpoints_default2 = Endpoints2; var endpointMethodsMap2 = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default2)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -42006,7 +42006,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - restEndpointMethods2.VERSION = VERSION13; + restEndpointMethods2.VERSION = VERSION17; function legacyRestEndpointMethods2(octokit) { const api = endpointsToMethods2(octokit); return { @@ -42014,7 +42014,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - legacyRestEndpointMethods2.VERSION = VERSION13; + legacyRestEndpointMethods2.VERSION = VERSION17; } }); @@ -42047,7 +42047,7 @@ var require_dist_node11 = __commonJS({ paginatingEndpoints: () => paginatingEndpoints }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "9.2.1"; + var VERSION17 = "9.2.1"; function normalizePaginatedListResponse2(response) { if (!response.data) { return { @@ -42393,7 +42393,7 @@ var require_dist_node11 = __commonJS({ }) }; } - paginateRest2.VERSION = VERSION13; + paginateRest2.VERSION = VERSION17; } }); @@ -42524,7 +42524,7 @@ var require_fast_content_type_parse = __commonJS({ var defaultContentType = { type: "", parameters: new NullObject() }; Object.freeze(defaultContentType.parameters); Object.freeze(defaultContentType); - function parse3(header) { + function parse5(header) { if (typeof header !== "string") { throw new TypeError("argument header is required and must be a string"); } @@ -42562,7 +42562,7 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - function safeParse2(header) { + function safeParse4(header) { if (typeof header !== "string") { return defaultContentType; } @@ -42600,9 +42600,9 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - module.exports.default = { parse: parse3, safeParse: safeParse2 }; - module.exports.parse = parse3; - module.exports.safeParse = safeParse2; + module.exports.default = { parse: parse5, safeParse: safeParse4 }; + module.exports.parse = parse5; + module.exports.safeParse = safeParse4; module.exports.defaultContentType = defaultContentType; } }); @@ -42710,7 +42710,7 @@ var require_parser = __commonJS({ let footer = null; let header = null; const mentions = []; - let merge2 = null; + let merge4 = null; const notes = []; const references = []; let revert = null; @@ -42720,7 +42720,7 @@ var require_parser = __commonJS({ footer, header, mentions, - merge: merge2, + merge: merge4, notes, references, revert, @@ -42729,14 +42729,14 @@ var require_parser = __commonJS({ type: null }; } - merge2 = lines.shift(); + merge4 = lines.shift(); const mergeParts = {}; const headerParts = {}; body = ""; footer = ""; - const mergeMatch = merge2.match(options.mergePattern); + const mergeMatch = merge4.match(options.mergePattern); if (mergeMatch && options.mergePattern) { - merge2 = mergeMatch[0]; + merge4 = mergeMatch[0]; header = lines.shift(); while (header !== void 0 && !header.trim()) { header = lines.shift(); @@ -42749,8 +42749,8 @@ var require_parser = __commonJS({ mergeParts[partName] = partValue; }); } else { - header = merge2; - merge2 = null; + header = merge4; + merge4 = null; mergeCorrespondence.forEach(function(partName) { mergeParts[partName] = null; }); @@ -42849,7 +42849,7 @@ var require_parser = __commonJS({ const msg = { ...headerParts, ...mergeParts, - merge: merge2, + merge: merge4, header, body: body ? trimOffNewlines(body) : null, footer: footer ? trimOffNewlines(footer) : null, @@ -43222,9 +43222,9 @@ function addQueryParameters(url, parameters) { return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } -var urlVariableRegex = /\{[^}]+\}/g; +var urlVariableRegex = /\{[^{}}]+\}/g; function removeNonChars(variableName) { - return variableName.replace(/^\W+|\W+$/g, "").split(/,/); + return variableName.replace(/(?:^\W+)|(?:(? { const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; return `application/vnd.github.${preview}-preview${format}`; @@ -43440,12 +43440,12 @@ function endpointWithDefaults(defaults, route, options) { return parse(merge(defaults, route, options)); } function withDefaults(oldDefaults, newDefaults) { - const DEFAULTS2 = merge(oldDefaults, newDefaults); - const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2); - return Object.assign(endpoint2, { - DEFAULTS: DEFAULTS2, - defaults: withDefaults.bind(null, DEFAULTS2), - merge: merge.bind(null, DEFAULTS2), + const DEFAULTS22 = merge(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults.bind(null, DEFAULTS22), + merge: merge.bind(null, DEFAULTS22), parse }); } @@ -43474,7 +43474,7 @@ var RequestError = class extends Error { if (options.request.headers.authorization) { requestCopy.headers = Object.assign({}, options.request.headers, { authorization: options.request.headers.authorization.replace( - / .*$/, + /(?]+)>; rel="deprecation"/); + const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/); const deprecationLink = matches && matches.pop(); log.warn( `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` @@ -43637,40 +43637,570 @@ function toErrorMessage(data) { return `Unknown error: ${JSON.stringify(data)}`; } function withDefaults2(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper(endpoint2.parse(endpointOptions)); + return fetchWrapper(endpoint22.parse(endpointOptions)); } - const request2 = (route2, parameters2) => { + const request22 = (route2, parameters2) => { return fetchWrapper( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; - Object.assign(request2, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); - return endpointOptions.request.hook(request2, endpointOptions); + return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); } var request = withDefaults2(endpoint, defaults_default); // var VERSION3 = "0.0.0-development"; +var userAgent2 = `octokit-endpoint.js/${VERSION3} ${getUserAgent()}`; +var DEFAULTS2 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent2 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys2(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject3(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep2(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject3(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep2(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties2(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge2(defaults, route, options) { + var _a2; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys2(options.headers); + removeUndefinedProperties2(options); + removeUndefinedProperties2(options.headers); + const mergedOptions = mergeDeep2(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a2 = defaults.mediaType.previews) == null ? void 0 : _a2.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters2(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex2 = /\{[^}]+\}/g; +function removeNonChars2(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames2(url) { + const matches = url.match(urlVariableRegex2); + if (!matches) { + return []; + } + return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); +} +function omit2(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved2(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved2(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue2(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + if (key) { + return encodeUnreserved2(key) + "=" + value; + } else { + return value; + } +} +function isDefined2(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator2(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues2(context3, operator, key, modifier) { + var value = context3[key], result = []; + if (isDefined2(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + result.push( + encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + result.push(encodeValue2(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + tmp.push(encodeValue2(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + tmp.push(encodeUnreserved2(k)); + tmp.push(encodeValue2(operator, value[k].toString())); + } + }); + } + if (isKeyOperator2(operator)) { + result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined2(value)) { + result.push(encodeUnreserved2(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved2(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl2(template) { + return { + expand: expand2.bind(null, template) + }; +} +function expand2(template, context3) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues2(context3, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved2(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse2(options) { + var _a2; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit2(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames2(url); + url = parseUrl2(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit2(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a2 = options.mediaType.previews) == null ? void 0 : _a2.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters2(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults2(defaults, route, options) { + return parse2(merge2(defaults, route, options)); +} +function withDefaults3(oldDefaults, newDefaults) { + const DEFAULTS22 = merge2(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults3.bind(null, DEFAULTS22), + merge: merge2.bind(null, DEFAULTS22), + parse: parse2 + }); +} +var endpoint2 = withDefaults3(null, DEFAULTS2); + +// +var import_fast_content_type_parse2 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError2 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION4 = "0.0.0-development"; +var defaults_default2 = { + headers: { + "user-agent": `octokit-request.js/${VERSION4} ${getUserAgent()}` + } +}; +function isPlainObject4(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper2(requestOptions) { + var _a2, _b, _c, _d, _e; + const fetch2 = ((_a2 = requestOptions.request) == null ? void 0 : _a2.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject4(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error2) { + let message = "Unknown Error"; + if (error2 instanceof Error) { + if (error2.name === "AbortError") { + error2.status = 500; + throw error2; + } + message = error2.message; + if (error2.name === "TypeError" && "cause" in error2) { + if (error2.cause instanceof Error) { + message = error2.cause.message; + } else if (typeof error2.cause === "string") { + message = error2.cause; + } + } + } + const requestError = new RequestError2(message, 500, { + request: requestOptions + }); + requestError.cause = error2; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError2(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2(toErrorMessage2(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData2(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData2(response) { + var _a2; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse2.safeParse)(contentType); + if (isJSONResponse2(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a2 = mimetype.parameters.charset) == null ? void 0 : _a2.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse2(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage2(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults4(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper2(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper2( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); +} +var request2 = withDefaults4(endpoint2, defaults_default2); + +// +var VERSION5 = "0.0.0-development"; function _buildMessageForResponseErrors(data) { return `Request failed due to following response errors: ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.errors = response.errors; @@ -43695,7 +44225,7 @@ var NON_VARIABLE_OPTIONS = [ ]; var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; -function graphql(request2, query, options) { +function graphql(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -43726,11 +44256,11 @@ function graphql(request2, query, options) { result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -43745,25 +44275,25 @@ function graphql(request2, query, options) { return response.data.data; }); } -function withDefaults3(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); +function withDefaults5(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults3.bind(null, newRequest), + defaults: withDefaults5.bind(null, newRequest), endpoint: newRequest.endpoint }); } -var graphql2 = withDefaults3(request, { +var graphql2 = withDefaults5(request2, { headers: { - "user-agent": `octokit-graphql.js/${VERSION3} ${getUserAgent()}` + "user-agent": `octokit-graphql.js/${VERSION5} ${getUserAgent()}` }, method: "POST", url: "/graphql" }); function withCustomRequest(customRequest) { - return withDefaults3(customRequest, { + return withDefaults5(customRequest, { method: "POST", url: "/graphql" }); @@ -43791,13 +44321,13 @@ function withAuthorizationPrefix(token) { } return `token ${token}`; } -async function hook(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( +async function hook(token, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix(token); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix(token); + return request4(endpoint4); } var createTokenAuth = function createTokenAuth2(token) { if (!token) { @@ -43815,14 +44345,14 @@ var createTokenAuth = function createTokenAuth2(token) { }; // -var VERSION4 = "6.1.3"; +var VERSION6 = "6.1.4"; // var noop = () => { }; var consoleWarn = console.warn.bind(console); var consoleError = console.error.bind(console); -var userAgentTrail = `octokit-core.js/${VERSION4} ${getUserAgent()}`; +var userAgentTrail = `octokit-core.js/${VERSION6} ${getUserAgent()}`; var Octokit = class { static defaults(defaults) { const OctokitWithDefaults = class extends this { @@ -43927,20 +44457,20 @@ var Octokit = class { hook; auth; }; -__publicField(Octokit, "VERSION", VERSION4); +__publicField(Octokit, "VERSION", VERSION6); __publicField(Octokit, "plugins", []); // -var VERSION5 = "5.3.1"; +var VERSION7 = "5.3.1"; // function requestLog(octokit) { - octokit.hook.wrap("request", (request2, options) => { + octokit.hook.wrap("request", (request4, options) => { octokit.log.debug("request", options); const start = Date.now(); const requestOptions = octokit.request.endpoint.parse(options); const path = requestOptions.url.replace(options.baseUrl, ""); - return request2(options).then((response) => { + return request4(options).then((response) => { const requestId = response.headers["x-github-request-id"]; octokit.log.info( `${requestOptions.method} ${path} - ${response.status} with id ${requestId} in ${Date.now() - start}ms` @@ -43956,10 +44486,10 @@ function requestLog(octokit) { }); }); } -requestLog.VERSION = VERSION5; +requestLog.VERSION = VERSION7; // -var VERSION6 = "0.0.0-development"; +var VERSION8 = "0.0.0-development"; function normalizePaginatedListResponse(response) { if (!response.data) { return { @@ -44003,7 +44533,7 @@ function iterator(octokit, route, parameters) { const response = await requestMethod({ method, url, headers }); const normalizedResponse = normalizePaginatedListResponse(response); url = ((normalizedResponse.headers.link || "").match( - /<([^>]+)>;\s*rel="next"/ + /<([^<>]+)>;\s*rel="next"/ ) || [])[1]; return { value: normalizedResponse }; } catch (error2) { @@ -44062,10 +44592,10 @@ function paginateRest(octokit) { }) }; } -paginateRest.VERSION = VERSION6; +paginateRest.VERSION = VERSION8; // -var VERSION7 = "13.3.1"; +var VERSION9 = "13.3.1"; // var Endpoints = { @@ -46138,8 +46668,8 @@ var endpoints_default = Endpoints; // var endpointMethodsMap = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -46264,7 +46794,7 @@ function restEndpointMethods(octokit) { rest: api }; } -restEndpointMethods.VERSION = VERSION7; +restEndpointMethods.VERSION = VERSION9; function legacyRestEndpointMethods(octokit) { const api = endpointsToMethods(octokit); return { @@ -46272,15 +46802,15 @@ function legacyRestEndpointMethods(octokit) { rest: api }; } -legacyRestEndpointMethods.VERSION = VERSION7; +legacyRestEndpointMethods.VERSION = VERSION9; // -var VERSION8 = "21.1.0"; +var VERSION10 = "21.1.1"; // var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRest).defaults( { - userAgent: `octokit-rest.js/${VERSION8}` + userAgent: `octokit-rest.js/${VERSION10}` } ); @@ -46612,25 +47142,25 @@ var allLabels = { var import_core2 = __toESM(require_core()); // -function requestToOAuthBaseUrl(request2) { - const endpointDefaults = request2.endpoint.DEFAULTS; +function requestToOAuthBaseUrl(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); } -async function oauthRequest(request2, route, parameters) { +async function oauthRequest(request4, route, parameters) { const withOAuthParameters = { - baseUrl: requestToOAuthBaseUrl(request2), + baseUrl: requestToOAuthBaseUrl(request4), headers: { accept: "application/json" }, ...parameters }; - const response = await request2(route, withOAuthParameters); + const response = await request4(route, withOAuthParameters); if ("error" in response.data) { const error2 = new RequestError( `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, 400, { - request: request2.endpoint.merge( + request: request4.endpoint.merge( route, withOAuthParameters ) @@ -46641,32 +47171,43 @@ async function oauthRequest(request2, route, parameters) { } return response; } -async function exchangeWebFlowCode(options) { - const request2 = options.request || request; +async function createDeviceCode(options) { + const request4 = options.request || request; + const parameters = { + client_id: options.clientId + }; + if ("scopes" in options && Array.isArray(options.scopes)) { + parameters.scope = options.scopes.join(" "); + } + return oauthRequest(request4, "POST /login/device/code", parameters); +} +async function exchangeDeviceCode(options) { + const request4 = options.request || request; const response = await oauthRequest( - request2, + request4, "POST /login/oauth/access_token", { client_id: options.clientId, - client_secret: options.clientSecret, - code: options.code, - redirect_uri: options.redirectUrl + device_code: options.code, + grant_type: "urn:ietf:params:oauth:grant-type:device_code" } ); const authentication = { clientType: options.clientType, clientId: options.clientId, - clientSecret: options.clientSecret, token: response.data.access_token, scopes: response.data.scope.split(/\s+/).filter(Boolean) }; + if ("clientSecret" in options) { + authentication.clientSecret = options.clientSecret; + } if (options.clientType === "github-app") { if ("refresh_token" in response.data) { const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp( + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( apiTimeInMs, response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp( + ), authentication.refreshTokenExpiresAt = toTimestamp2( apiTimeInMs, response.data.refresh_token_expires_in ); @@ -46675,46 +47216,722 @@ async function exchangeWebFlowCode(options) { } return { ...response, authentication }; } -function toTimestamp(apiTimeInMs, expirationInSeconds) { +function toTimestamp2(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } -async function createDeviceCode(options) { - const request2 = options.request || request; - const parameters = { - client_id: options.clientId + +// +async function getOAuthAccessToken(state, options) { + const cachedAuthentication = getCachedAuthentication(state, options.auth); + if (cachedAuthentication) + return cachedAuthentication; + const { data: verification } = await createDeviceCode({ + clientType: state.clientType, + clientId: state.clientId, + request: options.request || state.request, + scopes: options.auth.scopes || state.scopes + }); + await state.onVerification(verification); + const authentication = await waitForAccessToken( + options.request || state.request, + state.clientId, + state.clientType, + verification + ); + state.authentication = authentication; + return authentication; +} +function getCachedAuthentication(state, auth22) { + if (auth22.refresh === true) + return false; + if (!state.authentication) + return false; + if (state.clientType === "github-app") { + return state.authentication; + } + const authentication = state.authentication; + const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( + " " + ); + const currentScope = authentication.scopes.join(" "); + return newScope === currentScope ? authentication : false; +} +async function wait(seconds) { + await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); +} +async function waitForAccessToken(request4, clientId, clientType, verification) { + try { + const options = { + clientId, + request: request4, + code: verification.device_code + }; + const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ + ...options, + clientType: "oauth-app" + }) : await exchangeDeviceCode({ + ...options, + clientType: "github-app" + }); + return { + type: "token", + tokenType: "oauth", + ...authentication + }; + } catch (error2) { + if (!error2.response) + throw error2; + const errorType = error2.response.data.error; + if (errorType === "authorization_pending") { + await wait(verification.interval); + return waitForAccessToken(request4, clientId, clientType, verification); + } + if (errorType === "slow_down") { + await wait(verification.interval + 5); + return waitForAccessToken(request4, clientId, clientType, verification); + } + throw error2; + } +} +async function auth2(state, authOptions) { + return getOAuthAccessToken(state, { + auth: authOptions + }); +} +async function hook2(state, request4, route, parameters) { + let endpoint4 = request4.endpoint.merge( + route, + parameters + ); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); + } + const { token } = await getOAuthAccessToken(state, { + request: request4, + auth: { type: "oauth" } + }); + endpoint4.headers.authorization = `token ${token}`; + return request4(endpoint4); +} +var VERSION11 = "0.0.0-development"; +function createOAuthDeviceAuth(options) { + const requestWithDefaults = options.request || request.defaults({ + headers: { + "user-agent": `octokit-auth-oauth-device.js/${VERSION11} ${getUserAgent()}` + } + }); + const { request: request4 = requestWithDefaults, ...otherOptions } = options; + const state = options.clientType === "github-app" ? { + ...otherOptions, + clientType: "github-app", + request: request4 + } : { + ...otherOptions, + clientType: "oauth-app", + request: request4, + scopes: options.scopes || [] }; - if ("scopes" in options && Array.isArray(options.scopes)) { - parameters.scope = options.scopes.join(" "); + if (!options.clientId) { + throw new Error( + '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' + ); + } + if (!options.onVerification) { + throw new Error( + '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' + ); } - return oauthRequest(request2, "POST /login/device/code", parameters); + return Object.assign(auth2.bind(null, state), { + hook: hook2.bind(null, state) + }); } -async function exchangeDeviceCode(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + +// +var VERSION12 = "0.0.0-development"; +var userAgent3 = `octokit-endpoint.js/${VERSION12} ${getUserAgent()}`; +var DEFAULTS3 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent3 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys3(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject5(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep3(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject5(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep3(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties3(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge3(defaults, route, options) { + var _a2; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys3(options.headers); + removeUndefinedProperties3(options); + removeUndefinedProperties3(options.headers); + const mergedOptions = mergeDeep3(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a2 = defaults.mediaType.previews) == null ? void 0 : _a2.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters3(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex3 = /\{[^}]+\}/g; +function removeNonChars3(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames3(url) { + const matches = url.match(urlVariableRegex3); + if (!matches) { + return []; + } + return matches.map(removeNonChars3).reduce((a, b) => a.concat(b), []); +} +function omit3(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved3(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved3(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue3(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved3(value) : encodeUnreserved3(value); + if (key) { + return encodeUnreserved3(key) + "=" + value; + } else { + return value; + } +} +function isDefined3(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator3(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues3(context3, operator, key, modifier) { + var value = context3[key], result = []; + if (isDefined3(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue3(operator, value, isKeyOperator3(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + result.push( + encodeValue3(operator, value2, isKeyOperator3(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + result.push(encodeValue3(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + tmp.push(encodeValue3(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + tmp.push(encodeUnreserved3(k)); + tmp.push(encodeValue3(operator, value[k].toString())); + } + }); + } + if (isKeyOperator3(operator)) { + result.push(encodeUnreserved3(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined3(value)) { + result.push(encodeUnreserved3(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved3(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl3(template) { + return { + expand: expand3.bind(null, template) + }; +} +function expand3(template, context3) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues3(context3, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved3(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse4(options) { + var _a2; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit3(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames3(url); + url = parseUrl3(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit3(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a2 = options.mediaType.previews) == null ? void 0 : _a2.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters3(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults3(defaults, route, options) { + return parse4(merge3(defaults, route, options)); +} +function withDefaults6(oldDefaults, newDefaults) { + const DEFAULTS22 = merge3(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults3.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults6.bind(null, DEFAULTS22), + merge: merge3.bind(null, DEFAULTS22), + parse: parse4 + }); +} +var endpoint3 = withDefaults6(null, DEFAULTS3); + +// +var import_fast_content_type_parse3 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError3 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION13 = "0.0.0-development"; +var defaults_default3 = { + headers: { + "user-agent": `octokit-request.js/${VERSION13} ${getUserAgent()}` + } +}; +function isPlainObject6(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper3(requestOptions) { + var _a2, _b, _c, _d, _e; + const fetch2 = ((_a2 = requestOptions.request) == null ? void 0 : _a2.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject6(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error2) { + let message = "Unknown Error"; + if (error2 instanceof Error) { + if (error2.name === "AbortError") { + error2.status = 500; + throw error2; + } + message = error2.message; + if (error2.name === "TypeError" && "cause" in error2) { + if (error2.cause instanceof Error) { + message = error2.cause.message; + } else if (typeof error2.cause === "string") { + message = error2.cause; + } + } + } + const requestError = new RequestError3(message, 500, { + request: requestOptions + }); + requestError.cause = error2; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError3(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3(toErrorMessage3(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData3(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData3(response) { + var _a2; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse3.safeParse)(contentType); + if (isJSONResponse3(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a2 = mimetype.parameters.charset) == null ? void 0 : _a2.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse3(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage3(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults7(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper3(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper3( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults7.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults7.bind(null, endpoint22) + }); +} +var request3 = withDefaults7(endpoint3, defaults_default3); + +// +function requestToOAuthBaseUrl2(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; + return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); +} +async function oauthRequest2(request4, route, parameters) { + const withOAuthParameters = { + baseUrl: requestToOAuthBaseUrl2(request4), + headers: { + accept: "application/json" + }, + ...parameters + }; + const response = await request4(route, withOAuthParameters); + if ("error" in response.data) { + const error2 = new RequestError3( + `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, + 400, + { + request: request4.endpoint.merge( + route, + withOAuthParameters + ) + } + ); + error2.response = response; + throw error2; + } + return response; +} +async function exchangeWebFlowCode(options) { + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, - device_code: options.code, - grant_type: "urn:ietf:params:oauth:grant-type:device_code" + client_secret: options.clientSecret, + code: options.code, + redirect_uri: options.redirectUrl } ); const authentication = { clientType: options.clientType, clientId: options.clientId, + clientSecret: options.clientSecret, token: response.data.access_token, scopes: response.data.scope.split(/\s+/).filter(Boolean) }; - if ("clientSecret" in options) { - authentication.clientSecret = options.clientSecret; - } if (options.clientType === "github-app") { if ("refresh_token" in response.data) { const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp( apiTimeInMs, response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp2( + ), authentication.refreshTokenExpiresAt = toTimestamp( apiTimeInMs, response.data.refresh_token_expires_in ); @@ -46723,12 +47940,12 @@ async function exchangeDeviceCode(options) { } return { ...response, authentication }; } -function toTimestamp2(apiTimeInMs, expirationInSeconds) { +function toTimestamp(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function checkToken(options) { - const request2 = options.request || request; - const response = await request2("POST /applications/{client_id}/token", { + const request4 = options.request || request3; + const response = await request4("POST /applications/{client_id}/token", { headers: { authorization: `basic ${btoa( `${options.clientId}:${options.clientSecret}` @@ -46752,9 +47969,9 @@ async function checkToken(options) { return { ...response, authentication }; } async function refreshToken(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, @@ -46782,9 +47999,9 @@ function toTimestamp3(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function resetToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - const response = await request2( + const response = await request4( "PATCH /applications/{client_id}/token", { headers: { @@ -46809,9 +48026,9 @@ async function resetToken(options) { return { ...response, authentication }; } async function deleteToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/token", { headers: { @@ -46823,9 +48040,9 @@ async function deleteToken(options) { ); } async function deleteAuthorization(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/grant", { headers: { @@ -46838,133 +48055,7 @@ async function deleteAuthorization(options) { } // -async function getOAuthAccessToken(state, options) { - const cachedAuthentication = getCachedAuthentication(state, options.auth); - if (cachedAuthentication) - return cachedAuthentication; - const { data: verification } = await createDeviceCode({ - clientType: state.clientType, - clientId: state.clientId, - request: options.request || state.request, - scopes: options.auth.scopes || state.scopes - }); - await state.onVerification(verification); - const authentication = await waitForAccessToken( - options.request || state.request, - state.clientId, - state.clientType, - verification - ); - state.authentication = authentication; - return authentication; -} -function getCachedAuthentication(state, auth22) { - if (auth22.refresh === true) - return false; - if (!state.authentication) - return false; - if (state.clientType === "github-app") { - return state.authentication; - } - const authentication = state.authentication; - const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( - " " - ); - const currentScope = authentication.scopes.join(" "); - return newScope === currentScope ? authentication : false; -} -async function wait(seconds) { - await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); -} -async function waitForAccessToken(request2, clientId, clientType, verification) { - try { - const options = { - clientId, - request: request2, - code: verification.device_code - }; - const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ - ...options, - clientType: "oauth-app" - }) : await exchangeDeviceCode({ - ...options, - clientType: "github-app" - }); - return { - type: "token", - tokenType: "oauth", - ...authentication - }; - } catch (error2) { - if (!error2.response) - throw error2; - const errorType = error2.response.data.error; - if (errorType === "authorization_pending") { - await wait(verification.interval); - return waitForAccessToken(request2, clientId, clientType, verification); - } - if (errorType === "slow_down") { - await wait(verification.interval + 5); - return waitForAccessToken(request2, clientId, clientType, verification); - } - throw error2; - } -} -async function auth2(state, authOptions) { - return getOAuthAccessToken(state, { - auth: authOptions - }); -} -async function hook2(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( - route, - parameters - ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); - } - const { token } = await getOAuthAccessToken(state, { - request: request2, - auth: { type: "oauth" } - }); - endpoint2.headers.authorization = `token ${token}`; - return request2(endpoint2); -} -var VERSION9 = "0.0.0-development"; -function createOAuthDeviceAuth(options) { - const requestWithDefaults = options.request || request.defaults({ - headers: { - "user-agent": `octokit-auth-oauth-device.js/${VERSION9} ${getUserAgent()}` - } - }); - const { request: request2 = requestWithDefaults, ...otherOptions } = options; - const state = options.clientType === "github-app" ? { - ...otherOptions, - clientType: "github-app", - request: request2 - } : { - ...otherOptions, - clientType: "oauth-app", - request: request2, - scopes: options.scopes || [] - }; - if (!options.clientId) { - throw new Error( - '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - if (!options.onVerification) { - throw new Error( - '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - return Object.assign(auth2.bind(null, state), { - hook: hook2.bind(null, state) - }); -} - -// -var VERSION10 = "0.0.0-development"; +var VERSION14 = "0.0.0-development"; async function getAuthentication(state) { if ("code" in state.strategyOptions) { const { authentication } = await exchangeWebFlowCode({ @@ -47100,30 +48191,30 @@ var ROUTES_REQUIRING_BASIC_AUTH = /\/applications\/[^/]+\/(token|grant)s?/; function requiresBasicAuth(url) { return url && ROUTES_REQUIRING_BASIC_AUTH.test(url); } -async function hook3(state, request2, route, parameters = {}) { - const endpoint2 = request2.endpoint.merge( +async function hook3(state, request4, route, parameters = {}) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); } - if (requiresBasicAuth(endpoint2.url)) { + if (requiresBasicAuth(endpoint4.url)) { const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; - return request2(endpoint2); + endpoint4.headers.authorization = `basic ${credentials}`; + return request4(endpoint4); } - const { token } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request2 }) : await auth3({ ...state, request: request2 }); - endpoint2.headers.authorization = "token " + token; - return request2(endpoint2); + const { token } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request4 }) : await auth3({ ...state, request: request4 }); + endpoint4.headers.authorization = "token " + token; + return request4(endpoint4); } function createOAuthUserAuth({ clientId, clientSecret, clientType = "oauth-app", - request: request2 = request.defaults({ + request: request4 = request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION10} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION14} ${getUserAgent()}` } }), onTokenCreated, @@ -47135,13 +48226,13 @@ function createOAuthUserAuth({ clientSecret, onTokenCreated, strategyOptions, - request: request2 + request: request4 }); return Object.assign(auth3.bind(null, state), { hook: hook3.bind(null, state) }); } -createOAuthUserAuth.VERSION = VERSION10; +createOAuthUserAuth.VERSION = VERSION14; // async function auth4(state, authOptions) { @@ -47180,37 +48271,37 @@ async function auth4(state, authOptions) { }); return userAuth(); } -async function hook4(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( +async function hook4(state, request22, route, parameters) { + let endpoint4 = request22.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request22(endpoint4); } - if (state.clientType === "github-app" && !requiresBasicAuth(endpoint2.url)) { + if (state.clientType === "github-app" && !requiresBasicAuth(endpoint4.url)) { throw new Error( - `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint2.method} ${endpoint2.url}" is not supported.` + `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint4.method} ${endpoint4.url}" is not supported.` ); } const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; + endpoint4.headers.authorization = `basic ${credentials}`; try { - return await request2(endpoint2); + return await request22(endpoint4); } catch (error2) { if (error2.status !== 401) throw error2; - error2.message = `[@octokit/auth-oauth-app] "${endpoint2.method} ${endpoint2.url}" does not support clientId/clientSecret basic authentication.`; + error2.message = `[@octokit/auth-oauth-app] "${endpoint4.method} ${endpoint4.url}" does not support clientId/clientSecret basic authentication.`; throw error2; } } -var VERSION11 = "0.0.0-development"; +var VERSION15 = "0.0.0-development"; function createOAuthAppAuth(options) { const state = Object.assign( { request: request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION11} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION15} ${getUserAgent()}` } }), clientType: "oauth-app" @@ -47654,7 +48745,7 @@ async function getInstallationAuthentication(state, options, customRequest) { } } const appAuthentication = await getAppAuthentication(state); - const request2 = customRequest || state.request; + const request4 = customRequest || state.request; const payload = { installation_id: installationId, mediaType: { @@ -47684,7 +48775,7 @@ async function getInstallationAuthentication(state, options, customRequest) { repository_selection: repositorySelectionOptional, single_file: singleFileName } - } = await request2( + } = await request4( "POST /app/installations/{installation_id}/access_tokens", payload ); @@ -47781,18 +48872,18 @@ function isNotTimeSkewError(error2) { /'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/ )); } -async function hook5(state, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge(route, parameters); - const url = endpoint2.url; +async function hook5(state, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge(route, parameters); + const url = endpoint4.url; if (/\/login\/oauth\/access_token$/.test(url)) { - return request2(endpoint2); + return request4(endpoint4); } - if (requiresAppAuth(url.replace(request2.endpoint.DEFAULTS.baseUrl, ""))) { + if (requiresAppAuth(url.replace(request4.endpoint.DEFAULTS.baseUrl, ""))) { const { token: token2 } = await getAppAuthentication(state); - endpoint2.headers.authorization = `bearer ${token2}`; + endpoint4.headers.authorization = `bearer ${token2}`; let response; try { - response = await request2(endpoint2); + response = await request4(endpoint4); } catch (error2) { if (isNotTimeSkewError(error2)) { throw error2; @@ -47811,33 +48902,33 @@ async function hook5(state, request2, route, parameters) { ...state, timeDifference: diff }); - endpoint2.headers.authorization = `bearer ${token3}`; - return request2(endpoint2); + endpoint4.headers.authorization = `bearer ${token3}`; + return request4(endpoint4); } return response; } if (requiresBasicAuth(url)) { const authentication = await state.oauthApp({ type: "oauth-app" }); - endpoint2.headers.authorization = authentication.headers.authorization; - return request2(endpoint2); + endpoint4.headers.authorization = authentication.headers.authorization; + return request4(endpoint4); } const { token, createdAt } = await getInstallationAuthentication( state, {}, - request2.defaults({ baseUrl: endpoint2.baseUrl }) + request4.defaults({ baseUrl: endpoint4.baseUrl }) ); - endpoint2.headers.authorization = `token ${token}`; + endpoint4.headers.authorization = `token ${token}`; return sendRequestWithRetries( state, - request2, - endpoint2, + request4, + endpoint4, createdAt ); } -async function sendRequestWithRetries(state, request2, options, createdAt, retries = 0) { +async function sendRequestWithRetries(state, request4, options, createdAt, retries = 0) { const timeSinceTokenCreationInMs = +/* @__PURE__ */ new Date() - +new Date(createdAt); try { - return await request2(options); + return await request4(options); } catch (error2) { if (error2.status !== 401) { throw error2; @@ -47854,10 +48945,10 @@ async function sendRequestWithRetries(state, request2, options, createdAt, retri `[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${retries}, wait: ${awaitTime / 1e3}s)` ); await new Promise((resolve) => setTimeout(resolve, awaitTime)); - return sendRequestWithRetries(state, request2, options, createdAt, retries); + return sendRequestWithRetries(state, request4, options, createdAt, retries); } } -var VERSION12 = "7.1.4"; +var VERSION16 = "7.1.5"; function createAppAuth(options) { if (!options.appId) { throw new Error("[@octokit/auth-app] appId option is required"); @@ -47876,14 +48967,14 @@ function createAppAuth(options) { }, options.log ); - const request2 = options.request || request.defaults({ + const request4 = options.request || request.defaults({ headers: { - "user-agent": `octokit-auth-app.js/${VERSION12} ${getUserAgent()}` + "user-agent": `octokit-auth-app.js/${VERSION16} ${getUserAgent()}` } }); const state = Object.assign( { - request: request2, + request: request4, cache: getCache() }, options, @@ -47894,7 +48985,7 @@ function createAppAuth(options) { clientType: "github-app", clientId: options.clientId || "", clientSecret: options.clientSecret || "", - request: request2 + request: request4 }) } ); diff --git a/github-actions/create-pr-for-changes/main.js b/github-actions/create-pr-for-changes/main.js index e24ed16a0..483996cef 100644 --- a/github-actions/create-pr-for-changes/main.js +++ b/github-actions/create-pr-for-changes/main.js @@ -3694,11 +3694,11 @@ var require_util2 = __commonJS({ } return location; } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request3) { + return request3.urlList[request3.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request3) { + const url = requestCurrentURL(request3); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -3764,7 +3764,7 @@ var require_util2 = __commonJS({ } return true; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request3, actualResponse) { const { headersList } = actualResponse; const policyHeader = (headersList.get("referrer-policy") ?? "").split(","); let policy = ""; @@ -3778,7 +3778,7 @@ var require_util2 = __commonJS({ } } if (policy !== "") { - request2.referrerPolicy = policy; + request3.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -3795,33 +3795,33 @@ var require_util2 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; - if (request2.responseTainting === "cors" || request2.mode === "websocket") { + function appendRequestOriginHeader(request3) { + let serializedOrigin = request3.origin; + if (request3.responseTainting === "cors" || request3.mode === "websocket") { if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request3.headersList.append("origin", serializedOrigin); } - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + } else if (request3.method !== "GET" && request3.method !== "HEAD") { + switch (request3.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request3.origin && urlHasHttpsScheme(request3.origin) && !urlHasHttpsScheme(requestCurrentURL(request3))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request3, requestCurrentURL(request3))) { serializedOrigin = null; } break; default: } if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request3.headersList.append("origin", serializedOrigin); } } } @@ -3853,26 +3853,26 @@ var require_util2 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request3) { + const policy = request3.referrerPolicy; assert2(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request3.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (request2.referrer instanceof URL) { - referrerSource = request2.referrer; + } else if (request3.referrer instanceof URL) { + referrerSource = request3.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); if (referrerURL.toString().length > 4096) { referrerURL = referrerOrigin; } - const areSameOrigin = sameOrigin(request2, referrerURL); - const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request2.url); + const areSameOrigin = sameOrigin(request3, referrerURL); + const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request3.url); switch (policy) { case "origin": return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true); @@ -3883,7 +3883,7 @@ var require_util2 = __commonJS({ case "origin-when-cross-origin": return areSameOrigin ? referrerURL : referrerOrigin; case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -4032,7 +4032,7 @@ var require_util2 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request3) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -5918,25 +5918,25 @@ var require_request = __commonJS({ static [kHTTP2BuildRequest](origin, opts, handler2) { const headers = opts.headers; opts = { ...opts, headers: null }; - const request2 = new Request(origin, opts, handler2); - request2.headers = {}; + const request3 = new Request(origin, opts, handler2); + request3.headers = {}; if (Array.isArray(headers)) { if (headers.length % 2 !== 0) { throw new InvalidArgumentError("headers array must be even"); } for (let i = 0; i < headers.length; i += 2) { - processHeader(request2, headers[i], headers[i + 1], true); + processHeader(request3, headers[i], headers[i + 1], true); } } else if (headers && typeof headers === "object") { const keys = Object.keys(headers); for (let i = 0; i < keys.length; i++) { const key = keys[i]; - processHeader(request2, key, headers[key], true); + processHeader(request3, key, headers[key], true); } } else if (headers != null) { throw new InvalidArgumentError("headers must be an object or an array"); } - return request2; + return request3; } static [kHTTP2CopyHeaders](raw) { const rawHeaders = raw.split("\r\n"); @@ -5964,28 +5964,28 @@ var require_request = __commonJS({ return skipAppend ? val : `${key}: ${val}\r `; } - function processHeader(request2, key, val, skipAppend = false) { + function processHeader(request3, key, val, skipAppend = false) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { return; } - if (request2.host === null && key.length === 4 && key.toLowerCase() === "host") { + if (request3.host === null && key.length === 4 && key.toLowerCase() === "host") { if (headerCharRegex.exec(val) !== null) { throw new InvalidArgumentError(`invalid ${key} header`); } - request2.host = val; - } else if (request2.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request3.host = val; + } else if (request3.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { + request3.contentLength = parseInt(val, 10); + if (!Number.isFinite(request3.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { - request2.contentType = val; + } else if (request3.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { + request3.contentType = val; if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request3.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request3.headers += processHeaderValue(key, val); } else if (key.length === 17 && key.toLowerCase() === "transfer-encoding") { throw new InvalidArgumentError("invalid transfer-encoding header"); } else if (key.length === 10 && key.toLowerCase() === "connection") { @@ -5993,7 +5993,7 @@ var require_request = __commonJS({ if (value !== "close" && value !== "keep-alive") { throw new InvalidArgumentError("invalid connection header"); } else if (value === "close") { - request2.reset = true; + request3.reset = true; } } else if (key.length === 10 && key.toLowerCase() === "keep-alive") { throw new InvalidArgumentError("invalid keep-alive header"); @@ -6007,19 +6007,19 @@ var require_request = __commonJS({ if (Array.isArray(val)) { for (let i = 0; i < val.length; i++) { if (skipAppend) { - if (request2.headers[key]) - request2.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; + if (request3.headers[key]) + request3.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; else - request2.headers[key] = processHeaderValue(key, val[i], skipAppend); + request3.headers[key] = processHeaderValue(key, val[i], skipAppend); } else { - request2.headers += processHeaderValue(key, val[i]); + request3.headers += processHeaderValue(key, val[i]); } } } else { if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request3.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request3.headers += processHeaderValue(key, val); } } } @@ -7163,10 +7163,10 @@ var require_client = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); - this[kQueue].push(request2); + const request3 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); + this[kQueue].push(request3); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request3.body) == null && util.isIterable(request3.body)) { this[kResuming] = 1; process.nextTick(resume, this); } else { @@ -7190,8 +7190,8 @@ var require_client = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request3 = requests[i]; + errorRequest(this, request3, err); } const callback = () => { if (this[kClosedResolve]) { @@ -7239,13 +7239,13 @@ var require_client = __commonJS({ assert2(this[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request3 = requests[i]; + errorRequest(this, request3, err); } } else if (client[kRunning] > 0) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request3 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request3, err); } client[kPendingIdx] = client[kRunningIdx]; assert2(client[kRunning] === 0); @@ -7451,8 +7451,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request3 = client[kQueue][client[kRunningIdx]]; + if (!request3) { return -1; } } @@ -7492,12 +7492,12 @@ var require_client = __commonJS({ onUpgrade(head) { const { upgrade, client, socket, headers, statusCode } = this; assert2(upgrade); - const request2 = client[kQueue][client[kRunningIdx]]; - assert2(request2); + const request3 = client[kQueue][client[kRunningIdx]]; + assert2(request3); assert2(!socket.destroyed); assert2(socket === client[kSocket]); assert2(!this.paused); - assert2(request2.upgrade || request2.method === "CONNECT"); + assert2(request3.upgrade || request3.method === "CONNECT"); this.statusCode = null; this.statusText = ""; this.shouldKeepAlive = null; @@ -7514,7 +7514,7 @@ var require_client = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request3.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -7525,8 +7525,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request3 = client[kQueue][client[kRunningIdx]]; + if (!request3) { return -1; } assert2(!this.upgrade); @@ -7535,22 +7535,22 @@ var require_client = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request3.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert2.strictEqual(this.timeoutType, TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request3.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request3.bodyTimeout != null ? request3.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request3.method === "CONNECT") { assert2(client[kRunning] === 1); this.upgrade = true; return 2; @@ -7581,11 +7581,11 @@ var require_client = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request3.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request3.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request3.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -7602,8 +7602,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert2(request2); + const request3 = client[kQueue][client[kRunningIdx]]; + assert2(request3); assert2.strictEqual(this.timeoutType, TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -7616,7 +7616,7 @@ var require_client = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request3.onData(buf) === false) { return constants.ERROR.PAUSED; } } @@ -7628,8 +7628,8 @@ var require_client = __commonJS({ if (upgrade) { return; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert2(request2); + const request3 = client[kQueue][client[kRunningIdx]]; + assert2(request3); assert2(statusCode >= 100); this.statusCode = null; this.statusText = ""; @@ -7643,11 +7643,11 @@ var require_client = __commonJS({ if (statusCode < 200) { return; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request3.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request3.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert2.strictEqual(client[kRunning], 0); @@ -7705,8 +7705,8 @@ var require_client = __commonJS({ assert2(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request3 = requests[i]; + errorRequest(client, request3, err); } assert2(client[kSize] === 0); } @@ -7736,13 +7736,13 @@ var require_client = __commonJS({ assert2(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request3 = requests[i]; + errorRequest(client, request3, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request3 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request3, err); } client[kPendingIdx] = client[kRunningIdx]; assert2(client[kRunning] === 0); @@ -7875,8 +7875,8 @@ var require_client = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert2(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - errorRequest(client, request2, err); + const request3 = client[kQueue][client[kPendingIdx]++]; + errorRequest(client, request3, err); } } else { onError(client, err); @@ -7930,8 +7930,8 @@ var require_client = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request3 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request3.headersTimeout != null ? request3.headersTimeout : client[kHeadersTimeout]; + const request4 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request4.headersTimeout != null ? request4.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -7953,13 +7953,13 @@ var require_client = __commonJS({ if (client[kRunning] >= (client[kPipelining] || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request3 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request3.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; - if (socket && socket.servername !== request2.servername) { + client[kServerName] = request3.servername; + if (socket && socket.servername !== request3.servername) { util.destroy(socket, new InformationalError("servername changed")); return; } @@ -7974,16 +7974,16 @@ var require_client = __commonJS({ if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) { return; } - if (client[kRunning] > 0 && !request2.idempotent) { + if (client[kRunning] > 0 && !request3.idempotent) { return; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request3.upgrade || request3.method === "CONNECT")) { return; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request3.body) !== 0 && (util.isStream(request3.body) || util.isAsyncIterable(request3.body))) { return; } - if (!request2.aborted && write(client, request2)) { + if (!request3.aborted && write(client, request3)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -7993,12 +7993,12 @@ var require_client = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function write(client, request2) { + function write(client, request3) { if (client[kHTTPConnVersion] === "h2") { - writeH2(client, client[kHTTP2Session], request2); + writeH2(client, client[kHTTP2Session], request3); return; } - const { body, method, path, host, upgrade, headers, blocking, reset: reset2 } = request2; + const { body, method, path, host, upgrade, headers, blocking, reset: reset2 } = request3; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { body.read(0); @@ -8006,31 +8006,31 @@ var require_client = __commonJS({ const bodyLength = util.bodyLength(body); let contentLength = bodyLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request3.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request3.contentLength !== null && request3.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request3, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request3.onConnect((err) => { + if (request3.aborted || request3.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request3, err || new RequestAbortedError()); util.destroy(socket, new InformationalError("aborted")); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request3, err); } - if (request2.aborted) { + if (request3.aborted) { return false; } if (method === "HEAD") { @@ -8069,7 +8069,7 @@ upgrade: ${upgrade}\r header += headers; } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request3, headers: header, socket }); } if (!body || bodyLength === 0) { if (contentLength === 0) { @@ -8081,7 +8081,7 @@ upgrade: ${upgrade}\r socket.write(`${header}\r `, "latin1"); } - request2.onRequestSent(); + request3.onRequestSent(); } else if (util.isBuffer(body)) { assert2(contentLength === body.byteLength, "buffer body must have content length"); socket.cork(); @@ -8090,48 +8090,48 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - request2.onRequestSent(); + request3.onBodySent(body); + request3.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable({ body: body.stream(), client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body: body.stream(), client, request: request3, socket, contentLength, header, expectsPayload }); } else { - writeBlob({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeBlob({ body, client, request: request3, socket, contentLength, header, expectsPayload }); } } else if (util.isStream(body)) { - writeStream({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeStream({ body, client, request: request3, socket, contentLength, header, expectsPayload }); } else if (util.isIterable(body)) { - writeIterable({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body, client, request: request3, socket, contentLength, header, expectsPayload }); } else { assert2(false); } return true; } - function writeH2(client, session, request2) { - const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; + function writeH2(client, session, request3) { + const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request3; let headers; if (typeof reqHeaders === "string") headers = Request[kHTTP2CopyHeaders](reqHeaders.trim()); else headers = reqHeaders; if (upgrade) { - errorRequest(client, request2, new Error("Upgrade not supported for H2")); + errorRequest(client, request3, new Error("Upgrade not supported for H2")); return false; } try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request3.onConnect((err) => { + if (request3.aborted || request3.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request3, err || new RequestAbortedError()); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request3, err); } - if (request2.aborted) { + if (request3.aborted) { return false; } let stream; @@ -8142,11 +8142,11 @@ upgrade: ${upgrade}\r session.ref(); stream = session.request(headers, { endStream: false, signal }); if (stream.id && !stream.pending) { - request2.onUpgrade(null, null, stream); + request3.onUpgrade(null, null, stream); ++h2State.openStreams; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request3.onUpgrade(null, null, stream); ++h2State.openStreams; }); } @@ -8165,14 +8165,14 @@ upgrade: ${upgrade}\r } let contentLength = util.bodyLength(body); if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request3.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request3.contentLength != null && request3.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request3, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -8197,15 +8197,15 @@ upgrade: ${upgrade}\r ++h2State.openStreams; stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - if (request2.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { + if (request3.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.once("end", () => { - request2.onComplete([]); + request3.onComplete([]); }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request3.onData(chunk) === false) { stream.pause(); } }); @@ -8223,7 +8223,7 @@ upgrade: ${upgrade}\r }); stream.once("frameError", (type, code) => { const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`); - errorRequest(client, request2, err); + errorRequest(client, request3, err); if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { h2State.streams -= 1; util.destroy(stream, err); @@ -8232,20 +8232,20 @@ upgrade: ${upgrade}\r return true; function writeBodyH2() { if (!body) { - request2.onRequestSent(); + request3.onRequestSent(); } else if (util.isBuffer(body)) { assert2(contentLength === body.byteLength, "buffer body must have content length"); stream.cork(); stream.write(body); stream.uncork(); stream.end(); - request2.onBodySent(body); - request2.onRequestSent(); + request3.onBodySent(body); + request3.onRequestSent(); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { writeIterable({ client, - request: request2, + request: request3, contentLength, h2stream: stream, expectsPayload, @@ -8257,7 +8257,7 @@ upgrade: ${upgrade}\r writeBlob({ body, client, - request: request2, + request: request3, contentLength, expectsPayload, h2stream: stream, @@ -8269,7 +8269,7 @@ upgrade: ${upgrade}\r writeStream({ body, client, - request: request2, + request: request3, contentLength, expectsPayload, socket: client[kSocket], @@ -8280,7 +8280,7 @@ upgrade: ${upgrade}\r writeIterable({ body, client, - request: request2, + request: request3, contentLength, expectsPayload, header: "", @@ -8292,11 +8292,11 @@ upgrade: ${upgrade}\r } } } - function writeStream({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + function writeStream({ h2stream, body, client, request: request3, socket, contentLength, header, expectsPayload }) { assert2(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); if (client[kHTTPConnVersion] === "h2") { let onPipeData = function(chunk) { - request2.onBodySent(chunk); + request3.onBodySent(chunk); }; const pipe = pipeline( body, @@ -8306,7 +8306,7 @@ upgrade: ${upgrade}\r util.destroy(body, err); util.destroy(h2stream, err); } else { - request2.onRequestSent(); + request3.onRequestSent(); } } ); @@ -8318,7 +8318,7 @@ upgrade: ${upgrade}\r return; } let finished = false; - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request3, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -8374,7 +8374,7 @@ upgrade: ${upgrade}\r } socket.on("drain", onDrain).on("error", onFinished); } - async function writeBlob({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeBlob({ h2stream, body, client, request: request3, socket, contentLength, header, expectsPayload }) { assert2(contentLength === body.size, "blob body must have content length"); const isH2 = client[kHTTPConnVersion] === "h2"; try { @@ -8394,8 +8394,8 @@ upgrade: ${upgrade}\r socket.write(buffer); socket.uncork(); } - request2.onBodySent(buffer); - request2.onRequestSent(); + request3.onBodySent(buffer); + request3.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -8404,7 +8404,7 @@ upgrade: ${upgrade}\r util.destroy(isH2 ? h2stream : socket, err); } } - async function writeIterable({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeIterable({ h2stream, body, client, request: request3, socket, contentLength, header, expectsPayload }) { assert2(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -8430,7 +8430,7 @@ upgrade: ${upgrade}\r throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request3.onBodySent(chunk); if (!res) { await waitForDrain(); } @@ -8438,14 +8438,14 @@ upgrade: ${upgrade}\r } catch (err) { h2stream.destroy(err); } finally { - request2.onRequestSent(); + request3.onRequestSent(); h2stream.end(); h2stream.off("close", onDrain).off("drain", onDrain); } return; } socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request3, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -8463,9 +8463,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ socket, request: request3, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request3; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -8474,7 +8474,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request3, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -8513,7 +8513,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request3.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -8524,8 +8524,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request3 } = this; + request3.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -8568,10 +8568,10 @@ ${len.toString(16)}\r } } }; - function errorRequest(client, request2, err) { + function errorRequest(client, request3, err) { try { - request2.onError(err); - assert2(request2.aborted); + request3.onError(err); + assert2(request3.aborted); } catch (err2) { client.emit("error", err2); } @@ -9666,10 +9666,10 @@ var require_api_request = __commonJS({ } } }; - function request2(opts, callback) { + function request3(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request3.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -9684,7 +9684,7 @@ var require_api_request = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request3; module.exports.RequestHandler = RequestHandler; } }); @@ -10398,7 +10398,7 @@ var require_mock_utils = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData3(data) { if (Buffer.isBuffer(data)) { return data; } else if (typeof data === "object") { @@ -10503,7 +10503,7 @@ var require_mock_utils = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData3(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); handler2.abort = nop; @@ -10560,7 +10560,7 @@ var require_mock_utils = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData3, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -10582,7 +10582,7 @@ var require_mock_utils = __commonJS({ var require_mock_interceptor = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils(); + var { getResponseData: getResponseData3, buildKey, addMockDispatch } = require_mock_utils(); var { kDispatches, kDispatchKey, @@ -10645,7 +10645,7 @@ var require_mock_interceptor = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData(statusCode, data, responseOptions = {}) { - const responseData = getResponseData2(data); + const responseData = getResponseData3(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -12294,7 +12294,7 @@ var require_request2 = __commonJS({ policyContainer: makePolicyContainer() } }; - let request2 = null; + let request3 = null; let fallbackMode = null; const baseUrl = this[kRealm].settingsObject.baseUrl; let signal = null; @@ -12310,17 +12310,17 @@ var require_request2 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request3 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert2(input instanceof Request); - request2 = input[kState]; + request3 = input[kState]; signal = input[kSignal]; } const origin = this[kRealm].settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request3.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request3.window, origin)) { + window = request3.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -12328,43 +12328,43 @@ var require_request2 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request3 = makeRequest({ + method: request3.method, + headersList: request3.headersList, + unsafeRequest: request3.unsafeRequest, client: this[kRealm].settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request3.priority, + origin: request3.origin, + referrer: request3.referrer, + referrerPolicy: request3.referrerPolicy, + mode: request3.mode, + credentials: request3.credentials, + cache: request3.cache, + redirect: request3.redirect, + integrity: request3.integrity, + keepalive: request3.keepalive, + reloadNavigation: request3.reloadNavigation, + historyNavigation: request3.historyNavigation, + urlList: [...request3.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request3.mode === "navigate") { + request3.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request3.reloadNavigation = false; + request3.historyNavigation = false; + request3.origin = "client"; + request3.referrer = "client"; + request3.referrerPolicy = ""; + request3.url = request3.urlList[request3.urlList.length - 1]; + request3.urlList = [request3.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request3.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -12373,14 +12373,14 @@ var require_request2 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, this[kRealm].settingsObject.baseUrl)) { - request2.referrer = "client"; + request3.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request3.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request3.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -12395,27 +12395,27 @@ var require_request2 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request3.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request3.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request3.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request3.cache === "only-if-cached" && request3.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request3.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request3.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request3.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; @@ -12426,12 +12426,12 @@ var require_request2 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizeMethodRecord[method] ?? normalizeMethod(method); - request2.method = method; + request3.method = method; } if (init.signal !== void 0) { signal = init.signal; } - this[kState] = request2; + this[kState] = request3; const ac = new AbortController(); this[kSignal] = ac.signal; this[kSignal][kRealm] = this[kRealm]; @@ -12465,13 +12465,13 @@ var require_request2 = __commonJS({ } } this[kHeaders] = new Headers(kConstruct); - this[kHeaders][kHeadersList] = request2.headersList; + this[kHeaders][kHeadersList] = request3.headersList; this[kHeaders][kGuard] = "request"; this[kHeaders][kRealm] = this[kRealm]; if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request3.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request3.method} is unsupported in no-cors mode.` ); } this[kHeaders][kGuard] = "request-no-cors"; @@ -12490,14 +12490,14 @@ var require_request2 = __commonJS({ } } const inputBody = input instanceof Request ? input[kState].body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request3.method === "GET" || request3.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request3.keepalive ); initBody = extractedBody; if (contentType && !this[kHeaders][kHeadersList].contains("content-type")) { @@ -12509,12 +12509,12 @@ var require_request2 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request3.mode !== "same-origin" && request3.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request3.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -12644,7 +12644,7 @@ var require_request2 = __commonJS({ }; mixinBody(Request); function makeRequest(init) { - const request2 = { + const request3 = { method: "GET", localURLsOnly: false, unsafeRequest: false, @@ -12683,13 +12683,13 @@ var require_request2 = __commonJS({ ...init, headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; - request2.url = request2.urlList[0]; - return request2; + request3.url = request3.urlList[0]; + return request3; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(request2.body); + function cloneRequest(request3) { + const newRequest = makeRequest({ ...request3, body: null }); + if (request3.body != null) { + newRequest.body = cloneBody(request3.body); } return newRequest; } @@ -12919,14 +12919,14 @@ var require_fetch = __commonJS({ p.reject(e); return p.promise; } - const request2 = requestObject[kState]; + const request3 = requestObject[kState]; if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request3, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request3.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request3.serviceWorkers = "none"; } let responseObject = null; const relevantRealm = null; @@ -12938,7 +12938,7 @@ var require_fetch = __commonJS({ locallyAborted = true; assert2(controller != null); controller.abort(requestObject.signal.reason); - abortFetch(p, request2, responseObject, requestObject.signal.reason); + abortFetch(p, request3, responseObject, requestObject.signal.reason); } ); const handleFetchDone = (response) => finalizeAndReportTiming(response, "fetch"); @@ -12947,7 +12947,7 @@ var require_fetch = __commonJS({ return Promise.resolve(); } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request3, responseObject, controller.serializedAbortReason); return Promise.resolve(); } if (response.type === "error") { @@ -12965,7 +12965,7 @@ var require_fetch = __commonJS({ p.resolve(responseObject); }; controller = fetching({ - request: request2, + request: request3, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: init.dispatcher ?? getGlobalDispatcher() @@ -13010,14 +13010,14 @@ var require_fetch = __commonJS({ performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis2, cacheState); } } - function abortFetch(p, request2, responseObject, error) { + function abortFetch(p, request3, responseObject, error) { var _a, _b; if (!error) { error = new DOMException2("The operation was aborted.", "AbortError"); } p.reject(error); - if (request2.body != null && isReadable((_a = request2.body) == null ? void 0 : _a.stream)) { - request2.body.stream.cancel(error).catch((err) => { + if (request3.body != null && isReadable((_a = request3.body) == null ? void 0 : _a.stream)) { + request3.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -13038,7 +13038,7 @@ var require_fetch = __commonJS({ } } function fetching({ - request: request2, + request: request3, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -13050,9 +13050,9 @@ var require_fetch = __commonJS({ var _a, _b, _c, _d; let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request3.client != null) { + taskDestination = request3.client.globalObject; + crossOriginIsolatedCapability = request3.client.crossOriginIsolatedCapability; } const currenTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -13060,7 +13060,7 @@ var require_fetch = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request3, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -13070,32 +13070,32 @@ var require_fetch = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert2(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert2(!request3.body || request3.body.stream); + if (request3.window === "client") { + request3.window = ((_c = (_b = (_a = request3.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request3.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = (_d = request2.client) == null ? void 0 : _d.origin; + if (request3.origin === "client") { + request3.origin = (_d = request3.client) == null ? void 0 : _d.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request3.policyContainer === "client") { + if (request3.client != null) { + request3.policyContainer = clonePolicyContainer( + request3.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request3.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept")) { + if (!request3.headersList.contains("accept")) { const value = "*/*"; - request2.headersList.append("accept", value); + request3.headersList.append("accept", value); } - if (!request2.headersList.contains("accept-language")) { - request2.headersList.append("accept-language", "*"); + if (!request3.headersList.contains("accept-language")) { + request3.headersList.append("accept-language", "*"); } - if (request2.priority === null) { + if (request3.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request3.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -13103,44 +13103,44 @@ var require_fetch = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request3.localURLsOnly && !urlIsLocal(requestCurrentURL(request3))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request3); + if (requestBadPort(request3) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request3.referrerPolicy === "") { + request3.referrerPolicy = request3.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request3.referrer !== "no-referrer") { + request3.referrer = determineRequestsReferrer(request3); } if (response === null) { response = await (async () => { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request3); + if (sameOrigin(currentURL, request3.url) && request3.responseTainting === "basic" || currentURL.protocol === "data:" || (request3.mode === "navigate" || request3.mode === "websocket")) { + request3.responseTainting = "basic"; return await schemeFetch(fetchParams); } - if (request2.mode === "same-origin") { + if (request3.mode === "same-origin") { return makeNetworkError('request mode cannot be "same-origin"'); } - if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + if (request3.mode === "no-cors") { + if (request3.redirect !== "follow") { return makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } - request2.responseTainting = "opaque"; + request3.responseTainting = "opaque"; return await schemeFetch(fetchParams); } - if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + if (!urlIsHttpHttpsScheme(requestCurrentURL(request3))) { return makeNetworkError("URL scheme must be a HTTP(S) scheme"); } - request2.responseTainting = "cors"; + request3.responseTainting = "cors"; return await httpFetch(fetchParams); })(); } @@ -13148,13 +13148,13 @@ var require_fetch = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request3.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request3.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request3.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request3.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert2(false); @@ -13162,26 +13162,26 @@ var require_fetch = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request3.urlList); } - if (!request2.timingAllowFailed) { + if (!request3.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range")) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request3.headers.contains("range")) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request3.method === "HEAD" || request3.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request3.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request3.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request3.integrity)) { processBodyError("integrity mismatch"); return; } @@ -13197,8 +13197,8 @@ var require_fetch = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request3 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request3); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -13207,12 +13207,12 @@ var require_fetch = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request3); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blobURLEntryObject = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !isBlobLike(blobURLEntryObject)) { + if (request3.method !== "GET" || !isBlobLike(blobURLEntryObject)) { return Promise.resolve(makeNetworkError("invalid method")); } const bodyWithType = safelyExtractBody(blobURLEntryObject); @@ -13230,7 +13230,7 @@ var require_fetch = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -13312,41 +13312,41 @@ var require_fetch = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request3.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request3.redirect === "follow") { + request3.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request3.responseTainting === "cors" && corsCheck(request3, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request3, response) === "failure") { + request3.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request3.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request3.origin, + request3.client, + request3.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request3.redirect !== "manual") { fetchParams.controller.connection.destroy(); } - if (request2.redirect === "error") { + if (request3.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request3.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request3.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert2(false); @@ -13356,13 +13356,13 @@ var require_fetch = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request3).hash ); if (locationURL == null) { return response; @@ -13373,63 +13373,63 @@ var require_fetch = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request3.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request3.redirectCount += 1; + if (request3.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request3, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request3.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request3.body != null && request3.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request3.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request3.method)) { + request3.method = "GET"; + request3.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request3.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization"); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie"); - request2.headersList.delete("host"); + if (!sameOrigin(requestCurrentURL(request3), locationURL)) { + request3.headersList.delete("authorization"); + request3.headersList.delete("proxy-authorization", true); + request3.headersList.delete("cookie"); + request3.headersList.delete("host"); } - if (request2.body != null) { - assert2(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request3.body != null) { + assert2(request3.body.source != null); + request3.body = safelyExtractBody(request3.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request3.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request3, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request3.window === "no-window" && request3.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request3; } else { - httpRequest = makeRequest(request2); + httpRequest = makeRequest(request3); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request3.credentials === "include" || request3.credentials === "same-origin" && request3.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -13506,7 +13506,7 @@ var require_fetch = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request3.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -13514,7 +13514,7 @@ var require_fetch = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request3.body == null || request3.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -13542,21 +13542,21 @@ var require_fetch = __commonJS({ } } }; - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request3.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request3.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request3.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request3.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -13585,7 +13585,7 @@ var require_fetch = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request3.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -13697,17 +13697,17 @@ var require_fetch = __commonJS({ } return response; async function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request3); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: fetchParams.controller.dispatcher.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request3.method, + body: fetchParams.controller.dispatcher.isMockActive ? request3.body && (request3.body.source || request3.body.stream) : body, + headers: request3.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request3.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -13753,8 +13753,8 @@ var require_fetch = __commonJS({ } this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = request2.redirect === "follow" && location && redirectStatusSet.has(status); - if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = request3.redirect === "follow" && location && redirectStatusSet.has(status); + if (request3.method !== "HEAD" && request3.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (const coding of codings) { if (coding === "x-gzip" || coding === "gzip") { decoders.push(zlib.createGunzip({ @@ -14688,36 +14688,36 @@ var require_cache = __commonJS({ } this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request3, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.match" }); - request2 = webidl.converters.RequestInfo(request2); + request3 = webidl.converters.RequestInfo(request3); options = webidl.converters.CacheQueryOptions(options); - const p = await this.matchAll(request2, options); + const p = await this.matchAll(request3, options); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request3 = void 0, options = {}) { var _a; webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request3 !== void 0) + request3 = webidl.converters.RequestInfo(request3); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request3 !== void 0) { + if (request3 instanceof Request) { + r = request3[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request3 === "string") { + r = new Request(request3)[kState]; } } const responses = []; - if (request2 === void 0) { + if (request3 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -14739,11 +14739,11 @@ var require_cache = __commonJS({ } return Object.freeze(responseList); } - async add(request2) { + async add(request3) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.add" }); - request2 = webidl.converters.RequestInfo(request2); - const requests = [request2]; + request3 = webidl.converters.RequestInfo(request3); + const requests = [request3]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -14753,11 +14753,11 @@ var require_cache = __commonJS({ requests = webidl.converters["sequence"](requests); const responsePromises = []; const requestList = []; - for (const request2 of requests) { - if (typeof request2 === "string") { + for (const request3 of requests) { + if (typeof request3 === "string") { continue; } - const r = request2[kState]; + const r = request3[kState]; if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14766,8 +14766,8 @@ var require_cache = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = new Request(request2)[kState]; + for (const request3 of requests) { + const r = new Request(request3)[kState]; if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14842,16 +14842,16 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request3, response) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 2, { header: "Cache.put" }); - request2 = webidl.converters.RequestInfo(request2); + request3 = webidl.converters.RequestInfo(request3); response = webidl.converters.Response(response); let innerRequest = null; - if (request2 instanceof Request) { - innerRequest = request2[kState]; + if (request3 instanceof Request) { + innerRequest = request3[kState]; } else { - innerRequest = new Request(request2)[kState]; + innerRequest = new Request(request3)[kState]; } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -14919,20 +14919,20 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request3, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.delete" }); - request2 = webidl.converters.RequestInfo(request2); + request3 = webidl.converters.RequestInfo(request3); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 instanceof Request) { - r = request2[kState]; + if (request3 instanceof Request) { + r = request3[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert2(typeof request2 === "string"); - r = new Request(request2)[kState]; + assert2(typeof request3 === "string"); + r = new Request(request3)[kState]; } const operations = []; const operation = { @@ -14958,25 +14958,25 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request3 = void 0, options = {}) { webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request3 !== void 0) + request3 = webidl.converters.RequestInfo(request3); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request3 !== void 0) { + if (request3 instanceof Request) { + r = request3[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request3 === "string") { + r = new Request(request3)[kState]; } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request3 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -14988,12 +14988,12 @@ var require_cache = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request4 of requests) { const requestObject = new Request("https://a"); - requestObject[kState] = request3; - requestObject[kHeaders][kHeadersList] = request3.headersList; + requestObject[kState] = request4; + requestObject[kHeaders][kHeadersList] = request4.headersList; requestObject[kHeaders][kGuard] = "immutable"; - requestObject[kRealm] = request3.client; + requestObject[kRealm] = request4.client; requestList.push(requestObject); } promise.resolve(Object.freeze(requestList)); @@ -15088,9 +15088,9 @@ var require_cache = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request3, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request3.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -15106,7 +15106,7 @@ var require_cache = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request3.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -15178,21 +15178,21 @@ var require_cachestorage = __commonJS({ webidl.illegalConstructor(); } } - async match(request2, options = {}) { + async match(request3, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, { header: "CacheStorage.match" }); - request2 = webidl.converters.RequestInfo(request2); + request3 = webidl.converters.RequestInfo(request3); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request3, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request3, options); if (response !== void 0) { return response; } @@ -16105,7 +16105,7 @@ var require_connection = __commonJS({ function establishWebSocketConnection(url, protocols, ws, onEstablish, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request3 = makeRequest({ urlList: [requestURL], serviceWorkers: "none", referrer: "no-referrer", @@ -16116,17 +16116,17 @@ var require_connection = __commonJS({ }); if (options.headers) { const headersList = new Headers(options.headers)[kHeadersList]; - request2.headersList = headersList; + request3.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue); - request2.headersList.append("sec-websocket-version", "13"); + request3.headersList.append("sec-websocket-key", keyValue); + request3.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol); + request3.headersList.append("sec-websocket-protocol", protocol); } const permessageDeflate = ""; const controller = fetching({ - request: request2, + request: request3, useParallelQueue: true, dispatcher: options.dispatcher ?? getGlobalDispatcher(), processResponse(response) { @@ -16159,7 +16159,7 @@ var require_connection = __commonJS({ return; } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); - if (secProtocol !== null && secProtocol !== request2.headersList.get("Sec-WebSocket-Protocol")) { + if (secProtocol !== null && secProtocol !== request3.headersList.get("Sec-WebSocket-Protocol")) { failWebsocketConnection(ws, "Protocol was not set in the opening handshake."); return; } @@ -17204,7 +17204,7 @@ var require_lib = __commonJS({ } exports.isHttps = isHttps; var HttpClient = class { - constructor(userAgent2, handlers, requestOptions) { + constructor(userAgent3, handlers, requestOptions) { this._ignoreSslError = false; this._allowRedirects = true; this._allowRedirectDowngrade = false; @@ -17213,7 +17213,7 @@ var require_lib = __commonJS({ this._maxRetries = 1; this._keepAlive = false; this._disposed = false; - this.userAgent = userAgent2; + this.userAgent = userAgent3; this.handlers = handlers || []; this.requestOptions = requestOptions; if (requestOptions) { @@ -17478,14 +17478,14 @@ var require_lib = __commonJS({ } _mergeHeaders(headers) { if (this.requestOptions && this.requestOptions.headers) { - return Object.assign({}, lowercaseKeys2(this.requestOptions.headers), lowercaseKeys2(headers || {})); + return Object.assign({}, lowercaseKeys3(this.requestOptions.headers), lowercaseKeys3(headers || {})); } - return lowercaseKeys2(headers || {}); + return lowercaseKeys3(headers || {}); } _getExistingOrDefaultHeader(additionalHeaders, header, _default) { let clientHeader; if (this.requestOptions && this.requestOptions.headers) { - clientHeader = lowercaseKeys2(this.requestOptions.headers)[header]; + clientHeader = lowercaseKeys3(this.requestOptions.headers)[header]; } return additionalHeaders[header] || clientHeader || _default; } @@ -17620,7 +17620,7 @@ var require_lib = __commonJS({ } }; exports.HttpClient = HttpClient; - var lowercaseKeys2 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + var lowercaseKeys3 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); } }); @@ -20457,10 +20457,10 @@ var require_util8 = __commonJS({ } return obj; } - function errorRequest(client, request2, err) { + function errorRequest(client, request3, err) { try { - request2.onError(err); - assert2(request2.aborted); + request3.onError(err); + assert2(request3.aborted); } catch (err2) { client.emit("error", err2); } @@ -20988,7 +20988,7 @@ var require_request3 = __commonJS({ return this; } }; - function processHeader(request2, key, val) { + function processHeader(request3, key, val) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { @@ -21027,19 +21027,19 @@ var require_request3 = __commonJS({ } else { val = `${val}`; } - if (request2.host === null && headerName === "host") { + if (request3.host === null && headerName === "host") { if (typeof val !== "string") { throw new InvalidArgumentError("invalid host header"); } - request2.host = val; - } else if (request2.contentLength === null && headerName === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request3.host = val; + } else if (request3.contentLength === null && headerName === "content-length") { + request3.contentLength = parseInt(val, 10); + if (!Number.isFinite(request3.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && headerName === "content-type") { - request2.contentType = val; - request2.headers.push(key, val); + } else if (request3.contentType === null && headerName === "content-type") { + request3.contentType = val; + request3.headers.push(key, val); } else if (headerName === "transfer-encoding" || headerName === "keep-alive" || headerName === "upgrade") { throw new InvalidArgumentError(`invalid ${headerName} header`); } else if (headerName === "connection") { @@ -21048,12 +21048,12 @@ var require_request3 = __commonJS({ throw new InvalidArgumentError("invalid connection header"); } if (value === "close") { - request2.reset = true; + request3.reset = true; } } else if (headerName === "expect") { throw new NotSupportedError("expect header not supported"); } else { - request2.headers.push(key, val); + request3.headers.push(key, val); } } module.exports = Request; @@ -23366,11 +23366,11 @@ var require_util9 = __commonJS({ function normalizeBinaryStringToUtf8(value) { return Buffer.from(value, "binary").toString("utf8"); } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request3) { + return request3.urlList[request3.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request3) { + const url = requestCurrentURL(request3); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -23407,10 +23407,10 @@ var require_util9 = __commonJS({ } return policy; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request3, actualResponse) { const policy = parseReferrerPolicy(actualResponse); if (policy !== "") { - request2.referrerPolicy = policy; + request3.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -23427,33 +23427,33 @@ var require_util9 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header, true); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; + function appendRequestOriginHeader(request3) { + let serializedOrigin = request3.origin; if (serializedOrigin === "client" || serializedOrigin === void 0) { return; } - if (request2.responseTainting === "cors" || request2.mode === "websocket") { - request2.headersList.append("origin", serializedOrigin, true); - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + if (request3.responseTainting === "cors" || request3.mode === "websocket") { + request3.headersList.append("origin", serializedOrigin, true); + } else if (request3.method !== "GET" && request3.method !== "HEAD") { + switch (request3.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request3.origin && urlHasHttpsScheme(request3.origin) && !urlHasHttpsScheme(requestCurrentURL(request3))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request3, requestCurrentURL(request3))) { serializedOrigin = null; } break; default: } - request2.headersList.append("origin", serializedOrigin, true); + request3.headersList.append("origin", serializedOrigin, true); } } function coarsenTime(timestamp, crossOriginIsolatedCapability) { @@ -23507,18 +23507,18 @@ var require_util9 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request3) { + const policy = request3.referrerPolicy; assert2(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request3.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (webidl.is.URL(request2.referrer)) { - referrerSource = request2.referrer; + } else if (webidl.is.URL(request3.referrer)) { + referrerSource = request3.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); @@ -23536,14 +23536,14 @@ var require_util9 = __commonJS({ case "unsafe-url": return referrerURL; case "strict-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } return referrerOrigin; } case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -23553,17 +23553,17 @@ var require_util9 = __commonJS({ return referrerOrigin; } case "same-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request3, referrerURL)) { return referrerURL; } return "no-referrer"; case "origin-when-cross-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request3, referrerURL)) { return referrerURL; } return referrerOrigin; case "no-referrer-when-downgrade": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } @@ -23727,7 +23727,7 @@ var require_util9 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request3) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -25200,11 +25200,11 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request3 = client[kQueue][client[kRunningIdx]]; + if (!request3) { return -1; } - request2.onResponseStarted(); + request3.onResponseStarted(); return 0; } onHeaderField(buf) { @@ -25252,9 +25252,9 @@ var require_client_h1 = __commonJS({ assert2(!socket.destroyed); assert2(!this.paused); assert2((headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert2(request2); - assert2(request2.upgrade || request2.method === "CONNECT"); + const request3 = client[kQueue][client[kRunningIdx]]; + assert2(request3); + assert2(request3.upgrade || request3.method === "CONNECT"); this.statusCode = 0; this.statusText = ""; this.shouldKeepAlive = false; @@ -25271,7 +25271,7 @@ var require_client_h1 = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request3.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -25282,8 +25282,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request3 = client[kQueue][client[kRunningIdx]]; + if (!request3) { return -1; } assert2(!this.upgrade); @@ -25292,22 +25292,22 @@ var require_client_h1 = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request3.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert2(this.timeoutType === TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request3.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request3.bodyTimeout != null ? request3.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request3.method === "CONNECT") { assert2(client[kRunning] === 1); this.upgrade = true; return 2; @@ -25338,11 +25338,11 @@ var require_client_h1 = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request3.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request3.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request3.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -25359,8 +25359,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert2(request2); + const request3 = client[kQueue][client[kRunningIdx]]; + assert2(request3); assert2(this.timeoutType === TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -25373,7 +25373,7 @@ var require_client_h1 = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request3.onData(buf) === false) { return constants.ERROR.PAUSED; } return 0; @@ -25388,8 +25388,8 @@ var require_client_h1 = __commonJS({ } assert2(statusCode >= 100); assert2((this.headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert2(request2); + const request3 = client[kQueue][client[kRunningIdx]]; + assert2(request3); this.statusCode = 0; this.statusText = ""; this.bytesRead = 0; @@ -25401,11 +25401,11 @@ var require_client_h1 = __commonJS({ if (statusCode < 200) { return 0; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request3.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request3.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert2(client[kRunning] === 0); @@ -25471,8 +25471,8 @@ var require_client_h1 = __commonJS({ return { version: "h1", defaultPipelining: 1, - write(request2) { - return writeH1(client, request2); + write(request3) { + return writeH1(client, request3); }, resume() { resumeH1(client); @@ -25488,18 +25488,18 @@ var require_client_h1 = __commonJS({ get destroyed() { return socket.destroyed; }, - busy(request2) { + busy(request3) { if (socket[kWriting] || socket[kReset] || socket[kBlocking]) { return true; } - if (request2) { - if (client[kRunning] > 0 && !request2.idempotent) { + if (request3) { + if (client[kRunning] > 0 && !request3.idempotent) { return true; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request3.upgrade || request3.method === "CONNECT")) { return true; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body) || util.isFormDataLike(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request3.body) !== 0 && (util.isStream(request3.body) || util.isAsyncIterable(request3.body) || util.isFormDataLike(request3.body))) { return true; } } @@ -25546,13 +25546,13 @@ var require_client_h1 = __commonJS({ assert2(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request3 = requests[i]; + util.errorRequest(client, request3, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request3 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); } client[kPendingIdx] = client[kRunningIdx]; assert2(client[kRunning] === 0); @@ -25580,8 +25580,8 @@ var require_client_h1 = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request2 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request2.headersTimeout != null ? request2.headersTimeout : client[kHeadersTimeout]; + const request3 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request3.headersTimeout != null ? request3.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -25590,21 +25590,21 @@ var require_client_h1 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH1(client, request2) { - const { method, path, host, upgrade, blocking, reset: reset2 } = request2; - let { body, headers, contentLength } = request2; + function writeH1(client, request3) { + const { method, path, host, upgrade, blocking, reset: reset2 } = request3; + let { body, headers, contentLength } = request3; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH"; if (util.isFormDataLike(body)) { if (!extractBody) { extractBody = require_body2().extractBody; } const [bodyStream, contentType] = extractBody(body); - if (request2.contentType == null) { + if (request3.contentType == null) { headers.push("content-type", contentType); } body = bodyStream.stream; contentLength = bodyStream.length; - } else if (util.isBlobLike(body) && request2.contentType == null && body.type) { + } else if (util.isBlobLike(body) && request3.contentType == null && body.type) { headers.push("content-type", body.type); } if (body && typeof body.read === "function") { @@ -25613,33 +25613,33 @@ var require_client_h1 = __commonJS({ const bodyLength = util.bodyLength(body); contentLength = bodyLength ?? contentLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request3.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request3.contentLength !== null && request3.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request3, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request3.aborted || request3.completed) { return; } - util.errorRequest(client, request2, err || new RequestAbortedError()); + util.errorRequest(client, request3, err || new RequestAbortedError()); util.destroy(body); util.destroy(socket, new InformationalError("aborted")); }; try { - request2.onConnect(abort); + request3.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); } - if (request2.aborted) { + if (request3.aborted) { return false; } if (method === "HEAD") { @@ -25690,31 +25690,31 @@ upgrade: ${upgrade}\r } } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request3, headers: header, socket }); } if (!body || bodyLength === 0) { - writeBuffer(abort, null, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, null, client, request3, socket, contentLength, header, expectsPayload); } else if (util.isBuffer(body)) { - writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, body, client, request3, socket, contentLength, header, expectsPayload); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable(abort, body.stream(), client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body.stream(), client, request3, socket, contentLength, header, expectsPayload); } else { - writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBlob(abort, body, client, request3, socket, contentLength, header, expectsPayload); } } else if (util.isStream(body)) { - writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeStream(abort, body, client, request3, socket, contentLength, header, expectsPayload); } else if (util.isIterable(body)) { - writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body, client, request3, socket, contentLength, header, expectsPayload); } else { assert2(false); } return true; } - function writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeStream(abort, body, client, request3, socket, contentLength, header, expectsPayload) { assert2(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); let finished = false; - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request3, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -25780,7 +25780,7 @@ upgrade: ${upgrade}\r setImmediate(onClose); } } - function writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeBuffer(abort, body, client, request3, socket, contentLength, header, expectsPayload) { try { if (!body) { if (contentLength === 0) { @@ -25800,18 +25800,18 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - if (!expectsPayload && request2.reset !== false) { + request3.onBodySent(body); + if (!expectsPayload && request3.reset !== false) { socket[kReset] = true; } } - request2.onRequestSent(); + request3.onRequestSent(); client[kResume](); } catch (err) { abort(err); } } - async function writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeBlob(abort, body, client, request3, socket, contentLength, header, expectsPayload) { assert2(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -25824,9 +25824,9 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(buffer); socket.uncork(); - request2.onBodySent(buffer); - request2.onRequestSent(); - if (!expectsPayload && request2.reset !== false) { + request3.onBodySent(buffer); + request3.onRequestSent(); + if (!expectsPayload && request3.reset !== false) { socket[kReset] = true; } client[kResume](); @@ -25834,7 +25834,7 @@ upgrade: ${upgrade}\r abort(err); } } - async function writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeIterable(abort, body, client, request3, socket, contentLength, header, expectsPayload) { assert2(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -25853,7 +25853,7 @@ upgrade: ${upgrade}\r } }); socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request3, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -25871,9 +25871,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ abort, socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ abort, socket, request: request3, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request3; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -25883,7 +25883,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request3, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -25902,7 +25902,7 @@ upgrade: ${upgrade}\r } socket.cork(); if (bytesWritten === 0) { - if (!expectsPayload && request2.reset !== false) { + if (!expectsPayload && request3.reset !== false) { socket[kReset] = true; } if (contentLength === null) { @@ -25922,7 +25922,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request3.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -25933,8 +25933,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request3 } = this; + request3.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -26077,8 +26077,8 @@ var require_client_h2 = __commonJS({ return { version: "h2", defaultPipelining: Infinity, - write(request2) { - return writeH2(client, request2); + write(request3) { + return writeH2(client, request3); }, resume() { resumeH2(client); @@ -26136,9 +26136,9 @@ var require_client_h2 = __commonJS({ this[kHTTP2Session] = null; util.destroy(this[kSocket], err); if (client[kRunningIdx] < client[kQueue].length) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request3 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); client[kPendingIdx] = client[kRunningIdx]; } assert2(client[kRunning] === 0); @@ -26155,8 +26155,8 @@ var require_client_h2 = __commonJS({ assert2(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request3 = requests[i]; + util.errorRequest(client, request3, err); } } } @@ -26187,13 +26187,13 @@ var require_client_h2 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH2(client, request2) { - const requestTimeout = request2.bodyTimeout ?? client[kBodyTimeout]; + function writeH2(client, request3) { + const requestTimeout = request3.bodyTimeout ?? client[kBodyTimeout]; const session = client[kHTTP2Session]; - const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; - let { body } = request2; + const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request3; + let { body } = request3; if (upgrade) { - util.errorRequest(client, request2, new Error("Upgrade not supported for H2")); + util.errorRequest(client, request3, new Error("Upgrade not supported for H2")); return false; } const headers = {}; @@ -26217,11 +26217,11 @@ var require_client_h2 = __commonJS({ headers[HTTP2_HEADER_AUTHORITY] = host || `${hostname}${port ? `:${port}` : ""}`; headers[HTTP2_HEADER_METHOD] = method; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request3.aborted || request3.completed) { return; } err = err || new RequestAbortedError(); - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); if (stream != null) { stream.removeAllListeners("data"); stream.close(); @@ -26231,23 +26231,23 @@ var require_client_h2 = __commonJS({ util.destroy(body, err); }; try { - request2.onConnect(abort); + request3.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); } - if (request2.aborted) { + if (request3.aborted) { return false; } if (method === "CONNECT") { session.ref(); stream = session.request(headers, { endStream: false, signal }); if (!stream.pending) { - request2.onUpgrade(null, null, stream); + request3.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request3.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; }); @@ -26275,14 +26275,14 @@ var require_client_h2 = __commonJS({ contentLength = bodyStream.length; } if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request3.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request3.contentLength != null && request3.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request3, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -26298,7 +26298,7 @@ var require_client_h2 = __commonJS({ header += `${key}: ${headers[key]}\r `; } - channels.sendHeaders.publish({ request: request2, headers: header, socket: session[kSocket] }); + channels.sendHeaders.publish({ request: request3, headers: header, socket: session[kSocket] }); } const shouldEndStream = method === "GET" || method === "HEAD" || body === null; if (expectContinue) { @@ -26316,17 +26316,17 @@ var require_client_h2 = __commonJS({ stream.setTimeout(requestTimeout); stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - request2.onResponseStarted(); - if (request2.aborted) { + request3.onResponseStarted(); + if (request3.aborted) { stream.removeAllListeners("data"); return; } - if (request2.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { + if (request3.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request3.onData(chunk) === false) { stream.pause(); } }); @@ -26334,8 +26334,8 @@ var require_client_h2 = __commonJS({ var _a; stream.removeAllListeners("data"); if (((_a = stream.state) == null ? void 0 : _a.state) == null || stream.state.state < 6) { - if (!request2.aborted && !request2.completed) { - request2.onComplete({}); + if (!request3.aborted && !request3.completed) { + request3.onComplete({}); } client[kQueue][client[kRunningIdx]++] = null; client[kResume](); @@ -26378,10 +26378,10 @@ var require_client_h2 = __commonJS({ abort(err); }); stream.once("trailers", (trailers) => { - if (request2.aborted || request2.completed) { + if (request3.aborted || request3.completed) { return; } - request2.onComplete(trailers); + request3.onComplete(trailers); }); return true; function writeBodyH2() { @@ -26391,7 +26391,7 @@ var require_client_h2 = __commonJS({ stream, null, client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -26402,7 +26402,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -26414,7 +26414,7 @@ var require_client_h2 = __commonJS({ stream, body.stream(), client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -26425,7 +26425,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -26439,7 +26439,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request3, contentLength ); } else if (util.isIterable(body)) { @@ -26448,7 +26448,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -26458,7 +26458,7 @@ var require_client_h2 = __commonJS({ } } } - function writeBuffer(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + function writeBuffer(abort, h2stream, body, client, request3, socket, contentLength, expectsPayload) { try { if (body != null && util.isBuffer(body)) { assert2(contentLength === body.byteLength, "buffer body must have content length"); @@ -26466,18 +26466,18 @@ var require_client_h2 = __commonJS({ h2stream.write(body); h2stream.uncork(); h2stream.end(); - request2.onBodySent(body); + request3.onBodySent(body); } if (!expectsPayload) { socket[kReset] = true; } - request2.onRequestSent(); + request3.onRequestSent(); client[kResume](); } catch (error) { abort(error); } } - function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) { + function writeStream(abort, socket, expectsPayload, h2stream, body, client, request3, contentLength) { assert2(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); const pipe = pipeline( body, @@ -26488,7 +26488,7 @@ var require_client_h2 = __commonJS({ abort(err); } else { util.removeAllListeners(pipe); - request2.onRequestSent(); + request3.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26498,10 +26498,10 @@ var require_client_h2 = __commonJS({ ); util.addListener(pipe, "data", onPipeData); function onPipeData(chunk) { - request2.onBodySent(chunk); + request3.onBodySent(chunk); } } - async function writeBlob(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeBlob(abort, h2stream, body, client, request3, socket, contentLength, expectsPayload) { assert2(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -26512,8 +26512,8 @@ var require_client_h2 = __commonJS({ h2stream.write(buffer); h2stream.uncork(); h2stream.end(); - request2.onBodySent(buffer); - request2.onRequestSent(); + request3.onBodySent(buffer); + request3.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26522,7 +26522,7 @@ var require_client_h2 = __commonJS({ abort(err); } } - async function writeIterable(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeIterable(abort, h2stream, body, client, request3, socket, contentLength, expectsPayload) { assert2(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -26547,13 +26547,13 @@ var require_client_h2 = __commonJS({ throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request3.onBodySent(chunk); if (!res) { await waitForDrain(); } } h2stream.end(); - request2.onRequestSent(); + request3.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26800,10 +26800,10 @@ var require_client2 = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = new Request(origin, opts, handler2); - this[kQueue].push(request2); + const request3 = new Request(origin, opts, handler2); + this[kQueue].push(request3); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request3.body) == null && util.isIterable(request3.body)) { this[kResuming] = 1; queueMicrotask(() => resume(this)); } else { @@ -26827,8 +26827,8 @@ var require_client2 = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(this, request2, err); + const request3 = requests[i]; + util.errorRequest(this, request3, err); } const callback = () => { if (this[kClosedResolve]) { @@ -26852,8 +26852,8 @@ var require_client2 = __commonJS({ assert2(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request3 = requests[i]; + util.errorRequest(client, request3, err); } assert2(client[kSize] === 0); } @@ -26957,8 +26957,8 @@ var require_client2 = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert2(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - util.errorRequest(client, request2, err); + const request3 = client[kQueue][client[kPendingIdx]++]; + util.errorRequest(client, request3, err); } } else { onError(client, err); @@ -27016,12 +27016,12 @@ var require_client2 = __commonJS({ if (client[kRunning] >= (getPipelining(client) || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request3 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request3.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; + client[kServerName] = request3.servername; (_a = client[kHTTPContext]) == null ? void 0 : _a.destroy(new InformationalError("servername changed"), () => { client[kHTTPContext] = null; resume(client); @@ -27037,10 +27037,10 @@ var require_client2 = __commonJS({ if (client[kHTTPContext].destroyed) { return; } - if (client[kHTTPContext].busy(request2)) { + if (client[kHTTPContext].busy(request3)) { return; } - if (!request2.aborted && client[kHTTPContext].write(request2)) { + if (!request3.aborted && client[kHTTPContext].write(request3)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -28654,10 +28654,10 @@ var require_api_request2 = __commonJS({ } } }; - function request2(opts, callback) { + function request3(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request3.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -28673,7 +28673,7 @@ var require_api_request2 = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request3; module.exports.RequestHandler = RequestHandler; } }); @@ -29439,7 +29439,7 @@ var require_mock_utils2 = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData3(data) { if (Buffer.isBuffer(data)) { return data; } else if (data instanceof Uint8Array) { @@ -29572,7 +29572,7 @@ var require_mock_utils2 = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData3(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); (_a = handler2.onConnect) == null ? void 0 : _a.call(handler2, (err) => handler2.onError(err), null); @@ -29629,7 +29629,7 @@ var require_mock_utils2 = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData3, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -29652,7 +29652,7 @@ var require_mock_utils2 = __commonJS({ var require_mock_interceptor2 = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils2(); + var { getResponseData: getResponseData3, buildKey, addMockDispatch } = require_mock_utils2(); var { kDispatches, kDispatchKey, @@ -29717,7 +29717,7 @@ var require_mock_interceptor2 = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData({ statusCode, data, responseOptions }) { - const responseData = getResponseData2(data); + const responseData = getResponseData3(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -32017,7 +32017,7 @@ var require_sqlite_cache_store = __commonJS({ var { Writable } = __require("stream"); var { assertCacheKey, assertCacheValue } = require_cache2(); var DatabaseSync; - var VERSION9 = 3; + var VERSION11 = 3; var MAX_ENTRY_SIZE = 2 * 1e3 * 1e3 * 1e3; module.exports = class SqliteCacheStore { #maxEntrySize = MAX_ENTRY_SIZE; @@ -32056,7 +32056,7 @@ var require_sqlite_cache_store = __commonJS({ } this.#db = new DatabaseSync((opts == null ? void 0 : opts.location) ?? ":memory:"); this.#db.exec(` - CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION9} ( + CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION11} ( -- Data specific to us id INTEGER PRIMARY KEY AUTOINCREMENT, url TEXT NOT NULL, @@ -32075,9 +32075,9 @@ var require_sqlite_cache_store = __commonJS({ staleAt INTEGER NOT NULL ); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION9}_url ON cacheInterceptorV${VERSION9}(url); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION9}_method ON cacheInterceptorV${VERSION9}(method); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION9}_deleteAt ON cacheInterceptorV${VERSION9}(deleteAt); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION11}_url ON cacheInterceptorV${VERSION11}(url); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION11}_method ON cacheInterceptorV${VERSION11}(method); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION11}_deleteAt ON cacheInterceptorV${VERSION11}(deleteAt); `); this.#getValuesQuery = this.#db.prepare(` SELECT @@ -32092,7 +32092,7 @@ var require_sqlite_cache_store = __commonJS({ vary, cachedAt, staleAt - FROM cacheInterceptorV${VERSION9} + FROM cacheInterceptorV${VERSION11} WHERE url = ? AND method = ? @@ -32100,7 +32100,7 @@ var require_sqlite_cache_store = __commonJS({ deleteAt ASC `); this.#updateValueQuery = this.#db.prepare(` - UPDATE cacheInterceptorV${VERSION9} SET + UPDATE cacheInterceptorV${VERSION11} SET body = ?, deleteAt = ?, statusCode = ?, @@ -32114,7 +32114,7 @@ var require_sqlite_cache_store = __commonJS({ id = ? `); this.#insertValueQuery = this.#db.prepare(` - INSERT INTO cacheInterceptorV${VERSION9} ( + INSERT INTO cacheInterceptorV${VERSION11} ( url, method, body, @@ -32130,20 +32130,20 @@ var require_sqlite_cache_store = __commonJS({ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `); this.#deleteByUrlQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION9} WHERE url = ?` + `DELETE FROM cacheInterceptorV${VERSION11} WHERE url = ?` ); this.#countEntriesQuery = this.#db.prepare( - `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION9}` + `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION11}` ); this.#deleteExpiredValuesQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION9} WHERE deleteAt <= ?` + `DELETE FROM cacheInterceptorV${VERSION11} WHERE deleteAt <= ?` ); this.#deleteOldValuesQuery = this.#maxCount === Infinity ? null : this.#db.prepare(` - DELETE FROM cacheInterceptorV${VERSION9} + DELETE FROM cacheInterceptorV${VERSION11} WHERE id IN ( SELECT id - FROM cacheInterceptorV${VERSION9} + FROM cacheInterceptorV${VERSION11} ORDER BY cachedAt DESC LIMIT ? ) @@ -33234,7 +33234,7 @@ var require_request4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); input = webidl.converters.RequestInfo(input, prefix, "input"); init = webidl.converters.RequestInit(init, prefix, "init"); - let request2 = null; + let request3 = null; let fallbackMode = null; const baseUrl = environmentSettingsObject.settingsObject.baseUrl; let signal = null; @@ -33251,18 +33251,18 @@ var require_request4 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request3 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert2(webidl.is.Request(input)); - request2 = input.#state; + request3 = input.#state; signal = input.#signal; this.#dispatcher = init.dispatcher || input.#dispatcher; } const origin = environmentSettingsObject.settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request3.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request3.window, origin)) { + window = request3.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -33270,43 +33270,43 @@ var require_request4 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request3 = makeRequest({ + method: request3.method, + headersList: request3.headersList, + unsafeRequest: request3.unsafeRequest, client: environmentSettingsObject.settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request3.priority, + origin: request3.origin, + referrer: request3.referrer, + referrerPolicy: request3.referrerPolicy, + mode: request3.mode, + credentials: request3.credentials, + cache: request3.cache, + redirect: request3.redirect, + integrity: request3.integrity, + keepalive: request3.keepalive, + reloadNavigation: request3.reloadNavigation, + historyNavigation: request3.historyNavigation, + urlList: [...request3.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request3.mode === "navigate") { + request3.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request3.reloadNavigation = false; + request3.historyNavigation = false; + request3.origin = "client"; + request3.referrer = "client"; + request3.referrerPolicy = ""; + request3.url = request3.urlList[request3.urlList.length - 1]; + request3.urlList = [request3.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request3.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -33315,14 +33315,14 @@ var require_request4 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, environmentSettingsObject.settingsObject.baseUrl)) { - request2.referrer = "client"; + request3.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request3.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request3.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -33337,33 +33337,33 @@ var require_request4 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request3.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request3.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request3.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request3.cache === "only-if-cached" && request3.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request3.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request3.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request3.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; const mayBeNormalized = normalizedMethodRecords[method]; if (mayBeNormalized !== void 0) { - request2.method = mayBeNormalized; + request3.method = mayBeNormalized; } else { if (!isValidHTTPToken(method)) { throw new TypeError(`'${method}' is not a valid HTTP method.`); @@ -33373,9 +33373,9 @@ var require_request4 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizedMethodRecordsBase[upperCase] ?? method; - request2.method = method; + request3.method = method; } - if (!patchMethodWarning && request2.method === "patch") { + if (!patchMethodWarning && request3.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" }); @@ -33385,7 +33385,7 @@ var require_request4 = __commonJS({ if (init.signal !== void 0) { signal = init.signal; } - this.#state = request2; + this.#state = request3; const ac = new AbortController(); this.#signal = ac.signal; if (signal != null) { @@ -33406,12 +33406,12 @@ var require_request4 = __commonJS({ } } this.#headers = new Headers(kConstruct); - setHeadersList(this.#headers, request2.headersList); + setHeadersList(this.#headers, request3.headersList); setHeadersGuard(this.#headers, "request"); if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request3.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request3.method} is unsupported in no-cors mode.` ); } setHeadersGuard(this.#headers, "request-no-cors"); @@ -33430,14 +33430,14 @@ var require_request4 = __commonJS({ } } const inputBody = webidl.is.Request(input) ? input.#state.body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request3.method === "GET" || request3.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request3.keepalive ); initBody = extractedBody; if (contentType && !getHeadersList(this.#headers).contains("content-type", true)) { @@ -33449,12 +33449,12 @@ var require_request4 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request3.mode !== "same-origin" && request3.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request3.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -33599,24 +33599,24 @@ var require_request4 = __commonJS({ }; return `Request ${nodeUtil.formatWithOptions(options, properties)}`; } - static setRequestSignal(request2, newSignal) { - request2.#signal = newSignal; - return request2; + static setRequestSignal(request3, newSignal) { + request3.#signal = newSignal; + return request3; } - static getRequestDispatcher(request2) { - return request2.#dispatcher; + static getRequestDispatcher(request3) { + return request3.#dispatcher; } - static setRequestDispatcher(request2, newDispatcher) { - request2.#dispatcher = newDispatcher; + static setRequestDispatcher(request3, newDispatcher) { + request3.#dispatcher = newDispatcher; } - static setRequestHeaders(request2, newHeaders) { - request2.#headers = newHeaders; + static setRequestHeaders(request3, newHeaders) { + request3.#headers = newHeaders; } - static getRequestState(request2) { - return request2.#state; + static getRequestState(request3) { + return request3.#state; } - static setRequestState(request2, newState) { - request2.#state = newState; + static setRequestState(request3, newState) { + request3.#state = newState; } }; var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState } = Request; @@ -33669,23 +33669,23 @@ var require_request4 = __commonJS({ headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(newRequest, request2.body); + function cloneRequest(request3) { + const newRequest = makeRequest({ ...request3, body: null }); + if (request3.body != null) { + newRequest.body = cloneBody(newRequest, request3.body); } return newRequest; } function fromInnerRequest(innerRequest, dispatcher, signal, guard) { - const request2 = new Request(kConstruct); - setRequestState(request2, innerRequest); - setRequestDispatcher(request2, dispatcher); - setRequestSignal(request2, signal); + const request3 = new Request(kConstruct); + setRequestState(request3, innerRequest); + setRequestDispatcher(request3, dispatcher); + setRequestSignal(request3, signal); const headers = new Headers(kConstruct); - setRequestHeaders(request2, headers); + setRequestHeaders(request3, headers); setHeadersList(headers, innerRequest.headersList); setHeadersGuard(headers, guard); - return request2; + return request3; } Object.defineProperties(Request.prototype, { method: kEnumerableProperty, @@ -33923,14 +33923,14 @@ var require_fetch2 = __commonJS({ p.reject(e); return p.promise; } - const request2 = getRequestState(requestObject); + const request3 = getRequestState(requestObject); if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request3, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request3.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request3.serviceWorkers = "none"; } let responseObject = null; let locallyAborted = false; @@ -33942,7 +33942,7 @@ var require_fetch2 = __commonJS({ assert2(controller != null); controller.abort(requestObject.signal.reason); const realResponse = responseObject == null ? void 0 : responseObject.deref(); - abortFetch(p, request2, realResponse, requestObject.signal.reason); + abortFetch(p, request3, realResponse, requestObject.signal.reason); } ); const processResponse = (response) => { @@ -33950,7 +33950,7 @@ var require_fetch2 = __commonJS({ return; } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request3, responseObject, controller.serializedAbortReason); return; } if (response.type === "error") { @@ -33962,7 +33962,7 @@ var require_fetch2 = __commonJS({ p = null; }; controller = fetching({ - request: request2, + request: request3, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: getRequestDispatcher(requestObject) @@ -34003,13 +34003,13 @@ var require_fetch2 = __commonJS({ ); } var markResourceTiming = performance.markResourceTiming; - function abortFetch(p, request2, responseObject, error) { + function abortFetch(p, request3, responseObject, error) { var _a, _b; if (p) { p.reject(error); } - if (((_a = request2.body) == null ? void 0 : _a.stream) != null && isReadable(request2.body.stream)) { - request2.body.stream.cancel(error).catch((err) => { + if (((_a = request3.body) == null ? void 0 : _a.stream) != null && isReadable(request3.body.stream)) { + request3.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -34030,7 +34030,7 @@ var require_fetch2 = __commonJS({ } } function fetching({ - request: request2, + request: request3, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -34043,9 +34043,9 @@ var require_fetch2 = __commonJS({ assert2(dispatcher); let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request3.client != null) { + taskDestination = request3.client.globalObject; + crossOriginIsolatedCapability = request3.client.crossOriginIsolatedCapability; } const currentTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -34053,7 +34053,7 @@ var require_fetch2 = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request3, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -34063,32 +34063,32 @@ var require_fetch2 = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert2(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert2(!request3.body || request3.body.stream); + if (request3.window === "client") { + request3.window = ((_c = (_b = (_a = request3.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request3.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = request2.client.origin; + if (request3.origin === "client") { + request3.origin = request3.client.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request3.policyContainer === "client") { + if (request3.client != null) { + request3.policyContainer = clonePolicyContainer( + request3.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request3.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept", true)) { + if (!request3.headersList.contains("accept", true)) { const value = "*/*"; - request2.headersList.append("accept", value, true); + request3.headersList.append("accept", value, true); } - if (!request2.headersList.contains("accept-language", true)) { - request2.headersList.append("accept-language", "*", true); + if (!request3.headersList.contains("accept-language", true)) { + request3.headersList.append("accept-language", "*", true); } - if (request2.priority === null) { + if (request3.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request3.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -34096,41 +34096,41 @@ var require_fetch2 = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request3.localURLsOnly && !urlIsLocal(requestCurrentURL(request3))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request3); + if (requestBadPort(request3) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request3.referrerPolicy === "") { + request3.referrerPolicy = request3.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request3.referrer !== "no-referrer") { + request3.referrer = determineRequestsReferrer(request3); } if (response === null) { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request3); + if (sameOrigin(currentURL, request3.url) && request3.responseTainting === "basic" || currentURL.protocol === "data:" || (request3.mode === "navigate" || request3.mode === "websocket")) { + request3.responseTainting = "basic"; response = await schemeFetch(fetchParams); - } else if (request2.mode === "same-origin") { + } else if (request3.mode === "same-origin") { response = makeNetworkError('request mode cannot be "same-origin"'); - } else if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + } else if (request3.mode === "no-cors") { + if (request3.redirect !== "follow") { response = makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } else { - request2.responseTainting = "opaque"; + request3.responseTainting = "opaque"; response = await schemeFetch(fetchParams); } - } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request3))) { response = makeNetworkError("URL scheme must be a HTTP(S) scheme"); } else { - request2.responseTainting = "cors"; + request3.responseTainting = "cors"; response = await httpFetch(fetchParams); } } @@ -34138,13 +34138,13 @@ var require_fetch2 = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request3.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request3.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request3.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request3.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert2(false); @@ -34152,26 +34152,26 @@ var require_fetch2 = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request3.urlList); } - if (!request2.timingAllowFailed) { + if (!request3.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range", true)) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request3.headers.contains("range", true)) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request3.method === "HEAD" || request3.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request3.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request3.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request3.integrity)) { processBodyError("integrity mismatch"); return; } @@ -34187,8 +34187,8 @@ var require_fetch2 = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request3 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request3); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -34197,19 +34197,19 @@ var require_fetch2 = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("node:buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request3); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blob = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !webidl.is.Blob(blob)) { + if (request3.method !== "GET" || !webidl.is.Blob(blob)) { return Promise.resolve(makeNetworkError("invalid method")); } const response = makeResponse(); const fullLength = blob.size; const serializedFullLength = isomorphicEncode(`${fullLength}`); const type = blob.type; - if (!request2.headersList.contains("range", true)) { + if (!request3.headersList.contains("range", true)) { const bodyWithType = extractBody(blob); response.statusText = "OK"; response.body = bodyWithType[0]; @@ -34217,7 +34217,7 @@ var require_fetch2 = __commonJS({ response.headersList.set("content-type", type, true); } else { response.rangeRequested = true; - const rangeHeader = request2.headersList.get("range", true); + const rangeHeader = request3.headersList.get("range", true); const rangeValue = simpleRangeHeaderValue(rangeHeader, true); if (rangeValue === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34248,7 +34248,7 @@ var require_fetch2 = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34337,41 +34337,41 @@ var require_fetch2 = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request3.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request3.redirect === "follow") { + request3.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request3.responseTainting === "cors" && corsCheck(request3, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request3, response) === "failure") { + request3.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request3.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request3.origin, + request3.client, + request3.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request3.redirect !== "manual") { fetchParams.controller.connection.destroy(void 0, false); } - if (request2.redirect === "error") { + if (request3.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request3.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request3.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert2(false); @@ -34381,13 +34381,13 @@ var require_fetch2 = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request3).hash ); if (locationURL == null) { return response; @@ -34398,63 +34398,63 @@ var require_fetch2 = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request3.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request3.redirectCount += 1; + if (request3.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request3, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request3.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request3.body != null && request3.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request3.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request3.method)) { + request3.method = "GET"; + request3.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request3.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization", true); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie", true); - request2.headersList.delete("host", true); + if (!sameOrigin(requestCurrentURL(request3), locationURL)) { + request3.headersList.delete("authorization", true); + request3.headersList.delete("proxy-authorization", true); + request3.headersList.delete("cookie", true); + request3.headersList.delete("host", true); } - if (request2.body != null) { - assert2(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request3.body != null) { + assert2(request3.body.source != null); + request3.body = safelyExtractBody(request3.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request3.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request3, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request3.window === "no-window" && request3.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request3; } else { - httpRequest = cloneRequest(request2); + httpRequest = cloneRequest(request3); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request3.credentials === "include" || request3.credentials === "same-origin" && request3.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -34531,7 +34531,7 @@ var require_fetch2 = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request3.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -34539,7 +34539,7 @@ var require_fetch2 = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request3.body == null || request3.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -34569,21 +34569,21 @@ var require_fetch2 = __commonJS({ } } }; - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request3.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request3.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request3.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request3.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -34612,7 +34612,7 @@ var require_fetch2 = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request3.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -34723,17 +34723,17 @@ var require_fetch2 = __commonJS({ } return response; function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request3); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request3.method, + body: agent.isMockActive ? request3.body && (request3.body.source || request3.body.stream) : body, + headers: request3.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request3.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -34769,8 +34769,8 @@ var require_fetch2 = __commonJS({ location = headersList.get("location", true); this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status); - if (codings.length !== 0 && request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = location && request3.redirect === "follow" && redirectStatusSet.has(status); + if (codings.length !== 0 && request3.method !== "HEAD" && request3.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (let i = codings.length - 1; i >= 0; --i) { const coding = codings[i]; if (coding === "x-gzip" || coding === "gzip") { @@ -34912,32 +34912,32 @@ var require_cache4 = __commonJS({ webidl.util.markAsUncloneable(this); this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request3, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.match"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - const p = this.#internalMatchAll(request2, options, 1); + const p = this.#internalMatchAll(request3, options, 1); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request3 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.matchAll"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request3 !== void 0) + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - return this.#internalMatchAll(request2, options); + return this.#internalMatchAll(request3, options); } - async add(request2) { + async add(request3) { webidl.brandCheck(this, Cache); const prefix = "Cache.add"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); - const requests = [request2]; + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); + const requests = [request3]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -34947,19 +34947,19 @@ var require_cache4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); const responsePromises = []; const requestList = []; - for (let request2 of requests) { - if (request2 === void 0) { + for (let request3 of requests) { + if (request3 === void 0) { throw webidl.errors.conversionFailed({ prefix, argument: "Argument 1", types: ["undefined is not allowed"] }); } - request2 = webidl.converters.RequestInfo(request2); - if (typeof request2 === "string") { + request3 = webidl.converters.RequestInfo(request3); + if (typeof request3 === "string") { continue; } - const r = getRequestState(request2); + const r = getRequestState(request3); if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: prefix, @@ -34968,8 +34968,8 @@ var require_cache4 = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = getRequestState(new Request(request2)); + for (const request3 of requests) { + const r = getRequestState(new Request(request3)); if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: prefix, @@ -35043,17 +35043,17 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request3, response) { webidl.brandCheck(this, Cache); const prefix = "Cache.put"; webidl.argumentLengthCheck(arguments, 2, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); response = webidl.converters.Response(response, prefix, "response"); let innerRequest = null; - if (webidl.is.Request(request2)) { - innerRequest = getRequestState(request2); + if (webidl.is.Request(request3)) { + innerRequest = getRequestState(request3); } else { - innerRequest = getRequestState(new Request(request2)); + innerRequest = getRequestState(new Request(request3)); } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -35121,21 +35121,21 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request3, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.delete"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (webidl.is.Request(request3)) { + r = getRequestState(request3); if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert2(typeof request2 === "string"); - r = getRequestState(new Request(request2)); + assert2(typeof request3 === "string"); + r = getRequestState(new Request(request3)); } const operations = []; const operation = { @@ -35161,26 +35161,26 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request3 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.keys"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request3 !== void 0) + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request3 !== void 0) { + if (webidl.is.Request(request3)) { + r = getRequestState(request3); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request3 === "string") { + r = getRequestState(new Request(request3)); } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request3 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -35192,9 +35192,9 @@ var require_cache4 = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request4 of requests) { const requestObject = fromInnerRequest( - request3, + request4, void 0, new AbortController().signal, "immutable" @@ -35293,9 +35293,9 @@ var require_cache4 = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request3, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request3.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -35311,7 +35311,7 @@ var require_cache4 = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request3.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -35319,20 +35319,20 @@ var require_cache4 = __commonJS({ } return true; } - #internalMatchAll(request2, options, maxResponses = Infinity) { + #internalMatchAll(request3, options, maxResponses = Infinity) { let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request3 !== void 0) { + if (webidl.is.Request(request3)) { + r = getRequestState(request3); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request3 === "string") { + r = getRequestState(new Request(request3)); } } const responses = []; - if (request2 === void 0) { + if (request3 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -35420,21 +35420,21 @@ var require_cachestorage2 = __commonJS({ } webidl.util.markAsUncloneable(this); } - async match(request2, options = {}) { + async match(request3, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, "CacheStorage.match"); - request2 = webidl.converters.RequestInfo(request2); + request3 = webidl.converters.RequestInfo(request3); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request3, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request3, options); if (response !== void 0) { return response; } @@ -36524,7 +36524,7 @@ var require_connection2 = __commonJS({ function establishWebSocketConnection(url, protocols, client, handler2, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request3 = makeRequest({ urlList: [requestURL], client, serviceWorkers: "none", @@ -36536,18 +36536,18 @@ var require_connection2 = __commonJS({ }); if (options.headers) { const headersList = getHeadersList(new Headers(options.headers)); - request2.headersList = headersList; + request3.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue, true); - request2.headersList.append("sec-websocket-version", "13", true); + request3.headersList.append("sec-websocket-key", keyValue, true); + request3.headersList.append("sec-websocket-version", "13", true); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol, true); + request3.headersList.append("sec-websocket-protocol", protocol, true); } const permessageDeflate = "permessage-deflate; client_max_window_bits"; - request2.headersList.append("sec-websocket-extensions", permessageDeflate, true); + request3.headersList.append("sec-websocket-extensions", permessageDeflate, true); const controller = fetching({ - request: request2, + request: request3, useParallelQueue: true, dispatcher: options.dispatcher, processResponse(response) { @@ -36588,7 +36588,7 @@ var require_connection2 = __commonJS({ } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); if (secProtocol !== null) { - const requestProtocols = getDecodeSplit("sec-websocket-protocol", request2.headersList); + const requestProtocols = getDecodeSplit("sec-websocket-protocol", request3.headersList); if (!requestProtocols.includes(secProtocol)) { failWebsocketConnection(handler2, 1002, "Protocol was not set in the opening handshake."); return; @@ -38788,24 +38788,24 @@ var require_dist_node3 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export(dist_src_exports, { - endpoint: () => endpoint2 + endpoint: () => endpoint3 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent5 = require_dist_node2(); - var VERSION9 = "9.0.5"; - var userAgent2 = `octokit-endpoint.js/${VERSION9} ${(0, import_universal_user_agent5.getUserAgent)()}`; - var DEFAULTS2 = { + var import_universal_user_agent7 = require_dist_node2(); + var VERSION11 = "9.0.5"; + var userAgent3 = `octokit-endpoint.js/${VERSION11} ${(0, import_universal_user_agent7.getUserAgent)()}`; + var DEFAULTS3 = { method: "GET", baseUrl: "https://api.github.com", headers: { accept: "application/vnd.github.v3+json", - "user-agent": userAgent2 + "user-agent": userAgent3 }, mediaType: { format: "" } }; - function lowercaseKeys2(object) { + function lowercaseKeys3(object) { if (!object) { return {}; } @@ -38814,7 +38814,7 @@ var require_dist_node3 = __commonJS({ return newObj; }, {}); } - function isPlainObject3(value) { + function isPlainObject5(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -38825,21 +38825,21 @@ var require_dist_node3 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto2, "constructor") && proto2.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - function mergeDeep2(defaults, options) { + function mergeDeep3(defaults, options) { const result = Object.assign({}, defaults); Object.keys(options).forEach((key) => { - if (isPlainObject3(options[key])) { + if (isPlainObject5(options[key])) { if (!(key in defaults)) Object.assign(result, { [key]: options[key] }); else - result[key] = mergeDeep2(defaults[key], options[key]); + result[key] = mergeDeep3(defaults[key], options[key]); } else { Object.assign(result, { [key]: options[key] }); } }); return result; } - function removeUndefinedProperties2(obj) { + function removeUndefinedProperties3(obj) { for (const key in obj) { if (obj[key] === void 0) { delete obj[key]; @@ -38847,7 +38847,7 @@ var require_dist_node3 = __commonJS({ } return obj; } - function merge2(defaults, route, options) { + function merge3(defaults, route, options) { var _a; if (typeof route === "string") { let [method, url] = route.split(" "); @@ -38855,10 +38855,10 @@ var require_dist_node3 = __commonJS({ } else { options = Object.assign({}, route); } - options.headers = lowercaseKeys2(options.headers); - removeUndefinedProperties2(options); - removeUndefinedProperties2(options.headers); - const mergedOptions = mergeDeep2(defaults || {}, options); + options.headers = lowercaseKeys3(options.headers); + removeUndefinedProperties3(options); + removeUndefinedProperties3(options.headers); + const mergedOptions = mergeDeep3(defaults || {}, options); if (options.url === "/graphql") { if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( @@ -38869,7 +38869,7 @@ var require_dist_node3 = __commonJS({ } return mergedOptions; } - function addQueryParameters2(url, parameters) { + function addQueryParameters3(url, parameters) { const separator = /\?/.test(url) ? "&" : "?"; const names = Object.keys(parameters); if (names.length === 0) { @@ -38882,18 +38882,18 @@ var require_dist_node3 = __commonJS({ return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } - var urlVariableRegex2 = /\{[^}]+\}/g; - function removeNonChars2(variableName) { + var urlVariableRegex3 = /\{[^}]+\}/g; + function removeNonChars3(variableName) { return variableName.replace(/^\W+|\W+$/g, "").split(/,/); } - function extractUrlVariableNames2(url) { - const matches = url.match(urlVariableRegex2); + function extractUrlVariableNames3(url) { + const matches = url.match(urlVariableRegex3); if (!matches) { return []; } - return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); + return matches.map(removeNonChars3).reduce((a, b) => a.concat(b), []); } - function omit2(object, keysToOmit) { + function omit3(object, keysToOmit) { const result = { __proto__: null }; for (const key of Object.keys(object)) { if (keysToOmit.indexOf(key) === -1) { @@ -38902,7 +38902,7 @@ var require_dist_node3 = __commonJS({ } return result; } - function encodeReserved2(str) { + function encodeReserved3(str) { return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { if (!/%[0-9A-Fa-f]/.test(part)) { part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); @@ -38910,67 +38910,67 @@ var require_dist_node3 = __commonJS({ return part; }).join(""); } - function encodeUnreserved2(str) { + function encodeUnreserved3(str) { return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { return "%" + c.charCodeAt(0).toString(16).toUpperCase(); }); } - function encodeValue2(operator, value, key) { - value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + function encodeValue3(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved3(value) : encodeUnreserved3(value); if (key) { - return encodeUnreserved2(key) + "=" + value; + return encodeUnreserved3(key) + "=" + value; } else { return value; } } - function isDefined2(value) { + function isDefined3(value) { return value !== void 0 && value !== null; } - function isKeyOperator2(operator) { + function isKeyOperator3(operator) { return operator === ";" || operator === "&" || operator === "?"; } - function getValues2(context2, operator, key, modifier) { + function getValues3(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined2(value) && value !== "") { + if (isDefined3(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { value = value.substring(0, parseInt(modifier, 10)); } result.push( - encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + encodeValue3(operator, value, isKeyOperator3(operator) ? key : "") ); } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { + value.filter(isDefined3).forEach(function(value2) { result.push( - encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + encodeValue3(operator, value2, isKeyOperator3(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - result.push(encodeValue2(operator, value[k], k)); + if (isDefined3(value[k])) { + result.push(encodeValue3(operator, value[k], k)); } }); } } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { - tmp.push(encodeValue2(operator, value2)); + value.filter(isDefined3).forEach(function(value2) { + tmp.push(encodeValue3(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - tmp.push(encodeUnreserved2(k)); - tmp.push(encodeValue2(operator, value[k].toString())); + if (isDefined3(value[k])) { + tmp.push(encodeUnreserved3(k)); + tmp.push(encodeValue3(operator, value[k].toString())); } }); } - if (isKeyOperator2(operator)) { - result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + if (isKeyOperator3(operator)) { + result.push(encodeUnreserved3(key) + "=" + tmp.join(",")); } else if (tmp.length !== 0) { result.push(tmp.join(",")); } @@ -38978,23 +38978,23 @@ var require_dist_node3 = __commonJS({ } } else { if (operator === ";") { - if (isDefined2(value)) { - result.push(encodeUnreserved2(key)); + if (isDefined3(value)) { + result.push(encodeUnreserved3(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { - result.push(encodeUnreserved2(key) + "="); + result.push(encodeUnreserved3(key) + "="); } else if (value === "") { result.push(""); } } return result; } - function parseUrl2(template) { + function parseUrl3(template) { return { - expand: expand2.bind(null, template) + expand: expand3.bind(null, template) }; } - function expand2(template, context2) { + function expand3(template, context2) { var operators = ["+", "#", ".", "/", ";", "?", "&"]; template = template.replace( /\{([^\{\}]+)\}|([^\{\}]+)/g, @@ -39008,7 +39008,7 @@ var require_dist_node3 = __commonJS({ } expression.split(/,/g).forEach(function(variable) { var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); - values.push(getValues2(context2, operator, tmp[1], tmp[2] || tmp[3])); + values.push(getValues3(context2, operator, tmp[1], tmp[2] || tmp[3])); }); if (operator && operator !== "+") { var separator = ","; @@ -39022,7 +39022,7 @@ var require_dist_node3 = __commonJS({ return values.join(","); } } else { - return encodeReserved2(literal); + return encodeReserved3(literal); } } ); @@ -39032,13 +39032,13 @@ var require_dist_node3 = __commonJS({ return template.replace(/\/$/, ""); } } - function parse2(options) { + function parse3(options) { var _a; let method = options.method.toUpperCase(); let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); let headers = Object.assign({}, options.headers); let body; - let parameters = omit2(options, [ + let parameters = omit3(options, [ "method", "baseUrl", "url", @@ -39046,13 +39046,13 @@ var require_dist_node3 = __commonJS({ "request", "mediaType" ]); - const urlVariableNames = extractUrlVariableNames2(url); - url = parseUrl2(url).expand(parameters); + const urlVariableNames = extractUrlVariableNames3(url); + url = parseUrl3(url).expand(parameters); if (!/^http/.test(url)) { url = options.baseUrl + url; } const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); - const remainingParameters = omit2(parameters, omittedParameters); + const remainingParameters = omit3(parameters, omittedParameters); const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); if (!isBinaryRequest) { if (options.mediaType.format) { @@ -39074,7 +39074,7 @@ var require_dist_node3 = __commonJS({ } } if (["GET", "HEAD"].includes(method)) { - url = addQueryParameters2(url, remainingParameters); + url = addQueryParameters3(url, remainingParameters); } else { if ("data" in remainingParameters) { body = remainingParameters.data; @@ -39096,20 +39096,20 @@ var require_dist_node3 = __commonJS({ options.request ? { request: options.request } : null ); } - function endpointWithDefaults2(defaults, route, options) { - return parse2(merge2(defaults, route, options)); + function endpointWithDefaults3(defaults, route, options) { + return parse3(merge3(defaults, route, options)); } - function withDefaults4(oldDefaults, newDefaults) { - const DEFAULTS22 = merge2(oldDefaults, newDefaults); - const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + function withDefaults6(oldDefaults, newDefaults) { + const DEFAULTS22 = merge3(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults3.bind(null, DEFAULTS22); return Object.assign(endpoint22, { DEFAULTS: DEFAULTS22, - defaults: withDefaults4.bind(null, DEFAULTS22), - merge: merge2.bind(null, DEFAULTS22), - parse: parse2 + defaults: withDefaults6.bind(null, DEFAULTS22), + merge: merge3.bind(null, DEFAULTS22), + parse: parse3 }); } - var endpoint2 = withDefaults4(null, DEFAULTS2); + var endpoint3 = withDefaults6(null, DEFAULTS3); } }); @@ -39236,14 +39236,14 @@ var require_dist_node5 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export(dist_src_exports, { - RequestError: () => RequestError2 + RequestError: () => RequestError3 }); module.exports = __toCommonJS(dist_src_exports); var import_deprecation = require_dist_node4(); var import_once = __toESM2(require_once()); var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation)); var logOnceHeaders = (0, import_once.default)((deprecation) => console.warn(deprecation)); - var RequestError2 = class extends Error { + var RequestError3 = class extends Error { constructor(message, statusCode, options) { super(message); if (Error.captureStackTrace) { @@ -39318,13 +39318,13 @@ var require_dist_node6 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export(dist_src_exports, { - request: () => request2 + request: () => request3 }); module.exports = __toCommonJS(dist_src_exports); - var import_endpoint2 = require_dist_node3(); - var import_universal_user_agent5 = require_dist_node(); - var VERSION9 = "8.4.0"; - function isPlainObject3(value) { + var import_endpoint3 = require_dist_node3(); + var import_universal_user_agent7 = require_dist_node(); + var VERSION11 = "8.4.0"; + function isPlainObject5(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -39335,15 +39335,15 @@ var require_dist_node6 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto2, "constructor") && proto2.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - var import_request_error2 = require_dist_node5(); + var import_request_error3 = require_dist_node5(); function getBufferResponse(response) { return response.arrayBuffer(); } - function fetchWrapper2(requestOptions) { + function fetchWrapper3(requestOptions) { var _a, _b, _c, _d; const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console; const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false; - if (isPlainObject3(requestOptions.body) || Array.isArray(requestOptions.body)) { + if (isPlainObject5(requestOptions.body) || Array.isArray(requestOptions.body)) { requestOptions.body = JSON.stringify(requestOptions.body); } let headers = {}; @@ -39385,7 +39385,7 @@ var require_dist_node6 = __commonJS({ if (status < 400) { return; } - throw new import_request_error2.RequestError(response.statusText, status, { + throw new import_request_error3.RequestError(response.statusText, status, { response: { url, status, @@ -39396,19 +39396,19 @@ var require_dist_node6 = __commonJS({ }); } if (status === 304) { - throw new import_request_error2.RequestError("Not modified", status, { + throw new import_request_error3.RequestError("Not modified", status, { response: { url, status, headers, - data: await getResponseData2(response) + data: await getResponseData3(response) }, request: requestOptions }); } if (status >= 400) { - const data = await getResponseData2(response); - const error = new import_request_error2.RequestError(toErrorMessage2(data), status, { + const data = await getResponseData3(response); + const error = new import_request_error3.RequestError(toErrorMessage3(data), status, { response: { url, status, @@ -39419,7 +39419,7 @@ var require_dist_node6 = __commonJS({ }); throw error; } - return parseSuccessResponseBody ? await getResponseData2(response) : response.body; + return parseSuccessResponseBody ? await getResponseData3(response) : response.body; }).then((data) => { return { status, @@ -39428,7 +39428,7 @@ var require_dist_node6 = __commonJS({ data }; }).catch((error) => { - if (error instanceof import_request_error2.RequestError) + if (error instanceof import_request_error3.RequestError) throw error; else if (error.name === "AbortError") throw error; @@ -39440,12 +39440,12 @@ var require_dist_node6 = __commonJS({ message = error.cause; } } - throw new import_request_error2.RequestError(message, 500, { + throw new import_request_error3.RequestError(message, 500, { request: requestOptions }); }); } - async function getResponseData2(response) { + async function getResponseData3(response) { const contentType = response.headers.get("content-type"); if (/application\/json/.test(contentType)) { return response.json().catch(() => response.text()).catch(() => ""); @@ -39455,7 +39455,7 @@ var require_dist_node6 = __commonJS({ } return getBufferResponse(response); } - function toErrorMessage2(data) { + function toErrorMessage3(data) { if (typeof data === "string") return data; let suffix; @@ -39472,32 +39472,32 @@ var require_dist_node6 = __commonJS({ } return `Unknown error: ${JSON.stringify(data)}`; } - function withDefaults4(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + function withDefaults6(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper2(endpoint2.parse(endpointOptions)); + return fetchWrapper3(endpoint22.parse(endpointOptions)); } const request22 = (route2, parameters2) => { - return fetchWrapper2( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + return fetchWrapper3( + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; Object.assign(request22, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults6.bind(null, endpoint22) }); return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults6.bind(null, endpoint22) }); } - var request2 = withDefaults4(import_endpoint2.endpoint, { + var request3 = withDefaults6(import_endpoint3.endpoint, { headers: { - "user-agent": `octokit-request.js/${VERSION9} ${(0, import_universal_user_agent5.getUserAgent)()}` + "user-agent": `octokit-request.js/${VERSION11} ${(0, import_universal_user_agent7.getUserAgent)()}` } }); } @@ -39532,8 +39532,8 @@ var require_dist_node7 = __commonJS({ }); module.exports = __toCommonJS(dist_src_exports); var import_request3 = require_dist_node6(); - var import_universal_user_agent5 = require_dist_node(); - var VERSION9 = "7.1.0"; + var import_universal_user_agent7 = require_dist_node(); + var VERSION11 = "7.1.0"; var import_request22 = require_dist_node6(); var import_request4 = require_dist_node6(); function _buildMessageForResponseErrors2(data) { @@ -39541,9 +39541,9 @@ var require_dist_node7 = __commonJS({ ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError2 = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors2(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.name = "GraphqlResponseError"; @@ -39565,7 +39565,7 @@ var require_dist_node7 = __commonJS({ ]; var FORBIDDEN_VARIABLE_OPTIONS2 = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX2 = /\/api\/v3\/?$/; - function graphql3(request2, query2, options) { + function graphql3(request22, query2, options) { if (options) { if (typeof query2 === "string" && "query" in options) { return Promise.reject( @@ -39596,11 +39596,11 @@ var require_dist_node7 = __commonJS({ result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX2.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX2, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -39615,25 +39615,25 @@ var require_dist_node7 = __commonJS({ return response.data.data; }); } - function withDefaults4(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); + function withDefaults6(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query2, options) => { return graphql3(newRequest, query2, options); }; return Object.assign(newApi, { - defaults: withDefaults4.bind(null, newRequest), + defaults: withDefaults6.bind(null, newRequest), endpoint: newRequest.endpoint }); } - var graphql22 = withDefaults4(import_request3.request, { + var graphql22 = withDefaults6(import_request3.request, { headers: { - "user-agent": `octokit-graphql.js/${VERSION9} ${(0, import_universal_user_agent5.getUserAgent)()}` + "user-agent": `octokit-graphql.js/${VERSION11} ${(0, import_universal_user_agent7.getUserAgent)()}` }, method: "POST", url: "/graphql" }); function withCustomRequest2(customRequest) { - return withDefaults4(customRequest, { + return withDefaults6(customRequest, { method: "POST", url: "/graphql" }); @@ -39687,13 +39687,13 @@ var require_dist_node8 = __commonJS({ } return `token ${token}`; } - async function hook2(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( + async function hook2(token, request3, route, parameters) { + const endpoint3 = request3.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix2(token); - return request2(endpoint2); + endpoint3.headers.authorization = withAuthorizationPrefix2(token); + return request3(endpoint3); } var createTokenAuth3 = function createTokenAuth22(token) { if (!token) { @@ -39738,17 +39738,17 @@ var require_dist_node9 = __commonJS({ Octokit: () => Octokit3 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent5 = require_dist_node(); + var import_universal_user_agent7 = require_dist_node(); var import_before_after_hook2 = require_before_after_hook(); var import_request3 = require_dist_node6(); var import_graphql2 = require_dist_node7(); var import_auth_token2 = require_dist_node8(); - var VERSION9 = "5.2.0"; + var VERSION11 = "5.2.0"; var noop2 = () => { }; var consoleWarn2 = console.warn.bind(console); var consoleError2 = console.error.bind(console); - var userAgentTrail2 = `octokit-core.js/${VERSION9} ${(0, import_universal_user_agent5.getUserAgent)()}`; + var userAgentTrail2 = `octokit-core.js/${VERSION11} ${(0, import_universal_user_agent7.getUserAgent)()}`; var _a; var Octokit3 = (_a = class { static defaults(defaults) { @@ -39851,7 +39851,7 @@ var require_dist_node9 = __commonJS({ } } }, (() => { - _a.VERSION = VERSION9; + _a.VERSION = VERSION11; })(), (() => { _a.plugins = []; })(), _a); @@ -39885,7 +39885,7 @@ var require_dist_node10 = __commonJS({ restEndpointMethods: () => restEndpointMethods2 }); module.exports = __toCommonJS(dist_src_exports); - var VERSION9 = "10.4.1"; + var VERSION11 = "10.4.1"; var Endpoints2 = { actions: { addCustomLabelsToSelfHostedRunnerForOrg: [ @@ -41877,8 +41877,8 @@ var require_dist_node10 = __commonJS({ var endpoints_default2 = Endpoints2; var endpointMethodsMap2 = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default2)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint3] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint3; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -42001,7 +42001,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - restEndpointMethods2.VERSION = VERSION9; + restEndpointMethods2.VERSION = VERSION11; function legacyRestEndpointMethods2(octokit) { const api = endpointsToMethods2(octokit); return { @@ -42009,7 +42009,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - legacyRestEndpointMethods2.VERSION = VERSION9; + legacyRestEndpointMethods2.VERSION = VERSION11; } }); @@ -42042,7 +42042,7 @@ var require_dist_node11 = __commonJS({ paginatingEndpoints: () => paginatingEndpoints }); module.exports = __toCommonJS(dist_src_exports); - var VERSION9 = "9.2.1"; + var VERSION11 = "9.2.1"; function normalizePaginatedListResponse2(response) { if (!response.data) { return { @@ -42388,7 +42388,7 @@ var require_dist_node11 = __commonJS({ }) }; } - paginateRest2.VERSION = VERSION9; + paginateRest2.VERSION = VERSION11; } }); @@ -42807,7 +42807,7 @@ var require_fast_content_type_parse = __commonJS({ var defaultContentType = { type: "", parameters: new NullObject() }; Object.freeze(defaultContentType.parameters); Object.freeze(defaultContentType); - function parse2(header) { + function parse3(header) { if (typeof header !== "string") { throw new TypeError("argument header is required and must be a string"); } @@ -42845,7 +42845,7 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - function safeParse2(header) { + function safeParse3(header) { if (typeof header !== "string") { return defaultContentType; } @@ -42883,9 +42883,9 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - module.exports.default = { parse: parse2, safeParse: safeParse2 }; - module.exports.parse = parse2; - module.exports.safeParse = safeParse2; + module.exports.default = { parse: parse3, safeParse: safeParse3 }; + module.exports.parse = parse3; + module.exports.safeParse = safeParse3; module.exports.defaultContentType = defaultContentType; } }); @@ -43993,9 +43993,9 @@ function addQueryParameters(url, parameters) { return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } -var urlVariableRegex = /\{[^}]+\}/g; +var urlVariableRegex = /\{[^{}}]+\}/g; function removeNonChars(variableName) { - return variableName.replace(/^\W+|\W+$/g, "").split(/,/); + return variableName.replace(/(?:^\W+)|(?:(? { const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; return `application/vnd.github.${preview}-preview${format}`; @@ -44211,12 +44211,12 @@ function endpointWithDefaults(defaults, route, options) { return parse(merge(defaults, route, options)); } function withDefaults(oldDefaults, newDefaults) { - const DEFAULTS2 = merge(oldDefaults, newDefaults); - const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2); - return Object.assign(endpoint2, { - DEFAULTS: DEFAULTS2, - defaults: withDefaults.bind(null, DEFAULTS2), - merge: merge.bind(null, DEFAULTS2), + const DEFAULTS22 = merge(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults.bind(null, DEFAULTS22), + merge: merge.bind(null, DEFAULTS22), parse }); } @@ -44245,7 +44245,7 @@ var RequestError = class extends Error { if (options.request.headers.authorization) { requestCopy.headers = Object.assign({}, options.request.headers, { authorization: options.request.headers.authorization.replace( - / .*$/, + /(?]+)>; rel="deprecation"/); + const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/); const deprecationLink = matches && matches.pop(); log.warn( `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` @@ -44408,40 +44408,570 @@ function toErrorMessage(data) { return `Unknown error: ${JSON.stringify(data)}`; } function withDefaults2(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper(endpoint2.parse(endpointOptions)); + return fetchWrapper(endpoint22.parse(endpointOptions)); } - const request2 = (route2, parameters2) => { + const request22 = (route2, parameters2) => { return fetchWrapper( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; - Object.assign(request2, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); - return endpointOptions.request.hook(request2, endpointOptions); + return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); } var request = withDefaults2(endpoint, defaults_default); // var VERSION3 = "0.0.0-development"; +var userAgent2 = `octokit-endpoint.js/${VERSION3} ${getUserAgent()}`; +var DEFAULTS2 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent2 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys2(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject3(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto2 = Object.getPrototypeOf(value); + if (proto2 === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto2, "constructor") && proto2.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep2(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject3(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep2(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties2(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge2(defaults, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys2(options.headers); + removeUndefinedProperties2(options); + removeUndefinedProperties2(options.headers); + const mergedOptions = mergeDeep2(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters2(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex2 = /\{[^}]+\}/g; +function removeNonChars2(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames2(url) { + const matches = url.match(urlVariableRegex2); + if (!matches) { + return []; + } + return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); +} +function omit2(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved2(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved2(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue2(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + if (key) { + return encodeUnreserved2(key) + "=" + value; + } else { + return value; + } +} +function isDefined2(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator2(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues2(context2, operator, key, modifier) { + var value = context2[key], result = []; + if (isDefined2(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + result.push( + encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + result.push(encodeValue2(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + tmp.push(encodeValue2(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + tmp.push(encodeUnreserved2(k)); + tmp.push(encodeValue2(operator, value[k].toString())); + } + }); + } + if (isKeyOperator2(operator)) { + result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined2(value)) { + result.push(encodeUnreserved2(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved2(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl2(template) { + return { + expand: expand2.bind(null, template) + }; +} +function expand2(template, context2) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues2(context2, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved2(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse2(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit2(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames2(url); + url = parseUrl2(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit2(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters2(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults2(defaults, route, options) { + return parse2(merge2(defaults, route, options)); +} +function withDefaults3(oldDefaults, newDefaults) { + const DEFAULTS22 = merge2(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults3.bind(null, DEFAULTS22), + merge: merge2.bind(null, DEFAULTS22), + parse: parse2 + }); +} +var endpoint2 = withDefaults3(null, DEFAULTS2); + +// +var import_fast_content_type_parse2 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError2 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION4 = "0.0.0-development"; +var defaults_default2 = { + headers: { + "user-agent": `octokit-request.js/${VERSION4} ${getUserAgent()}` + } +}; +function isPlainObject4(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto2 = Object.getPrototypeOf(value); + if (proto2 === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto2, "constructor") && proto2.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper2(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject4(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error) { + let message = "Unknown Error"; + if (error instanceof Error) { + if (error.name === "AbortError") { + error.status = 500; + throw error; + } + message = error.message; + if (error.name === "TypeError" && "cause" in error) { + if (error.cause instanceof Error) { + message = error.cause.message; + } else if (typeof error.cause === "string") { + message = error.cause; + } + } + } + const requestError = new RequestError2(message, 500, { + request: requestOptions + }); + requestError.cause = error; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError2(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2(toErrorMessage2(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData2(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData2(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse2.safeParse)(contentType); + if (isJSONResponse2(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse2(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage2(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults4(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper2(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper2( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); +} +var request2 = withDefaults4(endpoint2, defaults_default2); + +// +var VERSION5 = "0.0.0-development"; function _buildMessageForResponseErrors(data) { return `Request failed due to following response errors: ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.errors = response.errors; @@ -44466,7 +44996,7 @@ var NON_VARIABLE_OPTIONS = [ ]; var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; -function graphql(request2, query2, options) { +function graphql(request22, query2, options) { if (options) { if (typeof query2 === "string" && "query" in options) { return Promise.reject( @@ -44497,11 +45027,11 @@ function graphql(request2, query2, options) { result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -44516,25 +45046,25 @@ function graphql(request2, query2, options) { return response.data.data; }); } -function withDefaults3(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); +function withDefaults5(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query2, options) => { return graphql(newRequest, query2, options); }; return Object.assign(newApi, { - defaults: withDefaults3.bind(null, newRequest), + defaults: withDefaults5.bind(null, newRequest), endpoint: newRequest.endpoint }); } -var graphql2 = withDefaults3(request, { +var graphql2 = withDefaults5(request2, { headers: { - "user-agent": `octokit-graphql.js/${VERSION3} ${getUserAgent()}` + "user-agent": `octokit-graphql.js/${VERSION5} ${getUserAgent()}` }, method: "POST", url: "/graphql" }); function withCustomRequest(customRequest) { - return withDefaults3(customRequest, { + return withDefaults5(customRequest, { method: "POST", url: "/graphql" }); @@ -44562,13 +45092,13 @@ function withAuthorizationPrefix(token) { } return `token ${token}`; } -async function hook(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( +async function hook(token, request3, route, parameters) { + const endpoint3 = request3.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix(token); - return request2(endpoint2); + endpoint3.headers.authorization = withAuthorizationPrefix(token); + return request3(endpoint3); } var createTokenAuth = function createTokenAuth2(token) { if (!token) { @@ -44586,14 +45116,14 @@ var createTokenAuth = function createTokenAuth2(token) { }; // -var VERSION4 = "6.1.3"; +var VERSION6 = "6.1.4"; // var noop = () => { }; var consoleWarn = console.warn.bind(console); var consoleError = console.error.bind(console); -var userAgentTrail = `octokit-core.js/${VERSION4} ${getUserAgent()}`; +var userAgentTrail = `octokit-core.js/${VERSION6} ${getUserAgent()}`; var Octokit = class { static defaults(defaults) { const OctokitWithDefaults = class extends this { @@ -44698,20 +45228,20 @@ var Octokit = class { hook; auth; }; -__publicField(Octokit, "VERSION", VERSION4); +__publicField(Octokit, "VERSION", VERSION6); __publicField(Octokit, "plugins", []); // -var VERSION5 = "5.3.1"; +var VERSION7 = "5.3.1"; // function requestLog(octokit) { - octokit.hook.wrap("request", (request2, options) => { + octokit.hook.wrap("request", (request3, options) => { octokit.log.debug("request", options); const start = Date.now(); const requestOptions = octokit.request.endpoint.parse(options); const path = requestOptions.url.replace(options.baseUrl, ""); - return request2(options).then((response) => { + return request3(options).then((response) => { const requestId = response.headers["x-github-request-id"]; octokit.log.info( `${requestOptions.method} ${path} - ${response.status} with id ${requestId} in ${Date.now() - start}ms` @@ -44727,10 +45257,10 @@ function requestLog(octokit) { }); }); } -requestLog.VERSION = VERSION5; +requestLog.VERSION = VERSION7; // -var VERSION6 = "0.0.0-development"; +var VERSION8 = "0.0.0-development"; function normalizePaginatedListResponse(response) { if (!response.data) { return { @@ -44774,7 +45304,7 @@ function iterator(octokit, route, parameters) { const response = await requestMethod({ method, url, headers }); const normalizedResponse = normalizePaginatedListResponse(response); url = ((normalizedResponse.headers.link || "").match( - /<([^>]+)>;\s*rel="next"/ + /<([^<>]+)>;\s*rel="next"/ ) || [])[1]; return { value: normalizedResponse }; } catch (error) { @@ -44833,10 +45363,10 @@ function paginateRest(octokit) { }) }; } -paginateRest.VERSION = VERSION6; +paginateRest.VERSION = VERSION8; // -var VERSION7 = "13.3.1"; +var VERSION9 = "13.3.1"; // var Endpoints = { @@ -46909,8 +47439,8 @@ var endpoints_default = Endpoints; // var endpointMethodsMap = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint3] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint3; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -47035,7 +47565,7 @@ function restEndpointMethods(octokit) { rest: api }; } -restEndpointMethods.VERSION = VERSION7; +restEndpointMethods.VERSION = VERSION9; function legacyRestEndpointMethods(octokit) { const api = endpointsToMethods(octokit); return { @@ -47043,15 +47573,15 @@ function legacyRestEndpointMethods(octokit) { rest: api }; } -legacyRestEndpointMethods.VERSION = VERSION7; +legacyRestEndpointMethods.VERSION = VERSION9; // -var VERSION8 = "21.1.0"; +var VERSION10 = "21.1.1"; // var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRest).defaults( { - userAgent: `octokit-rest.js/${VERSION8}` + userAgent: `octokit-rest.js/${VERSION10}` } ); diff --git a/github-actions/feature-request/main.js b/github-actions/feature-request/main.js index 79a0ed59b..b144d72bb 100644 --- a/github-actions/feature-request/main.js +++ b/github-actions/feature-request/main.js @@ -3699,11 +3699,11 @@ var require_util2 = __commonJS({ } return location; } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -3769,7 +3769,7 @@ var require_util2 = __commonJS({ } return true; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const { headersList } = actualResponse; const policyHeader = (headersList.get("referrer-policy") ?? "").split(","); let policy = ""; @@ -3783,7 +3783,7 @@ var require_util2 = __commonJS({ } } if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -3800,33 +3800,33 @@ var require_util2 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; - if (request2.responseTainting === "cors" || request2.mode === "websocket") { + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; + if (request4.responseTainting === "cors" || request4.mode === "websocket") { if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } } } @@ -3858,26 +3858,26 @@ var require_util2 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (request2.referrer instanceof URL) { - referrerSource = request2.referrer; + } else if (request4.referrer instanceof URL) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); if (referrerURL.toString().length > 4096) { referrerURL = referrerOrigin; } - const areSameOrigin = sameOrigin(request2, referrerURL); - const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request2.url); + const areSameOrigin = sameOrigin(request4, referrerURL); + const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request4.url); switch (policy) { case "origin": return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true); @@ -3888,7 +3888,7 @@ var require_util2 = __commonJS({ case "origin-when-cross-origin": return areSameOrigin ? referrerURL : referrerOrigin; case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -4037,7 +4037,7 @@ var require_util2 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -5923,25 +5923,25 @@ var require_request = __commonJS({ static [kHTTP2BuildRequest](origin, opts, handler2) { const headers = opts.headers; opts = { ...opts, headers: null }; - const request2 = new Request(origin, opts, handler2); - request2.headers = {}; + const request4 = new Request(origin, opts, handler2); + request4.headers = {}; if (Array.isArray(headers)) { if (headers.length % 2 !== 0) { throw new InvalidArgumentError("headers array must be even"); } for (let i = 0; i < headers.length; i += 2) { - processHeader(request2, headers[i], headers[i + 1], true); + processHeader(request4, headers[i], headers[i + 1], true); } } else if (headers && typeof headers === "object") { const keys = Object.keys(headers); for (let i = 0; i < keys.length; i++) { const key = keys[i]; - processHeader(request2, key, headers[key], true); + processHeader(request4, key, headers[key], true); } } else if (headers != null) { throw new InvalidArgumentError("headers must be an object or an array"); } - return request2; + return request4; } static [kHTTP2CopyHeaders](raw) { const rawHeaders = raw.split("\r\n"); @@ -5969,28 +5969,28 @@ var require_request = __commonJS({ return skipAppend ? val : `${key}: ${val}\r `; } - function processHeader(request2, key, val, skipAppend = false) { + function processHeader(request4, key, val, skipAppend = false) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { return; } - if (request2.host === null && key.length === 4 && key.toLowerCase() === "host") { + if (request4.host === null && key.length === 4 && key.toLowerCase() === "host") { if (headerCharRegex.exec(val) !== null) { throw new InvalidArgumentError(`invalid ${key} header`); } - request2.host = val; - } else if (request2.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { - request2.contentType = val; + } else if (request4.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { + request4.contentType = val; if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } else if (key.length === 17 && key.toLowerCase() === "transfer-encoding") { throw new InvalidArgumentError("invalid transfer-encoding header"); } else if (key.length === 10 && key.toLowerCase() === "connection") { @@ -5998,7 +5998,7 @@ var require_request = __commonJS({ if (value !== "close" && value !== "keep-alive") { throw new InvalidArgumentError("invalid connection header"); } else if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (key.length === 10 && key.toLowerCase() === "keep-alive") { throw new InvalidArgumentError("invalid keep-alive header"); @@ -6012,19 +6012,19 @@ var require_request = __commonJS({ if (Array.isArray(val)) { for (let i = 0; i < val.length; i++) { if (skipAppend) { - if (request2.headers[key]) - request2.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; + if (request4.headers[key]) + request4.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; else - request2.headers[key] = processHeaderValue(key, val[i], skipAppend); + request4.headers[key] = processHeaderValue(key, val[i], skipAppend); } else { - request2.headers += processHeaderValue(key, val[i]); + request4.headers += processHeaderValue(key, val[i]); } } } else { if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } } } @@ -7168,10 +7168,10 @@ var require_client = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); - this[kQueue].push(request2); + const request4 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; process.nextTick(resume, this); } else { @@ -7195,8 +7195,8 @@ var require_client = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -7244,13 +7244,13 @@ var require_client = __commonJS({ assert(this[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } } else if (client[kRunning] > 0) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7456,8 +7456,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } } @@ -7497,12 +7497,12 @@ var require_client = __commonJS({ onUpgrade(head) { const { upgrade, client, socket, headers, statusCode } = this; assert(upgrade); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(!socket.destroyed); assert(socket === client[kSocket]); assert(!this.paused); - assert(request2.upgrade || request2.method === "CONNECT"); + assert(request4.upgrade || request4.method === "CONNECT"); this.statusCode = null; this.statusText = ""; this.shouldKeepAlive = null; @@ -7519,7 +7519,7 @@ var require_client = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -7530,8 +7530,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert(!this.upgrade); @@ -7540,22 +7540,22 @@ var require_client = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert.strictEqual(this.timeoutType, TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -7586,11 +7586,11 @@ var require_client = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -7607,8 +7607,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert.strictEqual(this.timeoutType, TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -7621,7 +7621,7 @@ var require_client = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } } @@ -7633,8 +7633,8 @@ var require_client = __commonJS({ if (upgrade) { return; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(statusCode >= 100); this.statusCode = null; this.statusText = ""; @@ -7648,11 +7648,11 @@ var require_client = __commonJS({ if (statusCode < 200) { return; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert.strictEqual(client[kRunning], 0); @@ -7710,8 +7710,8 @@ var require_client = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } assert(client[kSize] === 0); } @@ -7741,13 +7741,13 @@ var require_client = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7880,8 +7880,8 @@ var require_client = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + errorRequest(client, request4, err); } } else { onError(client, err); @@ -7935,8 +7935,8 @@ var require_client = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request3 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request3.headersTimeout != null ? request3.headersTimeout : client[kHeadersTimeout]; + const request5 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request5.headersTimeout != null ? request5.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -7958,13 +7958,13 @@ var require_client = __commonJS({ if (client[kRunning] >= (client[kPipelining] || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; - if (socket && socket.servername !== request2.servername) { + client[kServerName] = request4.servername; + if (socket && socket.servername !== request4.servername) { util.destroy(socket, new InformationalError("servername changed")); return; } @@ -7979,16 +7979,16 @@ var require_client = __commonJS({ if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) { return; } - if (client[kRunning] > 0 && !request2.idempotent) { + if (client[kRunning] > 0 && !request4.idempotent) { return; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body))) { return; } - if (!request2.aborted && write(client, request2)) { + if (!request4.aborted && write(client, request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -7998,12 +7998,12 @@ var require_client = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function write(client, request2) { + function write(client, request4) { if (client[kHTTPConnVersion] === "h2") { - writeH2(client, client[kHTTP2Session], request2); + writeH2(client, client[kHTTP2Session], request4); return; } - const { body, method, path, host, upgrade, headers, blocking, reset } = request2; + const { body, method, path, host, upgrade, headers, blocking, reset } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { body.read(0); @@ -8011,31 +8011,31 @@ var require_client = __commonJS({ const bodyLength = util.bodyLength(body); let contentLength = bodyLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(socket, new InformationalError("aborted")); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -8074,7 +8074,7 @@ upgrade: ${upgrade}\r header += headers; } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { if (contentLength === 0) { @@ -8086,7 +8086,7 @@ upgrade: ${upgrade}\r socket.write(`${header}\r `, "latin1"); } - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); socket.cork(); @@ -8095,48 +8095,48 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable({ body: body.stream(), client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body: body.stream(), client, request: request4, socket, contentLength, header, expectsPayload }); } else { - writeBlob({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeBlob({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } } else if (util.isStream(body)) { - writeStream({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeStream({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else if (util.isIterable(body)) { - writeIterable({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else { assert(false); } return true; } - function writeH2(client, session, request2) { - const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; + function writeH2(client, session, request4) { + const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; let headers; if (typeof reqHeaders === "string") headers = Request[kHTTP2CopyHeaders](reqHeaders.trim()); else headers = reqHeaders; if (upgrade) { - errorRequest(client, request2, new Error("Upgrade not supported for H2")); + errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } let stream; @@ -8147,11 +8147,11 @@ upgrade: ${upgrade}\r session.ref(); stream = session.request(headers, { endStream: false, signal }); if (stream.id && !stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; }); } @@ -8170,14 +8170,14 @@ upgrade: ${upgrade}\r } let contentLength = util.bodyLength(body); if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -8202,15 +8202,15 @@ upgrade: ${upgrade}\r ++h2State.openStreams; stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - if (request2.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.once("end", () => { - request2.onComplete([]); + request4.onComplete([]); }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -8228,7 +8228,7 @@ upgrade: ${upgrade}\r }); stream.once("frameError", (type, code) => { const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`); - errorRequest(client, request2, err); + errorRequest(client, request4, err); if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { h2State.streams -= 1; util.destroy(stream, err); @@ -8237,20 +8237,20 @@ upgrade: ${upgrade}\r return true; function writeBodyH2() { if (!body) { - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); stream.cork(); stream.write(body); stream.uncork(); stream.end(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { writeIterable({ client, - request: request2, + request: request4, contentLength, h2stream: stream, expectsPayload, @@ -8262,7 +8262,7 @@ upgrade: ${upgrade}\r writeBlob({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, h2stream: stream, @@ -8274,7 +8274,7 @@ upgrade: ${upgrade}\r writeStream({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, socket: client[kSocket], @@ -8285,7 +8285,7 @@ upgrade: ${upgrade}\r writeIterable({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, header: "", @@ -8297,11 +8297,11 @@ upgrade: ${upgrade}\r } } } - function writeStream({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + function writeStream({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); if (client[kHTTPConnVersion] === "h2") { let onPipeData = function(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); }; const pipe = pipeline( body, @@ -8311,7 +8311,7 @@ upgrade: ${upgrade}\r util.destroy(body, err); util.destroy(h2stream, err); } else { - request2.onRequestSent(); + request4.onRequestSent(); } } ); @@ -8323,7 +8323,7 @@ upgrade: ${upgrade}\r return; } let finished = false; - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -8379,7 +8379,7 @@ upgrade: ${upgrade}\r } socket.on("drain", onDrain).on("error", onFinished); } - async function writeBlob({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeBlob({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength === body.size, "blob body must have content length"); const isH2 = client[kHTTPConnVersion] === "h2"; try { @@ -8399,8 +8399,8 @@ upgrade: ${upgrade}\r socket.write(buffer); socket.uncork(); } - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -8409,7 +8409,7 @@ upgrade: ${upgrade}\r util.destroy(isH2 ? h2stream : socket, err); } } - async function writeIterable({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeIterable({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -8435,7 +8435,7 @@ upgrade: ${upgrade}\r throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } @@ -8443,14 +8443,14 @@ upgrade: ${upgrade}\r } catch (err) { h2stream.destroy(err); } finally { - request2.onRequestSent(); + request4.onRequestSent(); h2stream.end(); h2stream.off("close", onDrain).off("drain", onDrain); } return; } socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -8468,9 +8468,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -8479,7 +8479,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -8518,7 +8518,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -8529,8 +8529,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -8573,10 +8573,10 @@ ${len.toString(16)}\r } } }; - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert(request2.aborted); + request4.onError(err); + assert(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -9671,10 +9671,10 @@ var require_api_request = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -9689,7 +9689,7 @@ var require_api_request = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -10403,7 +10403,7 @@ var require_mock_utils = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (typeof data === "object") { @@ -10508,7 +10508,7 @@ var require_mock_utils = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); handler2.abort = nop; @@ -10565,7 +10565,7 @@ var require_mock_utils = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -10587,7 +10587,7 @@ var require_mock_utils = __commonJS({ var require_mock_interceptor = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils(); var { kDispatches, kDispatchKey, @@ -10650,7 +10650,7 @@ var require_mock_interceptor = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData(statusCode, data, responseOptions = {}) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -12299,7 +12299,7 @@ var require_request2 = __commonJS({ policyContainer: makePolicyContainer() } }; - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = this[kRealm].settingsObject.baseUrl; let signal = null; @@ -12315,17 +12315,17 @@ var require_request2 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(input instanceof Request); - request2 = input[kState]; + request4 = input[kState]; signal = input[kSignal]; } const origin = this[kRealm].settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request4.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -12333,43 +12333,43 @@ var require_request2 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: this[kRealm].settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -12378,14 +12378,14 @@ var require_request2 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, this[kRealm].settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -12400,27 +12400,27 @@ var require_request2 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; @@ -12431,12 +12431,12 @@ var require_request2 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizeMethodRecord[method] ?? normalizeMethod(method); - request2.method = method; + request4.method = method; } if (init.signal !== void 0) { signal = init.signal; } - this[kState] = request2; + this[kState] = request4; const ac = new AbortController(); this[kSignal] = ac.signal; this[kSignal][kRealm] = this[kRealm]; @@ -12470,13 +12470,13 @@ var require_request2 = __commonJS({ } } this[kHeaders] = new Headers(kConstruct); - this[kHeaders][kHeadersList] = request2.headersList; + this[kHeaders][kHeadersList] = request4.headersList; this[kHeaders][kGuard] = "request"; this[kHeaders][kRealm] = this[kRealm]; if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } this[kHeaders][kGuard] = "request-no-cors"; @@ -12495,14 +12495,14 @@ var require_request2 = __commonJS({ } } const inputBody = input instanceof Request ? input[kState].body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !this[kHeaders][kHeadersList].contains("content-type")) { @@ -12514,12 +12514,12 @@ var require_request2 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -12649,7 +12649,7 @@ var require_request2 = __commonJS({ }; mixinBody(Request); function makeRequest(init) { - const request2 = { + const request4 = { method: "GET", localURLsOnly: false, unsafeRequest: false, @@ -12688,13 +12688,13 @@ var require_request2 = __commonJS({ ...init, headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; - request2.url = request2.urlList[0]; - return request2; + request4.url = request4.urlList[0]; + return request4; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(request4.body); } return newRequest; } @@ -12924,14 +12924,14 @@ var require_fetch = __commonJS({ p.reject(e); return p.promise; } - const request2 = requestObject[kState]; + const request4 = requestObject[kState]; if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; const relevantRealm = null; @@ -12943,7 +12943,7 @@ var require_fetch = __commonJS({ locallyAborted = true; assert(controller != null); controller.abort(requestObject.signal.reason); - abortFetch(p, request2, responseObject, requestObject.signal.reason); + abortFetch(p, request4, responseObject, requestObject.signal.reason); } ); const handleFetchDone = (response) => finalizeAndReportTiming(response, "fetch"); @@ -12952,7 +12952,7 @@ var require_fetch = __commonJS({ return Promise.resolve(); } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return Promise.resolve(); } if (response.type === "error") { @@ -12970,7 +12970,7 @@ var require_fetch = __commonJS({ p.resolve(responseObject); }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: init.dispatcher ?? getGlobalDispatcher() @@ -13015,14 +13015,14 @@ var require_fetch = __commonJS({ performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis2, cacheState); } } - function abortFetch(p, request2, responseObject, error) { + function abortFetch(p, request4, responseObject, error) { var _a, _b; if (!error) { error = new DOMException2("The operation was aborted.", "AbortError"); } p.reject(error); - if (request2.body != null && isReadable((_a = request2.body) == null ? void 0 : _a.stream)) { - request2.body.stream.cancel(error).catch((err) => { + if (request4.body != null && isReadable((_a = request4.body) == null ? void 0 : _a.stream)) { + request4.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -13043,7 +13043,7 @@ var require_fetch = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -13055,9 +13055,9 @@ var require_fetch = __commonJS({ var _a, _b, _c, _d; let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currenTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -13065,7 +13065,7 @@ var require_fetch = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -13075,32 +13075,32 @@ var require_fetch = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a = request4.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = (_d = request2.client) == null ? void 0 : _d.origin; + if (request4.origin === "client") { + request4.origin = (_d = request4.client) == null ? void 0 : _d.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept")) { + if (!request4.headersList.contains("accept")) { const value = "*/*"; - request2.headersList.append("accept", value); + request4.headersList.append("accept", value); } - if (!request2.headersList.contains("accept-language")) { - request2.headersList.append("accept-language", "*"); + if (!request4.headersList.contains("accept-language")) { + request4.headersList.append("accept-language", "*"); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -13108,44 +13108,44 @@ var require_fetch = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { response = await (async () => { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; return await schemeFetch(fetchParams); } - if (request2.mode === "same-origin") { + if (request4.mode === "same-origin") { return makeNetworkError('request mode cannot be "same-origin"'); } - if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { return makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; return await schemeFetch(fetchParams); } - if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { return makeNetworkError("URL scheme must be a HTTP(S) scheme"); } - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; return await httpFetch(fetchParams); })(); } @@ -13153,13 +13153,13 @@ var require_fetch = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -13167,26 +13167,26 @@ var require_fetch = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range")) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range")) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -13202,8 +13202,8 @@ var require_fetch = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -13212,12 +13212,12 @@ var require_fetch = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blobURLEntryObject = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !isBlobLike(blobURLEntryObject)) { + if (request4.method !== "GET" || !isBlobLike(blobURLEntryObject)) { return Promise.resolve(makeNetworkError("invalid method")); } const bodyWithType = safelyExtractBody(blobURLEntryObject); @@ -13235,7 +13235,7 @@ var require_fetch = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -13317,41 +13317,41 @@ var require_fetch = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -13361,13 +13361,13 @@ var require_fetch = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -13378,63 +13378,63 @@ var require_fetch = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization"); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie"); - request2.headersList.delete("host"); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization"); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie"); + request4.headersList.delete("host"); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = makeRequest(request2); + httpRequest = makeRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -13511,7 +13511,7 @@ var require_fetch = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -13519,7 +13519,7 @@ var require_fetch = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -13547,21 +13547,21 @@ var require_fetch = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -13590,7 +13590,7 @@ var require_fetch = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -13702,17 +13702,17 @@ var require_fetch = __commonJS({ } return response; async function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: fetchParams.controller.dispatcher.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: fetchParams.controller.dispatcher.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -13758,8 +13758,8 @@ var require_fetch = __commonJS({ } this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = request2.redirect === "follow" && location && redirectStatusSet.has(status); - if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = request4.redirect === "follow" && location && redirectStatusSet.has(status); + if (request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (const coding of codings) { if (coding === "x-gzip" || coding === "gzip") { decoders.push(zlib.createGunzip({ @@ -14693,36 +14693,36 @@ var require_cache = __commonJS({ } this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); - const p = await this.matchAll(request2, options); + const p = await this.matchAll(request4, options); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { var _a; webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -14744,11 +14744,11 @@ var require_cache = __commonJS({ } return Object.freeze(responseList); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.add" }); - request2 = webidl.converters.RequestInfo(request2); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -14758,11 +14758,11 @@ var require_cache = __commonJS({ requests = webidl.converters["sequence"](requests); const responsePromises = []; const requestList = []; - for (const request2 of requests) { - if (typeof request2 === "string") { + for (const request4 of requests) { + if (typeof request4 === "string") { continue; } - const r = request2[kState]; + const r = request4[kState]; if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14771,8 +14771,8 @@ var require_cache = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = new Request(request2)[kState]; + for (const request4 of requests) { + const r = new Request(request4)[kState]; if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14847,16 +14847,16 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 2, { header: "Cache.put" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); response = webidl.converters.Response(response); let innerRequest = null; - if (request2 instanceof Request) { - innerRequest = request2[kState]; + if (request4 instanceof Request) { + innerRequest = request4[kState]; } else { - innerRequest = new Request(request2)[kState]; + innerRequest = new Request(request4)[kState]; } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -14924,20 +14924,20 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.delete" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = new Request(request2)[kState]; + assert(typeof request4 === "string"); + r = new Request(request4)[kState]; } const operations = []; const operation = { @@ -14963,25 +14963,25 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -14993,12 +14993,12 @@ var require_cache = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = new Request("https://a"); - requestObject[kState] = request3; - requestObject[kHeaders][kHeadersList] = request3.headersList; + requestObject[kState] = request5; + requestObject[kHeaders][kHeadersList] = request5.headersList; requestObject[kHeaders][kGuard] = "immutable"; - requestObject[kRealm] = request3.client; + requestObject[kRealm] = request5.client; requestList.push(requestObject); } promise.resolve(Object.freeze(requestList)); @@ -15093,9 +15093,9 @@ var require_cache = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -15111,7 +15111,7 @@ var require_cache = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -15183,21 +15183,21 @@ var require_cachestorage = __commonJS({ webidl.illegalConstructor(); } } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, { header: "CacheStorage.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -16110,7 +16110,7 @@ var require_connection = __commonJS({ function establishWebSocketConnection(url, protocols, ws, onEstablish, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], serviceWorkers: "none", referrer: "no-referrer", @@ -16121,17 +16121,17 @@ var require_connection = __commonJS({ }); if (options.headers) { const headersList = new Headers(options.headers)[kHeadersList]; - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue); - request2.headersList.append("sec-websocket-version", "13"); + request4.headersList.append("sec-websocket-key", keyValue); + request4.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol); + request4.headersList.append("sec-websocket-protocol", protocol); } const permessageDeflate = ""; const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher ?? getGlobalDispatcher(), processResponse(response) { @@ -16164,7 +16164,7 @@ var require_connection = __commonJS({ return; } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); - if (secProtocol !== null && secProtocol !== request2.headersList.get("Sec-WebSocket-Protocol")) { + if (secProtocol !== null && secProtocol !== request4.headersList.get("Sec-WebSocket-Protocol")) { failWebsocketConnection(ws, "Protocol was not set in the opening handshake."); return; } @@ -17209,7 +17209,7 @@ var require_lib = __commonJS({ } exports.isHttps = isHttps; var HttpClient = class { - constructor(userAgent2, handlers, requestOptions) { + constructor(userAgent4, handlers, requestOptions) { this._ignoreSslError = false; this._allowRedirects = true; this._allowRedirectDowngrade = false; @@ -17218,7 +17218,7 @@ var require_lib = __commonJS({ this._maxRetries = 1; this._keepAlive = false; this._disposed = false; - this.userAgent = userAgent2; + this.userAgent = userAgent4; this.handlers = handlers || []; this.requestOptions = requestOptions; if (requestOptions) { @@ -17483,14 +17483,14 @@ var require_lib = __commonJS({ } _mergeHeaders(headers) { if (this.requestOptions && this.requestOptions.headers) { - return Object.assign({}, lowercaseKeys2(this.requestOptions.headers), lowercaseKeys2(headers || {})); + return Object.assign({}, lowercaseKeys4(this.requestOptions.headers), lowercaseKeys4(headers || {})); } - return lowercaseKeys2(headers || {}); + return lowercaseKeys4(headers || {}); } _getExistingOrDefaultHeader(additionalHeaders, header, _default) { let clientHeader; if (this.requestOptions && this.requestOptions.headers) { - clientHeader = lowercaseKeys2(this.requestOptions.headers)[header]; + clientHeader = lowercaseKeys4(this.requestOptions.headers)[header]; } return additionalHeaders[header] || clientHeader || _default; } @@ -17625,7 +17625,7 @@ var require_lib = __commonJS({ } }; exports.HttpClient = HttpClient; - var lowercaseKeys2 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + var lowercaseKeys4 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); } }); @@ -20462,10 +20462,10 @@ var require_util8 = __commonJS({ } return obj; } - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert(request2.aborted); + request4.onError(err); + assert(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -20993,7 +20993,7 @@ var require_request3 = __commonJS({ return this; } }; - function processHeader(request2, key, val) { + function processHeader(request4, key, val) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { @@ -21032,19 +21032,19 @@ var require_request3 = __commonJS({ } else { val = `${val}`; } - if (request2.host === null && headerName === "host") { + if (request4.host === null && headerName === "host") { if (typeof val !== "string") { throw new InvalidArgumentError("invalid host header"); } - request2.host = val; - } else if (request2.contentLength === null && headerName === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && headerName === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && headerName === "content-type") { - request2.contentType = val; - request2.headers.push(key, val); + } else if (request4.contentType === null && headerName === "content-type") { + request4.contentType = val; + request4.headers.push(key, val); } else if (headerName === "transfer-encoding" || headerName === "keep-alive" || headerName === "upgrade") { throw new InvalidArgumentError(`invalid ${headerName} header`); } else if (headerName === "connection") { @@ -21053,12 +21053,12 @@ var require_request3 = __commonJS({ throw new InvalidArgumentError("invalid connection header"); } if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (headerName === "expect") { throw new NotSupportedError("expect header not supported"); } else { - request2.headers.push(key, val); + request4.headers.push(key, val); } } module.exports = Request; @@ -23371,11 +23371,11 @@ var require_util9 = __commonJS({ function normalizeBinaryStringToUtf8(value) { return Buffer.from(value, "binary").toString("utf8"); } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -23412,10 +23412,10 @@ var require_util9 = __commonJS({ } return policy; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const policy = parseReferrerPolicy(actualResponse); if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -23432,33 +23432,33 @@ var require_util9 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header, true); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; if (serializedOrigin === "client" || serializedOrigin === void 0) { return; } - if (request2.responseTainting === "cors" || request2.mode === "websocket") { - request2.headersList.append("origin", serializedOrigin, true); - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + if (request4.responseTainting === "cors" || request4.mode === "websocket") { + request4.headersList.append("origin", serializedOrigin, true); + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } - request2.headersList.append("origin", serializedOrigin, true); + request4.headersList.append("origin", serializedOrigin, true); } } function coarsenTime(timestamp, crossOriginIsolatedCapability) { @@ -23512,18 +23512,18 @@ var require_util9 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (webidl.is.URL(request2.referrer)) { - referrerSource = request2.referrer; + } else if (webidl.is.URL(request4.referrer)) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); @@ -23541,14 +23541,14 @@ var require_util9 = __commonJS({ case "unsafe-url": return referrerURL; case "strict-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } return referrerOrigin; } case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -23558,17 +23558,17 @@ var require_util9 = __commonJS({ return referrerOrigin; } case "same-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return "no-referrer"; case "origin-when-cross-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return referrerOrigin; case "no-referrer-when-downgrade": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } @@ -23732,7 +23732,7 @@ var require_util9 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -25205,11 +25205,11 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } - request2.onResponseStarted(); + request4.onResponseStarted(); return 0; } onHeaderField(buf) { @@ -25257,9 +25257,9 @@ var require_client_h1 = __commonJS({ assert(!socket.destroyed); assert(!this.paused); assert((headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); - assert(request2.upgrade || request2.method === "CONNECT"); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); + assert(request4.upgrade || request4.method === "CONNECT"); this.statusCode = 0; this.statusText = ""; this.shouldKeepAlive = false; @@ -25276,7 +25276,7 @@ var require_client_h1 = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -25287,8 +25287,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert(!this.upgrade); @@ -25297,22 +25297,22 @@ var require_client_h1 = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert(this.timeoutType === TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -25343,11 +25343,11 @@ var require_client_h1 = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -25364,8 +25364,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(this.timeoutType === TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -25378,7 +25378,7 @@ var require_client_h1 = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } return 0; @@ -25393,8 +25393,8 @@ var require_client_h1 = __commonJS({ } assert(statusCode >= 100); assert((this.headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); this.statusCode = 0; this.statusText = ""; this.bytesRead = 0; @@ -25406,11 +25406,11 @@ var require_client_h1 = __commonJS({ if (statusCode < 200) { return 0; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert(client[kRunning] === 0); @@ -25476,8 +25476,8 @@ var require_client_h1 = __commonJS({ return { version: "h1", defaultPipelining: 1, - write(request2) { - return writeH1(client, request2); + write(request4) { + return writeH1(client, request4); }, resume() { resumeH1(client); @@ -25493,18 +25493,18 @@ var require_client_h1 = __commonJS({ get destroyed() { return socket.destroyed; }, - busy(request2) { + busy(request4) { if (socket[kWriting] || socket[kReset] || socket[kBlocking]) { return true; } - if (request2) { - if (client[kRunning] > 0 && !request2.idempotent) { + if (request4) { + if (client[kRunning] > 0 && !request4.idempotent) { return true; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return true; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body) || util.isFormDataLike(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body) || util.isFormDataLike(request4.body))) { return true; } } @@ -25551,13 +25551,13 @@ var require_client_h1 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -25585,8 +25585,8 @@ var require_client_h1 = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request2 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request2.headersTimeout != null ? request2.headersTimeout : client[kHeadersTimeout]; + const request4 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request4.headersTimeout != null ? request4.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -25595,21 +25595,21 @@ var require_client_h1 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH1(client, request2) { - const { method, path, host, upgrade, blocking, reset } = request2; - let { body, headers, contentLength } = request2; + function writeH1(client, request4) { + const { method, path, host, upgrade, blocking, reset } = request4; + let { body, headers, contentLength } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH"; if (util.isFormDataLike(body)) { if (!extractBody) { extractBody = require_body2().extractBody; } const [bodyStream, contentType] = extractBody(body); - if (request2.contentType == null) { + if (request4.contentType == null) { headers.push("content-type", contentType); } body = bodyStream.stream; contentLength = bodyStream.length; - } else if (util.isBlobLike(body) && request2.contentType == null && body.type) { + } else if (util.isBlobLike(body) && request4.contentType == null && body.type) { headers.push("content-type", body.type); } if (body && typeof body.read === "function") { @@ -25618,33 +25618,33 @@ var require_client_h1 = __commonJS({ const bodyLength = util.bodyLength(body); contentLength = bodyLength ?? contentLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - util.errorRequest(client, request2, err || new RequestAbortedError()); + util.errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(body); util.destroy(socket, new InformationalError("aborted")); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -25695,31 +25695,31 @@ upgrade: ${upgrade}\r } } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { - writeBuffer(abort, null, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, null, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBuffer(body)) { - writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable(abort, body.stream(), client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body.stream(), client, request4, socket, contentLength, header, expectsPayload); } else { - writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload); } } else if (util.isStream(body)) { - writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isIterable(body)) { - writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else { assert(false); } return true; } - function writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); let finished = false; - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -25785,7 +25785,7 @@ upgrade: ${upgrade}\r setImmediate(onClose); } } - function writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload) { try { if (!body) { if (contentLength === 0) { @@ -25805,18 +25805,18 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(body); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (err) { abort(err); } } - async function writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -25829,9 +25829,9 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(buffer); socket.uncork(); - request2.onBodySent(buffer); - request2.onRequestSent(); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(buffer); + request4.onRequestSent(); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } client[kResume](); @@ -25839,7 +25839,7 @@ upgrade: ${upgrade}\r abort(err); } } - async function writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -25858,7 +25858,7 @@ upgrade: ${upgrade}\r } }); socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -25876,9 +25876,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ abort, socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ abort, socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -25888,7 +25888,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -25907,7 +25907,7 @@ upgrade: ${upgrade}\r } socket.cork(); if (bytesWritten === 0) { - if (!expectsPayload && request2.reset !== false) { + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } if (contentLength === null) { @@ -25927,7 +25927,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -25938,8 +25938,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -26082,8 +26082,8 @@ var require_client_h2 = __commonJS({ return { version: "h2", defaultPipelining: Infinity, - write(request2) { - return writeH2(client, request2); + write(request4) { + return writeH2(client, request4); }, resume() { resumeH2(client); @@ -26141,9 +26141,9 @@ var require_client_h2 = __commonJS({ this[kHTTP2Session] = null; util.destroy(this[kSocket], err); if (client[kRunningIdx] < client[kQueue].length) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); client[kPendingIdx] = client[kRunningIdx]; } assert(client[kRunning] === 0); @@ -26160,8 +26160,8 @@ var require_client_h2 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } } @@ -26192,13 +26192,13 @@ var require_client_h2 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH2(client, request2) { - const requestTimeout = request2.bodyTimeout ?? client[kBodyTimeout]; + function writeH2(client, request4) { + const requestTimeout = request4.bodyTimeout ?? client[kBodyTimeout]; const session = client[kHTTP2Session]; - const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; - let { body } = request2; + const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; + let { body } = request4; if (upgrade) { - util.errorRequest(client, request2, new Error("Upgrade not supported for H2")); + util.errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } const headers = {}; @@ -26222,11 +26222,11 @@ var require_client_h2 = __commonJS({ headers[HTTP2_HEADER_AUTHORITY] = host || `${hostname}${port ? `:${port}` : ""}`; headers[HTTP2_HEADER_METHOD] = method; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } err = err || new RequestAbortedError(); - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); if (stream != null) { stream.removeAllListeners("data"); stream.close(); @@ -26236,23 +26236,23 @@ var require_client_h2 = __commonJS({ util.destroy(body, err); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "CONNECT") { session.ref(); stream = session.request(headers, { endStream: false, signal }); if (!stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; }); @@ -26280,14 +26280,14 @@ var require_client_h2 = __commonJS({ contentLength = bodyStream.length; } if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -26303,7 +26303,7 @@ var require_client_h2 = __commonJS({ header += `${key}: ${headers[key]}\r `; } - channels.sendHeaders.publish({ request: request2, headers: header, socket: session[kSocket] }); + channels.sendHeaders.publish({ request: request4, headers: header, socket: session[kSocket] }); } const shouldEndStream = method === "GET" || method === "HEAD" || body === null; if (expectContinue) { @@ -26321,17 +26321,17 @@ var require_client_h2 = __commonJS({ stream.setTimeout(requestTimeout); stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - request2.onResponseStarted(); - if (request2.aborted) { + request4.onResponseStarted(); + if (request4.aborted) { stream.removeAllListeners("data"); return; } - if (request2.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -26339,8 +26339,8 @@ var require_client_h2 = __commonJS({ var _a; stream.removeAllListeners("data"); if (((_a = stream.state) == null ? void 0 : _a.state) == null || stream.state.state < 6) { - if (!request2.aborted && !request2.completed) { - request2.onComplete({}); + if (!request4.aborted && !request4.completed) { + request4.onComplete({}); } client[kQueue][client[kRunningIdx]++] = null; client[kResume](); @@ -26383,10 +26383,10 @@ var require_client_h2 = __commonJS({ abort(err); }); stream.once("trailers", (trailers) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - request2.onComplete(trailers); + request4.onComplete(trailers); }); return true; function writeBodyH2() { @@ -26396,7 +26396,7 @@ var require_client_h2 = __commonJS({ stream, null, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26407,7 +26407,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26419,7 +26419,7 @@ var require_client_h2 = __commonJS({ stream, body.stream(), client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26430,7 +26430,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26444,7 +26444,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, contentLength ); } else if (util.isIterable(body)) { @@ -26453,7 +26453,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26463,7 +26463,7 @@ var require_client_h2 = __commonJS({ } } } - function writeBuffer(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + function writeBuffer(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { try { if (body != null && util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); @@ -26471,18 +26471,18 @@ var require_client_h2 = __commonJS({ h2stream.write(body); h2stream.uncork(); h2stream.end(); - request2.onBodySent(body); + request4.onBodySent(body); } if (!expectsPayload) { socket[kReset] = true; } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (error) { abort(error); } } - function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) { + function writeStream(abort, socket, expectsPayload, h2stream, body, client, request4, contentLength) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); const pipe = pipeline( body, @@ -26493,7 +26493,7 @@ var require_client_h2 = __commonJS({ abort(err); } else { util.removeAllListeners(pipe); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26503,10 +26503,10 @@ var require_client_h2 = __commonJS({ ); util.addListener(pipe, "data", onPipeData); function onPipeData(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); } } - async function writeBlob(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeBlob(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -26517,8 +26517,8 @@ var require_client_h2 = __commonJS({ h2stream.write(buffer); h2stream.uncork(); h2stream.end(); - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26527,7 +26527,7 @@ var require_client_h2 = __commonJS({ abort(err); } } - async function writeIterable(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeIterable(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -26552,13 +26552,13 @@ var require_client_h2 = __commonJS({ throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } } h2stream.end(); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26805,10 +26805,10 @@ var require_client2 = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = new Request(origin, opts, handler2); - this[kQueue].push(request2); + const request4 = new Request(origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; queueMicrotask(() => resume(this)); } else { @@ -26832,8 +26832,8 @@ var require_client2 = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(this, request2, err); + const request4 = requests[i]; + util.errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -26857,8 +26857,8 @@ var require_client2 = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } assert(client[kSize] === 0); } @@ -26962,8 +26962,8 @@ var require_client2 = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - util.errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + util.errorRequest(client, request4, err); } } else { onError(client, err); @@ -27021,12 +27021,12 @@ var require_client2 = __commonJS({ if (client[kRunning] >= (getPipelining(client) || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; + client[kServerName] = request4.servername; (_a = client[kHTTPContext]) == null ? void 0 : _a.destroy(new InformationalError("servername changed"), () => { client[kHTTPContext] = null; resume(client); @@ -27042,10 +27042,10 @@ var require_client2 = __commonJS({ if (client[kHTTPContext].destroyed) { return; } - if (client[kHTTPContext].busy(request2)) { + if (client[kHTTPContext].busy(request4)) { return; } - if (!request2.aborted && client[kHTTPContext].write(request2)) { + if (!request4.aborted && client[kHTTPContext].write(request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -28659,10 +28659,10 @@ var require_api_request2 = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -28678,7 +28678,7 @@ var require_api_request2 = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -29444,7 +29444,7 @@ var require_mock_utils2 = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (data instanceof Uint8Array) { @@ -29577,7 +29577,7 @@ var require_mock_utils2 = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); (_a = handler2.onConnect) == null ? void 0 : _a.call(handler2, (err) => handler2.onError(err), null); @@ -29634,7 +29634,7 @@ var require_mock_utils2 = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -29657,7 +29657,7 @@ var require_mock_utils2 = __commonJS({ var require_mock_interceptor2 = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils2(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils2(); var { kDispatches, kDispatchKey, @@ -29722,7 +29722,7 @@ var require_mock_interceptor2 = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData({ statusCode, data, responseOptions }) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -32022,7 +32022,7 @@ var require_sqlite_cache_store = __commonJS({ var { Writable } = __require("stream"); var { assertCacheKey, assertCacheValue } = require_cache2(); var DatabaseSync; - var VERSION13 = 3; + var VERSION17 = 3; var MAX_ENTRY_SIZE = 2 * 1e3 * 1e3 * 1e3; module.exports = class SqliteCacheStore { #maxEntrySize = MAX_ENTRY_SIZE; @@ -32061,7 +32061,7 @@ var require_sqlite_cache_store = __commonJS({ } this.#db = new DatabaseSync((opts == null ? void 0 : opts.location) ?? ":memory:"); this.#db.exec(` - CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION13} ( + CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION17} ( -- Data specific to us id INTEGER PRIMARY KEY AUTOINCREMENT, url TEXT NOT NULL, @@ -32080,9 +32080,9 @@ var require_sqlite_cache_store = __commonJS({ staleAt INTEGER NOT NULL ); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_url ON cacheInterceptorV${VERSION13}(url); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_method ON cacheInterceptorV${VERSION13}(method); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_deleteAt ON cacheInterceptorV${VERSION13}(deleteAt); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_url ON cacheInterceptorV${VERSION17}(url); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_method ON cacheInterceptorV${VERSION17}(method); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_deleteAt ON cacheInterceptorV${VERSION17}(deleteAt); `); this.#getValuesQuery = this.#db.prepare(` SELECT @@ -32097,7 +32097,7 @@ var require_sqlite_cache_store = __commonJS({ vary, cachedAt, staleAt - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION17} WHERE url = ? AND method = ? @@ -32105,7 +32105,7 @@ var require_sqlite_cache_store = __commonJS({ deleteAt ASC `); this.#updateValueQuery = this.#db.prepare(` - UPDATE cacheInterceptorV${VERSION13} SET + UPDATE cacheInterceptorV${VERSION17} SET body = ?, deleteAt = ?, statusCode = ?, @@ -32119,7 +32119,7 @@ var require_sqlite_cache_store = __commonJS({ id = ? `); this.#insertValueQuery = this.#db.prepare(` - INSERT INTO cacheInterceptorV${VERSION13} ( + INSERT INTO cacheInterceptorV${VERSION17} ( url, method, body, @@ -32135,20 +32135,20 @@ var require_sqlite_cache_store = __commonJS({ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `); this.#deleteByUrlQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE url = ?` + `DELETE FROM cacheInterceptorV${VERSION17} WHERE url = ?` ); this.#countEntriesQuery = this.#db.prepare( - `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION13}` + `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION17}` ); this.#deleteExpiredValuesQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE deleteAt <= ?` + `DELETE FROM cacheInterceptorV${VERSION17} WHERE deleteAt <= ?` ); this.#deleteOldValuesQuery = this.#maxCount === Infinity ? null : this.#db.prepare(` - DELETE FROM cacheInterceptorV${VERSION13} + DELETE FROM cacheInterceptorV${VERSION17} WHERE id IN ( SELECT id - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION17} ORDER BY cachedAt DESC LIMIT ? ) @@ -33239,7 +33239,7 @@ var require_request4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); input = webidl.converters.RequestInfo(input, prefix, "input"); init = webidl.converters.RequestInit(init, prefix, "init"); - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = environmentSettingsObject.settingsObject.baseUrl; let signal = null; @@ -33256,18 +33256,18 @@ var require_request4 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(webidl.is.Request(input)); - request2 = input.#state; + request4 = input.#state; signal = input.#signal; this.#dispatcher = init.dispatcher || input.#dispatcher; } const origin = environmentSettingsObject.settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request4.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -33275,43 +33275,43 @@ var require_request4 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: environmentSettingsObject.settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -33320,14 +33320,14 @@ var require_request4 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, environmentSettingsObject.settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -33342,33 +33342,33 @@ var require_request4 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; const mayBeNormalized = normalizedMethodRecords[method]; if (mayBeNormalized !== void 0) { - request2.method = mayBeNormalized; + request4.method = mayBeNormalized; } else { if (!isValidHTTPToken(method)) { throw new TypeError(`'${method}' is not a valid HTTP method.`); @@ -33378,9 +33378,9 @@ var require_request4 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizedMethodRecordsBase[upperCase] ?? method; - request2.method = method; + request4.method = method; } - if (!patchMethodWarning && request2.method === "patch") { + if (!patchMethodWarning && request4.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" }); @@ -33390,7 +33390,7 @@ var require_request4 = __commonJS({ if (init.signal !== void 0) { signal = init.signal; } - this.#state = request2; + this.#state = request4; const ac = new AbortController(); this.#signal = ac.signal; if (signal != null) { @@ -33411,12 +33411,12 @@ var require_request4 = __commonJS({ } } this.#headers = new Headers(kConstruct); - setHeadersList(this.#headers, request2.headersList); + setHeadersList(this.#headers, request4.headersList); setHeadersGuard(this.#headers, "request"); if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } setHeadersGuard(this.#headers, "request-no-cors"); @@ -33435,14 +33435,14 @@ var require_request4 = __commonJS({ } } const inputBody = webidl.is.Request(input) ? input.#state.body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !getHeadersList(this.#headers).contains("content-type", true)) { @@ -33454,12 +33454,12 @@ var require_request4 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -33604,24 +33604,24 @@ var require_request4 = __commonJS({ }; return `Request ${nodeUtil.formatWithOptions(options, properties)}`; } - static setRequestSignal(request2, newSignal) { - request2.#signal = newSignal; - return request2; + static setRequestSignal(request4, newSignal) { + request4.#signal = newSignal; + return request4; } - static getRequestDispatcher(request2) { - return request2.#dispatcher; + static getRequestDispatcher(request4) { + return request4.#dispatcher; } - static setRequestDispatcher(request2, newDispatcher) { - request2.#dispatcher = newDispatcher; + static setRequestDispatcher(request4, newDispatcher) { + request4.#dispatcher = newDispatcher; } - static setRequestHeaders(request2, newHeaders) { - request2.#headers = newHeaders; + static setRequestHeaders(request4, newHeaders) { + request4.#headers = newHeaders; } - static getRequestState(request2) { - return request2.#state; + static getRequestState(request4) { + return request4.#state; } - static setRequestState(request2, newState) { - request2.#state = newState; + static setRequestState(request4, newState) { + request4.#state = newState; } }; var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState } = Request; @@ -33674,23 +33674,23 @@ var require_request4 = __commonJS({ headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(newRequest, request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(newRequest, request4.body); } return newRequest; } function fromInnerRequest(innerRequest, dispatcher, signal, guard) { - const request2 = new Request(kConstruct); - setRequestState(request2, innerRequest); - setRequestDispatcher(request2, dispatcher); - setRequestSignal(request2, signal); + const request4 = new Request(kConstruct); + setRequestState(request4, innerRequest); + setRequestDispatcher(request4, dispatcher); + setRequestSignal(request4, signal); const headers = new Headers(kConstruct); - setRequestHeaders(request2, headers); + setRequestHeaders(request4, headers); setHeadersList(headers, innerRequest.headersList); setHeadersGuard(headers, guard); - return request2; + return request4; } Object.defineProperties(Request.prototype, { method: kEnumerableProperty, @@ -33928,14 +33928,14 @@ var require_fetch2 = __commonJS({ p.reject(e); return p.promise; } - const request2 = getRequestState(requestObject); + const request4 = getRequestState(requestObject); if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; let locallyAborted = false; @@ -33947,7 +33947,7 @@ var require_fetch2 = __commonJS({ assert(controller != null); controller.abort(requestObject.signal.reason); const realResponse = responseObject == null ? void 0 : responseObject.deref(); - abortFetch(p, request2, realResponse, requestObject.signal.reason); + abortFetch(p, request4, realResponse, requestObject.signal.reason); } ); const processResponse = (response) => { @@ -33955,7 +33955,7 @@ var require_fetch2 = __commonJS({ return; } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return; } if (response.type === "error") { @@ -33967,7 +33967,7 @@ var require_fetch2 = __commonJS({ p = null; }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: getRequestDispatcher(requestObject) @@ -34008,13 +34008,13 @@ var require_fetch2 = __commonJS({ ); } var markResourceTiming = performance.markResourceTiming; - function abortFetch(p, request2, responseObject, error) { + function abortFetch(p, request4, responseObject, error) { var _a, _b; if (p) { p.reject(error); } - if (((_a = request2.body) == null ? void 0 : _a.stream) != null && isReadable(request2.body.stream)) { - request2.body.stream.cancel(error).catch((err) => { + if (((_a = request4.body) == null ? void 0 : _a.stream) != null && isReadable(request4.body.stream)) { + request4.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -34035,7 +34035,7 @@ var require_fetch2 = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -34048,9 +34048,9 @@ var require_fetch2 = __commonJS({ assert(dispatcher); let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currentTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -34058,7 +34058,7 @@ var require_fetch2 = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -34068,32 +34068,32 @@ var require_fetch2 = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a = request4.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = request2.client.origin; + if (request4.origin === "client") { + request4.origin = request4.client.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept", true)) { + if (!request4.headersList.contains("accept", true)) { const value = "*/*"; - request2.headersList.append("accept", value, true); + request4.headersList.append("accept", value, true); } - if (!request2.headersList.contains("accept-language", true)) { - request2.headersList.append("accept-language", "*", true); + if (!request4.headersList.contains("accept-language", true)) { + request4.headersList.append("accept-language", "*", true); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -34101,41 +34101,41 @@ var require_fetch2 = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; response = await schemeFetch(fetchParams); - } else if (request2.mode === "same-origin") { + } else if (request4.mode === "same-origin") { response = makeNetworkError('request mode cannot be "same-origin"'); - } else if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + } else if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { response = makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } else { - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; response = await schemeFetch(fetchParams); } - } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { response = makeNetworkError("URL scheme must be a HTTP(S) scheme"); } else { - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; response = await httpFetch(fetchParams); } } @@ -34143,13 +34143,13 @@ var require_fetch2 = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -34157,26 +34157,26 @@ var require_fetch2 = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range", true)) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range", true)) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -34192,8 +34192,8 @@ var require_fetch2 = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -34202,19 +34202,19 @@ var require_fetch2 = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("node:buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blob = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !webidl.is.Blob(blob)) { + if (request4.method !== "GET" || !webidl.is.Blob(blob)) { return Promise.resolve(makeNetworkError("invalid method")); } const response = makeResponse(); const fullLength = blob.size; const serializedFullLength = isomorphicEncode(`${fullLength}`); const type = blob.type; - if (!request2.headersList.contains("range", true)) { + if (!request4.headersList.contains("range", true)) { const bodyWithType = extractBody(blob); response.statusText = "OK"; response.body = bodyWithType[0]; @@ -34222,7 +34222,7 @@ var require_fetch2 = __commonJS({ response.headersList.set("content-type", type, true); } else { response.rangeRequested = true; - const rangeHeader = request2.headersList.get("range", true); + const rangeHeader = request4.headersList.get("range", true); const rangeValue = simpleRangeHeaderValue(rangeHeader, true); if (rangeValue === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34253,7 +34253,7 @@ var require_fetch2 = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34342,41 +34342,41 @@ var require_fetch2 = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(void 0, false); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -34386,13 +34386,13 @@ var require_fetch2 = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -34403,63 +34403,63 @@ var require_fetch2 = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization", true); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie", true); - request2.headersList.delete("host", true); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization", true); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie", true); + request4.headersList.delete("host", true); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = cloneRequest(request2); + httpRequest = cloneRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -34536,7 +34536,7 @@ var require_fetch2 = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -34544,7 +34544,7 @@ var require_fetch2 = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -34574,21 +34574,21 @@ var require_fetch2 = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -34617,7 +34617,7 @@ var require_fetch2 = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -34728,17 +34728,17 @@ var require_fetch2 = __commonJS({ } return response; function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: agent.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -34774,8 +34774,8 @@ var require_fetch2 = __commonJS({ location = headersList.get("location", true); this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status); - if (codings.length !== 0 && request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = location && request4.redirect === "follow" && redirectStatusSet.has(status); + if (codings.length !== 0 && request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (let i = codings.length - 1; i >= 0; --i) { const coding = codings[i]; if (coding === "x-gzip" || coding === "gzip") { @@ -34917,32 +34917,32 @@ var require_cache4 = __commonJS({ webidl.util.markAsUncloneable(this); this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.match"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - const p = this.#internalMatchAll(request2, options, 1); + const p = this.#internalMatchAll(request4, options, 1); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.matchAll"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - return this.#internalMatchAll(request2, options); + return this.#internalMatchAll(request4, options); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); const prefix = "Cache.add"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -34952,19 +34952,19 @@ var require_cache4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); const responsePromises = []; const requestList = []; - for (let request2 of requests) { - if (request2 === void 0) { + for (let request4 of requests) { + if (request4 === void 0) { throw webidl.errors.conversionFailed({ prefix, argument: "Argument 1", types: ["undefined is not allowed"] }); } - request2 = webidl.converters.RequestInfo(request2); - if (typeof request2 === "string") { + request4 = webidl.converters.RequestInfo(request4); + if (typeof request4 === "string") { continue; } - const r = getRequestState(request2); + const r = getRequestState(request4); if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: prefix, @@ -34973,8 +34973,8 @@ var require_cache4 = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = getRequestState(new Request(request2)); + for (const request4 of requests) { + const r = getRequestState(new Request(request4)); if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: prefix, @@ -35048,17 +35048,17 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); const prefix = "Cache.put"; webidl.argumentLengthCheck(arguments, 2, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); response = webidl.converters.Response(response, prefix, "response"); let innerRequest = null; - if (webidl.is.Request(request2)) { - innerRequest = getRequestState(request2); + if (webidl.is.Request(request4)) { + innerRequest = getRequestState(request4); } else { - innerRequest = getRequestState(new Request(request2)); + innerRequest = getRequestState(new Request(request4)); } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -35126,21 +35126,21 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.delete"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = getRequestState(new Request(request2)); + assert(typeof request4 === "string"); + r = getRequestState(new Request(request4)); } const operations = []; const operation = { @@ -35166,26 +35166,26 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.keys"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -35197,9 +35197,9 @@ var require_cache4 = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = fromInnerRequest( - request3, + request5, void 0, new AbortController().signal, "immutable" @@ -35298,9 +35298,9 @@ var require_cache4 = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -35316,7 +35316,7 @@ var require_cache4 = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -35324,20 +35324,20 @@ var require_cache4 = __commonJS({ } return true; } - #internalMatchAll(request2, options, maxResponses = Infinity) { + #internalMatchAll(request4, options, maxResponses = Infinity) { let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -35425,21 +35425,21 @@ var require_cachestorage2 = __commonJS({ } webidl.util.markAsUncloneable(this); } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, "CacheStorage.match"); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -36529,7 +36529,7 @@ var require_connection2 = __commonJS({ function establishWebSocketConnection(url, protocols, client, handler2, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], client, serviceWorkers: "none", @@ -36541,18 +36541,18 @@ var require_connection2 = __commonJS({ }); if (options.headers) { const headersList = getHeadersList(new Headers(options.headers)); - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue, true); - request2.headersList.append("sec-websocket-version", "13", true); + request4.headersList.append("sec-websocket-key", keyValue, true); + request4.headersList.append("sec-websocket-version", "13", true); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol, true); + request4.headersList.append("sec-websocket-protocol", protocol, true); } const permessageDeflate = "permessage-deflate; client_max_window_bits"; - request2.headersList.append("sec-websocket-extensions", permessageDeflate, true); + request4.headersList.append("sec-websocket-extensions", permessageDeflate, true); const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher, processResponse(response) { @@ -36593,7 +36593,7 @@ var require_connection2 = __commonJS({ } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); if (secProtocol !== null) { - const requestProtocols = getDecodeSplit("sec-websocket-protocol", request2.headersList); + const requestProtocols = getDecodeSplit("sec-websocket-protocol", request4.headersList); if (!requestProtocols.includes(secProtocol)) { failWebsocketConnection(handler2, 1002, "Protocol was not set in the opening handshake."); return; @@ -38793,24 +38793,24 @@ var require_dist_node3 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - endpoint: () => endpoint2 + endpoint: () => endpoint4 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node2(); - var VERSION13 = "9.0.5"; - var userAgent2 = `octokit-endpoint.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; - var DEFAULTS2 = { + var import_universal_user_agent13 = require_dist_node2(); + var VERSION17 = "9.0.5"; + var userAgent4 = `octokit-endpoint.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}`; + var DEFAULTS4 = { method: "GET", baseUrl: "https://api.github.com", headers: { accept: "application/vnd.github.v3+json", - "user-agent": userAgent2 + "user-agent": userAgent4 }, mediaType: { format: "" } }; - function lowercaseKeys2(object) { + function lowercaseKeys4(object) { if (!object) { return {}; } @@ -38819,7 +38819,7 @@ var require_dist_node3 = __commonJS({ return newObj; }, {}); } - function isPlainObject3(value) { + function isPlainObject7(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -38830,21 +38830,21 @@ var require_dist_node3 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - function mergeDeep2(defaults, options) { + function mergeDeep4(defaults, options) { const result = Object.assign({}, defaults); Object.keys(options).forEach((key) => { - if (isPlainObject3(options[key])) { + if (isPlainObject7(options[key])) { if (!(key in defaults)) Object.assign(result, { [key]: options[key] }); else - result[key] = mergeDeep2(defaults[key], options[key]); + result[key] = mergeDeep4(defaults[key], options[key]); } else { Object.assign(result, { [key]: options[key] }); } }); return result; } - function removeUndefinedProperties2(obj) { + function removeUndefinedProperties4(obj) { for (const key in obj) { if (obj[key] === void 0) { delete obj[key]; @@ -38852,7 +38852,7 @@ var require_dist_node3 = __commonJS({ } return obj; } - function merge2(defaults, route, options) { + function merge4(defaults, route, options) { var _a; if (typeof route === "string") { let [method, url] = route.split(" "); @@ -38860,10 +38860,10 @@ var require_dist_node3 = __commonJS({ } else { options = Object.assign({}, route); } - options.headers = lowercaseKeys2(options.headers); - removeUndefinedProperties2(options); - removeUndefinedProperties2(options.headers); - const mergedOptions = mergeDeep2(defaults || {}, options); + options.headers = lowercaseKeys4(options.headers); + removeUndefinedProperties4(options); + removeUndefinedProperties4(options.headers); + const mergedOptions = mergeDeep4(defaults || {}, options); if (options.url === "/graphql") { if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( @@ -38874,7 +38874,7 @@ var require_dist_node3 = __commonJS({ } return mergedOptions; } - function addQueryParameters2(url, parameters) { + function addQueryParameters4(url, parameters) { const separator = /\?/.test(url) ? "&" : "?"; const names = Object.keys(parameters); if (names.length === 0) { @@ -38887,18 +38887,18 @@ var require_dist_node3 = __commonJS({ return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } - var urlVariableRegex2 = /\{[^}]+\}/g; - function removeNonChars2(variableName) { + var urlVariableRegex4 = /\{[^}]+\}/g; + function removeNonChars4(variableName) { return variableName.replace(/^\W+|\W+$/g, "").split(/,/); } - function extractUrlVariableNames2(url) { - const matches = url.match(urlVariableRegex2); + function extractUrlVariableNames4(url) { + const matches = url.match(urlVariableRegex4); if (!matches) { return []; } - return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); + return matches.map(removeNonChars4).reduce((a, b) => a.concat(b), []); } - function omit2(object, keysToOmit) { + function omit4(object, keysToOmit) { const result = { __proto__: null }; for (const key of Object.keys(object)) { if (keysToOmit.indexOf(key) === -1) { @@ -38907,7 +38907,7 @@ var require_dist_node3 = __commonJS({ } return result; } - function encodeReserved2(str) { + function encodeReserved4(str) { return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { if (!/%[0-9A-Fa-f]/.test(part)) { part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); @@ -38915,67 +38915,67 @@ var require_dist_node3 = __commonJS({ return part; }).join(""); } - function encodeUnreserved2(str) { + function encodeUnreserved4(str) { return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { return "%" + c.charCodeAt(0).toString(16).toUpperCase(); }); } - function encodeValue2(operator, value, key) { - value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + function encodeValue4(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved4(value) : encodeUnreserved4(value); if (key) { - return encodeUnreserved2(key) + "=" + value; + return encodeUnreserved4(key) + "=" + value; } else { return value; } } - function isDefined2(value) { + function isDefined4(value) { return value !== void 0 && value !== null; } - function isKeyOperator2(operator) { + function isKeyOperator4(operator) { return operator === ";" || operator === "&" || operator === "?"; } - function getValues2(context3, operator, key, modifier) { + function getValues4(context3, operator, key, modifier) { var value = context3[key], result = []; - if (isDefined2(value) && value !== "") { + if (isDefined4(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { value = value.substring(0, parseInt(modifier, 10)); } result.push( - encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value, isKeyOperator4(operator) ? key : "") ); } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { + value.filter(isDefined4).forEach(function(value2) { result.push( - encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value2, isKeyOperator4(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - result.push(encodeValue2(operator, value[k], k)); + if (isDefined4(value[k])) { + result.push(encodeValue4(operator, value[k], k)); } }); } } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { - tmp.push(encodeValue2(operator, value2)); + value.filter(isDefined4).forEach(function(value2) { + tmp.push(encodeValue4(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - tmp.push(encodeUnreserved2(k)); - tmp.push(encodeValue2(operator, value[k].toString())); + if (isDefined4(value[k])) { + tmp.push(encodeUnreserved4(k)); + tmp.push(encodeValue4(operator, value[k].toString())); } }); } - if (isKeyOperator2(operator)) { - result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + if (isKeyOperator4(operator)) { + result.push(encodeUnreserved4(key) + "=" + tmp.join(",")); } else if (tmp.length !== 0) { result.push(tmp.join(",")); } @@ -38983,23 +38983,23 @@ var require_dist_node3 = __commonJS({ } } else { if (operator === ";") { - if (isDefined2(value)) { - result.push(encodeUnreserved2(key)); + if (isDefined4(value)) { + result.push(encodeUnreserved4(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { - result.push(encodeUnreserved2(key) + "="); + result.push(encodeUnreserved4(key) + "="); } else if (value === "") { result.push(""); } } return result; } - function parseUrl2(template) { + function parseUrl4(template) { return { - expand: expand2.bind(null, template) + expand: expand4.bind(null, template) }; } - function expand2(template, context3) { + function expand4(template, context3) { var operators = ["+", "#", ".", "/", ";", "?", "&"]; template = template.replace( /\{([^\{\}]+)\}|([^\{\}]+)/g, @@ -39013,7 +39013,7 @@ var require_dist_node3 = __commonJS({ } expression.split(/,/g).forEach(function(variable) { var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); - values.push(getValues2(context3, operator, tmp[1], tmp[2] || tmp[3])); + values.push(getValues4(context3, operator, tmp[1], tmp[2] || tmp[3])); }); if (operator && operator !== "+") { var separator = ","; @@ -39027,7 +39027,7 @@ var require_dist_node3 = __commonJS({ return values.join(","); } } else { - return encodeReserved2(literal); + return encodeReserved4(literal); } } ); @@ -39037,13 +39037,13 @@ var require_dist_node3 = __commonJS({ return template.replace(/\/$/, ""); } } - function parse2(options) { + function parse4(options) { var _a; let method = options.method.toUpperCase(); let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); let headers = Object.assign({}, options.headers); let body; - let parameters = omit2(options, [ + let parameters = omit4(options, [ "method", "baseUrl", "url", @@ -39051,13 +39051,13 @@ var require_dist_node3 = __commonJS({ "request", "mediaType" ]); - const urlVariableNames = extractUrlVariableNames2(url); - url = parseUrl2(url).expand(parameters); + const urlVariableNames = extractUrlVariableNames4(url); + url = parseUrl4(url).expand(parameters); if (!/^http/.test(url)) { url = options.baseUrl + url; } const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); - const remainingParameters = omit2(parameters, omittedParameters); + const remainingParameters = omit4(parameters, omittedParameters); const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); if (!isBinaryRequest) { if (options.mediaType.format) { @@ -39079,7 +39079,7 @@ var require_dist_node3 = __commonJS({ } } if (["GET", "HEAD"].includes(method)) { - url = addQueryParameters2(url, remainingParameters); + url = addQueryParameters4(url, remainingParameters); } else { if ("data" in remainingParameters) { body = remainingParameters.data; @@ -39101,20 +39101,20 @@ var require_dist_node3 = __commonJS({ options.request ? { request: options.request } : null ); } - function endpointWithDefaults2(defaults, route, options) { - return parse2(merge2(defaults, route, options)); + function endpointWithDefaults4(defaults, route, options) { + return parse4(merge4(defaults, route, options)); } - function withDefaults4(oldDefaults, newDefaults) { - const DEFAULTS22 = merge2(oldDefaults, newDefaults); - const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + function withDefaults8(oldDefaults, newDefaults) { + const DEFAULTS22 = merge4(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults4.bind(null, DEFAULTS22); return Object.assign(endpoint22, { DEFAULTS: DEFAULTS22, - defaults: withDefaults4.bind(null, DEFAULTS22), - merge: merge2.bind(null, DEFAULTS22), - parse: parse2 + defaults: withDefaults8.bind(null, DEFAULTS22), + merge: merge4.bind(null, DEFAULTS22), + parse: parse4 }); } - var endpoint2 = withDefaults4(null, DEFAULTS2); + var endpoint4 = withDefaults8(null, DEFAULTS4); } }); @@ -39241,14 +39241,14 @@ var require_dist_node5 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - RequestError: () => RequestError2 + RequestError: () => RequestError4 }); module.exports = __toCommonJS(dist_src_exports); var import_deprecation = require_dist_node4(); var import_once = __toESM2(require_once()); var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation)); var logOnceHeaders = (0, import_once.default)((deprecation) => console.warn(deprecation)); - var RequestError2 = class extends Error { + var RequestError4 = class extends Error { constructor(message, statusCode, options) { super(message); if (Error.captureStackTrace) { @@ -39323,13 +39323,13 @@ var require_dist_node6 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - request: () => request2 + request: () => request4 }); module.exports = __toCommonJS(dist_src_exports); - var import_endpoint2 = require_dist_node3(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "8.4.0"; - function isPlainObject3(value) { + var import_endpoint4 = require_dist_node3(); + var import_universal_user_agent13 = require_dist_node(); + var VERSION17 = "8.4.0"; + function isPlainObject7(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -39340,15 +39340,15 @@ var require_dist_node6 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - var import_request_error4 = require_dist_node5(); + var import_request_error7 = require_dist_node5(); function getBufferResponse(response) { return response.arrayBuffer(); } - function fetchWrapper2(requestOptions) { + function fetchWrapper4(requestOptions) { var _a, _b, _c, _d; const log2 = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console; const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false; - if (isPlainObject3(requestOptions.body) || Array.isArray(requestOptions.body)) { + if (isPlainObject7(requestOptions.body) || Array.isArray(requestOptions.body)) { requestOptions.body = JSON.stringify(requestOptions.body); } let headers = {}; @@ -39390,7 +39390,7 @@ var require_dist_node6 = __commonJS({ if (status < 400) { return; } - throw new import_request_error4.RequestError(response.statusText, status, { + throw new import_request_error7.RequestError(response.statusText, status, { response: { url, status, @@ -39401,19 +39401,19 @@ var require_dist_node6 = __commonJS({ }); } if (status === 304) { - throw new import_request_error4.RequestError("Not modified", status, { + throw new import_request_error7.RequestError("Not modified", status, { response: { url, status, headers, - data: await getResponseData2(response) + data: await getResponseData4(response) }, request: requestOptions }); } if (status >= 400) { - const data = await getResponseData2(response); - const error = new import_request_error4.RequestError(toErrorMessage2(data), status, { + const data = await getResponseData4(response); + const error = new import_request_error7.RequestError(toErrorMessage4(data), status, { response: { url, status, @@ -39424,7 +39424,7 @@ var require_dist_node6 = __commonJS({ }); throw error; } - return parseSuccessResponseBody ? await getResponseData2(response) : response.body; + return parseSuccessResponseBody ? await getResponseData4(response) : response.body; }).then((data) => { return { status, @@ -39433,7 +39433,7 @@ var require_dist_node6 = __commonJS({ data }; }).catch((error) => { - if (error instanceof import_request_error4.RequestError) + if (error instanceof import_request_error7.RequestError) throw error; else if (error.name === "AbortError") throw error; @@ -39445,12 +39445,12 @@ var require_dist_node6 = __commonJS({ message = error.cause; } } - throw new import_request_error4.RequestError(message, 500, { + throw new import_request_error7.RequestError(message, 500, { request: requestOptions }); }); } - async function getResponseData2(response) { + async function getResponseData4(response) { const contentType = response.headers.get("content-type"); if (/application\/json/.test(contentType)) { return response.json().catch(() => response.text()).catch(() => ""); @@ -39460,7 +39460,7 @@ var require_dist_node6 = __commonJS({ } return getBufferResponse(response); } - function toErrorMessage2(data) { + function toErrorMessage4(data) { if (typeof data === "string") return data; let suffix; @@ -39477,32 +39477,32 @@ var require_dist_node6 = __commonJS({ } return `Unknown error: ${JSON.stringify(data)}`; } - function withDefaults4(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + function withDefaults8(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper2(endpoint2.parse(endpointOptions)); + return fetchWrapper4(endpoint22.parse(endpointOptions)); } const request22 = (route2, parameters2) => { - return fetchWrapper2( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + return fetchWrapper4( + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; Object.assign(request22, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); } - var request2 = withDefaults4(import_endpoint2.endpoint, { + var request4 = withDefaults8(import_endpoint4.endpoint, { headers: { - "user-agent": `octokit-request.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-request.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}` } }); } @@ -39537,8 +39537,8 @@ var require_dist_node7 = __commonJS({ }); module.exports = __toCommonJS(dist_src_exports); var import_request32 = require_dist_node6(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "7.1.0"; + var import_universal_user_agent13 = require_dist_node(); + var VERSION17 = "7.1.0"; var import_request22 = require_dist_node6(); var import_request15 = require_dist_node6(); function _buildMessageForResponseErrors2(data) { @@ -39546,9 +39546,9 @@ var require_dist_node7 = __commonJS({ ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError2 = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors2(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.name = "GraphqlResponseError"; @@ -39570,7 +39570,7 @@ var require_dist_node7 = __commonJS({ ]; var FORBIDDEN_VARIABLE_OPTIONS2 = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX2 = /\/api\/v3\/?$/; - function graphql3(request2, query, options) { + function graphql3(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -39601,11 +39601,11 @@ var require_dist_node7 = __commonJS({ result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX2.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX2, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -39620,25 +39620,25 @@ var require_dist_node7 = __commonJS({ return response.data.data; }); } - function withDefaults4(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); + function withDefaults8(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql3(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults4.bind(null, newRequest), + defaults: withDefaults8.bind(null, newRequest), endpoint: newRequest.endpoint }); } - var graphql22 = withDefaults4(import_request32.request, { + var graphql22 = withDefaults8(import_request32.request, { headers: { - "user-agent": `octokit-graphql.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-graphql.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}` }, method: "POST", url: "/graphql" }); function withCustomRequest2(customRequest) { - return withDefaults4(customRequest, { + return withDefaults8(customRequest, { method: "POST", url: "/graphql" }); @@ -39692,13 +39692,13 @@ var require_dist_node8 = __commonJS({ } return `token ${token}`; } - async function hook6(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( + async function hook6(token, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix2(token); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix2(token); + return request4(endpoint4); } var createTokenAuth3 = function createTokenAuth22(token) { if (!token) { @@ -39743,17 +39743,17 @@ var require_dist_node9 = __commonJS({ Octokit: () => Octokit3 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node(); + var import_universal_user_agent13 = require_dist_node(); var import_before_after_hook2 = require_before_after_hook(); var import_request15 = require_dist_node6(); var import_graphql2 = require_dist_node7(); var import_auth_token2 = require_dist_node8(); - var VERSION13 = "5.2.0"; + var VERSION17 = "5.2.0"; var noop2 = () => { }; var consoleWarn2 = console.warn.bind(console); var consoleError2 = console.error.bind(console); - var userAgentTrail2 = `octokit-core.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; + var userAgentTrail2 = `octokit-core.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}`; var _a; var Octokit3 = (_a = class { static defaults(defaults) { @@ -39856,7 +39856,7 @@ var require_dist_node9 = __commonJS({ } } }, (() => { - _a.VERSION = VERSION13; + _a.VERSION = VERSION17; })(), (() => { _a.plugins = []; })(), _a); @@ -39890,7 +39890,7 @@ var require_dist_node10 = __commonJS({ restEndpointMethods: () => restEndpointMethods2 }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "10.4.1"; + var VERSION17 = "10.4.1"; var Endpoints2 = { actions: { addCustomLabelsToSelfHostedRunnerForOrg: [ @@ -41882,8 +41882,8 @@ var require_dist_node10 = __commonJS({ var endpoints_default2 = Endpoints2; var endpointMethodsMap2 = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default2)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -42006,7 +42006,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - restEndpointMethods2.VERSION = VERSION13; + restEndpointMethods2.VERSION = VERSION17; function legacyRestEndpointMethods2(octokit) { const api = endpointsToMethods2(octokit); return { @@ -42014,7 +42014,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - legacyRestEndpointMethods2.VERSION = VERSION13; + legacyRestEndpointMethods2.VERSION = VERSION17; } }); @@ -42047,7 +42047,7 @@ var require_dist_node11 = __commonJS({ paginatingEndpoints: () => paginatingEndpoints }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "9.2.1"; + var VERSION17 = "9.2.1"; function normalizePaginatedListResponse2(response) { if (!response.data) { return { @@ -42393,7 +42393,7 @@ var require_dist_node11 = __commonJS({ }) }; } - paginateRest2.VERSION = VERSION13; + paginateRest2.VERSION = VERSION17; } }); @@ -42524,7 +42524,7 @@ var require_fast_content_type_parse = __commonJS({ var defaultContentType = { type: "", parameters: new NullObject() }; Object.freeze(defaultContentType.parameters); Object.freeze(defaultContentType); - function parse2(header) { + function parse4(header) { if (typeof header !== "string") { throw new TypeError("argument header is required and must be a string"); } @@ -42562,7 +42562,7 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - function safeParse2(header) { + function safeParse4(header) { if (typeof header !== "string") { return defaultContentType; } @@ -42600,9 +42600,9 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - module.exports.default = { parse: parse2, safeParse: safeParse2 }; - module.exports.parse = parse2; - module.exports.safeParse = safeParse2; + module.exports.default = { parse: parse4, safeParse: safeParse4 }; + module.exports.parse = parse4; + module.exports.safeParse = safeParse4; module.exports.defaultContentType = defaultContentType; } }); @@ -42822,9 +42822,9 @@ function addQueryParameters(url, parameters) { return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } -var urlVariableRegex = /\{[^}]+\}/g; +var urlVariableRegex = /\{[^{}}]+\}/g; function removeNonChars(variableName) { - return variableName.replace(/^\W+|\W+$/g, "").split(/,/); + return variableName.replace(/(?:^\W+)|(?:(? { const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; return `application/vnd.github.${preview}-preview${format}`; @@ -43040,12 +43040,12 @@ function endpointWithDefaults(defaults, route, options) { return parse(merge(defaults, route, options)); } function withDefaults(oldDefaults, newDefaults) { - const DEFAULTS2 = merge(oldDefaults, newDefaults); - const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2); - return Object.assign(endpoint2, { - DEFAULTS: DEFAULTS2, - defaults: withDefaults.bind(null, DEFAULTS2), - merge: merge.bind(null, DEFAULTS2), + const DEFAULTS22 = merge(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults.bind(null, DEFAULTS22), + merge: merge.bind(null, DEFAULTS22), parse }); } @@ -43074,7 +43074,7 @@ var RequestError = class extends Error { if (options.request.headers.authorization) { requestCopy.headers = Object.assign({}, options.request.headers, { authorization: options.request.headers.authorization.replace( - / .*$/, + /(?]+)>; rel="deprecation"/); + const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/); const deprecationLink = matches && matches.pop(); log2.warn( `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` @@ -43237,40 +43237,570 @@ function toErrorMessage(data) { return `Unknown error: ${JSON.stringify(data)}`; } function withDefaults2(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper(endpoint2.parse(endpointOptions)); + return fetchWrapper(endpoint22.parse(endpointOptions)); } - const request2 = (route2, parameters2) => { + const request22 = (route2, parameters2) => { return fetchWrapper( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; - Object.assign(request2, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); - return endpointOptions.request.hook(request2, endpointOptions); + return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); } var request = withDefaults2(endpoint, defaults_default); // var VERSION3 = "0.0.0-development"; +var userAgent2 = `octokit-endpoint.js/${VERSION3} ${getUserAgent()}`; +var DEFAULTS2 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent2 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys2(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject3(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep2(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject3(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep2(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties2(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge2(defaults, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys2(options.headers); + removeUndefinedProperties2(options); + removeUndefinedProperties2(options.headers); + const mergedOptions = mergeDeep2(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters2(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex2 = /\{[^}]+\}/g; +function removeNonChars2(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames2(url) { + const matches = url.match(urlVariableRegex2); + if (!matches) { + return []; + } + return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); +} +function omit2(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved2(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved2(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue2(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + if (key) { + return encodeUnreserved2(key) + "=" + value; + } else { + return value; + } +} +function isDefined2(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator2(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues2(context3, operator, key, modifier) { + var value = context3[key], result = []; + if (isDefined2(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + result.push( + encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + result.push(encodeValue2(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + tmp.push(encodeValue2(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + tmp.push(encodeUnreserved2(k)); + tmp.push(encodeValue2(operator, value[k].toString())); + } + }); + } + if (isKeyOperator2(operator)) { + result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined2(value)) { + result.push(encodeUnreserved2(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved2(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl2(template) { + return { + expand: expand2.bind(null, template) + }; +} +function expand2(template, context3) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues2(context3, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved2(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse2(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit2(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames2(url); + url = parseUrl2(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit2(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters2(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults2(defaults, route, options) { + return parse2(merge2(defaults, route, options)); +} +function withDefaults3(oldDefaults, newDefaults) { + const DEFAULTS22 = merge2(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults3.bind(null, DEFAULTS22), + merge: merge2.bind(null, DEFAULTS22), + parse: parse2 + }); +} +var endpoint2 = withDefaults3(null, DEFAULTS2); + +// +var import_fast_content_type_parse2 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError2 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION4 = "0.0.0-development"; +var defaults_default2 = { + headers: { + "user-agent": `octokit-request.js/${VERSION4} ${getUserAgent()}` + } +}; +function isPlainObject4(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper2(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch2 = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log2 = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject4(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error) { + let message = "Unknown Error"; + if (error instanceof Error) { + if (error.name === "AbortError") { + error.status = 500; + throw error; + } + message = error.message; + if (error.name === "TypeError" && "cause" in error) { + if (error.cause instanceof Error) { + message = error.cause.message; + } else if (typeof error.cause === "string") { + message = error.cause; + } + } + } + const requestError = new RequestError2(message, 500, { + request: requestOptions + }); + requestError.cause = error; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log2.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError2(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2(toErrorMessage2(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData2(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData2(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse2.safeParse)(contentType); + if (isJSONResponse2(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse2(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage2(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults4(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper2(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper2( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); +} +var request2 = withDefaults4(endpoint2, defaults_default2); + +// +var VERSION5 = "0.0.0-development"; function _buildMessageForResponseErrors(data) { return `Request failed due to following response errors: ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.errors = response.errors; @@ -43295,7 +43825,7 @@ var NON_VARIABLE_OPTIONS = [ ]; var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; -function graphql(request2, query, options) { +function graphql(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -43326,11 +43856,11 @@ function graphql(request2, query, options) { result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -43345,25 +43875,25 @@ function graphql(request2, query, options) { return response.data.data; }); } -function withDefaults3(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); +function withDefaults5(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults3.bind(null, newRequest), + defaults: withDefaults5.bind(null, newRequest), endpoint: newRequest.endpoint }); } -var graphql2 = withDefaults3(request, { +var graphql2 = withDefaults5(request2, { headers: { - "user-agent": `octokit-graphql.js/${VERSION3} ${getUserAgent()}` + "user-agent": `octokit-graphql.js/${VERSION5} ${getUserAgent()}` }, method: "POST", url: "/graphql" }); function withCustomRequest(customRequest) { - return withDefaults3(customRequest, { + return withDefaults5(customRequest, { method: "POST", url: "/graphql" }); @@ -43391,13 +43921,13 @@ function withAuthorizationPrefix(token) { } return `token ${token}`; } -async function hook(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( +async function hook(token, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix(token); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix(token); + return request4(endpoint4); } var createTokenAuth = function createTokenAuth2(token) { if (!token) { @@ -43415,14 +43945,14 @@ var createTokenAuth = function createTokenAuth2(token) { }; // -var VERSION4 = "6.1.3"; +var VERSION6 = "6.1.4"; // var noop = () => { }; var consoleWarn = console.warn.bind(console); var consoleError = console.error.bind(console); -var userAgentTrail = `octokit-core.js/${VERSION4} ${getUserAgent()}`; +var userAgentTrail = `octokit-core.js/${VERSION6} ${getUserAgent()}`; var Octokit = class { static defaults(defaults) { const OctokitWithDefaults = class extends this { @@ -43527,20 +44057,20 @@ var Octokit = class { hook; auth; }; -__publicField(Octokit, "VERSION", VERSION4); +__publicField(Octokit, "VERSION", VERSION6); __publicField(Octokit, "plugins", []); // -var VERSION5 = "5.3.1"; +var VERSION7 = "5.3.1"; // function requestLog(octokit) { - octokit.hook.wrap("request", (request2, options) => { + octokit.hook.wrap("request", (request4, options) => { octokit.log.debug("request", options); const start = Date.now(); const requestOptions = octokit.request.endpoint.parse(options); const path = requestOptions.url.replace(options.baseUrl, ""); - return request2(options).then((response) => { + return request4(options).then((response) => { const requestId = response.headers["x-github-request-id"]; octokit.log.info( `${requestOptions.method} ${path} - ${response.status} with id ${requestId} in ${Date.now() - start}ms` @@ -43556,10 +44086,10 @@ function requestLog(octokit) { }); }); } -requestLog.VERSION = VERSION5; +requestLog.VERSION = VERSION7; // -var VERSION6 = "0.0.0-development"; +var VERSION8 = "0.0.0-development"; function normalizePaginatedListResponse(response) { if (!response.data) { return { @@ -43603,7 +44133,7 @@ function iterator(octokit, route, parameters) { const response = await requestMethod({ method, url, headers }); const normalizedResponse = normalizePaginatedListResponse(response); url = ((normalizedResponse.headers.link || "").match( - /<([^>]+)>;\s*rel="next"/ + /<([^<>]+)>;\s*rel="next"/ ) || [])[1]; return { value: normalizedResponse }; } catch (error) { @@ -43662,10 +44192,10 @@ function paginateRest(octokit) { }) }; } -paginateRest.VERSION = VERSION6; +paginateRest.VERSION = VERSION8; // -var VERSION7 = "13.3.1"; +var VERSION9 = "13.3.1"; // var Endpoints = { @@ -45738,8 +46268,8 @@ var endpoints_default = Endpoints; // var endpointMethodsMap = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -45864,7 +46394,7 @@ function restEndpointMethods(octokit) { rest: api }; } -restEndpointMethods.VERSION = VERSION7; +restEndpointMethods.VERSION = VERSION9; function legacyRestEndpointMethods(octokit) { const api = endpointsToMethods(octokit); return { @@ -45872,38 +46402,38 @@ function legacyRestEndpointMethods(octokit) { rest: api }; } -legacyRestEndpointMethods.VERSION = VERSION7; +legacyRestEndpointMethods.VERSION = VERSION9; // -var VERSION8 = "21.1.0"; +var VERSION10 = "21.1.1"; // var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRest).defaults( { - userAgent: `octokit-rest.js/${VERSION8}` + userAgent: `octokit-rest.js/${VERSION10}` } ); // -function requestToOAuthBaseUrl(request2) { - const endpointDefaults = request2.endpoint.DEFAULTS; +function requestToOAuthBaseUrl(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); } -async function oauthRequest(request2, route, parameters) { +async function oauthRequest(request4, route, parameters) { const withOAuthParameters = { - baseUrl: requestToOAuthBaseUrl(request2), + baseUrl: requestToOAuthBaseUrl(request4), headers: { accept: "application/json" }, ...parameters }; - const response = await request2(route, withOAuthParameters); + const response = await request4(route, withOAuthParameters); if ("error" in response.data) { const error = new RequestError( `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, 400, { - request: request2.endpoint.merge( + request: request4.endpoint.merge( route, withOAuthParameters ) @@ -45914,32 +46444,43 @@ async function oauthRequest(request2, route, parameters) { } return response; } -async function exchangeWebFlowCode(options) { - const request2 = options.request || request; +async function createDeviceCode(options) { + const request4 = options.request || request; + const parameters = { + client_id: options.clientId + }; + if ("scopes" in options && Array.isArray(options.scopes)) { + parameters.scope = options.scopes.join(" "); + } + return oauthRequest(request4, "POST /login/device/code", parameters); +} +async function exchangeDeviceCode(options) { + const request4 = options.request || request; const response = await oauthRequest( - request2, + request4, "POST /login/oauth/access_token", { client_id: options.clientId, - client_secret: options.clientSecret, - code: options.code, - redirect_uri: options.redirectUrl + device_code: options.code, + grant_type: "urn:ietf:params:oauth:grant-type:device_code" } ); const authentication = { clientType: options.clientType, clientId: options.clientId, - clientSecret: options.clientSecret, token: response.data.access_token, scopes: response.data.scope.split(/\s+/).filter(Boolean) }; + if ("clientSecret" in options) { + authentication.clientSecret = options.clientSecret; + } if (options.clientType === "github-app") { if ("refresh_token" in response.data) { const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp( + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( apiTimeInMs, response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp( + ), authentication.refreshTokenExpiresAt = toTimestamp2( apiTimeInMs, response.data.refresh_token_expires_in ); @@ -45948,46 +46489,722 @@ async function exchangeWebFlowCode(options) { } return { ...response, authentication }; } -function toTimestamp(apiTimeInMs, expirationInSeconds) { +function toTimestamp2(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } -async function createDeviceCode(options) { - const request2 = options.request || request; - const parameters = { - client_id: options.clientId + +// +async function getOAuthAccessToken(state, options) { + const cachedAuthentication = getCachedAuthentication(state, options.auth); + if (cachedAuthentication) + return cachedAuthentication; + const { data: verification } = await createDeviceCode({ + clientType: state.clientType, + clientId: state.clientId, + request: options.request || state.request, + scopes: options.auth.scopes || state.scopes + }); + await state.onVerification(verification); + const authentication = await waitForAccessToken( + options.request || state.request, + state.clientId, + state.clientType, + verification + ); + state.authentication = authentication; + return authentication; +} +function getCachedAuthentication(state, auth22) { + if (auth22.refresh === true) + return false; + if (!state.authentication) + return false; + if (state.clientType === "github-app") { + return state.authentication; + } + const authentication = state.authentication; + const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( + " " + ); + const currentScope = authentication.scopes.join(" "); + return newScope === currentScope ? authentication : false; +} +async function wait(seconds) { + await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); +} +async function waitForAccessToken(request4, clientId, clientType, verification) { + try { + const options = { + clientId, + request: request4, + code: verification.device_code + }; + const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ + ...options, + clientType: "oauth-app" + }) : await exchangeDeviceCode({ + ...options, + clientType: "github-app" + }); + return { + type: "token", + tokenType: "oauth", + ...authentication + }; + } catch (error) { + if (!error.response) + throw error; + const errorType = error.response.data.error; + if (errorType === "authorization_pending") { + await wait(verification.interval); + return waitForAccessToken(request4, clientId, clientType, verification); + } + if (errorType === "slow_down") { + await wait(verification.interval + 5); + return waitForAccessToken(request4, clientId, clientType, verification); + } + throw error; + } +} +async function auth2(state, authOptions) { + return getOAuthAccessToken(state, { + auth: authOptions + }); +} +async function hook2(state, request4, route, parameters) { + let endpoint4 = request4.endpoint.merge( + route, + parameters + ); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); + } + const { token } = await getOAuthAccessToken(state, { + request: request4, + auth: { type: "oauth" } + }); + endpoint4.headers.authorization = `token ${token}`; + return request4(endpoint4); +} +var VERSION11 = "0.0.0-development"; +function createOAuthDeviceAuth(options) { + const requestWithDefaults = options.request || request.defaults({ + headers: { + "user-agent": `octokit-auth-oauth-device.js/${VERSION11} ${getUserAgent()}` + } + }); + const { request: request4 = requestWithDefaults, ...otherOptions } = options; + const state = options.clientType === "github-app" ? { + ...otherOptions, + clientType: "github-app", + request: request4 + } : { + ...otherOptions, + clientType: "oauth-app", + request: request4, + scopes: options.scopes || [] }; - if ("scopes" in options && Array.isArray(options.scopes)) { - parameters.scope = options.scopes.join(" "); + if (!options.clientId) { + throw new Error( + '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' + ); + } + if (!options.onVerification) { + throw new Error( + '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' + ); } - return oauthRequest(request2, "POST /login/device/code", parameters); + return Object.assign(auth2.bind(null, state), { + hook: hook2.bind(null, state) + }); } -async function exchangeDeviceCode(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + +// +var VERSION12 = "0.0.0-development"; +var userAgent3 = `octokit-endpoint.js/${VERSION12} ${getUserAgent()}`; +var DEFAULTS3 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent3 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys3(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject5(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep3(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject5(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep3(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties3(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge3(defaults, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys3(options.headers); + removeUndefinedProperties3(options); + removeUndefinedProperties3(options.headers); + const mergedOptions = mergeDeep3(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters3(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex3 = /\{[^}]+\}/g; +function removeNonChars3(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames3(url) { + const matches = url.match(urlVariableRegex3); + if (!matches) { + return []; + } + return matches.map(removeNonChars3).reduce((a, b) => a.concat(b), []); +} +function omit3(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved3(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved3(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue3(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved3(value) : encodeUnreserved3(value); + if (key) { + return encodeUnreserved3(key) + "=" + value; + } else { + return value; + } +} +function isDefined3(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator3(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues3(context3, operator, key, modifier) { + var value = context3[key], result = []; + if (isDefined3(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue3(operator, value, isKeyOperator3(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + result.push( + encodeValue3(operator, value2, isKeyOperator3(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + result.push(encodeValue3(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + tmp.push(encodeValue3(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + tmp.push(encodeUnreserved3(k)); + tmp.push(encodeValue3(operator, value[k].toString())); + } + }); + } + if (isKeyOperator3(operator)) { + result.push(encodeUnreserved3(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined3(value)) { + result.push(encodeUnreserved3(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved3(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl3(template) { + return { + expand: expand3.bind(null, template) + }; +} +function expand3(template, context3) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues3(context3, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved3(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse3(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit3(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames3(url); + url = parseUrl3(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit3(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters3(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults3(defaults, route, options) { + return parse3(merge3(defaults, route, options)); +} +function withDefaults6(oldDefaults, newDefaults) { + const DEFAULTS22 = merge3(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults3.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults6.bind(null, DEFAULTS22), + merge: merge3.bind(null, DEFAULTS22), + parse: parse3 + }); +} +var endpoint3 = withDefaults6(null, DEFAULTS3); + +// +var import_fast_content_type_parse3 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError3 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION13 = "0.0.0-development"; +var defaults_default3 = { + headers: { + "user-agent": `octokit-request.js/${VERSION13} ${getUserAgent()}` + } +}; +function isPlainObject6(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper3(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch2 = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log2 = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject6(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error) { + let message = "Unknown Error"; + if (error instanceof Error) { + if (error.name === "AbortError") { + error.status = 500; + throw error; + } + message = error.message; + if (error.name === "TypeError" && "cause" in error) { + if (error.cause instanceof Error) { + message = error.cause.message; + } else if (typeof error.cause === "string") { + message = error.cause; + } + } + } + const requestError = new RequestError3(message, 500, { + request: requestOptions + }); + requestError.cause = error; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log2.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError3(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3(toErrorMessage3(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData3(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData3(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse3.safeParse)(contentType); + if (isJSONResponse3(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse3(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage3(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults7(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper3(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper3( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults7.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults7.bind(null, endpoint22) + }); +} +var request3 = withDefaults7(endpoint3, defaults_default3); + +// +function requestToOAuthBaseUrl2(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; + return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); +} +async function oauthRequest2(request4, route, parameters) { + const withOAuthParameters = { + baseUrl: requestToOAuthBaseUrl2(request4), + headers: { + accept: "application/json" + }, + ...parameters + }; + const response = await request4(route, withOAuthParameters); + if ("error" in response.data) { + const error = new RequestError3( + `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, + 400, + { + request: request4.endpoint.merge( + route, + withOAuthParameters + ) + } + ); + error.response = response; + throw error; + } + return response; +} +async function exchangeWebFlowCode(options) { + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, - device_code: options.code, - grant_type: "urn:ietf:params:oauth:grant-type:device_code" + client_secret: options.clientSecret, + code: options.code, + redirect_uri: options.redirectUrl } ); const authentication = { clientType: options.clientType, clientId: options.clientId, + clientSecret: options.clientSecret, token: response.data.access_token, scopes: response.data.scope.split(/\s+/).filter(Boolean) }; - if ("clientSecret" in options) { - authentication.clientSecret = options.clientSecret; - } if (options.clientType === "github-app") { if ("refresh_token" in response.data) { const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp( apiTimeInMs, response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp2( + ), authentication.refreshTokenExpiresAt = toTimestamp( apiTimeInMs, response.data.refresh_token_expires_in ); @@ -45996,12 +47213,12 @@ async function exchangeDeviceCode(options) { } return { ...response, authentication }; } -function toTimestamp2(apiTimeInMs, expirationInSeconds) { +function toTimestamp(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function checkToken(options) { - const request2 = options.request || request; - const response = await request2("POST /applications/{client_id}/token", { + const request4 = options.request || request3; + const response = await request4("POST /applications/{client_id}/token", { headers: { authorization: `basic ${btoa( `${options.clientId}:${options.clientSecret}` @@ -46025,9 +47242,9 @@ async function checkToken(options) { return { ...response, authentication }; } async function refreshToken(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, @@ -46055,9 +47272,9 @@ function toTimestamp3(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function resetToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - const response = await request2( + const response = await request4( "PATCH /applications/{client_id}/token", { headers: { @@ -46082,9 +47299,9 @@ async function resetToken(options) { return { ...response, authentication }; } async function deleteToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/token", { headers: { @@ -46096,9 +47313,9 @@ async function deleteToken(options) { ); } async function deleteAuthorization(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/grant", { headers: { @@ -46111,133 +47328,7 @@ async function deleteAuthorization(options) { } // -async function getOAuthAccessToken(state, options) { - const cachedAuthentication = getCachedAuthentication(state, options.auth); - if (cachedAuthentication) - return cachedAuthentication; - const { data: verification } = await createDeviceCode({ - clientType: state.clientType, - clientId: state.clientId, - request: options.request || state.request, - scopes: options.auth.scopes || state.scopes - }); - await state.onVerification(verification); - const authentication = await waitForAccessToken( - options.request || state.request, - state.clientId, - state.clientType, - verification - ); - state.authentication = authentication; - return authentication; -} -function getCachedAuthentication(state, auth22) { - if (auth22.refresh === true) - return false; - if (!state.authentication) - return false; - if (state.clientType === "github-app") { - return state.authentication; - } - const authentication = state.authentication; - const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( - " " - ); - const currentScope = authentication.scopes.join(" "); - return newScope === currentScope ? authentication : false; -} -async function wait(seconds) { - await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); -} -async function waitForAccessToken(request2, clientId, clientType, verification) { - try { - const options = { - clientId, - request: request2, - code: verification.device_code - }; - const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ - ...options, - clientType: "oauth-app" - }) : await exchangeDeviceCode({ - ...options, - clientType: "github-app" - }); - return { - type: "token", - tokenType: "oauth", - ...authentication - }; - } catch (error) { - if (!error.response) - throw error; - const errorType = error.response.data.error; - if (errorType === "authorization_pending") { - await wait(verification.interval); - return waitForAccessToken(request2, clientId, clientType, verification); - } - if (errorType === "slow_down") { - await wait(verification.interval + 5); - return waitForAccessToken(request2, clientId, clientType, verification); - } - throw error; - } -} -async function auth2(state, authOptions) { - return getOAuthAccessToken(state, { - auth: authOptions - }); -} -async function hook2(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( - route, - parameters - ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); - } - const { token } = await getOAuthAccessToken(state, { - request: request2, - auth: { type: "oauth" } - }); - endpoint2.headers.authorization = `token ${token}`; - return request2(endpoint2); -} -var VERSION9 = "0.0.0-development"; -function createOAuthDeviceAuth(options) { - const requestWithDefaults = options.request || request.defaults({ - headers: { - "user-agent": `octokit-auth-oauth-device.js/${VERSION9} ${getUserAgent()}` - } - }); - const { request: request2 = requestWithDefaults, ...otherOptions } = options; - const state = options.clientType === "github-app" ? { - ...otherOptions, - clientType: "github-app", - request: request2 - } : { - ...otherOptions, - clientType: "oauth-app", - request: request2, - scopes: options.scopes || [] - }; - if (!options.clientId) { - throw new Error( - '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - if (!options.onVerification) { - throw new Error( - '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - return Object.assign(auth2.bind(null, state), { - hook: hook2.bind(null, state) - }); -} - -// -var VERSION10 = "0.0.0-development"; +var VERSION14 = "0.0.0-development"; async function getAuthentication(state) { if ("code" in state.strategyOptions) { const { authentication } = await exchangeWebFlowCode({ @@ -46373,30 +47464,30 @@ var ROUTES_REQUIRING_BASIC_AUTH = /\/applications\/[^/]+\/(token|grant)s?/; function requiresBasicAuth(url) { return url && ROUTES_REQUIRING_BASIC_AUTH.test(url); } -async function hook3(state, request2, route, parameters = {}) { - const endpoint2 = request2.endpoint.merge( +async function hook3(state, request4, route, parameters = {}) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); } - if (requiresBasicAuth(endpoint2.url)) { + if (requiresBasicAuth(endpoint4.url)) { const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; - return request2(endpoint2); + endpoint4.headers.authorization = `basic ${credentials}`; + return request4(endpoint4); } - const { token } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request2 }) : await auth3({ ...state, request: request2 }); - endpoint2.headers.authorization = "token " + token; - return request2(endpoint2); + const { token } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request4 }) : await auth3({ ...state, request: request4 }); + endpoint4.headers.authorization = "token " + token; + return request4(endpoint4); } function createOAuthUserAuth({ clientId, clientSecret, clientType = "oauth-app", - request: request2 = request.defaults({ + request: request4 = request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION10} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION14} ${getUserAgent()}` } }), onTokenCreated, @@ -46408,13 +47499,13 @@ function createOAuthUserAuth({ clientSecret, onTokenCreated, strategyOptions, - request: request2 + request: request4 }); return Object.assign(auth3.bind(null, state), { hook: hook3.bind(null, state) }); } -createOAuthUserAuth.VERSION = VERSION10; +createOAuthUserAuth.VERSION = VERSION14; // async function auth4(state, authOptions) { @@ -46453,37 +47544,37 @@ async function auth4(state, authOptions) { }); return userAuth(); } -async function hook4(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( +async function hook4(state, request22, route, parameters) { + let endpoint4 = request22.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request22(endpoint4); } - if (state.clientType === "github-app" && !requiresBasicAuth(endpoint2.url)) { + if (state.clientType === "github-app" && !requiresBasicAuth(endpoint4.url)) { throw new Error( - `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint2.method} ${endpoint2.url}" is not supported.` + `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint4.method} ${endpoint4.url}" is not supported.` ); } const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; + endpoint4.headers.authorization = `basic ${credentials}`; try { - return await request2(endpoint2); + return await request22(endpoint4); } catch (error) { if (error.status !== 401) throw error; - error.message = `[@octokit/auth-oauth-app] "${endpoint2.method} ${endpoint2.url}" does not support clientId/clientSecret basic authentication.`; + error.message = `[@octokit/auth-oauth-app] "${endpoint4.method} ${endpoint4.url}" does not support clientId/clientSecret basic authentication.`; throw error; } } -var VERSION11 = "0.0.0-development"; +var VERSION15 = "0.0.0-development"; function createOAuthAppAuth(options) { const state = Object.assign( { request: request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION11} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION15} ${getUserAgent()}` } }), clientType: "oauth-app" @@ -46927,7 +48018,7 @@ async function getInstallationAuthentication(state, options, customRequest) { } } const appAuthentication = await getAppAuthentication(state); - const request2 = customRequest || state.request; + const request4 = customRequest || state.request; const payload = { installation_id: installationId, mediaType: { @@ -46957,7 +48048,7 @@ async function getInstallationAuthentication(state, options, customRequest) { repository_selection: repositorySelectionOptional, single_file: singleFileName } - } = await request2( + } = await request4( "POST /app/installations/{installation_id}/access_tokens", payload ); @@ -47054,18 +48145,18 @@ function isNotTimeSkewError(error) { /'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/ )); } -async function hook5(state, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge(route, parameters); - const url = endpoint2.url; +async function hook5(state, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge(route, parameters); + const url = endpoint4.url; if (/\/login\/oauth\/access_token$/.test(url)) { - return request2(endpoint2); + return request4(endpoint4); } - if (requiresAppAuth(url.replace(request2.endpoint.DEFAULTS.baseUrl, ""))) { + if (requiresAppAuth(url.replace(request4.endpoint.DEFAULTS.baseUrl, ""))) { const { token: token2 } = await getAppAuthentication(state); - endpoint2.headers.authorization = `bearer ${token2}`; + endpoint4.headers.authorization = `bearer ${token2}`; let response; try { - response = await request2(endpoint2); + response = await request4(endpoint4); } catch (error) { if (isNotTimeSkewError(error)) { throw error; @@ -47084,33 +48175,33 @@ async function hook5(state, request2, route, parameters) { ...state, timeDifference: diff }); - endpoint2.headers.authorization = `bearer ${token3}`; - return request2(endpoint2); + endpoint4.headers.authorization = `bearer ${token3}`; + return request4(endpoint4); } return response; } if (requiresBasicAuth(url)) { const authentication = await state.oauthApp({ type: "oauth-app" }); - endpoint2.headers.authorization = authentication.headers.authorization; - return request2(endpoint2); + endpoint4.headers.authorization = authentication.headers.authorization; + return request4(endpoint4); } const { token, createdAt } = await getInstallationAuthentication( state, {}, - request2.defaults({ baseUrl: endpoint2.baseUrl }) + request4.defaults({ baseUrl: endpoint4.baseUrl }) ); - endpoint2.headers.authorization = `token ${token}`; + endpoint4.headers.authorization = `token ${token}`; return sendRequestWithRetries( state, - request2, - endpoint2, + request4, + endpoint4, createdAt ); } -async function sendRequestWithRetries(state, request2, options, createdAt, retries = 0) { +async function sendRequestWithRetries(state, request4, options, createdAt, retries = 0) { const timeSinceTokenCreationInMs = +/* @__PURE__ */ new Date() - +new Date(createdAt); try { - return await request2(options); + return await request4(options); } catch (error) { if (error.status !== 401) { throw error; @@ -47127,10 +48218,10 @@ async function sendRequestWithRetries(state, request2, options, createdAt, retri `[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${retries}, wait: ${awaitTime / 1e3}s)` ); await new Promise((resolve) => setTimeout(resolve, awaitTime)); - return sendRequestWithRetries(state, request2, options, createdAt, retries); + return sendRequestWithRetries(state, request4, options, createdAt, retries); } } -var VERSION12 = "7.1.4"; +var VERSION16 = "7.1.5"; function createAppAuth(options) { if (!options.appId) { throw new Error("[@octokit/auth-app] appId option is required"); @@ -47149,14 +48240,14 @@ function createAppAuth(options) { }, options.log ); - const request2 = options.request || request.defaults({ + const request4 = options.request || request.defaults({ headers: { - "user-agent": `octokit-auth-app.js/${VERSION12} ${getUserAgent()}` + "user-agent": `octokit-auth-app.js/${VERSION16} ${getUserAgent()}` } }); const state = Object.assign( { - request: request2, + request: request4, cache: getCache() }, options, @@ -47167,7 +48258,7 @@ function createAppAuth(options) { clientType: "github-app", clientId: options.clientId || "", clientSecret: options.clientSecret || "", - request: request2 + request: request4 }) } ); diff --git a/github-actions/google-internal-tests/main.js b/github-actions/google-internal-tests/main.js index 9a98e2e93..1f485119f 100644 --- a/github-actions/google-internal-tests/main.js +++ b/github-actions/google-internal-tests/main.js @@ -3698,11 +3698,11 @@ var require_util2 = __commonJS({ } return location; } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request3) { + return request3.urlList[request3.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request3) { + const url = requestCurrentURL(request3); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -3768,7 +3768,7 @@ var require_util2 = __commonJS({ } return true; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request3, actualResponse) { const { headersList } = actualResponse; const policyHeader = (headersList.get("referrer-policy") ?? "").split(","); let policy = ""; @@ -3782,7 +3782,7 @@ var require_util2 = __commonJS({ } } if (policy !== "") { - request2.referrerPolicy = policy; + request3.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -3799,33 +3799,33 @@ var require_util2 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; - if (request2.responseTainting === "cors" || request2.mode === "websocket") { + function appendRequestOriginHeader(request3) { + let serializedOrigin = request3.origin; + if (request3.responseTainting === "cors" || request3.mode === "websocket") { if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request3.headersList.append("origin", serializedOrigin); } - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + } else if (request3.method !== "GET" && request3.method !== "HEAD") { + switch (request3.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request3.origin && urlHasHttpsScheme(request3.origin) && !urlHasHttpsScheme(requestCurrentURL(request3))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request3, requestCurrentURL(request3))) { serializedOrigin = null; } break; default: } if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request3.headersList.append("origin", serializedOrigin); } } } @@ -3857,26 +3857,26 @@ var require_util2 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request3) { + const policy = request3.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request3.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (request2.referrer instanceof URL) { - referrerSource = request2.referrer; + } else if (request3.referrer instanceof URL) { + referrerSource = request3.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); if (referrerURL.toString().length > 4096) { referrerURL = referrerOrigin; } - const areSameOrigin = sameOrigin(request2, referrerURL); - const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request2.url); + const areSameOrigin = sameOrigin(request3, referrerURL); + const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request3.url); switch (policy) { case "origin": return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true); @@ -3887,7 +3887,7 @@ var require_util2 = __commonJS({ case "origin-when-cross-origin": return areSameOrigin ? referrerURL : referrerOrigin; case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -4036,7 +4036,7 @@ var require_util2 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request3) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -5922,25 +5922,25 @@ var require_request = __commonJS({ static [kHTTP2BuildRequest](origin, opts, handler2) { const headers = opts.headers; opts = { ...opts, headers: null }; - const request2 = new Request(origin, opts, handler2); - request2.headers = {}; + const request3 = new Request(origin, opts, handler2); + request3.headers = {}; if (Array.isArray(headers)) { if (headers.length % 2 !== 0) { throw new InvalidArgumentError("headers array must be even"); } for (let i = 0; i < headers.length; i += 2) { - processHeader(request2, headers[i], headers[i + 1], true); + processHeader(request3, headers[i], headers[i + 1], true); } } else if (headers && typeof headers === "object") { const keys = Object.keys(headers); for (let i = 0; i < keys.length; i++) { const key = keys[i]; - processHeader(request2, key, headers[key], true); + processHeader(request3, key, headers[key], true); } } else if (headers != null) { throw new InvalidArgumentError("headers must be an object or an array"); } - return request2; + return request3; } static [kHTTP2CopyHeaders](raw) { const rawHeaders = raw.split("\r\n"); @@ -5968,28 +5968,28 @@ var require_request = __commonJS({ return skipAppend ? val : `${key}: ${val}\r `; } - function processHeader(request2, key, val, skipAppend = false) { + function processHeader(request3, key, val, skipAppend = false) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { return; } - if (request2.host === null && key.length === 4 && key.toLowerCase() === "host") { + if (request3.host === null && key.length === 4 && key.toLowerCase() === "host") { if (headerCharRegex.exec(val) !== null) { throw new InvalidArgumentError(`invalid ${key} header`); } - request2.host = val; - } else if (request2.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request3.host = val; + } else if (request3.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { + request3.contentLength = parseInt(val, 10); + if (!Number.isFinite(request3.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { - request2.contentType = val; + } else if (request3.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { + request3.contentType = val; if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request3.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request3.headers += processHeaderValue(key, val); } else if (key.length === 17 && key.toLowerCase() === "transfer-encoding") { throw new InvalidArgumentError("invalid transfer-encoding header"); } else if (key.length === 10 && key.toLowerCase() === "connection") { @@ -5997,7 +5997,7 @@ var require_request = __commonJS({ if (value !== "close" && value !== "keep-alive") { throw new InvalidArgumentError("invalid connection header"); } else if (value === "close") { - request2.reset = true; + request3.reset = true; } } else if (key.length === 10 && key.toLowerCase() === "keep-alive") { throw new InvalidArgumentError("invalid keep-alive header"); @@ -6011,19 +6011,19 @@ var require_request = __commonJS({ if (Array.isArray(val)) { for (let i = 0; i < val.length; i++) { if (skipAppend) { - if (request2.headers[key]) - request2.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; + if (request3.headers[key]) + request3.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; else - request2.headers[key] = processHeaderValue(key, val[i], skipAppend); + request3.headers[key] = processHeaderValue(key, val[i], skipAppend); } else { - request2.headers += processHeaderValue(key, val[i]); + request3.headers += processHeaderValue(key, val[i]); } } } else { if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request3.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request3.headers += processHeaderValue(key, val); } } } @@ -7167,10 +7167,10 @@ var require_client = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); - this[kQueue].push(request2); + const request3 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); + this[kQueue].push(request3); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request3.body) == null && util.isIterable(request3.body)) { this[kResuming] = 1; process.nextTick(resume, this); } else { @@ -7194,8 +7194,8 @@ var require_client = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request3 = requests[i]; + errorRequest(this, request3, err); } const callback = () => { if (this[kClosedResolve]) { @@ -7243,13 +7243,13 @@ var require_client = __commonJS({ assert(this[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request3 = requests[i]; + errorRequest(this, request3, err); } } else if (client[kRunning] > 0) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request3 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request3, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7455,8 +7455,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request3 = client[kQueue][client[kRunningIdx]]; + if (!request3) { return -1; } } @@ -7496,12 +7496,12 @@ var require_client = __commonJS({ onUpgrade(head) { const { upgrade, client, socket, headers, statusCode } = this; assert(upgrade); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request3 = client[kQueue][client[kRunningIdx]]; + assert(request3); assert(!socket.destroyed); assert(socket === client[kSocket]); assert(!this.paused); - assert(request2.upgrade || request2.method === "CONNECT"); + assert(request3.upgrade || request3.method === "CONNECT"); this.statusCode = null; this.statusText = ""; this.shouldKeepAlive = null; @@ -7518,7 +7518,7 @@ var require_client = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request3.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -7529,8 +7529,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request3 = client[kQueue][client[kRunningIdx]]; + if (!request3) { return -1; } assert(!this.upgrade); @@ -7539,22 +7539,22 @@ var require_client = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request3.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert.strictEqual(this.timeoutType, TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request3.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request3.bodyTimeout != null ? request3.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request3.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -7585,11 +7585,11 @@ var require_client = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request3.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request3.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request3.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -7606,8 +7606,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request3 = client[kQueue][client[kRunningIdx]]; + assert(request3); assert.strictEqual(this.timeoutType, TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -7620,7 +7620,7 @@ var require_client = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request3.onData(buf) === false) { return constants.ERROR.PAUSED; } } @@ -7632,8 +7632,8 @@ var require_client = __commonJS({ if (upgrade) { return; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request3 = client[kQueue][client[kRunningIdx]]; + assert(request3); assert(statusCode >= 100); this.statusCode = null; this.statusText = ""; @@ -7647,11 +7647,11 @@ var require_client = __commonJS({ if (statusCode < 200) { return; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request3.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request3.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert.strictEqual(client[kRunning], 0); @@ -7709,8 +7709,8 @@ var require_client = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request3 = requests[i]; + errorRequest(client, request3, err); } assert(client[kSize] === 0); } @@ -7740,13 +7740,13 @@ var require_client = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request3 = requests[i]; + errorRequest(client, request3, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request3 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request3, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7879,8 +7879,8 @@ var require_client = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - errorRequest(client, request2, err); + const request3 = client[kQueue][client[kPendingIdx]++]; + errorRequest(client, request3, err); } } else { onError(client, err); @@ -7934,8 +7934,8 @@ var require_client = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request3 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request3.headersTimeout != null ? request3.headersTimeout : client[kHeadersTimeout]; + const request4 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request4.headersTimeout != null ? request4.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -7957,13 +7957,13 @@ var require_client = __commonJS({ if (client[kRunning] >= (client[kPipelining] || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request3 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request3.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; - if (socket && socket.servername !== request2.servername) { + client[kServerName] = request3.servername; + if (socket && socket.servername !== request3.servername) { util.destroy(socket, new InformationalError("servername changed")); return; } @@ -7978,16 +7978,16 @@ var require_client = __commonJS({ if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) { return; } - if (client[kRunning] > 0 && !request2.idempotent) { + if (client[kRunning] > 0 && !request3.idempotent) { return; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request3.upgrade || request3.method === "CONNECT")) { return; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request3.body) !== 0 && (util.isStream(request3.body) || util.isAsyncIterable(request3.body))) { return; } - if (!request2.aborted && write(client, request2)) { + if (!request3.aborted && write(client, request3)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -7997,12 +7997,12 @@ var require_client = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function write(client, request2) { + function write(client, request3) { if (client[kHTTPConnVersion] === "h2") { - writeH2(client, client[kHTTP2Session], request2); + writeH2(client, client[kHTTP2Session], request3); return; } - const { body, method, path: path3, host, upgrade, headers, blocking, reset } = request2; + const { body, method, path: path3, host, upgrade, headers, blocking, reset } = request3; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { body.read(0); @@ -8010,31 +8010,31 @@ var require_client = __commonJS({ const bodyLength = util.bodyLength(body); let contentLength = bodyLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request3.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request3.contentLength !== null && request3.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request3, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request3.onConnect((err) => { + if (request3.aborted || request3.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request3, err || new RequestAbortedError()); util.destroy(socket, new InformationalError("aborted")); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request3, err); } - if (request2.aborted) { + if (request3.aborted) { return false; } if (method === "HEAD") { @@ -8073,7 +8073,7 @@ upgrade: ${upgrade}\r header += headers; } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request3, headers: header, socket }); } if (!body || bodyLength === 0) { if (contentLength === 0) { @@ -8085,7 +8085,7 @@ upgrade: ${upgrade}\r socket.write(`${header}\r `, "latin1"); } - request2.onRequestSent(); + request3.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); socket.cork(); @@ -8094,48 +8094,48 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - request2.onRequestSent(); + request3.onBodySent(body); + request3.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable({ body: body.stream(), client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body: body.stream(), client, request: request3, socket, contentLength, header, expectsPayload }); } else { - writeBlob({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeBlob({ body, client, request: request3, socket, contentLength, header, expectsPayload }); } } else if (util.isStream(body)) { - writeStream({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeStream({ body, client, request: request3, socket, contentLength, header, expectsPayload }); } else if (util.isIterable(body)) { - writeIterable({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body, client, request: request3, socket, contentLength, header, expectsPayload }); } else { assert(false); } return true; } - function writeH2(client, session, request2) { - const { body, method, path: path3, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; + function writeH2(client, session, request3) { + const { body, method, path: path3, host, upgrade, expectContinue, signal, headers: reqHeaders } = request3; let headers; if (typeof reqHeaders === "string") headers = Request[kHTTP2CopyHeaders](reqHeaders.trim()); else headers = reqHeaders; if (upgrade) { - errorRequest(client, request2, new Error("Upgrade not supported for H2")); + errorRequest(client, request3, new Error("Upgrade not supported for H2")); return false; } try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request3.onConnect((err) => { + if (request3.aborted || request3.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request3, err || new RequestAbortedError()); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request3, err); } - if (request2.aborted) { + if (request3.aborted) { return false; } let stream; @@ -8146,11 +8146,11 @@ upgrade: ${upgrade}\r session.ref(); stream = session.request(headers, { endStream: false, signal }); if (stream.id && !stream.pending) { - request2.onUpgrade(null, null, stream); + request3.onUpgrade(null, null, stream); ++h2State.openStreams; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request3.onUpgrade(null, null, stream); ++h2State.openStreams; }); } @@ -8169,14 +8169,14 @@ upgrade: ${upgrade}\r } let contentLength = util.bodyLength(body); if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request3.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request3.contentLength != null && request3.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request3, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -8201,15 +8201,15 @@ upgrade: ${upgrade}\r ++h2State.openStreams; stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - if (request2.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { + if (request3.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.once("end", () => { - request2.onComplete([]); + request3.onComplete([]); }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request3.onData(chunk) === false) { stream.pause(); } }); @@ -8227,7 +8227,7 @@ upgrade: ${upgrade}\r }); stream.once("frameError", (type, code) => { const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`); - errorRequest(client, request2, err); + errorRequest(client, request3, err); if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { h2State.streams -= 1; util.destroy(stream, err); @@ -8236,20 +8236,20 @@ upgrade: ${upgrade}\r return true; function writeBodyH2() { if (!body) { - request2.onRequestSent(); + request3.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); stream.cork(); stream.write(body); stream.uncork(); stream.end(); - request2.onBodySent(body); - request2.onRequestSent(); + request3.onBodySent(body); + request3.onRequestSent(); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { writeIterable({ client, - request: request2, + request: request3, contentLength, h2stream: stream, expectsPayload, @@ -8261,7 +8261,7 @@ upgrade: ${upgrade}\r writeBlob({ body, client, - request: request2, + request: request3, contentLength, expectsPayload, h2stream: stream, @@ -8273,7 +8273,7 @@ upgrade: ${upgrade}\r writeStream({ body, client, - request: request2, + request: request3, contentLength, expectsPayload, socket: client[kSocket], @@ -8284,7 +8284,7 @@ upgrade: ${upgrade}\r writeIterable({ body, client, - request: request2, + request: request3, contentLength, expectsPayload, header: "", @@ -8296,11 +8296,11 @@ upgrade: ${upgrade}\r } } } - function writeStream({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + function writeStream({ h2stream, body, client, request: request3, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); if (client[kHTTPConnVersion] === "h2") { let onPipeData = function(chunk) { - request2.onBodySent(chunk); + request3.onBodySent(chunk); }; const pipe = pipeline( body, @@ -8310,7 +8310,7 @@ upgrade: ${upgrade}\r util.destroy(body, err); util.destroy(h2stream, err); } else { - request2.onRequestSent(); + request3.onRequestSent(); } } ); @@ -8322,7 +8322,7 @@ upgrade: ${upgrade}\r return; } let finished = false; - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request3, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -8378,7 +8378,7 @@ upgrade: ${upgrade}\r } socket.on("drain", onDrain).on("error", onFinished); } - async function writeBlob({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeBlob({ h2stream, body, client, request: request3, socket, contentLength, header, expectsPayload }) { assert(contentLength === body.size, "blob body must have content length"); const isH2 = client[kHTTPConnVersion] === "h2"; try { @@ -8398,8 +8398,8 @@ upgrade: ${upgrade}\r socket.write(buffer); socket.uncork(); } - request2.onBodySent(buffer); - request2.onRequestSent(); + request3.onBodySent(buffer); + request3.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -8408,7 +8408,7 @@ upgrade: ${upgrade}\r util.destroy(isH2 ? h2stream : socket, err); } } - async function writeIterable({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeIterable({ h2stream, body, client, request: request3, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -8434,7 +8434,7 @@ upgrade: ${upgrade}\r throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request3.onBodySent(chunk); if (!res) { await waitForDrain(); } @@ -8442,14 +8442,14 @@ upgrade: ${upgrade}\r } catch (err) { h2stream.destroy(err); } finally { - request2.onRequestSent(); + request3.onRequestSent(); h2stream.end(); h2stream.off("close", onDrain).off("drain", onDrain); } return; } socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request3, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -8467,9 +8467,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ socket, request: request3, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request3; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -8478,7 +8478,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request3, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -8517,7 +8517,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request3.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -8528,8 +8528,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request3 } = this; + request3.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -8572,10 +8572,10 @@ ${len.toString(16)}\r } } }; - function errorRequest(client, request2, err) { + function errorRequest(client, request3, err) { try { - request2.onError(err); - assert(request2.aborted); + request3.onError(err); + assert(request3.aborted); } catch (err2) { client.emit("error", err2); } @@ -9670,10 +9670,10 @@ var require_api_request = __commonJS({ } } }; - function request2(opts, callback) { + function request3(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request3.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -9688,7 +9688,7 @@ var require_api_request = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request3; module.exports.RequestHandler = RequestHandler; } }); @@ -10402,7 +10402,7 @@ var require_mock_utils = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData3(data) { if (Buffer.isBuffer(data)) { return data; } else if (typeof data === "object") { @@ -10507,7 +10507,7 @@ var require_mock_utils = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData3(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); handler2.abort = nop; @@ -10564,7 +10564,7 @@ var require_mock_utils = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData3, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -10586,7 +10586,7 @@ var require_mock_utils = __commonJS({ var require_mock_interceptor = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils(); + var { getResponseData: getResponseData3, buildKey, addMockDispatch } = require_mock_utils(); var { kDispatches, kDispatchKey, @@ -10649,7 +10649,7 @@ var require_mock_interceptor = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData(statusCode, data, responseOptions = {}) { - const responseData = getResponseData2(data); + const responseData = getResponseData3(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -12298,7 +12298,7 @@ var require_request2 = __commonJS({ policyContainer: makePolicyContainer() } }; - let request2 = null; + let request3 = null; let fallbackMode = null; const baseUrl = this[kRealm].settingsObject.baseUrl; let signal = null; @@ -12314,17 +12314,17 @@ var require_request2 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request3 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(input instanceof Request); - request2 = input[kState]; + request3 = input[kState]; signal = input[kSignal]; } const origin = this[kRealm].settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request3.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request3.window, origin)) { + window = request3.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -12332,43 +12332,43 @@ var require_request2 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request3 = makeRequest({ + method: request3.method, + headersList: request3.headersList, + unsafeRequest: request3.unsafeRequest, client: this[kRealm].settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request3.priority, + origin: request3.origin, + referrer: request3.referrer, + referrerPolicy: request3.referrerPolicy, + mode: request3.mode, + credentials: request3.credentials, + cache: request3.cache, + redirect: request3.redirect, + integrity: request3.integrity, + keepalive: request3.keepalive, + reloadNavigation: request3.reloadNavigation, + historyNavigation: request3.historyNavigation, + urlList: [...request3.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request3.mode === "navigate") { + request3.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request3.reloadNavigation = false; + request3.historyNavigation = false; + request3.origin = "client"; + request3.referrer = "client"; + request3.referrerPolicy = ""; + request3.url = request3.urlList[request3.urlList.length - 1]; + request3.urlList = [request3.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request3.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -12377,14 +12377,14 @@ var require_request2 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, this[kRealm].settingsObject.baseUrl)) { - request2.referrer = "client"; + request3.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request3.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request3.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -12399,27 +12399,27 @@ var require_request2 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request3.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request3.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request3.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request3.cache === "only-if-cached" && request3.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request3.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request3.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request3.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; @@ -12430,12 +12430,12 @@ var require_request2 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizeMethodRecord[method] ?? normalizeMethod(method); - request2.method = method; + request3.method = method; } if (init.signal !== void 0) { signal = init.signal; } - this[kState] = request2; + this[kState] = request3; const ac = new AbortController(); this[kSignal] = ac.signal; this[kSignal][kRealm] = this[kRealm]; @@ -12469,13 +12469,13 @@ var require_request2 = __commonJS({ } } this[kHeaders] = new Headers(kConstruct); - this[kHeaders][kHeadersList] = request2.headersList; + this[kHeaders][kHeadersList] = request3.headersList; this[kHeaders][kGuard] = "request"; this[kHeaders][kRealm] = this[kRealm]; if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request3.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request3.method} is unsupported in no-cors mode.` ); } this[kHeaders][kGuard] = "request-no-cors"; @@ -12494,14 +12494,14 @@ var require_request2 = __commonJS({ } } const inputBody = input instanceof Request ? input[kState].body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request3.method === "GET" || request3.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request3.keepalive ); initBody = extractedBody; if (contentType && !this[kHeaders][kHeadersList].contains("content-type")) { @@ -12513,12 +12513,12 @@ var require_request2 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request3.mode !== "same-origin" && request3.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request3.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -12648,7 +12648,7 @@ var require_request2 = __commonJS({ }; mixinBody(Request); function makeRequest(init) { - const request2 = { + const request3 = { method: "GET", localURLsOnly: false, unsafeRequest: false, @@ -12687,13 +12687,13 @@ var require_request2 = __commonJS({ ...init, headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; - request2.url = request2.urlList[0]; - return request2; + request3.url = request3.urlList[0]; + return request3; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(request2.body); + function cloneRequest(request3) { + const newRequest = makeRequest({ ...request3, body: null }); + if (request3.body != null) { + newRequest.body = cloneBody(request3.body); } return newRequest; } @@ -12923,14 +12923,14 @@ var require_fetch = __commonJS({ p.reject(e); return p.promise; } - const request2 = requestObject[kState]; + const request3 = requestObject[kState]; if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request3, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request3.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request3.serviceWorkers = "none"; } let responseObject = null; const relevantRealm = null; @@ -12942,7 +12942,7 @@ var require_fetch = __commonJS({ locallyAborted = true; assert(controller != null); controller.abort(requestObject.signal.reason); - abortFetch(p, request2, responseObject, requestObject.signal.reason); + abortFetch(p, request3, responseObject, requestObject.signal.reason); } ); const handleFetchDone = (response) => finalizeAndReportTiming(response, "fetch"); @@ -12951,7 +12951,7 @@ var require_fetch = __commonJS({ return Promise.resolve(); } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request3, responseObject, controller.serializedAbortReason); return Promise.resolve(); } if (response.type === "error") { @@ -12969,7 +12969,7 @@ var require_fetch = __commonJS({ p.resolve(responseObject); }; controller = fetching({ - request: request2, + request: request3, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: init.dispatcher ?? getGlobalDispatcher() @@ -13014,14 +13014,14 @@ var require_fetch = __commonJS({ performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis2, cacheState); } } - function abortFetch(p, request2, responseObject, error) { + function abortFetch(p, request3, responseObject, error) { var _a, _b; if (!error) { error = new DOMException2("The operation was aborted.", "AbortError"); } p.reject(error); - if (request2.body != null && isReadable((_a = request2.body) == null ? void 0 : _a.stream)) { - request2.body.stream.cancel(error).catch((err) => { + if (request3.body != null && isReadable((_a = request3.body) == null ? void 0 : _a.stream)) { + request3.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -13042,7 +13042,7 @@ var require_fetch = __commonJS({ } } function fetching({ - request: request2, + request: request3, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -13054,9 +13054,9 @@ var require_fetch = __commonJS({ var _a, _b, _c, _d; let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request3.client != null) { + taskDestination = request3.client.globalObject; + crossOriginIsolatedCapability = request3.client.crossOriginIsolatedCapability; } const currenTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -13064,7 +13064,7 @@ var require_fetch = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request3, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -13074,32 +13074,32 @@ var require_fetch = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request3.body || request3.body.stream); + if (request3.window === "client") { + request3.window = ((_c = (_b = (_a = request3.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request3.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = (_d = request2.client) == null ? void 0 : _d.origin; + if (request3.origin === "client") { + request3.origin = (_d = request3.client) == null ? void 0 : _d.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request3.policyContainer === "client") { + if (request3.client != null) { + request3.policyContainer = clonePolicyContainer( + request3.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request3.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept")) { + if (!request3.headersList.contains("accept")) { const value = "*/*"; - request2.headersList.append("accept", value); + request3.headersList.append("accept", value); } - if (!request2.headersList.contains("accept-language")) { - request2.headersList.append("accept-language", "*"); + if (!request3.headersList.contains("accept-language")) { + request3.headersList.append("accept-language", "*"); } - if (request2.priority === null) { + if (request3.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request3.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -13107,44 +13107,44 @@ var require_fetch = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request3.localURLsOnly && !urlIsLocal(requestCurrentURL(request3))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request3); + if (requestBadPort(request3) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request3.referrerPolicy === "") { + request3.referrerPolicy = request3.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request3.referrer !== "no-referrer") { + request3.referrer = determineRequestsReferrer(request3); } if (response === null) { response = await (async () => { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request3); + if (sameOrigin(currentURL, request3.url) && request3.responseTainting === "basic" || currentURL.protocol === "data:" || (request3.mode === "navigate" || request3.mode === "websocket")) { + request3.responseTainting = "basic"; return await schemeFetch(fetchParams); } - if (request2.mode === "same-origin") { + if (request3.mode === "same-origin") { return makeNetworkError('request mode cannot be "same-origin"'); } - if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + if (request3.mode === "no-cors") { + if (request3.redirect !== "follow") { return makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } - request2.responseTainting = "opaque"; + request3.responseTainting = "opaque"; return await schemeFetch(fetchParams); } - if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + if (!urlIsHttpHttpsScheme(requestCurrentURL(request3))) { return makeNetworkError("URL scheme must be a HTTP(S) scheme"); } - request2.responseTainting = "cors"; + request3.responseTainting = "cors"; return await httpFetch(fetchParams); })(); } @@ -13152,13 +13152,13 @@ var require_fetch = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request3.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request3.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request3.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request3.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -13166,26 +13166,26 @@ var require_fetch = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request3.urlList); } - if (!request2.timingAllowFailed) { + if (!request3.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range")) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request3.headers.contains("range")) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request3.method === "HEAD" || request3.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request3.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request3.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request3.integrity)) { processBodyError("integrity mismatch"); return; } @@ -13201,8 +13201,8 @@ var require_fetch = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request3 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request3); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -13211,12 +13211,12 @@ var require_fetch = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request3); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blobURLEntryObject = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !isBlobLike(blobURLEntryObject)) { + if (request3.method !== "GET" || !isBlobLike(blobURLEntryObject)) { return Promise.resolve(makeNetworkError("invalid method")); } const bodyWithType = safelyExtractBody(blobURLEntryObject); @@ -13234,7 +13234,7 @@ var require_fetch = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -13316,41 +13316,41 @@ var require_fetch = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request3.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request3.redirect === "follow") { + request3.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request3.responseTainting === "cors" && corsCheck(request3, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request3, response) === "failure") { + request3.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request3.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request3.origin, + request3.client, + request3.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request3.redirect !== "manual") { fetchParams.controller.connection.destroy(); } - if (request2.redirect === "error") { + if (request3.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request3.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request3.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -13360,13 +13360,13 @@ var require_fetch = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request3).hash ); if (locationURL == null) { return response; @@ -13377,63 +13377,63 @@ var require_fetch = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request3.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request3.redirectCount += 1; + if (request3.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request3, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request3.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request3.body != null && request3.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request3.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request3.method)) { + request3.method = "GET"; + request3.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request3.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization"); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie"); - request2.headersList.delete("host"); + if (!sameOrigin(requestCurrentURL(request3), locationURL)) { + request3.headersList.delete("authorization"); + request3.headersList.delete("proxy-authorization", true); + request3.headersList.delete("cookie"); + request3.headersList.delete("host"); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request3.body != null) { + assert(request3.body.source != null); + request3.body = safelyExtractBody(request3.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request3.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request3, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request3.window === "no-window" && request3.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request3; } else { - httpRequest = makeRequest(request2); + httpRequest = makeRequest(request3); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request3.credentials === "include" || request3.credentials === "same-origin" && request3.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -13510,7 +13510,7 @@ var require_fetch = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request3.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -13518,7 +13518,7 @@ var require_fetch = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request3.body == null || request3.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -13546,21 +13546,21 @@ var require_fetch = __commonJS({ } } }; - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request3.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request3.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request3.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request3.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -13589,7 +13589,7 @@ var require_fetch = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request3.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -13701,17 +13701,17 @@ var require_fetch = __commonJS({ } return response; async function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request3); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: fetchParams.controller.dispatcher.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request3.method, + body: fetchParams.controller.dispatcher.isMockActive ? request3.body && (request3.body.source || request3.body.stream) : body, + headers: request3.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request3.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -13757,8 +13757,8 @@ var require_fetch = __commonJS({ } this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = request2.redirect === "follow" && location && redirectStatusSet.has(status); - if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = request3.redirect === "follow" && location && redirectStatusSet.has(status); + if (request3.method !== "HEAD" && request3.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (const coding of codings) { if (coding === "x-gzip" || coding === "gzip") { decoders.push(zlib.createGunzip({ @@ -14692,36 +14692,36 @@ var require_cache = __commonJS({ } this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request3, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.match" }); - request2 = webidl.converters.RequestInfo(request2); + request3 = webidl.converters.RequestInfo(request3); options = webidl.converters.CacheQueryOptions(options); - const p = await this.matchAll(request2, options); + const p = await this.matchAll(request3, options); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request3 = void 0, options = {}) { var _a; webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request3 !== void 0) + request3 = webidl.converters.RequestInfo(request3); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request3 !== void 0) { + if (request3 instanceof Request) { + r = request3[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request3 === "string") { + r = new Request(request3)[kState]; } } const responses = []; - if (request2 === void 0) { + if (request3 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -14743,11 +14743,11 @@ var require_cache = __commonJS({ } return Object.freeze(responseList); } - async add(request2) { + async add(request3) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.add" }); - request2 = webidl.converters.RequestInfo(request2); - const requests = [request2]; + request3 = webidl.converters.RequestInfo(request3); + const requests = [request3]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -14757,11 +14757,11 @@ var require_cache = __commonJS({ requests = webidl.converters["sequence"](requests); const responsePromises = []; const requestList = []; - for (const request2 of requests) { - if (typeof request2 === "string") { + for (const request3 of requests) { + if (typeof request3 === "string") { continue; } - const r = request2[kState]; + const r = request3[kState]; if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14770,8 +14770,8 @@ var require_cache = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = new Request(request2)[kState]; + for (const request3 of requests) { + const r = new Request(request3)[kState]; if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14846,16 +14846,16 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request3, response) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 2, { header: "Cache.put" }); - request2 = webidl.converters.RequestInfo(request2); + request3 = webidl.converters.RequestInfo(request3); response = webidl.converters.Response(response); let innerRequest = null; - if (request2 instanceof Request) { - innerRequest = request2[kState]; + if (request3 instanceof Request) { + innerRequest = request3[kState]; } else { - innerRequest = new Request(request2)[kState]; + innerRequest = new Request(request3)[kState]; } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -14923,20 +14923,20 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request3, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.delete" }); - request2 = webidl.converters.RequestInfo(request2); + request3 = webidl.converters.RequestInfo(request3); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 instanceof Request) { - r = request2[kState]; + if (request3 instanceof Request) { + r = request3[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = new Request(request2)[kState]; + assert(typeof request3 === "string"); + r = new Request(request3)[kState]; } const operations = []; const operation = { @@ -14962,25 +14962,25 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request3 = void 0, options = {}) { webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request3 !== void 0) + request3 = webidl.converters.RequestInfo(request3); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request3 !== void 0) { + if (request3 instanceof Request) { + r = request3[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request3 === "string") { + r = new Request(request3)[kState]; } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request3 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -14992,12 +14992,12 @@ var require_cache = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request4 of requests) { const requestObject = new Request("https://a"); - requestObject[kState] = request3; - requestObject[kHeaders][kHeadersList] = request3.headersList; + requestObject[kState] = request4; + requestObject[kHeaders][kHeadersList] = request4.headersList; requestObject[kHeaders][kGuard] = "immutable"; - requestObject[kRealm] = request3.client; + requestObject[kRealm] = request4.client; requestList.push(requestObject); } promise.resolve(Object.freeze(requestList)); @@ -15092,9 +15092,9 @@ var require_cache = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request3, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request3.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -15110,7 +15110,7 @@ var require_cache = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request3.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -15182,21 +15182,21 @@ var require_cachestorage = __commonJS({ webidl.illegalConstructor(); } } - async match(request2, options = {}) { + async match(request3, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, { header: "CacheStorage.match" }); - request2 = webidl.converters.RequestInfo(request2); + request3 = webidl.converters.RequestInfo(request3); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request3, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request3, options); if (response !== void 0) { return response; } @@ -16109,7 +16109,7 @@ var require_connection = __commonJS({ function establishWebSocketConnection(url, protocols, ws, onEstablish, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request3 = makeRequest({ urlList: [requestURL], serviceWorkers: "none", referrer: "no-referrer", @@ -16120,17 +16120,17 @@ var require_connection = __commonJS({ }); if (options.headers) { const headersList = new Headers(options.headers)[kHeadersList]; - request2.headersList = headersList; + request3.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue); - request2.headersList.append("sec-websocket-version", "13"); + request3.headersList.append("sec-websocket-key", keyValue); + request3.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol); + request3.headersList.append("sec-websocket-protocol", protocol); } const permessageDeflate = ""; const controller = fetching({ - request: request2, + request: request3, useParallelQueue: true, dispatcher: options.dispatcher ?? getGlobalDispatcher(), processResponse(response) { @@ -16163,7 +16163,7 @@ var require_connection = __commonJS({ return; } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); - if (secProtocol !== null && secProtocol !== request2.headersList.get("Sec-WebSocket-Protocol")) { + if (secProtocol !== null && secProtocol !== request3.headersList.get("Sec-WebSocket-Protocol")) { failWebsocketConnection(ws, "Protocol was not set in the opening handshake."); return; } @@ -17208,7 +17208,7 @@ var require_lib = __commonJS({ } exports.isHttps = isHttps; var HttpClient = class { - constructor(userAgent2, handlers, requestOptions) { + constructor(userAgent3, handlers, requestOptions) { this._ignoreSslError = false; this._allowRedirects = true; this._allowRedirectDowngrade = false; @@ -17217,7 +17217,7 @@ var require_lib = __commonJS({ this._maxRetries = 1; this._keepAlive = false; this._disposed = false; - this.userAgent = userAgent2; + this.userAgent = userAgent3; this.handlers = handlers || []; this.requestOptions = requestOptions; if (requestOptions) { @@ -17482,14 +17482,14 @@ var require_lib = __commonJS({ } _mergeHeaders(headers) { if (this.requestOptions && this.requestOptions.headers) { - return Object.assign({}, lowercaseKeys2(this.requestOptions.headers), lowercaseKeys2(headers || {})); + return Object.assign({}, lowercaseKeys3(this.requestOptions.headers), lowercaseKeys3(headers || {})); } - return lowercaseKeys2(headers || {}); + return lowercaseKeys3(headers || {}); } _getExistingOrDefaultHeader(additionalHeaders, header, _default) { let clientHeader; if (this.requestOptions && this.requestOptions.headers) { - clientHeader = lowercaseKeys2(this.requestOptions.headers)[header]; + clientHeader = lowercaseKeys3(this.requestOptions.headers)[header]; } return additionalHeaders[header] || clientHeader || _default; } @@ -17624,7 +17624,7 @@ var require_lib = __commonJS({ } }; exports.HttpClient = HttpClient; - var lowercaseKeys2 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + var lowercaseKeys3 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); } }); @@ -20461,10 +20461,10 @@ var require_util8 = __commonJS({ } return obj; } - function errorRequest(client, request2, err) { + function errorRequest(client, request3, err) { try { - request2.onError(err); - assert(request2.aborted); + request3.onError(err); + assert(request3.aborted); } catch (err2) { client.emit("error", err2); } @@ -20992,7 +20992,7 @@ var require_request3 = __commonJS({ return this; } }; - function processHeader(request2, key, val) { + function processHeader(request3, key, val) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { @@ -21031,19 +21031,19 @@ var require_request3 = __commonJS({ } else { val = `${val}`; } - if (request2.host === null && headerName === "host") { + if (request3.host === null && headerName === "host") { if (typeof val !== "string") { throw new InvalidArgumentError("invalid host header"); } - request2.host = val; - } else if (request2.contentLength === null && headerName === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request3.host = val; + } else if (request3.contentLength === null && headerName === "content-length") { + request3.contentLength = parseInt(val, 10); + if (!Number.isFinite(request3.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && headerName === "content-type") { - request2.contentType = val; - request2.headers.push(key, val); + } else if (request3.contentType === null && headerName === "content-type") { + request3.contentType = val; + request3.headers.push(key, val); } else if (headerName === "transfer-encoding" || headerName === "keep-alive" || headerName === "upgrade") { throw new InvalidArgumentError(`invalid ${headerName} header`); } else if (headerName === "connection") { @@ -21052,12 +21052,12 @@ var require_request3 = __commonJS({ throw new InvalidArgumentError("invalid connection header"); } if (value === "close") { - request2.reset = true; + request3.reset = true; } } else if (headerName === "expect") { throw new NotSupportedError("expect header not supported"); } else { - request2.headers.push(key, val); + request3.headers.push(key, val); } } module.exports = Request; @@ -23370,11 +23370,11 @@ var require_util9 = __commonJS({ function normalizeBinaryStringToUtf8(value) { return Buffer.from(value, "binary").toString("utf8"); } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request3) { + return request3.urlList[request3.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request3) { + const url = requestCurrentURL(request3); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -23411,10 +23411,10 @@ var require_util9 = __commonJS({ } return policy; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request3, actualResponse) { const policy = parseReferrerPolicy(actualResponse); if (policy !== "") { - request2.referrerPolicy = policy; + request3.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -23431,33 +23431,33 @@ var require_util9 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header, true); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; + function appendRequestOriginHeader(request3) { + let serializedOrigin = request3.origin; if (serializedOrigin === "client" || serializedOrigin === void 0) { return; } - if (request2.responseTainting === "cors" || request2.mode === "websocket") { - request2.headersList.append("origin", serializedOrigin, true); - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + if (request3.responseTainting === "cors" || request3.mode === "websocket") { + request3.headersList.append("origin", serializedOrigin, true); + } else if (request3.method !== "GET" && request3.method !== "HEAD") { + switch (request3.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request3.origin && urlHasHttpsScheme(request3.origin) && !urlHasHttpsScheme(requestCurrentURL(request3))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request3, requestCurrentURL(request3))) { serializedOrigin = null; } break; default: } - request2.headersList.append("origin", serializedOrigin, true); + request3.headersList.append("origin", serializedOrigin, true); } } function coarsenTime(timestamp, crossOriginIsolatedCapability) { @@ -23511,18 +23511,18 @@ var require_util9 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request3) { + const policy = request3.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request3.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (webidl.is.URL(request2.referrer)) { - referrerSource = request2.referrer; + } else if (webidl.is.URL(request3.referrer)) { + referrerSource = request3.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); @@ -23540,14 +23540,14 @@ var require_util9 = __commonJS({ case "unsafe-url": return referrerURL; case "strict-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } return referrerOrigin; } case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -23557,17 +23557,17 @@ var require_util9 = __commonJS({ return referrerOrigin; } case "same-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request3, referrerURL)) { return referrerURL; } return "no-referrer"; case "origin-when-cross-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request3, referrerURL)) { return referrerURL; } return referrerOrigin; case "no-referrer-when-downgrade": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } @@ -23731,7 +23731,7 @@ var require_util9 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request3) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -25204,11 +25204,11 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request3 = client[kQueue][client[kRunningIdx]]; + if (!request3) { return -1; } - request2.onResponseStarted(); + request3.onResponseStarted(); return 0; } onHeaderField(buf) { @@ -25256,9 +25256,9 @@ var require_client_h1 = __commonJS({ assert(!socket.destroyed); assert(!this.paused); assert((headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); - assert(request2.upgrade || request2.method === "CONNECT"); + const request3 = client[kQueue][client[kRunningIdx]]; + assert(request3); + assert(request3.upgrade || request3.method === "CONNECT"); this.statusCode = 0; this.statusText = ""; this.shouldKeepAlive = false; @@ -25275,7 +25275,7 @@ var require_client_h1 = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request3.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -25286,8 +25286,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request3 = client[kQueue][client[kRunningIdx]]; + if (!request3) { return -1; } assert(!this.upgrade); @@ -25296,22 +25296,22 @@ var require_client_h1 = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request3.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert(this.timeoutType === TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request3.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request3.bodyTimeout != null ? request3.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request3.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -25342,11 +25342,11 @@ var require_client_h1 = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request3.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request3.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request3.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -25363,8 +25363,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request3 = client[kQueue][client[kRunningIdx]]; + assert(request3); assert(this.timeoutType === TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -25377,7 +25377,7 @@ var require_client_h1 = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request3.onData(buf) === false) { return constants.ERROR.PAUSED; } return 0; @@ -25392,8 +25392,8 @@ var require_client_h1 = __commonJS({ } assert(statusCode >= 100); assert((this.headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request3 = client[kQueue][client[kRunningIdx]]; + assert(request3); this.statusCode = 0; this.statusText = ""; this.bytesRead = 0; @@ -25405,11 +25405,11 @@ var require_client_h1 = __commonJS({ if (statusCode < 200) { return 0; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request3.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request3.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert(client[kRunning] === 0); @@ -25475,8 +25475,8 @@ var require_client_h1 = __commonJS({ return { version: "h1", defaultPipelining: 1, - write(request2) { - return writeH1(client, request2); + write(request3) { + return writeH1(client, request3); }, resume() { resumeH1(client); @@ -25492,18 +25492,18 @@ var require_client_h1 = __commonJS({ get destroyed() { return socket.destroyed; }, - busy(request2) { + busy(request3) { if (socket[kWriting] || socket[kReset] || socket[kBlocking]) { return true; } - if (request2) { - if (client[kRunning] > 0 && !request2.idempotent) { + if (request3) { + if (client[kRunning] > 0 && !request3.idempotent) { return true; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request3.upgrade || request3.method === "CONNECT")) { return true; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body) || util.isFormDataLike(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request3.body) !== 0 && (util.isStream(request3.body) || util.isAsyncIterable(request3.body) || util.isFormDataLike(request3.body))) { return true; } } @@ -25550,13 +25550,13 @@ var require_client_h1 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request3 = requests[i]; + util.errorRequest(client, request3, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request3 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -25584,8 +25584,8 @@ var require_client_h1 = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request2 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request2.headersTimeout != null ? request2.headersTimeout : client[kHeadersTimeout]; + const request3 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request3.headersTimeout != null ? request3.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -25594,21 +25594,21 @@ var require_client_h1 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH1(client, request2) { - const { method, path: path3, host, upgrade, blocking, reset } = request2; - let { body, headers, contentLength } = request2; + function writeH1(client, request3) { + const { method, path: path3, host, upgrade, blocking, reset } = request3; + let { body, headers, contentLength } = request3; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH"; if (util.isFormDataLike(body)) { if (!extractBody) { extractBody = require_body2().extractBody; } const [bodyStream, contentType] = extractBody(body); - if (request2.contentType == null) { + if (request3.contentType == null) { headers.push("content-type", contentType); } body = bodyStream.stream; contentLength = bodyStream.length; - } else if (util.isBlobLike(body) && request2.contentType == null && body.type) { + } else if (util.isBlobLike(body) && request3.contentType == null && body.type) { headers.push("content-type", body.type); } if (body && typeof body.read === "function") { @@ -25617,33 +25617,33 @@ var require_client_h1 = __commonJS({ const bodyLength = util.bodyLength(body); contentLength = bodyLength ?? contentLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request3.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request3.contentLength !== null && request3.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request3, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request3.aborted || request3.completed) { return; } - util.errorRequest(client, request2, err || new RequestAbortedError()); + util.errorRequest(client, request3, err || new RequestAbortedError()); util.destroy(body); util.destroy(socket, new InformationalError("aborted")); }; try { - request2.onConnect(abort); + request3.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); } - if (request2.aborted) { + if (request3.aborted) { return false; } if (method === "HEAD") { @@ -25694,31 +25694,31 @@ upgrade: ${upgrade}\r } } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request3, headers: header, socket }); } if (!body || bodyLength === 0) { - writeBuffer(abort, null, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, null, client, request3, socket, contentLength, header, expectsPayload); } else if (util.isBuffer(body)) { - writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, body, client, request3, socket, contentLength, header, expectsPayload); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable(abort, body.stream(), client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body.stream(), client, request3, socket, contentLength, header, expectsPayload); } else { - writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBlob(abort, body, client, request3, socket, contentLength, header, expectsPayload); } } else if (util.isStream(body)) { - writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeStream(abort, body, client, request3, socket, contentLength, header, expectsPayload); } else if (util.isIterable(body)) { - writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body, client, request3, socket, contentLength, header, expectsPayload); } else { assert(false); } return true; } - function writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeStream(abort, body, client, request3, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); let finished = false; - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request3, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -25784,7 +25784,7 @@ upgrade: ${upgrade}\r setImmediate(onClose); } } - function writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeBuffer(abort, body, client, request3, socket, contentLength, header, expectsPayload) { try { if (!body) { if (contentLength === 0) { @@ -25804,18 +25804,18 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - if (!expectsPayload && request2.reset !== false) { + request3.onBodySent(body); + if (!expectsPayload && request3.reset !== false) { socket[kReset] = true; } } - request2.onRequestSent(); + request3.onRequestSent(); client[kResume](); } catch (err) { abort(err); } } - async function writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeBlob(abort, body, client, request3, socket, contentLength, header, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -25828,9 +25828,9 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(buffer); socket.uncork(); - request2.onBodySent(buffer); - request2.onRequestSent(); - if (!expectsPayload && request2.reset !== false) { + request3.onBodySent(buffer); + request3.onRequestSent(); + if (!expectsPayload && request3.reset !== false) { socket[kReset] = true; } client[kResume](); @@ -25838,7 +25838,7 @@ upgrade: ${upgrade}\r abort(err); } } - async function writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeIterable(abort, body, client, request3, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -25857,7 +25857,7 @@ upgrade: ${upgrade}\r } }); socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request3, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -25875,9 +25875,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ abort, socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ abort, socket, request: request3, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request3; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -25887,7 +25887,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request3, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -25906,7 +25906,7 @@ upgrade: ${upgrade}\r } socket.cork(); if (bytesWritten === 0) { - if (!expectsPayload && request2.reset !== false) { + if (!expectsPayload && request3.reset !== false) { socket[kReset] = true; } if (contentLength === null) { @@ -25926,7 +25926,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request3.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -25937,8 +25937,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request3 } = this; + request3.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -26081,8 +26081,8 @@ var require_client_h2 = __commonJS({ return { version: "h2", defaultPipelining: Infinity, - write(request2) { - return writeH2(client, request2); + write(request3) { + return writeH2(client, request3); }, resume() { resumeH2(client); @@ -26140,9 +26140,9 @@ var require_client_h2 = __commonJS({ this[kHTTP2Session] = null; util.destroy(this[kSocket], err); if (client[kRunningIdx] < client[kQueue].length) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request3 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); client[kPendingIdx] = client[kRunningIdx]; } assert(client[kRunning] === 0); @@ -26159,8 +26159,8 @@ var require_client_h2 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request3 = requests[i]; + util.errorRequest(client, request3, err); } } } @@ -26191,13 +26191,13 @@ var require_client_h2 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH2(client, request2) { - const requestTimeout = request2.bodyTimeout ?? client[kBodyTimeout]; + function writeH2(client, request3) { + const requestTimeout = request3.bodyTimeout ?? client[kBodyTimeout]; const session = client[kHTTP2Session]; - const { method, path: path3, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; - let { body } = request2; + const { method, path: path3, host, upgrade, expectContinue, signal, headers: reqHeaders } = request3; + let { body } = request3; if (upgrade) { - util.errorRequest(client, request2, new Error("Upgrade not supported for H2")); + util.errorRequest(client, request3, new Error("Upgrade not supported for H2")); return false; } const headers = {}; @@ -26221,11 +26221,11 @@ var require_client_h2 = __commonJS({ headers[HTTP2_HEADER_AUTHORITY] = host || `${hostname}${port ? `:${port}` : ""}`; headers[HTTP2_HEADER_METHOD] = method; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request3.aborted || request3.completed) { return; } err = err || new RequestAbortedError(); - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); if (stream != null) { stream.removeAllListeners("data"); stream.close(); @@ -26235,23 +26235,23 @@ var require_client_h2 = __commonJS({ util.destroy(body, err); }; try { - request2.onConnect(abort); + request3.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request3, err); } - if (request2.aborted) { + if (request3.aborted) { return false; } if (method === "CONNECT") { session.ref(); stream = session.request(headers, { endStream: false, signal }); if (!stream.pending) { - request2.onUpgrade(null, null, stream); + request3.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request3.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; }); @@ -26279,14 +26279,14 @@ var require_client_h2 = __commonJS({ contentLength = bodyStream.length; } if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request3.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request3.contentLength != null && request3.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request3, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -26302,7 +26302,7 @@ var require_client_h2 = __commonJS({ header += `${key}: ${headers[key]}\r `; } - channels.sendHeaders.publish({ request: request2, headers: header, socket: session[kSocket] }); + channels.sendHeaders.publish({ request: request3, headers: header, socket: session[kSocket] }); } const shouldEndStream = method === "GET" || method === "HEAD" || body === null; if (expectContinue) { @@ -26320,17 +26320,17 @@ var require_client_h2 = __commonJS({ stream.setTimeout(requestTimeout); stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - request2.onResponseStarted(); - if (request2.aborted) { + request3.onResponseStarted(); + if (request3.aborted) { stream.removeAllListeners("data"); return; } - if (request2.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { + if (request3.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request3.onData(chunk) === false) { stream.pause(); } }); @@ -26338,8 +26338,8 @@ var require_client_h2 = __commonJS({ var _a; stream.removeAllListeners("data"); if (((_a = stream.state) == null ? void 0 : _a.state) == null || stream.state.state < 6) { - if (!request2.aborted && !request2.completed) { - request2.onComplete({}); + if (!request3.aborted && !request3.completed) { + request3.onComplete({}); } client[kQueue][client[kRunningIdx]++] = null; client[kResume](); @@ -26382,10 +26382,10 @@ var require_client_h2 = __commonJS({ abort(err); }); stream.once("trailers", (trailers) => { - if (request2.aborted || request2.completed) { + if (request3.aborted || request3.completed) { return; } - request2.onComplete(trailers); + request3.onComplete(trailers); }); return true; function writeBodyH2() { @@ -26395,7 +26395,7 @@ var require_client_h2 = __commonJS({ stream, null, client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -26406,7 +26406,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -26418,7 +26418,7 @@ var require_client_h2 = __commonJS({ stream, body.stream(), client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -26429,7 +26429,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -26443,7 +26443,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request3, contentLength ); } else if (util.isIterable(body)) { @@ -26452,7 +26452,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request3, client[kSocket], contentLength, expectsPayload @@ -26462,7 +26462,7 @@ var require_client_h2 = __commonJS({ } } } - function writeBuffer(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + function writeBuffer(abort, h2stream, body, client, request3, socket, contentLength, expectsPayload) { try { if (body != null && util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); @@ -26470,18 +26470,18 @@ var require_client_h2 = __commonJS({ h2stream.write(body); h2stream.uncork(); h2stream.end(); - request2.onBodySent(body); + request3.onBodySent(body); } if (!expectsPayload) { socket[kReset] = true; } - request2.onRequestSent(); + request3.onRequestSent(); client[kResume](); } catch (error) { abort(error); } } - function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) { + function writeStream(abort, socket, expectsPayload, h2stream, body, client, request3, contentLength) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); const pipe = pipeline( body, @@ -26492,7 +26492,7 @@ var require_client_h2 = __commonJS({ abort(err); } else { util.removeAllListeners(pipe); - request2.onRequestSent(); + request3.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26502,10 +26502,10 @@ var require_client_h2 = __commonJS({ ); util.addListener(pipe, "data", onPipeData); function onPipeData(chunk) { - request2.onBodySent(chunk); + request3.onBodySent(chunk); } } - async function writeBlob(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeBlob(abort, h2stream, body, client, request3, socket, contentLength, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -26516,8 +26516,8 @@ var require_client_h2 = __commonJS({ h2stream.write(buffer); h2stream.uncork(); h2stream.end(); - request2.onBodySent(buffer); - request2.onRequestSent(); + request3.onBodySent(buffer); + request3.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26526,7 +26526,7 @@ var require_client_h2 = __commonJS({ abort(err); } } - async function writeIterable(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeIterable(abort, h2stream, body, client, request3, socket, contentLength, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -26551,13 +26551,13 @@ var require_client_h2 = __commonJS({ throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request3.onBodySent(chunk); if (!res) { await waitForDrain(); } } h2stream.end(); - request2.onRequestSent(); + request3.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26804,10 +26804,10 @@ var require_client2 = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = new Request(origin, opts, handler2); - this[kQueue].push(request2); + const request3 = new Request(origin, opts, handler2); + this[kQueue].push(request3); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request3.body) == null && util.isIterable(request3.body)) { this[kResuming] = 1; queueMicrotask(() => resume(this)); } else { @@ -26831,8 +26831,8 @@ var require_client2 = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(this, request2, err); + const request3 = requests[i]; + util.errorRequest(this, request3, err); } const callback = () => { if (this[kClosedResolve]) { @@ -26856,8 +26856,8 @@ var require_client2 = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request3 = requests[i]; + util.errorRequest(client, request3, err); } assert(client[kSize] === 0); } @@ -26961,8 +26961,8 @@ var require_client2 = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - util.errorRequest(client, request2, err); + const request3 = client[kQueue][client[kPendingIdx]++]; + util.errorRequest(client, request3, err); } } else { onError(client, err); @@ -27020,12 +27020,12 @@ var require_client2 = __commonJS({ if (client[kRunning] >= (getPipelining(client) || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request3 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request3.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; + client[kServerName] = request3.servername; (_a = client[kHTTPContext]) == null ? void 0 : _a.destroy(new InformationalError("servername changed"), () => { client[kHTTPContext] = null; resume(client); @@ -27041,10 +27041,10 @@ var require_client2 = __commonJS({ if (client[kHTTPContext].destroyed) { return; } - if (client[kHTTPContext].busy(request2)) { + if (client[kHTTPContext].busy(request3)) { return; } - if (!request2.aborted && client[kHTTPContext].write(request2)) { + if (!request3.aborted && client[kHTTPContext].write(request3)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -28658,10 +28658,10 @@ var require_api_request2 = __commonJS({ } } }; - function request2(opts, callback) { + function request3(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request3.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -28677,7 +28677,7 @@ var require_api_request2 = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request3; module.exports.RequestHandler = RequestHandler; } }); @@ -29443,7 +29443,7 @@ var require_mock_utils2 = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData3(data) { if (Buffer.isBuffer(data)) { return data; } else if (data instanceof Uint8Array) { @@ -29576,7 +29576,7 @@ var require_mock_utils2 = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData3(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); (_a = handler2.onConnect) == null ? void 0 : _a.call(handler2, (err) => handler2.onError(err), null); @@ -29633,7 +29633,7 @@ var require_mock_utils2 = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData3, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -29656,7 +29656,7 @@ var require_mock_utils2 = __commonJS({ var require_mock_interceptor2 = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils2(); + var { getResponseData: getResponseData3, buildKey, addMockDispatch } = require_mock_utils2(); var { kDispatches, kDispatchKey, @@ -29721,7 +29721,7 @@ var require_mock_interceptor2 = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData({ statusCode, data, responseOptions }) { - const responseData = getResponseData2(data); + const responseData = getResponseData3(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -32021,7 +32021,7 @@ var require_sqlite_cache_store = __commonJS({ var { Writable } = __require("stream"); var { assertCacheKey, assertCacheValue } = require_cache2(); var DatabaseSync; - var VERSION9 = 3; + var VERSION11 = 3; var MAX_ENTRY_SIZE = 2 * 1e3 * 1e3 * 1e3; module.exports = class SqliteCacheStore { #maxEntrySize = MAX_ENTRY_SIZE; @@ -32060,7 +32060,7 @@ var require_sqlite_cache_store = __commonJS({ } this.#db = new DatabaseSync((opts == null ? void 0 : opts.location) ?? ":memory:"); this.#db.exec(` - CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION9} ( + CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION11} ( -- Data specific to us id INTEGER PRIMARY KEY AUTOINCREMENT, url TEXT NOT NULL, @@ -32079,9 +32079,9 @@ var require_sqlite_cache_store = __commonJS({ staleAt INTEGER NOT NULL ); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION9}_url ON cacheInterceptorV${VERSION9}(url); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION9}_method ON cacheInterceptorV${VERSION9}(method); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION9}_deleteAt ON cacheInterceptorV${VERSION9}(deleteAt); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION11}_url ON cacheInterceptorV${VERSION11}(url); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION11}_method ON cacheInterceptorV${VERSION11}(method); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION11}_deleteAt ON cacheInterceptorV${VERSION11}(deleteAt); `); this.#getValuesQuery = this.#db.prepare(` SELECT @@ -32096,7 +32096,7 @@ var require_sqlite_cache_store = __commonJS({ vary, cachedAt, staleAt - FROM cacheInterceptorV${VERSION9} + FROM cacheInterceptorV${VERSION11} WHERE url = ? AND method = ? @@ -32104,7 +32104,7 @@ var require_sqlite_cache_store = __commonJS({ deleteAt ASC `); this.#updateValueQuery = this.#db.prepare(` - UPDATE cacheInterceptorV${VERSION9} SET + UPDATE cacheInterceptorV${VERSION11} SET body = ?, deleteAt = ?, statusCode = ?, @@ -32118,7 +32118,7 @@ var require_sqlite_cache_store = __commonJS({ id = ? `); this.#insertValueQuery = this.#db.prepare(` - INSERT INTO cacheInterceptorV${VERSION9} ( + INSERT INTO cacheInterceptorV${VERSION11} ( url, method, body, @@ -32134,20 +32134,20 @@ var require_sqlite_cache_store = __commonJS({ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `); this.#deleteByUrlQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION9} WHERE url = ?` + `DELETE FROM cacheInterceptorV${VERSION11} WHERE url = ?` ); this.#countEntriesQuery = this.#db.prepare( - `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION9}` + `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION11}` ); this.#deleteExpiredValuesQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION9} WHERE deleteAt <= ?` + `DELETE FROM cacheInterceptorV${VERSION11} WHERE deleteAt <= ?` ); this.#deleteOldValuesQuery = this.#maxCount === Infinity ? null : this.#db.prepare(` - DELETE FROM cacheInterceptorV${VERSION9} + DELETE FROM cacheInterceptorV${VERSION11} WHERE id IN ( SELECT id - FROM cacheInterceptorV${VERSION9} + FROM cacheInterceptorV${VERSION11} ORDER BY cachedAt DESC LIMIT ? ) @@ -33238,7 +33238,7 @@ var require_request4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); input = webidl.converters.RequestInfo(input, prefix, "input"); init = webidl.converters.RequestInit(init, prefix, "init"); - let request2 = null; + let request3 = null; let fallbackMode = null; const baseUrl = environmentSettingsObject.settingsObject.baseUrl; let signal = null; @@ -33255,18 +33255,18 @@ var require_request4 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request3 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(webidl.is.Request(input)); - request2 = input.#state; + request3 = input.#state; signal = input.#signal; this.#dispatcher = init.dispatcher || input.#dispatcher; } const origin = environmentSettingsObject.settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request3.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request3.window, origin)) { + window = request3.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -33274,43 +33274,43 @@ var require_request4 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request3 = makeRequest({ + method: request3.method, + headersList: request3.headersList, + unsafeRequest: request3.unsafeRequest, client: environmentSettingsObject.settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request3.priority, + origin: request3.origin, + referrer: request3.referrer, + referrerPolicy: request3.referrerPolicy, + mode: request3.mode, + credentials: request3.credentials, + cache: request3.cache, + redirect: request3.redirect, + integrity: request3.integrity, + keepalive: request3.keepalive, + reloadNavigation: request3.reloadNavigation, + historyNavigation: request3.historyNavigation, + urlList: [...request3.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request3.mode === "navigate") { + request3.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request3.reloadNavigation = false; + request3.historyNavigation = false; + request3.origin = "client"; + request3.referrer = "client"; + request3.referrerPolicy = ""; + request3.url = request3.urlList[request3.urlList.length - 1]; + request3.urlList = [request3.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request3.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -33319,14 +33319,14 @@ var require_request4 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, environmentSettingsObject.settingsObject.baseUrl)) { - request2.referrer = "client"; + request3.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request3.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request3.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -33341,33 +33341,33 @@ var require_request4 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request3.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request3.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request3.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request3.cache === "only-if-cached" && request3.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request3.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request3.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request3.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; const mayBeNormalized = normalizedMethodRecords[method]; if (mayBeNormalized !== void 0) { - request2.method = mayBeNormalized; + request3.method = mayBeNormalized; } else { if (!isValidHTTPToken(method)) { throw new TypeError(`'${method}' is not a valid HTTP method.`); @@ -33377,9 +33377,9 @@ var require_request4 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizedMethodRecordsBase[upperCase] ?? method; - request2.method = method; + request3.method = method; } - if (!patchMethodWarning && request2.method === "patch") { + if (!patchMethodWarning && request3.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" }); @@ -33389,7 +33389,7 @@ var require_request4 = __commonJS({ if (init.signal !== void 0) { signal = init.signal; } - this.#state = request2; + this.#state = request3; const ac = new AbortController(); this.#signal = ac.signal; if (signal != null) { @@ -33410,12 +33410,12 @@ var require_request4 = __commonJS({ } } this.#headers = new Headers(kConstruct); - setHeadersList(this.#headers, request2.headersList); + setHeadersList(this.#headers, request3.headersList); setHeadersGuard(this.#headers, "request"); if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request3.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request3.method} is unsupported in no-cors mode.` ); } setHeadersGuard(this.#headers, "request-no-cors"); @@ -33434,14 +33434,14 @@ var require_request4 = __commonJS({ } } const inputBody = webidl.is.Request(input) ? input.#state.body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request3.method === "GET" || request3.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request3.keepalive ); initBody = extractedBody; if (contentType && !getHeadersList(this.#headers).contains("content-type", true)) { @@ -33453,12 +33453,12 @@ var require_request4 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request3.mode !== "same-origin" && request3.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request3.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -33603,24 +33603,24 @@ var require_request4 = __commonJS({ }; return `Request ${nodeUtil.formatWithOptions(options, properties)}`; } - static setRequestSignal(request2, newSignal) { - request2.#signal = newSignal; - return request2; + static setRequestSignal(request3, newSignal) { + request3.#signal = newSignal; + return request3; } - static getRequestDispatcher(request2) { - return request2.#dispatcher; + static getRequestDispatcher(request3) { + return request3.#dispatcher; } - static setRequestDispatcher(request2, newDispatcher) { - request2.#dispatcher = newDispatcher; + static setRequestDispatcher(request3, newDispatcher) { + request3.#dispatcher = newDispatcher; } - static setRequestHeaders(request2, newHeaders) { - request2.#headers = newHeaders; + static setRequestHeaders(request3, newHeaders) { + request3.#headers = newHeaders; } - static getRequestState(request2) { - return request2.#state; + static getRequestState(request3) { + return request3.#state; } - static setRequestState(request2, newState) { - request2.#state = newState; + static setRequestState(request3, newState) { + request3.#state = newState; } }; var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState } = Request; @@ -33673,23 +33673,23 @@ var require_request4 = __commonJS({ headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(newRequest, request2.body); + function cloneRequest(request3) { + const newRequest = makeRequest({ ...request3, body: null }); + if (request3.body != null) { + newRequest.body = cloneBody(newRequest, request3.body); } return newRequest; } function fromInnerRequest(innerRequest, dispatcher, signal, guard) { - const request2 = new Request(kConstruct); - setRequestState(request2, innerRequest); - setRequestDispatcher(request2, dispatcher); - setRequestSignal(request2, signal); + const request3 = new Request(kConstruct); + setRequestState(request3, innerRequest); + setRequestDispatcher(request3, dispatcher); + setRequestSignal(request3, signal); const headers = new Headers(kConstruct); - setRequestHeaders(request2, headers); + setRequestHeaders(request3, headers); setHeadersList(headers, innerRequest.headersList); setHeadersGuard(headers, guard); - return request2; + return request3; } Object.defineProperties(Request.prototype, { method: kEnumerableProperty, @@ -33927,14 +33927,14 @@ var require_fetch2 = __commonJS({ p.reject(e); return p.promise; } - const request2 = getRequestState(requestObject); + const request3 = getRequestState(requestObject); if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request3, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request3.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request3.serviceWorkers = "none"; } let responseObject = null; let locallyAborted = false; @@ -33946,7 +33946,7 @@ var require_fetch2 = __commonJS({ assert(controller != null); controller.abort(requestObject.signal.reason); const realResponse = responseObject == null ? void 0 : responseObject.deref(); - abortFetch(p, request2, realResponse, requestObject.signal.reason); + abortFetch(p, request3, realResponse, requestObject.signal.reason); } ); const processResponse = (response) => { @@ -33954,7 +33954,7 @@ var require_fetch2 = __commonJS({ return; } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request3, responseObject, controller.serializedAbortReason); return; } if (response.type === "error") { @@ -33966,7 +33966,7 @@ var require_fetch2 = __commonJS({ p = null; }; controller = fetching({ - request: request2, + request: request3, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: getRequestDispatcher(requestObject) @@ -34007,13 +34007,13 @@ var require_fetch2 = __commonJS({ ); } var markResourceTiming = performance.markResourceTiming; - function abortFetch(p, request2, responseObject, error) { + function abortFetch(p, request3, responseObject, error) { var _a, _b; if (p) { p.reject(error); } - if (((_a = request2.body) == null ? void 0 : _a.stream) != null && isReadable(request2.body.stream)) { - request2.body.stream.cancel(error).catch((err) => { + if (((_a = request3.body) == null ? void 0 : _a.stream) != null && isReadable(request3.body.stream)) { + request3.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -34034,7 +34034,7 @@ var require_fetch2 = __commonJS({ } } function fetching({ - request: request2, + request: request3, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -34047,9 +34047,9 @@ var require_fetch2 = __commonJS({ assert(dispatcher); let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request3.client != null) { + taskDestination = request3.client.globalObject; + crossOriginIsolatedCapability = request3.client.crossOriginIsolatedCapability; } const currentTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -34057,7 +34057,7 @@ var require_fetch2 = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request3, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -34067,32 +34067,32 @@ var require_fetch2 = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request3.body || request3.body.stream); + if (request3.window === "client") { + request3.window = ((_c = (_b = (_a = request3.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request3.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = request2.client.origin; + if (request3.origin === "client") { + request3.origin = request3.client.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request3.policyContainer === "client") { + if (request3.client != null) { + request3.policyContainer = clonePolicyContainer( + request3.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request3.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept", true)) { + if (!request3.headersList.contains("accept", true)) { const value = "*/*"; - request2.headersList.append("accept", value, true); + request3.headersList.append("accept", value, true); } - if (!request2.headersList.contains("accept-language", true)) { - request2.headersList.append("accept-language", "*", true); + if (!request3.headersList.contains("accept-language", true)) { + request3.headersList.append("accept-language", "*", true); } - if (request2.priority === null) { + if (request3.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request3.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -34100,41 +34100,41 @@ var require_fetch2 = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request3.localURLsOnly && !urlIsLocal(requestCurrentURL(request3))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request3); + if (requestBadPort(request3) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request3.referrerPolicy === "") { + request3.referrerPolicy = request3.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request3.referrer !== "no-referrer") { + request3.referrer = determineRequestsReferrer(request3); } if (response === null) { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request3); + if (sameOrigin(currentURL, request3.url) && request3.responseTainting === "basic" || currentURL.protocol === "data:" || (request3.mode === "navigate" || request3.mode === "websocket")) { + request3.responseTainting = "basic"; response = await schemeFetch(fetchParams); - } else if (request2.mode === "same-origin") { + } else if (request3.mode === "same-origin") { response = makeNetworkError('request mode cannot be "same-origin"'); - } else if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + } else if (request3.mode === "no-cors") { + if (request3.redirect !== "follow") { response = makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } else { - request2.responseTainting = "opaque"; + request3.responseTainting = "opaque"; response = await schemeFetch(fetchParams); } - } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request3))) { response = makeNetworkError("URL scheme must be a HTTP(S) scheme"); } else { - request2.responseTainting = "cors"; + request3.responseTainting = "cors"; response = await httpFetch(fetchParams); } } @@ -34142,13 +34142,13 @@ var require_fetch2 = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request3.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request3.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request3.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request3.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -34156,26 +34156,26 @@ var require_fetch2 = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request3.urlList); } - if (!request2.timingAllowFailed) { + if (!request3.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range", true)) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request3.headers.contains("range", true)) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request3.method === "HEAD" || request3.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request3.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request3.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request3.integrity)) { processBodyError("integrity mismatch"); return; } @@ -34191,8 +34191,8 @@ var require_fetch2 = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request3 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request3); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -34201,19 +34201,19 @@ var require_fetch2 = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("node:buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request3); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blob = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !webidl.is.Blob(blob)) { + if (request3.method !== "GET" || !webidl.is.Blob(blob)) { return Promise.resolve(makeNetworkError("invalid method")); } const response = makeResponse(); const fullLength = blob.size; const serializedFullLength = isomorphicEncode(`${fullLength}`); const type = blob.type; - if (!request2.headersList.contains("range", true)) { + if (!request3.headersList.contains("range", true)) { const bodyWithType = extractBody(blob); response.statusText = "OK"; response.body = bodyWithType[0]; @@ -34221,7 +34221,7 @@ var require_fetch2 = __commonJS({ response.headersList.set("content-type", type, true); } else { response.rangeRequested = true; - const rangeHeader = request2.headersList.get("range", true); + const rangeHeader = request3.headersList.get("range", true); const rangeValue = simpleRangeHeaderValue(rangeHeader, true); if (rangeValue === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34252,7 +34252,7 @@ var require_fetch2 = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request3); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34341,41 +34341,41 @@ var require_fetch2 = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request3.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request3.redirect === "follow") { + request3.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request3.responseTainting === "cors" && corsCheck(request3, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request3, response) === "failure") { + request3.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request3.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request3.origin, + request3.client, + request3.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request3.redirect !== "manual") { fetchParams.controller.connection.destroy(void 0, false); } - if (request2.redirect === "error") { + if (request3.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request3.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request3.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -34385,13 +34385,13 @@ var require_fetch2 = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request3).hash ); if (locationURL == null) { return response; @@ -34402,63 +34402,63 @@ var require_fetch2 = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request3.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request3.redirectCount += 1; + if (request3.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request3, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request3.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request3.body != null && request3.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request3.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request3.method)) { + request3.method = "GET"; + request3.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request3.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization", true); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie", true); - request2.headersList.delete("host", true); + if (!sameOrigin(requestCurrentURL(request3), locationURL)) { + request3.headersList.delete("authorization", true); + request3.headersList.delete("proxy-authorization", true); + request3.headersList.delete("cookie", true); + request3.headersList.delete("host", true); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request3.body != null) { + assert(request3.body.source != null); + request3.body = safelyExtractBody(request3.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request3.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request3, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request3 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request3.window === "no-window" && request3.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request3; } else { - httpRequest = cloneRequest(request2); + httpRequest = cloneRequest(request3); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request3.credentials === "include" || request3.credentials === "same-origin" && request3.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -34535,7 +34535,7 @@ var require_fetch2 = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request3.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -34543,7 +34543,7 @@ var require_fetch2 = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request3.body == null || request3.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -34573,21 +34573,21 @@ var require_fetch2 = __commonJS({ } } }; - const request2 = fetchParams.request; + const request3 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request3.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request3.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request3.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request3.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -34616,7 +34616,7 @@ var require_fetch2 = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request3.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -34727,17 +34727,17 @@ var require_fetch2 = __commonJS({ } return response; function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request3); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request3.method, + body: agent.isMockActive ? request3.body && (request3.body.source || request3.body.stream) : body, + headers: request3.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request3.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -34773,8 +34773,8 @@ var require_fetch2 = __commonJS({ location = headersList.get("location", true); this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status); - if (codings.length !== 0 && request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = location && request3.redirect === "follow" && redirectStatusSet.has(status); + if (codings.length !== 0 && request3.method !== "HEAD" && request3.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (let i = codings.length - 1; i >= 0; --i) { const coding = codings[i]; if (coding === "x-gzip" || coding === "gzip") { @@ -34916,32 +34916,32 @@ var require_cache4 = __commonJS({ webidl.util.markAsUncloneable(this); this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request3, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.match"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - const p = this.#internalMatchAll(request2, options, 1); + const p = this.#internalMatchAll(request3, options, 1); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request3 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.matchAll"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request3 !== void 0) + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - return this.#internalMatchAll(request2, options); + return this.#internalMatchAll(request3, options); } - async add(request2) { + async add(request3) { webidl.brandCheck(this, Cache); const prefix = "Cache.add"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); - const requests = [request2]; + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); + const requests = [request3]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -34951,19 +34951,19 @@ var require_cache4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); const responsePromises = []; const requestList = []; - for (let request2 of requests) { - if (request2 === void 0) { + for (let request3 of requests) { + if (request3 === void 0) { throw webidl.errors.conversionFailed({ prefix, argument: "Argument 1", types: ["undefined is not allowed"] }); } - request2 = webidl.converters.RequestInfo(request2); - if (typeof request2 === "string") { + request3 = webidl.converters.RequestInfo(request3); + if (typeof request3 === "string") { continue; } - const r = getRequestState(request2); + const r = getRequestState(request3); if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: prefix, @@ -34972,8 +34972,8 @@ var require_cache4 = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = getRequestState(new Request(request2)); + for (const request3 of requests) { + const r = getRequestState(new Request(request3)); if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: prefix, @@ -35047,17 +35047,17 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request3, response) { webidl.brandCheck(this, Cache); const prefix = "Cache.put"; webidl.argumentLengthCheck(arguments, 2, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); response = webidl.converters.Response(response, prefix, "response"); let innerRequest = null; - if (webidl.is.Request(request2)) { - innerRequest = getRequestState(request2); + if (webidl.is.Request(request3)) { + innerRequest = getRequestState(request3); } else { - innerRequest = getRequestState(new Request(request2)); + innerRequest = getRequestState(new Request(request3)); } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -35125,21 +35125,21 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request3, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.delete"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (webidl.is.Request(request3)) { + r = getRequestState(request3); if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = getRequestState(new Request(request2)); + assert(typeof request3 === "string"); + r = getRequestState(new Request(request3)); } const operations = []; const operation = { @@ -35165,26 +35165,26 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request3 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.keys"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request3 !== void 0) + request3 = webidl.converters.RequestInfo(request3, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request3 !== void 0) { + if (webidl.is.Request(request3)) { + r = getRequestState(request3); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request3 === "string") { + r = getRequestState(new Request(request3)); } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request3 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -35196,9 +35196,9 @@ var require_cache4 = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request4 of requests) { const requestObject = fromInnerRequest( - request3, + request4, void 0, new AbortController().signal, "immutable" @@ -35297,9 +35297,9 @@ var require_cache4 = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request3, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request3.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -35315,7 +35315,7 @@ var require_cache4 = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request3.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -35323,20 +35323,20 @@ var require_cache4 = __commonJS({ } return true; } - #internalMatchAll(request2, options, maxResponses = Infinity) { + #internalMatchAll(request3, options, maxResponses = Infinity) { let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request3 !== void 0) { + if (webidl.is.Request(request3)) { + r = getRequestState(request3); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request3 === "string") { + r = getRequestState(new Request(request3)); } } const responses = []; - if (request2 === void 0) { + if (request3 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -35424,21 +35424,21 @@ var require_cachestorage2 = __commonJS({ } webidl.util.markAsUncloneable(this); } - async match(request2, options = {}) { + async match(request3, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, "CacheStorage.match"); - request2 = webidl.converters.RequestInfo(request2); + request3 = webidl.converters.RequestInfo(request3); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request3, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request3, options); if (response !== void 0) { return response; } @@ -36528,7 +36528,7 @@ var require_connection2 = __commonJS({ function establishWebSocketConnection(url, protocols, client, handler2, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request3 = makeRequest({ urlList: [requestURL], client, serviceWorkers: "none", @@ -36540,18 +36540,18 @@ var require_connection2 = __commonJS({ }); if (options.headers) { const headersList = getHeadersList(new Headers(options.headers)); - request2.headersList = headersList; + request3.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue, true); - request2.headersList.append("sec-websocket-version", "13", true); + request3.headersList.append("sec-websocket-key", keyValue, true); + request3.headersList.append("sec-websocket-version", "13", true); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol, true); + request3.headersList.append("sec-websocket-protocol", protocol, true); } const permessageDeflate = "permessage-deflate; client_max_window_bits"; - request2.headersList.append("sec-websocket-extensions", permessageDeflate, true); + request3.headersList.append("sec-websocket-extensions", permessageDeflate, true); const controller = fetching({ - request: request2, + request: request3, useParallelQueue: true, dispatcher: options.dispatcher, processResponse(response) { @@ -36592,7 +36592,7 @@ var require_connection2 = __commonJS({ } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); if (secProtocol !== null) { - const requestProtocols = getDecodeSplit("sec-websocket-protocol", request2.headersList); + const requestProtocols = getDecodeSplit("sec-websocket-protocol", request3.headersList); if (!requestProtocols.includes(secProtocol)) { failWebsocketConnection(handler2, 1002, "Protocol was not set in the opening handshake."); return; @@ -38792,24 +38792,24 @@ var require_dist_node3 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export(dist_src_exports, { - endpoint: () => endpoint2 + endpoint: () => endpoint3 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent5 = require_dist_node2(); - var VERSION9 = "9.0.5"; - var userAgent2 = `octokit-endpoint.js/${VERSION9} ${(0, import_universal_user_agent5.getUserAgent)()}`; - var DEFAULTS2 = { + var import_universal_user_agent7 = require_dist_node2(); + var VERSION11 = "9.0.5"; + var userAgent3 = `octokit-endpoint.js/${VERSION11} ${(0, import_universal_user_agent7.getUserAgent)()}`; + var DEFAULTS3 = { method: "GET", baseUrl: "https://api.github.com", headers: { accept: "application/vnd.github.v3+json", - "user-agent": userAgent2 + "user-agent": userAgent3 }, mediaType: { format: "" } }; - function lowercaseKeys2(object) { + function lowercaseKeys3(object) { if (!object) { return {}; } @@ -38818,7 +38818,7 @@ var require_dist_node3 = __commonJS({ return newObj; }, {}); } - function isPlainObject3(value) { + function isPlainObject5(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -38829,21 +38829,21 @@ var require_dist_node3 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - function mergeDeep2(defaults2, options) { + function mergeDeep3(defaults2, options) { const result = Object.assign({}, defaults2); Object.keys(options).forEach((key) => { - if (isPlainObject3(options[key])) { + if (isPlainObject5(options[key])) { if (!(key in defaults2)) Object.assign(result, { [key]: options[key] }); else - result[key] = mergeDeep2(defaults2[key], options[key]); + result[key] = mergeDeep3(defaults2[key], options[key]); } else { Object.assign(result, { [key]: options[key] }); } }); return result; } - function removeUndefinedProperties2(obj) { + function removeUndefinedProperties3(obj) { for (const key in obj) { if (obj[key] === void 0) { delete obj[key]; @@ -38851,7 +38851,7 @@ var require_dist_node3 = __commonJS({ } return obj; } - function merge2(defaults2, route, options) { + function merge3(defaults2, route, options) { var _a; if (typeof route === "string") { let [method, url] = route.split(" "); @@ -38859,10 +38859,10 @@ var require_dist_node3 = __commonJS({ } else { options = Object.assign({}, route); } - options.headers = lowercaseKeys2(options.headers); - removeUndefinedProperties2(options); - removeUndefinedProperties2(options.headers); - const mergedOptions = mergeDeep2(defaults2 || {}, options); + options.headers = lowercaseKeys3(options.headers); + removeUndefinedProperties3(options); + removeUndefinedProperties3(options.headers); + const mergedOptions = mergeDeep3(defaults2 || {}, options); if (options.url === "/graphql") { if (defaults2 && ((_a = defaults2.mediaType.previews) == null ? void 0 : _a.length)) { mergedOptions.mediaType.previews = defaults2.mediaType.previews.filter( @@ -38873,7 +38873,7 @@ var require_dist_node3 = __commonJS({ } return mergedOptions; } - function addQueryParameters2(url, parameters) { + function addQueryParameters3(url, parameters) { const separator = /\?/.test(url) ? "&" : "?"; const names = Object.keys(parameters); if (names.length === 0) { @@ -38886,18 +38886,18 @@ var require_dist_node3 = __commonJS({ return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } - var urlVariableRegex2 = /\{[^}]+\}/g; - function removeNonChars2(variableName) { + var urlVariableRegex3 = /\{[^}]+\}/g; + function removeNonChars3(variableName) { return variableName.replace(/^\W+|\W+$/g, "").split(/,/); } - function extractUrlVariableNames2(url) { - const matches = url.match(urlVariableRegex2); + function extractUrlVariableNames3(url) { + const matches = url.match(urlVariableRegex3); if (!matches) { return []; } - return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); + return matches.map(removeNonChars3).reduce((a, b) => a.concat(b), []); } - function omit2(object, keysToOmit) { + function omit3(object, keysToOmit) { const result = { __proto__: null }; for (const key of Object.keys(object)) { if (keysToOmit.indexOf(key) === -1) { @@ -38906,7 +38906,7 @@ var require_dist_node3 = __commonJS({ } return result; } - function encodeReserved2(str) { + function encodeReserved3(str) { return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { if (!/%[0-9A-Fa-f]/.test(part)) { part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); @@ -38914,67 +38914,67 @@ var require_dist_node3 = __commonJS({ return part; }).join(""); } - function encodeUnreserved2(str) { + function encodeUnreserved3(str) { return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { return "%" + c.charCodeAt(0).toString(16).toUpperCase(); }); } - function encodeValue2(operator, value, key) { - value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + function encodeValue3(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved3(value) : encodeUnreserved3(value); if (key) { - return encodeUnreserved2(key) + "=" + value; + return encodeUnreserved3(key) + "=" + value; } else { return value; } } - function isDefined2(value) { + function isDefined3(value) { return value !== void 0 && value !== null; } - function isKeyOperator2(operator) { + function isKeyOperator3(operator) { return operator === ";" || operator === "&" || operator === "?"; } - function getValues2(context2, operator, key, modifier) { + function getValues3(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined2(value) && value !== "") { + if (isDefined3(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { value = value.substring(0, parseInt(modifier, 10)); } result.push( - encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + encodeValue3(operator, value, isKeyOperator3(operator) ? key : "") ); } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { + value.filter(isDefined3).forEach(function(value2) { result.push( - encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + encodeValue3(operator, value2, isKeyOperator3(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - result.push(encodeValue2(operator, value[k], k)); + if (isDefined3(value[k])) { + result.push(encodeValue3(operator, value[k], k)); } }); } } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { - tmp.push(encodeValue2(operator, value2)); + value.filter(isDefined3).forEach(function(value2) { + tmp.push(encodeValue3(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - tmp.push(encodeUnreserved2(k)); - tmp.push(encodeValue2(operator, value[k].toString())); + if (isDefined3(value[k])) { + tmp.push(encodeUnreserved3(k)); + tmp.push(encodeValue3(operator, value[k].toString())); } }); } - if (isKeyOperator2(operator)) { - result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + if (isKeyOperator3(operator)) { + result.push(encodeUnreserved3(key) + "=" + tmp.join(",")); } else if (tmp.length !== 0) { result.push(tmp.join(",")); } @@ -38982,23 +38982,23 @@ var require_dist_node3 = __commonJS({ } } else { if (operator === ";") { - if (isDefined2(value)) { - result.push(encodeUnreserved2(key)); + if (isDefined3(value)) { + result.push(encodeUnreserved3(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { - result.push(encodeUnreserved2(key) + "="); + result.push(encodeUnreserved3(key) + "="); } else if (value === "") { result.push(""); } } return result; } - function parseUrl2(template) { + function parseUrl3(template) { return { - expand: expand3.bind(null, template) + expand: expand4.bind(null, template) }; } - function expand3(template, context2) { + function expand4(template, context2) { var operators = ["+", "#", ".", "/", ";", "?", "&"]; template = template.replace( /\{([^\{\}]+)\}|([^\{\}]+)/g, @@ -39012,7 +39012,7 @@ var require_dist_node3 = __commonJS({ } expression.split(/,/g).forEach(function(variable) { var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); - values.push(getValues2(context2, operator, tmp[1], tmp[2] || tmp[3])); + values.push(getValues3(context2, operator, tmp[1], tmp[2] || tmp[3])); }); if (operator && operator !== "+") { var separator = ","; @@ -39026,7 +39026,7 @@ var require_dist_node3 = __commonJS({ return values.join(","); } } else { - return encodeReserved2(literal); + return encodeReserved3(literal); } } ); @@ -39036,13 +39036,13 @@ var require_dist_node3 = __commonJS({ return template.replace(/\/$/, ""); } } - function parse3(options) { + function parse4(options) { var _a; let method = options.method.toUpperCase(); let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); let headers = Object.assign({}, options.headers); let body; - let parameters = omit2(options, [ + let parameters = omit3(options, [ "method", "baseUrl", "url", @@ -39050,13 +39050,13 @@ var require_dist_node3 = __commonJS({ "request", "mediaType" ]); - const urlVariableNames = extractUrlVariableNames2(url); - url = parseUrl2(url).expand(parameters); + const urlVariableNames = extractUrlVariableNames3(url); + url = parseUrl3(url).expand(parameters); if (!/^http/.test(url)) { url = options.baseUrl + url; } const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); - const remainingParameters = omit2(parameters, omittedParameters); + const remainingParameters = omit3(parameters, omittedParameters); const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); if (!isBinaryRequest) { if (options.mediaType.format) { @@ -39078,7 +39078,7 @@ var require_dist_node3 = __commonJS({ } } if (["GET", "HEAD"].includes(method)) { - url = addQueryParameters2(url, remainingParameters); + url = addQueryParameters3(url, remainingParameters); } else { if ("data" in remainingParameters) { body = remainingParameters.data; @@ -39100,20 +39100,20 @@ var require_dist_node3 = __commonJS({ options.request ? { request: options.request } : null ); } - function endpointWithDefaults2(defaults2, route, options) { - return parse3(merge2(defaults2, route, options)); + function endpointWithDefaults3(defaults2, route, options) { + return parse4(merge3(defaults2, route, options)); } - function withDefaults4(oldDefaults, newDefaults) { - const DEFAULTS22 = merge2(oldDefaults, newDefaults); - const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + function withDefaults6(oldDefaults, newDefaults) { + const DEFAULTS22 = merge3(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults3.bind(null, DEFAULTS22); return Object.assign(endpoint22, { DEFAULTS: DEFAULTS22, - defaults: withDefaults4.bind(null, DEFAULTS22), - merge: merge2.bind(null, DEFAULTS22), - parse: parse3 + defaults: withDefaults6.bind(null, DEFAULTS22), + merge: merge3.bind(null, DEFAULTS22), + parse: parse4 }); } - var endpoint2 = withDefaults4(null, DEFAULTS2); + var endpoint3 = withDefaults6(null, DEFAULTS3); } }); @@ -39240,14 +39240,14 @@ var require_dist_node5 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export(dist_src_exports, { - RequestError: () => RequestError2 + RequestError: () => RequestError3 }); module.exports = __toCommonJS(dist_src_exports); var import_deprecation = require_dist_node4(); var import_once = __toESM2(require_once()); var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation)); var logOnceHeaders = (0, import_once.default)((deprecation) => console.warn(deprecation)); - var RequestError2 = class extends Error { + var RequestError3 = class extends Error { constructor(message, statusCode, options) { super(message); if (Error.captureStackTrace) { @@ -39322,13 +39322,13 @@ var require_dist_node6 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export(dist_src_exports, { - request: () => request2 + request: () => request3 }); module.exports = __toCommonJS(dist_src_exports); - var import_endpoint2 = require_dist_node3(); - var import_universal_user_agent5 = require_dist_node(); - var VERSION9 = "8.4.0"; - function isPlainObject3(value) { + var import_endpoint3 = require_dist_node3(); + var import_universal_user_agent7 = require_dist_node(); + var VERSION11 = "8.4.0"; + function isPlainObject5(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -39339,15 +39339,15 @@ var require_dist_node6 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - var import_request_error2 = require_dist_node5(); + var import_request_error3 = require_dist_node5(); function getBufferResponse(response) { return response.arrayBuffer(); } - function fetchWrapper2(requestOptions) { + function fetchWrapper3(requestOptions) { var _a, _b, _c, _d; const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console; const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false; - if (isPlainObject3(requestOptions.body) || Array.isArray(requestOptions.body)) { + if (isPlainObject5(requestOptions.body) || Array.isArray(requestOptions.body)) { requestOptions.body = JSON.stringify(requestOptions.body); } let headers = {}; @@ -39389,7 +39389,7 @@ var require_dist_node6 = __commonJS({ if (status < 400) { return; } - throw new import_request_error2.RequestError(response.statusText, status, { + throw new import_request_error3.RequestError(response.statusText, status, { response: { url, status, @@ -39400,19 +39400,19 @@ var require_dist_node6 = __commonJS({ }); } if (status === 304) { - throw new import_request_error2.RequestError("Not modified", status, { + throw new import_request_error3.RequestError("Not modified", status, { response: { url, status, headers, - data: await getResponseData2(response) + data: await getResponseData3(response) }, request: requestOptions }); } if (status >= 400) { - const data = await getResponseData2(response); - const error = new import_request_error2.RequestError(toErrorMessage2(data), status, { + const data = await getResponseData3(response); + const error = new import_request_error3.RequestError(toErrorMessage3(data), status, { response: { url, status, @@ -39423,7 +39423,7 @@ var require_dist_node6 = __commonJS({ }); throw error; } - return parseSuccessResponseBody ? await getResponseData2(response) : response.body; + return parseSuccessResponseBody ? await getResponseData3(response) : response.body; }).then((data) => { return { status, @@ -39432,7 +39432,7 @@ var require_dist_node6 = __commonJS({ data }; }).catch((error) => { - if (error instanceof import_request_error2.RequestError) + if (error instanceof import_request_error3.RequestError) throw error; else if (error.name === "AbortError") throw error; @@ -39444,12 +39444,12 @@ var require_dist_node6 = __commonJS({ message = error.cause; } } - throw new import_request_error2.RequestError(message, 500, { + throw new import_request_error3.RequestError(message, 500, { request: requestOptions }); }); } - async function getResponseData2(response) { + async function getResponseData3(response) { const contentType = response.headers.get("content-type"); if (/application\/json/.test(contentType)) { return response.json().catch(() => response.text()).catch(() => ""); @@ -39459,7 +39459,7 @@ var require_dist_node6 = __commonJS({ } return getBufferResponse(response); } - function toErrorMessage2(data) { + function toErrorMessage3(data) { if (typeof data === "string") return data; let suffix; @@ -39476,32 +39476,32 @@ var require_dist_node6 = __commonJS({ } return `Unknown error: ${JSON.stringify(data)}`; } - function withDefaults4(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + function withDefaults6(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper2(endpoint2.parse(endpointOptions)); + return fetchWrapper3(endpoint22.parse(endpointOptions)); } const request22 = (route2, parameters2) => { - return fetchWrapper2( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + return fetchWrapper3( + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; Object.assign(request22, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults6.bind(null, endpoint22) }); return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults6.bind(null, endpoint22) }); } - var request2 = withDefaults4(import_endpoint2.endpoint, { + var request3 = withDefaults6(import_endpoint3.endpoint, { headers: { - "user-agent": `octokit-request.js/${VERSION9} ${(0, import_universal_user_agent5.getUserAgent)()}` + "user-agent": `octokit-request.js/${VERSION11} ${(0, import_universal_user_agent7.getUserAgent)()}` } }); } @@ -39536,8 +39536,8 @@ var require_dist_node7 = __commonJS({ }); module.exports = __toCommonJS(dist_src_exports); var import_request3 = require_dist_node6(); - var import_universal_user_agent5 = require_dist_node(); - var VERSION9 = "7.1.0"; + var import_universal_user_agent7 = require_dist_node(); + var VERSION11 = "7.1.0"; var import_request22 = require_dist_node6(); var import_request4 = require_dist_node6(); function _buildMessageForResponseErrors2(data) { @@ -39545,9 +39545,9 @@ var require_dist_node7 = __commonJS({ ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError2 = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors2(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.name = "GraphqlResponseError"; @@ -39569,7 +39569,7 @@ var require_dist_node7 = __commonJS({ ]; var FORBIDDEN_VARIABLE_OPTIONS2 = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX2 = /\/api\/v3\/?$/; - function graphql3(request2, query, options) { + function graphql3(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -39600,11 +39600,11 @@ var require_dist_node7 = __commonJS({ result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX2.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX2, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -39619,25 +39619,25 @@ var require_dist_node7 = __commonJS({ return response.data.data; }); } - function withDefaults4(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); + function withDefaults6(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql3(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults4.bind(null, newRequest), + defaults: withDefaults6.bind(null, newRequest), endpoint: newRequest.endpoint }); } - var graphql22 = withDefaults4(import_request3.request, { + var graphql22 = withDefaults6(import_request3.request, { headers: { - "user-agent": `octokit-graphql.js/${VERSION9} ${(0, import_universal_user_agent5.getUserAgent)()}` + "user-agent": `octokit-graphql.js/${VERSION11} ${(0, import_universal_user_agent7.getUserAgent)()}` }, method: "POST", url: "/graphql" }); function withCustomRequest2(customRequest) { - return withDefaults4(customRequest, { + return withDefaults6(customRequest, { method: "POST", url: "/graphql" }); @@ -39691,13 +39691,13 @@ var require_dist_node8 = __commonJS({ } return `token ${token}`; } - async function hook2(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( + async function hook2(token, request3, route, parameters) { + const endpoint3 = request3.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix2(token); - return request2(endpoint2); + endpoint3.headers.authorization = withAuthorizationPrefix2(token); + return request3(endpoint3); } var createTokenAuth3 = function createTokenAuth22(token) { if (!token) { @@ -39742,17 +39742,17 @@ var require_dist_node9 = __commonJS({ Octokit: () => Octokit3 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent5 = require_dist_node(); + var import_universal_user_agent7 = require_dist_node(); var import_before_after_hook2 = require_before_after_hook(); var import_request3 = require_dist_node6(); var import_graphql2 = require_dist_node7(); var import_auth_token2 = require_dist_node8(); - var VERSION9 = "5.2.0"; + var VERSION11 = "5.2.0"; var noop2 = () => { }; var consoleWarn2 = console.warn.bind(console); var consoleError2 = console.error.bind(console); - var userAgentTrail2 = `octokit-core.js/${VERSION9} ${(0, import_universal_user_agent5.getUserAgent)()}`; + var userAgentTrail2 = `octokit-core.js/${VERSION11} ${(0, import_universal_user_agent7.getUserAgent)()}`; var _a; var Octokit3 = (_a = class { static defaults(defaults2) { @@ -39855,7 +39855,7 @@ var require_dist_node9 = __commonJS({ } } }, (() => { - _a.VERSION = VERSION9; + _a.VERSION = VERSION11; })(), (() => { _a.plugins = []; })(), _a); @@ -39889,7 +39889,7 @@ var require_dist_node10 = __commonJS({ restEndpointMethods: () => restEndpointMethods2 }); module.exports = __toCommonJS(dist_src_exports); - var VERSION9 = "10.4.1"; + var VERSION11 = "10.4.1"; var Endpoints2 = { actions: { addCustomLabelsToSelfHostedRunnerForOrg: [ @@ -41881,8 +41881,8 @@ var require_dist_node10 = __commonJS({ var endpoints_default2 = Endpoints2; var endpointMethodsMap2 = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default2)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults2, decorations] = endpoint2; + for (const [methodName, endpoint3] of Object.entries(endpoints)) { + const [route, defaults2, decorations] = endpoint3; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -42005,7 +42005,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - restEndpointMethods2.VERSION = VERSION9; + restEndpointMethods2.VERSION = VERSION11; function legacyRestEndpointMethods2(octokit) { const api = endpointsToMethods2(octokit); return { @@ -42013,7 +42013,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - legacyRestEndpointMethods2.VERSION = VERSION9; + legacyRestEndpointMethods2.VERSION = VERSION11; } }); @@ -42046,7 +42046,7 @@ var require_dist_node11 = __commonJS({ paginatingEndpoints: () => paginatingEndpoints }); module.exports = __toCommonJS(dist_src_exports); - var VERSION9 = "9.2.1"; + var VERSION11 = "9.2.1"; function normalizePaginatedListResponse2(response) { if (!response.data) { return { @@ -42392,7 +42392,7 @@ var require_dist_node11 = __commonJS({ }) }; } - paginateRest2.VERSION = VERSION9; + paginateRest2.VERSION = VERSION11; } }); @@ -42523,7 +42523,7 @@ var require_fast_content_type_parse = __commonJS({ var defaultContentType = { type: "", parameters: new NullObject() }; Object.freeze(defaultContentType.parameters); Object.freeze(defaultContentType); - function parse3(header) { + function parse4(header) { if (typeof header !== "string") { throw new TypeError("argument header is required and must be a string"); } @@ -42561,7 +42561,7 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - function safeParse2(header) { + function safeParse3(header) { if (typeof header !== "string") { return defaultContentType; } @@ -42599,9 +42599,9 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - module.exports.default = { parse: parse3, safeParse: safeParse2 }; - module.exports.parse = parse3; - module.exports.safeParse = safeParse2; + module.exports.default = { parse: parse4, safeParse: safeParse3 }; + module.exports.parse = parse4; + module.exports.safeParse = safeParse3; module.exports.defaultContentType = defaultContentType; } }); @@ -42711,7 +42711,7 @@ var require_brace_expansion = __commonJS({ if (str.substr(0, 2) === "{}") { str = "\\{\\}" + str.substr(2); } - return expand3(escapeBraces(str), true).map(unescapeBraces); + return expand4(escapeBraces(str), true).map(unescapeBraces); } function embrace(str) { return "{" + str + "}"; @@ -42725,13 +42725,13 @@ var require_brace_expansion = __commonJS({ function gte(i, y) { return i >= y; } - function expand3(str, isTop) { + function expand4(str, isTop) { var expansions = []; var m = balanced("{", "}", str); if (!m) return [str]; var pre = m.pre; - var post = m.post.length ? expand3(m.post, false) : [""]; + var post = m.post.length ? expand4(m.post, false) : [""]; if (/\$$/.test(m.pre)) { for (var k = 0; k < post.length; k++) { var expansion = pre + "{" + m.body + "}" + post[k]; @@ -42745,7 +42745,7 @@ var require_brace_expansion = __commonJS({ if (!isSequence && !isOptions) { if (m.post.match(/,.*\}/)) { str = m.pre + "{" + m.body + escClose + m.post; - return expand3(str); + return expand4(str); } return [str]; } @@ -42755,7 +42755,7 @@ var require_brace_expansion = __commonJS({ } else { n = parseCommaParts(m.body); if (n.length === 1) { - n = expand3(n[0], false).map(embrace); + n = expand4(n[0], false).map(embrace); if (n.length === 1) { return post.map(function(p) { return m.pre + n[0] + p; @@ -42801,7 +42801,7 @@ var require_brace_expansion = __commonJS({ } else { N = []; for (var j = 0; j < n.length; j++) { - N.push.apply(N, expand3(n[j], false)); + N.push.apply(N, expand4(n[j], false)); } } for (var j = 0; j < N.length; j++) { @@ -43651,7 +43651,7 @@ var require_jsonc_parser = __commonJS({ } }; } - function parse3(text, errors = [], options = ParseOptions.DEFAULT) { + function parse4(text, errors = [], options = ParseOptions.DEFAULT) { let currentProperty = null; let currentParent = []; const previousParents = []; @@ -44306,7 +44306,7 @@ var require_jsonc_parser = __commonJS({ SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF"; })(SyntaxKind || (SyntaxKind = {})); var getLocation2 = getLocation; - var parse22 = parse3; + var parse22 = parse4; var parseTree2 = parseTree; var findNodeAtLocation2 = findNodeAtLocation; var findNodeAtOffset2 = findNodeAtOffset; @@ -44611,9 +44611,9 @@ function addQueryParameters(url, parameters) { return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } -var urlVariableRegex = /\{[^}]+\}/g; +var urlVariableRegex = /\{[^{}}]+\}/g; function removeNonChars(variableName) { - return variableName.replace(/^\W+|\W+$/g, "").split(/,/); + return variableName.replace(/(?:^\W+)|(?:(? { const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; return `application/vnd.github.${preview}-preview${format}`; @@ -44829,12 +44829,12 @@ function endpointWithDefaults(defaults2, route, options) { return parse(merge(defaults2, route, options)); } function withDefaults(oldDefaults, newDefaults) { - const DEFAULTS2 = merge(oldDefaults, newDefaults); - const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2); - return Object.assign(endpoint2, { - DEFAULTS: DEFAULTS2, - defaults: withDefaults.bind(null, DEFAULTS2), - merge: merge.bind(null, DEFAULTS2), + const DEFAULTS22 = merge(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults.bind(null, DEFAULTS22), + merge: merge.bind(null, DEFAULTS22), parse }); } @@ -44863,7 +44863,7 @@ var RequestError = class extends Error { if (options.request.headers.authorization) { requestCopy.headers = Object.assign({}, options.request.headers, { authorization: options.request.headers.authorization.replace( - / .*$/, + /(?]+)>; rel="deprecation"/); + const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/); const deprecationLink = matches && matches.pop(); log.warn( `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` @@ -45026,40 +45026,570 @@ function toErrorMessage(data) { return `Unknown error: ${JSON.stringify(data)}`; } function withDefaults2(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper(endpoint2.parse(endpointOptions)); + return fetchWrapper(endpoint22.parse(endpointOptions)); } - const request2 = (route2, parameters2) => { + const request22 = (route2, parameters2) => { return fetchWrapper( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; - Object.assign(request2, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); - return endpointOptions.request.hook(request2, endpointOptions); + return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); } var request = withDefaults2(endpoint, defaults_default); // var VERSION3 = "0.0.0-development"; +var userAgent2 = `octokit-endpoint.js/${VERSION3} ${getUserAgent()}`; +var DEFAULTS2 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent2 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys2(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject3(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep2(defaults2, options) { + const result = Object.assign({}, defaults2); + Object.keys(options).forEach((key) => { + if (isPlainObject3(options[key])) { + if (!(key in defaults2)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep2(defaults2[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties2(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge2(defaults2, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys2(options.headers); + removeUndefinedProperties2(options); + removeUndefinedProperties2(options.headers); + const mergedOptions = mergeDeep2(defaults2 || {}, options); + if (options.url === "/graphql") { + if (defaults2 && ((_a = defaults2.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults2.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters2(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex2 = /\{[^}]+\}/g; +function removeNonChars2(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames2(url) { + const matches = url.match(urlVariableRegex2); + if (!matches) { + return []; + } + return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); +} +function omit2(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved2(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved2(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue2(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + if (key) { + return encodeUnreserved2(key) + "=" + value; + } else { + return value; + } +} +function isDefined2(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator2(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues2(context2, operator, key, modifier) { + var value = context2[key], result = []; + if (isDefined2(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + result.push( + encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + result.push(encodeValue2(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + tmp.push(encodeValue2(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + tmp.push(encodeUnreserved2(k)); + tmp.push(encodeValue2(operator, value[k].toString())); + } + }); + } + if (isKeyOperator2(operator)) { + result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined2(value)) { + result.push(encodeUnreserved2(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved2(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl2(template) { + return { + expand: expand2.bind(null, template) + }; +} +function expand2(template, context2) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues2(context2, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved2(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse2(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit2(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames2(url); + url = parseUrl2(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit2(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters2(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults2(defaults2, route, options) { + return parse2(merge2(defaults2, route, options)); +} +function withDefaults3(oldDefaults, newDefaults) { + const DEFAULTS22 = merge2(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults3.bind(null, DEFAULTS22), + merge: merge2.bind(null, DEFAULTS22), + parse: parse2 + }); +} +var endpoint2 = withDefaults3(null, DEFAULTS2); + +// +var import_fast_content_type_parse2 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError2 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION4 = "0.0.0-development"; +var defaults_default2 = { + headers: { + "user-agent": `octokit-request.js/${VERSION4} ${getUserAgent()}` + } +}; +function isPlainObject4(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper2(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject4(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error) { + let message = "Unknown Error"; + if (error instanceof Error) { + if (error.name === "AbortError") { + error.status = 500; + throw error; + } + message = error.message; + if (error.name === "TypeError" && "cause" in error) { + if (error.cause instanceof Error) { + message = error.cause.message; + } else if (typeof error.cause === "string") { + message = error.cause; + } + } + } + const requestError = new RequestError2(message, 500, { + request: requestOptions + }); + requestError.cause = error; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError2(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2(toErrorMessage2(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData2(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData2(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse2.safeParse)(contentType); + if (isJSONResponse2(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse2(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage2(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults4(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper2(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper2( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); +} +var request2 = withDefaults4(endpoint2, defaults_default2); + +// +var VERSION5 = "0.0.0-development"; function _buildMessageForResponseErrors(data) { return `Request failed due to following response errors: ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.errors = response.errors; @@ -45084,7 +45614,7 @@ var NON_VARIABLE_OPTIONS = [ ]; var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; -function graphql(request2, query, options) { +function graphql(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -45115,11 +45645,11 @@ function graphql(request2, query, options) { result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -45134,25 +45664,25 @@ function graphql(request2, query, options) { return response.data.data; }); } -function withDefaults3(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); +function withDefaults5(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults3.bind(null, newRequest), + defaults: withDefaults5.bind(null, newRequest), endpoint: newRequest.endpoint }); } -var graphql2 = withDefaults3(request, { +var graphql2 = withDefaults5(request2, { headers: { - "user-agent": `octokit-graphql.js/${VERSION3} ${getUserAgent()}` + "user-agent": `octokit-graphql.js/${VERSION5} ${getUserAgent()}` }, method: "POST", url: "/graphql" }); function withCustomRequest(customRequest) { - return withDefaults3(customRequest, { + return withDefaults5(customRequest, { method: "POST", url: "/graphql" }); @@ -45180,13 +45710,13 @@ function withAuthorizationPrefix(token) { } return `token ${token}`; } -async function hook(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( +async function hook(token, request3, route, parameters) { + const endpoint3 = request3.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix(token); - return request2(endpoint2); + endpoint3.headers.authorization = withAuthorizationPrefix(token); + return request3(endpoint3); } var createTokenAuth = function createTokenAuth2(token) { if (!token) { @@ -45204,14 +45734,14 @@ var createTokenAuth = function createTokenAuth2(token) { }; // -var VERSION4 = "6.1.3"; +var VERSION6 = "6.1.4"; // var noop = () => { }; var consoleWarn = console.warn.bind(console); var consoleError = console.error.bind(console); -var userAgentTrail = `octokit-core.js/${VERSION4} ${getUserAgent()}`; +var userAgentTrail = `octokit-core.js/${VERSION6} ${getUserAgent()}`; var Octokit = class { static defaults(defaults2) { const OctokitWithDefaults = class extends this { @@ -45316,20 +45846,20 @@ var Octokit = class { hook; auth; }; -__publicField(Octokit, "VERSION", VERSION4); +__publicField(Octokit, "VERSION", VERSION6); __publicField(Octokit, "plugins", []); // -var VERSION5 = "5.3.1"; +var VERSION7 = "5.3.1"; // function requestLog(octokit) { - octokit.hook.wrap("request", (request2, options) => { + octokit.hook.wrap("request", (request3, options) => { octokit.log.debug("request", options); const start = Date.now(); const requestOptions = octokit.request.endpoint.parse(options); const path3 = requestOptions.url.replace(options.baseUrl, ""); - return request2(options).then((response) => { + return request3(options).then((response) => { const requestId = response.headers["x-github-request-id"]; octokit.log.info( `${requestOptions.method} ${path3} - ${response.status} with id ${requestId} in ${Date.now() - start}ms` @@ -45345,10 +45875,10 @@ function requestLog(octokit) { }); }); } -requestLog.VERSION = VERSION5; +requestLog.VERSION = VERSION7; // -var VERSION6 = "0.0.0-development"; +var VERSION8 = "0.0.0-development"; function normalizePaginatedListResponse(response) { if (!response.data) { return { @@ -45392,7 +45922,7 @@ function iterator(octokit, route, parameters) { const response = await requestMethod({ method, url, headers }); const normalizedResponse = normalizePaginatedListResponse(response); url = ((normalizedResponse.headers.link || "").match( - /<([^>]+)>;\s*rel="next"/ + /<([^<>]+)>;\s*rel="next"/ ) || [])[1]; return { value: normalizedResponse }; } catch (error) { @@ -45451,10 +45981,10 @@ function paginateRest(octokit) { }) }; } -paginateRest.VERSION = VERSION6; +paginateRest.VERSION = VERSION8; // -var VERSION7 = "13.3.1"; +var VERSION9 = "13.3.1"; // var Endpoints = { @@ -47527,8 +48057,8 @@ var endpoints_default = Endpoints; // var endpointMethodsMap = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults2, decorations] = endpoint2; + for (const [methodName, endpoint3] of Object.entries(endpoints)) { + const [route, defaults2, decorations] = endpoint3; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -47653,7 +48183,7 @@ function restEndpointMethods(octokit) { rest: api }; } -restEndpointMethods.VERSION = VERSION7; +restEndpointMethods.VERSION = VERSION9; function legacyRestEndpointMethods(octokit) { const api = endpointsToMethods(octokit); return { @@ -47661,15 +48191,15 @@ function legacyRestEndpointMethods(octokit) { rest: api }; } -legacyRestEndpointMethods.VERSION = VERSION7; +legacyRestEndpointMethods.VERSION = VERSION9; // -var VERSION8 = "21.1.0"; +var VERSION10 = "21.1.1"; // var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRest).defaults( { - userAgent: `octokit-rest.js/${VERSION8}` + userAgent: `octokit-rest.js/${VERSION10}` } ); diff --git a/github-actions/org-file-sync/main.js b/github-actions/org-file-sync/main.js index b2cb12607..31c90769b 100644 --- a/github-actions/org-file-sync/main.js +++ b/github-actions/org-file-sync/main.js @@ -3699,11 +3699,11 @@ var require_util2 = __commonJS({ } return location; } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -3769,7 +3769,7 @@ var require_util2 = __commonJS({ } return true; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const { headersList } = actualResponse; const policyHeader = (headersList.get("referrer-policy") ?? "").split(","); let policy = ""; @@ -3783,7 +3783,7 @@ var require_util2 = __commonJS({ } } if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -3800,33 +3800,33 @@ var require_util2 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; - if (request2.responseTainting === "cors" || request2.mode === "websocket") { + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; + if (request4.responseTainting === "cors" || request4.mode === "websocket") { if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } } } @@ -3858,26 +3858,26 @@ var require_util2 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (request2.referrer instanceof URL) { - referrerSource = request2.referrer; + } else if (request4.referrer instanceof URL) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); if (referrerURL.toString().length > 4096) { referrerURL = referrerOrigin; } - const areSameOrigin = sameOrigin(request2, referrerURL); - const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request2.url); + const areSameOrigin = sameOrigin(request4, referrerURL); + const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request4.url); switch (policy) { case "origin": return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true); @@ -3888,7 +3888,7 @@ var require_util2 = __commonJS({ case "origin-when-cross-origin": return areSameOrigin ? referrerURL : referrerOrigin; case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -4037,7 +4037,7 @@ var require_util2 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -5923,25 +5923,25 @@ var require_request = __commonJS({ static [kHTTP2BuildRequest](origin, opts, handler2) { const headers = opts.headers; opts = { ...opts, headers: null }; - const request2 = new Request(origin, opts, handler2); - request2.headers = {}; + const request4 = new Request(origin, opts, handler2); + request4.headers = {}; if (Array.isArray(headers)) { if (headers.length % 2 !== 0) { throw new InvalidArgumentError("headers array must be even"); } for (let i = 0; i < headers.length; i += 2) { - processHeader(request2, headers[i], headers[i + 1], true); + processHeader(request4, headers[i], headers[i + 1], true); } } else if (headers && typeof headers === "object") { const keys = Object.keys(headers); for (let i = 0; i < keys.length; i++) { const key = keys[i]; - processHeader(request2, key, headers[key], true); + processHeader(request4, key, headers[key], true); } } else if (headers != null) { throw new InvalidArgumentError("headers must be an object or an array"); } - return request2; + return request4; } static [kHTTP2CopyHeaders](raw) { const rawHeaders = raw.split("\r\n"); @@ -5969,28 +5969,28 @@ var require_request = __commonJS({ return skipAppend ? val : `${key}: ${val}\r `; } - function processHeader(request2, key, val, skipAppend = false) { + function processHeader(request4, key, val, skipAppend = false) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { return; } - if (request2.host === null && key.length === 4 && key.toLowerCase() === "host") { + if (request4.host === null && key.length === 4 && key.toLowerCase() === "host") { if (headerCharRegex.exec(val) !== null) { throw new InvalidArgumentError(`invalid ${key} header`); } - request2.host = val; - } else if (request2.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { - request2.contentType = val; + } else if (request4.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { + request4.contentType = val; if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } else if (key.length === 17 && key.toLowerCase() === "transfer-encoding") { throw new InvalidArgumentError("invalid transfer-encoding header"); } else if (key.length === 10 && key.toLowerCase() === "connection") { @@ -5998,7 +5998,7 @@ var require_request = __commonJS({ if (value !== "close" && value !== "keep-alive") { throw new InvalidArgumentError("invalid connection header"); } else if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (key.length === 10 && key.toLowerCase() === "keep-alive") { throw new InvalidArgumentError("invalid keep-alive header"); @@ -6012,19 +6012,19 @@ var require_request = __commonJS({ if (Array.isArray(val)) { for (let i = 0; i < val.length; i++) { if (skipAppend) { - if (request2.headers[key]) - request2.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; + if (request4.headers[key]) + request4.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; else - request2.headers[key] = processHeaderValue(key, val[i], skipAppend); + request4.headers[key] = processHeaderValue(key, val[i], skipAppend); } else { - request2.headers += processHeaderValue(key, val[i]); + request4.headers += processHeaderValue(key, val[i]); } } } else { if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } } } @@ -7168,10 +7168,10 @@ var require_client = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); - this[kQueue].push(request2); + const request4 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; process.nextTick(resume, this); } else { @@ -7195,8 +7195,8 @@ var require_client = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -7244,13 +7244,13 @@ var require_client = __commonJS({ assert(this[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } } else if (client[kRunning] > 0) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7456,8 +7456,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } } @@ -7497,12 +7497,12 @@ var require_client = __commonJS({ onUpgrade(head) { const { upgrade, client, socket, headers, statusCode } = this; assert(upgrade); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(!socket.destroyed); assert(socket === client[kSocket]); assert(!this.paused); - assert(request2.upgrade || request2.method === "CONNECT"); + assert(request4.upgrade || request4.method === "CONNECT"); this.statusCode = null; this.statusText = ""; this.shouldKeepAlive = null; @@ -7519,7 +7519,7 @@ var require_client = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -7530,8 +7530,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert(!this.upgrade); @@ -7540,22 +7540,22 @@ var require_client = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert.strictEqual(this.timeoutType, TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -7586,11 +7586,11 @@ var require_client = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -7607,8 +7607,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert.strictEqual(this.timeoutType, TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -7621,7 +7621,7 @@ var require_client = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } } @@ -7633,8 +7633,8 @@ var require_client = __commonJS({ if (upgrade) { return; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(statusCode >= 100); this.statusCode = null; this.statusText = ""; @@ -7648,11 +7648,11 @@ var require_client = __commonJS({ if (statusCode < 200) { return; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert.strictEqual(client[kRunning], 0); @@ -7710,8 +7710,8 @@ var require_client = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } assert(client[kSize] === 0); } @@ -7741,13 +7741,13 @@ var require_client = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7880,8 +7880,8 @@ var require_client = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + errorRequest(client, request4, err); } } else { onError(client, err); @@ -7935,8 +7935,8 @@ var require_client = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request3 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request3.headersTimeout != null ? request3.headersTimeout : client[kHeadersTimeout]; + const request5 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request5.headersTimeout != null ? request5.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -7958,13 +7958,13 @@ var require_client = __commonJS({ if (client[kRunning] >= (client[kPipelining] || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; - if (socket && socket.servername !== request2.servername) { + client[kServerName] = request4.servername; + if (socket && socket.servername !== request4.servername) { util.destroy(socket, new InformationalError("servername changed")); return; } @@ -7979,16 +7979,16 @@ var require_client = __commonJS({ if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) { return; } - if (client[kRunning] > 0 && !request2.idempotent) { + if (client[kRunning] > 0 && !request4.idempotent) { return; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body))) { return; } - if (!request2.aborted && write(client, request2)) { + if (!request4.aborted && write(client, request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -7998,12 +7998,12 @@ var require_client = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function write(client, request2) { + function write(client, request4) { if (client[kHTTPConnVersion] === "h2") { - writeH2(client, client[kHTTP2Session], request2); + writeH2(client, client[kHTTP2Session], request4); return; } - const { body, method, path, host, upgrade, headers, blocking, reset } = request2; + const { body, method, path, host, upgrade, headers, blocking, reset } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { body.read(0); @@ -8011,31 +8011,31 @@ var require_client = __commonJS({ const bodyLength = util.bodyLength(body); let contentLength = bodyLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(socket, new InformationalError("aborted")); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -8074,7 +8074,7 @@ upgrade: ${upgrade}\r header += headers; } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { if (contentLength === 0) { @@ -8086,7 +8086,7 @@ upgrade: ${upgrade}\r socket.write(`${header}\r `, "latin1"); } - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); socket.cork(); @@ -8095,48 +8095,48 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable({ body: body.stream(), client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body: body.stream(), client, request: request4, socket, contentLength, header, expectsPayload }); } else { - writeBlob({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeBlob({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } } else if (util.isStream(body)) { - writeStream({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeStream({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else if (util.isIterable(body)) { - writeIterable({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else { assert(false); } return true; } - function writeH2(client, session, request2) { - const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; + function writeH2(client, session, request4) { + const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; let headers; if (typeof reqHeaders === "string") headers = Request[kHTTP2CopyHeaders](reqHeaders.trim()); else headers = reqHeaders; if (upgrade) { - errorRequest(client, request2, new Error("Upgrade not supported for H2")); + errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } let stream; @@ -8147,11 +8147,11 @@ upgrade: ${upgrade}\r session.ref(); stream = session.request(headers, { endStream: false, signal }); if (stream.id && !stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; }); } @@ -8170,14 +8170,14 @@ upgrade: ${upgrade}\r } let contentLength = util.bodyLength(body); if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -8202,15 +8202,15 @@ upgrade: ${upgrade}\r ++h2State.openStreams; stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - if (request2.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.once("end", () => { - request2.onComplete([]); + request4.onComplete([]); }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -8228,7 +8228,7 @@ upgrade: ${upgrade}\r }); stream.once("frameError", (type, code) => { const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`); - errorRequest(client, request2, err); + errorRequest(client, request4, err); if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { h2State.streams -= 1; util.destroy(stream, err); @@ -8237,20 +8237,20 @@ upgrade: ${upgrade}\r return true; function writeBodyH2() { if (!body) { - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); stream.cork(); stream.write(body); stream.uncork(); stream.end(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { writeIterable({ client, - request: request2, + request: request4, contentLength, h2stream: stream, expectsPayload, @@ -8262,7 +8262,7 @@ upgrade: ${upgrade}\r writeBlob({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, h2stream: stream, @@ -8274,7 +8274,7 @@ upgrade: ${upgrade}\r writeStream({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, socket: client[kSocket], @@ -8285,7 +8285,7 @@ upgrade: ${upgrade}\r writeIterable({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, header: "", @@ -8297,11 +8297,11 @@ upgrade: ${upgrade}\r } } } - function writeStream({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + function writeStream({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); if (client[kHTTPConnVersion] === "h2") { let onPipeData = function(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); }; const pipe = pipeline( body, @@ -8311,7 +8311,7 @@ upgrade: ${upgrade}\r util.destroy(body, err); util.destroy(h2stream, err); } else { - request2.onRequestSent(); + request4.onRequestSent(); } } ); @@ -8323,7 +8323,7 @@ upgrade: ${upgrade}\r return; } let finished = false; - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -8379,7 +8379,7 @@ upgrade: ${upgrade}\r } socket.on("drain", onDrain).on("error", onFinished); } - async function writeBlob({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeBlob({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength === body.size, "blob body must have content length"); const isH2 = client[kHTTPConnVersion] === "h2"; try { @@ -8399,8 +8399,8 @@ upgrade: ${upgrade}\r socket.write(buffer); socket.uncork(); } - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -8409,7 +8409,7 @@ upgrade: ${upgrade}\r util.destroy(isH2 ? h2stream : socket, err); } } - async function writeIterable({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeIterable({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -8435,7 +8435,7 @@ upgrade: ${upgrade}\r throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } @@ -8443,14 +8443,14 @@ upgrade: ${upgrade}\r } catch (err) { h2stream.destroy(err); } finally { - request2.onRequestSent(); + request4.onRequestSent(); h2stream.end(); h2stream.off("close", onDrain).off("drain", onDrain); } return; } socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -8468,9 +8468,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -8479,7 +8479,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -8518,7 +8518,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -8529,8 +8529,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -8573,10 +8573,10 @@ ${len.toString(16)}\r } } }; - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert(request2.aborted); + request4.onError(err); + assert(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -9671,10 +9671,10 @@ var require_api_request = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -9689,7 +9689,7 @@ var require_api_request = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -10403,7 +10403,7 @@ var require_mock_utils = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (typeof data === "object") { @@ -10508,7 +10508,7 @@ var require_mock_utils = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); handler2.abort = nop; @@ -10565,7 +10565,7 @@ var require_mock_utils = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -10587,7 +10587,7 @@ var require_mock_utils = __commonJS({ var require_mock_interceptor = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils(); var { kDispatches, kDispatchKey, @@ -10650,7 +10650,7 @@ var require_mock_interceptor = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData(statusCode, data, responseOptions = {}) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -12299,7 +12299,7 @@ var require_request2 = __commonJS({ policyContainer: makePolicyContainer() } }; - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = this[kRealm].settingsObject.baseUrl; let signal = null; @@ -12315,17 +12315,17 @@ var require_request2 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(input instanceof Request); - request2 = input[kState]; + request4 = input[kState]; signal = input[kSignal]; } const origin = this[kRealm].settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request4.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -12333,43 +12333,43 @@ var require_request2 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: this[kRealm].settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -12378,14 +12378,14 @@ var require_request2 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, this[kRealm].settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -12400,27 +12400,27 @@ var require_request2 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; @@ -12431,12 +12431,12 @@ var require_request2 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizeMethodRecord[method] ?? normalizeMethod(method); - request2.method = method; + request4.method = method; } if (init.signal !== void 0) { signal = init.signal; } - this[kState] = request2; + this[kState] = request4; const ac = new AbortController(); this[kSignal] = ac.signal; this[kSignal][kRealm] = this[kRealm]; @@ -12470,13 +12470,13 @@ var require_request2 = __commonJS({ } } this[kHeaders] = new Headers(kConstruct); - this[kHeaders][kHeadersList] = request2.headersList; + this[kHeaders][kHeadersList] = request4.headersList; this[kHeaders][kGuard] = "request"; this[kHeaders][kRealm] = this[kRealm]; if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } this[kHeaders][kGuard] = "request-no-cors"; @@ -12495,14 +12495,14 @@ var require_request2 = __commonJS({ } } const inputBody = input instanceof Request ? input[kState].body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !this[kHeaders][kHeadersList].contains("content-type")) { @@ -12514,12 +12514,12 @@ var require_request2 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -12649,7 +12649,7 @@ var require_request2 = __commonJS({ }; mixinBody(Request); function makeRequest(init) { - const request2 = { + const request4 = { method: "GET", localURLsOnly: false, unsafeRequest: false, @@ -12688,13 +12688,13 @@ var require_request2 = __commonJS({ ...init, headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; - request2.url = request2.urlList[0]; - return request2; + request4.url = request4.urlList[0]; + return request4; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(request4.body); } return newRequest; } @@ -12924,14 +12924,14 @@ var require_fetch = __commonJS({ p.reject(e); return p.promise; } - const request2 = requestObject[kState]; + const request4 = requestObject[kState]; if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; const relevantRealm = null; @@ -12943,7 +12943,7 @@ var require_fetch = __commonJS({ locallyAborted = true; assert(controller != null); controller.abort(requestObject.signal.reason); - abortFetch(p, request2, responseObject, requestObject.signal.reason); + abortFetch(p, request4, responseObject, requestObject.signal.reason); } ); const handleFetchDone = (response) => finalizeAndReportTiming(response, "fetch"); @@ -12952,7 +12952,7 @@ var require_fetch = __commonJS({ return Promise.resolve(); } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return Promise.resolve(); } if (response.type === "error") { @@ -12970,7 +12970,7 @@ var require_fetch = __commonJS({ p.resolve(responseObject); }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: init.dispatcher ?? getGlobalDispatcher() @@ -13015,14 +13015,14 @@ var require_fetch = __commonJS({ performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis2, cacheState); } } - function abortFetch(p, request2, responseObject, error) { + function abortFetch(p, request4, responseObject, error) { var _a, _b; if (!error) { error = new DOMException2("The operation was aborted.", "AbortError"); } p.reject(error); - if (request2.body != null && isReadable((_a = request2.body) == null ? void 0 : _a.stream)) { - request2.body.stream.cancel(error).catch((err) => { + if (request4.body != null && isReadable((_a = request4.body) == null ? void 0 : _a.stream)) { + request4.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -13043,7 +13043,7 @@ var require_fetch = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -13055,9 +13055,9 @@ var require_fetch = __commonJS({ var _a, _b, _c, _d; let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currenTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -13065,7 +13065,7 @@ var require_fetch = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -13075,32 +13075,32 @@ var require_fetch = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a = request4.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = (_d = request2.client) == null ? void 0 : _d.origin; + if (request4.origin === "client") { + request4.origin = (_d = request4.client) == null ? void 0 : _d.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept")) { + if (!request4.headersList.contains("accept")) { const value = "*/*"; - request2.headersList.append("accept", value); + request4.headersList.append("accept", value); } - if (!request2.headersList.contains("accept-language")) { - request2.headersList.append("accept-language", "*"); + if (!request4.headersList.contains("accept-language")) { + request4.headersList.append("accept-language", "*"); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -13108,44 +13108,44 @@ var require_fetch = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { response = await (async () => { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; return await schemeFetch(fetchParams); } - if (request2.mode === "same-origin") { + if (request4.mode === "same-origin") { return makeNetworkError('request mode cannot be "same-origin"'); } - if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { return makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; return await schemeFetch(fetchParams); } - if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { return makeNetworkError("URL scheme must be a HTTP(S) scheme"); } - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; return await httpFetch(fetchParams); })(); } @@ -13153,13 +13153,13 @@ var require_fetch = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -13167,26 +13167,26 @@ var require_fetch = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range")) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range")) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -13202,8 +13202,8 @@ var require_fetch = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -13212,12 +13212,12 @@ var require_fetch = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blobURLEntryObject = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !isBlobLike(blobURLEntryObject)) { + if (request4.method !== "GET" || !isBlobLike(blobURLEntryObject)) { return Promise.resolve(makeNetworkError("invalid method")); } const bodyWithType = safelyExtractBody(blobURLEntryObject); @@ -13235,7 +13235,7 @@ var require_fetch = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -13317,41 +13317,41 @@ var require_fetch = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -13361,13 +13361,13 @@ var require_fetch = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -13378,63 +13378,63 @@ var require_fetch = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization"); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie"); - request2.headersList.delete("host"); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization"); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie"); + request4.headersList.delete("host"); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = makeRequest(request2); + httpRequest = makeRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -13511,7 +13511,7 @@ var require_fetch = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -13519,7 +13519,7 @@ var require_fetch = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -13547,21 +13547,21 @@ var require_fetch = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -13590,7 +13590,7 @@ var require_fetch = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -13702,17 +13702,17 @@ var require_fetch = __commonJS({ } return response; async function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: fetchParams.controller.dispatcher.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: fetchParams.controller.dispatcher.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -13758,8 +13758,8 @@ var require_fetch = __commonJS({ } this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = request2.redirect === "follow" && location && redirectStatusSet.has(status); - if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = request4.redirect === "follow" && location && redirectStatusSet.has(status); + if (request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (const coding of codings) { if (coding === "x-gzip" || coding === "gzip") { decoders.push(zlib.createGunzip({ @@ -14693,36 +14693,36 @@ var require_cache = __commonJS({ } this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); - const p = await this.matchAll(request2, options); + const p = await this.matchAll(request4, options); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { var _a; webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -14744,11 +14744,11 @@ var require_cache = __commonJS({ } return Object.freeze(responseList); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.add" }); - request2 = webidl.converters.RequestInfo(request2); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -14758,11 +14758,11 @@ var require_cache = __commonJS({ requests = webidl.converters["sequence"](requests); const responsePromises = []; const requestList = []; - for (const request2 of requests) { - if (typeof request2 === "string") { + for (const request4 of requests) { + if (typeof request4 === "string") { continue; } - const r = request2[kState]; + const r = request4[kState]; if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14771,8 +14771,8 @@ var require_cache = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = new Request(request2)[kState]; + for (const request4 of requests) { + const r = new Request(request4)[kState]; if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14847,16 +14847,16 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 2, { header: "Cache.put" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); response = webidl.converters.Response(response); let innerRequest = null; - if (request2 instanceof Request) { - innerRequest = request2[kState]; + if (request4 instanceof Request) { + innerRequest = request4[kState]; } else { - innerRequest = new Request(request2)[kState]; + innerRequest = new Request(request4)[kState]; } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -14924,20 +14924,20 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.delete" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = new Request(request2)[kState]; + assert(typeof request4 === "string"); + r = new Request(request4)[kState]; } const operations = []; const operation = { @@ -14963,25 +14963,25 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -14993,12 +14993,12 @@ var require_cache = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = new Request("https://a"); - requestObject[kState] = request3; - requestObject[kHeaders][kHeadersList] = request3.headersList; + requestObject[kState] = request5; + requestObject[kHeaders][kHeadersList] = request5.headersList; requestObject[kHeaders][kGuard] = "immutable"; - requestObject[kRealm] = request3.client; + requestObject[kRealm] = request5.client; requestList.push(requestObject); } promise.resolve(Object.freeze(requestList)); @@ -15093,9 +15093,9 @@ var require_cache = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -15111,7 +15111,7 @@ var require_cache = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -15183,21 +15183,21 @@ var require_cachestorage = __commonJS({ webidl.illegalConstructor(); } } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, { header: "CacheStorage.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -16110,7 +16110,7 @@ var require_connection = __commonJS({ function establishWebSocketConnection(url, protocols, ws, onEstablish, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], serviceWorkers: "none", referrer: "no-referrer", @@ -16121,17 +16121,17 @@ var require_connection = __commonJS({ }); if (options.headers) { const headersList = new Headers(options.headers)[kHeadersList]; - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue); - request2.headersList.append("sec-websocket-version", "13"); + request4.headersList.append("sec-websocket-key", keyValue); + request4.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol); + request4.headersList.append("sec-websocket-protocol", protocol); } const permessageDeflate = ""; const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher ?? getGlobalDispatcher(), processResponse(response) { @@ -16164,7 +16164,7 @@ var require_connection = __commonJS({ return; } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); - if (secProtocol !== null && secProtocol !== request2.headersList.get("Sec-WebSocket-Protocol")) { + if (secProtocol !== null && secProtocol !== request4.headersList.get("Sec-WebSocket-Protocol")) { failWebsocketConnection(ws, "Protocol was not set in the opening handshake."); return; } @@ -17209,7 +17209,7 @@ var require_lib = __commonJS({ } exports.isHttps = isHttps; var HttpClient = class { - constructor(userAgent2, handlers, requestOptions) { + constructor(userAgent4, handlers, requestOptions) { this._ignoreSslError = false; this._allowRedirects = true; this._allowRedirectDowngrade = false; @@ -17218,7 +17218,7 @@ var require_lib = __commonJS({ this._maxRetries = 1; this._keepAlive = false; this._disposed = false; - this.userAgent = userAgent2; + this.userAgent = userAgent4; this.handlers = handlers || []; this.requestOptions = requestOptions; if (requestOptions) { @@ -17483,14 +17483,14 @@ var require_lib = __commonJS({ } _mergeHeaders(headers) { if (this.requestOptions && this.requestOptions.headers) { - return Object.assign({}, lowercaseKeys2(this.requestOptions.headers), lowercaseKeys2(headers || {})); + return Object.assign({}, lowercaseKeys4(this.requestOptions.headers), lowercaseKeys4(headers || {})); } - return lowercaseKeys2(headers || {}); + return lowercaseKeys4(headers || {}); } _getExistingOrDefaultHeader(additionalHeaders, header, _default) { let clientHeader; if (this.requestOptions && this.requestOptions.headers) { - clientHeader = lowercaseKeys2(this.requestOptions.headers)[header]; + clientHeader = lowercaseKeys4(this.requestOptions.headers)[header]; } return additionalHeaders[header] || clientHeader || _default; } @@ -17625,7 +17625,7 @@ var require_lib = __commonJS({ } }; exports.HttpClient = HttpClient; - var lowercaseKeys2 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + var lowercaseKeys4 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); } }); @@ -20462,10 +20462,10 @@ var require_util8 = __commonJS({ } return obj; } - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert(request2.aborted); + request4.onError(err); + assert(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -20993,7 +20993,7 @@ var require_request3 = __commonJS({ return this; } }; - function processHeader(request2, key, val) { + function processHeader(request4, key, val) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { @@ -21032,19 +21032,19 @@ var require_request3 = __commonJS({ } else { val = `${val}`; } - if (request2.host === null && headerName === "host") { + if (request4.host === null && headerName === "host") { if (typeof val !== "string") { throw new InvalidArgumentError("invalid host header"); } - request2.host = val; - } else if (request2.contentLength === null && headerName === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && headerName === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && headerName === "content-type") { - request2.contentType = val; - request2.headers.push(key, val); + } else if (request4.contentType === null && headerName === "content-type") { + request4.contentType = val; + request4.headers.push(key, val); } else if (headerName === "transfer-encoding" || headerName === "keep-alive" || headerName === "upgrade") { throw new InvalidArgumentError(`invalid ${headerName} header`); } else if (headerName === "connection") { @@ -21053,12 +21053,12 @@ var require_request3 = __commonJS({ throw new InvalidArgumentError("invalid connection header"); } if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (headerName === "expect") { throw new NotSupportedError("expect header not supported"); } else { - request2.headers.push(key, val); + request4.headers.push(key, val); } } module.exports = Request; @@ -23371,11 +23371,11 @@ var require_util9 = __commonJS({ function normalizeBinaryStringToUtf8(value) { return Buffer.from(value, "binary").toString("utf8"); } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -23412,10 +23412,10 @@ var require_util9 = __commonJS({ } return policy; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const policy = parseReferrerPolicy(actualResponse); if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -23432,33 +23432,33 @@ var require_util9 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header, true); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; if (serializedOrigin === "client" || serializedOrigin === void 0) { return; } - if (request2.responseTainting === "cors" || request2.mode === "websocket") { - request2.headersList.append("origin", serializedOrigin, true); - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + if (request4.responseTainting === "cors" || request4.mode === "websocket") { + request4.headersList.append("origin", serializedOrigin, true); + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } - request2.headersList.append("origin", serializedOrigin, true); + request4.headersList.append("origin", serializedOrigin, true); } } function coarsenTime(timestamp, crossOriginIsolatedCapability) { @@ -23512,18 +23512,18 @@ var require_util9 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (webidl.is.URL(request2.referrer)) { - referrerSource = request2.referrer; + } else if (webidl.is.URL(request4.referrer)) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); @@ -23541,14 +23541,14 @@ var require_util9 = __commonJS({ case "unsafe-url": return referrerURL; case "strict-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } return referrerOrigin; } case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -23558,17 +23558,17 @@ var require_util9 = __commonJS({ return referrerOrigin; } case "same-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return "no-referrer"; case "origin-when-cross-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return referrerOrigin; case "no-referrer-when-downgrade": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } @@ -23732,7 +23732,7 @@ var require_util9 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -25205,11 +25205,11 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } - request2.onResponseStarted(); + request4.onResponseStarted(); return 0; } onHeaderField(buf) { @@ -25257,9 +25257,9 @@ var require_client_h1 = __commonJS({ assert(!socket.destroyed); assert(!this.paused); assert((headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); - assert(request2.upgrade || request2.method === "CONNECT"); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); + assert(request4.upgrade || request4.method === "CONNECT"); this.statusCode = 0; this.statusText = ""; this.shouldKeepAlive = false; @@ -25276,7 +25276,7 @@ var require_client_h1 = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -25287,8 +25287,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert(!this.upgrade); @@ -25297,22 +25297,22 @@ var require_client_h1 = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert(this.timeoutType === TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -25343,11 +25343,11 @@ var require_client_h1 = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -25364,8 +25364,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(this.timeoutType === TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -25378,7 +25378,7 @@ var require_client_h1 = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } return 0; @@ -25393,8 +25393,8 @@ var require_client_h1 = __commonJS({ } assert(statusCode >= 100); assert((this.headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); this.statusCode = 0; this.statusText = ""; this.bytesRead = 0; @@ -25406,11 +25406,11 @@ var require_client_h1 = __commonJS({ if (statusCode < 200) { return 0; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert(client[kRunning] === 0); @@ -25476,8 +25476,8 @@ var require_client_h1 = __commonJS({ return { version: "h1", defaultPipelining: 1, - write(request2) { - return writeH1(client, request2); + write(request4) { + return writeH1(client, request4); }, resume() { resumeH1(client); @@ -25493,18 +25493,18 @@ var require_client_h1 = __commonJS({ get destroyed() { return socket.destroyed; }, - busy(request2) { + busy(request4) { if (socket[kWriting] || socket[kReset] || socket[kBlocking]) { return true; } - if (request2) { - if (client[kRunning] > 0 && !request2.idempotent) { + if (request4) { + if (client[kRunning] > 0 && !request4.idempotent) { return true; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return true; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body) || util.isFormDataLike(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body) || util.isFormDataLike(request4.body))) { return true; } } @@ -25551,13 +25551,13 @@ var require_client_h1 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -25585,8 +25585,8 @@ var require_client_h1 = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request2 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request2.headersTimeout != null ? request2.headersTimeout : client[kHeadersTimeout]; + const request4 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request4.headersTimeout != null ? request4.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -25595,21 +25595,21 @@ var require_client_h1 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH1(client, request2) { - const { method, path, host, upgrade, blocking, reset } = request2; - let { body, headers, contentLength } = request2; + function writeH1(client, request4) { + const { method, path, host, upgrade, blocking, reset } = request4; + let { body, headers, contentLength } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH"; if (util.isFormDataLike(body)) { if (!extractBody) { extractBody = require_body2().extractBody; } const [bodyStream, contentType] = extractBody(body); - if (request2.contentType == null) { + if (request4.contentType == null) { headers.push("content-type", contentType); } body = bodyStream.stream; contentLength = bodyStream.length; - } else if (util.isBlobLike(body) && request2.contentType == null && body.type) { + } else if (util.isBlobLike(body) && request4.contentType == null && body.type) { headers.push("content-type", body.type); } if (body && typeof body.read === "function") { @@ -25618,33 +25618,33 @@ var require_client_h1 = __commonJS({ const bodyLength = util.bodyLength(body); contentLength = bodyLength ?? contentLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - util.errorRequest(client, request2, err || new RequestAbortedError()); + util.errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(body); util.destroy(socket, new InformationalError("aborted")); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -25695,31 +25695,31 @@ upgrade: ${upgrade}\r } } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { - writeBuffer(abort, null, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, null, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBuffer(body)) { - writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable(abort, body.stream(), client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body.stream(), client, request4, socket, contentLength, header, expectsPayload); } else { - writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload); } } else if (util.isStream(body)) { - writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isIterable(body)) { - writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else { assert(false); } return true; } - function writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); let finished = false; - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -25785,7 +25785,7 @@ upgrade: ${upgrade}\r setImmediate(onClose); } } - function writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload) { try { if (!body) { if (contentLength === 0) { @@ -25805,18 +25805,18 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(body); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (err) { abort(err); } } - async function writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -25829,9 +25829,9 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(buffer); socket.uncork(); - request2.onBodySent(buffer); - request2.onRequestSent(); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(buffer); + request4.onRequestSent(); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } client[kResume](); @@ -25839,7 +25839,7 @@ upgrade: ${upgrade}\r abort(err); } } - async function writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -25858,7 +25858,7 @@ upgrade: ${upgrade}\r } }); socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -25876,9 +25876,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ abort, socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ abort, socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -25888,7 +25888,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -25907,7 +25907,7 @@ upgrade: ${upgrade}\r } socket.cork(); if (bytesWritten === 0) { - if (!expectsPayload && request2.reset !== false) { + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } if (contentLength === null) { @@ -25927,7 +25927,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -25938,8 +25938,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -26082,8 +26082,8 @@ var require_client_h2 = __commonJS({ return { version: "h2", defaultPipelining: Infinity, - write(request2) { - return writeH2(client, request2); + write(request4) { + return writeH2(client, request4); }, resume() { resumeH2(client); @@ -26141,9 +26141,9 @@ var require_client_h2 = __commonJS({ this[kHTTP2Session] = null; util.destroy(this[kSocket], err); if (client[kRunningIdx] < client[kQueue].length) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); client[kPendingIdx] = client[kRunningIdx]; } assert(client[kRunning] === 0); @@ -26160,8 +26160,8 @@ var require_client_h2 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } } @@ -26192,13 +26192,13 @@ var require_client_h2 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH2(client, request2) { - const requestTimeout = request2.bodyTimeout ?? client[kBodyTimeout]; + function writeH2(client, request4) { + const requestTimeout = request4.bodyTimeout ?? client[kBodyTimeout]; const session = client[kHTTP2Session]; - const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; - let { body } = request2; + const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; + let { body } = request4; if (upgrade) { - util.errorRequest(client, request2, new Error("Upgrade not supported for H2")); + util.errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } const headers = {}; @@ -26222,11 +26222,11 @@ var require_client_h2 = __commonJS({ headers[HTTP2_HEADER_AUTHORITY] = host || `${hostname}${port ? `:${port}` : ""}`; headers[HTTP2_HEADER_METHOD] = method; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } err = err || new RequestAbortedError(); - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); if (stream != null) { stream.removeAllListeners("data"); stream.close(); @@ -26236,23 +26236,23 @@ var require_client_h2 = __commonJS({ util.destroy(body, err); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "CONNECT") { session.ref(); stream = session.request(headers, { endStream: false, signal }); if (!stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; }); @@ -26280,14 +26280,14 @@ var require_client_h2 = __commonJS({ contentLength = bodyStream.length; } if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -26303,7 +26303,7 @@ var require_client_h2 = __commonJS({ header += `${key}: ${headers[key]}\r `; } - channels.sendHeaders.publish({ request: request2, headers: header, socket: session[kSocket] }); + channels.sendHeaders.publish({ request: request4, headers: header, socket: session[kSocket] }); } const shouldEndStream = method === "GET" || method === "HEAD" || body === null; if (expectContinue) { @@ -26321,17 +26321,17 @@ var require_client_h2 = __commonJS({ stream.setTimeout(requestTimeout); stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - request2.onResponseStarted(); - if (request2.aborted) { + request4.onResponseStarted(); + if (request4.aborted) { stream.removeAllListeners("data"); return; } - if (request2.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -26339,8 +26339,8 @@ var require_client_h2 = __commonJS({ var _a; stream.removeAllListeners("data"); if (((_a = stream.state) == null ? void 0 : _a.state) == null || stream.state.state < 6) { - if (!request2.aborted && !request2.completed) { - request2.onComplete({}); + if (!request4.aborted && !request4.completed) { + request4.onComplete({}); } client[kQueue][client[kRunningIdx]++] = null; client[kResume](); @@ -26383,10 +26383,10 @@ var require_client_h2 = __commonJS({ abort(err); }); stream.once("trailers", (trailers) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - request2.onComplete(trailers); + request4.onComplete(trailers); }); return true; function writeBodyH2() { @@ -26396,7 +26396,7 @@ var require_client_h2 = __commonJS({ stream, null, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26407,7 +26407,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26419,7 +26419,7 @@ var require_client_h2 = __commonJS({ stream, body.stream(), client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26430,7 +26430,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26444,7 +26444,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, contentLength ); } else if (util.isIterable(body)) { @@ -26453,7 +26453,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26463,7 +26463,7 @@ var require_client_h2 = __commonJS({ } } } - function writeBuffer(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + function writeBuffer(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { try { if (body != null && util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); @@ -26471,18 +26471,18 @@ var require_client_h2 = __commonJS({ h2stream.write(body); h2stream.uncork(); h2stream.end(); - request2.onBodySent(body); + request4.onBodySent(body); } if (!expectsPayload) { socket[kReset] = true; } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (error) { abort(error); } } - function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) { + function writeStream(abort, socket, expectsPayload, h2stream, body, client, request4, contentLength) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); const pipe = pipeline( body, @@ -26493,7 +26493,7 @@ var require_client_h2 = __commonJS({ abort(err); } else { util.removeAllListeners(pipe); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26503,10 +26503,10 @@ var require_client_h2 = __commonJS({ ); util.addListener(pipe, "data", onPipeData); function onPipeData(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); } } - async function writeBlob(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeBlob(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -26517,8 +26517,8 @@ var require_client_h2 = __commonJS({ h2stream.write(buffer); h2stream.uncork(); h2stream.end(); - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26527,7 +26527,7 @@ var require_client_h2 = __commonJS({ abort(err); } } - async function writeIterable(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeIterable(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -26552,13 +26552,13 @@ var require_client_h2 = __commonJS({ throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } } h2stream.end(); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26805,10 +26805,10 @@ var require_client2 = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = new Request(origin, opts, handler2); - this[kQueue].push(request2); + const request4 = new Request(origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; queueMicrotask(() => resume(this)); } else { @@ -26832,8 +26832,8 @@ var require_client2 = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(this, request2, err); + const request4 = requests[i]; + util.errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -26857,8 +26857,8 @@ var require_client2 = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } assert(client[kSize] === 0); } @@ -26962,8 +26962,8 @@ var require_client2 = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - util.errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + util.errorRequest(client, request4, err); } } else { onError(client, err); @@ -27021,12 +27021,12 @@ var require_client2 = __commonJS({ if (client[kRunning] >= (getPipelining(client) || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; + client[kServerName] = request4.servername; (_a = client[kHTTPContext]) == null ? void 0 : _a.destroy(new InformationalError("servername changed"), () => { client[kHTTPContext] = null; resume(client); @@ -27042,10 +27042,10 @@ var require_client2 = __commonJS({ if (client[kHTTPContext].destroyed) { return; } - if (client[kHTTPContext].busy(request2)) { + if (client[kHTTPContext].busy(request4)) { return; } - if (!request2.aborted && client[kHTTPContext].write(request2)) { + if (!request4.aborted && client[kHTTPContext].write(request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -28659,10 +28659,10 @@ var require_api_request2 = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -28678,7 +28678,7 @@ var require_api_request2 = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -29444,7 +29444,7 @@ var require_mock_utils2 = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (data instanceof Uint8Array) { @@ -29577,7 +29577,7 @@ var require_mock_utils2 = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); (_a = handler2.onConnect) == null ? void 0 : _a.call(handler2, (err) => handler2.onError(err), null); @@ -29634,7 +29634,7 @@ var require_mock_utils2 = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -29657,7 +29657,7 @@ var require_mock_utils2 = __commonJS({ var require_mock_interceptor2 = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils2(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils2(); var { kDispatches, kDispatchKey, @@ -29722,7 +29722,7 @@ var require_mock_interceptor2 = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData({ statusCode, data, responseOptions }) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -32022,7 +32022,7 @@ var require_sqlite_cache_store = __commonJS({ var { Writable } = __require("stream"); var { assertCacheKey, assertCacheValue } = require_cache2(); var DatabaseSync; - var VERSION13 = 3; + var VERSION17 = 3; var MAX_ENTRY_SIZE = 2 * 1e3 * 1e3 * 1e3; module.exports = class SqliteCacheStore { #maxEntrySize = MAX_ENTRY_SIZE; @@ -32061,7 +32061,7 @@ var require_sqlite_cache_store = __commonJS({ } this.#db = new DatabaseSync((opts == null ? void 0 : opts.location) ?? ":memory:"); this.#db.exec(` - CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION13} ( + CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION17} ( -- Data specific to us id INTEGER PRIMARY KEY AUTOINCREMENT, url TEXT NOT NULL, @@ -32080,9 +32080,9 @@ var require_sqlite_cache_store = __commonJS({ staleAt INTEGER NOT NULL ); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_url ON cacheInterceptorV${VERSION13}(url); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_method ON cacheInterceptorV${VERSION13}(method); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_deleteAt ON cacheInterceptorV${VERSION13}(deleteAt); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_url ON cacheInterceptorV${VERSION17}(url); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_method ON cacheInterceptorV${VERSION17}(method); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_deleteAt ON cacheInterceptorV${VERSION17}(deleteAt); `); this.#getValuesQuery = this.#db.prepare(` SELECT @@ -32097,7 +32097,7 @@ var require_sqlite_cache_store = __commonJS({ vary, cachedAt, staleAt - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION17} WHERE url = ? AND method = ? @@ -32105,7 +32105,7 @@ var require_sqlite_cache_store = __commonJS({ deleteAt ASC `); this.#updateValueQuery = this.#db.prepare(` - UPDATE cacheInterceptorV${VERSION13} SET + UPDATE cacheInterceptorV${VERSION17} SET body = ?, deleteAt = ?, statusCode = ?, @@ -32119,7 +32119,7 @@ var require_sqlite_cache_store = __commonJS({ id = ? `); this.#insertValueQuery = this.#db.prepare(` - INSERT INTO cacheInterceptorV${VERSION13} ( + INSERT INTO cacheInterceptorV${VERSION17} ( url, method, body, @@ -32135,20 +32135,20 @@ var require_sqlite_cache_store = __commonJS({ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `); this.#deleteByUrlQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE url = ?` + `DELETE FROM cacheInterceptorV${VERSION17} WHERE url = ?` ); this.#countEntriesQuery = this.#db.prepare( - `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION13}` + `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION17}` ); this.#deleteExpiredValuesQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE deleteAt <= ?` + `DELETE FROM cacheInterceptorV${VERSION17} WHERE deleteAt <= ?` ); this.#deleteOldValuesQuery = this.#maxCount === Infinity ? null : this.#db.prepare(` - DELETE FROM cacheInterceptorV${VERSION13} + DELETE FROM cacheInterceptorV${VERSION17} WHERE id IN ( SELECT id - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION17} ORDER BY cachedAt DESC LIMIT ? ) @@ -33239,7 +33239,7 @@ var require_request4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); input = webidl.converters.RequestInfo(input, prefix, "input"); init = webidl.converters.RequestInit(init, prefix, "init"); - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = environmentSettingsObject.settingsObject.baseUrl; let signal = null; @@ -33256,18 +33256,18 @@ var require_request4 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(webidl.is.Request(input)); - request2 = input.#state; + request4 = input.#state; signal = input.#signal; this.#dispatcher = init.dispatcher || input.#dispatcher; } const origin = environmentSettingsObject.settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request4.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -33275,43 +33275,43 @@ var require_request4 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: environmentSettingsObject.settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -33320,14 +33320,14 @@ var require_request4 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, environmentSettingsObject.settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -33342,33 +33342,33 @@ var require_request4 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; const mayBeNormalized = normalizedMethodRecords[method]; if (mayBeNormalized !== void 0) { - request2.method = mayBeNormalized; + request4.method = mayBeNormalized; } else { if (!isValidHTTPToken(method)) { throw new TypeError(`'${method}' is not a valid HTTP method.`); @@ -33378,9 +33378,9 @@ var require_request4 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizedMethodRecordsBase[upperCase] ?? method; - request2.method = method; + request4.method = method; } - if (!patchMethodWarning && request2.method === "patch") { + if (!patchMethodWarning && request4.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" }); @@ -33390,7 +33390,7 @@ var require_request4 = __commonJS({ if (init.signal !== void 0) { signal = init.signal; } - this.#state = request2; + this.#state = request4; const ac = new AbortController(); this.#signal = ac.signal; if (signal != null) { @@ -33411,12 +33411,12 @@ var require_request4 = __commonJS({ } } this.#headers = new Headers(kConstruct); - setHeadersList(this.#headers, request2.headersList); + setHeadersList(this.#headers, request4.headersList); setHeadersGuard(this.#headers, "request"); if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } setHeadersGuard(this.#headers, "request-no-cors"); @@ -33435,14 +33435,14 @@ var require_request4 = __commonJS({ } } const inputBody = webidl.is.Request(input) ? input.#state.body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !getHeadersList(this.#headers).contains("content-type", true)) { @@ -33454,12 +33454,12 @@ var require_request4 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -33604,24 +33604,24 @@ var require_request4 = __commonJS({ }; return `Request ${nodeUtil.formatWithOptions(options, properties)}`; } - static setRequestSignal(request2, newSignal) { - request2.#signal = newSignal; - return request2; + static setRequestSignal(request4, newSignal) { + request4.#signal = newSignal; + return request4; } - static getRequestDispatcher(request2) { - return request2.#dispatcher; + static getRequestDispatcher(request4) { + return request4.#dispatcher; } - static setRequestDispatcher(request2, newDispatcher) { - request2.#dispatcher = newDispatcher; + static setRequestDispatcher(request4, newDispatcher) { + request4.#dispatcher = newDispatcher; } - static setRequestHeaders(request2, newHeaders) { - request2.#headers = newHeaders; + static setRequestHeaders(request4, newHeaders) { + request4.#headers = newHeaders; } - static getRequestState(request2) { - return request2.#state; + static getRequestState(request4) { + return request4.#state; } - static setRequestState(request2, newState) { - request2.#state = newState; + static setRequestState(request4, newState) { + request4.#state = newState; } }; var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState } = Request; @@ -33674,23 +33674,23 @@ var require_request4 = __commonJS({ headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(newRequest, request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(newRequest, request4.body); } return newRequest; } function fromInnerRequest(innerRequest, dispatcher, signal, guard) { - const request2 = new Request(kConstruct); - setRequestState(request2, innerRequest); - setRequestDispatcher(request2, dispatcher); - setRequestSignal(request2, signal); + const request4 = new Request(kConstruct); + setRequestState(request4, innerRequest); + setRequestDispatcher(request4, dispatcher); + setRequestSignal(request4, signal); const headers = new Headers(kConstruct); - setRequestHeaders(request2, headers); + setRequestHeaders(request4, headers); setHeadersList(headers, innerRequest.headersList); setHeadersGuard(headers, guard); - return request2; + return request4; } Object.defineProperties(Request.prototype, { method: kEnumerableProperty, @@ -33928,14 +33928,14 @@ var require_fetch2 = __commonJS({ p.reject(e); return p.promise; } - const request2 = getRequestState(requestObject); + const request4 = getRequestState(requestObject); if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; let locallyAborted = false; @@ -33947,7 +33947,7 @@ var require_fetch2 = __commonJS({ assert(controller != null); controller.abort(requestObject.signal.reason); const realResponse = responseObject == null ? void 0 : responseObject.deref(); - abortFetch(p, request2, realResponse, requestObject.signal.reason); + abortFetch(p, request4, realResponse, requestObject.signal.reason); } ); const processResponse = (response) => { @@ -33955,7 +33955,7 @@ var require_fetch2 = __commonJS({ return; } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return; } if (response.type === "error") { @@ -33967,7 +33967,7 @@ var require_fetch2 = __commonJS({ p = null; }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: getRequestDispatcher(requestObject) @@ -34008,13 +34008,13 @@ var require_fetch2 = __commonJS({ ); } var markResourceTiming = performance.markResourceTiming; - function abortFetch(p, request2, responseObject, error) { + function abortFetch(p, request4, responseObject, error) { var _a, _b; if (p) { p.reject(error); } - if (((_a = request2.body) == null ? void 0 : _a.stream) != null && isReadable(request2.body.stream)) { - request2.body.stream.cancel(error).catch((err) => { + if (((_a = request4.body) == null ? void 0 : _a.stream) != null && isReadable(request4.body.stream)) { + request4.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -34035,7 +34035,7 @@ var require_fetch2 = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -34048,9 +34048,9 @@ var require_fetch2 = __commonJS({ assert(dispatcher); let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currentTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -34058,7 +34058,7 @@ var require_fetch2 = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -34068,32 +34068,32 @@ var require_fetch2 = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a = request4.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = request2.client.origin; + if (request4.origin === "client") { + request4.origin = request4.client.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept", true)) { + if (!request4.headersList.contains("accept", true)) { const value = "*/*"; - request2.headersList.append("accept", value, true); + request4.headersList.append("accept", value, true); } - if (!request2.headersList.contains("accept-language", true)) { - request2.headersList.append("accept-language", "*", true); + if (!request4.headersList.contains("accept-language", true)) { + request4.headersList.append("accept-language", "*", true); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -34101,41 +34101,41 @@ var require_fetch2 = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; response = await schemeFetch(fetchParams); - } else if (request2.mode === "same-origin") { + } else if (request4.mode === "same-origin") { response = makeNetworkError('request mode cannot be "same-origin"'); - } else if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + } else if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { response = makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } else { - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; response = await schemeFetch(fetchParams); } - } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { response = makeNetworkError("URL scheme must be a HTTP(S) scheme"); } else { - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; response = await httpFetch(fetchParams); } } @@ -34143,13 +34143,13 @@ var require_fetch2 = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -34157,26 +34157,26 @@ var require_fetch2 = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range", true)) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range", true)) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -34192,8 +34192,8 @@ var require_fetch2 = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -34202,19 +34202,19 @@ var require_fetch2 = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("node:buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blob = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !webidl.is.Blob(blob)) { + if (request4.method !== "GET" || !webidl.is.Blob(blob)) { return Promise.resolve(makeNetworkError("invalid method")); } const response = makeResponse(); const fullLength = blob.size; const serializedFullLength = isomorphicEncode(`${fullLength}`); const type = blob.type; - if (!request2.headersList.contains("range", true)) { + if (!request4.headersList.contains("range", true)) { const bodyWithType = extractBody(blob); response.statusText = "OK"; response.body = bodyWithType[0]; @@ -34222,7 +34222,7 @@ var require_fetch2 = __commonJS({ response.headersList.set("content-type", type, true); } else { response.rangeRequested = true; - const rangeHeader = request2.headersList.get("range", true); + const rangeHeader = request4.headersList.get("range", true); const rangeValue = simpleRangeHeaderValue(rangeHeader, true); if (rangeValue === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34253,7 +34253,7 @@ var require_fetch2 = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34342,41 +34342,41 @@ var require_fetch2 = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(void 0, false); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -34386,13 +34386,13 @@ var require_fetch2 = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -34403,63 +34403,63 @@ var require_fetch2 = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization", true); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie", true); - request2.headersList.delete("host", true); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization", true); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie", true); + request4.headersList.delete("host", true); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = cloneRequest(request2); + httpRequest = cloneRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -34536,7 +34536,7 @@ var require_fetch2 = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -34544,7 +34544,7 @@ var require_fetch2 = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -34574,21 +34574,21 @@ var require_fetch2 = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -34617,7 +34617,7 @@ var require_fetch2 = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -34728,17 +34728,17 @@ var require_fetch2 = __commonJS({ } return response; function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: agent.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -34774,8 +34774,8 @@ var require_fetch2 = __commonJS({ location = headersList.get("location", true); this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status); - if (codings.length !== 0 && request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = location && request4.redirect === "follow" && redirectStatusSet.has(status); + if (codings.length !== 0 && request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (let i = codings.length - 1; i >= 0; --i) { const coding = codings[i]; if (coding === "x-gzip" || coding === "gzip") { @@ -34917,32 +34917,32 @@ var require_cache4 = __commonJS({ webidl.util.markAsUncloneable(this); this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.match"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - const p = this.#internalMatchAll(request2, options, 1); + const p = this.#internalMatchAll(request4, options, 1); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.matchAll"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - return this.#internalMatchAll(request2, options); + return this.#internalMatchAll(request4, options); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); const prefix = "Cache.add"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -34952,19 +34952,19 @@ var require_cache4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); const responsePromises = []; const requestList = []; - for (let request2 of requests) { - if (request2 === void 0) { + for (let request4 of requests) { + if (request4 === void 0) { throw webidl.errors.conversionFailed({ prefix, argument: "Argument 1", types: ["undefined is not allowed"] }); } - request2 = webidl.converters.RequestInfo(request2); - if (typeof request2 === "string") { + request4 = webidl.converters.RequestInfo(request4); + if (typeof request4 === "string") { continue; } - const r = getRequestState(request2); + const r = getRequestState(request4); if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: prefix, @@ -34973,8 +34973,8 @@ var require_cache4 = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = getRequestState(new Request(request2)); + for (const request4 of requests) { + const r = getRequestState(new Request(request4)); if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: prefix, @@ -35048,17 +35048,17 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); const prefix = "Cache.put"; webidl.argumentLengthCheck(arguments, 2, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); response = webidl.converters.Response(response, prefix, "response"); let innerRequest = null; - if (webidl.is.Request(request2)) { - innerRequest = getRequestState(request2); + if (webidl.is.Request(request4)) { + innerRequest = getRequestState(request4); } else { - innerRequest = getRequestState(new Request(request2)); + innerRequest = getRequestState(new Request(request4)); } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -35126,21 +35126,21 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.delete"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = getRequestState(new Request(request2)); + assert(typeof request4 === "string"); + r = getRequestState(new Request(request4)); } const operations = []; const operation = { @@ -35166,26 +35166,26 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.keys"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -35197,9 +35197,9 @@ var require_cache4 = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = fromInnerRequest( - request3, + request5, void 0, new AbortController().signal, "immutable" @@ -35298,9 +35298,9 @@ var require_cache4 = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -35316,7 +35316,7 @@ var require_cache4 = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -35324,20 +35324,20 @@ var require_cache4 = __commonJS({ } return true; } - #internalMatchAll(request2, options, maxResponses = Infinity) { + #internalMatchAll(request4, options, maxResponses = Infinity) { let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -35425,21 +35425,21 @@ var require_cachestorage2 = __commonJS({ } webidl.util.markAsUncloneable(this); } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, "CacheStorage.match"); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -36529,7 +36529,7 @@ var require_connection2 = __commonJS({ function establishWebSocketConnection(url, protocols, client, handler2, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], client, serviceWorkers: "none", @@ -36541,18 +36541,18 @@ var require_connection2 = __commonJS({ }); if (options.headers) { const headersList = getHeadersList(new Headers(options.headers)); - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue, true); - request2.headersList.append("sec-websocket-version", "13", true); + request4.headersList.append("sec-websocket-key", keyValue, true); + request4.headersList.append("sec-websocket-version", "13", true); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol, true); + request4.headersList.append("sec-websocket-protocol", protocol, true); } const permessageDeflate = "permessage-deflate; client_max_window_bits"; - request2.headersList.append("sec-websocket-extensions", permessageDeflate, true); + request4.headersList.append("sec-websocket-extensions", permessageDeflate, true); const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher, processResponse(response) { @@ -36593,7 +36593,7 @@ var require_connection2 = __commonJS({ } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); if (secProtocol !== null) { - const requestProtocols = getDecodeSplit("sec-websocket-protocol", request2.headersList); + const requestProtocols = getDecodeSplit("sec-websocket-protocol", request4.headersList); if (!requestProtocols.includes(secProtocol)) { failWebsocketConnection(handler2, 1002, "Protocol was not set in the opening handshake."); return; @@ -38793,24 +38793,24 @@ var require_dist_node3 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - endpoint: () => endpoint2 + endpoint: () => endpoint4 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node2(); - var VERSION13 = "9.0.5"; - var userAgent2 = `octokit-endpoint.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; - var DEFAULTS2 = { + var import_universal_user_agent13 = require_dist_node2(); + var VERSION17 = "9.0.5"; + var userAgent4 = `octokit-endpoint.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}`; + var DEFAULTS4 = { method: "GET", baseUrl: "https://api.github.com", headers: { accept: "application/vnd.github.v3+json", - "user-agent": userAgent2 + "user-agent": userAgent4 }, mediaType: { format: "" } }; - function lowercaseKeys2(object) { + function lowercaseKeys4(object) { if (!object) { return {}; } @@ -38819,7 +38819,7 @@ var require_dist_node3 = __commonJS({ return newObj; }, {}); } - function isPlainObject3(value) { + function isPlainObject7(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -38830,21 +38830,21 @@ var require_dist_node3 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - function mergeDeep2(defaults, options) { + function mergeDeep4(defaults, options) { const result = Object.assign({}, defaults); Object.keys(options).forEach((key) => { - if (isPlainObject3(options[key])) { + if (isPlainObject7(options[key])) { if (!(key in defaults)) Object.assign(result, { [key]: options[key] }); else - result[key] = mergeDeep2(defaults[key], options[key]); + result[key] = mergeDeep4(defaults[key], options[key]); } else { Object.assign(result, { [key]: options[key] }); } }); return result; } - function removeUndefinedProperties2(obj) { + function removeUndefinedProperties4(obj) { for (const key in obj) { if (obj[key] === void 0) { delete obj[key]; @@ -38852,7 +38852,7 @@ var require_dist_node3 = __commonJS({ } return obj; } - function merge2(defaults, route, options) { + function merge4(defaults, route, options) { var _a; if (typeof route === "string") { let [method, url] = route.split(" "); @@ -38860,10 +38860,10 @@ var require_dist_node3 = __commonJS({ } else { options = Object.assign({}, route); } - options.headers = lowercaseKeys2(options.headers); - removeUndefinedProperties2(options); - removeUndefinedProperties2(options.headers); - const mergedOptions = mergeDeep2(defaults || {}, options); + options.headers = lowercaseKeys4(options.headers); + removeUndefinedProperties4(options); + removeUndefinedProperties4(options.headers); + const mergedOptions = mergeDeep4(defaults || {}, options); if (options.url === "/graphql") { if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( @@ -38874,7 +38874,7 @@ var require_dist_node3 = __commonJS({ } return mergedOptions; } - function addQueryParameters2(url, parameters) { + function addQueryParameters4(url, parameters) { const separator = /\?/.test(url) ? "&" : "?"; const names = Object.keys(parameters); if (names.length === 0) { @@ -38887,18 +38887,18 @@ var require_dist_node3 = __commonJS({ return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } - var urlVariableRegex2 = /\{[^}]+\}/g; - function removeNonChars2(variableName) { + var urlVariableRegex4 = /\{[^}]+\}/g; + function removeNonChars4(variableName) { return variableName.replace(/^\W+|\W+$/g, "").split(/,/); } - function extractUrlVariableNames2(url) { - const matches = url.match(urlVariableRegex2); + function extractUrlVariableNames4(url) { + const matches = url.match(urlVariableRegex4); if (!matches) { return []; } - return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); + return matches.map(removeNonChars4).reduce((a, b) => a.concat(b), []); } - function omit2(object, keysToOmit) { + function omit4(object, keysToOmit) { const result = { __proto__: null }; for (const key of Object.keys(object)) { if (keysToOmit.indexOf(key) === -1) { @@ -38907,7 +38907,7 @@ var require_dist_node3 = __commonJS({ } return result; } - function encodeReserved2(str) { + function encodeReserved4(str) { return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { if (!/%[0-9A-Fa-f]/.test(part)) { part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); @@ -38915,67 +38915,67 @@ var require_dist_node3 = __commonJS({ return part; }).join(""); } - function encodeUnreserved2(str) { + function encodeUnreserved4(str) { return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { return "%" + c.charCodeAt(0).toString(16).toUpperCase(); }); } - function encodeValue2(operator, value, key) { - value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + function encodeValue4(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved4(value) : encodeUnreserved4(value); if (key) { - return encodeUnreserved2(key) + "=" + value; + return encodeUnreserved4(key) + "=" + value; } else { return value; } } - function isDefined2(value) { + function isDefined4(value) { return value !== void 0 && value !== null; } - function isKeyOperator2(operator) { + function isKeyOperator4(operator) { return operator === ";" || operator === "&" || operator === "?"; } - function getValues2(context3, operator, key, modifier) { + function getValues4(context3, operator, key, modifier) { var value = context3[key], result = []; - if (isDefined2(value) && value !== "") { + if (isDefined4(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { value = value.substring(0, parseInt(modifier, 10)); } result.push( - encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value, isKeyOperator4(operator) ? key : "") ); } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { + value.filter(isDefined4).forEach(function(value2) { result.push( - encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value2, isKeyOperator4(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - result.push(encodeValue2(operator, value[k], k)); + if (isDefined4(value[k])) { + result.push(encodeValue4(operator, value[k], k)); } }); } } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { - tmp.push(encodeValue2(operator, value2)); + value.filter(isDefined4).forEach(function(value2) { + tmp.push(encodeValue4(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - tmp.push(encodeUnreserved2(k)); - tmp.push(encodeValue2(operator, value[k].toString())); + if (isDefined4(value[k])) { + tmp.push(encodeUnreserved4(k)); + tmp.push(encodeValue4(operator, value[k].toString())); } }); } - if (isKeyOperator2(operator)) { - result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + if (isKeyOperator4(operator)) { + result.push(encodeUnreserved4(key) + "=" + tmp.join(",")); } else if (tmp.length !== 0) { result.push(tmp.join(",")); } @@ -38983,23 +38983,23 @@ var require_dist_node3 = __commonJS({ } } else { if (operator === ";") { - if (isDefined2(value)) { - result.push(encodeUnreserved2(key)); + if (isDefined4(value)) { + result.push(encodeUnreserved4(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { - result.push(encodeUnreserved2(key) + "="); + result.push(encodeUnreserved4(key) + "="); } else if (value === "") { result.push(""); } } return result; } - function parseUrl2(template) { + function parseUrl4(template) { return { - expand: expand2.bind(null, template) + expand: expand4.bind(null, template) }; } - function expand2(template, context3) { + function expand4(template, context3) { var operators = ["+", "#", ".", "/", ";", "?", "&"]; template = template.replace( /\{([^\{\}]+)\}|([^\{\}]+)/g, @@ -39013,7 +39013,7 @@ var require_dist_node3 = __commonJS({ } expression.split(/,/g).forEach(function(variable) { var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); - values.push(getValues2(context3, operator, tmp[1], tmp[2] || tmp[3])); + values.push(getValues4(context3, operator, tmp[1], tmp[2] || tmp[3])); }); if (operator && operator !== "+") { var separator = ","; @@ -39027,7 +39027,7 @@ var require_dist_node3 = __commonJS({ return values.join(","); } } else { - return encodeReserved2(literal); + return encodeReserved4(literal); } } ); @@ -39037,13 +39037,13 @@ var require_dist_node3 = __commonJS({ return template.replace(/\/$/, ""); } } - function parse2(options) { + function parse4(options) { var _a; let method = options.method.toUpperCase(); let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); let headers = Object.assign({}, options.headers); let body; - let parameters = omit2(options, [ + let parameters = omit4(options, [ "method", "baseUrl", "url", @@ -39051,13 +39051,13 @@ var require_dist_node3 = __commonJS({ "request", "mediaType" ]); - const urlVariableNames = extractUrlVariableNames2(url); - url = parseUrl2(url).expand(parameters); + const urlVariableNames = extractUrlVariableNames4(url); + url = parseUrl4(url).expand(parameters); if (!/^http/.test(url)) { url = options.baseUrl + url; } const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); - const remainingParameters = omit2(parameters, omittedParameters); + const remainingParameters = omit4(parameters, omittedParameters); const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); if (!isBinaryRequest) { if (options.mediaType.format) { @@ -39079,7 +39079,7 @@ var require_dist_node3 = __commonJS({ } } if (["GET", "HEAD"].includes(method)) { - url = addQueryParameters2(url, remainingParameters); + url = addQueryParameters4(url, remainingParameters); } else { if ("data" in remainingParameters) { body = remainingParameters.data; @@ -39101,20 +39101,20 @@ var require_dist_node3 = __commonJS({ options.request ? { request: options.request } : null ); } - function endpointWithDefaults2(defaults, route, options) { - return parse2(merge2(defaults, route, options)); + function endpointWithDefaults4(defaults, route, options) { + return parse4(merge4(defaults, route, options)); } - function withDefaults4(oldDefaults, newDefaults) { - const DEFAULTS22 = merge2(oldDefaults, newDefaults); - const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + function withDefaults8(oldDefaults, newDefaults) { + const DEFAULTS22 = merge4(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults4.bind(null, DEFAULTS22); return Object.assign(endpoint22, { DEFAULTS: DEFAULTS22, - defaults: withDefaults4.bind(null, DEFAULTS22), - merge: merge2.bind(null, DEFAULTS22), - parse: parse2 + defaults: withDefaults8.bind(null, DEFAULTS22), + merge: merge4.bind(null, DEFAULTS22), + parse: parse4 }); } - var endpoint2 = withDefaults4(null, DEFAULTS2); + var endpoint4 = withDefaults8(null, DEFAULTS4); } }); @@ -39241,14 +39241,14 @@ var require_dist_node5 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - RequestError: () => RequestError2 + RequestError: () => RequestError4 }); module.exports = __toCommonJS(dist_src_exports); var import_deprecation = require_dist_node4(); var import_once = __toESM2(require_once()); var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation)); var logOnceHeaders = (0, import_once.default)((deprecation) => console.warn(deprecation)); - var RequestError2 = class extends Error { + var RequestError4 = class extends Error { constructor(message, statusCode, options) { super(message); if (Error.captureStackTrace) { @@ -39323,13 +39323,13 @@ var require_dist_node6 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - request: () => request2 + request: () => request4 }); module.exports = __toCommonJS(dist_src_exports); - var import_endpoint2 = require_dist_node3(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "8.4.0"; - function isPlainObject3(value) { + var import_endpoint4 = require_dist_node3(); + var import_universal_user_agent13 = require_dist_node(); + var VERSION17 = "8.4.0"; + function isPlainObject7(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -39340,15 +39340,15 @@ var require_dist_node6 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - var import_request_error3 = require_dist_node5(); + var import_request_error6 = require_dist_node5(); function getBufferResponse(response) { return response.arrayBuffer(); } - function fetchWrapper2(requestOptions) { + function fetchWrapper4(requestOptions) { var _a, _b, _c, _d; const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console; const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false; - if (isPlainObject3(requestOptions.body) || Array.isArray(requestOptions.body)) { + if (isPlainObject7(requestOptions.body) || Array.isArray(requestOptions.body)) { requestOptions.body = JSON.stringify(requestOptions.body); } let headers = {}; @@ -39390,7 +39390,7 @@ var require_dist_node6 = __commonJS({ if (status < 400) { return; } - throw new import_request_error3.RequestError(response.statusText, status, { + throw new import_request_error6.RequestError(response.statusText, status, { response: { url, status, @@ -39401,19 +39401,19 @@ var require_dist_node6 = __commonJS({ }); } if (status === 304) { - throw new import_request_error3.RequestError("Not modified", status, { + throw new import_request_error6.RequestError("Not modified", status, { response: { url, status, headers, - data: await getResponseData2(response) + data: await getResponseData4(response) }, request: requestOptions }); } if (status >= 400) { - const data = await getResponseData2(response); - const error = new import_request_error3.RequestError(toErrorMessage2(data), status, { + const data = await getResponseData4(response); + const error = new import_request_error6.RequestError(toErrorMessage4(data), status, { response: { url, status, @@ -39424,7 +39424,7 @@ var require_dist_node6 = __commonJS({ }); throw error; } - return parseSuccessResponseBody ? await getResponseData2(response) : response.body; + return parseSuccessResponseBody ? await getResponseData4(response) : response.body; }).then((data) => { return { status, @@ -39433,7 +39433,7 @@ var require_dist_node6 = __commonJS({ data }; }).catch((error) => { - if (error instanceof import_request_error3.RequestError) + if (error instanceof import_request_error6.RequestError) throw error; else if (error.name === "AbortError") throw error; @@ -39445,12 +39445,12 @@ var require_dist_node6 = __commonJS({ message = error.cause; } } - throw new import_request_error3.RequestError(message, 500, { + throw new import_request_error6.RequestError(message, 500, { request: requestOptions }); }); } - async function getResponseData2(response) { + async function getResponseData4(response) { const contentType = response.headers.get("content-type"); if (/application\/json/.test(contentType)) { return response.json().catch(() => response.text()).catch(() => ""); @@ -39460,7 +39460,7 @@ var require_dist_node6 = __commonJS({ } return getBufferResponse(response); } - function toErrorMessage2(data) { + function toErrorMessage4(data) { if (typeof data === "string") return data; let suffix; @@ -39477,32 +39477,32 @@ var require_dist_node6 = __commonJS({ } return `Unknown error: ${JSON.stringify(data)}`; } - function withDefaults4(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + function withDefaults8(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper2(endpoint2.parse(endpointOptions)); + return fetchWrapper4(endpoint22.parse(endpointOptions)); } const request22 = (route2, parameters2) => { - return fetchWrapper2( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + return fetchWrapper4( + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; Object.assign(request22, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); } - var request2 = withDefaults4(import_endpoint2.endpoint, { + var request4 = withDefaults8(import_endpoint4.endpoint, { headers: { - "user-agent": `octokit-request.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-request.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}` } }); } @@ -39537,8 +39537,8 @@ var require_dist_node7 = __commonJS({ }); module.exports = __toCommonJS(dist_src_exports); var import_request32 = require_dist_node6(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "7.1.0"; + var import_universal_user_agent13 = require_dist_node(); + var VERSION17 = "7.1.0"; var import_request22 = require_dist_node6(); var import_request15 = require_dist_node6(); function _buildMessageForResponseErrors2(data) { @@ -39546,9 +39546,9 @@ var require_dist_node7 = __commonJS({ ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError2 = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors2(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.name = "GraphqlResponseError"; @@ -39570,7 +39570,7 @@ var require_dist_node7 = __commonJS({ ]; var FORBIDDEN_VARIABLE_OPTIONS2 = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX2 = /\/api\/v3\/?$/; - function graphql3(request2, query, options) { + function graphql3(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -39601,11 +39601,11 @@ var require_dist_node7 = __commonJS({ result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX2.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX2, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -39620,25 +39620,25 @@ var require_dist_node7 = __commonJS({ return response.data.data; }); } - function withDefaults4(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); + function withDefaults8(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql3(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults4.bind(null, newRequest), + defaults: withDefaults8.bind(null, newRequest), endpoint: newRequest.endpoint }); } - var graphql22 = withDefaults4(import_request32.request, { + var graphql22 = withDefaults8(import_request32.request, { headers: { - "user-agent": `octokit-graphql.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-graphql.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}` }, method: "POST", url: "/graphql" }); function withCustomRequest2(customRequest) { - return withDefaults4(customRequest, { + return withDefaults8(customRequest, { method: "POST", url: "/graphql" }); @@ -39692,13 +39692,13 @@ var require_dist_node8 = __commonJS({ } return `token ${token}`; } - async function hook6(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( + async function hook6(token, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix2(token); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix2(token); + return request4(endpoint4); } var createTokenAuth3 = function createTokenAuth22(token) { if (!token) { @@ -39743,17 +39743,17 @@ var require_dist_node9 = __commonJS({ Octokit: () => Octokit3 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node(); + var import_universal_user_agent13 = require_dist_node(); var import_before_after_hook2 = require_before_after_hook(); var import_request15 = require_dist_node6(); var import_graphql2 = require_dist_node7(); var import_auth_token2 = require_dist_node8(); - var VERSION13 = "5.2.0"; + var VERSION17 = "5.2.0"; var noop2 = () => { }; var consoleWarn2 = console.warn.bind(console); var consoleError2 = console.error.bind(console); - var userAgentTrail2 = `octokit-core.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; + var userAgentTrail2 = `octokit-core.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}`; var _a; var Octokit3 = (_a = class { static defaults(defaults) { @@ -39856,7 +39856,7 @@ var require_dist_node9 = __commonJS({ } } }, (() => { - _a.VERSION = VERSION13; + _a.VERSION = VERSION17; })(), (() => { _a.plugins = []; })(), _a); @@ -39890,7 +39890,7 @@ var require_dist_node10 = __commonJS({ restEndpointMethods: () => restEndpointMethods2 }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "10.4.1"; + var VERSION17 = "10.4.1"; var Endpoints2 = { actions: { addCustomLabelsToSelfHostedRunnerForOrg: [ @@ -41882,8 +41882,8 @@ var require_dist_node10 = __commonJS({ var endpoints_default2 = Endpoints2; var endpointMethodsMap2 = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default2)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -42006,7 +42006,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - restEndpointMethods2.VERSION = VERSION13; + restEndpointMethods2.VERSION = VERSION17; function legacyRestEndpointMethods2(octokit) { const api = endpointsToMethods2(octokit); return { @@ -42014,7 +42014,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - legacyRestEndpointMethods2.VERSION = VERSION13; + legacyRestEndpointMethods2.VERSION = VERSION17; } }); @@ -42047,7 +42047,7 @@ var require_dist_node11 = __commonJS({ paginatingEndpoints: () => paginatingEndpoints }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "9.2.1"; + var VERSION17 = "9.2.1"; function normalizePaginatedListResponse2(response) { if (!response.data) { return { @@ -42393,7 +42393,7 @@ var require_dist_node11 = __commonJS({ }) }; } - paginateRest2.VERSION = VERSION13; + paginateRest2.VERSION = VERSION17; } }); @@ -42524,7 +42524,7 @@ var require_fast_content_type_parse = __commonJS({ var defaultContentType = { type: "", parameters: new NullObject() }; Object.freeze(defaultContentType.parameters); Object.freeze(defaultContentType); - function parse2(header) { + function parse4(header) { if (typeof header !== "string") { throw new TypeError("argument header is required and must be a string"); } @@ -42562,7 +42562,7 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - function safeParse2(header) { + function safeParse4(header) { if (typeof header !== "string") { return defaultContentType; } @@ -42600,9 +42600,9 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - module.exports.default = { parse: parse2, safeParse: safeParse2 }; - module.exports.parse = parse2; - module.exports.safeParse = safeParse2; + module.exports.default = { parse: parse4, safeParse: safeParse4 }; + module.exports.parse = parse4; + module.exports.safeParse = safeParse4; module.exports.defaultContentType = defaultContentType; } }); @@ -42819,9 +42819,9 @@ function addQueryParameters(url, parameters) { return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } -var urlVariableRegex = /\{[^}]+\}/g; +var urlVariableRegex = /\{[^{}}]+\}/g; function removeNonChars(variableName) { - return variableName.replace(/^\W+|\W+$/g, "").split(/,/); + return variableName.replace(/(?:^\W+)|(?:(? { const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; return `application/vnd.github.${preview}-preview${format}`; @@ -43037,12 +43037,12 @@ function endpointWithDefaults(defaults, route, options) { return parse(merge(defaults, route, options)); } function withDefaults(oldDefaults, newDefaults) { - const DEFAULTS2 = merge(oldDefaults, newDefaults); - const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2); - return Object.assign(endpoint2, { - DEFAULTS: DEFAULTS2, - defaults: withDefaults.bind(null, DEFAULTS2), - merge: merge.bind(null, DEFAULTS2), + const DEFAULTS22 = merge(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults.bind(null, DEFAULTS22), + merge: merge.bind(null, DEFAULTS22), parse }); } @@ -43071,7 +43071,7 @@ var RequestError = class extends Error { if (options.request.headers.authorization) { requestCopy.headers = Object.assign({}, options.request.headers, { authorization: options.request.headers.authorization.replace( - / .*$/, + /(?]+)>; rel="deprecation"/); + const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/); const deprecationLink = matches && matches.pop(); log.warn( `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` @@ -43234,40 +43234,570 @@ function toErrorMessage(data) { return `Unknown error: ${JSON.stringify(data)}`; } function withDefaults2(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper(endpoint2.parse(endpointOptions)); + return fetchWrapper(endpoint22.parse(endpointOptions)); } - const request2 = (route2, parameters2) => { + const request22 = (route2, parameters2) => { return fetchWrapper( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; - Object.assign(request2, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); - return endpointOptions.request.hook(request2, endpointOptions); + return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); } var request = withDefaults2(endpoint, defaults_default); // var VERSION3 = "0.0.0-development"; +var userAgent2 = `octokit-endpoint.js/${VERSION3} ${getUserAgent()}`; +var DEFAULTS2 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent2 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys2(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject3(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep2(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject3(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep2(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties2(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge2(defaults, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys2(options.headers); + removeUndefinedProperties2(options); + removeUndefinedProperties2(options.headers); + const mergedOptions = mergeDeep2(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters2(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex2 = /\{[^}]+\}/g; +function removeNonChars2(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames2(url) { + const matches = url.match(urlVariableRegex2); + if (!matches) { + return []; + } + return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); +} +function omit2(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved2(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved2(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue2(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + if (key) { + return encodeUnreserved2(key) + "=" + value; + } else { + return value; + } +} +function isDefined2(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator2(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues2(context3, operator, key, modifier) { + var value = context3[key], result = []; + if (isDefined2(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + result.push( + encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + result.push(encodeValue2(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + tmp.push(encodeValue2(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + tmp.push(encodeUnreserved2(k)); + tmp.push(encodeValue2(operator, value[k].toString())); + } + }); + } + if (isKeyOperator2(operator)) { + result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined2(value)) { + result.push(encodeUnreserved2(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved2(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl2(template) { + return { + expand: expand2.bind(null, template) + }; +} +function expand2(template, context3) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues2(context3, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved2(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse2(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit2(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames2(url); + url = parseUrl2(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit2(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters2(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults2(defaults, route, options) { + return parse2(merge2(defaults, route, options)); +} +function withDefaults3(oldDefaults, newDefaults) { + const DEFAULTS22 = merge2(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults3.bind(null, DEFAULTS22), + merge: merge2.bind(null, DEFAULTS22), + parse: parse2 + }); +} +var endpoint2 = withDefaults3(null, DEFAULTS2); + +// +var import_fast_content_type_parse2 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError2 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION4 = "0.0.0-development"; +var defaults_default2 = { + headers: { + "user-agent": `octokit-request.js/${VERSION4} ${getUserAgent()}` + } +}; +function isPlainObject4(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper2(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch2 = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject4(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error) { + let message = "Unknown Error"; + if (error instanceof Error) { + if (error.name === "AbortError") { + error.status = 500; + throw error; + } + message = error.message; + if (error.name === "TypeError" && "cause" in error) { + if (error.cause instanceof Error) { + message = error.cause.message; + } else if (typeof error.cause === "string") { + message = error.cause; + } + } + } + const requestError = new RequestError2(message, 500, { + request: requestOptions + }); + requestError.cause = error; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError2(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2(toErrorMessage2(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData2(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData2(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse2.safeParse)(contentType); + if (isJSONResponse2(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse2(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage2(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults4(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper2(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper2( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); +} +var request2 = withDefaults4(endpoint2, defaults_default2); + +// +var VERSION5 = "0.0.0-development"; function _buildMessageForResponseErrors(data) { return `Request failed due to following response errors: ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.errors = response.errors; @@ -43292,7 +43822,7 @@ var NON_VARIABLE_OPTIONS = [ ]; var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; -function graphql(request2, query, options) { +function graphql(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -43323,11 +43853,11 @@ function graphql(request2, query, options) { result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -43342,25 +43872,25 @@ function graphql(request2, query, options) { return response.data.data; }); } -function withDefaults3(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); +function withDefaults5(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults3.bind(null, newRequest), + defaults: withDefaults5.bind(null, newRequest), endpoint: newRequest.endpoint }); } -var graphql2 = withDefaults3(request, { +var graphql2 = withDefaults5(request2, { headers: { - "user-agent": `octokit-graphql.js/${VERSION3} ${getUserAgent()}` + "user-agent": `octokit-graphql.js/${VERSION5} ${getUserAgent()}` }, method: "POST", url: "/graphql" }); function withCustomRequest(customRequest) { - return withDefaults3(customRequest, { + return withDefaults5(customRequest, { method: "POST", url: "/graphql" }); @@ -43388,13 +43918,13 @@ function withAuthorizationPrefix(token) { } return `token ${token}`; } -async function hook(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( +async function hook(token, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix(token); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix(token); + return request4(endpoint4); } var createTokenAuth = function createTokenAuth2(token) { if (!token) { @@ -43412,14 +43942,14 @@ var createTokenAuth = function createTokenAuth2(token) { }; // -var VERSION4 = "6.1.3"; +var VERSION6 = "6.1.4"; // var noop = () => { }; var consoleWarn = console.warn.bind(console); var consoleError = console.error.bind(console); -var userAgentTrail = `octokit-core.js/${VERSION4} ${getUserAgent()}`; +var userAgentTrail = `octokit-core.js/${VERSION6} ${getUserAgent()}`; var Octokit = class { static defaults(defaults) { const OctokitWithDefaults = class extends this { @@ -43524,20 +44054,20 @@ var Octokit = class { hook; auth; }; -__publicField(Octokit, "VERSION", VERSION4); +__publicField(Octokit, "VERSION", VERSION6); __publicField(Octokit, "plugins", []); // -var VERSION5 = "5.3.1"; +var VERSION7 = "5.3.1"; // function requestLog(octokit) { - octokit.hook.wrap("request", (request2, options) => { + octokit.hook.wrap("request", (request4, options) => { octokit.log.debug("request", options); const start = Date.now(); const requestOptions = octokit.request.endpoint.parse(options); const path = requestOptions.url.replace(options.baseUrl, ""); - return request2(options).then((response) => { + return request4(options).then((response) => { const requestId = response.headers["x-github-request-id"]; octokit.log.info( `${requestOptions.method} ${path} - ${response.status} with id ${requestId} in ${Date.now() - start}ms` @@ -43553,10 +44083,10 @@ function requestLog(octokit) { }); }); } -requestLog.VERSION = VERSION5; +requestLog.VERSION = VERSION7; // -var VERSION6 = "0.0.0-development"; +var VERSION8 = "0.0.0-development"; function normalizePaginatedListResponse(response) { if (!response.data) { return { @@ -43600,7 +44130,7 @@ function iterator(octokit, route, parameters) { const response = await requestMethod({ method, url, headers }); const normalizedResponse = normalizePaginatedListResponse(response); url = ((normalizedResponse.headers.link || "").match( - /<([^>]+)>;\s*rel="next"/ + /<([^<>]+)>;\s*rel="next"/ ) || [])[1]; return { value: normalizedResponse }; } catch (error) { @@ -43659,10 +44189,10 @@ function paginateRest(octokit) { }) }; } -paginateRest.VERSION = VERSION6; +paginateRest.VERSION = VERSION8; // -var VERSION7 = "13.3.1"; +var VERSION9 = "13.3.1"; // var Endpoints = { @@ -45735,8 +46265,8 @@ var endpoints_default = Endpoints; // var endpointMethodsMap = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -45861,7 +46391,7 @@ function restEndpointMethods(octokit) { rest: api }; } -restEndpointMethods.VERSION = VERSION7; +restEndpointMethods.VERSION = VERSION9; function legacyRestEndpointMethods(octokit) { const api = endpointsToMethods(octokit); return { @@ -45869,15 +46399,15 @@ function legacyRestEndpointMethods(octokit) { rest: api }; } -legacyRestEndpointMethods.VERSION = VERSION7; +legacyRestEndpointMethods.VERSION = VERSION9; // -var VERSION8 = "21.1.0"; +var VERSION10 = "21.1.1"; // var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRest).defaults( { - userAgent: `octokit-rest.js/${VERSION8}` + userAgent: `octokit-rest.js/${VERSION10}` } ); @@ -45885,25 +46415,25 @@ var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRes var import_core2 = __toESM(require_core()); // -function requestToOAuthBaseUrl(request2) { - const endpointDefaults = request2.endpoint.DEFAULTS; +function requestToOAuthBaseUrl(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); } -async function oauthRequest(request2, route, parameters) { +async function oauthRequest(request4, route, parameters) { const withOAuthParameters = { - baseUrl: requestToOAuthBaseUrl(request2), + baseUrl: requestToOAuthBaseUrl(request4), headers: { accept: "application/json" }, ...parameters }; - const response = await request2(route, withOAuthParameters); + const response = await request4(route, withOAuthParameters); if ("error" in response.data) { const error = new RequestError( `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, 400, { - request: request2.endpoint.merge( + request: request4.endpoint.merge( route, withOAuthParameters ) @@ -45914,32 +46444,43 @@ async function oauthRequest(request2, route, parameters) { } return response; } -async function exchangeWebFlowCode(options) { - const request2 = options.request || request; +async function createDeviceCode(options) { + const request4 = options.request || request; + const parameters = { + client_id: options.clientId + }; + if ("scopes" in options && Array.isArray(options.scopes)) { + parameters.scope = options.scopes.join(" "); + } + return oauthRequest(request4, "POST /login/device/code", parameters); +} +async function exchangeDeviceCode(options) { + const request4 = options.request || request; const response = await oauthRequest( - request2, + request4, "POST /login/oauth/access_token", { client_id: options.clientId, - client_secret: options.clientSecret, - code: options.code, - redirect_uri: options.redirectUrl + device_code: options.code, + grant_type: "urn:ietf:params:oauth:grant-type:device_code" } ); const authentication = { clientType: options.clientType, clientId: options.clientId, - clientSecret: options.clientSecret, token: response.data.access_token, scopes: response.data.scope.split(/\s+/).filter(Boolean) }; + if ("clientSecret" in options) { + authentication.clientSecret = options.clientSecret; + } if (options.clientType === "github-app") { if ("refresh_token" in response.data) { const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp( + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( apiTimeInMs, response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp( + ), authentication.refreshTokenExpiresAt = toTimestamp2( apiTimeInMs, response.data.refresh_token_expires_in ); @@ -45948,46 +46489,722 @@ async function exchangeWebFlowCode(options) { } return { ...response, authentication }; } -function toTimestamp(apiTimeInMs, expirationInSeconds) { +function toTimestamp2(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } -async function createDeviceCode(options) { - const request2 = options.request || request; - const parameters = { - client_id: options.clientId + +// +async function getOAuthAccessToken(state, options) { + const cachedAuthentication = getCachedAuthentication(state, options.auth); + if (cachedAuthentication) + return cachedAuthentication; + const { data: verification } = await createDeviceCode({ + clientType: state.clientType, + clientId: state.clientId, + request: options.request || state.request, + scopes: options.auth.scopes || state.scopes + }); + await state.onVerification(verification); + const authentication = await waitForAccessToken( + options.request || state.request, + state.clientId, + state.clientType, + verification + ); + state.authentication = authentication; + return authentication; +} +function getCachedAuthentication(state, auth22) { + if (auth22.refresh === true) + return false; + if (!state.authentication) + return false; + if (state.clientType === "github-app") { + return state.authentication; + } + const authentication = state.authentication; + const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( + " " + ); + const currentScope = authentication.scopes.join(" "); + return newScope === currentScope ? authentication : false; +} +async function wait(seconds) { + await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); +} +async function waitForAccessToken(request4, clientId, clientType, verification) { + try { + const options = { + clientId, + request: request4, + code: verification.device_code + }; + const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ + ...options, + clientType: "oauth-app" + }) : await exchangeDeviceCode({ + ...options, + clientType: "github-app" + }); + return { + type: "token", + tokenType: "oauth", + ...authentication + }; + } catch (error) { + if (!error.response) + throw error; + const errorType = error.response.data.error; + if (errorType === "authorization_pending") { + await wait(verification.interval); + return waitForAccessToken(request4, clientId, clientType, verification); + } + if (errorType === "slow_down") { + await wait(verification.interval + 5); + return waitForAccessToken(request4, clientId, clientType, verification); + } + throw error; + } +} +async function auth2(state, authOptions) { + return getOAuthAccessToken(state, { + auth: authOptions + }); +} +async function hook2(state, request4, route, parameters) { + let endpoint4 = request4.endpoint.merge( + route, + parameters + ); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); + } + const { token } = await getOAuthAccessToken(state, { + request: request4, + auth: { type: "oauth" } + }); + endpoint4.headers.authorization = `token ${token}`; + return request4(endpoint4); +} +var VERSION11 = "0.0.0-development"; +function createOAuthDeviceAuth(options) { + const requestWithDefaults = options.request || request.defaults({ + headers: { + "user-agent": `octokit-auth-oauth-device.js/${VERSION11} ${getUserAgent()}` + } + }); + const { request: request4 = requestWithDefaults, ...otherOptions } = options; + const state = options.clientType === "github-app" ? { + ...otherOptions, + clientType: "github-app", + request: request4 + } : { + ...otherOptions, + clientType: "oauth-app", + request: request4, + scopes: options.scopes || [] }; - if ("scopes" in options && Array.isArray(options.scopes)) { - parameters.scope = options.scopes.join(" "); + if (!options.clientId) { + throw new Error( + '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' + ); + } + if (!options.onVerification) { + throw new Error( + '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' + ); } - return oauthRequest(request2, "POST /login/device/code", parameters); + return Object.assign(auth2.bind(null, state), { + hook: hook2.bind(null, state) + }); } -async function exchangeDeviceCode(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + +// +var VERSION12 = "0.0.0-development"; +var userAgent3 = `octokit-endpoint.js/${VERSION12} ${getUserAgent()}`; +var DEFAULTS3 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent3 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys3(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject5(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep3(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject5(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep3(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties3(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge3(defaults, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys3(options.headers); + removeUndefinedProperties3(options); + removeUndefinedProperties3(options.headers); + const mergedOptions = mergeDeep3(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters3(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex3 = /\{[^}]+\}/g; +function removeNonChars3(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames3(url) { + const matches = url.match(urlVariableRegex3); + if (!matches) { + return []; + } + return matches.map(removeNonChars3).reduce((a, b) => a.concat(b), []); +} +function omit3(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved3(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved3(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue3(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved3(value) : encodeUnreserved3(value); + if (key) { + return encodeUnreserved3(key) + "=" + value; + } else { + return value; + } +} +function isDefined3(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator3(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues3(context3, operator, key, modifier) { + var value = context3[key], result = []; + if (isDefined3(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue3(operator, value, isKeyOperator3(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + result.push( + encodeValue3(operator, value2, isKeyOperator3(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + result.push(encodeValue3(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + tmp.push(encodeValue3(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + tmp.push(encodeUnreserved3(k)); + tmp.push(encodeValue3(operator, value[k].toString())); + } + }); + } + if (isKeyOperator3(operator)) { + result.push(encodeUnreserved3(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined3(value)) { + result.push(encodeUnreserved3(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved3(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl3(template) { + return { + expand: expand3.bind(null, template) + }; +} +function expand3(template, context3) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues3(context3, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved3(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse3(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit3(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames3(url); + url = parseUrl3(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit3(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters3(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults3(defaults, route, options) { + return parse3(merge3(defaults, route, options)); +} +function withDefaults6(oldDefaults, newDefaults) { + const DEFAULTS22 = merge3(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults3.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults6.bind(null, DEFAULTS22), + merge: merge3.bind(null, DEFAULTS22), + parse: parse3 + }); +} +var endpoint3 = withDefaults6(null, DEFAULTS3); + +// +var import_fast_content_type_parse3 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError3 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION13 = "0.0.0-development"; +var defaults_default3 = { + headers: { + "user-agent": `octokit-request.js/${VERSION13} ${getUserAgent()}` + } +}; +function isPlainObject6(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper3(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch2 = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject6(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error) { + let message = "Unknown Error"; + if (error instanceof Error) { + if (error.name === "AbortError") { + error.status = 500; + throw error; + } + message = error.message; + if (error.name === "TypeError" && "cause" in error) { + if (error.cause instanceof Error) { + message = error.cause.message; + } else if (typeof error.cause === "string") { + message = error.cause; + } + } + } + const requestError = new RequestError3(message, 500, { + request: requestOptions + }); + requestError.cause = error; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError3(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3(toErrorMessage3(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData3(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData3(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse3.safeParse)(contentType); + if (isJSONResponse3(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse3(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage3(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults7(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper3(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper3( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults7.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults7.bind(null, endpoint22) + }); +} +var request3 = withDefaults7(endpoint3, defaults_default3); + +// +function requestToOAuthBaseUrl2(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; + return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); +} +async function oauthRequest2(request4, route, parameters) { + const withOAuthParameters = { + baseUrl: requestToOAuthBaseUrl2(request4), + headers: { + accept: "application/json" + }, + ...parameters + }; + const response = await request4(route, withOAuthParameters); + if ("error" in response.data) { + const error = new RequestError3( + `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, + 400, + { + request: request4.endpoint.merge( + route, + withOAuthParameters + ) + } + ); + error.response = response; + throw error; + } + return response; +} +async function exchangeWebFlowCode(options) { + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, - device_code: options.code, - grant_type: "urn:ietf:params:oauth:grant-type:device_code" + client_secret: options.clientSecret, + code: options.code, + redirect_uri: options.redirectUrl } ); const authentication = { clientType: options.clientType, clientId: options.clientId, + clientSecret: options.clientSecret, token: response.data.access_token, scopes: response.data.scope.split(/\s+/).filter(Boolean) }; - if ("clientSecret" in options) { - authentication.clientSecret = options.clientSecret; - } if (options.clientType === "github-app") { if ("refresh_token" in response.data) { const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp( apiTimeInMs, response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp2( + ), authentication.refreshTokenExpiresAt = toTimestamp( apiTimeInMs, response.data.refresh_token_expires_in ); @@ -45996,12 +47213,12 @@ async function exchangeDeviceCode(options) { } return { ...response, authentication }; } -function toTimestamp2(apiTimeInMs, expirationInSeconds) { +function toTimestamp(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function checkToken(options) { - const request2 = options.request || request; - const response = await request2("POST /applications/{client_id}/token", { + const request4 = options.request || request3; + const response = await request4("POST /applications/{client_id}/token", { headers: { authorization: `basic ${btoa( `${options.clientId}:${options.clientSecret}` @@ -46025,9 +47242,9 @@ async function checkToken(options) { return { ...response, authentication }; } async function refreshToken(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, @@ -46055,9 +47272,9 @@ function toTimestamp3(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function resetToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - const response = await request2( + const response = await request4( "PATCH /applications/{client_id}/token", { headers: { @@ -46082,9 +47299,9 @@ async function resetToken(options) { return { ...response, authentication }; } async function deleteToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/token", { headers: { @@ -46096,9 +47313,9 @@ async function deleteToken(options) { ); } async function deleteAuthorization(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/grant", { headers: { @@ -46111,133 +47328,7 @@ async function deleteAuthorization(options) { } // -async function getOAuthAccessToken(state, options) { - const cachedAuthentication = getCachedAuthentication(state, options.auth); - if (cachedAuthentication) - return cachedAuthentication; - const { data: verification } = await createDeviceCode({ - clientType: state.clientType, - clientId: state.clientId, - request: options.request || state.request, - scopes: options.auth.scopes || state.scopes - }); - await state.onVerification(verification); - const authentication = await waitForAccessToken( - options.request || state.request, - state.clientId, - state.clientType, - verification - ); - state.authentication = authentication; - return authentication; -} -function getCachedAuthentication(state, auth22) { - if (auth22.refresh === true) - return false; - if (!state.authentication) - return false; - if (state.clientType === "github-app") { - return state.authentication; - } - const authentication = state.authentication; - const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( - " " - ); - const currentScope = authentication.scopes.join(" "); - return newScope === currentScope ? authentication : false; -} -async function wait(seconds) { - await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); -} -async function waitForAccessToken(request2, clientId, clientType, verification) { - try { - const options = { - clientId, - request: request2, - code: verification.device_code - }; - const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ - ...options, - clientType: "oauth-app" - }) : await exchangeDeviceCode({ - ...options, - clientType: "github-app" - }); - return { - type: "token", - tokenType: "oauth", - ...authentication - }; - } catch (error) { - if (!error.response) - throw error; - const errorType = error.response.data.error; - if (errorType === "authorization_pending") { - await wait(verification.interval); - return waitForAccessToken(request2, clientId, clientType, verification); - } - if (errorType === "slow_down") { - await wait(verification.interval + 5); - return waitForAccessToken(request2, clientId, clientType, verification); - } - throw error; - } -} -async function auth2(state, authOptions) { - return getOAuthAccessToken(state, { - auth: authOptions - }); -} -async function hook2(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( - route, - parameters - ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); - } - const { token } = await getOAuthAccessToken(state, { - request: request2, - auth: { type: "oauth" } - }); - endpoint2.headers.authorization = `token ${token}`; - return request2(endpoint2); -} -var VERSION9 = "0.0.0-development"; -function createOAuthDeviceAuth(options) { - const requestWithDefaults = options.request || request.defaults({ - headers: { - "user-agent": `octokit-auth-oauth-device.js/${VERSION9} ${getUserAgent()}` - } - }); - const { request: request2 = requestWithDefaults, ...otherOptions } = options; - const state = options.clientType === "github-app" ? { - ...otherOptions, - clientType: "github-app", - request: request2 - } : { - ...otherOptions, - clientType: "oauth-app", - request: request2, - scopes: options.scopes || [] - }; - if (!options.clientId) { - throw new Error( - '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - if (!options.onVerification) { - throw new Error( - '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - return Object.assign(auth2.bind(null, state), { - hook: hook2.bind(null, state) - }); -} - -// -var VERSION10 = "0.0.0-development"; +var VERSION14 = "0.0.0-development"; async function getAuthentication(state) { if ("code" in state.strategyOptions) { const { authentication } = await exchangeWebFlowCode({ @@ -46373,30 +47464,30 @@ var ROUTES_REQUIRING_BASIC_AUTH = /\/applications\/[^/]+\/(token|grant)s?/; function requiresBasicAuth(url) { return url && ROUTES_REQUIRING_BASIC_AUTH.test(url); } -async function hook3(state, request2, route, parameters = {}) { - const endpoint2 = request2.endpoint.merge( +async function hook3(state, request4, route, parameters = {}) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); } - if (requiresBasicAuth(endpoint2.url)) { + if (requiresBasicAuth(endpoint4.url)) { const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; - return request2(endpoint2); + endpoint4.headers.authorization = `basic ${credentials}`; + return request4(endpoint4); } - const { token } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request2 }) : await auth3({ ...state, request: request2 }); - endpoint2.headers.authorization = "token " + token; - return request2(endpoint2); + const { token } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request4 }) : await auth3({ ...state, request: request4 }); + endpoint4.headers.authorization = "token " + token; + return request4(endpoint4); } function createOAuthUserAuth({ clientId, clientSecret, clientType = "oauth-app", - request: request2 = request.defaults({ + request: request4 = request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION10} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION14} ${getUserAgent()}` } }), onTokenCreated, @@ -46408,13 +47499,13 @@ function createOAuthUserAuth({ clientSecret, onTokenCreated, strategyOptions, - request: request2 + request: request4 }); return Object.assign(auth3.bind(null, state), { hook: hook3.bind(null, state) }); } -createOAuthUserAuth.VERSION = VERSION10; +createOAuthUserAuth.VERSION = VERSION14; // async function auth4(state, authOptions) { @@ -46453,37 +47544,37 @@ async function auth4(state, authOptions) { }); return userAuth(); } -async function hook4(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( +async function hook4(state, request22, route, parameters) { + let endpoint4 = request22.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request22(endpoint4); } - if (state.clientType === "github-app" && !requiresBasicAuth(endpoint2.url)) { + if (state.clientType === "github-app" && !requiresBasicAuth(endpoint4.url)) { throw new Error( - `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint2.method} ${endpoint2.url}" is not supported.` + `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint4.method} ${endpoint4.url}" is not supported.` ); } const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; + endpoint4.headers.authorization = `basic ${credentials}`; try { - return await request2(endpoint2); + return await request22(endpoint4); } catch (error) { if (error.status !== 401) throw error; - error.message = `[@octokit/auth-oauth-app] "${endpoint2.method} ${endpoint2.url}" does not support clientId/clientSecret basic authentication.`; + error.message = `[@octokit/auth-oauth-app] "${endpoint4.method} ${endpoint4.url}" does not support clientId/clientSecret basic authentication.`; throw error; } } -var VERSION11 = "0.0.0-development"; +var VERSION15 = "0.0.0-development"; function createOAuthAppAuth(options) { const state = Object.assign( { request: request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION11} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION15} ${getUserAgent()}` } }), clientType: "oauth-app" @@ -46927,7 +48018,7 @@ async function getInstallationAuthentication(state, options, customRequest) { } } const appAuthentication = await getAppAuthentication(state); - const request2 = customRequest || state.request; + const request4 = customRequest || state.request; const payload = { installation_id: installationId, mediaType: { @@ -46957,7 +48048,7 @@ async function getInstallationAuthentication(state, options, customRequest) { repository_selection: repositorySelectionOptional, single_file: singleFileName } - } = await request2( + } = await request4( "POST /app/installations/{installation_id}/access_tokens", payload ); @@ -47054,18 +48145,18 @@ function isNotTimeSkewError(error) { /'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/ )); } -async function hook5(state, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge(route, parameters); - const url = endpoint2.url; +async function hook5(state, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge(route, parameters); + const url = endpoint4.url; if (/\/login\/oauth\/access_token$/.test(url)) { - return request2(endpoint2); + return request4(endpoint4); } - if (requiresAppAuth(url.replace(request2.endpoint.DEFAULTS.baseUrl, ""))) { + if (requiresAppAuth(url.replace(request4.endpoint.DEFAULTS.baseUrl, ""))) { const { token: token2 } = await getAppAuthentication(state); - endpoint2.headers.authorization = `bearer ${token2}`; + endpoint4.headers.authorization = `bearer ${token2}`; let response; try { - response = await request2(endpoint2); + response = await request4(endpoint4); } catch (error) { if (isNotTimeSkewError(error)) { throw error; @@ -47084,33 +48175,33 @@ async function hook5(state, request2, route, parameters) { ...state, timeDifference: diff }); - endpoint2.headers.authorization = `bearer ${token3}`; - return request2(endpoint2); + endpoint4.headers.authorization = `bearer ${token3}`; + return request4(endpoint4); } return response; } if (requiresBasicAuth(url)) { const authentication = await state.oauthApp({ type: "oauth-app" }); - endpoint2.headers.authorization = authentication.headers.authorization; - return request2(endpoint2); + endpoint4.headers.authorization = authentication.headers.authorization; + return request4(endpoint4); } const { token, createdAt } = await getInstallationAuthentication( state, {}, - request2.defaults({ baseUrl: endpoint2.baseUrl }) + request4.defaults({ baseUrl: endpoint4.baseUrl }) ); - endpoint2.headers.authorization = `token ${token}`; + endpoint4.headers.authorization = `token ${token}`; return sendRequestWithRetries( state, - request2, - endpoint2, + request4, + endpoint4, createdAt ); } -async function sendRequestWithRetries(state, request2, options, createdAt, retries = 0) { +async function sendRequestWithRetries(state, request4, options, createdAt, retries = 0) { const timeSinceTokenCreationInMs = +/* @__PURE__ */ new Date() - +new Date(createdAt); try { - return await request2(options); + return await request4(options); } catch (error) { if (error.status !== 401) { throw error; @@ -47127,10 +48218,10 @@ async function sendRequestWithRetries(state, request2, options, createdAt, retri `[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${retries}, wait: ${awaitTime / 1e3}s)` ); await new Promise((resolve) => setTimeout(resolve, awaitTime)); - return sendRequestWithRetries(state, request2, options, createdAt, retries); + return sendRequestWithRetries(state, request4, options, createdAt, retries); } } -var VERSION12 = "7.1.4"; +var VERSION16 = "7.1.5"; function createAppAuth(options) { if (!options.appId) { throw new Error("[@octokit/auth-app] appId option is required"); @@ -47149,14 +48240,14 @@ function createAppAuth(options) { }, options.log ); - const request2 = options.request || request.defaults({ + const request4 = options.request || request.defaults({ headers: { - "user-agent": `octokit-auth-app.js/${VERSION12} ${getUserAgent()}` + "user-agent": `octokit-auth-app.js/${VERSION16} ${getUserAgent()}` } }); const state = Object.assign( { - request: request2, + request: request4, cache: getCache() }, options, @@ -47167,7 +48258,7 @@ function createAppAuth(options) { clientType: "github-app", clientId: options.clientId || "", clientSecret: options.clientSecret || "", - request: request2 + request: request4 }) } ); diff --git a/github-actions/post-approval-changes/main.js b/github-actions/post-approval-changes/main.js index 6cec33504..9381428ce 100644 --- a/github-actions/post-approval-changes/main.js +++ b/github-actions/post-approval-changes/main.js @@ -3699,11 +3699,11 @@ var require_util2 = __commonJS({ } return location; } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -3769,7 +3769,7 @@ var require_util2 = __commonJS({ } return true; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const { headersList } = actualResponse; const policyHeader = (headersList.get("referrer-policy") ?? "").split(","); let policy = ""; @@ -3783,7 +3783,7 @@ var require_util2 = __commonJS({ } } if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -3800,33 +3800,33 @@ var require_util2 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; - if (request2.responseTainting === "cors" || request2.mode === "websocket") { + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; + if (request4.responseTainting === "cors" || request4.mode === "websocket") { if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } } } @@ -3858,26 +3858,26 @@ var require_util2 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (request2.referrer instanceof URL) { - referrerSource = request2.referrer; + } else if (request4.referrer instanceof URL) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); if (referrerURL.toString().length > 4096) { referrerURL = referrerOrigin; } - const areSameOrigin = sameOrigin(request2, referrerURL); - const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request2.url); + const areSameOrigin = sameOrigin(request4, referrerURL); + const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request4.url); switch (policy) { case "origin": return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true); @@ -3888,7 +3888,7 @@ var require_util2 = __commonJS({ case "origin-when-cross-origin": return areSameOrigin ? referrerURL : referrerOrigin; case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -4037,7 +4037,7 @@ var require_util2 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -5923,25 +5923,25 @@ var require_request = __commonJS({ static [kHTTP2BuildRequest](origin, opts, handler2) { const headers = opts.headers; opts = { ...opts, headers: null }; - const request2 = new Request(origin, opts, handler2); - request2.headers = {}; + const request4 = new Request(origin, opts, handler2); + request4.headers = {}; if (Array.isArray(headers)) { if (headers.length % 2 !== 0) { throw new InvalidArgumentError("headers array must be even"); } for (let i = 0; i < headers.length; i += 2) { - processHeader(request2, headers[i], headers[i + 1], true); + processHeader(request4, headers[i], headers[i + 1], true); } } else if (headers && typeof headers === "object") { const keys = Object.keys(headers); for (let i = 0; i < keys.length; i++) { const key = keys[i]; - processHeader(request2, key, headers[key], true); + processHeader(request4, key, headers[key], true); } } else if (headers != null) { throw new InvalidArgumentError("headers must be an object or an array"); } - return request2; + return request4; } static [kHTTP2CopyHeaders](raw) { const rawHeaders = raw.split("\r\n"); @@ -5969,28 +5969,28 @@ var require_request = __commonJS({ return skipAppend ? val : `${key}: ${val}\r `; } - function processHeader(request2, key, val, skipAppend = false) { + function processHeader(request4, key, val, skipAppend = false) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { return; } - if (request2.host === null && key.length === 4 && key.toLowerCase() === "host") { + if (request4.host === null && key.length === 4 && key.toLowerCase() === "host") { if (headerCharRegex.exec(val) !== null) { throw new InvalidArgumentError(`invalid ${key} header`); } - request2.host = val; - } else if (request2.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { - request2.contentType = val; + } else if (request4.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { + request4.contentType = val; if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } else if (key.length === 17 && key.toLowerCase() === "transfer-encoding") { throw new InvalidArgumentError("invalid transfer-encoding header"); } else if (key.length === 10 && key.toLowerCase() === "connection") { @@ -5998,7 +5998,7 @@ var require_request = __commonJS({ if (value !== "close" && value !== "keep-alive") { throw new InvalidArgumentError("invalid connection header"); } else if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (key.length === 10 && key.toLowerCase() === "keep-alive") { throw new InvalidArgumentError("invalid keep-alive header"); @@ -6012,19 +6012,19 @@ var require_request = __commonJS({ if (Array.isArray(val)) { for (let i = 0; i < val.length; i++) { if (skipAppend) { - if (request2.headers[key]) - request2.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; + if (request4.headers[key]) + request4.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; else - request2.headers[key] = processHeaderValue(key, val[i], skipAppend); + request4.headers[key] = processHeaderValue(key, val[i], skipAppend); } else { - request2.headers += processHeaderValue(key, val[i]); + request4.headers += processHeaderValue(key, val[i]); } } } else { if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } } } @@ -7168,10 +7168,10 @@ var require_client = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); - this[kQueue].push(request2); + const request4 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; process.nextTick(resume, this); } else { @@ -7195,8 +7195,8 @@ var require_client = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -7244,13 +7244,13 @@ var require_client = __commonJS({ assert(this[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } } else if (client[kRunning] > 0) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7456,8 +7456,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } } @@ -7497,12 +7497,12 @@ var require_client = __commonJS({ onUpgrade(head) { const { upgrade, client, socket, headers, statusCode } = this; assert(upgrade); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(!socket.destroyed); assert(socket === client[kSocket]); assert(!this.paused); - assert(request2.upgrade || request2.method === "CONNECT"); + assert(request4.upgrade || request4.method === "CONNECT"); this.statusCode = null; this.statusText = ""; this.shouldKeepAlive = null; @@ -7519,7 +7519,7 @@ var require_client = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -7530,8 +7530,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert(!this.upgrade); @@ -7540,22 +7540,22 @@ var require_client = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert.strictEqual(this.timeoutType, TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -7586,11 +7586,11 @@ var require_client = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -7607,8 +7607,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert.strictEqual(this.timeoutType, TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -7621,7 +7621,7 @@ var require_client = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } } @@ -7633,8 +7633,8 @@ var require_client = __commonJS({ if (upgrade) { return; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(statusCode >= 100); this.statusCode = null; this.statusText = ""; @@ -7648,11 +7648,11 @@ var require_client = __commonJS({ if (statusCode < 200) { return; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert.strictEqual(client[kRunning], 0); @@ -7710,8 +7710,8 @@ var require_client = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } assert(client[kSize] === 0); } @@ -7741,13 +7741,13 @@ var require_client = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7880,8 +7880,8 @@ var require_client = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + errorRequest(client, request4, err); } } else { onError(client, err); @@ -7935,8 +7935,8 @@ var require_client = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request3 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request3.headersTimeout != null ? request3.headersTimeout : client[kHeadersTimeout]; + const request5 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request5.headersTimeout != null ? request5.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -7958,13 +7958,13 @@ var require_client = __commonJS({ if (client[kRunning] >= (client[kPipelining] || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; - if (socket && socket.servername !== request2.servername) { + client[kServerName] = request4.servername; + if (socket && socket.servername !== request4.servername) { util.destroy(socket, new InformationalError("servername changed")); return; } @@ -7979,16 +7979,16 @@ var require_client = __commonJS({ if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) { return; } - if (client[kRunning] > 0 && !request2.idempotent) { + if (client[kRunning] > 0 && !request4.idempotent) { return; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body))) { return; } - if (!request2.aborted && write(client, request2)) { + if (!request4.aborted && write(client, request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -7998,12 +7998,12 @@ var require_client = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function write(client, request2) { + function write(client, request4) { if (client[kHTTPConnVersion] === "h2") { - writeH2(client, client[kHTTP2Session], request2); + writeH2(client, client[kHTTP2Session], request4); return; } - const { body, method, path, host, upgrade, headers, blocking, reset } = request2; + const { body, method, path, host, upgrade, headers, blocking, reset } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { body.read(0); @@ -8011,31 +8011,31 @@ var require_client = __commonJS({ const bodyLength = util.bodyLength(body); let contentLength = bodyLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(socket, new InformationalError("aborted")); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -8074,7 +8074,7 @@ upgrade: ${upgrade}\r header += headers; } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { if (contentLength === 0) { @@ -8086,7 +8086,7 @@ upgrade: ${upgrade}\r socket.write(`${header}\r `, "latin1"); } - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); socket.cork(); @@ -8095,48 +8095,48 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable({ body: body.stream(), client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body: body.stream(), client, request: request4, socket, contentLength, header, expectsPayload }); } else { - writeBlob({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeBlob({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } } else if (util.isStream(body)) { - writeStream({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeStream({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else if (util.isIterable(body)) { - writeIterable({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else { assert(false); } return true; } - function writeH2(client, session, request2) { - const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; + function writeH2(client, session, request4) { + const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; let headers; if (typeof reqHeaders === "string") headers = Request[kHTTP2CopyHeaders](reqHeaders.trim()); else headers = reqHeaders; if (upgrade) { - errorRequest(client, request2, new Error("Upgrade not supported for H2")); + errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } let stream; @@ -8147,11 +8147,11 @@ upgrade: ${upgrade}\r session.ref(); stream = session.request(headers, { endStream: false, signal }); if (stream.id && !stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; }); } @@ -8170,14 +8170,14 @@ upgrade: ${upgrade}\r } let contentLength = util.bodyLength(body); if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -8202,15 +8202,15 @@ upgrade: ${upgrade}\r ++h2State.openStreams; stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - if (request2.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.once("end", () => { - request2.onComplete([]); + request4.onComplete([]); }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -8228,7 +8228,7 @@ upgrade: ${upgrade}\r }); stream.once("frameError", (type, code) => { const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`); - errorRequest(client, request2, err); + errorRequest(client, request4, err); if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { h2State.streams -= 1; util.destroy(stream, err); @@ -8237,20 +8237,20 @@ upgrade: ${upgrade}\r return true; function writeBodyH2() { if (!body) { - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); stream.cork(); stream.write(body); stream.uncork(); stream.end(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { writeIterable({ client, - request: request2, + request: request4, contentLength, h2stream: stream, expectsPayload, @@ -8262,7 +8262,7 @@ upgrade: ${upgrade}\r writeBlob({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, h2stream: stream, @@ -8274,7 +8274,7 @@ upgrade: ${upgrade}\r writeStream({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, socket: client[kSocket], @@ -8285,7 +8285,7 @@ upgrade: ${upgrade}\r writeIterable({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, header: "", @@ -8297,11 +8297,11 @@ upgrade: ${upgrade}\r } } } - function writeStream({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + function writeStream({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); if (client[kHTTPConnVersion] === "h2") { let onPipeData = function(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); }; const pipe = pipeline( body, @@ -8311,7 +8311,7 @@ upgrade: ${upgrade}\r util.destroy(body, err); util.destroy(h2stream, err); } else { - request2.onRequestSent(); + request4.onRequestSent(); } } ); @@ -8323,7 +8323,7 @@ upgrade: ${upgrade}\r return; } let finished = false; - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -8379,7 +8379,7 @@ upgrade: ${upgrade}\r } socket.on("drain", onDrain).on("error", onFinished); } - async function writeBlob({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeBlob({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength === body.size, "blob body must have content length"); const isH2 = client[kHTTPConnVersion] === "h2"; try { @@ -8399,8 +8399,8 @@ upgrade: ${upgrade}\r socket.write(buffer); socket.uncork(); } - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -8409,7 +8409,7 @@ upgrade: ${upgrade}\r util.destroy(isH2 ? h2stream : socket, err); } } - async function writeIterable({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeIterable({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -8435,7 +8435,7 @@ upgrade: ${upgrade}\r throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } @@ -8443,14 +8443,14 @@ upgrade: ${upgrade}\r } catch (err) { h2stream.destroy(err); } finally { - request2.onRequestSent(); + request4.onRequestSent(); h2stream.end(); h2stream.off("close", onDrain).off("drain", onDrain); } return; } socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -8468,9 +8468,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -8479,7 +8479,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -8518,7 +8518,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -8529,8 +8529,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -8573,10 +8573,10 @@ ${len.toString(16)}\r } } }; - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert(request2.aborted); + request4.onError(err); + assert(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -9671,10 +9671,10 @@ var require_api_request = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -9689,7 +9689,7 @@ var require_api_request = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -10403,7 +10403,7 @@ var require_mock_utils = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (typeof data === "object") { @@ -10508,7 +10508,7 @@ var require_mock_utils = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); handler2.abort = nop; @@ -10565,7 +10565,7 @@ var require_mock_utils = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -10587,7 +10587,7 @@ var require_mock_utils = __commonJS({ var require_mock_interceptor = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils(); var { kDispatches, kDispatchKey, @@ -10650,7 +10650,7 @@ var require_mock_interceptor = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData(statusCode, data, responseOptions = {}) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -12299,7 +12299,7 @@ var require_request2 = __commonJS({ policyContainer: makePolicyContainer() } }; - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = this[kRealm].settingsObject.baseUrl; let signal = null; @@ -12315,17 +12315,17 @@ var require_request2 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(input instanceof Request); - request2 = input[kState]; + request4 = input[kState]; signal = input[kSignal]; } const origin = this[kRealm].settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request4.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -12333,43 +12333,43 @@ var require_request2 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: this[kRealm].settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -12378,14 +12378,14 @@ var require_request2 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, this[kRealm].settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -12400,27 +12400,27 @@ var require_request2 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; @@ -12431,12 +12431,12 @@ var require_request2 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizeMethodRecord[method] ?? normalizeMethod(method); - request2.method = method; + request4.method = method; } if (init.signal !== void 0) { signal = init.signal; } - this[kState] = request2; + this[kState] = request4; const ac = new AbortController(); this[kSignal] = ac.signal; this[kSignal][kRealm] = this[kRealm]; @@ -12470,13 +12470,13 @@ var require_request2 = __commonJS({ } } this[kHeaders] = new Headers(kConstruct); - this[kHeaders][kHeadersList] = request2.headersList; + this[kHeaders][kHeadersList] = request4.headersList; this[kHeaders][kGuard] = "request"; this[kHeaders][kRealm] = this[kRealm]; if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } this[kHeaders][kGuard] = "request-no-cors"; @@ -12495,14 +12495,14 @@ var require_request2 = __commonJS({ } } const inputBody = input instanceof Request ? input[kState].body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !this[kHeaders][kHeadersList].contains("content-type")) { @@ -12514,12 +12514,12 @@ var require_request2 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -12649,7 +12649,7 @@ var require_request2 = __commonJS({ }; mixinBody(Request); function makeRequest(init) { - const request2 = { + const request4 = { method: "GET", localURLsOnly: false, unsafeRequest: false, @@ -12688,13 +12688,13 @@ var require_request2 = __commonJS({ ...init, headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; - request2.url = request2.urlList[0]; - return request2; + request4.url = request4.urlList[0]; + return request4; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(request4.body); } return newRequest; } @@ -12924,14 +12924,14 @@ var require_fetch = __commonJS({ p.reject(e); return p.promise; } - const request2 = requestObject[kState]; + const request4 = requestObject[kState]; if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; const relevantRealm = null; @@ -12943,7 +12943,7 @@ var require_fetch = __commonJS({ locallyAborted = true; assert(controller != null); controller.abort(requestObject.signal.reason); - abortFetch(p, request2, responseObject, requestObject.signal.reason); + abortFetch(p, request4, responseObject, requestObject.signal.reason); } ); const handleFetchDone = (response) => finalizeAndReportTiming(response, "fetch"); @@ -12952,7 +12952,7 @@ var require_fetch = __commonJS({ return Promise.resolve(); } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return Promise.resolve(); } if (response.type === "error") { @@ -12970,7 +12970,7 @@ var require_fetch = __commonJS({ p.resolve(responseObject); }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: init.dispatcher ?? getGlobalDispatcher() @@ -13015,14 +13015,14 @@ var require_fetch = __commonJS({ performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis2, cacheState); } } - function abortFetch(p, request2, responseObject, error) { + function abortFetch(p, request4, responseObject, error) { var _a, _b; if (!error) { error = new DOMException2("The operation was aborted.", "AbortError"); } p.reject(error); - if (request2.body != null && isReadable((_a = request2.body) == null ? void 0 : _a.stream)) { - request2.body.stream.cancel(error).catch((err) => { + if (request4.body != null && isReadable((_a = request4.body) == null ? void 0 : _a.stream)) { + request4.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -13043,7 +13043,7 @@ var require_fetch = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -13055,9 +13055,9 @@ var require_fetch = __commonJS({ var _a, _b, _c, _d; let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currenTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -13065,7 +13065,7 @@ var require_fetch = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -13075,32 +13075,32 @@ var require_fetch = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a = request4.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = (_d = request2.client) == null ? void 0 : _d.origin; + if (request4.origin === "client") { + request4.origin = (_d = request4.client) == null ? void 0 : _d.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept")) { + if (!request4.headersList.contains("accept")) { const value = "*/*"; - request2.headersList.append("accept", value); + request4.headersList.append("accept", value); } - if (!request2.headersList.contains("accept-language")) { - request2.headersList.append("accept-language", "*"); + if (!request4.headersList.contains("accept-language")) { + request4.headersList.append("accept-language", "*"); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -13108,44 +13108,44 @@ var require_fetch = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { response = await (async () => { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; return await schemeFetch(fetchParams); } - if (request2.mode === "same-origin") { + if (request4.mode === "same-origin") { return makeNetworkError('request mode cannot be "same-origin"'); } - if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { return makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; return await schemeFetch(fetchParams); } - if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { return makeNetworkError("URL scheme must be a HTTP(S) scheme"); } - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; return await httpFetch(fetchParams); })(); } @@ -13153,13 +13153,13 @@ var require_fetch = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -13167,26 +13167,26 @@ var require_fetch = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range")) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range")) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -13202,8 +13202,8 @@ var require_fetch = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -13212,12 +13212,12 @@ var require_fetch = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blobURLEntryObject = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !isBlobLike(blobURLEntryObject)) { + if (request4.method !== "GET" || !isBlobLike(blobURLEntryObject)) { return Promise.resolve(makeNetworkError("invalid method")); } const bodyWithType = safelyExtractBody(blobURLEntryObject); @@ -13235,7 +13235,7 @@ var require_fetch = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -13317,41 +13317,41 @@ var require_fetch = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -13361,13 +13361,13 @@ var require_fetch = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -13378,63 +13378,63 @@ var require_fetch = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization"); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie"); - request2.headersList.delete("host"); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization"); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie"); + request4.headersList.delete("host"); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = makeRequest(request2); + httpRequest = makeRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -13511,7 +13511,7 @@ var require_fetch = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -13519,7 +13519,7 @@ var require_fetch = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -13547,21 +13547,21 @@ var require_fetch = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -13590,7 +13590,7 @@ var require_fetch = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -13702,17 +13702,17 @@ var require_fetch = __commonJS({ } return response; async function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: fetchParams.controller.dispatcher.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: fetchParams.controller.dispatcher.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -13758,8 +13758,8 @@ var require_fetch = __commonJS({ } this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = request2.redirect === "follow" && location && redirectStatusSet.has(status); - if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = request4.redirect === "follow" && location && redirectStatusSet.has(status); + if (request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (const coding of codings) { if (coding === "x-gzip" || coding === "gzip") { decoders.push(zlib.createGunzip({ @@ -14693,36 +14693,36 @@ var require_cache = __commonJS({ } this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); - const p = await this.matchAll(request2, options); + const p = await this.matchAll(request4, options); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { var _a; webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -14744,11 +14744,11 @@ var require_cache = __commonJS({ } return Object.freeze(responseList); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.add" }); - request2 = webidl.converters.RequestInfo(request2); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -14758,11 +14758,11 @@ var require_cache = __commonJS({ requests = webidl.converters["sequence"](requests); const responsePromises = []; const requestList = []; - for (const request2 of requests) { - if (typeof request2 === "string") { + for (const request4 of requests) { + if (typeof request4 === "string") { continue; } - const r = request2[kState]; + const r = request4[kState]; if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14771,8 +14771,8 @@ var require_cache = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = new Request(request2)[kState]; + for (const request4 of requests) { + const r = new Request(request4)[kState]; if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14847,16 +14847,16 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 2, { header: "Cache.put" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); response = webidl.converters.Response(response); let innerRequest = null; - if (request2 instanceof Request) { - innerRequest = request2[kState]; + if (request4 instanceof Request) { + innerRequest = request4[kState]; } else { - innerRequest = new Request(request2)[kState]; + innerRequest = new Request(request4)[kState]; } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -14924,20 +14924,20 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.delete" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = new Request(request2)[kState]; + assert(typeof request4 === "string"); + r = new Request(request4)[kState]; } const operations = []; const operation = { @@ -14963,25 +14963,25 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -14993,12 +14993,12 @@ var require_cache = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = new Request("https://a"); - requestObject[kState] = request3; - requestObject[kHeaders][kHeadersList] = request3.headersList; + requestObject[kState] = request5; + requestObject[kHeaders][kHeadersList] = request5.headersList; requestObject[kHeaders][kGuard] = "immutable"; - requestObject[kRealm] = request3.client; + requestObject[kRealm] = request5.client; requestList.push(requestObject); } promise.resolve(Object.freeze(requestList)); @@ -15093,9 +15093,9 @@ var require_cache = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -15111,7 +15111,7 @@ var require_cache = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -15183,21 +15183,21 @@ var require_cachestorage = __commonJS({ webidl.illegalConstructor(); } } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, { header: "CacheStorage.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -16110,7 +16110,7 @@ var require_connection = __commonJS({ function establishWebSocketConnection(url, protocols, ws, onEstablish, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], serviceWorkers: "none", referrer: "no-referrer", @@ -16121,17 +16121,17 @@ var require_connection = __commonJS({ }); if (options.headers) { const headersList = new Headers(options.headers)[kHeadersList]; - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue); - request2.headersList.append("sec-websocket-version", "13"); + request4.headersList.append("sec-websocket-key", keyValue); + request4.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol); + request4.headersList.append("sec-websocket-protocol", protocol); } const permessageDeflate = ""; const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher ?? getGlobalDispatcher(), processResponse(response) { @@ -16164,7 +16164,7 @@ var require_connection = __commonJS({ return; } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); - if (secProtocol !== null && secProtocol !== request2.headersList.get("Sec-WebSocket-Protocol")) { + if (secProtocol !== null && secProtocol !== request4.headersList.get("Sec-WebSocket-Protocol")) { failWebsocketConnection(ws, "Protocol was not set in the opening handshake."); return; } @@ -17209,7 +17209,7 @@ var require_lib = __commonJS({ } exports.isHttps = isHttps; var HttpClient = class { - constructor(userAgent2, handlers, requestOptions) { + constructor(userAgent4, handlers, requestOptions) { this._ignoreSslError = false; this._allowRedirects = true; this._allowRedirectDowngrade = false; @@ -17218,7 +17218,7 @@ var require_lib = __commonJS({ this._maxRetries = 1; this._keepAlive = false; this._disposed = false; - this.userAgent = userAgent2; + this.userAgent = userAgent4; this.handlers = handlers || []; this.requestOptions = requestOptions; if (requestOptions) { @@ -17483,14 +17483,14 @@ var require_lib = __commonJS({ } _mergeHeaders(headers) { if (this.requestOptions && this.requestOptions.headers) { - return Object.assign({}, lowercaseKeys2(this.requestOptions.headers), lowercaseKeys2(headers || {})); + return Object.assign({}, lowercaseKeys4(this.requestOptions.headers), lowercaseKeys4(headers || {})); } - return lowercaseKeys2(headers || {}); + return lowercaseKeys4(headers || {}); } _getExistingOrDefaultHeader(additionalHeaders, header, _default) { let clientHeader; if (this.requestOptions && this.requestOptions.headers) { - clientHeader = lowercaseKeys2(this.requestOptions.headers)[header]; + clientHeader = lowercaseKeys4(this.requestOptions.headers)[header]; } return additionalHeaders[header] || clientHeader || _default; } @@ -17625,7 +17625,7 @@ var require_lib = __commonJS({ } }; exports.HttpClient = HttpClient; - var lowercaseKeys2 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + var lowercaseKeys4 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); } }); @@ -20462,10 +20462,10 @@ var require_util8 = __commonJS({ } return obj; } - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert(request2.aborted); + request4.onError(err); + assert(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -20993,7 +20993,7 @@ var require_request3 = __commonJS({ return this; } }; - function processHeader(request2, key, val) { + function processHeader(request4, key, val) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { @@ -21032,19 +21032,19 @@ var require_request3 = __commonJS({ } else { val = `${val}`; } - if (request2.host === null && headerName === "host") { + if (request4.host === null && headerName === "host") { if (typeof val !== "string") { throw new InvalidArgumentError("invalid host header"); } - request2.host = val; - } else if (request2.contentLength === null && headerName === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && headerName === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && headerName === "content-type") { - request2.contentType = val; - request2.headers.push(key, val); + } else if (request4.contentType === null && headerName === "content-type") { + request4.contentType = val; + request4.headers.push(key, val); } else if (headerName === "transfer-encoding" || headerName === "keep-alive" || headerName === "upgrade") { throw new InvalidArgumentError(`invalid ${headerName} header`); } else if (headerName === "connection") { @@ -21053,12 +21053,12 @@ var require_request3 = __commonJS({ throw new InvalidArgumentError("invalid connection header"); } if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (headerName === "expect") { throw new NotSupportedError("expect header not supported"); } else { - request2.headers.push(key, val); + request4.headers.push(key, val); } } module.exports = Request; @@ -23371,11 +23371,11 @@ var require_util9 = __commonJS({ function normalizeBinaryStringToUtf8(value) { return Buffer.from(value, "binary").toString("utf8"); } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -23412,10 +23412,10 @@ var require_util9 = __commonJS({ } return policy; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const policy = parseReferrerPolicy(actualResponse); if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -23432,33 +23432,33 @@ var require_util9 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header, true); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; if (serializedOrigin === "client" || serializedOrigin === void 0) { return; } - if (request2.responseTainting === "cors" || request2.mode === "websocket") { - request2.headersList.append("origin", serializedOrigin, true); - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + if (request4.responseTainting === "cors" || request4.mode === "websocket") { + request4.headersList.append("origin", serializedOrigin, true); + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } - request2.headersList.append("origin", serializedOrigin, true); + request4.headersList.append("origin", serializedOrigin, true); } } function coarsenTime(timestamp, crossOriginIsolatedCapability) { @@ -23512,18 +23512,18 @@ var require_util9 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (webidl.is.URL(request2.referrer)) { - referrerSource = request2.referrer; + } else if (webidl.is.URL(request4.referrer)) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); @@ -23541,14 +23541,14 @@ var require_util9 = __commonJS({ case "unsafe-url": return referrerURL; case "strict-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } return referrerOrigin; } case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -23558,17 +23558,17 @@ var require_util9 = __commonJS({ return referrerOrigin; } case "same-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return "no-referrer"; case "origin-when-cross-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return referrerOrigin; case "no-referrer-when-downgrade": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } @@ -23732,7 +23732,7 @@ var require_util9 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -25205,11 +25205,11 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } - request2.onResponseStarted(); + request4.onResponseStarted(); return 0; } onHeaderField(buf) { @@ -25257,9 +25257,9 @@ var require_client_h1 = __commonJS({ assert(!socket.destroyed); assert(!this.paused); assert((headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); - assert(request2.upgrade || request2.method === "CONNECT"); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); + assert(request4.upgrade || request4.method === "CONNECT"); this.statusCode = 0; this.statusText = ""; this.shouldKeepAlive = false; @@ -25276,7 +25276,7 @@ var require_client_h1 = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -25287,8 +25287,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert(!this.upgrade); @@ -25297,22 +25297,22 @@ var require_client_h1 = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert(this.timeoutType === TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -25343,11 +25343,11 @@ var require_client_h1 = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -25364,8 +25364,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(this.timeoutType === TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -25378,7 +25378,7 @@ var require_client_h1 = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } return 0; @@ -25393,8 +25393,8 @@ var require_client_h1 = __commonJS({ } assert(statusCode >= 100); assert((this.headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); this.statusCode = 0; this.statusText = ""; this.bytesRead = 0; @@ -25406,11 +25406,11 @@ var require_client_h1 = __commonJS({ if (statusCode < 200) { return 0; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert(client[kRunning] === 0); @@ -25476,8 +25476,8 @@ var require_client_h1 = __commonJS({ return { version: "h1", defaultPipelining: 1, - write(request2) { - return writeH1(client, request2); + write(request4) { + return writeH1(client, request4); }, resume() { resumeH1(client); @@ -25493,18 +25493,18 @@ var require_client_h1 = __commonJS({ get destroyed() { return socket.destroyed; }, - busy(request2) { + busy(request4) { if (socket[kWriting] || socket[kReset] || socket[kBlocking]) { return true; } - if (request2) { - if (client[kRunning] > 0 && !request2.idempotent) { + if (request4) { + if (client[kRunning] > 0 && !request4.idempotent) { return true; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return true; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body) || util.isFormDataLike(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body) || util.isFormDataLike(request4.body))) { return true; } } @@ -25551,13 +25551,13 @@ var require_client_h1 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -25585,8 +25585,8 @@ var require_client_h1 = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request2 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request2.headersTimeout != null ? request2.headersTimeout : client[kHeadersTimeout]; + const request4 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request4.headersTimeout != null ? request4.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -25595,21 +25595,21 @@ var require_client_h1 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH1(client, request2) { - const { method, path, host, upgrade, blocking, reset } = request2; - let { body, headers, contentLength } = request2; + function writeH1(client, request4) { + const { method, path, host, upgrade, blocking, reset } = request4; + let { body, headers, contentLength } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH"; if (util.isFormDataLike(body)) { if (!extractBody) { extractBody = require_body2().extractBody; } const [bodyStream, contentType] = extractBody(body); - if (request2.contentType == null) { + if (request4.contentType == null) { headers.push("content-type", contentType); } body = bodyStream.stream; contentLength = bodyStream.length; - } else if (util.isBlobLike(body) && request2.contentType == null && body.type) { + } else if (util.isBlobLike(body) && request4.contentType == null && body.type) { headers.push("content-type", body.type); } if (body && typeof body.read === "function") { @@ -25618,33 +25618,33 @@ var require_client_h1 = __commonJS({ const bodyLength = util.bodyLength(body); contentLength = bodyLength ?? contentLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - util.errorRequest(client, request2, err || new RequestAbortedError()); + util.errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(body); util.destroy(socket, new InformationalError("aborted")); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -25695,31 +25695,31 @@ upgrade: ${upgrade}\r } } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { - writeBuffer(abort, null, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, null, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBuffer(body)) { - writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable(abort, body.stream(), client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body.stream(), client, request4, socket, contentLength, header, expectsPayload); } else { - writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload); } } else if (util.isStream(body)) { - writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isIterable(body)) { - writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else { assert(false); } return true; } - function writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); let finished = false; - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -25785,7 +25785,7 @@ upgrade: ${upgrade}\r setImmediate(onClose); } } - function writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload) { try { if (!body) { if (contentLength === 0) { @@ -25805,18 +25805,18 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(body); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (err) { abort(err); } } - async function writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -25829,9 +25829,9 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(buffer); socket.uncork(); - request2.onBodySent(buffer); - request2.onRequestSent(); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(buffer); + request4.onRequestSent(); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } client[kResume](); @@ -25839,7 +25839,7 @@ upgrade: ${upgrade}\r abort(err); } } - async function writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -25858,7 +25858,7 @@ upgrade: ${upgrade}\r } }); socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -25876,9 +25876,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ abort, socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ abort, socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -25888,7 +25888,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -25907,7 +25907,7 @@ upgrade: ${upgrade}\r } socket.cork(); if (bytesWritten === 0) { - if (!expectsPayload && request2.reset !== false) { + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } if (contentLength === null) { @@ -25927,7 +25927,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -25938,8 +25938,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -26082,8 +26082,8 @@ var require_client_h2 = __commonJS({ return { version: "h2", defaultPipelining: Infinity, - write(request2) { - return writeH2(client, request2); + write(request4) { + return writeH2(client, request4); }, resume() { resumeH2(client); @@ -26141,9 +26141,9 @@ var require_client_h2 = __commonJS({ this[kHTTP2Session] = null; util.destroy(this[kSocket], err); if (client[kRunningIdx] < client[kQueue].length) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); client[kPendingIdx] = client[kRunningIdx]; } assert(client[kRunning] === 0); @@ -26160,8 +26160,8 @@ var require_client_h2 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } } @@ -26192,13 +26192,13 @@ var require_client_h2 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH2(client, request2) { - const requestTimeout = request2.bodyTimeout ?? client[kBodyTimeout]; + function writeH2(client, request4) { + const requestTimeout = request4.bodyTimeout ?? client[kBodyTimeout]; const session = client[kHTTP2Session]; - const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; - let { body } = request2; + const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; + let { body } = request4; if (upgrade) { - util.errorRequest(client, request2, new Error("Upgrade not supported for H2")); + util.errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } const headers = {}; @@ -26222,11 +26222,11 @@ var require_client_h2 = __commonJS({ headers[HTTP2_HEADER_AUTHORITY] = host || `${hostname}${port ? `:${port}` : ""}`; headers[HTTP2_HEADER_METHOD] = method; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } err = err || new RequestAbortedError(); - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); if (stream != null) { stream.removeAllListeners("data"); stream.close(); @@ -26236,23 +26236,23 @@ var require_client_h2 = __commonJS({ util.destroy(body, err); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "CONNECT") { session.ref(); stream = session.request(headers, { endStream: false, signal }); if (!stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; }); @@ -26280,14 +26280,14 @@ var require_client_h2 = __commonJS({ contentLength = bodyStream.length; } if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -26303,7 +26303,7 @@ var require_client_h2 = __commonJS({ header += `${key}: ${headers[key]}\r `; } - channels.sendHeaders.publish({ request: request2, headers: header, socket: session[kSocket] }); + channels.sendHeaders.publish({ request: request4, headers: header, socket: session[kSocket] }); } const shouldEndStream = method === "GET" || method === "HEAD" || body === null; if (expectContinue) { @@ -26321,17 +26321,17 @@ var require_client_h2 = __commonJS({ stream.setTimeout(requestTimeout); stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - request2.onResponseStarted(); - if (request2.aborted) { + request4.onResponseStarted(); + if (request4.aborted) { stream.removeAllListeners("data"); return; } - if (request2.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -26339,8 +26339,8 @@ var require_client_h2 = __commonJS({ var _a; stream.removeAllListeners("data"); if (((_a = stream.state) == null ? void 0 : _a.state) == null || stream.state.state < 6) { - if (!request2.aborted && !request2.completed) { - request2.onComplete({}); + if (!request4.aborted && !request4.completed) { + request4.onComplete({}); } client[kQueue][client[kRunningIdx]++] = null; client[kResume](); @@ -26383,10 +26383,10 @@ var require_client_h2 = __commonJS({ abort(err); }); stream.once("trailers", (trailers) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - request2.onComplete(trailers); + request4.onComplete(trailers); }); return true; function writeBodyH2() { @@ -26396,7 +26396,7 @@ var require_client_h2 = __commonJS({ stream, null, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26407,7 +26407,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26419,7 +26419,7 @@ var require_client_h2 = __commonJS({ stream, body.stream(), client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26430,7 +26430,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26444,7 +26444,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, contentLength ); } else if (util.isIterable(body)) { @@ -26453,7 +26453,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26463,7 +26463,7 @@ var require_client_h2 = __commonJS({ } } } - function writeBuffer(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + function writeBuffer(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { try { if (body != null && util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); @@ -26471,18 +26471,18 @@ var require_client_h2 = __commonJS({ h2stream.write(body); h2stream.uncork(); h2stream.end(); - request2.onBodySent(body); + request4.onBodySent(body); } if (!expectsPayload) { socket[kReset] = true; } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (error) { abort(error); } } - function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) { + function writeStream(abort, socket, expectsPayload, h2stream, body, client, request4, contentLength) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); const pipe = pipeline( body, @@ -26493,7 +26493,7 @@ var require_client_h2 = __commonJS({ abort(err); } else { util.removeAllListeners(pipe); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26503,10 +26503,10 @@ var require_client_h2 = __commonJS({ ); util.addListener(pipe, "data", onPipeData); function onPipeData(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); } } - async function writeBlob(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeBlob(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -26517,8 +26517,8 @@ var require_client_h2 = __commonJS({ h2stream.write(buffer); h2stream.uncork(); h2stream.end(); - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26527,7 +26527,7 @@ var require_client_h2 = __commonJS({ abort(err); } } - async function writeIterable(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeIterable(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -26552,13 +26552,13 @@ var require_client_h2 = __commonJS({ throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } } h2stream.end(); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26805,10 +26805,10 @@ var require_client2 = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = new Request(origin, opts, handler2); - this[kQueue].push(request2); + const request4 = new Request(origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; queueMicrotask(() => resume(this)); } else { @@ -26832,8 +26832,8 @@ var require_client2 = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(this, request2, err); + const request4 = requests[i]; + util.errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -26857,8 +26857,8 @@ var require_client2 = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } assert(client[kSize] === 0); } @@ -26962,8 +26962,8 @@ var require_client2 = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - util.errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + util.errorRequest(client, request4, err); } } else { onError(client, err); @@ -27021,12 +27021,12 @@ var require_client2 = __commonJS({ if (client[kRunning] >= (getPipelining(client) || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; + client[kServerName] = request4.servername; (_a = client[kHTTPContext]) == null ? void 0 : _a.destroy(new InformationalError("servername changed"), () => { client[kHTTPContext] = null; resume(client); @@ -27042,10 +27042,10 @@ var require_client2 = __commonJS({ if (client[kHTTPContext].destroyed) { return; } - if (client[kHTTPContext].busy(request2)) { + if (client[kHTTPContext].busy(request4)) { return; } - if (!request2.aborted && client[kHTTPContext].write(request2)) { + if (!request4.aborted && client[kHTTPContext].write(request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -28659,10 +28659,10 @@ var require_api_request2 = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -28678,7 +28678,7 @@ var require_api_request2 = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -29444,7 +29444,7 @@ var require_mock_utils2 = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (data instanceof Uint8Array) { @@ -29577,7 +29577,7 @@ var require_mock_utils2 = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); (_a = handler2.onConnect) == null ? void 0 : _a.call(handler2, (err) => handler2.onError(err), null); @@ -29634,7 +29634,7 @@ var require_mock_utils2 = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -29657,7 +29657,7 @@ var require_mock_utils2 = __commonJS({ var require_mock_interceptor2 = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils2(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils2(); var { kDispatches, kDispatchKey, @@ -29722,7 +29722,7 @@ var require_mock_interceptor2 = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData({ statusCode, data, responseOptions }) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -32022,7 +32022,7 @@ var require_sqlite_cache_store = __commonJS({ var { Writable } = __require("stream"); var { assertCacheKey, assertCacheValue } = require_cache2(); var DatabaseSync; - var VERSION13 = 3; + var VERSION17 = 3; var MAX_ENTRY_SIZE = 2 * 1e3 * 1e3 * 1e3; module.exports = class SqliteCacheStore { #maxEntrySize = MAX_ENTRY_SIZE; @@ -32061,7 +32061,7 @@ var require_sqlite_cache_store = __commonJS({ } this.#db = new DatabaseSync((opts == null ? void 0 : opts.location) ?? ":memory:"); this.#db.exec(` - CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION13} ( + CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION17} ( -- Data specific to us id INTEGER PRIMARY KEY AUTOINCREMENT, url TEXT NOT NULL, @@ -32080,9 +32080,9 @@ var require_sqlite_cache_store = __commonJS({ staleAt INTEGER NOT NULL ); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_url ON cacheInterceptorV${VERSION13}(url); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_method ON cacheInterceptorV${VERSION13}(method); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_deleteAt ON cacheInterceptorV${VERSION13}(deleteAt); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_url ON cacheInterceptorV${VERSION17}(url); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_method ON cacheInterceptorV${VERSION17}(method); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_deleteAt ON cacheInterceptorV${VERSION17}(deleteAt); `); this.#getValuesQuery = this.#db.prepare(` SELECT @@ -32097,7 +32097,7 @@ var require_sqlite_cache_store = __commonJS({ vary, cachedAt, staleAt - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION17} WHERE url = ? AND method = ? @@ -32105,7 +32105,7 @@ var require_sqlite_cache_store = __commonJS({ deleteAt ASC `); this.#updateValueQuery = this.#db.prepare(` - UPDATE cacheInterceptorV${VERSION13} SET + UPDATE cacheInterceptorV${VERSION17} SET body = ?, deleteAt = ?, statusCode = ?, @@ -32119,7 +32119,7 @@ var require_sqlite_cache_store = __commonJS({ id = ? `); this.#insertValueQuery = this.#db.prepare(` - INSERT INTO cacheInterceptorV${VERSION13} ( + INSERT INTO cacheInterceptorV${VERSION17} ( url, method, body, @@ -32135,20 +32135,20 @@ var require_sqlite_cache_store = __commonJS({ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `); this.#deleteByUrlQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE url = ?` + `DELETE FROM cacheInterceptorV${VERSION17} WHERE url = ?` ); this.#countEntriesQuery = this.#db.prepare( - `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION13}` + `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION17}` ); this.#deleteExpiredValuesQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE deleteAt <= ?` + `DELETE FROM cacheInterceptorV${VERSION17} WHERE deleteAt <= ?` ); this.#deleteOldValuesQuery = this.#maxCount === Infinity ? null : this.#db.prepare(` - DELETE FROM cacheInterceptorV${VERSION13} + DELETE FROM cacheInterceptorV${VERSION17} WHERE id IN ( SELECT id - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION17} ORDER BY cachedAt DESC LIMIT ? ) @@ -33239,7 +33239,7 @@ var require_request4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); input = webidl.converters.RequestInfo(input, prefix, "input"); init = webidl.converters.RequestInit(init, prefix, "init"); - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = environmentSettingsObject.settingsObject.baseUrl; let signal = null; @@ -33256,18 +33256,18 @@ var require_request4 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(webidl.is.Request(input)); - request2 = input.#state; + request4 = input.#state; signal = input.#signal; this.#dispatcher = init.dispatcher || input.#dispatcher; } const origin = environmentSettingsObject.settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request4.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -33275,43 +33275,43 @@ var require_request4 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: environmentSettingsObject.settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -33320,14 +33320,14 @@ var require_request4 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, environmentSettingsObject.settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -33342,33 +33342,33 @@ var require_request4 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; const mayBeNormalized = normalizedMethodRecords[method]; if (mayBeNormalized !== void 0) { - request2.method = mayBeNormalized; + request4.method = mayBeNormalized; } else { if (!isValidHTTPToken(method)) { throw new TypeError(`'${method}' is not a valid HTTP method.`); @@ -33378,9 +33378,9 @@ var require_request4 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizedMethodRecordsBase[upperCase] ?? method; - request2.method = method; + request4.method = method; } - if (!patchMethodWarning && request2.method === "patch") { + if (!patchMethodWarning && request4.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" }); @@ -33390,7 +33390,7 @@ var require_request4 = __commonJS({ if (init.signal !== void 0) { signal = init.signal; } - this.#state = request2; + this.#state = request4; const ac = new AbortController(); this.#signal = ac.signal; if (signal != null) { @@ -33411,12 +33411,12 @@ var require_request4 = __commonJS({ } } this.#headers = new Headers(kConstruct); - setHeadersList(this.#headers, request2.headersList); + setHeadersList(this.#headers, request4.headersList); setHeadersGuard(this.#headers, "request"); if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } setHeadersGuard(this.#headers, "request-no-cors"); @@ -33435,14 +33435,14 @@ var require_request4 = __commonJS({ } } const inputBody = webidl.is.Request(input) ? input.#state.body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !getHeadersList(this.#headers).contains("content-type", true)) { @@ -33454,12 +33454,12 @@ var require_request4 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -33604,24 +33604,24 @@ var require_request4 = __commonJS({ }; return `Request ${nodeUtil.formatWithOptions(options, properties)}`; } - static setRequestSignal(request2, newSignal) { - request2.#signal = newSignal; - return request2; + static setRequestSignal(request4, newSignal) { + request4.#signal = newSignal; + return request4; } - static getRequestDispatcher(request2) { - return request2.#dispatcher; + static getRequestDispatcher(request4) { + return request4.#dispatcher; } - static setRequestDispatcher(request2, newDispatcher) { - request2.#dispatcher = newDispatcher; + static setRequestDispatcher(request4, newDispatcher) { + request4.#dispatcher = newDispatcher; } - static setRequestHeaders(request2, newHeaders) { - request2.#headers = newHeaders; + static setRequestHeaders(request4, newHeaders) { + request4.#headers = newHeaders; } - static getRequestState(request2) { - return request2.#state; + static getRequestState(request4) { + return request4.#state; } - static setRequestState(request2, newState) { - request2.#state = newState; + static setRequestState(request4, newState) { + request4.#state = newState; } }; var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState } = Request; @@ -33674,23 +33674,23 @@ var require_request4 = __commonJS({ headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(newRequest, request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(newRequest, request4.body); } return newRequest; } function fromInnerRequest(innerRequest, dispatcher, signal, guard) { - const request2 = new Request(kConstruct); - setRequestState(request2, innerRequest); - setRequestDispatcher(request2, dispatcher); - setRequestSignal(request2, signal); + const request4 = new Request(kConstruct); + setRequestState(request4, innerRequest); + setRequestDispatcher(request4, dispatcher); + setRequestSignal(request4, signal); const headers = new Headers(kConstruct); - setRequestHeaders(request2, headers); + setRequestHeaders(request4, headers); setHeadersList(headers, innerRequest.headersList); setHeadersGuard(headers, guard); - return request2; + return request4; } Object.defineProperties(Request.prototype, { method: kEnumerableProperty, @@ -33928,14 +33928,14 @@ var require_fetch2 = __commonJS({ p.reject(e); return p.promise; } - const request2 = getRequestState(requestObject); + const request4 = getRequestState(requestObject); if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; let locallyAborted = false; @@ -33947,7 +33947,7 @@ var require_fetch2 = __commonJS({ assert(controller != null); controller.abort(requestObject.signal.reason); const realResponse = responseObject == null ? void 0 : responseObject.deref(); - abortFetch(p, request2, realResponse, requestObject.signal.reason); + abortFetch(p, request4, realResponse, requestObject.signal.reason); } ); const processResponse = (response) => { @@ -33955,7 +33955,7 @@ var require_fetch2 = __commonJS({ return; } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return; } if (response.type === "error") { @@ -33967,7 +33967,7 @@ var require_fetch2 = __commonJS({ p = null; }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: getRequestDispatcher(requestObject) @@ -34008,13 +34008,13 @@ var require_fetch2 = __commonJS({ ); } var markResourceTiming = performance.markResourceTiming; - function abortFetch(p, request2, responseObject, error) { + function abortFetch(p, request4, responseObject, error) { var _a, _b; if (p) { p.reject(error); } - if (((_a = request2.body) == null ? void 0 : _a.stream) != null && isReadable(request2.body.stream)) { - request2.body.stream.cancel(error).catch((err) => { + if (((_a = request4.body) == null ? void 0 : _a.stream) != null && isReadable(request4.body.stream)) { + request4.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -34035,7 +34035,7 @@ var require_fetch2 = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -34048,9 +34048,9 @@ var require_fetch2 = __commonJS({ assert(dispatcher); let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currentTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -34058,7 +34058,7 @@ var require_fetch2 = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -34068,32 +34068,32 @@ var require_fetch2 = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a = request4.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = request2.client.origin; + if (request4.origin === "client") { + request4.origin = request4.client.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept", true)) { + if (!request4.headersList.contains("accept", true)) { const value = "*/*"; - request2.headersList.append("accept", value, true); + request4.headersList.append("accept", value, true); } - if (!request2.headersList.contains("accept-language", true)) { - request2.headersList.append("accept-language", "*", true); + if (!request4.headersList.contains("accept-language", true)) { + request4.headersList.append("accept-language", "*", true); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -34101,41 +34101,41 @@ var require_fetch2 = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; response = await schemeFetch(fetchParams); - } else if (request2.mode === "same-origin") { + } else if (request4.mode === "same-origin") { response = makeNetworkError('request mode cannot be "same-origin"'); - } else if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + } else if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { response = makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } else { - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; response = await schemeFetch(fetchParams); } - } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { response = makeNetworkError("URL scheme must be a HTTP(S) scheme"); } else { - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; response = await httpFetch(fetchParams); } } @@ -34143,13 +34143,13 @@ var require_fetch2 = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -34157,26 +34157,26 @@ var require_fetch2 = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range", true)) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range", true)) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -34192,8 +34192,8 @@ var require_fetch2 = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -34202,19 +34202,19 @@ var require_fetch2 = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("node:buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blob = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !webidl.is.Blob(blob)) { + if (request4.method !== "GET" || !webidl.is.Blob(blob)) { return Promise.resolve(makeNetworkError("invalid method")); } const response = makeResponse(); const fullLength = blob.size; const serializedFullLength = isomorphicEncode(`${fullLength}`); const type = blob.type; - if (!request2.headersList.contains("range", true)) { + if (!request4.headersList.contains("range", true)) { const bodyWithType = extractBody(blob); response.statusText = "OK"; response.body = bodyWithType[0]; @@ -34222,7 +34222,7 @@ var require_fetch2 = __commonJS({ response.headersList.set("content-type", type, true); } else { response.rangeRequested = true; - const rangeHeader = request2.headersList.get("range", true); + const rangeHeader = request4.headersList.get("range", true); const rangeValue = simpleRangeHeaderValue(rangeHeader, true); if (rangeValue === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34253,7 +34253,7 @@ var require_fetch2 = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34342,41 +34342,41 @@ var require_fetch2 = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(void 0, false); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -34386,13 +34386,13 @@ var require_fetch2 = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -34403,63 +34403,63 @@ var require_fetch2 = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization", true); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie", true); - request2.headersList.delete("host", true); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization", true); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie", true); + request4.headersList.delete("host", true); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = cloneRequest(request2); + httpRequest = cloneRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -34536,7 +34536,7 @@ var require_fetch2 = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -34544,7 +34544,7 @@ var require_fetch2 = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -34574,21 +34574,21 @@ var require_fetch2 = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -34617,7 +34617,7 @@ var require_fetch2 = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -34728,17 +34728,17 @@ var require_fetch2 = __commonJS({ } return response; function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: agent.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -34774,8 +34774,8 @@ var require_fetch2 = __commonJS({ location = headersList.get("location", true); this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status); - if (codings.length !== 0 && request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = location && request4.redirect === "follow" && redirectStatusSet.has(status); + if (codings.length !== 0 && request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (let i = codings.length - 1; i >= 0; --i) { const coding = codings[i]; if (coding === "x-gzip" || coding === "gzip") { @@ -34917,32 +34917,32 @@ var require_cache4 = __commonJS({ webidl.util.markAsUncloneable(this); this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.match"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - const p = this.#internalMatchAll(request2, options, 1); + const p = this.#internalMatchAll(request4, options, 1); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.matchAll"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - return this.#internalMatchAll(request2, options); + return this.#internalMatchAll(request4, options); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); const prefix = "Cache.add"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -34952,19 +34952,19 @@ var require_cache4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); const responsePromises = []; const requestList = []; - for (let request2 of requests) { - if (request2 === void 0) { + for (let request4 of requests) { + if (request4 === void 0) { throw webidl.errors.conversionFailed({ prefix, argument: "Argument 1", types: ["undefined is not allowed"] }); } - request2 = webidl.converters.RequestInfo(request2); - if (typeof request2 === "string") { + request4 = webidl.converters.RequestInfo(request4); + if (typeof request4 === "string") { continue; } - const r = getRequestState(request2); + const r = getRequestState(request4); if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: prefix, @@ -34973,8 +34973,8 @@ var require_cache4 = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = getRequestState(new Request(request2)); + for (const request4 of requests) { + const r = getRequestState(new Request(request4)); if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: prefix, @@ -35048,17 +35048,17 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); const prefix = "Cache.put"; webidl.argumentLengthCheck(arguments, 2, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); response = webidl.converters.Response(response, prefix, "response"); let innerRequest = null; - if (webidl.is.Request(request2)) { - innerRequest = getRequestState(request2); + if (webidl.is.Request(request4)) { + innerRequest = getRequestState(request4); } else { - innerRequest = getRequestState(new Request(request2)); + innerRequest = getRequestState(new Request(request4)); } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -35126,21 +35126,21 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.delete"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = getRequestState(new Request(request2)); + assert(typeof request4 === "string"); + r = getRequestState(new Request(request4)); } const operations = []; const operation = { @@ -35166,26 +35166,26 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.keys"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -35197,9 +35197,9 @@ var require_cache4 = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = fromInnerRequest( - request3, + request5, void 0, new AbortController().signal, "immutable" @@ -35298,9 +35298,9 @@ var require_cache4 = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -35316,7 +35316,7 @@ var require_cache4 = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -35324,20 +35324,20 @@ var require_cache4 = __commonJS({ } return true; } - #internalMatchAll(request2, options, maxResponses = Infinity) { + #internalMatchAll(request4, options, maxResponses = Infinity) { let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -35425,21 +35425,21 @@ var require_cachestorage2 = __commonJS({ } webidl.util.markAsUncloneable(this); } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, "CacheStorage.match"); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -36529,7 +36529,7 @@ var require_connection2 = __commonJS({ function establishWebSocketConnection(url, protocols, client, handler2, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], client, serviceWorkers: "none", @@ -36541,18 +36541,18 @@ var require_connection2 = __commonJS({ }); if (options.headers) { const headersList = getHeadersList(new Headers(options.headers)); - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue, true); - request2.headersList.append("sec-websocket-version", "13", true); + request4.headersList.append("sec-websocket-key", keyValue, true); + request4.headersList.append("sec-websocket-version", "13", true); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol, true); + request4.headersList.append("sec-websocket-protocol", protocol, true); } const permessageDeflate = "permessage-deflate; client_max_window_bits"; - request2.headersList.append("sec-websocket-extensions", permessageDeflate, true); + request4.headersList.append("sec-websocket-extensions", permessageDeflate, true); const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher, processResponse(response) { @@ -36593,7 +36593,7 @@ var require_connection2 = __commonJS({ } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); if (secProtocol !== null) { - const requestProtocols = getDecodeSplit("sec-websocket-protocol", request2.headersList); + const requestProtocols = getDecodeSplit("sec-websocket-protocol", request4.headersList); if (!requestProtocols.includes(secProtocol)) { failWebsocketConnection(handler2, 1002, "Protocol was not set in the opening handshake."); return; @@ -38793,24 +38793,24 @@ var require_dist_node3 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - endpoint: () => endpoint2 + endpoint: () => endpoint4 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node2(); - var VERSION13 = "9.0.5"; - var userAgent2 = `octokit-endpoint.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; - var DEFAULTS2 = { + var import_universal_user_agent13 = require_dist_node2(); + var VERSION17 = "9.0.5"; + var userAgent4 = `octokit-endpoint.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}`; + var DEFAULTS4 = { method: "GET", baseUrl: "https://api.github.com", headers: { accept: "application/vnd.github.v3+json", - "user-agent": userAgent2 + "user-agent": userAgent4 }, mediaType: { format: "" } }; - function lowercaseKeys2(object) { + function lowercaseKeys4(object) { if (!object) { return {}; } @@ -38819,7 +38819,7 @@ var require_dist_node3 = __commonJS({ return newObj; }, {}); } - function isPlainObject3(value) { + function isPlainObject7(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -38830,21 +38830,21 @@ var require_dist_node3 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - function mergeDeep2(defaults, options) { + function mergeDeep4(defaults, options) { const result = Object.assign({}, defaults); Object.keys(options).forEach((key) => { - if (isPlainObject3(options[key])) { + if (isPlainObject7(options[key])) { if (!(key in defaults)) Object.assign(result, { [key]: options[key] }); else - result[key] = mergeDeep2(defaults[key], options[key]); + result[key] = mergeDeep4(defaults[key], options[key]); } else { Object.assign(result, { [key]: options[key] }); } }); return result; } - function removeUndefinedProperties2(obj) { + function removeUndefinedProperties4(obj) { for (const key in obj) { if (obj[key] === void 0) { delete obj[key]; @@ -38852,7 +38852,7 @@ var require_dist_node3 = __commonJS({ } return obj; } - function merge2(defaults, route, options) { + function merge4(defaults, route, options) { var _a; if (typeof route === "string") { let [method, url] = route.split(" "); @@ -38860,10 +38860,10 @@ var require_dist_node3 = __commonJS({ } else { options = Object.assign({}, route); } - options.headers = lowercaseKeys2(options.headers); - removeUndefinedProperties2(options); - removeUndefinedProperties2(options.headers); - const mergedOptions = mergeDeep2(defaults || {}, options); + options.headers = lowercaseKeys4(options.headers); + removeUndefinedProperties4(options); + removeUndefinedProperties4(options.headers); + const mergedOptions = mergeDeep4(defaults || {}, options); if (options.url === "/graphql") { if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( @@ -38874,7 +38874,7 @@ var require_dist_node3 = __commonJS({ } return mergedOptions; } - function addQueryParameters2(url, parameters) { + function addQueryParameters4(url, parameters) { const separator = /\?/.test(url) ? "&" : "?"; const names = Object.keys(parameters); if (names.length === 0) { @@ -38887,18 +38887,18 @@ var require_dist_node3 = __commonJS({ return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } - var urlVariableRegex2 = /\{[^}]+\}/g; - function removeNonChars2(variableName) { + var urlVariableRegex4 = /\{[^}]+\}/g; + function removeNonChars4(variableName) { return variableName.replace(/^\W+|\W+$/g, "").split(/,/); } - function extractUrlVariableNames2(url) { - const matches = url.match(urlVariableRegex2); + function extractUrlVariableNames4(url) { + const matches = url.match(urlVariableRegex4); if (!matches) { return []; } - return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); + return matches.map(removeNonChars4).reduce((a, b) => a.concat(b), []); } - function omit2(object, keysToOmit) { + function omit4(object, keysToOmit) { const result = { __proto__: null }; for (const key of Object.keys(object)) { if (keysToOmit.indexOf(key) === -1) { @@ -38907,7 +38907,7 @@ var require_dist_node3 = __commonJS({ } return result; } - function encodeReserved2(str) { + function encodeReserved4(str) { return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { if (!/%[0-9A-Fa-f]/.test(part)) { part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); @@ -38915,67 +38915,67 @@ var require_dist_node3 = __commonJS({ return part; }).join(""); } - function encodeUnreserved2(str) { + function encodeUnreserved4(str) { return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { return "%" + c.charCodeAt(0).toString(16).toUpperCase(); }); } - function encodeValue2(operator, value, key) { - value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + function encodeValue4(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved4(value) : encodeUnreserved4(value); if (key) { - return encodeUnreserved2(key) + "=" + value; + return encodeUnreserved4(key) + "=" + value; } else { return value; } } - function isDefined2(value) { + function isDefined4(value) { return value !== void 0 && value !== null; } - function isKeyOperator2(operator) { + function isKeyOperator4(operator) { return operator === ";" || operator === "&" || operator === "?"; } - function getValues2(context3, operator, key, modifier) { + function getValues4(context3, operator, key, modifier) { var value = context3[key], result = []; - if (isDefined2(value) && value !== "") { + if (isDefined4(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { value = value.substring(0, parseInt(modifier, 10)); } result.push( - encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value, isKeyOperator4(operator) ? key : "") ); } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { + value.filter(isDefined4).forEach(function(value2) { result.push( - encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value2, isKeyOperator4(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - result.push(encodeValue2(operator, value[k], k)); + if (isDefined4(value[k])) { + result.push(encodeValue4(operator, value[k], k)); } }); } } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { - tmp.push(encodeValue2(operator, value2)); + value.filter(isDefined4).forEach(function(value2) { + tmp.push(encodeValue4(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - tmp.push(encodeUnreserved2(k)); - tmp.push(encodeValue2(operator, value[k].toString())); + if (isDefined4(value[k])) { + tmp.push(encodeUnreserved4(k)); + tmp.push(encodeValue4(operator, value[k].toString())); } }); } - if (isKeyOperator2(operator)) { - result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + if (isKeyOperator4(operator)) { + result.push(encodeUnreserved4(key) + "=" + tmp.join(",")); } else if (tmp.length !== 0) { result.push(tmp.join(",")); } @@ -38983,23 +38983,23 @@ var require_dist_node3 = __commonJS({ } } else { if (operator === ";") { - if (isDefined2(value)) { - result.push(encodeUnreserved2(key)); + if (isDefined4(value)) { + result.push(encodeUnreserved4(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { - result.push(encodeUnreserved2(key) + "="); + result.push(encodeUnreserved4(key) + "="); } else if (value === "") { result.push(""); } } return result; } - function parseUrl2(template) { + function parseUrl4(template) { return { - expand: expand2.bind(null, template) + expand: expand4.bind(null, template) }; } - function expand2(template, context3) { + function expand4(template, context3) { var operators = ["+", "#", ".", "/", ";", "?", "&"]; template = template.replace( /\{([^\{\}]+)\}|([^\{\}]+)/g, @@ -39013,7 +39013,7 @@ var require_dist_node3 = __commonJS({ } expression.split(/,/g).forEach(function(variable) { var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); - values.push(getValues2(context3, operator, tmp[1], tmp[2] || tmp[3])); + values.push(getValues4(context3, operator, tmp[1], tmp[2] || tmp[3])); }); if (operator && operator !== "+") { var separator = ","; @@ -39027,7 +39027,7 @@ var require_dist_node3 = __commonJS({ return values.join(","); } } else { - return encodeReserved2(literal); + return encodeReserved4(literal); } } ); @@ -39037,13 +39037,13 @@ var require_dist_node3 = __commonJS({ return template.replace(/\/$/, ""); } } - function parse2(options) { + function parse4(options) { var _a; let method = options.method.toUpperCase(); let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); let headers = Object.assign({}, options.headers); let body; - let parameters = omit2(options, [ + let parameters = omit4(options, [ "method", "baseUrl", "url", @@ -39051,13 +39051,13 @@ var require_dist_node3 = __commonJS({ "request", "mediaType" ]); - const urlVariableNames = extractUrlVariableNames2(url); - url = parseUrl2(url).expand(parameters); + const urlVariableNames = extractUrlVariableNames4(url); + url = parseUrl4(url).expand(parameters); if (!/^http/.test(url)) { url = options.baseUrl + url; } const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); - const remainingParameters = omit2(parameters, omittedParameters); + const remainingParameters = omit4(parameters, omittedParameters); const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); if (!isBinaryRequest) { if (options.mediaType.format) { @@ -39079,7 +39079,7 @@ var require_dist_node3 = __commonJS({ } } if (["GET", "HEAD"].includes(method)) { - url = addQueryParameters2(url, remainingParameters); + url = addQueryParameters4(url, remainingParameters); } else { if ("data" in remainingParameters) { body = remainingParameters.data; @@ -39101,20 +39101,20 @@ var require_dist_node3 = __commonJS({ options.request ? { request: options.request } : null ); } - function endpointWithDefaults2(defaults, route, options) { - return parse2(merge2(defaults, route, options)); + function endpointWithDefaults4(defaults, route, options) { + return parse4(merge4(defaults, route, options)); } - function withDefaults4(oldDefaults, newDefaults) { - const DEFAULTS22 = merge2(oldDefaults, newDefaults); - const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + function withDefaults8(oldDefaults, newDefaults) { + const DEFAULTS22 = merge4(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults4.bind(null, DEFAULTS22); return Object.assign(endpoint22, { DEFAULTS: DEFAULTS22, - defaults: withDefaults4.bind(null, DEFAULTS22), - merge: merge2.bind(null, DEFAULTS22), - parse: parse2 + defaults: withDefaults8.bind(null, DEFAULTS22), + merge: merge4.bind(null, DEFAULTS22), + parse: parse4 }); } - var endpoint2 = withDefaults4(null, DEFAULTS2); + var endpoint4 = withDefaults8(null, DEFAULTS4); } }); @@ -39241,14 +39241,14 @@ var require_dist_node5 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - RequestError: () => RequestError2 + RequestError: () => RequestError4 }); module.exports = __toCommonJS(dist_src_exports); var import_deprecation = require_dist_node4(); var import_once = __toESM2(require_once()); var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation)); var logOnceHeaders = (0, import_once.default)((deprecation) => console.warn(deprecation)); - var RequestError2 = class extends Error { + var RequestError4 = class extends Error { constructor(message, statusCode, options) { super(message); if (Error.captureStackTrace) { @@ -39323,13 +39323,13 @@ var require_dist_node6 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - request: () => request2 + request: () => request4 }); module.exports = __toCommonJS(dist_src_exports); - var import_endpoint2 = require_dist_node3(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "8.4.0"; - function isPlainObject3(value) { + var import_endpoint4 = require_dist_node3(); + var import_universal_user_agent13 = require_dist_node(); + var VERSION17 = "8.4.0"; + function isPlainObject7(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -39340,15 +39340,15 @@ var require_dist_node6 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - var import_request_error3 = require_dist_node5(); + var import_request_error6 = require_dist_node5(); function getBufferResponse(response) { return response.arrayBuffer(); } - function fetchWrapper2(requestOptions) { + function fetchWrapper4(requestOptions) { var _a, _b, _c, _d; const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console; const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false; - if (isPlainObject3(requestOptions.body) || Array.isArray(requestOptions.body)) { + if (isPlainObject7(requestOptions.body) || Array.isArray(requestOptions.body)) { requestOptions.body = JSON.stringify(requestOptions.body); } let headers = {}; @@ -39390,7 +39390,7 @@ var require_dist_node6 = __commonJS({ if (status < 400) { return; } - throw new import_request_error3.RequestError(response.statusText, status, { + throw new import_request_error6.RequestError(response.statusText, status, { response: { url, status, @@ -39401,19 +39401,19 @@ var require_dist_node6 = __commonJS({ }); } if (status === 304) { - throw new import_request_error3.RequestError("Not modified", status, { + throw new import_request_error6.RequestError("Not modified", status, { response: { url, status, headers, - data: await getResponseData2(response) + data: await getResponseData4(response) }, request: requestOptions }); } if (status >= 400) { - const data = await getResponseData2(response); - const error = new import_request_error3.RequestError(toErrorMessage2(data), status, { + const data = await getResponseData4(response); + const error = new import_request_error6.RequestError(toErrorMessage4(data), status, { response: { url, status, @@ -39424,7 +39424,7 @@ var require_dist_node6 = __commonJS({ }); throw error; } - return parseSuccessResponseBody ? await getResponseData2(response) : response.body; + return parseSuccessResponseBody ? await getResponseData4(response) : response.body; }).then((data) => { return { status, @@ -39433,7 +39433,7 @@ var require_dist_node6 = __commonJS({ data }; }).catch((error) => { - if (error instanceof import_request_error3.RequestError) + if (error instanceof import_request_error6.RequestError) throw error; else if (error.name === "AbortError") throw error; @@ -39445,12 +39445,12 @@ var require_dist_node6 = __commonJS({ message = error.cause; } } - throw new import_request_error3.RequestError(message, 500, { + throw new import_request_error6.RequestError(message, 500, { request: requestOptions }); }); } - async function getResponseData2(response) { + async function getResponseData4(response) { const contentType = response.headers.get("content-type"); if (/application\/json/.test(contentType)) { return response.json().catch(() => response.text()).catch(() => ""); @@ -39460,7 +39460,7 @@ var require_dist_node6 = __commonJS({ } return getBufferResponse(response); } - function toErrorMessage2(data) { + function toErrorMessage4(data) { if (typeof data === "string") return data; let suffix; @@ -39477,32 +39477,32 @@ var require_dist_node6 = __commonJS({ } return `Unknown error: ${JSON.stringify(data)}`; } - function withDefaults4(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + function withDefaults8(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper2(endpoint2.parse(endpointOptions)); + return fetchWrapper4(endpoint22.parse(endpointOptions)); } const request22 = (route2, parameters2) => { - return fetchWrapper2( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + return fetchWrapper4( + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; Object.assign(request22, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); } - var request2 = withDefaults4(import_endpoint2.endpoint, { + var request4 = withDefaults8(import_endpoint4.endpoint, { headers: { - "user-agent": `octokit-request.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-request.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}` } }); } @@ -39537,8 +39537,8 @@ var require_dist_node7 = __commonJS({ }); module.exports = __toCommonJS(dist_src_exports); var import_request32 = require_dist_node6(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "7.1.0"; + var import_universal_user_agent13 = require_dist_node(); + var VERSION17 = "7.1.0"; var import_request22 = require_dist_node6(); var import_request15 = require_dist_node6(); function _buildMessageForResponseErrors2(data) { @@ -39546,9 +39546,9 @@ var require_dist_node7 = __commonJS({ ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError2 = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors2(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.name = "GraphqlResponseError"; @@ -39570,7 +39570,7 @@ var require_dist_node7 = __commonJS({ ]; var FORBIDDEN_VARIABLE_OPTIONS2 = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX2 = /\/api\/v3\/?$/; - function graphql3(request2, query, options) { + function graphql3(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -39601,11 +39601,11 @@ var require_dist_node7 = __commonJS({ result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX2.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX2, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -39620,25 +39620,25 @@ var require_dist_node7 = __commonJS({ return response.data.data; }); } - function withDefaults4(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); + function withDefaults8(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql3(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults4.bind(null, newRequest), + defaults: withDefaults8.bind(null, newRequest), endpoint: newRequest.endpoint }); } - var graphql22 = withDefaults4(import_request32.request, { + var graphql22 = withDefaults8(import_request32.request, { headers: { - "user-agent": `octokit-graphql.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-graphql.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}` }, method: "POST", url: "/graphql" }); function withCustomRequest2(customRequest) { - return withDefaults4(customRequest, { + return withDefaults8(customRequest, { method: "POST", url: "/graphql" }); @@ -39692,13 +39692,13 @@ var require_dist_node8 = __commonJS({ } return `token ${token}`; } - async function hook6(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( + async function hook6(token, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix2(token); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix2(token); + return request4(endpoint4); } var createTokenAuth3 = function createTokenAuth22(token) { if (!token) { @@ -39743,17 +39743,17 @@ var require_dist_node9 = __commonJS({ Octokit: () => Octokit3 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node(); + var import_universal_user_agent13 = require_dist_node(); var import_before_after_hook2 = require_before_after_hook(); var import_request15 = require_dist_node6(); var import_graphql2 = require_dist_node7(); var import_auth_token2 = require_dist_node8(); - var VERSION13 = "5.2.0"; + var VERSION17 = "5.2.0"; var noop2 = () => { }; var consoleWarn2 = console.warn.bind(console); var consoleError2 = console.error.bind(console); - var userAgentTrail2 = `octokit-core.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; + var userAgentTrail2 = `octokit-core.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}`; var _a; var Octokit3 = (_a = class { static defaults(defaults) { @@ -39856,7 +39856,7 @@ var require_dist_node9 = __commonJS({ } } }, (() => { - _a.VERSION = VERSION13; + _a.VERSION = VERSION17; })(), (() => { _a.plugins = []; })(), _a); @@ -39890,7 +39890,7 @@ var require_dist_node10 = __commonJS({ restEndpointMethods: () => restEndpointMethods2 }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "10.4.1"; + var VERSION17 = "10.4.1"; var Endpoints2 = { actions: { addCustomLabelsToSelfHostedRunnerForOrg: [ @@ -41882,8 +41882,8 @@ var require_dist_node10 = __commonJS({ var endpoints_default2 = Endpoints2; var endpointMethodsMap2 = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default2)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -42006,7 +42006,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - restEndpointMethods2.VERSION = VERSION13; + restEndpointMethods2.VERSION = VERSION17; function legacyRestEndpointMethods2(octokit) { const api = endpointsToMethods2(octokit); return { @@ -42014,7 +42014,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - legacyRestEndpointMethods2.VERSION = VERSION13; + legacyRestEndpointMethods2.VERSION = VERSION17; } }); @@ -42047,7 +42047,7 @@ var require_dist_node11 = __commonJS({ paginatingEndpoints: () => paginatingEndpoints }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "9.2.1"; + var VERSION17 = "9.2.1"; function normalizePaginatedListResponse2(response) { if (!response.data) { return { @@ -42393,7 +42393,7 @@ var require_dist_node11 = __commonJS({ }) }; } - paginateRest2.VERSION = VERSION13; + paginateRest2.VERSION = VERSION17; } }); @@ -42524,7 +42524,7 @@ var require_fast_content_type_parse = __commonJS({ var defaultContentType = { type: "", parameters: new NullObject() }; Object.freeze(defaultContentType.parameters); Object.freeze(defaultContentType); - function parse2(header) { + function parse4(header) { if (typeof header !== "string") { throw new TypeError("argument header is required and must be a string"); } @@ -42562,7 +42562,7 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - function safeParse2(header) { + function safeParse4(header) { if (typeof header !== "string") { return defaultContentType; } @@ -42600,9 +42600,9 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - module.exports.default = { parse: parse2, safeParse: safeParse2 }; - module.exports.parse = parse2; - module.exports.safeParse = safeParse2; + module.exports.default = { parse: parse4, safeParse: safeParse4 }; + module.exports.parse = parse4; + module.exports.safeParse = safeParse4; module.exports.defaultContentType = defaultContentType; } }); @@ -42819,9 +42819,9 @@ function addQueryParameters(url, parameters) { return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } -var urlVariableRegex = /\{[^}]+\}/g; +var urlVariableRegex = /\{[^{}}]+\}/g; function removeNonChars(variableName) { - return variableName.replace(/^\W+|\W+$/g, "").split(/,/); + return variableName.replace(/(?:^\W+)|(?:(? { const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; return `application/vnd.github.${preview}-preview${format}`; @@ -43037,12 +43037,12 @@ function endpointWithDefaults(defaults, route, options) { return parse(merge(defaults, route, options)); } function withDefaults(oldDefaults, newDefaults) { - const DEFAULTS2 = merge(oldDefaults, newDefaults); - const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2); - return Object.assign(endpoint2, { - DEFAULTS: DEFAULTS2, - defaults: withDefaults.bind(null, DEFAULTS2), - merge: merge.bind(null, DEFAULTS2), + const DEFAULTS22 = merge(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults.bind(null, DEFAULTS22), + merge: merge.bind(null, DEFAULTS22), parse }); } @@ -43071,7 +43071,7 @@ var RequestError = class extends Error { if (options.request.headers.authorization) { requestCopy.headers = Object.assign({}, options.request.headers, { authorization: options.request.headers.authorization.replace( - / .*$/, + /(?]+)>; rel="deprecation"/); + const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/); const deprecationLink = matches && matches.pop(); log.warn( `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` @@ -43234,40 +43234,570 @@ function toErrorMessage(data) { return `Unknown error: ${JSON.stringify(data)}`; } function withDefaults2(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper(endpoint2.parse(endpointOptions)); + return fetchWrapper(endpoint22.parse(endpointOptions)); } - const request2 = (route2, parameters2) => { + const request22 = (route2, parameters2) => { return fetchWrapper( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; - Object.assign(request2, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); - return endpointOptions.request.hook(request2, endpointOptions); + return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); } var request = withDefaults2(endpoint, defaults_default); // var VERSION3 = "0.0.0-development"; +var userAgent2 = `octokit-endpoint.js/${VERSION3} ${getUserAgent()}`; +var DEFAULTS2 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent2 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys2(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject3(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep2(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject3(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep2(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties2(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge2(defaults, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys2(options.headers); + removeUndefinedProperties2(options); + removeUndefinedProperties2(options.headers); + const mergedOptions = mergeDeep2(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters2(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex2 = /\{[^}]+\}/g; +function removeNonChars2(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames2(url) { + const matches = url.match(urlVariableRegex2); + if (!matches) { + return []; + } + return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); +} +function omit2(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved2(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved2(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue2(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + if (key) { + return encodeUnreserved2(key) + "=" + value; + } else { + return value; + } +} +function isDefined2(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator2(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues2(context3, operator, key, modifier) { + var value = context3[key], result = []; + if (isDefined2(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + result.push( + encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + result.push(encodeValue2(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + tmp.push(encodeValue2(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + tmp.push(encodeUnreserved2(k)); + tmp.push(encodeValue2(operator, value[k].toString())); + } + }); + } + if (isKeyOperator2(operator)) { + result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined2(value)) { + result.push(encodeUnreserved2(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved2(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl2(template) { + return { + expand: expand2.bind(null, template) + }; +} +function expand2(template, context3) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues2(context3, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved2(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse2(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit2(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames2(url); + url = parseUrl2(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit2(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters2(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults2(defaults, route, options) { + return parse2(merge2(defaults, route, options)); +} +function withDefaults3(oldDefaults, newDefaults) { + const DEFAULTS22 = merge2(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults3.bind(null, DEFAULTS22), + merge: merge2.bind(null, DEFAULTS22), + parse: parse2 + }); +} +var endpoint2 = withDefaults3(null, DEFAULTS2); + +// +var import_fast_content_type_parse2 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError2 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION4 = "0.0.0-development"; +var defaults_default2 = { + headers: { + "user-agent": `octokit-request.js/${VERSION4} ${getUserAgent()}` + } +}; +function isPlainObject4(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper2(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch2 = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject4(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error) { + let message = "Unknown Error"; + if (error instanceof Error) { + if (error.name === "AbortError") { + error.status = 500; + throw error; + } + message = error.message; + if (error.name === "TypeError" && "cause" in error) { + if (error.cause instanceof Error) { + message = error.cause.message; + } else if (typeof error.cause === "string") { + message = error.cause; + } + } + } + const requestError = new RequestError2(message, 500, { + request: requestOptions + }); + requestError.cause = error; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError2(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2(toErrorMessage2(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData2(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData2(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse2.safeParse)(contentType); + if (isJSONResponse2(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse2(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage2(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults4(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper2(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper2( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); +} +var request2 = withDefaults4(endpoint2, defaults_default2); + +// +var VERSION5 = "0.0.0-development"; function _buildMessageForResponseErrors(data) { return `Request failed due to following response errors: ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.errors = response.errors; @@ -43292,7 +43822,7 @@ var NON_VARIABLE_OPTIONS = [ ]; var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; -function graphql(request2, query, options) { +function graphql(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -43323,11 +43853,11 @@ function graphql(request2, query, options) { result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -43342,25 +43872,25 @@ function graphql(request2, query, options) { return response.data.data; }); } -function withDefaults3(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); +function withDefaults5(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults3.bind(null, newRequest), + defaults: withDefaults5.bind(null, newRequest), endpoint: newRequest.endpoint }); } -var graphql2 = withDefaults3(request, { +var graphql2 = withDefaults5(request2, { headers: { - "user-agent": `octokit-graphql.js/${VERSION3} ${getUserAgent()}` + "user-agent": `octokit-graphql.js/${VERSION5} ${getUserAgent()}` }, method: "POST", url: "/graphql" }); function withCustomRequest(customRequest) { - return withDefaults3(customRequest, { + return withDefaults5(customRequest, { method: "POST", url: "/graphql" }); @@ -43388,13 +43918,13 @@ function withAuthorizationPrefix(token) { } return `token ${token}`; } -async function hook(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( +async function hook(token, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix(token); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix(token); + return request4(endpoint4); } var createTokenAuth = function createTokenAuth2(token) { if (!token) { @@ -43412,14 +43942,14 @@ var createTokenAuth = function createTokenAuth2(token) { }; // -var VERSION4 = "6.1.3"; +var VERSION6 = "6.1.4"; // var noop = () => { }; var consoleWarn = console.warn.bind(console); var consoleError = console.error.bind(console); -var userAgentTrail = `octokit-core.js/${VERSION4} ${getUserAgent()}`; +var userAgentTrail = `octokit-core.js/${VERSION6} ${getUserAgent()}`; var Octokit = class { static defaults(defaults) { const OctokitWithDefaults = class extends this { @@ -43524,20 +44054,20 @@ var Octokit = class { hook; auth; }; -__publicField(Octokit, "VERSION", VERSION4); +__publicField(Octokit, "VERSION", VERSION6); __publicField(Octokit, "plugins", []); // -var VERSION5 = "5.3.1"; +var VERSION7 = "5.3.1"; // function requestLog(octokit) { - octokit.hook.wrap("request", (request2, options) => { + octokit.hook.wrap("request", (request4, options) => { octokit.log.debug("request", options); const start = Date.now(); const requestOptions = octokit.request.endpoint.parse(options); const path = requestOptions.url.replace(options.baseUrl, ""); - return request2(options).then((response) => { + return request4(options).then((response) => { const requestId = response.headers["x-github-request-id"]; octokit.log.info( `${requestOptions.method} ${path} - ${response.status} with id ${requestId} in ${Date.now() - start}ms` @@ -43553,10 +44083,10 @@ function requestLog(octokit) { }); }); } -requestLog.VERSION = VERSION5; +requestLog.VERSION = VERSION7; // -var VERSION6 = "0.0.0-development"; +var VERSION8 = "0.0.0-development"; function normalizePaginatedListResponse(response) { if (!response.data) { return { @@ -43600,7 +44130,7 @@ function iterator(octokit, route, parameters) { const response = await requestMethod({ method, url, headers }); const normalizedResponse = normalizePaginatedListResponse(response); url = ((normalizedResponse.headers.link || "").match( - /<([^>]+)>;\s*rel="next"/ + /<([^<>]+)>;\s*rel="next"/ ) || [])[1]; return { value: normalizedResponse }; } catch (error) { @@ -43659,10 +44189,10 @@ function paginateRest(octokit) { }) }; } -paginateRest.VERSION = VERSION6; +paginateRest.VERSION = VERSION8; // -var VERSION7 = "13.3.1"; +var VERSION9 = "13.3.1"; // var Endpoints = { @@ -45735,8 +46265,8 @@ var endpoints_default = Endpoints; // var endpointMethodsMap = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -45861,7 +46391,7 @@ function restEndpointMethods(octokit) { rest: api }; } -restEndpointMethods.VERSION = VERSION7; +restEndpointMethods.VERSION = VERSION9; function legacyRestEndpointMethods(octokit) { const api = endpointsToMethods(octokit); return { @@ -45869,15 +46399,15 @@ function legacyRestEndpointMethods(octokit) { rest: api }; } -legacyRestEndpointMethods.VERSION = VERSION7; +legacyRestEndpointMethods.VERSION = VERSION9; // -var VERSION8 = "21.1.0"; +var VERSION10 = "21.1.1"; // var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRest).defaults( { - userAgent: `octokit-rest.js/${VERSION8}` + userAgent: `octokit-rest.js/${VERSION10}` } ); @@ -45885,25 +46415,25 @@ var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRes var import_core2 = __toESM(require_core()); // -function requestToOAuthBaseUrl(request2) { - const endpointDefaults = request2.endpoint.DEFAULTS; +function requestToOAuthBaseUrl(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); } -async function oauthRequest(request2, route, parameters) { +async function oauthRequest(request4, route, parameters) { const withOAuthParameters = { - baseUrl: requestToOAuthBaseUrl(request2), + baseUrl: requestToOAuthBaseUrl(request4), headers: { accept: "application/json" }, ...parameters }; - const response = await request2(route, withOAuthParameters); + const response = await request4(route, withOAuthParameters); if ("error" in response.data) { const error = new RequestError( `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, 400, { - request: request2.endpoint.merge( + request: request4.endpoint.merge( route, withOAuthParameters ) @@ -45914,32 +46444,43 @@ async function oauthRequest(request2, route, parameters) { } return response; } -async function exchangeWebFlowCode(options) { - const request2 = options.request || request; +async function createDeviceCode(options) { + const request4 = options.request || request; + const parameters = { + client_id: options.clientId + }; + if ("scopes" in options && Array.isArray(options.scopes)) { + parameters.scope = options.scopes.join(" "); + } + return oauthRequest(request4, "POST /login/device/code", parameters); +} +async function exchangeDeviceCode(options) { + const request4 = options.request || request; const response = await oauthRequest( - request2, + request4, "POST /login/oauth/access_token", { client_id: options.clientId, - client_secret: options.clientSecret, - code: options.code, - redirect_uri: options.redirectUrl + device_code: options.code, + grant_type: "urn:ietf:params:oauth:grant-type:device_code" } ); const authentication = { clientType: options.clientType, clientId: options.clientId, - clientSecret: options.clientSecret, token: response.data.access_token, scopes: response.data.scope.split(/\s+/).filter(Boolean) }; + if ("clientSecret" in options) { + authentication.clientSecret = options.clientSecret; + } if (options.clientType === "github-app") { if ("refresh_token" in response.data) { const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp( + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( apiTimeInMs, response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp( + ), authentication.refreshTokenExpiresAt = toTimestamp2( apiTimeInMs, response.data.refresh_token_expires_in ); @@ -45948,46 +46489,722 @@ async function exchangeWebFlowCode(options) { } return { ...response, authentication }; } -function toTimestamp(apiTimeInMs, expirationInSeconds) { +function toTimestamp2(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } -async function createDeviceCode(options) { - const request2 = options.request || request; - const parameters = { - client_id: options.clientId + +// +async function getOAuthAccessToken(state, options) { + const cachedAuthentication = getCachedAuthentication(state, options.auth); + if (cachedAuthentication) + return cachedAuthentication; + const { data: verification } = await createDeviceCode({ + clientType: state.clientType, + clientId: state.clientId, + request: options.request || state.request, + scopes: options.auth.scopes || state.scopes + }); + await state.onVerification(verification); + const authentication = await waitForAccessToken( + options.request || state.request, + state.clientId, + state.clientType, + verification + ); + state.authentication = authentication; + return authentication; +} +function getCachedAuthentication(state, auth22) { + if (auth22.refresh === true) + return false; + if (!state.authentication) + return false; + if (state.clientType === "github-app") { + return state.authentication; + } + const authentication = state.authentication; + const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( + " " + ); + const currentScope = authentication.scopes.join(" "); + return newScope === currentScope ? authentication : false; +} +async function wait(seconds) { + await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); +} +async function waitForAccessToken(request4, clientId, clientType, verification) { + try { + const options = { + clientId, + request: request4, + code: verification.device_code + }; + const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ + ...options, + clientType: "oauth-app" + }) : await exchangeDeviceCode({ + ...options, + clientType: "github-app" + }); + return { + type: "token", + tokenType: "oauth", + ...authentication + }; + } catch (error) { + if (!error.response) + throw error; + const errorType = error.response.data.error; + if (errorType === "authorization_pending") { + await wait(verification.interval); + return waitForAccessToken(request4, clientId, clientType, verification); + } + if (errorType === "slow_down") { + await wait(verification.interval + 5); + return waitForAccessToken(request4, clientId, clientType, verification); + } + throw error; + } +} +async function auth2(state, authOptions) { + return getOAuthAccessToken(state, { + auth: authOptions + }); +} +async function hook2(state, request4, route, parameters) { + let endpoint4 = request4.endpoint.merge( + route, + parameters + ); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); + } + const { token } = await getOAuthAccessToken(state, { + request: request4, + auth: { type: "oauth" } + }); + endpoint4.headers.authorization = `token ${token}`; + return request4(endpoint4); +} +var VERSION11 = "0.0.0-development"; +function createOAuthDeviceAuth(options) { + const requestWithDefaults = options.request || request.defaults({ + headers: { + "user-agent": `octokit-auth-oauth-device.js/${VERSION11} ${getUserAgent()}` + } + }); + const { request: request4 = requestWithDefaults, ...otherOptions } = options; + const state = options.clientType === "github-app" ? { + ...otherOptions, + clientType: "github-app", + request: request4 + } : { + ...otherOptions, + clientType: "oauth-app", + request: request4, + scopes: options.scopes || [] }; - if ("scopes" in options && Array.isArray(options.scopes)) { - parameters.scope = options.scopes.join(" "); + if (!options.clientId) { + throw new Error( + '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' + ); + } + if (!options.onVerification) { + throw new Error( + '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' + ); } - return oauthRequest(request2, "POST /login/device/code", parameters); + return Object.assign(auth2.bind(null, state), { + hook: hook2.bind(null, state) + }); } -async function exchangeDeviceCode(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + +// +var VERSION12 = "0.0.0-development"; +var userAgent3 = `octokit-endpoint.js/${VERSION12} ${getUserAgent()}`; +var DEFAULTS3 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent3 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys3(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject5(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep3(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject5(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep3(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties3(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge3(defaults, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys3(options.headers); + removeUndefinedProperties3(options); + removeUndefinedProperties3(options.headers); + const mergedOptions = mergeDeep3(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters3(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex3 = /\{[^}]+\}/g; +function removeNonChars3(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames3(url) { + const matches = url.match(urlVariableRegex3); + if (!matches) { + return []; + } + return matches.map(removeNonChars3).reduce((a, b) => a.concat(b), []); +} +function omit3(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved3(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved3(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue3(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved3(value) : encodeUnreserved3(value); + if (key) { + return encodeUnreserved3(key) + "=" + value; + } else { + return value; + } +} +function isDefined3(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator3(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues3(context3, operator, key, modifier) { + var value = context3[key], result = []; + if (isDefined3(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue3(operator, value, isKeyOperator3(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + result.push( + encodeValue3(operator, value2, isKeyOperator3(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + result.push(encodeValue3(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + tmp.push(encodeValue3(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + tmp.push(encodeUnreserved3(k)); + tmp.push(encodeValue3(operator, value[k].toString())); + } + }); + } + if (isKeyOperator3(operator)) { + result.push(encodeUnreserved3(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined3(value)) { + result.push(encodeUnreserved3(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved3(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl3(template) { + return { + expand: expand3.bind(null, template) + }; +} +function expand3(template, context3) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues3(context3, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved3(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse3(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit3(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames3(url); + url = parseUrl3(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit3(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters3(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults3(defaults, route, options) { + return parse3(merge3(defaults, route, options)); +} +function withDefaults6(oldDefaults, newDefaults) { + const DEFAULTS22 = merge3(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults3.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults6.bind(null, DEFAULTS22), + merge: merge3.bind(null, DEFAULTS22), + parse: parse3 + }); +} +var endpoint3 = withDefaults6(null, DEFAULTS3); + +// +var import_fast_content_type_parse3 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError3 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION13 = "0.0.0-development"; +var defaults_default3 = { + headers: { + "user-agent": `octokit-request.js/${VERSION13} ${getUserAgent()}` + } +}; +function isPlainObject6(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper3(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch2 = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject6(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error) { + let message = "Unknown Error"; + if (error instanceof Error) { + if (error.name === "AbortError") { + error.status = 500; + throw error; + } + message = error.message; + if (error.name === "TypeError" && "cause" in error) { + if (error.cause instanceof Error) { + message = error.cause.message; + } else if (typeof error.cause === "string") { + message = error.cause; + } + } + } + const requestError = new RequestError3(message, 500, { + request: requestOptions + }); + requestError.cause = error; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError3(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3(toErrorMessage3(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData3(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData3(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse3.safeParse)(contentType); + if (isJSONResponse3(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse3(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage3(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults7(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper3(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper3( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults7.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults7.bind(null, endpoint22) + }); +} +var request3 = withDefaults7(endpoint3, defaults_default3); + +// +function requestToOAuthBaseUrl2(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; + return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); +} +async function oauthRequest2(request4, route, parameters) { + const withOAuthParameters = { + baseUrl: requestToOAuthBaseUrl2(request4), + headers: { + accept: "application/json" + }, + ...parameters + }; + const response = await request4(route, withOAuthParameters); + if ("error" in response.data) { + const error = new RequestError3( + `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, + 400, + { + request: request4.endpoint.merge( + route, + withOAuthParameters + ) + } + ); + error.response = response; + throw error; + } + return response; +} +async function exchangeWebFlowCode(options) { + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, - device_code: options.code, - grant_type: "urn:ietf:params:oauth:grant-type:device_code" + client_secret: options.clientSecret, + code: options.code, + redirect_uri: options.redirectUrl } ); const authentication = { clientType: options.clientType, clientId: options.clientId, + clientSecret: options.clientSecret, token: response.data.access_token, scopes: response.data.scope.split(/\s+/).filter(Boolean) }; - if ("clientSecret" in options) { - authentication.clientSecret = options.clientSecret; - } if (options.clientType === "github-app") { if ("refresh_token" in response.data) { const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp( apiTimeInMs, response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp2( + ), authentication.refreshTokenExpiresAt = toTimestamp( apiTimeInMs, response.data.refresh_token_expires_in ); @@ -45996,12 +47213,12 @@ async function exchangeDeviceCode(options) { } return { ...response, authentication }; } -function toTimestamp2(apiTimeInMs, expirationInSeconds) { +function toTimestamp(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function checkToken(options) { - const request2 = options.request || request; - const response = await request2("POST /applications/{client_id}/token", { + const request4 = options.request || request3; + const response = await request4("POST /applications/{client_id}/token", { headers: { authorization: `basic ${btoa( `${options.clientId}:${options.clientSecret}` @@ -46025,9 +47242,9 @@ async function checkToken(options) { return { ...response, authentication }; } async function refreshToken(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, @@ -46055,9 +47272,9 @@ function toTimestamp3(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function resetToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - const response = await request2( + const response = await request4( "PATCH /applications/{client_id}/token", { headers: { @@ -46082,9 +47299,9 @@ async function resetToken(options) { return { ...response, authentication }; } async function deleteToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/token", { headers: { @@ -46096,9 +47313,9 @@ async function deleteToken(options) { ); } async function deleteAuthorization(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/grant", { headers: { @@ -46111,133 +47328,7 @@ async function deleteAuthorization(options) { } // -async function getOAuthAccessToken(state, options) { - const cachedAuthentication = getCachedAuthentication(state, options.auth); - if (cachedAuthentication) - return cachedAuthentication; - const { data: verification } = await createDeviceCode({ - clientType: state.clientType, - clientId: state.clientId, - request: options.request || state.request, - scopes: options.auth.scopes || state.scopes - }); - await state.onVerification(verification); - const authentication = await waitForAccessToken( - options.request || state.request, - state.clientId, - state.clientType, - verification - ); - state.authentication = authentication; - return authentication; -} -function getCachedAuthentication(state, auth22) { - if (auth22.refresh === true) - return false; - if (!state.authentication) - return false; - if (state.clientType === "github-app") { - return state.authentication; - } - const authentication = state.authentication; - const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( - " " - ); - const currentScope = authentication.scopes.join(" "); - return newScope === currentScope ? authentication : false; -} -async function wait(seconds) { - await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); -} -async function waitForAccessToken(request2, clientId, clientType, verification) { - try { - const options = { - clientId, - request: request2, - code: verification.device_code - }; - const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ - ...options, - clientType: "oauth-app" - }) : await exchangeDeviceCode({ - ...options, - clientType: "github-app" - }); - return { - type: "token", - tokenType: "oauth", - ...authentication - }; - } catch (error) { - if (!error.response) - throw error; - const errorType = error.response.data.error; - if (errorType === "authorization_pending") { - await wait(verification.interval); - return waitForAccessToken(request2, clientId, clientType, verification); - } - if (errorType === "slow_down") { - await wait(verification.interval + 5); - return waitForAccessToken(request2, clientId, clientType, verification); - } - throw error; - } -} -async function auth2(state, authOptions) { - return getOAuthAccessToken(state, { - auth: authOptions - }); -} -async function hook2(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( - route, - parameters - ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); - } - const { token } = await getOAuthAccessToken(state, { - request: request2, - auth: { type: "oauth" } - }); - endpoint2.headers.authorization = `token ${token}`; - return request2(endpoint2); -} -var VERSION9 = "0.0.0-development"; -function createOAuthDeviceAuth(options) { - const requestWithDefaults = options.request || request.defaults({ - headers: { - "user-agent": `octokit-auth-oauth-device.js/${VERSION9} ${getUserAgent()}` - } - }); - const { request: request2 = requestWithDefaults, ...otherOptions } = options; - const state = options.clientType === "github-app" ? { - ...otherOptions, - clientType: "github-app", - request: request2 - } : { - ...otherOptions, - clientType: "oauth-app", - request: request2, - scopes: options.scopes || [] - }; - if (!options.clientId) { - throw new Error( - '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - if (!options.onVerification) { - throw new Error( - '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - return Object.assign(auth2.bind(null, state), { - hook: hook2.bind(null, state) - }); -} - -// -var VERSION10 = "0.0.0-development"; +var VERSION14 = "0.0.0-development"; async function getAuthentication(state) { if ("code" in state.strategyOptions) { const { authentication } = await exchangeWebFlowCode({ @@ -46373,30 +47464,30 @@ var ROUTES_REQUIRING_BASIC_AUTH = /\/applications\/[^/]+\/(token|grant)s?/; function requiresBasicAuth(url) { return url && ROUTES_REQUIRING_BASIC_AUTH.test(url); } -async function hook3(state, request2, route, parameters = {}) { - const endpoint2 = request2.endpoint.merge( +async function hook3(state, request4, route, parameters = {}) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); } - if (requiresBasicAuth(endpoint2.url)) { + if (requiresBasicAuth(endpoint4.url)) { const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; - return request2(endpoint2); + endpoint4.headers.authorization = `basic ${credentials}`; + return request4(endpoint4); } - const { token } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request2 }) : await auth3({ ...state, request: request2 }); - endpoint2.headers.authorization = "token " + token; - return request2(endpoint2); + const { token } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request4 }) : await auth3({ ...state, request: request4 }); + endpoint4.headers.authorization = "token " + token; + return request4(endpoint4); } function createOAuthUserAuth({ clientId, clientSecret, clientType = "oauth-app", - request: request2 = request.defaults({ + request: request4 = request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION10} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION14} ${getUserAgent()}` } }), onTokenCreated, @@ -46408,13 +47499,13 @@ function createOAuthUserAuth({ clientSecret, onTokenCreated, strategyOptions, - request: request2 + request: request4 }); return Object.assign(auth3.bind(null, state), { hook: hook3.bind(null, state) }); } -createOAuthUserAuth.VERSION = VERSION10; +createOAuthUserAuth.VERSION = VERSION14; // async function auth4(state, authOptions) { @@ -46453,37 +47544,37 @@ async function auth4(state, authOptions) { }); return userAuth(); } -async function hook4(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( +async function hook4(state, request22, route, parameters) { + let endpoint4 = request22.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request22(endpoint4); } - if (state.clientType === "github-app" && !requiresBasicAuth(endpoint2.url)) { + if (state.clientType === "github-app" && !requiresBasicAuth(endpoint4.url)) { throw new Error( - `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint2.method} ${endpoint2.url}" is not supported.` + `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint4.method} ${endpoint4.url}" is not supported.` ); } const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; + endpoint4.headers.authorization = `basic ${credentials}`; try { - return await request2(endpoint2); + return await request22(endpoint4); } catch (error) { if (error.status !== 401) throw error; - error.message = `[@octokit/auth-oauth-app] "${endpoint2.method} ${endpoint2.url}" does not support clientId/clientSecret basic authentication.`; + error.message = `[@octokit/auth-oauth-app] "${endpoint4.method} ${endpoint4.url}" does not support clientId/clientSecret basic authentication.`; throw error; } } -var VERSION11 = "0.0.0-development"; +var VERSION15 = "0.0.0-development"; function createOAuthAppAuth(options) { const state = Object.assign( { request: request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION11} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION15} ${getUserAgent()}` } }), clientType: "oauth-app" @@ -46927,7 +48018,7 @@ async function getInstallationAuthentication(state, options, customRequest) { } } const appAuthentication = await getAppAuthentication(state); - const request2 = customRequest || state.request; + const request4 = customRequest || state.request; const payload = { installation_id: installationId, mediaType: { @@ -46957,7 +48048,7 @@ async function getInstallationAuthentication(state, options, customRequest) { repository_selection: repositorySelectionOptional, single_file: singleFileName } - } = await request2( + } = await request4( "POST /app/installations/{installation_id}/access_tokens", payload ); @@ -47054,18 +48145,18 @@ function isNotTimeSkewError(error) { /'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/ )); } -async function hook5(state, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge(route, parameters); - const url = endpoint2.url; +async function hook5(state, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge(route, parameters); + const url = endpoint4.url; if (/\/login\/oauth\/access_token$/.test(url)) { - return request2(endpoint2); + return request4(endpoint4); } - if (requiresAppAuth(url.replace(request2.endpoint.DEFAULTS.baseUrl, ""))) { + if (requiresAppAuth(url.replace(request4.endpoint.DEFAULTS.baseUrl, ""))) { const { token: token2 } = await getAppAuthentication(state); - endpoint2.headers.authorization = `bearer ${token2}`; + endpoint4.headers.authorization = `bearer ${token2}`; let response; try { - response = await request2(endpoint2); + response = await request4(endpoint4); } catch (error) { if (isNotTimeSkewError(error)) { throw error; @@ -47084,33 +48175,33 @@ async function hook5(state, request2, route, parameters) { ...state, timeDifference: diff }); - endpoint2.headers.authorization = `bearer ${token3}`; - return request2(endpoint2); + endpoint4.headers.authorization = `bearer ${token3}`; + return request4(endpoint4); } return response; } if (requiresBasicAuth(url)) { const authentication = await state.oauthApp({ type: "oauth-app" }); - endpoint2.headers.authorization = authentication.headers.authorization; - return request2(endpoint2); + endpoint4.headers.authorization = authentication.headers.authorization; + return request4(endpoint4); } const { token, createdAt } = await getInstallationAuthentication( state, {}, - request2.defaults({ baseUrl: endpoint2.baseUrl }) + request4.defaults({ baseUrl: endpoint4.baseUrl }) ); - endpoint2.headers.authorization = `token ${token}`; + endpoint4.headers.authorization = `token ${token}`; return sendRequestWithRetries( state, - request2, - endpoint2, + request4, + endpoint4, createdAt ); } -async function sendRequestWithRetries(state, request2, options, createdAt, retries = 0) { +async function sendRequestWithRetries(state, request4, options, createdAt, retries = 0) { const timeSinceTokenCreationInMs = +/* @__PURE__ */ new Date() - +new Date(createdAt); try { - return await request2(options); + return await request4(options); } catch (error) { if (error.status !== 401) { throw error; @@ -47127,10 +48218,10 @@ async function sendRequestWithRetries(state, request2, options, createdAt, retri `[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${retries}, wait: ${awaitTime / 1e3}s)` ); await new Promise((resolve) => setTimeout(resolve, awaitTime)); - return sendRequestWithRetries(state, request2, options, createdAt, retries); + return sendRequestWithRetries(state, request4, options, createdAt, retries); } } -var VERSION12 = "7.1.4"; +var VERSION16 = "7.1.5"; function createAppAuth(options) { if (!options.appId) { throw new Error("[@octokit/auth-app] appId option is required"); @@ -47149,14 +48240,14 @@ function createAppAuth(options) { }, options.log ); - const request2 = options.request || request.defaults({ + const request4 = options.request || request.defaults({ headers: { - "user-agent": `octokit-auth-app.js/${VERSION12} ${getUserAgent()}` + "user-agent": `octokit-auth-app.js/${VERSION16} ${getUserAgent()}` } }); const state = Object.assign( { - request: request2, + request: request4, cache: getCache() }, options, @@ -47167,7 +48258,7 @@ function createAppAuth(options) { clientType: "github-app", clientId: options.clientId || "", clientSecret: options.clientSecret || "", - request: request2 + request: request4 }) } ); diff --git a/github-actions/previews/upload-artifacts-to-firebase/fetch-workflow-artifact.js b/github-actions/previews/upload-artifacts-to-firebase/fetch-workflow-artifact.js index 8a1bfd54a..d6c4f0797 100644 --- a/github-actions/previews/upload-artifacts-to-firebase/fetch-workflow-artifact.js +++ b/github-actions/previews/upload-artifacts-to-firebase/fetch-workflow-artifact.js @@ -42,7 +42,7 @@ var require_fast_content_type_parse = __commonJS({ var defaultContentType = { type: "", parameters: new NullObject() }; Object.freeze(defaultContentType.parameters); Object.freeze(defaultContentType); - function parse2(header) { + function parse3(header) { if (typeof header !== "string") { throw new TypeError("argument header is required and must be a string"); } @@ -80,7 +80,7 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - function safeParse2(header) { + function safeParse3(header) { if (typeof header !== "string") { return defaultContentType; } @@ -118,9 +118,9 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - module.exports.default = { parse: parse2, safeParse: safeParse2 }; - module.exports.parse = parse2; - module.exports.safeParse = safeParse2; + module.exports.default = { parse: parse3, safeParse: safeParse3 }; + module.exports.parse = parse3; + module.exports.safeParse = safeParse3; module.exports.defaultContentType = defaultContentType; } }); @@ -333,9 +333,9 @@ function addQueryParameters(url, parameters) { return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } -var urlVariableRegex = /\{[^}]+\}/g; +var urlVariableRegex = /\{[^{}}]+\}/g; function removeNonChars(variableName) { - return variableName.replace(/^\W+|\W+$/g, "").split(/,/); + return variableName.replace(/(?:^\W+)|(?:(? { const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; return `application/vnd.github.${preview}-preview${format}`; @@ -551,12 +551,12 @@ function endpointWithDefaults(defaults, route, options) { return parse(merge(defaults, route, options)); } function withDefaults(oldDefaults, newDefaults) { - const DEFAULTS2 = merge(oldDefaults, newDefaults); - const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2); - return Object.assign(endpoint2, { - DEFAULTS: DEFAULTS2, - defaults: withDefaults.bind(null, DEFAULTS2), - merge: merge.bind(null, DEFAULTS2), + const DEFAULTS22 = merge(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults.bind(null, DEFAULTS22), + merge: merge.bind(null, DEFAULTS22), parse }); } @@ -585,7 +585,7 @@ var RequestError = class extends Error { if (options.request.headers.authorization) { requestCopy.headers = Object.assign({}, options.request.headers, { authorization: options.request.headers.authorization.replace( - / .*$/, + /(?]+)>; rel="deprecation"/); + const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/); const deprecationLink = matches && matches.pop(); log.warn( `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` @@ -748,40 +748,570 @@ function toErrorMessage(data) { return `Unknown error: ${JSON.stringify(data)}`; } function withDefaults2(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper(endpoint2.parse(endpointOptions)); + return fetchWrapper(endpoint22.parse(endpointOptions)); } - const request2 = (route2, parameters2) => { + const request22 = (route2, parameters2) => { return fetchWrapper( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; - Object.assign(request2, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); - return endpointOptions.request.hook(request2, endpointOptions); + return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); } var request = withDefaults2(endpoint, defaults_default); // var VERSION3 = "0.0.0-development"; +var userAgent2 = `octokit-endpoint.js/${VERSION3} ${getUserAgent()}`; +var DEFAULTS2 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent2 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys2(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject3(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep2(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject3(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep2(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties2(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge2(defaults, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys2(options.headers); + removeUndefinedProperties2(options); + removeUndefinedProperties2(options.headers); + const mergedOptions = mergeDeep2(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters2(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex2 = /\{[^}]+\}/g; +function removeNonChars2(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames2(url) { + const matches = url.match(urlVariableRegex2); + if (!matches) { + return []; + } + return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); +} +function omit2(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved2(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved2(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue2(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + if (key) { + return encodeUnreserved2(key) + "=" + value; + } else { + return value; + } +} +function isDefined2(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator2(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues2(context, operator, key, modifier) { + var value = context[key], result = []; + if (isDefined2(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + result.push( + encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + result.push(encodeValue2(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + tmp.push(encodeValue2(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + tmp.push(encodeUnreserved2(k)); + tmp.push(encodeValue2(operator, value[k].toString())); + } + }); + } + if (isKeyOperator2(operator)) { + result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined2(value)) { + result.push(encodeUnreserved2(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved2(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl2(template) { + return { + expand: expand2.bind(null, template) + }; +} +function expand2(template, context) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues2(context, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved2(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse2(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit2(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames2(url); + url = parseUrl2(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit2(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters2(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults2(defaults, route, options) { + return parse2(merge2(defaults, route, options)); +} +function withDefaults3(oldDefaults, newDefaults) { + const DEFAULTS22 = merge2(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults3.bind(null, DEFAULTS22), + merge: merge2.bind(null, DEFAULTS22), + parse: parse2 + }); +} +var endpoint2 = withDefaults3(null, DEFAULTS2); + +// +var import_fast_content_type_parse2 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError2 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION4 = "0.0.0-development"; +var defaults_default2 = { + headers: { + "user-agent": `octokit-request.js/${VERSION4} ${getUserAgent()}` + } +}; +function isPlainObject4(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper2(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject4(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error) { + let message = "Unknown Error"; + if (error instanceof Error) { + if (error.name === "AbortError") { + error.status = 500; + throw error; + } + message = error.message; + if (error.name === "TypeError" && "cause" in error) { + if (error.cause instanceof Error) { + message = error.cause.message; + } else if (typeof error.cause === "string") { + message = error.cause; + } + } + } + const requestError = new RequestError2(message, 500, { + request: requestOptions + }); + requestError.cause = error; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError2(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2(toErrorMessage2(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData2(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData2(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse2.safeParse)(contentType); + if (isJSONResponse2(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse2(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage2(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults4(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper2(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper2( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); +} +var request2 = withDefaults4(endpoint2, defaults_default2); + +// +var VERSION5 = "0.0.0-development"; function _buildMessageForResponseErrors(data) { return `Request failed due to following response errors: ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.errors = response.errors; @@ -806,7 +1336,7 @@ var NON_VARIABLE_OPTIONS = [ ]; var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; -function graphql(request2, query, options) { +function graphql(request22, query, options) { if (options) { if (typeof query === "string" && "query" in options) { return Promise.reject( @@ -837,11 +1367,11 @@ function graphql(request2, query, options) { result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -856,25 +1386,25 @@ function graphql(request2, query, options) { return response.data.data; }); } -function withDefaults3(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); +function withDefaults5(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query, options) => { return graphql(newRequest, query, options); }; return Object.assign(newApi, { - defaults: withDefaults3.bind(null, newRequest), + defaults: withDefaults5.bind(null, newRequest), endpoint: newRequest.endpoint }); } -var graphql2 = withDefaults3(request, { +var graphql2 = withDefaults5(request2, { headers: { - "user-agent": `octokit-graphql.js/${VERSION3} ${getUserAgent()}` + "user-agent": `octokit-graphql.js/${VERSION5} ${getUserAgent()}` }, method: "POST", url: "/graphql" }); function withCustomRequest(customRequest) { - return withDefaults3(customRequest, { + return withDefaults5(customRequest, { method: "POST", url: "/graphql" }); @@ -902,13 +1432,13 @@ function withAuthorizationPrefix(token) { } return `token ${token}`; } -async function hook(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( +async function hook(token, request3, route, parameters) { + const endpoint3 = request3.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix(token); - return request2(endpoint2); + endpoint3.headers.authorization = withAuthorizationPrefix(token); + return request3(endpoint3); } var createTokenAuth = function createTokenAuth2(token) { if (!token) { @@ -926,14 +1456,14 @@ var createTokenAuth = function createTokenAuth2(token) { }; // -var VERSION4 = "6.1.3"; +var VERSION6 = "6.1.4"; // var noop = () => { }; var consoleWarn = console.warn.bind(console); var consoleError = console.error.bind(console); -var userAgentTrail = `octokit-core.js/${VERSION4} ${getUserAgent()}`; +var userAgentTrail = `octokit-core.js/${VERSION6} ${getUserAgent()}`; var Octokit = class { static defaults(defaults) { const OctokitWithDefaults = class extends this { @@ -1038,20 +1568,20 @@ var Octokit = class { hook; auth; }; -__publicField(Octokit, "VERSION", VERSION4); +__publicField(Octokit, "VERSION", VERSION6); __publicField(Octokit, "plugins", []); // -var VERSION5 = "5.3.1"; +var VERSION7 = "5.3.1"; // function requestLog(octokit) { - octokit.hook.wrap("request", (request2, options) => { + octokit.hook.wrap("request", (request3, options) => { octokit.log.debug("request", options); const start = Date.now(); const requestOptions = octokit.request.endpoint.parse(options); const path = requestOptions.url.replace(options.baseUrl, ""); - return request2(options).then((response) => { + return request3(options).then((response) => { const requestId = response.headers["x-github-request-id"]; octokit.log.info( `${requestOptions.method} ${path} - ${response.status} with id ${requestId} in ${Date.now() - start}ms` @@ -1067,10 +1597,10 @@ function requestLog(octokit) { }); }); } -requestLog.VERSION = VERSION5; +requestLog.VERSION = VERSION7; // -var VERSION6 = "0.0.0-development"; +var VERSION8 = "0.0.0-development"; function normalizePaginatedListResponse(response) { if (!response.data) { return { @@ -1114,7 +1644,7 @@ function iterator(octokit, route, parameters) { const response = await requestMethod({ method, url, headers }); const normalizedResponse = normalizePaginatedListResponse(response); url = ((normalizedResponse.headers.link || "").match( - /<([^>]+)>;\s*rel="next"/ + /<([^<>]+)>;\s*rel="next"/ ) || [])[1]; return { value: normalizedResponse }; } catch (error) { @@ -1173,10 +1703,10 @@ function paginateRest(octokit) { }) }; } -paginateRest.VERSION = VERSION6; +paginateRest.VERSION = VERSION8; // -var VERSION7 = "13.3.1"; +var VERSION9 = "13.3.1"; // var Endpoints = { @@ -3249,8 +3779,8 @@ var endpoints_default = Endpoints; // var endpointMethodsMap = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint3] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint3; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -3375,7 +3905,7 @@ function restEndpointMethods(octokit) { rest: api }; } -restEndpointMethods.VERSION = VERSION7; +restEndpointMethods.VERSION = VERSION9; function legacyRestEndpointMethods(octokit) { const api = endpointsToMethods(octokit); return { @@ -3383,15 +3913,15 @@ function legacyRestEndpointMethods(octokit) { rest: api }; } -legacyRestEndpointMethods.VERSION = VERSION7; +legacyRestEndpointMethods.VERSION = VERSION9; // -var VERSION8 = "21.1.0"; +var VERSION10 = "21.1.1"; // var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRest).defaults( { - userAgent: `octokit-rest.js/${VERSION8}` + userAgent: `octokit-rest.js/${VERSION10}` } ); diff --git a/github-actions/unified-status-check/main.js b/github-actions/unified-status-check/main.js index 14a4a838f..3919fe923 100644 --- a/github-actions/unified-status-check/main.js +++ b/github-actions/unified-status-check/main.js @@ -3699,11 +3699,11 @@ var require_util2 = __commonJS({ } return location; } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -3769,7 +3769,7 @@ var require_util2 = __commonJS({ } return true; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const { headersList } = actualResponse; const policyHeader = (headersList.get("referrer-policy") ?? "").split(","); let policy = ""; @@ -3783,7 +3783,7 @@ var require_util2 = __commonJS({ } } if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -3800,33 +3800,33 @@ var require_util2 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; - if (request2.responseTainting === "cors" || request2.mode === "websocket") { + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; + if (request4.responseTainting === "cors" || request4.mode === "websocket") { if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } if (serializedOrigin) { - request2.headersList.append("origin", serializedOrigin); + request4.headersList.append("origin", serializedOrigin); } } } @@ -3858,26 +3858,26 @@ var require_util2 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (request2.referrer instanceof URL) { - referrerSource = request2.referrer; + } else if (request4.referrer instanceof URL) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); if (referrerURL.toString().length > 4096) { referrerURL = referrerOrigin; } - const areSameOrigin = sameOrigin(request2, referrerURL); - const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request2.url); + const areSameOrigin = sameOrigin(request4, referrerURL); + const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(request4.url); switch (policy) { case "origin": return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true); @@ -3888,7 +3888,7 @@ var require_util2 = __commonJS({ case "origin-when-cross-origin": return areSameOrigin ? referrerURL : referrerOrigin; case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -4037,7 +4037,7 @@ var require_util2 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -5923,25 +5923,25 @@ var require_request = __commonJS({ static [kHTTP2BuildRequest](origin, opts, handler2) { const headers = opts.headers; opts = { ...opts, headers: null }; - const request2 = new Request(origin, opts, handler2); - request2.headers = {}; + const request4 = new Request(origin, opts, handler2); + request4.headers = {}; if (Array.isArray(headers)) { if (headers.length % 2 !== 0) { throw new InvalidArgumentError("headers array must be even"); } for (let i = 0; i < headers.length; i += 2) { - processHeader(request2, headers[i], headers[i + 1], true); + processHeader(request4, headers[i], headers[i + 1], true); } } else if (headers && typeof headers === "object") { const keys = Object.keys(headers); for (let i = 0; i < keys.length; i++) { const key = keys[i]; - processHeader(request2, key, headers[key], true); + processHeader(request4, key, headers[key], true); } } else if (headers != null) { throw new InvalidArgumentError("headers must be an object or an array"); } - return request2; + return request4; } static [kHTTP2CopyHeaders](raw) { const rawHeaders = raw.split("\r\n"); @@ -5969,28 +5969,28 @@ var require_request = __commonJS({ return skipAppend ? val : `${key}: ${val}\r `; } - function processHeader(request2, key, val, skipAppend = false) { + function processHeader(request4, key, val, skipAppend = false) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { return; } - if (request2.host === null && key.length === 4 && key.toLowerCase() === "host") { + if (request4.host === null && key.length === 4 && key.toLowerCase() === "host") { if (headerCharRegex.exec(val) !== null) { throw new InvalidArgumentError(`invalid ${key} header`); } - request2.host = val; - } else if (request2.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && key.length === 14 && key.toLowerCase() === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { - request2.contentType = val; + } else if (request4.contentType === null && key.length === 12 && key.toLowerCase() === "content-type") { + request4.contentType = val; if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } else if (key.length === 17 && key.toLowerCase() === "transfer-encoding") { throw new InvalidArgumentError("invalid transfer-encoding header"); } else if (key.length === 10 && key.toLowerCase() === "connection") { @@ -5998,7 +5998,7 @@ var require_request = __commonJS({ if (value !== "close" && value !== "keep-alive") { throw new InvalidArgumentError("invalid connection header"); } else if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (key.length === 10 && key.toLowerCase() === "keep-alive") { throw new InvalidArgumentError("invalid keep-alive header"); @@ -6012,19 +6012,19 @@ var require_request = __commonJS({ if (Array.isArray(val)) { for (let i = 0; i < val.length; i++) { if (skipAppend) { - if (request2.headers[key]) - request2.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; + if (request4.headers[key]) + request4.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`; else - request2.headers[key] = processHeaderValue(key, val[i], skipAppend); + request4.headers[key] = processHeaderValue(key, val[i], skipAppend); } else { - request2.headers += processHeaderValue(key, val[i]); + request4.headers += processHeaderValue(key, val[i]); } } } else { if (skipAppend) - request2.headers[key] = processHeaderValue(key, val, skipAppend); + request4.headers[key] = processHeaderValue(key, val, skipAppend); else - request2.headers += processHeaderValue(key, val); + request4.headers += processHeaderValue(key, val); } } } @@ -7168,10 +7168,10 @@ var require_client = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); - this[kQueue].push(request2); + const request4 = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler2) : Request[kHTTP1BuildRequest](origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; process.nextTick(resume, this); } else { @@ -7195,8 +7195,8 @@ var require_client = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -7244,13 +7244,13 @@ var require_client = __commonJS({ assert(this[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(this, request2, err); + const request4 = requests[i]; + errorRequest(this, request4, err); } } else if (client[kRunning] > 0) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7456,8 +7456,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } } @@ -7497,12 +7497,12 @@ var require_client = __commonJS({ onUpgrade(head) { const { upgrade, client, socket, headers, statusCode } = this; assert(upgrade); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(!socket.destroyed); assert(socket === client[kSocket]); assert(!this.paused); - assert(request2.upgrade || request2.method === "CONNECT"); + assert(request4.upgrade || request4.method === "CONNECT"); this.statusCode = null; this.statusText = ""; this.shouldKeepAlive = null; @@ -7519,7 +7519,7 @@ var require_client = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -7530,8 +7530,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert(!this.upgrade); @@ -7540,22 +7540,22 @@ var require_client = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert.strictEqual(this.timeoutType, TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -7586,11 +7586,11 @@ var require_client = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -7607,8 +7607,8 @@ var require_client = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert.strictEqual(this.timeoutType, TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -7621,7 +7621,7 @@ var require_client = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } } @@ -7633,8 +7633,8 @@ var require_client = __commonJS({ if (upgrade) { return; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(statusCode >= 100); this.statusCode = null; this.statusText = ""; @@ -7648,11 +7648,11 @@ var require_client = __commonJS({ if (statusCode < 200) { return; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert.strictEqual(client[kRunning], 0); @@ -7710,8 +7710,8 @@ var require_client = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } assert(client[kSize] === 0); } @@ -7741,13 +7741,13 @@ var require_client = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - errorRequest(client, request2, err); + const request4 = requests[i]; + errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - errorRequest(client, request2, err); + errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -7880,8 +7880,8 @@ var require_client = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + errorRequest(client, request4, err); } } else { onError(client, err); @@ -7935,8 +7935,8 @@ var require_client = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request3 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request3.headersTimeout != null ? request3.headersTimeout : client[kHeadersTimeout]; + const request5 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request5.headersTimeout != null ? request5.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -7958,13 +7958,13 @@ var require_client = __commonJS({ if (client[kRunning] >= (client[kPipelining] || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; - if (socket && socket.servername !== request2.servername) { + client[kServerName] = request4.servername; + if (socket && socket.servername !== request4.servername) { util.destroy(socket, new InformationalError("servername changed")); return; } @@ -7979,16 +7979,16 @@ var require_client = __commonJS({ if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) { return; } - if (client[kRunning] > 0 && !request2.idempotent) { + if (client[kRunning] > 0 && !request4.idempotent) { return; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body))) { return; } - if (!request2.aborted && write(client, request2)) { + if (!request4.aborted && write(client, request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -7998,12 +7998,12 @@ var require_client = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function write(client, request2) { + function write(client, request4) { if (client[kHTTPConnVersion] === "h2") { - writeH2(client, client[kHTTP2Session], request2); + writeH2(client, client[kHTTP2Session], request4); return; } - const { body, method, path, host, upgrade, headers, blocking, reset } = request2; + const { body, method, path, host, upgrade, headers, blocking, reset } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { body.read(0); @@ -8011,31 +8011,31 @@ var require_client = __commonJS({ const bodyLength = util.bodyLength(body); let contentLength = bodyLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(socket, new InformationalError("aborted")); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -8074,7 +8074,7 @@ upgrade: ${upgrade}\r header += headers; } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { if (contentLength === 0) { @@ -8086,7 +8086,7 @@ upgrade: ${upgrade}\r socket.write(`${header}\r `, "latin1"); } - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); socket.cork(); @@ -8095,48 +8095,48 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable({ body: body.stream(), client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body: body.stream(), client, request: request4, socket, contentLength, header, expectsPayload }); } else { - writeBlob({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeBlob({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } } else if (util.isStream(body)) { - writeStream({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeStream({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else if (util.isIterable(body)) { - writeIterable({ body, client, request: request2, socket, contentLength, header, expectsPayload }); + writeIterable({ body, client, request: request4, socket, contentLength, header, expectsPayload }); } else { assert(false); } return true; } - function writeH2(client, session, request2) { - const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; + function writeH2(client, session, request4) { + const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; let headers; if (typeof reqHeaders === "string") headers = Request[kHTTP2CopyHeaders](reqHeaders.trim()); else headers = reqHeaders; if (upgrade) { - errorRequest(client, request2, new Error("Upgrade not supported for H2")); + errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } try { - request2.onConnect((err) => { - if (request2.aborted || request2.completed) { + request4.onConnect((err) => { + if (request4.aborted || request4.completed) { return; } - errorRequest(client, request2, err || new RequestAbortedError()); + errorRequest(client, request4, err || new RequestAbortedError()); }); } catch (err) { - errorRequest(client, request2, err); + errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } let stream; @@ -8147,11 +8147,11 @@ upgrade: ${upgrade}\r session.ref(); stream = session.request(headers, { endStream: false, signal }); if (stream.id && !stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++h2State.openStreams; }); } @@ -8170,14 +8170,14 @@ upgrade: ${upgrade}\r } let contentLength = util.bodyLength(body); if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - errorRequest(client, request2, new RequestContentLengthMismatchError()); + errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -8202,15 +8202,15 @@ upgrade: ${upgrade}\r ++h2State.openStreams; stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - if (request2.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.once("end", () => { - request2.onComplete([]); + request4.onComplete([]); }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -8228,7 +8228,7 @@ upgrade: ${upgrade}\r }); stream.once("frameError", (type, code) => { const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`); - errorRequest(client, request2, err); + errorRequest(client, request4, err); if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { h2State.streams -= 1; util.destroy(stream, err); @@ -8237,20 +8237,20 @@ upgrade: ${upgrade}\r return true; function writeBodyH2() { if (!body) { - request2.onRequestSent(); + request4.onRequestSent(); } else if (util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); stream.cork(); stream.write(body); stream.uncork(); stream.end(); - request2.onBodySent(body); - request2.onRequestSent(); + request4.onBodySent(body); + request4.onRequestSent(); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { writeIterable({ client, - request: request2, + request: request4, contentLength, h2stream: stream, expectsPayload, @@ -8262,7 +8262,7 @@ upgrade: ${upgrade}\r writeBlob({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, h2stream: stream, @@ -8274,7 +8274,7 @@ upgrade: ${upgrade}\r writeStream({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, socket: client[kSocket], @@ -8285,7 +8285,7 @@ upgrade: ${upgrade}\r writeIterable({ body, client, - request: request2, + request: request4, contentLength, expectsPayload, header: "", @@ -8297,11 +8297,11 @@ upgrade: ${upgrade}\r } } } - function writeStream({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + function writeStream({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); if (client[kHTTPConnVersion] === "h2") { let onPipeData = function(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); }; const pipe = pipeline( body, @@ -8311,7 +8311,7 @@ upgrade: ${upgrade}\r util.destroy(body, err); util.destroy(h2stream, err); } else { - request2.onRequestSent(); + request4.onRequestSent(); } } ); @@ -8323,7 +8323,7 @@ upgrade: ${upgrade}\r return; } let finished = false; - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -8379,7 +8379,7 @@ upgrade: ${upgrade}\r } socket.on("drain", onDrain).on("error", onFinished); } - async function writeBlob({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeBlob({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength === body.size, "blob body must have content length"); const isH2 = client[kHTTPConnVersion] === "h2"; try { @@ -8399,8 +8399,8 @@ upgrade: ${upgrade}\r socket.write(buffer); socket.uncork(); } - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -8409,7 +8409,7 @@ upgrade: ${upgrade}\r util.destroy(isH2 ? h2stream : socket, err); } } - async function writeIterable({ h2stream, body, client, request: request2, socket, contentLength, header, expectsPayload }) { + async function writeIterable({ h2stream, body, client, request: request4, socket, contentLength, header, expectsPayload }) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -8435,7 +8435,7 @@ upgrade: ${upgrade}\r throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } @@ -8443,14 +8443,14 @@ upgrade: ${upgrade}\r } catch (err) { h2stream.destroy(err); } finally { - request2.onRequestSent(); + request4.onRequestSent(); h2stream.end(); h2stream.off("close", onDrain).off("drain", onDrain); } return; } socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -8468,9 +8468,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -8479,7 +8479,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -8518,7 +8518,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -8529,8 +8529,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -8573,10 +8573,10 @@ ${len.toString(16)}\r } } }; - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert(request2.aborted); + request4.onError(err); + assert(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -9671,10 +9671,10 @@ var require_api_request = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -9689,7 +9689,7 @@ var require_api_request = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -10403,7 +10403,7 @@ var require_mock_utils = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (typeof data === "object") { @@ -10508,7 +10508,7 @@ var require_mock_utils = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); handler2.abort = nop; @@ -10565,7 +10565,7 @@ var require_mock_utils = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -10587,7 +10587,7 @@ var require_mock_utils = __commonJS({ var require_mock_interceptor = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils(); var { kDispatches, kDispatchKey, @@ -10650,7 +10650,7 @@ var require_mock_interceptor = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData(statusCode, data, responseOptions = {}) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -12299,7 +12299,7 @@ var require_request2 = __commonJS({ policyContainer: makePolicyContainer() } }; - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = this[kRealm].settingsObject.baseUrl; let signal = null; @@ -12315,17 +12315,17 @@ var require_request2 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(input instanceof Request); - request2 = input[kState]; + request4 = input[kState]; signal = input[kSignal]; } const origin = this[kRealm].settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request4.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -12333,43 +12333,43 @@ var require_request2 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: this[kRealm].settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -12378,14 +12378,14 @@ var require_request2 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, this[kRealm].settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -12400,27 +12400,27 @@ var require_request2 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; @@ -12431,12 +12431,12 @@ var require_request2 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizeMethodRecord[method] ?? normalizeMethod(method); - request2.method = method; + request4.method = method; } if (init.signal !== void 0) { signal = init.signal; } - this[kState] = request2; + this[kState] = request4; const ac = new AbortController(); this[kSignal] = ac.signal; this[kSignal][kRealm] = this[kRealm]; @@ -12470,13 +12470,13 @@ var require_request2 = __commonJS({ } } this[kHeaders] = new Headers(kConstruct); - this[kHeaders][kHeadersList] = request2.headersList; + this[kHeaders][kHeadersList] = request4.headersList; this[kHeaders][kGuard] = "request"; this[kHeaders][kRealm] = this[kRealm]; if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } this[kHeaders][kGuard] = "request-no-cors"; @@ -12495,14 +12495,14 @@ var require_request2 = __commonJS({ } } const inputBody = input instanceof Request ? input[kState].body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !this[kHeaders][kHeadersList].contains("content-type")) { @@ -12514,12 +12514,12 @@ var require_request2 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -12649,7 +12649,7 @@ var require_request2 = __commonJS({ }; mixinBody(Request); function makeRequest(init) { - const request2 = { + const request4 = { method: "GET", localURLsOnly: false, unsafeRequest: false, @@ -12688,13 +12688,13 @@ var require_request2 = __commonJS({ ...init, headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; - request2.url = request2.urlList[0]; - return request2; + request4.url = request4.urlList[0]; + return request4; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(request4.body); } return newRequest; } @@ -12924,14 +12924,14 @@ var require_fetch = __commonJS({ p.reject(e); return p.promise; } - const request2 = requestObject[kState]; + const request4 = requestObject[kState]; if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; const relevantRealm = null; @@ -12943,7 +12943,7 @@ var require_fetch = __commonJS({ locallyAborted = true; assert(controller != null); controller.abort(requestObject.signal.reason); - abortFetch(p, request2, responseObject, requestObject.signal.reason); + abortFetch(p, request4, responseObject, requestObject.signal.reason); } ); const handleFetchDone = (response) => finalizeAndReportTiming(response, "fetch"); @@ -12952,7 +12952,7 @@ var require_fetch = __commonJS({ return Promise.resolve(); } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return Promise.resolve(); } if (response.type === "error") { @@ -12970,7 +12970,7 @@ var require_fetch = __commonJS({ p.resolve(responseObject); }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: init.dispatcher ?? getGlobalDispatcher() @@ -13015,14 +13015,14 @@ var require_fetch = __commonJS({ performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis2, cacheState); } } - function abortFetch(p, request2, responseObject, error) { + function abortFetch(p, request4, responseObject, error) { var _a, _b; if (!error) { error = new DOMException2("The operation was aborted.", "AbortError"); } p.reject(error); - if (request2.body != null && isReadable((_a = request2.body) == null ? void 0 : _a.stream)) { - request2.body.stream.cancel(error).catch((err) => { + if (request4.body != null && isReadable((_a = request4.body) == null ? void 0 : _a.stream)) { + request4.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -13043,7 +13043,7 @@ var require_fetch = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -13055,9 +13055,9 @@ var require_fetch = __commonJS({ var _a, _b, _c, _d; let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currenTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -13065,7 +13065,7 @@ var require_fetch = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -13075,32 +13075,32 @@ var require_fetch = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a = request4.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = (_d = request2.client) == null ? void 0 : _d.origin; + if (request4.origin === "client") { + request4.origin = (_d = request4.client) == null ? void 0 : _d.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept")) { + if (!request4.headersList.contains("accept")) { const value = "*/*"; - request2.headersList.append("accept", value); + request4.headersList.append("accept", value); } - if (!request2.headersList.contains("accept-language")) { - request2.headersList.append("accept-language", "*"); + if (!request4.headersList.contains("accept-language")) { + request4.headersList.append("accept-language", "*"); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -13108,44 +13108,44 @@ var require_fetch = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { response = await (async () => { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; return await schemeFetch(fetchParams); } - if (request2.mode === "same-origin") { + if (request4.mode === "same-origin") { return makeNetworkError('request mode cannot be "same-origin"'); } - if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { return makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; return await schemeFetch(fetchParams); } - if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { return makeNetworkError("URL scheme must be a HTTP(S) scheme"); } - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; return await httpFetch(fetchParams); })(); } @@ -13153,13 +13153,13 @@ var require_fetch = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -13167,26 +13167,26 @@ var require_fetch = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range")) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range")) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -13202,8 +13202,8 @@ var require_fetch = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -13212,12 +13212,12 @@ var require_fetch = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blobURLEntryObject = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !isBlobLike(blobURLEntryObject)) { + if (request4.method !== "GET" || !isBlobLike(blobURLEntryObject)) { return Promise.resolve(makeNetworkError("invalid method")); } const bodyWithType = safelyExtractBody(blobURLEntryObject); @@ -13235,7 +13235,7 @@ var require_fetch = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -13317,41 +13317,41 @@ var require_fetch = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -13361,13 +13361,13 @@ var require_fetch = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -13378,63 +13378,63 @@ var require_fetch = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization"); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie"); - request2.headersList.delete("host"); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization"); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie"); + request4.headersList.delete("host"); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = makeRequest(request2); + httpRequest = makeRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -13511,7 +13511,7 @@ var require_fetch = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -13519,7 +13519,7 @@ var require_fetch = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -13547,21 +13547,21 @@ var require_fetch = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -13590,7 +13590,7 @@ var require_fetch = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -13702,17 +13702,17 @@ var require_fetch = __commonJS({ } return response; async function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: fetchParams.controller.dispatcher.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: fetchParams.controller.dispatcher.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -13758,8 +13758,8 @@ var require_fetch = __commonJS({ } this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = request2.redirect === "follow" && location && redirectStatusSet.has(status); - if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = request4.redirect === "follow" && location && redirectStatusSet.has(status); + if (request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (const coding of codings) { if (coding === "x-gzip" || coding === "gzip") { decoders.push(zlib.createGunzip({ @@ -14693,36 +14693,36 @@ var require_cache = __commonJS({ } this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); - const p = await this.matchAll(request2, options); + const p = await this.matchAll(request4, options); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { var _a; webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -14744,11 +14744,11 @@ var require_cache = __commonJS({ } return Object.freeze(responseList); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.add" }); - request2 = webidl.converters.RequestInfo(request2); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -14758,11 +14758,11 @@ var require_cache = __commonJS({ requests = webidl.converters["sequence"](requests); const responsePromises = []; const requestList = []; - for (const request2 of requests) { - if (typeof request2 === "string") { + for (const request4 of requests) { + if (typeof request4 === "string") { continue; } - const r = request2[kState]; + const r = request4[kState]; if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14771,8 +14771,8 @@ var require_cache = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = new Request(request2)[kState]; + for (const request4 of requests) { + const r = new Request(request4)[kState]; if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: "Cache.addAll", @@ -14847,16 +14847,16 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 2, { header: "Cache.put" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); response = webidl.converters.Response(response); let innerRequest = null; - if (request2 instanceof Request) { - innerRequest = request2[kState]; + if (request4 instanceof Request) { + innerRequest = request4[kState]; } else { - innerRequest = new Request(request2)[kState]; + innerRequest = new Request(request4)[kState]; } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -14924,20 +14924,20 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); webidl.argumentLengthCheck(arguments, 1, { header: "Cache.delete" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = new Request(request2)[kState]; + assert(typeof request4 === "string"); + r = new Request(request4)[kState]; } const operations = []; const operation = { @@ -14963,25 +14963,25 @@ var require_cache = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request2 !== void 0) { - if (request2 instanceof Request) { - r = request2[kState]; + if (request4 !== void 0) { + if (request4 instanceof Request) { + r = request4[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = new Request(request2)[kState]; + } else if (typeof request4 === "string") { + r = new Request(request4)[kState]; } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -14993,12 +14993,12 @@ var require_cache = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = new Request("https://a"); - requestObject[kState] = request3; - requestObject[kHeaders][kHeadersList] = request3.headersList; + requestObject[kState] = request5; + requestObject[kHeaders][kHeadersList] = request5.headersList; requestObject[kHeaders][kGuard] = "immutable"; - requestObject[kRealm] = request3.client; + requestObject[kRealm] = request5.client; requestList.push(requestObject); } promise.resolve(Object.freeze(requestList)); @@ -15093,9 +15093,9 @@ var require_cache = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -15111,7 +15111,7 @@ var require_cache = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -15183,21 +15183,21 @@ var require_cachestorage = __commonJS({ webidl.illegalConstructor(); } } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, { header: "CacheStorage.match" }); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -16110,7 +16110,7 @@ var require_connection = __commonJS({ function establishWebSocketConnection(url, protocols, ws, onEstablish, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], serviceWorkers: "none", referrer: "no-referrer", @@ -16121,17 +16121,17 @@ var require_connection = __commonJS({ }); if (options.headers) { const headersList = new Headers(options.headers)[kHeadersList]; - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue); - request2.headersList.append("sec-websocket-version", "13"); + request4.headersList.append("sec-websocket-key", keyValue); + request4.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol); + request4.headersList.append("sec-websocket-protocol", protocol); } const permessageDeflate = ""; const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher ?? getGlobalDispatcher(), processResponse(response) { @@ -16164,7 +16164,7 @@ var require_connection = __commonJS({ return; } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); - if (secProtocol !== null && secProtocol !== request2.headersList.get("Sec-WebSocket-Protocol")) { + if (secProtocol !== null && secProtocol !== request4.headersList.get("Sec-WebSocket-Protocol")) { failWebsocketConnection(ws, "Protocol was not set in the opening handshake."); return; } @@ -17209,7 +17209,7 @@ var require_lib = __commonJS({ } exports.isHttps = isHttps; var HttpClient = class { - constructor(userAgent2, handlers, requestOptions) { + constructor(userAgent4, handlers, requestOptions) { this._ignoreSslError = false; this._allowRedirects = true; this._allowRedirectDowngrade = false; @@ -17218,7 +17218,7 @@ var require_lib = __commonJS({ this._maxRetries = 1; this._keepAlive = false; this._disposed = false; - this.userAgent = userAgent2; + this.userAgent = userAgent4; this.handlers = handlers || []; this.requestOptions = requestOptions; if (requestOptions) { @@ -17483,14 +17483,14 @@ var require_lib = __commonJS({ } _mergeHeaders(headers) { if (this.requestOptions && this.requestOptions.headers) { - return Object.assign({}, lowercaseKeys2(this.requestOptions.headers), lowercaseKeys2(headers || {})); + return Object.assign({}, lowercaseKeys4(this.requestOptions.headers), lowercaseKeys4(headers || {})); } - return lowercaseKeys2(headers || {}); + return lowercaseKeys4(headers || {}); } _getExistingOrDefaultHeader(additionalHeaders, header, _default) { let clientHeader; if (this.requestOptions && this.requestOptions.headers) { - clientHeader = lowercaseKeys2(this.requestOptions.headers)[header]; + clientHeader = lowercaseKeys4(this.requestOptions.headers)[header]; } return additionalHeaders[header] || clientHeader || _default; } @@ -17625,7 +17625,7 @@ var require_lib = __commonJS({ } }; exports.HttpClient = HttpClient; - var lowercaseKeys2 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + var lowercaseKeys4 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); } }); @@ -19437,7 +19437,7 @@ var require_fast_content_type_parse = __commonJS({ var defaultContentType = { type: "", parameters: new NullObject() }; Object.freeze(defaultContentType.parameters); Object.freeze(defaultContentType); - function parse2(header) { + function parse4(header) { if (typeof header !== "string") { throw new TypeError("argument header is required and must be a string"); } @@ -19475,7 +19475,7 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - function safeParse2(header) { + function safeParse4(header) { if (typeof header !== "string") { return defaultContentType; } @@ -19513,9 +19513,9 @@ var require_fast_content_type_parse = __commonJS({ } return result; } - module.exports.default = { parse: parse2, safeParse: safeParse2 }; - module.exports.parse = parse2; - module.exports.safeParse = safeParse2; + module.exports.default = { parse: parse4, safeParse: safeParse4 }; + module.exports.parse = parse4; + module.exports.safeParse = safeParse4; module.exports.defaultContentType = defaultContentType; } }); @@ -20558,10 +20558,10 @@ var require_util8 = __commonJS({ } return obj; } - function errorRequest(client, request2, err) { + function errorRequest(client, request4, err) { try { - request2.onError(err); - assert(request2.aborted); + request4.onError(err); + assert(request4.aborted); } catch (err2) { client.emit("error", err2); } @@ -21089,7 +21089,7 @@ var require_request3 = __commonJS({ return this; } }; - function processHeader(request2, key, val) { + function processHeader(request4, key, val) { if (val && (typeof val === "object" && !Array.isArray(val))) { throw new InvalidArgumentError(`invalid ${key} header`); } else if (val === void 0) { @@ -21128,19 +21128,19 @@ var require_request3 = __commonJS({ } else { val = `${val}`; } - if (request2.host === null && headerName === "host") { + if (request4.host === null && headerName === "host") { if (typeof val !== "string") { throw new InvalidArgumentError("invalid host header"); } - request2.host = val; - } else if (request2.contentLength === null && headerName === "content-length") { - request2.contentLength = parseInt(val, 10); - if (!Number.isFinite(request2.contentLength)) { + request4.host = val; + } else if (request4.contentLength === null && headerName === "content-length") { + request4.contentLength = parseInt(val, 10); + if (!Number.isFinite(request4.contentLength)) { throw new InvalidArgumentError("invalid content-length header"); } - } else if (request2.contentType === null && headerName === "content-type") { - request2.contentType = val; - request2.headers.push(key, val); + } else if (request4.contentType === null && headerName === "content-type") { + request4.contentType = val; + request4.headers.push(key, val); } else if (headerName === "transfer-encoding" || headerName === "keep-alive" || headerName === "upgrade") { throw new InvalidArgumentError(`invalid ${headerName} header`); } else if (headerName === "connection") { @@ -21149,12 +21149,12 @@ var require_request3 = __commonJS({ throw new InvalidArgumentError("invalid connection header"); } if (value === "close") { - request2.reset = true; + request4.reset = true; } } else if (headerName === "expect") { throw new NotSupportedError("expect header not supported"); } else { - request2.headers.push(key, val); + request4.headers.push(key, val); } } module.exports = Request; @@ -23467,11 +23467,11 @@ var require_util9 = __commonJS({ function normalizeBinaryStringToUtf8(value) { return Buffer.from(value, "binary").toString("utf8"); } - function requestCurrentURL(request2) { - return request2.urlList[request2.urlList.length - 1]; + function requestCurrentURL(request4) { + return request4.urlList[request4.urlList.length - 1]; } - function requestBadPort(request2) { - const url = requestCurrentURL(request2); + function requestBadPort(request4) { + const url = requestCurrentURL(request4); if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { return "blocked"; } @@ -23508,10 +23508,10 @@ var require_util9 = __commonJS({ } return policy; } - function setRequestReferrerPolicyOnRedirect(request2, actualResponse) { + function setRequestReferrerPolicyOnRedirect(request4, actualResponse) { const policy = parseReferrerPolicy(actualResponse); if (policy !== "") { - request2.referrerPolicy = policy; + request4.referrerPolicy = policy; } } function crossOriginResourcePolicyCheck() { @@ -23528,33 +23528,33 @@ var require_util9 = __commonJS({ header = httpRequest.mode; httpRequest.headersList.set("sec-fetch-mode", header, true); } - function appendRequestOriginHeader(request2) { - let serializedOrigin = request2.origin; + function appendRequestOriginHeader(request4) { + let serializedOrigin = request4.origin; if (serializedOrigin === "client" || serializedOrigin === void 0) { return; } - if (request2.responseTainting === "cors" || request2.mode === "websocket") { - request2.headersList.append("origin", serializedOrigin, true); - } else if (request2.method !== "GET" && request2.method !== "HEAD") { - switch (request2.referrerPolicy) { + if (request4.responseTainting === "cors" || request4.mode === "websocket") { + request4.headersList.append("origin", serializedOrigin, true); + } else if (request4.method !== "GET" && request4.method !== "HEAD") { + switch (request4.referrerPolicy) { case "no-referrer": serializedOrigin = null; break; case "no-referrer-when-downgrade": case "strict-origin": case "strict-origin-when-cross-origin": - if (request2.origin && urlHasHttpsScheme(request2.origin) && !urlHasHttpsScheme(requestCurrentURL(request2))) { + if (request4.origin && urlHasHttpsScheme(request4.origin) && !urlHasHttpsScheme(requestCurrentURL(request4))) { serializedOrigin = null; } break; case "same-origin": - if (!sameOrigin(request2, requestCurrentURL(request2))) { + if (!sameOrigin(request4, requestCurrentURL(request4))) { serializedOrigin = null; } break; default: } - request2.headersList.append("origin", serializedOrigin, true); + request4.headersList.append("origin", serializedOrigin, true); } } function coarsenTime(timestamp, crossOriginIsolatedCapability) { @@ -23608,18 +23608,18 @@ var require_util9 = __commonJS({ referrerPolicy: policyContainer.referrerPolicy }; } - function determineRequestsReferrer(request2) { - const policy = request2.referrerPolicy; + function determineRequestsReferrer(request4) { + const policy = request4.referrerPolicy; assert(policy); let referrerSource = null; - if (request2.referrer === "client") { + if (request4.referrer === "client") { const globalOrigin = getGlobalOrigin(); if (!globalOrigin || globalOrigin.origin === "null") { return "no-referrer"; } referrerSource = new URL(globalOrigin); - } else if (webidl.is.URL(request2.referrer)) { - referrerSource = request2.referrer; + } else if (webidl.is.URL(request4.referrer)) { + referrerSource = request4.referrer; } let referrerURL = stripURLForReferrer(referrerSource); const referrerOrigin = stripURLForReferrer(referrerSource, true); @@ -23637,14 +23637,14 @@ var require_util9 = __commonJS({ case "unsafe-url": return referrerURL; case "strict-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } return referrerOrigin; } case "strict-origin-when-cross-origin": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (sameOrigin(referrerURL, currentURL)) { return referrerURL; } @@ -23654,17 +23654,17 @@ var require_util9 = __commonJS({ return referrerOrigin; } case "same-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return "no-referrer"; case "origin-when-cross-origin": - if (sameOrigin(request2, referrerURL)) { + if (sameOrigin(request4, referrerURL)) { return referrerURL; } return referrerOrigin; case "no-referrer-when-downgrade": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { return "no-referrer"; } @@ -23828,7 +23828,7 @@ var require_util9 = __commonJS({ } return true; } - function tryUpgradeRequestToAPotentiallyTrustworthyURL(request2) { + function tryUpgradeRequestToAPotentiallyTrustworthyURL(request4) { } function sameOrigin(A, B) { if (A.origin === B.origin && A.origin === "null") { @@ -25301,11 +25301,11 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } - request2.onResponseStarted(); + request4.onResponseStarted(); return 0; } onHeaderField(buf) { @@ -25353,9 +25353,9 @@ var require_client_h1 = __commonJS({ assert(!socket.destroyed); assert(!this.paused); assert((headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); - assert(request2.upgrade || request2.method === "CONNECT"); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); + assert(request4.upgrade || request4.method === "CONNECT"); this.statusCode = 0; this.statusText = ""; this.shouldKeepAlive = false; @@ -25372,7 +25372,7 @@ var require_client_h1 = __commonJS({ client[kQueue][client[kRunningIdx]++] = null; client.emit("disconnect", client[kUrl], [client], new InformationalError("upgrade")); try { - request2.onUpgrade(statusCode, headers, socket); + request4.onUpgrade(statusCode, headers, socket); } catch (err) { util.destroy(socket, err); } @@ -25383,8 +25383,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - if (!request2) { + const request4 = client[kQueue][client[kRunningIdx]]; + if (!request4) { return -1; } assert(!this.upgrade); @@ -25393,22 +25393,22 @@ var require_client_h1 = __commonJS({ util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; } - if (upgrade && !request2.upgrade) { + if (upgrade && !request4.upgrade) { util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } assert(this.timeoutType === TIMEOUT_HEADERS); this.statusCode = statusCode; - this.shouldKeepAlive = shouldKeepAlive || request2.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; + this.shouldKeepAlive = shouldKeepAlive || request4.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; if (this.statusCode >= 200) { - const bodyTimeout = request2.bodyTimeout != null ? request2.bodyTimeout : client[kBodyTimeout]; + const bodyTimeout = request4.bodyTimeout != null ? request4.bodyTimeout : client[kBodyTimeout]; this.setTimeout(bodyTimeout, TIMEOUT_BODY); } else if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - if (request2.method === "CONNECT") { + if (request4.method === "CONNECT") { assert(client[kRunning] === 1); this.upgrade = true; return 2; @@ -25439,11 +25439,11 @@ var require_client_h1 = __commonJS({ } else { socket[kReset] = true; } - const pause = request2.onHeaders(statusCode, headers, this.resume, statusText) === false; - if (request2.aborted) { + const pause = request4.onHeaders(statusCode, headers, this.resume, statusText) === false; + if (request4.aborted) { return -1; } - if (request2.method === "HEAD") { + if (request4.method === "HEAD") { return 1; } if (statusCode < 200) { @@ -25460,8 +25460,8 @@ var require_client_h1 = __commonJS({ if (socket.destroyed) { return -1; } - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); assert(this.timeoutType === TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { @@ -25474,7 +25474,7 @@ var require_client_h1 = __commonJS({ return -1; } this.bytesRead += buf.length; - if (request2.onData(buf) === false) { + if (request4.onData(buf) === false) { return constants.ERROR.PAUSED; } return 0; @@ -25489,8 +25489,8 @@ var require_client_h1 = __commonJS({ } assert(statusCode >= 100); assert((this.headers.length & 1) === 0); - const request2 = client[kQueue][client[kRunningIdx]]; - assert(request2); + const request4 = client[kQueue][client[kRunningIdx]]; + assert(request4); this.statusCode = 0; this.statusText = ""; this.bytesRead = 0; @@ -25502,11 +25502,11 @@ var require_client_h1 = __commonJS({ if (statusCode < 200) { return 0; } - if (request2.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { + if (request4.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) { util.destroy(socket, new ResponseContentLengthMismatchError()); return -1; } - request2.onComplete(headers); + request4.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { assert(client[kRunning] === 0); @@ -25572,8 +25572,8 @@ var require_client_h1 = __commonJS({ return { version: "h1", defaultPipelining: 1, - write(request2) { - return writeH1(client, request2); + write(request4) { + return writeH1(client, request4); }, resume() { resumeH1(client); @@ -25589,18 +25589,18 @@ var require_client_h1 = __commonJS({ get destroyed() { return socket.destroyed; }, - busy(request2) { + busy(request4) { if (socket[kWriting] || socket[kReset] || socket[kBlocking]) { return true; } - if (request2) { - if (client[kRunning] > 0 && !request2.idempotent) { + if (request4) { + if (client[kRunning] > 0 && !request4.idempotent) { return true; } - if (client[kRunning] > 0 && (request2.upgrade || request2.method === "CONNECT")) { + if (client[kRunning] > 0 && (request4.upgrade || request4.method === "CONNECT")) { return true; } - if (client[kRunning] > 0 && util.bodyLength(request2.body) !== 0 && (util.isStream(request2.body) || util.isAsyncIterable(request2.body) || util.isFormDataLike(request2.body))) { + if (client[kRunning] > 0 && util.bodyLength(request4.body) !== 0 && (util.isStream(request4.body) || util.isAsyncIterable(request4.body) || util.isFormDataLike(request4.body))) { return true; } } @@ -25647,13 +25647,13 @@ var require_client_h1 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } else if (client[kRunning] > 0 && err.code !== "UND_ERR_INFO") { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } client[kPendingIdx] = client[kRunningIdx]; assert(client[kRunning] === 0); @@ -25681,8 +25681,8 @@ var require_client_h1 = __commonJS({ } } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request2 = client[kQueue][client[kRunningIdx]]; - const headersTimeout = request2.headersTimeout != null ? request2.headersTimeout : client[kHeadersTimeout]; + const request4 = client[kQueue][client[kRunningIdx]]; + const headersTimeout = request4.headersTimeout != null ? request4.headersTimeout : client[kHeadersTimeout]; socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS); } } @@ -25691,21 +25691,21 @@ var require_client_h1 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH1(client, request2) { - const { method, path, host, upgrade, blocking, reset } = request2; - let { body, headers, contentLength } = request2; + function writeH1(client, request4) { + const { method, path, host, upgrade, blocking, reset } = request4; + let { body, headers, contentLength } = request4; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH"; if (util.isFormDataLike(body)) { if (!extractBody) { extractBody = require_body2().extractBody; } const [bodyStream, contentType] = extractBody(body); - if (request2.contentType == null) { + if (request4.contentType == null) { headers.push("content-type", contentType); } body = bodyStream.stream; contentLength = bodyStream.length; - } else if (util.isBlobLike(body) && request2.contentType == null && body.type) { + } else if (util.isBlobLike(body) && request4.contentType == null && body.type) { headers.push("content-type", body.type); } if (body && typeof body.read === "function") { @@ -25714,33 +25714,33 @@ var require_client_h1 = __commonJS({ const bodyLength = util.bodyLength(body); contentLength = bodyLength ?? contentLength; if (contentLength === null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 && !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength !== null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength !== null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); } const socket = client[kSocket]; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - util.errorRequest(client, request2, err || new RequestAbortedError()); + util.errorRequest(client, request4, err || new RequestAbortedError()); util.destroy(body); util.destroy(socket, new InformationalError("aborted")); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "HEAD") { @@ -25791,31 +25791,31 @@ upgrade: ${upgrade}\r } } if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request: request2, headers: header, socket }); + channels.sendHeaders.publish({ request: request4, headers: header, socket }); } if (!body || bodyLength === 0) { - writeBuffer(abort, null, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, null, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBuffer(body)) { - writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isBlobLike(body)) { if (typeof body.stream === "function") { - writeIterable(abort, body.stream(), client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body.stream(), client, request4, socket, contentLength, header, expectsPayload); } else { - writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload); } } else if (util.isStream(body)) { - writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else if (util.isIterable(body)) { - writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload); + writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload); } else { assert(false); } return true; } - function writeStream(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeStream(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); let finished = false; - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); const onData = function(chunk) { if (finished) { return; @@ -25881,7 +25881,7 @@ upgrade: ${upgrade}\r setImmediate(onClose); } } - function writeBuffer(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + function writeBuffer(abort, body, client, request4, socket, contentLength, header, expectsPayload) { try { if (!body) { if (contentLength === 0) { @@ -25901,18 +25901,18 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(body); socket.uncork(); - request2.onBodySent(body); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(body); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (err) { abort(err); } } - async function writeBlob(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeBlob(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -25925,9 +25925,9 @@ upgrade: ${upgrade}\r `, "latin1"); socket.write(buffer); socket.uncork(); - request2.onBodySent(buffer); - request2.onRequestSent(); - if (!expectsPayload && request2.reset !== false) { + request4.onBodySent(buffer); + request4.onRequestSent(); + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } client[kResume](); @@ -25935,7 +25935,7 @@ upgrade: ${upgrade}\r abort(err); } } - async function writeIterable(abort, body, client, request2, socket, contentLength, header, expectsPayload) { + async function writeIterable(abort, body, client, request4, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -25954,7 +25954,7 @@ upgrade: ${upgrade}\r } }); socket.on("close", onDrain).on("drain", onDrain); - const writer = new AsyncWriter({ abort, socket, request: request2, contentLength, client, expectsPayload, header }); + const writer = new AsyncWriter({ abort, socket, request: request4, contentLength, client, expectsPayload, header }); try { for await (const chunk of body) { if (socket[kError]) { @@ -25972,9 +25972,9 @@ upgrade: ${upgrade}\r } } var AsyncWriter = class { - constructor({ abort, socket, request: request2, contentLength, client, expectsPayload, header }) { + constructor({ abort, socket, request: request4, contentLength, client, expectsPayload, header }) { this.socket = socket; - this.request = request2; + this.request = request4; this.contentLength = contentLength; this.client = client; this.bytesWritten = 0; @@ -25984,7 +25984,7 @@ upgrade: ${upgrade}\r socket[kWriting] = true; } write(chunk) { - const { socket, request: request2, contentLength, client, bytesWritten, expectsPayload, header } = this; + const { socket, request: request4, contentLength, client, bytesWritten, expectsPayload, header } = this; if (socket[kError]) { throw socket[kError]; } @@ -26003,7 +26003,7 @@ upgrade: ${upgrade}\r } socket.cork(); if (bytesWritten === 0) { - if (!expectsPayload && request2.reset !== false) { + if (!expectsPayload && request4.reset !== false) { socket[kReset] = true; } if (contentLength === null) { @@ -26023,7 +26023,7 @@ ${len.toString(16)}\r this.bytesWritten += len; const ret = socket.write(chunk); socket.uncork(); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!ret) { if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { if (socket[kParser].timeout.refresh) { @@ -26034,8 +26034,8 @@ ${len.toString(16)}\r return ret; } end() { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request2 } = this; - request2.onRequestSent(); + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request: request4 } = this; + request4.onRequestSent(); socket[kWriting] = false; if (socket[kError]) { throw socket[kError]; @@ -26178,8 +26178,8 @@ var require_client_h2 = __commonJS({ return { version: "h2", defaultPipelining: Infinity, - write(request2) { - return writeH2(client, request2); + write(request4) { + return writeH2(client, request4); }, resume() { resumeH2(client); @@ -26237,9 +26237,9 @@ var require_client_h2 = __commonJS({ this[kHTTP2Session] = null; util.destroy(this[kSocket], err); if (client[kRunningIdx] < client[kQueue].length) { - const request2 = client[kQueue][client[kRunningIdx]]; + const request4 = client[kQueue][client[kRunningIdx]]; client[kQueue][client[kRunningIdx]++] = null; - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); client[kPendingIdx] = client[kRunningIdx]; } assert(client[kRunning] === 0); @@ -26256,8 +26256,8 @@ var require_client_h2 = __commonJS({ assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } } } @@ -26288,13 +26288,13 @@ var require_client_h2 = __commonJS({ function shouldSendContentLength(method) { return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; } - function writeH2(client, request2) { - const requestTimeout = request2.bodyTimeout ?? client[kBodyTimeout]; + function writeH2(client, request4) { + const requestTimeout = request4.bodyTimeout ?? client[kBodyTimeout]; const session = client[kHTTP2Session]; - const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2; - let { body } = request2; + const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request4; + let { body } = request4; if (upgrade) { - util.errorRequest(client, request2, new Error("Upgrade not supported for H2")); + util.errorRequest(client, request4, new Error("Upgrade not supported for H2")); return false; } const headers = {}; @@ -26318,11 +26318,11 @@ var require_client_h2 = __commonJS({ headers[HTTP2_HEADER_AUTHORITY] = host || `${hostname}${port ? `:${port}` : ""}`; headers[HTTP2_HEADER_METHOD] = method; const abort = (err) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } err = err || new RequestAbortedError(); - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); if (stream != null) { stream.removeAllListeners("data"); stream.close(); @@ -26332,23 +26332,23 @@ var require_client_h2 = __commonJS({ util.destroy(body, err); }; try { - request2.onConnect(abort); + request4.onConnect(abort); } catch (err) { - util.errorRequest(client, request2, err); + util.errorRequest(client, request4, err); } - if (request2.aborted) { + if (request4.aborted) { return false; } if (method === "CONNECT") { session.ref(); stream = session.request(headers, { endStream: false, signal }); if (!stream.pending) { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; } else { stream.once("ready", () => { - request2.onUpgrade(null, null, stream); + request4.onUpgrade(null, null, stream); ++session[kOpenStreams]; client[kQueue][client[kRunningIdx]++] = null; }); @@ -26376,14 +26376,14 @@ var require_client_h2 = __commonJS({ contentLength = bodyStream.length; } if (contentLength == null) { - contentLength = request2.contentLength; + contentLength = request4.contentLength; } if (contentLength === 0 || !expectsPayload) { contentLength = null; } - if (shouldSendContentLength(method) && contentLength > 0 && request2.contentLength != null && request2.contentLength !== contentLength) { + if (shouldSendContentLength(method) && contentLength > 0 && request4.contentLength != null && request4.contentLength !== contentLength) { if (client[kStrictContentLength]) { - util.errorRequest(client, request2, new RequestContentLengthMismatchError()); + util.errorRequest(client, request4, new RequestContentLengthMismatchError()); return false; } process.emitWarning(new RequestContentLengthMismatchError()); @@ -26399,7 +26399,7 @@ var require_client_h2 = __commonJS({ header += `${key}: ${headers[key]}\r `; } - channels.sendHeaders.publish({ request: request2, headers: header, socket: session[kSocket] }); + channels.sendHeaders.publish({ request: request4, headers: header, socket: session[kSocket] }); } const shouldEndStream = method === "GET" || method === "HEAD" || body === null; if (expectContinue) { @@ -26417,17 +26417,17 @@ var require_client_h2 = __commonJS({ stream.setTimeout(requestTimeout); stream.once("response", (headers2) => { const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers2; - request2.onResponseStarted(); - if (request2.aborted) { + request4.onResponseStarted(); + if (request4.aborted) { stream.removeAllListeners("data"); return; } - if (request2.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { + if (request4.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) { stream.pause(); } }); stream.on("data", (chunk) => { - if (request2.onData(chunk) === false) { + if (request4.onData(chunk) === false) { stream.pause(); } }); @@ -26435,8 +26435,8 @@ var require_client_h2 = __commonJS({ var _a; stream.removeAllListeners("data"); if (((_a = stream.state) == null ? void 0 : _a.state) == null || stream.state.state < 6) { - if (!request2.aborted && !request2.completed) { - request2.onComplete({}); + if (!request4.aborted && !request4.completed) { + request4.onComplete({}); } client[kQueue][client[kRunningIdx]++] = null; client[kResume](); @@ -26479,10 +26479,10 @@ var require_client_h2 = __commonJS({ abort(err); }); stream.once("trailers", (trailers) => { - if (request2.aborted || request2.completed) { + if (request4.aborted || request4.completed) { return; } - request2.onComplete(trailers); + request4.onComplete(trailers); }); return true; function writeBodyH2() { @@ -26492,7 +26492,7 @@ var require_client_h2 = __commonJS({ stream, null, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26503,7 +26503,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26515,7 +26515,7 @@ var require_client_h2 = __commonJS({ stream, body.stream(), client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26526,7 +26526,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26540,7 +26540,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, contentLength ); } else if (util.isIterable(body)) { @@ -26549,7 +26549,7 @@ var require_client_h2 = __commonJS({ stream, body, client, - request2, + request4, client[kSocket], contentLength, expectsPayload @@ -26559,7 +26559,7 @@ var require_client_h2 = __commonJS({ } } } - function writeBuffer(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + function writeBuffer(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { try { if (body != null && util.isBuffer(body)) { assert(contentLength === body.byteLength, "buffer body must have content length"); @@ -26567,18 +26567,18 @@ var require_client_h2 = __commonJS({ h2stream.write(body); h2stream.uncork(); h2stream.end(); - request2.onBodySent(body); + request4.onBodySent(body); } if (!expectsPayload) { socket[kReset] = true; } - request2.onRequestSent(); + request4.onRequestSent(); client[kResume](); } catch (error) { abort(error); } } - function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) { + function writeStream(abort, socket, expectsPayload, h2stream, body, client, request4, contentLength) { assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); const pipe = pipeline( body, @@ -26589,7 +26589,7 @@ var require_client_h2 = __commonJS({ abort(err); } else { util.removeAllListeners(pipe); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26599,10 +26599,10 @@ var require_client_h2 = __commonJS({ ); util.addListener(pipe, "data", onPipeData); function onPipeData(chunk) { - request2.onBodySent(chunk); + request4.onBodySent(chunk); } } - async function writeBlob(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeBlob(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert(contentLength === body.size, "blob body must have content length"); try { if (contentLength != null && contentLength !== body.size) { @@ -26613,8 +26613,8 @@ var require_client_h2 = __commonJS({ h2stream.write(buffer); h2stream.uncork(); h2stream.end(); - request2.onBodySent(buffer); - request2.onRequestSent(); + request4.onBodySent(buffer); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26623,7 +26623,7 @@ var require_client_h2 = __commonJS({ abort(err); } } - async function writeIterable(abort, h2stream, body, client, request2, socket, contentLength, expectsPayload) { + async function writeIterable(abort, h2stream, body, client, request4, socket, contentLength, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { @@ -26648,13 +26648,13 @@ var require_client_h2 = __commonJS({ throw socket[kError]; } const res = h2stream.write(chunk); - request2.onBodySent(chunk); + request4.onBodySent(chunk); if (!res) { await waitForDrain(); } } h2stream.end(); - request2.onRequestSent(); + request4.onRequestSent(); if (!expectsPayload) { socket[kReset] = true; } @@ -26901,10 +26901,10 @@ var require_client2 = __commonJS({ } [kDispatch](opts, handler2) { const origin = opts.origin || this[kUrl].origin; - const request2 = new Request(origin, opts, handler2); - this[kQueue].push(request2); + const request4 = new Request(origin, opts, handler2); + this[kQueue].push(request4); if (this[kResuming]) { - } else if (util.bodyLength(request2.body) == null && util.isIterable(request2.body)) { + } else if (util.bodyLength(request4.body) == null && util.isIterable(request4.body)) { this[kResuming] = 1; queueMicrotask(() => resume(this)); } else { @@ -26928,8 +26928,8 @@ var require_client2 = __commonJS({ return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(this, request2, err); + const request4 = requests[i]; + util.errorRequest(this, request4, err); } const callback = () => { if (this[kClosedResolve]) { @@ -26953,8 +26953,8 @@ var require_client2 = __commonJS({ assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i = 0; i < requests.length; i++) { - const request2 = requests[i]; - util.errorRequest(client, request2, err); + const request4 = requests[i]; + util.errorRequest(client, request4, err); } assert(client[kSize] === 0); } @@ -27058,8 +27058,8 @@ var require_client2 = __commonJS({ if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request2 = client[kQueue][client[kPendingIdx]++]; - util.errorRequest(client, request2, err); + const request4 = client[kQueue][client[kPendingIdx]++]; + util.errorRequest(client, request4, err); } } else { onError(client, err); @@ -27117,12 +27117,12 @@ var require_client2 = __commonJS({ if (client[kRunning] >= (getPipelining(client) || 1)) { return; } - const request2 = client[kQueue][client[kPendingIdx]]; - if (client[kUrl].protocol === "https:" && client[kServerName] !== request2.servername) { + const request4 = client[kQueue][client[kPendingIdx]]; + if (client[kUrl].protocol === "https:" && client[kServerName] !== request4.servername) { if (client[kRunning] > 0) { return; } - client[kServerName] = request2.servername; + client[kServerName] = request4.servername; (_a = client[kHTTPContext]) == null ? void 0 : _a.destroy(new InformationalError("servername changed"), () => { client[kHTTPContext] = null; resume(client); @@ -27138,10 +27138,10 @@ var require_client2 = __commonJS({ if (client[kHTTPContext].destroyed) { return; } - if (client[kHTTPContext].busy(request2)) { + if (client[kHTTPContext].busy(request4)) { return; } - if (!request2.aborted && client[kHTTPContext].write(request2)) { + if (!request4.aborted && client[kHTTPContext].write(request4)) { client[kPendingIdx]++; } else { client[kQueue].splice(client[kPendingIdx], 1); @@ -28755,10 +28755,10 @@ var require_api_request2 = __commonJS({ } } }; - function request2(opts, callback) { + function request4(opts, callback) { if (callback === void 0) { return new Promise((resolve, reject) => { - request2.call(this, opts, (err, data) => { + request4.call(this, opts, (err, data) => { return err ? reject(err) : resolve(data); }); }); @@ -28774,7 +28774,7 @@ var require_api_request2 = __commonJS({ queueMicrotask(() => callback(err, { opaque })); } } - module.exports = request2; + module.exports = request4; module.exports.RequestHandler = RequestHandler; } }); @@ -29540,7 +29540,7 @@ var require_mock_utils2 = __commonJS({ const headersMatch = matchHeaders(mockDispatch2, headers); return pathMatch && methodMatch && bodyMatch && headersMatch; } - function getResponseData2(data) { + function getResponseData4(data) { if (Buffer.isBuffer(data)) { return data; } else if (data instanceof Uint8Array) { @@ -29673,7 +29673,7 @@ var require_mock_utils2 = __commonJS({ body.then((newData) => handleReply(mockDispatches, newData)); return; } - const responseData = getResponseData2(body); + const responseData = getResponseData4(body); const responseHeaders = generateKeyValues(headers); const responseTrailers = generateKeyValues(trailers); (_a = handler2.onConnect) == null ? void 0 : _a.call(handler2, (err) => handler2.onError(err), null); @@ -29730,7 +29730,7 @@ var require_mock_utils2 = __commonJS({ } } module.exports = { - getResponseData: getResponseData2, + getResponseData: getResponseData4, getMockDispatch, addMockDispatch, deleteMockDispatch, @@ -29753,7 +29753,7 @@ var require_mock_utils2 = __commonJS({ var require_mock_interceptor2 = __commonJS({ ""(exports, module) { "use strict"; - var { getResponseData: getResponseData2, buildKey, addMockDispatch } = require_mock_utils2(); + var { getResponseData: getResponseData4, buildKey, addMockDispatch } = require_mock_utils2(); var { kDispatches, kDispatchKey, @@ -29818,7 +29818,7 @@ var require_mock_interceptor2 = __commonJS({ this[kContentLength] = false; } createMockScopeDispatchData({ statusCode, data, responseOptions }) { - const responseData = getResponseData2(data); + const responseData = getResponseData4(data); const contentLength = this[kContentLength] ? { "content-length": responseData.length } : {}; const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }; const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }; @@ -32118,7 +32118,7 @@ var require_sqlite_cache_store = __commonJS({ var { Writable } = __require("stream"); var { assertCacheKey, assertCacheValue } = require_cache2(); var DatabaseSync; - var VERSION13 = 3; + var VERSION17 = 3; var MAX_ENTRY_SIZE = 2 * 1e3 * 1e3 * 1e3; module.exports = class SqliteCacheStore { #maxEntrySize = MAX_ENTRY_SIZE; @@ -32157,7 +32157,7 @@ var require_sqlite_cache_store = __commonJS({ } this.#db = new DatabaseSync((opts == null ? void 0 : opts.location) ?? ":memory:"); this.#db.exec(` - CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION13} ( + CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION17} ( -- Data specific to us id INTEGER PRIMARY KEY AUTOINCREMENT, url TEXT NOT NULL, @@ -32176,9 +32176,9 @@ var require_sqlite_cache_store = __commonJS({ staleAt INTEGER NOT NULL ); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_url ON cacheInterceptorV${VERSION13}(url); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_method ON cacheInterceptorV${VERSION13}(method); - CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION13}_deleteAt ON cacheInterceptorV${VERSION13}(deleteAt); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_url ON cacheInterceptorV${VERSION17}(url); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_method ON cacheInterceptorV${VERSION17}(method); + CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION17}_deleteAt ON cacheInterceptorV${VERSION17}(deleteAt); `); this.#getValuesQuery = this.#db.prepare(` SELECT @@ -32193,7 +32193,7 @@ var require_sqlite_cache_store = __commonJS({ vary, cachedAt, staleAt - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION17} WHERE url = ? AND method = ? @@ -32201,7 +32201,7 @@ var require_sqlite_cache_store = __commonJS({ deleteAt ASC `); this.#updateValueQuery = this.#db.prepare(` - UPDATE cacheInterceptorV${VERSION13} SET + UPDATE cacheInterceptorV${VERSION17} SET body = ?, deleteAt = ?, statusCode = ?, @@ -32215,7 +32215,7 @@ var require_sqlite_cache_store = __commonJS({ id = ? `); this.#insertValueQuery = this.#db.prepare(` - INSERT INTO cacheInterceptorV${VERSION13} ( + INSERT INTO cacheInterceptorV${VERSION17} ( url, method, body, @@ -32231,20 +32231,20 @@ var require_sqlite_cache_store = __commonJS({ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `); this.#deleteByUrlQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE url = ?` + `DELETE FROM cacheInterceptorV${VERSION17} WHERE url = ?` ); this.#countEntriesQuery = this.#db.prepare( - `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION13}` + `SELECT COUNT(*) AS total FROM cacheInterceptorV${VERSION17}` ); this.#deleteExpiredValuesQuery = this.#db.prepare( - `DELETE FROM cacheInterceptorV${VERSION13} WHERE deleteAt <= ?` + `DELETE FROM cacheInterceptorV${VERSION17} WHERE deleteAt <= ?` ); this.#deleteOldValuesQuery = this.#maxCount === Infinity ? null : this.#db.prepare(` - DELETE FROM cacheInterceptorV${VERSION13} + DELETE FROM cacheInterceptorV${VERSION17} WHERE id IN ( SELECT id - FROM cacheInterceptorV${VERSION13} + FROM cacheInterceptorV${VERSION17} ORDER BY cachedAt DESC LIMIT ? ) @@ -33335,7 +33335,7 @@ var require_request4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); input = webidl.converters.RequestInfo(input, prefix, "input"); init = webidl.converters.RequestInit(init, prefix, "init"); - let request2 = null; + let request4 = null; let fallbackMode = null; const baseUrl = environmentSettingsObject.settingsObject.baseUrl; let signal = null; @@ -33352,18 +33352,18 @@ var require_request4 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request2 = makeRequest({ urlList: [parsedURL] }); + request4 = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(webidl.is.Request(input)); - request2 = input.#state; + request4 = input.#state; signal = input.#signal; this.#dispatcher = init.dispatcher || input.#dispatcher; } const origin = environmentSettingsObject.settingsObject.origin; let window = "client"; - if (((_b = (_a = request2.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request2.window, origin)) { - window = request2.window; + if (((_b = (_a = request4.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request4.window, origin)) { + window = request4.window; } if (init.window != null) { throw new TypeError(`'window' option '${window}' must be null`); @@ -33371,43 +33371,43 @@ var require_request4 = __commonJS({ if ("window" in init) { window = "no-window"; } - request2 = makeRequest({ - method: request2.method, - headersList: request2.headersList, - unsafeRequest: request2.unsafeRequest, + request4 = makeRequest({ + method: request4.method, + headersList: request4.headersList, + unsafeRequest: request4.unsafeRequest, client: environmentSettingsObject.settingsObject, window, - priority: request2.priority, - origin: request2.origin, - referrer: request2.referrer, - referrerPolicy: request2.referrerPolicy, - mode: request2.mode, - credentials: request2.credentials, - cache: request2.cache, - redirect: request2.redirect, - integrity: request2.integrity, - keepalive: request2.keepalive, - reloadNavigation: request2.reloadNavigation, - historyNavigation: request2.historyNavigation, - urlList: [...request2.urlList] + priority: request4.priority, + origin: request4.origin, + referrer: request4.referrer, + referrerPolicy: request4.referrerPolicy, + mode: request4.mode, + credentials: request4.credentials, + cache: request4.cache, + redirect: request4.redirect, + integrity: request4.integrity, + keepalive: request4.keepalive, + reloadNavigation: request4.reloadNavigation, + historyNavigation: request4.historyNavigation, + urlList: [...request4.urlList] }); const initHasKey = Object.keys(init).length !== 0; if (initHasKey) { - if (request2.mode === "navigate") { - request2.mode = "same-origin"; + if (request4.mode === "navigate") { + request4.mode = "same-origin"; } - request2.reloadNavigation = false; - request2.historyNavigation = false; - request2.origin = "client"; - request2.referrer = "client"; - request2.referrerPolicy = ""; - request2.url = request2.urlList[request2.urlList.length - 1]; - request2.urlList = [request2.url]; + request4.reloadNavigation = false; + request4.historyNavigation = false; + request4.origin = "client"; + request4.referrer = "client"; + request4.referrerPolicy = ""; + request4.url = request4.urlList[request4.urlList.length - 1]; + request4.urlList = [request4.url]; } if (init.referrer !== void 0) { const referrer = init.referrer; if (referrer === "") { - request2.referrer = "no-referrer"; + request4.referrer = "no-referrer"; } else { let parsedReferrer; try { @@ -33416,14 +33416,14 @@ var require_request4 = __commonJS({ throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }); } if (parsedReferrer.protocol === "about:" && parsedReferrer.hostname === "client" || origin && !sameOrigin(parsedReferrer, environmentSettingsObject.settingsObject.baseUrl)) { - request2.referrer = "client"; + request4.referrer = "client"; } else { - request2.referrer = parsedReferrer; + request4.referrer = parsedReferrer; } } } if (init.referrerPolicy !== void 0) { - request2.referrerPolicy = init.referrerPolicy; + request4.referrerPolicy = init.referrerPolicy; } let mode; if (init.mode !== void 0) { @@ -33438,33 +33438,33 @@ var require_request4 = __commonJS({ }); } if (mode != null) { - request2.mode = mode; + request4.mode = mode; } if (init.credentials !== void 0) { - request2.credentials = init.credentials; + request4.credentials = init.credentials; } if (init.cache !== void 0) { - request2.cache = init.cache; + request4.cache = init.cache; } - if (request2.cache === "only-if-cached" && request2.mode !== "same-origin") { + if (request4.cache === "only-if-cached" && request4.mode !== "same-origin") { throw new TypeError( "'only-if-cached' can be set only with 'same-origin' mode" ); } if (init.redirect !== void 0) { - request2.redirect = init.redirect; + request4.redirect = init.redirect; } if (init.integrity != null) { - request2.integrity = String(init.integrity); + request4.integrity = String(init.integrity); } if (init.keepalive !== void 0) { - request2.keepalive = Boolean(init.keepalive); + request4.keepalive = Boolean(init.keepalive); } if (init.method !== void 0) { let method = init.method; const mayBeNormalized = normalizedMethodRecords[method]; if (mayBeNormalized !== void 0) { - request2.method = mayBeNormalized; + request4.method = mayBeNormalized; } else { if (!isValidHTTPToken(method)) { throw new TypeError(`'${method}' is not a valid HTTP method.`); @@ -33474,9 +33474,9 @@ var require_request4 = __commonJS({ throw new TypeError(`'${method}' HTTP method is unsupported.`); } method = normalizedMethodRecordsBase[upperCase] ?? method; - request2.method = method; + request4.method = method; } - if (!patchMethodWarning && request2.method === "patch") { + if (!patchMethodWarning && request4.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" }); @@ -33486,7 +33486,7 @@ var require_request4 = __commonJS({ if (init.signal !== void 0) { signal = init.signal; } - this.#state = request2; + this.#state = request4; const ac = new AbortController(); this.#signal = ac.signal; if (signal != null) { @@ -33507,12 +33507,12 @@ var require_request4 = __commonJS({ } } this.#headers = new Headers(kConstruct); - setHeadersList(this.#headers, request2.headersList); + setHeadersList(this.#headers, request4.headersList); setHeadersGuard(this.#headers, "request"); if (mode === "no-cors") { - if (!corsSafeListedMethodsSet.has(request2.method)) { + if (!corsSafeListedMethodsSet.has(request4.method)) { throw new TypeError( - `'${request2.method} is unsupported in no-cors mode.` + `'${request4.method} is unsupported in no-cors mode.` ); } setHeadersGuard(this.#headers, "request-no-cors"); @@ -33531,14 +33531,14 @@ var require_request4 = __commonJS({ } } const inputBody = webidl.is.Request(input) ? input.#state.body : null; - if ((init.body != null || inputBody != null) && (request2.method === "GET" || request2.method === "HEAD")) { + if ((init.body != null || inputBody != null) && (request4.method === "GET" || request4.method === "HEAD")) { throw new TypeError("Request with GET/HEAD method cannot have body."); } let initBody = null; if (init.body != null) { const [extractedBody, contentType] = extractBody( init.body, - request2.keepalive + request4.keepalive ); initBody = extractedBody; if (contentType && !getHeadersList(this.#headers).contains("content-type", true)) { @@ -33550,12 +33550,12 @@ var require_request4 = __commonJS({ if (initBody != null && init.duplex == null) { throw new TypeError("RequestInit: duplex option is required when sending a body."); } - if (request2.mode !== "same-origin" && request2.mode !== "cors") { + if (request4.mode !== "same-origin" && request4.mode !== "cors") { throw new TypeError( 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' ); } - request2.useCORSPreflightFlag = true; + request4.useCORSPreflightFlag = true; } let finalBody = inputOrInitBody; if (initBody == null && inputBody != null) { @@ -33700,24 +33700,24 @@ var require_request4 = __commonJS({ }; return `Request ${nodeUtil.formatWithOptions(options, properties)}`; } - static setRequestSignal(request2, newSignal) { - request2.#signal = newSignal; - return request2; + static setRequestSignal(request4, newSignal) { + request4.#signal = newSignal; + return request4; } - static getRequestDispatcher(request2) { - return request2.#dispatcher; + static getRequestDispatcher(request4) { + return request4.#dispatcher; } - static setRequestDispatcher(request2, newDispatcher) { - request2.#dispatcher = newDispatcher; + static setRequestDispatcher(request4, newDispatcher) { + request4.#dispatcher = newDispatcher; } - static setRequestHeaders(request2, newHeaders) { - request2.#headers = newHeaders; + static setRequestHeaders(request4, newHeaders) { + request4.#headers = newHeaders; } - static getRequestState(request2) { - return request2.#state; + static getRequestState(request4) { + return request4.#state; } - static setRequestState(request2, newState) { - request2.#state = newState; + static setRequestState(request4, newState) { + request4.#state = newState; } }; var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState } = Request; @@ -33770,23 +33770,23 @@ var require_request4 = __commonJS({ headersList: init.headersList ? new HeadersList(init.headersList) : new HeadersList() }; } - function cloneRequest(request2) { - const newRequest = makeRequest({ ...request2, body: null }); - if (request2.body != null) { - newRequest.body = cloneBody(newRequest, request2.body); + function cloneRequest(request4) { + const newRequest = makeRequest({ ...request4, body: null }); + if (request4.body != null) { + newRequest.body = cloneBody(newRequest, request4.body); } return newRequest; } function fromInnerRequest(innerRequest, dispatcher, signal, guard) { - const request2 = new Request(kConstruct); - setRequestState(request2, innerRequest); - setRequestDispatcher(request2, dispatcher); - setRequestSignal(request2, signal); + const request4 = new Request(kConstruct); + setRequestState(request4, innerRequest); + setRequestDispatcher(request4, dispatcher); + setRequestSignal(request4, signal); const headers = new Headers(kConstruct); - setRequestHeaders(request2, headers); + setRequestHeaders(request4, headers); setHeadersList(headers, innerRequest.headersList); setHeadersGuard(headers, guard); - return request2; + return request4; } Object.defineProperties(Request.prototype, { method: kEnumerableProperty, @@ -34024,14 +34024,14 @@ var require_fetch2 = __commonJS({ p.reject(e); return p.promise; } - const request2 = getRequestState(requestObject); + const request4 = getRequestState(requestObject); if (requestObject.signal.aborted) { - abortFetch(p, request2, null, requestObject.signal.reason); + abortFetch(p, request4, null, requestObject.signal.reason); return p.promise; } - const globalObject = request2.client.globalObject; + const globalObject = request4.client.globalObject; if (((_a = globalObject == null ? void 0 : globalObject.constructor) == null ? void 0 : _a.name) === "ServiceWorkerGlobalScope") { - request2.serviceWorkers = "none"; + request4.serviceWorkers = "none"; } let responseObject = null; let locallyAborted = false; @@ -34043,7 +34043,7 @@ var require_fetch2 = __commonJS({ assert(controller != null); controller.abort(requestObject.signal.reason); const realResponse = responseObject == null ? void 0 : responseObject.deref(); - abortFetch(p, request2, realResponse, requestObject.signal.reason); + abortFetch(p, request4, realResponse, requestObject.signal.reason); } ); const processResponse = (response) => { @@ -34051,7 +34051,7 @@ var require_fetch2 = __commonJS({ return; } if (response.aborted) { - abortFetch(p, request2, responseObject, controller.serializedAbortReason); + abortFetch(p, request4, responseObject, controller.serializedAbortReason); return; } if (response.type === "error") { @@ -34063,7 +34063,7 @@ var require_fetch2 = __commonJS({ p = null; }; controller = fetching({ - request: request2, + request: request4, processResponseEndOfBody: handleFetchDone, processResponse, dispatcher: getRequestDispatcher(requestObject) @@ -34104,13 +34104,13 @@ var require_fetch2 = __commonJS({ ); } var markResourceTiming = performance.markResourceTiming; - function abortFetch(p, request2, responseObject, error) { + function abortFetch(p, request4, responseObject, error) { var _a, _b; if (p) { p.reject(error); } - if (((_a = request2.body) == null ? void 0 : _a.stream) != null && isReadable(request2.body.stream)) { - request2.body.stream.cancel(error).catch((err) => { + if (((_a = request4.body) == null ? void 0 : _a.stream) != null && isReadable(request4.body.stream)) { + request4.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -34131,7 +34131,7 @@ var require_fetch2 = __commonJS({ } } function fetching({ - request: request2, + request: request4, processRequestBodyChunkLength, processRequestEndOfBody, processResponse, @@ -34144,9 +34144,9 @@ var require_fetch2 = __commonJS({ assert(dispatcher); let taskDestination = null; let crossOriginIsolatedCapability = false; - if (request2.client != null) { - taskDestination = request2.client.globalObject; - crossOriginIsolatedCapability = request2.client.crossOriginIsolatedCapability; + if (request4.client != null) { + taskDestination = request4.client.globalObject; + crossOriginIsolatedCapability = request4.client.crossOriginIsolatedCapability; } const currentTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability); const timingInfo = createOpaqueTimingInfo({ @@ -34154,7 +34154,7 @@ var require_fetch2 = __commonJS({ }); const fetchParams = { controller: new Fetch(dispatcher), - request: request2, + request: request4, timingInfo, processRequestBodyChunkLength, processRequestEndOfBody, @@ -34164,32 +34164,32 @@ var require_fetch2 = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert(!request2.body || request2.body.stream); - if (request2.window === "client") { - request2.window = ((_c = (_b = (_a = request2.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request2.client : "no-window"; + assert(!request4.body || request4.body.stream); + if (request4.window === "client") { + request4.window = ((_c = (_b = (_a = request4.client) == null ? void 0 : _a.globalObject) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) === "Window" ? request4.client : "no-window"; } - if (request2.origin === "client") { - request2.origin = request2.client.origin; + if (request4.origin === "client") { + request4.origin = request4.client.origin; } - if (request2.policyContainer === "client") { - if (request2.client != null) { - request2.policyContainer = clonePolicyContainer( - request2.client.policyContainer + if (request4.policyContainer === "client") { + if (request4.client != null) { + request4.policyContainer = clonePolicyContainer( + request4.client.policyContainer ); } else { - request2.policyContainer = makePolicyContainer(); + request4.policyContainer = makePolicyContainer(); } } - if (!request2.headersList.contains("accept", true)) { + if (!request4.headersList.contains("accept", true)) { const value = "*/*"; - request2.headersList.append("accept", value, true); + request4.headersList.append("accept", value, true); } - if (!request2.headersList.contains("accept-language", true)) { - request2.headersList.append("accept-language", "*", true); + if (!request4.headersList.contains("accept-language", true)) { + request4.headersList.append("accept-language", "*", true); } - if (request2.priority === null) { + if (request4.priority === null) { } - if (subresourceSet.has(request2.destination)) { + if (subresourceSet.has(request4.destination)) { } mainFetch(fetchParams).catch((err) => { fetchParams.controller.terminate(err); @@ -34197,41 +34197,41 @@ var require_fetch2 = __commonJS({ return fetchParams.controller; } async function mainFetch(fetchParams, recursive = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; - if (request2.localURLsOnly && !urlIsLocal(requestCurrentURL(request2))) { + if (request4.localURLsOnly && !urlIsLocal(requestCurrentURL(request4))) { response = makeNetworkError("local URLs only"); } - tryUpgradeRequestToAPotentiallyTrustworthyURL(request2); - if (requestBadPort(request2) === "blocked") { + tryUpgradeRequestToAPotentiallyTrustworthyURL(request4); + if (requestBadPort(request4) === "blocked") { response = makeNetworkError("bad port"); } - if (request2.referrerPolicy === "") { - request2.referrerPolicy = request2.policyContainer.referrerPolicy; + if (request4.referrerPolicy === "") { + request4.referrerPolicy = request4.policyContainer.referrerPolicy; } - if (request2.referrer !== "no-referrer") { - request2.referrer = determineRequestsReferrer(request2); + if (request4.referrer !== "no-referrer") { + request4.referrer = determineRequestsReferrer(request4); } if (response === null) { - const currentURL = requestCurrentURL(request2); - if (sameOrigin(currentURL, request2.url) && request2.responseTainting === "basic" || currentURL.protocol === "data:" || (request2.mode === "navigate" || request2.mode === "websocket")) { - request2.responseTainting = "basic"; + const currentURL = requestCurrentURL(request4); + if (sameOrigin(currentURL, request4.url) && request4.responseTainting === "basic" || currentURL.protocol === "data:" || (request4.mode === "navigate" || request4.mode === "websocket")) { + request4.responseTainting = "basic"; response = await schemeFetch(fetchParams); - } else if (request2.mode === "same-origin") { + } else if (request4.mode === "same-origin") { response = makeNetworkError('request mode cannot be "same-origin"'); - } else if (request2.mode === "no-cors") { - if (request2.redirect !== "follow") { + } else if (request4.mode === "no-cors") { + if (request4.redirect !== "follow") { response = makeNetworkError( 'redirect mode cannot be "follow" for "no-cors" request' ); } else { - request2.responseTainting = "opaque"; + request4.responseTainting = "opaque"; response = await schemeFetch(fetchParams); } - } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request2))) { + } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request4))) { response = makeNetworkError("URL scheme must be a HTTP(S) scheme"); } else { - request2.responseTainting = "cors"; + request4.responseTainting = "cors"; response = await httpFetch(fetchParams); } } @@ -34239,13 +34239,13 @@ var require_fetch2 = __commonJS({ return response; } if (response.status !== 0 && !response.internalResponse) { - if (request2.responseTainting === "cors") { + if (request4.responseTainting === "cors") { } - if (request2.responseTainting === "basic") { + if (request4.responseTainting === "basic") { response = filterResponse(response, "basic"); - } else if (request2.responseTainting === "cors") { + } else if (request4.responseTainting === "cors") { response = filterResponse(response, "cors"); - } else if (request2.responseTainting === "opaque") { + } else if (request4.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { assert(false); @@ -34253,26 +34253,26 @@ var require_fetch2 = __commonJS({ } let internalResponse = response.status === 0 ? response : response.internalResponse; if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request2.urlList); + internalResponse.urlList.push(...request4.urlList); } - if (!request2.timingAllowFailed) { + if (!request4.timingAllowFailed) { response.timingAllowPassed = true; } - if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request2.headers.contains("range", true)) { + if (response.type === "opaque" && internalResponse.status === 206 && internalResponse.rangeRequested && !request4.headers.contains("range", true)) { response = internalResponse = makeNetworkError(); } - if (response.status !== 0 && (request2.method === "HEAD" || request2.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { + if (response.status !== 0 && (request4.method === "HEAD" || request4.method === "CONNECT" || nullBodyStatus.includes(internalResponse.status))) { internalResponse.body = null; fetchParams.controller.dump = true; } - if (request2.integrity) { + if (request4.integrity) { const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason)); - if (request2.responseTainting === "opaque" || response.body == null) { + if (request4.responseTainting === "opaque" || response.body == null) { processBodyError(response.error); return; } const processBody = (bytes) => { - if (!bytesMatch(bytes, request2.integrity)) { + if (!bytesMatch(bytes, request4.integrity)) { processBodyError("integrity mismatch"); return; } @@ -34288,8 +34288,8 @@ var require_fetch2 = __commonJS({ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { return Promise.resolve(makeAppropriateNetworkError(fetchParams)); } - const { request: request2 } = fetchParams; - const { protocol: scheme } = requestCurrentURL(request2); + const { request: request4 } = fetchParams; + const { protocol: scheme } = requestCurrentURL(request4); switch (scheme) { case "about:": { return Promise.resolve(makeNetworkError("about scheme is not supported")); @@ -34298,19 +34298,19 @@ var require_fetch2 = __commonJS({ if (!resolveObjectURL) { resolveObjectURL = __require("node:buffer").resolveObjectURL; } - const blobURLEntry = requestCurrentURL(request2); + const blobURLEntry = requestCurrentURL(request4); if (blobURLEntry.search.length !== 0) { return Promise.resolve(makeNetworkError("NetworkError when attempting to fetch resource.")); } const blob = resolveObjectURL(blobURLEntry.toString()); - if (request2.method !== "GET" || !webidl.is.Blob(blob)) { + if (request4.method !== "GET" || !webidl.is.Blob(blob)) { return Promise.resolve(makeNetworkError("invalid method")); } const response = makeResponse(); const fullLength = blob.size; const serializedFullLength = isomorphicEncode(`${fullLength}`); const type = blob.type; - if (!request2.headersList.contains("range", true)) { + if (!request4.headersList.contains("range", true)) { const bodyWithType = extractBody(blob); response.statusText = "OK"; response.body = bodyWithType[0]; @@ -34318,7 +34318,7 @@ var require_fetch2 = __commonJS({ response.headersList.set("content-type", type, true); } else { response.rangeRequested = true; - const rangeHeader = request2.headersList.get("range", true); + const rangeHeader = request4.headersList.get("range", true); const rangeValue = simpleRangeHeaderValue(rangeHeader, true); if (rangeValue === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34349,7 +34349,7 @@ var require_fetch2 = __commonJS({ return Promise.resolve(response); } case "data:": { - const currentURL = requestCurrentURL(request2); + const currentURL = requestCurrentURL(request4); const dataURLStruct = dataURLProcessor(currentURL); if (dataURLStruct === "failure") { return Promise.resolve(makeNetworkError("failed to fetch the data URL")); @@ -34438,41 +34438,41 @@ var require_fetch2 = __commonJS({ } } async function httpFetch(fetchParams) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; let actualResponse = null; const timingInfo = fetchParams.timingInfo; - if (request2.serviceWorkers === "all") { + if (request4.serviceWorkers === "all") { } if (response === null) { - if (request2.redirect === "follow") { - request2.serviceWorkers = "none"; + if (request4.redirect === "follow") { + request4.serviceWorkers = "none"; } actualResponse = response = await httpNetworkOrCacheFetch(fetchParams); - if (request2.responseTainting === "cors" && corsCheck(request2, response) === "failure") { + if (request4.responseTainting === "cors" && corsCheck(request4, response) === "failure") { return makeNetworkError("cors failure"); } - if (TAOCheck(request2, response) === "failure") { - request2.timingAllowFailed = true; + if (TAOCheck(request4, response) === "failure") { + request4.timingAllowFailed = true; } } - if ((request2.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( - request2.origin, - request2.client, - request2.destination, + if ((request4.responseTainting === "opaque" || response.type === "opaque") && crossOriginResourcePolicyCheck( + request4.origin, + request4.client, + request4.destination, actualResponse ) === "blocked") { return makeNetworkError("blocked"); } if (redirectStatusSet.has(actualResponse.status)) { - if (request2.redirect !== "manual") { + if (request4.redirect !== "manual") { fetchParams.controller.connection.destroy(void 0, false); } - if (request2.redirect === "error") { + if (request4.redirect === "error") { response = makeNetworkError("unexpected redirect"); - } else if (request2.redirect === "manual") { + } else if (request4.redirect === "manual") { response = actualResponse; - } else if (request2.redirect === "follow") { + } else if (request4.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { assert(false); @@ -34482,13 +34482,13 @@ var require_fetch2 = __commonJS({ return response; } function httpRedirectFetch(fetchParams, response) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; const actualResponse = response.internalResponse ? response.internalResponse : response; let locationURL; try { locationURL = responseLocationURL( actualResponse, - requestCurrentURL(request2).hash + requestCurrentURL(request4).hash ); if (locationURL == null) { return response; @@ -34499,63 +34499,63 @@ var require_fetch2 = __commonJS({ if (!urlIsHttpHttpsScheme(locationURL)) { return Promise.resolve(makeNetworkError("URL scheme must be a HTTP(S) scheme")); } - if (request2.redirectCount === 20) { + if (request4.redirectCount === 20) { return Promise.resolve(makeNetworkError("redirect count exceeded")); } - request2.redirectCount += 1; - if (request2.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request2, locationURL)) { + request4.redirectCount += 1; + if (request4.mode === "cors" && (locationURL.username || locationURL.password) && !sameOrigin(request4, locationURL)) { return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')); } - if (request2.responseTainting === "cors" && (locationURL.username || locationURL.password)) { + if (request4.responseTainting === "cors" && (locationURL.username || locationURL.password)) { return Promise.resolve(makeNetworkError( 'URL cannot contain credentials for request mode "cors"' )); } - if (actualResponse.status !== 303 && request2.body != null && request2.body.source == null) { + if (actualResponse.status !== 303 && request4.body != null && request4.body.source == null) { return Promise.resolve(makeNetworkError()); } - if ([301, 302].includes(actualResponse.status) && request2.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request2.method)) { - request2.method = "GET"; - request2.body = null; + if ([301, 302].includes(actualResponse.status) && request4.method === "POST" || actualResponse.status === 303 && !GET_OR_HEAD.includes(request4.method)) { + request4.method = "GET"; + request4.body = null; for (const headerName of requestBodyHeader) { - request2.headersList.delete(headerName); + request4.headersList.delete(headerName); } } - if (!sameOrigin(requestCurrentURL(request2), locationURL)) { - request2.headersList.delete("authorization", true); - request2.headersList.delete("proxy-authorization", true); - request2.headersList.delete("cookie", true); - request2.headersList.delete("host", true); + if (!sameOrigin(requestCurrentURL(request4), locationURL)) { + request4.headersList.delete("authorization", true); + request4.headersList.delete("proxy-authorization", true); + request4.headersList.delete("cookie", true); + request4.headersList.delete("host", true); } - if (request2.body != null) { - assert(request2.body.source != null); - request2.body = safelyExtractBody(request2.body.source)[0]; + if (request4.body != null) { + assert(request4.body.source != null); + request4.body = safelyExtractBody(request4.body.source)[0]; } const timingInfo = fetchParams.timingInfo; timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); if (timingInfo.redirectStartTime === 0) { timingInfo.redirectStartTime = timingInfo.startTime; } - request2.urlList.push(locationURL); - setRequestReferrerPolicyOnRedirect(request2, actualResponse); + request4.urlList.push(locationURL); + setRequestReferrerPolicyOnRedirect(request4, actualResponse); return mainFetch(fetchParams, true); } async function httpNetworkOrCacheFetch(fetchParams, isAuthenticationFetch = false, isNewConnectionFetch = false) { - const request2 = fetchParams.request; + const request4 = fetchParams.request; let httpFetchParams = null; let httpRequest = null; let response = null; const httpCache = null; const revalidatingFlag = false; - if (request2.window === "no-window" && request2.redirect === "error") { + if (request4.window === "no-window" && request4.redirect === "error") { httpFetchParams = fetchParams; - httpRequest = request2; + httpRequest = request4; } else { - httpRequest = cloneRequest(request2); + httpRequest = cloneRequest(request4); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } - const includeCredentials = request2.credentials === "include" || request2.credentials === "same-origin" && request2.responseTainting === "basic"; + const includeCredentials = request4.credentials === "include" || request4.credentials === "same-origin" && request4.responseTainting === "basic"; const contentLength = httpRequest.body ? httpRequest.body.length : null; let contentLengthHeaderValue = null; if (httpRequest.body == null && ["POST", "PUT"].includes(httpRequest.method)) { @@ -34632,7 +34632,7 @@ var require_fetch2 = __commonJS({ } response.requestIncludesCredentials = includeCredentials; if (response.status === 407) { - if (request2.window === "no-window") { + if (request4.window === "no-window") { return makeNetworkError(); } if (isCancelled(fetchParams)) { @@ -34640,7 +34640,7 @@ var require_fetch2 = __commonJS({ } return makeNetworkError("proxy authentication required"); } - if (response.status === 421 && !isNewConnectionFetch && (request2.body == null || request2.body.source != null)) { + if (response.status === 421 && !isNewConnectionFetch && (request4.body == null || request4.body.source != null)) { if (isCancelled(fetchParams)) { return makeAppropriateNetworkError(fetchParams); } @@ -34670,21 +34670,21 @@ var require_fetch2 = __commonJS({ } } }; - const request2 = fetchParams.request; + const request4 = fetchParams.request; let response = null; const timingInfo = fetchParams.timingInfo; const httpCache = null; if (httpCache == null) { - request2.cache = "no-store"; + request4.cache = "no-store"; } const newConnection = forceNewConnection ? "yes" : "no"; - if (request2.mode === "websocket") { + if (request4.mode === "websocket") { } else { } let requestBody = null; - if (request2.body == null && fetchParams.processRequestEndOfBody) { + if (request4.body == null && fetchParams.processRequestEndOfBody) { queueMicrotask(() => fetchParams.processRequestEndOfBody()); - } else if (request2.body != null) { + } else if (request4.body != null) { const processBodyChunk = async function* (bytes) { var _a; if (isCancelled(fetchParams)) { @@ -34713,7 +34713,7 @@ var require_fetch2 = __commonJS({ }; requestBody = async function* () { try { - for await (const bytes of request2.body.stream) { + for await (const bytes of request4.body.stream) { yield* processBodyChunk(bytes); } processEndOfBody(); @@ -34824,17 +34824,17 @@ var require_fetch2 = __commonJS({ } return response; function dispatch({ body }) { - const url = requestCurrentURL(request2); + const url = requestCurrentURL(request4); const agent = fetchParams.controller.dispatcher; return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, - method: request2.method, - body: agent.isMockActive ? request2.body && (request2.body.source || request2.body.stream) : body, - headers: request2.headersList.entries, + method: request4.method, + body: agent.isMockActive ? request4.body && (request4.body.source || request4.body.stream) : body, + headers: request4.headersList.entries, maxRedirections: 0, - upgrade: request2.mode === "websocket" ? "websocket" : void 0 + upgrade: request4.mode === "websocket" ? "websocket" : void 0 }, { body: null, @@ -34870,8 +34870,8 @@ var require_fetch2 = __commonJS({ location = headersList.get("location", true); this.body = new Readable({ read: resume }); const decoders = []; - const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status); - if (codings.length !== 0 && request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { + const willFollow = location && request4.redirect === "follow" && redirectStatusSet.has(status); + if (codings.length !== 0 && request4.method !== "HEAD" && request4.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { for (let i = codings.length - 1; i >= 0; --i) { const coding = codings[i]; if (coding === "x-gzip" || coding === "gzip") { @@ -35013,32 +35013,32 @@ var require_cache4 = __commonJS({ webidl.util.markAsUncloneable(this); this.#relevantRequestResponseList = arguments[1]; } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.match"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - const p = this.#internalMatchAll(request2, options, 1); + const p = this.#internalMatchAll(request4, options, 1); if (p.length === 0) { return; } return p[0]; } - async matchAll(request2 = void 0, options = {}) { + async matchAll(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.matchAll"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); - return this.#internalMatchAll(request2, options); + return this.#internalMatchAll(request4, options); } - async add(request2) { + async add(request4) { webidl.brandCheck(this, Cache); const prefix = "Cache.add"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); - const requests = [request2]; + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); + const requests = [request4]; const responseArrayPromise = this.addAll(requests); return await responseArrayPromise; } @@ -35048,19 +35048,19 @@ var require_cache4 = __commonJS({ webidl.argumentLengthCheck(arguments, 1, prefix); const responsePromises = []; const requestList = []; - for (let request2 of requests) { - if (request2 === void 0) { + for (let request4 of requests) { + if (request4 === void 0) { throw webidl.errors.conversionFailed({ prefix, argument: "Argument 1", types: ["undefined is not allowed"] }); } - request2 = webidl.converters.RequestInfo(request2); - if (typeof request2 === "string") { + request4 = webidl.converters.RequestInfo(request4); + if (typeof request4 === "string") { continue; } - const r = getRequestState(request2); + const r = getRequestState(request4); if (!urlIsHttpHttpsScheme(r.url) || r.method !== "GET") { throw webidl.errors.exception({ header: prefix, @@ -35069,8 +35069,8 @@ var require_cache4 = __commonJS({ } } const fetchControllers = []; - for (const request2 of requests) { - const r = getRequestState(new Request(request2)); + for (const request4 of requests) { + const r = getRequestState(new Request(request4)); if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: prefix, @@ -35144,17 +35144,17 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async put(request2, response) { + async put(request4, response) { webidl.brandCheck(this, Cache); const prefix = "Cache.put"; webidl.argumentLengthCheck(arguments, 2, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); response = webidl.converters.Response(response, prefix, "response"); let innerRequest = null; - if (webidl.is.Request(request2)) { - innerRequest = getRequestState(request2); + if (webidl.is.Request(request4)) { + innerRequest = getRequestState(request4); } else { - innerRequest = getRequestState(new Request(request2)); + innerRequest = getRequestState(new Request(request4)); } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -35222,21 +35222,21 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async delete(request2, options = {}) { + async delete(request4, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.delete"; webidl.argumentLengthCheck(arguments, 1, prefix); - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { - assert(typeof request2 === "string"); - r = getRequestState(new Request(request2)); + assert(typeof request4 === "string"); + r = getRequestState(new Request(request4)); } const operations = []; const operation = { @@ -35262,26 +35262,26 @@ var require_cache4 = __commonJS({ }); return cacheJobPromise.promise; } - async keys(request2 = void 0, options = {}) { + async keys(request4 = void 0, options = {}) { webidl.brandCheck(this, Cache); const prefix = "Cache.keys"; - if (request2 !== void 0) - request2 = webidl.converters.RequestInfo(request2, prefix, "request"); + if (request4 !== void 0) + request4 = webidl.converters.RequestInfo(request4, prefix, "request"); options = webidl.converters.CacheQueryOptions(options, prefix, "options"); let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const promise = createDeferredPromise(); const requests = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { requests.push(requestResponse[0]); } @@ -35293,9 +35293,9 @@ var require_cache4 = __commonJS({ } queueMicrotask(() => { const requestList = []; - for (const request3 of requests) { + for (const request5 of requests) { const requestObject = fromInnerRequest( - request3, + request5, void 0, new AbortController().signal, "immutable" @@ -35394,9 +35394,9 @@ var require_cache4 = __commonJS({ } return resultList; } - #requestMatchesCachedItem(requestQuery, request2, response = null, options) { + #requestMatchesCachedItem(requestQuery, request4, response = null, options) { const queryURL = new URL(requestQuery.url); - const cachedURL = new URL(request2.url); + const cachedURL = new URL(request4.url); if (options == null ? void 0 : options.ignoreSearch) { cachedURL.search = ""; queryURL.search = ""; @@ -35412,7 +35412,7 @@ var require_cache4 = __commonJS({ if (fieldValue === "*") { return false; } - const requestValue = request2.headersList.get(fieldValue); + const requestValue = request4.headersList.get(fieldValue); const queryValue = requestQuery.headersList.get(fieldValue); if (requestValue !== queryValue) { return false; @@ -35420,20 +35420,20 @@ var require_cache4 = __commonJS({ } return true; } - #internalMatchAll(request2, options, maxResponses = Infinity) { + #internalMatchAll(request4, options, maxResponses = Infinity) { let r = null; - if (request2 !== void 0) { - if (webidl.is.Request(request2)) { - r = getRequestState(request2); + if (request4 !== void 0) { + if (webidl.is.Request(request4)) { + r = getRequestState(request4); if (r.method !== "GET" && !options.ignoreMethod) { return []; } - } else if (typeof request2 === "string") { - r = getRequestState(new Request(request2)); + } else if (typeof request4 === "string") { + r = getRequestState(new Request(request4)); } } const responses = []; - if (request2 === void 0) { + if (request4 === void 0) { for (const requestResponse of this.#relevantRequestResponseList) { responses.push(requestResponse[1]); } @@ -35521,21 +35521,21 @@ var require_cachestorage2 = __commonJS({ } webidl.util.markAsUncloneable(this); } - async match(request2, options = {}) { + async match(request4, options = {}) { webidl.brandCheck(this, CacheStorage); webidl.argumentLengthCheck(arguments, 1, "CacheStorage.match"); - request2 = webidl.converters.RequestInfo(request2); + request4 = webidl.converters.RequestInfo(request4); options = webidl.converters.MultiCacheQueryOptions(options); if (options.cacheName != null) { if (this.#caches.has(options.cacheName)) { const cacheList = this.#caches.get(options.cacheName); const cache = new Cache(kConstruct, cacheList); - return await cache.match(request2, options); + return await cache.match(request4, options); } } else { for (const cacheList of this.#caches.values()) { const cache = new Cache(kConstruct, cacheList); - const response = await cache.match(request2, options); + const response = await cache.match(request4, options); if (response !== void 0) { return response; } @@ -36625,7 +36625,7 @@ var require_connection2 = __commonJS({ function establishWebSocketConnection(url, protocols, client, handler2, options) { const requestURL = url; requestURL.protocol = url.protocol === "ws:" ? "http:" : "https:"; - const request2 = makeRequest({ + const request4 = makeRequest({ urlList: [requestURL], client, serviceWorkers: "none", @@ -36637,18 +36637,18 @@ var require_connection2 = __commonJS({ }); if (options.headers) { const headersList = getHeadersList(new Headers(options.headers)); - request2.headersList = headersList; + request4.headersList = headersList; } const keyValue = crypto.randomBytes(16).toString("base64"); - request2.headersList.append("sec-websocket-key", keyValue, true); - request2.headersList.append("sec-websocket-version", "13", true); + request4.headersList.append("sec-websocket-key", keyValue, true); + request4.headersList.append("sec-websocket-version", "13", true); for (const protocol of protocols) { - request2.headersList.append("sec-websocket-protocol", protocol, true); + request4.headersList.append("sec-websocket-protocol", protocol, true); } const permessageDeflate = "permessage-deflate; client_max_window_bits"; - request2.headersList.append("sec-websocket-extensions", permessageDeflate, true); + request4.headersList.append("sec-websocket-extensions", permessageDeflate, true); const controller = fetching({ - request: request2, + request: request4, useParallelQueue: true, dispatcher: options.dispatcher, processResponse(response) { @@ -36689,7 +36689,7 @@ var require_connection2 = __commonJS({ } const secProtocol = response.headersList.get("Sec-WebSocket-Protocol"); if (secProtocol !== null) { - const requestProtocols = getDecodeSplit("sec-websocket-protocol", request2.headersList); + const requestProtocols = getDecodeSplit("sec-websocket-protocol", request4.headersList); if (!requestProtocols.includes(secProtocol)) { failWebsocketConnection(handler2, 1002, "Protocol was not set in the opening handshake."); return; @@ -38889,24 +38889,24 @@ var require_dist_node3 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - endpoint: () => endpoint2 + endpoint: () => endpoint4 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node2(); - var VERSION13 = "9.0.5"; - var userAgent2 = `octokit-endpoint.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; - var DEFAULTS2 = { + var import_universal_user_agent13 = require_dist_node2(); + var VERSION17 = "9.0.5"; + var userAgent4 = `octokit-endpoint.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}`; + var DEFAULTS4 = { method: "GET", baseUrl: "https://api.github.com", headers: { accept: "application/vnd.github.v3+json", - "user-agent": userAgent2 + "user-agent": userAgent4 }, mediaType: { format: "" } }; - function lowercaseKeys2(object) { + function lowercaseKeys4(object) { if (!object) { return {}; } @@ -38915,7 +38915,7 @@ var require_dist_node3 = __commonJS({ return newObj; }, {}); } - function isPlainObject3(value) { + function isPlainObject7(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -38926,21 +38926,21 @@ var require_dist_node3 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - function mergeDeep2(defaults, options) { + function mergeDeep4(defaults, options) { const result = Object.assign({}, defaults); Object.keys(options).forEach((key) => { - if (isPlainObject3(options[key])) { + if (isPlainObject7(options[key])) { if (!(key in defaults)) Object.assign(result, { [key]: options[key] }); else - result[key] = mergeDeep2(defaults[key], options[key]); + result[key] = mergeDeep4(defaults[key], options[key]); } else { Object.assign(result, { [key]: options[key] }); } }); return result; } - function removeUndefinedProperties2(obj) { + function removeUndefinedProperties4(obj) { for (const key in obj) { if (obj[key] === void 0) { delete obj[key]; @@ -38948,7 +38948,7 @@ var require_dist_node3 = __commonJS({ } return obj; } - function merge2(defaults, route, options) { + function merge4(defaults, route, options) { var _a; if (typeof route === "string") { let [method, url] = route.split(" "); @@ -38956,10 +38956,10 @@ var require_dist_node3 = __commonJS({ } else { options = Object.assign({}, route); } - options.headers = lowercaseKeys2(options.headers); - removeUndefinedProperties2(options); - removeUndefinedProperties2(options.headers); - const mergedOptions = mergeDeep2(defaults || {}, options); + options.headers = lowercaseKeys4(options.headers); + removeUndefinedProperties4(options); + removeUndefinedProperties4(options.headers); + const mergedOptions = mergeDeep4(defaults || {}, options); if (options.url === "/graphql") { if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( @@ -38970,7 +38970,7 @@ var require_dist_node3 = __commonJS({ } return mergedOptions; } - function addQueryParameters2(url, parameters) { + function addQueryParameters4(url, parameters) { const separator = /\?/.test(url) ? "&" : "?"; const names = Object.keys(parameters); if (names.length === 0) { @@ -38983,18 +38983,18 @@ var require_dist_node3 = __commonJS({ return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } - var urlVariableRegex2 = /\{[^}]+\}/g; - function removeNonChars2(variableName) { + var urlVariableRegex4 = /\{[^}]+\}/g; + function removeNonChars4(variableName) { return variableName.replace(/^\W+|\W+$/g, "").split(/,/); } - function extractUrlVariableNames2(url) { - const matches = url.match(urlVariableRegex2); + function extractUrlVariableNames4(url) { + const matches = url.match(urlVariableRegex4); if (!matches) { return []; } - return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); + return matches.map(removeNonChars4).reduce((a, b) => a.concat(b), []); } - function omit2(object, keysToOmit) { + function omit4(object, keysToOmit) { const result = { __proto__: null }; for (const key of Object.keys(object)) { if (keysToOmit.indexOf(key) === -1) { @@ -39003,7 +39003,7 @@ var require_dist_node3 = __commonJS({ } return result; } - function encodeReserved2(str) { + function encodeReserved4(str) { return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { if (!/%[0-9A-Fa-f]/.test(part)) { part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); @@ -39011,67 +39011,67 @@ var require_dist_node3 = __commonJS({ return part; }).join(""); } - function encodeUnreserved2(str) { + function encodeUnreserved4(str) { return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { return "%" + c.charCodeAt(0).toString(16).toUpperCase(); }); } - function encodeValue2(operator, value, key) { - value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + function encodeValue4(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved4(value) : encodeUnreserved4(value); if (key) { - return encodeUnreserved2(key) + "=" + value; + return encodeUnreserved4(key) + "=" + value; } else { return value; } } - function isDefined2(value) { + function isDefined4(value) { return value !== void 0 && value !== null; } - function isKeyOperator2(operator) { + function isKeyOperator4(operator) { return operator === ";" || operator === "&" || operator === "?"; } - function getValues2(context3, operator, key, modifier) { + function getValues4(context3, operator, key, modifier) { var value = context3[key], result = []; - if (isDefined2(value) && value !== "") { + if (isDefined4(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { value = value.substring(0, parseInt(modifier, 10)); } result.push( - encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value, isKeyOperator4(operator) ? key : "") ); } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { + value.filter(isDefined4).forEach(function(value2) { result.push( - encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + encodeValue4(operator, value2, isKeyOperator4(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - result.push(encodeValue2(operator, value[k], k)); + if (isDefined4(value[k])) { + result.push(encodeValue4(operator, value[k], k)); } }); } } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined2).forEach(function(value2) { - tmp.push(encodeValue2(operator, value2)); + value.filter(isDefined4).forEach(function(value2) { + tmp.push(encodeValue4(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - tmp.push(encodeUnreserved2(k)); - tmp.push(encodeValue2(operator, value[k].toString())); + if (isDefined4(value[k])) { + tmp.push(encodeUnreserved4(k)); + tmp.push(encodeValue4(operator, value[k].toString())); } }); } - if (isKeyOperator2(operator)) { - result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + if (isKeyOperator4(operator)) { + result.push(encodeUnreserved4(key) + "=" + tmp.join(",")); } else if (tmp.length !== 0) { result.push(tmp.join(",")); } @@ -39079,23 +39079,23 @@ var require_dist_node3 = __commonJS({ } } else { if (operator === ";") { - if (isDefined2(value)) { - result.push(encodeUnreserved2(key)); + if (isDefined4(value)) { + result.push(encodeUnreserved4(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { - result.push(encodeUnreserved2(key) + "="); + result.push(encodeUnreserved4(key) + "="); } else if (value === "") { result.push(""); } } return result; } - function parseUrl2(template) { + function parseUrl4(template) { return { - expand: expand2.bind(null, template) + expand: expand4.bind(null, template) }; } - function expand2(template, context3) { + function expand4(template, context3) { var operators = ["+", "#", ".", "/", ";", "?", "&"]; template = template.replace( /\{([^\{\}]+)\}|([^\{\}]+)/g, @@ -39109,7 +39109,7 @@ var require_dist_node3 = __commonJS({ } expression.split(/,/g).forEach(function(variable) { var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); - values.push(getValues2(context3, operator, tmp[1], tmp[2] || tmp[3])); + values.push(getValues4(context3, operator, tmp[1], tmp[2] || tmp[3])); }); if (operator && operator !== "+") { var separator = ","; @@ -39123,7 +39123,7 @@ var require_dist_node3 = __commonJS({ return values.join(","); } } else { - return encodeReserved2(literal); + return encodeReserved4(literal); } } ); @@ -39133,13 +39133,13 @@ var require_dist_node3 = __commonJS({ return template.replace(/\/$/, ""); } } - function parse2(options) { + function parse4(options) { var _a; let method = options.method.toUpperCase(); let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); let headers = Object.assign({}, options.headers); let body; - let parameters = omit2(options, [ + let parameters = omit4(options, [ "method", "baseUrl", "url", @@ -39147,13 +39147,13 @@ var require_dist_node3 = __commonJS({ "request", "mediaType" ]); - const urlVariableNames = extractUrlVariableNames2(url); - url = parseUrl2(url).expand(parameters); + const urlVariableNames = extractUrlVariableNames4(url); + url = parseUrl4(url).expand(parameters); if (!/^http/.test(url)) { url = options.baseUrl + url; } const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); - const remainingParameters = omit2(parameters, omittedParameters); + const remainingParameters = omit4(parameters, omittedParameters); const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); if (!isBinaryRequest) { if (options.mediaType.format) { @@ -39175,7 +39175,7 @@ var require_dist_node3 = __commonJS({ } } if (["GET", "HEAD"].includes(method)) { - url = addQueryParameters2(url, remainingParameters); + url = addQueryParameters4(url, remainingParameters); } else { if ("data" in remainingParameters) { body = remainingParameters.data; @@ -39197,20 +39197,20 @@ var require_dist_node3 = __commonJS({ options.request ? { request: options.request } : null ); } - function endpointWithDefaults2(defaults, route, options) { - return parse2(merge2(defaults, route, options)); + function endpointWithDefaults4(defaults, route, options) { + return parse4(merge4(defaults, route, options)); } - function withDefaults4(oldDefaults, newDefaults) { - const DEFAULTS22 = merge2(oldDefaults, newDefaults); - const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + function withDefaults8(oldDefaults, newDefaults) { + const DEFAULTS22 = merge4(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults4.bind(null, DEFAULTS22); return Object.assign(endpoint22, { DEFAULTS: DEFAULTS22, - defaults: withDefaults4.bind(null, DEFAULTS22), - merge: merge2.bind(null, DEFAULTS22), - parse: parse2 + defaults: withDefaults8.bind(null, DEFAULTS22), + merge: merge4.bind(null, DEFAULTS22), + parse: parse4 }); } - var endpoint2 = withDefaults4(null, DEFAULTS2); + var endpoint4 = withDefaults8(null, DEFAULTS4); } }); @@ -39337,14 +39337,14 @@ var require_dist_node5 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - RequestError: () => RequestError2 + RequestError: () => RequestError4 }); module.exports = __toCommonJS(dist_src_exports); var import_deprecation = require_dist_node4(); var import_once = __toESM2(require_once()); var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation)); var logOnceHeaders = (0, import_once.default)((deprecation) => console.warn(deprecation)); - var RequestError2 = class extends Error { + var RequestError4 = class extends Error { constructor(message, statusCode, options) { super(message); if (Error.captureStackTrace) { @@ -39419,13 +39419,13 @@ var require_dist_node6 = __commonJS({ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; __export2(dist_src_exports, { - request: () => request2 + request: () => request4 }); module.exports = __toCommonJS(dist_src_exports); - var import_endpoint2 = require_dist_node3(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "8.4.0"; - function isPlainObject3(value) { + var import_endpoint4 = require_dist_node3(); + var import_universal_user_agent13 = require_dist_node(); + var VERSION17 = "8.4.0"; + function isPlainObject7(value) { if (typeof value !== "object" || value === null) return false; if (Object.prototype.toString.call(value) !== "[object Object]") @@ -39436,15 +39436,15 @@ var require_dist_node6 = __commonJS({ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } - var import_request_error3 = require_dist_node5(); + var import_request_error6 = require_dist_node5(); function getBufferResponse(response) { return response.arrayBuffer(); } - function fetchWrapper2(requestOptions) { + function fetchWrapper4(requestOptions) { var _a, _b, _c, _d; const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console; const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false; - if (isPlainObject3(requestOptions.body) || Array.isArray(requestOptions.body)) { + if (isPlainObject7(requestOptions.body) || Array.isArray(requestOptions.body)) { requestOptions.body = JSON.stringify(requestOptions.body); } let headers = {}; @@ -39486,7 +39486,7 @@ var require_dist_node6 = __commonJS({ if (status < 400) { return; } - throw new import_request_error3.RequestError(response.statusText, status, { + throw new import_request_error6.RequestError(response.statusText, status, { response: { url, status, @@ -39497,19 +39497,19 @@ var require_dist_node6 = __commonJS({ }); } if (status === 304) { - throw new import_request_error3.RequestError("Not modified", status, { + throw new import_request_error6.RequestError("Not modified", status, { response: { url, status, headers, - data: await getResponseData2(response) + data: await getResponseData4(response) }, request: requestOptions }); } if (status >= 400) { - const data = await getResponseData2(response); - const error = new import_request_error3.RequestError(toErrorMessage2(data), status, { + const data = await getResponseData4(response); + const error = new import_request_error6.RequestError(toErrorMessage4(data), status, { response: { url, status, @@ -39520,7 +39520,7 @@ var require_dist_node6 = __commonJS({ }); throw error; } - return parseSuccessResponseBody ? await getResponseData2(response) : response.body; + return parseSuccessResponseBody ? await getResponseData4(response) : response.body; }).then((data) => { return { status, @@ -39529,7 +39529,7 @@ var require_dist_node6 = __commonJS({ data }; }).catch((error) => { - if (error instanceof import_request_error3.RequestError) + if (error instanceof import_request_error6.RequestError) throw error; else if (error.name === "AbortError") throw error; @@ -39541,12 +39541,12 @@ var require_dist_node6 = __commonJS({ message = error.cause; } } - throw new import_request_error3.RequestError(message, 500, { + throw new import_request_error6.RequestError(message, 500, { request: requestOptions }); }); } - async function getResponseData2(response) { + async function getResponseData4(response) { const contentType = response.headers.get("content-type"); if (/application\/json/.test(contentType)) { return response.json().catch(() => response.text()).catch(() => ""); @@ -39556,7 +39556,7 @@ var require_dist_node6 = __commonJS({ } return getBufferResponse(response); } - function toErrorMessage2(data) { + function toErrorMessage4(data) { if (typeof data === "string") return data; let suffix; @@ -39573,32 +39573,32 @@ var require_dist_node6 = __commonJS({ } return `Unknown error: ${JSON.stringify(data)}`; } - function withDefaults4(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + function withDefaults8(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper2(endpoint2.parse(endpointOptions)); + return fetchWrapper4(endpoint22.parse(endpointOptions)); } const request22 = (route2, parameters2) => { - return fetchWrapper2( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + return fetchWrapper4( + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; Object.assign(request22, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults4.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults8.bind(null, endpoint22) }); } - var request2 = withDefaults4(import_endpoint2.endpoint, { + var request4 = withDefaults8(import_endpoint4.endpoint, { headers: { - "user-agent": `octokit-request.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-request.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}` } }); } @@ -39633,8 +39633,8 @@ var require_dist_node7 = __commonJS({ }); module.exports = __toCommonJS(dist_src_exports); var import_request32 = require_dist_node6(); - var import_universal_user_agent9 = require_dist_node(); - var VERSION13 = "7.1.0"; + var import_universal_user_agent13 = require_dist_node(); + var VERSION17 = "7.1.0"; var import_request22 = require_dist_node6(); var import_request15 = require_dist_node6(); function _buildMessageForResponseErrors2(data) { @@ -39642,9 +39642,9 @@ var require_dist_node7 = __commonJS({ ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError2 = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors2(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.name = "GraphqlResponseError"; @@ -39666,7 +39666,7 @@ var require_dist_node7 = __commonJS({ ]; var FORBIDDEN_VARIABLE_OPTIONS2 = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX2 = /\/api\/v3\/?$/; - function graphql3(request2, query2, options) { + function graphql3(request22, query2, options) { if (options) { if (typeof query2 === "string" && "query" in options) { return Promise.reject( @@ -39697,11 +39697,11 @@ var require_dist_node7 = __commonJS({ result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX2.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX2, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -39716,25 +39716,25 @@ var require_dist_node7 = __commonJS({ return response.data.data; }); } - function withDefaults4(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); + function withDefaults8(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query2, options) => { return graphql3(newRequest, query2, options); }; return Object.assign(newApi, { - defaults: withDefaults4.bind(null, newRequest), + defaults: withDefaults8.bind(null, newRequest), endpoint: newRequest.endpoint }); } - var graphql22 = withDefaults4(import_request32.request, { + var graphql22 = withDefaults8(import_request32.request, { headers: { - "user-agent": `octokit-graphql.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}` + "user-agent": `octokit-graphql.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}` }, method: "POST", url: "/graphql" }); function withCustomRequest2(customRequest) { - return withDefaults4(customRequest, { + return withDefaults8(customRequest, { method: "POST", url: "/graphql" }); @@ -39788,13 +39788,13 @@ var require_dist_node8 = __commonJS({ } return `token ${token}`; } - async function hook6(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( + async function hook6(token, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix2(token); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix2(token); + return request4(endpoint4); } var createTokenAuth3 = function createTokenAuth22(token) { if (!token) { @@ -39839,17 +39839,17 @@ var require_dist_node9 = __commonJS({ Octokit: () => Octokit3 }); module.exports = __toCommonJS(dist_src_exports); - var import_universal_user_agent9 = require_dist_node(); + var import_universal_user_agent13 = require_dist_node(); var import_before_after_hook2 = require_before_after_hook(); var import_request15 = require_dist_node6(); var import_graphql2 = require_dist_node7(); var import_auth_token2 = require_dist_node8(); - var VERSION13 = "5.2.0"; + var VERSION17 = "5.2.0"; var noop2 = () => { }; var consoleWarn2 = console.warn.bind(console); var consoleError2 = console.error.bind(console); - var userAgentTrail2 = `octokit-core.js/${VERSION13} ${(0, import_universal_user_agent9.getUserAgent)()}`; + var userAgentTrail2 = `octokit-core.js/${VERSION17} ${(0, import_universal_user_agent13.getUserAgent)()}`; var _a; var Octokit3 = (_a = class { static defaults(defaults) { @@ -39952,7 +39952,7 @@ var require_dist_node9 = __commonJS({ } } }, (() => { - _a.VERSION = VERSION13; + _a.VERSION = VERSION17; })(), (() => { _a.plugins = []; })(), _a); @@ -39986,7 +39986,7 @@ var require_dist_node10 = __commonJS({ restEndpointMethods: () => restEndpointMethods2 }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "10.4.1"; + var VERSION17 = "10.4.1"; var Endpoints2 = { actions: { addCustomLabelsToSelfHostedRunnerForOrg: [ @@ -41978,8 +41978,8 @@ var require_dist_node10 = __commonJS({ var endpoints_default2 = Endpoints2; var endpointMethodsMap2 = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default2)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -42102,7 +42102,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - restEndpointMethods2.VERSION = VERSION13; + restEndpointMethods2.VERSION = VERSION17; function legacyRestEndpointMethods2(octokit) { const api = endpointsToMethods2(octokit); return { @@ -42110,7 +42110,7 @@ var require_dist_node10 = __commonJS({ rest: api }; } - legacyRestEndpointMethods2.VERSION = VERSION13; + legacyRestEndpointMethods2.VERSION = VERSION17; } }); @@ -42143,7 +42143,7 @@ var require_dist_node11 = __commonJS({ paginatingEndpoints: () => paginatingEndpoints }); module.exports = __toCommonJS(dist_src_exports); - var VERSION13 = "9.2.1"; + var VERSION17 = "9.2.1"; function normalizePaginatedListResponse2(response) { if (!response.data) { return { @@ -42489,7 +42489,7 @@ var require_dist_node11 = __commonJS({ }) }; } - paginateRest2.VERSION = VERSION13; + paginateRest2.VERSION = VERSION17; } }); @@ -43106,9 +43106,9 @@ function addQueryParameters(url, parameters) { return `${name}=${encodeURIComponent(parameters[name])}`; }).join("&"); } -var urlVariableRegex = /\{[^}]+\}/g; +var urlVariableRegex = /\{[^{}}]+\}/g; function removeNonChars(variableName) { - return variableName.replace(/^\W+|\W+$/g, "").split(/,/); + return variableName.replace(/(?:^\W+)|(?:(? { const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; return `application/vnd.github.${preview}-preview${format}`; @@ -43324,12 +43324,12 @@ function endpointWithDefaults(defaults, route, options) { return parse(merge(defaults, route, options)); } function withDefaults(oldDefaults, newDefaults) { - const DEFAULTS2 = merge(oldDefaults, newDefaults); - const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2); - return Object.assign(endpoint2, { - DEFAULTS: DEFAULTS2, - defaults: withDefaults.bind(null, DEFAULTS2), - merge: merge.bind(null, DEFAULTS2), + const DEFAULTS22 = merge(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults.bind(null, DEFAULTS22), + merge: merge.bind(null, DEFAULTS22), parse }); } @@ -43358,7 +43358,7 @@ var RequestError = class extends Error { if (options.request.headers.authorization) { requestCopy.headers = Object.assign({}, options.request.headers, { authorization: options.request.headers.authorization.replace( - / .*$/, + /(?]+)>; rel="deprecation"/); + const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/); const deprecationLink = matches && matches.pop(); log.warn( `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` @@ -43521,40 +43521,570 @@ function toErrorMessage(data) { return `Unknown error: ${JSON.stringify(data)}`; } function withDefaults2(oldEndpoint, newDefaults) { - const endpoint2 = oldEndpoint.defaults(newDefaults); + const endpoint22 = oldEndpoint.defaults(newDefaults); const newApi = function(route, parameters) { - const endpointOptions = endpoint2.merge(route, parameters); + const endpointOptions = endpoint22.merge(route, parameters); if (!endpointOptions.request || !endpointOptions.request.hook) { - return fetchWrapper(endpoint2.parse(endpointOptions)); + return fetchWrapper(endpoint22.parse(endpointOptions)); } - const request2 = (route2, parameters2) => { + const request22 = (route2, parameters2) => { return fetchWrapper( - endpoint2.parse(endpoint2.merge(route2, parameters2)) + endpoint22.parse(endpoint22.merge(route2, parameters2)) ); }; - Object.assign(request2, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); - return endpointOptions.request.hook(request2, endpointOptions); + return endpointOptions.request.hook(request22, endpointOptions); }; return Object.assign(newApi, { - endpoint: endpoint2, - defaults: withDefaults2.bind(null, endpoint2) + endpoint: endpoint22, + defaults: withDefaults2.bind(null, endpoint22) }); } var request = withDefaults2(endpoint, defaults_default); // var VERSION3 = "0.0.0-development"; +var userAgent2 = `octokit-endpoint.js/${VERSION3} ${getUserAgent()}`; +var DEFAULTS2 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent2 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys2(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject3(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep2(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject3(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep2(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties2(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge2(defaults, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys2(options.headers); + removeUndefinedProperties2(options); + removeUndefinedProperties2(options.headers); + const mergedOptions = mergeDeep2(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters2(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex2 = /\{[^}]+\}/g; +function removeNonChars2(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames2(url) { + const matches = url.match(urlVariableRegex2); + if (!matches) { + return []; + } + return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); +} +function omit2(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved2(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved2(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue2(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved2(value) : encodeUnreserved2(value); + if (key) { + return encodeUnreserved2(key) + "=" + value; + } else { + return value; + } +} +function isDefined2(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator2(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues2(context3, operator, key, modifier) { + var value = context3[key], result = []; + if (isDefined2(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue2(operator, value, isKeyOperator2(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + result.push( + encodeValue2(operator, value2, isKeyOperator2(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + result.push(encodeValue2(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined2).forEach(function(value2) { + tmp.push(encodeValue2(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined2(value[k])) { + tmp.push(encodeUnreserved2(k)); + tmp.push(encodeValue2(operator, value[k].toString())); + } + }); + } + if (isKeyOperator2(operator)) { + result.push(encodeUnreserved2(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined2(value)) { + result.push(encodeUnreserved2(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved2(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl2(template) { + return { + expand: expand2.bind(null, template) + }; +} +function expand2(template, context3) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues2(context3, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved2(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse2(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit2(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames2(url); + url = parseUrl2(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit2(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters2(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults2(defaults, route, options) { + return parse2(merge2(defaults, route, options)); +} +function withDefaults3(oldDefaults, newDefaults) { + const DEFAULTS22 = merge2(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults2.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults3.bind(null, DEFAULTS22), + merge: merge2.bind(null, DEFAULTS22), + parse: parse2 + }); +} +var endpoint2 = withDefaults3(null, DEFAULTS2); + +// +var import_fast_content_type_parse2 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError2 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION4 = "0.0.0-development"; +var defaults_default2 = { + headers: { + "user-agent": `octokit-request.js/${VERSION4} ${getUserAgent()}` + } +}; +function isPlainObject4(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper2(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch2 = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject4(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error) { + let message = "Unknown Error"; + if (error instanceof Error) { + if (error.name === "AbortError") { + error.status = 500; + throw error; + } + message = error.message; + if (error.name === "TypeError" && "cause" in error) { + if (error.cause instanceof Error) { + message = error.cause.message; + } else if (typeof error.cause === "string") { + message = error.cause; + } + } + } + const requestError = new RequestError2(message, 500, { + request: requestOptions + }); + requestError.cause = error; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError2(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData2(fetchResponse); + throw new RequestError2(toErrorMessage2(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData2(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData2(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse2.safeParse)(contentType); + if (isJSONResponse2(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse2(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage2(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults4(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper2(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper2( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults4.bind(null, endpoint22) + }); +} +var request2 = withDefaults4(endpoint2, defaults_default2); + +// +var VERSION5 = "0.0.0-development"; function _buildMessageForResponseErrors(data) { return `Request failed due to following response errors: ` + data.errors.map((e) => ` - ${e.message}`).join("\n"); } var GraphqlResponseError = class extends Error { - constructor(request2, headers, response) { + constructor(request22, headers, response) { super(_buildMessageForResponseErrors(response)); - this.request = request2; + this.request = request22; this.headers = headers; this.response = response; this.errors = response.errors; @@ -43579,7 +44109,7 @@ var NON_VARIABLE_OPTIONS = [ ]; var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; -function graphql(request2, query2, options) { +function graphql(request22, query2, options) { if (options) { if (typeof query2 === "string" && "query" in options) { return Promise.reject( @@ -43610,11 +44140,11 @@ function graphql(request2, query2, options) { result.variables[key] = parsedOptions[key]; return result; }, {}); - const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl; + const baseUrl = parsedOptions.baseUrl || request22.endpoint.DEFAULTS.baseUrl; if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) { requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql"); } - return request2(requestOptions).then((response) => { + return request22(requestOptions).then((response) => { if (response.data.errors) { const headers = {}; for (const key of Object.keys(response.headers)) { @@ -43629,25 +44159,25 @@ function graphql(request2, query2, options) { return response.data.data; }); } -function withDefaults3(request2, newDefaults) { - const newRequest = request2.defaults(newDefaults); +function withDefaults5(request22, newDefaults) { + const newRequest = request22.defaults(newDefaults); const newApi = (query2, options) => { return graphql(newRequest, query2, options); }; return Object.assign(newApi, { - defaults: withDefaults3.bind(null, newRequest), + defaults: withDefaults5.bind(null, newRequest), endpoint: newRequest.endpoint }); } -var graphql2 = withDefaults3(request, { +var graphql2 = withDefaults5(request2, { headers: { - "user-agent": `octokit-graphql.js/${VERSION3} ${getUserAgent()}` + "user-agent": `octokit-graphql.js/${VERSION5} ${getUserAgent()}` }, method: "POST", url: "/graphql" }); function withCustomRequest(customRequest) { - return withDefaults3(customRequest, { + return withDefaults5(customRequest, { method: "POST", url: "/graphql" }); @@ -43675,13 +44205,13 @@ function withAuthorizationPrefix(token) { } return `token ${token}`; } -async function hook(token, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge( +async function hook(token, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - endpoint2.headers.authorization = withAuthorizationPrefix(token); - return request2(endpoint2); + endpoint4.headers.authorization = withAuthorizationPrefix(token); + return request4(endpoint4); } var createTokenAuth = function createTokenAuth2(token) { if (!token) { @@ -43699,14 +44229,14 @@ var createTokenAuth = function createTokenAuth2(token) { }; // -var VERSION4 = "6.1.3"; +var VERSION6 = "6.1.4"; // var noop = () => { }; var consoleWarn = console.warn.bind(console); var consoleError = console.error.bind(console); -var userAgentTrail = `octokit-core.js/${VERSION4} ${getUserAgent()}`; +var userAgentTrail = `octokit-core.js/${VERSION6} ${getUserAgent()}`; var Octokit = class { static defaults(defaults) { const OctokitWithDefaults = class extends this { @@ -43811,20 +44341,20 @@ var Octokit = class { hook; auth; }; -__publicField(Octokit, "VERSION", VERSION4); +__publicField(Octokit, "VERSION", VERSION6); __publicField(Octokit, "plugins", []); // -var VERSION5 = "5.3.1"; +var VERSION7 = "5.3.1"; // function requestLog(octokit) { - octokit.hook.wrap("request", (request2, options) => { + octokit.hook.wrap("request", (request4, options) => { octokit.log.debug("request", options); const start = Date.now(); const requestOptions = octokit.request.endpoint.parse(options); const path = requestOptions.url.replace(options.baseUrl, ""); - return request2(options).then((response) => { + return request4(options).then((response) => { const requestId = response.headers["x-github-request-id"]; octokit.log.info( `${requestOptions.method} ${path} - ${response.status} with id ${requestId} in ${Date.now() - start}ms` @@ -43840,10 +44370,10 @@ function requestLog(octokit) { }); }); } -requestLog.VERSION = VERSION5; +requestLog.VERSION = VERSION7; // -var VERSION6 = "0.0.0-development"; +var VERSION8 = "0.0.0-development"; function normalizePaginatedListResponse(response) { if (!response.data) { return { @@ -43887,7 +44417,7 @@ function iterator(octokit, route, parameters) { const response = await requestMethod({ method, url, headers }); const normalizedResponse = normalizePaginatedListResponse(response); url = ((normalizedResponse.headers.link || "").match( - /<([^>]+)>;\s*rel="next"/ + /<([^<>]+)>;\s*rel="next"/ ) || [])[1]; return { value: normalizedResponse }; } catch (error) { @@ -43946,10 +44476,10 @@ function paginateRest(octokit) { }) }; } -paginateRest.VERSION = VERSION6; +paginateRest.VERSION = VERSION8; // -var VERSION7 = "13.3.1"; +var VERSION9 = "13.3.1"; // var Endpoints = { @@ -46022,8 +46552,8 @@ var endpoints_default = Endpoints; // var endpointMethodsMap = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default)) { - for (const [methodName, endpoint2] of Object.entries(endpoints)) { - const [route, defaults, decorations] = endpoint2; + for (const [methodName, endpoint4] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint4; const [method, url] = route.split(/ /); const endpointDefaults = Object.assign( { @@ -46148,7 +46678,7 @@ function restEndpointMethods(octokit) { rest: api }; } -restEndpointMethods.VERSION = VERSION7; +restEndpointMethods.VERSION = VERSION9; function legacyRestEndpointMethods(octokit) { const api = endpointsToMethods(octokit); return { @@ -46156,15 +46686,15 @@ function legacyRestEndpointMethods(octokit) { rest: api }; } -legacyRestEndpointMethods.VERSION = VERSION7; +legacyRestEndpointMethods.VERSION = VERSION9; // -var VERSION8 = "21.1.0"; +var VERSION10 = "21.1.1"; // var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRest).defaults( { - userAgent: `octokit-rest.js/${VERSION8}` + userAgent: `octokit-rest.js/${VERSION10}` } ); @@ -46172,25 +46702,25 @@ var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRes var import_core2 = __toESM(require_core()); // -function requestToOAuthBaseUrl(request2) { - const endpointDefaults = request2.endpoint.DEFAULTS; +function requestToOAuthBaseUrl(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); } -async function oauthRequest(request2, route, parameters) { +async function oauthRequest(request4, route, parameters) { const withOAuthParameters = { - baseUrl: requestToOAuthBaseUrl(request2), + baseUrl: requestToOAuthBaseUrl(request4), headers: { accept: "application/json" }, ...parameters }; - const response = await request2(route, withOAuthParameters); + const response = await request4(route, withOAuthParameters); if ("error" in response.data) { const error = new RequestError( `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, 400, { - request: request2.endpoint.merge( + request: request4.endpoint.merge( route, withOAuthParameters ) @@ -46201,32 +46731,43 @@ async function oauthRequest(request2, route, parameters) { } return response; } -async function exchangeWebFlowCode(options) { - const request2 = options.request || request; +async function createDeviceCode(options) { + const request4 = options.request || request; + const parameters = { + client_id: options.clientId + }; + if ("scopes" in options && Array.isArray(options.scopes)) { + parameters.scope = options.scopes.join(" "); + } + return oauthRequest(request4, "POST /login/device/code", parameters); +} +async function exchangeDeviceCode(options) { + const request4 = options.request || request; const response = await oauthRequest( - request2, + request4, "POST /login/oauth/access_token", { client_id: options.clientId, - client_secret: options.clientSecret, - code: options.code, - redirect_uri: options.redirectUrl + device_code: options.code, + grant_type: "urn:ietf:params:oauth:grant-type:device_code" } ); const authentication = { clientType: options.clientType, clientId: options.clientId, - clientSecret: options.clientSecret, token: response.data.access_token, scopes: response.data.scope.split(/\s+/).filter(Boolean) }; + if ("clientSecret" in options) { + authentication.clientSecret = options.clientSecret; + } if (options.clientType === "github-app") { if ("refresh_token" in response.data) { const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp( + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( apiTimeInMs, response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp( + ), authentication.refreshTokenExpiresAt = toTimestamp2( apiTimeInMs, response.data.refresh_token_expires_in ); @@ -46235,46 +46776,722 @@ async function exchangeWebFlowCode(options) { } return { ...response, authentication }; } -function toTimestamp(apiTimeInMs, expirationInSeconds) { +function toTimestamp2(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } -async function createDeviceCode(options) { - const request2 = options.request || request; - const parameters = { - client_id: options.clientId + +// +async function getOAuthAccessToken(state, options) { + const cachedAuthentication = getCachedAuthentication(state, options.auth); + if (cachedAuthentication) + return cachedAuthentication; + const { data: verification } = await createDeviceCode({ + clientType: state.clientType, + clientId: state.clientId, + request: options.request || state.request, + scopes: options.auth.scopes || state.scopes + }); + await state.onVerification(verification); + const authentication = await waitForAccessToken( + options.request || state.request, + state.clientId, + state.clientType, + verification + ); + state.authentication = authentication; + return authentication; +} +function getCachedAuthentication(state, auth22) { + if (auth22.refresh === true) + return false; + if (!state.authentication) + return false; + if (state.clientType === "github-app") { + return state.authentication; + } + const authentication = state.authentication; + const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( + " " + ); + const currentScope = authentication.scopes.join(" "); + return newScope === currentScope ? authentication : false; +} +async function wait(seconds) { + await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); +} +async function waitForAccessToken(request4, clientId, clientType, verification) { + try { + const options = { + clientId, + request: request4, + code: verification.device_code + }; + const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ + ...options, + clientType: "oauth-app" + }) : await exchangeDeviceCode({ + ...options, + clientType: "github-app" + }); + return { + type: "token", + tokenType: "oauth", + ...authentication + }; + } catch (error) { + if (!error.response) + throw error; + const errorType = error.response.data.error; + if (errorType === "authorization_pending") { + await wait(verification.interval); + return waitForAccessToken(request4, clientId, clientType, verification); + } + if (errorType === "slow_down") { + await wait(verification.interval + 5); + return waitForAccessToken(request4, clientId, clientType, verification); + } + throw error; + } +} +async function auth2(state, authOptions) { + return getOAuthAccessToken(state, { + auth: authOptions + }); +} +async function hook2(state, request4, route, parameters) { + let endpoint4 = request4.endpoint.merge( + route, + parameters + ); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); + } + const { token } = await getOAuthAccessToken(state, { + request: request4, + auth: { type: "oauth" } + }); + endpoint4.headers.authorization = `token ${token}`; + return request4(endpoint4); +} +var VERSION11 = "0.0.0-development"; +function createOAuthDeviceAuth(options) { + const requestWithDefaults = options.request || request.defaults({ + headers: { + "user-agent": `octokit-auth-oauth-device.js/${VERSION11} ${getUserAgent()}` + } + }); + const { request: request4 = requestWithDefaults, ...otherOptions } = options; + const state = options.clientType === "github-app" ? { + ...otherOptions, + clientType: "github-app", + request: request4 + } : { + ...otherOptions, + clientType: "oauth-app", + request: request4, + scopes: options.scopes || [] }; - if ("scopes" in options && Array.isArray(options.scopes)) { - parameters.scope = options.scopes.join(" "); + if (!options.clientId) { + throw new Error( + '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' + ); + } + if (!options.onVerification) { + throw new Error( + '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' + ); } - return oauthRequest(request2, "POST /login/device/code", parameters); + return Object.assign(auth2.bind(null, state), { + hook: hook2.bind(null, state) + }); } -async function exchangeDeviceCode(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + +// +var VERSION12 = "0.0.0-development"; +var userAgent3 = `octokit-endpoint.js/${VERSION12} ${getUserAgent()}`; +var DEFAULTS3 = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent3 + }, + mediaType: { + format: "" + } +}; +function lowercaseKeys3(object) { + if (!object) { + return {}; + } + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} +function isPlainObject5(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +function mergeDeep3(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach((key) => { + if (isPlainObject5(options[key])) { + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep3(defaults[key], options[key]); + } else { + Object.assign(result, { [key]: options[key] }); + } + }); + return result; +} +function removeUndefinedProperties3(obj) { + for (const key in obj) { + if (obj[key] === void 0) { + delete obj[key]; + } + } + return obj; +} +function merge3(defaults, route, options) { + var _a; + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { method, url } : { url: method }, options); + } else { + options = Object.assign({}, route); + } + options.headers = lowercaseKeys3(options.headers); + removeUndefinedProperties3(options); + removeUndefinedProperties3(options.headers); + const mergedOptions = mergeDeep3(defaults || {}, options); + if (options.url === "/graphql") { + if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter( + (preview) => !mergedOptions.mediaType.previews.includes(preview) + ).concat(mergedOptions.mediaType.previews); + } + mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, "")); + } + return mergedOptions; +} +function addQueryParameters3(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + if (names.length === 0) { + return url; + } + return url + separator + names.map((name) => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} +var urlVariableRegex3 = /\{[^}]+\}/g; +function removeNonChars3(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} +function extractUrlVariableNames3(url) { + const matches = url.match(urlVariableRegex3); + if (!matches) { + return []; + } + return matches.map(removeNonChars3).reduce((a, b) => a.concat(b), []); +} +function omit3(object, keysToOmit) { + const result = { __proto__: null }; + for (const key of Object.keys(object)) { + if (keysToOmit.indexOf(key) === -1) { + result[key] = object[key]; + } + } + return result; +} +function encodeReserved3(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + return part; + }).join(""); +} +function encodeUnreserved3(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} +function encodeValue3(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved3(value) : encodeUnreserved3(value); + if (key) { + return encodeUnreserved3(key) + "=" + value; + } else { + return value; + } +} +function isDefined3(value) { + return value !== void 0 && value !== null; +} +function isKeyOperator3(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} +function getValues3(context3, operator, key, modifier) { + var value = context3[key], result = []; + if (isDefined3(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + result.push( + encodeValue3(operator, value, isKeyOperator3(operator) ? key : "") + ); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + result.push( + encodeValue3(operator, value2, isKeyOperator3(operator) ? key : "") + ); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + result.push(encodeValue3(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + if (Array.isArray(value)) { + value.filter(isDefined3).forEach(function(value2) { + tmp.push(encodeValue3(operator, value2)); + }); + } else { + Object.keys(value).forEach(function(k) { + if (isDefined3(value[k])) { + tmp.push(encodeUnreserved3(k)); + tmp.push(encodeValue3(operator, value[k].toString())); + } + }); + } + if (isKeyOperator3(operator)) { + result.push(encodeUnreserved3(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined3(value)) { + result.push(encodeUnreserved3(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved3(key) + "="); + } else if (value === "") { + result.push(""); + } + } + return result; +} +function parseUrl3(template) { + return { + expand: expand3.bind(null, template) + }; +} +function expand3(template, context3) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + template = template.replace( + /\{([^\{\}]+)\}|([^\{\}]+)/g, + function(_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + expression.split(/,/g).forEach(function(variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues3(context3, operator, tmp[1], tmp[2] || tmp[3])); + }); + if (operator && operator !== "+") { + var separator = ","; + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved3(literal); + } + } + ); + if (template === "/") { + return template; + } else { + return template.replace(/\/$/, ""); + } +} +function parse3(options) { + var _a; + let method = options.method.toUpperCase(); + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit3(options, [ + "method", + "baseUrl", + "url", + "headers", + "request", + "mediaType" + ]); + const urlVariableNames = extractUrlVariableNames3(url); + url = parseUrl3(url).expand(parameters); + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit3(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + if (!isBinaryRequest) { + if (options.mediaType.format) { + headers.accept = headers.accept.split(/,/).map( + (format) => format.replace( + /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, + `application/vnd$1$2.${options.mediaType.format}` + ) + ).join(","); + } + if (url.endsWith("/graphql")) { + if ((_a = options.mediaType.previews) == null ? void 0 : _a.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } + } + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters3(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } + } + } + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } + return Object.assign( + { method, url, headers }, + typeof body !== "undefined" ? { body } : null, + options.request ? { request: options.request } : null + ); +} +function endpointWithDefaults3(defaults, route, options) { + return parse3(merge3(defaults, route, options)); +} +function withDefaults6(oldDefaults, newDefaults) { + const DEFAULTS22 = merge3(oldDefaults, newDefaults); + const endpoint22 = endpointWithDefaults3.bind(null, DEFAULTS22); + return Object.assign(endpoint22, { + DEFAULTS: DEFAULTS22, + defaults: withDefaults6.bind(null, DEFAULTS22), + merge: merge3.bind(null, DEFAULTS22), + parse: parse3 + }); +} +var endpoint3 = withDefaults6(null, DEFAULTS3); + +// +var import_fast_content_type_parse3 = __toESM(require_fast_content_type_parse(), 1); + +// +var RequestError3 = class extends Error { + name; + status; + request; + response; + constructor(message, statusCode, options) { + super(message); + this.name = "HttpError"; + this.status = Number.parseInt(statusCode); + if (Number.isNaN(this.status)) { + this.status = 0; + } + if ("response" in options) { + this.response = options.response; + } + const requestCopy = Object.assign({}, options.request); + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace( + / .*$/, + " [REDACTED]" + ) + }); + } + requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; + } +}; + +// +var VERSION13 = "0.0.0-development"; +var defaults_default3 = { + headers: { + "user-agent": `octokit-request.js/${VERSION13} ${getUserAgent()}` + } +}; +function isPlainObject6(value) { + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; + const proto = Object.getPrototypeOf(value); + if (proto === null) + return true; + const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); +} +async function fetchWrapper3(requestOptions) { + var _a, _b, _c, _d, _e; + const fetch2 = ((_a = requestOptions.request) == null ? void 0 : _a.fetch) || globalThis.fetch; + if (!fetch2) { + throw new Error( + "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 log = ((_b = requestOptions.request) == null ? void 0 : _b.log) || console; + const parseSuccessResponseBody = ((_c = requestOptions.request) == null ? void 0 : _c.parseSuccessResponseBody) !== false; + const body = isPlainObject6(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body; + const requestHeaders = Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value) + ]) + ); + let fetchResponse; + try { + fetchResponse = await fetch2(requestOptions.url, { + method: requestOptions.method, + body, + redirect: (_d = requestOptions.request) == null ? void 0 : _d.redirect, + headers: requestHeaders, + signal: (_e = requestOptions.request) == null ? void 0 : _e.signal, + ...requestOptions.body && { duplex: "half" } + }); + } catch (error) { + let message = "Unknown Error"; + if (error instanceof Error) { + if (error.name === "AbortError") { + error.status = 500; + throw error; + } + message = error.message; + if (error.name === "TypeError" && "cause" in error) { + if (error.cause instanceof Error) { + message = error.cause.message; + } else if (typeof error.cause === "string") { + message = error.cause; + } + } + } + const requestError = new RequestError3(message, 500, { + request: requestOptions + }); + requestError.cause = error; + throw requestError; + } + const status = fetchResponse.status; + const url = fetchResponse.url; + const responseHeaders = {}; + for (const [key, value] of fetchResponse.headers) { + responseHeaders[key] = value; + } + const octokitResponse = { + url, + status, + headers: responseHeaders, + data: "" + }; + if ("deprecation" in responseHeaders) { + const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn( + `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` + ); + } + if (status === 204 || status === 205) { + return octokitResponse; + } + if (requestOptions.method === "HEAD") { + if (status < 400) { + return octokitResponse; + } + throw new RequestError3(fetchResponse.statusText, status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status === 304) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3("Not modified", status, { + response: octokitResponse, + request: requestOptions + }); + } + if (status >= 400) { + octokitResponse.data = await getResponseData3(fetchResponse); + throw new RequestError3(toErrorMessage3(octokitResponse.data), status, { + response: octokitResponse, + request: requestOptions + }); + } + octokitResponse.data = parseSuccessResponseBody ? await getResponseData3(fetchResponse) : fetchResponse.body; + return octokitResponse; +} +async function getResponseData3(response) { + var _a; + const contentType = response.headers.get("content-type"); + if (!contentType) { + return response.text().catch(() => ""); + } + const mimetype = (0, import_fast_content_type_parse3.safeParse)(contentType); + if (isJSONResponse3(mimetype)) { + let text = ""; + try { + text = await response.text(); + return JSON.parse(text); + } catch (err) { + return text; + } + } else if (mimetype.type.startsWith("text/") || ((_a = mimetype.parameters.charset) == null ? void 0 : _a.toLowerCase()) === "utf-8") { + return response.text().catch(() => ""); + } else { + return response.arrayBuffer().catch(() => new ArrayBuffer(0)); + } +} +function isJSONResponse3(mimetype) { + return mimetype.type === "application/json" || mimetype.type === "application/scim+json"; +} +function toErrorMessage3(data) { + if (typeof data === "string") { + return data; + } + if (data instanceof ArrayBuffer) { + return "Unknown error"; + } + if ("message" in data) { + const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + } + return `Unknown error: ${JSON.stringify(data)}`; +} +function withDefaults7(oldEndpoint, newDefaults) { + const endpoint22 = oldEndpoint.defaults(newDefaults); + const newApi = function(route, parameters) { + const endpointOptions = endpoint22.merge(route, parameters); + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper3(endpoint22.parse(endpointOptions)); + } + const request22 = (route2, parameters2) => { + return fetchWrapper3( + endpoint22.parse(endpoint22.merge(route2, parameters2)) + ); + }; + Object.assign(request22, { + endpoint: endpoint22, + defaults: withDefaults7.bind(null, endpoint22) + }); + return endpointOptions.request.hook(request22, endpointOptions); + }; + return Object.assign(newApi, { + endpoint: endpoint22, + defaults: withDefaults7.bind(null, endpoint22) + }); +} +var request3 = withDefaults7(endpoint3, defaults_default3); + +// +function requestToOAuthBaseUrl2(request4) { + const endpointDefaults = request4.endpoint.DEFAULTS; + return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", ""); +} +async function oauthRequest2(request4, route, parameters) { + const withOAuthParameters = { + baseUrl: requestToOAuthBaseUrl2(request4), + headers: { + accept: "application/json" + }, + ...parameters + }; + const response = await request4(route, withOAuthParameters); + if ("error" in response.data) { + const error = new RequestError3( + `${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`, + 400, + { + request: request4.endpoint.merge( + route, + withOAuthParameters + ) + } + ); + error.response = response; + throw error; + } + return response; +} +async function exchangeWebFlowCode(options) { + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, - device_code: options.code, - grant_type: "urn:ietf:params:oauth:grant-type:device_code" + client_secret: options.clientSecret, + code: options.code, + redirect_uri: options.redirectUrl } ); const authentication = { clientType: options.clientType, clientId: options.clientId, + clientSecret: options.clientSecret, token: response.data.access_token, scopes: response.data.scope.split(/\s+/).filter(Boolean) }; - if ("clientSecret" in options) { - authentication.clientSecret = options.clientSecret; - } if (options.clientType === "github-app") { if ("refresh_token" in response.data) { const apiTimeInMs = new Date(response.headers.date).getTime(); - authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2( + authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp( apiTimeInMs, response.data.expires_in - ), authentication.refreshTokenExpiresAt = toTimestamp2( + ), authentication.refreshTokenExpiresAt = toTimestamp( apiTimeInMs, response.data.refresh_token_expires_in ); @@ -46283,12 +47500,12 @@ async function exchangeDeviceCode(options) { } return { ...response, authentication }; } -function toTimestamp2(apiTimeInMs, expirationInSeconds) { +function toTimestamp(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function checkToken(options) { - const request2 = options.request || request; - const response = await request2("POST /applications/{client_id}/token", { + const request4 = options.request || request3; + const response = await request4("POST /applications/{client_id}/token", { headers: { authorization: `basic ${btoa( `${options.clientId}:${options.clientSecret}` @@ -46312,9 +47529,9 @@ async function checkToken(options) { return { ...response, authentication }; } async function refreshToken(options) { - const request2 = options.request || request; - const response = await oauthRequest( - request2, + const request4 = options.request || request3; + const response = await oauthRequest2( + request4, "POST /login/oauth/access_token", { client_id: options.clientId, @@ -46342,9 +47559,9 @@ function toTimestamp3(apiTimeInMs, expirationInSeconds) { return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString(); } async function resetToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - const response = await request2( + const response = await request4( "PATCH /applications/{client_id}/token", { headers: { @@ -46369,9 +47586,9 @@ async function resetToken(options) { return { ...response, authentication }; } async function deleteToken(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/token", { headers: { @@ -46383,9 +47600,9 @@ async function deleteToken(options) { ); } async function deleteAuthorization(options) { - const request2 = options.request || request; + const request4 = options.request || request3; const auth6 = btoa(`${options.clientId}:${options.clientSecret}`); - return request2( + return request4( "DELETE /applications/{client_id}/grant", { headers: { @@ -46398,133 +47615,7 @@ async function deleteAuthorization(options) { } // -async function getOAuthAccessToken(state, options) { - const cachedAuthentication = getCachedAuthentication(state, options.auth); - if (cachedAuthentication) - return cachedAuthentication; - const { data: verification } = await createDeviceCode({ - clientType: state.clientType, - clientId: state.clientId, - request: options.request || state.request, - scopes: options.auth.scopes || state.scopes - }); - await state.onVerification(verification); - const authentication = await waitForAccessToken( - options.request || state.request, - state.clientId, - state.clientType, - verification - ); - state.authentication = authentication; - return authentication; -} -function getCachedAuthentication(state, auth22) { - if (auth22.refresh === true) - return false; - if (!state.authentication) - return false; - if (state.clientType === "github-app") { - return state.authentication; - } - const authentication = state.authentication; - const newScope = ("scopes" in auth22 && auth22.scopes || state.scopes).join( - " " - ); - const currentScope = authentication.scopes.join(" "); - return newScope === currentScope ? authentication : false; -} -async function wait(seconds) { - await new Promise((resolve) => setTimeout(resolve, seconds * 1e3)); -} -async function waitForAccessToken(request2, clientId, clientType, verification) { - try { - const options = { - clientId, - request: request2, - code: verification.device_code - }; - const { authentication } = clientType === "oauth-app" ? await exchangeDeviceCode({ - ...options, - clientType: "oauth-app" - }) : await exchangeDeviceCode({ - ...options, - clientType: "github-app" - }); - return { - type: "token", - tokenType: "oauth", - ...authentication - }; - } catch (error) { - if (!error.response) - throw error; - const errorType = error.response.data.error; - if (errorType === "authorization_pending") { - await wait(verification.interval); - return waitForAccessToken(request2, clientId, clientType, verification); - } - if (errorType === "slow_down") { - await wait(verification.interval + 5); - return waitForAccessToken(request2, clientId, clientType, verification); - } - throw error; - } -} -async function auth2(state, authOptions) { - return getOAuthAccessToken(state, { - auth: authOptions - }); -} -async function hook2(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( - route, - parameters - ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); - } - const { token } = await getOAuthAccessToken(state, { - request: request2, - auth: { type: "oauth" } - }); - endpoint2.headers.authorization = `token ${token}`; - return request2(endpoint2); -} -var VERSION9 = "0.0.0-development"; -function createOAuthDeviceAuth(options) { - const requestWithDefaults = options.request || request.defaults({ - headers: { - "user-agent": `octokit-auth-oauth-device.js/${VERSION9} ${getUserAgent()}` - } - }); - const { request: request2 = requestWithDefaults, ...otherOptions } = options; - const state = options.clientType === "github-app" ? { - ...otherOptions, - clientType: "github-app", - request: request2 - } : { - ...otherOptions, - clientType: "oauth-app", - request: request2, - scopes: options.scopes || [] - }; - if (!options.clientId) { - throw new Error( - '[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - if (!options.onVerification) { - throw new Error( - '[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)' - ); - } - return Object.assign(auth2.bind(null, state), { - hook: hook2.bind(null, state) - }); -} - -// -var VERSION10 = "0.0.0-development"; +var VERSION14 = "0.0.0-development"; async function getAuthentication(state) { if ("code" in state.strategyOptions) { const { authentication } = await exchangeWebFlowCode({ @@ -46660,30 +47751,30 @@ var ROUTES_REQUIRING_BASIC_AUTH = /\/applications\/[^/]+\/(token|grant)s?/; function requiresBasicAuth(url) { return url && ROUTES_REQUIRING_BASIC_AUTH.test(url); } -async function hook3(state, request2, route, parameters = {}) { - const endpoint2 = request2.endpoint.merge( +async function hook3(state, request4, route, parameters = {}) { + const endpoint4 = request4.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request4(endpoint4); } - if (requiresBasicAuth(endpoint2.url)) { + if (requiresBasicAuth(endpoint4.url)) { const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; - return request2(endpoint2); + endpoint4.headers.authorization = `basic ${credentials}`; + return request4(endpoint4); } - const { token } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request2 }) : await auth3({ ...state, request: request2 }); - endpoint2.headers.authorization = "token " + token; - return request2(endpoint2); + const { token } = state.clientType === "oauth-app" ? await auth3({ ...state, request: request4 }) : await auth3({ ...state, request: request4 }); + endpoint4.headers.authorization = "token " + token; + return request4(endpoint4); } function createOAuthUserAuth({ clientId, clientSecret, clientType = "oauth-app", - request: request2 = request.defaults({ + request: request4 = request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION10} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION14} ${getUserAgent()}` } }), onTokenCreated, @@ -46695,13 +47786,13 @@ function createOAuthUserAuth({ clientSecret, onTokenCreated, strategyOptions, - request: request2 + request: request4 }); return Object.assign(auth3.bind(null, state), { hook: hook3.bind(null, state) }); } -createOAuthUserAuth.VERSION = VERSION10; +createOAuthUserAuth.VERSION = VERSION14; // async function auth4(state, authOptions) { @@ -46740,37 +47831,37 @@ async function auth4(state, authOptions) { }); return userAuth(); } -async function hook4(state, request2, route, parameters) { - let endpoint2 = request2.endpoint.merge( +async function hook4(state, request22, route, parameters) { + let endpoint4 = request22.endpoint.merge( route, parameters ); - if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint2.url)) { - return request2(endpoint2); + if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint4.url)) { + return request22(endpoint4); } - if (state.clientType === "github-app" && !requiresBasicAuth(endpoint2.url)) { + if (state.clientType === "github-app" && !requiresBasicAuth(endpoint4.url)) { throw new Error( - `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint2.method} ${endpoint2.url}" is not supported.` + `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint4.method} ${endpoint4.url}" is not supported.` ); } const credentials = btoa(`${state.clientId}:${state.clientSecret}`); - endpoint2.headers.authorization = `basic ${credentials}`; + endpoint4.headers.authorization = `basic ${credentials}`; try { - return await request2(endpoint2); + return await request22(endpoint4); } catch (error) { if (error.status !== 401) throw error; - error.message = `[@octokit/auth-oauth-app] "${endpoint2.method} ${endpoint2.url}" does not support clientId/clientSecret basic authentication.`; + error.message = `[@octokit/auth-oauth-app] "${endpoint4.method} ${endpoint4.url}" does not support clientId/clientSecret basic authentication.`; throw error; } } -var VERSION11 = "0.0.0-development"; +var VERSION15 = "0.0.0-development"; function createOAuthAppAuth(options) { const state = Object.assign( { request: request.defaults({ headers: { - "user-agent": `octokit-auth-oauth-app.js/${VERSION11} ${getUserAgent()}` + "user-agent": `octokit-auth-oauth-app.js/${VERSION15} ${getUserAgent()}` } }), clientType: "oauth-app" @@ -47214,7 +48305,7 @@ async function getInstallationAuthentication(state, options, customRequest) { } } const appAuthentication = await getAppAuthentication(state); - const request2 = customRequest || state.request; + const request4 = customRequest || state.request; const payload = { installation_id: installationId, mediaType: { @@ -47244,7 +48335,7 @@ async function getInstallationAuthentication(state, options, customRequest) { repository_selection: repositorySelectionOptional, single_file: singleFileName } - } = await request2( + } = await request4( "POST /app/installations/{installation_id}/access_tokens", payload ); @@ -47341,18 +48432,18 @@ function isNotTimeSkewError(error) { /'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/ )); } -async function hook5(state, request2, route, parameters) { - const endpoint2 = request2.endpoint.merge(route, parameters); - const url = endpoint2.url; +async function hook5(state, request4, route, parameters) { + const endpoint4 = request4.endpoint.merge(route, parameters); + const url = endpoint4.url; if (/\/login\/oauth\/access_token$/.test(url)) { - return request2(endpoint2); + return request4(endpoint4); } - if (requiresAppAuth(url.replace(request2.endpoint.DEFAULTS.baseUrl, ""))) { + if (requiresAppAuth(url.replace(request4.endpoint.DEFAULTS.baseUrl, ""))) { const { token: token2 } = await getAppAuthentication(state); - endpoint2.headers.authorization = `bearer ${token2}`; + endpoint4.headers.authorization = `bearer ${token2}`; let response; try { - response = await request2(endpoint2); + response = await request4(endpoint4); } catch (error) { if (isNotTimeSkewError(error)) { throw error; @@ -47371,33 +48462,33 @@ async function hook5(state, request2, route, parameters) { ...state, timeDifference: diff }); - endpoint2.headers.authorization = `bearer ${token3}`; - return request2(endpoint2); + endpoint4.headers.authorization = `bearer ${token3}`; + return request4(endpoint4); } return response; } if (requiresBasicAuth(url)) { const authentication = await state.oauthApp({ type: "oauth-app" }); - endpoint2.headers.authorization = authentication.headers.authorization; - return request2(endpoint2); + endpoint4.headers.authorization = authentication.headers.authorization; + return request4(endpoint4); } const { token, createdAt } = await getInstallationAuthentication( state, {}, - request2.defaults({ baseUrl: endpoint2.baseUrl }) + request4.defaults({ baseUrl: endpoint4.baseUrl }) ); - endpoint2.headers.authorization = `token ${token}`; + endpoint4.headers.authorization = `token ${token}`; return sendRequestWithRetries( state, - request2, - endpoint2, + request4, + endpoint4, createdAt ); } -async function sendRequestWithRetries(state, request2, options, createdAt, retries = 0) { +async function sendRequestWithRetries(state, request4, options, createdAt, retries = 0) { const timeSinceTokenCreationInMs = +/* @__PURE__ */ new Date() - +new Date(createdAt); try { - return await request2(options); + return await request4(options); } catch (error) { if (error.status !== 401) { throw error; @@ -47414,10 +48505,10 @@ async function sendRequestWithRetries(state, request2, options, createdAt, retri `[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${retries}, wait: ${awaitTime / 1e3}s)` ); await new Promise((resolve) => setTimeout(resolve, awaitTime)); - return sendRequestWithRetries(state, request2, options, createdAt, retries); + return sendRequestWithRetries(state, request4, options, createdAt, retries); } } -var VERSION12 = "7.1.4"; +var VERSION16 = "7.1.5"; function createAppAuth(options) { if (!options.appId) { throw new Error("[@octokit/auth-app] appId option is required"); @@ -47436,14 +48527,14 @@ function createAppAuth(options) { }, options.log ); - const request2 = options.request || request.defaults({ + const request4 = options.request || request.defaults({ headers: { - "user-agent": `octokit-auth-app.js/${VERSION12} ${getUserAgent()}` + "user-agent": `octokit-auth-app.js/${VERSION16} ${getUserAgent()}` } }); const state = Object.assign( { - request: request2, + request: request4, cache: getCache() }, options, @@ -47454,7 +48545,7 @@ function createAppAuth(options) { clientType: "github-app", clientId: options.clientId || "", clientSecret: options.clientSecret || "", - request: request2 + request: request4 }) } ); diff --git a/ng-dev/package.json b/ng-dev/package.json index bfbe22eae..ca6465586 100644 --- a/ng-dev/package.json +++ b/ng-dev/package.json @@ -16,7 +16,7 @@ }, "dependencies": { "@google-cloud/spanner": "7.18.1", - "@octokit/rest": "21.1.0", + "@octokit/rest": "21.1.1", "@types/semver": "^7.3.6", "@types/supports-color": "^10.0.0", "@yarnpkg/lockfile": "^1.1.0", diff --git a/package.json b/package.json index e97a9dfd7..c23a18553 100644 --- a/package.json +++ b/package.json @@ -75,15 +75,15 @@ "@google-cloud/storage": "^7.0.0", "@inquirer/prompts": "^7.0.0", "@inquirer/type": "^3.0.0", - "@octokit/auth-app": "7.1.4", - "@octokit/core": "6.1.3", - "@octokit/graphql": "8.2.0", + "@octokit/auth-app": "7.1.5", + "@octokit/core": "6.1.4", + "@octokit/graphql": "8.2.1", "@octokit/graphql-schema": "patch:@octokit/graphql-schema@npm%3A15.3.0#~/.yarn/patches/@octokit-graphql-schema-npm-15.3.0-4046a59648.patch", - "@octokit/openapi-types": "23.0.1", - "@octokit/plugin-paginate-rest": "11.4.0", + "@octokit/openapi-types": "24.0.0", + "@octokit/plugin-paginate-rest": "11.4.2", "@octokit/plugin-rest-endpoint-methods": "13.3.1", - "@octokit/request-error": "6.1.6", - "@octokit/rest": "21.1.0", + "@octokit/request-error": "6.1.7", + "@octokit/rest": "21.1.1", "@octokit/types": "13.8.0", "@octokit/webhooks-definitions": "3.67.3", "@octokit/webhooks-types": "7.6.1", diff --git a/yarn.lock b/yarn.lock index 1963c0f4e..6bafb5f89 100644 --- a/yarn.lock +++ b/yarn.lock @@ -258,15 +258,15 @@ __metadata: "@inquirer/prompts": "npm:^7.0.0" "@inquirer/type": "npm:^3.0.0" "@microsoft/api-extractor": "npm:7.50.0" - "@octokit/auth-app": "npm:7.1.4" - "@octokit/core": "npm:6.1.3" - "@octokit/graphql": "npm:8.2.0" + "@octokit/auth-app": "npm:7.1.5" + "@octokit/core": "npm:6.1.4" + "@octokit/graphql": "npm:8.2.1" "@octokit/graphql-schema": "patch:@octokit/graphql-schema@npm%3A15.3.0#~/.yarn/patches/@octokit-graphql-schema-npm-15.3.0-4046a59648.patch" - "@octokit/openapi-types": "npm:23.0.1" - "@octokit/plugin-paginate-rest": "npm:11.4.0" + "@octokit/openapi-types": "npm:24.0.0" + "@octokit/plugin-paginate-rest": "npm:11.4.2" "@octokit/plugin-rest-endpoint-methods": "npm:13.3.1" - "@octokit/request-error": "npm:6.1.6" - "@octokit/rest": "npm:21.1.0" + "@octokit/request-error": "npm:6.1.7" + "@octokit/rest": "npm:21.1.1" "@octokit/types": "npm:13.8.0" "@octokit/webhooks-definitions": "npm:3.67.3" "@octokit/webhooks-types": "npm:7.6.1" @@ -3292,57 +3292,57 @@ __metadata: languageName: node linkType: hard -"@octokit/auth-app@npm:7.1.4": - version: 7.1.4 - resolution: "@octokit/auth-app@npm:7.1.4" +"@octokit/auth-app@npm:7.1.5": + version: 7.1.5 + resolution: "@octokit/auth-app@npm:7.1.5" dependencies: - "@octokit/auth-oauth-app": "npm:^8.1.2" - "@octokit/auth-oauth-user": "npm:^5.1.2" - "@octokit/request": "npm:^9.1.4" - "@octokit/request-error": "npm:^6.1.6" - "@octokit/types": "npm:^13.6.2" + "@octokit/auth-oauth-app": "npm:^8.1.3" + "@octokit/auth-oauth-user": "npm:^5.1.3" + "@octokit/request": "npm:^9.2.1" + "@octokit/request-error": "npm:^6.1.7" + "@octokit/types": "npm:^13.8.0" toad-cache: "npm:^3.7.0" universal-github-app-jwt: "npm:^2.2.0" universal-user-agent: "npm:^7.0.0" - checksum: 10c0/6e1c77db754a0c1cdd047b44841ce3eef87c1d96bb5e80fc1978992159d4ddd9e34744ecb39b26b65ca8527421ac092e8a5bfa3fce25dc49bfc052aede522d2d + checksum: 10c0/d90ae740b85dbae8f5af457bfda333815977672a214b11d115907df5ff6a74c48e57ba4db0db8808d2a77065f311c9c09f915b4f7f4a4a2dc024b9fd9c46732e languageName: node linkType: hard -"@octokit/auth-oauth-app@npm:^8.1.2": - version: 8.1.2 - resolution: "@octokit/auth-oauth-app@npm:8.1.2" +"@octokit/auth-oauth-app@npm:^8.1.3": + version: 8.1.3 + resolution: "@octokit/auth-oauth-app@npm:8.1.3" dependencies: - "@octokit/auth-oauth-device": "npm:^7.1.2" - "@octokit/auth-oauth-user": "npm:^5.1.2" - "@octokit/request": "npm:^9.1.4" + "@octokit/auth-oauth-device": "npm:^7.1.3" + "@octokit/auth-oauth-user": "npm:^5.1.3" + "@octokit/request": "npm:^9.2.1" "@octokit/types": "npm:^13.6.2" universal-user-agent: "npm:^7.0.0" - checksum: 10c0/96e398dedfbbc81227b495c6e9592a75e9bb7af5cfe0fdbc88c59b6807506ea2b6c4abebd2c6096585af7d8c46cc98583fd9f4f8b301f41d2bf92c4a566244fb + checksum: 10c0/23aa311a8a181a551c4cc2de953801a50cb5abc211bab01c95d198ebb0afebbdbb5c0cfa8756f5e1a149af0b3c5fcd11e75e9ace297051ecb7b5cb3d9c414e57 languageName: node linkType: hard -"@octokit/auth-oauth-device@npm:^7.1.2": - version: 7.1.2 - resolution: "@octokit/auth-oauth-device@npm:7.1.2" +"@octokit/auth-oauth-device@npm:^7.1.3": + version: 7.1.3 + resolution: "@octokit/auth-oauth-device@npm:7.1.3" dependencies: - "@octokit/oauth-methods": "npm:^5.1.3" - "@octokit/request": "npm:^9.1.4" + "@octokit/oauth-methods": "npm:^5.1.4" + "@octokit/request": "npm:^9.2.1" "@octokit/types": "npm:^13.6.2" universal-user-agent: "npm:^7.0.0" - checksum: 10c0/9c6a522397465bbabc2660ae9621ac07bbc6623796e537689291a22339fb55c7114a378f0abbad2d9f3b91dc531362a92ab3fe68d0815588a4b11d626b0c59f6 + checksum: 10c0/23373396fb93b55ccccc9b3a1b0ed2cf5ef9da7d2244a1450bea674c00060cdc6614185e387ff8c9d2958c9b20aa0ec1d4f61b7f50caebbd39e638c0fe603f3d languageName: node linkType: hard -"@octokit/auth-oauth-user@npm:^5.1.2": - version: 5.1.2 - resolution: "@octokit/auth-oauth-user@npm:5.1.2" +"@octokit/auth-oauth-user@npm:^5.1.3": + version: 5.1.3 + resolution: "@octokit/auth-oauth-user@npm:5.1.3" dependencies: - "@octokit/auth-oauth-device": "npm:^7.1.2" - "@octokit/oauth-methods": "npm:^5.1.2" - "@octokit/request": "npm:^9.1.4" + "@octokit/auth-oauth-device": "npm:^7.1.3" + "@octokit/oauth-methods": "npm:^5.1.3" + "@octokit/request": "npm:^9.2.1" "@octokit/types": "npm:^13.6.2" universal-user-agent: "npm:^7.0.0" - checksum: 10c0/40e2652377f273da192672022a7e1cbdc8024275a8daf1347566e6697bee0d99017d50ce7a97237679386bd27248cbf8eb758f597f94e6e3d677970b57da276b + checksum: 10c0/01809c89a74b4e3db594d362b47d7d3495cb6dd6ee8e730b6c8a751e552c3b5cc7c67508dd4869171e3bbce306db4762def945cb9c022362ec2b7ca280795e79 languageName: node linkType: hard @@ -3360,18 +3360,18 @@ __metadata: languageName: node linkType: hard -"@octokit/core@npm:6.1.3, @octokit/core@npm:^6.1.3": - version: 6.1.3 - resolution: "@octokit/core@npm:6.1.3" +"@octokit/core@npm:6.1.4, @octokit/core@npm:^6.1.4": + version: 6.1.4 + resolution: "@octokit/core@npm:6.1.4" dependencies: "@octokit/auth-token": "npm:^5.0.0" "@octokit/graphql": "npm:^8.1.2" - "@octokit/request": "npm:^9.1.4" - "@octokit/request-error": "npm:^6.1.6" + "@octokit/request": "npm:^9.2.1" + "@octokit/request-error": "npm:^6.1.7" "@octokit/types": "npm:^13.6.2" before-after-hook: "npm:^3.0.2" universal-user-agent: "npm:^7.0.0" - checksum: 10c0/d02506dfb2771b18d0ee620b92deb75f0458cbf92b975b04c9ad3e50b06813d4c98a598bf1a1cae5757d31166c52a1ef55c30b17f2359f30309731e264ea20d0 + checksum: 10c0/bcb05e83c54f686ae55bd3793e63a1832f83cbe804586b52c61b0e18942609dcc209af501720de6f2c87dc575047645b074f4cd5822d461e892058ea9654aebc languageName: node linkType: hard @@ -3400,6 +3400,16 @@ __metadata: languageName: node linkType: hard +"@octokit/endpoint@npm:^10.1.3": + version: 10.1.3 + resolution: "@octokit/endpoint@npm:10.1.3" + dependencies: + "@octokit/types": "npm:^13.6.2" + universal-user-agent: "npm:^7.0.2" + checksum: 10c0/096956534efee1f683b4749673c2d1673c6fbe5362b9cce553f9f4b956feaf59bde816594de72f4352f749b862d0b15bc0e2fa7fb0e198deb1fe637b5f4a8bc7 + languageName: node + linkType: hard + "@octokit/endpoint@npm:^9.0.1": version: 9.0.5 resolution: "@octokit/endpoint@npm:9.0.5" @@ -3430,14 +3440,14 @@ __metadata: languageName: node linkType: hard -"@octokit/graphql@npm:8.2.0, @octokit/graphql@npm:^8.1.2": - version: 8.2.0 - resolution: "@octokit/graphql@npm:8.2.0" +"@octokit/graphql@npm:8.2.1": + version: 8.2.1 + resolution: "@octokit/graphql@npm:8.2.1" dependencies: - "@octokit/request": "npm:^9.1.4" + "@octokit/request": "npm:^9.2.2" "@octokit/types": "npm:^13.8.0" universal-user-agent: "npm:^7.0.0" - checksum: 10c0/10c91490e191554bd611d80ae4678fc3887d3cb0f56258781e04c941d3373ccdb63b518a3e6ba7a08e2777b0cb22c60c62aaa6aa138bd9052624b364c886c1db + checksum: 10c0/79fe7b50113bef90a32e3b6ee48923cad2afc049aba5c22e44167cf5773e2688a4e953f3ee1e24bee9706ccf7588ae14451933b282f63f1f7d5c95d319df23dd languageName: node linkType: hard @@ -3452,6 +3462,17 @@ __metadata: languageName: node linkType: hard +"@octokit/graphql@npm:^8.1.2": + version: 8.2.0 + resolution: "@octokit/graphql@npm:8.2.0" + dependencies: + "@octokit/request": "npm:^9.1.4" + "@octokit/types": "npm:^13.8.0" + universal-user-agent: "npm:^7.0.0" + checksum: 10c0/10c91490e191554bd611d80ae4678fc3887d3cb0f56258781e04c941d3373ccdb63b518a3e6ba7a08e2777b0cb22c60c62aaa6aa138bd9052624b364c886c1db + languageName: node + linkType: hard + "@octokit/oauth-authorization-url@npm:^7.0.0": version: 7.1.1 resolution: "@octokit/oauth-authorization-url@npm:7.1.1" @@ -3459,7 +3480,7 @@ __metadata: languageName: node linkType: hard -"@octokit/oauth-methods@npm:^5.1.2, @octokit/oauth-methods@npm:^5.1.3": +"@octokit/oauth-methods@npm:^5.1.3": version: 5.1.3 resolution: "@octokit/oauth-methods@npm:5.1.3" dependencies: @@ -3471,10 +3492,22 @@ __metadata: languageName: node linkType: hard -"@octokit/openapi-types@npm:23.0.1, @octokit/openapi-types@npm:^23.0.1": - version: 23.0.1 - resolution: "@octokit/openapi-types@npm:23.0.1" - checksum: 10c0/ab734ceb26343d9f051a59503b8cb5bdc7fec9ca044b60511b227179bec73141dd9144a6b2d68bcd737741881b136c1b7d5392da89ae2e35e39acc489e5eb4c1 +"@octokit/oauth-methods@npm:^5.1.4": + version: 5.1.4 + resolution: "@octokit/oauth-methods@npm:5.1.4" + dependencies: + "@octokit/oauth-authorization-url": "npm:^7.0.0" + "@octokit/request": "npm:^9.2.1" + "@octokit/request-error": "npm:^6.1.7" + "@octokit/types": "npm:^13.6.2" + checksum: 10c0/28d02aad67b5559dbb2660ca91bb31c8a2e1dab7c81a6df505f80fbeba56a25b8c291e8add510a5db75ff15aff30c5ea078f7f670bb83c3fe693e25532dae401 + languageName: node + linkType: hard + +"@octokit/openapi-types@npm:24.0.0": + version: 24.0.0 + resolution: "@octokit/openapi-types@npm:24.0.0" + checksum: 10c0/2b90c0fac29c81d9713e78e4411dd3b5c161a866765d209646f8350327078d768a4ab4402fa6d099b1160b101f054f378f9d5b6eb22b021bda3a5305022cfd4d languageName: node linkType: hard @@ -3485,14 +3518,21 @@ __metadata: languageName: node linkType: hard -"@octokit/plugin-paginate-rest@npm:11.4.0, @octokit/plugin-paginate-rest@npm:^11.4.0": - version: 11.4.0 - resolution: "@octokit/plugin-paginate-rest@npm:11.4.0" +"@octokit/openapi-types@npm:^23.0.1": + version: 23.0.1 + resolution: "@octokit/openapi-types@npm:23.0.1" + checksum: 10c0/ab734ceb26343d9f051a59503b8cb5bdc7fec9ca044b60511b227179bec73141dd9144a6b2d68bcd737741881b136c1b7d5392da89ae2e35e39acc489e5eb4c1 + languageName: node + linkType: hard + +"@octokit/plugin-paginate-rest@npm:11.4.2, @octokit/plugin-paginate-rest@npm:^11.4.2": + version: 11.4.2 + resolution: "@octokit/plugin-paginate-rest@npm:11.4.2" dependencies: "@octokit/types": "npm:^13.7.0" peerDependencies: "@octokit/core": ">=6" - checksum: 10c0/b211f2491ddb941dfe6ae0b8fa752c617c74a1bb3086a9e2e23e77430682d30863ed8ccc6180dd12d4f6f0e0c7af4489863dd63804e2cc9f3fab12c1f04f8dd2 + checksum: 10c0/e2da83bb8ddec64e4a2e752483aee929618bef6ade312c20cb2e510c5bf532ced4ff25115e9a71843eb04ba7f770ec5afc7ae0b8d43e227e0f795a7f554d92fd languageName: node linkType: hard @@ -3538,12 +3578,12 @@ __metadata: languageName: node linkType: hard -"@octokit/request-error@npm:6.1.6, @octokit/request-error@npm:^6.0.1, @octokit/request-error@npm:^6.1.6": - version: 6.1.6 - resolution: "@octokit/request-error@npm:6.1.6" +"@octokit/request-error@npm:6.1.7, @octokit/request-error@npm:^6.1.7": + version: 6.1.7 + resolution: "@octokit/request-error@npm:6.1.7" dependencies: "@octokit/types": "npm:^13.6.2" - checksum: 10c0/cbbed77ddd1d40a1bed36224667c2fac4c20ce375a78d4648745ad1fedc8c2b1d01343b5908979d5b6557736245637eb58efc65d0cd1ef047ea6be74b46c47d2 + checksum: 10c0/24bd6f98b1d7b2d4062de34777b4195d3cc4dc40c3187a0321dd588291ec5e13b5760765aacdef3a73796a529d3dec0bfb820780be6ef526a3e774d13566b5b0 languageName: node linkType: hard @@ -3558,6 +3598,15 @@ __metadata: languageName: node linkType: hard +"@octokit/request-error@npm:^6.0.1, @octokit/request-error@npm:^6.1.6": + version: 6.1.6 + resolution: "@octokit/request-error@npm:6.1.6" + dependencies: + "@octokit/types": "npm:^13.6.2" + checksum: 10c0/cbbed77ddd1d40a1bed36224667c2fac4c20ce375a78d4648745ad1fedc8c2b1d01343b5908979d5b6557736245637eb58efc65d0cd1ef047ea6be74b46c47d2 + languageName: node + linkType: hard + "@octokit/request@npm:^8.3.0, @octokit/request@npm:^8.3.1": version: 8.4.0 resolution: "@octokit/request@npm:8.4.0" @@ -3583,15 +3632,28 @@ __metadata: languageName: node linkType: hard -"@octokit/rest@npm:21.1.0": - version: 21.1.0 - resolution: "@octokit/rest@npm:21.1.0" +"@octokit/request@npm:^9.2.1, @octokit/request@npm:^9.2.2": + version: 9.2.2 + resolution: "@octokit/request@npm:9.2.2" + dependencies: + "@octokit/endpoint": "npm:^10.1.3" + "@octokit/request-error": "npm:^6.1.7" + "@octokit/types": "npm:^13.6.2" + fast-content-type-parse: "npm:^2.0.0" + universal-user-agent: "npm:^7.0.2" + checksum: 10c0/14cb523c17ed619c63e52025af9fdc67357b63d113905ec0ccb47badd20926e6f37a17a0620d3a906823b496e3b7efb29ed1e2af658cde5daf3ed3f88b421973 + languageName: node + linkType: hard + +"@octokit/rest@npm:21.1.1": + version: 21.1.1 + resolution: "@octokit/rest@npm:21.1.1" dependencies: - "@octokit/core": "npm:^6.1.3" - "@octokit/plugin-paginate-rest": "npm:^11.4.0" + "@octokit/core": "npm:^6.1.4" + "@octokit/plugin-paginate-rest": "npm:^11.4.2" "@octokit/plugin-request-log": "npm:^5.3.1" "@octokit/plugin-rest-endpoint-methods": "npm:^13.3.0" - checksum: 10c0/98d00f5be3e7ccee9486738664650e37be6251face1afc17e4733795a4b986645f33f64602aabf98dbde4c710d1448fb9ea7dfaf0f99824f37deb326aa2a224b + checksum: 10c0/59e4fe55942e6f94ff6924934418fbfdee516f6df00889f9417add037c2163b45079a600b6c43449bc824641c9f1b9ac6fe9d3b52a5a1ed3e5e12de697171b78 languageName: node linkType: hard