@shopify/create-app
Version:
A CLI tool to create a new Shopify app.
7,715 lines • 350 kB
JavaScript
import {
require_get_stream
} from "./chunk-JGGOQOPO.js";
import {
require_semver
} from "./chunk-OQ3KXXGH.js";
import {
__commonJS,
__require,
__toESM,
init_cjs_shims
} from "./chunk-3XNI6LP4.js";
// ../../node_modules/.pnpm/defer-to-connect@2.0.1/node_modules/defer-to-connect/dist/source/index.js
var require_source = __commonJS({
"../../node_modules/.pnpm/defer-to-connect@2.0.1/node_modules/defer-to-connect/dist/source/index.js"(exports, module) {
"use strict";
init_cjs_shims();
Object.defineProperty(exports, "__esModule", { value: !0 });
function isTLSSocket(socket) {
return socket.encrypted;
}
var deferToConnect2 = (socket, fn) => {
let listeners;
typeof fn == "function" ? listeners = { connect: fn } : listeners = fn;
let hasConnectListener = typeof listeners.connect == "function", hasSecureConnectListener = typeof listeners.secureConnect == "function", hasCloseListener = typeof listeners.close == "function", onConnect = () => {
hasConnectListener && listeners.connect(), isTLSSocket(socket) && hasSecureConnectListener && (socket.authorized ? listeners.secureConnect() : socket.authorizationError || socket.once("secureConnect", listeners.secureConnect)), hasCloseListener && socket.once("close", listeners.close);
};
socket.writable && !socket.connecting ? onConnect() : socket.connecting ? socket.once("connect", onConnect) : socket.destroyed && hasCloseListener && listeners.close(socket._hadError);
};
exports.default = deferToConnect2;
module.exports = deferToConnect2;
module.exports.default = deferToConnect2;
}
});
// ../../node_modules/.pnpm/http-cache-semantics@4.2.0/node_modules/http-cache-semantics/index.js
var require_http_cache_semantics = __commonJS({
"../../node_modules/.pnpm/http-cache-semantics@4.2.0/node_modules/http-cache-semantics/index.js"(exports, module) {
"use strict";
init_cjs_shims();
var statusCodeCacheableByDefault = /* @__PURE__ */ new Set([
200,
203,
204,
206,
300,
301,
308,
404,
405,
410,
414,
501
]), understoodStatuses = /* @__PURE__ */ new Set([
200,
203,
204,
300,
301,
302,
303,
307,
308,
404,
405,
410,
414,
501
]), errorStatusCodes = /* @__PURE__ */ new Set([
500,
502,
503,
504
]), hopByHopHeaders = {
date: !0,
// included, because we add Age update Date
connection: !0,
"keep-alive": !0,
"proxy-authenticate": !0,
"proxy-authorization": !0,
te: !0,
trailer: !0,
"transfer-encoding": !0,
upgrade: !0
}, excludedFromRevalidationUpdate = {
// Since the old body is reused, it doesn't make sense to change properties of the body
"content-length": !0,
"content-encoding": !0,
"transfer-encoding": !0,
"content-range": !0
};
function toNumberOrZero(s) {
let n = parseInt(s, 10);
return isFinite(n) ? n : 0;
}
function isErrorResponse(response) {
return response ? errorStatusCodes.has(response.status) : !0;
}
function parseCacheControl(header) {
let cc = {};
if (!header) return cc;
let parts = header.trim().split(/,/);
for (let part of parts) {
let [k, v] = part.split(/=/, 2);
cc[k.trim()] = v === void 0 ? !0 : v.trim().replace(/^"|"$/g, "");
}
return cc;
}
function formatCacheControl(cc) {
let parts = [];
for (let k in cc) {
let v = cc[k];
parts.push(v === !0 ? k : k + "=" + v);
}
if (parts.length)
return parts.join(", ");
}
module.exports = class {
/**
* Creates a new CachePolicy instance.
* @param {HttpRequest} req - Incoming client request.
* @param {HttpResponse} res - Received server response.
* @param {Object} [options={}] - Configuration options.
* @param {boolean} [options.shared=true] - Is the cache shared (a public proxy)? `false` for personal browser caches.
* @param {number} [options.cacheHeuristic=0.1] - Fallback heuristic (age fraction) for cache duration.
* @param {number} [options.immutableMinTimeToLive=86400000] - Minimum TTL for immutable responses in milliseconds.
* @param {boolean} [options.ignoreCargoCult=false] - Detect nonsense cache headers, and override them.
* @param {any} [options._fromObject] - Internal parameter for deserialization. Do not use.
*/
constructor(req, res, {
shared,
cacheHeuristic,
immutableMinTimeToLive,
ignoreCargoCult,
_fromObject
} = {}) {
if (_fromObject) {
this._fromObject(_fromObject);
return;
}
if (!res || !res.headers)
throw Error("Response headers missing");
this._assertRequestHasHeaders(req), this._responseTime = this.now(), this._isShared = shared !== !1, this._ignoreCargoCult = !!ignoreCargoCult, this._cacheHeuristic = cacheHeuristic !== void 0 ? cacheHeuristic : 0.1, this._immutableMinTtl = immutableMinTimeToLive !== void 0 ? immutableMinTimeToLive : 24 * 3600 * 1e3, this._status = "status" in res ? res.status : 200, this._resHeaders = res.headers, this._rescc = parseCacheControl(res.headers["cache-control"]), this._method = "method" in req ? req.method : "GET", this._url = req.url, this._host = req.headers.host, this._noAuthorization = !req.headers.authorization, this._reqHeaders = res.headers.vary ? req.headers : null, this._reqcc = parseCacheControl(req.headers["cache-control"]), this._ignoreCargoCult && "pre-check" in this._rescc && "post-check" in this._rescc && (delete this._rescc["pre-check"], delete this._rescc["post-check"], delete this._rescc["no-cache"], delete this._rescc["no-store"], delete this._rescc["must-revalidate"], this._resHeaders = Object.assign({}, this._resHeaders, {
"cache-control": formatCacheControl(this._rescc)
}), delete this._resHeaders.expires, delete this._resHeaders.pragma), res.headers["cache-control"] == null && /no-cache/.test(res.headers.pragma) && (this._rescc["no-cache"] = !0);
}
/**
* You can monkey-patch it for testing.
* @returns {number} Current time in milliseconds.
*/
now() {
return Date.now();
}
/**
* Determines if the response is storable in a cache.
* @returns {boolean} `false` if can never be cached.
*/
storable() {
return !!(!this._reqcc["no-store"] && // A cache MUST NOT store a response to any request, unless:
// The request method is understood by the cache and defined as being cacheable, and
(this._method === "GET" || this._method === "HEAD" || this._method === "POST" && this._hasExplicitExpiration()) && // the response status code is understood by the cache, and
understoodStatuses.has(this._status) && // the "no-store" cache directive does not appear in request or response header fields, and
!this._rescc["no-store"] && // the "private" response directive does not appear in the response, if the cache is shared, and
(!this._isShared || !this._rescc.private) && // the Authorization header field does not appear in the request, if the cache is shared,
(!this._isShared || this._noAuthorization || this._allowsStoringAuthenticated()) && // the response either:
// contains an Expires header field, or
(this._resHeaders.expires || // contains a max-age response directive, or
// contains a s-maxage response directive and the cache is shared, or
// contains a public response directive.
this._rescc["max-age"] || this._isShared && this._rescc["s-maxage"] || this._rescc.public || // has a status code that is defined as cacheable by default
statusCodeCacheableByDefault.has(this._status)));
}
/**
* @returns {boolean} true if expiration is explicitly defined.
*/
_hasExplicitExpiration() {
return !!(this._isShared && this._rescc["s-maxage"] || this._rescc["max-age"] || this._resHeaders.expires);
}
/**
* @param {HttpRequest} req - a request
* @throws {Error} if the headers are missing.
*/
_assertRequestHasHeaders(req) {
if (!req || !req.headers)
throw Error("Request headers missing");
}
/**
* Checks if the request matches the cache and can be satisfied from the cache immediately,
* without having to make a request to the server.
*
* This doesn't support `stale-while-revalidate`. See `evaluateRequest()` for a more complete solution.
*
* @param {HttpRequest} req - The new incoming HTTP request.
* @returns {boolean} `true`` if the cached response used to construct this cache policy satisfies the request without revalidation.
*/
satisfiesWithoutRevalidation(req) {
return !this.evaluateRequest(req).revalidation;
}
/**
* @param {{headers: Record<string, string>, synchronous: boolean}|undefined} revalidation - Revalidation information, if any.
* @returns {{response: {headers: Record<string, string>}, revalidation: {headers: Record<string, string>, synchronous: boolean}|undefined}} An object with a cached response headers and revalidation info.
*/
_evaluateRequestHitResult(revalidation) {
return {
response: {
headers: this.responseHeaders()
},
revalidation
};
}
/**
* @param {HttpRequest} request - new incoming
* @param {boolean} synchronous - whether revalidation must be synchronous (not s-w-r).
* @returns {{headers: Record<string, string>, synchronous: boolean}} An object with revalidation headers and a synchronous flag.
*/
_evaluateRequestRevalidation(request, synchronous) {
return {
synchronous,
headers: this.revalidationHeaders(request)
};
}
/**
* @param {HttpRequest} request - new incoming
* @returns {{response: undefined, revalidation: {headers: Record<string, string>, synchronous: boolean}}} An object indicating no cached response and revalidation details.
*/
_evaluateRequestMissResult(request) {
return {
response: void 0,
revalidation: this._evaluateRequestRevalidation(request, !0)
};
}
/**
* Checks if the given request matches this cache entry, and how the cache can be used to satisfy it. Returns an object with:
*
* ```
* {
* // If defined, you must send a request to the server.
* revalidation: {
* headers: {}, // HTTP headers to use when sending the revalidation response
* // If true, you MUST wait for a response from the server before using the cache
* // If false, this is stale-while-revalidate. The cache is stale, but you can use it while you update it asynchronously.
* synchronous: bool,
* },
* // If defined, you can use this cached response.
* response: {
* headers: {}, // Updated cached HTTP headers you must use when responding to the client
* },
* }
* ```
* @param {HttpRequest} req - new incoming HTTP request
* @returns {{response: {headers: Record<string, string>}|undefined, revalidation: {headers: Record<string, string>, synchronous: boolean}|undefined}} An object containing keys:
* - revalidation: { headers: Record<string, string>, synchronous: boolean } Set if you should send this to the origin server
* - response: { headers: Record<string, string> } Set if you can respond to the client with these cached headers
*/
evaluateRequest(req) {
if (this._assertRequestHasHeaders(req), this._rescc["must-revalidate"])
return this._evaluateRequestMissResult(req);
if (!this._requestMatches(req, !1))
return this._evaluateRequestMissResult(req);
let requestCC = parseCacheControl(req.headers["cache-control"]);
return requestCC["no-cache"] || /no-cache/.test(req.headers.pragma) ? this._evaluateRequestMissResult(req) : requestCC["max-age"] && this.age() > toNumberOrZero(requestCC["max-age"]) ? this._evaluateRequestMissResult(req) : requestCC["min-fresh"] && this.maxAge() - this.age() < toNumberOrZero(requestCC["min-fresh"]) ? this._evaluateRequestMissResult(req) : this.stale() ? "max-stale" in requestCC && (requestCC["max-stale"] === !0 || requestCC["max-stale"] > this.age() - this.maxAge()) ? this._evaluateRequestHitResult(void 0) : this.useStaleWhileRevalidate() ? this._evaluateRequestHitResult(this._evaluateRequestRevalidation(req, !1)) : this._evaluateRequestMissResult(req) : this._evaluateRequestHitResult(void 0);
}
/**
* @param {HttpRequest} req - check if this is for the same cache entry
* @param {boolean} allowHeadMethod - allow a HEAD method to match.
* @returns {boolean} `true` if the request matches.
*/
_requestMatches(req, allowHeadMethod) {
return !!((!this._url || this._url === req.url) && this._host === req.headers.host && // the request method associated with the stored response allows it to be used for the presented request, and
(!req.method || this._method === req.method || allowHeadMethod && req.method === "HEAD") && // selecting header fields nominated by the stored response (if any) match those presented, and
this._varyMatches(req));
}
/**
* Determines whether storing authenticated responses is allowed.
* @returns {boolean} `true` if allowed.
*/
_allowsStoringAuthenticated() {
return !!(this._rescc["must-revalidate"] || this._rescc.public || this._rescc["s-maxage"]);
}
/**
* Checks whether the Vary header in the response matches the new request.
* @param {HttpRequest} req - incoming HTTP request
* @returns {boolean} `true` if the vary headers match.
*/
_varyMatches(req) {
if (!this._resHeaders.vary)
return !0;
if (this._resHeaders.vary === "*")
return !1;
let fields = this._resHeaders.vary.trim().toLowerCase().split(/\s*,\s*/);
for (let name of fields)
if (req.headers[name] !== this._reqHeaders[name]) return !1;
return !0;
}
/**
* Creates a copy of the given headers without any hop-by-hop headers.
* @param {Record<string, string>} inHeaders - old headers from the cached response
* @returns {Record<string, string>} A new headers object without hop-by-hop headers.
*/
_copyWithoutHopByHopHeaders(inHeaders) {
let headers = {};
for (let name in inHeaders)
hopByHopHeaders[name] || (headers[name] = inHeaders[name]);
if (inHeaders.connection) {
let tokens = inHeaders.connection.trim().split(/\s*,\s*/);
for (let name of tokens)
delete headers[name];
}
if (headers.warning) {
let warnings = headers.warning.split(/,/).filter((warning) => !/^\s*1[0-9][0-9]/.test(warning));
warnings.length ? headers.warning = warnings.join(",").trim() : delete headers.warning;
}
return headers;
}
/**
* Returns the response headers adjusted for serving the cached response.
* Removes hop-by-hop headers and updates the Age and Date headers.
* @returns {Record<string, string>} The adjusted response headers.
*/
responseHeaders() {
let headers = this._copyWithoutHopByHopHeaders(this._resHeaders), age = this.age();
return age > 3600 * 24 && !this._hasExplicitExpiration() && this.maxAge() > 3600 * 24 && (headers.warning = (headers.warning ? `${headers.warning}, ` : "") + '113 - "rfc7234 5.5.4"'), headers.age = `${Math.round(age)}`, headers.date = new Date(this.now()).toUTCString(), headers;
}
/**
* Returns the Date header value from the response or the current time if invalid.
* @returns {number} Timestamp (in milliseconds) representing the Date header or response time.
*/
date() {
let serverDate = Date.parse(this._resHeaders.date);
return isFinite(serverDate) ? serverDate : this._responseTime;
}
/**
* Value of the Age header, in seconds, updated for the current time.
* May be fractional.
* @returns {number} The age in seconds.
*/
age() {
let age = this._ageValue(), residentTime = (this.now() - this._responseTime) / 1e3;
return age + residentTime;
}
/**
* @returns {number} The Age header value as a number.
*/
_ageValue() {
return toNumberOrZero(this._resHeaders.age);
}
/**
* Possibly outdated value of applicable max-age (or heuristic equivalent) in seconds.
* This counts since response's `Date`.
*
* For an up-to-date value, see `timeToLive()`.
*
* Returns the maximum age (freshness lifetime) of the response in seconds.
* @returns {number} The max-age value in seconds.
*/
maxAge() {
if (!this.storable() || this._rescc["no-cache"] || this._isShared && this._resHeaders["set-cookie"] && !this._rescc.public && !this._rescc.immutable || this._resHeaders.vary === "*")
return 0;
if (this._isShared) {
if (this._rescc["proxy-revalidate"])
return 0;
if (this._rescc["s-maxage"])
return toNumberOrZero(this._rescc["s-maxage"]);
}
if (this._rescc["max-age"])
return toNumberOrZero(this._rescc["max-age"]);
let defaultMinTtl = this._rescc.immutable ? this._immutableMinTtl : 0, serverDate = this.date();
if (this._resHeaders.expires) {
let expires = Date.parse(this._resHeaders.expires);
return Number.isNaN(expires) || expires < serverDate ? 0 : Math.max(defaultMinTtl, (expires - serverDate) / 1e3);
}
if (this._resHeaders["last-modified"]) {
let lastModified = Date.parse(this._resHeaders["last-modified"]);
if (isFinite(lastModified) && serverDate > lastModified)
return Math.max(
defaultMinTtl,
(serverDate - lastModified) / 1e3 * this._cacheHeuristic
);
}
return defaultMinTtl;
}
/**
* Remaining time this cache entry may be useful for, in *milliseconds*.
* You can use this as an expiration time for your cache storage.
*
* Prefer this method over `maxAge()`, because it includes other factors like `age` and `stale-while-revalidate`.
* @returns {number} Time-to-live in milliseconds.
*/
timeToLive() {
let age = this.maxAge() - this.age(), staleIfErrorAge = age + toNumberOrZero(this._rescc["stale-if-error"]), staleWhileRevalidateAge = age + toNumberOrZero(this._rescc["stale-while-revalidate"]);
return Math.round(Math.max(0, age, staleIfErrorAge, staleWhileRevalidateAge) * 1e3);
}
/**
* If true, this cache entry is past its expiration date.
* Note that stale cache may be useful sometimes, see `evaluateRequest()`.
* @returns {boolean} `false` doesn't mean it's fresh nor usable
*/
stale() {
return this.maxAge() <= this.age();
}
/**
* @returns {boolean} `true` if `stale-if-error` condition allows use of a stale response.
*/
_useStaleIfError() {
return this.maxAge() + toNumberOrZero(this._rescc["stale-if-error"]) > this.age();
}
/** See `evaluateRequest()` for a more complete solution
* @returns {boolean} `true` if `stale-while-revalidate` is currently allowed.
*/
useStaleWhileRevalidate() {
let swr = toNumberOrZero(this._rescc["stale-while-revalidate"]);
return swr > 0 && this.maxAge() + swr > this.age();
}
/**
* Creates a `CachePolicy` instance from a serialized object.
* @param {Object} obj - The serialized object.
* @returns {CachePolicy} A new CachePolicy instance.
*/
static fromObject(obj) {
return new this(void 0, void 0, { _fromObject: obj });
}
/**
* @param {any} obj - The serialized object.
* @throws {Error} If already initialized or if the object is invalid.
*/
_fromObject(obj) {
if (this._responseTime) throw Error("Reinitialized");
if (!obj || obj.v !== 1) throw Error("Invalid serialization");
this._responseTime = obj.t, this._isShared = obj.sh, this._cacheHeuristic = obj.ch, this._immutableMinTtl = obj.imm !== void 0 ? obj.imm : 24 * 3600 * 1e3, this._ignoreCargoCult = !!obj.icc, this._status = obj.st, this._resHeaders = obj.resh, this._rescc = obj.rescc, this._method = obj.m, this._url = obj.u, this._host = obj.h, this._noAuthorization = obj.a, this._reqHeaders = obj.reqh, this._reqcc = obj.reqcc;
}
/**
* Serializes the `CachePolicy` instance into a JSON-serializable object.
* @returns {Object} The serialized object.
*/
toObject() {
return {
v: 1,
t: this._responseTime,
sh: this._isShared,
ch: this._cacheHeuristic,
imm: this._immutableMinTtl,
icc: this._ignoreCargoCult,
st: this._status,
resh: this._resHeaders,
rescc: this._rescc,
m: this._method,
u: this._url,
h: this._host,
a: this._noAuthorization,
reqh: this._reqHeaders,
reqcc: this._reqcc
};
}
/**
* Headers for sending to the origin server to revalidate stale response.
* Allows server to return 304 to allow reuse of the previous response.
*
* Hop by hop headers are always stripped.
* Revalidation headers may be added or removed, depending on request.
* @param {HttpRequest} incomingReq - The incoming HTTP request.
* @returns {Record<string, string>} The headers for the revalidation request.
*/
revalidationHeaders(incomingReq) {
this._assertRequestHasHeaders(incomingReq);
let headers = this._copyWithoutHopByHopHeaders(incomingReq.headers);
if (delete headers["if-range"], !this._requestMatches(incomingReq, !0) || !this.storable())
return delete headers["if-none-match"], delete headers["if-modified-since"], headers;
if (this._resHeaders.etag && (headers["if-none-match"] = headers["if-none-match"] ? `${headers["if-none-match"]}, ${this._resHeaders.etag}` : this._resHeaders.etag), headers["accept-ranges"] || headers["if-match"] || headers["if-unmodified-since"] || this._method && this._method != "GET") {
if (delete headers["if-modified-since"], headers["if-none-match"]) {
let etags = headers["if-none-match"].split(/,/).filter((etag) => !/^\s*W\//.test(etag));
etags.length ? headers["if-none-match"] = etags.join(",").trim() : delete headers["if-none-match"];
}
} else this._resHeaders["last-modified"] && !headers["if-modified-since"] && (headers["if-modified-since"] = this._resHeaders["last-modified"]);
return headers;
}
/**
* Creates new CachePolicy with information combined from the previews response,
* and the new revalidation response.
*
* Returns {policy, modified} where modified is a boolean indicating
* whether the response body has been modified, and old cached body can't be used.
*
* @param {HttpRequest} request - The latest HTTP request asking for the cached entry.
* @param {HttpResponse} response - The latest revalidation HTTP response from the origin server.
* @returns {{policy: CachePolicy, modified: boolean, matches: boolean}} The updated policy and modification status.
* @throws {Error} If the response headers are missing.
*/
revalidatedPolicy(request, response) {
if (this._assertRequestHasHeaders(request), this._useStaleIfError() && isErrorResponse(response))
return {
policy: this,
modified: !1,
matches: !0
};
if (!response || !response.headers)
throw Error("Response headers missing");
let matches = !1;
response.status !== void 0 && response.status != 304 ? matches = !1 : response.headers.etag && !/^\s*W\//.test(response.headers.etag) ? matches = this._resHeaders.etag && this._resHeaders.etag.replace(/^\s*W\//, "") === response.headers.etag : this._resHeaders.etag && response.headers.etag ? matches = this._resHeaders.etag.replace(/^\s*W\//, "") === response.headers.etag.replace(/^\s*W\//, "") : this._resHeaders["last-modified"] ? matches = this._resHeaders["last-modified"] === response.headers["last-modified"] : !this._resHeaders.etag && !this._resHeaders["last-modified"] && !response.headers.etag && !response.headers["last-modified"] && (matches = !0);
let optionsCopy = {
shared: this._isShared,
cacheHeuristic: this._cacheHeuristic,
immutableMinTimeToLive: this._immutableMinTtl,
ignoreCargoCult: this._ignoreCargoCult
};
if (!matches)
return {
policy: new this.constructor(request, response, optionsCopy),
// Client receiving 304 without body, even if it's invalid/mismatched has no option
// but to reuse a cached body. We don't have a good way to tell clients to do
// error recovery in such case.
modified: response.status != 304,
matches: !1
};
let headers = {};
for (let k in this._resHeaders)
headers[k] = k in response.headers && !excludedFromRevalidationUpdate[k] ? response.headers[k] : this._resHeaders[k];
let newResponse = Object.assign({}, response, {
status: this._status,
method: this._method,
headers
});
return {
policy: new this.constructor(request, newResponse, optionsCopy),
modified: !1,
matches: !0
};
}
};
}
});
// ../../node_modules/.pnpm/json-buffer@3.0.1/node_modules/json-buffer/index.js
var require_json_buffer = __commonJS({
"../../node_modules/.pnpm/json-buffer@3.0.1/node_modules/json-buffer/index.js"(exports) {
init_cjs_shims();
exports.stringify = function stringify(o) {
if (typeof o > "u") return o;
if (o && Buffer.isBuffer(o))
return JSON.stringify(":base64:" + o.toString("base64"));
if (o && o.toJSON && (o = o.toJSON()), o && typeof o == "object") {
var s = "", array = Array.isArray(o);
s = array ? "[" : "{";
var first = !0;
for (var k in o) {
var ignore = typeof o[k] == "function" || !array && typeof o[k] > "u";
Object.hasOwnProperty.call(o, k) && !ignore && (first || (s += ","), first = !1, array ? o[k] == null ? s += "null" : s += stringify(o[k]) : o[k] !== void 0 && (s += stringify(k) + ":" + stringify(o[k])));
}
return s += array ? "]" : "}", s;
} else return typeof o == "string" ? JSON.stringify(/^:/.test(o) ? ":" + o : o) : typeof o > "u" ? "null" : JSON.stringify(o);
};
exports.parse = function(s) {
return JSON.parse(s, function(key, value) {
return typeof value == "string" ? /^:base64:/.test(value) ? Buffer.from(value.substring(8), "base64") : /^:/.test(value) ? value.substring(1) : value : value;
});
};
}
});
// ../../node_modules/.pnpm/keyv@4.5.4/node_modules/keyv/src/index.js
var require_src = __commonJS({
"../../node_modules/.pnpm/keyv@4.5.4/node_modules/keyv/src/index.js"(exports, module) {
"use strict";
init_cjs_shims();
var EventEmitter3 = __require("events"), JSONB = require_json_buffer(), loadStore = (options) => {
let adapters = {
redis: "@keyv/redis",
rediss: "@keyv/redis",
mongodb: "@keyv/mongo",
mongo: "@keyv/mongo",
sqlite: "@keyv/sqlite",
postgresql: "@keyv/postgres",
postgres: "@keyv/postgres",
mysql: "@keyv/mysql",
etcd: "@keyv/etcd",
offline: "@keyv/offline",
tiered: "@keyv/tiered"
};
if (options.adapter || options.uri) {
let adapter = options.adapter || /^[^:+]*/.exec(options.uri)[0];
return new (__require(adapters[adapter]))(options);
}
return /* @__PURE__ */ new Map();
}, iterableAdapters = [
"sqlite",
"postgres",
"mysql",
"mongo",
"redis",
"tiered"
], Keyv2 = class extends EventEmitter3 {
constructor(uri, { emitErrors = !0, ...options } = {}) {
if (super(), this.opts = {
namespace: "keyv",
serialize: JSONB.stringify,
deserialize: JSONB.parse,
...typeof uri == "string" ? { uri } : uri,
...options
}, !this.opts.store) {
let adapterOptions = { ...this.opts };
this.opts.store = loadStore(adapterOptions);
}
if (this.opts.compression) {
let compression = this.opts.compression;
this.opts.serialize = compression.serialize.bind(compression), this.opts.deserialize = compression.deserialize.bind(compression);
}
typeof this.opts.store.on == "function" && emitErrors && this.opts.store.on("error", (error) => this.emit("error", error)), this.opts.store.namespace = this.opts.namespace;
let generateIterator = (iterator) => async function* () {
for await (let [key, raw] of typeof iterator == "function" ? iterator(this.opts.store.namespace) : iterator) {
let data = await this.opts.deserialize(raw);
if (!(this.opts.store.namespace && !key.includes(this.opts.store.namespace))) {
if (typeof data.expires == "number" && Date.now() > data.expires) {
this.delete(key);
continue;
}
yield [this._getKeyUnprefix(key), data.value];
}
}
};
typeof this.opts.store[Symbol.iterator] == "function" && this.opts.store instanceof Map ? this.iterator = generateIterator(this.opts.store) : typeof this.opts.store.iterator == "function" && this.opts.store.opts && this._checkIterableAdaptar() && (this.iterator = generateIterator(this.opts.store.iterator.bind(this.opts.store)));
}
_checkIterableAdaptar() {
return iterableAdapters.includes(this.opts.store.opts.dialect) || iterableAdapters.findIndex((element) => this.opts.store.opts.url.includes(element)) >= 0;
}
_getKeyPrefix(key) {
return `${this.opts.namespace}:${key}`;
}
_getKeyPrefixArray(keys) {
return keys.map((key) => `${this.opts.namespace}:${key}`);
}
_getKeyUnprefix(key) {
return key.split(":").splice(1).join(":");
}
get(key, options) {
let { store } = this.opts, isArray = Array.isArray(key), keyPrefixed = isArray ? this._getKeyPrefixArray(key) : this._getKeyPrefix(key);
if (isArray && store.getMany === void 0) {
let promises = [];
for (let key2 of keyPrefixed)
promises.push(
Promise.resolve().then(() => store.get(key2)).then((data) => typeof data == "string" ? this.opts.deserialize(data) : this.opts.compression ? this.opts.deserialize(data) : data).then((data) => {
if (data != null)
return typeof data.expires == "number" && Date.now() > data.expires ? this.delete(key2).then(() => {
}) : options && options.raw ? data : data.value;
})
);
return Promise.allSettled(promises).then((values) => {
let data = [];
for (let value of values)
data.push(value.value);
return data;
});
}
return Promise.resolve().then(() => isArray ? store.getMany(keyPrefixed) : store.get(keyPrefixed)).then((data) => typeof data == "string" ? this.opts.deserialize(data) : this.opts.compression ? this.opts.deserialize(data) : data).then((data) => {
if (data != null)
return isArray ? data.map((row, index) => {
if (typeof row == "string" && (row = this.opts.deserialize(row)), row != null) {
if (typeof row.expires == "number" && Date.now() > row.expires) {
this.delete(key[index]).then(() => {
});
return;
}
return options && options.raw ? row : row.value;
}
}) : typeof data.expires == "number" && Date.now() > data.expires ? this.delete(key).then(() => {
}) : options && options.raw ? data : data.value;
});
}
set(key, value, ttl2) {
let keyPrefixed = this._getKeyPrefix(key);
typeof ttl2 > "u" && (ttl2 = this.opts.ttl), ttl2 === 0 && (ttl2 = void 0);
let { store } = this.opts;
return Promise.resolve().then(() => {
let expires = typeof ttl2 == "number" ? Date.now() + ttl2 : null;
return typeof value == "symbol" && this.emit("error", "symbol cannot be serialized"), value = { value, expires }, this.opts.serialize(value);
}).then((value2) => store.set(keyPrefixed, value2, ttl2)).then(() => !0);
}
delete(key) {
let { store } = this.opts;
if (Array.isArray(key)) {
let keyPrefixed2 = this._getKeyPrefixArray(key);
if (store.deleteMany === void 0) {
let promises = [];
for (let key2 of keyPrefixed2)
promises.push(store.delete(key2));
return Promise.allSettled(promises).then((values) => values.every((x) => x.value === !0));
}
return Promise.resolve().then(() => store.deleteMany(keyPrefixed2));
}
let keyPrefixed = this._getKeyPrefix(key);
return Promise.resolve().then(() => store.delete(keyPrefixed));
}
clear() {
let { store } = this.opts;
return Promise.resolve().then(() => store.clear());
}
has(key) {
let keyPrefixed = this._getKeyPrefix(key), { store } = this.opts;
return Promise.resolve().then(async () => typeof store.has == "function" ? store.has(keyPrefixed) : await store.get(keyPrefixed) !== void 0);
}
disconnect() {
let { store } = this.opts;
if (typeof store.disconnect == "function")
return store.disconnect();
}
};
module.exports = Keyv2;
}
});
// ../../node_modules/.pnpm/mimic-response@3.1.0/node_modules/mimic-response/index.js
var require_mimic_response = __commonJS({
"../../node_modules/.pnpm/mimic-response@3.1.0/node_modules/mimic-response/index.js"(exports, module) {
"use strict";
init_cjs_shims();
var knownProperties2 = [
"aborted",
"complete",
"headers",
"httpVersion",
"httpVersionMinor",
"httpVersionMajor",
"method",
"rawHeaders",
"rawTrailers",
"setTimeout",
"socket",
"statusCode",
"statusMessage",
"trailers",
"url"
];
module.exports = (fromStream, toStream) => {
if (toStream._readableState.autoDestroy)
throw new Error("The second stream must have the `autoDestroy` option set to `false`");
let fromProperties = new Set(Object.keys(fromStream).concat(knownProperties2)), properties = {};
for (let property of fromProperties)
property in toStream || (properties[property] = {
get() {
let value = fromStream[property];
return typeof value == "function" ? value.bind(fromStream) : value;
},
set(value) {
fromStream[property] = value;
},
enumerable: !0,
configurable: !1
});
return Object.defineProperties(toStream, properties), fromStream.once("aborted", () => {
toStream.destroy(), toStream.emit("aborted");
}), fromStream.once("close", () => {
fromStream.complete && toStream.readable ? toStream.once("end", () => {
toStream.emit("close");
}) : toStream.emit("close");
}), toStream;
};
}
});
// ../../node_modules/.pnpm/decompress-response@6.0.0/node_modules/decompress-response/index.js
var require_decompress_response = __commonJS({
"../../node_modules/.pnpm/decompress-response@6.0.0/node_modules/decompress-response/index.js"(exports, module) {
"use strict";
init_cjs_shims();
var { Transform, PassThrough } = __require("stream"), zlib = __require("zlib"), mimicResponse2 = require_mimic_response();
module.exports = (response) => {
let contentEncoding = (response.headers["content-encoding"] || "").toLowerCase();
if (!["gzip", "deflate", "br"].includes(contentEncoding))
return response;
let isBrotli = contentEncoding === "br";
if (isBrotli && typeof zlib.createBrotliDecompress != "function")
return response.destroy(new Error("Brotli is not supported on Node.js < 12")), response;
let isEmpty = !0, checker = new Transform({
transform(data, _encoding, callback) {
isEmpty = !1, callback(null, data);
},
flush(callback) {
callback();
}
}), finalStream = new PassThrough({
autoDestroy: !1,
destroy(error, callback) {
response.destroy(), callback(error);
}
}), decompressStream = isBrotli ? zlib.createBrotliDecompress() : zlib.createUnzip();
return decompressStream.once("error", (error) => {
if (isEmpty && !response.readable) {
finalStream.end();
return;
}
finalStream.destroy(error);
}), mimicResponse2(response, finalStream), response.pipe(checker).pipe(decompressStream).pipe(finalStream), finalStream;
};
}
});
// ../../node_modules/.pnpm/quick-lru@5.1.1/node_modules/quick-lru/index.js
var require_quick_lru = __commonJS({
"../../node_modules/.pnpm/quick-lru@5.1.1/node_modules/quick-lru/index.js"(exports, module) {
"use strict";
init_cjs_shims();
var QuickLRU = class {
constructor(options = {}) {
if (!(options.maxSize && options.maxSize > 0))
throw new TypeError("`maxSize` must be a number greater than 0");
this.maxSize = options.maxSize, this.onEviction = options.onEviction, this.cache = /* @__PURE__ */ new Map(), this.oldCache = /* @__PURE__ */ new Map(), this._size = 0;
}
_set(key, value) {
if (this.cache.set(key, value), this._size++, this._size >= this.maxSize) {
if (this._size = 0, typeof this.onEviction == "function")
for (let [key2, value2] of this.oldCache.entries())
this.onEviction(key2, value2);
this.oldCache = this.cache, this.cache = /* @__PURE__ */ new Map();
}
}
get(key) {
if (this.cache.has(key))
return this.cache.get(key);
if (this.oldCache.has(key)) {
let value = this.oldCache.get(key);
return this.oldCache.delete(key), this._set(key, value), value;
}
}
set(key, value) {
return this.cache.has(key) ? this.cache.set(key, value) : this._set(key, value), this;
}
has(key) {
return this.cache.has(key) || this.oldCache.has(key);
}
peek(key) {
if (this.cache.has(key))
return this.cache.get(key);
if (this.oldCache.has(key))
return this.oldCache.get(key);
}
delete(key) {
let deleted = this.cache.delete(key);
return deleted && this._size--, this.oldCache.delete(key) || deleted;
}
clear() {
this.cache.clear(), this.oldCache.clear(), this._size = 0;
}
*keys() {
for (let [key] of this)
yield key;
}
*values() {
for (let [, value] of this)
yield value;
}
*[Symbol.iterator]() {
for (let item of this.cache)
yield item;
for (let item of this.oldCache) {
let [key] = item;
this.cache.has(key) || (yield item);
}
}
get size() {
let oldCacheSize = 0;
for (let key of this.oldCache.keys())
this.cache.has(key) || oldCacheSize++;
return Math.min(this._size + oldCacheSize, this.maxSize);
}
};
module.exports = QuickLRU;
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/delay-async-destroy.js
var require_delay_async_destroy = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/delay-async-destroy.js"(exports, module) {
"use strict";
init_cjs_shims();
module.exports = (stream2) => {
if (stream2.listenerCount("error") !== 0)
return stream2;
stream2.__destroy = stream2._destroy, stream2._destroy = (...args) => {
let callback = args.pop();
stream2.__destroy(...args, async (error) => {
await Promise.resolve(), callback(error);
});
};
let onError = (error) => {
Promise.resolve().then(() => {
stream2.emit("error", error);
});
};
return stream2.once("error", onError), Promise.resolve().then(() => {
stream2.off("error", onError);
}), stream2;
};
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/agent.js
var require_agent = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/agent.js"(exports, module) {
"use strict";
init_cjs_shims();
var { URL: URL4 } = __require("url"), EventEmitter3 = __require("events"), tls = __require("tls"), http22 = __require("http2"), QuickLRU = require_quick_lru(), delayAsyncDestroy = require_delay_async_destroy(), kCurrentStreamCount = /* @__PURE__ */ Symbol("currentStreamCount"), kRequest = /* @__PURE__ */ Symbol("request"), kOriginSet = /* @__PURE__ */ Symbol("cachedOriginSet"), kGracefullyClosing = /* @__PURE__ */ Symbol("gracefullyClosing"), kLength = /* @__PURE__ */ Symbol("length"), nameKeys = [
// Not an Agent option actually
"createConnection",
// `http2.connect()` options
"maxDeflateDynamicTableSize",
"maxSettings",
"maxSessionMemory",
"maxHeaderListPairs",
"maxOutstandingPings",
"maxReservedRemoteStreams",
"maxSendHeaderBlockLength",
"paddingStrategy",
"peerMaxConcurrentStreams",
"settings",
// `tls.connect()` source options
"family",
"localAddress",
"rejectUnauthorized",
// `tls.connect()` secure context options
"pskCallback",
"minDHSize",
// `tls.connect()` destination options
// - `servername` is automatically validated, skip it
// - `host` and `port` just describe the destination server,
"path",
"socket",
// `tls.createSecureContext()` options
"ca",
"cert",
"sigalgs",
"ciphers",
"clientCertEngine",
"crl",
"dhparam",
"ecdhCurve",
"honorCipherOrder",
"key",
"privateKeyEngine",
"privateKeyIdentifier",
"maxVersion",
"minVersion",
"pfx",
"secureOptions",
"secureProtocol",
"sessionIdContext",
"ticketKeys"
], getSortedIndex = (array, value, compare) => {
let low = 0, high = array.length;
for (; low < high; ) {
let mid = low + high >>> 1;
compare(array[mid], value) ? low = mid + 1 : high = mid;
}
return low;
}, compareSessions = (a, b) => a.remoteSettings.maxConcurrentStreams > b.remoteSettings.maxConcurrentStreams, closeCoveredSessions = (where, session) => {
for (let index = 0; index < where.length; index++) {
let coveredSession = where[index];
// Unfortunately `.every()` returns true for an empty array
coveredSession[kOriginSet].length > 0 && coveredSession[kOriginSet].length < session[kOriginSet].length && coveredSession[kOriginSet].every((origin) => session[kOriginSet].includes(origin)) && coveredSession[kCurrentStreamCount] + session[kCurrentStreamCount] <= session.remoteSettings.maxConcurrentStreams && gracefullyClose(coveredSession);
}
}, closeSessionIfCovered = (where, coveredSession) => {
for (let index = 0; index < where.length; index++) {
let session = where[index];
if (coveredSession[kOriginSet].length > 0 && coveredSession[kOriginSet].length < session[kOriginSet].length && coveredSession[kOriginSet].every((origin) => session[kOriginSet].includes(origin)) && coveredSession[kCurrentStreamCount] + session[kCurrentStreamCount] <= session.remoteSettings.maxConcurrentStreams)
return gracefullyClose(coveredSession), !0;
}
return !1;
}, gracefullyClose = (session) => {
session[kGracefullyClosing] = !0, session[kCurrentStreamCount] === 0 && session.close();
}, Agent = class _Agent extends EventEmitter3 {
constructor({ timeout = 0, maxSessions = Number.POSITIVE_INFINITY, maxEmptySessions = 10, maxCachedTlsSessions = 100 } = {}) {
super(), this.sessions = {}, this.queue = {}, this.timeout = timeout, this.maxSessions = maxSessions, this.maxEmptySessions = maxEmptySessions, this._emptySessionCount = 0, this._sessionCount = 0, this.settings = {
enablePush: !1,
initialWindowSize: 1024 * 1024 * 32
// 32MB, see https://github.com/nodejs/node/issues/38426
}, this.tlsSessionCache = new QuickLRU({ maxSize: maxCachedTlsSessions });
}
get protocol() {
return "https:";
}
normalizeOptions(options) {
let normalized = "";
for (let index = 0; index < nameKeys.length; index++) {
let key = nameKeys[index];
normalized += ":", options && options[key] !== void 0 && (normalized += options[key]);
}
return normalized;
}
_processQueue() {
if (this._sessionCount >= this.maxSessions) {
this.closeEmptySessions(this.maxSessions - this._sessionCount + 1);
return;
}
for (let normalizedOptions in this.queue)
for (let normalizedOrigin in this.queue[normalizedOptions]) {
let item = this.queue[normalizedOptions][normalizedOrigin];
item.completed || (item.completed = !0, item());
}
}
_isBetterSession(thisStreamCount, thatStreamCount) {
return thisStreamCount > thatStreamCount;
}
_accept(session, listeners, normalizedOrigin, options) {
let index = 0;
for (; index < listeners.length && session[kCurrentStreamCount] < session.remoteSettings.maxConcurrentStreams; )
listeners[index].resolve(session), index++;
listeners.splice(0, index), listeners.length > 0 && (this.getSession(normalizedOrigin, options, listeners), listeners.length = 0);
}
getSession(origin, options, listeners) {
return new Promise((resolve, reject) => {
Array.isArray(listeners) && listeners.length > 0 ? (listeners = [...listeners], resolve()) : listeners = [{ resolve, reject }];
try {
if (typeof origin == "string")
origin = new URL4(origin);
else if (!(origin instanceof URL4))
throw new TypeError("The `origin` argument needs to be a string or an URL object");
if (options) {
let { servername } = options, { hostname } = origin;
if (servername && hostname !== servername)
throw new Error(`Origin ${hostname} differs from servername ${servername}`);
}
} catch (error) {
for (let index = 0; index < listeners.length; index++)
listeners[index].reject(error);
return;
}
let normalizedOptions = this.normalizeOptions(options), normalizedOrigin = origin.origin;
if (normalizedOptions in this.sessions) {
let sessions = this.sessions[normalizedOptions], maxConcurrentStreams = -1, currentStreamsCount = -1, optimalSession;
for (let index = 0; index < sessions.length; index++) {
let session = sessions[index], sessionMaxConcurrentStreams = session.remoteSettings.maxConcurrentStreams;
if (sessionMaxConcurrentStreams < maxConcurrentStreams)
break;
if (!session[kOriginSet].includes(normalizedOrigin))
continue;
let sessionCurrentStreamsCount = session[kCurrentStreamCount];
sessionCurrentStreamsCount >= sessionMaxConcurrentStreams || session[kGracefullyClosing] || session.destroyed || (optimalSession || (maxConcurrentStreams = sessionMaxConcurrentStreams), this._isBetterSession(sessionCurrentStreamsCount, currentStreamsCount) && (optimalSession = session, currentStreamsCount = sessionCurrentStreamsCount));
}
if (optimalSession) {
this._accept(optimalSession, listeners, normalizedOrigin, options);
return;
}
}
if (normalizedOptions in this.queue) {
if (normalizedOrigin in this.queue[normalizedOptions]) {
this.queue[normalizedOptions][normalizedOrigin].listeners.push(...listeners);
return;
}
} else
this.queue[normalizedOptions] = {
[kLength]: 0
};
let removeFromQueue = () => {
normalizedOptions in this.queue && this.queue[normalizedOptions][normalizedOrigin] === entry && (delete this.queue[normalizedOptions][normalizedOrigin], --this.queue[normalizedOptions][kLength] === 0 && delete this.queue[normalizedOptions]);
}, entry = async () => {
this._sessionCount++;
let name = `${normalizedOrigin}:${normalizedOptions}`, receivedSettings = !1, socket;
try {
let computedOptions = { ...options };
computedOptions.settings === void 0 && (computedOptions.settings = this.settings), computedOptions.session === void 0 && (computedOptions.session = this.tlsSessionCache.get(name)), socket = await (computedOptions.createConnection || this.createConnection).call(this, origin, computedOptions), computedOptions.createConnection = () => socket;
let session = http22.connect(origin, computedOptions);
session[kCurrentStreamCount] = 0, session[kGracefullyClosing] = !1;
let getOriginSet = () => {
let { socket: socket2 } = session, originSet;
return socket2.servername === !1 ? (socket2.servername = socket2.remoteAddress, originSet = session.originSet, socket2.servername = !1) : originSet = session.originSet, originSet;
}, isFree = () => session[kCurrentStreamCount] < session.remoteSettings.maxConcurrentStreams;
session.socket.once("session", (tlsSession) => {
this.tlsSessionCache.set(name, tlsSession);
}), session.once("error", (error) => {
for (let index = 0; index < listeners.length; index++)
listeners[index].reject(error);
this.tlsSessionCache.delete(name);
}), session.setTimeout(this.timeout, () => {
session.destroy();
}), session.once("close", () => {
if (this._sessionCount--, receivedSettings) {
this._emptySessionCount--;
let where = this.sessions[normalizedOptions];
where.length === 1 ? delete this.sessions[normalizedOptions] : where.splice(where.indexOf(session), 1);
} else {
removeFromQueue();
let error = new Error("Session closed without receiving a SETTINGS frame");
error.code = "HTTP2WRAPPER_NOSETTINGS";
for (let index = 0; index < listeners.length; index++)
listeners[index].reject(error);
}
this._processQueue();
});
let processListeners = () => {
let queue = this.queue[normalizedOptions];
if (!queue)
return;
let originSet = session[kOriginSet];
for (let index = 0; index < originSet.length; index++) {
let origin2 = originSet[index];
if (origin2 in queue) {
let { listeners: listeners2, completed } = queue[origin2], index2 = 0;
for (; index2 < listeners2.length && isFree(); )
listeners2[index2].resolve(session), index2++;
if (queue[origin2].listeners.splice(0, index2), queue[origin2].listeners.length === 0 && !completed && (delete queue[origin2], --queue[kLength] === 0)) {
delete this.queue[normalizedOptions];
break;
}
if (!isFree())
break;
}
}
};
session.on("origin", () => {
session[kOriginSet] = getOriginSet() || [], session[kGracefullyClosing] = !1, closeSessionIfCovered(this.sessions[normalizedOptions], session), !(session[kGracefullyClosing] || !isFree()) && (processListeners(), isFree() && closeCoveredSessions(this.sessions[normalizedOptions], session));
}), session.once("remoteSettings", () => {
if (entry.destroyed) {
let error = new Error("Agent has been destroyed");
for (let index = 0; index < listeners.length; index++)
listeners[index].reject(error);
session.destroy();
return;
}
if (session.setLocalWindowSize && session.setLocalWindowSize(1024 * 1024 * 4), session[kOriginSet] = getOriginSet() || [], session.socket.encrypted) {
let mainOrigin = session[kOriginSet][0];
if (mainOrigin !== normalizedOrigin) {
let error = new Error(`Requested origin ${normalizedOrigin} does not match server ${mainOrigin}`);
for (let index = 0; index < listeners.length; index++)
listeners[index].reject(error);
session.destroy();
return;
}
}
removeFromQueue();
{
let where = this.sessions;
if (normalizedOptions in where) {
let sessions = where[normalizedOptions];
sessions.splice(getSortedIndex(sessions, session, compareSessions), 0, session);
} else
where[normalizedOptions] = [session];
}
receivedSettings = !0, this._emptySessionCount++, this.emit("session", session), this._accept(session, listeners, normalizedOrigin, options), session[kCurrentStreamCount] === 0 && this._emptySessionCount > this.maxEmptySessions && this.closeEmptySessions(this._emptySessionCount - this.maxEmptySessions), session.on("remoteSettings", () => {
isFree() && (processListeners(), isFree() && closeCoveredSessions(this.sessions[normalizedOptions], session));
});
}), session[kRequest] = session.request, session.request = (headers, streamOptions) => {
if (session[kGracefullyClosing])
throw new Error("The session is gracefully closing. No new streams are allowed.");
let stream2 = session[kRequest](headers, streamOptions);
return session.ref(), session[kCurrentStreamCount]++ === 0 && this._emptySessionCount--, stream2.once("close", () => {
if (--session[kCurrentStreamCount] === 0 && (this._emptySessionCount++, session.unref(), this._emptySessionCount > this.maxEmptySessions || session[kGracefullyClosing])) {
session.close();
return;
}
session.destroyed || session.closed || isFree() && !closeSessionIfCovered(this.sessions[normalizedOptions], session) && (closeCoveredSessions(this.sessions[normalizedOptions], session), processListeners(), session[kCurrentStreamCount] === 0 && this._processQueue());
}), stream2;
};
} catch (error) {
removeFromQueue(), this._sessionCount--;
for (let index = 0; index < listeners.length; index++)
listeners[index].reject(error);
}
};
entry.listeners = listeners, entry.completed = !1, entry.destroyed = !1, this.queue[normalizedOptions][normalizedOrigin] = entry, this.queue[normalizedOptions][kLength]++, this._processQueue();
});
}
request(origin, options, headers, streamOptions) {
return new Promise((resolve, reject) => {
this.getSession(origin, options, [{
reject,
resolve: (session) => {
try {
let stream2 = session.request(headers, streamOptions);
delayAsyncDestroy(stream2), resolve(stream2);
} catch (error) {
reject(error);
}
}
}]);
});
}
async createConnection(origin, options) {
return _Agent.connect(origin, options);
}
static connect(origin, options) {
options.ALPNProtocols = ["h2"];
let port = origin.port || 443, host = origin.hostname;
typeof options.servername > "u" && (options.servername = host);
let socket = tls.connect(port, host, options);
return options.socket && (socket._peername = {
family: void 0,
address: void 0,
port
}), socket;
}
closeEmptySessions(maxCount = Number.POSITIVE_INFINITY) {
let closedCount = 0, { sessions } = this;
for (let key in sessions) {
let thisSessions = sessions[key];
for (let index = 0; index < thisSessions.length; index++) {
let session = thisSessions[index];
if (session[kCurrentStreamCount] === 0 && (closedCount++, session.close(), closedCount >= maxCount))
return closedCount;
}
}
return closedCount;
}
destroy(reason) {
let { sessions, queue } = this;
for (let key in sessions) {
let thisSessions = sessions[key];
for (let index = 0; index < thisSessions.length; index++)
thisSessions[index].destroy(reason);
}
for (let normalizedOptions in queue) {
let entries2 = queue[normalizedOptions];
for (let normalizedOrigin in entries2)
entries2[normalizedOrigin].destroyed = !0;
}
this.queue = {}, this.tlsSessionCache.clear();
}
get emptySessionCount() {
return this._emptySessionCount;
}
get pendingSessionCount() {
return this._sessionCount - this._emptySessionCount;
}
get sessionCount() {
return this._sessionCount;
}
};
Agent.kCurrentStreamCount = kCurrentStreamCount;
Agent.kGracefullyClosing = kGracefullyClosing;
module.exports = {
Agent,
globalAgent: new Agent()
};
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/incoming-message.js
var require_incoming_message = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/incoming-message.js"(exports, module) {
"use strict";
init_cjs_shims();
var { Readable } = __require("stream"), IncomingMessage = class extends Readable {
constructor(socket, highWaterMark) {
super({
emitClose: !1,
autoDestroy: !0,
highWaterMark
}), this.statusCode = null, this.statusMessage = "", this.httpVersion = "2.0", this.httpVersionMajor = 2, this.httpVersionMinor = 0, this.headers = {}, this.trailers = {}, this.req = null, this.aborted = !1, this.complete = !1, this.upgrade = null, this.rawHeaders = [], this.rawTrailers = [], this.socket = socket, this._dumped = !1;
}
get connection() {
return this.socket;
}
set connection(value) {
this.socket = value;
}
_destroy(error, callback) {
this.readableEnded || (this.aborted = !0), callback(), this.req._request.destroy(error);
}
setTimeout(ms, callback) {
return this.req.setTimeout(ms, callback), this;
}
_dump() {
this._dumped || (this._dumped = !0, this.removeAllListeners("data"), this.resume());
}
_read() {
this.req && this.req._request.resume();
}
};
module.exports = IncomingMessage;
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/proxy-events.js
var require_proxy_events = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/proxy-events.js"(exports, module) {
"use strict";
init_cjs_shims();
module.exports = (from, to, events) => {
for (let event of events)
from.on(event, (...args) => to.emit(event, ...args));
};
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/errors.js
var require_errors = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/errors.js"(exports, module) {
"use strict";
init_cjs_shims();
var makeError = (Base, key, getMessage) => {
module.exports[key] = class extends Base {
constructor(...args) {
super(typeof getMessage == "string" ? getMessage : getMessage(args)), this.name = `${super.name} [${key}]`, this.code = key;
}
};
};
makeError(TypeError, "ERR_INVALID_ARG_TYPE", (args) => {
let type = args[0].includes(".") ? "property" : "argument", valid = args[1], isManyTypes = Array.isArray(valid);
return isManyTypes && (valid = `${valid.slice(0, -1).join(", ")} or ${valid.slice(-1)}`), `The "${args[0]}" ${type} must be ${isManyTypes ? "one of" : "of"} type ${valid}. Received ${typeof args[2]}`;
});
makeError(
TypeError,
"ERR_INVALID_PROTOCOL",
(args) => `Protocol "${args[0]}" not supported. Expected "${args[1]}"`
);
makeError(
Error,
"ERR_HTTP_HEADERS_SENT",
(args) => `Cannot ${args[0]} headers after they are sent to the client`
);
makeError(
TypeError,
"ERR_INVALID_HTTP_TOKEN",
(args) => `${args[0]} must be a valid HTTP token [${args[1]}]`
);
makeError(
TypeError,
"ERR_HTTP_INVALID_HEADER_VALUE",
(args) => `Invalid value "${args[0]} for header "${args[1]}"`
);
makeError(
TypeError,
"ERR_INVALID_CHAR",
(args) => `Invalid character in ${args[0]} [${args[1]}]`
);
makeError(
Error,
"ERR_HTTP2_NO_SOCKET_MANIPULATION",
"HTTP/2 sockets should not be directly manipulated (e.g. read and written)"
);
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/is-request-pseudo-header.js
var require_is_request_pseudo_header = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/is-request-pseudo-header.js"(exports, module) {
"use strict";
init_cjs_shims();
module.exports = (header) => {
switch (header) {
case ":method":
case ":scheme":
case ":authority":
case ":path":
return !0;
default:
return !1;
}
};
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/validate-header-name.js
var require_validate_header_name = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/validate-header-name.js"(exports, module) {
"use strict";
init_cjs_shims();
var { ERR_INVALID_HTTP_TOKEN } = require_errors(), isRequestPseudoHeader = require_is_request_pseudo_header(), isValidHttpToken = /^[\^`\-\w!#$%&*+.|~]+$/;
module.exports = (name) => {
if (typeof name != "string" || !isValidHttpToken.test(name) && !isRequestPseudoHeader(name))
throw new ERR_INVALID_HTTP_TOKEN("Header name", name);
};
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/validate-header-value.js
var require_validate_header_value = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/validate-header-value.js"(exports, module) {
"use strict";
init_cjs_shims();
var {
ERR_HTTP_INVALID_HEADER_VALUE,
ERR_INVALID_CHAR
} = require_errors(), isInvalidHeaderValue = /[^\t\u0020-\u007E\u0080-\u00FF]/;
module.exports = (name, value) => {
if (typeof value > "u")
throw new ERR_HTTP_INVALID_HEADER_VALUE(value, name);
if (isInvalidHeaderValue.test(value))
throw new ERR_INVALID_CHAR("header content", name);
};
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/proxy-socket-handler.js
var require_proxy_socket_handler = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/proxy-socket-handler.js"(exports, module) {
"use strict";
init_cjs_shims();
var { ERR_HTTP2_NO_SOCKET_MANIPULATION } = require_errors(), proxySocketHandler = {
has(stream2, property) {
let reference = stream2.session === void 0 ? stream2 : stream2.session.socket;
return property in stream2 || property in reference;
},
get(stream2, property) {
switch (property) {
case "on":
case "once":
case "end":
case "emit":
case "destroy":
return stream2[property].bind(stream2);
case "writable":
case "destroyed":
return stream2[property];
case "readable":
return stream2.destroyed ? !1 : stream2.readable;
case "setTimeout": {
let { session } = stream2;
return session !== void 0 ? session.setTimeout.bind(session) : stream2.setTimeout.bind(stream2);
}
case "write":
case "read":
case "pause":
case "resume":
throw new ERR_HTTP2_NO_SOCKET_MANIPULATION();
default: {
let reference = stream2.session === void 0 ? stream2 : stream2.session.socket, value = reference[property];
return typeof value == "function" ? value.bind(reference) : value;
}
}
},
getPrototypeOf(stream2) {
return stream2.session !== void 0 ? Reflect.getPrototypeOf(stream2.session.socket) : Reflect.getPrototypeOf(stream2);
},
set(stream2, property, value) {
switch (property) {
case "writable":
case "readable":
case "destroyed":
case "on":
case "once":
case "end":
case "emit":
case "destroy":
return stream2[property] = value, !0;
case "setTimeout": {
let { session } = stream2;
return session === void 0 ? stream2.setTimeout = value : session.setTimeout = value, !0;
}
case "write":
case "read":
case "pause":
case "resume":
throw new ERR_HTTP2_NO_SOCKET_MANIPULATION();
default: {
let reference = stream2.session === void 0 ? stream2 : stream2.session.socket;
return reference[property] = value, !0;
}
}
}
};
module.exports = proxySocketHandler;
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/client-request.js
var require_client_request = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/client-request.js"(exports, module) {
"use strict";
init_cjs_shims();
var { URL: URL4, urlToHttpOptions } = __require("url"), http22 = __require("http2"), { Writable } = __require("stream"), { Agent, globalAgent } = require_agent(), IncomingMessage = require_incoming_message(), proxyEvents2 = require_proxy_events(), {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_PROTOCOL,
ERR_HTTP_HEADERS_SENT
} = require_errors(), validateHeaderName = require_validate_header_name(), validateHeaderValue = require_validate_header_value(), proxySocketHandler = require_proxy_socket_handler(), {
HTTP2_HEADER_STATUS,
HTTP2_HEADER_METHOD,
HTTP2_HEADER_PATH,
HTTP2_HEADER_AUTHORITY,
HTTP2_METHOD_CONNECT
} = http22.constants, kHeaders = /* @__PURE__ */ Symbol("headers"), kOrigin = /* @__PURE__ */ Symbol("origin"), kSession = /* @__PURE__ */ Symbol("session"), kOptions = /* @__PURE__ */ Symbol("options"), kFlushedHeaders = /* @__PURE__ */ Symbol("flushedHeaders"), kJobs = /* @__PURE__ */ Symbol("jobs"), kPendingAgentPromise = /* @__PURE__ */ Symbol("pendingAgentPromise"), ClientRequest = class extends Writable {
constructor(input, options, callback) {
if (super({
autoDestroy: !1,
emitClose: !1
}), typeof input == "string" ? input = urlToHttpOptions(new URL4(input)) : input instanceof URL4 ? input = urlToHttpOptions(input) : input = { ...input }, typeof options == "function" || options === void 0 ? (callback = options, options = input) : options = Object.assign(input, options), options.h2session) {
if (this[kSession] = options.h2session, this[kSession].destroyed)
throw new Error("The session has been closed already");
this.protocol = this[kSession].socket.encrypted ? "https:" : "http:";
} else if (options.agent === !1)
this.agent = new Agent({ maxEmptySessions: 0 });
else if (typeof options.agent > "u" || options.agent === null)
this.agent = globalAgent;
else if (typeof options.agent.request == "function")
this.agent = options.agent;
else
throw new ERR_INVALID_ARG_TYPE("options.agent", ["http2wrapper.Agent-like Object", "undefined", "false"], options.agent);
if (this.agent && (this.protocol = this.agent.protocol), options.protocol && options.protocol !== this.protocol)
throw new ERR_INVALID_PROTOCOL(options.protocol, this.protocol);
options.port || (options.port = options.defaultPort || this.agent && this.agent.defaultPort || 443), options.host = options.hostname || options.host || "localhost", delete options.hostname;
let { timeout } = options;
options.timeout = void 0, this[kHeaders] = /* @__PURE__ */ Object.create(null), this[kJobs] = [], this[kPendingAgentPromise] = void 0, this.socket = null, this.connection = null, this.method = options.method || "GET", this.method === "CONNECT" && (options.path === "/" || options.path === void 0) || (this.path = options.path), this.res = null, this.aborted = !1, this.reusedSocket = !1;
let { headers } = options;
if (headers)
for (let header in headers)
this.setHeader(header, headers[header]);
options.auth && !("authorization" in this[kHeaders]) && (this[kHeaders].authorization = "Basic " + Buffer.from(options.auth).toString("base64")), options.session = options.tlsSession, options.path = options.socketPath, this[kOptions] = options, this[kOrigin] = new URL4(`${this.protocol}//${options.servername || options.host}:${options.port}`);
let reuseSocket = options._reuseSocket;
reuseSocket && (options.createConnection = (...args) => reuseSocket.destroyed ? this.agent.createConnection(...args) : reuseSocket, this.agent.getSession(this[kOrigin], this[kOptions]).catch(() => {
})), timeout && this.setTimeout(timeout), callback && this.once("response", callback), this[kFlushedHeaders] = !1;
}
get method() {
return this[kHeaders][HTTP2_HEADER_METHOD];
}
set method(value) {
value && (this[kHeaders][HTTP2_HEADER_METHOD] = value.toUpperCase());
}
get path() {
let header = this.method === "CONNECT" ? HTTP2_HEADER_AUTHORITY : HTTP2_HEADER_PATH;
return this[kHeaders][header];
}
set path(value) {
if (value) {
let header = this.method === "CONNECT" ? HTTP2_HEADER_AUTHORITY : HTTP2_HEADER_PATH;
this[kHeaders][header] = value;
}
}
get host() {
return this[kOrigin].hostname;
}
set host(_value) {
}
get _mustNotHaveABody() {
return this.method === "GET" || this.method === "HEAD" || this.method === "DELETE";
}
_write(chunk, encoding, callback) {
if (this._mustNotHaveABody) {
callback(new Error("The GET, HEAD and DELETE methods must NOT have a body"));
return;
}
this.flushHeaders();
let callWrite = () => this._request.write(chunk, encoding, callback);
this._request ? callWrite() : this[kJobs].push(callWrite);
}
_final(callback) {
this.flushHeaders();
let callEnd = () => {
if (this._mustNotHaveABody || this.method === "CONNECT") {
callback();
return;
}
this._request.end(callback);
};
this._request ? callEnd() : this[kJobs].push(callEnd);
}
abort() {
this.res && this.res.complete || (this.aborted || process.nextTick(() => this.emit("abort")), this.aborted = !0, this.destroy());
}
async _destroy(error, callback) {
this.res && this.res._dump(), this._request ? this._request.destroy() : process.nextTick(() => {
this.emit("close");
});
try {
await this[kPendingAgentPromise];
} catch (internalError) {
this.aborted && (error = internalError);
}
callback(error);
}
async flushHeaders() {
if (this[kFlushedHeaders] || this.destroyed)
return;
this[kFlushedHeaders] = !0;
let isConnectMethod = this.method === HTTP2_METHOD_CONNECT, onStream = (stream2) => {
if (this._request = stream2, this.destroyed) {
stream2.destroy();
return;
}
isConnectMethod || proxyEvents2(stream2, this, ["timeout", "continue"]), stream2.once("error", (error) => {
this.destroy(error);
}), stream2.once("aborted", () => {
let { res } = this;
res ? (res.aborted = !0, res.emit("aborted"), res.destroy()) : this.destroy(new Error("The server aborted the HTTP/2 stream"));
});
let onResponse = (headers, flags, rawHeaders) => {
let response = new IncomingMessage(this.socket, stream2.readableHighWaterMark);
this.res = response, response.url = `${this[kOrigin].origin}${this.path}`, response.req = this, response.statusCode = headers[HTTP2_HEADER_STATUS], response.headers = headers, response.rawHeaders = rawHeaders, response.once("end", () => {
response.complete = !0, response.socket = null, response.connection = null;
}), isConnectMethod ? (response.upgrade = !0, this.emit("connect", response, stream2, Buffer.alloc(0)) ? this.emit("close") : stream2.destroy()) : (stream2.on("data", (chunk) => {
!response._dumped && !response.push(chunk) && stream2.pause();
}), stream2.once("end", () => {
this.aborted || response.push(null);
}), this.emit("response", response) || response._dump());
};
stream2.once("response", onResponse), stream2.once("headers", (headers) => this.emit("information", { statusCode: headers[HTTP2_HEADER_STATUS] })), stream2.once("trailers", (trailers, flags, rawTrailers) => {
let { res } = this;
if (res === null) {
onResponse(trailers, flags, rawTrailers);
return;
}
res.trailers = trailers, res.rawTrailers = rawTrailers;
}), stream2.once("close", () => {
let { aborted, res } = this;
if (res) {
aborted && (res.aborted = !0, res.emit("aborted"), res.destroy());
let finish = () => {
res.emit("close"), this.destroy(), this.emit("close");
};
res.readable ? res.once("end", finish) : finish();
return;
}
if (!this.destroyed) {
this.destroy(new Error("The HTTP/2 stream has been early terminated")), this.emit("close");
return;
}
this.destroy(), this.emit("close");
}), this.socket = new Proxy(stream2, proxySocketHandler);
for (let job of this[kJobs])
job();
this[kJobs].length = 0, this.emit("socket", this.socket);
};
if (!(HTTP2_HEADER_AUTHORITY in this[kHeaders]) && !isConnectMethod && (this[kHeaders][HTTP2_HEADER_AUTHORITY] = this[kOrigin].host), this[kSession])
try {
onStream(this[kSession].request(this[kHeaders]));
} catch (error) {
this.destroy(error);
}
else {
this.reusedSocket = !0;
try {
let promise = this.agent.request(this[kOrigin], this[kOptions], this[kHeaders]);
this[kPendingAgentPromise] = promise, onStream(await promise), this[kPendingAgentPromise] = !1;
} catch (error) {
this[kPendingAgentPromise] = !1, this.destroy(error);
}
}
}
get connection() {
return this.socket;
}
set connection(value) {
this.socket = value;
}
getHeaderNames() {
return Object.keys(this[kHeaders]);
}
hasHeader(name) {
if (typeof name != "string")
throw new ERR_INVALID_ARG_TYPE("name", "string", name);
return !!this[kHeaders][name.toLowerCase()];
}
getHeader(name) {
if (typeof name != "string")
throw new ERR_INVALID_ARG_TYPE("name", "string", name);
return this[kHeaders][name.toLowerCase()];
}
get headersSent() {
return this[kFlushedHeaders];
}
removeHeader(name) {
if (typeof name != "string")
throw new ERR_INVALID_ARG_TYPE("name", "string", name);
if (this.headersSent)
throw new ERR_HTTP_HEADERS_SENT("remove");
delete this[kHeaders][name.toLowerCase()];
}
setHeader(name, value) {
if (this.headersSent)
throw new ERR_HTTP_HEADERS_SENT("set");
validateHeaderName(name), validateHeaderValue(name, value);
let lowercased = name.toLowerCase();
if (lowercased === "connection") {
if (value.toLowerCase() === "keep-alive")
return;
throw new Error(`Invalid 'connection' header: ${value}`);
}
lowercased === "host" && this.method === "CONNECT" ? this[kHeaders][HTTP2_HEADER_AUTHORITY] = value : this[kHeaders][lowercased] = value;
}
setNoDelay() {
}
setSocketKeepAlive() {
}
setTimeout(ms, callback) {
let applyTimeout = () => this._request.setTimeout(ms, callback);
return this._request ? applyTimeout() : this[kJobs].push(applyTimeout), this;
}
get maxHeadersCount() {
if (!this.destroyed && this._request)
return this._request.session.localSettings.maxHeaderListSize;
}
set maxHeadersCount(_value) {
}
};
module.exports = ClientRequest;
}
});
// ../../node_modules/.pnpm/resolve-alpn@1.2.1/node_modules/resolve-alpn/index.js
var require_resolve_alpn = __commonJS({
"../../node_modules/.pnpm/resolve-alpn@1.2.1/node_modules/resolve-alpn/index.js"(exports, module) {
"use strict";
init_cjs_shims();
var tls = __require("tls");
module.exports = (options = {}, connect = tls.connect) => new Promise((resolve, reject) => {
let timeout = !1, socket, callback = async () => {
await socketPromise, socket.off("timeout", onTimeout), socket.off("error", reject), options.resolveSocket ? (resolve({ alpnProtocol: socket.alpnProtocol, socket, timeout }), timeout && (await Promise.resolve(), socket.emit("timeout"))) : (socket.destroy(), resolve({ alpnProtocol: socket.alpnProtocol, timeout }));
}, onTimeout = async () => {
timeout = !0, callback();
}, socketPromise = (async () => {
try {
socket = await connect(options, callback), socket.on("error", reject), socket.once("timeout", onTimeout);
} catch (error) {
reject(error);
}
})();
});
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/calculate-server-name.js
var require_calculate_server_name = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/calculate-server-name.js"(exports, module) {
"use strict";
init_cjs_shims();
var { isIP } = __require("net"), assert2 = __require("assert"), getHost = (host) => {
if (host[0] === "[") {
let idx2 = host.indexOf("]");
return assert2(idx2 !== -1), host.slice(1, idx2);
}
let idx = host.indexOf(":");
return idx === -1 ? host : host.slice(0, idx);
};
module.exports = (host) => {
let servername = getHost(host);
return isIP(servername) ? "" : servername;
};
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/auto.js
var require_auto = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/auto.js"(exports, module) {
"use strict";
init_cjs_shims();
var { URL: URL4, urlToHttpOptions } = __require("url"), http3 = __require("http"), https2 = __require("https"), resolveALPN = require_resolve_alpn(), QuickLRU = require_quick_lru(), { Agent, globalAgent } = require_agent(), Http2ClientRequest = require_client_request(), calculateServerName = require_calculate_server_name(), delayAsyncDestroy = require_delay_async_destroy(), cache = new QuickLRU({ maxSize: 100 }), queue = /* @__PURE__ */ new Map(), installSocket = (agent, socket, options) => {
socket._httpMessage = { shouldKeepAlive: !0 };
let onFree = () => {
agent.emit("free", socket, options);
};
socket.on("free", onFree);
let onClose = () => {
agent.removeSocket(socket, options);
};
socket.on("close", onClose);
let onTimeout = () => {
let { freeSockets } = agent;
for (let sockets of Object.values(freeSockets))
if (sockets.includes(socket)) {
socket.destroy();
return;
}
};
socket.on("timeout", onTimeout);
let onRemove = () => {
agent.removeSocket(socket, options), socket.off("close", onClose), socket.off("free", onFree), socket.off("timeout", onTimeout), socket.off("agentRemove", onRemove);
};
socket.on("agentRemove", onRemove), agent.emit("free", socket, options);
}, createResolveProtocol = (cache2, queue2 = /* @__PURE__ */ new Map(), connect = void 0) => async (options) => {
let name = `${options.host}:${options.port}:${options.ALPNProtocols.sort()}`;
if (!cache2.has(name)) {
if (queue2.has(name))
return { alpnProtocol: (await queue2.get(name)).alpnProtocol };
let { path } = options;
options.path = options.socketPath;
let resultPromise = resolveALPN(options, connect);
queue2.set(name, resultPromise);
try {
let result = await resultPromise;
return cache2.set(name, result.alpnProtocol), queue2.delete(name), options.path = path, result;
} catch (error) {
throw queue2.delete(name), options.path = path, error;
}
}
return { alpnProtocol: cache2.get(name) };
}, defaultResolveProtocol = createResolveProtocol(cache, queue);
module.exports = async (input, options, callback) => {
if (typeof input == "string" ? input = urlToHttpOptions(new URL4(input)) : input instanceof URL4 ? input = urlToHttpOptions(input) : input = { ...input }, typeof options == "function" || options === void 0 ? (callback = options, options = input) : options = Object.assign(input, options), options.ALPNProtocols = options.ALPNProtocols || ["h2", "http/1.1"], !Array.isArray(options.ALPNProtocols) || options.ALPNProtocols.length === 0)
throw new Error("The `ALPNProtocols` option must be an Array with at least one entry");
options.protocol = options.protocol || "https:";
let isHttps = options.protocol === "https:";
options.host = options.hostname || options.host || "localhost", options.session = options.tlsSession, options.servername = options.servername || calculateServerName(options.headers && options.headers.host || options.host), options.port = options.port || (isHttps ? 443 : 80), options._defaultAgent = isHttps ? https2.globalAgent : http3.globalAgent;
let resolveProtocol = options.resolveProtocol || defaultResolveProtocol, { agent } = options;
if (agent !== void 0 && agent !== !1 && agent.constructor.name !== "Object")
throw new Error("The `options.agent` can be only an object `http`, `https` or `http2` properties");
if (isHttps) {
options.resolveSocket = !0;
let { socket, alpnProtocol, timeout } = await resolveProtocol(options);
if (timeout) {
socket && socket.destroy();
let error = new Error(`Timed out resolving ALPN: ${options.timeout} ms`);
throw error.code = "ETIMEDOUT", error.ms = options.timeout, error;
}
socket && options.createConnection && (socket.destroy(), socket = void 0), delete options.resolveSocket;
let isHttp2 = alpnProtocol === "h2";
if (agent && (agent = isHttp2 ? agent.http2 : agent.https, options.agent = agent), agent === void 0 && (agent = isHttp2 ? globalAgent : https2.globalAgent), socket)
if (agent === !1)
socket.destroy();
else {
let defaultCreateConnection = (isHttp2 ? Agent : https2.Agent).prototype.createConnection;
agent.createConnection === defaultCreateConnection ? isHttp2 ? options._reuseSocket = socket : installSocket(agent, socket, options) : socket.destroy();
}
if (isHttp2)
return delayAsyncDestroy(new Http2ClientRequest(options, callback));
} else agent && (options.agent = agent.http);
return options.headers && (options.headers = { ...options.headers }, options.headers[":authority"] && (options.headers.host || (options.headers.host = options.headers[":authority"]), delete options.headers[":authority"]), delete options.headers[":method"], delete options.headers[":scheme"], delete options.headers[":path"]), delayAsyncDestroy(http3.request(options, callback));
};
module.exports.protocolCache = cache;
module.exports.resolveProtocol = defaultResolveProtocol;
module.exports.createResolveProtocol = createResolveProtocol;
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/js-stream-socket.js
var require_js_stream_socket = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/js-stream-socket.js"(exports, module) {
"use strict";
init_cjs_shims();
var stream2 = __require("stream"), tls = __require("tls"), JSStreamSocket = new tls.TLSSocket(new stream2.PassThrough())._handle._parentWrap.constructor;
module.exports = JSStreamSocket;
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/unexpected-status-code-error.js
var require_unexpected_status_code_error = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/unexpected-status-code-error.js"(exports, module) {
"use strict";
init_cjs_shims();
var UnexpectedStatusCodeError = class extends Error {
constructor(statusCode, statusMessage = "") {
super(`The proxy server rejected the request with status code ${statusCode} (${statusMessage || "empty status message"})`), this.statusCode = statusCode, this.statusMessage = statusMessage;
}
};
module.exports = UnexpectedStatusCodeError;
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/check-type.js
var require_check_type = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/check-type.js"(exports, module) {
"use strict";
init_cjs_shims();
var checkType = (name, value, types2) => {
if (!types2.some((type) => typeof type === "string" ? typeof value === type : value instanceof type)) {
let names = types2.map((type) => typeof type == "string" ? type : type.name);
throw new TypeError(`Expected '${name}' to be a type of ${names.join(" or ")}, got ${typeof value}`);
}
};
module.exports = checkType;
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/initialize.js
var require_initialize = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/initialize.js"(exports, module) {
"use strict";
init_cjs_shims();
var { URL: URL4 } = __require("url"), checkType = require_check_type();
module.exports = (self, proxyOptions) => {
checkType("proxyOptions", proxyOptions, ["object"]), checkType("proxyOptions.headers", proxyOptions.headers, ["object", "undefined"]), checkType("proxyOptions.raw", proxyOptions.raw, ["boolean", "undefined"]), checkType("proxyOptions.url", proxyOptions.url, [URL4, "string"]);
let url = new URL4(proxyOptions.url);
self.proxyOptions = {
raw: !0,
...proxyOptions,
headers: { ...proxyOptions.headers },
url
};
};
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/get-auth-headers.js
var require_get_auth_headers = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/get-auth-headers.js"(exports, module) {
"use strict";
init_cjs_shims();
module.exports = (self) => {
let { username, password } = self.proxyOptions.url;
if (username || password) {
let data = `${username}:${password}`, authorization = `Basic ${Buffer.from(data).toString("base64")}`;
return {
"proxy-authorization": authorization,
authorization
};
}
return {};
};
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/h1-over-h2.js
var require_h1_over_h2 = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/h1-over-h2.js"(exports, module) {
"use strict";
init_cjs_shims();
var tls = __require("tls"), http3 = __require("http"), https2 = __require("https"), JSStreamSocket = require_js_stream_socket(), { globalAgent } = require_agent(), UnexpectedStatusCodeError = require_unexpected_status_code_error(), initialize = require_initialize(), getAuthorizationHeaders = require_get_auth_headers(), createConnection = (self, options, callback) => {
(async () => {
try {
let { proxyOptions } = self, { url, headers, raw } = proxyOptions, stream2 = await globalAgent.request(url, proxyOptions, {
...getAuthorizationHeaders(self),
...headers,
":method": "CONNECT",
":authority": `${options.host}:${options.port}`
});
stream2.once("error", callback), stream2.once("response", (headers2) => {
let statusCode = headers2[":status"];
if (statusCode !== 200) {
callback(new UnexpectedStatusCodeError(statusCode, ""));
return;
}
let encrypted = self instanceof https2.Agent;
if (raw && encrypted) {
options.socket = stream2;
let secureStream = tls.connect(options);
secureStream.once("close", () => {
stream2.destroy();
}), callback(null, secureStream);
return;
}
let socket = new JSStreamSocket(stream2);
socket.encrypted = !1, socket._handle.getpeername = (out) => {
out.family = void 0, out.address = void 0, out.port = void 0;
}, callback(null, socket);
});
} catch (error) {
callback(error);
}
})();
}, HttpOverHttp2 = class extends http3.Agent {
constructor(options) {
super(options), initialize(this, options.proxyOptions);
}
createConnection(options, callback) {
createConnection(this, options, callback);
}
}, HttpsOverHttp2 = class extends https2.Agent {
constructor(options) {
super(options), initialize(this, options.proxyOptions);
}
createConnection(options, callback) {
createConnection(this, options, callback);
}
};
module.exports = {
HttpOverHttp2,
HttpsOverHttp2
};
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/h2-over-hx.js
var require_h2_over_hx = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/h2-over-hx.js"(exports, module) {
"use strict";
init_cjs_shims();
var { Agent } = require_agent(), JSStreamSocket = require_js_stream_socket(), UnexpectedStatusCodeError = require_unexpected_status_code_error(), initialize = require_initialize(), Http2OverHttpX = class extends Agent {
constructor(options) {
super(options), initialize(this, options.proxyOptions);
}
async createConnection(origin, options) {
let authority = `${origin.hostname}:${origin.port || 443}`, [stream2, statusCode, statusMessage] = await this._getProxyStream(authority);
if (statusCode !== 200)
throw new UnexpectedStatusCodeError(statusCode, statusMessage);
if (this.proxyOptions.raw)
options.socket = stream2;
else {
let socket = new JSStreamSocket(stream2);
return socket.encrypted = !1, socket._handle.getpeername = (out) => {
out.family = void 0, out.address = void 0, out.port = void 0;
}, socket;
}
return super.createConnection(origin, options);
}
};
module.exports = Http2OverHttpX;
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/h2-over-h2.js
var require_h2_over_h2 = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/h2-over-h2.js"(exports, module) {
"use strict";
init_cjs_shims();
var { globalAgent } = require_agent(), Http2OverHttpX = require_h2_over_hx(), getAuthorizationHeaders = require_get_auth_headers(), getStatusCode = (stream2) => new Promise((resolve, reject) => {
stream2.once("error", reject), stream2.once("response", (headers) => {
stream2.off("error", reject), resolve(headers[":status"]);
});
}), Http2OverHttp2 = class extends Http2OverHttpX {
async _getProxyStream(authority) {
let { proxyOptions } = this, headers = {
...getAuthorizationHeaders(this),
...proxyOptions.headers,
":method": "CONNECT",
":authority": authority
}, stream2 = await globalAgent.request(proxyOptions.url, proxyOptions, headers), statusCode = await getStatusCode(stream2);
return [stream2, statusCode, ""];
}
};
module.exports = Http2OverHttp2;
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/h2-over-h1.js
var require_h2_over_h1 = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/h2-over-h1.js"(exports, module) {
"use strict";
init_cjs_shims();
var http3 = __require("http"), https2 = __require("https"), Http2OverHttpX = require_h2_over_hx(), getAuthorizationHeaders = require_get_auth_headers(), getStream3 = (request) => new Promise((resolve, reject) => {
let onConnect = (response, socket, head) => {
socket.unshift(head), request.off("error", reject), resolve([socket, response.statusCode, response.statusMessage]);
};
request.once("error", reject), request.once("connect", onConnect);
}), Http2OverHttp = class extends Http2OverHttpX {
async _getProxyStream(authority) {
let { proxyOptions } = this, { url, headers } = this.proxyOptions, request = (url.protocol === "https:" ? https2 : http3).request({
...proxyOptions,
hostname: url.hostname,
port: url.port,
path: authority,
headers: {
...getAuthorizationHeaders(this),
...headers,
host: authority
},
method: "CONNECT"
}).end();
return getStream3(request);
}
};
module.exports = {
Http2OverHttp,
Http2OverHttps: Http2OverHttp
};
}
});
// ../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/index.js
var require_source2 = __commonJS({
"../../node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/index.js"(exports, module) {
"use strict";
init_cjs_shims();
var http22 = __require("http2"), {
Agent,
globalAgent
} = require_agent(), ClientRequest = require_client_request(), IncomingMessage = require_incoming_message(), auto = require_auto(), {
HttpOverHttp2,
HttpsOverHttp2
} = require_h1_over_h2(), Http2OverHttp2 = require_h2_over_h2(), {
Http2OverHttp,
Http2OverHttps
} = require_h2_over_h1(), validateHeaderName = require_validate_header_name(), validateHeaderValue = require_validate_header_value(), request = (url, options, callback) => new ClientRequest(url, options, callback), get = (url, options, callback) => {
let req = new ClientRequest(url, options, callback);
return req.end(), req;
};
module.exports = {
...http22,
ClientRequest,
IncomingMessage,
Agent,
globalAgent,
request,
get,
auto,
proxies: {
HttpOverHttp2,
HttpsOverHttp2,
Http2OverHttp2,
Http2OverHttp,
Http2OverHttps
},
validateHeaderName,
validateHeaderValue
};
}
});
// ../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js
var require_ini = __commonJS({
"../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports) {
init_cjs_shims();
exports.parse = exports.decode = decode;
exports.stringify = exports.encode = encode;
exports.safe = safe;
exports.unsafe = unsafe;
var eol = typeof process < "u" && process.platform === "win32" ? `\r
` : `
`;
function encode(obj, opt) {
var children = [], out = "";
typeof opt == "string" ? opt = {
section: opt,
whitespace: !1
} : (opt = opt || {}, opt.whitespace = opt.whitespace === !0);
var separator = opt.whitespace ? " = " : "=";
return Object.keys(obj).forEach(function(k, _, __) {
var val = obj[k];
val && Array.isArray(val) ? val.forEach(function(item) {
out += safe(k + "[]") + separator + safe(item) + `
`;
}) : val && typeof val == "object" ? children.push(k) : out += safe(k) + separator + safe(val) + eol;
}), opt.section && out.length && (out = "[" + safe(opt.section) + "]" + eol + out), children.forEach(function(k, _, __) {
var nk = dotSplit(k).join("\\."), section = (opt.section ? opt.section + "." : "") + nk, child = encode(obj[k], {
section,
whitespace: opt.whitespace
});
out.length && child.length && (out += eol), out += child;
}), out;
}
function dotSplit(str) {
return str.replace(/\1/g, "LITERAL\\1LITERAL").replace(/\\\./g, "").split(/\./).map(function(part) {
return part.replace(/\1/g, "\\.").replace(/\2LITERAL\\1LITERAL\2/g, "");
});
}
function decode(str) {
var out = {}, p = out, section = null, re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i, lines = str.split(/[\r\n]+/g);
return lines.forEach(function(line, _, __) {
if (!(!line || line.match(/^\s*[;#]/))) {
var match = line.match(re);
if (match) {
if (match[1] !== void 0) {
if (section = unsafe(match[1]), section === "__proto__") {
p = {};
return;
}
p = out[section] = out[section] || {};
return;
}
var key = unsafe(match[2]);
if (key !== "__proto__") {
var value = match[3] ? unsafe(match[4]) : !0;
switch (value) {
case "true":
case "false":
case "null":
value = JSON.parse(value);
}
if (key.length > 2 && key.slice(-2) === "[]") {
if (key = key.substring(0, key.length - 2), key === "__proto__")
return;
p[key] ? Array.isArray(p[key]) || (p[key] = [p[key]]) : p[key] = [];
}
Array.isArray(p[key]) ? p[key].push(value) : p[key] = value;
}
}
}
}), Object.keys(out).filter(function(k, _, __) {
if (!out[k] || typeof out[k] != "object" || Array.isArray(out[k]))
return !1;
var parts = dotSplit(k), p2 = out, l = parts.pop(), nl = l.replace(/\\\./g, ".");
return parts.forEach(function(part, _2, __2) {
part !== "__proto__" && ((!p2[part] || typeof p2[part] != "object") && (p2[part] = {}), p2 = p2[part]);
}), p2 === out && nl === l ? !1 : (p2[nl] = out[k], !0);
}).forEach(function(del, _, __) {
delete out[del];
}), out;
}
function isQuoted(val) {
return val.charAt(0) === '"' && val.slice(-1) === '"' || val.charAt(0) === "'" && val.slice(-1) === "'";
}
function safe(val) {
return typeof val != "string" || val.match(/[=\r\n]/) || val.match(/^\[/) || val.length > 1 && isQuoted(val) || val !== val.trim() ? JSON.stringify(val) : val.replace(/;/g, "\\;").replace(/#/g, "\\#");
}
function unsafe(val, doUnesc) {
if (val = (val || "").trim(), isQuoted(val)) {
val.charAt(0) === "'" && (val = val.substr(1, val.length - 2));
try {
val = JSON.parse(val);
} catch {
}
} else {
for (var esc = !1, unesc = "", i = 0, l = val.length; i < l; i++) {
var c = val.charAt(i);
if (esc)
"\\;#".indexOf(c) !== -1 ? unesc += c : unesc += "\\" + c, esc = !1;
else {
if (";#".indexOf(c) !== -1)
break;
c === "\\" ? esc = !0 : unesc += c;
}
}
return esc && (unesc += "\\"), unesc.trim();
}
return val;
}
}
});
// ../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js
var require_strip_json_comments = __commonJS({
"../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js"(exports, module) {
"use strict";
init_cjs_shims();
var singleComment = 1, multiComment = 2;
function stripWithoutWhitespace() {
return "";
}
function stripWithWhitespace(str, start, end) {
return str.slice(start, end).replace(/\S/g, " ");
}
module.exports = function(str, opts) {
opts = opts || {};
for (var currentChar, nextChar, insideString = !1, insideComment = !1, offset = 0, ret = "", strip = opts.whitespace === !1 ? stripWithoutWhitespace : stripWithWhitespace, i = 0; i < str.length; i++) {
if (currentChar = str[i], nextChar = str[i + 1], !insideComment && currentChar === '"') {
var escaped = str[i - 1] === "\\" && str[i - 2] !== "\\";
escaped || (insideString = !insideString);
}
if (!insideString) {
if (!insideComment && currentChar + nextChar === "//")
ret += str.slice(offset, i), offset = i, insideComment = singleComment, i++;
else if (insideComment === singleComment && currentChar + nextChar === `\r
`) {
i++, insideComment = !1, ret += strip(str, offset, i), offset = i;
continue;
} else if (insideComment === singleComment && currentChar === `
`)
insideComment = !1, ret += strip(str, offset, i), offset = i;
else if (!insideComment && currentChar + nextChar === "/*") {
ret += str.slice(offset, i), offset = i, insideComment = multiComment, i++;
continue;
} else if (insideComment === multiComment && currentChar + nextChar === "*/") {
i++, insideComment = !1, ret += strip(str, offset, i + 1), offset = i + 1;
continue;
}
}
}
return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
};
}
});
// ../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js
var require_utils = __commonJS({
"../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports) {
"use strict";
init_cjs_shims();
var fs = __require("fs"), ini = require_ini(), path = __require("path"), stripJsonComments = require_strip_json_comments(), parse = exports.parse = function(content) {
return /^\s*{/.test(content) ? JSON.parse(stripJsonComments(content)) : ini.parse(content);
}, file = exports.file = function() {
var args = [].slice.call(arguments).filter(function(arg) {
return arg != null;
});
for (var i in args)
if (typeof args[i] != "string")
return;
var file2 = path.join.apply(null, args), content;
try {
return fs.readFileSync(file2, "utf-8");
} catch {
return;
}
}, json = exports.json = function() {
var content = file.apply(null, arguments);
return content ? parse(content) : null;
}, env = exports.env = function(prefix, env2) {
env2 = env2 || process.env;
var obj = {}, l = prefix.length;
for (var k in env2)
if (k.toLowerCase().indexOf(prefix.toLowerCase()) === 0) {
for (var keypath = k.substring(l).split("__"), _emptyStringIndex; (_emptyStringIndex = keypath.indexOf("")) > -1; )
keypath.splice(_emptyStringIndex, 1);
var cursor = obj;
keypath.forEach(function(_subkey, i) {
!_subkey || typeof cursor != "object" || (i === keypath.length - 1 && (cursor[_subkey] = env2[k]), cursor[_subkey] === void 0 && (cursor[_subkey] = {}), cursor = cursor[_subkey]);
});
}
return obj;
}, find = exports.find = function() {
var rel = path.join.apply(null, [].slice.call(arguments));
function find2(start, rel2) {
var file2 = path.join(start, rel2);
try {
return fs.statSync(file2), file2;
} catch {
if (path.dirname(start) !== start)
return find2(path.dirname(start), rel2);
}
}
return find2(process.cwd(), rel);
};
}
});
// ../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js
var require_deep_extend = __commonJS({
"../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js"(exports, module) {
"use strict";
init_cjs_shims();
function isSpecificValue(val) {
return val instanceof Buffer || val instanceof Date || val instanceof RegExp;
}
function cloneSpecificValue(val) {
if (val instanceof Buffer) {
var x = Buffer.alloc ? Buffer.alloc(val.length) : new Buffer(val.length);
return val.copy(x), x;
} else {
if (val instanceof Date)
return new Date(val.getTime());
if (val instanceof RegExp)
return new RegExp(val);
throw new Error("Unexpected situation");
}
}
function deepCloneArray(arr) {
var clone = [];
return arr.forEach(function(item, index) {
typeof item == "object" && item !== null ? Array.isArray(item) ? clone[index] = deepCloneArray(item) : isSpecificValue(item) ? clone[index] = cloneSpecificValue(item) : clone[index] = deepExtend({}, item) : clone[index] = item;
}), clone;
}
function safeGetProperty(object, property) {
return property === "__proto__" ? void 0 : object[property];
}
var deepExtend = module.exports = function() {
if (arguments.length < 1 || typeof arguments[0] != "object")
return !1;
if (arguments.length < 2)
return arguments[0];
var target = arguments[0], args = Array.prototype.slice.call(arguments, 1), val, src, clone;
return args.forEach(function(obj) {
typeof obj != "object" || obj === null || Array.isArray(obj) || Object.keys(obj).forEach(function(key) {
if (src = safeGetProperty(target, key), val = safeGetProperty(obj, key), val !== target)
if (typeof val != "object" || val === null) {
target[key] = val;
return;
} else if (Array.isArray(val)) {
target[key] = deepCloneArray(val);
return;
} else if (isSpecificValue(val)) {
target[key] = cloneSpecificValue(val);
return;
} else if (typeof src != "object" || src === null || Array.isArray(src)) {
target[key] = deepExtend({}, val);
return;
} else {
target[key] = deepExtend(src, val);
return;
}
});
}), target;
};
}
});
// ../../node_modules/.pnpm/minimist@1.2.8/node_modules/minimist/index.js
var require_minimist = __commonJS({
"../../node_modules/.pnpm/minimist@1.2.8/node_modules/minimist/index.js"(exports, module) {
"use strict";
init_cjs_shims();
function hasKey(obj, keys) {
var o = obj;
keys.slice(0, -1).forEach(function(key2) {
o = o[key2] || {};
});
var key = keys[keys.length - 1];
return key in o;
}
function isNumber(x) {
return typeof x == "number" || /^0x[0-9a-f]+$/i.test(x) ? !0 : /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
}
function isConstructorOrProto(obj, key) {
return key === "constructor" && typeof obj[key] == "function" || key === "__proto__";
}
module.exports = function(args, opts) {
opts || (opts = {});
var flags = {
bools: {},
strings: {},
unknownFn: null
};
typeof opts.unknown == "function" && (flags.unknownFn = opts.unknown), typeof opts.boolean == "boolean" && opts.boolean ? flags.allBools = !0 : [].concat(opts.boolean).filter(Boolean).forEach(function(key2) {
flags.bools[key2] = !0;
});
var aliases2 = {};
function aliasIsBoolean(key2) {
return aliases2[key2].some(function(x) {
return flags.bools[x];
});
}
Object.keys(opts.alias || {}).forEach(function(key2) {
aliases2[key2] = [].concat(opts.alias[key2]), aliases2[key2].forEach(function(x) {
aliases2[x] = [key2].concat(aliases2[key2].filter(function(y) {
return x !== y;
}));
});
}), [].concat(opts.string).filter(Boolean).forEach(function(key2) {
flags.strings[key2] = !0, aliases2[key2] && [].concat(aliases2[key2]).forEach(function(k) {
flags.strings[k] = !0;
});
});
var defaults2 = opts.default || {}, argv = { _: [] };
function argDefined(key2, arg2) {
return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key2] || flags.bools[key2] || aliases2[key2];
}
function setKey(obj, keys, value2) {
for (var o = obj, i2 = 0; i2 < keys.length - 1; i2++) {
var key2 = keys[i2];
if (isConstructorOrProto(o, key2))
return;
o[key2] === void 0 && (o[key2] = {}), (o[key2] === Object.prototype || o[key2] === Number.prototype || o[key2] === String.prototype) && (o[key2] = {}), o[key2] === Array.prototype && (o[key2] = []), o = o[key2];
}
var lastKey = keys[keys.length - 1];
isConstructorOrProto(o, lastKey) || ((o === Object.prototype || o === Number.prototype || o === String.prototype) && (o = {}), o === Array.prototype && (o = []), o[lastKey] === void 0 || flags.bools[lastKey] || typeof o[lastKey] == "boolean" ? o[lastKey] = value2 : Array.isArray(o[lastKey]) ? o[lastKey].push(value2) : o[lastKey] = [o[lastKey], value2]);
}
function setArg(key2, val, arg2) {
if (!(arg2 && flags.unknownFn && !argDefined(key2, arg2) && flags.unknownFn(arg2) === !1)) {
var value2 = !flags.strings[key2] && isNumber(val) ? Number(val) : val;
setKey(argv, key2.split("."), value2), (aliases2[key2] || []).forEach(function(x) {
setKey(argv, x.split("."), value2);
});
}
}
Object.keys(flags.bools).forEach(function(key2) {
setArg(key2, defaults2[key2] === void 0 ? !1 : defaults2[key2]);
});
var notFlags = [];
args.indexOf("--") !== -1 && (notFlags = args.slice(args.indexOf("--") + 1), args = args.slice(0, args.indexOf("--")));
for (var i = 0; i < args.length; i++) {
var arg = args[i], key, next;
if (/^--.+=/.test(arg)) {
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
key = m[1];
var value = m[2];
flags.bools[key] && (value = value !== "false"), setArg(key, value, arg);
} else if (/^--no-.+/.test(arg))
key = arg.match(/^--no-(.+)/)[1], setArg(key, !1, arg);
else if (/^--.+/.test(arg))
key = arg.match(/^--(.+)/)[1], next = args[i + 1], next !== void 0 && !/^(-|--)[^-]/.test(next) && !flags.bools[key] && !flags.allBools && (!aliases2[key] || !aliasIsBoolean(key)) ? (setArg(key, next, arg), i += 1) : /^(true|false)$/.test(next) ? (setArg(key, next === "true", arg), i += 1) : setArg(key, flags.strings[key] ? "" : !0, arg);
else if (/^-[^-]+/.test(arg)) {
for (var letters = arg.slice(1, -1).split(""), broken = !1, j = 0; j < letters.length; j++) {
if (next = arg.slice(j + 2), next === "-") {
setArg(letters[j], next, arg);
continue;
}
if (/[A-Za-z]/.test(letters[j]) && next[0] === "=") {
setArg(letters[j], next.slice(1), arg), broken = !0;
break;
}
if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
setArg(letters[j], next, arg), broken = !0;
break;
}
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
setArg(letters[j], arg.slice(j + 2), arg), broken = !0;
break;
} else
setArg(letters[j], flags.strings[letters[j]] ? "" : !0, arg);
}
key = arg.slice(-1)[0], !broken && key !== "-" && (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key] && (!aliases2[key] || !aliasIsBoolean(key)) ? (setArg(key, args[i + 1], arg), i += 1) : args[i + 1] && /^(true|false)$/.test(args[i + 1]) ? (setArg(key, args[i + 1] === "true", arg), i += 1) : setArg(key, flags.strings[key] ? "" : !0, arg));
} else if ((!flags.unknownFn || flags.unknownFn(arg) !== !1) && argv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg)), opts.stopEarly) {
argv._.push.apply(argv._, args.slice(i + 1));
break;
}
}
return Object.keys(defaults2).forEach(function(k) {
hasKey(argv, k.split(".")) || (setKey(argv, k.split("."), defaults2[k]), (aliases2[k] || []).forEach(function(x) {
setKey(argv, x.split("."), defaults2[k]);
}));
}), opts["--"] ? argv["--"] = notFlags.slice() : notFlags.forEach(function(k) {
argv._.push(k);
}), argv;
};
}
});
// ../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js
var require_rc = __commonJS({
"../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports, module) {
init_cjs_shims();
var cc = require_utils(), join = __require("path").join, deepExtend = require_deep_extend(), etc = "/etc", win = process.platform === "win32", home = win ? process.env.USERPROFILE : process.env.HOME;
module.exports = function(name, defaults2, argv, parse) {
if (typeof name != "string")
throw new Error("rc(name): name *must* be string");
argv || (argv = require_minimist()(process.argv.slice(2))), defaults2 = (typeof defaults2 == "string" ? cc.json(defaults2) : defaults2) || {}, parse = parse || cc.parse;
var env = cc.env(name + "_"), configs = [defaults2], configFiles = [];
function addConfigFile(file) {
if (!(configFiles.indexOf(file) >= 0)) {
var fileConfig = cc.file(file);
fileConfig && (configs.push(parse(fileConfig)), configFiles.push(file));
}
}
return win || [
join(etc, name, "config"),
join(etc, name + "rc")
].forEach(addConfigFile), home && [
join(home, ".config", name, "config"),
join(home, ".config", name),
join(home, "." + name, "config"),
join(home, "." + name + "rc")
].forEach(addConfigFile), addConfigFile(cc.find("." + name + "rc")), env.config && addConfigFile(env.config), argv.config && addConfigFile(argv.config), deepExtend.apply(null, configs.concat([
env,
argv,
configFiles.length ? { configs: configFiles, config: configFiles[configFiles.length - 1] } : void 0
]));
};
}
});
// ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/polyfills.js
var require_polyfills = __commonJS({
"../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/polyfills.js"(exports, module) {
init_cjs_shims();
var constants = __require("constants"), origCwd = process.cwd, cwd = null, platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
process.cwd = function() {
return cwd || (cwd = origCwd.call(process)), cwd;
};
try {
process.cwd();
} catch {
}
typeof process.chdir == "function" && (chdir = process.chdir, process.chdir = function(d) {
cwd = null, chdir.call(process, d);
}, Object.setPrototypeOf && Object.setPrototypeOf(process.chdir, chdir));
var chdir;
module.exports = patch;
function patch(fs) {
constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./) && patchLchmod(fs), fs.lutimes || patchLutimes(fs), fs.chown = chownFix(fs.chown), fs.fchown = chownFix(fs.fchown), fs.lchown = chownFix(fs.lchown), fs.chmod = chmodFix(fs.chmod), fs.fchmod = chmodFix(fs.fchmod), fs.lchmod = chmodFix(fs.lchmod), fs.chownSync = chownFixSync(fs.chownSync), fs.fchownSync = chownFixSync(fs.fchownSync), fs.lchownSync = chownFixSync(fs.lchownSync), fs.chmodSync = chmodFixSync(fs.chmodSync), fs.fchmodSync = chmodFixSync(fs.fchmodSync), fs.lchmodSync = chmodFixSync(fs.lchmodSync), fs.stat = statFix(fs.stat), fs.fstat = statFix(fs.fstat), fs.lstat = statFix(fs.lstat), fs.statSync = statFixSync(fs.statSync), fs.fstatSync = statFixSync(fs.fstatSync), fs.lstatSync = statFixSync(fs.lstatSync), fs.chmod && !fs.lchmod && (fs.lchmod = function(path, mode, cb) {
cb && process.nextTick(cb);
}, fs.lchmodSync = function() {
}), fs.chown && !fs.lchown && (fs.lchown = function(path, uid, gid, cb) {
cb && process.nextTick(cb);
}, fs.lchownSync = function() {
}), platform === "win32" && (fs.rename = typeof fs.rename != "function" ? fs.rename : (function(fs$rename) {
function rename(from, to, cb) {
var start = Date.now(), backoff = 0;
fs$rename(from, to, function CB(er) {
if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) {
setTimeout(function() {
fs.stat(to, function(stater, st) {
stater && stater.code === "ENOENT" ? fs$rename(from, to, CB) : cb(er);
});
}, backoff), backoff < 100 && (backoff += 10);
return;
}
cb && cb(er);
});
}
return Object.setPrototypeOf && Object.setPrototypeOf(rename, fs$rename), rename;
})(fs.rename)), fs.read = typeof fs.read != "function" ? fs.read : (function(fs$read) {
function read(fd, buffer, offset, length, position, callback_) {
var callback;
if (callback_ && typeof callback_ == "function") {
var eagCounter = 0;
callback = function(er, _, __) {
if (er && er.code === "EAGAIN" && eagCounter < 10)
return eagCounter++, fs$read.call(fs, fd, buffer, offset, length, position, callback);
callback_.apply(this, arguments);
};
}
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
}
return Object.setPrototypeOf && Object.setPrototypeOf(read, fs$read), read;
})(fs.read), fs.readSync = typeof fs.readSync != "function" ? fs.readSync : /* @__PURE__ */ (function(fs$readSync) {
return function(fd, buffer, offset, length, position) {
for (var eagCounter = 0; ; )
try {
return fs$readSync.call(fs, fd, buffer, offset, length, position);
} catch (er) {
if (er.code === "EAGAIN" && eagCounter < 10) {
eagCounter++;
continue;
}
throw er;
}
};
})(fs.readSync);
function patchLchmod(fs2) {
fs2.lchmod = function(path, mode, callback) {
fs2.open(
path,
constants.O_WRONLY | constants.O_SYMLINK,
mode,
function(err, fd) {
if (err) {
callback && callback(err);
return;
}
fs2.fchmod(fd, mode, function(err2) {
fs2.close(fd, function(err22) {
callback && callback(err2 || err22);
});
});
}
);
}, fs2.lchmodSync = function(path, mode) {
var fd = fs2.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode), threw = !0, ret;
try {
ret = fs2.fchmodSync(fd, mode), threw = !1;
} finally {
if (threw)
try {
fs2.closeSync(fd);
} catch {
}
else
fs2.closeSync(fd);
}
return ret;
};
}
function patchLutimes(fs2) {
constants.hasOwnProperty("O_SYMLINK") && fs2.futimes ? (fs2.lutimes = function(path, at, mt, cb) {
fs2.open(path, constants.O_SYMLINK, function(er, fd) {
if (er) {
cb && cb(er);
return;
}
fs2.futimes(fd, at, mt, function(er2) {
fs2.close(fd, function(er22) {
cb && cb(er2 || er22);
});
});
});
}, fs2.lutimesSync = function(path, at, mt) {
var fd = fs2.openSync(path, constants.O_SYMLINK), ret, threw = !0;
try {
ret = fs2.futimesSync(fd, at, mt), threw = !1;
} finally {
if (threw)
try {
fs2.closeSync(fd);
} catch {
}
else
fs2.closeSync(fd);
}
return ret;
}) : fs2.futimes && (fs2.lutimes = function(_a, _b, _c, cb) {
cb && process.nextTick(cb);
}, fs2.lutimesSync = function() {
});
}
function chmodFix(orig) {
return orig && function(target, mode, cb) {
return orig.call(fs, target, mode, function(er) {
chownErOk(er) && (er = null), cb && cb.apply(this, arguments);
});
};
}
function chmodFixSync(orig) {
return orig && function(target, mode) {
try {
return orig.call(fs, target, mode);
} catch (er) {
if (!chownErOk(er)) throw er;
}
};
}
function chownFix(orig) {
return orig && function(target, uid, gid, cb) {
return orig.call(fs, target, uid, gid, function(er) {
chownErOk(er) && (er = null), cb && cb.apply(this, arguments);
});
};
}
function chownFixSync(orig) {
return orig && function(target, uid, gid) {
try {
return orig.call(fs, target, uid, gid);
} catch (er) {
if (!chownErOk(er)) throw er;
}
};
}
function statFix(orig) {
return orig && function(target, options, cb) {
typeof options == "function" && (cb = options, options = null);
function callback(er, stats) {
stats && (stats.uid < 0 && (stats.uid += 4294967296), stats.gid < 0 && (stats.gid += 4294967296)), cb && cb.apply(this, arguments);
}
return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
};
}
function statFixSync(orig) {
return orig && function(target, options) {
var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
return stats && (stats.uid < 0 && (stats.uid += 4294967296), stats.gid < 0 && (stats.gid += 4294967296)), stats;
};
}
function chownErOk(er) {
if (!er || er.code === "ENOSYS")
return !0;
var nonroot = !process.getuid || process.getuid() !== 0;
return !!(nonroot && (er.code === "EINVAL" || er.code === "EPERM"));
}
}
}
});
// ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/legacy-streams.js
var require_legacy_streams = __commonJS({
"../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/legacy-streams.js"(exports, module) {
init_cjs_shims();
var Stream = __require("stream").Stream;
module.exports = legacy;
function legacy(fs) {
return {
ReadStream,
WriteStream
};
function ReadStream(path, options) {
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
Stream.call(this);
var self = this;
this.path = path, this.fd = null, this.readable = !0, this.paused = !1, this.flags = "r", this.mode = 438, this.bufferSize = 64 * 1024, options = options || {};
for (var keys = Object.keys(options), index = 0, length = keys.length; index < length; index++) {
var key = keys[index];
this[key] = options[key];
}
if (this.encoding && this.setEncoding(this.encoding), this.start !== void 0) {
if (typeof this.start != "number")
throw TypeError("start must be a Number");
if (this.end === void 0)
this.end = 1 / 0;
else if (typeof this.end != "number")
throw TypeError("end must be a Number");
if (this.start > this.end)
throw new Error("start must be <= end");
this.pos = this.start;
}
if (this.fd !== null) {
process.nextTick(function() {
self._read();
});
return;
}
fs.open(this.path, this.flags, this.mode, function(err, fd) {
if (err) {
self.emit("error", err), self.readable = !1;
return;
}
self.fd = fd, self.emit("open", fd), self._read();
});
}
function WriteStream(path, options) {
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
Stream.call(this), this.path = path, this.fd = null, this.writable = !0, this.flags = "w", this.encoding = "binary", this.mode = 438, this.bytesWritten = 0, options = options || {};
for (var keys = Object.keys(options), index = 0, length = keys.length; index < length; index++) {
var key = keys[index];
this[key] = options[key];
}
if (this.start !== void 0) {
if (typeof this.start != "number")
throw TypeError("start must be a Number");
if (this.start < 0)
throw new Error("start must be >= zero");
this.pos = this.start;
}
this.busy = !1, this._queue = [], this.fd === null && (this._open = fs.open, this._queue.push([this._open, this.path, this.flags, this.mode, void 0]), this.flush());
}
}
}
});
// ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/clone.js
var require_clone = __commonJS({
"../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/clone.js"(exports, module) {
"use strict";
init_cjs_shims();
module.exports = clone;
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
return obj.__proto__;
};
function clone(obj) {
if (obj === null || typeof obj != "object")
return obj;
if (obj instanceof Object)
var copy = { __proto__: getPrototypeOf(obj) };
else
var copy = /* @__PURE__ */ Object.create(null);
return Object.getOwnPropertyNames(obj).forEach(function(key) {
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
}), copy;
}
}
});
// ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/graceful-fs.js
var require_graceful_fs = __commonJS({
"../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/graceful-fs.js"(exports, module) {
init_cjs_shims();
var fs = __require("fs"), polyfills = require_polyfills(), legacy = require_legacy_streams(), clone = require_clone(), util = __require("util"), gracefulQueue, previousSymbol;
typeof Symbol == "function" && typeof Symbol.for == "function" ? (gracefulQueue = /* @__PURE__ */ Symbol.for("graceful-fs.queue"), previousSymbol = /* @__PURE__ */ Symbol.for("graceful-fs.previous")) : (gracefulQueue = "___graceful-fs.queue", previousSymbol = "___graceful-fs.previous");
function noop3() {
}
function publishQueue(context, queue2) {
Object.defineProperty(context, gracefulQueue, {
get: function() {
return queue2;
}
});
}
var debug = noop3;
util.debuglog ? debug = util.debuglog("gfs4") : /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && (debug = function() {
var m = util.format.apply(util, arguments);
m = "GFS4: " + m.split(/\n/).join(`
GFS4: `), console.error(m);
});
fs[gracefulQueue] || (queue = global[gracefulQueue] || [], publishQueue(fs, queue), fs.close = (function(fs$close) {
function close(fd, cb) {
return fs$close.call(fs, fd, function(err) {
err || resetQueue(), typeof cb == "function" && cb.apply(this, arguments);
});
}
return Object.defineProperty(close, previousSymbol, {
value: fs$close
}), close;
})(fs.close), fs.closeSync = (function(fs$closeSync) {
function closeSync(fd) {
fs$closeSync.apply(fs, arguments), resetQueue();
}
return Object.defineProperty(closeSync, previousSymbol, {
value: fs$closeSync
}), closeSync;
})(fs.closeSync), /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && process.on("exit", function() {
debug(fs[gracefulQueue]), __require("assert").equal(fs[gracefulQueue].length, 0);
}));
var queue;
global[gracefulQueue] || publishQueue(global, fs[gracefulQueue]);
module.exports = patch(clone(fs));
process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched && (module.exports = patch(fs), fs.__patched = !0);
function patch(fs2) {
polyfills(fs2), fs2.gracefulify = patch, fs2.createReadStream = createReadStream, fs2.createWriteStream = createWriteStream;
var fs$readFile = fs2.readFile;
fs2.readFile = readFile;
function readFile(path, options, cb) {
return typeof options == "function" && (cb = options, options = null), go$readFile(path, options, cb);
function go$readFile(path2, options2, cb2, startTime) {
return fs$readFile(path2, options2, function(err) {
err && (err.code === "EMFILE" || err.code === "ENFILE") ? enqueue([go$readFile, [path2, options2, cb2], err, startTime || Date.now(), Date.now()]) : typeof cb2 == "function" && cb2.apply(this, arguments);
});
}
}
var fs$writeFile = fs2.writeFile;
fs2.writeFile = writeFile;
function writeFile(path, data, options, cb) {
return typeof options == "function" && (cb = options, options = null), go$writeFile(path, data, options, cb);
function go$writeFile(path2, data2, options2, cb2, startTime) {
return fs$writeFile(path2, data2, options2, function(err) {
err && (err.code === "EMFILE" || err.code === "ENFILE") ? enqueue([go$writeFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]) : typeof cb2 == "function" && cb2.apply(this, arguments);
});
}
}
var fs$appendFile = fs2.appendFile;
fs$appendFile && (fs2.appendFile = appendFile);
function appendFile(path, data, options, cb) {
return typeof options == "function" && (cb = options, options = null), go$appendFile(path, data, options, cb);
function go$appendFile(path2, data2, options2, cb2, startTime) {
return fs$appendFile(path2, data2, options2, function(err) {
err && (err.code === "EMFILE" || err.code === "ENFILE") ? enqueue([go$appendFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]) : typeof cb2 == "function" && cb2.apply(this, arguments);
});
}
}
var fs$copyFile = fs2.copyFile;
fs$copyFile && (fs2.copyFile = copyFile);
function copyFile(src, dest, flags, cb) {
return typeof flags == "function" && (cb = flags, flags = 0), go$copyFile(src, dest, flags, cb);
function go$copyFile(src2, dest2, flags2, cb2, startTime) {
return fs$copyFile(src2, dest2, flags2, function(err) {
err && (err.code === "EMFILE" || err.code === "ENFILE") ? enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]) : typeof cb2 == "function" && cb2.apply(this, arguments);
});
}
}
var fs$readdir = fs2.readdir;
fs2.readdir = readdir;
var noReaddirOptionVersions = /^v[0-5]\./;
function readdir(path, options, cb) {
typeof options == "function" && (cb = options, options = null);
var go$readdir = noReaddirOptionVersions.test(process.version) ? function(path2, options2, cb2, startTime) {
return fs$readdir(path2, fs$readdirCallback(
path2,
options2,
cb2,
startTime
));
} : function(path2, options2, cb2, startTime) {
return fs$readdir(path2, options2, fs$readdirCallback(
path2,
options2,
cb2,
startTime
));
};
return go$readdir(path, options, cb);
function fs$readdirCallback(path2, options2, cb2, startTime) {
return function(err, files) {
err && (err.code === "EMFILE" || err.code === "ENFILE") ? enqueue([
go$readdir,
[path2, options2, cb2],
err,
startTime || Date.now(),
Date.now()
]) : (files && files.sort && files.sort(), typeof cb2 == "function" && cb2.call(this, err, files));
};
}
}
if (process.version.substr(0, 4) === "v0.8") {
var legStreams = legacy(fs2);
ReadStream = legStreams.ReadStream, WriteStream = legStreams.WriteStream;
}
var fs$ReadStream = fs2.ReadStream;
fs$ReadStream && (ReadStream.prototype = Object.create(fs$ReadStream.prototype), ReadStream.prototype.open = ReadStream$open);
var fs$WriteStream = fs2.WriteStream;
fs$WriteStream && (WriteStream.prototype = Object.create(fs$WriteStream.prototype), WriteStream.prototype.open = WriteStream$open), Object.defineProperty(fs2, "ReadStream", {
get: function() {
return ReadStream;
},
set: function(val) {
ReadStream = val;
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(fs2, "WriteStream", {
get: function() {
return WriteStream;
},
set: function(val) {
WriteStream = val;
},
enumerable: !0,
configurable: !0
});
var FileReadStream = ReadStream;
Object.defineProperty(fs2, "FileReadStream", {
get: function() {
return FileReadStream;
},
set: function(val) {
FileReadStream = val;
},
enumerable: !0,
configurable: !0
});
var FileWriteStream = WriteStream;
Object.defineProperty(fs2, "FileWriteStream", {
get: function() {
return FileWriteStream;
},
set: function(val) {
FileWriteStream = val;
},
enumerable: !0,
configurable: !0
});
function ReadStream(path, options) {
return this instanceof ReadStream ? (fs$ReadStream.apply(this, arguments), this) : ReadStream.apply(Object.create(ReadStream.prototype), arguments);
}
function ReadStream$open() {
var that = this;
open(that.path, that.flags, that.mode, function(err, fd) {
err ? (that.autoClose && that.destroy(), that.emit("error", err)) : (that.fd = fd, that.emit("open", fd), that.read());
});
}
function WriteStream(path, options) {
return this instanceof WriteStream ? (fs$WriteStream.apply(this, arguments), this) : WriteStream.apply(Object.create(WriteStream.prototype), arguments);
}
function WriteStream$open() {
var that = this;
open(that.path, that.flags, that.mode, function(err, fd) {
err ? (that.destroy(), that.emit("error", err)) : (that.fd = fd, that.emit("open", fd));
});
}
function createReadStream(path, options) {
return new fs2.ReadStream(path, options);
}
function createWriteStream(path, options) {
return new fs2.WriteStream(path, options);
}
var fs$open = fs2.open;
fs2.open = open;
function open(path, flags, mode, cb) {
return typeof mode == "function" && (cb = mode, mode = null), go$open(path, flags, mode, cb);
function go$open(path2, flags2, mode2, cb2, startTime) {
return fs$open(path2, flags2, mode2, function(err, fd) {
err && (err.code === "EMFILE" || err.code === "ENFILE") ? enqueue([go$open, [path2, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]) : typeof cb2 == "function" && cb2.apply(this, arguments);
});
}
}
return fs2;
}
function enqueue(elem) {
debug("ENQUEUE", elem[0].name, elem[1]), fs[gracefulQueue].push(elem), retry();
}
var retryTimer;
function resetQueue() {
for (var now = Date.now(), i = 0; i < fs[gracefulQueue].length; ++i)
fs[gracefulQueue][i].length > 2 && (fs[gracefulQueue][i][3] = now, fs[gracefulQueue][i][4] = now);
retry();
}
function retry() {
if (clearTimeout(retryTimer), retryTimer = void 0, fs[gracefulQueue].length !== 0) {
var elem = fs[gracefulQueue].shift(), fn = elem[0], args = elem[1], err = elem[2], startTime = elem[3], lastTime = elem[4];
if (startTime === void 0)
debug("RETRY", fn.name, args), fn.apply(null, args);
else if (Date.now() - startTime >= 6e4) {
debug("TIMEOUT", fn.name, args);
var cb = args.pop();
typeof cb == "function" && cb.call(null, err);
} else {
var sinceAttempt = Date.now() - lastTime, sinceStart = Math.max(lastTime - startTime, 1), desiredDelay = Math.min(sinceStart * 1.2, 100);
sinceAttempt >= desiredDelay ? (debug("RETRY", fn.name, args), fn.apply(null, args.concat([startTime]))) : fs[gracefulQueue].push(elem);
}
retryTimer === void 0 && (retryTimer = setTimeout(retry, 0));
}
}
}
});
// ../../node_modules/.pnpm/@pnpm+network.ca-file@1.0.2/node_modules/@pnpm/network.ca-file/dist/ca-file.js
var require_ca_file = __commonJS({
"../../node_modules/.pnpm/@pnpm+network.ca-file@1.0.2/node_modules/@pnpm/network.ca-file/dist/ca-file.js"(exports) {
"use strict";
init_cjs_shims();
var __importDefault = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { default: mod };
};
Object.defineProperty(exports, "__esModule", { value: !0 });
exports.readCAFileSync = void 0;
var graceful_fs_1 = __importDefault(require_graceful_fs());
function readCAFileSync(filePath) {
try {
let contents = graceful_fs_1.default.readFileSync(filePath, "utf8"), delim = "-----END CERTIFICATE-----";
return contents.split(delim).filter((ca) => !!ca.trim()).map((ca) => `${ca.trimLeft()}${delim}`);
} catch (err) {
if (err.code === "ENOENT")
return;
throw err;
}
}
exports.readCAFileSync = readCAFileSync;
}
});
// ../../node_modules/.pnpm/@pnpm+network.ca-file@1.0.2/node_modules/@pnpm/network.ca-file/dist/index.js
var require_dist = __commonJS({
"../../node_modules/.pnpm/@pnpm+network.ca-file@1.0.2/node_modules/@pnpm/network.ca-file/dist/index.js"(exports) {
"use strict";
init_cjs_shims();
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
k2 === void 0 && (k2 = k);
var desc = Object.getOwnPropertyDescriptor(m, k);
(!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) && (desc = { enumerable: !0, get: function() {
return m[k];
} }), Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
k2 === void 0 && (k2 = k), o[k2] = m[k];
})), __exportStar = exports && exports.__exportStar || function(m, exports2) {
for (var p in m) p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p) && __createBinding(exports2, m, p);
};
Object.defineProperty(exports, "__esModule", { value: !0 });
__exportStar(require_ca_file(), exports);
}
});
// ../../node_modules/.pnpm/proto-list@1.2.4/node_modules/proto-list/proto-list.js
var require_proto_list = __commonJS({
"../../node_modules/.pnpm/proto-list@1.2.4/node_modules/proto-list/proto-list.js"(exports, module) {
init_cjs_shims();
module.exports = ProtoList;
function setProto(obj, proto) {
if (typeof Object.setPrototypeOf == "function")
return Object.setPrototypeOf(obj, proto);
obj.__proto__ = proto;
}
function ProtoList() {
this.list = [];
var root = null;
Object.defineProperty(this, "root", {
get: function() {
return root;
},
set: function(r) {
root = r, this.list.length && setProto(this.list[this.list.length - 1], r);
},
enumerable: !0,
configurable: !0
});
}
ProtoList.prototype = {
get length() {
return this.list.length;
},
get keys() {
var k = [];
for (var i in this.list[0]) k.push(i);
return k;
},
get snapshot() {
var o = {};
return this.keys.forEach(function(k) {
o[k] = this.get(k);
}, this), o;
},
get store() {
return this.list[0];
},
push: function(obj) {
return typeof obj != "object" && (obj = { valueOf: obj }), this.list.length >= 1 && setProto(this.list[this.list.length - 1], obj), setProto(obj, this.root), this.list.push(obj);
},
pop: function() {
return this.list.length >= 2 && setProto(this.list[this.list.length - 2], this.root), this.list.pop();
},
unshift: function(obj) {
return setProto(obj, this.list[0] || this.root), this.list.unshift(obj);
},
shift: function() {
return this.list.length === 1 && setProto(this.list[0], this.root), this.list.shift();
},
get: function(key) {
return this.list[0][key];
},
set: function(key, val, save) {
return this.length || this.push({}), save && this.list[0].hasOwnProperty(key) && this.push({}), this.list[0][key] = val;
},
forEach: function(fn, thisp) {
for (var key in this.list[0]) fn.call(thisp, key, this.list[0][key]);
},
slice: function() {
return this.list.slice.apply(this.list, arguments);
},
splice: function() {
for (var ret = this.list.splice.apply(this.list, arguments), i = 0, l = this.list.length; i < l; i++)
setProto(this.list[i], this.list[i + 1] || this.root);
return ret;
}
};
}
});
// ../../node_modules/.pnpm/config-chain@1.1.13/node_modules/config-chain/index.js
var require_config_chain = __commonJS({
"../../node_modules/.pnpm/config-chain@1.1.13/node_modules/config-chain/index.js"(exports, module) {
init_cjs_shims();
var ProtoList = require_proto_list(), path = __require("path"), fs = __require("fs"), ini = require_ini(), EE = __require("events").EventEmitter, url = __require("url"), http3 = __require("http"), exports = module.exports = function() {
for (var args = [].slice.call(arguments), conf = new ConfigChain(); args.length; ) {
var a = args.shift();
a && conf.push(typeof a == "string" ? json(a) : a);
}
return conf;
}, find = exports.find = function() {
var rel = path.join.apply(null, [].slice.call(arguments));
function find2(start, rel2) {
var file = path.join(start, rel2);
try {
return fs.statSync(file), file;
} catch {
if (path.dirname(start) !== start)
return find2(path.dirname(start), rel2);
}
}
return find2(__dirname, rel);
}, parse = exports.parse = function(content, file, type) {
if (content = "" + content, type)
if (type === "json")
if (this.emit)
try {
return JSON.parse(content);
} catch (er) {
this.emit("error", er);
}
else
return JSON.parse(content);
else
return ini.parse(content);
else try {
return JSON.parse(content);
} catch {
return ini.parse(content);
}
}, json = exports.json = function() {
var args = [].slice.call(arguments).filter(function(arg) {
return arg != null;
}), file = path.join.apply(null, args), content;
try {
content = fs.readFileSync(file, "utf-8");
} catch {
return;
}
return parse(content, file, "json");
}, env = exports.env = function(prefix, env2) {
env2 = env2 || process.env;
var obj = {}, l = prefix.length;
for (var k in env2)
k.indexOf(prefix) === 0 && (obj[k.substring(l)] = env2[k]);
return obj;
};
exports.ConfigChain = ConfigChain;
function ConfigChain() {
EE.apply(this), ProtoList.apply(this, arguments), this._awaiting = 0, this._saving = 0, this.sources = {};
}
var extras = {
constructor: { value: ConfigChain }
};
Object.keys(EE.prototype).forEach(function(k) {
extras[k] = Object.getOwnPropertyDescriptor(EE.prototype, k);
});
ConfigChain.prototype = Object.create(ProtoList.prototype, extras);
ConfigChain.prototype.del = function(key, where) {
if (where) {
var target = this.sources[where];
if (target = target && target.data, !target)
return this.emit("error", new Error("not found " + where));
delete target[key];
} else
for (var i = 0, l = this.list.length; i < l; i++)
delete this.list[i][key];
return this;
};
ConfigChain.prototype.set = function(key, value, where) {
var target;
if (where) {
if (target = this.sources[where], target = target && target.data, !target)
return this.emit("error", new Error("not found " + where));
} else if (target = this.list[0], !target)
return this.emit("error", new Error("cannot set, no confs!"));
return target[key] = value, this;
};
ConfigChain.prototype.get = function(key, where) {
return where ? (where = this.sources[where], where && (where = where.data), where && Object.hasOwnProperty.call(where, key) ? where[key] : void 0) : this.list[0][key];
};
ConfigChain.prototype.save = function(where, type, cb) {
typeof type == "function" && (cb = type, type = null);
var target = this.sources[where];
if (!target || !(target.path || target.source) || !target.data)
return this.emit("error", new Error("bad save target: " + where));
if (target.source) {
var pref = target.prefix || "";
return Object.keys(target.data).forEach(function(k) {
target.source[pref + k] = target.data[k];
}), this;
}
var type = type || target.type, data = target.data;
return target.type === "json" ? data = JSON.stringify(data) : data = ini.stringify(data), this._saving++, fs.writeFile(target.path, data, "utf8", function(er) {
if (this._saving--, er)
return cb ? cb(er) : this.emit("error", er);
this._saving === 0 && (cb && cb(), this.emit("save"));
}.bind(this)), this;
};
ConfigChain.prototype.addFile = function(file, type, name) {
name = name || file;
var marker = { __source__: name };
return this.sources[name] = { path: file, type }, this.push(marker), this._await(), fs.readFile(file, "utf8", function(er, data) {
er && this.emit("error", er), this.addString(data, file, type, marker);
}.bind(this)), this;
};
ConfigChain.prototype.addEnv = function(prefix, env2, name) {
name = name || "env";
var data = exports.env(prefix, env2);
return this.sources[name] = { data, source: env2, prefix }, this.add(data, name);
};
ConfigChain.prototype.addUrl = function(req, type, name) {
this._await();
var href = url.format(req);
name = name || href;
var marker = { __source__: name };
return this.sources[name] = { href, type }, this.push(marker), http3.request(req, function(res) {
var c = [], ct = res.headers["content-type"];
type || (type = ct.indexOf("json") !== -1 ? "json" : ct.indexOf("ini") !== -1 ? "ini" : href.match(/\.json$/) ? "json" : href.match(/\.ini$/) ? "ini" : null, marker.type = type), res.on("data", c.push.bind(c)).on("end", function() {
this.addString(Buffer.concat(c), href, type, marker);
}.bind(this)).on("error", this.emit.bind(this, "error"));
}.bind(this)).on("error", this.emit.bind(this, "error")).end(), this;
};
ConfigChain.prototype.addString = function(data, file, type, marker) {
return data = this.parse(data, file, type), this.add(data, marker), this;
};
ConfigChain.prototype.add = function(data, marker) {
if (marker && typeof marker == "object") {
var i = this.list.indexOf(marker);
if (i === -1)
return this.emit("error", new Error("bad marker"));
this.splice(i, 1, data), marker = marker.__source__, this.sources[marker] = this.sources[marker] || {}, this.sources[marker].data = data, this._resolve();
} else
typeof marker == "string" && (this.sources[marker] = this.sources[marker] || {}, this.sources[marker].data = data), this._await(), this.push(data), process.nextTick(this._resolve.bind(this));
return this;
};
ConfigChain.prototype.parse = exports.parse;
ConfigChain.prototype._await = function() {
this._awaiting++;
};
ConfigChain.prototype._resolve = function() {
this._awaiting--, this._awaiting === 0 && this.emit("load", this);
};
}
});
// ../../node_modules/.pnpm/@pnpm+npm-conf@3.0.3/node_modules/@pnpm/npm-conf/lib/envKeyToSetting.js
var require_envKeyToSetting = __commonJS({
"../../node_modules/.pnpm/@pnpm+npm-conf@3.0.3/node_modules/@pnpm/npm-conf/lib/envKeyToSetting.js"(exports, module) {
init_cjs_shims();
module.exports = function(x) {
let colonIndex = x.indexOf(":");
if (colonIndex === -1)
return normalize(x);
let firstPart = x.substr(0, colonIndex), secondPart = x.substr(colonIndex + 1);
return `${firstPart}:${normalize(secondPart)}`;
};
function normalize(s) {
if (s = s.toLowerCase(), s === "_authtoken") return "_authToken";
let r = s[0];
for (let i = 1; i < s.length; i++)
r += s[i] === "_" ? "-" : s[i];
return r;
}
}
});
// ../../node_modules/.pnpm/@pnpm+config.env-replace@1.1.0/node_modules/@pnpm/config.env-replace/dist/env-replace.js
var require_env_replace = __commonJS({
"../../node_modules/.pnpm/@pnpm+config.env-replace@1.1.0/node_modules/@pnpm/config.env-replace/dist/env-replace.js"(exports) {
"use strict";
init_cjs_shims();
Object.defineProperty(exports, "__esModule", { value: !0 });
exports.envReplace = void 0;
var ENV_EXPR = /(?<!\\)(\\*)\$\{([^${}]+)\}/g;
function envReplace(settingValue, env) {
return settingValue.replace(ENV_EXPR, replaceEnvMatch.bind(null, env));
}
exports.envReplace = envReplace;
function replaceEnvMatch(env, orig, escape, name) {
if (escape.length % 2)
return orig.slice((escape.length + 1) / 2);
let envValue = getEnvValue(env, name);
if (envValue === void 0)
throw new Error(`Failed to replace env in config: ${orig}`);
return `${escape.slice(escape.length / 2)}${envValue}`;
}
var ENV_VALUE = /([^:-]+)(:?)-(.+)/;
function getEnvValue(env, name) {
let matched = name.match(ENV_VALUE);
if (!matched)
return env[name];
let [, variableName, colon, fallback] = matched;
return Object.prototype.hasOwnProperty.call(env, variableName) ? !env[variableName] && colon ? fallback : env[variableName] : fallback;
}
}
});
// ../../node_modules/.pnpm/@pnpm+config.env-replace@1.1.0/node_modules/@pnpm/config.env-replace/dist/index.js
var require_dist2 = __commonJS({
"../../node_modules/.pnpm/@pnpm+config.env-replace@1.1.0/node_modules/@pnpm/config.env-replace/dist/index.js"(exports) {
"use strict";
init_cjs_shims();
Object.defineProperty(exports, "__esModule", { value: !0 });
exports.envReplace = void 0;
var env_replace_1 = require_env_replace();
Object.defineProperty(exports, "envReplace", { enumerable: !0, get: function() {
return env_replace_1.envReplace;
} });
}
});
// ../../node_modules/.pnpm/@pnpm+npm-conf@3.0.3/node_modules/@pnpm/npm-conf/lib/util.js
var require_util = __commonJS({
"../../node_modules/.pnpm/@pnpm+npm-conf@3.0.3/node_modules/@pnpm/npm-conf/lib/util.js"(exports) {
"use strict";
init_cjs_shims();
var fs = __require("fs"), path = __require("path"), { envReplace } = require_dist2(), parseKey = (key) => typeof key != "string" ? key : envReplace(key, process.env), parseField = (types2, field, key) => {
if (typeof field != "string")
return field;
let typeList = [].concat(types2[key]), isPath = typeList.indexOf(path) !== -1, isBool = typeList.indexOf(Boolean) !== -1, isString = typeList.indexOf(String) !== -1, isNumber = typeList.indexOf(Number) !== -1;
if (field = `${field}`.trim(), /^".*"$/.test(field))
try {
field = JSON.parse(field);
} catch {
throw new Error(`Failed parsing JSON config key ${key}: ${field}`);
}
if (isBool && !isString && field === "")
return !0;
switch (field) {
// eslint-disable-line default-case
case "true":
return !0;
case "false":
return !1;
case "null":
return null;
case "undefined":
return;
}
let processedField = envReplace(field, process.env);
if ((key.endsWith(":tokenHelper") || key === "tokenHelper") && processedField !== field)
throw new Error(`It is not allowed to use environment variables in the value of the ${key} setting.`);
return field = processedField, isPath && ((process.platform === "win32" ? /^~(\/|\\)/ : /^~\//).test(field) && process.env.HOME && (field = path.resolve(process.env.HOME, field.substr(2))), field = path.resolve(field)), isNumber && !isNaN(field) && (field = Number(field)), field;
}, findPrefix = (name) => {
name = path.resolve(name);
let walkedUp = !1;
for (; path.basename(name) === "node_modules"; )
name = path.dirname(name), walkedUp = !0;
if (walkedUp)
return name;
let find = (name2, original) => {
let regex = /^[a-zA-Z]:(\\|\/)?$/;
if (name2 === "/" || process.platform === "win32" && regex.test(name2))
return original;
try {
let files = fs.readdirSync(name2);
if (files.includes("node_modules") || files.includes("package.json") || files.includes("package.json5") || files.includes("package.yaml") || files.includes("pnpm-workspace.yaml"))
return name2;
let dirname = path.dirname(name2);
return dirname === name2 ? original : find(dirname, original);
} catch (error) {
if (name2 === original) {
if (error.code === "ENOENT")
return original;
throw error;
}
return original;
}
};
return find(name, name);
};
exports.envReplace = envReplace;
exports.findPrefix = findPrefix;
exports.parseField = parseField;
exports.parseKey = parseKey;
}
});
// ../../node_modules/.pnpm/@pnpm+npm-conf@3.0.3/node_modules/@pnpm/npm-conf/lib/types.js
var require_types = __commonJS({
"../../node_modules/.pnpm/@pnpm+npm-conf@3.0.3/node_modules/@pnpm/npm-conf/lib/types.js"(exports) {
"use strict";
init_cjs_shims();
var path = __require("path"), Stream = __require("stream").Stream, url = __require("url"), Umask = () => {
}, getLocalAddresses = () => [], semver2 = () => {
};
exports.types = {
access: [null, "restricted", "public"],
"allow-same-version": Boolean,
"always-auth": Boolean,
also: [null, "dev", "development"],
audit: Boolean,
"auth-type": ["legacy", "sso", "saml", "oauth"],
"bin-links": Boolean,
browser: [null, String],
ca: [null, String, Array],
cafile: path,
cache: path,
"cache-lock-stale": Number,
"cache-lock-retries": Number,
"cache-lock-wait": Number,
"cache-max": Number,
"cache-min": Number,
cert: [null, String],
cidr: [null, String, Array],
color: ["always", Boolean],
depth: Number,
description: Boolean,
dev: Boolean,
"dry-run": Boolean,
editor: String,
"engine-strict": Boolean,
force: Boolean,
"fetch-retries": Number,
"fetch-retry-factor": Number,
"fetch-retry-mintimeout": Number,
"fetch-retry-maxtimeout": Number,
git: String,
"git-tag-version": Boolean,
"commit-hooks": Boolean,
global: Boolean,
globalconfig: path,
"global-style": Boolean,
group: [Number, String],
"https-proxy": [null, url],
"user-agent": String,
"ham-it-up": Boolean,
heading: String,
"if-present": Boolean,
"ignore-prepublish": Boolean,
"ignore-scripts": Boolean,
"init-module": path,
"init-author-name": String,
"init-author-email": String,
"init-author-url": ["", url],
"init-license": String,
"init-version": semver2,
json: Boolean,
key: [null, String],
"legacy-bundling": Boolean,
link: Boolean,
// local-address must be listed as an IP for a local network interface
// must be IPv4 due to node bug
"local-address": getLocalAddresses(),
loglevel: ["silent", "error", "warn", "notice", "http", "timing", "info", "verbose", "silly"],
logstream: Stream,
"logs-max": Number,
long: Boolean,
maxsockets: Number,
message: String,
"metrics-registry": [null, String],
"node-options": [null, String],
"node-version": [null, semver2],
"no-proxy": [null, String, Array],
offline: Boolean,
"onload-script": [null, String],
only: [null, "dev", "development", "prod", "production"],
optional: Boolean,
"package-lock": Boolean,
otp: [null, String],
"package-lock-only": Boolean,
parseable: Boolean,
"prefer-offline": Boolean,
"prefer-online": Boolean,
prefix: path,
production: Boolean,
progress: Boolean,
proxy: [null, !1, url],
provenance: Boolean,
// allow proxy to be disabled explicitly
"read-only": Boolean,
"rebuild-bundle": Boolean,
registry: [null, url],
rollback: Boolean,
save: Boolean,
"save-bundle": Boolean,
"save-dev": Boolean,
"save-exact": Boolean,
"save-optional": Boolean,
"save-prefix": String,
"save-prod": Boolean,
scope: String,
"script-shell": [null, String],
"scripts-prepend-node-path": [!1, !0, "auto", "warn-only"],
searchopts: String,
searchexclude: [null, String],
searchlimit: Number,
searchstaleness: Number,
"send-metrics": Boolean,
shell: String,
shrinkwrap: Boolean,
"sign-git-tag": Boolean,
"sso-poll-frequency": Number,
"sso-type": [null, "oauth", "saml"],
"strict-ssl": Boolean,
tag: String,
timing: Boolean,
tmp: path,
unicode: Boolean,
"unsafe-perm": Boolean,
usage: Boolean,
user: [Number, String],
userconfig: path,
umask: Umask,
version: Boolean,
"tag-version-prefix": String,
versions: Boolean,
viewer: String,
_exit: Boolean
};
}
});
// ../../node_modules/.pnpm/@pnpm+npm-conf@3.0.3/node_modules/@pnpm/npm-conf/lib/conf.js
var require_conf = __commonJS({
"../../node_modules/.pnpm/@pnpm+npm-conf@3.0.3/node_modules/@pnpm/npm-conf/lib/conf.js"(exports, module) {
"use strict";
init_cjs_shims();
var { readCAFileSync } = require_dist(), fs = __require("fs"), path = __require("path"), { ConfigChain } = require_config_chain(), envKeyToSetting = require_envKeyToSetting(), util = require_util(), Conf = class extends ConfigChain {
// https://github.com/npm/cli/blob/latest/lib/config/core.js#L203-L217
constructor(base, types2) {
super(base), this.root = base, this._parseField = util.parseField.bind(null, types2 || require_types());
}
// https://github.com/npm/cli/blob/latest/lib/config/core.js#L326-L338
add(data, marker) {
try {
for (let [key, value] of Object.entries(data)) {
let substKey = util.parseKey(key);
substKey !== key && delete data[key], data[substKey] = this._parseField(value, substKey);
}
} catch (error) {
throw error;
}
return super.add(data, marker);
}
// https://github.com/npm/cli/blob/latest/lib/config/core.js#L306-L319
addFile(file, name) {
name = name || file;
let marker = { __source__: name };
this.sources[name] = { path: file, type: "ini" }, this.push(marker), this._await();
try {
let contents = fs.readFileSync(file, "utf8");
this.addString(contents, file, "ini", marker);
} catch (error) {
if (error.code === "ENOENT")
this.add({}, marker);
else if (error.code !== "EISDIR")
return `Issue while reading "${file}". ${error.message}`;
}
}
// https://github.com/npm/cli/blob/latest/lib/config/core.js#L341-L357
addEnv(env) {
env = env || process.env;
let conf = {};
return Object.keys(env).filter((x) => /^npm_config_/i.test(x)).forEach((x) => {
if (!env[x])
return;
let key = envKeyToSetting(x.substr(11)), rawVal = env[x];
conf[key] = deserializeEnvVal(key, rawVal);
}), super.addEnv("", conf, "env");
}
// https://github.com/npm/cli/blob/latest/lib/config/load-prefix.js
loadPrefix() {
let cli = this.list[0];
Object.defineProperty(this, "prefix", {
enumerable: !0,
set: (prefix) => {
let g = this.get("global");
this[g ? "globalPrefix" : "localPrefix"] = prefix;
},
get: () => this.get("global") ? this.globalPrefix : this.localPrefix
}), Object.defineProperty(this, "globalPrefix", {
enumerable: !0,
set: (prefix) => {
this.set("prefix", prefix);
},
get: () => path.resolve(this.get("prefix"))
});
let p;
if (Object.defineProperty(this, "localPrefix", {
enumerable: !0,
set: (prefix) => {
p = prefix;
},
get: () => p
}), Object.prototype.hasOwnProperty.call(cli, "prefix"))
p = path.resolve(cli.prefix);
else
try {
p = util.findPrefix(process.cwd());
} catch (error) {
throw error;
}
return p;
}
// https://github.com/npm/cli/blob/latest/lib/config/load-cafile.js
loadCAFile(file) {
if (!file)
return;
let ca = readCAFileSync(file);
ca && this.set("ca", ca);
}
// https://github.com/npm/cli/blob/latest/lib/config/set-user.js
loadUser() {
let defConf = this.root;
if (this.get("global"))
return;
if (process.env.SUDO_UID) {
defConf.user = Number(process.env.SUDO_UID);
return;
}
let prefix = path.resolve(this.get("prefix"));
try {
let stats = fs.statSync(prefix);
defConf.user = stats.uid;
} catch (error) {
if (error.code === "ENOENT")
return;
throw error;
}
}
};
function deserializeEnvVal(envKey, envValue) {
function deserializeList(envValue2) {
return envValue2.indexOf(`
`) ? envValue2.split(`
`) : envValue2.split(",");
}
switch (envKey) {
case "hoist-pattern":
case "public-hoist-pattern":
return deserializeList(envValue);
}
return envValue;
}
module.exports = Conf;
}
});
// ../../node_modules/.pnpm/@pnpm+npm-conf@3.0.3/node_modules/@pnpm/npm-conf/lib/defaults.js
var require_defaults = __commonJS({
"../../node_modules/.pnpm/@pnpm+npm-conf@3.0.3/node_modules/@pnpm/npm-conf/lib/defaults.js"(exports) {
"use strict";
init_cjs_shims();
var os2 = __require("os"), path = __require("path"), temp = os2.tmpdir(), uidOrPid = process.getuid ? process.getuid() : process.pid, hasUnicode = () => !0, isWindows = process.platform === "win32", osenv = {
editor: () => process.env.EDITOR || process.env.VISUAL || (isWindows ? "notepad.exe" : "vi"),
shell: () => isWindows ? process.env.COMSPEC || "cmd.exe" : process.env.SHELL || "/bin/bash"
}, umask = {
fromString: () => process.umask()
}, home = os2.homedir();
home ? process.env.HOME = home : home = path.resolve(temp, "npm-" + uidOrPid);
var cacheExtra = process.platform === "win32" ? "npm-cache" : ".npm", cacheRoot = process.platform === "win32" && process.env.APPDATA || home, cache = path.resolve(cacheRoot, cacheExtra), defaults2, globalPrefix;
Object.defineProperty(exports, "defaults", {
get: function() {
return defaults2 || (process.env.PREFIX ? globalPrefix = process.env.PREFIX : process.platform === "win32" ? globalPrefix = path.dirname(process.execPath) : (globalPrefix = path.dirname(path.dirname(process.execPath)), process.env.DESTDIR && (globalPrefix = path.join(process.env.DESTDIR, globalPrefix))), defaults2 = {
access: null,
"allow-same-version": !1,
"always-auth": !1,
also: null,
audit: !0,
"auth-type": "legacy",
"bin-links": !0,
browser: null,
ca: null,
cafile: null,
cache,
"cache-lock-stale": 6e4,
"cache-lock-retries": 10,
"cache-lock-wait": 1e4,
"cache-max": 1 / 0,
"cache-min": 10,
cert: null,
cidr: null,
color: process.env.NO_COLOR == null,
depth: 1 / 0,
description: !0,
dev: !1,
"dry-run": !1,
editor: osenv.editor(),
"engine-strict": !1,
force: !1,
"fetch-retries": 2,
"fetch-retry-factor": 10,
"fetch-retry-mintimeout": 1e4,
"fetch-retry-maxtimeout": 6e4,
git: "git",
"git-tag-version": !0,
"commit-hooks": !0,
global: !1,
globalconfig: path.resolve(globalPrefix, "etc", "npmrc"),
"global-style": !1,
group: process.platform === "win32" ? 0 : process.env.SUDO_GID || process.getgid && process.getgid(),
"ham-it-up": !1,
heading: "npm",
"if-present": !1,
"ignore-prepublish": !1,
"ignore-scripts": !1,
"init-module": path.resolve(home, ".npm-init.js"),
"init-author-name": "",
"init-author-email": "",
"init-author-url": "",
"init-version": "1.0.0",
"init-license": "ISC",
json: !1,
key: null,
"legacy-bundling": !1,
link: !1,
"local-address": void 0,
loglevel: "notice",
logstream: process.stderr,
"logs-max": 10,
long: !1,
maxsockets: 50,
message: "%s",
"metrics-registry": null,
"node-options": null,
// We remove node-version to fix the issue described here: https://github.com/pnpm/pnpm/issues/4203#issuecomment-1133872769
offline: !1,
"onload-script": !1,
only: null,
optional: !0,
otp: null,
"package-lock": !0,
"package-lock-only": !1,
parseable: !1,
"prefer-offline": !1,
"prefer-online": !1,
prefix: globalPrefix,
production: !1,
progress: !process.env.TRAVIS && !process.env.CI,
provenance: !1,
proxy: null,
"https-proxy": null,
"no-proxy": null,
"user-agent": "npm/{npm-version} node/{node-version} {platform} {arch}",
"read-only": !1,
"rebuild-bundle": !0,
registry: "https://registry.npmjs.org/",
rollback: !0,
save: !0,
"save-bundle": !1,
"save-dev": !1,
"save-exact": !1,
"save-optional": !1,
"save-prefix": "^",
"save-prod": !1,
scope: "",
"script-shell": null,
"scripts-prepend-node-path": "warn-only",
searchopts: "",
searchexclude: null,
searchlimit: 20,
searchstaleness: 900,
"send-metrics": !1,
shell: osenv.shell(),
shrinkwrap: !0,
"sign-git-tag": !1,
"sso-poll-frequency": 500,
"sso-type": "oauth",
"strict-ssl": !0,
tag: "latest",
"tag-version-prefix": "v",
timing: !1,
tmp: temp,
unicode: hasUnicode(),
"unsafe-perm": process.platform === "win32" || process.platform === "cygwin" || !(process.getuid && process.setuid && process.getgid && process.setgid) || process.getuid() !== 0,
usage: !1,
user: process.platform === "win32" ? 0 : "nobody",
userconfig: path.resolve(home, ".npmrc"),
umask: process.umask ? process.umask() : umask.fromString("022"),
version: !1,
versions: !1,
viewer: process.platform === "win32" ? "browser" : "man",
_exit: !0
}, defaults2);
}
});
}
});
// ../../node_modules/.pnpm/@pnpm+npm-conf@3.0.3/node_modules/@pnpm/npm-conf/index.js
var require_npm_conf = __commonJS({
"../../node_modules/.pnpm/@pnpm+npm-conf@3.0.3/node_modules/@pnpm/npm-conf/index.js"(exports, module) {
"use strict";
init_cjs_shims();
var path = __require("path"), Conf = require_conf(), _defaults = require_defaults();
module.exports = (opts, types2, defaults2) => {
let conf = new Conf(Object.assign({}, _defaults.defaults, defaults2), types2);
conf.add(Object.assign({}, opts), "cli");
let warnings = [], failedToLoadBuiltInConfig = !1;
if (__require.resolve.paths) {
let paths = __require.resolve.paths("npm"), npmPath;
try {
npmPath = __require.resolve("npm", { paths: paths.slice(-1) });
} catch {
failedToLoadBuiltInConfig = !0;
}
npmPath && warnings.push(conf.addFile(path.resolve(path.dirname(npmPath), "..", "npmrc"), "builtin"));
}
conf.addEnv(), conf.loadPrefix();
let trustedUserconfig = conf.get("userconfig"), trustedPrefix = conf.get("prefix");
if (trustedPrefix) {
let etc = path.resolve(trustedPrefix, "etc");
conf.root.globalconfig = path.resolve(etc, "npmrc"), conf.root.globalignorefile = path.resolve(etc, "npmignore");
}
let trustedGlobalconfig = conf.get("globalconfig"), projectConf = path.resolve(conf.localPrefix, ".npmrc"), userConf = trustedUserconfig;
if (!conf.get("global") && projectConf !== userConf ? warnings.push(conf.addFile(projectConf, "project")) : conf.add({}, "project"), conf.get("workspace-prefix") && conf.get("workspace-prefix") !== projectConf) {
let workspaceConf = path.resolve(conf.get("workspace-prefix"), ".npmrc");
warnings.push(conf.addFile(workspaceConf, "workspace"));
}
warnings.push(conf.addFile(trustedUserconfig, "user")), warnings.push(conf.addFile(trustedGlobalconfig, "global")), conf.loadUser();
let caFile = conf.get("cafile");
return caFile && conf.loadCAFile(caFile), {
config: conf,
warnings: warnings.filter(Boolean),
failedToLoadBuiltInConfig
};
};
Object.defineProperty(module.exports, "defaults", {
get() {
return _defaults.defaults;
},
enumerable: !0
});
}
});
// ../../node_modules/.pnpm/registry-auth-token@5.1.1/node_modules/registry-auth-token/index.js
var require_registry_auth_token = __commonJS({
"../../node_modules/.pnpm/registry-auth-token@5.1.1/node_modules/registry-auth-token/index.js"(exports, module) {
init_cjs_shims();
var npmConf = require_npm_conf(), tokenKey = ":_authToken", legacyTokenKey = ":_auth", userKey = ":username", passwordKey = ":_password";
module.exports = function() {
let checkUrl, options;
arguments.length >= 2 ? (checkUrl = arguments[0], options = Object.assign({}, arguments[1])) : typeof arguments[0] == "string" ? checkUrl = arguments[0] : options = Object.assign({}, arguments[0]), options = options || {};
let providedNpmrc = options.npmrc;
return options.npmrc = (options.npmrc ? {
config: {
get: (key) => providedNpmrc[key]
}
} : npmConf()).config, checkUrl = checkUrl || options.npmrc.get("registry") || npmConf.defaults.registry, getRegistryAuthInfo(checkUrl, options) || getLegacyAuthInfo(options.npmrc);
};
function urlResolve(from, to) {
let resolvedUrl = new URL(to, new URL(from.startsWith("//") ? `./${from}` : from, "resolve://"));
if (resolvedUrl.protocol === "resolve:") {
let { pathname, search, hash } = resolvedUrl;
return pathname + search + hash;
}
return resolvedUrl.toString();
}
function getRegistryAuthInfo(checkUrl, options) {
let parsed = checkUrl instanceof URL ? checkUrl : new URL(checkUrl.startsWith("//") ? `http:${checkUrl}` : checkUrl), pathname;
for (; pathname !== "/" && parsed.pathname !== pathname; ) {
pathname = parsed.pathname || "/";
let regUrl = "//" + parsed.host + pathname.replace(/\/$/, ""), authInfo = getAuthInfoForUrl(regUrl, options.npmrc);
if (authInfo)
return authInfo;
if (!options.recursive)
return /\/$/.test(checkUrl) ? void 0 : getRegistryAuthInfo(new URL("./", parsed), options);
parsed.pathname = urlResolve(normalizePath(pathname), "..") || "/";
}
}
function getLegacyAuthInfo(npmrc) {
return npmrc.get("_auth") ? { token: replaceEnvironmentVariable(npmrc.get("_auth")), type: "Basic" } : void 0;
}
function normalizePath(path) {
return path[path.length - 1] === "/" ? path : path + "/";
}
function getAuthInfoForUrl(regUrl, npmrc) {
let bearerAuth = getBearerToken(npmrc.get(regUrl + tokenKey) || npmrc.get(regUrl + "/" + tokenKey));
if (bearerAuth)
return bearerAuth;
let username = npmrc.get(regUrl + userKey) || npmrc.get(regUrl + "/" + userKey), password = npmrc.get(regUrl + passwordKey) || npmrc.get(regUrl + "/" + passwordKey), basicAuth = getTokenForUsernameAndPassword(username, password);
if (basicAuth)
return basicAuth;
let basicAuthWithToken = getLegacyAuthToken(npmrc.get(regUrl + legacyTokenKey) || npmrc.get(regUrl + "/" + legacyTokenKey));
if (basicAuthWithToken)
return basicAuthWithToken;
}
function replaceEnvironmentVariable(token) {
return token.replace(/^\$\{?([^}]*)\}?$/, function(fullMatch, envVar) {
return process.env[envVar];
});
}
function getBearerToken(tok) {
return tok ? { token: replaceEnvironmentVariable(tok), type: "Bearer" } : void 0;
}
function getTokenForUsernameAndPassword(username, password) {
if (!username || !password)
return;
let pass = Buffer.from(replaceEnvironmentVariable(password), "base64").toString("utf8");
return {
token: Buffer.from(username + ":" + pass, "utf8").toString("base64"),
type: "Basic",
password: pass,
username
};
}
function getLegacyAuthToken(tok) {
return tok ? { token: replaceEnvironmentVariable(tok), type: "Basic" } : void 0;
}
}
});
// ../../node_modules/.pnpm/latest-version@7.0.0/node_modules/latest-version/index.js
init_cjs_shims();
// ../../node_modules/.pnpm/package-json@8.1.1/node_modules/package-json/index.js
init_cjs_shims();
import { Agent as HttpAgent } from "node:http";
import { Agent as HttpsAgent } from "node:https";
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/index.js
init_cjs_shims();
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/create.js
init_cjs_shims();
// ../../node_modules/.pnpm/@sindresorhus+is@5.6.0/node_modules/@sindresorhus/is/dist/index.js
init_cjs_shims();
var typedArrayTypeNames = [
"Int8Array",
"Uint8Array",
"Uint8ClampedArray",
"Int16Array",
"Uint16Array",
"Int32Array",
"Uint32Array",
"Float32Array",
"Float64Array",
"BigInt64Array",
"BigUint64Array"
];
function isTypedArrayName(name) {
return typedArrayTypeNames.includes(name);
}
var objectTypeNames = [
"Function",
"Generator",
"AsyncGenerator",
"GeneratorFunction",
"AsyncGeneratorFunction",
"AsyncFunction",
"Observable",
"Array",
"Buffer",
"Blob",
"Object",
"RegExp",
"Date",
"Error",
"Map",
"Set",
"WeakMap",
"WeakSet",
"WeakRef",
"ArrayBuffer",
"SharedArrayBuffer",
"DataView",
"Promise",
"URL",
"FormData",
"URLSearchParams",
"HTMLElement",
"NaN",
...typedArrayTypeNames
];
function isObjectTypeName(name) {
return objectTypeNames.includes(name);
}
var primitiveTypeNames = [
"null",
"undefined",
"string",
"number",
"bigint",
"boolean",
"symbol"
];
function isPrimitiveTypeName(name) {
return primitiveTypeNames.includes(name);
}
function isOfType(type) {
return (value) => typeof value === type;
}
var { toString } = Object.prototype, getObjectType = (value) => {
let objectTypeName = toString.call(value).slice(8, -1);
if (/HTML\w+Element/.test(objectTypeName) && is.domElement(value))
return "HTMLElement";
if (isObjectTypeName(objectTypeName))
return objectTypeName;
}, isObjectOfType = (type) => (value) => getObjectType(value) === type;
function is(value) {
if (value === null)
return "null";
switch (typeof value) {
case "undefined":
return "undefined";
case "string":
return "string";
case "number":
return Number.isNaN(value) ? "NaN" : "number";
case "boolean":
return "boolean";
case "function":
return "Function";
case "bigint":
return "bigint";
case "symbol":
return "symbol";
default:
}
if (is.observable(value))
return "Observable";
if (is.array(value))
return "Array";
if (is.buffer(value))
return "Buffer";
let tagType = getObjectType(value);
if (tagType)
return tagType;
if (value instanceof String || value instanceof Boolean || value instanceof Number)
throw new TypeError("Please don't use object wrappers for primitive types");
return "Object";
}
is.undefined = isOfType("undefined");
is.string = isOfType("string");
var isNumberType = isOfType("number");
is.number = (value) => isNumberType(value) && !is.nan(value);
is.positiveNumber = (value) => is.number(value) && value > 0;
is.negativeNumber = (value) => is.number(value) && value < 0;
is.bigint = isOfType("bigint");
is.function_ = isOfType("function");
is.null_ = (value) => value === null;
is.class_ = (value) => is.function_(value) && value.toString().startsWith("class ");
is.boolean = (value) => value === !0 || value === !1;
is.symbol = isOfType("symbol");
is.numericString = (value) => is.string(value) && !is.emptyStringOrWhitespace(value) && !Number.isNaN(Number(value));
is.array = (value, assertion) => Array.isArray(value) ? is.function_(assertion) ? value.every((element) => assertion(element)) : !0 : !1;
is.buffer = (value) => value?.constructor?.isBuffer?.(value) ?? !1;
is.blob = (value) => isObjectOfType("Blob")(value);
is.nullOrUndefined = (value) => is.null_(value) || is.undefined(value);
is.object = (value) => !is.null_(value) && (typeof value == "object" || is.function_(value));
is.iterable = (value) => is.function_(value?.[Symbol.iterator]);
is.asyncIterable = (value) => is.function_(value?.[Symbol.asyncIterator]);
is.generator = (value) => is.iterable(value) && is.function_(value?.next) && is.function_(value?.throw);
is.asyncGenerator = (value) => is.asyncIterable(value) && is.function_(value.next) && is.function_(value.throw);
is.nativePromise = (value) => isObjectOfType("Promise")(value);
var hasPromiseApi = (value) => is.function_(value?.then) && is.function_(value?.catch);
is.promise = (value) => is.nativePromise(value) || hasPromiseApi(value);
is.generatorFunction = isObjectOfType("GeneratorFunction");
is.asyncGeneratorFunction = (value) => getObjectType(value) === "AsyncGeneratorFunction";
is.asyncFunction = (value) => getObjectType(value) === "AsyncFunction";
is.boundFunction = (value) => is.function_(value) && !value.hasOwnProperty("prototype");
is.regExp = isObjectOfType("RegExp");
is.date = isObjectOfType("Date");
is.error = isObjectOfType("Error");
is.map = (value) => isObjectOfType("Map")(value);
is.set = (value) => isObjectOfType("Set")(value);
is.weakMap = (value) => isObjectOfType("WeakMap")(value);
is.weakSet = (value) => isObjectOfType("WeakSet")(value);
is.weakRef = (value) => isObjectOfType("WeakRef")(value);
is.int8Array = isObjectOfType("Int8Array");
is.uint8Array = isObjectOfType("Uint8Array");
is.uint8ClampedArray = isObjectOfType("Uint8ClampedArray");
is.int16Array = isObjectOfType("Int16Array");
is.uint16Array = isObjectOfType("Uint16Array");
is.int32Array = isObjectOfType("Int32Array");
is.uint32Array = isObjectOfType("Uint32Array");
is.float32Array = isObjectOfType("Float32Array");
is.float64Array = isObjectOfType("Float64Array");
is.bigInt64Array = isObjectOfType("BigInt64Array");
is.bigUint64Array = isObjectOfType("BigUint64Array");
is.arrayBuffer = isObjectOfType("ArrayBuffer");
is.sharedArrayBuffer = isObjectOfType("SharedArrayBuffer");
is.dataView = isObjectOfType("DataView");
is.enumCase = (value, targetEnum) => Object.values(targetEnum).includes(value);
is.directInstanceOf = (instance, class_) => Object.getPrototypeOf(instance) === class_.prototype;
is.urlInstance = (value) => isObjectOfType("URL")(value);
is.urlString = (value) => {
if (!is.string(value))
return !1;
try {
return new URL(value), !0;
} catch {
return !1;
}
};
is.truthy = (value) => !!value;
is.falsy = (value) => !value;
is.nan = (value) => Number.isNaN(value);
is.primitive = (value) => is.null_(value) || isPrimitiveTypeName(typeof value);
is.integer = (value) => Number.isInteger(value);
is.safeInteger = (value) => Number.isSafeInteger(value);
is.plainObject = (value) => {
if (typeof value != "object" || value === null)
return !1;
let prototype = Object.getPrototypeOf(value);
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
};
is.typedArray = (value) => isTypedArrayName(getObjectType(value));
var isValidLength = (value) => is.safeInteger(value) && value >= 0;
is.arrayLike = (value) => !is.nullOrUndefined(value) && !is.function_(value) && isValidLength(value.length);
is.tupleLike = (value, guards) => is.array(guards) && is.array(value) && guards.length === value.length ? guards.every((guard, index) => guard(value[index])) : !1;
is.inRange = (value, range) => {
if (is.number(range))
return value >= Math.min(0, range) && value <= Math.max(range, 0);
if (is.array(range) && range.length === 2)
return value >= Math.min(...range) && value <= Math.max(...range);
throw new TypeError(`Invalid range: ${JSON.stringify(range)}`);
};
var NODE_TYPE_ELEMENT = 1, DOM_PROPERTIES_TO_CHECK = [
"innerHTML",
"ownerDocument",
"style",
"attributes",
"nodeValue"
];
is.domElement = (value) => is.object(value) && value.nodeType === NODE_TYPE_ELEMENT && is.string(value.nodeName) && !is.plainObject(value) && DOM_PROPERTIES_TO_CHECK.every((property) => property in value);
is.observable = (value) => value ? value === value[Symbol.observable]?.() || value === value["@@observable"]?.() : !1;
is.nodeStream = (value) => is.object(value) && is.function_(value.pipe) && !is.observable(value);
is.infinite = (value) => value === Number.POSITIVE_INFINITY || value === Number.NEGATIVE_INFINITY;
var isAbsoluteMod2 = (remainder) => (value) => is.integer(value) && Math.abs(value % 2) === remainder;
is.evenInteger = isAbsoluteMod2(0);
is.oddInteger = isAbsoluteMod2(1);
is.emptyArray = (value) => is.array(value) && value.length === 0;
is.nonEmptyArray = (value) => is.array(value) && value.length > 0;
is.emptyString = (value) => is.string(value) && value.length === 0;
var isWhiteSpaceString = (value) => is.string(value) && !/\S/.test(value);
is.emptyStringOrWhitespace = (value) => is.emptyString(value) || isWhiteSpaceString(value);
is.nonEmptyString = (value) => is.string(value) && value.length > 0;
is.nonEmptyStringAndNotWhitespace = (value) => is.string(value) && !is.emptyStringOrWhitespace(value);
is.emptyObject = (value) => is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length === 0;
is.nonEmptyObject = (value) => is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length > 0;
is.emptySet = (value) => is.set(value) && value.size === 0;
is.nonEmptySet = (value) => is.set(value) && value.size > 0;
is.emptyMap = (value) => is.map(value) && value.size === 0;
is.nonEmptyMap = (value) => is.map(value) && value.size > 0;
is.propertyKey = (value) => is.any([is.string, is.number, is.symbol], value);
is.formData = (value) => isObjectOfType("FormData")(value);
is.urlSearchParams = (value) => isObjectOfType("URLSearchParams")(value);
var predicateOnArray = (method, predicate, values) => {
if (!is.function_(predicate))
throw new TypeError(`Invalid predicate: ${JSON.stringify(predicate)}`);
if (values.length === 0)
throw new TypeError("Invalid number of values");
return method.call(values, predicate);
};
is.any = (predicate, ...values) => (is.array(predicate) ? predicate : [predicate]).some((singlePredicate) => predicateOnArray(Array.prototype.some, singlePredicate, values));
is.all = (predicate, ...values) => predicateOnArray(Array.prototype.every, predicate, values);
var assertType = (condition, description, value, options = {}) => {
if (!condition) {
let { multipleValues } = options, valuesMessage = multipleValues ? `received values of types ${[
...new Set(value.map((singleValue) => `\`${is(singleValue)}\``))
].join(", ")}` : `received value of type \`${is(value)}\``;
throw new TypeError(`Expected value which is \`${description}\`, ${valuesMessage}.`);
}
}, assert = {
// Unknowns.
undefined: (value) => assertType(is.undefined(value), "undefined", value),
string: (value) => assertType(is.string(value), "string", value),
number: (value) => assertType(is.number(value), "number", value),
positiveNumber: (value) => assertType(is.positiveNumber(value), "positive number", value),
negativeNumber: (value) => assertType(is.negativeNumber(value), "negative number", value),
bigint: (value) => assertType(is.bigint(value), "bigint", value),
// eslint-disable-next-line @typescript-eslint/ban-types
function_: (value) => assertType(is.function_(value), "Function", value),
null_: (value) => assertType(is.null_(value), "null", value),
class_: (value) => assertType(is.class_(value), "Class", value),
boolean: (value) => assertType(is.boolean(value), "boolean", value),
symbol: (value) => assertType(is.symbol(value), "symbol", value),
numericString: (value) => assertType(is.numericString(value), "string with a number", value),
array: (value, assertion) => {
assertType(is.array(value), "Array", value), assertion && value.forEach(assertion);
},
buffer: (value) => assertType(is.buffer(value), "Buffer", value),
blob: (value) => assertType(is.blob(value), "Blob", value),
nullOrUndefined: (value) => assertType(is.nullOrUndefined(value), "null or undefined", value),
object: (value) => assertType(is.object(value), "Object", value),
iterable: (value) => assertType(is.iterable(value), "Iterable", value),
asyncIterable: (value) => assertType(is.asyncIterable(value), "AsyncIterable", value),
generator: (value) => assertType(is.generator(value), "Generator", value),
asyncGenerator: (value) => assertType(is.asyncGenerator(value), "AsyncGenerator", value),
nativePromise: (value) => assertType(is.nativePromise(value), "native Promise", value),
promise: (value) => assertType(is.promise(value), "Promise", value),
generatorFunction: (value) => assertType(is.generatorFunction(value), "GeneratorFunction", value),
asyncGeneratorFunction: (value) => assertType(is.asyncGeneratorFunction(value), "AsyncGeneratorFunction", value),
// eslint-disable-next-line @typescript-eslint/ban-types
asyncFunction: (value) => assertType(is.asyncFunction(value), "AsyncFunction", value),
// eslint-disable-next-line @typescript-eslint/ban-types
boundFunction: (value) => assertType(is.boundFunction(value), "Function", value),
regExp: (value) => assertType(is.regExp(value), "RegExp", value),
date: (value) => assertType(is.date(value), "Date", value),
error: (value) => assertType(is.error(value), "Error", value),
map: (value) => assertType(is.map(value), "Map", value),
set: (value) => assertType(is.set(value), "Set", value),
weakMap: (value) => assertType(is.weakMap(value), "WeakMap", value),
weakSet: (value) => assertType(is.weakSet(value), "WeakSet", value),
weakRef: (value) => assertType(is.weakRef(value), "WeakRef", value),
int8Array: (value) => assertType(is.int8Array(value), "Int8Array", value),
uint8Array: (value) => assertType(is.uint8Array(value), "Uint8Array", value),
uint8ClampedArray: (value) => assertType(is.uint8ClampedArray(value), "Uint8ClampedArray", value),
int16Array: (value) => assertType(is.int16Array(value), "Int16Array", value),
uint16Array: (value) => assertType(is.uint16Array(value), "Uint16Array", value),
int32Array: (value) => assertType(is.int32Array(value), "Int32Array", value),
uint32Array: (value) => assertType(is.uint32Array(value), "Uint32Array", value),
float32Array: (value) => assertType(is.float32Array(value), "Float32Array", value),
float64Array: (value) => assertType(is.float64Array(value), "Float64Array", value),
bigInt64Array: (value) => assertType(is.bigInt64Array(value), "BigInt64Array", value),
bigUint64Array: (value) => assertType(is.bigUint64Array(value), "BigUint64Array", value),
arrayBuffer: (value) => assertType(is.arrayBuffer(value), "ArrayBuffer", value),
sharedArrayBuffer: (value) => assertType(is.sharedArrayBuffer(value), "SharedArrayBuffer", value),
dataView: (value) => assertType(is.dataView(value), "DataView", value),
enumCase: (value, targetEnum) => assertType(is.enumCase(value, targetEnum), "EnumCase", value),
urlInstance: (value) => assertType(is.urlInstance(value), "URL", value),
urlString: (value) => assertType(is.urlString(value), "string with a URL", value),
truthy: (value) => assertType(is.truthy(value), "truthy", value),
falsy: (value) => assertType(is.falsy(value), "falsy", value),
nan: (value) => assertType(is.nan(value), "NaN", value),
primitive: (value) => assertType(is.primitive(value), "primitive", value),
integer: (value) => assertType(is.integer(value), "integer", value),
safeInteger: (value) => assertType(is.safeInteger(value), "integer", value),
plainObject: (value) => assertType(is.plainObject(value), "plain object", value),
typedArray: (value) => assertType(is.typedArray(value), "TypedArray", value),
arrayLike: (value) => assertType(is.arrayLike(value), "array-like", value),
tupleLike: (value, guards) => assertType(is.tupleLike(value, guards), "tuple-like", value),
domElement: (value) => assertType(is.domElement(value), "HTMLElement", value),
observable: (value) => assertType(is.observable(value), "Observable", value),
nodeStream: (value) => assertType(is.nodeStream(value), "Node.js Stream", value),
infinite: (value) => assertType(is.infinite(value), "infinite number", value),
emptyArray: (value) => assertType(is.emptyArray(value), "empty array", value),
nonEmptyArray: (value) => assertType(is.nonEmptyArray(value), "non-empty array", value),
emptyString: (value) => assertType(is.emptyString(value), "empty string", value),
emptyStringOrWhitespace: (value) => assertType(is.emptyStringOrWhitespace(value), "empty string or whitespace", value),
nonEmptyString: (value) => assertType(is.nonEmptyString(value), "non-empty string", value),
nonEmptyStringAndNotWhitespace: (value) => assertType(is.nonEmptyStringAndNotWhitespace(value), "non-empty string and not whitespace", value),
emptyObject: (value) => assertType(is.emptyObject(value), "empty object", value),
nonEmptyObject: (value) => assertType(is.nonEmptyObject(value), "non-empty object", value),
emptySet: (value) => assertType(is.emptySet(value), "empty set", value),
nonEmptySet: (value) => assertType(is.nonEmptySet(value), "non-empty set", value),
emptyMap: (value) => assertType(is.emptyMap(value), "empty map", value),
nonEmptyMap: (value) => assertType(is.nonEmptyMap(value), "non-empty map", value),
propertyKey: (value) => assertType(is.propertyKey(value), "PropertyKey", value),
formData: (value) => assertType(is.formData(value), "FormData", value),
urlSearchParams: (value) => assertType(is.urlSearchParams(value), "URLSearchParams", value),
// Numbers.
evenInteger: (value) => assertType(is.evenInteger(value), "even integer", value),
oddInteger: (value) => assertType(is.oddInteger(value), "odd integer", value),
// Two arguments.
directInstanceOf: (instance, class_) => assertType(is.directInstanceOf(instance, class_), "T", instance),
inRange: (value, range) => assertType(is.inRange(value, range), "in range", value),
// Variadic functions.
any: (predicate, ...values) => assertType(is.any(predicate, ...values), "predicate returns truthy for any value", values, { multipleValues: !0 }),
all: (predicate, ...values) => assertType(is.all(predicate, ...values), "predicate returns truthy for all values", values, { multipleValues: !0 })
};
Object.defineProperties(is, {
class: {
value: is.class_
},
function: {
value: is.function_
},
null: {
value: is.null_
}
});
Object.defineProperties(assert, {
class: {
value: assert.class_
},
function: {
value: assert.function_
},
null: {
value: assert.null_
}
});
var dist_default = is;
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/as-promise/index.js
init_cjs_shims();
import { EventEmitter as EventEmitter2 } from "node:events";
// ../../node_modules/.pnpm/p-cancelable@3.0.0/node_modules/p-cancelable/index.js
init_cjs_shims();
var CancelError = class extends Error {
constructor(reason) {
super(reason || "Promise was canceled"), this.name = "CancelError";
}
get isCanceled() {
return !0;
}
}, PCancelable = class _PCancelable {
static fn(userFunction) {
return (...arguments_) => new _PCancelable((resolve, reject, onCancel) => {
arguments_.push(onCancel), userFunction(...arguments_).then(resolve, reject);
});
}
constructor(executor) {
this._cancelHandlers = [], this._isPending = !0, this._isCanceled = !1, this._rejectOnCancel = !0, this._promise = new Promise((resolve, reject) => {
this._reject = reject;
let onResolve = (value) => {
(!this._isCanceled || !onCancel.shouldReject) && (this._isPending = !1, resolve(value));
}, onReject = (error) => {
this._isPending = !1, reject(error);
}, onCancel = (handler) => {
if (!this._isPending)
throw new Error("The `onCancel` handler was attached after the promise settled.");
this._cancelHandlers.push(handler);
};
Object.defineProperties(onCancel, {
shouldReject: {
get: () => this._rejectOnCancel,
set: (boolean) => {
this._rejectOnCancel = boolean;
}
}
}), executor(onResolve, onReject, onCancel);
});
}
then(onFulfilled, onRejected) {
return this._promise.then(onFulfilled, onRejected);
}
catch(onRejected) {
return this._promise.catch(onRejected);
}
finally(onFinally) {
return this._promise.finally(onFinally);
}
cancel(reason) {
if (!(!this._isPending || this._isCanceled)) {
if (this._isCanceled = !0, this._cancelHandlers.length > 0)
try {
for (let handler of this._cancelHandlers)
handler();
} catch (error) {
this._reject(error);
return;
}
this._rejectOnCancel && this._reject(new CancelError(reason));
}
}
get isCanceled() {
return this._isCanceled;
}
};
Object.setPrototypeOf(PCancelable.prototype, Promise.prototype);
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/errors.js
init_cjs_shims();
function isRequest(x) {
return dist_default.object(x) && "_onResponse" in x;
}
var RequestError = class extends Error {
constructor(message, error, self) {
if (super(message), Object.defineProperty(this, "input", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "code", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "stack", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "response", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "request", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "timings", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Error.captureStackTrace(this, this.constructor), this.name = "RequestError", this.code = error.code ?? "ERR_GOT_REQUEST_ERROR", this.input = error.input, isRequest(self) ? (Object.defineProperty(this, "request", {
enumerable: !1,
value: self
}), Object.defineProperty(this, "response", {
enumerable: !1,
value: self.response
}), this.options = self.options) : this.options = self, this.timings = this.request?.timings, dist_default.string(error.stack) && dist_default.string(this.stack)) {
let indexOfMessage = this.stack.indexOf(this.message) + this.message.length, thisStackTrace = this.stack.slice(indexOfMessage).split(`
`).reverse(), errorStackTrace = error.stack.slice(error.stack.indexOf(error.message) + error.message.length).split(`
`).reverse();
for (; errorStackTrace.length > 0 && errorStackTrace[0] === thisStackTrace[0]; )
thisStackTrace.shift();
this.stack = `${this.stack.slice(0, indexOfMessage)}${thisStackTrace.reverse().join(`
`)}${errorStackTrace.reverse().join(`
`)}`;
}
}
}, MaxRedirectsError = class extends RequestError {
constructor(request) {
super(`Redirected ${request.options.maxRedirects} times. Aborting.`, {}, request), this.name = "MaxRedirectsError", this.code = "ERR_TOO_MANY_REDIRECTS";
}
}, HTTPError = class extends RequestError {
constructor(response) {
super(`Response code ${response.statusCode} (${response.statusMessage})`, {}, response.request), this.name = "HTTPError", this.code = "ERR_NON_2XX_3XX_RESPONSE";
}
}, CacheError = class extends RequestError {
constructor(error, request) {
super(error.message, error, request), this.name = "CacheError", this.code = this.code === "ERR_GOT_REQUEST_ERROR" ? "ERR_CACHE_ACCESS" : this.code;
}
}, UploadError = class extends RequestError {
constructor(error, request) {
super(error.message, error, request), this.name = "UploadError", this.code = this.code === "ERR_GOT_REQUEST_ERROR" ? "ERR_UPLOAD" : this.code;
}
}, TimeoutError = class extends RequestError {
constructor(error, timings, request) {
super(error.message, error, request), Object.defineProperty(this, "timings", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "event", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this.name = "TimeoutError", this.event = error.event, this.timings = timings;
}
}, ReadError = class extends RequestError {
constructor(error, request) {
super(error.message, error, request), this.name = "ReadError", this.code = this.code === "ERR_GOT_REQUEST_ERROR" ? "ERR_READING_RESPONSE_STREAM" : this.code;
}
}, RetryError = class extends RequestError {
constructor(request) {
super("Retrying", {}, request), this.name = "RetryError", this.code = "ERR_RETRYING";
}
}, AbortError = class extends RequestError {
constructor(request) {
super("This operation was aborted.", {}, request), this.code = "ERR_ABORTED", this.name = "AbortError";
}
};
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/index.js
init_cjs_shims();
import process3 from "node:process";
import { Buffer as Buffer3 } from "node:buffer";
import { Duplex } from "node:stream";
import { URL as URL3, URLSearchParams as URLSearchParams2 } from "node:url";
import http2, { ServerResponse } from "node:http";
// ../../node_modules/.pnpm/@szmarczak+http-timer@5.0.1/node_modules/@szmarczak/http-timer/dist/source/index.js
init_cjs_shims();
var import_defer_to_connect = __toESM(require_source(), 1);
import { errorMonitor } from "events";
import { types } from "util";
var timer = (request) => {
if (request.timings)
return request.timings;
let timings = {
start: Date.now(),
socket: void 0,
lookup: void 0,
connect: void 0,
secureConnect: void 0,
upload: void 0,
response: void 0,
end: void 0,
error: void 0,
abort: void 0,
phases: {
wait: void 0,
dns: void 0,
tcp: void 0,
tls: void 0,
request: void 0,
firstByte: void 0,
download: void 0,
total: void 0
}
};
request.timings = timings;
let handleError = (origin) => {
origin.once(errorMonitor, () => {
timings.error = Date.now(), timings.phases.total = timings.error - timings.start;
});
};
handleError(request);
let onAbort = () => {
timings.abort = Date.now(), timings.phases.total = timings.abort - timings.start;
};
request.prependOnceListener("abort", onAbort);
let onSocket = (socket) => {
if (timings.socket = Date.now(), timings.phases.wait = timings.socket - timings.start, types.isProxy(socket))
return;
let lookupListener = () => {
timings.lookup = Date.now(), timings.phases.dns = timings.lookup - timings.socket;
};
socket.prependOnceListener("lookup", lookupListener), (0, import_defer_to_connect.default)(socket, {
connect: () => {
timings.connect = Date.now(), timings.lookup === void 0 && (socket.removeListener("lookup", lookupListener), timings.lookup = timings.connect, timings.phases.dns = timings.lookup - timings.socket), timings.phases.tcp = timings.connect - timings.lookup;
},
secureConnect: () => {
timings.secureConnect = Date.now(), timings.phases.tls = timings.secureConnect - timings.connect;
}
});
};
request.socket ? onSocket(request.socket) : request.prependOnceListener("socket", onSocket);
let onUpload = () => {
timings.upload = Date.now(), timings.phases.request = timings.upload - (timings.secureConnect ?? timings.connect);
};
return request.writableFinished ? onUpload() : request.prependOnceListener("finish", onUpload), request.prependOnceListener("response", (response) => {
timings.response = Date.now(), timings.phases.firstByte = timings.response - timings.upload, response.timings = timings, handleError(response), response.prependOnceListener("end", () => {
request.off("abort", onAbort), response.off("aborted", onAbort), !timings.phases.total && (timings.end = Date.now(), timings.phases.download = timings.end - timings.response, timings.phases.total = timings.end - timings.start);
}), response.prependOnceListener("aborted", onAbort);
}), timings;
}, source_default = timer;
// ../../node_modules/.pnpm/cacheable-request@10.2.14/node_modules/cacheable-request/dist/index.js
init_cjs_shims();
import EventEmitter from "node:events";
import urlLib from "node:url";
import crypto from "node:crypto";
import stream, { PassThrough as PassThroughStream } from "node:stream";
// ../../node_modules/.pnpm/normalize-url@8.1.1/node_modules/normalize-url/index.js
init_cjs_shims();
var DATA_URL_DEFAULT_MIME_TYPE = "text/plain", DATA_URL_DEFAULT_CHARSET = "us-ascii", testParameter = (name, filters) => filters.some((filter) => filter instanceof RegExp ? filter.test(name) : filter === name), supportedProtocols = /* @__PURE__ */ new Set([
"https:",
"http:",
"file:"
]), hasCustomProtocol = (urlString) => {
try {
let { protocol } = new URL(urlString);
return protocol.endsWith(":") && !protocol.includes(".") && !supportedProtocols.has(protocol);
} catch {
return !1;
}
}, normalizeDataURL = (urlString, { stripHash }) => {
let match = /^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(urlString);
if (!match)
throw new Error(`Invalid URL: ${urlString}`);
let { type, data, hash } = match.groups, mediaType = type.split(";"), isBase64 = mediaType.at(-1) === "base64";
isBase64 && mediaType.pop();
let mimeType = mediaType.shift()?.toLowerCase() ?? "", normalizedMediaType = [...mediaType.map((attribute) => {
let [key, value = ""] = attribute.split("=").map((string) => string.trim());
return key === "charset" && (value = value.toLowerCase(), value === DATA_URL_DEFAULT_CHARSET) ? "" : `${key}${value ? `=${value}` : ""}`;
}).filter(Boolean)];
isBase64 && normalizedMediaType.push("base64"), (normalizedMediaType.length > 0 || mimeType && mimeType !== DATA_URL_DEFAULT_MIME_TYPE) && normalizedMediaType.unshift(mimeType);
let hashPart = stripHash || !hash ? "" : `#${hash}`;
return `data:${normalizedMediaType.join(";")},${isBase64 ? data.trim() : data}${hashPart}`;
};
function normalizeUrl(urlString, options) {
if (options = {
defaultProtocol: "http",
normalizeProtocol: !0,
forceHttp: !1,
forceHttps: !1,
stripAuthentication: !0,
stripHash: !1,
stripTextFragment: !0,
stripWWW: !0,
removeQueryParameters: [/^utm_\w+/i],
removeTrailingSlash: !0,
removeSingleSlash: !0,
removeDirectoryIndex: !1,
removeExplicitPort: !1,
sortQueryParameters: !0,
removePath: !1,
transformPath: !1,
...options
}, typeof options.defaultProtocol == "string" && !options.defaultProtocol.endsWith(":") && (options.defaultProtocol = `${options.defaultProtocol}:`), urlString = urlString.trim(), /^data:/i.test(urlString))
return normalizeDataURL(urlString, options);
if (hasCustomProtocol(urlString))
return urlString;
let hasRelativeProtocol = urlString.startsWith("//");
!hasRelativeProtocol && /^\.*\//.test(urlString) || (urlString = urlString.replace(/^(?!(?:\w+:)?\/\/)|^\/\//, options.defaultProtocol));
let urlObject = new URL(urlString);
if (options.forceHttp && options.forceHttps)
throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");
if (options.forceHttp && urlObject.protocol === "https:" && (urlObject.protocol = "http:"), options.forceHttps && urlObject.protocol === "http:" && (urlObject.protocol = "https:"), options.stripAuthentication && (urlObject.username = "", urlObject.password = ""), options.stripHash ? urlObject.hash = "" : options.stripTextFragment && (urlObject.hash = urlObject.hash.replace(/#?:~:text.*?$/i, "")), urlObject.pathname) {
let protocolRegex = /\b[a-z][a-z\d+\-.]{1,50}:\/\//g, lastIndex = 0, result = "";
for (; ; ) {
let match = protocolRegex.exec(urlObject.pathname);
if (!match)
break;
let protocol = match[0], protocolAtIndex = match.index, intermediate = urlObject.pathname.slice(lastIndex, protocolAtIndex);
result += intermediate.replace(/\/{2,}/g, "/"), result += protocol, lastIndex = protocolAtIndex + protocol.length;
}
let remnant = urlObject.pathname.slice(lastIndex, urlObject.pathname.length);
result += remnant.replace(/\/{2,}/g, "/"), urlObject.pathname = result;
}
if (urlObject.pathname)
try {
urlObject.pathname = decodeURI(urlObject.pathname).replace(/\\/g, "%5C");
} catch {
}
if (options.removeDirectoryIndex === !0 && (options.removeDirectoryIndex = [/^index\.[a-z]+$/]), Array.isArray(options.removeDirectoryIndex) && options.removeDirectoryIndex.length > 0) {
let pathComponents = urlObject.pathname.split("/").filter(Boolean), lastComponent = pathComponents.at(-1);
lastComponent && testParameter(lastComponent, options.removeDirectoryIndex) && (pathComponents.pop(), urlObject.pathname = pathComponents.length > 0 ? `/${pathComponents.join("/")}/` : "/");
}
if (options.removePath && (urlObject.pathname = "/"), options.transformPath && typeof options.transformPath == "function") {
let pathComponents = urlObject.pathname.split("/").filter(Boolean), newComponents = options.transformPath(pathComponents);
urlObject.pathname = newComponents?.length > 0 ? `/${newComponents.join("/")}` : "/";
}
if (urlObject.hostname && (urlObject.hostname = urlObject.hostname.replace(/\.$/, ""), options.stripWWW && /^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(urlObject.hostname) && (urlObject.hostname = urlObject.hostname.replace(/^www\./, ""))), Array.isArray(options.removeQueryParameters))
for (let key of [...urlObject.searchParams.keys()])
testParameter(key, options.removeQueryParameters) && urlObject.searchParams.delete(key);
if (!Array.isArray(options.keepQueryParameters) && options.removeQueryParameters === !0 && (urlObject.search = ""), Array.isArray(options.keepQueryParameters) && options.keepQueryParameters.length > 0)
for (let key of [...urlObject.searchParams.keys()])
testParameter(key, options.keepQueryParameters) || urlObject.searchParams.delete(key);
if (options.sortQueryParameters) {
let originalSearch = urlObject.search;
urlObject.searchParams.sort();
try {
urlObject.search = decodeURIComponent(urlObject.search);
} catch {
}
let partsWithoutEquals = originalSearch.slice(1).split("&").filter((p) => p && !p.includes("="));
for (let part of partsWithoutEquals) {
let decoded = decodeURIComponent(part);
urlObject.search = urlObject.search.replace(`?${decoded}=`, `?${decoded}`).replace(`&${decoded}=`, `&${decoded}`);
}
}
options.removeTrailingSlash && (urlObject.pathname = urlObject.pathname.replace(/\/$/, "")), options.removeExplicitPort && urlObject.port && (urlObject.port = "");
let oldUrlString = urlString;
return urlString = urlObject.toString(), !options.removeSingleSlash && urlObject.pathname === "/" && !oldUrlString.endsWith("/") && urlObject.hash === "" && (urlString = urlString.replace(/\/$/, "")), (options.removeTrailingSlash || urlObject.pathname === "/") && urlObject.hash === "" && options.removeSingleSlash && (urlString = urlString.replace(/\/$/, "")), hasRelativeProtocol && !options.normalizeProtocol && (urlString = urlString.replace(/^http:\/\//, "//")), options.stripProtocol && (urlString = urlString.replace(/^(?:https?:)?\/\//, "")), urlString;
}
// ../../node_modules/.pnpm/cacheable-request@10.2.14/node_modules/cacheable-request/dist/index.js
var import_get_stream = __toESM(require_get_stream(), 1), import_http_cache_semantics = __toESM(require_http_cache_semantics(), 1);
// ../../node_modules/.pnpm/responselike@3.0.0/node_modules/responselike/index.js
init_cjs_shims();
import { Readable as ReadableStream } from "node:stream";
// ../../node_modules/.pnpm/lowercase-keys@3.0.0/node_modules/lowercase-keys/index.js
init_cjs_shims();
function lowercaseKeys(object) {
return Object.fromEntries(Object.entries(object).map(([key, value]) => [key.toLowerCase(), value]));
}
// ../../node_modules/.pnpm/responselike@3.0.0/node_modules/responselike/index.js
var Response = class extends ReadableStream {
statusCode;
headers;
body;
url;
constructor({ statusCode, headers, body, url }) {
if (typeof statusCode != "number")
throw new TypeError("Argument `statusCode` should be a number");
if (typeof headers != "object")
throw new TypeError("Argument `headers` should be an object");
if (!(body instanceof Uint8Array))
throw new TypeError("Argument `body` should be a buffer");
if (typeof url != "string")
throw new TypeError("Argument `url` should be a string");
super({
read() {
this.push(body), this.push(null);
}
}), this.statusCode = statusCode, this.headers = lowercaseKeys(headers), this.body = body, this.url = url;
}
};
// ../../node_modules/.pnpm/cacheable-request@10.2.14/node_modules/cacheable-request/dist/index.js
var import_keyv = __toESM(require_src(), 1);
// ../../node_modules/.pnpm/mimic-response@4.0.0/node_modules/mimic-response/index.js
init_cjs_shims();
var knownProperties = [
"aborted",
"complete",
"headers",
"httpVersion",
"httpVersionMinor",
"httpVersionMajor",
"method",
"rawHeaders",
"rawTrailers",
"setTimeout",
"socket",
"statusCode",
"statusMessage",
"trailers",
"url"
];
function mimicResponse(fromStream, toStream) {
if (toStream._readableState.autoDestroy)
throw new Error("The second stream must have the `autoDestroy` option set to `false`");
let fromProperties = /* @__PURE__ */ new Set([...Object.keys(fromStream), ...knownProperties]), properties = {};
for (let property of fromProperties)
property in toStream || (properties[property] = {
get() {
let value = fromStream[property];
return typeof value == "function" ? value.bind(fromStream) : value;
},
set(value) {
fromStream[property] = value;
},
enumerable: !0,
configurable: !1
});
return Object.defineProperties(toStream, properties), fromStream.once("aborted", () => {
toStream.destroy(), toStream.emit("aborted");
}), fromStream.once("close", () => {
fromStream.complete && toStream.readable ? toStream.once("end", () => {
toStream.emit("close");
}) : toStream.emit("close");
}), toStream;
}
// ../../node_modules/.pnpm/cacheable-request@10.2.14/node_modules/cacheable-request/dist/types.js
init_cjs_shims();
var RequestError2 = class extends Error {
constructor(error) {
super(error.message), Object.assign(this, error);
}
}, CacheError2 = class extends Error {
constructor(error) {
super(error.message), Object.assign(this, error);
}
};
// ../../node_modules/.pnpm/cacheable-request@10.2.14/node_modules/cacheable-request/dist/index.js
var CacheableRequest = class {
constructor(cacheRequest, cacheAdapter) {
this.hooks = /* @__PURE__ */ new Map(), this.request = () => (options, cb) => {
let url;
if (typeof options == "string")
url = normalizeUrlObject(urlLib.parse(options)), options = {};
else if (options instanceof urlLib.URL)
url = normalizeUrlObject(urlLib.parse(options.toString())), options = {};
else {
let [pathname, ...searchParts] = (options.path ?? "").split("?"), search = searchParts.length > 0 ? `?${searchParts.join("?")}` : "";
url = normalizeUrlObject({ ...options, pathname, search });
}
options = {
headers: {},
method: "GET",
cache: !0,
strictTtl: !1,
automaticFailover: !1,
...options,
...urlObjectToRequestOptions(url)
}, options.headers = Object.fromEntries(entries(options.headers).map(([key2, value]) => [key2.toLowerCase(), value]));
let ee = new EventEmitter(), normalizedUrlString = normalizeUrl(urlLib.format(url), {
stripWWW: !1,
removeTrailingSlash: !1,
stripAuthentication: !1
}), key = `${options.method}:${normalizedUrlString}`;
options.body && options.method !== void 0 && ["POST", "PATCH", "PUT"].includes(options.method) && (options.body instanceof stream.Readable ? options.cache = !1 : key += `:${crypto.createHash("md5").update(options.body).digest("hex")}`);
let revalidate = !1, madeRequest = !1, makeRequest = (options_) => {
madeRequest = !0;
let requestErrored = !1, requestErrorCallback = () => {
}, requestErrorPromise = new Promise((resolve) => {
requestErrorCallback = () => {
requestErrored || (requestErrored = !0, resolve());
};
}), handler = async (response) => {
if (revalidate) {
response.status = response.statusCode;
let revalidatedPolicy = import_http_cache_semantics.default.fromObject(revalidate.cachePolicy).revalidatedPolicy(options_, response);
if (!revalidatedPolicy.modified) {
response.resume(), await new Promise((resolve) => {
response.once("end", resolve);
});
let headers = convertHeaders(revalidatedPolicy.policy.responseHeaders());
response = new Response({ statusCode: revalidate.statusCode, headers, body: revalidate.body, url: revalidate.url }), response.cachePolicy = revalidatedPolicy.policy, response.fromCache = !0;
}
}
response.fromCache || (response.cachePolicy = new import_http_cache_semantics.default(options_, response, options_), response.fromCache = !1);
let clonedResponse;
options_.cache && response.cachePolicy.storable() ? (clonedResponse = cloneResponse(response), (async () => {
try {
let bodyPromise = import_get_stream.default.buffer(response);
await Promise.race([
requestErrorPromise,
new Promise((resolve) => response.once("end", resolve)),
new Promise((resolve) => response.once("close", resolve))
// eslint-disable-line no-promise-executor-return
]);
let body = await bodyPromise, value = {
url: response.url,
statusCode: response.fromCache ? revalidate.statusCode : response.statusCode,
body,
cachePolicy: response.cachePolicy.toObject()
}, ttl2 = options_.strictTtl ? response.cachePolicy.timeToLive() : void 0;
if (options_.maxTtl && (ttl2 = ttl2 ? Math.min(ttl2, options_.maxTtl) : options_.maxTtl), this.hooks.size > 0)
for (let key_ of this.hooks.keys())
value = await this.runHook(key_, value, response);
await this.cache.set(key, value, ttl2);
} catch (error) {
ee.emit("error", new CacheError2(error));
}
})()) : options_.cache && revalidate && (async () => {
try {
await this.cache.delete(key);
} catch (error) {
ee.emit("error", new CacheError2(error));
}
})(), ee.emit("response", clonedResponse ?? response), typeof cb == "function" && cb(clonedResponse ?? response);
};
try {
let request_ = this.cacheRequest(options_, handler);
request_.once("error", requestErrorCallback), request_.once("abort", requestErrorCallback), request_.once("destroy", requestErrorCallback), ee.emit("request", request_);
} catch (error) {
ee.emit("error", new RequestError2(error));
}
};
return (async () => {
let get = async (options_) => {
await Promise.resolve();
let cacheEntry = options_.cache ? await this.cache.get(key) : void 0;
if (cacheEntry === void 0 && !options_.forceRefresh) {
makeRequest(options_);
return;
}
let policy = import_http_cache_semantics.default.fromObject(cacheEntry.cachePolicy);
if (policy.satisfiesWithoutRevalidation(options_) && !options_.forceRefresh) {
let headers = convertHeaders(policy.responseHeaders()), response = new Response({ statusCode: cacheEntry.statusCode, headers, body: cacheEntry.body, url: cacheEntry.url });
response.cachePolicy = policy, response.fromCache = !0, ee.emit("response", response), typeof cb == "function" && cb(response);
} else policy.satisfiesWithoutRevalidation(options_) && Date.now() >= policy.timeToLive() && options_.forceRefresh ? (await this.cache.delete(key), options_.headers = policy.revalidationHeaders(options_), makeRequest(options_)) : (revalidate = cacheEntry, options_.headers = policy.revalidationHeaders(options_), makeRequest(options_));
}, errorHandler = (error) => ee.emit("error", new CacheError2(error));
if (this.cache instanceof import_keyv.default) {
let cachek = this.cache;
cachek.once("error", errorHandler), ee.on("error", () => cachek.removeListener("error", errorHandler)), ee.on("response", () => cachek.removeListener("error", errorHandler));
}
try {
await get(options);
} catch (error) {
options.automaticFailover && !madeRequest && makeRequest(options), ee.emit("error", new CacheError2(error));
}
})(), ee;
}, this.addHook = (name, fn) => {
this.hooks.has(name) || this.hooks.set(name, fn);
}, this.removeHook = (name) => this.hooks.delete(name), this.getHook = (name) => this.hooks.get(name), this.runHook = async (name, ...args) => this.hooks.get(name)?.(...args), cacheAdapter instanceof import_keyv.default ? this.cache = cacheAdapter : typeof cacheAdapter == "string" ? this.cache = new import_keyv.default({
uri: cacheAdapter,
namespace: "cacheable-request"
}) : this.cache = new import_keyv.default({
store: cacheAdapter,
namespace: "cacheable-request"
}), this.request = this.request.bind(this), this.cacheRequest = cacheRequest;
}
}, entries = Object.entries, cloneResponse = (response) => {
let clone = new PassThroughStream({ autoDestroy: !1 });
return mimicResponse(response, clone), response.pipe(clone);
}, urlObjectToRequestOptions = (url) => {
let options = { ...url };
return options.path = `${url.pathname || "/"}${url.search || ""}`, delete options.pathname, delete options.search, options;
}, normalizeUrlObject = (url) => (
// If url was parsed by url.parse or new URL:
// - hostname will be set
// - host will be hostname[:port]
// - port will be set if it was explicit in the parsed string
// Otherwise, url was from request options:
// - hostname or host may be set
// - host shall not have port encoded
{
protocol: url.protocol,
auth: url.auth,
hostname: url.hostname || url.host || "localhost",
port: url.port,
pathname: url.pathname,
search: url.search
}
), convertHeaders = (headers) => {
let result = [];
for (let name of Object.keys(headers))
result[name.toLowerCase()] = headers[name];
return result;
}, dist_default2 = CacheableRequest;
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/index.js
var import_decompress_response = __toESM(require_decompress_response(), 1);
var import_get_stream2 = __toESM(require_get_stream(), 1);
// ../../node_modules/.pnpm/form-data-encoder@2.1.4/node_modules/form-data-encoder/lib/FormDataEncoder.js
init_cjs_shims();
// ../../node_modules/.pnpm/form-data-encoder@2.1.4/node_modules/form-data-encoder/lib/util/getStreamIterator.js
init_cjs_shims();
// ../../node_modules/.pnpm/form-data-encoder@2.1.4/node_modules/form-data-encoder/lib/util/isFunction.js
init_cjs_shims();
var isFunction = (value) => typeof value == "function";
// ../../node_modules/.pnpm/form-data-encoder@2.1.4/node_modules/form-data-encoder/lib/util/getStreamIterator.js
var isAsyncIterable = (value) => isFunction(value[Symbol.asyncIterator]);
async function* readStream(readable) {
let reader = readable.getReader();
for (; ; ) {
let { done, value } = await reader.read();
if (done)
break;
yield value;
}
}
var getStreamIterator = (source) => {
if (isAsyncIterable(source))
return source;
if (isFunction(source.getReader))
return readStream(source);
throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.");
};
// ../../node_modules/.pnpm/form-data-encoder@2.1.4/node_modules/form-data-encoder/lib/util/createBoundary.js
init_cjs_shims();
var alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
function createBoundary() {
let size = 16, res = "";
for (; size--; )
res += alphabet[Math.random() * alphabet.length << 0];
return res;
}
// ../../node_modules/.pnpm/form-data-encoder@2.1.4/node_modules/form-data-encoder/lib/util/normalizeValue.js
init_cjs_shims();
var normalizeValue = (value) => String(value).replace(/\r|\n/g, (match, i, str) => match === "\r" && str[i + 1] !== `
` || match === `
` && str[i - 1] !== "\r" ? `\r
` : match);
// ../../node_modules/.pnpm/form-data-encoder@2.1.4/node_modules/form-data-encoder/lib/util/isPlainObject.js
init_cjs_shims();
var getType = (value) => Object.prototype.toString.call(value).slice(8, -1).toLowerCase();
function isPlainObject(value) {
if (getType(value) !== "object")
return !1;
let pp = Object.getPrototypeOf(value);
return pp == null ? !0 : (pp.constructor && pp.constructor.toString()) === Object.toString();
}
// ../../node_modules/.pnpm/form-data-encoder@2.1.4/node_modules/form-data-encoder/lib/util/proxyHeaders.js
init_cjs_shims();
function getProperty(target, prop) {
if (typeof prop == "string") {
for (let [name, value] of Object.entries(target))
if (prop.toLowerCase() === name.toLowerCase())
return value;
}
}
var proxyHeaders = (object) => new Proxy(object, {
get: (target, prop) => getProperty(target, prop),
has: (target, prop) => getProperty(target, prop) !== void 0
});
// ../../node_modules/.pnpm/form-data-encoder@2.1.4/node_modules/form-data-encoder/lib/util/isFormData.js
init_cjs_shims();
var isFormData = (value) => !!(value && isFunction(value.constructor) && value[Symbol.toStringTag] === "FormData" && isFunction(value.append) && isFunction(value.getAll) && isFunction(value.entries) && isFunction(value[Symbol.iterator]));
// ../../node_modules/.pnpm/form-data-encoder@2.1.4/node_modules/form-data-encoder/lib/util/escapeName.js
init_cjs_shims();
var escapeName = (name) => String(name).replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/"/g, "%22");
// ../../node_modules/.pnpm/form-data-encoder@2.1.4/node_modules/form-data-encoder/lib/util/isFile.js
init_cjs_shims();
var isFile = (value) => !!(value && typeof value == "object" && isFunction(value.constructor) && value[Symbol.toStringTag] === "File" && isFunction(value.stream) && value.name != null);
// ../../node_modules/.pnpm/form-data-encoder@2.1.4/node_modules/form-data-encoder/lib/FormDataEncoder.js
var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state == "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
}, __classPrivateFieldGet = function(receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state == "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}, _FormDataEncoder_instances, _FormDataEncoder_CRLF, _FormDataEncoder_CRLF_BYTES, _FormDataEncoder_CRLF_BYTES_LENGTH, _FormDataEncoder_DASHES, _FormDataEncoder_encoder, _FormDataEncoder_footer, _FormDataEncoder_form, _FormDataEncoder_options, _FormDataEncoder_getFieldHeader, _FormDataEncoder_getContentLength, defaultOptions = {
enableAdditionalHeaders: !1
}, readonlyProp = { writable: !1, configurable: !1 }, FormDataEncoder = class {
constructor(form, boundaryOrOptions, options) {
if (_FormDataEncoder_instances.add(this), _FormDataEncoder_CRLF.set(this, `\r
`), _FormDataEncoder_CRLF_BYTES.set(this, void 0), _FormDataEncoder_CRLF_BYTES_LENGTH.set(this, void 0), _FormDataEncoder_DASHES.set(this, "-".repeat(2)), _FormDataEncoder_encoder.set(this, new TextEncoder()), _FormDataEncoder_footer.set(this, void 0), _FormDataEncoder_form.set(this, void 0), _FormDataEncoder_options.set(this, void 0), !isFormData(form))
throw new TypeError("Expected first argument to be a FormData instance.");
let boundary;
if (isPlainObject(boundaryOrOptions) ? options = boundaryOrOptions : boundary = boundaryOrOptions, boundary || (boundary = createBoundary()), typeof boundary != "string")
throw new TypeError("Expected boundary argument to be a string.");
if (options && !isPlainObject(options))
throw new TypeError("Expected options argument to be an object.");
__classPrivateFieldSet(this, _FormDataEncoder_form, Array.from(form.entries()), "f"), __classPrivateFieldSet(this, _FormDataEncoder_options, { ...defaultOptions, ...options }, "f"), __classPrivateFieldSet(this, _FormDataEncoder_CRLF_BYTES, __classPrivateFieldGet(this, _FormDataEncoder_encoder, "f").encode(__classPrivateFieldGet(this, _FormDataEncoder_CRLF, "f")), "f"), __classPrivateFieldSet(this, _FormDataEncoder_CRLF_BYTES_LENGTH, __classPrivateFieldGet(this, _FormDataEncoder_CRLF_BYTES, "f").byteLength, "f"), this.boundary = `form-data-boundary-${boundary}`, this.contentType = `multipart/form-data; boundary=${this.boundary}`, __classPrivateFieldSet(this, _FormDataEncoder_footer, __classPrivateFieldGet(this, _FormDataEncoder_encoder, "f").encode(`${__classPrivateFieldGet(this, _FormDataEncoder_DASHES, "f")}${this.boundary}${__classPrivateFieldGet(this, _FormDataEncoder_DASHES, "f")}${__classPrivateFieldGet(this, _FormDataEncoder_CRLF, "f").repeat(2)}`), "f");
let headers = {
"Content-Type": this.contentType
}, contentLength = __classPrivateFieldGet(this, _FormDataEncoder_instances, "m", _FormDataEncoder_getContentLength).call(this);
contentLength && (this.contentLength = contentLength, headers["Content-Length"] = contentLength), this.headers = proxyHeaders(Object.freeze(headers)), Object.defineProperties(this, {
boundary: readonlyProp,
contentType: readonlyProp,
contentLength: readonlyProp,
headers: readonlyProp
});
}
getContentLength() {
return this.contentLength == null ? void 0 : Number(this.contentLength);
}
*values() {
for (let [name, raw] of __classPrivateFieldGet(this, _FormDataEncoder_form, "f")) {
let value = isFile(raw) ? raw : __classPrivateFieldGet(this, _FormDataEncoder_encoder, "f").encode(normalizeValue(raw));
yield __classPrivateFieldGet(this, _FormDataEncoder_instances, "m", _FormDataEncoder_getFieldHeader).call(this, name, value), yield value, yield __classPrivateFieldGet(this, _FormDataEncoder_CRLF_BYTES, "f");
}
yield __classPrivateFieldGet(this, _FormDataEncoder_footer, "f");
}
async *encode() {
for (let part of this.values())
isFile(part) ? yield* getStreamIterator(part.stream()) : yield part;
}
[(_FormDataEncoder_CRLF = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_CRLF_BYTES = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_CRLF_BYTES_LENGTH = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_DASHES = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_encoder = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_footer = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_form = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_options = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_instances = /* @__PURE__ */ new WeakSet(), _FormDataEncoder_getFieldHeader = function(name, value) {
let header = "";
header += `${__classPrivateFieldGet(this, _FormDataEncoder_DASHES, "f")}${this.boundary}${__classPrivateFieldGet(this, _FormDataEncoder_CRLF, "f")}`, header += `Content-Disposition: form-data; name="${escapeName(name)}"`, isFile(value) && (header += `; filename="${escapeName(value.name)}"${__classPrivateFieldGet(this, _FormDataEncoder_CRLF, "f")}`, header += `Content-Type: ${value.type || "application/octet-stream"}`);
let size = isFile(value) ? value.size : value.byteLength;
return __classPrivateFieldGet(this, _FormDataEncoder_options, "f").enableAdditionalHeaders === !0 && size != null && !isNaN(size) && (header += `${__classPrivateFieldGet(this, _FormDataEncoder_CRLF, "f")}Content-Length: ${isFile(value) ? value.size : value.byteLength}`), __classPrivateFieldGet(this, _FormDataEncoder_encoder, "f").encode(`${header}${__classPrivateFieldGet(this, _FormDataEncoder_CRLF, "f").repeat(2)}`);
}, _FormDataEncoder_getContentLength = function() {
let length = 0;
for (let [name, raw] of __classPrivateFieldGet(this, _FormDataEncoder_form, "f")) {
let value = isFile(raw) ? raw : __classPrivateFieldGet(this, _FormDataEncoder_encoder, "f").encode(normalizeValue(raw)), size = isFile(value) ? value.size : value.byteLength;
if (size == null || isNaN(size))
return;
length += __classPrivateFieldGet(this, _FormDataEncoder_instances, "m", _FormDataEncoder_getFieldHeader).call(this, name, value).byteLength, length += size, length += __classPrivateFieldGet(this, _FormDataEncoder_CRLF_BYTES_LENGTH, "f");
}
return String(length + __classPrivateFieldGet(this, _FormDataEncoder_footer, "f").byteLength);
}, Symbol.iterator)]() {
return this.values();
}
[Symbol.asyncIterator]() {
return this.encode();
}
};
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/utils/get-body-size.js
init_cjs_shims();
import { Buffer as Buffer2 } from "node:buffer";
import { promisify } from "node:util";
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/utils/is-form-data.js
init_cjs_shims();
function isFormData2(body) {
return dist_default.nodeStream(body) && dist_default.function_(body.getBoundary);
}
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/utils/get-body-size.js
async function getBodySize(body, headers) {
if (headers && "content-length" in headers)
return Number(headers["content-length"]);
if (!body)
return 0;
if (dist_default.string(body))
return Buffer2.byteLength(body);
if (dist_default.buffer(body))
return body.length;
if (isFormData2(body))
return promisify(body.getLength.bind(body))();
}
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/utils/proxy-events.js
init_cjs_shims();
function proxyEvents(from, to, events) {
let eventFunctions = {};
for (let event of events) {
let eventFunction = (...args) => {
to.emit(event, ...args);
};
eventFunctions[event] = eventFunction, from.on(event, eventFunction);
}
return () => {
for (let [event, eventFunction] of Object.entries(eventFunctions))
from.off(event, eventFunction);
};
}
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/timed-out.js
init_cjs_shims();
import net from "node:net";
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/utils/unhandle.js
init_cjs_shims();
function unhandle() {
let handlers = [];
return {
once(origin, event, fn) {
origin.once(event, fn), handlers.push({ origin, event, fn });
},
unhandleAll() {
for (let handler of handlers) {
let { origin, event, fn } = handler;
origin.removeListener(event, fn);
}
handlers.length = 0;
}
};
}
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/timed-out.js
var reentry = /* @__PURE__ */ Symbol("reentry"), noop = () => {
}, TimeoutError2 = class extends Error {
constructor(threshold, event) {
super(`Timeout awaiting '${event}' for ${threshold}ms`), Object.defineProperty(this, "event", {
enumerable: !0,
configurable: !0,
writable: !0,
value: event
}), Object.defineProperty(this, "code", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this.name = "TimeoutError", this.code = "ETIMEDOUT";
}
};
function timedOut(request, delays, options) {
if (reentry in request)
return noop;
request[reentry] = !0;
let cancelers = [], { once, unhandleAll } = unhandle(), addTimeout = (delay2, callback, event) => {
let timeout = setTimeout(callback, delay2, delay2, event);
timeout.unref?.();
let cancel = () => {
clearTimeout(timeout);
};
return cancelers.push(cancel), cancel;
}, { host, hostname } = options, timeoutHandler = (delay2, event) => {
request.destroy(new TimeoutError2(delay2, event));
}, cancelTimeouts = () => {
for (let cancel of cancelers)
cancel();
unhandleAll();
};
if (request.once("error", (error) => {
if (cancelTimeouts(), request.listenerCount("error") === 0)
throw error;
}), typeof delays.request < "u") {
let cancelTimeout = addTimeout(delays.request, timeoutHandler, "request");
once(request, "response", (response) => {
once(response, "end", cancelTimeout);
});
}
if (typeof delays.socket < "u") {
let { socket } = delays, socketTimeoutHandler = () => {
timeoutHandler(socket, "socket");
};
request.setTimeout(socket, socketTimeoutHandler), cancelers.push(() => {
request.removeListener("timeout", socketTimeoutHandler);
});
}
let hasLookup = typeof delays.lookup < "u", hasConnect = typeof delays.connect < "u", hasSecureConnect = typeof delays.secureConnect < "u", hasSend = typeof delays.send < "u";
return (hasLookup || hasConnect || hasSecureConnect || hasSend) && once(request, "socket", (socket) => {
let { socketPath } = request;
if (socket.connecting) {
let hasPath = !!(socketPath ?? net.isIP(hostname ?? host ?? "") !== 0);
if (hasLookup && !hasPath && typeof socket.address().address > "u") {
let cancelTimeout = addTimeout(delays.lookup, timeoutHandler, "lookup");
once(socket, "lookup", cancelTimeout);
}
if (hasConnect) {
let timeConnect = () => addTimeout(delays.connect, timeoutHandler, "connect");
hasPath ? once(socket, "connect", timeConnect()) : once(socket, "lookup", (error) => {
error === null && once(socket, "connect", timeConnect());
});
}
hasSecureConnect && options.protocol === "https:" && once(socket, "connect", () => {
let cancelTimeout = addTimeout(delays.secureConnect, timeoutHandler, "secureConnect");
once(socket, "secureConnect", cancelTimeout);
});
}
if (hasSend) {
let timeRequest = () => addTimeout(delays.send, timeoutHandler, "send");
socket.connecting ? once(socket, "connect", () => {
once(request, "upload-complete", timeRequest());
}) : once(request, "upload-complete", timeRequest());
}
}), typeof delays.response < "u" && once(request, "upload-complete", () => {
let cancelTimeout = addTimeout(delays.response, timeoutHandler, "response");
once(request, "response", cancelTimeout);
}), typeof delays.read < "u" && once(request, "response", (response) => {
let cancelTimeout = addTimeout(delays.read, timeoutHandler, "read");
once(response, "end", cancelTimeout);
}), cancelTimeouts;
}
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/utils/url-to-options.js
init_cjs_shims();
function urlToOptions(url) {
url = url;
let options = {
protocol: url.protocol,
hostname: dist_default.string(url.hostname) && url.hostname.startsWith("[") ? url.hostname.slice(1, -1) : url.hostname,
host: url.host,
hash: url.hash,
search: url.search,
pathname: url.pathname,
href: url.href,
path: `${url.pathname || ""}${url.search || ""}`
};
return dist_default.string(url.port) && url.port.length > 0 && (options.port = Number(url.port)), (url.username || url.password) && (options.auth = `${url.username || ""}:${url.password || ""}`), options;
}
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/utils/weakable-map.js
init_cjs_shims();
var WeakableMap = class {
constructor() {
Object.defineProperty(this, "weakMap", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "map", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this.weakMap = /* @__PURE__ */ new WeakMap(), this.map = /* @__PURE__ */ new Map();
}
set(key, value) {
typeof key == "object" ? this.weakMap.set(key, value) : this.map.set(key, value);
}
get(key) {
return typeof key == "object" ? this.weakMap.get(key) : this.map.get(key);
}
has(key) {
return typeof key == "object" ? this.weakMap.has(key) : this.map.has(key);
}
};
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/calculate-retry-delay.js
init_cjs_shims();
var calculateRetryDelay = ({ attemptCount, retryOptions, error, retryAfter, computedValue }) => {
if (error.name === "RetryError")
return 1;
if (attemptCount > retryOptions.limit)
return 0;
let hasMethod = retryOptions.methods.includes(error.options.method), hasErrorCode = retryOptions.errorCodes.includes(error.code), hasStatusCode = error.response && retryOptions.statusCodes.includes(error.response.statusCode);
if (!hasMethod || !hasErrorCode && !hasStatusCode)
return 0;
if (error.response) {
if (retryAfter)
return retryAfter > computedValue ? 0 : retryAfter;
if (error.response.statusCode === 413)
return 0;
}
let noise = Math.random() * retryOptions.noise;
return Math.min(2 ** (attemptCount - 1) * 1e3, retryOptions.backoffLimit) + noise;
}, calculate_retry_delay_default = calculateRetryDelay;
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/options.js
init_cjs_shims();
import process2 from "node:process";
import { promisify as promisify3, inspect } from "node:util";
import { URL as URL2, URLSearchParams } from "node:url";
import { checkServerIdentity } from "node:tls";
import http from "node:http";
import https from "node:https";
// ../../node_modules/.pnpm/cacheable-lookup@7.0.0/node_modules/cacheable-lookup/source/index.js
init_cjs_shims();
import {
V4MAPPED,
ADDRCONFIG,
ALL,
promises as dnsPromises,
lookup as dnsLookup
} from "node:dns";
import { promisify as promisify2 } from "node:util";
import os from "node:os";
var { Resolver: AsyncResolver } = dnsPromises, kCacheableLookupCreateConnection = /* @__PURE__ */ Symbol("cacheableLookupCreateConnection"), kCacheableLookupInstance = /* @__PURE__ */ Symbol("cacheableLookupInstance"), kExpires = /* @__PURE__ */ Symbol("expires"), supportsALL = typeof ALL == "number", verifyAgent = (agent) => {
if (!(agent && typeof agent.createConnection == "function"))
throw new Error("Expected an Agent instance as the first argument");
}, map4to6 = (entries2) => {
for (let entry of entries2)
entry.family !== 6 && (entry.address = `::ffff:${entry.address}`, entry.family = 6);
}, getIfaceInfo = () => {
let has4 = !1, has6 = !1;
for (let device of Object.values(os.networkInterfaces()))
for (let iface of device)
if (!iface.internal && (iface.family === "IPv6" ? has6 = !0 : has4 = !0, has4 && has6))
return { has4, has6 };
return { has4, has6 };
}, isIterable = (map) => Symbol.iterator in map, ignoreNoResultErrors = (dnsPromise) => dnsPromise.catch((error) => {
if (error.code === "ENODATA" || error.code === "ENOTFOUND" || error.code === "ENOENT")
return [];
throw error;
}), ttl = { ttl: !0 }, all = { all: !0 }, all4 = { all: !0, family: 4 }, all6 = { all: !0, family: 6 }, CacheableLookup = class {
constructor({
cache = /* @__PURE__ */ new Map(),
maxTtl = 1 / 0,
fallbackDuration = 3600,
errorTtl = 0.15,
resolver = new AsyncResolver(),
lookup = dnsLookup
} = {}) {
if (this.maxTtl = maxTtl, this.errorTtl = errorTtl, this._cache = cache, this._resolver = resolver, this._dnsLookup = lookup && promisify2(lookup), this.stats = {
cache: 0,
query: 0
}, this._resolver instanceof AsyncResolver ? (this._resolve4 = this._resolver.resolve4.bind(this._resolver), this._resolve6 = this._resolver.resolve6.bind(this._resolver)) : (this._resolve4 = promisify2(this._resolver.resolve4.bind(this._resolver)), this._resolve6 = promisify2(this._resolver.resolve6.bind(this._resolver))), this._iface = getIfaceInfo(), this._pending = {}, this._nextRemovalTime = !1, this._hostnamesToFallback = /* @__PURE__ */ new Set(), this.fallbackDuration = fallbackDuration, fallbackDuration > 0) {
let interval = setInterval(() => {
this._hostnamesToFallback.clear();
}, fallbackDuration * 1e3);
interval.unref && interval.unref(), this._fallbackInterval = interval;
}
this.lookup = this.lookup.bind(this), this.lookupAsync = this.lookupAsync.bind(this);
}
set servers(servers) {
this.clear(), this._resolver.setServers(servers);
}
get servers() {
return this._resolver.getServers();
}
lookup(hostname, options, callback) {
if (typeof options == "function" ? (callback = options, options = {}) : typeof options == "number" && (options = {
family: options
}), !callback)
throw new Error("Callback must be a function.");
this.lookupAsync(hostname, options).then((result) => {
options.all ? callback(null, result) : callback(null, result.address, result.family, result.expires, result.ttl, result.source);
}, callback);
}
async lookupAsync(hostname, options = {}) {
typeof options == "number" && (options = {
family: options
});
let cached = await this.query(hostname);
if (options.family === 6) {
let filtered = cached.filter((entry) => entry.family === 6);
options.hints & V4MAPPED && (supportsALL && options.hints & ALL || filtered.length === 0) ? map4to6(cached) : cached = filtered;
} else options.family === 4 && (cached = cached.filter((entry) => entry.family === 4));
if (options.hints & ADDRCONFIG) {
let { _iface } = this;
cached = cached.filter((entry) => entry.family === 6 ? _iface.has6 : _iface.has4);
}
if (cached.length === 0) {
let error = new Error(`cacheableLookup ENOTFOUND ${hostname}`);
throw error.code = "ENOTFOUND", error.hostname = hostname, error;
}
return options.all ? cached : cached[0];
}
async query(hostname) {
let source = "cache", cached = await this._cache.get(hostname);
if (cached && this.stats.cache++, !cached) {
let pending = this._pending[hostname];
if (pending)
this.stats.cache++, cached = await pending;
else {
source = "query";
let newPromise = this.queryAndCache(hostname);
this._pending[hostname] = newPromise, this.stats.query++;
try {
cached = await newPromise;
} finally {
delete this._pending[hostname];
}
}
}
return cached = cached.map((entry) => ({ ...entry, source })), cached;
}
async _resolve(hostname) {
let [A, AAAA] = await Promise.all([
ignoreNoResultErrors(this._resolve4(hostname, ttl)),
ignoreNoResultErrors(this._resolve6(hostname, ttl))
]), aTtl = 0, aaaaTtl = 0, cacheTtl = 0, now = Date.now();
for (let entry of A)
entry.family = 4, entry.expires = now + entry.ttl * 1e3, aTtl = Math.max(aTtl, entry.ttl);
for (let entry of AAAA)
entry.family = 6, entry.expires = now + entry.ttl * 1e3, aaaaTtl = Math.max(aaaaTtl, entry.ttl);
return A.length > 0 ? AAAA.length > 0 ? cacheTtl = Math.min(aTtl, aaaaTtl) : cacheTtl = aTtl : cacheTtl = aaaaTtl, {
entries: [
...A,
...AAAA
],
cacheTtl
};
}
async _lookup(hostname) {
try {
let [A, AAAA] = await Promise.all([
// Passing {all: true} doesn't return all IPv4 and IPv6 entries.
// See https://github.com/szmarczak/cacheable-lookup/issues/42
ignoreNoResultErrors(this._dnsLookup(hostname, all4)),
ignoreNoResultErrors(this._dnsLookup(hostname, all6))
]);
return {
entries: [
...A,
...AAAA
],
cacheTtl: 0
};
} catch {
return {
entries: [],
cacheTtl: 0
};
}
}
async _set(hostname, data, cacheTtl) {
if (this.maxTtl > 0 && cacheTtl > 0) {
cacheTtl = Math.min(cacheTtl, this.maxTtl) * 1e3, data[kExpires] = Date.now() + cacheTtl;
try {
await this._cache.set(hostname, data, cacheTtl);
} catch (error) {
this.lookupAsync = async () => {
let cacheError = new Error("Cache Error. Please recreate the CacheableLookup instance.");
throw cacheError.cause = error, cacheError;
};
}
isIterable(this._cache) && this._tick(cacheTtl);
}
}
async queryAndCache(hostname) {
if (this._hostnamesToFallback.has(hostname))
return this._dnsLookup(hostname, all);
let query = await this._resolve(hostname);
query.entries.length === 0 && this._dnsLookup && (query = await this._lookup(hostname), query.entries.length !== 0 && this.fallbackDuration > 0 && this._hostnamesToFallback.add(hostname));
let cacheTtl = query.entries.length === 0 ? this.errorTtl : query.cacheTtl;
return await this._set(hostname, query.entries, cacheTtl), query.entries;
}
_tick(ms) {
let nextRemovalTime = this._nextRemovalTime;
(!nextRemovalTime || ms < nextRemovalTime) && (clearTimeout(this._removalTimeout), this._nextRemovalTime = ms, this._removalTimeout = setTimeout(() => {
this._nextRemovalTime = !1;
let nextExpiry = 1 / 0, now = Date.now();
for (let [hostname, entries2] of this._cache) {
let expires = entries2[kExpires];
now >= expires ? this._cache.delete(hostname) : expires < nextExpiry && (nextExpiry = expires);
}
nextExpiry !== 1 / 0 && this._tick(nextExpiry - now);
}, ms), this._removalTimeout.unref && this._removalTimeout.unref());
}
install(agent) {
if (verifyAgent(agent), kCacheableLookupCreateConnection in agent)
throw new Error("CacheableLookup has been already installed");
agent[kCacheableLookupCreateConnection] = agent.createConnection, agent[kCacheableLookupInstance] = this, agent.createConnection = (options, callback) => ("lookup" in options || (options.lookup = this.lookup), agent[kCacheableLookupCreateConnection](options, callback));
}
uninstall(agent) {
if (verifyAgent(agent), agent[kCacheableLookupCreateConnection]) {
if (agent[kCacheableLookupInstance] !== this)
throw new Error("The agent is not owned by this CacheableLookup instance");
agent.createConnection = agent[kCacheableLookupCreateConnection], delete agent[kCacheableLookupCreateConnection], delete agent[kCacheableLookupInstance];
}
}
updateInterfaceInfo() {
let { _iface } = this;
this._iface = getIfaceInfo(), (_iface.has4 && !this._iface.has4 || _iface.has6 && !this._iface.has6) && this._cache.clear();
}
clear(hostname) {
if (hostname) {
this._cache.delete(hostname);
return;
}
this._cache.clear();
}
};
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/options.js
var import_http2_wrapper = __toESM(require_source2(), 1);
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/parse-link-header.js
init_cjs_shims();
function parseLinkHeader(link) {
let parsed = [], items = link.split(",");
for (let item of items) {
let [rawUriReference, ...rawLinkParameters] = item.split(";"), trimmedUriReference = rawUriReference.trim();
if (trimmedUriReference[0] !== "<" || trimmedUriReference[trimmedUriReference.length - 1] !== ">")
throw new Error(`Invalid format of the Link header reference: ${trimmedUriReference}`);
let reference = trimmedUriReference.slice(1, -1), parameters = {};
if (rawLinkParameters.length === 0)
throw new Error(`Unexpected end of Link header parameters: ${rawLinkParameters.join(";")}`);
for (let rawParameter of rawLinkParameters) {
let trimmedRawParameter = rawParameter.trim(), center = trimmedRawParameter.indexOf("=");
if (center === -1)
throw new Error(`Failed to parse Link header: ${link}`);
let name = trimmedRawParameter.slice(0, center).trim(), value = trimmedRawParameter.slice(center + 1).trim();
parameters[name] = value;
}
parsed.push({
reference,
parameters
});
}
return parsed;
}
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/options.js
var [major, minor] = process2.versions.node.split(".").map(Number);
function validateSearchParameters(searchParameters) {
for (let key in searchParameters) {
let value = searchParameters[key];
assert.any([dist_default.string, dist_default.number, dist_default.boolean, dist_default.null_, dist_default.undefined], value);
}
}
var globalCache = /* @__PURE__ */ new Map(), globalDnsCache, getGlobalDnsCache = () => globalDnsCache || (globalDnsCache = new CacheableLookup(), globalDnsCache), defaultInternals = {
request: void 0,
agent: {
http: void 0,
https: void 0,
http2: void 0
},
h2session: void 0,
decompress: !0,
timeout: {
connect: void 0,
lookup: void 0,
read: void 0,
request: void 0,
response: void 0,
secureConnect: void 0,
send: void 0,
socket: void 0
},
prefixUrl: "",
body: void 0,
form: void 0,
json: void 0,
cookieJar: void 0,
ignoreInvalidCookies: !1,
searchParams: void 0,
dnsLookup: void 0,
dnsCache: void 0,
context: {},
hooks: {
init: [],
beforeRequest: [],
beforeError: [],
beforeRedirect: [],
beforeRetry: [],
afterResponse: []
},
followRedirect: !0,
maxRedirects: 10,
cache: void 0,
throwHttpErrors: !0,
username: "",
password: "",
http2: !1,
allowGetBody: !1,
headers: {
"user-agent": "got (https://github.com/sindresorhus/got)"
},
methodRewriting: !1,
dnsLookupIpVersion: void 0,
parseJson: JSON.parse,
stringifyJson: JSON.stringify,
retry: {
limit: 2,
methods: [
"GET",
"PUT",
"HEAD",
"DELETE",
"OPTIONS",
"TRACE"
],
statusCodes: [
408,
413,
429,
500,
502,
503,
504,
521,
522,
524
],
errorCodes: [
"ETIMEDOUT",
"ECONNRESET",
"EADDRINUSE",
"ECONNREFUSED",
"EPIPE",
"ENOTFOUND",
"ENETUNREACH",
"EAI_AGAIN"
],
maxRetryAfter: void 0,
calculateDelay: ({ computedValue }) => computedValue,
backoffLimit: Number.POSITIVE_INFINITY,
noise: 100
},
localAddress: void 0,
method: "GET",
createConnection: void 0,
cacheOptions: {
shared: void 0,
cacheHeuristic: void 0,
immutableMinTimeToLive: void 0,
ignoreCargoCult: void 0
},
https: {
alpnProtocols: void 0,
rejectUnauthorized: void 0,
checkServerIdentity: void 0,
certificateAuthority: void 0,
key: void 0,
certificate: void 0,
passphrase: void 0,
pfx: void 0,
ciphers: void 0,
honorCipherOrder: void 0,
minVersion: void 0,
maxVersion: void 0,
signatureAlgorithms: void 0,
tlsSessionLifetime: void 0,
dhparam: void 0,
ecdhCurve: void 0,
certificateRevocationLists: void 0
},
encoding: void 0,
resolveBodyOnly: !1,
isStream: !1,
responseType: "text",
url: void 0,
pagination: {
transform(response) {
return response.request.options.responseType === "json" ? response.body : JSON.parse(response.body);
},
paginate({ response }) {
let rawLinkHeader = response.headers.link;
if (typeof rawLinkHeader != "string" || rawLinkHeader.trim() === "")
return !1;
let next = parseLinkHeader(rawLinkHeader).find((entry) => entry.parameters.rel === "next" || entry.parameters.rel === '"next"');
return next ? {
url: new URL2(next.reference, response.url)
} : !1;
},
filter: () => !0,
shouldContinue: () => !0,
countLimit: Number.POSITIVE_INFINITY,
backoff: 0,
requestLimit: 1e4,
stackAllItems: !1
},
setHost: !0,
maxHeaderSize: void 0,
signal: void 0,
enableUnixSockets: !0
}, cloneInternals = (internals) => {
let { hooks, retry } = internals, result = {
...internals,
context: { ...internals.context },
cacheOptions: { ...internals.cacheOptions },
https: { ...internals.https },
agent: { ...internals.agent },
headers: { ...internals.headers },
retry: {
...retry,
errorCodes: [...retry.errorCodes],
methods: [...retry.methods],
statusCodes: [...retry.statusCodes]
},
timeout: { ...internals.timeout },
hooks: {
init: [...hooks.init],
beforeRequest: [...hooks.beforeRequest],
beforeError: [...hooks.beforeError],
beforeRedirect: [...hooks.beforeRedirect],
beforeRetry: [...hooks.beforeRetry],
afterResponse: [...hooks.afterResponse]
},
searchParams: internals.searchParams ? new URLSearchParams(internals.searchParams) : void 0,
pagination: { ...internals.pagination }
};
return result.url !== void 0 && (result.prefixUrl = ""), result;
}, cloneRaw = (raw) => {
let { hooks, retry } = raw, result = { ...raw };
return dist_default.object(raw.context) && (result.context = { ...raw.context }), dist_default.object(raw.cacheOptions) && (result.cacheOptions = { ...raw.cacheOptions }), dist_default.object(raw.https) && (result.https = { ...raw.https }), dist_default.object(raw.cacheOptions) && (result.cacheOptions = { ...result.cacheOptions }), dist_default.object(raw.agent) && (result.agent = { ...raw.agent }), dist_default.object(raw.headers) && (result.headers = { ...raw.headers }), dist_default.object(retry) && (result.retry = { ...retry }, dist_default.array(retry.errorCodes) && (result.retry.errorCodes = [...retry.errorCodes]), dist_default.array(retry.methods) && (result.retry.methods = [...retry.methods]), dist_default.array(retry.statusCodes) && (result.retry.statusCodes = [...retry.statusCodes])), dist_default.object(raw.timeout) && (result.timeout = { ...raw.timeout }), dist_default.object(hooks) && (result.hooks = {
...hooks
}, dist_default.array(hooks.init) && (result.hooks.init = [...hooks.init]), dist_default.array(hooks.beforeRequest) && (result.hooks.beforeRequest = [...hooks.beforeRequest]), dist_default.array(hooks.beforeError) && (result.hooks.beforeError = [...hooks.beforeError]), dist_default.array(hooks.beforeRedirect) && (result.hooks.beforeRedirect = [...hooks.beforeRedirect]), dist_default.array(hooks.beforeRetry) && (result.hooks.beforeRetry = [...hooks.beforeRetry]), dist_default.array(hooks.afterResponse) && (result.hooks.afterResponse = [...hooks.afterResponse])), dist_default.object(raw.pagination) && (result.pagination = { ...raw.pagination }), result;
}, getHttp2TimeoutOption = (internals) => {
let delays = [internals.timeout.socket, internals.timeout.connect, internals.timeout.lookup, internals.timeout.request, internals.timeout.secureConnect].filter((delay2) => typeof delay2 == "number");
if (delays.length > 0)
return Math.min(...delays);
}, init = (options, withOptions, self) => {
let initHooks = options.hooks?.init;
if (initHooks)
for (let hook of initHooks)
hook(withOptions, self);
}, Options = class _Options {
constructor(input, options, defaults2) {
if (Object.defineProperty(this, "_unixOptions", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_internals", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_merging", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_init", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), assert.any([dist_default.string, dist_default.urlInstance, dist_default.object, dist_default.undefined], input), assert.any([dist_default.object, dist_default.undefined], options), assert.any([dist_default.object, dist_default.undefined], defaults2), input instanceof _Options || options instanceof _Options)
throw new TypeError("The defaults must be passed as the third argument");
this._internals = cloneInternals(defaults2?._internals ?? defaults2 ?? defaultInternals), this._init = [...defaults2?._init ?? []], this._merging = !1, this._unixOptions = void 0;
try {
if (dist_default.plainObject(input))
try {
this.merge(input), this.merge(options);
} finally {
this.url = input.url;
}
else
try {
this.merge(options);
} finally {
if (options?.url !== void 0)
if (input === void 0)
this.url = options.url;
else
throw new TypeError("The `url` option is mutually exclusive with the `input` argument");
else input !== void 0 && (this.url = input);
}
} catch (error) {
throw error.options = this, error;
}
}
merge(options) {
if (options) {
if (options instanceof _Options) {
for (let init2 of options._init)
this.merge(init2);
return;
}
options = cloneRaw(options), init(this, options, this), init(options, options, this), this._merging = !0, "isStream" in options && (this.isStream = options.isStream);
try {
let push = !1;
for (let key in options)
if (!(key === "mutableDefaults" || key === "handlers") && key !== "url") {
if (!(key in this))
throw new Error(`Unexpected option: ${key}`);
this[key] = options[key], push = !0;
}
push && this._init.push(options);
} finally {
this._merging = !1;
}
}
}
/**
Custom request function.
The main purpose of this is to [support HTTP2 using a wrapper](https://github.com/szmarczak/http2-wrapper).
@default http.request | https.request
*/
get request() {
return this._internals.request;
}
set request(value) {
assert.any([dist_default.function_, dist_default.undefined], value), this._internals.request = value;
}
/**
An object representing `http`, `https` and `http2` keys for [`http.Agent`](https://nodejs.org/api/http.html#http_class_http_agent), [`https.Agent`](https://nodejs.org/api/https.html#https_class_https_agent) and [`http2wrapper.Agent`](https://github.com/szmarczak/http2-wrapper#new-http2agentoptions) instance.
This is necessary because a request to one protocol might redirect to another.
In such a scenario, Got will switch over to the right protocol agent for you.
If a key is not present, it will default to a global agent.
@example
```
import got from 'got';
import HttpAgent from 'agentkeepalive';
const {HttpsAgent} = HttpAgent;
await got('https://sindresorhus.com', {
agent: {
http: new HttpAgent(),
https: new HttpsAgent()
}
});
```
*/
get agent() {
return this._internals.agent;
}
set agent(value) {
assert.plainObject(value);
for (let key in value) {
if (!(key in this._internals.agent))
throw new TypeError(`Unexpected agent option: ${key}`);
assert.any([dist_default.object, dist_default.undefined], value[key]);
}
this._merging ? Object.assign(this._internals.agent, value) : this._internals.agent = { ...value };
}
get h2session() {
return this._internals.h2session;
}
set h2session(value) {
this._internals.h2session = value;
}
/**
Decompress the response automatically.
This will set the `accept-encoding` header to `gzip, deflate, br` unless you set it yourself.
If this is disabled, a compressed response is returned as a `Buffer`.
This may be useful if you want to handle decompression yourself or stream the raw compressed data.
@default true
*/
get decompress() {
return this._internals.decompress;
}
set decompress(value) {
assert.boolean(value), this._internals.decompress = value;
}
/**
Milliseconds to wait for the server to end the response before aborting the request with `got.TimeoutError` error (a.k.a. `request` property).
By default, there's no timeout.
This also accepts an `object` with the following fields to constrain the duration of each phase of the request lifecycle:
- `lookup` starts when a socket is assigned and ends when the hostname has been resolved.
Does not apply when using a Unix domain socket.
- `connect` starts when `lookup` completes (or when the socket is assigned if lookup does not apply to the request) and ends when the socket is connected.
- `secureConnect` starts when `connect` completes and ends when the handshaking process completes (HTTPS only).
- `socket` starts when the socket is connected. See [request.setTimeout](https://nodejs.org/api/http.html#http_request_settimeout_timeout_callback).
- `response` starts when the request has been written to the socket and ends when the response headers are received.
- `send` starts when the socket is connected and ends with the request has been written to the socket.
- `request` starts when the request is initiated and ends when the response's end event fires.
*/
get timeout() {
return this._internals.timeout;
}
set timeout(value) {
assert.plainObject(value);
for (let key in value) {
if (!(key in this._internals.timeout))
throw new Error(`Unexpected timeout option: ${key}`);
assert.any([dist_default.number, dist_default.undefined], value[key]);
}
this._merging ? Object.assign(this._internals.timeout, value) : this._internals.timeout = { ...value };
}
/**
When specified, `prefixUrl` will be prepended to `url`.
The prefix can be any valid URL, either relative or absolute.
A trailing slash `/` is optional - one will be added automatically.
__Note__: `prefixUrl` will be ignored if the `url` argument is a URL instance.
__Note__: Leading slashes in `input` are disallowed when using this option to enforce consistency and avoid confusion.
For example, when the prefix URL is `https://example.com/foo` and the input is `/bar`, there's ambiguity whether the resulting URL would become `https://example.com/foo/bar` or `https://example.com/bar`.
The latter is used by browsers.
__Tip__: Useful when used with `got.extend()` to create niche-specific Got instances.
__Tip__: You can change `prefixUrl` using hooks as long as the URL still includes the `prefixUrl`.
If the URL doesn't include it anymore, it will throw.
@example
```
import got from 'got';
await got('unicorn', {prefixUrl: 'https://cats.com'});
//=> 'https://cats.com/unicorn'
const instance = got.extend({
prefixUrl: 'https://google.com'
});
await instance('unicorn', {
hooks: {
beforeRequest: [
options => {
options.prefixUrl = 'https://cats.com';
}
]
}
});
//=> 'https://cats.com/unicorn'
```
*/
get prefixUrl() {
return this._internals.prefixUrl;
}
set prefixUrl(value) {
if (assert.any([dist_default.string, dist_default.urlInstance], value), value === "") {
this._internals.prefixUrl = "";
return;
}
if (value = value.toString(), value.endsWith("/") || (value += "/"), this._internals.prefixUrl && this._internals.url) {
let { href } = this._internals.url;
this._internals.url.href = value + href.slice(this._internals.prefixUrl.length);
}
this._internals.prefixUrl = value;
}
/**
__Note #1__: The `body` option cannot be used with the `json` or `form` option.
__Note #2__: If you provide this option, `got.stream()` will be read-only.
__Note #3__: If you provide a payload with the `GET` or `HEAD` method, it will throw a `TypeError` unless the method is `GET` and the `allowGetBody` option is set to `true`.
__Note #4__: This option is not enumerable and will not be merged with the instance defaults.
The `content-length` header will be automatically set if `body` is a `string` / `Buffer` / [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) / [`form-data` instance](https://github.com/form-data/form-data), and `content-length` and `transfer-encoding` are not manually set in `options.headers`.
Since Got 12, the `content-length` is not automatically set when `body` is a `fs.createReadStream`.
*/
get body() {
return this._internals.body;
}
set body(value) {
assert.any([dist_default.string, dist_default.buffer, dist_default.nodeStream, dist_default.generator, dist_default.asyncGenerator, isFormData, dist_default.undefined], value), dist_default.nodeStream(value) && assert.truthy(value.readable), value !== void 0 && (assert.undefined(this._internals.form), assert.undefined(this._internals.json)), this._internals.body = value;
}
/**
The form body is converted to a query string using [`(new URLSearchParams(object)).toString()`](https://nodejs.org/api/url.html#url_constructor_new_urlsearchparams_obj).
If the `Content-Type` header is not present, it will be set to `application/x-www-form-urlencoded`.
__Note #1__: If you provide this option, `got.stream()` will be read-only.
__Note #2__: This option is not enumerable and will not be merged with the instance defaults.
*/
get form() {
return this._internals.form;
}
set form(value) {
assert.any([dist_default.plainObject, dist_default.undefined], value), value !== void 0 && (assert.undefined(this._internals.body), assert.undefined(this._internals.json)), this._internals.form = value;
}
/**
JSON body. If the `Content-Type` header is not set, it will be set to `application/json`.
__Note #1__: If you provide this option, `got.stream()` will be read-only.
__Note #2__: This option is not enumerable and will not be merged with the instance defaults.
*/
get json() {
return this._internals.json;
}
set json(value) {
value !== void 0 && (assert.undefined(this._internals.body), assert.undefined(this._internals.form)), this._internals.json = value;
}
/**
The URL to request, as a string, a [`https.request` options object](https://nodejs.org/api/https.html#https_https_request_options_callback), or a [WHATWG `URL`](https://nodejs.org/api/url.html#url_class_url).
Properties from `options` will override properties in the parsed `url`.
If no protocol is specified, it will throw a `TypeError`.
__Note__: The query string is **not** parsed as search params.
@example
```
await got('https://example.com/?query=a b'); //=> https://example.com/?query=a%20b
await got('https://example.com/', {searchParams: {query: 'a b'}}); //=> https://example.com/?query=a+b
// The query string is overridden by `searchParams`
await got('https://example.com/?query=a b', {searchParams: {query: 'a b'}}); //=> https://example.com/?query=a+b
```
*/
get url() {
return this._internals.url;
}
set url(value) {
if (assert.any([dist_default.string, dist_default.urlInstance, dist_default.undefined], value), value === void 0) {
this._internals.url = void 0;
return;
}
if (dist_default.string(value) && value.startsWith("/"))
throw new Error("`url` must not start with a slash");
let urlString = `${this.prefixUrl}${value.toString()}`, url = new URL2(urlString);
if (this._internals.url = url, url.protocol === "unix:" && (url.href = `http://unix${url.pathname}${url.search}`), url.protocol !== "http:" && url.protocol !== "https:") {
let error = new Error(`Unsupported protocol: ${url.protocol}`);
throw error.code = "ERR_UNSUPPORTED_PROTOCOL", error;
}
if (this._internals.username && (url.username = this._internals.username, this._internals.username = ""), this._internals.password && (url.password = this._internals.password, this._internals.password = ""), this._internals.searchParams && (url.search = this._internals.searchParams.toString(), this._internals.searchParams = void 0), url.hostname === "unix") {
if (!this._internals.enableUnixSockets)
throw new Error("Using UNIX domain sockets but option `enableUnixSockets` is not enabled");
let matches = /(?<socketPath>.+?):(?<path>.+)/.exec(`${url.pathname}${url.search}`);
if (matches?.groups) {
let { socketPath, path } = matches.groups;
this._unixOptions = {
socketPath,
path,
host: ""
};
} else
this._unixOptions = void 0;
return;
}
this._unixOptions = void 0;
}
/**
Cookie support. You don't have to care about parsing or how to store them.
__Note__: If you provide this option, `options.headers.cookie` will be overridden.
*/
get cookieJar() {
return this._internals.cookieJar;
}
set cookieJar(value) {
if (assert.any([dist_default.object, dist_default.undefined], value), value === void 0) {
this._internals.cookieJar = void 0;
return;
}
let { setCookie, getCookieString } = value;
assert.function_(setCookie), assert.function_(getCookieString), setCookie.length === 4 && getCookieString.length === 0 ? (setCookie = promisify3(setCookie.bind(value)), getCookieString = promisify3(getCookieString.bind(value)), this._internals.cookieJar = {
setCookie,
getCookieString
}) : this._internals.cookieJar = value;
}
/**
You can abort the `request` using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
*Requires Node.js 16 or later.*
@example
```
import got from 'got';
const abortController = new AbortController();
const request = got('https://httpbin.org/anything', {
signal: abortController.signal
});
setTimeout(() => {
abortController.abort();
}, 100);
```
*/
// TODO: Replace `any` with `AbortSignal` when targeting Node 16.
get signal() {
return this._internals.signal;
}
// TODO: Replace `any` with `AbortSignal` when targeting Node 16.
set signal(value) {
assert.object(value), this._internals.signal = value;
}
/**
Ignore invalid cookies instead of throwing an error.
Only useful when the `cookieJar` option has been set. Not recommended.
@default false
*/
get ignoreInvalidCookies() {
return this._internals.ignoreInvalidCookies;
}
set ignoreInvalidCookies(value) {
assert.boolean(value), this._internals.ignoreInvalidCookies = value;
}
/**
Query string that will be added to the request URL.
This will override the query string in `url`.
If you need to pass in an array, you can do it using a `URLSearchParams` instance.
@example
```
import got from 'got';
const searchParams = new URLSearchParams([['key', 'a'], ['key', 'b']]);
await got('https://example.com', {searchParams});
console.log(searchParams.toString());
//=> 'key=a&key=b'
```
*/
get searchParams() {
return this._internals.url ? this._internals.url.searchParams : (this._internals.searchParams === void 0 && (this._internals.searchParams = new URLSearchParams()), this._internals.searchParams);
}
set searchParams(value) {
assert.any([dist_default.string, dist_default.object, dist_default.undefined], value);
let url = this._internals.url;
if (value === void 0) {
this._internals.searchParams = void 0, url && (url.search = "");
return;
}
let searchParameters = this.searchParams, updated;
if (dist_default.string(value))
updated = new URLSearchParams(value);
else if (value instanceof URLSearchParams)
updated = value;
else {
validateSearchParameters(value), updated = new URLSearchParams();
for (let key in value) {
let entry = value[key];
entry === null ? updated.append(key, "") : entry === void 0 ? searchParameters.delete(key) : updated.append(key, entry);
}
}
if (this._merging) {
for (let key of updated.keys())
searchParameters.delete(key);
for (let [key, value2] of updated)
searchParameters.append(key, value2);
} else url ? url.search = searchParameters.toString() : this._internals.searchParams = searchParameters;
}
get searchParameters() {
throw new Error("The `searchParameters` option does not exist. Use `searchParams` instead.");
}
set searchParameters(_value) {
throw new Error("The `searchParameters` option does not exist. Use `searchParams` instead.");
}
get dnsLookup() {
return this._internals.dnsLookup;
}
set dnsLookup(value) {
assert.any([dist_default.function_, dist_default.undefined], value), this._internals.dnsLookup = value;
}
/**
An instance of [`CacheableLookup`](https://github.com/szmarczak/cacheable-lookup) used for making DNS lookups.
Useful when making lots of requests to different *public* hostnames.
`CacheableLookup` uses `dns.resolver4(..)` and `dns.resolver6(...)` under the hood and fall backs to `dns.lookup(...)` when the first two fail, which may lead to additional delay.
__Note__: This should stay disabled when making requests to internal hostnames such as `localhost`, `database.local` etc.
@default false
*/
get dnsCache() {
return this._internals.dnsCache;
}
set dnsCache(value) {
assert.any([dist_default.object, dist_default.boolean, dist_default.undefined], value), value === !0 ? this._internals.dnsCache = getGlobalDnsCache() : value === !1 ? this._internals.dnsCache = void 0 : this._internals.dnsCache = value;
}
/**
User data. `context` is shallow merged and enumerable. If it contains non-enumerable properties they will NOT be merged.
@example
```
import got from 'got';
const instance = got.extend({
hooks: {
beforeRequest: [
options => {
if (!options.context || !options.context.token) {
throw new Error('Token required');
}
options.headers.token = options.context.token;
}
]
}
});
const context = {
token: 'secret'
};
const response = await instance('https://httpbin.org/headers', {context});
// Let's see the headers
console.log(response.body);
```
*/
get context() {
return this._internals.context;
}
set context(value) {
assert.object(value), this._merging ? Object.assign(this._internals.context, value) : this._internals.context = { ...value };
}
/**
Hooks allow modifications during the request lifecycle.
Hook functions may be async and are run serially.
*/
get hooks() {
return this._internals.hooks;
}
set hooks(value) {
assert.object(value);
for (let knownHookEvent in value) {
if (!(knownHookEvent in this._internals.hooks))
throw new Error(`Unexpected hook event: ${knownHookEvent}`);
let typedKnownHookEvent = knownHookEvent, hooks = value[typedKnownHookEvent];
if (assert.any([dist_default.array, dist_default.undefined], hooks), hooks)
for (let hook of hooks)
assert.function_(hook);
if (this._merging)
hooks && this._internals.hooks[typedKnownHookEvent].push(...hooks);
else {
if (!hooks)
throw new Error(`Missing hook event: ${knownHookEvent}`);
this._internals.hooks[knownHookEvent] = [...hooks];
}
}
}
/**
Defines if redirect responses should be followed automatically.
Note that if a `303` is sent by the server in response to any request type (`POST`, `DELETE`, etc.), Got will automatically request the resource pointed to in the location header via `GET`.
This is in accordance with [the spec](https://tools.ietf.org/html/rfc7231#section-6.4.4). You can optionally turn on this behavior also for other redirect codes - see `methodRewriting`.
@default true
*/
get followRedirect() {
return this._internals.followRedirect;
}
set followRedirect(value) {
assert.boolean(value), this._internals.followRedirect = value;
}
get followRedirects() {
throw new TypeError("The `followRedirects` option does not exist. Use `followRedirect` instead.");
}
set followRedirects(_value) {
throw new TypeError("The `followRedirects` option does not exist. Use `followRedirect` instead.");
}
/**
If exceeded, the request will be aborted and a `MaxRedirectsError` will be thrown.
@default 10
*/
get maxRedirects() {
return this._internals.maxRedirects;
}
set maxRedirects(value) {
assert.number(value), this._internals.maxRedirects = value;
}
/**
A cache adapter instance for storing cached response data.
@default false
*/
get cache() {
return this._internals.cache;
}
set cache(value) {
assert.any([dist_default.object, dist_default.string, dist_default.boolean, dist_default.undefined], value), value === !0 ? this._internals.cache = globalCache : value === !1 ? this._internals.cache = void 0 : this._internals.cache = value;
}
/**
Determines if a `got.HTTPError` is thrown for unsuccessful responses.
If this is disabled, requests that encounter an error status code will be resolved with the `response` instead of throwing.
This may be useful if you are checking for resource availability and are expecting error responses.
@default true
*/
get throwHttpErrors() {
return this._internals.throwHttpErrors;
}
set throwHttpErrors(value) {
assert.boolean(value), this._internals.throwHttpErrors = value;
}
get username() {
let url = this._internals.url, value = url ? url.username : this._internals.username;
return decodeURIComponent(value);
}
set username(value) {
assert.string(value);
let url = this._internals.url, fixedValue = encodeURIComponent(value);
url ? url.username = fixedValue : this._internals.username = fixedValue;
}
get password() {
let url = this._internals.url, value = url ? url.password : this._internals.password;
return decodeURIComponent(value);
}
set password(value) {
assert.string(value);
let url = this._internals.url, fixedValue = encodeURIComponent(value);
url ? url.password = fixedValue : this._internals.password = fixedValue;
}
/**
If set to `true`, Got will additionally accept HTTP2 requests.
It will choose either HTTP/1.1 or HTTP/2 depending on the ALPN protocol.
__Note__: This option requires Node.js 15.10.0 or newer as HTTP/2 support on older Node.js versions is very buggy.
__Note__: Overriding `options.request` will disable HTTP2 support.
@default false
@example
```
import got from 'got';
const {headers} = await got('https://nghttp2.org/httpbin/anything', {http2: true});
console.log(headers.via);
//=> '2 nghttpx'
```
*/
get http2() {
return this._internals.http2;
}
set http2(value) {
assert.boolean(value), this._internals.http2 = value;
}
/**
Set this to `true` to allow sending body for the `GET` method.
However, the [HTTP/2 specification](https://tools.ietf.org/html/rfc7540#section-8.1.3) says that `An HTTP GET request includes request header fields and no payload body`, therefore when using the HTTP/2 protocol this option will have no effect.
This option is only meant to interact with non-compliant servers when you have no other choice.
__Note__: The [RFC 7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) doesn't specify any particular behavior for the GET method having a payload, therefore __it's considered an [anti-pattern](https://en.wikipedia.org/wiki/Anti-pattern)__.
@default false
*/
get allowGetBody() {
return this._internals.allowGetBody;
}
set allowGetBody(value) {
assert.boolean(value), this._internals.allowGetBody = value;
}
/**
Request headers.
Existing headers will be overwritten. Headers set to `undefined` will be omitted.
@default {}
*/
get headers() {
return this._internals.headers;
}
set headers(value) {
assert.plainObject(value), this._merging ? Object.assign(this._internals.headers, lowercaseKeys(value)) : this._internals.headers = lowercaseKeys(value);
}
/**
Specifies if the HTTP request method should be [rewritten as `GET`](https://tools.ietf.org/html/rfc7231#section-6.4) on redirects.
As the [specification](https://tools.ietf.org/html/rfc7231#section-6.4) prefers to rewrite the HTTP method only on `303` responses, this is Got's default behavior.
Setting `methodRewriting` to `true` will also rewrite `301` and `302` responses, as allowed by the spec. This is the behavior followed by `curl` and browsers.
__Note__: Got never performs method rewriting on `307` and `308` responses, as this is [explicitly prohibited by the specification](https://www.rfc-editor.org/rfc/rfc7231#section-6.4.7).
@default false
*/
get methodRewriting() {
return this._internals.methodRewriting;
}
set methodRewriting(value) {
assert.boolean(value), this._internals.methodRewriting = value;
}
/**
Indicates which DNS record family to use.
Values:
- `undefined`: IPv4 (if present) or IPv6
- `4`: Only IPv4
- `6`: Only IPv6
@default undefined
*/
get dnsLookupIpVersion() {
return this._internals.dnsLookupIpVersion;
}
set dnsLookupIpVersion(value) {
if (value !== void 0 && value !== 4 && value !== 6)
throw new TypeError(`Invalid DNS lookup IP version: ${value}`);
this._internals.dnsLookupIpVersion = value;
}
/**
A function used to parse JSON responses.
@example
```
import got from 'got';
import Bourne from '@hapi/bourne';
const parsed = await got('https://example.com', {
parseJson: text => Bourne.parse(text)
}).json();
console.log(parsed);
```
*/
get parseJson() {
return this._internals.parseJson;
}
set parseJson(value) {
assert.function_(value), this._internals.parseJson = value;
}
/**
A function used to stringify the body of JSON requests.
@example
```
import got from 'got';
await got.post('https://example.com', {
stringifyJson: object => JSON.stringify(object, (key, value) => {
if (key.startsWith('_')) {
return;
}
return value;
}),
json: {
some: 'payload',
_ignoreMe: 1234
}
});
```
@example
```
import got from 'got';
await got.post('https://example.com', {
stringifyJson: object => JSON.stringify(object, (key, value) => {
if (typeof value === 'number') {
return value.toString();
}
return value;
}),
json: {
some: 'payload',
number: 1
}
});
```
*/
get stringifyJson() {
return this._internals.stringifyJson;
}
set stringifyJson(value) {
assert.function_(value), this._internals.stringifyJson = value;
}
/**
An object representing `limit`, `calculateDelay`, `methods`, `statusCodes`, `maxRetryAfter` and `errorCodes` fields for maximum retry count, retry handler, allowed methods, allowed status codes, maximum [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) time and allowed error codes.
Delays between retries counts with function `1000 * Math.pow(2, retry) + Math.random() * 100`, where `retry` is attempt number (starts from 1).
The `calculateDelay` property is a `function` that receives an object with `attemptCount`, `retryOptions`, `error` and `computedValue` properties for current retry count, the retry options, error and default computed value.
The function must return a delay in milliseconds (or a Promise resolving with it) (`0` return value cancels retry).
By default, it retries *only* on the specified methods, status codes, and on these network errors:
- `ETIMEDOUT`: One of the [timeout](#timeout) limits were reached.
- `ECONNRESET`: Connection was forcibly closed by a peer.
- `EADDRINUSE`: Could not bind to any free port.
- `ECONNREFUSED`: Connection was refused by the server.
- `EPIPE`: The remote side of the stream being written has been closed.
- `ENOTFOUND`: Couldn't resolve the hostname to an IP address.
- `ENETUNREACH`: No internet connection.
- `EAI_AGAIN`: DNS lookup timed out.
__Note__: If `maxRetryAfter` is set to `undefined`, it will use `options.timeout`.
__Note__: If [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) header is greater than `maxRetryAfter`, it will cancel the request.
*/
get retry() {
return this._internals.retry;
}
set retry(value) {
if (assert.plainObject(value), assert.any([dist_default.function_, dist_default.undefined], value.calculateDelay), assert.any([dist_default.number, dist_default.undefined], value.maxRetryAfter), assert.any([dist_default.number, dist_default.undefined], value.limit), assert.any([dist_default.array, dist_default.undefined], value.methods), assert.any([dist_default.array, dist_default.undefined], value.statusCodes), assert.any([dist_default.array, dist_default.undefined], value.errorCodes), assert.any([dist_default.number, dist_default.undefined], value.noise), value.noise && Math.abs(value.noise) > 100)
throw new Error(`The maximum acceptable retry noise is +/- 100ms, got ${value.noise}`);
for (let key in value)
if (!(key in this._internals.retry))
throw new Error(`Unexpected retry option: ${key}`);
this._merging ? Object.assign(this._internals.retry, value) : this._internals.retry = { ...value };
let { retry } = this._internals;
retry.methods = [...new Set(retry.methods.map((method) => method.toUpperCase()))], retry.statusCodes = [...new Set(retry.statusCodes)], retry.errorCodes = [...new Set(retry.errorCodes)];
}
/**
From `http.RequestOptions`.
The IP address used to send the request from.
*/
get localAddress() {
return this._internals.localAddress;
}
set localAddress(value) {
assert.any([dist_default.string, dist_default.undefined], value), this._internals.localAddress = value;
}
/**
The HTTP method used to make the request.
@default 'GET'
*/
get method() {
return this._internals.method;
}
set method(value) {
assert.string(value), this._internals.method = value.toUpperCase();
}
get createConnection() {
return this._internals.createConnection;
}
set createConnection(value) {
assert.any([dist_default.function_, dist_default.undefined], value), this._internals.createConnection = value;
}
/**
From `http-cache-semantics`
@default {}
*/
get cacheOptions() {
return this._internals.cacheOptions;
}
set cacheOptions(value) {
assert.plainObject(value), assert.any([dist_default.boolean, dist_default.undefined], value.shared), assert.any([dist_default.number, dist_default.undefined], value.cacheHeuristic), assert.any([dist_default.number, dist_default.undefined], value.immutableMinTimeToLive), assert.any([dist_default.boolean, dist_default.undefined], value.ignoreCargoCult);
for (let key in value)
if (!(key in this._internals.cacheOptions))
throw new Error(`Cache option \`${key}\` does not exist`);
this._merging ? Object.assign(this._internals.cacheOptions, value) : this._internals.cacheOptions = { ...value };
}
/**
Options for the advanced HTTPS API.
*/
get https() {
return this._internals.https;
}
set https(value) {
assert.plainObject(value), assert.any([dist_default.boolean, dist_default.undefined], value.rejectUnauthorized), assert.any([dist_default.function_, dist_default.undefined], value.checkServerIdentity), assert.any([dist_default.string, dist_default.object, dist_default.array, dist_default.undefined], value.certificateAuthority), assert.any([dist_default.string, dist_default.object, dist_default.array, dist_default.undefined], value.key), assert.any([dist_default.string, dist_default.object, dist_default.array, dist_default.undefined], value.certificate), assert.any([dist_default.string, dist_default.undefined], value.passphrase), assert.any([dist_default.string, dist_default.buffer, dist_default.array, dist_default.undefined], value.pfx), assert.any([dist_default.array, dist_default.undefined], value.alpnProtocols), assert.any([dist_default.string, dist_default.undefined], value.ciphers), assert.any([dist_default.string, dist_default.buffer, dist_default.undefined], value.dhparam), assert.any([dist_default.string, dist_default.undefined], value.signatureAlgorithms), assert.any([dist_default.string, dist_default.undefined], value.minVersion), assert.any([dist_default.string, dist_default.undefined], value.maxVersion), assert.any([dist_default.boolean, dist_default.undefined], value.honorCipherOrder), assert.any([dist_default.number, dist_default.undefined], value.tlsSessionLifetime), assert.any([dist_default.string, dist_default.undefined], value.ecdhCurve), assert.any([dist_default.string, dist_default.buffer, dist_default.array, dist_default.undefined], value.certificateRevocationLists);
for (let key in value)
if (!(key in this._internals.https))
throw new Error(`HTTPS option \`${key}\` does not exist`);
this._merging ? Object.assign(this._internals.https, value) : this._internals.https = { ...value };
}
/**
[Encoding](https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings) to be used on `setEncoding` of the response data.
To get a [`Buffer`](https://nodejs.org/api/buffer.html), you need to set `responseType` to `buffer` instead.
Don't set this option to `null`.
__Note__: This doesn't affect streams! Instead, you need to do `got.stream(...).setEncoding(encoding)`.
@default 'utf-8'
*/
get encoding() {
return this._internals.encoding;
}
set encoding(value) {
if (value === null)
throw new TypeError("To get a Buffer, set `options.responseType` to `buffer` instead");
assert.any([dist_default.string, dist_default.undefined], value), this._internals.encoding = value;
}
/**
When set to `true` the promise will return the Response body instead of the Response object.
@default false
*/
get resolveBodyOnly() {
return this._internals.resolveBodyOnly;
}
set resolveBodyOnly(value) {
assert.boolean(value), this._internals.resolveBodyOnly = value;
}
/**
Returns a `Stream` instead of a `Promise`.
This is equivalent to calling `got.stream(url, options?)`.
@default false
*/
get isStream() {
return this._internals.isStream;
}
set isStream(value) {
assert.boolean(value), this._internals.isStream = value;
}
/**
The parsing method.
The promise also has `.text()`, `.json()` and `.buffer()` methods which return another Got promise for the parsed body.
It's like setting the options to `{responseType: 'json', resolveBodyOnly: true}` but without affecting the main Got promise.
__Note__: When using streams, this option is ignored.
@example
```
const responsePromise = got(url);
const bufferPromise = responsePromise.buffer();
const jsonPromise = responsePromise.json();
const [response, buffer, json] = Promise.all([responsePromise, bufferPromise, jsonPromise]);
// `response` is an instance of Got Response
// `buffer` is an instance of Buffer
// `json` is an object
```
@example
```
// This
const body = await got(url).json();
// is semantically the same as this
const body = await got(url, {responseType: 'json', resolveBodyOnly: true});
```
*/
get responseType() {
return this._internals.responseType;
}
set responseType(value) {
if (value === void 0) {
this._internals.responseType = "text";
return;
}
if (value !== "text" && value !== "buffer" && value !== "json")
throw new Error(`Invalid \`responseType\` option: ${value}`);
this._internals.responseType = value;
}
get pagination() {
return this._internals.pagination;
}
set pagination(value) {
assert.object(value), this._merging ? Object.assign(this._internals.pagination, value) : this._internals.pagination = value;
}
get auth() {
throw new Error("Parameter `auth` is deprecated. Use `username` / `password` instead.");
}
set auth(_value) {
throw new Error("Parameter `auth` is deprecated. Use `username` / `password` instead.");
}
get setHost() {
return this._internals.setHost;
}
set setHost(value) {
assert.boolean(value), this._internals.setHost = value;
}
get maxHeaderSize() {
return this._internals.maxHeaderSize;
}
set maxHeaderSize(value) {
assert.any([dist_default.number, dist_default.undefined], value), this._internals.maxHeaderSize = value;
}
get enableUnixSockets() {
return this._internals.enableUnixSockets;
}
set enableUnixSockets(value) {
assert.boolean(value), this._internals.enableUnixSockets = value;
}
// eslint-disable-next-line @typescript-eslint/naming-convention
toJSON() {
return { ...this._internals };
}
[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")](_depth, options) {
return inspect(this._internals, options);
}
createNativeRequestOptions() {
let internals = this._internals, url = internals.url, agent;
url.protocol === "https:" ? agent = internals.http2 ? internals.agent : internals.agent.https : agent = internals.agent.http;
let { https: https2 } = internals, { pfx } = https2;
return dist_default.array(pfx) && dist_default.plainObject(pfx[0]) && (pfx = pfx.map((object) => ({
buf: object.buffer,
passphrase: object.passphrase
}))), {
...internals.cacheOptions,
...this._unixOptions,
// HTTPS options
// eslint-disable-next-line @typescript-eslint/naming-convention
ALPNProtocols: https2.alpnProtocols,
ca: https2.certificateAuthority,
cert: https2.certificate,
key: https2.key,
passphrase: https2.passphrase,
pfx: https2.pfx,
rejectUnauthorized: https2.rejectUnauthorized,
checkServerIdentity: https2.checkServerIdentity ?? checkServerIdentity,
ciphers: https2.ciphers,
honorCipherOrder: https2.honorCipherOrder,
minVersion: https2.minVersion,
maxVersion: https2.maxVersion,
sigalgs: https2.signatureAlgorithms,
sessionTimeout: https2.tlsSessionLifetime,
dhparam: https2.dhparam,
ecdhCurve: https2.ecdhCurve,
crl: https2.certificateRevocationLists,
// HTTP options
lookup: internals.dnsLookup ?? internals.dnsCache?.lookup,
family: internals.dnsLookupIpVersion,
agent,
setHost: internals.setHost,
method: internals.method,
maxHeaderSize: internals.maxHeaderSize,
localAddress: internals.localAddress,
headers: internals.headers,
createConnection: internals.createConnection,
timeout: internals.http2 ? getHttp2TimeoutOption(internals) : void 0,
// HTTP/2 options
h2session: internals.h2session
};
}
getRequestFunction() {
let url = this._internals.url, { request } = this._internals;
return !request && url ? this.getFallbackRequestFunction() : request;
}
getFallbackRequestFunction() {
let url = this._internals.url;
if (url) {
if (url.protocol === "https:") {
if (this._internals.http2) {
if (major < 15 || major === 15 && minor < 10) {
let error = new Error("To use the `http2` option, install Node.js 15.10.0 or above");
throw error.code = "EUNSUPPORTED", error;
}
return import_http2_wrapper.default.auto;
}
return https.request;
}
return http.request;
}
}
freeze() {
let options = this._internals;
Object.freeze(options), Object.freeze(options.hooks), Object.freeze(options.hooks.afterResponse), Object.freeze(options.hooks.beforeError), Object.freeze(options.hooks.beforeRedirect), Object.freeze(options.hooks.beforeRequest), Object.freeze(options.hooks.beforeRetry), Object.freeze(options.hooks.init), Object.freeze(options.https), Object.freeze(options.cacheOptions), Object.freeze(options.agent), Object.freeze(options.headers), Object.freeze(options.timeout), Object.freeze(options.retry), Object.freeze(options.retry.errorCodes), Object.freeze(options.retry.methods), Object.freeze(options.retry.statusCodes);
}
};
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/response.js
init_cjs_shims();
var isResponseOk = (response) => {
let { statusCode } = response, limitStatusCode = response.request.options.followRedirect ? 299 : 399;
return statusCode >= 200 && statusCode <= limitStatusCode || statusCode === 304;
}, ParseError = class extends RequestError {
constructor(error, response) {
let { options } = response.request;
super(`${error.message} in "${options.url.toString()}"`, error, response.request), this.name = "ParseError", this.code = "ERR_BODY_PARSE_FAILURE";
}
}, parseBody = (response, responseType, parseJson, encoding) => {
let { rawBody } = response;
try {
if (responseType === "text")
return rawBody.toString(encoding);
if (responseType === "json")
return rawBody.length === 0 ? "" : parseJson(rawBody.toString(encoding));
if (responseType === "buffer")
return rawBody;
} catch (error) {
throw new ParseError(error, response);
}
throw new ParseError({
message: `Unknown body type '${responseType}'`,
name: "Error"
}, response);
};
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/utils/is-client-request.js
init_cjs_shims();
function isClientRequest(clientRequest) {
return clientRequest.writable && !clientRequest.writableEnded;
}
var is_client_request_default = isClientRequest;
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/utils/is-unix-socket-url.js
init_cjs_shims();
function isUnixSocketURL(url) {
return url.protocol === "unix:" || url.hostname === "unix";
}
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/core/index.js
var { buffer: getBuffer } = import_get_stream2.default, supportsBrotli = dist_default.string(process3.versions.brotli), methodsWithoutBody = /* @__PURE__ */ new Set(["GET", "HEAD"]), cacheableStore = new WeakableMap(), redirectCodes = /* @__PURE__ */ new Set([300, 301, 302, 303, 304, 307, 308]), proxiedRequestEvents = [
"socket",
"connect",
"continue",
"information",
"upgrade"
], noop2 = () => {
}, Request = class _Request extends Duplex {
constructor(url, options, defaults2) {
super({
// Don't destroy immediately, as the error may be emitted on unsuccessful retry
autoDestroy: !1,
// It needs to be zero because we're just proxying the data to another stream
highWaterMark: 0
}), Object.defineProperty(this, "constructor", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_noPipe", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "options", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "response", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "requestUrl", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "redirectUrls", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "retryCount", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_stopRetry", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_downloadedSize", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_uploadedSize", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_stopReading", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_pipedServerResponses", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_request", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_responseSize", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_bodySize", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_unproxyEvents", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_isFromCache", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_cannotHaveBody", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_triggerRead", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_cancelTimeouts", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_removeListeners", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_nativeResponse", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_flushed", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_aborted", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_requestInitialized", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this._downloadedSize = 0, this._uploadedSize = 0, this._stopReading = !1, this._pipedServerResponses = /* @__PURE__ */ new Set(), this._cannotHaveBody = !1, this._unproxyEvents = noop2, this._triggerRead = !1, this._cancelTimeouts = noop2, this._removeListeners = noop2, this._jobs = [], this._flushed = !1, this._requestInitialized = !1, this._aborted = !1, this.redirectUrls = [], this.retryCount = 0, this._stopRetry = noop2, this.on("pipe", (source) => {
source?.headers && Object.assign(this.options.headers, source.headers);
}), this.on("newListener", (event) => {
if (event === "retry" && this.listenerCount("retry") > 0)
throw new Error("A retry listener has been attached already.");
});
try {
if (this.options = new Options(url, options, defaults2), !this.options.url) {
if (this.options.prefixUrl === "")
throw new TypeError("Missing `url` property");
this.options.url = "";
}
this.requestUrl = this.options.url;
} catch (error) {
let { options: options2 } = error;
options2 && (this.options = options2), this.flush = async () => {
this.flush = async () => {
}, this.destroy(error);
};
return;
}
let { body } = this.options;
if (dist_default.nodeStream(body) && body.once("error", (error) => {
this._flushed ? this._beforeError(new UploadError(error, this)) : this.flush = async () => {
this.flush = async () => {
}, this._beforeError(new UploadError(error, this));
};
}), this.options.signal) {
let abort = () => {
this.destroy(new AbortError(this));
};
this.options.signal.aborted ? abort() : (this.options.signal.addEventListener("abort", abort), this._removeListeners = () => {
this.options.signal.removeEventListener("abort", abort);
});
}
}
async flush() {
if (!this._flushed) {
this._flushed = !0;
try {
if (await this._finalizeBody(), this.destroyed)
return;
if (await this._makeRequest(), this.destroyed) {
this._request?.destroy();
return;
}
for (let job of this._jobs)
job();
this._jobs.length = 0, this._requestInitialized = !0;
} catch (error) {
this._beforeError(error);
}
}
}
_beforeError(error) {
if (this._stopReading)
return;
let { response, options } = this, attemptCount = this.retryCount + (error.name === "RetryError" ? 0 : 1);
this._stopReading = !0, error instanceof RequestError || (error = new RequestError(error.message, error, this));
let typedError = error;
(async () => {
if (response?.readable && !response.rawBody && !this._request?.socket?.destroyed && (response.setEncoding(this.readableEncoding), await this._setRawBody(response) && (response.body = response.rawBody.toString())), this.listenerCount("retry") !== 0) {
let backoff;
try {
let retryAfter;
response && "retry-after" in response.headers && (retryAfter = Number(response.headers["retry-after"]), Number.isNaN(retryAfter) ? (retryAfter = Date.parse(response.headers["retry-after"]) - Date.now(), retryAfter <= 0 && (retryAfter = 1)) : retryAfter *= 1e3);
let retryOptions = options.retry;
backoff = await retryOptions.calculateDelay({
attemptCount,
retryOptions,
error: typedError,
retryAfter,
computedValue: calculate_retry_delay_default({
attemptCount,
retryOptions,
error: typedError,
retryAfter,
computedValue: retryOptions.maxRetryAfter ?? options.timeout.request ?? Number.POSITIVE_INFINITY
})
});
} catch (error_) {
this._error(new RequestError(error_.message, error_, this));
return;
}
if (backoff) {
if (await new Promise((resolve) => {
let timeout = setTimeout(resolve, backoff);
this._stopRetry = () => {
clearTimeout(timeout), resolve();
};
}), this.destroyed)
return;
try {
for (let hook of this.options.hooks.beforeRetry)
await hook(typedError, this.retryCount + 1);
} catch (error_) {
this._error(new RequestError(error_.message, error, this));
return;
}
if (this.destroyed)
return;
this.destroy(), this.emit("retry", this.retryCount + 1, error, (updatedOptions) => {
let request = new _Request(options.url, updatedOptions, options);
return request.retryCount = this.retryCount + 1, process3.nextTick(() => {
request.flush();
}), request;
});
return;
}
}
this._error(typedError);
})();
}
_read() {
this._triggerRead = !0;
let { response } = this;
if (response && !this._stopReading) {
response.readableLength && (this._triggerRead = !1);
let data;
for (; (data = response.read()) !== null; ) {
this._downloadedSize += data.length;
let progress = this.downloadProgress;
progress.percent < 1 && this.emit("downloadProgress", progress), this.push(data);
}
}
}
_write(chunk, encoding, callback) {
let write = () => {
this._writeRequest(chunk, encoding, callback);
};
this._requestInitialized ? write() : this._jobs.push(write);
}
_final(callback) {
let endRequest = () => {
if (!this._request || this._request.destroyed) {
callback();
return;
}
this._request.end((error) => {
this._request._writableState?.errored || (error || (this._bodySize = this._uploadedSize, this.emit("uploadProgress", this.uploadProgress), this._request.emit("upload-complete")), callback(error));
});
};
this._requestInitialized ? endRequest() : this._jobs.push(endRequest);
}
_destroy(error, callback) {
if (this._stopReading = !0, this.flush = async () => {
}, this._stopRetry(), this._cancelTimeouts(), this._removeListeners(), this.options) {
let { body } = this.options;
dist_default.nodeStream(body) && body.destroy();
}
this._request && this._request.destroy(), error !== null && !dist_default.undefined(error) && !(error instanceof RequestError) && (error = new RequestError(error.message, error, this)), callback(error);
}
pipe(destination, options) {
return destination instanceof ServerResponse && this._pipedServerResponses.add(destination), super.pipe(destination, options);
}
unpipe(destination) {
return destination instanceof ServerResponse && this._pipedServerResponses.delete(destination), super.unpipe(destination), this;
}
async _finalizeBody() {
let { options } = this, { headers } = options, isForm = !dist_default.undefined(options.form), isJSON = !dist_default.undefined(options.json), isBody = !dist_default.undefined(options.body), cannotHaveBody = methodsWithoutBody.has(options.method) && !(options.method === "GET" && options.allowGetBody);
if (this._cannotHaveBody = cannotHaveBody, isForm || isJSON || isBody) {
if (cannotHaveBody)
throw new TypeError(`The \`${options.method}\` method cannot be used with a body`);
let noContentType = !dist_default.string(headers["content-type"]);
if (isBody) {
if (isFormData(options.body)) {
let encoder = new FormDataEncoder(options.body);
noContentType && (headers["content-type"] = encoder.headers["Content-Type"]), "Content-Length" in encoder.headers && (headers["content-length"] = encoder.headers["Content-Length"]), options.body = encoder.encode();
}
isFormData2(options.body) && noContentType && (headers["content-type"] = `multipart/form-data; boundary=${options.body.getBoundary()}`);
} else if (isForm) {
noContentType && (headers["content-type"] = "application/x-www-form-urlencoded");
let { form } = options;
options.form = void 0, options.body = new URLSearchParams2(form).toString();
} else {
noContentType && (headers["content-type"] = "application/json");
let { json } = options;
options.json = void 0, options.body = options.stringifyJson(json);
}
let uploadBodySize = await getBodySize(options.body, options.headers);
dist_default.undefined(headers["content-length"]) && dist_default.undefined(headers["transfer-encoding"]) && !cannotHaveBody && !dist_default.undefined(uploadBodySize) && (headers["content-length"] = String(uploadBodySize));
}
options.responseType === "json" && !("accept" in options.headers) && (options.headers.accept = "application/json"), this._bodySize = Number(headers["content-length"]) || void 0;
}
async _onResponseBase(response) {
if (this.isAborted)
return;
let { options } = this, { url } = options;
this._nativeResponse = response, options.decompress && (response = (0, import_decompress_response.default)(response));
let statusCode = response.statusCode, typedResponse = response;
typedResponse.statusMessage = typedResponse.statusMessage ?? http2.STATUS_CODES[statusCode], typedResponse.url = options.url.toString(), typedResponse.requestUrl = this.requestUrl, typedResponse.redirectUrls = this.redirectUrls, typedResponse.request = this, typedResponse.isFromCache = this._nativeResponse.fromCache ?? !1, typedResponse.ip = this.ip, typedResponse.retryCount = this.retryCount, typedResponse.ok = isResponseOk(typedResponse), this._isFromCache = typedResponse.isFromCache, this._responseSize = Number(response.headers["content-length"]) || void 0, this.response = typedResponse, response.once("end", () => {
this._responseSize = this._downloadedSize, this.emit("downloadProgress", this.downloadProgress);
}), response.once("error", (error) => {
this._aborted = !0, response.destroy(), this._beforeError(new ReadError(error, this));
}), response.once("aborted", () => {
this._aborted = !0, this._beforeError(new ReadError({
name: "Error",
message: "The server aborted pending request",
code: "ECONNRESET"
}, this));
}), this.emit("downloadProgress", this.downloadProgress);
let rawCookies = response.headers["set-cookie"];
if (dist_default.object(options.cookieJar) && rawCookies) {
let promises = rawCookies.map(async (rawCookie) => options.cookieJar.setCookie(rawCookie, url.toString()));
options.ignoreInvalidCookies && (promises = promises.map(async (promise) => {
try {
await promise;
} catch {
}
}));
try {
await Promise.all(promises);
} catch (error) {
this._beforeError(error);
return;
}
}
if (!this.isAborted) {
if (options.followRedirect && response.headers.location && redirectCodes.has(statusCode)) {
if (response.resume(), this._cancelTimeouts(), this._unproxyEvents(), this.redirectUrls.length >= options.maxRedirects) {
this._beforeError(new MaxRedirectsError(this));
return;
}
this._request = void 0;
let updatedOptions = new Options(void 0, void 0, this.options), serverRequestedGet = statusCode === 303 && updatedOptions.method !== "GET" && updatedOptions.method !== "HEAD", canRewrite = statusCode !== 307 && statusCode !== 308, userRequestedGet = updatedOptions.methodRewriting && canRewrite;
(serverRequestedGet || userRequestedGet) && (updatedOptions.method = "GET", updatedOptions.body = void 0, updatedOptions.json = void 0, updatedOptions.form = void 0, delete updatedOptions.headers["content-length"]);
try {
let redirectBuffer = Buffer3.from(response.headers.location, "binary").toString(), redirectUrl = new URL3(redirectBuffer, url);
if (!isUnixSocketURL(url) && isUnixSocketURL(redirectUrl)) {
this._beforeError(new RequestError("Cannot redirect to UNIX socket", {}, this));
return;
}
redirectUrl.hostname !== url.hostname || redirectUrl.port !== url.port ? ("host" in updatedOptions.headers && delete updatedOptions.headers.host, "cookie" in updatedOptions.headers && delete updatedOptions.headers.cookie, "authorization" in updatedOptions.headers && delete updatedOptions.headers.authorization, (updatedOptions.username || updatedOptions.password) && (updatedOptions.username = "", updatedOptions.password = "")) : (redirectUrl.username = updatedOptions.username, redirectUrl.password = updatedOptions.password), this.redirectUrls.push(redirectUrl), updatedOptions.prefixUrl = "", updatedOptions.url = redirectUrl;
for (let hook of updatedOptions.hooks.beforeRedirect)
await hook(updatedOptions, typedResponse);
this.emit("redirect", updatedOptions, typedResponse), this.options = updatedOptions, await this._makeRequest();
} catch (error) {
this._beforeError(error);
return;
}
return;
}
if (options.isStream && options.throwHttpErrors && !isResponseOk(typedResponse)) {
this._beforeError(new HTTPError(typedResponse));
return;
}
if (response.on("readable", () => {
this._triggerRead && this._read();
}), this.on("resume", () => {
response.resume();
}), this.on("pause", () => {
response.pause();
}), response.once("end", () => {
this.push(null);
}), this._noPipe) {
await this._setRawBody() && this.emit("response", response);
return;
}
this.emit("response", response);
for (let destination of this._pipedServerResponses)
if (!destination.headersSent) {
for (let key in response.headers) {
let isAllowed = options.decompress ? key !== "content-encoding" : !0, value = response.headers[key];
isAllowed && destination.setHeader(key, value);
}
destination.statusCode = statusCode;
}
}
}
async _setRawBody(from = this) {
if (from.readableEnded)
return !1;
try {
let rawBody = await getBuffer(from);
if (!this.isAborted)
return this.response.rawBody = rawBody, !0;
} catch {
}
return !1;
}
async _onResponse(response) {
try {
await this._onResponseBase(response);
} catch (error) {
this._beforeError(error);
}
}
_onRequest(request) {
let { options } = this, { timeout, url } = options;
source_default(request), this.options.http2 && request.setTimeout(0), this._cancelTimeouts = timedOut(request, timeout, url);
let responseEventName = options.cache ? "cacheableResponse" : "response";
request.once(responseEventName, (response) => {
this._onResponse(response);
}), request.once("error", (error) => {
this._aborted = !0, request.destroy(), error = error instanceof TimeoutError2 ? new TimeoutError(error, this.timings, this) : new RequestError(error.message, error, this), this._beforeError(error);
}), this._unproxyEvents = proxyEvents(request, this, proxiedRequestEvents), this._request = request, this.emit("uploadProgress", this.uploadProgress), this._sendBody(), this.emit("request", request);
}
async _asyncWrite(chunk) {
return new Promise((resolve, reject) => {
super.write(chunk, (error) => {
if (error) {
reject(error);
return;
}
resolve();
});
});
}
_sendBody() {
let { body } = this.options, currentRequest = this.redirectUrls.length === 0 ? this : this._request ?? this;
dist_default.nodeStream(body) ? body.pipe(currentRequest) : dist_default.generator(body) || dist_default.asyncGenerator(body) ? (async () => {
try {
for await (let chunk of body)
await this._asyncWrite(chunk);
super.end();
} catch (error) {
this._beforeError(error);
}
})() : dist_default.undefined(body) ? (this._cannotHaveBody || this._noPipe) && currentRequest.end() : (this._writeRequest(body, void 0, () => {
}), currentRequest.end());
}
_prepareCache(cache) {
if (!cacheableStore.has(cache)) {
let cacheableRequest = new dist_default2(((requestOptions, handler) => {
let result = requestOptions._request(requestOptions, handler);
return dist_default.promise(result) && (result.once = (event, handler2) => {
if (event === "error")
(async () => {
try {
await result;
} catch (error) {
handler2(error);
}
})();
else if (event === "abort")
(async () => {
try {
(await result).once("abort", handler2);
} catch {
}
})();
else
throw new Error(`Unknown HTTP2 promise event: ${event}`);
return result;
}), result;
}), cache);
cacheableStore.set(cache, cacheableRequest.request());
}
}
async _createCacheableRequest(url, options) {
return new Promise((resolve, reject) => {
Object.assign(options, urlToOptions(url));
let request, cacheRequest = cacheableStore.get(options.cache)(options, async (response) => {
if (response._readableState.autoDestroy = !1, request) {
let fix = () => {
response.req && (response.complete = response.req.res.complete);
};
response.prependOnceListener("end", fix), fix(), (await request).emit("cacheableResponse", response);
}
resolve(response);
});
cacheRequest.once("error", reject), cacheRequest.once("request", async (requestOrPromise) => {
request = requestOrPromise, resolve(request);
});
});
}
async _makeRequest() {
let { options } = this, { headers, username, password } = options, cookieJar = options.cookieJar;
for (let key in headers)
if (dist_default.undefined(headers[key]))
delete headers[key];
else if (dist_default.null_(headers[key]))
throw new TypeError(`Use \`undefined\` instead of \`null\` to delete the \`${key}\` header`);
if (options.decompress && dist_default.undefined(headers["accept-encoding"]) && (headers["accept-encoding"] = supportsBrotli ? "gzip, deflate, br" : "gzip, deflate"), username || password) {
let credentials = Buffer3.from(`${username}:${password}`).toString("base64");
headers.authorization = `Basic ${credentials}`;
}
if (cookieJar) {
let cookieString = await cookieJar.getCookieString(options.url.toString());
dist_default.nonEmptyString(cookieString) && (headers.cookie = cookieString);
}
options.prefixUrl = "";
let request;
for (let hook of options.hooks.beforeRequest) {
let result = await hook(options);
if (!dist_default.undefined(result)) {
request = () => result;
break;
}
}
request || (request = options.getRequestFunction());
let url = options.url;
this._requestOptions = options.createNativeRequestOptions(), options.cache && (this._requestOptions._request = request, this._requestOptions.cache = options.cache, this._requestOptions.body = options.body, this._prepareCache(options.cache));
let fn = options.cache ? this._createCacheableRequest : request;
try {
let requestOrResponse = fn(url, this._requestOptions);
dist_default.promise(requestOrResponse) && (requestOrResponse = await requestOrResponse), dist_default.undefined(requestOrResponse) && (requestOrResponse = options.getFallbackRequestFunction()(url, this._requestOptions), dist_default.promise(requestOrResponse) && (requestOrResponse = await requestOrResponse)), is_client_request_default(requestOrResponse) ? this._onRequest(requestOrResponse) : this.writable ? (this.once("finish", () => {
this._onResponse(requestOrResponse);
}), this._sendBody()) : this._onResponse(requestOrResponse);
} catch (error) {
throw error instanceof CacheError2 ? new CacheError(error, this) : error;
}
}
async _error(error) {
try {
if (!(error instanceof HTTPError && !this.options.throwHttpErrors))
for (let hook of this.options.hooks.beforeError)
error = await hook(error);
} catch (error_) {
error = new RequestError(error_.message, error_, this);
}
this.destroy(error);
}
_writeRequest(chunk, encoding, callback) {
!this._request || this._request.destroyed || this._request.write(chunk, encoding, (error) => {
if (!error && !this._request.destroyed) {
this._uploadedSize += Buffer3.byteLength(chunk, encoding);
let progress = this.uploadProgress;
progress.percent < 1 && this.emit("uploadProgress", progress);
}
callback(error);
});
}
/**
The remote IP address.
*/
get ip() {
return this.socket?.remoteAddress;
}
/**
Indicates whether the request has been aborted or not.
*/
get isAborted() {
return this._aborted;
}
get socket() {
return this._request?.socket ?? void 0;
}
/**
Progress event for downloading (receiving a response).
*/
get downloadProgress() {
let percent;
return this._responseSize ? percent = this._downloadedSize / this._responseSize : this._responseSize === this._downloadedSize ? percent = 1 : percent = 0, {
percent,
transferred: this._downloadedSize,
total: this._responseSize
};
}
/**
Progress event for uploading (sending a request).
*/
get uploadProgress() {
let percent;
return this._bodySize ? percent = this._uploadedSize / this._bodySize : this._bodySize === this._uploadedSize ? percent = 1 : percent = 0, {
percent,
transferred: this._uploadedSize,
total: this._bodySize
};
}
/**
The object contains the following properties:
- `start` - Time when the request started.
- `socket` - Time when a socket was assigned to the request.
- `lookup` - Time when the DNS lookup finished.
- `connect` - Time when the socket successfully connected.
- `secureConnect` - Time when the socket securely connected.
- `upload` - Time when the request finished uploading.
- `response` - Time when the request fired `response` event.
- `end` - Time when the response fired `end` event.
- `error` - Time when the request fired `error` event.
- `abort` - Time when the request fired `abort` event.
- `phases`
- `wait` - `timings.socket - timings.start`
- `dns` - `timings.lookup - timings.socket`
- `tcp` - `timings.connect - timings.lookup`
- `tls` - `timings.secureConnect - timings.connect`
- `request` - `timings.upload - (timings.secureConnect || timings.connect)`
- `firstByte` - `timings.response - timings.upload`
- `download` - `timings.end - timings.response`
- `total` - `(timings.end || timings.error || timings.abort) - timings.start`
If something has not been measured yet, it will be `undefined`.
__Note__: The time is a `number` representing the milliseconds elapsed since the UNIX epoch.
*/
get timings() {
return this._request?.timings;
}
/**
Whether the response was retrieved from the cache.
*/
get isFromCache() {
return this._isFromCache;
}
get reusedSocket() {
return this._request?.reusedSocket;
}
};
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/as-promise/types.js
init_cjs_shims();
var CancelError2 = class extends RequestError {
constructor(request) {
super("Promise was canceled", {}, request), this.name = "CancelError", this.code = "ERR_CANCELED";
}
/**
Whether the promise is canceled.
*/
get isCanceled() {
return !0;
}
};
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/as-promise/index.js
var proxiedRequestEvents2 = [
"request",
"response",
"redirect",
"uploadProgress",
"downloadProgress"
];
function asPromise(firstRequest) {
let globalRequest, globalResponse, normalizedOptions, emitter = new EventEmitter2(), promise = new PCancelable((resolve, reject, onCancel) => {
onCancel(() => {
globalRequest.destroy();
}), onCancel.shouldReject = !1, onCancel(() => {
reject(new CancelError2(globalRequest));
});
let makeRequest = (retryCount) => {
onCancel(() => {
});
let request = firstRequest ?? new Request(void 0, void 0, normalizedOptions);
request.retryCount = retryCount, request._noPipe = !0, globalRequest = request, request.once("response", async (response) => {
let contentEncoding = (response.headers["content-encoding"] ?? "").toLowerCase(), isCompressed = contentEncoding === "gzip" || contentEncoding === "deflate" || contentEncoding === "br", { options } = request;
if (isCompressed && !options.decompress)
response.body = response.rawBody;
else
try {
response.body = parseBody(response, options.responseType, options.parseJson, options.encoding);
} catch (error) {
if (response.body = response.rawBody.toString(), isResponseOk(response)) {
request._beforeError(error);
return;
}
}
try {
let hooks = options.hooks.afterResponse;
for (let [index, hook] of hooks.entries())
if (response = await hook(response, async (updatedOptions) => {
throw options.merge(updatedOptions), options.prefixUrl = "", updatedOptions.url && (options.url = updatedOptions.url), options.hooks.afterResponse = options.hooks.afterResponse.slice(0, index), new RetryError(request);
}), !(dist_default.object(response) && dist_default.number(response.statusCode) && !dist_default.nullOrUndefined(response.body)))
throw new TypeError("The `afterResponse` hook returned an invalid value");
} catch (error) {
request._beforeError(error);
return;
}
if (globalResponse = response, !isResponseOk(response)) {
request._beforeError(new HTTPError(response));
return;
}
request.destroy(), resolve(request.options.resolveBodyOnly ? response.body : response);
});
let onError = (error) => {
if (promise.isCanceled)
return;
let { options } = request;
if (error instanceof HTTPError && !options.throwHttpErrors) {
let { response } = error;
request.destroy(), resolve(request.options.resolveBodyOnly ? response.body : response);
return;
}
reject(error);
};
request.once("error", onError);
let previousBody = request.options?.body;
request.once("retry", (newRetryCount, error) => {
firstRequest = void 0;
let newBody = request.options.body;
if (previousBody === newBody && dist_default.nodeStream(newBody)) {
error.message = "Cannot retry with consumed body stream", onError(error);
return;
}
normalizedOptions = request.options, makeRequest(newRetryCount);
}), proxyEvents(request, emitter, proxiedRequestEvents2), dist_default.undefined(firstRequest) && request.flush();
};
makeRequest(0);
});
promise.on = (event, fn) => (emitter.on(event, fn), promise), promise.off = (event, fn) => (emitter.off(event, fn), promise);
let shortcut = (responseType) => {
let newPromise = (async () => {
await promise;
let { options } = globalResponse.request;
return parseBody(globalResponse, responseType, options.parseJson, options.encoding);
})();
return Object.defineProperties(newPromise, Object.getOwnPropertyDescriptors(promise)), newPromise;
};
return promise.json = () => {
if (globalRequest.options) {
let { headers } = globalRequest.options;
!globalRequest.writableFinished && !("accept" in headers) && (headers.accept = "application/json");
}
return shortcut("json");
}, promise.buffer = () => shortcut("buffer"), promise.text = () => shortcut("text"), promise;
}
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/create.js
var delay = async (ms) => new Promise((resolve) => {
setTimeout(resolve, ms);
}), isGotInstance = (value) => dist_default.function_(value), aliases = [
"get",
"post",
"put",
"patch",
"head",
"delete"
], create = (defaults2) => {
defaults2 = {
options: new Options(void 0, void 0, defaults2.options),
handlers: [...defaults2.handlers],
mutableDefaults: defaults2.mutableDefaults
}, Object.defineProperty(defaults2, "mutableDefaults", {
enumerable: !0,
configurable: !1,
writable: !1
});
let got2 = ((url, options, defaultOptions2 = defaults2.options) => {
let request = new Request(url, options, defaultOptions2), promise, lastHandler = (normalized) => (request.options = normalized, request._noPipe = !normalized.isStream, request.flush(), normalized.isStream ? request : (promise || (promise = asPromise(request)), promise)), iteration = 0, iterateHandlers = (newOptions) => {
let result = (defaults2.handlers[iteration++] ?? lastHandler)(newOptions, iterateHandlers);
if (dist_default.promise(result) && !request.options.isStream && (promise || (promise = asPromise(request)), result !== promise)) {
let descriptors = Object.getOwnPropertyDescriptors(promise);
for (let key in descriptors)
key in result && delete descriptors[key];
Object.defineProperties(result, descriptors), result.cancel = promise.cancel;
}
return result;
};
return iterateHandlers(request.options);
});
got2.extend = (...instancesOrOptions) => {
let options = new Options(void 0, void 0, defaults2.options), handlers = [...defaults2.handlers], mutableDefaults;
for (let value of instancesOrOptions)
isGotInstance(value) ? (options.merge(value.defaults.options), handlers.push(...value.defaults.handlers), mutableDefaults = value.defaults.mutableDefaults) : (options.merge(value), value.handlers && handlers.push(...value.handlers), mutableDefaults = value.mutableDefaults);
return create({
options,
handlers,
mutableDefaults: !!mutableDefaults
});
};
let paginateEach = (async function* (url, options) {
let normalizedOptions = new Options(url, options, defaults2.options);
normalizedOptions.resolveBodyOnly = !1;
let { pagination } = normalizedOptions;
assert.function_(pagination.transform), assert.function_(pagination.shouldContinue), assert.function_(pagination.filter), assert.function_(pagination.paginate), assert.number(pagination.countLimit), assert.number(pagination.requestLimit), assert.number(pagination.backoff);
let allItems = [], { countLimit } = pagination, numberOfRequests = 0;
for (; numberOfRequests < pagination.requestLimit; ) {
numberOfRequests !== 0 && await delay(pagination.backoff);
let response = await got2(void 0, void 0, normalizedOptions), parsed = await pagination.transform(response), currentItems = [];
assert.array(parsed);
for (let item of parsed)
if (pagination.filter({ item, currentItems, allItems }) && (!pagination.shouldContinue({ item, currentItems, allItems }) || (yield item, pagination.stackAllItems && allItems.push(item), currentItems.push(item), --countLimit <= 0)))
return;
let optionsToMerge = pagination.paginate({
response,
currentItems,
allItems
});
if (optionsToMerge === !1)
return;
optionsToMerge === response.request.options ? normalizedOptions = response.request.options : (normalizedOptions.merge(optionsToMerge), assert.any([dist_default.urlInstance, dist_default.undefined], optionsToMerge.url), optionsToMerge.url !== void 0 && (normalizedOptions.prefixUrl = "", normalizedOptions.url = optionsToMerge.url)), numberOfRequests++;
}
});
got2.paginate = paginateEach, got2.paginate.all = (async (url, options) => {
let results = [];
for await (let item of paginateEach(url, options))
results.push(item);
return results;
}), got2.paginate.each = paginateEach, got2.stream = ((url, options) => got2(url, { ...options, isStream: !0 }));
for (let method of aliases)
got2[method] = ((url, options) => got2(url, { ...options, method })), got2.stream[method] = ((url, options) => got2(url, { ...options, method, isStream: !0 }));
return defaults2.mutableDefaults || (Object.freeze(defaults2.handlers), defaults2.options.freeze()), Object.defineProperty(got2, "defaults", {
value: defaults2,
writable: !1,
configurable: !1,
enumerable: !0
}), got2;
}, create_default = create;
// ../../node_modules/.pnpm/got@12.6.1/node_modules/got/dist/source/index.js
var defaults = {
options: new Options(),
handlers: [],
mutableDefaults: !1
}, got = create_default(defaults), source_default2 = got;
// ../../node_modules/.pnpm/registry-url@6.0.1/node_modules/registry-url/index.js
init_cjs_shims();
var import_rc = __toESM(require_rc(), 1);
function registryUrl(scope) {
let result = (0, import_rc.default)("npm", { registry: "https://registry.npmjs.org/" }), url = result[`${scope}:registry`] || result.config_registry || result.registry;
return url.slice(-1) === "/" ? url : `${url}/`;
}
// ../../node_modules/.pnpm/package-json@8.1.1/node_modules/package-json/index.js
var import_registry_auth_token = __toESM(require_registry_auth_token(), 1), import_semver = __toESM(require_semver(), 1), agentOptions = {
keepAlive: !0,
maxSockets: 50
}, httpAgent = new HttpAgent(agentOptions), httpsAgent = new HttpsAgent(agentOptions), PackageNotFoundError = class extends Error {
constructor(packageName) {
super(`Package \`${packageName}\` could not be found`), this.name = "PackageNotFoundError";
}
}, VersionNotFoundError = class extends Error {
constructor(packageName, version) {
super(`Version \`${version}\` for package \`${packageName}\` could not be found`), this.name = "VersionNotFoundError";
}
};
async function packageJson(packageName, options) {
options = {
version: "latest",
...options
};
let scope = packageName.split("/")[0], registryUrl_ = options.registryUrl || registryUrl(scope), packageUrl = new URL(encodeURIComponent(packageName).replace(/^%40/, "@"), registryUrl_), authInfo = (0, import_registry_auth_token.default)(registryUrl_.toString(), { recursive: !0 }), headers = {
accept: "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"
};
options.fullMetadata && delete headers.accept, authInfo && (headers.authorization = `${authInfo.type} ${authInfo.token}`);
let gotOptions = {
headers,
agent: {
http: httpAgent,
https: httpsAgent
}
};
options.agent && (gotOptions.agent = options.agent);
let data;
try {
data = await source_default2(packageUrl, gotOptions).json();
} catch (error) {
throw error?.response?.statusCode === 404 ? new PackageNotFoundError(packageName) : error;
}
if (options.allVersions)
return data;
let { version } = options, versionError = new VersionNotFoundError(packageName, version);
if (data["dist-tags"][version]) {
let time = data.time;
data = data.versions[data["dist-tags"][version]], data.time = time;
} else if (version) {
if (!data.versions[version]) {
let versions = Object.keys(data.versions);
if (version = import_semver.default.maxSatisfying(versions, version), !version)
throw versionError;
}
let time = data.time;
if (data = data.versions[version], data.time = time, !data)
throw versionError;
}
return data;
}
// ../../node_modules/.pnpm/latest-version@7.0.0/node_modules/latest-version/index.js
async function latestVersion(packageName, options) {
let { version } = await packageJson(packageName.toLowerCase(), options);
return version;
}
export {
latestVersion as default
};
/*! Bundled license information:
deep-extend/lib/deep-extend.js:
(*!
* @description Recursive object extending
* @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
* @license MIT
*
* The MIT License (MIT)
*
* Copyright (c) 2013-2018 Viacheslav Lotsmanov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*)
*/
//# sourceMappingURL=latest-version-HW6YILV7.js.map