' + body + "\n\n\n"; + } + module2.exports = finalhandler; + function finalhandler(req, res, options) { + var opts = options || {}; + var env = opts.env || process.env.NODE_ENV || "development"; + var onerror = opts.onerror; + return function(err) { + var headers; + var msg; + var status; + if (!err && headersSent(res)) { + debug("cannot 404 after headers sent"); + return; + } + if (err) { + status = getErrorStatusCode(err); + if (status === void 0) { + status = getResponseStatusCode(res); + } else { + headers = getErrorHeaders(err); + } + msg = getErrorMessage(err, status, env); + } else { + status = 404; + msg = "Cannot " + req.method + " " + encodeUrl(getResourceName(req)); + } + debug("default %s", status); + if (err && onerror) { + defer(onerror, err, req, res); + } + if (headersSent(res)) { + debug("cannot %d after headers sent", status); + req.socket.destroy(); + return; + } + send(req, res, status, headers, msg); + }; + } + function getErrorHeaders(err) { + if (!err.headers || typeof err.headers !== "object") { + return void 0; + } + var headers = Object.create(null); + var keys = Object.keys(err.headers); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + headers[key] = err.headers[key]; + } + return headers; + } + function getErrorMessage(err, status, env) { + var msg; + if (env !== "production") { + msg = err.stack; + if (!msg && typeof err.toString === "function") { + msg = err.toString(); + } + } + return msg || statuses[status]; + } + function getErrorStatusCode(err) { + if (typeof err.status === "number" && err.status >= 400 && err.status < 600) { + return err.status; + } + if (typeof err.statusCode === "number" && err.statusCode >= 400 && err.statusCode < 600) { + return err.statusCode; + } + return void 0; + } + function getResourceName(req) { + try { + return parseUrl.original(req).pathname; + } catch (e) { + return "resource"; + } + } + function getResponseStatusCode(res) { + var status = res.statusCode; + if (typeof status !== "number" || status < 400 || status > 599) { + status = 500; + } + return status; + } + function headersSent(res) { + return typeof res.headersSent !== "boolean" ? Boolean(res._header) : res.headersSent; + } + function send(req, res, status, headers, message) { + function write() { + var body = createHtmlDocument(message); + res.statusCode = status; + res.statusMessage = statuses[status]; + setHeaders(res, headers); + res.setHeader("Content-Security-Policy", "default-src 'none'"); + res.setHeader("X-Content-Type-Options", "nosniff"); + res.setHeader("Content-Type", "text/html; charset=utf-8"); + res.setHeader("Content-Length", Buffer.byteLength(body, "utf8")); + if (req.method === "HEAD") { + res.end(); + return; + } + res.end(body, "utf8"); + } + if (isFinished(req)) { + write(); + return; + } + unpipe(req); + onFinished(req, write); + req.resume(); + } + function setHeaders(res, headers) { + if (!headers) { + return; + } + var keys = Object.keys(headers); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + res.setHeader(key, headers[key]); + } + } +}); + +// node_modules/express/node_modules/ms/index.js +var require_ms4 = __commonJS((exports2, module2) => { + var s = 1e3; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var y = d * 365.25; + module2.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === "string" && val.length > 0) { + return parse(val); + } else if (type === "number" && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val)); + }; + function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || "ms").toLowerCase(); + switch (type) { + case "years": + case "year": + case "yrs": + case "yr": + case "y": + return n * y; + case "days": + case "day": + case "d": + return n * d; + case "hours": + case "hour": + case "hrs": + case "hr": + case "h": + return n * h; + case "minutes": + case "minute": + case "mins": + case "min": + case "m": + return n * m; + case "seconds": + case "second": + case "secs": + case "sec": + case "s": + return n * s; + case "milliseconds": + case "millisecond": + case "msecs": + case "msec": + case "ms": + return n; + default: + return void 0; + } + } + function fmtShort(ms) { + if (ms >= d) { + return Math.round(ms / d) + "d"; + } + if (ms >= h) { + return Math.round(ms / h) + "h"; + } + if (ms >= m) { + return Math.round(ms / m) + "m"; + } + if (ms >= s) { + return Math.round(ms / s) + "s"; + } + return ms + "ms"; + } + function fmtLong(ms) { + return plural(ms, d, "day") || plural(ms, h, "hour") || plural(ms, m, "minute") || plural(ms, s, "second") || ms + " ms"; + } + function plural(ms, n, name) { + if (ms < n) { + return; + } + if (ms < n * 1.5) { + return Math.floor(ms / n) + " " + name; + } + return Math.ceil(ms / n) + " " + name + "s"; + } +}); + +// node_modules/express/node_modules/debug/src/debug.js +var require_debug5 = __commonJS((exports2, module2) => { + exports2 = module2.exports = createDebug.debug = createDebug["default"] = createDebug; + exports2.coerce = coerce; + exports2.disable = disable; + exports2.enable = enable; + exports2.enabled = enabled; + exports2.humanize = require_ms4(); + exports2.names = []; + exports2.skips = []; + exports2.formatters = {}; + var prevTime; + function selectColor(namespace) { + var hash = 0, i; + for (i in namespace) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; + } + return exports2.colors[Math.abs(hash) % exports2.colors.length]; + } + function createDebug(namespace) { + function debug() { + if (!debug.enabled) + return; + var self2 = debug; + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self2.diff = ms; + self2.prev = prevTime; + self2.curr = curr; + prevTime = curr; + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + args[0] = exports2.coerce(args[0]); + if (typeof args[0] !== "string") { + args.unshift("%O"); + } + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { + if (match === "%%") + return match; + index++; + var formatter = exports2.formatters[format]; + if (typeof formatter === "function") { + var val = args[index]; + match = formatter.call(self2, val); + args.splice(index, 1); + index--; + } + return match; + }); + exports2.formatArgs.call(self2, args); + var logFn = debug.log || exports2.log || console.log.bind(console); + logFn.apply(self2, args); + } + debug.namespace = namespace; + debug.enabled = exports2.enabled(namespace); + debug.useColors = exports2.useColors(); + debug.color = selectColor(namespace); + if (typeof exports2.init === "function") { + exports2.init(debug); + } + return debug; + } + function enable(namespaces) { + exports2.save(namespaces); + exports2.names = []; + exports2.skips = []; + var split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/); + var len = split.length; + for (var i = 0; i < len; i++) { + if (!split[i]) + continue; + namespaces = split[i].replace(/\*/g, ".*?"); + if (namespaces[0] === "-") { + exports2.skips.push(new RegExp("^" + namespaces.substr(1) + "$")); + } else { + exports2.names.push(new RegExp("^" + namespaces + "$")); + } + } + } + function disable() { + exports2.enable(""); + } + function enabled(name) { + var i, len; + for (i = 0, len = exports2.skips.length; i < len; i++) { + if (exports2.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports2.names.length; i < len; i++) { + if (exports2.names[i].test(name)) { + return true; + } + } + return false; + } + function coerce(val) { + if (val instanceof Error) + return val.stack || val.message; + return val; + } +}); + +// node_modules/express/node_modules/debug/src/browser.js +var require_browser6 = __commonJS((exports2, module2) => { + exports2 = module2.exports = require_debug5(); + exports2.log = log2; + exports2.formatArgs = formatArgs; + exports2.save = save; + exports2.load = load; + exports2.useColors = useColors; + exports2.storage = typeof chrome != "undefined" && typeof chrome.storage != "undefined" ? chrome.storage.local : localstorage(); + exports2.colors = [ + "lightseagreen", + "forestgreen", + "goldenrod", + "dodgerblue", + "darkorchid", + "crimson" + ]; + function useColors() { + if (typeof window !== "undefined" && window.process && window.process.type === "renderer") { + return true; + } + return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + } + exports2.formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (err) { + return "[UnexpectedJSONParseError]: " + err.message; + } + }; + function formatArgs(args) { + var useColors2 = this.useColors; + args[0] = (useColors2 ? "%c" : "") + this.namespace + (useColors2 ? " %c" : " ") + args[0] + (useColors2 ? "%c " : " ") + "+" + exports2.humanize(this.diff); + if (!useColors2) + return; + var c = "color: " + this.color; + args.splice(1, 0, c, "color: inherit"); + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function(match) { + if (match === "%%") + return; + index++; + if (match === "%c") { + lastC = index; + } + }); + args.splice(lastC, 0, c); + } + function log2() { + return typeof console === "object" && console.log && Function.prototype.apply.call(console.log, console, arguments); + } + function save(namespaces) { + try { + if (namespaces == null) { + exports2.storage.removeItem("debug"); + } else { + exports2.storage.debug = namespaces; + } + } catch (e) { + } + } + function load() { + var r; + try { + r = exports2.storage.debug; + } catch (e) { + } + if (!r && typeof process !== "undefined" && "env" in process) { + r = process.env.DEBUG; + } + return r; + } + exports2.enable(load()); + function localstorage() { + try { + return window.localStorage; + } catch (e) { + } + } +}); + +// node_modules/express/node_modules/debug/src/node.js +var require_node6 = __commonJS((exports2, module2) => { + var tty = require("tty"); + var util = require("util"); + exports2 = module2.exports = require_debug5(); + exports2.init = init; + exports2.log = log2; + exports2.formatArgs = formatArgs; + exports2.save = save; + exports2.load = load; + exports2.useColors = useColors; + exports2.colors = [6, 2, 3, 4, 5, 1]; + exports2.inspectOpts = Object.keys(process.env).filter(function(key) { + return /^debug_/i.test(key); + }).reduce(function(obj, key) { + var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function(_, k) { + return k.toUpperCase(); + }); + var val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) + val = true; + else if (/^(no|off|false|disabled)$/i.test(val)) + val = false; + else if (val === "null") + val = null; + else + val = Number(val); + obj[prop] = val; + return obj; + }, {}); + var fd = parseInt(process.env.DEBUG_FD, 10) || 2; + if (fd !== 1 && fd !== 2) { + util.deprecate(function() { + }, "except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)")(); + } + var stream = fd === 1 ? process.stdout : fd === 2 ? process.stderr : createWritableStdioStream(fd); + function useColors() { + return "colors" in exports2.inspectOpts ? Boolean(exports2.inspectOpts.colors) : tty.isatty(fd); + } + exports2.formatters.o = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts).split("\n").map(function(str) { + return str.trim(); + }).join(" "); + }; + exports2.formatters.O = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); + }; + function formatArgs(args) { + var name = this.namespace; + var useColors2 = this.useColors; + if (useColors2) { + var c = this.color; + var prefix = " [3" + c + ";1m" + name + " [0m"; + args[0] = prefix + args[0].split("\n").join("\n" + prefix); + args.push("[3" + c + "m+" + exports2.humanize(this.diff) + "[0m"); + } else { + args[0] = new Date().toUTCString() + " " + name + " " + args[0]; + } + } + function log2() { + return stream.write(util.format.apply(util, arguments) + "\n"); + } + function save(namespaces) { + if (namespaces == null) { + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } + } + function load() { + return process.env.DEBUG; + } + function createWritableStdioStream(fd2) { + var stream2; + var tty_wrap = process.binding("tty_wrap"); + switch (tty_wrap.guessHandleType(fd2)) { + case "TTY": + stream2 = new tty.WriteStream(fd2); + stream2._type = "tty"; + if (stream2._handle && stream2._handle.unref) { + stream2._handle.unref(); + } + break; + case "FILE": + var fs = require("fs"); + stream2 = new fs.SyncWriteStream(fd2, {autoClose: false}); + stream2._type = "fs"; + break; + case "PIPE": + case "TCP": + var net = require("net"); + stream2 = new net.Socket({ + fd: fd2, + readable: false, + writable: true + }); + stream2.readable = false; + stream2.read = null; + stream2._type = "pipe"; + if (stream2._handle && stream2._handle.unref) { + stream2._handle.unref(); + } + break; + default: + throw new Error("Implement me. Unknown stream file type!"); + } + stream2.fd = fd2; + stream2._isStdio = true; + return stream2; + } + function init(debug) { + debug.inspectOpts = {}; + var keys = Object.keys(exports2.inspectOpts); + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]]; + } + } + exports2.enable(load()); +}); + +// node_modules/express/node_modules/debug/src/index.js +var require_src6 = __commonJS((exports2, module2) => { + if (typeof process !== "undefined" && process.type === "renderer") { + module2.exports = require_browser6(); + } else { + module2.exports = require_node6(); + } +}); + +// node_modules/array-flatten/array-flatten.js +var require_array_flatten = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = arrayFlatten; + function flattenWithDepth(array, result, depth) { + for (var i = 0; i < array.length; i++) { + var value = array[i]; + if (depth > 0 && Array.isArray(value)) { + flattenWithDepth(value, result, depth - 1); + } else { + result.push(value); + } + } + return result; + } + function flattenForever(array, result) { + for (var i = 0; i < array.length; i++) { + var value = array[i]; + if (Array.isArray(value)) { + flattenForever(value, result); + } else { + result.push(value); + } + } + return result; + } + function arrayFlatten(array, depth) { + if (depth == null) { + return flattenForever(array, []); + } + return flattenWithDepth(array, [], depth); + } +}); + +// node_modules/path-to-regexp/index.js +var require_path_to_regexp = __commonJS((exports2, module2) => { + module2.exports = pathtoRegexp; + var MATCHING_GROUP_REGEXP = /\((?!\?)/g; + function pathtoRegexp(path, keys, options) { + options = options || {}; + keys = keys || []; + var strict = options.strict; + var end = options.end !== false; + var flags = options.sensitive ? "" : "i"; + var extraOffset = 0; + var keysOffset = keys.length; + var i = 0; + var name = 0; + var m; + if (path instanceof RegExp) { + while (m = MATCHING_GROUP_REGEXP.exec(path.source)) { + keys.push({ + name: name++, + optional: false, + offset: m.index + }); + } + return path; + } + if (Array.isArray(path)) { + path = path.map(function(value) { + return pathtoRegexp(value, keys, options).source; + }); + return new RegExp("(?:" + path.join("|") + ")", flags); + } + path = ("^" + path + (strict ? "" : path[path.length - 1] === "/" ? "?" : "/?")).replace(/\/\(/g, "/(?:").replace(/([\/\.])/g, "\\$1").replace(/(\\\/)?(\\\.)?:(\w+)(\(.*?\))?(\*)?(\?)?/g, function(match, slash, format, key, capture, star, optional, offset) { + slash = slash || ""; + format = format || ""; + capture = capture || "([^\\/" + format + "]+?)"; + optional = optional || ""; + keys.push({ + name: key, + optional: !!optional, + offset: offset + extraOffset + }); + var result = "" + (optional ? "" : slash) + "(?:" + format + (optional ? slash : "") + capture + (star ? "((?:[\\/" + format + "].+?)?)" : "") + ")" + optional; + extraOffset += result.length - match.length; + return result; + }).replace(/\*/g, function(star, index2) { + var len = keys.length; + while (len-- > keysOffset && keys[len].offset > index2) { + keys[len].offset += 3; + } + return "(.*)"; + }); + while (m = MATCHING_GROUP_REGEXP.exec(path)) { + var escapeCount = 0; + var index = m.index; + while (path.charAt(--index) === "\\") { + escapeCount++; + } + if (escapeCount % 2 === 1) { + continue; + } + if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) { + keys.splice(keysOffset + i, 0, { + name: name++, + optional: false, + offset: m.index + }); + } + i++; + } + path += end ? "$" : path[path.length - 1] === "/" ? "" : "(?=\\/|$)"; + return new RegExp(path, flags); + } +}); + +// node_modules/express/lib/router/layer.js +var require_layer = __commonJS((exports2, module2) => { + /*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + "use strict"; + var pathRegexp = require_path_to_regexp(); + var debug = require_src6()("express:router:layer"); + var hasOwnProperty2 = Object.prototype.hasOwnProperty; + module2.exports = Layer; + function Layer(path, options, fn) { + if (!(this instanceof Layer)) { + return new Layer(path, options, fn); + } + debug("new %o", path); + var opts = options || {}; + this.handle = fn; + this.name = fn.name || "
" + body + "\n\n\n"; + } + function decode(path2) { + try { + return decodeURIComponent(path2); + } catch (err) { + return -1; + } + } + function getHeaderNames(res) { + return typeof res.getHeaderNames !== "function" ? Object.keys(res._headers || {}) : res.getHeaderNames(); + } + function hasListeners(emitter, type) { + var count = typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type); + return count > 0; + } + function headersSent(res) { + return typeof res.headersSent !== "boolean" ? Boolean(res._header) : res.headersSent; + } + function normalizeList(val, name) { + var list = [].concat(val || []); + for (var i = 0; i < list.length; i++) { + if (typeof list[i] !== "string") { + throw new TypeError(name + " must be array of strings or false"); + } + } + return list; + } + function parseHttpDate(date) { + var timestamp = date && Date.parse(date); + return typeof timestamp === "number" ? timestamp : NaN; + } + function parseTokenList(str) { + var end = 0; + var list = []; + var start = 0; + for (var i = 0, len = str.length; i < len; i++) { + switch (str.charCodeAt(i)) { + case 32: + if (start === end) { + start = end = i + 1; + } + break; + case 44: + list.push(str.substring(start, end)); + start = end = i + 1; + break; + default: + end = i + 1; + break; + } + } + list.push(str.substring(start, end)); + return list; + } + function setHeaders(res, headers) { + var keys = Object.keys(headers); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + res.setHeader(key, headers[key]); + } + } +}); + +// node_modules/forwarded/index.js +var require_forwarded = __commonJS((exports2, module2) => { + /*! + * forwarded + * Copyright(c) 2014-2017 Douglas Christopher Wilson + * MIT Licensed + */ + "use strict"; + module2.exports = forwarded; + function forwarded(req) { + if (!req) { + throw new TypeError("argument req is required"); + } + var proxyAddrs = parse(req.headers["x-forwarded-for"] || ""); + var socketAddr = req.connection.remoteAddress; + var addrs = [socketAddr].concat(proxyAddrs); + return addrs; + } + function parse(header) { + var end = header.length; + var list = []; + var start = header.length; + for (var i = header.length - 1; i >= 0; i--) { + switch (header.charCodeAt(i)) { + case 32: + if (start === end) { + start = end = i; + } + break; + case 44: + if (start !== end) { + list.push(header.substring(start, end)); + } + start = end = i; + break; + default: + start = i; + break; + } + } + if (start !== end) { + list.push(header.substring(start, end)); + } + return list; + } +}); + +// node_modules/ipaddr.js/lib/ipaddr.js +var require_ipaddr = __commonJS((exports2, module2) => { + (function() { + var expandIPv6, ipaddr, ipv4Part, ipv4Regexes, ipv6Part, ipv6Regexes, matchCIDR, root, zoneIndex; + ipaddr = {}; + root = this; + if (typeof module2 !== "undefined" && module2 !== null && module2.exports) { + module2.exports = ipaddr; + } else { + root["ipaddr"] = ipaddr; + } + matchCIDR = function(first, second, partSize, cidrBits) { + var part, shift; + if (first.length !== second.length) { + throw new Error("ipaddr: cannot match CIDR for objects with different lengths"); + } + part = 0; + while (cidrBits > 0) { + shift = partSize - cidrBits; + if (shift < 0) { + shift = 0; + } + if (first[part] >> shift !== second[part] >> shift) { + return false; + } + cidrBits -= partSize; + part += 1; + } + return true; + }; + ipaddr.subnetMatch = function(address, rangeList, defaultName) { + var k, len, rangeName, rangeSubnets, subnet; + if (defaultName == null) { + defaultName = "unicast"; + } + for (rangeName in rangeList) { + rangeSubnets = rangeList[rangeName]; + if (rangeSubnets[0] && !(rangeSubnets[0] instanceof Array)) { + rangeSubnets = [rangeSubnets]; + } + for (k = 0, len = rangeSubnets.length; k < len; k++) { + subnet = rangeSubnets[k]; + if (address.kind() === subnet[0].kind()) { + if (address.match.apply(address, subnet)) { + return rangeName; + } + } + } + } + return defaultName; + }; + ipaddr.IPv4 = function() { + function IPv4(octets) { + var k, len, octet; + if (octets.length !== 4) { + throw new Error("ipaddr: ipv4 octet count should be 4"); + } + for (k = 0, len = octets.length; k < len; k++) { + octet = octets[k]; + if (!(0 <= octet && octet <= 255)) { + throw new Error("ipaddr: ipv4 octet should fit in 8 bits"); + } + } + this.octets = octets; + } + IPv4.prototype.kind = function() { + return "ipv4"; + }; + IPv4.prototype.toString = function() { + return this.octets.join("."); + }; + IPv4.prototype.toNormalizedString = function() { + return this.toString(); + }; + IPv4.prototype.toByteArray = function() { + return this.octets.slice(0); + }; + IPv4.prototype.match = function(other, cidrRange) { + var ref; + if (cidrRange === void 0) { + ref = other, other = ref[0], cidrRange = ref[1]; + } + if (other.kind() !== "ipv4") { + throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one"); + } + return matchCIDR(this.octets, other.octets, 8, cidrRange); + }; + IPv4.prototype.SpecialRanges = { + unspecified: [[new IPv4([0, 0, 0, 0]), 8]], + broadcast: [[new IPv4([255, 255, 255, 255]), 32]], + multicast: [[new IPv4([224, 0, 0, 0]), 4]], + linkLocal: [[new IPv4([169, 254, 0, 0]), 16]], + loopback: [[new IPv4([127, 0, 0, 0]), 8]], + carrierGradeNat: [[new IPv4([100, 64, 0, 0]), 10]], + private: [[new IPv4([10, 0, 0, 0]), 8], [new IPv4([172, 16, 0, 0]), 12], [new IPv4([192, 168, 0, 0]), 16]], + reserved: [[new IPv4([192, 0, 0, 0]), 24], [new IPv4([192, 0, 2, 0]), 24], [new IPv4([192, 88, 99, 0]), 24], [new IPv4([198, 51, 100, 0]), 24], [new IPv4([203, 0, 113, 0]), 24], [new IPv4([240, 0, 0, 0]), 4]] + }; + IPv4.prototype.range = function() { + return ipaddr.subnetMatch(this, this.SpecialRanges); + }; + IPv4.prototype.toIPv4MappedAddress = function() { + return ipaddr.IPv6.parse("::ffff:" + this.toString()); + }; + IPv4.prototype.prefixLengthFromSubnetMask = function() { + var cidr, i, k, octet, stop, zeros, zerotable; + zerotable = { + 0: 8, + 128: 7, + 192: 6, + 224: 5, + 240: 4, + 248: 3, + 252: 2, + 254: 1, + 255: 0 + }; + cidr = 0; + stop = false; + for (i = k = 3; k >= 0; i = k += -1) { + octet = this.octets[i]; + if (octet in zerotable) { + zeros = zerotable[octet]; + if (stop && zeros !== 0) { + return null; + } + if (zeros !== 8) { + stop = true; + } + cidr += zeros; + } else { + return null; + } + } + return 32 - cidr; + }; + return IPv4; + }(); + ipv4Part = "(0?\\d+|0x[a-f0-9]+)"; + ipv4Regexes = { + fourOctet: new RegExp("^" + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "$", "i"), + longValue: new RegExp("^" + ipv4Part + "$", "i") + }; + ipaddr.IPv4.parser = function(string) { + var match, parseIntAuto, part, shift, value; + parseIntAuto = function(string2) { + if (string2[0] === "0" && string2[1] !== "x") { + return parseInt(string2, 8); + } else { + return parseInt(string2); + } + }; + if (match = string.match(ipv4Regexes.fourOctet)) { + return function() { + var k, len, ref, results; + ref = match.slice(1, 6); + results = []; + for (k = 0, len = ref.length; k < len; k++) { + part = ref[k]; + results.push(parseIntAuto(part)); + } + return results; + }(); + } else if (match = string.match(ipv4Regexes.longValue)) { + value = parseIntAuto(match[1]); + if (value > 4294967295 || value < 0) { + throw new Error("ipaddr: address outside defined range"); + } + return function() { + var k, results; + results = []; + for (shift = k = 0; k <= 24; shift = k += 8) { + results.push(value >> shift & 255); + } + return results; + }().reverse(); + } else { + return null; + } + }; + ipaddr.IPv6 = function() { + function IPv6(parts, zoneId) { + var i, k, l, len, part, ref; + if (parts.length === 16) { + this.parts = []; + for (i = k = 0; k <= 14; i = k += 2) { + this.parts.push(parts[i] << 8 | parts[i + 1]); + } + } else if (parts.length === 8) { + this.parts = parts; + } else { + throw new Error("ipaddr: ipv6 part count should be 8 or 16"); + } + ref = this.parts; + for (l = 0, len = ref.length; l < len; l++) { + part = ref[l]; + if (!(0 <= part && part <= 65535)) { + throw new Error("ipaddr: ipv6 part should fit in 16 bits"); + } + } + if (zoneId) { + this.zoneId = zoneId; + } + } + IPv6.prototype.kind = function() { + return "ipv6"; + }; + IPv6.prototype.toString = function() { + return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/, "::"); + }; + IPv6.prototype.toRFC5952String = function() { + var bestMatchIndex, bestMatchLength, match, regex, string; + regex = /((^|:)(0(:|$)){2,})/g; + string = this.toNormalizedString(); + bestMatchIndex = 0; + bestMatchLength = -1; + while (match = regex.exec(string)) { + if (match[0].length > bestMatchLength) { + bestMatchIndex = match.index; + bestMatchLength = match[0].length; + } + } + if (bestMatchLength < 0) { + return string; + } + return string.substring(0, bestMatchIndex) + "::" + string.substring(bestMatchIndex + bestMatchLength); + }; + IPv6.prototype.toByteArray = function() { + var bytes, k, len, part, ref; + bytes = []; + ref = this.parts; + for (k = 0, len = ref.length; k < len; k++) { + part = ref[k]; + bytes.push(part >> 8); + bytes.push(part & 255); + } + return bytes; + }; + IPv6.prototype.toNormalizedString = function() { + var addr, part, suffix; + addr = function() { + var k, len, ref, results; + ref = this.parts; + results = []; + for (k = 0, len = ref.length; k < len; k++) { + part = ref[k]; + results.push(part.toString(16)); + } + return results; + }.call(this).join(":"); + suffix = ""; + if (this.zoneId) { + suffix = "%" + this.zoneId; + } + return addr + suffix; + }; + IPv6.prototype.toFixedLengthString = function() { + var addr, part, suffix; + addr = function() { + var k, len, ref, results; + ref = this.parts; + results = []; + for (k = 0, len = ref.length; k < len; k++) { + part = ref[k]; + results.push(part.toString(16).padStart(4, "0")); + } + return results; + }.call(this).join(":"); + suffix = ""; + if (this.zoneId) { + suffix = "%" + this.zoneId; + } + return addr + suffix; + }; + IPv6.prototype.match = function(other, cidrRange) { + var ref; + if (cidrRange === void 0) { + ref = other, other = ref[0], cidrRange = ref[1]; + } + if (other.kind() !== "ipv6") { + throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one"); + } + return matchCIDR(this.parts, other.parts, 16, cidrRange); + }; + IPv6.prototype.SpecialRanges = { + unspecified: [new IPv6([0, 0, 0, 0, 0, 0, 0, 0]), 128], + linkLocal: [new IPv6([65152, 0, 0, 0, 0, 0, 0, 0]), 10], + multicast: [new IPv6([65280, 0, 0, 0, 0, 0, 0, 0]), 8], + loopback: [new IPv6([0, 0, 0, 0, 0, 0, 0, 1]), 128], + uniqueLocal: [new IPv6([64512, 0, 0, 0, 0, 0, 0, 0]), 7], + ipv4Mapped: [new IPv6([0, 0, 0, 0, 0, 65535, 0, 0]), 96], + rfc6145: [new IPv6([0, 0, 0, 0, 65535, 0, 0, 0]), 96], + rfc6052: [new IPv6([100, 65435, 0, 0, 0, 0, 0, 0]), 96], + "6to4": [new IPv6([8194, 0, 0, 0, 0, 0, 0, 0]), 16], + teredo: [new IPv6([8193, 0, 0, 0, 0, 0, 0, 0]), 32], + reserved: [[new IPv6([8193, 3512, 0, 0, 0, 0, 0, 0]), 32]] + }; + IPv6.prototype.range = function() { + return ipaddr.subnetMatch(this, this.SpecialRanges); + }; + IPv6.prototype.isIPv4MappedAddress = function() { + return this.range() === "ipv4Mapped"; + }; + IPv6.prototype.toIPv4Address = function() { + var high, low, ref; + if (!this.isIPv4MappedAddress()) { + throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4"); + } + ref = this.parts.slice(-2), high = ref[0], low = ref[1]; + return new ipaddr.IPv4([high >> 8, high & 255, low >> 8, low & 255]); + }; + IPv6.prototype.prefixLengthFromSubnetMask = function() { + var cidr, i, k, part, stop, zeros, zerotable; + zerotable = { + 0: 16, + 32768: 15, + 49152: 14, + 57344: 13, + 61440: 12, + 63488: 11, + 64512: 10, + 65024: 9, + 65280: 8, + 65408: 7, + 65472: 6, + 65504: 5, + 65520: 4, + 65528: 3, + 65532: 2, + 65534: 1, + 65535: 0 + }; + cidr = 0; + stop = false; + for (i = k = 7; k >= 0; i = k += -1) { + part = this.parts[i]; + if (part in zerotable) { + zeros = zerotable[part]; + if (stop && zeros !== 0) { + return null; + } + if (zeros !== 16) { + stop = true; + } + cidr += zeros; + } else { + return null; + } + } + return 128 - cidr; + }; + return IPv6; + }(); + ipv6Part = "(?:[0-9a-f]+::?)+"; + zoneIndex = "%[0-9a-z]{1,}"; + ipv6Regexes = { + zoneIndex: new RegExp(zoneIndex, "i"), + native: new RegExp("^(::)?(" + ipv6Part + ")?([0-9a-f]+)?(::)?(" + zoneIndex + ")?$", "i"), + transitional: new RegExp("^((?:" + ipv6Part + ")|(?:::)(?:" + ipv6Part + ")?)" + (ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part) + ("(" + zoneIndex + ")?$"), "i") + }; + expandIPv6 = function(string, parts) { + var colonCount, lastColon, part, replacement, replacementCount, zoneId; + if (string.indexOf("::") !== string.lastIndexOf("::")) { + return null; + } + zoneId = (string.match(ipv6Regexes["zoneIndex"]) || [])[0]; + if (zoneId) { + zoneId = zoneId.substring(1); + string = string.replace(/%.+$/, ""); + } + colonCount = 0; + lastColon = -1; + while ((lastColon = string.indexOf(":", lastColon + 1)) >= 0) { + colonCount++; + } + if (string.substr(0, 2) === "::") { + colonCount--; + } + if (string.substr(-2, 2) === "::") { + colonCount--; + } + if (colonCount > parts) { + return null; + } + replacementCount = parts - colonCount; + replacement = ":"; + while (replacementCount--) { + replacement += "0:"; + } + string = string.replace("::", replacement); + if (string[0] === ":") { + string = string.slice(1); + } + if (string[string.length - 1] === ":") { + string = string.slice(0, -1); + } + parts = function() { + var k, len, ref, results; + ref = string.split(":"); + results = []; + for (k = 0, len = ref.length; k < len; k++) { + part = ref[k]; + results.push(parseInt(part, 16)); + } + return results; + }(); + return { + parts, + zoneId + }; + }; + ipaddr.IPv6.parser = function(string) { + var addr, k, len, match, octet, octets, zoneId; + if (ipv6Regexes["native"].test(string)) { + return expandIPv6(string, 8); + } else if (match = string.match(ipv6Regexes["transitional"])) { + zoneId = match[6] || ""; + addr = expandIPv6(match[1].slice(0, -1) + zoneId, 6); + if (addr.parts) { + octets = [parseInt(match[2]), parseInt(match[3]), parseInt(match[4]), parseInt(match[5])]; + for (k = 0, len = octets.length; k < len; k++) { + octet = octets[k]; + if (!(0 <= octet && octet <= 255)) { + return null; + } + } + addr.parts.push(octets[0] << 8 | octets[1]); + addr.parts.push(octets[2] << 8 | octets[3]); + return { + parts: addr.parts, + zoneId: addr.zoneId + }; + } + } + return null; + }; + ipaddr.IPv4.isIPv4 = ipaddr.IPv6.isIPv6 = function(string) { + return this.parser(string) !== null; + }; + ipaddr.IPv4.isValid = function(string) { + var e; + try { + new this(this.parser(string)); + return true; + } catch (error1) { + e = error1; + return false; + } + }; + ipaddr.IPv4.isValidFourPartDecimal = function(string) { + if (ipaddr.IPv4.isValid(string) && string.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/)) { + return true; + } else { + return false; + } + }; + ipaddr.IPv6.isValid = function(string) { + var addr, e; + if (typeof string === "string" && string.indexOf(":") === -1) { + return false; + } + try { + addr = this.parser(string); + new this(addr.parts, addr.zoneId); + return true; + } catch (error1) { + e = error1; + return false; + } + }; + ipaddr.IPv4.parse = function(string) { + var parts; + parts = this.parser(string); + if (parts === null) { + throw new Error("ipaddr: string is not formatted like ip address"); + } + return new this(parts); + }; + ipaddr.IPv6.parse = function(string) { + var addr; + addr = this.parser(string); + if (addr.parts === null) { + throw new Error("ipaddr: string is not formatted like ip address"); + } + return new this(addr.parts, addr.zoneId); + }; + ipaddr.IPv4.parseCIDR = function(string) { + var maskLength, match, parsed; + if (match = string.match(/^(.+)\/(\d+)$/)) { + maskLength = parseInt(match[2]); + if (maskLength >= 0 && maskLength <= 32) { + parsed = [this.parse(match[1]), maskLength]; + Object.defineProperty(parsed, "toString", { + value: function() { + return this.join("/"); + } + }); + return parsed; + } + } + throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range"); + }; + ipaddr.IPv4.subnetMaskFromPrefixLength = function(prefix) { + var filledOctetCount, j, octets; + prefix = parseInt(prefix); + if (prefix < 0 || prefix > 32) { + throw new Error("ipaddr: invalid IPv4 prefix length"); + } + octets = [0, 0, 0, 0]; + j = 0; + filledOctetCount = Math.floor(prefix / 8); + while (j < filledOctetCount) { + octets[j] = 255; + j++; + } + if (filledOctetCount < 4) { + octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - prefix % 8; + } + return new this(octets); + }; + ipaddr.IPv4.broadcastAddressFromCIDR = function(string) { + var cidr, error, i, ipInterfaceOctets, octets, subnetMaskOctets; + try { + cidr = this.parseCIDR(string); + ipInterfaceOctets = cidr[0].toByteArray(); + subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray(); + octets = []; + i = 0; + while (i < 4) { + octets.push(parseInt(ipInterfaceOctets[i], 10) | parseInt(subnetMaskOctets[i], 10) ^ 255); + i++; + } + return new this(octets); + } catch (error1) { + error = error1; + throw new Error("ipaddr: the address does not have IPv4 CIDR format"); + } + }; + ipaddr.IPv4.networkAddressFromCIDR = function(string) { + var cidr, error, i, ipInterfaceOctets, octets, subnetMaskOctets; + try { + cidr = this.parseCIDR(string); + ipInterfaceOctets = cidr[0].toByteArray(); + subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray(); + octets = []; + i = 0; + while (i < 4) { + octets.push(parseInt(ipInterfaceOctets[i], 10) & parseInt(subnetMaskOctets[i], 10)); + i++; + } + return new this(octets); + } catch (error1) { + error = error1; + throw new Error("ipaddr: the address does not have IPv4 CIDR format"); + } + }; + ipaddr.IPv6.parseCIDR = function(string) { + var maskLength, match, parsed; + if (match = string.match(/^(.+)\/(\d+)$/)) { + maskLength = parseInt(match[2]); + if (maskLength >= 0 && maskLength <= 128) { + parsed = [this.parse(match[1]), maskLength]; + Object.defineProperty(parsed, "toString", { + value: function() { + return this.join("/"); + } + }); + return parsed; + } + } + throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range"); + }; + ipaddr.isValid = function(string) { + return ipaddr.IPv6.isValid(string) || ipaddr.IPv4.isValid(string); + }; + ipaddr.parse = function(string) { + if (ipaddr.IPv6.isValid(string)) { + return ipaddr.IPv6.parse(string); + } else if (ipaddr.IPv4.isValid(string)) { + return ipaddr.IPv4.parse(string); + } else { + throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format"); + } + }; + ipaddr.parseCIDR = function(string) { + var e; + try { + return ipaddr.IPv6.parseCIDR(string); + } catch (error1) { + e = error1; + try { + return ipaddr.IPv4.parseCIDR(string); + } catch (error12) { + e = error12; + throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format"); + } + } + }; + ipaddr.fromByteArray = function(bytes) { + var length; + length = bytes.length; + if (length === 4) { + return new ipaddr.IPv4(bytes); + } else if (length === 16) { + return new ipaddr.IPv6(bytes); + } else { + throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address"); + } + }; + ipaddr.process = function(string) { + var addr; + addr = this.parse(string); + if (addr.kind() === "ipv6" && addr.isIPv4MappedAddress()) { + return addr.toIPv4Address(); + } else { + return addr; + } + }; + }).call(exports2); +}); + +// node_modules/proxy-addr/index.js +var require_proxy_addr = __commonJS((exports2, module2) => { + /*! + * proxy-addr + * Copyright(c) 2014-2016 Douglas Christopher Wilson + * MIT Licensed + */ + "use strict"; + module2.exports = proxyaddr; + module2.exports.all = alladdrs; + module2.exports.compile = compile; + var forwarded = require_forwarded(); + var ipaddr = require_ipaddr(); + var DIGIT_REGEXP = /^[0-9]+$/; + var isip = ipaddr.isValid; + var parseip = ipaddr.parse; + var IP_RANGES = { + linklocal: ["169.254.0.0/16", "fe80::/10"], + loopback: ["127.0.0.1/8", "::1/128"], + uniquelocal: ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "fc00::/7"] + }; + function alladdrs(req, trust) { + var addrs = forwarded(req); + if (!trust) { + return addrs; + } + if (typeof trust !== "function") { + trust = compile(trust); + } + for (var i = 0; i < addrs.length - 1; i++) { + if (trust(addrs[i], i)) + continue; + addrs.length = i + 1; + } + return addrs; + } + function compile(val) { + if (!val) { + throw new TypeError("argument is required"); + } + var trust; + if (typeof val === "string") { + trust = [val]; + } else if (Array.isArray(val)) { + trust = val.slice(); + } else { + throw new TypeError("unsupported trust argument"); + } + for (var i = 0; i < trust.length; i++) { + val = trust[i]; + if (!Object.prototype.hasOwnProperty.call(IP_RANGES, val)) { + continue; + } + val = IP_RANGES[val]; + trust.splice.apply(trust, [i, 1].concat(val)); + i += val.length - 1; + } + return compileTrust(compileRangeSubnets(trust)); + } + function compileRangeSubnets(arr) { + var rangeSubnets = new Array(arr.length); + for (var i = 0; i < arr.length; i++) { + rangeSubnets[i] = parseipNotation(arr[i]); + } + return rangeSubnets; + } + function compileTrust(rangeSubnets) { + var len = rangeSubnets.length; + return len === 0 ? trustNone : len === 1 ? trustSingle(rangeSubnets[0]) : trustMulti(rangeSubnets); + } + function parseipNotation(note) { + var pos = note.lastIndexOf("/"); + var str = pos !== -1 ? note.substring(0, pos) : note; + if (!isip(str)) { + throw new TypeError("invalid IP address: " + str); + } + var ip = parseip(str); + if (pos === -1 && ip.kind() === "ipv6" && ip.isIPv4MappedAddress()) { + ip = ip.toIPv4Address(); + } + var max = ip.kind() === "ipv6" ? 128 : 32; + var range = pos !== -1 ? note.substring(pos + 1, note.length) : null; + if (range === null) { + range = max; + } else if (DIGIT_REGEXP.test(range)) { + range = parseInt(range, 10); + } else if (ip.kind() === "ipv4" && isip(range)) { + range = parseNetmask(range); + } else { + range = null; + } + if (range <= 0 || range > max) { + throw new TypeError("invalid range on address: " + note); + } + return [ip, range]; + } + function parseNetmask(netmask) { + var ip = parseip(netmask); + var kind = ip.kind(); + return kind === "ipv4" ? ip.prefixLengthFromSubnetMask() : null; + } + function proxyaddr(req, trust) { + if (!req) { + throw new TypeError("req argument is required"); + } + if (!trust) { + throw new TypeError("trust argument is required"); + } + var addrs = alladdrs(req, trust); + var addr = addrs[addrs.length - 1]; + return addr; + } + function trustNone() { + return false; + } + function trustMulti(subnets) { + return function trust(addr) { + if (!isip(addr)) + return false; + var ip = parseip(addr); + var ipconv; + var kind = ip.kind(); + for (var i = 0; i < subnets.length; i++) { + var subnet = subnets[i]; + var subnetip = subnet[0]; + var subnetkind = subnetip.kind(); + var subnetrange = subnet[1]; + var trusted = ip; + if (kind !== subnetkind) { + if (subnetkind === "ipv4" && !ip.isIPv4MappedAddress()) { + continue; + } + if (!ipconv) { + ipconv = subnetkind === "ipv4" ? ip.toIPv4Address() : ip.toIPv4MappedAddress(); + } + trusted = ipconv; + } + if (trusted.match(subnetip, subnetrange)) { + return true; + } + } + return false; + }; + } + function trustSingle(subnet) { + var subnetip = subnet[0]; + var subnetkind = subnetip.kind(); + var subnetisipv4 = subnetkind === "ipv4"; + var subnetrange = subnet[1]; + return function trust(addr) { + if (!isip(addr)) + return false; + var ip = parseip(addr); + var kind = ip.kind(); + if (kind !== subnetkind) { + if (subnetisipv4 && !ip.isIPv4MappedAddress()) { + return false; + } + ip = subnetisipv4 ? ip.toIPv4Address() : ip.toIPv4MappedAddress(); + } + return ip.match(subnetip, subnetrange); + }; + } +}); + +// node_modules/express/lib/utils.js +var require_utils6 = __commonJS((exports2) => { + /*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + "use strict"; + var Buffer2 = require_safe_buffer().Buffer; + var contentDisposition = require_content_disposition(); + var contentType = require_content_type(); + var deprecate = require_depd()("express"); + var flatten = require_array_flatten(); + var mime = require_send().mime; + var etag = require_etag(); + var proxyaddr = require_proxy_addr(); + var qs = require_lib6(); + var querystring = require("querystring"); + exports2.etag = createETagGenerator({weak: false}); + exports2.wetag = createETagGenerator({weak: true}); + exports2.isAbsolute = function(path) { + if (path[0] === "/") + return true; + if (path[1] === ":" && (path[2] === "\\" || path[2] === "/")) + return true; + if (path.substring(0, 2) === "\\\\") + return true; + }; + exports2.flatten = deprecate.function(flatten, "utils.flatten: use array-flatten npm module instead"); + exports2.normalizeType = function(type) { + return ~type.indexOf("/") ? acceptParams(type) : {value: mime.lookup(type), params: {}}; + }; + exports2.normalizeTypes = function(types) { + var ret = []; + for (var i = 0; i < types.length; ++i) { + ret.push(exports2.normalizeType(types[i])); + } + return ret; + }; + exports2.contentDisposition = deprecate.function(contentDisposition, "utils.contentDisposition: use content-disposition npm module instead"); + function acceptParams(str, index) { + var parts = str.split(/ *; */); + var ret = {value: parts[0], quality: 1, params: {}, originalIndex: index}; + for (var i = 1; i < parts.length; ++i) { + var pms = parts[i].split(/ *= */); + if (pms[0] === "q") { + ret.quality = parseFloat(pms[1]); + } else { + ret.params[pms[0]] = pms[1]; + } + } + return ret; + } + exports2.compileETag = function(val) { + var fn; + if (typeof val === "function") { + return val; + } + switch (val) { + case true: + fn = exports2.wetag; + break; + case false: + break; + case "strong": + fn = exports2.etag; + break; + case "weak": + fn = exports2.wetag; + break; + default: + throw new TypeError("unknown value for etag function: " + val); + } + return fn; + }; + exports2.compileQueryParser = function compileQueryParser(val) { + var fn; + if (typeof val === "function") { + return val; + } + switch (val) { + case true: + fn = querystring.parse; + break; + case false: + fn = newObject; + break; + case "extended": + fn = parseExtendedQueryString; + break; + case "simple": + fn = querystring.parse; + break; + default: + throw new TypeError("unknown value for query parser function: " + val); + } + return fn; + }; + exports2.compileTrust = function(val) { + if (typeof val === "function") + return val; + if (val === true) { + return function() { + return true; + }; + } + if (typeof val === "number") { + return function(a, i) { + return i < val; + }; + } + if (typeof val === "string") { + val = val.split(/ *, */); + } + return proxyaddr.compile(val || []); + }; + exports2.setCharset = function setCharset(type, charset) { + if (!type || !charset) { + return type; + } + var parsed = contentType.parse(type); + parsed.parameters.charset = charset; + return contentType.format(parsed); + }; + function createETagGenerator(options) { + return function generateETag(body, encoding) { + var buf = !Buffer2.isBuffer(body) ? Buffer2.from(body, encoding) : body; + return etag(buf, options); + }; + } + function parseExtendedQueryString(str) { + return qs.parse(str, { + allowPrototypes: true + }); + } + function newObject() { + return {}; + } +}); + +// node_modules/express/lib/application.js +var require_application = __commonJS((exports2, module2) => { + /*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + "use strict"; + var finalhandler = require_finalhandler(); + var Router = require_router2(); + var methods = require_methods(); + var middleware = require_init(); + var query = require_query(); + var debug = require_src6()("express:application"); + var View = require_view(); + var http = require("http"); + var compileETag = require_utils6().compileETag; + var compileQueryParser = require_utils6().compileQueryParser; + var compileTrust = require_utils6().compileTrust; + var deprecate = require_depd()("express"); + var flatten = require_array_flatten(); + var merge = require_utils_merge(); + var resolve = require("path").resolve; + var setPrototypeOf = require_setprototypeof(); + var slice = Array.prototype.slice; + var app2 = exports2 = module2.exports = {}; + var trustProxyDefaultSymbol = "@@symbol:trust_proxy_default"; + app2.init = function init() { + this.cache = {}; + this.engines = {}; + this.settings = {}; + this.defaultConfiguration(); + }; + app2.defaultConfiguration = function defaultConfiguration() { + var env = process.env.NODE_ENV || "development"; + this.enable("x-powered-by"); + this.set("etag", "weak"); + this.set("env", env); + this.set("query parser", "extended"); + this.set("subdomain offset", 2); + this.set("trust proxy", false); + Object.defineProperty(this.settings, trustProxyDefaultSymbol, { + configurable: true, + value: true + }); + debug("booting in %s mode", env); + this.on("mount", function onmount(parent) { + if (this.settings[trustProxyDefaultSymbol] === true && typeof parent.settings["trust proxy fn"] === "function") { + delete this.settings["trust proxy"]; + delete this.settings["trust proxy fn"]; + } + setPrototypeOf(this.request, parent.request); + setPrototypeOf(this.response, parent.response); + setPrototypeOf(this.engines, parent.engines); + setPrototypeOf(this.settings, parent.settings); + }); + this.locals = Object.create(null); + this.mountpath = "/"; + this.locals.settings = this.settings; + this.set("view", View); + this.set("views", resolve("views")); + this.set("jsonp callback name", "callback"); + if (env === "production") { + this.enable("view cache"); + } + Object.defineProperty(this, "router", { + get: function() { + throw new Error("'app.router' is deprecated!\nPlease see the 3.x to 4.x migration guide for details on how to update your app."); + } + }); + }; + app2.lazyrouter = function lazyrouter() { + if (!this._router) { + this._router = new Router({ + caseSensitive: this.enabled("case sensitive routing"), + strict: this.enabled("strict routing") + }); + this._router.use(query(this.get("query parser fn"))); + this._router.use(middleware.init(this)); + } + }; + app2.handle = function handle(req, res, callback) { + var router = this._router; + var done = callback || finalhandler(req, res, { + env: this.get("env"), + onerror: logerror.bind(this) + }); + if (!router) { + debug("no routes defined on app"); + done(); + return; + } + router.handle(req, res, done); + }; + app2.use = function use(fn) { + var offset = 0; + var path = "/"; + if (typeof fn !== "function") { + var arg = fn; + while (Array.isArray(arg) && arg.length !== 0) { + arg = arg[0]; + } + if (typeof arg !== "function") { + offset = 1; + path = fn; + } + } + var fns = flatten(slice.call(arguments, offset)); + if (fns.length === 0) { + throw new TypeError("app.use() requires a middleware function"); + } + this.lazyrouter(); + var router = this._router; + fns.forEach(function(fn2) { + if (!fn2 || !fn2.handle || !fn2.set) { + return router.use(path, fn2); + } + debug(".use app under %s", path); + fn2.mountpath = path; + fn2.parent = this; + router.use(path, function mounted_app(req, res, next) { + var orig = req.app; + fn2.handle(req, res, function(err) { + setPrototypeOf(req, orig.request); + setPrototypeOf(res, orig.response); + next(err); + }); + }); + fn2.emit("mount", this); + }, this); + return this; + }; + app2.route = function route(path) { + this.lazyrouter(); + return this._router.route(path); + }; + app2.engine = function engine(ext, fn) { + if (typeof fn !== "function") { + throw new Error("callback function required"); + } + var extension = ext[0] !== "." ? "." + ext : ext; + this.engines[extension] = fn; + return this; + }; + app2.param = function param(name, fn) { + this.lazyrouter(); + if (Array.isArray(name)) { + for (var i = 0; i < name.length; i++) { + this.param(name[i], fn); + } + return this; + } + this._router.param(name, fn); + return this; + }; + app2.set = function set(setting, val) { + if (arguments.length === 1) { + return this.settings[setting]; + } + debug('set "%s" to %o', setting, val); + this.settings[setting] = val; + switch (setting) { + case "etag": + this.set("etag fn", compileETag(val)); + break; + case "query parser": + this.set("query parser fn", compileQueryParser(val)); + break; + case "trust proxy": + this.set("trust proxy fn", compileTrust(val)); + Object.defineProperty(this.settings, trustProxyDefaultSymbol, { + configurable: true, + value: false + }); + break; + } + return this; + }; + app2.path = function path() { + return this.parent ? this.parent.path() + this.mountpath : ""; + }; + app2.enabled = function enabled(setting) { + return Boolean(this.set(setting)); + }; + app2.disabled = function disabled(setting) { + return !this.set(setting); + }; + app2.enable = function enable(setting) { + return this.set(setting, true); + }; + app2.disable = function disable(setting) { + return this.set(setting, false); + }; + methods.forEach(function(method) { + app2[method] = function(path) { + if (method === "get" && arguments.length === 1) { + return this.set(path); + } + this.lazyrouter(); + var route = this._router.route(path); + route[method].apply(route, slice.call(arguments, 1)); + return this; + }; + }); + app2.all = function all(path) { + this.lazyrouter(); + var route = this._router.route(path); + var args = slice.call(arguments, 1); + for (var i = 0; i < methods.length; i++) { + route[methods[i]].apply(route, args); + } + return this; + }; + app2.del = deprecate.function(app2.delete, "app.del: Use app.delete instead"); + app2.render = function render(name, options, callback) { + var cache = this.cache; + var done = callback; + var engines = this.engines; + var opts = options; + var renderOptions = {}; + var view; + if (typeof options === "function") { + done = options; + opts = {}; + } + merge(renderOptions, this.locals); + if (opts._locals) { + merge(renderOptions, opts._locals); + } + merge(renderOptions, opts); + if (renderOptions.cache == null) { + renderOptions.cache = this.enabled("view cache"); + } + if (renderOptions.cache) { + view = cache[name]; + } + if (!view) { + var View2 = this.get("view"); + view = new View2(name, { + defaultEngine: this.get("view engine"), + root: this.get("views"), + engines + }); + if (!view.path) { + var dirs = Array.isArray(view.root) && view.root.length > 1 ? 'directories "' + view.root.slice(0, -1).join('", "') + '" or "' + view.root[view.root.length - 1] + '"' : 'directory "' + view.root + '"'; + var err = new Error('Failed to lookup view "' + name + '" in views ' + dirs); + err.view = view; + return done(err); + } + if (renderOptions.cache) { + cache[name] = view; + } + } + tryRender(view, renderOptions, done); + }; + app2.listen = function listen() { + var server = http.createServer(this); + return server.listen.apply(server, arguments); + }; + function logerror(err) { + if (this.get("env") !== "test") + console.error(err.stack || err.toString()); + } + function tryRender(view, options, callback) { + try { + view.render(options, callback); + } catch (err) { + callback(err); + } + } +}); + +// node_modules/negotiator/lib/charset.js +var require_charset = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = preferredCharsets; + module2.exports.preferredCharsets = preferredCharsets; + var simpleCharsetRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/; + function parseAcceptCharset(accept) { + var accepts = accept.split(","); + for (var i = 0, j = 0; i < accepts.length; i++) { + var charset = parseCharset(accepts[i].trim(), i); + if (charset) { + accepts[j++] = charset; + } + } + accepts.length = j; + return accepts; + } + function parseCharset(str, i) { + var match = simpleCharsetRegExp.exec(str); + if (!match) + return null; + var charset = match[1]; + var q = 1; + if (match[2]) { + var params = match[2].split(";"); + for (var j = 0; j < params.length; j++) { + var p = params[j].trim().split("="); + if (p[0] === "q") { + q = parseFloat(p[1]); + break; + } + } + } + return { + charset, + q, + i + }; + } + function getCharsetPriority(charset, accepted, index) { + var priority = {o: -1, q: 0, s: 0}; + for (var i = 0; i < accepted.length; i++) { + var spec = specify(charset, accepted[i], index); + if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) { + priority = spec; + } + } + return priority; + } + function specify(charset, spec, index) { + var s = 0; + if (spec.charset.toLowerCase() === charset.toLowerCase()) { + s |= 1; + } else if (spec.charset !== "*") { + return null; + } + return { + i: index, + o: spec.i, + q: spec.q, + s + }; + } + function preferredCharsets(accept, provided) { + var accepts = parseAcceptCharset(accept === void 0 ? "*" : accept || ""); + if (!provided) { + return accepts.filter(isQuality).sort(compareSpecs).map(getFullCharset); + } + var priorities = provided.map(function getPriority(type, index) { + return getCharsetPriority(type, accepts, index); + }); + return priorities.filter(isQuality).sort(compareSpecs).map(function getCharset(priority) { + return provided[priorities.indexOf(priority)]; + }); + } + function compareSpecs(a, b) { + return b.q - a.q || b.s - a.s || a.o - b.o || a.i - b.i || 0; + } + function getFullCharset(spec) { + return spec.charset; + } + function isQuality(spec) { + return spec.q > 0; + } +}); + +// node_modules/negotiator/lib/encoding.js +var require_encoding = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = preferredEncodings; + module2.exports.preferredEncodings = preferredEncodings; + var simpleEncodingRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/; + function parseAcceptEncoding(accept) { + var accepts = accept.split(","); + var hasIdentity = false; + var minQuality = 1; + for (var i = 0, j = 0; i < accepts.length; i++) { + var encoding = parseEncoding(accepts[i].trim(), i); + if (encoding) { + accepts[j++] = encoding; + hasIdentity = hasIdentity || specify("identity", encoding); + minQuality = Math.min(minQuality, encoding.q || 1); + } + } + if (!hasIdentity) { + accepts[j++] = { + encoding: "identity", + q: minQuality, + i + }; + } + accepts.length = j; + return accepts; + } + function parseEncoding(str, i) { + var match = simpleEncodingRegExp.exec(str); + if (!match) + return null; + var encoding = match[1]; + var q = 1; + if (match[2]) { + var params = match[2].split(";"); + for (var j = 0; j < params.length; j++) { + var p = params[j].trim().split("="); + if (p[0] === "q") { + q = parseFloat(p[1]); + break; + } + } + } + return { + encoding, + q, + i + }; + } + function getEncodingPriority(encoding, accepted, index) { + var priority = {o: -1, q: 0, s: 0}; + for (var i = 0; i < accepted.length; i++) { + var spec = specify(encoding, accepted[i], index); + if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) { + priority = spec; + } + } + return priority; + } + function specify(encoding, spec, index) { + var s = 0; + if (spec.encoding.toLowerCase() === encoding.toLowerCase()) { + s |= 1; + } else if (spec.encoding !== "*") { + return null; + } + return { + i: index, + o: spec.i, + q: spec.q, + s + }; + } + function preferredEncodings(accept, provided) { + var accepts = parseAcceptEncoding(accept || ""); + if (!provided) { + return accepts.filter(isQuality).sort(compareSpecs).map(getFullEncoding); + } + var priorities = provided.map(function getPriority(type, index) { + return getEncodingPriority(type, accepts, index); + }); + return priorities.filter(isQuality).sort(compareSpecs).map(function getEncoding(priority) { + return provided[priorities.indexOf(priority)]; + }); + } + function compareSpecs(a, b) { + return b.q - a.q || b.s - a.s || a.o - b.o || a.i - b.i || 0; + } + function getFullEncoding(spec) { + return spec.encoding; + } + function isQuality(spec) { + return spec.q > 0; + } +}); + +// node_modules/negotiator/lib/language.js +var require_language = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = preferredLanguages; + module2.exports.preferredLanguages = preferredLanguages; + var simpleLanguageRegExp = /^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/; + function parseAcceptLanguage(accept) { + var accepts = accept.split(","); + for (var i = 0, j = 0; i < accepts.length; i++) { + var language = parseLanguage(accepts[i].trim(), i); + if (language) { + accepts[j++] = language; + } + } + accepts.length = j; + return accepts; + } + function parseLanguage(str, i) { + var match = simpleLanguageRegExp.exec(str); + if (!match) + return null; + var prefix = match[1], suffix = match[2], full = prefix; + if (suffix) + full += "-" + suffix; + var q = 1; + if (match[3]) { + var params = match[3].split(";"); + for (var j = 0; j < params.length; j++) { + var p = params[j].split("="); + if (p[0] === "q") + q = parseFloat(p[1]); + } + } + return { + prefix, + suffix, + q, + i, + full + }; + } + function getLanguagePriority(language, accepted, index) { + var priority = {o: -1, q: 0, s: 0}; + for (var i = 0; i < accepted.length; i++) { + var spec = specify(language, accepted[i], index); + if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) { + priority = spec; + } + } + return priority; + } + function specify(language, spec, index) { + var p = parseLanguage(language); + if (!p) + return null; + var s = 0; + if (spec.full.toLowerCase() === p.full.toLowerCase()) { + s |= 4; + } else if (spec.prefix.toLowerCase() === p.full.toLowerCase()) { + s |= 2; + } else if (spec.full.toLowerCase() === p.prefix.toLowerCase()) { + s |= 1; + } else if (spec.full !== "*") { + return null; + } + return { + i: index, + o: spec.i, + q: spec.q, + s + }; + } + function preferredLanguages(accept, provided) { + var accepts = parseAcceptLanguage(accept === void 0 ? "*" : accept || ""); + if (!provided) { + return accepts.filter(isQuality).sort(compareSpecs).map(getFullLanguage); + } + var priorities = provided.map(function getPriority(type, index) { + return getLanguagePriority(type, accepts, index); + }); + return priorities.filter(isQuality).sort(compareSpecs).map(function getLanguage(priority) { + return provided[priorities.indexOf(priority)]; + }); + } + function compareSpecs(a, b) { + return b.q - a.q || b.s - a.s || a.o - b.o || a.i - b.i || 0; + } + function getFullLanguage(spec) { + return spec.full; + } + function isQuality(spec) { + return spec.q > 0; + } +}); + +// node_modules/negotiator/lib/mediaType.js +var require_mediaType = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = preferredMediaTypes; + module2.exports.preferredMediaTypes = preferredMediaTypes; + var simpleMediaTypeRegExp = /^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/; + function parseAccept(accept) { + var accepts = splitMediaTypes(accept); + for (var i = 0, j = 0; i < accepts.length; i++) { + var mediaType = parseMediaType(accepts[i].trim(), i); + if (mediaType) { + accepts[j++] = mediaType; + } + } + accepts.length = j; + return accepts; + } + function parseMediaType(str, i) { + var match = simpleMediaTypeRegExp.exec(str); + if (!match) + return null; + var params = Object.create(null); + var q = 1; + var subtype = match[2]; + var type = match[1]; + if (match[3]) { + var kvps = splitParameters(match[3]).map(splitKeyValuePair); + for (var j = 0; j < kvps.length; j++) { + var pair = kvps[j]; + var key = pair[0].toLowerCase(); + var val = pair[1]; + var value = val && val[0] === '"' && val[val.length - 1] === '"' ? val.substr(1, val.length - 2) : val; + if (key === "q") { + q = parseFloat(value); + break; + } + params[key] = value; + } + } + return { + type, + subtype, + params, + q, + i + }; + } + function getMediaTypePriority(type, accepted, index) { + var priority = {o: -1, q: 0, s: 0}; + for (var i = 0; i < accepted.length; i++) { + var spec = specify(type, accepted[i], index); + if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) { + priority = spec; + } + } + return priority; + } + function specify(type, spec, index) { + var p = parseMediaType(type); + var s = 0; + if (!p) { + return null; + } + if (spec.type.toLowerCase() == p.type.toLowerCase()) { + s |= 4; + } else if (spec.type != "*") { + return null; + } + if (spec.subtype.toLowerCase() == p.subtype.toLowerCase()) { + s |= 2; + } else if (spec.subtype != "*") { + return null; + } + var keys = Object.keys(spec.params); + if (keys.length > 0) { + if (keys.every(function(k) { + return spec.params[k] == "*" || (spec.params[k] || "").toLowerCase() == (p.params[k] || "").toLowerCase(); + })) { + s |= 1; + } else { + return null; + } + } + return { + i: index, + o: spec.i, + q: spec.q, + s + }; + } + function preferredMediaTypes(accept, provided) { + var accepts = parseAccept(accept === void 0 ? "*/*" : accept || ""); + if (!provided) { + return accepts.filter(isQuality).sort(compareSpecs).map(getFullType); + } + var priorities = provided.map(function getPriority(type, index) { + return getMediaTypePriority(type, accepts, index); + }); + return priorities.filter(isQuality).sort(compareSpecs).map(function getType(priority) { + return provided[priorities.indexOf(priority)]; + }); + } + function compareSpecs(a, b) { + return b.q - a.q || b.s - a.s || a.o - b.o || a.i - b.i || 0; + } + function getFullType(spec) { + return spec.type + "/" + spec.subtype; + } + function isQuality(spec) { + return spec.q > 0; + } + function quoteCount(string) { + var count = 0; + var index = 0; + while ((index = string.indexOf('"', index)) !== -1) { + count++; + index++; + } + return count; + } + function splitKeyValuePair(str) { + var index = str.indexOf("="); + var key; + var val; + if (index === -1) { + key = str; + } else { + key = str.substr(0, index); + val = str.substr(index + 1); + } + return [key, val]; + } + function splitMediaTypes(accept) { + var accepts = accept.split(","); + for (var i = 1, j = 0; i < accepts.length; i++) { + if (quoteCount(accepts[j]) % 2 == 0) { + accepts[++j] = accepts[i]; + } else { + accepts[j] += "," + accepts[i]; + } + } + accepts.length = j + 1; + return accepts; + } + function splitParameters(str) { + var parameters = str.split(";"); + for (var i = 1, j = 0; i < parameters.length; i++) { + if (quoteCount(parameters[j]) % 2 == 0) { + parameters[++j] = parameters[i]; + } else { + parameters[j] += ";" + parameters[i]; + } + } + parameters.length = j + 1; + for (var i = 0; i < parameters.length; i++) { + parameters[i] = parameters[i].trim(); + } + return parameters; + } +}); + +// node_modules/negotiator/index.js +var require_negotiator = __commonJS((exports2, module2) => { + /*! + * negotiator + * Copyright(c) 2012 Federico Romero + * Copyright(c) 2012-2014 Isaac Z. Schlueter + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + "use strict"; + var modules = Object.create(null); + module2.exports = Negotiator; + module2.exports.Negotiator = Negotiator; + function Negotiator(request) { + if (!(this instanceof Negotiator)) { + return new Negotiator(request); + } + this.request = request; + } + Negotiator.prototype.charset = function charset(available) { + var set = this.charsets(available); + return set && set[0]; + }; + Negotiator.prototype.charsets = function charsets(available) { + var preferredCharsets = loadModule("charset").preferredCharsets; + return preferredCharsets(this.request.headers["accept-charset"], available); + }; + Negotiator.prototype.encoding = function encoding(available) { + var set = this.encodings(available); + return set && set[0]; + }; + Negotiator.prototype.encodings = function encodings(available) { + var preferredEncodings = loadModule("encoding").preferredEncodings; + return preferredEncodings(this.request.headers["accept-encoding"], available); + }; + Negotiator.prototype.language = function language(available) { + var set = this.languages(available); + return set && set[0]; + }; + Negotiator.prototype.languages = function languages(available) { + var preferredLanguages = loadModule("language").preferredLanguages; + return preferredLanguages(this.request.headers["accept-language"], available); + }; + Negotiator.prototype.mediaType = function mediaType(available) { + var set = this.mediaTypes(available); + return set && set[0]; + }; + Negotiator.prototype.mediaTypes = function mediaTypes(available) { + var preferredMediaTypes = loadModule("mediaType").preferredMediaTypes; + return preferredMediaTypes(this.request.headers.accept, available); + }; + Negotiator.prototype.preferredCharset = Negotiator.prototype.charset; + Negotiator.prototype.preferredCharsets = Negotiator.prototype.charsets; + Negotiator.prototype.preferredEncoding = Negotiator.prototype.encoding; + Negotiator.prototype.preferredEncodings = Negotiator.prototype.encodings; + Negotiator.prototype.preferredLanguage = Negotiator.prototype.language; + Negotiator.prototype.preferredLanguages = Negotiator.prototype.languages; + Negotiator.prototype.preferredMediaType = Negotiator.prototype.mediaType; + Negotiator.prototype.preferredMediaTypes = Negotiator.prototype.mediaTypes; + function loadModule(moduleName) { + var module3 = modules[moduleName]; + if (module3 !== void 0) { + return module3; + } + switch (moduleName) { + case "charset": + module3 = require_charset(); + break; + case "encoding": + module3 = require_encoding(); + break; + case "language": + module3 = require_language(); + break; + case "mediaType": + module3 = require_mediaType(); + break; + default: + throw new Error("Cannot find module '" + moduleName + "'"); + } + modules[moduleName] = module3; + return module3; + } +}); + +// node_modules/accepts/index.js +var require_accepts = __commonJS((exports2, module2) => { + /*! + * accepts + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + "use strict"; + var Negotiator = require_negotiator(); + var mime = require_mime_types(); + module2.exports = Accepts; + function Accepts(req) { + if (!(this instanceof Accepts)) { + return new Accepts(req); + } + this.headers = req.headers; + this.negotiator = new Negotiator(req); + } + Accepts.prototype.type = Accepts.prototype.types = function(types_) { + var types = types_; + if (types && !Array.isArray(types)) { + types = new Array(arguments.length); + for (var i = 0; i < types.length; i++) { + types[i] = arguments[i]; + } + } + if (!types || types.length === 0) { + return this.negotiator.mediaTypes(); + } + if (!this.headers.accept) { + return types[0]; + } + var mimes = types.map(extToMime); + var accepts = this.negotiator.mediaTypes(mimes.filter(validMime)); + var first = accepts[0]; + return first ? types[mimes.indexOf(first)] : false; + }; + Accepts.prototype.encoding = Accepts.prototype.encodings = function(encodings_) { + var encodings = encodings_; + if (encodings && !Array.isArray(encodings)) { + encodings = new Array(arguments.length); + for (var i = 0; i < encodings.length; i++) { + encodings[i] = arguments[i]; + } + } + if (!encodings || encodings.length === 0) { + return this.negotiator.encodings(); + } + return this.negotiator.encodings(encodings)[0] || false; + }; + Accepts.prototype.charset = Accepts.prototype.charsets = function(charsets_) { + var charsets = charsets_; + if (charsets && !Array.isArray(charsets)) { + charsets = new Array(arguments.length); + for (var i = 0; i < charsets.length; i++) { + charsets[i] = arguments[i]; + } + } + if (!charsets || charsets.length === 0) { + return this.negotiator.charsets(); + } + return this.negotiator.charsets(charsets)[0] || false; + }; + Accepts.prototype.lang = Accepts.prototype.langs = Accepts.prototype.language = Accepts.prototype.languages = function(languages_) { + var languages = languages_; + if (languages && !Array.isArray(languages)) { + languages = new Array(arguments.length); + for (var i = 0; i < languages.length; i++) { + languages[i] = arguments[i]; + } + } + if (!languages || languages.length === 0) { + return this.negotiator.languages(); + } + return this.negotiator.languages(languages)[0] || false; + }; + function extToMime(type) { + return type.indexOf("/") === -1 ? mime.lookup(type) : type; + } + function validMime(type) { + return typeof type === "string"; + } +}); + +// node_modules/express/lib/request.js +var require_request3 = __commonJS((exports2, module2) => { + /*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + "use strict"; + var accepts = require_accepts(); + var deprecate = require_depd()("express"); + var isIP = require("net").isIP; + var typeis = require_type_is(); + var http = require("http"); + var fresh = require_fresh(); + var parseRange = require_range_parser(); + var parse = require_parseurl(); + var proxyaddr = require_proxy_addr(); + var req = Object.create(http.IncomingMessage.prototype); + module2.exports = req; + req.get = req.header = function header(name) { + if (!name) { + throw new TypeError("name argument is required to req.get"); + } + if (typeof name !== "string") { + throw new TypeError("name must be a string to req.get"); + } + var lc = name.toLowerCase(); + switch (lc) { + case "referer": + case "referrer": + return this.headers.referrer || this.headers.referer; + default: + return this.headers[lc]; + } + }; + req.accepts = function() { + var accept = accepts(this); + return accept.types.apply(accept, arguments); + }; + req.acceptsEncodings = function() { + var accept = accepts(this); + return accept.encodings.apply(accept, arguments); + }; + req.acceptsEncoding = deprecate.function(req.acceptsEncodings, "req.acceptsEncoding: Use acceptsEncodings instead"); + req.acceptsCharsets = function() { + var accept = accepts(this); + return accept.charsets.apply(accept, arguments); + }; + req.acceptsCharset = deprecate.function(req.acceptsCharsets, "req.acceptsCharset: Use acceptsCharsets instead"); + req.acceptsLanguages = function() { + var accept = accepts(this); + return accept.languages.apply(accept, arguments); + }; + req.acceptsLanguage = deprecate.function(req.acceptsLanguages, "req.acceptsLanguage: Use acceptsLanguages instead"); + req.range = function range(size, options) { + var range2 = this.get("Range"); + if (!range2) + return; + return parseRange(size, range2, options); + }; + req.param = function param(name, defaultValue) { + var params = this.params || {}; + var body = this.body || {}; + var query = this.query || {}; + var args = arguments.length === 1 ? "name" : "name, default"; + deprecate("req.param(" + args + "): Use req.params, req.body, or req.query instead"); + if (params[name] != null && params.hasOwnProperty(name)) + return params[name]; + if (body[name] != null) + return body[name]; + if (query[name] != null) + return query[name]; + return defaultValue; + }; + req.is = function is(types) { + var arr = types; + if (!Array.isArray(types)) { + arr = new Array(arguments.length); + for (var i = 0; i < arr.length; i++) { + arr[i] = arguments[i]; + } + } + return typeis(this, arr); + }; + defineGetter(req, "protocol", function protocol() { + var proto = this.connection.encrypted ? "https" : "http"; + var trust = this.app.get("trust proxy fn"); + if (!trust(this.connection.remoteAddress, 0)) { + return proto; + } + var header = this.get("X-Forwarded-Proto") || proto; + var index = header.indexOf(","); + return index !== -1 ? header.substring(0, index).trim() : header.trim(); + }); + defineGetter(req, "secure", function secure() { + return this.protocol === "https"; + }); + defineGetter(req, "ip", function ip() { + var trust = this.app.get("trust proxy fn"); + return proxyaddr(this, trust); + }); + defineGetter(req, "ips", function ips() { + var trust = this.app.get("trust proxy fn"); + var addrs = proxyaddr.all(this, trust); + addrs.reverse().pop(); + return addrs; + }); + defineGetter(req, "subdomains", function subdomains() { + var hostname = this.hostname; + if (!hostname) + return []; + var offset = this.app.get("subdomain offset"); + var subdomains2 = !isIP(hostname) ? hostname.split(".").reverse() : [hostname]; + return subdomains2.slice(offset); + }); + defineGetter(req, "path", function path() { + return parse(this).pathname; + }); + defineGetter(req, "hostname", function hostname() { + var trust = this.app.get("trust proxy fn"); + var host = this.get("X-Forwarded-Host"); + if (!host || !trust(this.connection.remoteAddress, 0)) { + host = this.get("Host"); + } else if (host.indexOf(",") !== -1) { + host = host.substring(0, host.indexOf(",")).trimRight(); + } + if (!host) + return; + var offset = host[0] === "[" ? host.indexOf("]") + 1 : 0; + var index = host.indexOf(":", offset); + return index !== -1 ? host.substring(0, index) : host; + }); + defineGetter(req, "host", deprecate.function(function host() { + return this.hostname; + }, "req.host: Use req.hostname instead")); + defineGetter(req, "fresh", function() { + var method = this.method; + var res = this.res; + var status = res.statusCode; + if (method !== "GET" && method !== "HEAD") + return false; + if (status >= 200 && status < 300 || status === 304) { + return fresh(this.headers, { + etag: res.get("ETag"), + "last-modified": res.get("Last-Modified") + }); + } + return false; + }); + defineGetter(req, "stale", function stale() { + return !this.fresh; + }); + defineGetter(req, "xhr", function xhr() { + var val = this.get("X-Requested-With") || ""; + return val.toLowerCase() === "xmlhttprequest"; + }); + function defineGetter(obj, name, getter) { + Object.defineProperty(obj, name, { + configurable: true, + enumerable: true, + get: getter + }); + } +}); + +// node_modules/cookie-signature/index.js +var require_cookie_signature = __commonJS((exports2) => { + var crypto = require("crypto"); + exports2.sign = function(val, secret) { + if (typeof val != "string") + throw new TypeError("Cookie value must be provided as a string."); + if (typeof secret != "string") + throw new TypeError("Secret string must be provided."); + return val + "." + crypto.createHmac("sha256", secret).update(val).digest("base64").replace(/\=+$/, ""); + }; + exports2.unsign = function(val, secret) { + if (typeof val != "string") + throw new TypeError("Signed cookie string must be provided."); + if (typeof secret != "string") + throw new TypeError("Secret string must be provided."); + var str = val.slice(0, val.lastIndexOf(".")), mac = exports2.sign(str, secret); + return sha1(mac) == sha1(val) ? str : false; + }; + function sha1(str) { + return crypto.createHash("sha1").update(str).digest("hex"); + } +}); + +// node_modules/express/node_modules/cookie/index.js +var require_cookie2 = __commonJS((exports2) => { + /*! + * cookie + * Copyright(c) 2012-2014 Roman Shtylman + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + "use strict"; + exports2.parse = parse; + exports2.serialize = serialize; + var decode = decodeURIComponent; + var encode = encodeURIComponent; + var pairSplitRegExp = /; */; + var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/; + function parse(str, options) { + if (typeof str !== "string") { + throw new TypeError("argument str must be a string"); + } + var obj = {}; + var opt = options || {}; + var pairs = str.split(pairSplitRegExp); + var dec = opt.decode || decode; + for (var i = 0; i < pairs.length; i++) { + var pair = pairs[i]; + var eq_idx = pair.indexOf("="); + if (eq_idx < 0) { + continue; + } + var key = pair.substr(0, eq_idx).trim(); + var val = pair.substr(++eq_idx, pair.length).trim(); + if (val[0] == '"') { + val = val.slice(1, -1); + } + if (obj[key] == void 0) { + obj[key] = tryDecode(val, dec); + } + } + return obj; + } + function serialize(name, val, options) { + var opt = options || {}; + var enc = opt.encode || encode; + if (typeof enc !== "function") { + throw new TypeError("option encode is invalid"); + } + if (!fieldContentRegExp.test(name)) { + throw new TypeError("argument name is invalid"); + } + var value = enc(val); + if (value && !fieldContentRegExp.test(value)) { + throw new TypeError("argument val is invalid"); + } + var str = name + "=" + value; + if (opt.maxAge != null) { + var maxAge = opt.maxAge - 0; + if (isNaN(maxAge)) + throw new Error("maxAge should be a Number"); + str += "; Max-Age=" + Math.floor(maxAge); + } + if (opt.domain) { + if (!fieldContentRegExp.test(opt.domain)) { + throw new TypeError("option domain is invalid"); + } + str += "; Domain=" + opt.domain; + } + if (opt.path) { + if (!fieldContentRegExp.test(opt.path)) { + throw new TypeError("option path is invalid"); + } + str += "; Path=" + opt.path; + } + if (opt.expires) { + if (typeof opt.expires.toUTCString !== "function") { + throw new TypeError("option expires is invalid"); + } + str += "; Expires=" + opt.expires.toUTCString(); + } + if (opt.httpOnly) { + str += "; HttpOnly"; + } + if (opt.secure) { + str += "; Secure"; + } + if (opt.sameSite) { + var sameSite = typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite; + switch (sameSite) { + case true: + str += "; SameSite=Strict"; + break; + case "lax": + str += "; SameSite=Lax"; + break; + case "strict": + str += "; SameSite=Strict"; + break; + case "none": + str += "; SameSite=None"; + break; + default: + throw new TypeError("option sameSite is invalid"); + } + } + return str; + } + function tryDecode(str, decode2) { + try { + return decode2(str); + } catch (e) { + return str; + } + } +}); + +// node_modules/vary/index.js +var require_vary = __commonJS((exports2, module2) => { + /*! + * vary + * Copyright(c) 2014-2017 Douglas Christopher Wilson + * MIT Licensed + */ + "use strict"; + module2.exports = vary; + module2.exports.append = append; + var FIELD_NAME_REGEXP = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/; + function append(header, field) { + if (typeof header !== "string") { + throw new TypeError("header argument is required"); + } + if (!field) { + throw new TypeError("field argument is required"); + } + var fields = !Array.isArray(field) ? parse(String(field)) : field; + for (var j = 0; j < fields.length; j++) { + if (!FIELD_NAME_REGEXP.test(fields[j])) { + throw new TypeError("field argument contains an invalid header name"); + } + } + if (header === "*") { + return header; + } + var val = header; + var vals = parse(header.toLowerCase()); + if (fields.indexOf("*") !== -1 || vals.indexOf("*") !== -1) { + return "*"; + } + for (var i = 0; i < fields.length; i++) { + var fld = fields[i].toLowerCase(); + if (vals.indexOf(fld) === -1) { + vals.push(fld); + val = val ? val + ", " + fields[i] : fields[i]; + } + } + return val; + } + function parse(header) { + var end = 0; + var list = []; + var start = 0; + for (var i = 0, len = header.length; i < len; i++) { + switch (header.charCodeAt(i)) { + case 32: + if (start === end) { + start = end = i + 1; + } + break; + case 44: + list.push(header.substring(start, end)); + start = end = i + 1; + break; + default: + end = i + 1; + break; + } + } + list.push(header.substring(start, end)); + return list; + } + function vary(res, field) { + if (!res || !res.getHeader || !res.setHeader) { + throw new TypeError("res argument is required"); + } + var val = res.getHeader("Vary") || ""; + var header = Array.isArray(val) ? val.join(", ") : String(val); + if (val = append(header, field)) { + res.setHeader("Vary", val); + } + } +}); + +// node_modules/express/lib/response.js +var require_response = __commonJS((exports2, module2) => { + /*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + "use strict"; + var Buffer2 = require_safe_buffer().Buffer; + var contentDisposition = require_content_disposition(); + var deprecate = require_depd()("express"); + var encodeUrl = require_encodeurl(); + var escapeHtml = require_escape_html(); + var http = require("http"); + var isAbsolute = require_utils6().isAbsolute; + var onFinished = require_on_finished(); + var path = require("path"); + var statuses = require_statuses(); + var merge = require_utils_merge(); + var sign = require_cookie_signature().sign; + var normalizeType = require_utils6().normalizeType; + var normalizeTypes = require_utils6().normalizeTypes; + var setCharset = require_utils6().setCharset; + var cookie = require_cookie2(); + var send = require_send(); + var extname = path.extname; + var mime = send.mime; + var resolve = path.resolve; + var vary = require_vary(); + var res = Object.create(http.ServerResponse.prototype); + module2.exports = res; + var charsetRegExp = /;\s*charset\s*=/; + res.status = function status(code) { + this.statusCode = code; + return this; + }; + res.links = function(links) { + var link = this.get("Link") || ""; + if (link) + link += ", "; + return this.set("Link", link + Object.keys(links).map(function(rel) { + return "<" + links[rel] + '>; rel="' + rel + '"'; + }).join(", ")); + }; + res.send = function send2(body) { + var chunk = body; + var encoding; + var req = this.req; + var type; + var app2 = this.app; + if (arguments.length === 2) { + if (typeof arguments[0] !== "number" && typeof arguments[1] === "number") { + deprecate("res.send(body, status): Use res.status(status).send(body) instead"); + this.statusCode = arguments[1]; + } else { + deprecate("res.send(status, body): Use res.status(status).send(body) instead"); + this.statusCode = arguments[0]; + chunk = arguments[1]; + } + } + if (typeof chunk === "number" && arguments.length === 1) { + if (!this.get("Content-Type")) { + this.type("txt"); + } + deprecate("res.send(status): Use res.sendStatus(status) instead"); + this.statusCode = chunk; + chunk = statuses[chunk]; + } + switch (typeof chunk) { + case "string": + if (!this.get("Content-Type")) { + this.type("html"); + } + break; + case "boolean": + case "number": + case "object": + if (chunk === null) { + chunk = ""; + } else if (Buffer2.isBuffer(chunk)) { + if (!this.get("Content-Type")) { + this.type("bin"); + } + } else { + return this.json(chunk); + } + break; + } + if (typeof chunk === "string") { + encoding = "utf8"; + type = this.get("Content-Type"); + if (typeof type === "string") { + this.set("Content-Type", setCharset(type, "utf-8")); + } + } + var etagFn = app2.get("etag fn"); + var generateETag = !this.get("ETag") && typeof etagFn === "function"; + var len; + if (chunk !== void 0) { + if (Buffer2.isBuffer(chunk)) { + len = chunk.length; + } else if (!generateETag && chunk.length < 1e3) { + len = Buffer2.byteLength(chunk, encoding); + } else { + chunk = Buffer2.from(chunk, encoding); + encoding = void 0; + len = chunk.length; + } + this.set("Content-Length", len); + } + var etag; + if (generateETag && len !== void 0) { + if (etag = etagFn(chunk, encoding)) { + this.set("ETag", etag); + } + } + if (req.fresh) + this.statusCode = 304; + if (this.statusCode === 204 || this.statusCode === 304) { + this.removeHeader("Content-Type"); + this.removeHeader("Content-Length"); + this.removeHeader("Transfer-Encoding"); + chunk = ""; + } + if (req.method === "HEAD") { + this.end(); + } else { + this.end(chunk, encoding); + } + return this; + }; + res.json = function json(obj) { + var val = obj; + if (arguments.length === 2) { + if (typeof arguments[1] === "number") { + deprecate("res.json(obj, status): Use res.status(status).json(obj) instead"); + this.statusCode = arguments[1]; + } else { + deprecate("res.json(status, obj): Use res.status(status).json(obj) instead"); + this.statusCode = arguments[0]; + val = arguments[1]; + } + } + var app2 = this.app; + var escape2 = app2.get("json escape"); + var replacer = app2.get("json replacer"); + var spaces = app2.get("json spaces"); + var body = stringify(val, replacer, spaces, escape2); + if (!this.get("Content-Type")) { + this.set("Content-Type", "application/json"); + } + return this.send(body); + }; + res.jsonp = function jsonp(obj) { + var val = obj; + if (arguments.length === 2) { + if (typeof arguments[1] === "number") { + deprecate("res.jsonp(obj, status): Use res.status(status).json(obj) instead"); + this.statusCode = arguments[1]; + } else { + deprecate("res.jsonp(status, obj): Use res.status(status).jsonp(obj) instead"); + this.statusCode = arguments[0]; + val = arguments[1]; + } + } + var app2 = this.app; + var escape2 = app2.get("json escape"); + var replacer = app2.get("json replacer"); + var spaces = app2.get("json spaces"); + var body = stringify(val, replacer, spaces, escape2); + var callback = this.req.query[app2.get("jsonp callback name")]; + if (!this.get("Content-Type")) { + this.set("X-Content-Type-Options", "nosniff"); + this.set("Content-Type", "application/json"); + } + if (Array.isArray(callback)) { + callback = callback[0]; + } + if (typeof callback === "string" && callback.length !== 0) { + this.set("X-Content-Type-Options", "nosniff"); + this.set("Content-Type", "text/javascript"); + callback = callback.replace(/[^\[\]\w$.]/g, ""); + body = body.replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"); + body = "/**/ typeof " + callback + " === 'function' && " + callback + "(" + body + ");"; + } + return this.send(body); + }; + res.sendStatus = function sendStatus(statusCode) { + var body = statuses[statusCode] || String(statusCode); + this.statusCode = statusCode; + this.type("txt"); + return this.send(body); + }; + res.sendFile = function sendFile(path2, options, callback) { + var done = callback; + var req = this.req; + var res2 = this; + var next = req.next; + var opts = options || {}; + if (!path2) { + throw new TypeError("path argument is required to res.sendFile"); + } + if (typeof path2 !== "string") { + throw new TypeError("path must be a string to res.sendFile"); + } + if (typeof options === "function") { + done = options; + opts = {}; + } + if (!opts.root && !isAbsolute(path2)) { + throw new TypeError("path must be absolute or specify root to res.sendFile"); + } + var pathname = encodeURI(path2); + var file = send(req, pathname, opts); + sendfile(res2, file, opts, function(err) { + if (done) + return done(err); + if (err && err.code === "EISDIR") + return next(); + if (err && err.code !== "ECONNABORTED" && err.syscall !== "write") { + next(err); + } + }); + }; + res.sendfile = function(path2, options, callback) { + var done = callback; + var req = this.req; + var res2 = this; + var next = req.next; + var opts = options || {}; + if (typeof options === "function") { + done = options; + opts = {}; + } + var file = send(req, path2, opts); + sendfile(res2, file, opts, function(err) { + if (done) + return done(err); + if (err && err.code === "EISDIR") + return next(); + if (err && err.code !== "ECONNABORTED" && err.syscall !== "write") { + next(err); + } + }); + }; + res.sendfile = deprecate.function(res.sendfile, "res.sendfile: Use res.sendFile instead"); + res.download = function download(path2, filename, options, callback) { + var done = callback; + var name = filename; + var opts = options || null; + if (typeof filename === "function") { + done = filename; + name = null; + opts = null; + } else if (typeof options === "function") { + done = options; + opts = null; + } + var headers = { + "Content-Disposition": contentDisposition(name || path2) + }; + if (opts && opts.headers) { + var keys = Object.keys(opts.headers); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (key.toLowerCase() !== "content-disposition") { + headers[key] = opts.headers[key]; + } + } + } + opts = Object.create(opts); + opts.headers = headers; + var fullPath = resolve(path2); + return this.sendFile(fullPath, opts, done); + }; + res.contentType = res.type = function contentType(type) { + var ct = type.indexOf("/") === -1 ? mime.lookup(type) : type; + return this.set("Content-Type", ct); + }; + res.format = function(obj) { + var req = this.req; + var next = req.next; + var fn = obj.default; + if (fn) + delete obj.default; + var keys = Object.keys(obj); + var key = keys.length > 0 ? req.accepts(keys) : false; + this.vary("Accept"); + if (key) { + this.set("Content-Type", normalizeType(key).value); + obj[key](req, this, next); + } else if (fn) { + fn(); + } else { + var err = new Error("Not Acceptable"); + err.status = err.statusCode = 406; + err.types = normalizeTypes(keys).map(function(o) { + return o.value; + }); + next(err); + } + return this; + }; + res.attachment = function attachment(filename) { + if (filename) { + this.type(extname(filename)); + } + this.set("Content-Disposition", contentDisposition(filename)); + return this; + }; + res.append = function append(field, val) { + var prev = this.get(field); + var value = val; + if (prev) { + value = Array.isArray(prev) ? prev.concat(val) : Array.isArray(val) ? [prev].concat(val) : [prev, val]; + } + return this.set(field, value); + }; + res.set = res.header = function header(field, val) { + if (arguments.length === 2) { + var value = Array.isArray(val) ? val.map(String) : String(val); + if (field.toLowerCase() === "content-type") { + if (Array.isArray(value)) { + throw new TypeError("Content-Type cannot be set to an Array"); + } + if (!charsetRegExp.test(value)) { + var charset = mime.charsets.lookup(value.split(";")[0]); + if (charset) + value += "; charset=" + charset.toLowerCase(); + } + } + this.setHeader(field, value); + } else { + for (var key in field) { + this.set(key, field[key]); + } + } + return this; + }; + res.get = function(field) { + return this.getHeader(field); + }; + res.clearCookie = function clearCookie(name, options) { + var opts = merge({expires: new Date(1), path: "/"}, options); + return this.cookie(name, "", opts); + }; + res.cookie = function(name, value, options) { + var opts = merge({}, options); + var secret = this.req.secret; + var signed = opts.signed; + if (signed && !secret) { + throw new Error('cookieParser("secret") required for signed cookies'); + } + var val = typeof value === "object" ? "j:" + JSON.stringify(value) : String(value); + if (signed) { + val = "s:" + sign(val, secret); + } + if ("maxAge" in opts) { + opts.expires = new Date(Date.now() + opts.maxAge); + opts.maxAge /= 1e3; + } + if (opts.path == null) { + opts.path = "/"; + } + this.append("Set-Cookie", cookie.serialize(name, String(val), opts)); + return this; + }; + res.location = function location(url) { + var loc = url; + if (url === "back") { + loc = this.req.get("Referrer") || "/"; + } + return this.set("Location", encodeUrl(loc)); + }; + res.redirect = function redirect(url) { + var address = url; + var body; + var status = 302; + if (arguments.length === 2) { + if (typeof arguments[0] === "number") { + status = arguments[0]; + address = arguments[1]; + } else { + deprecate("res.redirect(url, status): Use res.redirect(status, url) instead"); + status = arguments[1]; + } + } + address = this.location(address).get("Location"); + this.format({ + text: function() { + body = statuses[status] + ". Redirecting to " + address; + }, + html: function() { + var u = escapeHtml(address); + body = "
" + statuses[status] + '. Redirecting to ' + u + "
"; + }, + default: function() { + body = ""; + } + }); + this.statusCode = status; + this.set("Content-Length", Buffer2.byteLength(body)); + if (this.req.method === "HEAD") { + this.end(); + } else { + this.end(body); + } + }; + res.vary = function(field) { + if (!field || Array.isArray(field) && !field.length) { + deprecate("res.vary(): Provide a field name"); + return this; + } + vary(this, field); + return this; + }; + res.render = function render(view, options, callback) { + var app2 = this.req.app; + var done = callback; + var opts = options || {}; + var req = this.req; + var self2 = this; + if (typeof options === "function") { + done = options; + opts = {}; + } + opts._locals = self2.locals; + done = done || function(err, str) { + if (err) + return req.next(err); + self2.send(str); + }; + app2.render(view, opts, done); + }; + function sendfile(res2, file, options, callback) { + var done = false; + var streaming; + function onaborted() { + if (done) + return; + done = true; + var err = new Error("Request aborted"); + err.code = "ECONNABORTED"; + callback(err); + } + function ondirectory() { + if (done) + return; + done = true; + var err = new Error("EISDIR, read"); + err.code = "EISDIR"; + callback(err); + } + function onerror(err) { + if (done) + return; + done = true; + callback(err); + } + function onend() { + if (done) + return; + done = true; + callback(); + } + function onfile() { + streaming = false; + } + function onfinish(err) { + if (err && err.code === "ECONNRESET") + return onaborted(); + if (err) + return onerror(err); + if (done) + return; + setImmediate(function() { + if (streaming !== false && !done) { + onaborted(); + return; + } + if (done) + return; + done = true; + callback(); + }); + } + function onstream() { + streaming = true; + } + file.on("directory", ondirectory); + file.on("end", onend); + file.on("error", onerror); + file.on("file", onfile); + file.on("stream", onstream); + onFinished(res2, onfinish); + if (options.headers) { + file.on("headers", function headers(res3) { + var obj = options.headers; + var keys = Object.keys(obj); + for (var i = 0; i < keys.length; i++) { + var k = keys[i]; + res3.setHeader(k, obj[k]); + } + }); + } + file.pipe(res2); + } + function stringify(value, replacer, spaces, escape2) { + var json = replacer || spaces ? JSON.stringify(value, replacer, spaces) : JSON.stringify(value); + if (escape2) { + json = json.replace(/[<>&]/g, function(c) { + switch (c.charCodeAt(0)) { + case 60: + return "\\u003c"; + case 62: + return "\\u003e"; + case 38: + return "\\u0026"; + default: + return c; + } + }); + } + return json; + } +}); + +// node_modules/serve-static/index.js +var require_serve_static = __commonJS((exports2, module2) => { + /*! + * serve-static + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * Copyright(c) 2014-2016 Douglas Christopher Wilson + * MIT Licensed + */ + "use strict"; + var encodeUrl = require_encodeurl(); + var escapeHtml = require_escape_html(); + var parseUrl = require_parseurl(); + var resolve = require("path").resolve; + var send = require_send(); + var url = require("url"); + module2.exports = serveStatic; + module2.exports.mime = send.mime; + function serveStatic(root, options) { + if (!root) { + throw new TypeError("root path required"); + } + if (typeof root !== "string") { + throw new TypeError("root path must be a string"); + } + var opts = Object.create(options || null); + var fallthrough = opts.fallthrough !== false; + var redirect = opts.redirect !== false; + var setHeaders = opts.setHeaders; + if (setHeaders && typeof setHeaders !== "function") { + throw new TypeError("option setHeaders must be function"); + } + opts.maxage = opts.maxage || opts.maxAge || 0; + opts.root = resolve(root); + var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener(); + return function serveStatic2(req, res, next) { + if (req.method !== "GET" && req.method !== "HEAD") { + if (fallthrough) { + return next(); + } + res.statusCode = 405; + res.setHeader("Allow", "GET, HEAD"); + res.setHeader("Content-Length", "0"); + res.end(); + return; + } + var forwardError = !fallthrough; + var originalUrl = parseUrl.original(req); + var path = parseUrl(req).pathname; + if (path === "/" && originalUrl.pathname.substr(-1) !== "/") { + path = ""; + } + var stream = send(req, path, opts); + stream.on("directory", onDirectory); + if (setHeaders) { + stream.on("headers", setHeaders); + } + if (fallthrough) { + stream.on("file", function onFile() { + forwardError = true; + }); + } + stream.on("error", function error(err) { + if (forwardError || !(err.statusCode < 500)) { + next(err); + return; + } + next(); + }); + stream.pipe(res); + }; + } + function collapseLeadingSlashes(str) { + for (var i = 0; i < str.length; i++) { + if (str.charCodeAt(i) !== 47) { + break; + } + } + return i > 1 ? "/" + str.substr(i) : str; + } + function createHtmlDocument(title, body) { + return '\n\n\n\n" + body + "\n\n\n"; + } + function createNotFoundDirectoryListener() { + return function notFound() { + this.error(404); + }; + } + function createRedirectDirectoryListener() { + return function redirect(res) { + if (this.hasTrailingSlash()) { + this.error(404); + return; + } + var originalUrl = parseUrl.original(this.req); + originalUrl.path = null; + originalUrl.pathname = collapseLeadingSlashes(originalUrl.pathname + "/"); + var loc = encodeUrl(url.format(originalUrl)); + var doc = createHtmlDocument("Redirecting", 'Redirecting to ' + escapeHtml(loc) + ""); + res.statusCode = 301; + res.setHeader("Content-Type", "text/html; charset=UTF-8"); + res.setHeader("Content-Length", Buffer.byteLength(doc)); + res.setHeader("Content-Security-Policy", "default-src 'none'"); + res.setHeader("X-Content-Type-Options", "nosniff"); + res.setHeader("Location", loc); + res.end(doc); + }; + } +}); + +// node_modules/express/lib/express.js +var require_express2 = __commonJS((exports2, module2) => { + /*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + "use strict"; + var bodyParser = require_body_parser(); + var EventEmitter = require("events").EventEmitter; + var mixin = require_merge_descriptors(); + var proto = require_application(); + var Route = require_route2(); + var Router = require_router2(); + var req = require_request3(); + var res = require_response(); + exports2 = module2.exports = createApplication; + function createApplication() { + var app2 = function(req2, res2, next) { + app2.handle(req2, res2, next); + }; + mixin(app2, EventEmitter.prototype, false); + mixin(app2, proto, false); + app2.request = Object.create(req, { + app: {configurable: true, enumerable: true, writable: true, value: app2} + }); + app2.response = Object.create(res, { + app: {configurable: true, enumerable: true, writable: true, value: app2} + }); + app2.init(); + return app2; + } + exports2.application = proto; + exports2.request = req; + exports2.response = res; + exports2.Route = Route; + exports2.Router = Router; + exports2.json = bodyParser.json; + exports2.query = require_query(); + exports2.raw = bodyParser.raw; + exports2.static = require_serve_static(); + exports2.text = bodyParser.text; + exports2.urlencoded = bodyParser.urlencoded; + var removedMiddlewares = [ + "bodyParser", + "compress", + "cookieSession", + "session", + "logger", + "cookieParser", + "favicon", + "responseTime", + "errorHandler", + "timeout", + "methodOverride", + "vhost", + "csrf", + "directory", + "limit", + "multipart", + "staticCache" + ]; + removedMiddlewares.forEach(function(name) { + Object.defineProperty(exports2, name, { + get: function() { + throw new Error("Most middleware (like " + name + ") is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware."); + }, + configurable: true + }); + }); +}); + +// node_modules/express/index.js +var require_express3 = __commonJS((exports2, module2) => { + /*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + "use strict"; + module2.exports = require_express2(); +}); + +// node_modules/pino-http/node_modules/pino-std-serializers/lib/err.js +var require_err2 = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = errSerializer; + var seen = Symbol("circular-ref-tag"); + var rawSymbol = Symbol("pino-raw-err-ref"); + var pinoErrProto = Object.create({}, { + type: { + enumerable: true, + writable: true, + value: void 0 + }, + message: { + enumerable: true, + writable: true, + value: void 0 + }, + stack: { + enumerable: true, + writable: true, + value: void 0 + }, + raw: { + enumerable: false, + get: function() { + return this[rawSymbol]; + }, + set: function(val) { + this[rawSymbol] = val; + } + } + }); + Object.defineProperty(pinoErrProto, rawSymbol, { + writable: true, + value: {} + }); + function errSerializer(err) { + if (!(err instanceof Error)) { + return err; + } + err[seen] = void 0; + const _err = Object.create(pinoErrProto); + _err.type = err.constructor.name; + _err.message = err.message; + _err.stack = err.stack; + for (const key in err) { + if (_err[key] === void 0) { + const val = err[key]; + if (val instanceof Error) { + if (!val.hasOwnProperty(seen)) { + _err[key] = errSerializer(val); + } + } else { + _err[key] = val; + } + } + } + delete err[seen]; + _err.raw = err; + return _err; + } +}); + +// node_modules/pino-http/node_modules/pino-std-serializers/lib/req.js +var require_req2 = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = { + mapHttpRequest, + reqSerializer + }; + var rawSymbol = Symbol("pino-raw-req-ref"); + var pinoReqProto = Object.create({}, { + id: { + enumerable: true, + writable: true, + value: "" + }, + method: { + enumerable: true, + writable: true, + value: "" + }, + url: { + enumerable: true, + writable: true, + value: "" + }, + headers: { + enumerable: true, + writable: true, + value: {} + }, + remoteAddress: { + enumerable: true, + writable: true, + value: "" + }, + remotePort: { + enumerable: true, + writable: true, + value: "" + }, + raw: { + enumerable: false, + get: function() { + return this[rawSymbol]; + }, + set: function(val) { + this[rawSymbol] = val; + } + } + }); + Object.defineProperty(pinoReqProto, rawSymbol, { + writable: true, + value: {} + }); + function reqSerializer(req) { + var connection = req.info || req.connection; + const _req = Object.create(pinoReqProto); + _req.id = typeof req.id === "function" ? req.id() : req.id || (req.info ? req.info.id : void 0); + _req.method = req.method; + if (req.originalUrl) { + _req.url = req.originalUrl; + } else { + _req.url = req.path || (req.url ? req.url.path || req.url : void 0); + } + _req.headers = req.headers; + _req.remoteAddress = connection && connection.remoteAddress; + _req.remotePort = connection && connection.remotePort; + _req.raw = req.raw || req; + return _req; + } + function mapHttpRequest(req) { + return { + req: reqSerializer(req) + }; + } +}); + +// node_modules/pino-http/node_modules/pino-std-serializers/lib/res.js +var require_res2 = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = { + mapHttpResponse, + resSerializer + }; + var rawSymbol = Symbol("pino-raw-res-ref"); + var pinoResProto = Object.create({}, { + statusCode: { + enumerable: true, + writable: true, + value: 0 + }, + headers: { + enumerable: true, + writable: true, + value: "" + }, + raw: { + enumerable: false, + get: function() { + return this[rawSymbol]; + }, + set: function(val) { + this[rawSymbol] = val; + } + } + }); + Object.defineProperty(pinoResProto, rawSymbol, { + writable: true, + value: {} + }); + function resSerializer(res) { + const _res = Object.create(pinoResProto); + _res.statusCode = res.statusCode; + _res.headers = res.getHeaders ? res.getHeaders() : res._headers; + _res.raw = res; + return _res; + } + function mapHttpResponse(res) { + return { + res: resSerializer(res) + }; + } +}); + +// node_modules/pino-http/node_modules/pino-std-serializers/index.js +var require_pino_std_serializers2 = __commonJS((exports2, module2) => { + "use strict"; + var errSerializer = require_err2(); + var reqSerializers = require_req2(); + var resSerializers = require_res2(); + module2.exports = { + err: errSerializer, + mapHttpRequest: reqSerializers.mapHttpRequest, + mapHttpResponse: resSerializers.mapHttpResponse, + req: reqSerializers.reqSerializer, + res: resSerializers.resSerializer, + wrapErrorSerializer: function wrapErrorSerializer(customSerializer) { + if (customSerializer === errSerializer) + return customSerializer; + return function wrapErrSerializer(err) { + return customSerializer(errSerializer(err)); + }; + }, + wrapRequestSerializer: function wrapRequestSerializer(customSerializer) { + if (customSerializer === reqSerializers.reqSerializer) + return customSerializer; + return function wrappedReqSerializer(req) { + return customSerializer(reqSerializers.reqSerializer(req)); + }; + }, + wrapResponseSerializer: function wrapResponseSerializer(customSerializer) { + if (customSerializer === resSerializers.resSerializer) + return customSerializer; + return function wrappedResSerializer(res) { + return customSerializer(resSerializers.resSerializer(res)); + }; + } + }; +}); + +// node_modules/fast-url-parser/src/urlparser.js +var require_urlparser = __commonJS((exports2, module2) => { + "use strict"; + function Url() { + this._protocol = null; + this._href = ""; + this._port = -1; + this._query = null; + this.auth = null; + this.slashes = null; + this.host = null; + this.hostname = null; + this.hash = null; + this.search = null; + this.pathname = null; + this._prependSlash = false; + } + var querystring = require("querystring"); + Url.queryString = querystring; + Url.prototype.parse = function Url$parse(str, parseQueryString, hostDenotesSlash, disableAutoEscapeChars) { + if (typeof str !== "string") { + throw new TypeError("Parameter 'url' must be a string, not " + typeof str); + } + var start = 0; + var end = str.length - 1; + while (str.charCodeAt(start) <= 32) + start++; + while (str.charCodeAt(end) <= 32) + end--; + start = this._parseProtocol(str, start, end); + if (this._protocol !== "javascript") { + start = this._parseHost(str, start, end, hostDenotesSlash); + var proto = this._protocol; + if (!this.hostname && (this.slashes || proto && !slashProtocols[proto])) { + this.hostname = this.host = ""; + } + } + if (start <= end) { + var ch = str.charCodeAt(start); + if (ch === 47 || ch === 92) { + this._parsePath(str, start, end, disableAutoEscapeChars); + } else if (ch === 63) { + this._parseQuery(str, start, end, disableAutoEscapeChars); + } else if (ch === 35) { + this._parseHash(str, start, end, disableAutoEscapeChars); + } else if (this._protocol !== "javascript") { + this._parsePath(str, start, end, disableAutoEscapeChars); + } else { + this.pathname = str.slice(start, end + 1); + } + } + if (!this.pathname && this.hostname && this._slashProtocols[this._protocol]) { + this.pathname = "/"; + } + if (parseQueryString) { + var search = this.search; + if (search == null) { + search = this.search = ""; + } + if (search.charCodeAt(0) === 63) { + search = search.slice(1); + } + this.query = Url.queryString.parse(search); + } + }; + Url.prototype.resolve = function Url$resolve(relative2) { + return this.resolveObject(Url.parse(relative2, false, true)).format(); + }; + Url.prototype.format = function Url$format() { + var auth = this.auth || ""; + if (auth) { + auth = encodeURIComponent(auth); + auth = auth.replace(/%3A/i, ":"); + auth += "@"; + } + var protocol = this.protocol || ""; + var pathname = this.pathname || ""; + var hash = this.hash || ""; + var search = this.search || ""; + var query = ""; + var hostname = this.hostname || ""; + var port = this.port || ""; + var host = false; + var scheme = ""; + var q = this.query; + if (q && typeof q === "object") { + query = Url.queryString.stringify(q); + } + if (!search) { + search = query ? "?" + query : ""; + } + if (protocol && protocol.charCodeAt(protocol.length - 1) !== 58) + protocol += ":"; + if (this.host) { + host = auth + this.host; + } else if (hostname) { + var ip6 = hostname.indexOf(":") > -1; + if (ip6) + hostname = "[" + hostname + "]"; + host = auth + hostname + (port ? ":" + port : ""); + } + var slashes = this.slashes || (!protocol || slashProtocols[protocol]) && host !== false; + if (protocol) + scheme = protocol + (slashes ? "//" : ""); + else if (slashes) + scheme = "//"; + if (slashes && pathname && pathname.charCodeAt(0) !== 47) { + pathname = "/" + pathname; + } + if (search && search.charCodeAt(0) !== 63) + search = "?" + search; + if (hash && hash.charCodeAt(0) !== 35) + hash = "#" + hash; + pathname = escapePathName(pathname); + search = escapeSearch(search); + return scheme + (host === false ? "" : host) + pathname + search + hash; + }; + Url.prototype.resolveObject = function Url$resolveObject(relative2) { + if (typeof relative2 === "string") + relative2 = Url.parse(relative2, false, true); + var result = this._clone(); + result.hash = relative2.hash; + if (!relative2.href) { + result._href = ""; + return result; + } + if (relative2.slashes && !relative2._protocol) { + relative2._copyPropsTo(result, true); + if (slashProtocols[result._protocol] && result.hostname && !result.pathname) { + result.pathname = "/"; + } + result._href = ""; + return result; + } + if (relative2._protocol && relative2._protocol !== result._protocol) { + if (!slashProtocols[relative2._protocol]) { + relative2._copyPropsTo(result, false); + result._href = ""; + return result; + } + result._protocol = relative2._protocol; + if (!relative2.host && relative2._protocol !== "javascript") { + var relPath = (relative2.pathname || "").split("/"); + while (relPath.length && !(relative2.host = relPath.shift())) + ; + if (!relative2.host) + relative2.host = ""; + if (!relative2.hostname) + relative2.hostname = ""; + if (relPath[0] !== "") + relPath.unshift(""); + if (relPath.length < 2) + relPath.unshift(""); + result.pathname = relPath.join("/"); + } else { + result.pathname = relative2.pathname; + } + result.search = relative2.search; + result.host = relative2.host || ""; + result.auth = relative2.auth; + result.hostname = relative2.hostname || relative2.host; + result._port = relative2._port; + result.slashes = result.slashes || relative2.slashes; + result._href = ""; + return result; + } + var isSourceAbs = result.pathname && result.pathname.charCodeAt(0) === 47; + var isRelAbs = relative2.host || relative2.pathname && relative2.pathname.charCodeAt(0) === 47; + var mustEndAbs = isRelAbs || isSourceAbs || result.host && relative2.pathname; + var removeAllDots = mustEndAbs; + var srcPath = result.pathname && result.pathname.split("/") || []; + var relPath = relative2.pathname && relative2.pathname.split("/") || []; + var psychotic = result._protocol && !slashProtocols[result._protocol]; + if (psychotic) { + result.hostname = ""; + result._port = -1; + if (result.host) { + if (srcPath[0] === "") + srcPath[0] = result.host; + else + srcPath.unshift(result.host); + } + result.host = ""; + if (relative2._protocol) { + relative2.hostname = ""; + relative2._port = -1; + if (relative2.host) { + if (relPath[0] === "") + relPath[0] = relative2.host; + else + relPath.unshift(relative2.host); + } + relative2.host = ""; + } + mustEndAbs = mustEndAbs && (relPath[0] === "" || srcPath[0] === ""); + } + if (isRelAbs) { + result.host = relative2.host ? relative2.host : result.host; + result.hostname = relative2.hostname ? relative2.hostname : result.hostname; + result.search = relative2.search; + srcPath = relPath; + } else if (relPath.length) { + if (!srcPath) + srcPath = []; + srcPath.pop(); + srcPath = srcPath.concat(relPath); + result.search = relative2.search; + } else if (relative2.search) { + if (psychotic) { + result.hostname = result.host = srcPath.shift(); + var authInHost = result.host && result.host.indexOf("@") > 0 ? result.host.split("@") : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + result.search = relative2.search; + result._href = ""; + return result; + } + if (!srcPath.length) { + result.pathname = null; + result._href = ""; + return result; + } + var last = srcPath.slice(-1)[0]; + var hasTrailingSlash = (result.host || relative2.host) && (last === "." || last === "..") || last === ""; + var up = 0; + for (var i2 = srcPath.length; i2 >= 0; i2--) { + last = srcPath[i2]; + if (last === ".") { + srcPath.splice(i2, 1); + } else if (last === "..") { + srcPath.splice(i2, 1); + up++; + } else if (up) { + srcPath.splice(i2, 1); + up--; + } + } + if (!mustEndAbs && !removeAllDots) { + for (; up--; up) { + srcPath.unshift(".."); + } + } + if (mustEndAbs && srcPath[0] !== "" && (!srcPath[0] || srcPath[0].charCodeAt(0) !== 47)) { + srcPath.unshift(""); + } + if (hasTrailingSlash && srcPath.join("/").substr(-1) !== "/") { + srcPath.push(""); + } + var isAbsolute = srcPath[0] === "" || srcPath[0] && srcPath[0].charCodeAt(0) === 47; + if (psychotic) { + result.hostname = result.host = isAbsolute ? "" : srcPath.length ? srcPath.shift() : ""; + var authInHost = result.host && result.host.indexOf("@") > 0 ? result.host.split("@") : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + mustEndAbs = mustEndAbs || result.host && srcPath.length; + if (mustEndAbs && !isAbsolute) { + srcPath.unshift(""); + } + result.pathname = srcPath.length === 0 ? null : srcPath.join("/"); + result.auth = relative2.auth || result.auth; + result.slashes = result.slashes || relative2.slashes; + result._href = ""; + return result; + }; + var punycode = require("punycode"); + Url.prototype._hostIdna = function Url$_hostIdna(hostname) { + return punycode.toASCII(hostname); + }; + var escapePathName = Url.prototype._escapePathName = function Url$_escapePathName(pathname) { + if (!containsCharacter2(pathname, 35, 63)) { + return pathname; + } + return _escapePath(pathname); + }; + var escapeSearch = Url.prototype._escapeSearch = function Url$_escapeSearch(search) { + if (!containsCharacter2(search, 35, -1)) + return search; + return _escapeSearch(search); + }; + Url.prototype._parseProtocol = function Url$_parseProtocol(str, start, end) { + var doLowerCase = false; + var protocolCharacters = this._protocolCharacters; + for (var i2 = start; i2 <= end; ++i2) { + var ch = str.charCodeAt(i2); + if (ch === 58) { + var protocol = str.slice(start, i2); + if (doLowerCase) + protocol = protocol.toLowerCase(); + this._protocol = protocol; + return i2 + 1; + } else if (protocolCharacters[ch] === 1) { + if (ch < 97) + doLowerCase = true; + } else { + return start; + } + } + return start; + }; + Url.prototype._parseAuth = function Url$_parseAuth(str, start, end, decode) { + var auth = str.slice(start, end + 1); + if (decode) { + auth = decodeURIComponent(auth); + } + this.auth = auth; + }; + Url.prototype._parsePort = function Url$_parsePort(str, start, end) { + var port = 0; + var hadChars = false; + var validPort = true; + for (var i2 = start; i2 <= end; ++i2) { + var ch = str.charCodeAt(i2); + if (48 <= ch && ch <= 57) { + port = 10 * port + (ch - 48); + hadChars = true; + } else { + validPort = false; + if (ch === 92 || ch === 47) { + validPort = true; + } + break; + } + } + if (port === 0 && !hadChars || !validPort) { + if (!validPort) { + this._port = -2; + } + return 0; + } + this._port = port; + return i2 - start; + }; + Url.prototype._parseHost = function Url$_parseHost(str, start, end, slashesDenoteHost) { + var hostEndingCharacters = this._hostEndingCharacters; + var first = str.charCodeAt(start); + var second = str.charCodeAt(start + 1); + if ((first === 47 || first === 92) && (second === 47 || second === 92)) { + this.slashes = true; + if (start === 0) { + if (end < 2) + return start; + var hasAuth = containsCharacter(str, 64, 2, hostEndingCharacters); + if (!hasAuth && !slashesDenoteHost) { + this.slashes = null; + return start; + } + } + start += 2; + } else if (!this._protocol || slashProtocols[this._protocol]) { + return start; + } + var doLowerCase = false; + var idna = false; + var hostNameStart = start; + var hostNameEnd = end; + var lastCh = -1; + var portLength = 0; + var charsAfterDot = 0; + var authNeedsDecoding = false; + var j = -1; + for (var i2 = start; i2 <= end; ++i2) { + var ch = str.charCodeAt(i2); + if (ch === 64) { + j = i2; + } else if (ch === 37) { + authNeedsDecoding = true; + } else if (hostEndingCharacters[ch] === 1) { + break; + } + } + if (j > -1) { + this._parseAuth(str, start, j - 1, authNeedsDecoding); + start = hostNameStart = j + 1; + } + if (str.charCodeAt(start) === 91) { + for (var i2 = start + 1; i2 <= end; ++i2) { + var ch = str.charCodeAt(i2); + if (ch === 93) { + if (str.charCodeAt(i2 + 1) === 58) { + portLength = this._parsePort(str, i2 + 2, end) + 1; + } + var hostname = str.slice(start + 1, i2).toLowerCase(); + this.hostname = hostname; + this.host = this._port > 0 ? "[" + hostname + "]:" + this._port : "[" + hostname + "]"; + this.pathname = "/"; + return i2 + portLength + 1; + } + } + return start; + } + for (var i2 = start; i2 <= end; ++i2) { + if (charsAfterDot > 62) { + this.hostname = this.host = str.slice(start, i2); + return i2; + } + var ch = str.charCodeAt(i2); + if (ch === 58) { + portLength = this._parsePort(str, i2 + 1, end) + 1; + hostNameEnd = i2 - 1; + break; + } else if (ch < 97) { + if (ch === 46) { + charsAfterDot = -1; + } else if (65 <= ch && ch <= 90) { + doLowerCase = true; + } else if (!(ch === 45 || ch === 95 || ch === 43 || 48 <= ch && ch <= 57)) { + if (hostEndingCharacters[ch] === 0 && this._noPrependSlashHostEnders[ch] === 0) { + this._prependSlash = true; + } + hostNameEnd = i2 - 1; + break; + } + } else if (ch >= 123) { + if (ch <= 126) { + if (this._noPrependSlashHostEnders[ch] === 0) { + this._prependSlash = true; + } + hostNameEnd = i2 - 1; + break; + } + idna = true; + } + lastCh = ch; + charsAfterDot++; + } + if (hostNameEnd + 1 !== start && hostNameEnd - hostNameStart <= 256) { + var hostname = str.slice(hostNameStart, hostNameEnd + 1); + if (doLowerCase) + hostname = hostname.toLowerCase(); + if (idna) + hostname = this._hostIdna(hostname); + this.hostname = hostname; + this.host = this._port > 0 ? hostname + ":" + this._port : hostname; + } + return hostNameEnd + 1 + portLength; + }; + Url.prototype._copyPropsTo = function Url$_copyPropsTo(input, noProtocol) { + if (!noProtocol) { + input._protocol = this._protocol; + } + input._href = this._href; + input._port = this._port; + input._prependSlash = this._prependSlash; + input.auth = this.auth; + input.slashes = this.slashes; + input.host = this.host; + input.hostname = this.hostname; + input.hash = this.hash; + input.search = this.search; + input.pathname = this.pathname; + }; + Url.prototype._clone = function Url$_clone() { + var ret = new Url(); + ret._protocol = this._protocol; + ret._href = this._href; + ret._port = this._port; + ret._prependSlash = this._prependSlash; + ret.auth = this.auth; + ret.slashes = this.slashes; + ret.host = this.host; + ret.hostname = this.hostname; + ret.hash = this.hash; + ret.search = this.search; + ret.pathname = this.pathname; + return ret; + }; + Url.prototype._getComponentEscaped = function Url$_getComponentEscaped(str, start, end, isAfterQuery) { + var cur = start; + var i2 = start; + var ret = ""; + var autoEscapeMap2 = isAfterQuery ? this._afterQueryAutoEscapeMap : this._autoEscapeMap; + for (; i2 <= end; ++i2) { + var ch = str.charCodeAt(i2); + var escaped = autoEscapeMap2[ch]; + if (escaped !== "" && escaped !== void 0) { + if (cur < i2) + ret += str.slice(cur, i2); + ret += escaped; + cur = i2 + 1; + } + } + if (cur < i2 + 1) + ret += str.slice(cur, i2); + return ret; + }; + Url.prototype._parsePath = function Url$_parsePath(str, start, end, disableAutoEscapeChars) { + var pathStart = start; + var pathEnd = end; + var escape2 = false; + var autoEscapeCharacters = this._autoEscapeCharacters; + var prePath = this._port === -2 ? "/:" : ""; + for (var i2 = start; i2 <= end; ++i2) { + var ch = str.charCodeAt(i2); + if (ch === 35) { + this._parseHash(str, i2, end, disableAutoEscapeChars); + pathEnd = i2 - 1; + break; + } else if (ch === 63) { + this._parseQuery(str, i2, end, disableAutoEscapeChars); + pathEnd = i2 - 1; + break; + } else if (!disableAutoEscapeChars && !escape2 && autoEscapeCharacters[ch] === 1) { + escape2 = true; + } + } + if (pathStart > pathEnd) { + this.pathname = prePath === "" ? "/" : prePath; + return; + } + var path; + if (escape2) { + path = this._getComponentEscaped(str, pathStart, pathEnd, false); + } else { + path = str.slice(pathStart, pathEnd + 1); + } + this.pathname = prePath === "" ? this._prependSlash ? "/" + path : path : prePath + path; + }; + Url.prototype._parseQuery = function Url$_parseQuery(str, start, end, disableAutoEscapeChars) { + var queryStart = start; + var queryEnd = end; + var escape2 = false; + var autoEscapeCharacters = this._autoEscapeCharacters; + for (var i2 = start; i2 <= end; ++i2) { + var ch = str.charCodeAt(i2); + if (ch === 35) { + this._parseHash(str, i2, end, disableAutoEscapeChars); + queryEnd = i2 - 1; + break; + } else if (!disableAutoEscapeChars && !escape2 && autoEscapeCharacters[ch] === 1) { + escape2 = true; + } + } + if (queryStart > queryEnd) { + this.search = ""; + return; + } + var query; + if (escape2) { + query = this._getComponentEscaped(str, queryStart, queryEnd, true); + } else { + query = str.slice(queryStart, queryEnd + 1); + } + this.search = query; + }; + Url.prototype._parseHash = function Url$_parseHash(str, start, end, disableAutoEscapeChars) { + if (start > end) { + this.hash = ""; + return; + } + this.hash = disableAutoEscapeChars ? str.slice(start, end + 1) : this._getComponentEscaped(str, start, end, true); + }; + Object.defineProperty(Url.prototype, "port", { + get: function() { + if (this._port >= 0) { + return "" + this._port; + } + return null; + }, + set: function(v) { + if (v == null) { + this._port = -1; + } else { + this._port = parseInt(v, 10); + } + } + }); + Object.defineProperty(Url.prototype, "query", { + get: function() { + var query = this._query; + if (query != null) { + return query; + } + var search = this.search; + if (search) { + if (search.charCodeAt(0) === 63) { + search = search.slice(1); + } + if (search !== "") { + this._query = search; + return search; + } + } + return search; + }, + set: function(v) { + this._query = v; + } + }); + Object.defineProperty(Url.prototype, "path", { + get: function() { + var p = this.pathname || ""; + var s = this.search || ""; + if (p || s) { + return p + s; + } + return p == null && s ? "/" + s : null; + }, + set: function() { + } + }); + Object.defineProperty(Url.prototype, "protocol", { + get: function() { + var proto = this._protocol; + return proto ? proto + ":" : proto; + }, + set: function(v) { + if (typeof v === "string") { + var end = v.length - 1; + if (v.charCodeAt(end) === 58) { + this._protocol = v.slice(0, end); + } else { + this._protocol = v; + } + } else if (v == null) { + this._protocol = null; + } + } + }); + Object.defineProperty(Url.prototype, "href", { + get: function() { + var href = this._href; + if (!href) { + href = this._href = this.format(); + } + return href; + }, + set: function(v) { + this._href = v; + } + }); + Url.parse = function Url$Parse(str, parseQueryString, hostDenotesSlash, disableAutoEscapeChars) { + if (str instanceof Url) + return str; + var ret = new Url(); + ret.parse(str, !!parseQueryString, !!hostDenotesSlash, !!disableAutoEscapeChars); + return ret; + }; + Url.format = function Url$Format(obj) { + if (typeof obj === "string") { + obj = Url.parse(obj); + } + if (!(obj instanceof Url)) { + return Url.prototype.format.call(obj); + } + return obj.format(); + }; + Url.resolve = function Url$Resolve(source, relative2) { + return Url.parse(source, false, true).resolve(relative2); + }; + Url.resolveObject = function Url$ResolveObject(source, relative2) { + if (!source) + return relative2; + return Url.parse(source, false, true).resolveObject(relative2); + }; + function _escapePath(pathname) { + return pathname.replace(/[?#]/g, function(match) { + return encodeURIComponent(match); + }); + } + function _escapeSearch(search) { + return search.replace(/#/g, function(match) { + return encodeURIComponent(match); + }); + } + function containsCharacter(string, char1, fromIndex, stopCharacterTable) { + var len2 = string.length; + for (var i2 = fromIndex; i2 < len2; ++i2) { + var ch = string.charCodeAt(i2); + if (ch === char1) { + return true; + } else if (stopCharacterTable[ch] === 1) { + return false; + } + } + return false; + } + function containsCharacter2(string, char1, char2) { + for (var i2 = 0, len2 = string.length; i2 < len2; ++i2) { + var ch = string.charCodeAt(i2); + if (ch === char1 || ch === char2) + return true; + } + return false; + } + function makeAsciiTable(spec) { + var ret = new Uint8Array(128); + spec.forEach(function(item) { + if (typeof item === "number") { + ret[item] = 1; + } else { + var start = item[0]; + var end = item[1]; + for (var j = start; j <= end; ++j) { + ret[j] = 1; + } + } + }); + return ret; + } + var autoEscape = [ + "<", + ">", + '"', + "`", + " ", + "\r", + "\n", + " ", + "{", + "}", + "|", + "\\", + "^", + "`", + "'" + ]; + var autoEscapeMap = new Array(128); + for (var i = 0, len = autoEscapeMap.length; i < len; ++i) { + autoEscapeMap[i] = ""; + } + for (var i = 0, len = autoEscape.length; i < len; ++i) { + c = autoEscape[i]; + esc = encodeURIComponent(c); + if (esc === c) { + esc = escape(c); + } + autoEscapeMap[c.charCodeAt(0)] = esc; + } + var c; + var esc; + var afterQueryAutoEscapeMap = autoEscapeMap.slice(); + autoEscapeMap[92] = "/"; + var slashProtocols = Url.prototype._slashProtocols = { + http: true, + https: true, + gopher: true, + file: true, + ftp: true, + "http:": true, + "https:": true, + "gopher:": true, + "file:": true, + "ftp:": true + }; + function f() { + } + f.prototype = slashProtocols; + Url.prototype._protocolCharacters = makeAsciiTable([ + [97, 122], + [65, 90], + 46, + 43, + 45 + ]); + Url.prototype._hostEndingCharacters = makeAsciiTable([ + 35, + 63, + 47, + 92 + ]); + Url.prototype._autoEscapeCharacters = makeAsciiTable(autoEscape.map(function(v) { + return v.charCodeAt(0); + })); + Url.prototype._noPrependSlashHostEnders = makeAsciiTable([ + "<", + ">", + "'", + "`", + " ", + "\r", + "\n", + " ", + "{", + "}", + "|", + "^", + "`", + '"', + "%", + ";" + ].map(function(v) { + return v.charCodeAt(0); + })); + Url.prototype._autoEscapeMap = autoEscapeMap; + Url.prototype._afterQueryAutoEscapeMap = afterQueryAutoEscapeMap; + module2.exports = Url; + Url.replace = function Url$Replace() { + require.cache.url = { + exports: Url + }; + }; +}); + +// node_modules/pino-http/logger.js +var require_logger2 = __commonJS((exports2, module2) => { + "use strict"; + var pino = require_pino(); + var serializers = require_pino_std_serializers2(); + var URL = require_urlparser(); + var startTime = Symbol("startTime"); + function pinoLogger(opts, stream) { + if (opts && opts._writableState) { + stream = opts; + opts = null; + } + opts = Object.assign({}, opts); + opts.customAttributeKeys = opts.customAttributeKeys || {}; + var reqKey = opts.customAttributeKeys.req || "req"; + var resKey = opts.customAttributeKeys.res || "res"; + var errKey = opts.customAttributeKeys.err || "err"; + var responseTimeKey = opts.customAttributeKeys.responseTime || "responseTime"; + delete opts.customAttributeKeys; + var customProps = opts.customProps || opts.reqCustomProps || {}; + opts.wrapSerializers = "wrapSerializers" in opts ? opts.wrapSerializers : true; + if (opts.wrapSerializers) { + opts.serializers = Object.assign({}, opts.serializers); + var requestSerializer = opts.serializers[reqKey] || opts.serializers.req || serializers.req; + var responseSerializer = opts.serializers[resKey] || opts.serializers.res || serializers.res; + var errorSerializer = opts.serializers[errKey] || opts.serializers.err || serializers.err; + opts.serializers[reqKey] = serializers.wrapRequestSerializer(requestSerializer); + opts.serializers[resKey] = serializers.wrapResponseSerializer(responseSerializer); + opts.serializers[errKey] = serializers.wrapErrorSerializer(errorSerializer); + } + delete opts.wrapSerializers; + if (opts.useLevel && opts.customLogLevel) { + throw new Error("You can't pass 'useLevel' and 'customLogLevel' together"); + } + var useLevel = opts.useLevel || "info"; + var customLogLevel = opts.customLogLevel; + delete opts.useLevel; + delete opts.customLogLevel; + var theStream = opts.stream || stream; + delete opts.stream; + var autoLogging = opts.autoLogging !== false; + var autoLoggingIgnorePaths = opts.autoLogging && opts.autoLogging.ignorePaths ? opts.autoLogging.ignorePaths : []; + var autoLoggingGetPath = opts.autoLogging && opts.autoLogging.getPath ? opts.autoLogging.getPath : null; + delete opts.autoLogging; + var successMessage = opts.customSuccessMessage || function() { + return "request completed"; + }; + var errorMessage = opts.customErrorMessage || function() { + return "request errored"; + }; + delete opts.customSuccessfulMessage; + delete opts.customErroredMessage; + var logger = wrapChild(opts, theStream); + var genReqId = reqIdGenFactory(opts.genReqId); + loggingMiddleware.logger = logger; + return loggingMiddleware; + function onResFinished(err) { + this.removeListener("error", onResFinished); + this.removeListener("finish", onResFinished); + var log2 = this.log; + var responseTime = Date.now() - this[startTime]; + var level = customLogLevel ? customLogLevel(this, err) : useLevel; + if (err || this.err || this.statusCode >= 500) { + var error = err || this.err || new Error("failed with status code " + this.statusCode); + log2[level]({ + [resKey]: this, + [errKey]: error, + [responseTimeKey]: responseTime + }, errorMessage(error, this)); + return; + } + log2[level]({ + [resKey]: this, + [responseTimeKey]: responseTime + }, successMessage(this)); + } + function loggingMiddleware(req, res, next) { + var shouldLogSuccess = true; + req.id = genReqId(req); + var log2 = logger.child({[reqKey]: req}); + if (customProps) { + var customPropBindings = typeof customProps === "function" ? customProps(req, res) : customProps; + log2 = log2.child(customPropBindings); + } + req.log = res.log = log2; + res[startTime] = res[startTime] || Date.now(); + if (autoLogging) { + if (autoLoggingIgnorePaths.length) { + var url; + if (autoLoggingGetPath) { + url = URL.parse(autoLoggingGetPath(req)); + } else if (req.url) { + url = URL.parse(req.url); + } + if (url && url.pathname) { + shouldLogSuccess = !autoLoggingIgnorePaths.find((ignorePath) => { + if (ignorePath instanceof RegExp) { + return ignorePath.test(url.pathname); + } + return ignorePath === url.pathname; + }); + } + } + if (shouldLogSuccess) { + res.on("finish", onResFinished); + } + res.on("error", onResFinished); + } + if (next) { + next(); + } + } + } + function wrapChild(opts, stream) { + var prevLogger = opts.logger; + var prevGenReqId = opts.genReqId; + var logger = null; + if (prevLogger) { + opts.logger = void 0; + opts.genReqId = void 0; + logger = prevLogger.child(opts); + opts.logger = prevLogger; + opts.genReqId = prevGenReqId; + } else { + logger = pino(opts, stream); + } + return logger; + } + function reqIdGenFactory(func) { + if (typeof func === "function") + return func; + var maxInt = 2147483647; + var nextReqId = 0; + return function genReqId(req) { + return req.id || (nextReqId = nextReqId + 1 & maxInt); + }; + } + module2.exports = pinoLogger; + module2.exports.stdSerializers = { + err: serializers.err, + req: serializers.req, + res: serializers.res + }; + module2.exports.startTime = startTime; +}); + +// node_modules/uuid/dist/rng.js +var require_rng = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = rng; + var _crypto = _interopRequireDefault(require("crypto")); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var rnds8Pool = new Uint8Array(256); + var poolPtr = rnds8Pool.length; + function rng() { + if (poolPtr > rnds8Pool.length - 16) { + _crypto.default.randomFillSync(rnds8Pool); + poolPtr = 0; + } + return rnds8Pool.slice(poolPtr, poolPtr += 16); + } +}); + +// node_modules/uuid/dist/regex.js +var require_regex = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; + exports2.default = _default; +}); + +// node_modules/uuid/dist/validate.js +var require_validate = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var _regex = _interopRequireDefault(require_regex()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function validate(uuid) { + return typeof uuid === "string" && _regex.default.test(uuid); + } + var _default = validate; + exports2.default = _default; +}); + +// node_modules/uuid/dist/stringify.js +var require_stringify2 = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var _validate = _interopRequireDefault(require_validate()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var byteToHex = []; + for (let i = 0; i < 256; ++i) { + byteToHex.push((i + 256).toString(16).substr(1)); + } + function stringify(arr, offset = 0) { + const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); + if (!(0, _validate.default)(uuid)) { + throw TypeError("Stringified UUID is invalid"); + } + return uuid; + } + var _default = stringify; + exports2.default = _default; +}); + +// node_modules/uuid/dist/v1.js +var require_v1 = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var _rng = _interopRequireDefault(require_rng()); + var _stringify = _interopRequireDefault(require_stringify2()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var _nodeId; + var _clockseq; + var _lastMSecs = 0; + var _lastNSecs = 0; + function v1(options, buf, offset) { + let i = buf && offset || 0; + const b = buf || new Array(16); + options = options || {}; + let node = options.node || _nodeId; + let clockseq = options.clockseq !== void 0 ? options.clockseq : _clockseq; + if (node == null || clockseq == null) { + const seedBytes = options.random || (options.rng || _rng.default)(); + if (node == null) { + node = _nodeId = [seedBytes[0] | 1, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; + } + if (clockseq == null) { + clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 16383; + } + } + let msecs = options.msecs !== void 0 ? options.msecs : Date.now(); + let nsecs = options.nsecs !== void 0 ? options.nsecs : _lastNSecs + 1; + const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4; + if (dt < 0 && options.clockseq === void 0) { + clockseq = clockseq + 1 & 16383; + } + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === void 0) { + nsecs = 0; + } + if (nsecs >= 1e4) { + throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); + } + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; + msecs += 122192928e5; + const tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296; + b[i++] = tl >>> 24 & 255; + b[i++] = tl >>> 16 & 255; + b[i++] = tl >>> 8 & 255; + b[i++] = tl & 255; + const tmh = msecs / 4294967296 * 1e4 & 268435455; + b[i++] = tmh >>> 8 & 255; + b[i++] = tmh & 255; + b[i++] = tmh >>> 24 & 15 | 16; + b[i++] = tmh >>> 16 & 255; + b[i++] = clockseq >>> 8 | 128; + b[i++] = clockseq & 255; + for (let n = 0; n < 6; ++n) { + b[i + n] = node[n]; + } + return buf || (0, _stringify.default)(b); + } + var _default = v1; + exports2.default = _default; +}); + +// node_modules/uuid/dist/parse.js +var require_parse4 = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var _validate = _interopRequireDefault(require_validate()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function parse(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError("Invalid UUID"); + } + let v; + const arr = new Uint8Array(16); + arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; + arr[1] = v >>> 16 & 255; + arr[2] = v >>> 8 & 255; + arr[3] = v & 255; + arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; + arr[5] = v & 255; + arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; + arr[7] = v & 255; + arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; + arr[9] = v & 255; + arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255; + arr[11] = v / 4294967296 & 255; + arr[12] = v >>> 24 & 255; + arr[13] = v >>> 16 & 255; + arr[14] = v >>> 8 & 255; + arr[15] = v & 255; + return arr; + } + var _default = parse; + exports2.default = _default; +}); + +// node_modules/uuid/dist/v35.js +var require_v35 = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = _default; + exports2.URL = exports2.DNS = void 0; + var _stringify = _interopRequireDefault(require_stringify2()); + var _parse = _interopRequireDefault(require_parse4()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function stringToBytes(str) { + str = unescape(encodeURIComponent(str)); + const bytes = []; + for (let i = 0; i < str.length; ++i) { + bytes.push(str.charCodeAt(i)); + } + return bytes; + } + var DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"; + exports2.DNS = DNS; + var URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8"; + exports2.URL = URL; + function _default(name, version, hashfunc) { + function generateUUID(value, namespace, buf, offset) { + if (typeof value === "string") { + value = stringToBytes(value); + } + if (typeof namespace === "string") { + namespace = (0, _parse.default)(namespace); + } + if (namespace.length !== 16) { + throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)"); + } + let bytes = new Uint8Array(16 + value.length); + bytes.set(namespace); + bytes.set(value, namespace.length); + bytes = hashfunc(bytes); + bytes[6] = bytes[6] & 15 | version; + bytes[8] = bytes[8] & 63 | 128; + if (buf) { + offset = offset || 0; + for (let i = 0; i < 16; ++i) { + buf[offset + i] = bytes[i]; + } + return buf; + } + return (0, _stringify.default)(bytes); + } + try { + generateUUID.name = name; + } catch (err) { + } + generateUUID.DNS = DNS; + generateUUID.URL = URL; + return generateUUID; + } +}); + +// node_modules/uuid/dist/md5.js +var require_md5 = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var _crypto = _interopRequireDefault(require("crypto")); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function md5(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === "string") { + bytes = Buffer.from(bytes, "utf8"); + } + return _crypto.default.createHash("md5").update(bytes).digest(); + } + var _default = md5; + exports2.default = _default; +}); + +// node_modules/uuid/dist/v3.js +var require_v3 = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var _v = _interopRequireDefault(require_v35()); + var _md = _interopRequireDefault(require_md5()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var v3 = (0, _v.default)("v3", 48, _md.default); + var _default = v3; + exports2.default = _default; +}); + +// node_modules/uuid/dist/v4.js +var require_v4 = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var _rng = _interopRequireDefault(require_rng()); + var _stringify = _interopRequireDefault(require_stringify2()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function v4(options, buf, offset) { + options = options || {}; + const rnds = options.random || (options.rng || _rng.default)(); + rnds[6] = rnds[6] & 15 | 64; + rnds[8] = rnds[8] & 63 | 128; + if (buf) { + offset = offset || 0; + for (let i = 0; i < 16; ++i) { + buf[offset + i] = rnds[i]; + } + return buf; + } + return (0, _stringify.default)(rnds); + } + var _default = v4; + exports2.default = _default; +}); + +// node_modules/uuid/dist/sha1.js +var require_sha1 = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var _crypto = _interopRequireDefault(require("crypto")); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function sha1(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === "string") { + bytes = Buffer.from(bytes, "utf8"); + } + return _crypto.default.createHash("sha1").update(bytes).digest(); + } + var _default = sha1; + exports2.default = _default; +}); + +// node_modules/uuid/dist/v5.js +var require_v5 = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var _v = _interopRequireDefault(require_v35()); + var _sha = _interopRequireDefault(require_sha1()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var v5 = (0, _v.default)("v5", 80, _sha.default); + var _default = v5; + exports2.default = _default; +}); + +// node_modules/uuid/dist/nil.js +var require_nil = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var _default = "00000000-0000-0000-0000-000000000000"; + exports2.default = _default; +}); + +// node_modules/uuid/dist/version.js +var require_version5 = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var _validate = _interopRequireDefault(require_validate()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function version(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError("Invalid UUID"); + } + return parseInt(uuid.substr(14, 1), 16); + } + var _default = version; + exports2.default = _default; +}); + +// node_modules/uuid/dist/index.js +var require_dist9 = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + Object.defineProperty(exports2, "v1", { + enumerable: true, + get: function() { + return _v.default; + } + }); + Object.defineProperty(exports2, "v3", { + enumerable: true, + get: function() { + return _v2.default; + } + }); + Object.defineProperty(exports2, "v4", { + enumerable: true, + get: function() { + return _v3.default; + } + }); + Object.defineProperty(exports2, "v5", { + enumerable: true, + get: function() { + return _v4.default; + } + }); + Object.defineProperty(exports2, "NIL", { + enumerable: true, + get: function() { + return _nil.default; + } + }); + Object.defineProperty(exports2, "version", { + enumerable: true, + get: function() { + return _version.default; + } + }); + Object.defineProperty(exports2, "validate", { + enumerable: true, + get: function() { + return _validate.default; + } + }); + Object.defineProperty(exports2, "stringify", { + enumerable: true, + get: function() { + return _stringify.default; + } + }); + Object.defineProperty(exports2, "parse", { + enumerable: true, + get: function() { + return _parse.default; + } + }); + var _v = _interopRequireDefault(require_v1()); + var _v2 = _interopRequireDefault(require_v3()); + var _v3 = _interopRequireDefault(require_v4()); + var _v4 = _interopRequireDefault(require_v5()); + var _nil = _interopRequireDefault(require_nil()); + var _version = _interopRequireDefault(require_version5()); + var _validate = _interopRequireDefault(require_validate()); + var _stringify = _interopRequireDefault(require_stringify2()); + var _parse = _interopRequireDefault(require_parse4()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } +}); + +// node_modules/probot/lib/server/logging-middleware.js +var require_logging_middleware = __commonJS((exports2) => { + "use strict"; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : {default: mod}; + }; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.getLoggingMiddleware = void 0; + var pino_http_1 = __importDefault(require_logger2()); + var uuid_1 = require_dist9(); + function getLoggingMiddleware(logger) { + return pino_http_1.default({ + logger: logger.child({name: "http"}), + customSuccessMessage(res) { + const responseTime = Date.now() - res[pino_http_1.default.startTime]; + return `${res.req.method} ${res.req.url} ${res.statusCode} - ${responseTime}ms`; + }, + customErrorMessage(err, res) { + const responseTime = Date.now() - res[pino_http_1.default.startTime]; + return `${res.req.method} ${res.req.url} ${res.statusCode} - ${responseTime}ms`; + }, + genReqId: (req) => req.headers["x-request-id"] || req.headers["x-github-delivery"] || uuid_1.v4() + }); + } + exports2.getLoggingMiddleware = getLoggingMiddleware; +}); + +// node_modules/validator/lib/util/assertString.js +var require_assertString = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = assertString; + function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function _typeof2(obj2) { + return typeof obj2; + }; + } else { + _typeof = function _typeof2(obj2) { + return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; + }; + } + return _typeof(obj); + } + function assertString(input) { + var isString = typeof input === "string" || input instanceof String; + if (!isString) { + var invalidType; + if (input === null) { + invalidType = "null"; + } else { + invalidType = _typeof(input); + if (invalidType === "object" && input.constructor && input.constructor.hasOwnProperty("name")) { + invalidType = input.constructor.name; + } else { + invalidType = "a ".concat(invalidType); + } + } + throw new TypeError("Expected string but received ".concat(invalidType, ".")); + } + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/toDate.js +var require_toDate = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = toDate; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function toDate(date) { + (0, _assertString.default)(date); + date = Date.parse(date); + return !isNaN(date) ? new Date(date) : null; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/toFloat.js +var require_toFloat = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = toFloat; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function toFloat(str) { + (0, _assertString.default)(str); + return parseFloat(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/toInt.js +var require_toInt = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = toInt; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function toInt(str, radix) { + (0, _assertString.default)(str); + return parseInt(str, radix || 10); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/toBoolean.js +var require_toBoolean = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = toBoolean; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function toBoolean(str, strict) { + (0, _assertString.default)(str); + if (strict) { + return str === "1" || str === "true"; + } + return str !== "0" && str !== "false" && str !== ""; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/equals.js +var require_equals = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = equals; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function equals(str, comparison) { + (0, _assertString.default)(str); + return str === comparison; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/util/toString.js +var require_toString = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = toString; + function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function _typeof2(obj2) { + return typeof obj2; + }; + } else { + _typeof = function _typeof2(obj2) { + return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; + }; + } + return _typeof(obj); + } + function toString(input) { + if (_typeof(input) === "object" && input !== null) { + if (typeof input.toString === "function") { + input = input.toString(); + } else { + input = "[object Object]"; + } + } else if (input === null || typeof input === "undefined" || isNaN(input) && !input.length) { + input = ""; + } + return String(input); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/contains.js +var require_contains = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = contains; + var _assertString = _interopRequireDefault(require_assertString()); + var _toString = _interopRequireDefault(require_toString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function contains(str, elem) { + (0, _assertString.default)(str); + return str.indexOf((0, _toString.default)(elem)) >= 0; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/matches.js +var require_matches = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = matches; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function matches(str, pattern, modifiers) { + (0, _assertString.default)(str); + if (Object.prototype.toString.call(pattern) !== "[object RegExp]") { + pattern = new RegExp(pattern, modifiers); + } + return pattern.test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/util/merge.js +var require_merge2 = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = merge; + function merge() { + var obj = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + var defaults = arguments.length > 1 ? arguments[1] : void 0; + for (var key in defaults) { + if (typeof obj[key] === "undefined") { + obj[key] = defaults[key]; + } + } + return obj; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isByteLength.js +var require_isByteLength = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isByteLength; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function _typeof2(obj2) { + return typeof obj2; + }; + } else { + _typeof = function _typeof2(obj2) { + return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; + }; + } + return _typeof(obj); + } + function isByteLength(str, options) { + (0, _assertString.default)(str); + var min; + var max; + if (_typeof(options) === "object") { + min = options.min || 0; + max = options.max; + } else { + min = arguments[1]; + max = arguments[2]; + } + var len = encodeURI(str).split(/%..|./).length - 1; + return len >= min && (typeof max === "undefined" || len <= max); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isFQDN.js +var require_isFQDN = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isFQDN; + var _assertString = _interopRequireDefault(require_assertString()); + var _merge = _interopRequireDefault(require_merge2()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var default_fqdn_options = { + require_tld: true, + allow_underscores: false, + allow_trailing_dot: false + }; + function isFQDN(str, options) { + (0, _assertString.default)(str); + options = (0, _merge.default)(options, default_fqdn_options); + if (options.allow_trailing_dot && str[str.length - 1] === ".") { + str = str.substring(0, str.length - 1); + } + var parts = str.split("."); + for (var i = 0; i < parts.length; i++) { + if (parts[i].length > 63) { + return false; + } + } + if (options.require_tld) { + var tld = parts.pop(); + if (!parts.length || !/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) { + return false; + } + if (/[\s\u2002-\u200B\u202F\u205F\u3000\uFEFF\uDB40\uDC20]/.test(tld)) { + return false; + } + } + for (var part, _i = 0; _i < parts.length; _i++) { + part = parts[_i]; + if (options.allow_underscores) { + part = part.replace(/_/g, ""); + } + if (!/^[a-z\u00a1-\uffff0-9-]+$/i.test(part)) { + return false; + } + if (/[\uff01-\uff5e]/.test(part)) { + return false; + } + if (part[0] === "-" || part[part.length - 1] === "-") { + return false; + } + } + return true; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isIP.js +var require_isIP = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isIP; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var ipv4Maybe = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/; + var ipv6Block = /^[0-9A-F]{1,4}$/i; + function isIP(str) { + var version = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""; + (0, _assertString.default)(str); + version = String(version); + if (!version) { + return isIP(str, 4) || isIP(str, 6); + } else if (version === "4") { + if (!ipv4Maybe.test(str)) { + return false; + } + var parts = str.split(".").sort(function(a, b) { + return a - b; + }); + return parts[3] <= 255; + } else if (version === "6") { + var blocks = str.split(":"); + var foundOmissionBlock = false; + var foundIPv4TransitionBlock = isIP(blocks[blocks.length - 1], 4); + var expectedNumberOfBlocks = foundIPv4TransitionBlock ? 7 : 8; + if (blocks.length > expectedNumberOfBlocks) { + return false; + } + if (str === "::") { + return true; + } else if (str.substr(0, 2) === "::") { + blocks.shift(); + blocks.shift(); + foundOmissionBlock = true; + } else if (str.substr(str.length - 2) === "::") { + blocks.pop(); + blocks.pop(); + foundOmissionBlock = true; + } + for (var i = 0; i < blocks.length; ++i) { + if (blocks[i] === "" && i > 0 && i < blocks.length - 1) { + if (foundOmissionBlock) { + return false; + } + foundOmissionBlock = true; + } else if (foundIPv4TransitionBlock && i === blocks.length - 1) { + } else if (!ipv6Block.test(blocks[i])) { + return false; + } + } + if (foundOmissionBlock) { + return blocks.length >= 1; + } + return blocks.length === expectedNumberOfBlocks; + } + return false; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isEmail.js +var require_isEmail = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isEmail; + var _assertString = _interopRequireDefault(require_assertString()); + var _merge = _interopRequireDefault(require_merge2()); + var _isByteLength = _interopRequireDefault(require_isByteLength()); + var _isFQDN = _interopRequireDefault(require_isFQDN()); + var _isIP = _interopRequireDefault(require_isIP()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var default_email_options = { + allow_display_name: false, + require_display_name: false, + allow_utf8_local_part: true, + require_tld: true + }; + var displayName = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\,\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\s]*<(.+)>$/i; + var emailUserPart = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i; + var gmailUserPart = /^[a-z\d]+$/; + var quotedEmailUser = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i; + var emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i; + var quotedEmailUserUtf8 = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i; + function isEmail(str, options) { + (0, _assertString.default)(str); + options = (0, _merge.default)(options, default_email_options); + if (options.require_display_name || options.allow_display_name) { + var display_email = str.match(displayName); + if (display_email) { + str = display_email[1]; + } else if (options.require_display_name) { + return false; + } + } + var parts = str.split("@"); + var domain = parts.pop(); + var user = parts.join("@"); + var lower_domain = domain.toLowerCase(); + if (options.domain_specific_validation && (lower_domain === "gmail.com" || lower_domain === "googlemail.com")) { + user = user.toLowerCase(); + var username = user.split("+")[0]; + if (!(0, _isByteLength.default)(username.replace(".", ""), { + min: 6, + max: 30 + })) { + return false; + } + var _user_parts = username.split("."); + for (var i = 0; i < _user_parts.length; i++) { + if (!gmailUserPart.test(_user_parts[i])) { + return false; + } + } + } + if (!(0, _isByteLength.default)(user, { + max: 64 + }) || !(0, _isByteLength.default)(domain, { + max: 254 + })) { + return false; + } + if (!(0, _isFQDN.default)(domain, { + require_tld: options.require_tld + })) { + if (!options.allow_ip_domain) { + return false; + } + if (!(0, _isIP.default)(domain)) { + if (!domain.startsWith("[") || !domain.endsWith("]")) { + return false; + } + var noBracketdomain = domain.substr(1, domain.length - 2); + if (noBracketdomain.length === 0 || !(0, _isIP.default)(noBracketdomain)) { + return false; + } + } + } + if (user[0] === '"') { + user = user.slice(1, user.length - 1); + return options.allow_utf8_local_part ? quotedEmailUserUtf8.test(user) : quotedEmailUser.test(user); + } + var pattern = options.allow_utf8_local_part ? emailUserUtf8Part : emailUserPart; + var user_parts = user.split("."); + for (var _i = 0; _i < user_parts.length; _i++) { + if (!pattern.test(user_parts[_i])) { + return false; + } + } + return true; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isURL.js +var require_isURL = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isURL; + var _assertString = _interopRequireDefault(require_assertString()); + var _isFQDN = _interopRequireDefault(require_isFQDN()); + var _isIP = _interopRequireDefault(require_isIP()); + var _merge = _interopRequireDefault(require_merge2()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var default_url_options = { + protocols: ["http", "https", "ftp"], + require_tld: true, + require_protocol: false, + require_host: true, + require_valid_protocol: true, + allow_underscores: false, + allow_trailing_dot: false, + allow_protocol_relative_urls: false + }; + var wrapped_ipv6 = /^\[([^\]]+)\](?::([0-9]+))?$/; + function isRegExp(obj) { + return Object.prototype.toString.call(obj) === "[object RegExp]"; + } + function checkHost(host, matches) { + for (var i = 0; i < matches.length; i++) { + var match = matches[i]; + if (host === match || isRegExp(match) && match.test(host)) { + return true; + } + } + return false; + } + function isURL(url, options) { + (0, _assertString.default)(url); + if (!url || url.length >= 2083 || /[\s<>]/.test(url)) { + return false; + } + if (url.indexOf("mailto:") === 0) { + return false; + } + options = (0, _merge.default)(options, default_url_options); + var protocol, auth, host, hostname, port, port_str, split, ipv6; + split = url.split("#"); + url = split.shift(); + split = url.split("?"); + url = split.shift(); + split = url.split("://"); + if (split.length > 1) { + protocol = split.shift().toLowerCase(); + if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) { + return false; + } + } else if (options.require_protocol) { + return false; + } else if (url.substr(0, 2) === "//") { + if (!options.allow_protocol_relative_urls) { + return false; + } + split[0] = url.substr(2); + } + url = split.join("://"); + if (url === "") { + return false; + } + split = url.split("/"); + url = split.shift(); + if (url === "" && !options.require_host) { + return true; + } + split = url.split("@"); + if (split.length > 1) { + if (options.disallow_auth) { + return false; + } + auth = split.shift(); + if (auth.indexOf(":") >= 0 && auth.split(":").length > 2) { + return false; + } + } + hostname = split.join("@"); + port_str = null; + ipv6 = null; + var ipv6_match = hostname.match(wrapped_ipv6); + if (ipv6_match) { + host = ""; + ipv6 = ipv6_match[1]; + port_str = ipv6_match[2] || null; + } else { + split = hostname.split(":"); + host = split.shift(); + if (split.length) { + port_str = split.join(":"); + } + } + if (port_str !== null) { + port = parseInt(port_str, 10); + if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) { + return false; + } + } + if (!(0, _isIP.default)(host) && !(0, _isFQDN.default)(host, options) && (!ipv6 || !(0, _isIP.default)(ipv6, 6))) { + return false; + } + host = host || ipv6; + if (options.host_whitelist && !checkHost(host, options.host_whitelist)) { + return false; + } + if (options.host_blacklist && checkHost(host, options.host_blacklist)) { + return false; + } + return true; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isMACAddress.js +var require_isMACAddress = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isMACAddress; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/; + var macAddressNoColons = /^([0-9a-fA-F]){12}$/; + function isMACAddress(str, options) { + (0, _assertString.default)(str); + if (options && options.no_colons) { + return macAddressNoColons.test(str); + } + return macAddress.test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isIPRange.js +var require_isIPRange = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isIPRange; + var _assertString = _interopRequireDefault(require_assertString()); + var _isIP = _interopRequireDefault(require_isIP()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var subnetMaybe = /^\d{1,2}$/; + function isIPRange(str) { + (0, _assertString.default)(str); + var parts = str.split("/"); + if (parts.length !== 2) { + return false; + } + if (!subnetMaybe.test(parts[1])) { + return false; + } + if (parts[1].length > 1 && parts[1].startsWith("0")) { + return false; + } + return (0, _isIP.default)(parts[0], 4) && parts[1] <= 32 && parts[1] >= 0; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isBoolean.js +var require_isBoolean = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isBoolean; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function isBoolean(str) { + (0, _assertString.default)(str); + return ["true", "false", "1", "0"].indexOf(str) >= 0; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/alpha.js +var require_alpha = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.commaDecimal = exports2.dotDecimal = exports2.arabicLocales = exports2.englishLocales = exports2.decimal = exports2.alphanumeric = exports2.alpha = void 0; + var alpha = { + "en-US": /^[A-Z]+$/i, + "bg-BG": /^[А-Я]+$/i, + "cs-CZ": /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i, + "da-DK": /^[A-ZÆØÅ]+$/i, + "de-DE": /^[A-ZÄÖÜß]+$/i, + "el-GR": /^[Α-ω]+$/i, + "es-ES": /^[A-ZÁÉÍÑÓÚÜ]+$/i, + "fr-FR": /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i, + "it-IT": /^[A-ZÀÉÈÌÎÓÒÙ]+$/i, + "nb-NO": /^[A-ZÆØÅ]+$/i, + "nl-NL": /^[A-ZÁÉËÏÓÖÜÚ]+$/i, + "nn-NO": /^[A-ZÆØÅ]+$/i, + "hu-HU": /^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i, + "pl-PL": /^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i, + "pt-PT": /^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i, + "ru-RU": /^[А-ЯЁ]+$/i, + "sl-SI": /^[A-ZČĆĐŠŽ]+$/i, + "sk-SK": /^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i, + "sr-RS@latin": /^[A-ZČĆŽŠĐ]+$/i, + "sr-RS": /^[А-ЯЂЈЉЊЋЏ]+$/i, + "sv-SE": /^[A-ZÅÄÖ]+$/i, + "tr-TR": /^[A-ZÇĞİıÖŞÜ]+$/i, + "uk-UA": /^[А-ЩЬЮЯЄIЇҐі]+$/i, + "ku-IQ": /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i, + ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/ + }; + exports2.alpha = alpha; + var alphanumeric = { + "en-US": /^[0-9A-Z]+$/i, + "bg-BG": /^[0-9А-Я]+$/i, + "cs-CZ": /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i, + "da-DK": /^[0-9A-ZÆØÅ]+$/i, + "de-DE": /^[0-9A-ZÄÖÜß]+$/i, + "el-GR": /^[0-9Α-ω]+$/i, + "es-ES": /^[0-9A-ZÁÉÍÑÓÚÜ]+$/i, + "fr-FR": /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i, + "it-IT": /^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i, + "hu-HU": /^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i, + "nb-NO": /^[0-9A-ZÆØÅ]+$/i, + "nl-NL": /^[0-9A-ZÁÉËÏÓÖÜÚ]+$/i, + "nn-NO": /^[0-9A-ZÆØÅ]+$/i, + "pl-PL": /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i, + "pt-PT": /^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i, + "ru-RU": /^[0-9А-ЯЁ]+$/i, + "sl-SI": /^[0-9A-ZČĆĐŠŽ]+$/i, + "sk-SK": /^[0-9A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i, + "sr-RS@latin": /^[0-9A-ZČĆŽŠĐ]+$/i, + "sr-RS": /^[0-9А-ЯЂЈЉЊЋЏ]+$/i, + "sv-SE": /^[0-9A-ZÅÄÖ]+$/i, + "tr-TR": /^[0-9A-ZÇĞİıÖŞÜ]+$/i, + "uk-UA": /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i, + "ku-IQ": /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i, + ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/ + }; + exports2.alphanumeric = alphanumeric; + var decimal = { + "en-US": ".", + ar: "\u066B" + }; + exports2.decimal = decimal; + var englishLocales = ["AU", "GB", "HK", "IN", "NZ", "ZA", "ZM"]; + exports2.englishLocales = englishLocales; + for (var locale, i = 0; i < englishLocales.length; i++) { + locale = "en-".concat(englishLocales[i]); + alpha[locale] = alpha["en-US"]; + alphanumeric[locale] = alphanumeric["en-US"]; + decimal[locale] = decimal["en-US"]; + } + var arabicLocales = ["AE", "BH", "DZ", "EG", "IQ", "JO", "KW", "LB", "LY", "MA", "QM", "QA", "SA", "SD", "SY", "TN", "YE"]; + exports2.arabicLocales = arabicLocales; + for (var _locale, _i = 0; _i < arabicLocales.length; _i++) { + _locale = "ar-".concat(arabicLocales[_i]); + alpha[_locale] = alpha.ar; + alphanumeric[_locale] = alphanumeric.ar; + decimal[_locale] = decimal.ar; + } + var dotDecimal = []; + exports2.dotDecimal = dotDecimal; + var commaDecimal = ["bg-BG", "cs-CZ", "da-DK", "de-DE", "el-GR", "es-ES", "fr-FR", "it-IT", "ku-IQ", "hu-HU", "nb-NO", "nn-NO", "nl-NL", "pl-PL", "pt-PT", "ru-RU", "sl-SI", "sr-RS@latin", "sr-RS", "sv-SE", "tr-TR", "uk-UA"]; + exports2.commaDecimal = commaDecimal; + for (var _i2 = 0; _i2 < dotDecimal.length; _i2++) { + decimal[dotDecimal[_i2]] = decimal["en-US"]; + } + for (var _i3 = 0; _i3 < commaDecimal.length; _i3++) { + decimal[commaDecimal[_i3]] = ","; + } + alpha["pt-BR"] = alpha["pt-PT"]; + alphanumeric["pt-BR"] = alphanumeric["pt-PT"]; + decimal["pt-BR"] = decimal["pt-PT"]; + alpha["pl-Pl"] = alpha["pl-PL"]; + alphanumeric["pl-Pl"] = alphanumeric["pl-PL"]; + decimal["pl-Pl"] = decimal["pl-PL"]; +}); + +// node_modules/validator/lib/isAlpha.js +var require_isAlpha = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isAlpha; + exports2.locales = void 0; + var _assertString = _interopRequireDefault(require_assertString()); + var _alpha = require_alpha(); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function isAlpha(str) { + var locale = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "en-US"; + (0, _assertString.default)(str); + if (locale in _alpha.alpha) { + return _alpha.alpha[locale].test(str); + } + throw new Error("Invalid locale '".concat(locale, "'")); + } + var locales = Object.keys(_alpha.alpha); + exports2.locales = locales; +}); + +// node_modules/validator/lib/isAlphanumeric.js +var require_isAlphanumeric = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isAlphanumeric; + exports2.locales = void 0; + var _assertString = _interopRequireDefault(require_assertString()); + var _alpha = require_alpha(); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function isAlphanumeric(str) { + var locale = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "en-US"; + (0, _assertString.default)(str); + if (locale in _alpha.alphanumeric) { + return _alpha.alphanumeric[locale].test(str); + } + throw new Error("Invalid locale '".concat(locale, "'")); + } + var locales = Object.keys(_alpha.alphanumeric); + exports2.locales = locales; +}); + +// node_modules/validator/lib/isNumeric.js +var require_isNumeric = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isNumeric; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var numeric = /^[+-]?([0-9]*[.])?[0-9]+$/; + var numericNoSymbols = /^[0-9]+$/; + function isNumeric(str, options) { + (0, _assertString.default)(str); + if (options && options.no_symbols) { + return numericNoSymbols.test(str); + } + return numeric.test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isInt.js +var require_isInt = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isInt; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var int = /^(?:[-+]?(?:0|[1-9][0-9]*))$/; + var intLeadingZeroes = /^[-+]?[0-9]+$/; + function isInt(str, options) { + (0, _assertString.default)(str); + options = options || {}; + var regex = options.hasOwnProperty("allow_leading_zeroes") && !options.allow_leading_zeroes ? int : intLeadingZeroes; + var minCheckPassed = !options.hasOwnProperty("min") || str >= options.min; + var maxCheckPassed = !options.hasOwnProperty("max") || str <= options.max; + var ltCheckPassed = !options.hasOwnProperty("lt") || str < options.lt; + var gtCheckPassed = !options.hasOwnProperty("gt") || str > options.gt; + return regex.test(str) && minCheckPassed && maxCheckPassed && ltCheckPassed && gtCheckPassed; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isPort.js +var require_isPort = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isPort; + var _isInt = _interopRequireDefault(require_isInt()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function isPort(str) { + return (0, _isInt.default)(str, { + min: 0, + max: 65535 + }); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isLowercase.js +var require_isLowercase = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isLowercase; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function isLowercase(str) { + (0, _assertString.default)(str); + return str === str.toLowerCase(); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isUppercase.js +var require_isUppercase = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isUppercase; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function isUppercase(str) { + (0, _assertString.default)(str); + return str === str.toUpperCase(); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isAscii.js +var require_isAscii = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isAscii; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var ascii = /^[\x00-\x7F]+$/; + function isAscii(str) { + (0, _assertString.default)(str); + return ascii.test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isFullWidth.js +var require_isFullWidth = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isFullWidth; + exports2.fullWidth = void 0; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var fullWidth = /[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/; + exports2.fullWidth = fullWidth; + function isFullWidth(str) { + (0, _assertString.default)(str); + return fullWidth.test(str); + } +}); + +// node_modules/validator/lib/isHalfWidth.js +var require_isHalfWidth = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isHalfWidth; + exports2.halfWidth = void 0; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var halfWidth = /[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/; + exports2.halfWidth = halfWidth; + function isHalfWidth(str) { + (0, _assertString.default)(str); + return halfWidth.test(str); + } +}); + +// node_modules/validator/lib/isVariableWidth.js +var require_isVariableWidth = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isVariableWidth; + var _assertString = _interopRequireDefault(require_assertString()); + var _isFullWidth = require_isFullWidth(); + var _isHalfWidth = require_isHalfWidth(); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function isVariableWidth(str) { + (0, _assertString.default)(str); + return _isFullWidth.fullWidth.test(str) && _isHalfWidth.halfWidth.test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isMultibyte.js +var require_isMultibyte = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isMultibyte; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var multibyte = /[^\x00-\x7F]/; + function isMultibyte(str) { + (0, _assertString.default)(str); + return multibyte.test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isSurrogatePair.js +var require_isSurrogatePair = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isSurrogatePair; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var surrogatePair = /[\uD800-\uDBFF][\uDC00-\uDFFF]/; + function isSurrogatePair(str) { + (0, _assertString.default)(str); + return surrogatePair.test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isFloat.js +var require_isFloat = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isFloat; + exports2.locales = void 0; + var _assertString = _interopRequireDefault(require_assertString()); + var _alpha = require_alpha(); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function isFloat(str, options) { + (0, _assertString.default)(str); + options = options || {}; + var float = new RegExp("^(?:[-+])?(?:[0-9]+)?(?:\\".concat(options.locale ? _alpha.decimal[options.locale] : ".", "[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$")); + if (str === "" || str === "." || str === "-" || str === "+") { + return false; + } + var value = parseFloat(str.replace(",", ".")); + return float.test(str) && (!options.hasOwnProperty("min") || value >= options.min) && (!options.hasOwnProperty("max") || value <= options.max) && (!options.hasOwnProperty("lt") || value < options.lt) && (!options.hasOwnProperty("gt") || value > options.gt); + } + var locales = Object.keys(_alpha.decimal); + exports2.locales = locales; +}); + +// node_modules/validator/lib/util/includes.js +var require_includes = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var includes = function includes2(arr, val) { + return arr.some(function(arrVal) { + return val === arrVal; + }); + }; + var _default = includes; + exports2.default = _default; + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isDecimal.js +var require_isDecimal = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isDecimal; + var _merge = _interopRequireDefault(require_merge2()); + var _assertString = _interopRequireDefault(require_assertString()); + var _includes = _interopRequireDefault(require_includes()); + var _alpha = require_alpha(); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function decimalRegExp(options) { + var regExp = new RegExp("^[-+]?([0-9]+)?(\\".concat(_alpha.decimal[options.locale], "[0-9]{").concat(options.decimal_digits, "})").concat(options.force_decimal ? "" : "?", "$")); + return regExp; + } + var default_decimal_options = { + force_decimal: false, + decimal_digits: "1,", + locale: "en-US" + }; + var blacklist = ["", "-", "+"]; + function isDecimal(str, options) { + (0, _assertString.default)(str); + options = (0, _merge.default)(options, default_decimal_options); + if (options.locale in _alpha.decimal) { + return !(0, _includes.default)(blacklist, str.replace(/ /g, "")) && decimalRegExp(options).test(str); + } + throw new Error("Invalid locale '".concat(options.locale, "'")); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isHexadecimal.js +var require_isHexadecimal = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isHexadecimal; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var hexadecimal = /^[0-9A-F]+$/i; + function isHexadecimal(str) { + (0, _assertString.default)(str); + return hexadecimal.test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isDivisibleBy.js +var require_isDivisibleBy = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isDivisibleBy; + var _assertString = _interopRequireDefault(require_assertString()); + var _toFloat = _interopRequireDefault(require_toFloat()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function isDivisibleBy(str, num) { + (0, _assertString.default)(str); + return (0, _toFloat.default)(str) % parseInt(num, 10) === 0; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isHexColor.js +var require_isHexColor = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isHexColor; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var hexcolor = /^#?([0-9A-F]{3}|[0-9A-F]{6})$/i; + function isHexColor(str) { + (0, _assertString.default)(str); + return hexcolor.test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isISRC.js +var require_isISRC = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isISRC; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var isrc = /^[A-Z]{2}[0-9A-Z]{3}\d{2}\d{5}$/; + function isISRC(str) { + (0, _assertString.default)(str); + return isrc.test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isMD5.js +var require_isMD5 = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isMD5; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var md5 = /^[a-f0-9]{32}$/; + function isMD5(str) { + (0, _assertString.default)(str); + return md5.test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isHash.js +var require_isHash = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isHash; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var lengths = { + md5: 32, + md4: 32, + sha1: 40, + sha256: 64, + sha384: 96, + sha512: 128, + ripemd128: 32, + ripemd160: 40, + tiger128: 32, + tiger160: 40, + tiger192: 48, + crc32: 8, + crc32b: 8 + }; + function isHash(str, algorithm) { + (0, _assertString.default)(str); + var hash = new RegExp("^[a-f0-9]{".concat(lengths[algorithm], "}$")); + return hash.test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isJWT.js +var require_isJWT = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isJWT; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var jwt = /^([A-Za-z0-9\-_~+\/]+[=]{0,2})\.([A-Za-z0-9\-_~+\/]+[=]{0,2})(?:\.([A-Za-z0-9\-_~+\/]+[=]{0,2}))?$/; + function isJWT(str) { + (0, _assertString.default)(str); + return jwt.test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isJSON.js +var require_isJSON = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isJSON; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function _typeof2(obj2) { + return typeof obj2; + }; + } else { + _typeof = function _typeof2(obj2) { + return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; + }; + } + return _typeof(obj); + } + function isJSON(str) { + (0, _assertString.default)(str); + try { + var obj = JSON.parse(str); + return !!obj && _typeof(obj) === "object"; + } catch (e) { + } + return false; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isEmpty.js +var require_isEmpty = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isEmpty; + var _assertString = _interopRequireDefault(require_assertString()); + var _merge = _interopRequireDefault(require_merge2()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var default_is_empty_options = { + ignore_whitespace: false + }; + function isEmpty(str, options) { + (0, _assertString.default)(str); + options = (0, _merge.default)(options, default_is_empty_options); + return (options.ignore_whitespace ? str.trim().length : str.length) === 0; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isLength.js +var require_isLength = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isLength; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function _typeof2(obj2) { + return typeof obj2; + }; + } else { + _typeof = function _typeof2(obj2) { + return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; + }; + } + return _typeof(obj); + } + function isLength(str, options) { + (0, _assertString.default)(str); + var min; + var max; + if (_typeof(options) === "object") { + min = options.min || 0; + max = options.max; + } else { + min = arguments[1]; + max = arguments[2]; + } + var surrogatePairs = str.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g) || []; + var len = str.length - surrogatePairs.length; + return len >= min && (typeof max === "undefined" || len <= max); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isUUID.js +var require_isUUID = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isUUID; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var uuid = { + 3: /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i, + 4: /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, + 5: /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, + all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i + }; + function isUUID(str) { + var version = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "all"; + (0, _assertString.default)(str); + var pattern = uuid[version]; + return pattern && pattern.test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isMongoId.js +var require_isMongoId = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isMongoId; + var _assertString = _interopRequireDefault(require_assertString()); + var _isHexadecimal = _interopRequireDefault(require_isHexadecimal()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function isMongoId(str) { + (0, _assertString.default)(str); + return (0, _isHexadecimal.default)(str) && str.length === 24; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isAfter.js +var require_isAfter = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isAfter; + var _assertString = _interopRequireDefault(require_assertString()); + var _toDate = _interopRequireDefault(require_toDate()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function isAfter(str) { + var date = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : String(new Date()); + (0, _assertString.default)(str); + var comparison = (0, _toDate.default)(date); + var original = (0, _toDate.default)(str); + return !!(original && comparison && original > comparison); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isBefore.js +var require_isBefore = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isBefore; + var _assertString = _interopRequireDefault(require_assertString()); + var _toDate = _interopRequireDefault(require_toDate()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function isBefore(str) { + var date = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : String(new Date()); + (0, _assertString.default)(str); + var comparison = (0, _toDate.default)(date); + var original = (0, _toDate.default)(str); + return !!(original && comparison && original < comparison); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isIn.js +var require_isIn = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isIn; + var _assertString = _interopRequireDefault(require_assertString()); + var _toString = _interopRequireDefault(require_toString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function _typeof(obj) { + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function _typeof2(obj2) { + return typeof obj2; + }; + } else { + _typeof = function _typeof2(obj2) { + return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; + }; + } + return _typeof(obj); + } + function isIn(str, options) { + (0, _assertString.default)(str); + var i; + if (Object.prototype.toString.call(options) === "[object Array]") { + var array = []; + for (i in options) { + if ({}.hasOwnProperty.call(options, i)) { + array[i] = (0, _toString.default)(options[i]); + } + } + return array.indexOf(str) >= 0; + } else if (_typeof(options) === "object") { + return options.hasOwnProperty(str); + } else if (options && typeof options.indexOf === "function") { + return options.indexOf(str) >= 0; + } + return false; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isCreditCard.js +var require_isCreditCard = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isCreditCard; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14})$/; + function isCreditCard(str) { + (0, _assertString.default)(str); + var sanitized = str.replace(/[- ]+/g, ""); + if (!creditCard.test(sanitized)) { + return false; + } + var sum = 0; + var digit; + var tmpNum; + var shouldDouble; + for (var i = sanitized.length - 1; i >= 0; i--) { + digit = sanitized.substring(i, i + 1); + tmpNum = parseInt(digit, 10); + if (shouldDouble) { + tmpNum *= 2; + if (tmpNum >= 10) { + sum += tmpNum % 10 + 1; + } else { + sum += tmpNum; + } + } else { + sum += tmpNum; + } + shouldDouble = !shouldDouble; + } + return !!(sum % 10 === 0 ? sanitized : false); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isIdentityCard.js +var require_isIdentityCard = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isIdentityCard; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var validators = { + ES: function ES(str) { + (0, _assertString.default)(str); + var DNI = /^[0-9X-Z][0-9]{7}[TRWAGMYFPDXBNJZSQVHLCKE]$/; + var charsValue = { + X: 0, + Y: 1, + Z: 2 + }; + var controlDigits = ["T", "R", "W", "A", "G", "M", "Y", "F", "P", "D", "X", "B", "N", "J", "Z", "S", "Q", "V", "H", "L", "C", "K", "E"]; + var sanitized = str.trim().toUpperCase(); + if (!DNI.test(sanitized)) { + return false; + } + var number = sanitized.slice(0, -1).replace(/[X,Y,Z]/g, function(char) { + return charsValue[char]; + }); + return sanitized.endsWith(controlDigits[number % 23]); + } + }; + function isIdentityCard(str) { + var locale = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "any"; + (0, _assertString.default)(str); + if (locale in validators) { + return validators[locale](str); + } else if (locale === "any") { + for (var key in validators) { + if (validators.hasOwnProperty(key)) { + var validator = validators[key]; + if (validator(str)) { + return true; + } + } + } + return false; + } + throw new Error("Invalid locale '".concat(locale, "'")); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isISIN.js +var require_isISIN = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isISIN; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var isin = /^[A-Z]{2}[0-9A-Z]{9}[0-9]$/; + function isISIN(str) { + (0, _assertString.default)(str); + if (!isin.test(str)) { + return false; + } + var checksumStr = str.replace(/[A-Z]/g, function(character) { + return parseInt(character, 36); + }); + var sum = 0; + var digit; + var tmpNum; + var shouldDouble = true; + for (var i = checksumStr.length - 2; i >= 0; i--) { + digit = checksumStr.substring(i, i + 1); + tmpNum = parseInt(digit, 10); + if (shouldDouble) { + tmpNum *= 2; + if (tmpNum >= 10) { + sum += tmpNum + 1; + } else { + sum += tmpNum; + } + } else { + sum += tmpNum; + } + shouldDouble = !shouldDouble; + } + return parseInt(str.substr(str.length - 1), 10) === (1e4 - sum) % 10; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isISBN.js +var require_isISBN = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isISBN; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var isbn10Maybe = /^(?:[0-9]{9}X|[0-9]{10})$/; + var isbn13Maybe = /^(?:[0-9]{13})$/; + var factor = [1, 3]; + function isISBN(str) { + var version = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""; + (0, _assertString.default)(str); + version = String(version); + if (!version) { + return isISBN(str, 10) || isISBN(str, 13); + } + var sanitized = str.replace(/[\s-]+/g, ""); + var checksum = 0; + var i; + if (version === "10") { + if (!isbn10Maybe.test(sanitized)) { + return false; + } + for (i = 0; i < 9; i++) { + checksum += (i + 1) * sanitized.charAt(i); + } + if (sanitized.charAt(9) === "X") { + checksum += 10 * 10; + } else { + checksum += 10 * sanitized.charAt(9); + } + if (checksum % 11 === 0) { + return !!sanitized; + } + } else if (version === "13") { + if (!isbn13Maybe.test(sanitized)) { + return false; + } + for (i = 0; i < 12; i++) { + checksum += factor[i % 2] * sanitized.charAt(i); + } + if (sanitized.charAt(12) - (10 - checksum % 10) % 10 === 0) { + return !!sanitized; + } + } + return false; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isISSN.js +var require_isISSN = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isISSN; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var issn = "^\\d{4}-?\\d{3}[\\dX]$"; + function isISSN(str) { + var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + (0, _assertString.default)(str); + var testIssn = issn; + testIssn = options.require_hyphen ? testIssn.replace("?", "") : testIssn; + testIssn = options.case_sensitive ? new RegExp(testIssn) : new RegExp(testIssn, "i"); + if (!testIssn.test(str)) { + return false; + } + var digits = str.replace("-", "").toUpperCase(); + var checksum = 0; + for (var i = 0; i < digits.length; i++) { + var digit = digits[i]; + checksum += (digit === "X" ? 10 : +digit) * (8 - i); + } + return checksum % 11 === 0; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isMobilePhone.js +var require_isMobilePhone = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isMobilePhone; + exports2.locales = void 0; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var phones = { + "ar-AE": /^((\+?971)|0)?5[024568]\d{7}$/, + "ar-DZ": /^(\+?213|0)(5|6|7)\d{8}$/, + "ar-EG": /^((\+?20)|0)?1[012]\d{8}$/, + "ar-IQ": /^(\+?964|0)?7[0-9]\d{8}$/, + "ar-JO": /^(\+?962|0)?7[789]\d{7}$/, + "ar-KW": /^(\+?965)[569]\d{7}$/, + "ar-SA": /^(!?(\+?966)|0)?5\d{8}$/, + "ar-SY": /^(!?(\+?963)|0)?9\d{8}$/, + "ar-TN": /^(\+?216)?[2459]\d{7}$/, + "be-BY": /^(\+?375)?(24|25|29|33|44)\d{7}$/, + "bg-BG": /^(\+?359|0)?8[789]\d{7}$/, + "bn-BD": /\+?(88)?0?1[356789][0-9]{8}\b/, + "cs-CZ": /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/, + "da-DK": /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/, + "de-DE": /^(\+49)?0?1(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/, + "el-GR": /^(\+?30|0)?(69\d{8})$/, + "en-AU": /^(\+?61|0)4\d{8}$/, + "en-GB": /^(\+?44|0)7\d{9}$/, + "en-GH": /^(\+233|0)(20|50|24|54|27|57|26|56|23|28)\d{7}$/, + "en-HK": /^(\+?852\-?)?[456789]\d{3}\-?\d{4}$/, + "en-IE": /^(\+?353|0)8[356789]\d{7}$/, + "en-IN": /^(\+?91|0)?[6789]\d{9}$/, + "en-KE": /^(\+?254|0)?[7]\d{8}$/, + "en-MU": /^(\+?230|0)?\d{8}$/, + "en-NG": /^(\+?234|0)?[789]\d{9}$/, + "en-NZ": /^(\+?64|0)[28]\d{7,9}$/, + "en-PK": /^((\+92)|(0092))-{0,1}\d{3}-{0,1}\d{7}$|^\d{11}$|^\d{4}-\d{7}$/, + "en-RW": /^(\+?250|0)?[7]\d{8}$/, + "en-SG": /^(\+65)?[89]\d{7}$/, + "en-TZ": /^(\+?255|0)?[67]\d{8}$/, + "en-UG": /^(\+?256|0)?[7]\d{8}$/, + "en-US": /^((\+1|1)?( |-)?)?(\([2-9][0-9]{2}\)|[2-9][0-9]{2})( |-)?([2-9][0-9]{2}( |-)?[0-9]{4})$/, + "en-ZA": /^(\+?27|0)\d{9}$/, + "en-ZM": /^(\+?26)?09[567]\d{7}$/, + "es-ES": /^(\+?34)?(6\d{1}|7[1234])\d{7}$/, + "es-MX": /^(\+?52)?(1|01)?\d{10,11}$/, + "es-UY": /^(\+598|0)9[1-9][\d]{6}$/, + "et-EE": /^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/, + "fa-IR": /^(\+?98[\-\s]?|0)9[0-39]\d[\-\s]?\d{3}[\-\s]?\d{4}$/, + "fi-FI": /^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/, + "fo-FO": /^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/, + "fr-FR": /^(\+?33|0)[67]\d{8}$/, + "he-IL": /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/, + "hu-HU": /^(\+?36)(20|30|70)\d{7}$/, + "id-ID": /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/, + "it-IT": /^(\+?39)?\s?3\d{2} ?\d{6,7}$/, + "ja-JP": /^(\+?81|0)[789]0[ \-]?[1-9]\d{2}[ \-]?\d{5}$/, + "kk-KZ": /^(\+?7|8)?7\d{9}$/, + "kl-GL": /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/, + "ko-KR": /^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/, + "lt-LT": /^(\+370|8)\d{8}$/, + "ms-MY": /^(\+?6?01){1}(([0145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/, + "nb-NO": /^(\+?47)?[49]\d{7}$/, + "nl-BE": /^(\+?32|0)4?\d{8}$/, + "nn-NO": /^(\+?47)?[49]\d{7}$/, + "pl-PL": /^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/, + "pt-BR": /(?=^(\+?5{2}\-?|0)[1-9]{2}\-?\d{4}\-?\d{4}$)(^(\+?5{2}\-?|0)[1-9]{2}\-?[6-9]{1}\d{3}\-?\d{4}$)|(^(\+?5{2}\-?|0)[1-9]{2}\-?9[6-9]{1}\d{3}\-?\d{4}$)/, + "pt-PT": /^(\+?351)?9[1236]\d{7}$/, + "ro-RO": /^(\+?4?0)\s?7\d{2}(\/|\s|\.|\-)?\d{3}(\s|\.|\-)?\d{3}$/, + "ru-RU": /^(\+?7|8)?9\d{9}$/, + "sl-SI": /^(\+386\s?|0)(\d{1}\s?\d{3}\s?\d{2}\s?\d{2}|\d{2}\s?\d{3}\s?\d{3})$/, + "sk-SK": /^(\+?421)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/, + "sr-RS": /^(\+3816|06)[- \d]{5,9}$/, + "sv-SE": /^(\+?46|0)[\s\-]?7[\s\-]?[02369]([\s\-]?\d){7}$/, + "th-TH": /^(\+66|66|0)\d{9}$/, + "tr-TR": /^(\+?90|0)?5\d{9}$/, + "uk-UA": /^(\+?38|8)?0\d{9}$/, + "vi-VN": /^(\+?84|0)((3([2-9]))|(5([689]))|(7([0|6-9]))|(8([1-5]))|(9([0-9])))([0-9]{7})$/, + "zh-CN": /^((\+|00)86)?1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/, + "zh-TW": /^(\+?886\-?|0)?9\d{8}$/ + }; + phones["en-CA"] = phones["en-US"]; + phones["fr-BE"] = phones["nl-BE"]; + phones["zh-HK"] = phones["en-HK"]; + function isMobilePhone(str, locale, options) { + (0, _assertString.default)(str); + if (options && options.strictMode && !str.startsWith("+")) { + return false; + } + if (Array.isArray(locale)) { + return locale.some(function(key2) { + if (phones.hasOwnProperty(key2)) { + var phone2 = phones[key2]; + if (phone2.test(str)) { + return true; + } + } + return false; + }); + } else if (locale in phones) { + return phones[locale].test(str); + } else if (!locale || locale === "any") { + for (var key in phones) { + if (phones.hasOwnProperty(key)) { + var phone = phones[key]; + if (phone.test(str)) { + return true; + } + } + } + return false; + } + throw new Error("Invalid locale '".concat(locale, "'")); + } + var locales = Object.keys(phones); + exports2.locales = locales; +}); + +// node_modules/validator/lib/isCurrency.js +var require_isCurrency = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isCurrency; + var _merge = _interopRequireDefault(require_merge2()); + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function currencyRegex(options) { + var decimal_digits = "\\d{".concat(options.digits_after_decimal[0], "}"); + options.digits_after_decimal.forEach(function(digit, index) { + if (index !== 0) + decimal_digits = "".concat(decimal_digits, "|\\d{").concat(digit, "}"); + }); + var symbol = "(\\".concat(options.symbol.replace(/\./g, "\\."), ")").concat(options.require_symbol ? "" : "?"), negative = "-?", whole_dollar_amount_without_sep = "[1-9]\\d*", whole_dollar_amount_with_sep = "[1-9]\\d{0,2}(\\".concat(options.thousands_separator, "\\d{3})*"), valid_whole_dollar_amounts = ["0", whole_dollar_amount_without_sep, whole_dollar_amount_with_sep], whole_dollar_amount = "(".concat(valid_whole_dollar_amounts.join("|"), ")?"), decimal_amount = "(\\".concat(options.decimal_separator, "(").concat(decimal_digits, "))").concat(options.require_decimal ? "" : "?"); + var pattern = whole_dollar_amount + (options.allow_decimal || options.require_decimal ? decimal_amount : ""); + if (options.allow_negatives && !options.parens_for_negatives) { + if (options.negative_sign_after_digits) { + pattern += negative; + } else if (options.negative_sign_before_digits) { + pattern = negative + pattern; + } + } + if (options.allow_negative_sign_placeholder) { + pattern = "( (?!\\-))?".concat(pattern); + } else if (options.allow_space_after_symbol) { + pattern = " ?".concat(pattern); + } else if (options.allow_space_after_digits) { + pattern += "( (?!$))?"; + } + if (options.symbol_after_digits) { + pattern += symbol; + } else { + pattern = symbol + pattern; + } + if (options.allow_negatives) { + if (options.parens_for_negatives) { + pattern = "(\\(".concat(pattern, "\\)|").concat(pattern, ")"); + } else if (!(options.negative_sign_before_digits || options.negative_sign_after_digits)) { + pattern = negative + pattern; + } + } + return new RegExp("^(?!-? )(?=.*\\d)".concat(pattern, "$")); + } + var default_currency_options = { + symbol: "$", + require_symbol: false, + allow_space_after_symbol: false, + symbol_after_digits: false, + allow_negatives: true, + parens_for_negatives: false, + negative_sign_before_digits: false, + negative_sign_after_digits: false, + allow_negative_sign_placeholder: false, + thousands_separator: ",", + decimal_separator: ".", + allow_decimal: true, + require_decimal: false, + digits_after_decimal: [2], + allow_space_after_digits: false + }; + function isCurrency(str, options) { + (0, _assertString.default)(str); + options = (0, _merge.default)(options, default_currency_options); + return currencyRegex(options).test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isISO8601.js +var require_isISO8601 = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isISO8601; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var iso8601 = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; + var isValidDate = function isValidDate2(str) { + var ordinalMatch = str.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/); + if (ordinalMatch) { + var oYear = Number(ordinalMatch[1]); + var oDay = Number(ordinalMatch[2]); + if (oYear % 4 === 0 && oYear % 100 !== 0) + return oDay <= 366; + return oDay <= 365; + } + var match = str.match(/(\d{4})-?(\d{0,2})-?(\d*)/).map(Number); + var year = match[1]; + var month = match[2]; + var day = match[3]; + var monthString = month ? "0".concat(month).slice(-2) : month; + var dayString = day ? "0".concat(day).slice(-2) : day; + var d = new Date("".concat(year, "-").concat(monthString || "01", "-").concat(dayString || "01")); + if (isNaN(d.getUTCFullYear())) + return false; + if (month && day) { + return d.getUTCFullYear() === year && d.getUTCMonth() + 1 === month && d.getUTCDate() === day; + } + return true; + }; + function isISO8601(str, options) { + (0, _assertString.default)(str); + var check = iso8601.test(str); + if (!options) + return check; + if (check && options.strict) + return isValidDate(str); + return check; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isRFC3339.js +var require_isRFC3339 = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isRFC3339; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var dateFullYear = /[0-9]{4}/; + var dateMonth = /(0[1-9]|1[0-2])/; + var dateMDay = /([12]\d|0[1-9]|3[01])/; + var timeHour = /([01][0-9]|2[0-3])/; + var timeMinute = /[0-5][0-9]/; + var timeSecond = /([0-5][0-9]|60)/; + var timeSecFrac = /(\.[0-9]+)?/; + var timeNumOffset = new RegExp("[-+]".concat(timeHour.source, ":").concat(timeMinute.source)); + var timeOffset = new RegExp("([zZ]|".concat(timeNumOffset.source, ")")); + var partialTime = new RegExp("".concat(timeHour.source, ":").concat(timeMinute.source, ":").concat(timeSecond.source).concat(timeSecFrac.source)); + var fullDate = new RegExp("".concat(dateFullYear.source, "-").concat(dateMonth.source, "-").concat(dateMDay.source)); + var fullTime = new RegExp("".concat(partialTime.source).concat(timeOffset.source)); + var rfc3339 = new RegExp("".concat(fullDate.source, "[ tT]").concat(fullTime.source)); + function isRFC3339(str) { + (0, _assertString.default)(str); + return rfc3339.test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isISO31661Alpha2.js +var require_isISO31661Alpha2 = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isISO31661Alpha2; + var _assertString = _interopRequireDefault(require_assertString()); + var _includes = _interopRequireDefault(require_includes()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var validISO31661Alpha2CountriesCodes = ["AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"]; + function isISO31661Alpha2(str) { + (0, _assertString.default)(str); + return (0, _includes.default)(validISO31661Alpha2CountriesCodes, str.toUpperCase()); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isISO31661Alpha3.js +var require_isISO31661Alpha3 = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isISO31661Alpha3; + var _assertString = _interopRequireDefault(require_assertString()); + var _includes = _interopRequireDefault(require_includes()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var validISO31661Alpha3CountriesCodes = ["AFG", "ALA", "ALB", "DZA", "ASM", "AND", "AGO", "AIA", "ATA", "ATG", "ARG", "ARM", "ABW", "AUS", "AUT", "AZE", "BHS", "BHR", "BGD", "BRB", "BLR", "BEL", "BLZ", "BEN", "BMU", "BTN", "BOL", "BES", "BIH", "BWA", "BVT", "BRA", "IOT", "BRN", "BGR", "BFA", "BDI", "KHM", "CMR", "CAN", "CPV", "CYM", "CAF", "TCD", "CHL", "CHN", "CXR", "CCK", "COL", "COM", "COG", "COD", "COK", "CRI", "CIV", "HRV", "CUB", "CUW", "CYP", "CZE", "DNK", "DJI", "DMA", "DOM", "ECU", "EGY", "SLV", "GNQ", "ERI", "EST", "ETH", "FLK", "FRO", "FJI", "FIN", "FRA", "GUF", "PYF", "ATF", "GAB", "GMB", "GEO", "DEU", "GHA", "GIB", "GRC", "GRL", "GRD", "GLP", "GUM", "GTM", "GGY", "GIN", "GNB", "GUY", "HTI", "HMD", "VAT", "HND", "HKG", "HUN", "ISL", "IND", "IDN", "IRN", "IRQ", "IRL", "IMN", "ISR", "ITA", "JAM", "JPN", "JEY", "JOR", "KAZ", "KEN", "KIR", "PRK", "KOR", "KWT", "KGZ", "LAO", "LVA", "LBN", "LSO", "LBR", "LBY", "LIE", "LTU", "LUX", "MAC", "MKD", "MDG", "MWI", "MYS", "MDV", "MLI", "MLT", "MHL", "MTQ", "MRT", "MUS", "MYT", "MEX", "FSM", "MDA", "MCO", "MNG", "MNE", "MSR", "MAR", "MOZ", "MMR", "NAM", "NRU", "NPL", "NLD", "NCL", "NZL", "NIC", "NER", "NGA", "NIU", "NFK", "MNP", "NOR", "OMN", "PAK", "PLW", "PSE", "PAN", "PNG", "PRY", "PER", "PHL", "PCN", "POL", "PRT", "PRI", "QAT", "REU", "ROU", "RUS", "RWA", "BLM", "SHN", "KNA", "LCA", "MAF", "SPM", "VCT", "WSM", "SMR", "STP", "SAU", "SEN", "SRB", "SYC", "SLE", "SGP", "SXM", "SVK", "SVN", "SLB", "SOM", "ZAF", "SGS", "SSD", "ESP", "LKA", "SDN", "SUR", "SJM", "SWZ", "SWE", "CHE", "SYR", "TWN", "TJK", "TZA", "THA", "TLS", "TGO", "TKL", "TON", "TTO", "TUN", "TUR", "TKM", "TCA", "TUV", "UGA", "UKR", "ARE", "GBR", "USA", "UMI", "URY", "UZB", "VUT", "VEN", "VNM", "VGB", "VIR", "WLF", "ESH", "YEM", "ZMB", "ZWE"]; + function isISO31661Alpha3(str) { + (0, _assertString.default)(str); + return (0, _includes.default)(validISO31661Alpha3CountriesCodes, str.toUpperCase()); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isBase64.js +var require_isBase64 = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isBase64; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var notBase64 = /[^A-Z0-9+\/=]/i; + function isBase64(str) { + (0, _assertString.default)(str); + var len = str.length; + if (!len || len % 4 !== 0 || notBase64.test(str)) { + return false; + } + var firstPaddingChar = str.indexOf("="); + return firstPaddingChar === -1 || firstPaddingChar === len - 1 || firstPaddingChar === len - 2 && str[len - 1] === "="; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isDataURI.js +var require_isDataURI = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isDataURI; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var validMediaType = /^[a-z]+\/[a-z0-9\-\+]+$/i; + var validAttribute = /^[a-z\-]+=[a-z0-9\-]+$/i; + var validData = /^[a-z0-9!\$&'\(\)\*\+,;=\-\._~:@\/\?%\s]*$/i; + function isDataURI(str) { + (0, _assertString.default)(str); + var data = str.split(","); + if (data.length < 2) { + return false; + } + var attributes = data.shift().trim().split(";"); + var schemeAndMediaType = attributes.shift(); + if (schemeAndMediaType.substr(0, 5) !== "data:") { + return false; + } + var mediaType = schemeAndMediaType.substr(5); + if (mediaType !== "" && !validMediaType.test(mediaType)) { + return false; + } + for (var i = 0; i < attributes.length; i++) { + if (i === attributes.length - 1 && attributes[i].toLowerCase() === "base64") { + } else if (!validAttribute.test(attributes[i])) { + return false; + } + } + for (var _i = 0; _i < data.length; _i++) { + if (!validData.test(data[_i])) { + return false; + } + } + return true; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isMagnetURI.js +var require_isMagnetURI = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isMagnetURI; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var magnetURI = /^magnet:\?xt=urn:[a-z0-9]+:[a-z0-9]{32,40}&dn=.+&tr=.+$/i; + function isMagnetURI(url) { + (0, _assertString.default)(url); + return magnetURI.test(url.trim()); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isMimeType.js +var require_isMimeType = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isMimeType; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var mimeTypeSimple = /^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+]{1,100}$/i; + var mimeTypeText = /^text\/[a-zA-Z0-9\.\-\+]{1,100};\s?charset=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?$/i; + var mimeTypeMultipart = /^multipart\/[a-zA-Z0-9\.\-\+]{1,100}(;\s?(boundary|charset)=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?){0,2}$/i; + function isMimeType(str) { + (0, _assertString.default)(str); + return mimeTypeSimple.test(str) || mimeTypeText.test(str) || mimeTypeMultipart.test(str); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isLatLong.js +var require_isLatLong = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = _default; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var lat = /^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/; + var long = /^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/; + function _default(str) { + (0, _assertString.default)(str); + if (!str.includes(",")) + return false; + var pair = str.split(","); + return lat.test(pair[0]) && long.test(pair[1]); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isPostalCode.js +var require_isPostalCode = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = _default; + exports2.locales = void 0; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var threeDigit = /^\d{3}$/; + var fourDigit = /^\d{4}$/; + var fiveDigit = /^\d{5}$/; + var sixDigit = /^\d{6}$/; + var patterns = { + AD: /^AD\d{3}$/, + AT: fourDigit, + AU: fourDigit, + BE: fourDigit, + BG: fourDigit, + CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i, + CH: fourDigit, + CZ: /^\d{3}\s?\d{2}$/, + DE: fiveDigit, + DK: fourDigit, + DZ: fiveDigit, + EE: fiveDigit, + ES: fiveDigit, + FI: fiveDigit, + FR: /^\d{2}\s?\d{3}$/, + GB: /^(gir\s?0aa|[a-z]{1,2}\d[\da-z]?\s?(\d[a-z]{2})?)$/i, + GR: /^\d{3}\s?\d{2}$/, + HR: /^([1-5]\d{4}$)/, + HU: fourDigit, + IL: fiveDigit, + IN: sixDigit, + IS: threeDigit, + IT: fiveDigit, + JP: /^\d{3}\-\d{4}$/, + KE: fiveDigit, + LI: /^(948[5-9]|949[0-7])$/, + LT: /^LT\-\d{5}$/, + LU: fourDigit, + LV: /^LV\-\d{4}$/, + MX: fiveDigit, + NL: /^\d{4}\s?[a-z]{2}$/i, + NO: fourDigit, + PL: /^\d{2}\-\d{3}$/, + PT: /^\d{4}\-\d{3}?$/, + RO: sixDigit, + RU: sixDigit, + SA: fiveDigit, + SE: /^\d{3}\s?\d{2}$/, + SI: fourDigit, + SK: /^\d{3}\s?\d{2}$/, + TN: fourDigit, + TW: /^\d{3}(\d{2})?$/, + UA: fiveDigit, + US: /^\d{5}(-\d{4})?$/, + ZA: fourDigit, + ZM: fiveDigit + }; + var locales = Object.keys(patterns); + exports2.locales = locales; + function _default(str, locale) { + (0, _assertString.default)(str); + if (locale in patterns) { + return patterns[locale].test(str); + } else if (locale === "any") { + for (var key in patterns) { + if (patterns.hasOwnProperty(key)) { + var pattern = patterns[key]; + if (pattern.test(str)) { + return true; + } + } + } + return false; + } + throw new Error("Invalid locale '".concat(locale, "'")); + } +}); + +// node_modules/validator/lib/ltrim.js +var require_ltrim = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = ltrim; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function ltrim(str, chars) { + (0, _assertString.default)(str); + var pattern = chars ? new RegExp("^[".concat(chars, "]+"), "g") : /^\s+/g; + return str.replace(pattern, ""); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/rtrim.js +var require_rtrim = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = rtrim; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function rtrim(str, chars) { + (0, _assertString.default)(str); + var pattern = chars ? new RegExp("[".concat(chars, "]")) : /\s/; + var idx = str.length - 1; + for (; idx >= 0 && pattern.test(str[idx]); idx--) { + ; + } + return idx < str.length ? str.substr(0, idx + 1) : str; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/trim.js +var require_trim = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = trim; + var _rtrim = _interopRequireDefault(require_rtrim()); + var _ltrim = _interopRequireDefault(require_ltrim()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function trim(str, chars) { + return (0, _rtrim.default)((0, _ltrim.default)(str, chars), chars); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/escape.js +var require_escape = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = escape2; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function escape2(str) { + (0, _assertString.default)(str); + return str.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(//g, ">").replace(/\//g, "/").replace(/\\/g, "\").replace(/`/g, "`"); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/unescape.js +var require_unescape = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = unescape2; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function unescape2(str) { + (0, _assertString.default)(str); + return str.replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(///g, "/").replace(/\/g, "\\").replace(/`/g, "`"); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/blacklist.js +var require_blacklist = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = blacklist; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function blacklist(str, chars) { + (0, _assertString.default)(str); + return str.replace(new RegExp("[".concat(chars, "]+"), "g"), ""); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/stripLow.js +var require_stripLow = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = stripLow; + var _assertString = _interopRequireDefault(require_assertString()); + var _blacklist = _interopRequireDefault(require_blacklist()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function stripLow(str, keep_new_lines) { + (0, _assertString.default)(str); + var chars = keep_new_lines ? "\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F" : "\\x00-\\x1F\\x7F"; + return (0, _blacklist.default)(str, chars); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/whitelist.js +var require_whitelist = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = whitelist; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function whitelist(str, chars) { + (0, _assertString.default)(str); + return str.replace(new RegExp("[^".concat(chars, "]+"), "g"), ""); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/isWhitelisted.js +var require_isWhitelisted = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isWhitelisted; + var _assertString = _interopRequireDefault(require_assertString()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + function isWhitelisted(str, chars) { + (0, _assertString.default)(str); + for (var i = str.length - 1; i >= 0; i--) { + if (chars.indexOf(str[i]) === -1) { + return false; + } + } + return true; + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/lib/normalizeEmail.js +var require_normalizeEmail = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = normalizeEmail; + var _merge = _interopRequireDefault(require_merge2()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var default_normalize_email_options = { + all_lowercase: true, + gmail_lowercase: true, + gmail_remove_dots: true, + gmail_remove_subaddress: true, + gmail_convert_googlemaildotcom: true, + outlookdotcom_lowercase: true, + outlookdotcom_remove_subaddress: true, + yahoo_lowercase: true, + yahoo_remove_subaddress: true, + yandex_lowercase: true, + icloud_lowercase: true, + icloud_remove_subaddress: true + }; + var icloud_domains = ["icloud.com", "me.com"]; + var outlookdotcom_domains = ["hotmail.at", "hotmail.be", "hotmail.ca", "hotmail.cl", "hotmail.co.il", "hotmail.co.nz", "hotmail.co.th", "hotmail.co.uk", "hotmail.com", "hotmail.com.ar", "hotmail.com.au", "hotmail.com.br", "hotmail.com.gr", "hotmail.com.mx", "hotmail.com.pe", "hotmail.com.tr", "hotmail.com.vn", "hotmail.cz", "hotmail.de", "hotmail.dk", "hotmail.es", "hotmail.fr", "hotmail.hu", "hotmail.id", "hotmail.ie", "hotmail.in", "hotmail.it", "hotmail.jp", "hotmail.kr", "hotmail.lv", "hotmail.my", "hotmail.ph", "hotmail.pt", "hotmail.sa", "hotmail.sg", "hotmail.sk", "live.be", "live.co.uk", "live.com", "live.com.ar", "live.com.mx", "live.de", "live.es", "live.eu", "live.fr", "live.it", "live.nl", "msn.com", "outlook.at", "outlook.be", "outlook.cl", "outlook.co.il", "outlook.co.nz", "outlook.co.th", "outlook.com", "outlook.com.ar", "outlook.com.au", "outlook.com.br", "outlook.com.gr", "outlook.com.pe", "outlook.com.tr", "outlook.com.vn", "outlook.cz", "outlook.de", "outlook.dk", "outlook.es", "outlook.fr", "outlook.hu", "outlook.id", "outlook.ie", "outlook.in", "outlook.it", "outlook.jp", "outlook.kr", "outlook.lv", "outlook.my", "outlook.ph", "outlook.pt", "outlook.sa", "outlook.sg", "outlook.sk", "passport.com"]; + var yahoo_domains = ["rocketmail.com", "yahoo.ca", "yahoo.co.uk", "yahoo.com", "yahoo.de", "yahoo.fr", "yahoo.in", "yahoo.it", "ymail.com"]; + var yandex_domains = ["yandex.ru", "yandex.ua", "yandex.kz", "yandex.com", "yandex.by", "ya.ru"]; + function dotsReplacer(match) { + if (match.length > 1) { + return match; + } + return ""; + } + function normalizeEmail(email, options) { + options = (0, _merge.default)(options, default_normalize_email_options); + var raw_parts = email.split("@"); + var domain = raw_parts.pop(); + var user = raw_parts.join("@"); + var parts = [user, domain]; + parts[1] = parts[1].toLowerCase(); + if (parts[1] === "gmail.com" || parts[1] === "googlemail.com") { + if (options.gmail_remove_subaddress) { + parts[0] = parts[0].split("+")[0]; + } + if (options.gmail_remove_dots) { + parts[0] = parts[0].replace(/\.+/g, dotsReplacer); + } + if (!parts[0].length) { + return false; + } + if (options.all_lowercase || options.gmail_lowercase) { + parts[0] = parts[0].toLowerCase(); + } + parts[1] = options.gmail_convert_googlemaildotcom ? "gmail.com" : parts[1]; + } else if (icloud_domains.indexOf(parts[1]) >= 0) { + if (options.icloud_remove_subaddress) { + parts[0] = parts[0].split("+")[0]; + } + if (!parts[0].length) { + return false; + } + if (options.all_lowercase || options.icloud_lowercase) { + parts[0] = parts[0].toLowerCase(); + } + } else if (outlookdotcom_domains.indexOf(parts[1]) >= 0) { + if (options.outlookdotcom_remove_subaddress) { + parts[0] = parts[0].split("+")[0]; + } + if (!parts[0].length) { + return false; + } + if (options.all_lowercase || options.outlookdotcom_lowercase) { + parts[0] = parts[0].toLowerCase(); + } + } else if (yahoo_domains.indexOf(parts[1]) >= 0) { + if (options.yahoo_remove_subaddress) { + var components = parts[0].split("-"); + parts[0] = components.length > 1 ? components.slice(0, -1).join("-") : components[0]; + } + if (!parts[0].length) { + return false; + } + if (options.all_lowercase || options.yahoo_lowercase) { + parts[0] = parts[0].toLowerCase(); + } + } else if (yandex_domains.indexOf(parts[1]) >= 0) { + if (options.all_lowercase || options.yandex_lowercase) { + parts[0] = parts[0].toLowerCase(); + } + parts[1] = "yandex.ru"; + } else if (options.all_lowercase) { + parts[0] = parts[0].toLowerCase(); + } + return parts.join("@"); + } + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/validator/index.js +var require_validator2 = __commonJS((exports2, module2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var _toDate = _interopRequireDefault(require_toDate()); + var _toFloat = _interopRequireDefault(require_toFloat()); + var _toInt = _interopRequireDefault(require_toInt()); + var _toBoolean = _interopRequireDefault(require_toBoolean()); + var _equals = _interopRequireDefault(require_equals()); + var _contains = _interopRequireDefault(require_contains()); + var _matches = _interopRequireDefault(require_matches()); + var _isEmail = _interopRequireDefault(require_isEmail()); + var _isURL = _interopRequireDefault(require_isURL()); + var _isMACAddress = _interopRequireDefault(require_isMACAddress()); + var _isIP = _interopRequireDefault(require_isIP()); + var _isIPRange = _interopRequireDefault(require_isIPRange()); + var _isFQDN = _interopRequireDefault(require_isFQDN()); + var _isBoolean = _interopRequireDefault(require_isBoolean()); + var _isAlpha = _interopRequireWildcard(require_isAlpha()); + var _isAlphanumeric = _interopRequireWildcard(require_isAlphanumeric()); + var _isNumeric = _interopRequireDefault(require_isNumeric()); + var _isPort = _interopRequireDefault(require_isPort()); + var _isLowercase = _interopRequireDefault(require_isLowercase()); + var _isUppercase = _interopRequireDefault(require_isUppercase()); + var _isAscii = _interopRequireDefault(require_isAscii()); + var _isFullWidth = _interopRequireDefault(require_isFullWidth()); + var _isHalfWidth = _interopRequireDefault(require_isHalfWidth()); + var _isVariableWidth = _interopRequireDefault(require_isVariableWidth()); + var _isMultibyte = _interopRequireDefault(require_isMultibyte()); + var _isSurrogatePair = _interopRequireDefault(require_isSurrogatePair()); + var _isInt = _interopRequireDefault(require_isInt()); + var _isFloat = _interopRequireWildcard(require_isFloat()); + var _isDecimal = _interopRequireDefault(require_isDecimal()); + var _isHexadecimal = _interopRequireDefault(require_isHexadecimal()); + var _isDivisibleBy = _interopRequireDefault(require_isDivisibleBy()); + var _isHexColor = _interopRequireDefault(require_isHexColor()); + var _isISRC = _interopRequireDefault(require_isISRC()); + var _isMD = _interopRequireDefault(require_isMD5()); + var _isHash = _interopRequireDefault(require_isHash()); + var _isJWT = _interopRequireDefault(require_isJWT()); + var _isJSON = _interopRequireDefault(require_isJSON()); + var _isEmpty = _interopRequireDefault(require_isEmpty()); + var _isLength = _interopRequireDefault(require_isLength()); + var _isByteLength = _interopRequireDefault(require_isByteLength()); + var _isUUID = _interopRequireDefault(require_isUUID()); + var _isMongoId = _interopRequireDefault(require_isMongoId()); + var _isAfter = _interopRequireDefault(require_isAfter()); + var _isBefore = _interopRequireDefault(require_isBefore()); + var _isIn = _interopRequireDefault(require_isIn()); + var _isCreditCard = _interopRequireDefault(require_isCreditCard()); + var _isIdentityCard = _interopRequireDefault(require_isIdentityCard()); + var _isISIN = _interopRequireDefault(require_isISIN()); + var _isISBN = _interopRequireDefault(require_isISBN()); + var _isISSN = _interopRequireDefault(require_isISSN()); + var _isMobilePhone = _interopRequireWildcard(require_isMobilePhone()); + var _isCurrency = _interopRequireDefault(require_isCurrency()); + var _isISO = _interopRequireDefault(require_isISO8601()); + var _isRFC = _interopRequireDefault(require_isRFC3339()); + var _isISO31661Alpha = _interopRequireDefault(require_isISO31661Alpha2()); + var _isISO31661Alpha2 = _interopRequireDefault(require_isISO31661Alpha3()); + var _isBase = _interopRequireDefault(require_isBase64()); + var _isDataURI = _interopRequireDefault(require_isDataURI()); + var _isMagnetURI = _interopRequireDefault(require_isMagnetURI()); + var _isMimeType = _interopRequireDefault(require_isMimeType()); + var _isLatLong = _interopRequireDefault(require_isLatLong()); + var _isPostalCode = _interopRequireWildcard(require_isPostalCode()); + var _ltrim = _interopRequireDefault(require_ltrim()); + var _rtrim = _interopRequireDefault(require_rtrim()); + var _trim = _interopRequireDefault(require_trim()); + var _escape = _interopRequireDefault(require_escape()); + var _unescape = _interopRequireDefault(require_unescape()); + var _stripLow = _interopRequireDefault(require_stripLow()); + var _whitelist = _interopRequireDefault(require_whitelist()); + var _blacklist = _interopRequireDefault(require_blacklist()); + var _isWhitelisted = _interopRequireDefault(require_isWhitelisted()); + var _normalizeEmail = _interopRequireDefault(require_normalizeEmail()); + var _toString = _interopRequireDefault(require_toString()); + function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {}; + if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; + if (desc.get || desc.set) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + } + newObj.default = obj; + return newObj; + } + } + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; + } + var version = "10.11.0"; + var validator = { + version, + toDate: _toDate.default, + toFloat: _toFloat.default, + toInt: _toInt.default, + toBoolean: _toBoolean.default, + equals: _equals.default, + contains: _contains.default, + matches: _matches.default, + isEmail: _isEmail.default, + isURL: _isURL.default, + isMACAddress: _isMACAddress.default, + isIP: _isIP.default, + isIPRange: _isIPRange.default, + isFQDN: _isFQDN.default, + isBoolean: _isBoolean.default, + isAlpha: _isAlpha.default, + isAlphaLocales: _isAlpha.locales, + isAlphanumeric: _isAlphanumeric.default, + isAlphanumericLocales: _isAlphanumeric.locales, + isNumeric: _isNumeric.default, + isPort: _isPort.default, + isLowercase: _isLowercase.default, + isUppercase: _isUppercase.default, + isAscii: _isAscii.default, + isFullWidth: _isFullWidth.default, + isHalfWidth: _isHalfWidth.default, + isVariableWidth: _isVariableWidth.default, + isMultibyte: _isMultibyte.default, + isSurrogatePair: _isSurrogatePair.default, + isInt: _isInt.default, + isFloat: _isFloat.default, + isFloatLocales: _isFloat.locales, + isDecimal: _isDecimal.default, + isHexadecimal: _isHexadecimal.default, + isDivisibleBy: _isDivisibleBy.default, + isHexColor: _isHexColor.default, + isISRC: _isISRC.default, + isMD5: _isMD.default, + isHash: _isHash.default, + isJWT: _isJWT.default, + isJSON: _isJSON.default, + isEmpty: _isEmpty.default, + isLength: _isLength.default, + isByteLength: _isByteLength.default, + isUUID: _isUUID.default, + isMongoId: _isMongoId.default, + isAfter: _isAfter.default, + isBefore: _isBefore.default, + isIn: _isIn.default, + isCreditCard: _isCreditCard.default, + isIdentityCard: _isIdentityCard.default, + isISIN: _isISIN.default, + isISBN: _isISBN.default, + isISSN: _isISSN.default, + isMobilePhone: _isMobilePhone.default, + isMobilePhoneLocales: _isMobilePhone.locales, + isPostalCode: _isPostalCode.default, + isPostalCodeLocales: _isPostalCode.locales, + isCurrency: _isCurrency.default, + isISO8601: _isISO.default, + isRFC3339: _isRFC.default, + isISO31661Alpha2: _isISO31661Alpha.default, + isISO31661Alpha3: _isISO31661Alpha2.default, + isBase64: _isBase.default, + isDataURI: _isDataURI.default, + isMagnetURI: _isMagnetURI.default, + isMimeType: _isMimeType.default, + isLatLong: _isLatLong.default, + ltrim: _ltrim.default, + rtrim: _rtrim.default, + trim: _trim.default, + escape: _escape.default, + unescape: _unescape.default, + stripLow: _stripLow.default, + whitelist: _whitelist.default, + blacklist: _blacklist.default, + isWhitelisted: _isWhitelisted.default, + normalizeEmail: _normalizeEmail.default, + toString: _toString.default + }; + var _default = validator; + exports2.default = _default; + module2.exports = exports2.default; + module2.exports.default = exports2.default; +}); + +// node_modules/requires-port/index.js +var require_requires_port = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function required(port, protocol) { + protocol = protocol.split(":")[0]; + port = +port; + if (!port) + return false; + switch (protocol) { + case "http": + case "ws": + return port !== 80; + case "https": + case "wss": + return port !== 443; + case "ftp": + return port !== 21; + case "gopher": + return port !== 70; + case "file": + return false; + } + return port !== 0; + }; +}); + +// node_modules/querystringify/index.js +var require_querystringify = __commonJS((exports2) => { + "use strict"; + var has = Object.prototype.hasOwnProperty; + var undef; + function decode(input) { + try { + return decodeURIComponent(input.replace(/\+/g, " ")); + } catch (e) { + return null; + } + } + function encode(input) { + try { + return encodeURIComponent(input); + } catch (e) { + return null; + } + } + function querystring(query) { + var parser2 = /([^=?#&]+)=?([^&]*)/g, result = {}, part; + while (part = parser2.exec(query)) { + var key = decode(part[1]), value = decode(part[2]); + if (key === null || value === null || key in result) + continue; + result[key] = value; + } + return result; + } + function querystringify(obj, prefix) { + prefix = prefix || ""; + var pairs = [], value, key; + if (typeof prefix !== "string") + prefix = "?"; + for (key in obj) { + if (has.call(obj, key)) { + value = obj[key]; + if (!value && (value === null || value === undef || isNaN(value))) { + value = ""; + } + key = encode(key); + value = encode(value); + if (key === null || value === null) + continue; + pairs.push(key + "=" + value); + } + } + return pairs.length ? prefix + pairs.join("&") : ""; + } + exports2.stringify = querystringify; + exports2.parse = querystring; +}); + +// node_modules/url-parse/index.js +var require_url_parse = __commonJS((exports2, module2) => { + "use strict"; + var required = require_requires_port(); + var qs = require_querystringify(); + var slashes = /^[A-Za-z][A-Za-z0-9+-.]*:[\\/]+/; + var protocolre = /^([a-z][a-z0-9.+-]*:)?([\\/]{1,})?([\S\s]*)/i; + var whitespace = "[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]"; + var left = new RegExp("^" + whitespace + "+"); + function trimLeft(str) { + return (str ? str : "").toString().replace(left, ""); + } + var rules = [ + ["#", "hash"], + ["?", "query"], + function sanitize(address) { + return address.replace("\\", "/"); + }, + ["/", "pathname"], + ["@", "auth", 1], + [NaN, "host", void 0, 1, 1], + [/:(\d+)$/, "port", void 0, 1], + [NaN, "hostname", void 0, 1, 1] + ]; + var ignore = {hash: 1, query: 1}; + function lolcation(loc) { + var globalVar; + if (typeof window !== "undefined") + globalVar = window; + else if (typeof global !== "undefined") + globalVar = global; + else if (typeof self !== "undefined") + globalVar = self; + else + globalVar = {}; + var location = globalVar.location || {}; + loc = loc || location; + var finaldestination = {}, type = typeof loc, key; + if (loc.protocol === "blob:") { + finaldestination = new Url(unescape(loc.pathname), {}); + } else if (type === "string") { + finaldestination = new Url(loc, {}); + for (key in ignore) + delete finaldestination[key]; + } else if (type === "object") { + for (key in loc) { + if (key in ignore) + continue; + finaldestination[key] = loc[key]; + } + if (finaldestination.slashes === void 0) { + finaldestination.slashes = slashes.test(loc.href); + } + } + return finaldestination; + } + function extractProtocol(address) { + address = trimLeft(address); + var match = protocolre.exec(address), protocol = match[1] ? match[1].toLowerCase() : "", slashes2 = !!(match[2] && match[2].length >= 2), rest = match[2] && match[2].length === 1 ? "/" + match[3] : match[3]; + return { + protocol, + slashes: slashes2, + rest + }; + } + function resolve(relative2, base) { + if (relative2 === "") + return base; + var path = (base || "/").split("/").slice(0, -1).concat(relative2.split("/")), i = path.length, last = path[i - 1], unshift = false, up = 0; + while (i--) { + if (path[i] === ".") { + path.splice(i, 1); + } else if (path[i] === "..") { + path.splice(i, 1); + up++; + } else if (up) { + if (i === 0) + unshift = true; + path.splice(i, 1); + up--; + } + } + if (unshift) + path.unshift(""); + if (last === "." || last === "..") + path.push(""); + return path.join("/"); + } + function Url(address, location, parser2) { + address = trimLeft(address); + if (!(this instanceof Url)) { + return new Url(address, location, parser2); + } + var relative2, extracted, parse, instruction, index, key, instructions = rules.slice(), type = typeof location, url = this, i = 0; + if (type !== "object" && type !== "string") { + parser2 = location; + location = null; + } + if (parser2 && typeof parser2 !== "function") + parser2 = qs.parse; + location = lolcation(location); + extracted = extractProtocol(address || ""); + relative2 = !extracted.protocol && !extracted.slashes; + url.slashes = extracted.slashes || relative2 && location.slashes; + url.protocol = extracted.protocol || location.protocol || ""; + address = extracted.rest; + if (!extracted.slashes) + instructions[3] = [/(.*)/, "pathname"]; + for (; i < instructions.length; i++) { + instruction = instructions[i]; + if (typeof instruction === "function") { + address = instruction(address); + continue; + } + parse = instruction[0]; + key = instruction[1]; + if (parse !== parse) { + url[key] = address; + } else if (typeof parse === "string") { + if (~(index = address.indexOf(parse))) { + if (typeof instruction[2] === "number") { + url[key] = address.slice(0, index); + address = address.slice(index + instruction[2]); + } else { + url[key] = address.slice(index); + address = address.slice(0, index); + } + } + } else if (index = parse.exec(address)) { + url[key] = index[1]; + address = address.slice(0, index.index); + } + url[key] = url[key] || (relative2 && instruction[3] ? location[key] || "" : ""); + if (instruction[4]) + url[key] = url[key].toLowerCase(); + } + if (parser2) + url.query = parser2(url.query); + if (relative2 && location.slashes && url.pathname.charAt(0) !== "/" && (url.pathname !== "" || location.pathname !== "")) { + url.pathname = resolve(url.pathname, location.pathname); + } + if (url.pathname.charAt(0) !== "/" && url.hostname) { + url.pathname = "/" + url.pathname; + } + if (!required(url.port, url.protocol)) { + url.host = url.hostname; + url.port = ""; + } + url.username = url.password = ""; + if (url.auth) { + instruction = url.auth.split(":"); + url.username = instruction[0] || ""; + url.password = instruction[1] || ""; + } + url.origin = url.protocol && url.host && url.protocol !== "file:" ? url.protocol + "//" + url.host : "null"; + url.href = url.toString(); + } + function set(part, value, fn) { + var url = this; + switch (part) { + case "query": + if (typeof value === "string" && value.length) { + value = (fn || qs.parse)(value); + } + url[part] = value; + break; + case "port": + url[part] = value; + if (!required(value, url.protocol)) { + url.host = url.hostname; + url[part] = ""; + } else if (value) { + url.host = url.hostname + ":" + value; + } + break; + case "hostname": + url[part] = value; + if (url.port) + value += ":" + url.port; + url.host = value; + break; + case "host": + url[part] = value; + if (/:\d+$/.test(value)) { + value = value.split(":"); + url.port = value.pop(); + url.hostname = value.join(":"); + } else { + url.hostname = value; + url.port = ""; + } + break; + case "protocol": + url.protocol = value.toLowerCase(); + url.slashes = !fn; + break; + case "pathname": + case "hash": + if (value) { + var char = part === "pathname" ? "/" : "#"; + url[part] = value.charAt(0) !== char ? char + value : value; + } else { + url[part] = value; + } + break; + default: + url[part] = value; + } + for (var i = 0; i < rules.length; i++) { + var ins = rules[i]; + if (ins[4]) + url[ins[1]] = url[ins[1]].toLowerCase(); + } + url.origin = url.protocol && url.host && url.protocol !== "file:" ? url.protocol + "//" + url.host : "null"; + url.href = url.toString(); + return url; + } + function toString(stringify) { + if (!stringify || typeof stringify !== "function") + stringify = qs.stringify; + var query, url = this, protocol = url.protocol; + if (protocol && protocol.charAt(protocol.length - 1) !== ":") + protocol += ":"; + var result = protocol + (url.slashes ? "//" : ""); + if (url.username) { + result += url.username; + if (url.password) + result += ":" + url.password; + result += "@"; + } + result += url.host + url.pathname; + query = typeof url.query === "object" ? stringify(url.query) : url.query; + if (query) + result += query.charAt(0) !== "?" ? "?" + query : query; + if (url.hash) + result += url.hash; + return result; + } + Url.prototype = {set, toString}; + Url.extractProtocol = extractProtocol; + Url.location = lolcation; + Url.trimLeft = trimLeft; + Url.qs = qs; + module2.exports = Url; +}); + +// node_modules/original/index.js +var require_original = __commonJS((exports2, module2) => { + "use strict"; + var parse = require_url_parse(); + function origin(url) { + if (typeof url === "string") + url = parse(url); + if (!url.protocol || !url.hostname) + return "null"; + return (url.protocol + "//" + url.host).toLowerCase(); + } + origin.same = function same(a, b) { + return origin(a) === origin(b); + }; + module2.exports = origin; +}); + +// node_modules/eventsource/lib/eventsource.js +var require_eventsource = __commonJS((exports2, module2) => { + var original = require_original(); + var parse = require("url").parse; + var events = require("events"); + var https = require("https"); + var http = require("http"); + var util = require("util"); + var httpsOptions = [ + "pfx", + "key", + "passphrase", + "cert", + "ca", + "ciphers", + "rejectUnauthorized", + "secureProtocol", + "servername", + "checkServerIdentity" + ]; + var bom = [239, 187, 191]; + var colon = 58; + var space = 32; + var lineFeed = 10; + var carriageReturn = 13; + function hasBom(buf) { + return bom.every(function(charCode, index) { + return buf[index] === charCode; + }); + } + function EventSource(url, eventSourceInitDict) { + var readyState = EventSource.CONNECTING; + Object.defineProperty(this, "readyState", { + get: function() { + return readyState; + } + }); + Object.defineProperty(this, "url", { + get: function() { + return url; + } + }); + var self2 = this; + self2.reconnectInterval = 1e3; + self2.connectionInProgress = false; + function onConnectionClosed(message) { + if (readyState === EventSource.CLOSED) + return; + readyState = EventSource.CONNECTING; + _emit("error", new Event2("error", {message})); + if (reconnectUrl) { + url = reconnectUrl; + reconnectUrl = null; + } + setTimeout(function() { + if (readyState !== EventSource.CONNECTING || self2.connectionInProgress) { + return; + } + self2.connectionInProgress = true; + connect(); + }, self2.reconnectInterval); + } + var req; + var lastEventId = ""; + if (eventSourceInitDict && eventSourceInitDict.headers && eventSourceInitDict.headers["Last-Event-ID"]) { + lastEventId = eventSourceInitDict.headers["Last-Event-ID"]; + delete eventSourceInitDict.headers["Last-Event-ID"]; + } + var discardTrailingNewline = false; + var data = ""; + var eventName = ""; + var reconnectUrl = null; + function connect() { + var options = parse(url); + var isSecure = options.protocol === "https:"; + options.headers = {"Cache-Control": "no-cache", Accept: "text/event-stream"}; + if (lastEventId) + options.headers["Last-Event-ID"] = lastEventId; + if (eventSourceInitDict && eventSourceInitDict.headers) { + for (var i in eventSourceInitDict.headers) { + var header = eventSourceInitDict.headers[i]; + if (header) { + options.headers[i] = header; + } + } + } + options.rejectUnauthorized = !(eventSourceInitDict && !eventSourceInitDict.rejectUnauthorized); + if (eventSourceInitDict && eventSourceInitDict.createConnection !== void 0) { + options.createConnection = eventSourceInitDict.createConnection; + } + var useProxy = eventSourceInitDict && eventSourceInitDict.proxy; + if (useProxy) { + var proxy = parse(eventSourceInitDict.proxy); + isSecure = proxy.protocol === "https:"; + options.protocol = isSecure ? "https:" : "http:"; + options.path = url; + options.headers.Host = options.host; + options.hostname = proxy.hostname; + options.host = proxy.host; + options.port = proxy.port; + } + if (eventSourceInitDict && eventSourceInitDict.https) { + for (var optName in eventSourceInitDict.https) { + if (httpsOptions.indexOf(optName) === -1) { + continue; + } + var option = eventSourceInitDict.https[optName]; + if (option !== void 0) { + options[optName] = option; + } + } + } + if (eventSourceInitDict && eventSourceInitDict.withCredentials !== void 0) { + options.withCredentials = eventSourceInitDict.withCredentials; + } + req = (isSecure ? https : http).request(options, function(res) { + self2.connectionInProgress = false; + if (res.statusCode === 500 || res.statusCode === 502 || res.statusCode === 503 || res.statusCode === 504) { + _emit("error", new Event2("error", {status: res.statusCode, message: res.statusMessage})); + onConnectionClosed(); + return; + } + if (res.statusCode === 301 || res.statusCode === 302 || res.statusCode === 307) { + if (!res.headers.location) { + _emit("error", new Event2("error", {status: res.statusCode, message: res.statusMessage})); + return; + } + if (res.statusCode === 307) + reconnectUrl = url; + url = res.headers.location; + process.nextTick(connect); + return; + } + if (res.statusCode !== 200) { + _emit("error", new Event2("error", {status: res.statusCode, message: res.statusMessage})); + return self2.close(); + } + readyState = EventSource.OPEN; + res.on("close", function() { + res.removeAllListeners("close"); + res.removeAllListeners("end"); + onConnectionClosed(); + }); + res.on("end", function() { + res.removeAllListeners("close"); + res.removeAllListeners("end"); + onConnectionClosed(); + }); + _emit("open", new Event2("open")); + var isFirst = true; + var buf; + var startingPos = 0; + var startingFieldLength = -1; + res.on("data", function(chunk) { + buf = buf ? Buffer.concat([buf, chunk]) : chunk; + if (isFirst && hasBom(buf)) { + buf = buf.slice(bom.length); + } + isFirst = false; + var pos = 0; + var length = buf.length; + while (pos < length) { + if (discardTrailingNewline) { + if (buf[pos] === lineFeed) { + ++pos; + } + discardTrailingNewline = false; + } + var lineLength = -1; + var fieldLength = startingFieldLength; + var c; + for (var i2 = startingPos; lineLength < 0 && i2 < length; ++i2) { + c = buf[i2]; + if (c === colon) { + if (fieldLength < 0) { + fieldLength = i2 - pos; + } + } else if (c === carriageReturn) { + discardTrailingNewline = true; + lineLength = i2 - pos; + } else if (c === lineFeed) { + lineLength = i2 - pos; + } + } + if (lineLength < 0) { + startingPos = length - pos; + startingFieldLength = fieldLength; + break; + } else { + startingPos = 0; + startingFieldLength = -1; + } + parseEventStreamLine(buf, pos, fieldLength, lineLength); + pos += lineLength + 1; + } + if (pos === length) { + buf = void 0; + } else if (pos > 0) { + buf = buf.slice(pos); + } + }); + }); + req.on("error", function(err) { + self2.connectionInProgress = false; + onConnectionClosed(err.message); + }); + if (req.setNoDelay) + req.setNoDelay(true); + req.end(); + } + connect(); + function _emit() { + if (self2.listeners(arguments[0]).length > 0) { + self2.emit.apply(self2, arguments); + } + } + this._close = function() { + if (readyState === EventSource.CLOSED) + return; + readyState = EventSource.CLOSED; + if (req.abort) + req.abort(); + if (req.xhr && req.xhr.abort) + req.xhr.abort(); + }; + function parseEventStreamLine(buf, pos, fieldLength, lineLength) { + if (lineLength === 0) { + if (data.length > 0) { + var type = eventName || "message"; + _emit(type, new MessageEvent(type, { + data: data.slice(0, -1), + lastEventId, + origin: original(url) + })); + data = ""; + } + eventName = void 0; + } else if (fieldLength > 0) { + var noValue = fieldLength < 0; + var step = 0; + var field = buf.slice(pos, pos + (noValue ? lineLength : fieldLength)).toString(); + if (noValue) { + step = lineLength; + } else if (buf[pos + fieldLength + 1] !== space) { + step = fieldLength + 1; + } else { + step = fieldLength + 2; + } + pos += step; + var valueLength = lineLength - step; + var value = buf.slice(pos, pos + valueLength).toString(); + if (field === "data") { + data += value + "\n"; + } else if (field === "event") { + eventName = value; + } else if (field === "id") { + lastEventId = value; + } else if (field === "retry") { + var retry = parseInt(value, 10); + if (!Number.isNaN(retry)) { + self2.reconnectInterval = retry; + } + } + } + } + } + module2.exports = EventSource; + util.inherits(EventSource, events.EventEmitter); + EventSource.prototype.constructor = EventSource; + ["open", "error", "message"].forEach(function(method) { + Object.defineProperty(EventSource.prototype, "on" + method, { + get: function get() { + var listener = this.listeners(method)[0]; + return listener ? listener._listener ? listener._listener : listener : void 0; + }, + set: function set(listener) { + this.removeAllListeners(method); + this.addEventListener(method, listener); + } + }); + }); + Object.defineProperty(EventSource, "CONNECTING", {enumerable: true, value: 0}); + Object.defineProperty(EventSource, "OPEN", {enumerable: true, value: 1}); + Object.defineProperty(EventSource, "CLOSED", {enumerable: true, value: 2}); + EventSource.prototype.CONNECTING = 0; + EventSource.prototype.OPEN = 1; + EventSource.prototype.CLOSED = 2; + EventSource.prototype.close = function() { + this._close(); + }; + EventSource.prototype.addEventListener = function addEventListener2(type, listener) { + if (typeof listener === "function") { + listener._listener = listener; + this.on(type, listener); + } + }; + EventSource.prototype.dispatchEvent = function dispatchEvent(event) { + if (!event.type) { + throw new Error("UNSPECIFIED_EVENT_TYPE_ERR"); + } + this.emit(event.type, event.detail); + }; + EventSource.prototype.removeEventListener = function removeEventListener(type, listener) { + if (typeof listener === "function") { + listener._listener = void 0; + this.removeListener(type, listener); + } + }; + function Event2(type, optionalProperties) { + Object.defineProperty(this, "type", {writable: false, value: type, enumerable: true}); + if (optionalProperties) { + for (var f in optionalProperties) { + if (optionalProperties.hasOwnProperty(f)) { + Object.defineProperty(this, f, {writable: false, value: optionalProperties[f], enumerable: true}); + } + } + } + } + function MessageEvent(type, eventInitDict) { + Object.defineProperty(this, "type", {writable: false, value: type, enumerable: true}); + for (var f in eventInitDict) { + if (eventInitDict.hasOwnProperty(f)) { + Object.defineProperty(this, f, {writable: false, value: eventInitDict[f], enumerable: true}); + } + } + } +}); + +// node_modules/has-symbols/shams.js +var require_shams = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function hasSymbols() { + if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") { + return false; + } + if (typeof Symbol.iterator === "symbol") { + return true; + } + var obj = {}; + var sym = Symbol("test"); + var symObj = Object(sym); + if (typeof sym === "string") { + return false; + } + if (Object.prototype.toString.call(sym) !== "[object Symbol]") { + return false; + } + if (Object.prototype.toString.call(symObj) !== "[object Symbol]") { + return false; + } + var symVal = 42; + obj[sym] = symVal; + for (sym in obj) { + return false; + } + if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) { + return false; + } + if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) { + return false; + } + var syms = Object.getOwnPropertySymbols(obj); + if (syms.length !== 1 || syms[0] !== sym) { + return false; + } + if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { + return false; + } + if (typeof Object.getOwnPropertyDescriptor === "function") { + var descriptor = Object.getOwnPropertyDescriptor(obj, sym); + if (descriptor.value !== symVal || descriptor.enumerable !== true) { + return false; + } + } + return true; + }; +}); + +// node_modules/has-symbols/index.js +var require_has_symbols = __commonJS((exports2, module2) => { + "use strict"; + var origSymbol = typeof Symbol !== "undefined" && Symbol; + var hasSymbolSham = require_shams(); + module2.exports = function hasNativeSymbols() { + if (typeof origSymbol !== "function") { + return false; + } + if (typeof Symbol !== "function") { + return false; + } + if (typeof origSymbol("foo") !== "symbol") { + return false; + } + if (typeof Symbol("bar") !== "symbol") { + return false; + } + return hasSymbolSham(); + }; +}); + +// node_modules/function-bind/implementation.js +var require_implementation = __commonJS((exports2, module2) => { + "use strict"; + var ERROR_MESSAGE = "Function.prototype.bind called on incompatible "; + var slice = Array.prototype.slice; + var toStr = Object.prototype.toString; + var funcType = "[object Function]"; + module2.exports = function bind(that) { + var target = this; + if (typeof target !== "function" || toStr.call(target) !== funcType) { + throw new TypeError(ERROR_MESSAGE + target); + } + var args = slice.call(arguments, 1); + var bound; + var binder = function() { + if (this instanceof bound) { + var result = target.apply(this, args.concat(slice.call(arguments))); + if (Object(result) === result) { + return result; + } + return this; + } else { + return target.apply(that, args.concat(slice.call(arguments))); + } + }; + var boundLength = Math.max(0, target.length - args.length); + var boundArgs = []; + for (var i = 0; i < boundLength; i++) { + boundArgs.push("$" + i); + } + bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder); + if (target.prototype) { + var Empty = function Empty2() { + }; + Empty.prototype = target.prototype; + bound.prototype = new Empty(); + Empty.prototype = null; + } + return bound; + }; +}); + +// node_modules/function-bind/index.js +var require_function_bind = __commonJS((exports2, module2) => { + "use strict"; + var implementation = require_implementation(); + module2.exports = Function.prototype.bind || implementation; +}); + +// node_modules/has/src/index.js +var require_src8 = __commonJS((exports2, module2) => { + "use strict"; + var bind = require_function_bind(); + module2.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); +}); + +// node_modules/get-intrinsic/index.js +var require_get_intrinsic = __commonJS((exports2, module2) => { + "use strict"; + var undefined2; + var $SyntaxError = SyntaxError; + var $Function = Function; + var $TypeError = TypeError; + var getEvalledConstructor = function(expressionSyntax) { + try { + return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")(); + } catch (e) { + } + }; + var $gOPD = Object.getOwnPropertyDescriptor; + if ($gOPD) { + try { + $gOPD({}, ""); + } catch (e) { + $gOPD = null; + } + } + var throwTypeError = function() { + throw new $TypeError(); + }; + var ThrowTypeError = $gOPD ? function() { + try { + arguments.callee; + return throwTypeError; + } catch (calleeThrows) { + try { + return $gOPD(arguments, "callee").get; + } catch (gOPDthrows) { + return throwTypeError; + } + } + }() : throwTypeError; + var hasSymbols = require_has_symbols()(); + var getProto = Object.getPrototypeOf || function(x) { + return x.__proto__; + }; + var needsEval = {}; + var TypedArray = typeof Uint8Array === "undefined" ? undefined2 : getProto(Uint8Array); + var INTRINSICS = { + "%AggregateError%": typeof AggregateError === "undefined" ? undefined2 : AggregateError, + "%Array%": Array, + "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined2 : ArrayBuffer, + "%ArrayIteratorPrototype%": hasSymbols ? getProto([][Symbol.iterator]()) : undefined2, + "%AsyncFromSyncIteratorPrototype%": undefined2, + "%AsyncFunction%": needsEval, + "%AsyncGenerator%": needsEval, + "%AsyncGeneratorFunction%": needsEval, + "%AsyncIteratorPrototype%": needsEval, + "%Atomics%": typeof Atomics === "undefined" ? undefined2 : Atomics, + "%BigInt%": typeof BigInt === "undefined" ? undefined2 : BigInt, + "%Boolean%": Boolean, + "%DataView%": typeof DataView === "undefined" ? undefined2 : DataView, + "%Date%": Date, + "%decodeURI%": decodeURI, + "%decodeURIComponent%": decodeURIComponent, + "%encodeURI%": encodeURI, + "%encodeURIComponent%": encodeURIComponent, + "%Error%": Error, + "%eval%": eval, + "%EvalError%": EvalError, + "%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array, + "%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array, + "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined2 : FinalizationRegistry, + "%Function%": $Function, + "%GeneratorFunction%": needsEval, + "%Int8Array%": typeof Int8Array === "undefined" ? undefined2 : Int8Array, + "%Int16Array%": typeof Int16Array === "undefined" ? undefined2 : Int16Array, + "%Int32Array%": typeof Int32Array === "undefined" ? undefined2 : Int32Array, + "%isFinite%": isFinite, + "%isNaN%": isNaN, + "%IteratorPrototype%": hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined2, + "%JSON%": typeof JSON === "object" ? JSON : undefined2, + "%Map%": typeof Map === "undefined" ? undefined2 : Map, + "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols ? undefined2 : getProto(new Map()[Symbol.iterator]()), + "%Math%": Math, + "%Number%": Number, + "%Object%": Object, + "%parseFloat%": parseFloat, + "%parseInt%": parseInt, + "%Promise%": typeof Promise === "undefined" ? undefined2 : Promise, + "%Proxy%": typeof Proxy === "undefined" ? undefined2 : Proxy, + "%RangeError%": RangeError, + "%ReferenceError%": ReferenceError, + "%Reflect%": typeof Reflect === "undefined" ? undefined2 : Reflect, + "%RegExp%": RegExp, + "%Set%": typeof Set === "undefined" ? undefined2 : Set, + "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols ? undefined2 : getProto(new Set()[Symbol.iterator]()), + "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined2 : SharedArrayBuffer, + "%String%": String, + "%StringIteratorPrototype%": hasSymbols ? getProto(""[Symbol.iterator]()) : undefined2, + "%Symbol%": hasSymbols ? Symbol : undefined2, + "%SyntaxError%": $SyntaxError, + "%ThrowTypeError%": ThrowTypeError, + "%TypedArray%": TypedArray, + "%TypeError%": $TypeError, + "%Uint8Array%": typeof Uint8Array === "undefined" ? undefined2 : Uint8Array, + "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined2 : Uint8ClampedArray, + "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined2 : Uint16Array, + "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined2 : Uint32Array, + "%URIError%": URIError, + "%WeakMap%": typeof WeakMap === "undefined" ? undefined2 : WeakMap, + "%WeakRef%": typeof WeakRef === "undefined" ? undefined2 : WeakRef, + "%WeakSet%": typeof WeakSet === "undefined" ? undefined2 : WeakSet + }; + var doEval = function doEval2(name) { + var value; + if (name === "%AsyncFunction%") { + value = getEvalledConstructor("async function () {}"); + } else if (name === "%GeneratorFunction%") { + value = getEvalledConstructor("function* () {}"); + } else if (name === "%AsyncGeneratorFunction%") { + value = getEvalledConstructor("async function* () {}"); + } else if (name === "%AsyncGenerator%") { + var fn = doEval2("%AsyncGeneratorFunction%"); + if (fn) { + value = fn.prototype; + } + } else if (name === "%AsyncIteratorPrototype%") { + var gen = doEval2("%AsyncGenerator%"); + if (gen) { + value = getProto(gen.prototype); + } + } + INTRINSICS[name] = value; + return value; + }; + var LEGACY_ALIASES = { + "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"], + "%ArrayPrototype%": ["Array", "prototype"], + "%ArrayProto_entries%": ["Array", "prototype", "entries"], + "%ArrayProto_forEach%": ["Array", "prototype", "forEach"], + "%ArrayProto_keys%": ["Array", "prototype", "keys"], + "%ArrayProto_values%": ["Array", "prototype", "values"], + "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"], + "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"], + "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"], + "%BooleanPrototype%": ["Boolean", "prototype"], + "%DataViewPrototype%": ["DataView", "prototype"], + "%DatePrototype%": ["Date", "prototype"], + "%ErrorPrototype%": ["Error", "prototype"], + "%EvalErrorPrototype%": ["EvalError", "prototype"], + "%Float32ArrayPrototype%": ["Float32Array", "prototype"], + "%Float64ArrayPrototype%": ["Float64Array", "prototype"], + "%FunctionPrototype%": ["Function", "prototype"], + "%Generator%": ["GeneratorFunction", "prototype"], + "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"], + "%Int8ArrayPrototype%": ["Int8Array", "prototype"], + "%Int16ArrayPrototype%": ["Int16Array", "prototype"], + "%Int32ArrayPrototype%": ["Int32Array", "prototype"], + "%JSONParse%": ["JSON", "parse"], + "%JSONStringify%": ["JSON", "stringify"], + "%MapPrototype%": ["Map", "prototype"], + "%NumberPrototype%": ["Number", "prototype"], + "%ObjectPrototype%": ["Object", "prototype"], + "%ObjProto_toString%": ["Object", "prototype", "toString"], + "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"], + "%PromisePrototype%": ["Promise", "prototype"], + "%PromiseProto_then%": ["Promise", "prototype", "then"], + "%Promise_all%": ["Promise", "all"], + "%Promise_reject%": ["Promise", "reject"], + "%Promise_resolve%": ["Promise", "resolve"], + "%RangeErrorPrototype%": ["RangeError", "prototype"], + "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"], + "%RegExpPrototype%": ["RegExp", "prototype"], + "%SetPrototype%": ["Set", "prototype"], + "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"], + "%StringPrototype%": ["String", "prototype"], + "%SymbolPrototype%": ["Symbol", "prototype"], + "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"], + "%TypedArrayPrototype%": ["TypedArray", "prototype"], + "%TypeErrorPrototype%": ["TypeError", "prototype"], + "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"], + "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"], + "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"], + "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"], + "%URIErrorPrototype%": ["URIError", "prototype"], + "%WeakMapPrototype%": ["WeakMap", "prototype"], + "%WeakSetPrototype%": ["WeakSet", "prototype"] + }; + var bind = require_function_bind(); + var hasOwn = require_src8(); + var $concat = bind.call(Function.call, Array.prototype.concat); + var $spliceApply = bind.call(Function.apply, Array.prototype.splice); + var $replace = bind.call(Function.call, String.prototype.replace); + var $strSlice = bind.call(Function.call, String.prototype.slice); + var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; + var reEscapeChar = /\\(\\)?/g; + var stringToPath = function stringToPath2(string) { + var first = $strSlice(string, 0, 1); + var last = $strSlice(string, -1); + if (first === "%" && last !== "%") { + throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`"); + } else if (last === "%" && first !== "%") { + throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`"); + } + var result = []; + $replace(string, rePropName, function(match, number, quote, subString) { + result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match; + }); + return result; + }; + var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) { + var intrinsicName = name; + var alias; + if (hasOwn(LEGACY_ALIASES, intrinsicName)) { + alias = LEGACY_ALIASES[intrinsicName]; + intrinsicName = "%" + alias[0] + "%"; + } + if (hasOwn(INTRINSICS, intrinsicName)) { + var value = INTRINSICS[intrinsicName]; + if (value === needsEval) { + value = doEval(intrinsicName); + } + if (typeof value === "undefined" && !allowMissing) { + throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!"); + } + return { + alias, + name: intrinsicName, + value + }; + } + throw new $SyntaxError("intrinsic " + name + " does not exist!"); + }; + module2.exports = function GetIntrinsic(name, allowMissing) { + if (typeof name !== "string" || name.length === 0) { + throw new $TypeError("intrinsic name must be a non-empty string"); + } + if (arguments.length > 1 && typeof allowMissing !== "boolean") { + throw new $TypeError('"allowMissing" argument must be a boolean'); + } + var parts = stringToPath(name); + var intrinsicBaseName = parts.length > 0 ? parts[0] : ""; + var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing); + var intrinsicRealName = intrinsic.name; + var value = intrinsic.value; + var skipFurtherCaching = false; + var alias = intrinsic.alias; + if (alias) { + intrinsicBaseName = alias[0]; + $spliceApply(parts, $concat([0, 1], alias)); + } + for (var i = 1, isOwn = true; i < parts.length; i += 1) { + var part = parts[i]; + var first = $strSlice(part, 0, 1); + var last = $strSlice(part, -1); + if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) { + throw new $SyntaxError("property names with quotes must have matching quotes"); + } + if (part === "constructor" || !isOwn) { + skipFurtherCaching = true; + } + intrinsicBaseName += "." + part; + intrinsicRealName = "%" + intrinsicBaseName + "%"; + if (hasOwn(INTRINSICS, intrinsicRealName)) { + value = INTRINSICS[intrinsicRealName]; + } else if (value != null) { + if (!(part in value)) { + if (!allowMissing) { + throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available."); + } + return void 0; + } + if ($gOPD && i + 1 >= parts.length) { + var desc = $gOPD(value, part); + isOwn = !!desc; + if (isOwn && "get" in desc && !("originalValue" in desc.get)) { + value = desc.get; + } else { + value = value[part]; + } + } else { + isOwn = hasOwn(value, part); + value = value[part]; + } + if (isOwn && !skipFurtherCaching) { + INTRINSICS[intrinsicRealName] = value; + } + } + } + return value; + }; +}); + +// node_modules/call-bind/index.js +var require_call_bind = __commonJS((exports2, module2) => { + "use strict"; + var bind = require_function_bind(); + var GetIntrinsic = require_get_intrinsic(); + var $apply = GetIntrinsic("%Function.prototype.apply%"); + var $call = GetIntrinsic("%Function.prototype.call%"); + var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply); + var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true); + var $defineProperty = GetIntrinsic("%Object.defineProperty%", true); + var $max = GetIntrinsic("%Math.max%"); + if ($defineProperty) { + try { + $defineProperty({}, "a", {value: 1}); + } catch (e) { + $defineProperty = null; + } + } + module2.exports = function callBind(originalFunction) { + var func = $reflectApply(bind, $call, arguments); + if ($gOPD && $defineProperty) { + var desc = $gOPD(func, "length"); + if (desc.configurable) { + $defineProperty(func, "length", {value: 1 + $max(0, originalFunction.length - (arguments.length - 1))}); + } + } + return func; + }; + var applyBind = function applyBind2() { + return $reflectApply(bind, $apply, arguments); + }; + if ($defineProperty) { + $defineProperty(module2.exports, "apply", {value: applyBind}); + } else { + module2.exports.apply = applyBind; + } +}); + +// node_modules/call-bind/callBound.js +var require_callBound = __commonJS((exports2, module2) => { + "use strict"; + var GetIntrinsic = require_get_intrinsic(); + var callBind = require_call_bind(); + var $indexOf = callBind(GetIntrinsic("String.prototype.indexOf")); + module2.exports = function callBoundIntrinsic(name, allowMissing) { + var intrinsic = GetIntrinsic(name, !!allowMissing); + if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) { + return callBind(intrinsic); + } + return intrinsic; + }; +}); + +// node_modules/object-inspect/util.inspect.js +var require_util_inspect = __commonJS((exports2, module2) => { + module2.exports = require("util").inspect; +}); + +// node_modules/object-inspect/index.js +var require_object_inspect = __commonJS((exports2, module2) => { + var hasMap = typeof Map === "function" && Map.prototype; + var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null; + var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === "function" ? mapSizeDescriptor.get : null; + var mapForEach = hasMap && Map.prototype.forEach; + var hasSet = typeof Set === "function" && Set.prototype; + var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null; + var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === "function" ? setSizeDescriptor.get : null; + var setForEach = hasSet && Set.prototype.forEach; + var hasWeakMap = typeof WeakMap === "function" && WeakMap.prototype; + var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null; + var hasWeakSet = typeof WeakSet === "function" && WeakSet.prototype; + var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null; + var booleanValueOf = Boolean.prototype.valueOf; + var objectToString = Object.prototype.toString; + var functionToString = Function.prototype.toString; + var match = String.prototype.match; + var bigIntValueOf = typeof BigInt === "function" ? BigInt.prototype.valueOf : null; + var gOPS = Object.getOwnPropertySymbols; + var symToString = typeof Symbol === "function" ? Symbol.prototype.toString : null; + var isEnumerable = Object.prototype.propertyIsEnumerable; + var inspectCustom = require_util_inspect().custom; + var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null; + module2.exports = function inspect_(obj, options, depth, seen) { + var opts = options || {}; + if (has(opts, "quoteStyle") && (opts.quoteStyle !== "single" && opts.quoteStyle !== "double")) { + throw new TypeError('option "quoteStyle" must be "single" or "double"'); + } + if (has(opts, "maxStringLength") && (typeof opts.maxStringLength === "number" ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity : opts.maxStringLength !== null)) { + throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`'); + } + var customInspect = has(opts, "customInspect") ? opts.customInspect : true; + if (typeof customInspect !== "boolean") { + throw new TypeError('option "customInspect", if provided, must be `true` or `false`'); + } + if (has(opts, "indent") && opts.indent !== null && opts.indent !== " " && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)) { + throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`'); + } + if (typeof obj === "undefined") { + return "undefined"; + } + if (obj === null) { + return "null"; + } + if (typeof obj === "boolean") { + return obj ? "true" : "false"; + } + if (typeof obj === "string") { + return inspectString(obj, opts); + } + if (typeof obj === "number") { + if (obj === 0) { + return Infinity / obj > 0 ? "0" : "-0"; + } + return String(obj); + } + if (typeof obj === "bigint") { + return String(obj) + "n"; + } + var maxDepth = typeof opts.depth === "undefined" ? 5 : opts.depth; + if (typeof depth === "undefined") { + depth = 0; + } + if (depth >= maxDepth && maxDepth > 0 && typeof obj === "object") { + return isArray(obj) ? "[Array]" : "[Object]"; + } + var indent = getIndent(opts, depth); + if (typeof seen === "undefined") { + seen = []; + } else if (indexOf(seen, obj) >= 0) { + return "[Circular]"; + } + function inspect(value, from, noIndent) { + if (from) { + seen = seen.slice(); + seen.push(from); + } + if (noIndent) { + var newOpts = { + depth: opts.depth + }; + if (has(opts, "quoteStyle")) { + newOpts.quoteStyle = opts.quoteStyle; + } + return inspect_(value, newOpts, depth + 1, seen); + } + return inspect_(value, opts, depth + 1, seen); + } + if (typeof obj === "function") { + var name = nameOf(obj); + var keys = arrObjKeys(obj, inspect); + return "[Function" + (name ? ": " + name : " (anonymous)") + "]" + (keys.length > 0 ? " { " + keys.join(", ") + " }" : ""); + } + if (isSymbol(obj)) { + var symString = symToString.call(obj); + return typeof obj === "object" ? markBoxed(symString) : symString; + } + if (isElement(obj)) { + var s = "<" + String(obj.nodeName).toLowerCase(); + var attrs = obj.attributes || []; + for (var i = 0; i < attrs.length; i++) { + s += " " + attrs[i].name + "=" + wrapQuotes(quote(attrs[i].value), "double", opts); + } + s += ">"; + if (obj.childNodes && obj.childNodes.length) { + s += "..."; + } + s += "" + String(obj.nodeName).toLowerCase() + ">"; + return s; + } + if (isArray(obj)) { + if (obj.length === 0) { + return "[]"; + } + var xs = arrObjKeys(obj, inspect); + if (indent && !singleLineValues(xs)) { + return "[" + indentedJoin(xs, indent) + "]"; + } + return "[ " + xs.join(", ") + " ]"; + } + if (isError(obj)) { + var parts = arrObjKeys(obj, inspect); + if (parts.length === 0) { + return "[" + String(obj) + "]"; + } + return "{ [" + String(obj) + "] " + parts.join(", ") + " }"; + } + if (typeof obj === "object" && customInspect) { + if (inspectSymbol && typeof obj[inspectSymbol] === "function") { + return obj[inspectSymbol](); + } else if (typeof obj.inspect === "function") { + return obj.inspect(); + } + } + if (isMap(obj)) { + var mapParts = []; + mapForEach.call(obj, function(value, key) { + mapParts.push(inspect(key, obj, true) + " => " + inspect(value, obj)); + }); + return collectionOf("Map", mapSize.call(obj), mapParts, indent); + } + if (isSet(obj)) { + var setParts = []; + setForEach.call(obj, function(value) { + setParts.push(inspect(value, obj)); + }); + return collectionOf("Set", setSize.call(obj), setParts, indent); + } + if (isWeakMap(obj)) { + return weakCollectionOf("WeakMap"); + } + if (isWeakSet(obj)) { + return weakCollectionOf("WeakSet"); + } + if (isNumber(obj)) { + return markBoxed(inspect(Number(obj))); + } + if (isBigInt(obj)) { + return markBoxed(inspect(bigIntValueOf.call(obj))); + } + if (isBoolean(obj)) { + return markBoxed(booleanValueOf.call(obj)); + } + if (isString(obj)) { + return markBoxed(inspect(String(obj))); + } + if (!isDate(obj) && !isRegExp(obj)) { + var ys = arrObjKeys(obj, inspect); + if (ys.length === 0) { + return "{}"; + } + if (indent) { + return "{" + indentedJoin(ys, indent) + "}"; + } + return "{ " + ys.join(", ") + " }"; + } + return String(obj); + }; + function wrapQuotes(s, defaultStyle, opts) { + var quoteChar = (opts.quoteStyle || defaultStyle) === "double" ? '"' : "'"; + return quoteChar + s + quoteChar; + } + function quote(s) { + return String(s).replace(/"/g, """); + } + function isArray(obj) { + return toStr(obj) === "[object Array]"; + } + function isDate(obj) { + return toStr(obj) === "[object Date]"; + } + function isRegExp(obj) { + return toStr(obj) === "[object RegExp]"; + } + function isError(obj) { + return toStr(obj) === "[object Error]"; + } + function isSymbol(obj) { + return toStr(obj) === "[object Symbol]"; + } + function isString(obj) { + return toStr(obj) === "[object String]"; + } + function isNumber(obj) { + return toStr(obj) === "[object Number]"; + } + function isBigInt(obj) { + return toStr(obj) === "[object BigInt]"; + } + function isBoolean(obj) { + return toStr(obj) === "[object Boolean]"; + } + var hasOwn = Object.prototype.hasOwnProperty || function(key) { + return key in this; + }; + function has(obj, key) { + return hasOwn.call(obj, key); + } + function toStr(obj) { + return objectToString.call(obj); + } + function nameOf(f) { + if (f.name) { + return f.name; + } + var m = match.call(functionToString.call(f), /^function\s*([\w$]+)/); + if (m) { + return m[1]; + } + return null; + } + function indexOf(xs, x) { + if (xs.indexOf) { + return xs.indexOf(x); + } + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) { + return i; + } + } + return -1; + } + function isMap(x) { + if (!mapSize || !x || typeof x !== "object") { + return false; + } + try { + mapSize.call(x); + try { + setSize.call(x); + } catch (s) { + return true; + } + return x instanceof Map; + } catch (e) { + } + return false; + } + function isWeakMap(x) { + if (!weakMapHas || !x || typeof x !== "object") { + return false; + } + try { + weakMapHas.call(x, weakMapHas); + try { + weakSetHas.call(x, weakSetHas); + } catch (s) { + return true; + } + return x instanceof WeakMap; + } catch (e) { + } + return false; + } + function isSet(x) { + if (!setSize || !x || typeof x !== "object") { + return false; + } + try { + setSize.call(x); + try { + mapSize.call(x); + } catch (m) { + return true; + } + return x instanceof Set; + } catch (e) { + } + return false; + } + function isWeakSet(x) { + if (!weakSetHas || !x || typeof x !== "object") { + return false; + } + try { + weakSetHas.call(x, weakSetHas); + try { + weakMapHas.call(x, weakMapHas); + } catch (s) { + return true; + } + return x instanceof WeakSet; + } catch (e) { + } + return false; + } + function isElement(x) { + if (!x || typeof x !== "object") { + return false; + } + if (typeof HTMLElement !== "undefined" && x instanceof HTMLElement) { + return true; + } + return typeof x.nodeName === "string" && typeof x.getAttribute === "function"; + } + function inspectString(str, opts) { + if (str.length > opts.maxStringLength) { + var remaining = str.length - opts.maxStringLength; + var trailer = "... " + remaining + " more character" + (remaining > 1 ? "s" : ""); + return inspectString(str.slice(0, opts.maxStringLength), opts) + trailer; + } + var s = str.replace(/(['\\])/g, "\\$1").replace(/[\x00-\x1f]/g, lowbyte); + return wrapQuotes(s, "single", opts); + } + function lowbyte(c) { + var n = c.charCodeAt(0); + var x = { + 8: "b", + 9: "t", + 10: "n", + 12: "f", + 13: "r" + }[n]; + if (x) { + return "\\" + x; + } + return "\\x" + (n < 16 ? "0" : "") + n.toString(16).toUpperCase(); + } + function markBoxed(str) { + return "Object(" + str + ")"; + } + function weakCollectionOf(type) { + return type + " { ? }"; + } + function collectionOf(type, size, entries, indent) { + var joinedEntries = indent ? indentedJoin(entries, indent) : entries.join(", "); + return type + " (" + size + ") {" + joinedEntries + "}"; + } + function singleLineValues(xs) { + for (var i = 0; i < xs.length; i++) { + if (indexOf(xs[i], "\n") >= 0) { + return false; + } + } + return true; + } + function getIndent(opts, depth) { + var baseIndent; + if (opts.indent === " ") { + baseIndent = " "; + } else if (typeof opts.indent === "number" && opts.indent > 0) { + baseIndent = Array(opts.indent + 1).join(" "); + } else { + return null; + } + return { + base: baseIndent, + prev: Array(depth + 1).join(baseIndent) + }; + } + function indentedJoin(xs, indent) { + if (xs.length === 0) { + return ""; + } + var lineJoiner = "\n" + indent.prev + indent.base; + return lineJoiner + xs.join("," + lineJoiner) + "\n" + indent.prev; + } + function arrObjKeys(obj, inspect) { + var isArr = isArray(obj); + var xs = []; + if (isArr) { + xs.length = obj.length; + for (var i = 0; i < obj.length; i++) { + xs[i] = has(obj, i) ? inspect(obj[i], obj) : ""; + } + } + for (var key in obj) { + if (!has(obj, key)) { + continue; + } + if (isArr && String(Number(key)) === key && key < obj.length) { + continue; + } + if (/[^\w$]/.test(key)) { + xs.push(inspect(key, obj) + ": " + inspect(obj[key], obj)); + } else { + xs.push(key + ": " + inspect(obj[key], obj)); + } + } + if (typeof gOPS === "function") { + var syms = gOPS(obj); + for (var j = 0; j < syms.length; j++) { + if (isEnumerable.call(obj, syms[j])) { + xs.push("[" + inspect(syms[j]) + "]: " + inspect(obj[syms[j]], obj)); + } + } + } + return xs; + } +}); + +// node_modules/side-channel/index.js +var require_side_channel = __commonJS((exports2, module2) => { + "use strict"; + var GetIntrinsic = require_get_intrinsic(); + var callBound = require_callBound(); + var inspect = require_object_inspect(); + var $TypeError = GetIntrinsic("%TypeError%"); + var $WeakMap = GetIntrinsic("%WeakMap%", true); + var $Map = GetIntrinsic("%Map%", true); + var $weakMapGet = callBound("WeakMap.prototype.get", true); + var $weakMapSet = callBound("WeakMap.prototype.set", true); + var $weakMapHas = callBound("WeakMap.prototype.has", true); + var $mapGet = callBound("Map.prototype.get", true); + var $mapSet = callBound("Map.prototype.set", true); + var $mapHas = callBound("Map.prototype.has", true); + var listGetNode = function(list, key) { + for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) { + if (curr.key === key) { + prev.next = curr.next; + curr.next = list.next; + list.next = curr; + return curr; + } + } + }; + var listGet = function(objects, key) { + var node = listGetNode(objects, key); + return node && node.value; + }; + var listSet = function(objects, key, value) { + var node = listGetNode(objects, key); + if (node) { + node.value = value; + } else { + objects.next = { + key, + next: objects.next, + value + }; + } + }; + var listHas = function(objects, key) { + return !!listGetNode(objects, key); + }; + module2.exports = function getSideChannel() { + var $wm; + var $m; + var $o; + var channel = { + assert: function(key) { + if (!channel.has(key)) { + throw new $TypeError("Side channel does not contain " + inspect(key)); + } + }, + get: function(key) { + if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) { + if ($wm) { + return $weakMapGet($wm, key); + } + } else if ($Map) { + if ($m) { + return $mapGet($m, key); + } + } else { + if ($o) { + return listGet($o, key); + } + } + }, + has: function(key) { + if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) { + if ($wm) { + return $weakMapHas($wm, key); + } + } else if ($Map) { + if ($m) { + return $mapHas($m, key); + } + } else { + if ($o) { + return listHas($o, key); + } + } + return false; + }, + set: function(key, value) { + if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) { + if (!$wm) { + $wm = new $WeakMap(); + } + $weakMapSet($wm, key, value); + } else if ($Map) { + if (!$m) { + $m = new $Map(); + } + $mapSet($m, key, value); + } else { + if (!$o) { + $o = {key: {}, next: null}; + } + listSet($o, key, value); + } + } + }; + return channel; + }; +}); + +// node_modules/superagent/node_modules/qs/lib/formats.js +var require_formats2 = __commonJS((exports2, module2) => { + "use strict"; + var replace = String.prototype.replace; + var percentTwenties = /%20/g; + var Format = { + RFC1738: "RFC1738", + RFC3986: "RFC3986" + }; + module2.exports = { + default: Format.RFC3986, + formatters: { + RFC1738: function(value) { + return replace.call(value, percentTwenties, "+"); + }, + RFC3986: function(value) { + return String(value); + } + }, + RFC1738: Format.RFC1738, + RFC3986: Format.RFC3986 + }; +}); + +// node_modules/superagent/node_modules/qs/lib/utils.js +var require_utils7 = __commonJS((exports2, module2) => { + "use strict"; + var formats = require_formats2(); + var has = Object.prototype.hasOwnProperty; + var isArray = Array.isArray; + var hexTable = function() { + var array = []; + for (var i = 0; i < 256; ++i) { + array.push("%" + ((i < 16 ? "0" : "") + i.toString(16)).toUpperCase()); + } + return array; + }(); + var compactQueue = function compactQueue2(queue) { + while (queue.length > 1) { + var item = queue.pop(); + var obj = item.obj[item.prop]; + if (isArray(obj)) { + var compacted = []; + for (var j = 0; j < obj.length; ++j) { + if (typeof obj[j] !== "undefined") { + compacted.push(obj[j]); + } + } + item.obj[item.prop] = compacted; + } + } + }; + var arrayToObject = function arrayToObject2(source, options) { + var obj = options && options.plainObjects ? Object.create(null) : {}; + for (var i = 0; i < source.length; ++i) { + if (typeof source[i] !== "undefined") { + obj[i] = source[i]; + } + } + return obj; + }; + var merge = function merge2(target, source, options) { + if (!source) { + return target; + } + if (typeof source !== "object") { + if (isArray(target)) { + target.push(source); + } else if (target && typeof target === "object") { + if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) { + target[source] = true; + } + } else { + return [target, source]; + } + return target; + } + if (!target || typeof target !== "object") { + return [target].concat(source); + } + var mergeTarget = target; + if (isArray(target) && !isArray(source)) { + mergeTarget = arrayToObject(target, options); + } + if (isArray(target) && isArray(source)) { + source.forEach(function(item, i) { + if (has.call(target, i)) { + var targetItem = target[i]; + if (targetItem && typeof targetItem === "object" && item && typeof item === "object") { + target[i] = merge2(targetItem, item, options); + } else { + target.push(item); + } + } else { + target[i] = item; + } + }); + return target; + } + return Object.keys(source).reduce(function(acc, key) { + var value = source[key]; + if (has.call(acc, key)) { + acc[key] = merge2(acc[key], value, options); + } else { + acc[key] = value; + } + return acc; + }, mergeTarget); + }; + var assign = function assignSingleSource(target, source) { + return Object.keys(source).reduce(function(acc, key) { + acc[key] = source[key]; + return acc; + }, target); + }; + var decode = function(str, decoder, charset) { + var strWithoutPlus = str.replace(/\+/g, " "); + if (charset === "iso-8859-1") { + return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape); + } + try { + return decodeURIComponent(strWithoutPlus); + } catch (e) { + return strWithoutPlus; + } + }; + var encode = function encode2(str, defaultEncoder, charset, kind, format) { + if (str.length === 0) { + return str; + } + var string = str; + if (typeof str === "symbol") { + string = Symbol.prototype.toString.call(str); + } else if (typeof str !== "string") { + string = String(str); + } + if (charset === "iso-8859-1") { + return escape(string).replace(/%u[0-9a-f]{4}/gi, function($0) { + return "%26%23" + parseInt($0.slice(2), 16) + "%3B"; + }); + } + var out = ""; + for (var i = 0; i < string.length; ++i) { + var c = string.charCodeAt(i); + if (c === 45 || c === 46 || c === 95 || c === 126 || c >= 48 && c <= 57 || c >= 65 && c <= 90 || c >= 97 && c <= 122 || format === formats.RFC1738 && (c === 40 || c === 41)) { + out += string.charAt(i); + continue; + } + if (c < 128) { + out = out + hexTable[c]; + continue; + } + if (c < 2048) { + out = out + (hexTable[192 | c >> 6] + hexTable[128 | c & 63]); + continue; + } + if (c < 55296 || c >= 57344) { + out = out + (hexTable[224 | c >> 12] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63]); + continue; + } + i += 1; + c = 65536 + ((c & 1023) << 10 | string.charCodeAt(i) & 1023); + out += hexTable[240 | c >> 18] + hexTable[128 | c >> 12 & 63] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63]; + } + return out; + }; + var compact = function compact2(value) { + var queue = [{obj: {o: value}, prop: "o"}]; + var refs = []; + for (var i = 0; i < queue.length; ++i) { + var item = queue[i]; + var obj = item.obj[item.prop]; + var keys = Object.keys(obj); + for (var j = 0; j < keys.length; ++j) { + var key = keys[j]; + var val = obj[key]; + if (typeof val === "object" && val !== null && refs.indexOf(val) === -1) { + queue.push({obj, prop: key}); + refs.push(val); + } + } + } + compactQueue(queue); + return value; + }; + var isRegExp = function isRegExp2(obj) { + return Object.prototype.toString.call(obj) === "[object RegExp]"; + }; + var isBuffer = function isBuffer2(obj) { + if (!obj || typeof obj !== "object") { + return false; + } + return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); + }; + var combine = function combine2(a, b) { + return [].concat(a, b); + }; + var maybeMap = function maybeMap2(val, fn) { + if (isArray(val)) { + var mapped = []; + for (var i = 0; i < val.length; i += 1) { + mapped.push(fn(val[i])); + } + return mapped; + } + return fn(val); + }; + module2.exports = { + arrayToObject, + assign, + combine, + compact, + decode, + encode, + isBuffer, + isRegExp, + maybeMap, + merge + }; +}); + +// node_modules/superagent/node_modules/qs/lib/stringify.js +var require_stringify3 = __commonJS((exports2, module2) => { + "use strict"; + var getSideChannel = require_side_channel(); + var utils = require_utils7(); + var formats = require_formats2(); + var has = Object.prototype.hasOwnProperty; + var arrayPrefixGenerators = { + brackets: function brackets(prefix) { + return prefix + "[]"; + }, + comma: "comma", + indices: function indices(prefix, key) { + return prefix + "[" + key + "]"; + }, + repeat: function repeat(prefix) { + return prefix; + } + }; + var isArray = Array.isArray; + var push = Array.prototype.push; + var pushToArray = function(arr, valueOrArray) { + push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]); + }; + var toISO = Date.prototype.toISOString; + var defaultFormat = formats["default"]; + var defaults = { + addQueryPrefix: false, + allowDots: false, + charset: "utf-8", + charsetSentinel: false, + delimiter: "&", + encode: true, + encoder: utils.encode, + encodeValuesOnly: false, + format: defaultFormat, + formatter: formats.formatters[defaultFormat], + indices: false, + serializeDate: function serializeDate(date) { + return toISO.call(date); + }, + skipNulls: false, + strictNullHandling: false + }; + var isNonNullishPrimitive = function isNonNullishPrimitive2(v) { + return typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "bigint"; + }; + var stringify = function stringify2(object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) { + var obj = object; + if (sideChannel.has(object)) { + throw new RangeError("Cyclic object value"); + } + if (typeof filter === "function") { + obj = filter(prefix, obj); + } else if (obj instanceof Date) { + obj = serializeDate(obj); + } else if (generateArrayPrefix === "comma" && isArray(obj)) { + obj = utils.maybeMap(obj, function(value2) { + if (value2 instanceof Date) { + return serializeDate(value2); + } + return value2; + }); + } + if (obj === null) { + if (strictNullHandling) { + return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, "key", format) : prefix; + } + obj = ""; + } + if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) { + if (encoder) { + var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, "key", format); + return [formatter(keyValue) + "=" + formatter(encoder(obj, defaults.encoder, charset, "value", format))]; + } + return [formatter(prefix) + "=" + formatter(String(obj))]; + } + var values = []; + if (typeof obj === "undefined") { + return values; + } + var objKeys; + if (generateArrayPrefix === "comma" && isArray(obj)) { + objKeys = [{value: obj.length > 0 ? obj.join(",") || null : void 0}]; + } else if (isArray(filter)) { + objKeys = filter; + } else { + var keys = Object.keys(obj); + objKeys = sort ? keys.sort(sort) : keys; + } + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + var value = typeof key === "object" && key.value !== void 0 ? key.value : obj[key]; + if (skipNulls && value === null) { + continue; + } + var keyPrefix = isArray(obj) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(prefix, key) : prefix : prefix + (allowDots ? "." + key : "[" + key + "]"); + sideChannel.set(object, true); + var valueSideChannel = getSideChannel(); + pushToArray(values, stringify2(value, keyPrefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel)); + } + return values; + }; + var normalizeStringifyOptions = function normalizeStringifyOptions2(opts) { + if (!opts) { + return defaults; + } + if (opts.encoder !== null && opts.encoder !== void 0 && typeof opts.encoder !== "function") { + throw new TypeError("Encoder has to be a function."); + } + var charset = opts.charset || defaults.charset; + if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") { + throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined"); + } + var format = formats["default"]; + if (typeof opts.format !== "undefined") { + if (!has.call(formats.formatters, opts.format)) { + throw new TypeError("Unknown format option provided."); + } + format = opts.format; + } + var formatter = formats.formatters[format]; + var filter = defaults.filter; + if (typeof opts.filter === "function" || isArray(opts.filter)) { + filter = opts.filter; + } + return { + addQueryPrefix: typeof opts.addQueryPrefix === "boolean" ? opts.addQueryPrefix : defaults.addQueryPrefix, + allowDots: typeof opts.allowDots === "undefined" ? defaults.allowDots : !!opts.allowDots, + charset, + charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel, + delimiter: typeof opts.delimiter === "undefined" ? defaults.delimiter : opts.delimiter, + encode: typeof opts.encode === "boolean" ? opts.encode : defaults.encode, + encoder: typeof opts.encoder === "function" ? opts.encoder : defaults.encoder, + encodeValuesOnly: typeof opts.encodeValuesOnly === "boolean" ? opts.encodeValuesOnly : defaults.encodeValuesOnly, + filter, + format, + formatter, + serializeDate: typeof opts.serializeDate === "function" ? opts.serializeDate : defaults.serializeDate, + skipNulls: typeof opts.skipNulls === "boolean" ? opts.skipNulls : defaults.skipNulls, + sort: typeof opts.sort === "function" ? opts.sort : null, + strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling + }; + }; + module2.exports = function(object, opts) { + var obj = object; + var options = normalizeStringifyOptions(opts); + var objKeys; + var filter; + if (typeof options.filter === "function") { + filter = options.filter; + obj = filter("", obj); + } else if (isArray(options.filter)) { + filter = options.filter; + objKeys = filter; + } + var keys = []; + if (typeof obj !== "object" || obj === null) { + return ""; + } + var arrayFormat; + if (opts && opts.arrayFormat in arrayPrefixGenerators) { + arrayFormat = opts.arrayFormat; + } else if (opts && "indices" in opts) { + arrayFormat = opts.indices ? "indices" : "repeat"; + } else { + arrayFormat = "indices"; + } + var generateArrayPrefix = arrayPrefixGenerators[arrayFormat]; + if (!objKeys) { + objKeys = Object.keys(obj); + } + if (options.sort) { + objKeys.sort(options.sort); + } + var sideChannel = getSideChannel(); + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + if (options.skipNulls && obj[key] === null) { + continue; + } + pushToArray(keys, stringify(obj[key], key, generateArrayPrefix, options.strictNullHandling, options.skipNulls, options.encode ? options.encoder : null, options.filter, options.sort, options.allowDots, options.serializeDate, options.format, options.formatter, options.encodeValuesOnly, options.charset, sideChannel)); + } + var joined = keys.join(options.delimiter); + var prefix = options.addQueryPrefix === true ? "?" : ""; + if (options.charsetSentinel) { + if (options.charset === "iso-8859-1") { + prefix += "utf8=%26%2310003%3B&"; + } else { + prefix += "utf8=%E2%9C%93&"; + } + } + return joined.length > 0 ? prefix + joined : ""; + }; +}); + +// node_modules/superagent/node_modules/qs/lib/parse.js +var require_parse5 = __commonJS((exports2, module2) => { + "use strict"; + var utils = require_utils7(); + var has = Object.prototype.hasOwnProperty; + var isArray = Array.isArray; + var defaults = { + allowDots: false, + allowPrototypes: false, + allowSparse: false, + arrayLimit: 20, + charset: "utf-8", + charsetSentinel: false, + comma: false, + decoder: utils.decode, + delimiter: "&", + depth: 5, + ignoreQueryPrefix: false, + interpretNumericEntities: false, + parameterLimit: 1e3, + parseArrays: true, + plainObjects: false, + strictNullHandling: false + }; + var interpretNumericEntities = function(str) { + return str.replace(/(\d+);/g, function($0, numberStr) { + return String.fromCharCode(parseInt(numberStr, 10)); + }); + }; + var parseArrayValue = function(val, options) { + if (val && typeof val === "string" && options.comma && val.indexOf(",") > -1) { + return val.split(","); + } + return val; + }; + var isoSentinel = "utf8=%26%2310003%3B"; + var charsetSentinel = "utf8=%E2%9C%93"; + var parseValues = function parseQueryStringValues(str, options) { + var obj = {}; + var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, "") : str; + var limit = options.parameterLimit === Infinity ? void 0 : options.parameterLimit; + var parts = cleanStr.split(options.delimiter, limit); + var skipIndex = -1; + var i; + var charset = options.charset; + if (options.charsetSentinel) { + for (i = 0; i < parts.length; ++i) { + if (parts[i].indexOf("utf8=") === 0) { + if (parts[i] === charsetSentinel) { + charset = "utf-8"; + } else if (parts[i] === isoSentinel) { + charset = "iso-8859-1"; + } + skipIndex = i; + i = parts.length; + } + } + } + for (i = 0; i < parts.length; ++i) { + if (i === skipIndex) { + continue; + } + var part = parts[i]; + var bracketEqualsPos = part.indexOf("]="); + var pos = bracketEqualsPos === -1 ? part.indexOf("=") : bracketEqualsPos + 1; + var key, val; + if (pos === -1) { + key = options.decoder(part, defaults.decoder, charset, "key"); + val = options.strictNullHandling ? null : ""; + } else { + key = options.decoder(part.slice(0, pos), defaults.decoder, charset, "key"); + val = utils.maybeMap(parseArrayValue(part.slice(pos + 1), options), function(encodedVal) { + return options.decoder(encodedVal, defaults.decoder, charset, "value"); + }); + } + if (val && options.interpretNumericEntities && charset === "iso-8859-1") { + val = interpretNumericEntities(val); + } + if (part.indexOf("[]=") > -1) { + val = isArray(val) ? [val] : val; + } + if (has.call(obj, key)) { + obj[key] = utils.combine(obj[key], val); + } else { + obj[key] = val; + } + } + return obj; + }; + var parseObject = function(chain, val, options, valuesParsed) { + var leaf = valuesParsed ? val : parseArrayValue(val, options); + for (var i = chain.length - 1; i >= 0; --i) { + var obj; + var root = chain[i]; + if (root === "[]" && options.parseArrays) { + obj = [].concat(leaf); + } else { + obj = options.plainObjects ? Object.create(null) : {}; + var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root; + var index = parseInt(cleanRoot, 10); + if (!options.parseArrays && cleanRoot === "") { + obj = {0: leaf}; + } else if (!isNaN(index) && root !== cleanRoot && String(index) === cleanRoot && index >= 0 && (options.parseArrays && index <= options.arrayLimit)) { + obj = []; + obj[index] = leaf; + } else { + obj[cleanRoot] = leaf; + } + } + leaf = obj; + } + return leaf; + }; + var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) { + if (!givenKey) { + return; + } + var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey; + var brackets = /(\[[^[\]]*])/; + var child = /(\[[^[\]]*])/g; + var segment = options.depth > 0 && brackets.exec(key); + var parent = segment ? key.slice(0, segment.index) : key; + var keys = []; + if (parent) { + if (!options.plainObjects && has.call(Object.prototype, parent)) { + if (!options.allowPrototypes) { + return; + } + } + keys.push(parent); + } + var i = 0; + while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) { + i += 1; + if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { + if (!options.allowPrototypes) { + return; + } + } + keys.push(segment[1]); + } + if (segment) { + keys.push("[" + key.slice(segment.index) + "]"); + } + return parseObject(keys, val, options, valuesParsed); + }; + var normalizeParseOptions = function normalizeParseOptions2(opts) { + if (!opts) { + return defaults; + } + if (opts.decoder !== null && opts.decoder !== void 0 && typeof opts.decoder !== "function") { + throw new TypeError("Decoder has to be a function."); + } + if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") { + throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined"); + } + var charset = typeof opts.charset === "undefined" ? defaults.charset : opts.charset; + return { + allowDots: typeof opts.allowDots === "undefined" ? defaults.allowDots : !!opts.allowDots, + allowPrototypes: typeof opts.allowPrototypes === "boolean" ? opts.allowPrototypes : defaults.allowPrototypes, + allowSparse: typeof opts.allowSparse === "boolean" ? opts.allowSparse : defaults.allowSparse, + arrayLimit: typeof opts.arrayLimit === "number" ? opts.arrayLimit : defaults.arrayLimit, + charset, + charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel, + comma: typeof opts.comma === "boolean" ? opts.comma : defaults.comma, + decoder: typeof opts.decoder === "function" ? opts.decoder : defaults.decoder, + delimiter: typeof opts.delimiter === "string" || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter, + depth: typeof opts.depth === "number" || opts.depth === false ? +opts.depth : defaults.depth, + ignoreQueryPrefix: opts.ignoreQueryPrefix === true, + interpretNumericEntities: typeof opts.interpretNumericEntities === "boolean" ? opts.interpretNumericEntities : defaults.interpretNumericEntities, + parameterLimit: typeof opts.parameterLimit === "number" ? opts.parameterLimit : defaults.parameterLimit, + parseArrays: opts.parseArrays !== false, + plainObjects: typeof opts.plainObjects === "boolean" ? opts.plainObjects : defaults.plainObjects, + strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling + }; + }; + module2.exports = function(str, opts) { + var options = normalizeParseOptions(opts); + if (str === "" || str === null || typeof str === "undefined") { + return options.plainObjects ? Object.create(null) : {}; + } + var tempObj = typeof str === "string" ? parseValues(str, options) : str; + var obj = options.plainObjects ? Object.create(null) : {}; + var keys = Object.keys(tempObj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var newObj = parseKeys(key, tempObj[key], options, typeof str === "string"); + obj = utils.merge(obj, newObj, options); + } + if (options.allowSparse === true) { + return obj; + } + return utils.compact(obj); + }; +}); + +// node_modules/superagent/node_modules/qs/lib/index.js +var require_lib7 = __commonJS((exports2, module2) => { + "use strict"; + var stringify = require_stringify3(); + var parse = require_parse5(); + var formats = require_formats2(); + module2.exports = { + formats, + parse, + stringify + }; +}); + +// node_modules/superagent/node_modules/mime/Mime.js +var require_Mime = __commonJS((exports2, module2) => { + "use strict"; + function Mime() { + this._types = Object.create(null); + this._extensions = Object.create(null); + for (let i = 0; i < arguments.length; i++) { + this.define(arguments[i]); + } + this.define = this.define.bind(this); + this.getType = this.getType.bind(this); + this.getExtension = this.getExtension.bind(this); + } + Mime.prototype.define = function(typeMap, force) { + for (let type in typeMap) { + let extensions = typeMap[type].map(function(t) { + return t.toLowerCase(); + }); + type = type.toLowerCase(); + for (let i = 0; i < extensions.length; i++) { + const ext = extensions[i]; + if (ext[0] === "*") { + continue; + } + if (!force && ext in this._types) { + throw new Error('Attempt to change mapping for "' + ext + '" extension from "' + this._types[ext] + '" to "' + type + '". Pass `force=true` to allow this, otherwise remove "' + ext + '" from the list of extensions for "' + type + '".'); + } + this._types[ext] = type; + } + if (force || !this._extensions[type]) { + const ext = extensions[0]; + this._extensions[type] = ext[0] !== "*" ? ext : ext.substr(1); + } + } + }; + Mime.prototype.getType = function(path) { + path = String(path); + let last = path.replace(/^.*[/\\]/, "").toLowerCase(); + let ext = last.replace(/^.*\./, "").toLowerCase(); + let hasPath = last.length < path.length; + let hasDot = ext.length < last.length - 1; + return (hasDot || !hasPath) && this._types[ext] || null; + }; + Mime.prototype.getExtension = function(type) { + type = /^\s*([^;\s]*)/.test(type) && RegExp.$1; + return type && this._extensions[type.toLowerCase()] || null; + }; + module2.exports = Mime; +}); + +// node_modules/superagent/node_modules/mime/types/standard.js +var require_standard = __commonJS((exports2, module2) => { + module2.exports = {"application/andrew-inset": ["ez"], "application/applixware": ["aw"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomdeleted+xml": ["atomdeleted"], "application/atomsvc+xml": ["atomsvc"], "application/atsc-dwd+xml": ["dwd"], "application/atsc-held+xml": ["held"], "application/atsc-rsat+xml": ["rsat"], "application/bdoc": ["bdoc"], "application/calendar+xml": ["xcs"], "application/ccxml+xml": ["ccxml"], "application/cdfx+xml": ["cdfx"], "application/cdmi-capability": ["cdmia"], "application/cdmi-container": ["cdmic"], "application/cdmi-domain": ["cdmid"], "application/cdmi-object": ["cdmio"], "application/cdmi-queue": ["cdmiq"], "application/cu-seeme": ["cu"], "application/dash+xml": ["mpd"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["ecma", "es"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/fdt+xml": ["fdt"], "application/font-tdpfr": ["pfr"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hjson": ["hjson"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "application/its+xml": ["its"], "application/java-archive": ["jar", "war", "ear"], "application/java-serialized-object": ["ser"], "application/java-vm": ["class"], "application/javascript": ["js", "mjs"], "application/json": ["json", "map"], "application/json5": ["json5"], "application/jsonml+json": ["jsonml"], "application/ld+json": ["jsonld"], "application/lgr+xml": ["lgr"], "application/lost+xml": ["lostxml"], "application/mac-binhex40": ["hqx"], "application/mac-compactpro": ["cpt"], "application/mads+xml": ["mads"], "application/manifest+json": ["webmanifest"], "application/marc": ["mrc"], "application/marcxml+xml": ["mrcx"], "application/mathematica": ["ma", "nb", "mb"], "application/mathml+xml": ["mathml"], "application/mbox": ["mbox"], "application/mediaservercontrol+xml": ["mscml"], "application/metalink+xml": ["metalink"], "application/metalink4+xml": ["meta4"], "application/mets+xml": ["mets"], "application/mmt-aei+xml": ["maei"], "application/mmt-usd+xml": ["musd"], "application/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["mp4s", "m4p"], "application/mrb-consumer+xml": ["*xdf"], "application/mrb-publish+xml": ["*xdf"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "application/n-quads": ["nq"], "application/n-triples": ["nt"], "application/node": ["cjs"], "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"], "application/oda": ["oda"], "application/oebps-package+xml": ["opf"], "application/ogg": ["ogx"], "application/omdoc+xml": ["omdoc"], "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"], "application/oxps": ["oxps"], "application/p2p-overlay+xml": ["relo"], "application/patch-ops-error+xml": ["*xer"], "application/pdf": ["pdf"], "application/pgp-encrypted": ["pgp"], "application/pgp-signature": ["asc", "sig"], "application/pics-rules": ["prf"], "application/pkcs10": ["p10"], "application/pkcs7-mime": ["p7m", "p7c"], "application/pkcs7-signature": ["p7s"], "application/pkcs8": ["p8"], "application/pkix-attr-cert": ["ac"], "application/pkix-cert": ["cer"], "application/pkix-crl": ["crl"], "application/pkix-pkipath": ["pkipath"], "application/pkixcmp": ["pki"], "application/pls+xml": ["pls"], "application/postscript": ["ai", "eps", "ps"], "application/provenance+xml": ["provx"], "application/pskc+xml": ["pskcxml"], "application/raml+yaml": ["raml"], "application/rdf+xml": ["rdf", "owl"], "application/reginfo+xml": ["rif"], "application/relax-ng-compact-syntax": ["rnc"], "application/resource-lists+xml": ["rl"], "application/resource-lists-diff+xml": ["rld"], "application/rls-services+xml": ["rs"], "application/route-apd+xml": ["rapd"], "application/route-s-tsid+xml": ["sls"], "application/route-usd+xml": ["rusd"], "application/rpki-ghostbusters": ["gbr"], "application/rpki-manifest": ["mft"], "application/rpki-roa": ["roa"], "application/rsd+xml": ["rsd"], "application/rss+xml": ["rss"], "application/rtf": ["rtf"], "application/sbml+xml": ["sbml"], "application/scvp-cv-request": ["scq"], "application/scvp-cv-response": ["scs"], "application/scvp-vp-request": ["spq"], "application/scvp-vp-response": ["spp"], "application/sdp": ["sdp"], "application/senml+xml": ["senmlx"], "application/sensml+xml": ["sensmlx"], "application/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "application/sieve": ["siv", "sieve"], "application/smil+xml": ["smi", "smil"], "application/sparql-query": ["rq"], "application/sparql-results+xml": ["srx"], "application/srgs": ["gram"], "application/srgs+xml": ["grxml"], "application/sru+xml": ["sru"], "application/ssdl+xml": ["ssdl"], "application/ssml+xml": ["ssml"], "application/swid+xml": ["swidtag"], "application/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/toml": ["toml"], "application/ttml+xml": ["ttml"], "application/ubjson": ["ubj"], "application/urc-ressheet+xml": ["rsheet"], "application/urc-targetdesc+xml": ["td"], "application/voicexml+xml": ["vxml"], "application/wasm": ["wasm"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-att+xml": ["xav"], "application/xcap-caps+xml": ["xca"], "application/xcap-diff+xml": ["xdf"], "application/xcap-el+xml": ["xel"], "application/xcap-error+xml": ["xer"], "application/xcap-ns+xml": ["xns"], "application/xenc+xml": ["xenc"], "application/xhtml+xml": ["xhtml", "xht"], "application/xliff+xml": ["xlf"], "application/xml": ["xml", "xsl", "xsd", "rng"], "application/xml-dtd": ["dtd"], "application/xop+xml": ["xop"], "application/xproc+xml": ["xpl"], "application/xslt+xml": ["*xsl", "xslt"], "application/xspf+xml": ["xspf"], "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"], "application/yang": ["yang"], "application/yin+xml": ["yin"], "application/zip": ["zip"], "audio/3gpp": ["*3gpp"], "audio/adpcm": ["adp"], "audio/amr": ["amr"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/mobile-xmf": ["mxmf"], "audio/mp3": ["*mp3"], "audio/mp4": ["m4a", "mp4a"], "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], "audio/ogg": ["oga", "ogg", "spx", "opus"], "audio/s3m": ["s3m"], "audio/silk": ["sil"], "audio/wav": ["wav"], "audio/wave": ["*wav"], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/collection": ["ttc"], "font/otf": ["otf"], "font/ttf": ["ttf"], "font/woff": ["woff"], "font/woff2": ["woff2"], "image/aces": ["exr"], "image/apng": ["apng"], "image/avif": ["avif"], "image/bmp": ["bmp"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/emf": ["emf"], "image/fits": ["fits"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/heic": ["heic"], "image/heic-sequence": ["heics"], "image/heif": ["heif"], "image/heif-sequence": ["heifs"], "image/hej2k": ["hej2"], "image/hsj2": ["hsj2"], "image/ief": ["ief"], "image/jls": ["jls"], "image/jp2": ["jp2", "jpg2"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/jph": ["jph"], "image/jphc": ["jhc"], "image/jpm": ["jpm"], "image/jpx": ["jpx", "jpf"], "image/jxr": ["jxr"], "image/jxra": ["jxra"], "image/jxrs": ["jxrs"], "image/jxs": ["jxs"], "image/jxsc": ["jxsc"], "image/jxsi": ["jxsi"], "image/jxss": ["jxss"], "image/ktx": ["ktx"], "image/ktx2": ["ktx2"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/t38": ["t38"], "image/tiff": ["tif", "tiff"], "image/tiff-fx": ["tfx"], "image/webp": ["webp"], "image/wmf": ["wmf"], "message/disposition-notification": ["disposition-notification"], "message/global": ["u8msg"], "message/global-delivery-status": ["u8dsn"], "message/global-disposition-notification": ["u8mdn"], "message/global-headers": ["u8hdr"], "message/rfc822": ["eml", "mime"], "model/3mf": ["3mf"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/stl": ["stl"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["*x3db", "x3dbz"], "model/x3d+fastinfoset": ["x3db"], "model/x3d+vrml": ["*x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "model/x3d-vrml": ["x3dv"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["markdown", "md"], "text/mathml": ["mml"], "text/mdx": ["mdx"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": ["*rtf"], "text/sgml": ["sgml", "sgm"], "text/shex": ["shex"], "text/slim": ["slim", "slm"], "text/spdx": ["spdx"], "text/stylus": ["stylus", "styl"], "text/tab-separated-values": ["tsv"], "text/troff": ["t", "tr", "roff", "man", "me", "ms"], "text/turtle": ["ttl"], "text/uri-list": ["uri", "uris", "urls"], "text/vcard": ["vcard"], "text/vtt": ["vtt"], "text/xml": ["*xml"], "text/yaml": ["yaml", "yml"], "video/3gpp": ["3gp", "3gpp"], "video/3gpp2": ["3g2"], "video/h261": ["h261"], "video/h263": ["h263"], "video/h264": ["h264"], "video/iso.segment": ["m4s"], "video/jpeg": ["jpgv"], "video/jpm": ["*jpm", "jpgm"], "video/mj2": ["mj2", "mjp2"], "video/mp2t": ["ts"], "video/mp4": ["mp4", "mp4v", "mpg4"], "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"], "video/ogg": ["ogv"], "video/quicktime": ["qt", "mov"], "video/webm": ["webm"]}; +}); + +// node_modules/superagent/node_modules/mime/types/other.js +var require_other = __commonJS((exports2, module2) => { + module2.exports = {"application/prs.cww": ["cww"], "application/vnd.1000minds.decision-model+xml": ["1km"], "application/vnd.3gpp.pic-bw-large": ["plb"], "application/vnd.3gpp.pic-bw-small": ["psb"], "application/vnd.3gpp.pic-bw-var": ["pvb"], "application/vnd.3gpp2.tcap": ["tcap"], "application/vnd.3m.post-it-notes": ["pwn"], "application/vnd.accpac.simply.aso": ["aso"], "application/vnd.accpac.simply.imp": ["imp"], "application/vnd.acucobol": ["acu"], "application/vnd.acucorp": ["atc", "acutc"], "application/vnd.adobe.air-application-installer-package+zip": ["air"], "application/vnd.adobe.formscentral.fcdt": ["fcdt"], "application/vnd.adobe.fxp": ["fxp", "fxpl"], "application/vnd.adobe.xdp+xml": ["xdp"], "application/vnd.adobe.xfdf": ["xfdf"], "application/vnd.ahead.space": ["ahead"], "application/vnd.airzip.filesecure.azf": ["azf"], "application/vnd.airzip.filesecure.azs": ["azs"], "application/vnd.amazon.ebook": ["azw"], "application/vnd.americandynamics.acc": ["acc"], "application/vnd.amiga.ami": ["ami"], "application/vnd.android.package-archive": ["apk"], "application/vnd.anser-web-certificate-issue-initiation": ["cii"], "application/vnd.anser-web-funds-transfer-initiation": ["fti"], "application/vnd.antix.game-component": ["atx"], "application/vnd.apple.installer+xml": ["mpkg"], "application/vnd.apple.keynote": ["key"], "application/vnd.apple.mpegurl": ["m3u8"], "application/vnd.apple.numbers": ["numbers"], "application/vnd.apple.pages": ["pages"], "application/vnd.apple.pkpass": ["pkpass"], "application/vnd.aristanetworks.swi": ["swi"], "application/vnd.astraea-software.iota": ["iota"], "application/vnd.audiograph": ["aep"], "application/vnd.balsamiq.bmml+xml": ["bmml"], "application/vnd.blueice.multipass": ["mpm"], "application/vnd.bmi": ["bmi"], "application/vnd.businessobjects": ["rep"], "application/vnd.chemdraw+xml": ["cdxml"], "application/vnd.chipnuts.karaoke-mmd": ["mmd"], "application/vnd.cinderella": ["cdy"], "application/vnd.citationstyles.style+xml": ["csl"], "application/vnd.claymore": ["cla"], "application/vnd.cloanto.rp9": ["rp9"], "application/vnd.clonk.c4group": ["c4g", "c4d", "c4f", "c4p", "c4u"], "application/vnd.cluetrust.cartomobile-config": ["c11amc"], "application/vnd.cluetrust.cartomobile-config-pkg": ["c11amz"], "application/vnd.commonspace": ["csp"], "application/vnd.contact.cmsg": ["cdbcmsg"], "application/vnd.cosmocaller": ["cmc"], "application/vnd.crick.clicker": ["clkx"], "application/vnd.crick.clicker.keyboard": ["clkk"], "application/vnd.crick.clicker.palette": ["clkp"], "application/vnd.crick.clicker.template": ["clkt"], "application/vnd.crick.clicker.wordbank": ["clkw"], "application/vnd.criticaltools.wbs+xml": ["wbs"], "application/vnd.ctc-posml": ["pml"], "application/vnd.cups-ppd": ["ppd"], "application/vnd.curl.car": ["car"], "application/vnd.curl.pcurl": ["pcurl"], "application/vnd.dart": ["dart"], "application/vnd.data-vision.rdz": ["rdz"], "application/vnd.dbf": ["dbf"], "application/vnd.dece.data": ["uvf", "uvvf", "uvd", "uvvd"], "application/vnd.dece.ttml+xml": ["uvt", "uvvt"], "application/vnd.dece.unspecified": ["uvx", "uvvx"], "application/vnd.dece.zip": ["uvz", "uvvz"], "application/vnd.denovo.fcselayout-link": ["fe_launch"], "application/vnd.dna": ["dna"], "application/vnd.dolby.mlp": ["mlp"], "application/vnd.dpgraph": ["dpg"], "application/vnd.dreamfactory": ["dfac"], "application/vnd.ds-keypoint": ["kpxx"], "application/vnd.dvb.ait": ["ait"], "application/vnd.dvb.service": ["svc"], "application/vnd.dynageo": ["geo"], "application/vnd.ecowin.chart": ["mag"], "application/vnd.enliven": ["nml"], "application/vnd.epson.esf": ["esf"], "application/vnd.epson.msf": ["msf"], "application/vnd.epson.quickanime": ["qam"], "application/vnd.epson.salt": ["slt"], "application/vnd.epson.ssf": ["ssf"], "application/vnd.eszigno3+xml": ["es3", "et3"], "application/vnd.ezpix-album": ["ez2"], "application/vnd.ezpix-package": ["ez3"], "application/vnd.fdf": ["fdf"], "application/vnd.fdsn.mseed": ["mseed"], "application/vnd.fdsn.seed": ["seed", "dataless"], "application/vnd.flographit": ["gph"], "application/vnd.fluxtime.clip": ["ftc"], "application/vnd.framemaker": ["fm", "frame", "maker", "book"], "application/vnd.frogans.fnc": ["fnc"], "application/vnd.frogans.ltf": ["ltf"], "application/vnd.fsc.weblaunch": ["fsc"], "application/vnd.fujitsu.oasys": ["oas"], "application/vnd.fujitsu.oasys2": ["oa2"], "application/vnd.fujitsu.oasys3": ["oa3"], "application/vnd.fujitsu.oasysgp": ["fg5"], "application/vnd.fujitsu.oasysprs": ["bh2"], "application/vnd.fujixerox.ddd": ["ddd"], "application/vnd.fujixerox.docuworks": ["xdw"], "application/vnd.fujixerox.docuworks.binder": ["xbd"], "application/vnd.fuzzysheet": ["fzs"], "application/vnd.genomatix.tuxedo": ["txd"], "application/vnd.geogebra.file": ["ggb"], "application/vnd.geogebra.tool": ["ggt"], "application/vnd.geometry-explorer": ["gex", "gre"], "application/vnd.geonext": ["gxt"], "application/vnd.geoplan": ["g2w"], "application/vnd.geospace": ["g3w"], "application/vnd.gmx": ["gmx"], "application/vnd.google-apps.document": ["gdoc"], "application/vnd.google-apps.presentation": ["gslides"], "application/vnd.google-apps.spreadsheet": ["gsheet"], "application/vnd.google-earth.kml+xml": ["kml"], "application/vnd.google-earth.kmz": ["kmz"], "application/vnd.grafeq": ["gqf", "gqs"], "application/vnd.groove-account": ["gac"], "application/vnd.groove-help": ["ghf"], "application/vnd.groove-identity-message": ["gim"], "application/vnd.groove-injector": ["grv"], "application/vnd.groove-tool-message": ["gtm"], "application/vnd.groove-tool-template": ["tpl"], "application/vnd.groove-vcard": ["vcg"], "application/vnd.hal+xml": ["hal"], "application/vnd.handheld-entertainment+xml": ["zmm"], "application/vnd.hbci": ["hbci"], "application/vnd.hhe.lesson-player": ["les"], "application/vnd.hp-hpgl": ["hpgl"], "application/vnd.hp-hpid": ["hpid"], "application/vnd.hp-hps": ["hps"], "application/vnd.hp-jlyt": ["jlt"], "application/vnd.hp-pcl": ["pcl"], "application/vnd.hp-pclxl": ["pclxl"], "application/vnd.hydrostatix.sof-data": ["sfd-hdstx"], "application/vnd.ibm.minipay": ["mpy"], "application/vnd.ibm.modcap": ["afp", "listafp", "list3820"], "application/vnd.ibm.rights-management": ["irm"], "application/vnd.ibm.secure-container": ["sc"], "application/vnd.iccprofile": ["icc", "icm"], "application/vnd.igloader": ["igl"], "application/vnd.immervision-ivp": ["ivp"], "application/vnd.immervision-ivu": ["ivu"], "application/vnd.insors.igm": ["igm"], "application/vnd.intercon.formnet": ["xpw", "xpx"], "application/vnd.intergeo": ["i2g"], "application/vnd.intu.qbo": ["qbo"], "application/vnd.intu.qfx": ["qfx"], "application/vnd.ipunplugged.rcprofile": ["rcprofile"], "application/vnd.irepository.package+xml": ["irp"], "application/vnd.is-xpr": ["xpr"], "application/vnd.isac.fcs": ["fcs"], "application/vnd.jam": ["jam"], "application/vnd.jcp.javame.midlet-rms": ["rms"], "application/vnd.jisp": ["jisp"], "application/vnd.joost.joda-archive": ["joda"], "application/vnd.kahootz": ["ktz", "ktr"], "application/vnd.kde.karbon": ["karbon"], "application/vnd.kde.kchart": ["chrt"], "application/vnd.kde.kformula": ["kfo"], "application/vnd.kde.kivio": ["flw"], "application/vnd.kde.kontour": ["kon"], "application/vnd.kde.kpresenter": ["kpr", "kpt"], "application/vnd.kde.kspread": ["ksp"], "application/vnd.kde.kword": ["kwd", "kwt"], "application/vnd.kenameaapp": ["htke"], "application/vnd.kidspiration": ["kia"], "application/vnd.kinar": ["kne", "knp"], "application/vnd.koan": ["skp", "skd", "skt", "skm"], "application/vnd.kodak-descriptor": ["sse"], "application/vnd.las.las+xml": ["lasxml"], "application/vnd.llamagraphics.life-balance.desktop": ["lbd"], "application/vnd.llamagraphics.life-balance.exchange+xml": ["lbe"], "application/vnd.lotus-1-2-3": ["123"], "application/vnd.lotus-approach": ["apr"], "application/vnd.lotus-freelance": ["pre"], "application/vnd.lotus-notes": ["nsf"], "application/vnd.lotus-organizer": ["org"], "application/vnd.lotus-screencam": ["scm"], "application/vnd.lotus-wordpro": ["lwp"], "application/vnd.macports.portpkg": ["portpkg"], "application/vnd.mcd": ["mcd"], "application/vnd.medcalcdata": ["mc1"], "application/vnd.mediastation.cdkey": ["cdkey"], "application/vnd.mfer": ["mwf"], "application/vnd.mfmp": ["mfm"], "application/vnd.micrografx.flo": ["flo"], "application/vnd.micrografx.igx": ["igx"], "application/vnd.mif": ["mif"], "application/vnd.mobius.daf": ["daf"], "application/vnd.mobius.dis": ["dis"], "application/vnd.mobius.mbk": ["mbk"], "application/vnd.mobius.mqy": ["mqy"], "application/vnd.mobius.msl": ["msl"], "application/vnd.mobius.plc": ["plc"], "application/vnd.mobius.txf": ["txf"], "application/vnd.mophun.application": ["mpn"], "application/vnd.mophun.certificate": ["mpc"], "application/vnd.mozilla.xul+xml": ["xul"], "application/vnd.ms-artgalry": ["cil"], "application/vnd.ms-cab-compressed": ["cab"], "application/vnd.ms-excel": ["xls", "xlm", "xla", "xlc", "xlt", "xlw"], "application/vnd.ms-excel.addin.macroenabled.12": ["xlam"], "application/vnd.ms-excel.sheet.binary.macroenabled.12": ["xlsb"], "application/vnd.ms-excel.sheet.macroenabled.12": ["xlsm"], "application/vnd.ms-excel.template.macroenabled.12": ["xltm"], "application/vnd.ms-fontobject": ["eot"], "application/vnd.ms-htmlhelp": ["chm"], "application/vnd.ms-ims": ["ims"], "application/vnd.ms-lrm": ["lrm"], "application/vnd.ms-officetheme": ["thmx"], "application/vnd.ms-outlook": ["msg"], "application/vnd.ms-pki.seccat": ["cat"], "application/vnd.ms-pki.stl": ["*stl"], "application/vnd.ms-powerpoint": ["ppt", "pps", "pot"], "application/vnd.ms-powerpoint.addin.macroenabled.12": ["ppam"], "application/vnd.ms-powerpoint.presentation.macroenabled.12": ["pptm"], "application/vnd.ms-powerpoint.slide.macroenabled.12": ["sldm"], "application/vnd.ms-powerpoint.slideshow.macroenabled.12": ["ppsm"], "application/vnd.ms-powerpoint.template.macroenabled.12": ["potm"], "application/vnd.ms-project": ["mpp", "mpt"], "application/vnd.ms-word.document.macroenabled.12": ["docm"], "application/vnd.ms-word.template.macroenabled.12": ["dotm"], "application/vnd.ms-works": ["wps", "wks", "wcm", "wdb"], "application/vnd.ms-wpl": ["wpl"], "application/vnd.ms-xpsdocument": ["xps"], "application/vnd.mseq": ["mseq"], "application/vnd.musician": ["mus"], "application/vnd.muvee.style": ["msty"], "application/vnd.mynfc": ["taglet"], "application/vnd.neurolanguage.nlu": ["nlu"], "application/vnd.nitf": ["ntf", "nitf"], "application/vnd.noblenet-directory": ["nnd"], "application/vnd.noblenet-sealer": ["nns"], "application/vnd.noblenet-web": ["nnw"], "application/vnd.nokia.n-gage.ac+xml": ["*ac"], "application/vnd.nokia.n-gage.data": ["ngdat"], "application/vnd.nokia.n-gage.symbian.install": ["n-gage"], "application/vnd.nokia.radio-preset": ["rpst"], "application/vnd.nokia.radio-presets": ["rpss"], "application/vnd.novadigm.edm": ["edm"], "application/vnd.novadigm.edx": ["edx"], "application/vnd.novadigm.ext": ["ext"], "application/vnd.oasis.opendocument.chart": ["odc"], "application/vnd.oasis.opendocument.chart-template": ["otc"], "application/vnd.oasis.opendocument.database": ["odb"], "application/vnd.oasis.opendocument.formula": ["odf"], "application/vnd.oasis.opendocument.formula-template": ["odft"], "application/vnd.oasis.opendocument.graphics": ["odg"], "application/vnd.oasis.opendocument.graphics-template": ["otg"], "application/vnd.oasis.opendocument.image": ["odi"], "application/vnd.oasis.opendocument.image-template": ["oti"], "application/vnd.oasis.opendocument.presentation": ["odp"], "application/vnd.oasis.opendocument.presentation-template": ["otp"], "application/vnd.oasis.opendocument.spreadsheet": ["ods"], "application/vnd.oasis.opendocument.spreadsheet-template": ["ots"], "application/vnd.oasis.opendocument.text": ["odt"], "application/vnd.oasis.opendocument.text-master": ["odm"], "application/vnd.oasis.opendocument.text-template": ["ott"], "application/vnd.oasis.opendocument.text-web": ["oth"], "application/vnd.olpc-sugar": ["xo"], "application/vnd.oma.dd2+xml": ["dd2"], "application/vnd.openblox.game+xml": ["obgx"], "application/vnd.openofficeorg.extension": ["oxt"], "application/vnd.openstreetmap.data+xml": ["osm"], "application/vnd.openxmlformats-officedocument.presentationml.presentation": ["pptx"], "application/vnd.openxmlformats-officedocument.presentationml.slide": ["sldx"], "application/vnd.openxmlformats-officedocument.presentationml.slideshow": ["ppsx"], "application/vnd.openxmlformats-officedocument.presentationml.template": ["potx"], "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ["xlsx"], "application/vnd.openxmlformats-officedocument.spreadsheetml.template": ["xltx"], "application/vnd.openxmlformats-officedocument.wordprocessingml.document": ["docx"], "application/vnd.openxmlformats-officedocument.wordprocessingml.template": ["dotx"], "application/vnd.osgeo.mapguide.package": ["mgp"], "application/vnd.osgi.dp": ["dp"], "application/vnd.osgi.subsystem": ["esa"], "application/vnd.palm": ["pdb", "pqa", "oprc"], "application/vnd.pawaafile": ["paw"], "application/vnd.pg.format": ["str"], "application/vnd.pg.osasli": ["ei6"], "application/vnd.picsel": ["efif"], "application/vnd.pmi.widget": ["wg"], "application/vnd.pocketlearn": ["plf"], "application/vnd.powerbuilder6": ["pbd"], "application/vnd.previewsystems.box": ["box"], "application/vnd.proteus.magazine": ["mgz"], "application/vnd.publishare-delta-tree": ["qps"], "application/vnd.pvi.ptid1": ["ptid"], "application/vnd.quark.quarkxpress": ["qxd", "qxt", "qwd", "qwt", "qxl", "qxb"], "application/vnd.rar": ["rar"], "application/vnd.realvnc.bed": ["bed"], "application/vnd.recordare.musicxml": ["mxl"], "application/vnd.recordare.musicxml+xml": ["musicxml"], "application/vnd.rig.cryptonote": ["cryptonote"], "application/vnd.rim.cod": ["cod"], "application/vnd.rn-realmedia": ["rm"], "application/vnd.rn-realmedia-vbr": ["rmvb"], "application/vnd.route66.link66+xml": ["link66"], "application/vnd.sailingtracker.track": ["st"], "application/vnd.seemail": ["see"], "application/vnd.sema": ["sema"], "application/vnd.semd": ["semd"], "application/vnd.semf": ["semf"], "application/vnd.shana.informed.formdata": ["ifm"], "application/vnd.shana.informed.formtemplate": ["itp"], "application/vnd.shana.informed.interchange": ["iif"], "application/vnd.shana.informed.package": ["ipk"], "application/vnd.simtech-mindmapper": ["twd", "twds"], "application/vnd.smaf": ["mmf"], "application/vnd.smart.teacher": ["teacher"], "application/vnd.software602.filler.form+xml": ["fo"], "application/vnd.solent.sdkm+xml": ["sdkm", "sdkd"], "application/vnd.spotfire.dxp": ["dxp"], "application/vnd.spotfire.sfs": ["sfs"], "application/vnd.stardivision.calc": ["sdc"], "application/vnd.stardivision.draw": ["sda"], "application/vnd.stardivision.impress": ["sdd"], "application/vnd.stardivision.math": ["smf"], "application/vnd.stardivision.writer": ["sdw", "vor"], "application/vnd.stardivision.writer-global": ["sgl"], "application/vnd.stepmania.package": ["smzip"], "application/vnd.stepmania.stepchart": ["sm"], "application/vnd.sun.wadl+xml": ["wadl"], "application/vnd.sun.xml.calc": ["sxc"], "application/vnd.sun.xml.calc.template": ["stc"], "application/vnd.sun.xml.draw": ["sxd"], "application/vnd.sun.xml.draw.template": ["std"], "application/vnd.sun.xml.impress": ["sxi"], "application/vnd.sun.xml.impress.template": ["sti"], "application/vnd.sun.xml.math": ["sxm"], "application/vnd.sun.xml.writer": ["sxw"], "application/vnd.sun.xml.writer.global": ["sxg"], "application/vnd.sun.xml.writer.template": ["stw"], "application/vnd.sus-calendar": ["sus", "susp"], "application/vnd.svd": ["svd"], "application/vnd.symbian.install": ["sis", "sisx"], "application/vnd.syncml+xml": ["xsm"], "application/vnd.syncml.dm+wbxml": ["bdm"], "application/vnd.syncml.dm+xml": ["xdm"], "application/vnd.syncml.dmddf+xml": ["ddf"], "application/vnd.tao.intent-module-archive": ["tao"], "application/vnd.tcpdump.pcap": ["pcap", "cap", "dmp"], "application/vnd.tmobile-livetv": ["tmo"], "application/vnd.trid.tpt": ["tpt"], "application/vnd.triscape.mxs": ["mxs"], "application/vnd.trueapp": ["tra"], "application/vnd.ufdl": ["ufd", "ufdl"], "application/vnd.uiq.theme": ["utz"], "application/vnd.umajin": ["umj"], "application/vnd.unity": ["unityweb"], "application/vnd.uoml+xml": ["uoml"], "application/vnd.vcx": ["vcx"], "application/vnd.visio": ["vsd", "vst", "vss", "vsw"], "application/vnd.visionary": ["vis"], "application/vnd.vsf": ["vsf"], "application/vnd.wap.wbxml": ["wbxml"], "application/vnd.wap.wmlc": ["wmlc"], "application/vnd.wap.wmlscriptc": ["wmlsc"], "application/vnd.webturbo": ["wtb"], "application/vnd.wolfram.player": ["nbp"], "application/vnd.wordperfect": ["wpd"], "application/vnd.wqd": ["wqd"], "application/vnd.wt.stf": ["stf"], "application/vnd.xara": ["xar"], "application/vnd.xfdl": ["xfdl"], "application/vnd.yamaha.hv-dic": ["hvd"], "application/vnd.yamaha.hv-script": ["hvs"], "application/vnd.yamaha.hv-voice": ["hvp"], "application/vnd.yamaha.openscoreformat": ["osf"], "application/vnd.yamaha.openscoreformat.osfpvg+xml": ["osfpvg"], "application/vnd.yamaha.smaf-audio": ["saf"], "application/vnd.yamaha.smaf-phrase": ["spf"], "application/vnd.yellowriver-custom-menu": ["cmp"], "application/vnd.zul": ["zir", "zirz"], "application/vnd.zzazz.deck+xml": ["zaz"], "application/x-7z-compressed": ["7z"], "application/x-abiword": ["abw"], "application/x-ace-compressed": ["ace"], "application/x-apple-diskimage": ["*dmg"], "application/x-arj": ["arj"], "application/x-authorware-bin": ["aab", "x32", "u32", "vox"], "application/x-authorware-map": ["aam"], "application/x-authorware-seg": ["aas"], "application/x-bcpio": ["bcpio"], "application/x-bdoc": ["*bdoc"], "application/x-bittorrent": ["torrent"], "application/x-blorb": ["blb", "blorb"], "application/x-bzip": ["bz"], "application/x-bzip2": ["bz2", "boz"], "application/x-cbr": ["cbr", "cba", "cbt", "cbz", "cb7"], "application/x-cdlink": ["vcd"], "application/x-cfs-compressed": ["cfs"], "application/x-chat": ["chat"], "application/x-chess-pgn": ["pgn"], "application/x-chrome-extension": ["crx"], "application/x-cocoa": ["cco"], "application/x-conference": ["nsc"], "application/x-cpio": ["cpio"], "application/x-csh": ["csh"], "application/x-debian-package": ["*deb", "udeb"], "application/x-dgc-compressed": ["dgc"], "application/x-director": ["dir", "dcr", "dxr", "cst", "cct", "cxt", "w3d", "fgd", "swa"], "application/x-doom": ["wad"], "application/x-dtbncx+xml": ["ncx"], "application/x-dtbook+xml": ["dtb"], "application/x-dtbresource+xml": ["res"], "application/x-dvi": ["dvi"], "application/x-envoy": ["evy"], "application/x-eva": ["eva"], "application/x-font-bdf": ["bdf"], "application/x-font-ghostscript": ["gsf"], "application/x-font-linux-psf": ["psf"], "application/x-font-pcf": ["pcf"], "application/x-font-snf": ["snf"], "application/x-font-type1": ["pfa", "pfb", "pfm", "afm"], "application/x-freearc": ["arc"], "application/x-futuresplash": ["spl"], "application/x-gca-compressed": ["gca"], "application/x-glulx": ["ulx"], "application/x-gnumeric": ["gnumeric"], "application/x-gramps-xml": ["gramps"], "application/x-gtar": ["gtar"], "application/x-hdf": ["hdf"], "application/x-httpd-php": ["php"], "application/x-install-instructions": ["install"], "application/x-iso9660-image": ["*iso"], "application/x-java-archive-diff": ["jardiff"], "application/x-java-jnlp-file": ["jnlp"], "application/x-keepass2": ["kdbx"], "application/x-latex": ["latex"], "application/x-lua-bytecode": ["luac"], "application/x-lzh-compressed": ["lzh", "lha"], "application/x-makeself": ["run"], "application/x-mie": ["mie"], "application/x-mobipocket-ebook": ["prc", "mobi"], "application/x-ms-application": ["application"], "application/x-ms-shortcut": ["lnk"], "application/x-ms-wmd": ["wmd"], "application/x-ms-wmz": ["wmz"], "application/x-ms-xbap": ["xbap"], "application/x-msaccess": ["mdb"], "application/x-msbinder": ["obd"], "application/x-mscardfile": ["crd"], "application/x-msclip": ["clp"], "application/x-msdos-program": ["*exe"], "application/x-msdownload": ["*exe", "*dll", "com", "bat", "*msi"], "application/x-msmediaview": ["mvb", "m13", "m14"], "application/x-msmetafile": ["*wmf", "*wmz", "*emf", "emz"], "application/x-msmoney": ["mny"], "application/x-mspublisher": ["pub"], "application/x-msschedule": ["scd"], "application/x-msterminal": ["trm"], "application/x-mswrite": ["wri"], "application/x-netcdf": ["nc", "cdf"], "application/x-ns-proxy-autoconfig": ["pac"], "application/x-nzb": ["nzb"], "application/x-perl": ["pl", "pm"], "application/x-pilot": ["*prc", "*pdb"], "application/x-pkcs12": ["p12", "pfx"], "application/x-pkcs7-certificates": ["p7b", "spc"], "application/x-pkcs7-certreqresp": ["p7r"], "application/x-rar-compressed": ["*rar"], "application/x-redhat-package-manager": ["rpm"], "application/x-research-info-systems": ["ris"], "application/x-sea": ["sea"], "application/x-sh": ["sh"], "application/x-shar": ["shar"], "application/x-shockwave-flash": ["swf"], "application/x-silverlight-app": ["xap"], "application/x-sql": ["sql"], "application/x-stuffit": ["sit"], "application/x-stuffitx": ["sitx"], "application/x-subrip": ["srt"], "application/x-sv4cpio": ["sv4cpio"], "application/x-sv4crc": ["sv4crc"], "application/x-t3vm-image": ["t3"], "application/x-tads": ["gam"], "application/x-tar": ["tar"], "application/x-tcl": ["tcl", "tk"], "application/x-tex": ["tex"], "application/x-tex-tfm": ["tfm"], "application/x-texinfo": ["texinfo", "texi"], "application/x-tgif": ["*obj"], "application/x-ustar": ["ustar"], "application/x-virtualbox-hdd": ["hdd"], "application/x-virtualbox-ova": ["ova"], "application/x-virtualbox-ovf": ["ovf"], "application/x-virtualbox-vbox": ["vbox"], "application/x-virtualbox-vbox-extpack": ["vbox-extpack"], "application/x-virtualbox-vdi": ["vdi"], "application/x-virtualbox-vhd": ["vhd"], "application/x-virtualbox-vmdk": ["vmdk"], "application/x-wais-source": ["src"], "application/x-web-app-manifest+json": ["webapp"], "application/x-x509-ca-cert": ["der", "crt", "pem"], "application/x-xfig": ["fig"], "application/x-xliff+xml": ["*xlf"], "application/x-xpinstall": ["xpi"], "application/x-xz": ["xz"], "application/x-zmachine": ["z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8"], "audio/vnd.dece.audio": ["uva", "uvva"], "audio/vnd.digital-winds": ["eol"], "audio/vnd.dra": ["dra"], "audio/vnd.dts": ["dts"], "audio/vnd.dts.hd": ["dtshd"], "audio/vnd.lucent.voice": ["lvp"], "audio/vnd.ms-playready.media.pya": ["pya"], "audio/vnd.nuera.ecelp4800": ["ecelp4800"], "audio/vnd.nuera.ecelp7470": ["ecelp7470"], "audio/vnd.nuera.ecelp9600": ["ecelp9600"], "audio/vnd.rip": ["rip"], "audio/x-aac": ["aac"], "audio/x-aiff": ["aif", "aiff", "aifc"], "audio/x-caf": ["caf"], "audio/x-flac": ["flac"], "audio/x-m4a": ["*m4a"], "audio/x-matroska": ["mka"], "audio/x-mpegurl": ["m3u"], "audio/x-ms-wax": ["wax"], "audio/x-ms-wma": ["wma"], "audio/x-pn-realaudio": ["ram", "ra"], "audio/x-pn-realaudio-plugin": ["rmp"], "audio/x-realaudio": ["*ra"], "audio/x-wav": ["*wav"], "chemical/x-cdx": ["cdx"], "chemical/x-cif": ["cif"], "chemical/x-cmdf": ["cmdf"], "chemical/x-cml": ["cml"], "chemical/x-csml": ["csml"], "chemical/x-xyz": ["xyz"], "image/prs.btif": ["btif"], "image/prs.pti": ["pti"], "image/vnd.adobe.photoshop": ["psd"], "image/vnd.airzip.accelerator.azv": ["azv"], "image/vnd.dece.graphic": ["uvi", "uvvi", "uvg", "uvvg"], "image/vnd.djvu": ["djvu", "djv"], "image/vnd.dvb.subtitle": ["*sub"], "image/vnd.dwg": ["dwg"], "image/vnd.dxf": ["dxf"], "image/vnd.fastbidsheet": ["fbs"], "image/vnd.fpx": ["fpx"], "image/vnd.fst": ["fst"], "image/vnd.fujixerox.edmics-mmr": ["mmr"], "image/vnd.fujixerox.edmics-rlc": ["rlc"], "image/vnd.microsoft.icon": ["ico"], "image/vnd.ms-dds": ["dds"], "image/vnd.ms-modi": ["mdi"], "image/vnd.ms-photo": ["wdp"], "image/vnd.net-fpx": ["npx"], "image/vnd.pco.b16": ["b16"], "image/vnd.tencent.tap": ["tap"], "image/vnd.valve.source.texture": ["vtf"], "image/vnd.wap.wbmp": ["wbmp"], "image/vnd.xiff": ["xif"], "image/vnd.zbrush.pcx": ["pcx"], "image/x-3ds": ["3ds"], "image/x-cmu-raster": ["ras"], "image/x-cmx": ["cmx"], "image/x-freehand": ["fh", "fhc", "fh4", "fh5", "fh7"], "image/x-icon": ["*ico"], "image/x-jng": ["jng"], "image/x-mrsid-image": ["sid"], "image/x-ms-bmp": ["*bmp"], "image/x-pcx": ["*pcx"], "image/x-pict": ["pic", "pct"], "image/x-portable-anymap": ["pnm"], "image/x-portable-bitmap": ["pbm"], "image/x-portable-graymap": ["pgm"], "image/x-portable-pixmap": ["ppm"], "image/x-rgb": ["rgb"], "image/x-tga": ["tga"], "image/x-xbitmap": ["xbm"], "image/x-xpixmap": ["xpm"], "image/x-xwindowdump": ["xwd"], "message/vnd.wfa.wsc": ["wsc"], "model/vnd.collada+xml": ["dae"], "model/vnd.dwf": ["dwf"], "model/vnd.gdl": ["gdl"], "model/vnd.gtw": ["gtw"], "model/vnd.mts": ["mts"], "model/vnd.opengex": ["ogex"], "model/vnd.parasolid.transmit.binary": ["x_b"], "model/vnd.parasolid.transmit.text": ["x_t"], "model/vnd.usdz+zip": ["usdz"], "model/vnd.valve.source.compiled-map": ["bsp"], "model/vnd.vtu": ["vtu"], "text/prs.lines.tag": ["dsc"], "text/vnd.curl": ["curl"], "text/vnd.curl.dcurl": ["dcurl"], "text/vnd.curl.mcurl": ["mcurl"], "text/vnd.curl.scurl": ["scurl"], "text/vnd.dvb.subtitle": ["sub"], "text/vnd.fly": ["fly"], "text/vnd.fmi.flexstor": ["flx"], "text/vnd.graphviz": ["gv"], "text/vnd.in3d.3dml": ["3dml"], "text/vnd.in3d.spot": ["spot"], "text/vnd.sun.j2me.app-descriptor": ["jad"], "text/vnd.wap.wml": ["wml"], "text/vnd.wap.wmlscript": ["wmls"], "text/x-asm": ["s", "asm"], "text/x-c": ["c", "cc", "cxx", "cpp", "h", "hh", "dic"], "text/x-component": ["htc"], "text/x-fortran": ["f", "for", "f77", "f90"], "text/x-handlebars-template": ["hbs"], "text/x-java-source": ["java"], "text/x-lua": ["lua"], "text/x-markdown": ["mkd"], "text/x-nfo": ["nfo"], "text/x-opml": ["opml"], "text/x-org": ["*org"], "text/x-pascal": ["p", "pas"], "text/x-processing": ["pde"], "text/x-sass": ["sass"], "text/x-scss": ["scss"], "text/x-setext": ["etx"], "text/x-sfv": ["sfv"], "text/x-suse-ymp": ["ymp"], "text/x-uuencode": ["uu"], "text/x-vcalendar": ["vcs"], "text/x-vcard": ["vcf"], "video/vnd.dece.hd": ["uvh", "uvvh"], "video/vnd.dece.mobile": ["uvm", "uvvm"], "video/vnd.dece.pd": ["uvp", "uvvp"], "video/vnd.dece.sd": ["uvs", "uvvs"], "video/vnd.dece.video": ["uvv", "uvvv"], "video/vnd.dvb.file": ["dvb"], "video/vnd.fvt": ["fvt"], "video/vnd.mpegurl": ["mxu", "m4u"], "video/vnd.ms-playready.media.pyv": ["pyv"], "video/vnd.uvvu.mp4": ["uvu", "uvvu"], "video/vnd.vivo": ["viv"], "video/x-f4v": ["f4v"], "video/x-fli": ["fli"], "video/x-flv": ["flv"], "video/x-m4v": ["m4v"], "video/x-matroska": ["mkv", "mk3d", "mks"], "video/x-mng": ["mng"], "video/x-ms-asf": ["asf", "asx"], "video/x-ms-vob": ["vob"], "video/x-ms-wm": ["wm"], "video/x-ms-wmv": ["wmv"], "video/x-ms-wmx": ["wmx"], "video/x-ms-wvx": ["wvx"], "video/x-msvideo": ["avi"], "video/x-sgi-movie": ["movie"], "video/x-smv": ["smv"], "x-conference/x-cooltalk": ["ice"]}; +}); + +// node_modules/superagent/node_modules/mime/index.js +var require_mime2 = __commonJS((exports2, module2) => { + "use strict"; + var Mime = require_Mime(); + module2.exports = new Mime(require_standard(), require_other()); +}); + +// node_modules/delayed-stream/lib/delayed_stream.js +var require_delayed_stream = __commonJS((exports2, module2) => { + var Stream = require("stream").Stream; + var util = require("util"); + module2.exports = DelayedStream; + function DelayedStream() { + this.source = null; + this.dataSize = 0; + this.maxDataSize = 1024 * 1024; + this.pauseStream = true; + this._maxDataSizeExceeded = false; + this._released = false; + this._bufferedEvents = []; + } + util.inherits(DelayedStream, Stream); + DelayedStream.create = function(source, options) { + var delayedStream = new this(); + options = options || {}; + for (var option in options) { + delayedStream[option] = options[option]; + } + delayedStream.source = source; + var realEmit = source.emit; + source.emit = function() { + delayedStream._handleEmit(arguments); + return realEmit.apply(source, arguments); + }; + source.on("error", function() { + }); + if (delayedStream.pauseStream) { + source.pause(); + } + return delayedStream; + }; + Object.defineProperty(DelayedStream.prototype, "readable", { + configurable: true, + enumerable: true, + get: function() { + return this.source.readable; + } + }); + DelayedStream.prototype.setEncoding = function() { + return this.source.setEncoding.apply(this.source, arguments); + }; + DelayedStream.prototype.resume = function() { + if (!this._released) { + this.release(); + } + this.source.resume(); + }; + DelayedStream.prototype.pause = function() { + this.source.pause(); + }; + DelayedStream.prototype.release = function() { + this._released = true; + this._bufferedEvents.forEach(function(args) { + this.emit.apply(this, args); + }.bind(this)); + this._bufferedEvents = []; + }; + DelayedStream.prototype.pipe = function() { + var r = Stream.prototype.pipe.apply(this, arguments); + this.resume(); + return r; + }; + DelayedStream.prototype._handleEmit = function(args) { + if (this._released) { + this.emit.apply(this, args); + return; + } + if (args[0] === "data") { + this.dataSize += args[1].length; + this._checkIfMaxDataSizeExceeded(); + } + this._bufferedEvents.push(args); + }; + DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { + if (this._maxDataSizeExceeded) { + return; + } + if (this.dataSize <= this.maxDataSize) { + return; + } + this._maxDataSizeExceeded = true; + var message = "DelayedStream#maxDataSize of " + this.maxDataSize + " bytes exceeded."; + this.emit("error", new Error(message)); + }; +}); + +// node_modules/combined-stream/lib/combined_stream.js +var require_combined_stream = __commonJS((exports2, module2) => { + var util = require("util"); + var Stream = require("stream").Stream; + var DelayedStream = require_delayed_stream(); + module2.exports = CombinedStream; + function CombinedStream() { + this.writable = false; + this.readable = true; + this.dataSize = 0; + this.maxDataSize = 2 * 1024 * 1024; + this.pauseStreams = true; + this._released = false; + this._streams = []; + this._currentStream = null; + this._insideLoop = false; + this._pendingNext = false; + } + util.inherits(CombinedStream, Stream); + CombinedStream.create = function(options) { + var combinedStream = new this(); + options = options || {}; + for (var option in options) { + combinedStream[option] = options[option]; + } + return combinedStream; + }; + CombinedStream.isStreamLike = function(stream) { + return typeof stream !== "function" && typeof stream !== "string" && typeof stream !== "boolean" && typeof stream !== "number" && !Buffer.isBuffer(stream); + }; + CombinedStream.prototype.append = function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + if (!(stream instanceof DelayedStream)) { + var newStream = DelayedStream.create(stream, { + maxDataSize: Infinity, + pauseStream: this.pauseStreams + }); + stream.on("data", this._checkDataSize.bind(this)); + stream = newStream; + } + this._handleErrors(stream); + if (this.pauseStreams) { + stream.pause(); + } + } + this._streams.push(stream); + return this; + }; + CombinedStream.prototype.pipe = function(dest, options) { + Stream.prototype.pipe.call(this, dest, options); + this.resume(); + return dest; + }; + CombinedStream.prototype._getNext = function() { + this._currentStream = null; + if (this._insideLoop) { + this._pendingNext = true; + return; + } + this._insideLoop = true; + try { + do { + this._pendingNext = false; + this._realGetNext(); + } while (this._pendingNext); + } finally { + this._insideLoop = false; + } + }; + CombinedStream.prototype._realGetNext = function() { + var stream = this._streams.shift(); + if (typeof stream == "undefined") { + this.end(); + return; + } + if (typeof stream !== "function") { + this._pipeNext(stream); + return; + } + var getStream = stream; + getStream(function(stream2) { + var isStreamLike = CombinedStream.isStreamLike(stream2); + if (isStreamLike) { + stream2.on("data", this._checkDataSize.bind(this)); + this._handleErrors(stream2); + } + this._pipeNext(stream2); + }.bind(this)); + }; + CombinedStream.prototype._pipeNext = function(stream) { + this._currentStream = stream; + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on("end", this._getNext.bind(this)); + stream.pipe(this, {end: false}); + return; + } + var value = stream; + this.write(value); + this._getNext(); + }; + CombinedStream.prototype._handleErrors = function(stream) { + var self2 = this; + stream.on("error", function(err) { + self2._emitError(err); + }); + }; + CombinedStream.prototype.write = function(data) { + this.emit("data", data); + }; + CombinedStream.prototype.pause = function() { + if (!this.pauseStreams) { + return; + } + if (this.pauseStreams && this._currentStream && typeof this._currentStream.pause == "function") + this._currentStream.pause(); + this.emit("pause"); + }; + CombinedStream.prototype.resume = function() { + if (!this._released) { + this._released = true; + this.writable = true; + this._getNext(); + } + if (this.pauseStreams && this._currentStream && typeof this._currentStream.resume == "function") + this._currentStream.resume(); + this.emit("resume"); + }; + CombinedStream.prototype.end = function() { + this._reset(); + this.emit("end"); + }; + CombinedStream.prototype.destroy = function() { + this._reset(); + this.emit("close"); + }; + CombinedStream.prototype._reset = function() { + this.writable = false; + this._streams = []; + this._currentStream = null; + }; + CombinedStream.prototype._checkDataSize = function() { + this._updateDataSize(); + if (this.dataSize <= this.maxDataSize) { + return; + } + var message = "DelayedStream#maxDataSize of " + this.maxDataSize + " bytes exceeded."; + this._emitError(new Error(message)); + }; + CombinedStream.prototype._updateDataSize = function() { + this.dataSize = 0; + var self2 = this; + this._streams.forEach(function(stream) { + if (!stream.dataSize) { + return; + } + self2.dataSize += stream.dataSize; + }); + if (this._currentStream && this._currentStream.dataSize) { + this.dataSize += this._currentStream.dataSize; + } + }; + CombinedStream.prototype._emitError = function(err) { + this._reset(); + this.emit("error", err); + }; +}); + +// node_modules/asynckit/lib/defer.js +var require_defer = __commonJS((exports2, module2) => { + module2.exports = defer; + function defer(fn) { + var nextTick = typeof setImmediate == "function" ? setImmediate : typeof process == "object" && typeof process.nextTick == "function" ? process.nextTick : null; + if (nextTick) { + nextTick(fn); + } else { + setTimeout(fn, 0); + } + } +}); + +// node_modules/asynckit/lib/async.js +var require_async2 = __commonJS((exports2, module2) => { + var defer = require_defer(); + module2.exports = async; + function async(callback) { + var isAsync = false; + defer(function() { + isAsync = true; + }); + return function async_callback(err, result) { + if (isAsync) { + callback(err, result); + } else { + defer(function nextTick_callback() { + callback(err, result); + }); + } + }; + } +}); + +// node_modules/asynckit/lib/abort.js +var require_abort = __commonJS((exports2, module2) => { + module2.exports = abort; + function abort(state) { + Object.keys(state.jobs).forEach(clean.bind(state)); + state.jobs = {}; + } + function clean(key) { + if (typeof this.jobs[key] == "function") { + this.jobs[key](); + } + } +}); + +// node_modules/asynckit/lib/iterate.js +var require_iterate = __commonJS((exports2, module2) => { + var async = require_async2(); + var abort = require_abort(); + module2.exports = iterate; + function iterate(list, iterator, state, callback) { + var key = state["keyedList"] ? state["keyedList"][state.index] : state.index; + state.jobs[key] = runJob(iterator, key, list[key], function(error, output) { + if (!(key in state.jobs)) { + return; + } + delete state.jobs[key]; + if (error) { + abort(state); + } else { + state.results[key] = output; + } + callback(error, state.results); + }); + } + function runJob(iterator, key, item, callback) { + var aborter; + if (iterator.length == 2) { + aborter = iterator(item, async(callback)); + } else { + aborter = iterator(item, key, async(callback)); + } + return aborter; + } +}); + +// node_modules/asynckit/lib/state.js +var require_state3 = __commonJS((exports2, module2) => { + module2.exports = state; + function state(list, sortMethod) { + var isNamedList = !Array.isArray(list), initState = { + index: 0, + keyedList: isNamedList || sortMethod ? Object.keys(list) : null, + jobs: {}, + results: isNamedList ? {} : [], + size: isNamedList ? Object.keys(list).length : list.length + }; + if (sortMethod) { + initState.keyedList.sort(isNamedList ? sortMethod : function(a, b) { + return sortMethod(list[a], list[b]); + }); + } + return initState; + } +}); + +// node_modules/asynckit/lib/terminator.js +var require_terminator = __commonJS((exports2, module2) => { + var abort = require_abort(); + var async = require_async2(); + module2.exports = terminator; + function terminator(callback) { + if (!Object.keys(this.jobs).length) { + return; + } + this.index = this.size; + abort(this); + async(callback)(null, this.results); + } +}); + +// node_modules/asynckit/parallel.js +var require_parallel = __commonJS((exports2, module2) => { + var iterate = require_iterate(); + var initState = require_state3(); + var terminator = require_terminator(); + module2.exports = parallel; + function parallel(list, iterator, callback) { + var state = initState(list); + while (state.index < (state["keyedList"] || list).length) { + iterate(list, iterator, state, function(error, result) { + if (error) { + callback(error, result); + return; + } + if (Object.keys(state.jobs).length === 0) { + callback(null, state.results); + return; + } + }); + state.index++; + } + return terminator.bind(state, callback); + } +}); + +// node_modules/asynckit/serialOrdered.js +var require_serialOrdered = __commonJS((exports2, module2) => { + var iterate = require_iterate(); + var initState = require_state3(); + var terminator = require_terminator(); + module2.exports = serialOrdered; + module2.exports.ascending = ascending; + module2.exports.descending = descending; + function serialOrdered(list, iterator, sortMethod, callback) { + var state = initState(list, sortMethod); + iterate(list, iterator, state, function iteratorHandler(error, result) { + if (error) { + callback(error, result); + return; + } + state.index++; + if (state.index < (state["keyedList"] || list).length) { + iterate(list, iterator, state, iteratorHandler); + return; + } + callback(null, state.results); + }); + return terminator.bind(state, callback); + } + function ascending(a, b) { + return a < b ? -1 : a > b ? 1 : 0; + } + function descending(a, b) { + return -1 * ascending(a, b); + } +}); + +// node_modules/asynckit/serial.js +var require_serial = __commonJS((exports2, module2) => { + var serialOrdered = require_serialOrdered(); + module2.exports = serial; + function serial(list, iterator, callback) { + return serialOrdered(list, iterator, null, callback); + } +}); + +// node_modules/asynckit/index.js +var require_asynckit = __commonJS((exports2, module2) => { + module2.exports = { + parallel: require_parallel(), + serial: require_serial(), + serialOrdered: require_serialOrdered() + }; +}); + +// node_modules/superagent/node_modules/form-data/lib/populate.js +var require_populate = __commonJS((exports2, module2) => { + module2.exports = function(dst, src) { + Object.keys(src).forEach(function(prop) { + dst[prop] = dst[prop] || src[prop]; + }); + return dst; + }; +}); + +// node_modules/superagent/node_modules/form-data/lib/form_data.js +var require_form_data = __commonJS((exports2, module2) => { + var CombinedStream = require_combined_stream(); + var util = require("util"); + var path = require("path"); + var http = require("http"); + var https = require("https"); + var parseUrl = require("url").parse; + var fs = require("fs"); + var mime = require_mime_types(); + var asynckit = require_asynckit(); + var populate = require_populate(); + module2.exports = FormData; + util.inherits(FormData, CombinedStream); + function FormData(options) { + if (!(this instanceof FormData)) { + return new FormData(options); + } + this._overheadLength = 0; + this._valueLength = 0; + this._valuesToMeasure = []; + CombinedStream.call(this); + options = options || {}; + for (var option in options) { + this[option] = options[option]; + } + } + FormData.LINE_BREAK = "\r\n"; + FormData.DEFAULT_CONTENT_TYPE = "application/octet-stream"; + FormData.prototype.append = function(field, value, options) { + options = options || {}; + if (typeof options == "string") { + options = {filename: options}; + } + var append = CombinedStream.prototype.append.bind(this); + if (typeof value == "number") { + value = "" + value; + } + if (util.isArray(value)) { + this._error(new Error("Arrays are not supported.")); + return; + } + var header = this._multiPartHeader(field, value, options); + var footer = this._multiPartFooter(); + append(header); + append(value); + append(footer); + this._trackLength(header, value, options); + }; + FormData.prototype._trackLength = function(header, value, options) { + var valueLength = 0; + if (options.knownLength != null) { + valueLength += +options.knownLength; + } else if (Buffer.isBuffer(value)) { + valueLength = value.length; + } else if (typeof value === "string") { + valueLength = Buffer.byteLength(value); + } + this._valueLength += valueLength; + this._overheadLength += Buffer.byteLength(header) + FormData.LINE_BREAK.length; + if (!value || !value.path && !(value.readable && value.hasOwnProperty("httpVersion"))) { + return; + } + if (!options.knownLength) { + this._valuesToMeasure.push(value); + } + }; + FormData.prototype._lengthRetriever = function(value, callback) { + if (value.hasOwnProperty("fd")) { + if (value.end != void 0 && value.end != Infinity && value.start != void 0) { + callback(null, value.end + 1 - (value.start ? value.start : 0)); + } else { + fs.stat(value.path, function(err, stat) { + var fileSize; + if (err) { + callback(err); + return; + } + fileSize = stat.size - (value.start ? value.start : 0); + callback(null, fileSize); + }); + } + } else if (value.hasOwnProperty("httpVersion")) { + callback(null, +value.headers["content-length"]); + } else if (value.hasOwnProperty("httpModule")) { + value.on("response", function(response) { + value.pause(); + callback(null, +response.headers["content-length"]); + }); + value.resume(); + } else { + callback("Unknown stream"); + } + }; + FormData.prototype._multiPartHeader = function(field, value, options) { + if (typeof options.header == "string") { + return options.header; + } + var contentDisposition = this._getContentDisposition(value, options); + var contentType = this._getContentType(value, options); + var contents = ""; + var headers = { + "Content-Disposition": ["form-data", 'name="' + field + '"'].concat(contentDisposition || []), + "Content-Type": [].concat(contentType || []) + }; + if (typeof options.header == "object") { + populate(headers, options.header); + } + var header; + for (var prop in headers) { + if (!headers.hasOwnProperty(prop)) + continue; + header = headers[prop]; + if (header == null) { + continue; + } + if (!Array.isArray(header)) { + header = [header]; + } + if (header.length) { + contents += prop + ": " + header.join("; ") + FormData.LINE_BREAK; + } + } + return "--" + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK; + }; + FormData.prototype._getContentDisposition = function(value, options) { + var filename, contentDisposition; + if (typeof options.filepath === "string") { + filename = path.normalize(options.filepath).replace(/\\/g, "/"); + } else if (options.filename || value.name || value.path) { + filename = path.basename(options.filename || value.name || value.path); + } else if (value.readable && value.hasOwnProperty("httpVersion")) { + filename = path.basename(value.client._httpMessage.path || ""); + } + if (filename) { + contentDisposition = 'filename="' + filename + '"'; + } + return contentDisposition; + }; + FormData.prototype._getContentType = function(value, options) { + var contentType = options.contentType; + if (!contentType && value.name) { + contentType = mime.lookup(value.name); + } + if (!contentType && value.path) { + contentType = mime.lookup(value.path); + } + if (!contentType && value.readable && value.hasOwnProperty("httpVersion")) { + contentType = value.headers["content-type"]; + } + if (!contentType && (options.filepath || options.filename)) { + contentType = mime.lookup(options.filepath || options.filename); + } + if (!contentType && typeof value == "object") { + contentType = FormData.DEFAULT_CONTENT_TYPE; + } + return contentType; + }; + FormData.prototype._multiPartFooter = function() { + return function(next) { + var footer = FormData.LINE_BREAK; + var lastPart = this._streams.length === 0; + if (lastPart) { + footer += this._lastBoundary(); + } + next(footer); + }.bind(this); + }; + FormData.prototype._lastBoundary = function() { + return "--" + this.getBoundary() + "--" + FormData.LINE_BREAK; + }; + FormData.prototype.getHeaders = function(userHeaders) { + var header; + var formHeaders = { + "content-type": "multipart/form-data; boundary=" + this.getBoundary() + }; + for (header in userHeaders) { + if (userHeaders.hasOwnProperty(header)) { + formHeaders[header.toLowerCase()] = userHeaders[header]; + } + } + return formHeaders; + }; + FormData.prototype.setBoundary = function(boundary) { + this._boundary = boundary; + }; + FormData.prototype.getBoundary = function() { + if (!this._boundary) { + this._generateBoundary(); + } + return this._boundary; + }; + FormData.prototype.getBuffer = function() { + var dataBuffer = new Buffer.alloc(0); + var boundary = this.getBoundary(); + for (var i = 0, len = this._streams.length; i < len; i++) { + if (typeof this._streams[i] !== "function") { + if (Buffer.isBuffer(this._streams[i])) { + dataBuffer = Buffer.concat([dataBuffer, this._streams[i]]); + } else { + dataBuffer = Buffer.concat([dataBuffer, Buffer.from(this._streams[i])]); + } + if (typeof this._streams[i] !== "string" || this._streams[i].substring(2, boundary.length + 2) !== boundary) { + dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData.LINE_BREAK)]); + } + } + } + return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]); + }; + FormData.prototype._generateBoundary = function() { + var boundary = "--------------------------"; + for (var i = 0; i < 24; i++) { + boundary += Math.floor(Math.random() * 10).toString(16); + } + this._boundary = boundary; + }; + FormData.prototype.getLengthSync = function() { + var knownLength = this._overheadLength + this._valueLength; + if (this._streams.length) { + knownLength += this._lastBoundary().length; + } + if (!this.hasKnownLength()) { + this._error(new Error("Cannot calculate proper length in synchronous way.")); + } + return knownLength; + }; + FormData.prototype.hasKnownLength = function() { + var hasKnownLength = true; + if (this._valuesToMeasure.length) { + hasKnownLength = false; + } + return hasKnownLength; + }; + FormData.prototype.getLength = function(cb) { + var knownLength = this._overheadLength + this._valueLength; + if (this._streams.length) { + knownLength += this._lastBoundary().length; + } + if (!this._valuesToMeasure.length) { + process.nextTick(cb.bind(this, null, knownLength)); + return; + } + asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) { + if (err) { + cb(err); + return; + } + values.forEach(function(length) { + knownLength += length; + }); + cb(null, knownLength); + }); + }; + FormData.prototype.submit = function(params, cb) { + var request, options, defaults = {method: "post"}; + if (typeof params == "string") { + params = parseUrl(params); + options = populate({ + port: params.port, + path: params.pathname, + host: params.hostname, + protocol: params.protocol + }, defaults); + } else { + options = populate(params, defaults); + if (!options.port) { + options.port = options.protocol == "https:" ? 443 : 80; + } + } + options.headers = this.getHeaders(params.headers); + if (options.protocol == "https:") { + request = https.request(options); + } else { + request = http.request(options); + } + this.getLength(function(err, length) { + if (err) { + this._error(err); + return; + } + request.setHeader("Content-Length", length); + this.pipe(request); + if (cb) { + var onResponse; + var callback = function(error, responce) { + request.removeListener("error", callback); + request.removeListener("response", onResponse); + return cb.call(this, error, responce); + }; + onResponse = callback.bind(this, null); + request.on("error", callback); + request.on("response", onResponse); + } + }.bind(this)); + return request; + }; + FormData.prototype._error = function(err) { + if (!this.error) { + this.error = err; + this.pause(); + this.emit("error", err); + } + }; + FormData.prototype.toString = function() { + return "[object FormData]"; + }; +}); + +// node_modules/formidable/lib/file.js +var require_file = __commonJS((exports2, module2) => { + if (global.GENTLY) + require = GENTLY.hijack(require); + var util = require("util"); + var fs = require("fs"); + var EventEmitter = require("events").EventEmitter; + var crypto = require("crypto"); + function File(properties) { + EventEmitter.call(this); + this.size = 0; + this.path = null; + this.name = null; + this.type = null; + this.hash = null; + this.lastModifiedDate = null; + this._writeStream = null; + for (var key in properties) { + this[key] = properties[key]; + } + if (typeof this.hash === "string") { + this.hash = crypto.createHash(properties.hash); + } else { + this.hash = null; + } + } + module2.exports = File; + util.inherits(File, EventEmitter); + File.prototype.open = function() { + this._writeStream = new fs.WriteStream(this.path); + }; + File.prototype.toJSON = function() { + var json = { + size: this.size, + path: this.path, + name: this.name, + type: this.type, + mtime: this.lastModifiedDate, + length: this.length, + filename: this.filename, + mime: this.mime + }; + if (this.hash && this.hash != "") { + json.hash = this.hash; + } + return json; + }; + File.prototype.write = function(buffer, cb) { + var self2 = this; + if (self2.hash) { + self2.hash.update(buffer); + } + if (this._writeStream.closed) { + return cb(); + } + this._writeStream.write(buffer, function() { + self2.lastModifiedDate = new Date(); + self2.size += buffer.length; + self2.emit("progress", self2.size); + cb(); + }); + }; + File.prototype.end = function(cb) { + var self2 = this; + if (self2.hash) { + self2.hash = self2.hash.digest("hex"); + } + this._writeStream.end(function() { + self2.emit("end"); + cb(); + }); + }; +}); + +// node_modules/formidable/lib/multipart_parser.js +var require_multipart_parser = __commonJS((exports2) => { + var Buffer2 = require("buffer").Buffer; + var s = 0; + var S = { + PARSER_UNINITIALIZED: s++, + START: s++, + START_BOUNDARY: s++, + HEADER_FIELD_START: s++, + HEADER_FIELD: s++, + HEADER_VALUE_START: s++, + HEADER_VALUE: s++, + HEADER_VALUE_ALMOST_DONE: s++, + HEADERS_ALMOST_DONE: s++, + PART_DATA_START: s++, + PART_DATA: s++, + PART_END: s++, + END: s++ + }; + var f = 1; + var F = { + PART_BOUNDARY: f, + LAST_BOUNDARY: f *= 2 + }; + var LF = 10; + var CR = 13; + var SPACE = 32; + var HYPHEN = 45; + var COLON = 58; + var A = 97; + var Z = 122; + var lower = function(c) { + return c | 32; + }; + for (s in S) { + exports2[s] = S[s]; + } + function MultipartParser() { + this.boundary = null; + this.boundaryChars = null; + this.lookbehind = null; + this.state = S.PARSER_UNINITIALIZED; + this.index = null; + this.flags = 0; + } + exports2.MultipartParser = MultipartParser; + MultipartParser.stateToString = function(stateNumber) { + for (var state in S) { + var number = S[state]; + if (number === stateNumber) + return state; + } + }; + MultipartParser.prototype.initWithBoundary = function(str) { + this.boundary = new Buffer2(str.length + 4); + this.boundary.write("\r\n--", 0); + this.boundary.write(str, 4); + this.lookbehind = new Buffer2(this.boundary.length + 8); + this.state = S.START; + this.boundaryChars = {}; + for (var i = 0; i < this.boundary.length; i++) { + this.boundaryChars[this.boundary[i]] = true; + } + }; + MultipartParser.prototype.write = function(buffer) { + var self2 = this, i = 0, len = buffer.length, prevIndex = this.index, index = this.index, state = this.state, flags = this.flags, lookbehind = this.lookbehind, boundary = this.boundary, boundaryChars = this.boundaryChars, boundaryLength = this.boundary.length, boundaryEnd = boundaryLength - 1, bufferLength = buffer.length, c, cl, mark = function(name) { + self2[name + "Mark"] = i; + }, clear = function(name) { + delete self2[name + "Mark"]; + }, callback = function(name, buffer2, start, end) { + if (start !== void 0 && start === end) { + return; + } + var callbackSymbol = "on" + name.substr(0, 1).toUpperCase() + name.substr(1); + if (callbackSymbol in self2) { + self2[callbackSymbol](buffer2, start, end); + } + }, dataCallback = function(name, clear2) { + var markSymbol = name + "Mark"; + if (!(markSymbol in self2)) { + return; + } + if (!clear2) { + callback(name, buffer, self2[markSymbol], buffer.length); + self2[markSymbol] = 0; + } else { + callback(name, buffer, self2[markSymbol], i); + delete self2[markSymbol]; + } + }; + for (i = 0; i < len; i++) { + c = buffer[i]; + switch (state) { + case S.PARSER_UNINITIALIZED: + return i; + case S.START: + index = 0; + state = S.START_BOUNDARY; + case S.START_BOUNDARY: + if (index == boundary.length - 2) { + if (c == HYPHEN) { + flags |= F.LAST_BOUNDARY; + } else if (c != CR) { + return i; + } + index++; + break; + } else if (index - 1 == boundary.length - 2) { + if (flags & F.LAST_BOUNDARY && c == HYPHEN) { + callback("end"); + state = S.END; + flags = 0; + } else if (!(flags & F.LAST_BOUNDARY) && c == LF) { + index = 0; + callback("partBegin"); + state = S.HEADER_FIELD_START; + } else { + return i; + } + break; + } + if (c != boundary[index + 2]) { + index = -2; + } + if (c == boundary[index + 2]) { + index++; + } + break; + case S.HEADER_FIELD_START: + state = S.HEADER_FIELD; + mark("headerField"); + index = 0; + case S.HEADER_FIELD: + if (c == CR) { + clear("headerField"); + state = S.HEADERS_ALMOST_DONE; + break; + } + index++; + if (c == HYPHEN) { + break; + } + if (c == COLON) { + if (index == 1) { + return i; + } + dataCallback("headerField", true); + state = S.HEADER_VALUE_START; + break; + } + cl = lower(c); + if (cl < A || cl > Z) { + return i; + } + break; + case S.HEADER_VALUE_START: + if (c == SPACE) { + break; + } + mark("headerValue"); + state = S.HEADER_VALUE; + case S.HEADER_VALUE: + if (c == CR) { + dataCallback("headerValue", true); + callback("headerEnd"); + state = S.HEADER_VALUE_ALMOST_DONE; + } + break; + case S.HEADER_VALUE_ALMOST_DONE: + if (c != LF) { + return i; + } + state = S.HEADER_FIELD_START; + break; + case S.HEADERS_ALMOST_DONE: + if (c != LF) { + return i; + } + callback("headersEnd"); + state = S.PART_DATA_START; + break; + case S.PART_DATA_START: + state = S.PART_DATA; + mark("partData"); + case S.PART_DATA: + prevIndex = index; + if (index === 0) { + i += boundaryEnd; + while (i < bufferLength && !(buffer[i] in boundaryChars)) { + i += boundaryLength; + } + i -= boundaryEnd; + c = buffer[i]; + } + if (index < boundary.length) { + if (boundary[index] == c) { + if (index === 0) { + dataCallback("partData", true); + } + index++; + } else { + index = 0; + } + } else if (index == boundary.length) { + index++; + if (c == CR) { + flags |= F.PART_BOUNDARY; + } else if (c == HYPHEN) { + flags |= F.LAST_BOUNDARY; + } else { + index = 0; + } + } else if (index - 1 == boundary.length) { + if (flags & F.PART_BOUNDARY) { + index = 0; + if (c == LF) { + flags &= ~F.PART_BOUNDARY; + callback("partEnd"); + callback("partBegin"); + state = S.HEADER_FIELD_START; + break; + } + } else if (flags & F.LAST_BOUNDARY) { + if (c == HYPHEN) { + callback("partEnd"); + callback("end"); + state = S.END; + flags = 0; + } else { + index = 0; + } + } else { + index = 0; + } + } + if (index > 0) { + lookbehind[index - 1] = c; + } else if (prevIndex > 0) { + callback("partData", lookbehind, 0, prevIndex); + prevIndex = 0; + mark("partData"); + i--; + } + break; + case S.END: + break; + default: + return i; + } + } + dataCallback("headerField"); + dataCallback("headerValue"); + dataCallback("partData"); + this.index = index; + this.state = state; + this.flags = flags; + return len; + }; + MultipartParser.prototype.end = function() { + var callback = function(self2, name) { + var callbackSymbol = "on" + name.substr(0, 1).toUpperCase() + name.substr(1); + if (callbackSymbol in self2) { + self2[callbackSymbol](); + } + }; + if (this.state == S.HEADER_FIELD_START && this.index === 0 || this.state == S.PART_DATA && this.index == this.boundary.length) { + callback(this, "partEnd"); + callback(this, "end"); + } else if (this.state != S.END) { + return new Error("MultipartParser.end(): stream ended unexpectedly: " + this.explain()); + } + }; + MultipartParser.prototype.explain = function() { + return "state = " + MultipartParser.stateToString(this.state); + }; +}); + +// node_modules/formidable/lib/querystring_parser.js +var require_querystring_parser = __commonJS((exports2) => { + if (global.GENTLY) + require = GENTLY.hijack(require); + var querystring = require("querystring"); + function QuerystringParser(maxKeys) { + this.maxKeys = maxKeys; + this.buffer = ""; + } + exports2.QuerystringParser = QuerystringParser; + QuerystringParser.prototype.write = function(buffer) { + this.buffer += buffer.toString("ascii"); + return buffer.length; + }; + QuerystringParser.prototype.end = function() { + var fields = querystring.parse(this.buffer, "&", "=", {maxKeys: this.maxKeys}); + for (var field in fields) { + this.onField(field, fields[field]); + } + this.buffer = ""; + this.onEnd(); + }; +}); + +// node_modules/formidable/lib/octet_parser.js +var require_octet_parser = __commonJS((exports2) => { + var EventEmitter = require("events").EventEmitter; + var util = require("util"); + function OctetParser(options) { + if (!(this instanceof OctetParser)) + return new OctetParser(options); + EventEmitter.call(this); + } + util.inherits(OctetParser, EventEmitter); + exports2.OctetParser = OctetParser; + OctetParser.prototype.write = function(buffer) { + this.emit("data", buffer); + return buffer.length; + }; + OctetParser.prototype.end = function() { + this.emit("end"); + }; +}); + +// node_modules/formidable/lib/json_parser.js +var require_json_parser = __commonJS((exports2) => { + if (global.GENTLY) + require = GENTLY.hijack(require); + var Buffer2 = require("buffer").Buffer; + function JSONParser(parent) { + this.parent = parent; + this.chunks = []; + this.bytesWritten = 0; + } + exports2.JSONParser = JSONParser; + JSONParser.prototype.write = function(buffer) { + this.bytesWritten += buffer.length; + this.chunks.push(buffer); + return buffer.length; + }; + JSONParser.prototype.end = function() { + try { + var fields = JSON.parse(Buffer2.concat(this.chunks)); + for (var field in fields) { + this.onField(field, fields[field]); + } + } catch (e) { + this.parent.emit("error", e); + } + this.data = null; + this.onEnd(); + }; +}); + +// node_modules/formidable/lib/incoming_form.js +var require_incoming_form = __commonJS((exports2) => { + if (global.GENTLY) + require = GENTLY.hijack(require); + var crypto = require("crypto"); + var fs = require("fs"); + var util = require("util"); + var path = require("path"); + var File = require_file(); + var MultipartParser = require_multipart_parser().MultipartParser; + var QuerystringParser = require_querystring_parser().QuerystringParser; + var OctetParser = require_octet_parser().OctetParser; + var JSONParser = require_json_parser().JSONParser; + var StringDecoder = require("string_decoder").StringDecoder; + var EventEmitter = require("events").EventEmitter; + var Stream = require("stream").Stream; + var os = require("os"); + function IncomingForm(opts) { + if (!(this instanceof IncomingForm)) + return new IncomingForm(opts); + EventEmitter.call(this); + opts = opts || {}; + this.error = null; + this.ended = false; + this.maxFields = opts.maxFields || 1e3; + this.maxFieldsSize = opts.maxFieldsSize || 20 * 1024 * 1024; + this.maxFileSize = opts.maxFileSize || 200 * 1024 * 1024; + this.keepExtensions = opts.keepExtensions || false; + this.uploadDir = opts.uploadDir || os.tmpdir && os.tmpdir() || os.tmpDir(); + this.encoding = opts.encoding || "utf-8"; + this.headers = null; + this.type = null; + this.hash = opts.hash || false; + this.multiples = opts.multiples || false; + this.bytesReceived = null; + this.bytesExpected = null; + this._parser = null; + this._flushing = 0; + this._fieldsSize = 0; + this._fileSize = 0; + this.openedFiles = []; + return this; + } + util.inherits(IncomingForm, EventEmitter); + exports2.IncomingForm = IncomingForm; + IncomingForm.prototype.parse = function(req, cb) { + this.pause = function() { + try { + req.pause(); + } catch (err) { + if (!this.ended) { + this._error(err); + } + return false; + } + return true; + }; + this.resume = function() { + try { + req.resume(); + } catch (err) { + if (!this.ended) { + this._error(err); + } + return false; + } + return true; + }; + if (cb) { + var fields = {}, files = {}; + this.on("field", function(name, value) { + fields[name] = value; + }).on("file", function(name, file) { + if (this.multiples) { + if (files[name]) { + if (!Array.isArray(files[name])) { + files[name] = [files[name]]; + } + files[name].push(file); + } else { + files[name] = file; + } + } else { + files[name] = file; + } + }).on("error", function(err) { + cb(err, fields, files); + }).on("end", function() { + cb(null, fields, files); + }); + } + this.writeHeaders(req.headers); + var self2 = this; + req.on("error", function(err) { + self2._error(err); + }).on("aborted", function() { + self2.emit("aborted"); + self2._error(new Error("Request aborted")); + }).on("data", function(buffer) { + self2.write(buffer); + }).on("end", function() { + if (self2.error) { + return; + } + var err = self2._parser.end(); + if (err) { + self2._error(err); + } + }); + return this; + }; + IncomingForm.prototype.writeHeaders = function(headers) { + this.headers = headers; + this._parseContentLength(); + this._parseContentType(); + }; + IncomingForm.prototype.write = function(buffer) { + if (this.error) { + return; + } + if (!this._parser) { + this._error(new Error("uninitialized parser")); + return; + } + this.bytesReceived += buffer.length; + this.emit("progress", this.bytesReceived, this.bytesExpected); + var bytesParsed = this._parser.write(buffer); + if (bytesParsed !== buffer.length) { + this._error(new Error("parser error, " + bytesParsed + " of " + buffer.length + " bytes parsed")); + } + return bytesParsed; + }; + IncomingForm.prototype.pause = function() { + return false; + }; + IncomingForm.prototype.resume = function() { + return false; + }; + IncomingForm.prototype.onPart = function(part) { + this.handlePart(part); + }; + IncomingForm.prototype.handlePart = function(part) { + var self2 = this; + if (part.filename === void 0) { + var value = "", decoder = new StringDecoder(this.encoding); + part.on("data", function(buffer) { + self2._fieldsSize += buffer.length; + if (self2._fieldsSize > self2.maxFieldsSize) { + self2._error(new Error("maxFieldsSize exceeded, received " + self2._fieldsSize + " bytes of field data")); + return; + } + value += decoder.write(buffer); + }); + part.on("end", function() { + self2.emit("field", part.name, value); + }); + return; + } + this._flushing++; + var file = new File({ + path: this._uploadPath(part.filename), + name: part.filename, + type: part.mime, + hash: self2.hash + }); + this.emit("fileBegin", part.name, file); + file.open(); + this.openedFiles.push(file); + part.on("data", function(buffer) { + self2._fileSize += buffer.length; + if (self2._fileSize > self2.maxFileSize) { + self2._error(new Error("maxFileSize exceeded, received " + self2._fileSize + " bytes of file data")); + return; + } + if (buffer.length == 0) { + return; + } + self2.pause(); + file.write(buffer, function() { + self2.resume(); + }); + }); + part.on("end", function() { + file.end(function() { + self2._flushing--; + self2.emit("file", part.name, file); + self2._maybeEnd(); + }); + }); + }; + function dummyParser(self2) { + return { + end: function() { + self2.ended = true; + self2._maybeEnd(); + return null; + } + }; + } + IncomingForm.prototype._parseContentType = function() { + if (this.bytesExpected === 0) { + this._parser = dummyParser(this); + return; + } + if (!this.headers["content-type"]) { + this._error(new Error("bad content-type header, no content-type")); + return; + } + if (this.headers["content-type"].match(/octet-stream/i)) { + this._initOctetStream(); + return; + } + if (this.headers["content-type"].match(/urlencoded/i)) { + this._initUrlencoded(); + return; + } + if (this.headers["content-type"].match(/multipart/i)) { + var m = this.headers["content-type"].match(/boundary=(?:"([^"]+)"|([^;]+))/i); + if (m) { + this._initMultipart(m[1] || m[2]); + } else { + this._error(new Error("bad content-type header, no multipart boundary")); + } + return; + } + if (this.headers["content-type"].match(/json/i)) { + this._initJSONencoded(); + return; + } + this._error(new Error("bad content-type header, unknown content-type: " + this.headers["content-type"])); + }; + IncomingForm.prototype._error = function(err) { + if (this.error || this.ended) { + return; + } + this.error = err; + this.emit("error", err); + if (Array.isArray(this.openedFiles)) { + this.openedFiles.forEach(function(file) { + file._writeStream.destroy(); + setTimeout(fs.unlink, 0, file.path, function(error) { + }); + }); + } + }; + IncomingForm.prototype._parseContentLength = function() { + this.bytesReceived = 0; + if (this.headers["content-length"]) { + this.bytesExpected = parseInt(this.headers["content-length"], 10); + } else if (this.headers["transfer-encoding"] === void 0) { + this.bytesExpected = 0; + } + if (this.bytesExpected !== null) { + this.emit("progress", this.bytesReceived, this.bytesExpected); + } + }; + IncomingForm.prototype._newParser = function() { + return new MultipartParser(); + }; + IncomingForm.prototype._initMultipart = function(boundary) { + this.type = "multipart"; + var parser2 = new MultipartParser(), self2 = this, headerField, headerValue, part; + parser2.initWithBoundary(boundary); + parser2.onPartBegin = function() { + part = new Stream(); + part.readable = true; + part.headers = {}; + part.name = null; + part.filename = null; + part.mime = null; + part.transferEncoding = "binary"; + part.transferBuffer = ""; + headerField = ""; + headerValue = ""; + }; + parser2.onHeaderField = function(b, start, end) { + headerField += b.toString(self2.encoding, start, end); + }; + parser2.onHeaderValue = function(b, start, end) { + headerValue += b.toString(self2.encoding, start, end); + }; + parser2.onHeaderEnd = function() { + headerField = headerField.toLowerCase(); + part.headers[headerField] = headerValue; + var m = headerValue.match(/\bname=("([^"]*)"|([^\(\)<>@,;:\\"\/\[\]\?=\{\}\s\t/]+))/i); + if (headerField == "content-disposition") { + if (m) { + part.name = m[2] || m[3] || ""; + } + part.filename = self2._fileName(headerValue); + } else if (headerField == "content-type") { + part.mime = headerValue; + } else if (headerField == "content-transfer-encoding") { + part.transferEncoding = headerValue.toLowerCase(); + } + headerField = ""; + headerValue = ""; + }; + parser2.onHeadersEnd = function() { + switch (part.transferEncoding) { + case "binary": + case "7bit": + case "8bit": + parser2.onPartData = function(b, start, end) { + part.emit("data", b.slice(start, end)); + }; + parser2.onPartEnd = function() { + part.emit("end"); + }; + break; + case "base64": + parser2.onPartData = function(b, start, end) { + part.transferBuffer += b.slice(start, end).toString("ascii"); + var offset = parseInt(part.transferBuffer.length / 4, 10) * 4; + part.emit("data", new Buffer(part.transferBuffer.substring(0, offset), "base64")); + part.transferBuffer = part.transferBuffer.substring(offset); + }; + parser2.onPartEnd = function() { + part.emit("data", new Buffer(part.transferBuffer, "base64")); + part.emit("end"); + }; + break; + default: + return self2._error(new Error("unknown transfer-encoding")); + } + self2.onPart(part); + }; + parser2.onEnd = function() { + self2.ended = true; + self2._maybeEnd(); + }; + this._parser = parser2; + }; + IncomingForm.prototype._fileName = function(headerValue) { + var m = headerValue.match(/\bfilename=("(.*?)"|([^\(\)<>@,;:\\"\/\[\]\?=\{\}\s\t/]+))($|;\s)/i); + if (!m) + return; + var match = m[2] || m[3] || ""; + var filename = match.substr(match.lastIndexOf("\\") + 1); + filename = filename.replace(/%22/g, '"'); + filename = filename.replace(/([\d]{4});/g, function(m2, code) { + return String.fromCharCode(code); + }); + return filename; + }; + IncomingForm.prototype._initUrlencoded = function() { + this.type = "urlencoded"; + var parser2 = new QuerystringParser(this.maxFields), self2 = this; + parser2.onField = function(key, val) { + self2.emit("field", key, val); + }; + parser2.onEnd = function() { + self2.ended = true; + self2._maybeEnd(); + }; + this._parser = parser2; + }; + IncomingForm.prototype._initOctetStream = function() { + this.type = "octet-stream"; + var filename = this.headers["x-file-name"]; + var mime = this.headers["content-type"]; + var file = new File({ + path: this._uploadPath(filename), + name: filename, + type: mime + }); + this.emit("fileBegin", filename, file); + file.open(); + this.openedFiles.push(file); + this._flushing++; + var self2 = this; + self2._parser = new OctetParser(); + var outstandingWrites = 0; + self2._parser.on("data", function(buffer) { + self2.pause(); + outstandingWrites++; + file.write(buffer, function() { + outstandingWrites--; + self2.resume(); + if (self2.ended) { + self2._parser.emit("doneWritingFile"); + } + }); + }); + self2._parser.on("end", function() { + self2._flushing--; + self2.ended = true; + var done = function() { + file.end(function() { + self2.emit("file", "file", file); + self2._maybeEnd(); + }); + }; + if (outstandingWrites === 0) { + done(); + } else { + self2._parser.once("doneWritingFile", done); + } + }); + }; + IncomingForm.prototype._initJSONencoded = function() { + this.type = "json"; + var parser2 = new JSONParser(this), self2 = this; + parser2.onField = function(key, val) { + self2.emit("field", key, val); + }; + parser2.onEnd = function() { + self2.ended = true; + self2._maybeEnd(); + }; + this._parser = parser2; + }; + IncomingForm.prototype._uploadPath = function(filename) { + var buf = crypto.randomBytes(16); + var name = "upload_" + buf.toString("hex"); + if (this.keepExtensions) { + var ext = path.extname(filename); + ext = ext.replace(/(\.[a-z0-9]+).*/i, "$1"); + name += ext; + } + return path.join(this.uploadDir, name); + }; + IncomingForm.prototype._maybeEnd = function() { + if (!this.ended || this._flushing || this.error) { + return; + } + this.emit("end"); + }; +}); + +// node_modules/formidable/lib/index.js +var require_lib8 = __commonJS((exports2, module2) => { + var IncomingForm = require_incoming_form().IncomingForm; + IncomingForm.IncomingForm = IncomingForm; + module2.exports = IncomingForm; +}); + +// node_modules/cookiejar/cookiejar.js +var require_cookiejar = __commonJS((exports2) => { + (function() { + "use strict"; + function CookieAccessInfo(domain, path, secure, script) { + if (this instanceof CookieAccessInfo) { + this.domain = domain || void 0; + this.path = path || "/"; + this.secure = !!secure; + this.script = !!script; + return this; + } + return new CookieAccessInfo(domain, path, secure, script); + } + CookieAccessInfo.All = Object.freeze(Object.create(null)); + exports2.CookieAccessInfo = CookieAccessInfo; + function Cookie(cookiestr, request_domain, request_path) { + if (cookiestr instanceof Cookie) { + return cookiestr; + } + if (this instanceof Cookie) { + this.name = null; + this.value = null; + this.expiration_date = Infinity; + this.path = String(request_path || "/"); + this.explicit_path = false; + this.domain = request_domain || null; + this.explicit_domain = false; + this.secure = false; + this.noscript = false; + if (cookiestr) { + this.parse(cookiestr, request_domain, request_path); + } + return this; + } + return new Cookie(cookiestr, request_domain, request_path); + } + exports2.Cookie = Cookie; + Cookie.prototype.toString = function toString() { + var str = [this.name + "=" + this.value]; + if (this.expiration_date !== Infinity) { + str.push("expires=" + new Date(this.expiration_date).toGMTString()); + } + if (this.domain) { + str.push("domain=" + this.domain); + } + if (this.path) { + str.push("path=" + this.path); + } + if (this.secure) { + str.push("secure"); + } + if (this.noscript) { + str.push("httponly"); + } + return str.join("; "); + }; + Cookie.prototype.toValueString = function toValueString() { + return this.name + "=" + this.value; + }; + var cookie_str_splitter = /[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g; + Cookie.prototype.parse = function parse(str, request_domain, request_path) { + if (this instanceof Cookie) { + var parts = str.split(";").filter(function(value2) { + return !!value2; + }); + var i; + var pair = parts[0].match(/([^=]+)=([\s\S]*)/); + if (!pair) { + console.warn("Invalid cookie header encountered. Header: '" + str + "'"); + return; + } + var key = pair[1]; + var value = pair[2]; + if (typeof key !== "string" || key.length === 0 || typeof value !== "string") { + console.warn("Unable to extract values from cookie header. Cookie: '" + str + "'"); + return; + } + this.name = key; + this.value = value; + for (i = 1; i < parts.length; i += 1) { + pair = parts[i].match(/([^=]+)(?:=([\s\S]*))?/); + key = pair[1].trim().toLowerCase(); + value = pair[2]; + switch (key) { + case "httponly": + this.noscript = true; + break; + case "expires": + this.expiration_date = value ? Number(Date.parse(value)) : Infinity; + break; + case "path": + this.path = value ? value.trim() : ""; + this.explicit_path = true; + break; + case "domain": + this.domain = value ? value.trim() : ""; + this.explicit_domain = !!this.domain; + break; + case "secure": + this.secure = true; + break; + } + } + if (!this.explicit_path) { + this.path = request_path || "/"; + } + if (!this.explicit_domain) { + this.domain = request_domain; + } + return this; + } + return new Cookie().parse(str, request_domain, request_path); + }; + Cookie.prototype.matches = function matches(access_info) { + if (access_info === CookieAccessInfo.All) { + return true; + } + if (this.noscript && access_info.script || this.secure && !access_info.secure || !this.collidesWith(access_info)) { + return false; + } + return true; + }; + Cookie.prototype.collidesWith = function collidesWith(access_info) { + if (this.path && !access_info.path || this.domain && !access_info.domain) { + return false; + } + if (this.path && access_info.path.indexOf(this.path) !== 0) { + return false; + } + if (this.explicit_path && access_info.path.indexOf(this.path) !== 0) { + return false; + } + var access_domain = access_info.domain && access_info.domain.replace(/^[\.]/, ""); + var cookie_domain = this.domain && this.domain.replace(/^[\.]/, ""); + if (cookie_domain === access_domain) { + return true; + } + if (cookie_domain) { + if (!this.explicit_domain) { + return false; + } + var wildcard = access_domain.indexOf(cookie_domain); + if (wildcard === -1 || wildcard !== access_domain.length - cookie_domain.length) { + return false; + } + return true; + } + return true; + }; + function CookieJar() { + var cookies, cookies_list, collidable_cookie; + if (this instanceof CookieJar) { + cookies = Object.create(null); + this.setCookie = function setCookie(cookie, request_domain, request_path) { + var remove, i; + cookie = new Cookie(cookie, request_domain, request_path); + remove = cookie.expiration_date <= Date.now(); + if (cookies[cookie.name] !== void 0) { + cookies_list = cookies[cookie.name]; + for (i = 0; i < cookies_list.length; i += 1) { + collidable_cookie = cookies_list[i]; + if (collidable_cookie.collidesWith(cookie)) { + if (remove) { + cookies_list.splice(i, 1); + if (cookies_list.length === 0) { + delete cookies[cookie.name]; + } + return false; + } + cookies_list[i] = cookie; + return cookie; + } + } + if (remove) { + return false; + } + cookies_list.push(cookie); + return cookie; + } + if (remove) { + return false; + } + cookies[cookie.name] = [cookie]; + return cookies[cookie.name]; + }; + this.getCookie = function getCookie(cookie_name, access_info) { + var cookie, i; + cookies_list = cookies[cookie_name]; + if (!cookies_list) { + return; + } + for (i = 0; i < cookies_list.length; i += 1) { + cookie = cookies_list[i]; + if (cookie.expiration_date <= Date.now()) { + if (cookies_list.length === 0) { + delete cookies[cookie.name]; + } + continue; + } + if (cookie.matches(access_info)) { + return cookie; + } + } + }; + this.getCookies = function getCookies(access_info) { + var matches = [], cookie_name, cookie; + for (cookie_name in cookies) { + cookie = this.getCookie(cookie_name, access_info); + if (cookie) { + matches.push(cookie); + } + } + matches.toString = function toString() { + return matches.join(":"); + }; + matches.toValueString = function toValueString() { + return matches.map(function(c) { + return c.toValueString(); + }).join(";"); + }; + return matches; + }; + return this; + } + return new CookieJar(); + } + exports2.CookieJar = CookieJar; + CookieJar.prototype.setCookies = function setCookies(cookies, request_domain, request_path) { + cookies = Array.isArray(cookies) ? cookies : cookies.split(cookie_str_splitter); + var successful = [], i, cookie; + cookies = cookies.map(function(item) { + return new Cookie(item, request_domain, request_path); + }); + for (i = 0; i < cookies.length; i += 1) { + cookie = cookies[i]; + if (this.setCookie(cookie, request_domain, request_path)) { + successful.push(cookie); + } + } + return successful; + }; + })(); +}); + +// node_modules/superagent/node_modules/semver/internal/constants.js +var require_constants3 = __commonJS((exports2, module2) => { + var SEMVER_SPEC_VERSION = "2.0.0"; + var MAX_LENGTH = 256; + var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; + var MAX_SAFE_COMPONENT_LENGTH = 16; + module2.exports = { + SEMVER_SPEC_VERSION, + MAX_LENGTH, + MAX_SAFE_INTEGER, + MAX_SAFE_COMPONENT_LENGTH + }; +}); + +// node_modules/superagent/node_modules/semver/internal/debug.js +var require_debug7 = __commonJS((exports2, module2) => { + var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => { + }; + module2.exports = debug; +}); + +// node_modules/superagent/node_modules/semver/internal/re.js +var require_re2 = __commonJS((exports2, module2) => { + var {MAX_SAFE_COMPONENT_LENGTH} = require_constants3(); + var debug = require_debug7(); + exports2 = module2.exports = {}; + var re = exports2.re = []; + var src = exports2.src = []; + var t = exports2.t = {}; + var R = 0; + var createToken = (name, value, isGlobal) => { + const index = R++; + debug(index, value); + t[name] = index; + src[index] = value; + re[index] = new RegExp(value, isGlobal ? "g" : void 0); + }; + createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*"); + createToken("NUMERICIDENTIFIERLOOSE", "[0-9]+"); + createToken("NONNUMERICIDENTIFIER", "\\d*[a-zA-Z-][a-zA-Z0-9-]*"); + createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`); + createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`); + createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`); + createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`); + createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`); + createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`); + createToken("BUILDIDENTIFIER", "[0-9A-Za-z-]+"); + createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`); + createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`); + createToken("FULL", `^${src[t.FULLPLAIN]}$`); + createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`); + createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`); + createToken("GTLT", "((?:<|>)?=?)"); + createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`); + createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`); + createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`); + createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`); + createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`); + createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`); + createToken("COERCE", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:$|[^\\d])`); + createToken("COERCERTL", src[t.COERCE], true); + createToken("LONETILDE", "(?:~>?)"); + createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true); + exports2.tildeTrimReplace = "$1~"; + createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`); + createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`); + createToken("LONECARET", "(?:\\^)"); + createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true); + exports2.caretTrimReplace = "$1^"; + createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`); + createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`); + createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`); + createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`); + createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true); + exports2.comparatorTrimReplace = "$1$2$3"; + createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`); + createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`); + createToken("STAR", "(<|>)?=?\\s*\\*"); + createToken("GTE0", "^\\s*>=\\s*0.0.0\\s*$"); + createToken("GTE0PRE", "^\\s*>=\\s*0.0.0-0\\s*$"); +}); + +// node_modules/superagent/node_modules/semver/internal/parse-options.js +var require_parse_options2 = __commonJS((exports2, module2) => { + var opts = ["includePrerelease", "loose", "rtl"]; + var parseOptions = (options) => !options ? {} : typeof options !== "object" ? {loose: true} : opts.filter((k) => options[k]).reduce((options2, k) => { + options2[k] = true; + return options2; + }, {}); + module2.exports = parseOptions; +}); + +// node_modules/superagent/node_modules/semver/internal/identifiers.js +var require_identifiers2 = __commonJS((exports2, module2) => { + var numeric = /^[0-9]+$/; + var compareIdentifiers = (a, b) => { + const anum = numeric.test(a); + const bnum = numeric.test(b); + if (anum && bnum) { + a = +a; + b = +b; + } + return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1; + }; + var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a); + module2.exports = { + compareIdentifiers, + rcompareIdentifiers + }; +}); + +// node_modules/superagent/node_modules/semver/classes/semver.js +var require_semver4 = __commonJS((exports2, module2) => { + var debug = require_debug7(); + var {MAX_LENGTH, MAX_SAFE_INTEGER} = require_constants3(); + var {re, t} = require_re2(); + var parseOptions = require_parse_options2(); + var {compareIdentifiers} = require_identifiers2(); + var SemVer = class { + constructor(version, options) { + options = parseOptions(options); + if (version instanceof SemVer) { + if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) { + return version; + } else { + version = version.version; + } + } else if (typeof version !== "string") { + throw new TypeError(`Invalid Version: ${version}`); + } + if (version.length > MAX_LENGTH) { + throw new TypeError(`version is longer than ${MAX_LENGTH} characters`); + } + debug("SemVer", version, options); + this.options = options; + this.loose = !!options.loose; + this.includePrerelease = !!options.includePrerelease; + const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]); + if (!m) { + throw new TypeError(`Invalid Version: ${version}`); + } + this.raw = version; + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError("Invalid major version"); + } + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError("Invalid minor version"); + } + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError("Invalid patch version"); + } + if (!m[4]) { + this.prerelease = []; + } else { + this.prerelease = m[4].split(".").map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id; + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num; + } + } + return id; + }); + } + this.build = m[5] ? m[5].split(".") : []; + this.format(); + } + format() { + this.version = `${this.major}.${this.minor}.${this.patch}`; + if (this.prerelease.length) { + this.version += `-${this.prerelease.join(".")}`; + } + return this.version; + } + toString() { + return this.version; + } + compare(other) { + debug("SemVer.compare", this.version, this.options, other); + if (!(other instanceof SemVer)) { + if (typeof other === "string" && other === this.version) { + return 0; + } + other = new SemVer(other, this.options); + } + if (other.version === this.version) { + return 0; + } + return this.compareMain(other) || this.comparePre(other); + } + compareMain(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch); + } + comparePre(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + if (this.prerelease.length && !other.prerelease.length) { + return -1; + } else if (!this.prerelease.length && other.prerelease.length) { + return 1; + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0; + } + let i = 0; + do { + const a = this.prerelease[i]; + const b = other.prerelease[i]; + debug("prerelease compare", i, a, b); + if (a === void 0 && b === void 0) { + return 0; + } else if (b === void 0) { + return 1; + } else if (a === void 0) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers(a, b); + } + } while (++i); + } + compareBuild(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + let i = 0; + do { + const a = this.build[i]; + const b = other.build[i]; + debug("prerelease compare", i, a, b); + if (a === void 0 && b === void 0) { + return 0; + } else if (b === void 0) { + return 1; + } else if (a === void 0) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers(a, b); + } + } while (++i); + } + inc(release, identifier) { + switch (release) { + case "premajor": + this.prerelease.length = 0; + this.patch = 0; + this.minor = 0; + this.major++; + this.inc("pre", identifier); + break; + case "preminor": + this.prerelease.length = 0; + this.patch = 0; + this.minor++; + this.inc("pre", identifier); + break; + case "prepatch": + this.prerelease.length = 0; + this.inc("patch", identifier); + this.inc("pre", identifier); + break; + case "prerelease": + if (this.prerelease.length === 0) { + this.inc("patch", identifier); + } + this.inc("pre", identifier); + break; + case "major": + if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) { + this.major++; + } + this.minor = 0; + this.patch = 0; + this.prerelease = []; + break; + case "minor": + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++; + } + this.patch = 0; + this.prerelease = []; + break; + case "patch": + if (this.prerelease.length === 0) { + this.patch++; + } + this.prerelease = []; + break; + case "pre": + if (this.prerelease.length === 0) { + this.prerelease = [0]; + } else { + let i = this.prerelease.length; + while (--i >= 0) { + if (typeof this.prerelease[i] === "number") { + this.prerelease[i]++; + i = -2; + } + } + if (i === -1) { + this.prerelease.push(0); + } + } + if (identifier) { + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0]; + } + } else { + this.prerelease = [identifier, 0]; + } + } + break; + default: + throw new Error(`invalid increment argument: ${release}`); + } + this.format(); + this.raw = this.version; + return this; + } + }; + module2.exports = SemVer; +}); + +// node_modules/superagent/node_modules/semver/functions/parse.js +var require_parse6 = __commonJS((exports2, module2) => { + var {MAX_LENGTH} = require_constants3(); + var {re, t} = require_re2(); + var SemVer = require_semver4(); + var parseOptions = require_parse_options2(); + var parse = (version, options) => { + options = parseOptions(options); + if (version instanceof SemVer) { + return version; + } + if (typeof version !== "string") { + return null; + } + if (version.length > MAX_LENGTH) { + return null; + } + const r = options.loose ? re[t.LOOSE] : re[t.FULL]; + if (!r.test(version)) { + return null; + } + try { + return new SemVer(version, options); + } catch (er) { + return null; + } + }; + module2.exports = parse; +}); + +// node_modules/superagent/node_modules/semver/functions/valid.js +var require_valid3 = __commonJS((exports2, module2) => { + var parse = require_parse6(); + var valid = (version, options) => { + const v = parse(version, options); + return v ? v.version : null; + }; + module2.exports = valid; +}); + +// node_modules/superagent/node_modules/semver/functions/clean.js +var require_clean2 = __commonJS((exports2, module2) => { + var parse = require_parse6(); + var clean = (version, options) => { + const s = parse(version.trim().replace(/^[=v]+/, ""), options); + return s ? s.version : null; + }; + module2.exports = clean; +}); + +// node_modules/superagent/node_modules/semver/functions/inc.js +var require_inc2 = __commonJS((exports2, module2) => { + var SemVer = require_semver4(); + var inc = (version, release, options, identifier) => { + if (typeof options === "string") { + identifier = options; + options = void 0; + } + try { + return new SemVer(version, options).inc(release, identifier).version; + } catch (er) { + return null; + } + }; + module2.exports = inc; +}); + +// node_modules/superagent/node_modules/semver/functions/compare.js +var require_compare2 = __commonJS((exports2, module2) => { + var SemVer = require_semver4(); + var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose)); + module2.exports = compare; +}); + +// node_modules/superagent/node_modules/semver/functions/eq.js +var require_eq2 = __commonJS((exports2, module2) => { + var compare = require_compare2(); + var eq = (a, b, loose) => compare(a, b, loose) === 0; + module2.exports = eq; +}); + +// node_modules/superagent/node_modules/semver/functions/diff.js +var require_diff2 = __commonJS((exports2, module2) => { + var parse = require_parse6(); + var eq = require_eq2(); + var diff = (version1, version2) => { + if (eq(version1, version2)) { + return null; + } else { + const v1 = parse(version1); + const v2 = parse(version2); + const hasPre = v1.prerelease.length || v2.prerelease.length; + const prefix = hasPre ? "pre" : ""; + const defaultResult = hasPre ? "prerelease" : ""; + for (const key in v1) { + if (key === "major" || key === "minor" || key === "patch") { + if (v1[key] !== v2[key]) { + return prefix + key; + } + } + } + return defaultResult; + } + }; + module2.exports = diff; +}); + +// node_modules/superagent/node_modules/semver/functions/major.js +var require_major2 = __commonJS((exports2, module2) => { + var SemVer = require_semver4(); + var major = (a, loose) => new SemVer(a, loose).major; + module2.exports = major; +}); + +// node_modules/superagent/node_modules/semver/functions/minor.js +var require_minor2 = __commonJS((exports2, module2) => { + var SemVer = require_semver4(); + var minor = (a, loose) => new SemVer(a, loose).minor; + module2.exports = minor; +}); + +// node_modules/superagent/node_modules/semver/functions/patch.js +var require_patch2 = __commonJS((exports2, module2) => { + var SemVer = require_semver4(); + var patch = (a, loose) => new SemVer(a, loose).patch; + module2.exports = patch; +}); + +// node_modules/superagent/node_modules/semver/functions/prerelease.js +var require_prerelease2 = __commonJS((exports2, module2) => { + var parse = require_parse6(); + var prerelease = (version, options) => { + const parsed = parse(version, options); + return parsed && parsed.prerelease.length ? parsed.prerelease : null; + }; + module2.exports = prerelease; +}); + +// node_modules/superagent/node_modules/semver/functions/rcompare.js +var require_rcompare2 = __commonJS((exports2, module2) => { + var compare = require_compare2(); + var rcompare = (a, b, loose) => compare(b, a, loose); + module2.exports = rcompare; +}); + +// node_modules/superagent/node_modules/semver/functions/compare-loose.js +var require_compare_loose2 = __commonJS((exports2, module2) => { + var compare = require_compare2(); + var compareLoose = (a, b) => compare(a, b, true); + module2.exports = compareLoose; +}); + +// node_modules/superagent/node_modules/semver/functions/compare-build.js +var require_compare_build2 = __commonJS((exports2, module2) => { + var SemVer = require_semver4(); + var compareBuild = (a, b, loose) => { + const versionA = new SemVer(a, loose); + const versionB = new SemVer(b, loose); + return versionA.compare(versionB) || versionA.compareBuild(versionB); + }; + module2.exports = compareBuild; +}); + +// node_modules/superagent/node_modules/semver/functions/sort.js +var require_sort2 = __commonJS((exports2, module2) => { + var compareBuild = require_compare_build2(); + var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)); + module2.exports = sort; +}); + +// node_modules/superagent/node_modules/semver/functions/rsort.js +var require_rsort2 = __commonJS((exports2, module2) => { + var compareBuild = require_compare_build2(); + var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)); + module2.exports = rsort; +}); + +// node_modules/superagent/node_modules/semver/functions/gt.js +var require_gt2 = __commonJS((exports2, module2) => { + var compare = require_compare2(); + var gt = (a, b, loose) => compare(a, b, loose) > 0; + module2.exports = gt; +}); + +// node_modules/superagent/node_modules/semver/functions/lt.js +var require_lt2 = __commonJS((exports2, module2) => { + var compare = require_compare2(); + var lt = (a, b, loose) => compare(a, b, loose) < 0; + module2.exports = lt; +}); + +// node_modules/superagent/node_modules/semver/functions/neq.js +var require_neq2 = __commonJS((exports2, module2) => { + var compare = require_compare2(); + var neq = (a, b, loose) => compare(a, b, loose) !== 0; + module2.exports = neq; +}); + +// node_modules/superagent/node_modules/semver/functions/gte.js +var require_gte2 = __commonJS((exports2, module2) => { + var compare = require_compare2(); + var gte = (a, b, loose) => compare(a, b, loose) >= 0; + module2.exports = gte; +}); + +// node_modules/superagent/node_modules/semver/functions/lte.js +var require_lte2 = __commonJS((exports2, module2) => { + var compare = require_compare2(); + var lte = (a, b, loose) => compare(a, b, loose) <= 0; + module2.exports = lte; +}); + +// node_modules/superagent/node_modules/semver/functions/cmp.js +var require_cmp2 = __commonJS((exports2, module2) => { + var eq = require_eq2(); + var neq = require_neq2(); + var gt = require_gt2(); + var gte = require_gte2(); + var lt = require_lt2(); + var lte = require_lte2(); + var cmp = (a, op, b, loose) => { + switch (op) { + case "===": + if (typeof a === "object") + a = a.version; + if (typeof b === "object") + b = b.version; + return a === b; + case "!==": + if (typeof a === "object") + a = a.version; + if (typeof b === "object") + b = b.version; + return a !== b; + case "": + case "=": + case "==": + return eq(a, b, loose); + case "!=": + return neq(a, b, loose); + case ">": + return gt(a, b, loose); + case ">=": + return gte(a, b, loose); + case "<": + return lt(a, b, loose); + case "<=": + return lte(a, b, loose); + default: + throw new TypeError(`Invalid operator: ${op}`); + } + }; + module2.exports = cmp; +}); + +// node_modules/superagent/node_modules/semver/functions/coerce.js +var require_coerce2 = __commonJS((exports2, module2) => { + var SemVer = require_semver4(); + var parse = require_parse6(); + var {re, t} = require_re2(); + var coerce = (version, options) => { + if (version instanceof SemVer) { + return version; + } + if (typeof version === "number") { + version = String(version); + } + if (typeof version !== "string") { + return null; + } + options = options || {}; + let match = null; + if (!options.rtl) { + match = version.match(re[t.COERCE]); + } else { + let next; + while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) { + if (!match || next.index + next[0].length !== match.index + match[0].length) { + match = next; + } + re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length; + } + re[t.COERCERTL].lastIndex = -1; + } + if (match === null) + return null; + return parse(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options); + }; + module2.exports = coerce; +}); + +// node_modules/superagent/node_modules/semver/classes/range.js +var require_range2 = __commonJS((exports2, module2) => { + var Range = class { + constructor(range, options) { + options = parseOptions(options); + if (range instanceof Range) { + if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) { + return range; + } else { + return new Range(range.raw, options); + } + } + if (range instanceof Comparator) { + this.raw = range.value; + this.set = [[range]]; + this.format(); + return this; + } + this.options = options; + this.loose = !!options.loose; + this.includePrerelease = !!options.includePrerelease; + this.raw = range; + this.set = range.split(/\s*\|\|\s*/).map((range2) => this.parseRange(range2.trim())).filter((c) => c.length); + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${range}`); + } + if (this.set.length > 1) { + const first = this.set[0]; + this.set = this.set.filter((c) => !isNullSet(c[0])); + if (this.set.length === 0) + this.set = [first]; + else if (this.set.length > 1) { + for (const c of this.set) { + if (c.length === 1 && isAny(c[0])) { + this.set = [c]; + break; + } + } + } + } + this.format(); + } + format() { + this.range = this.set.map((comps) => { + return comps.join(" ").trim(); + }).join("||").trim(); + return this.range; + } + toString() { + return this.range; + } + parseRange(range) { + range = range.trim(); + const memoOpts = Object.keys(this.options).join(","); + const memoKey = `parseRange:${memoOpts}:${range}`; + const cached = cache.get(memoKey); + if (cached) + return cached; + const loose = this.options.loose; + const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]; + range = range.replace(hr, hyphenReplace(this.options.includePrerelease)); + debug("hyphen replace", range); + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace); + debug("comparator trim", range, re[t.COMPARATORTRIM]); + range = range.replace(re[t.TILDETRIM], tildeTrimReplace); + range = range.replace(re[t.CARETTRIM], caretTrimReplace); + range = range.split(/\s+/).join(" "); + const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]; + const rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options)).filter(this.options.loose ? (comp) => !!comp.match(compRe) : () => true).map((comp) => new Comparator(comp, this.options)); + const l = rangeList.length; + const rangeMap = new Map(); + for (const comp of rangeList) { + if (isNullSet(comp)) + return [comp]; + rangeMap.set(comp.value, comp); + } + if (rangeMap.size > 1 && rangeMap.has("")) + rangeMap.delete(""); + const result = [...rangeMap.values()]; + cache.set(memoKey, result); + return result; + } + intersects(range, options) { + if (!(range instanceof Range)) { + throw new TypeError("a Range is required"); + } + return this.set.some((thisComparators) => { + return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => { + return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options); + }); + }); + }); + }); + } + test(version) { + if (!version) { + return false; + } + if (typeof version === "string") { + try { + version = new SemVer(version, this.options); + } catch (er) { + return false; + } + } + for (let i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true; + } + } + return false; + } + }; + module2.exports = Range; + var LRU = require_lru_cache(); + var cache = new LRU({max: 1e3}); + var parseOptions = require_parse_options2(); + var Comparator = require_comparator2(); + var debug = require_debug7(); + var SemVer = require_semver4(); + var { + re, + t, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace + } = require_re2(); + var isNullSet = (c) => c.value === "<0.0.0-0"; + var isAny = (c) => c.value === ""; + var isSatisfiable = (comparators, options) => { + let result = true; + const remainingComparators = comparators.slice(); + let testComparator = remainingComparators.pop(); + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options); + }); + testComparator = remainingComparators.pop(); + } + return result; + }; + var parseComparator = (comp, options) => { + debug("comp", comp, options); + comp = replaceCarets(comp, options); + debug("caret", comp); + comp = replaceTildes(comp, options); + debug("tildes", comp); + comp = replaceXRanges(comp, options); + debug("xrange", comp); + comp = replaceStars(comp, options); + debug("stars", comp); + return comp; + }; + var isX = (id) => !id || id.toLowerCase() === "x" || id === "*"; + var replaceTildes = (comp, options) => comp.trim().split(/\s+/).map((comp2) => { + return replaceTilde(comp2, options); + }).join(" "); + var replaceTilde = (comp, options) => { + const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]; + return comp.replace(r, (_, M, m, p, pr) => { + debug("tilde", comp, _, M, m, p, pr); + let ret; + if (isX(M)) { + ret = ""; + } else if (isX(m)) { + ret = `>=${M}.0.0 <${+M + 1}.0.0-0`; + } else if (isX(p)) { + ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`; + } else if (pr) { + debug("replaceTilde pr", pr); + ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`; + } else { + ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`; + } + debug("tilde return", ret); + return ret; + }); + }; + var replaceCarets = (comp, options) => comp.trim().split(/\s+/).map((comp2) => { + return replaceCaret(comp2, options); + }).join(" "); + var replaceCaret = (comp, options) => { + debug("caret", comp, options); + const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]; + const z = options.includePrerelease ? "-0" : ""; + return comp.replace(r, (_, M, m, p, pr) => { + debug("caret", comp, _, M, m, p, pr); + let ret; + if (isX(M)) { + ret = ""; + } else if (isX(m)) { + ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`; + } else if (isX(p)) { + if (M === "0") { + ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`; + } else { + ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`; + } + } else if (pr) { + debug("replaceCaret pr", pr); + if (M === "0") { + if (m === "0") { + ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`; + } else { + ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`; + } + } else { + ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`; + } + } else { + debug("no pr"); + if (M === "0") { + if (m === "0") { + ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`; + } else { + ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`; + } + } else { + ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`; + } + } + debug("caret return", ret); + return ret; + }); + }; + var replaceXRanges = (comp, options) => { + debug("replaceXRanges", comp, options); + return comp.split(/\s+/).map((comp2) => { + return replaceXRange(comp2, options); + }).join(" "); + }; + var replaceXRange = (comp, options) => { + comp = comp.trim(); + const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]; + return comp.replace(r, (ret, gtlt, M, m, p, pr) => { + debug("xRange", comp, ret, gtlt, M, m, p, pr); + const xM = isX(M); + const xm = xM || isX(m); + const xp = xm || isX(p); + const anyX = xp; + if (gtlt === "=" && anyX) { + gtlt = ""; + } + pr = options.includePrerelease ? "-0" : ""; + if (xM) { + if (gtlt === ">" || gtlt === "<") { + ret = "<0.0.0-0"; + } else { + ret = "*"; + } + } else if (gtlt && anyX) { + if (xm) { + m = 0; + } + p = 0; + if (gtlt === ">") { + gtlt = ">="; + if (xm) { + M = +M + 1; + m = 0; + p = 0; + } else { + m = +m + 1; + p = 0; + } + } else if (gtlt === "<=") { + gtlt = "<"; + if (xm) { + M = +M + 1; + } else { + m = +m + 1; + } + } + if (gtlt === "<") + pr = "-0"; + ret = `${gtlt + M}.${m}.${p}${pr}`; + } else if (xm) { + ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`; + } else if (xp) { + ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`; + } + debug("xRange return", ret); + return ret; + }); + }; + var replaceStars = (comp, options) => { + debug("replaceStars", comp, options); + return comp.trim().replace(re[t.STAR], ""); + }; + var replaceGTE0 = (comp, options) => { + debug("replaceGTE0", comp, options); + return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], ""); + }; + var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => { + if (isX(fM)) { + from = ""; + } else if (isX(fm)) { + from = `>=${fM}.0.0${incPr ? "-0" : ""}`; + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`; + } else if (fpr) { + from = `>=${from}`; + } else { + from = `>=${from}${incPr ? "-0" : ""}`; + } + if (isX(tM)) { + to = ""; + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0-0`; + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0-0`; + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}`; + } else if (incPr) { + to = `<${tM}.${tm}.${+tp + 1}-0`; + } else { + to = `<=${to}`; + } + return `${from} ${to}`.trim(); + }; + var testSet = (set, version, options) => { + for (let i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false; + } + } + if (version.prerelease.length && !options.includePrerelease) { + for (let i = 0; i < set.length; i++) { + debug(set[i].semver); + if (set[i].semver === Comparator.ANY) { + continue; + } + if (set[i].semver.prerelease.length > 0) { + const allowed = set[i].semver; + if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) { + return true; + } + } + } + return false; + } + return true; + }; +}); + +// node_modules/superagent/node_modules/semver/classes/comparator.js +var require_comparator2 = __commonJS((exports2, module2) => { + var ANY = Symbol("SemVer ANY"); + var Comparator = class { + static get ANY() { + return ANY; + } + constructor(comp, options) { + options = parseOptions(options); + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp; + } else { + comp = comp.value; + } + } + debug("comparator", comp, options); + this.options = options; + this.loose = !!options.loose; + this.parse(comp); + if (this.semver === ANY) { + this.value = ""; + } else { + this.value = this.operator + this.semver.version; + } + debug("comp", this); + } + parse(comp) { + const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]; + const m = comp.match(r); + if (!m) { + throw new TypeError(`Invalid comparator: ${comp}`); + } + this.operator = m[1] !== void 0 ? m[1] : ""; + if (this.operator === "=") { + this.operator = ""; + } + if (!m[2]) { + this.semver = ANY; + } else { + this.semver = new SemVer(m[2], this.options.loose); + } + } + toString() { + return this.value; + } + test(version) { + debug("Comparator.test", version, this.options.loose); + if (this.semver === ANY || version === ANY) { + return true; + } + if (typeof version === "string") { + try { + version = new SemVer(version, this.options); + } catch (er) { + return false; + } + } + return cmp(version, this.operator, this.semver, this.options); + } + intersects(comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError("a Comparator is required"); + } + if (!options || typeof options !== "object") { + options = { + loose: !!options, + includePrerelease: false + }; + } + if (this.operator === "") { + if (this.value === "") { + return true; + } + return new Range(comp.value, options).test(this.value); + } else if (comp.operator === "") { + if (comp.value === "") { + return true; + } + return new Range(this.value, options).test(comp.semver); + } + const sameDirectionIncreasing = (this.operator === ">=" || this.operator === ">") && (comp.operator === ">=" || comp.operator === ">"); + const sameDirectionDecreasing = (this.operator === "<=" || this.operator === "<") && (comp.operator === "<=" || comp.operator === "<"); + const sameSemVer = this.semver.version === comp.semver.version; + const differentDirectionsInclusive = (this.operator === ">=" || this.operator === "<=") && (comp.operator === ">=" || comp.operator === "<="); + const oppositeDirectionsLessThan = cmp(this.semver, "<", comp.semver, options) && (this.operator === ">=" || this.operator === ">") && (comp.operator === "<=" || comp.operator === "<"); + const oppositeDirectionsGreaterThan = cmp(this.semver, ">", comp.semver, options) && (this.operator === "<=" || this.operator === "<") && (comp.operator === ">=" || comp.operator === ">"); + return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan; + } + }; + module2.exports = Comparator; + var parseOptions = require_parse_options2(); + var {re, t} = require_re2(); + var cmp = require_cmp2(); + var debug = require_debug7(); + var SemVer = require_semver4(); + var Range = require_range2(); +}); + +// node_modules/superagent/node_modules/semver/functions/satisfies.js +var require_satisfies2 = __commonJS((exports2, module2) => { + var Range = require_range2(); + var satisfies = (version, range, options) => { + try { + range = new Range(range, options); + } catch (er) { + return false; + } + return range.test(version); + }; + module2.exports = satisfies; +}); + +// node_modules/superagent/node_modules/semver/ranges/to-comparators.js +var require_to_comparators2 = __commonJS((exports2, module2) => { + var Range = require_range2(); + var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" ")); + module2.exports = toComparators; +}); + +// node_modules/superagent/node_modules/semver/ranges/max-satisfying.js +var require_max_satisfying2 = __commonJS((exports2, module2) => { + var SemVer = require_semver4(); + var Range = require_range2(); + var maxSatisfying = (versions, range, options) => { + let max = null; + let maxSV = null; + let rangeObj = null; + try { + rangeObj = new Range(range, options); + } catch (er) { + return null; + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + if (!max || maxSV.compare(v) === -1) { + max = v; + maxSV = new SemVer(max, options); + } + } + }); + return max; + }; + module2.exports = maxSatisfying; +}); + +// node_modules/superagent/node_modules/semver/ranges/min-satisfying.js +var require_min_satisfying2 = __commonJS((exports2, module2) => { + var SemVer = require_semver4(); + var Range = require_range2(); + var minSatisfying = (versions, range, options) => { + let min = null; + let minSV = null; + let rangeObj = null; + try { + rangeObj = new Range(range, options); + } catch (er) { + return null; + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + if (!min || minSV.compare(v) === 1) { + min = v; + minSV = new SemVer(min, options); + } + } + }); + return min; + }; + module2.exports = minSatisfying; +}); + +// node_modules/superagent/node_modules/semver/ranges/min-version.js +var require_min_version2 = __commonJS((exports2, module2) => { + var SemVer = require_semver4(); + var Range = require_range2(); + var gt = require_gt2(); + var minVersion = (range, loose) => { + range = new Range(range, loose); + let minver = new SemVer("0.0.0"); + if (range.test(minver)) { + return minver; + } + minver = new SemVer("0.0.0-0"); + if (range.test(minver)) { + return minver; + } + minver = null; + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i]; + let setMin = null; + comparators.forEach((comparator) => { + const compver = new SemVer(comparator.semver.version); + switch (comparator.operator) { + case ">": + if (compver.prerelease.length === 0) { + compver.patch++; + } else { + compver.prerelease.push(0); + } + compver.raw = compver.format(); + case "": + case ">=": + if (!setMin || gt(compver, setMin)) { + setMin = compver; + } + break; + case "<": + case "<=": + break; + default: + throw new Error(`Unexpected operation: ${comparator.operator}`); + } + }); + if (setMin && (!minver || gt(minver, setMin))) + minver = setMin; + } + if (minver && range.test(minver)) { + return minver; + } + return null; + }; + module2.exports = minVersion; +}); + +// node_modules/superagent/node_modules/semver/ranges/valid.js +var require_valid4 = __commonJS((exports2, module2) => { + var Range = require_range2(); + var validRange = (range, options) => { + try { + return new Range(range, options).range || "*"; + } catch (er) { + return null; + } + }; + module2.exports = validRange; +}); + +// node_modules/superagent/node_modules/semver/ranges/outside.js +var require_outside2 = __commonJS((exports2, module2) => { + var SemVer = require_semver4(); + var Comparator = require_comparator2(); + var {ANY} = Comparator; + var Range = require_range2(); + var satisfies = require_satisfies2(); + var gt = require_gt2(); + var lt = require_lt2(); + var lte = require_lte2(); + var gte = require_gte2(); + var outside = (version, range, hilo, options) => { + version = new SemVer(version, options); + range = new Range(range, options); + let gtfn, ltefn, ltfn, comp, ecomp; + switch (hilo) { + case ">": + gtfn = gt; + ltefn = lte; + ltfn = lt; + comp = ">"; + ecomp = ">="; + break; + case "<": + gtfn = lt; + ltefn = gte; + ltfn = gt; + comp = "<"; + ecomp = "<="; + break; + default: + throw new TypeError('Must provide a hilo val of "<" or ">"'); + } + if (satisfies(version, range, options)) { + return false; + } + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i]; + let high = null; + let low = null; + comparators.forEach((comparator) => { + if (comparator.semver === ANY) { + comparator = new Comparator(">=0.0.0"); + } + high = high || comparator; + low = low || comparator; + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator; + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator; + } + }); + if (high.operator === comp || high.operator === ecomp) { + return false; + } + if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) { + return false; + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false; + } + } + return true; + }; + module2.exports = outside; +}); + +// node_modules/superagent/node_modules/semver/ranges/gtr.js +var require_gtr2 = __commonJS((exports2, module2) => { + var outside = require_outside2(); + var gtr = (version, range, options) => outside(version, range, ">", options); + module2.exports = gtr; +}); + +// node_modules/superagent/node_modules/semver/ranges/ltr.js +var require_ltr2 = __commonJS((exports2, module2) => { + var outside = require_outside2(); + var ltr = (version, range, options) => outside(version, range, "<", options); + module2.exports = ltr; +}); + +// node_modules/superagent/node_modules/semver/ranges/intersects.js +var require_intersects2 = __commonJS((exports2, module2) => { + var Range = require_range2(); + var intersects = (r1, r2, options) => { + r1 = new Range(r1, options); + r2 = new Range(r2, options); + return r1.intersects(r2); + }; + module2.exports = intersects; +}); + +// node_modules/superagent/node_modules/semver/ranges/simplify.js +var require_simplify2 = __commonJS((exports2, module2) => { + var satisfies = require_satisfies2(); + var compare = require_compare2(); + module2.exports = (versions, range, options) => { + const set = []; + let min = null; + let prev = null; + const v = versions.sort((a, b) => compare(a, b, options)); + for (const version of v) { + const included = satisfies(version, range, options); + if (included) { + prev = version; + if (!min) + min = version; + } else { + if (prev) { + set.push([min, prev]); + } + prev = null; + min = null; + } + } + if (min) + set.push([min, null]); + const ranges = []; + for (const [min2, max] of set) { + if (min2 === max) + ranges.push(min2); + else if (!max && min2 === v[0]) + ranges.push("*"); + else if (!max) + ranges.push(`>=${min2}`); + else if (min2 === v[0]) + ranges.push(`<=${max}`); + else + ranges.push(`${min2} - ${max}`); + } + const simplified = ranges.join(" || "); + const original = typeof range.raw === "string" ? range.raw : String(range); + return simplified.length < original.length ? simplified : range; + }; +}); + +// node_modules/superagent/node_modules/semver/ranges/subset.js +var require_subset2 = __commonJS((exports2, module2) => { + var Range = require_range2(); + var Comparator = require_comparator2(); + var {ANY} = Comparator; + var satisfies = require_satisfies2(); + var compare = require_compare2(); + var subset = (sub, dom, options = {}) => { + if (sub === dom) + return true; + sub = new Range(sub, options); + dom = new Range(dom, options); + let sawNonNull = false; + OUTER: + for (const simpleSub of sub.set) { + for (const simpleDom of dom.set) { + const isSub = simpleSubset(simpleSub, simpleDom, options); + sawNonNull = sawNonNull || isSub !== null; + if (isSub) + continue OUTER; + } + if (sawNonNull) + return false; + } + return true; + }; + var simpleSubset = (sub, dom, options) => { + if (sub === dom) + return true; + if (sub.length === 1 && sub[0].semver === ANY) { + if (dom.length === 1 && dom[0].semver === ANY) + return true; + else if (options.includePrerelease) + sub = [new Comparator(">=0.0.0-0")]; + else + sub = [new Comparator(">=0.0.0")]; + } + if (dom.length === 1 && dom[0].semver === ANY) { + if (options.includePrerelease) + return true; + else + dom = [new Comparator(">=0.0.0")]; + } + const eqSet = new Set(); + let gt, lt; + for (const c of sub) { + if (c.operator === ">" || c.operator === ">=") + gt = higherGT(gt, c, options); + else if (c.operator === "<" || c.operator === "<=") + lt = lowerLT(lt, c, options); + else + eqSet.add(c.semver); + } + if (eqSet.size > 1) + return null; + let gtltComp; + if (gt && lt) { + gtltComp = compare(gt.semver, lt.semver, options); + if (gtltComp > 0) + return null; + else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) + return null; + } + for (const eq of eqSet) { + if (gt && !satisfies(eq, String(gt), options)) + return null; + if (lt && !satisfies(eq, String(lt), options)) + return null; + for (const c of dom) { + if (!satisfies(eq, String(c), options)) + return false; + } + return true; + } + let higher, lower; + let hasDomLT, hasDomGT; + let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false; + let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false; + if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) { + needDomLTPre = false; + } + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">="; + hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<="; + if (gt) { + if (needDomGTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) { + needDomGTPre = false; + } + } + if (c.operator === ">" || c.operator === ">=") { + higher = higherGT(gt, c, options); + if (higher === c && higher !== gt) + return false; + } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) + return false; + } + if (lt) { + if (needDomLTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) { + needDomLTPre = false; + } + } + if (c.operator === "<" || c.operator === "<=") { + lower = lowerLT(lt, c, options); + if (lower === c && lower !== lt) + return false; + } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) + return false; + } + if (!c.operator && (lt || gt) && gtltComp !== 0) + return false; + } + if (gt && hasDomLT && !lt && gtltComp !== 0) + return false; + if (lt && hasDomGT && !gt && gtltComp !== 0) + return false; + if (needDomGTPre || needDomLTPre) + return false; + return true; + }; + var higherGT = (a, b, options) => { + if (!a) + return b; + const comp = compare(a.semver, b.semver, options); + return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a; + }; + var lowerLT = (a, b, options) => { + if (!a) + return b; + const comp = compare(a.semver, b.semver, options); + return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a; + }; + module2.exports = subset; +}); + +// node_modules/superagent/node_modules/semver/index.js +var require_semver5 = __commonJS((exports2, module2) => { + var internalRe = require_re2(); + module2.exports = { + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: require_constants3().SEMVER_SPEC_VERSION, + SemVer: require_semver4(), + compareIdentifiers: require_identifiers2().compareIdentifiers, + rcompareIdentifiers: require_identifiers2().rcompareIdentifiers, + parse: require_parse6(), + valid: require_valid3(), + clean: require_clean2(), + inc: require_inc2(), + diff: require_diff2(), + major: require_major2(), + minor: require_minor2(), + patch: require_patch2(), + prerelease: require_prerelease2(), + compare: require_compare2(), + rcompare: require_rcompare2(), + compareLoose: require_compare_loose2(), + compareBuild: require_compare_build2(), + sort: require_sort2(), + rsort: require_rsort2(), + gt: require_gt2(), + lt: require_lt2(), + eq: require_eq2(), + neq: require_neq2(), + gte: require_gte2(), + lte: require_lte2(), + cmp: require_cmp2(), + coerce: require_coerce2(), + Comparator: require_comparator2(), + Range: require_range2(), + satisfies: require_satisfies2(), + toComparators: require_to_comparators2(), + maxSatisfying: require_max_satisfying2(), + minSatisfying: require_min_satisfying2(), + minVersion: require_min_version2(), + validRange: require_valid4(), + outside: require_outside2(), + gtr: require_gtr2(), + ltr: require_ltr2(), + intersects: require_intersects2(), + simplifyRange: require_simplify2(), + subset: require_subset2() + }; +}); + +// node_modules/superagent/lib/utils.js +var require_utils8 = __commonJS((exports2) => { + "use strict"; + exports2.type = function(str) { + return str.split(/ *; */).shift(); + }; + exports2.params = function(str) { + return str.split(/ *; */).reduce(function(obj, str2) { + var parts = str2.split(/ *= */); + var key = parts.shift(); + var val = parts.shift(); + if (key && val) + obj[key] = val; + return obj; + }, {}); + }; + exports2.parseLinks = function(str) { + return str.split(/ *, */).reduce(function(obj, str2) { + var parts = str2.split(/ *; */); + var url = parts[0].slice(1, -1); + var rel = parts[1].split(/ *= */)[1].slice(1, -1); + obj[rel] = url; + return obj; + }, {}); + }; + exports2.cleanHeader = function(header, changesOrigin) { + delete header["content-type"]; + delete header["content-length"]; + delete header["transfer-encoding"]; + delete header.host; + if (changesOrigin) { + delete header.authorization; + delete header.cookie; + } + return header; + }; +}); + +// node_modules/superagent/lib/is-object.js +var require_is_object = __commonJS((exports2, module2) => { + "use strict"; + function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function _typeof2(obj2) { + return typeof obj2; + }; + } else { + _typeof = function _typeof2(obj2) { + return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; + }; + } + return _typeof(obj); + } + function isObject(obj) { + return obj !== null && _typeof(obj) === "object"; + } + module2.exports = isObject; +}); + +// node_modules/superagent/lib/request-base.js +var require_request_base = __commonJS((exports2, module2) => { + "use strict"; + function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function _typeof2(obj2) { + return typeof obj2; + }; + } else { + _typeof = function _typeof2(obj2) { + return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; + }; + } + return _typeof(obj); + } + var isObject = require_is_object(); + module2.exports = RequestBase; + function RequestBase(obj) { + if (obj) + return mixin(obj); + } + function mixin(obj) { + for (var key in RequestBase.prototype) { + if (Object.prototype.hasOwnProperty.call(RequestBase.prototype, key)) + obj[key] = RequestBase.prototype[key]; + } + return obj; + } + RequestBase.prototype.clearTimeout = function() { + clearTimeout(this._timer); + clearTimeout(this._responseTimeoutTimer); + clearTimeout(this._uploadTimeoutTimer); + delete this._timer; + delete this._responseTimeoutTimer; + delete this._uploadTimeoutTimer; + return this; + }; + RequestBase.prototype.parse = function(fn) { + this._parser = fn; + return this; + }; + RequestBase.prototype.responseType = function(val) { + this._responseType = val; + return this; + }; + RequestBase.prototype.serialize = function(fn) { + this._serializer = fn; + return this; + }; + RequestBase.prototype.timeout = function(options) { + if (!options || _typeof(options) !== "object") { + this._timeout = options; + this._responseTimeout = 0; + this._uploadTimeout = 0; + return this; + } + for (var option in options) { + if (Object.prototype.hasOwnProperty.call(options, option)) { + switch (option) { + case "deadline": + this._timeout = options.deadline; + break; + case "response": + this._responseTimeout = options.response; + break; + case "upload": + this._uploadTimeout = options.upload; + break; + default: + console.warn("Unknown timeout option", option); + } + } + } + return this; + }; + RequestBase.prototype.retry = function(count, fn) { + if (arguments.length === 0 || count === true) + count = 1; + if (count <= 0) + count = 0; + this._maxRetries = count; + this._retries = 0; + this._retryCallback = fn; + return this; + }; + var ERROR_CODES = ["ECONNRESET", "ETIMEDOUT", "EADDRINFO", "ESOCKETTIMEDOUT"]; + RequestBase.prototype._shouldRetry = function(err, res) { + if (!this._maxRetries || this._retries++ >= this._maxRetries) { + return false; + } + if (this._retryCallback) { + try { + var override = this._retryCallback(err, res); + if (override === true) + return true; + if (override === false) + return false; + } catch (err_) { + console.error(err_); + } + } + if (res && res.status && res.status >= 500 && res.status !== 501) + return true; + if (err) { + if (err.code && ERROR_CODES.includes(err.code)) + return true; + if (err.timeout && err.code === "ECONNABORTED") + return true; + if (err.crossDomain) + return true; + } + return false; + }; + RequestBase.prototype._retry = function() { + this.clearTimeout(); + if (this.req) { + this.req = null; + this.req = this.request(); + } + this._aborted = false; + this.timedout = false; + this.timedoutError = null; + return this._end(); + }; + RequestBase.prototype.then = function(resolve, reject) { + var _this = this; + if (!this._fullfilledPromise) { + var self2 = this; + if (this._endCalled) { + console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"); + } + this._fullfilledPromise = new Promise(function(resolve2, reject2) { + self2.on("abort", function() { + if (_this._maxRetries && _this._maxRetries > _this._retries) { + return; + } + if (_this.timedout && _this.timedoutError) { + reject2(_this.timedoutError); + return; + } + var err = new Error("Aborted"); + err.code = "ABORTED"; + err.status = _this.status; + err.method = _this.method; + err.url = _this.url; + reject2(err); + }); + self2.end(function(err, res) { + if (err) + reject2(err); + else + resolve2(res); + }); + }); + } + return this._fullfilledPromise.then(resolve, reject); + }; + RequestBase.prototype.catch = function(cb) { + return this.then(void 0, cb); + }; + RequestBase.prototype.use = function(fn) { + fn(this); + return this; + }; + RequestBase.prototype.ok = function(cb) { + if (typeof cb !== "function") + throw new Error("Callback required"); + this._okCallback = cb; + return this; + }; + RequestBase.prototype._isResponseOK = function(res) { + if (!res) { + return false; + } + if (this._okCallback) { + return this._okCallback(res); + } + return res.status >= 200 && res.status < 300; + }; + RequestBase.prototype.get = function(field) { + return this._header[field.toLowerCase()]; + }; + RequestBase.prototype.getHeader = RequestBase.prototype.get; + RequestBase.prototype.set = function(field, val) { + if (isObject(field)) { + for (var key in field) { + if (Object.prototype.hasOwnProperty.call(field, key)) + this.set(key, field[key]); + } + return this; + } + this._header[field.toLowerCase()] = val; + this.header[field] = val; + return this; + }; + RequestBase.prototype.unset = function(field) { + delete this._header[field.toLowerCase()]; + delete this.header[field]; + return this; + }; + RequestBase.prototype.field = function(name, val) { + if (name === null || name === void 0) { + throw new Error(".field(name, val) name can not be empty"); + } + if (this._data) { + throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"); + } + if (isObject(name)) { + for (var key in name) { + if (Object.prototype.hasOwnProperty.call(name, key)) + this.field(key, name[key]); + } + return this; + } + if (Array.isArray(val)) { + for (var i in val) { + if (Object.prototype.hasOwnProperty.call(val, i)) + this.field(name, val[i]); + } + return this; + } + if (val === null || val === void 0) { + throw new Error(".field(name, val) val can not be empty"); + } + if (typeof val === "boolean") { + val = String(val); + } + this._getFormData().append(name, val); + return this; + }; + RequestBase.prototype.abort = function() { + if (this._aborted) { + return this; + } + this._aborted = true; + if (this.xhr) + this.xhr.abort(); + if (this.req) + this.req.abort(); + this.clearTimeout(); + this.emit("abort"); + return this; + }; + RequestBase.prototype._auth = function(user, pass, options, base64Encoder) { + switch (options.type) { + case "basic": + this.set("Authorization", "Basic ".concat(base64Encoder("".concat(user, ":").concat(pass)))); + break; + case "auto": + this.username = user; + this.password = pass; + break; + case "bearer": + this.set("Authorization", "Bearer ".concat(user)); + break; + default: + break; + } + return this; + }; + RequestBase.prototype.withCredentials = function(on) { + if (on === void 0) + on = true; + this._withCredentials = on; + return this; + }; + RequestBase.prototype.redirects = function(n) { + this._maxRedirects = n; + return this; + }; + RequestBase.prototype.maxResponseSize = function(n) { + if (typeof n !== "number") { + throw new TypeError("Invalid argument"); + } + this._maxResponseSize = n; + return this; + }; + RequestBase.prototype.toJSON = function() { + return { + method: this.method, + url: this.url, + data: this._data, + headers: this._header + }; + }; + RequestBase.prototype.send = function(data) { + var isObj = isObject(data); + var type = this._header["content-type"]; + if (this._formData) { + throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"); + } + if (isObj && !this._data) { + if (Array.isArray(data)) { + this._data = []; + } else if (!this._isHost(data)) { + this._data = {}; + } + } else if (data && this._data && this._isHost(this._data)) { + throw new Error("Can't merge these send calls"); + } + if (isObj && isObject(this._data)) { + for (var key in data) { + if (Object.prototype.hasOwnProperty.call(data, key)) + this._data[key] = data[key]; + } + } else if (typeof data === "string") { + if (!type) + this.type("form"); + type = this._header["content-type"]; + if (type === "application/x-www-form-urlencoded") { + this._data = this._data ? "".concat(this._data, "&").concat(data) : data; + } else { + this._data = (this._data || "") + data; + } + } else { + this._data = data; + } + if (!isObj || this._isHost(data)) { + return this; + } + if (!type) + this.type("json"); + return this; + }; + RequestBase.prototype.sortQuery = function(sort) { + this._sort = typeof sort === "undefined" ? true : sort; + return this; + }; + RequestBase.prototype._finalizeQueryString = function() { + var query = this._query.join("&"); + if (query) { + this.url += (this.url.includes("?") ? "&" : "?") + query; + } + this._query.length = 0; + if (this._sort) { + var index = this.url.indexOf("?"); + if (index >= 0) { + var queryArr = this.url.slice(index + 1).split("&"); + if (typeof this._sort === "function") { + queryArr.sort(this._sort); + } else { + queryArr.sort(); + } + this.url = this.url.slice(0, index) + "?" + queryArr.join("&"); + } + } + }; + RequestBase.prototype._appendQueryString = function() { + console.warn("Unsupported"); + }; + RequestBase.prototype._timeoutError = function(reason, timeout, errno) { + if (this._aborted) { + return; + } + var err = new Error("".concat(reason + timeout, "ms exceeded")); + err.timeout = timeout; + err.code = "ECONNABORTED"; + err.errno = errno; + this.timedout = true; + this.timedoutError = err; + this.abort(); + this.callback(err); + }; + RequestBase.prototype._setTimeouts = function() { + var self2 = this; + if (this._timeout && !this._timer) { + this._timer = setTimeout(function() { + self2._timeoutError("Timeout of ", self2._timeout, "ETIME"); + }, this._timeout); + } + if (this._responseTimeout && !this._responseTimeoutTimer) { + this._responseTimeoutTimer = setTimeout(function() { + self2._timeoutError("Response timeout of ", self2._responseTimeout, "ETIMEDOUT"); + }, this._responseTimeout); + } + }; +}); + +// node_modules/superagent/lib/node/unzip.js +var require_unzip = __commonJS((exports2) => { + "use strict"; + var _require = require("string_decoder"); + var StringDecoder = _require.StringDecoder; + var Stream = require("stream"); + var zlib = require("zlib"); + exports2.unzip = function(req, res) { + var unzip = zlib.createUnzip(); + var stream = new Stream(); + var decoder; + stream.req = req; + unzip.on("error", function(err) { + if (err && err.code === "Z_BUF_ERROR") { + stream.emit("end"); + return; + } + stream.emit("error", err); + }); + res.pipe(unzip); + res.setEncoding = function(type) { + decoder = new StringDecoder(type); + }; + unzip.on("data", function(buf) { + if (decoder) { + var str = decoder.write(buf); + if (str.length > 0) + stream.emit("data", str); + } else { + stream.emit("data", buf); + } + }); + unzip.on("end", function() { + stream.emit("end"); + }); + var _on = res.on; + res.on = function(type, fn) { + if (type === "data" || type === "end") { + stream.on(type, fn.bind(res)); + } else if (type === "error") { + stream.on(type, fn.bind(res)); + _on.call(res, type, fn); + } else { + _on.call(res, type, fn); + } + return this; + }; + }; +}); + +// node_modules/superagent/lib/response-base.js +var require_response_base = __commonJS((exports2, module2) => { + "use strict"; + var utils = require_utils8(); + module2.exports = ResponseBase; + function ResponseBase(obj) { + if (obj) + return mixin(obj); + } + function mixin(obj) { + for (var key in ResponseBase.prototype) { + if (Object.prototype.hasOwnProperty.call(ResponseBase.prototype, key)) + obj[key] = ResponseBase.prototype[key]; + } + return obj; + } + ResponseBase.prototype.get = function(field) { + return this.header[field.toLowerCase()]; + }; + ResponseBase.prototype._setHeaderProperties = function(header) { + var ct = header["content-type"] || ""; + this.type = utils.type(ct); + var params = utils.params(ct); + for (var key in params) { + if (Object.prototype.hasOwnProperty.call(params, key)) + this[key] = params[key]; + } + this.links = {}; + try { + if (header.link) { + this.links = utils.parseLinks(header.link); + } + } catch (_unused) { + } + }; + ResponseBase.prototype._setStatusProperties = function(status) { + var type = status / 100 | 0; + this.statusCode = status; + this.status = this.statusCode; + this.statusType = type; + this.info = type === 1; + this.ok = type === 2; + this.redirect = type === 3; + this.clientError = type === 4; + this.serverError = type === 5; + this.error = type === 4 || type === 5 ? this.toError() : false; + this.created = status === 201; + this.accepted = status === 202; + this.noContent = status === 204; + this.badRequest = status === 400; + this.unauthorized = status === 401; + this.notAcceptable = status === 406; + this.forbidden = status === 403; + this.notFound = status === 404; + this.unprocessableEntity = status === 422; + }; +}); + +// node_modules/superagent/lib/node/response.js +var require_response2 = __commonJS((exports2, module2) => { + "use strict"; + var util = require("util"); + var Stream = require("stream"); + var ResponseBase = require_response_base(); + module2.exports = Response2; + function Response2(req) { + Stream.call(this); + this.res = req.res; + var res = this.res; + this.request = req; + this.req = req.req; + this.text = res.text; + this.body = res.body === void 0 ? {} : res.body; + this.files = res.files || {}; + this.buffered = req._resBuffered; + this.headers = res.headers; + this.header = this.headers; + this._setStatusProperties(res.statusCode); + this._setHeaderProperties(this.header); + this.setEncoding = res.setEncoding.bind(res); + res.on("data", this.emit.bind(this, "data")); + res.on("end", this.emit.bind(this, "end")); + res.on("close", this.emit.bind(this, "close")); + res.on("error", this.emit.bind(this, "error")); + } + util.inherits(Response2, Stream); + ResponseBase(Response2.prototype); + Response2.prototype.destroy = function(err) { + this.res.destroy(err); + }; + Response2.prototype.pause = function() { + this.res.pause(); + }; + Response2.prototype.resume = function() { + this.res.resume(); + }; + Response2.prototype.toError = function() { + var req = this.req; + var method = req.method; + var path = req.path; + var msg = "cannot ".concat(method, " ").concat(path, " (").concat(this.status, ")"); + var err = new Error(msg); + err.status = this.status; + err.text = this.text; + err.method = method; + err.path = path; + return err; + }; + Response2.prototype.setStatusProperties = function(status) { + console.warn("In superagent 2.x setStatusProperties is a private method"); + return this._setStatusProperties(status); + }; + Response2.prototype.toJSON = function() { + return { + req: this.request.toJSON(), + header: this.header, + status: this.status, + text: this.text + }; + }; +}); + +// node_modules/superagent/lib/node/http2wrapper.js +var require_http2wrapper = __commonJS((exports2) => { + "use strict"; + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) + symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + if (i % 2) { + ownKeys(Object(source), true).forEach(function(key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + } + return target; + } + function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, {value, enumerable: true, configurable: true, writable: true}); + } else { + obj[key] = value; + } + return obj; + } + var Stream = require("stream"); + var util = require("util"); + var net = require("net"); + var tls = require("tls"); + var _require = require("url"); + var parse = _require.parse; + var semver = require_semver5(); + var http2; + if (semver.gte(process.version, "v10.10.0")) + http2 = require("http2"); + else + throw new Error("superagent: this version of Node.js does not support http2"); + var _http2$constants = http2.constants; + var HTTP2_HEADER_PATH = _http2$constants.HTTP2_HEADER_PATH; + var HTTP2_HEADER_STATUS = _http2$constants.HTTP2_HEADER_STATUS; + var HTTP2_HEADER_METHOD = _http2$constants.HTTP2_HEADER_METHOD; + var HTTP2_HEADER_AUTHORITY = _http2$constants.HTTP2_HEADER_AUTHORITY; + var HTTP2_HEADER_HOST = _http2$constants.HTTP2_HEADER_HOST; + var HTTP2_HEADER_SET_COOKIE = _http2$constants.HTTP2_HEADER_SET_COOKIE; + var NGHTTP2_CANCEL = _http2$constants.NGHTTP2_CANCEL; + function setProtocol(protocol) { + return { + request: function request(options) { + return new Request2(protocol, options); + } + }; + } + function Request2(protocol, options) { + var _this = this; + Stream.call(this); + var defaultPort = protocol === "https:" ? 443 : 80; + var defaultHost = "localhost"; + var port = options.port || defaultPort; + var host = options.host || defaultHost; + delete options.port; + delete options.host; + this.method = options.method; + this.path = options.path; + this.protocol = protocol; + this.host = host; + delete options.method; + delete options.path; + var sessionOptions = _objectSpread({}, options); + if (options.socketPath) { + sessionOptions.socketPath = options.socketPath; + sessionOptions.createConnection = this.createUnixConnection.bind(this); + } + this._headers = {}; + var session = http2.connect("".concat(protocol, "//").concat(host, ":").concat(port), sessionOptions); + this.setHeader("host", "".concat(host, ":").concat(port)); + session.on("error", function(err) { + return _this.emit("error", err); + }); + this.session = session; + } + util.inherits(Request2, Stream); + Request2.prototype.createUnixConnection = function(authority, options) { + switch (this.protocol) { + case "http:": + return net.connect(options.socketPath); + case "https:": + options.ALPNProtocols = ["h2"]; + options.servername = this.host; + options.allowHalfOpen = true; + return tls.connect(options.socketPath, options); + default: + throw new Error("Unsupported protocol", this.protocol); + } + }; + Request2.prototype.setNoDelay = function(bool) { + }; + Request2.prototype.getFrame = function() { + var _method, _this2 = this; + if (this.frame) { + return this.frame; + } + var method = (_method = {}, _defineProperty(_method, HTTP2_HEADER_PATH, this.path), _defineProperty(_method, HTTP2_HEADER_METHOD, this.method), _method); + var headers = this.mapToHttp2Header(this._headers); + headers = Object.assign(headers, method); + var frame = this.session.request(headers); + frame.once("response", function(headers2, flags) { + headers2 = _this2.mapToHttpHeader(headers2); + frame.headers = headers2; + frame.statusCode = headers2[HTTP2_HEADER_STATUS]; + frame.status = frame.statusCode; + _this2.emit("response", frame); + }); + this._headerSent = true; + frame.once("drain", function() { + return _this2.emit("drain"); + }); + frame.on("error", function(err) { + return _this2.emit("error", err); + }); + frame.on("close", function() { + return _this2.session.close(); + }); + this.frame = frame; + return frame; + }; + Request2.prototype.mapToHttpHeader = function(headers) { + var keys = Object.keys(headers); + var http2Headers = {}; + for (var _i = 0, _keys = keys; _i < _keys.length; _i++) { + var key = _keys[_i]; + var value = headers[key]; + key = key.toLowerCase(); + switch (key) { + case HTTP2_HEADER_SET_COOKIE: + value = Array.isArray(value) ? value : [value]; + break; + default: + break; + } + http2Headers[key] = value; + } + return http2Headers; + }; + Request2.prototype.mapToHttp2Header = function(headers) { + var keys = Object.keys(headers); + var http2Headers = {}; + for (var _i2 = 0, _keys2 = keys; _i2 < _keys2.length; _i2++) { + var key = _keys2[_i2]; + var value = headers[key]; + key = key.toLowerCase(); + switch (key) { + case HTTP2_HEADER_HOST: + key = HTTP2_HEADER_AUTHORITY; + value = /^http:\/\/|^https:\/\//.test(value) ? parse(value).host : value; + break; + default: + break; + } + http2Headers[key] = value; + } + return http2Headers; + }; + Request2.prototype.setHeader = function(name, value) { + this._headers[name.toLowerCase()] = value; + }; + Request2.prototype.getHeader = function(name) { + return this._headers[name.toLowerCase()]; + }; + Request2.prototype.write = function(data, encoding) { + var frame = this.getFrame(); + return frame.write(data, encoding); + }; + Request2.prototype.pipe = function(stream, options) { + var frame = this.getFrame(); + return frame.pipe(stream, options); + }; + Request2.prototype.end = function(data) { + var frame = this.getFrame(); + frame.end(data); + }; + Request2.prototype.abort = function(data) { + var frame = this.getFrame(); + frame.close(NGHTTP2_CANCEL); + this.session.destroy(); + }; + exports2.setProtocol = setProtocol; +}); + +// node_modules/superagent/lib/agent-base.js +var require_agent_base = __commonJS((exports2, module2) => { + "use strict"; + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _unsupportedIterableToArray(o, minLen) { + if (!o) + return; + if (typeof o === "string") + return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) + n = o.constructor.name; + if (n === "Map" || n === "Set") + return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) + return _arrayLikeToArray(o, minLen); + } + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) + return Array.from(iter); + } + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) + return _arrayLikeToArray(arr); + } + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) + len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + return arr2; + } + function Agent() { + this._defaults = []; + } + ["use", "on", "once", "set", "query", "type", "accept", "auth", "withCredentials", "sortQuery", "retry", "ok", "redirects", "timeout", "buffer", "serialize", "parse", "ca", "key", "pfx", "cert", "disableTLSCerts"].forEach(function(fn) { + Agent.prototype[fn] = function() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + this._defaults.push({ + fn, + args + }); + return this; + }; + }); + Agent.prototype._setDefaults = function(req) { + this._defaults.forEach(function(def) { + req[def.fn].apply(req, _toConsumableArray(def.args)); + }); + }; + module2.exports = Agent; +}); + +// node_modules/superagent/lib/node/agent.js +var require_agent2 = __commonJS((exports2, module2) => { + "use strict"; + var _require = require("url"); + var parse = _require.parse; + var _require2 = require_cookiejar(); + var CookieJar = _require2.CookieJar; + var _require3 = require_cookiejar(); + var CookieAccessInfo = _require3.CookieAccessInfo; + var methods = require_methods(); + var request = require_node8(); + var AgentBase = require_agent_base(); + module2.exports = Agent; + function Agent(options) { + if (!(this instanceof Agent)) { + return new Agent(options); + } + AgentBase.call(this); + this.jar = new CookieJar(); + if (options) { + if (options.ca) { + this.ca(options.ca); + } + if (options.key) { + this.key(options.key); + } + if (options.pfx) { + this.pfx(options.pfx); + } + if (options.cert) { + this.cert(options.cert); + } + if (options.rejectUnauthorized === false) { + this.disableTLSCerts(); + } + } + } + Agent.prototype = Object.create(AgentBase.prototype); + Agent.prototype._saveCookies = function(res) { + var cookies = res.headers["set-cookie"]; + if (cookies) + this.jar.setCookies(cookies); + }; + Agent.prototype._attachCookies = function(req) { + var url = parse(req.url); + var access = new CookieAccessInfo(url.hostname, url.pathname, url.protocol === "https:"); + var cookies = this.jar.getCookies(access).toValueString(); + req.cookies = cookies; + }; + methods.forEach(function(name) { + var method = name.toUpperCase(); + Agent.prototype[name] = function(url, fn) { + var req = new request.Request(method, url); + req.on("response", this._saveCookies.bind(this)); + req.on("redirect", this._saveCookies.bind(this)); + req.on("redirect", this._attachCookies.bind(this, req)); + this._setDefaults(req); + this._attachCookies(req); + if (fn) { + req.end(fn); + } + return req; + }; + }); + Agent.prototype.del = Agent.prototype.delete; +}); + +// node_modules/superagent/lib/node/parsers/urlencoded.js +var require_urlencoded2 = __commonJS((exports2, module2) => { + "use strict"; + var qs = require_lib7(); + module2.exports = function(res, fn) { + res.text = ""; + res.setEncoding("ascii"); + res.on("data", function(chunk) { + res.text += chunk; + }); + res.on("end", function() { + try { + fn(null, qs.parse(res.text)); + } catch (err) { + fn(err); + } + }); + }; +}); + +// node_modules/superagent/lib/node/parsers/json.js +var require_json3 = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(res, fn) { + res.text = ""; + res.setEncoding("utf8"); + res.on("data", function(chunk) { + res.text += chunk; + }); + res.on("end", function() { + var body; + var err; + try { + body = res.text && JSON.parse(res.text); + } catch (err_) { + err = err_; + err.rawResponse = res.text || null; + err.statusCode = res.statusCode; + } finally { + fn(err, body); + } + }); + }; +}); + +// node_modules/superagent/lib/node/parsers/text.js +var require_text2 = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(res, fn) { + res.text = ""; + res.setEncoding("utf8"); + res.on("data", function(chunk) { + res.text += chunk; + }); + res.on("end", fn); + }; +}); + +// node_modules/superagent/lib/node/parsers/image.js +var require_image = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function(res, fn) { + var data = []; + res.on("data", function(chunk) { + data.push(chunk); + }); + res.on("end", function() { + fn(null, Buffer.concat(data)); + }); + }; +}); + +// node_modules/superagent/lib/node/parsers/index.js +var require_parsers2 = __commonJS((exports2) => { + "use strict"; + exports2["application/x-www-form-urlencoded"] = require_urlencoded2(); + exports2["application/json"] = require_json3(); + exports2.text = require_text2(); + var binary = require_image(); + exports2["application/octet-stream"] = binary; + exports2["application/pdf"] = binary; + exports2.image = binary; +}); + +// node_modules/superagent/lib/node/index.js +var require_node8 = __commonJS((exports2, module2) => { + "use strict"; + function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function _typeof2(obj2) { + return typeof obj2; + }; + } else { + _typeof = function _typeof2(obj2) { + return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; + }; + } + return _typeof(obj); + } + var _require = require("url"); + var parse = _require.parse; + var format = _require.format; + var resolve = _require.resolve; + var Stream = require("stream"); + var https = require("https"); + var http = require("http"); + var fs = require("fs"); + var zlib = require("zlib"); + var util = require("util"); + var qs = require_lib7(); + var mime = require_mime2(); + var methods = require_methods(); + var FormData = require_form_data(); + var formidable = require_lib8(); + var debug = require_src2()("superagent"); + var CookieJar = require_cookiejar(); + var semver = require_semver5(); + var safeStringify = require_fast_safe_stringify(); + var utils = require_utils8(); + var RequestBase = require_request_base(); + var _require2 = require_unzip(); + var unzip = _require2.unzip; + var Response2 = require_response2(); + var http2; + if (semver.gte(process.version, "v10.10.0")) + http2 = require_http2wrapper(); + function request(method, url) { + if (typeof url === "function") { + return new exports2.Request("GET", method).end(url); + } + if (arguments.length === 1) { + return new exports2.Request("GET", method); + } + return new exports2.Request(method, url); + } + module2.exports = request; + exports2 = module2.exports; + exports2.Request = Request2; + exports2.agent = require_agent2(); + function noop() { + } + exports2.Response = Response2; + mime.define({ + "application/x-www-form-urlencoded": ["form", "urlencoded", "form-data"] + }, true); + exports2.protocols = { + "http:": http, + "https:": https, + "http2:": http2 + }; + exports2.serialize = { + "application/x-www-form-urlencoded": qs.stringify, + "application/json": safeStringify + }; + exports2.parse = require_parsers2(); + exports2.buffer = {}; + function _initHeaders(req) { + req._header = {}; + req.header = {}; + } + function Request2(method, url) { + Stream.call(this); + if (typeof url !== "string") + url = format(url); + this._enableHttp2 = Boolean(process.env.HTTP2_TEST); + this._agent = false; + this._formData = null; + this.method = method; + this.url = url; + _initHeaders(this); + this.writable = true; + this._redirects = 0; + this.redirects(method === "HEAD" ? 0 : 5); + this.cookies = ""; + this.qs = {}; + this._query = []; + this.qsRaw = this._query; + this._redirectList = []; + this._streamRequest = false; + this.once("end", this.clearTimeout.bind(this)); + } + util.inherits(Request2, Stream); + RequestBase(Request2.prototype); + Request2.prototype.http2 = function(bool) { + if (exports2.protocols["http2:"] === void 0) { + throw new Error("superagent: this version of Node.js does not support http2"); + } + this._enableHttp2 = bool === void 0 ? true : bool; + return this; + }; + Request2.prototype.attach = function(field, file, options) { + if (file) { + if (this._data) { + throw new Error("superagent can't mix .send() and .attach()"); + } + var o = options || {}; + if (typeof options === "string") { + o = { + filename: options + }; + } + if (typeof file === "string") { + if (!o.filename) + o.filename = file; + debug("creating `fs.ReadStream` instance for file: %s", file); + file = fs.createReadStream(file); + } else if (!o.filename && file.path) { + o.filename = file.path; + } + this._getFormData().append(field, file, o); + } + return this; + }; + Request2.prototype._getFormData = function() { + var _this = this; + if (!this._formData) { + this._formData = new FormData(); + this._formData.on("error", function(err) { + debug("FormData error", err); + if (_this.called) { + return; + } + _this.callback(err); + _this.abort(); + }); + } + return this._formData; + }; + Request2.prototype.agent = function(agent) { + if (arguments.length === 0) + return this._agent; + this._agent = agent; + return this; + }; + Request2.prototype.type = function(type) { + return this.set("Content-Type", type.includes("/") ? type : mime.getType(type)); + }; + Request2.prototype.accept = function(type) { + return this.set("Accept", type.includes("/") ? type : mime.getType(type)); + }; + Request2.prototype.query = function(val) { + if (typeof val === "string") { + this._query.push(val); + } else { + Object.assign(this.qs, val); + } + return this; + }; + Request2.prototype.write = function(data, encoding) { + var req = this.request(); + if (!this._streamRequest) { + this._streamRequest = true; + } + return req.write(data, encoding); + }; + Request2.prototype.pipe = function(stream, options) { + this.piped = true; + this.buffer(false); + this.end(); + return this._pipeContinue(stream, options); + }; + Request2.prototype._pipeContinue = function(stream, options) { + var _this2 = this; + this.req.once("response", function(res) { + if (isRedirect(res.statusCode) && _this2._redirects++ !== _this2._maxRedirects) { + return _this2._redirect(res) === _this2 ? _this2._pipeContinue(stream, options) : void 0; + } + _this2.res = res; + _this2._emitResponse(); + if (_this2._aborted) + return; + if (_this2._shouldUnzip(res)) { + var unzipObj = zlib.createUnzip(); + unzipObj.on("error", function(err) { + if (err && err.code === "Z_BUF_ERROR") { + stream.emit("end"); + return; + } + stream.emit("error", err); + }); + res.pipe(unzipObj).pipe(stream, options); + } else { + res.pipe(stream, options); + } + res.once("end", function() { + _this2.emit("end"); + }); + }); + return stream; + }; + Request2.prototype.buffer = function(val) { + this._buffer = val !== false; + return this; + }; + Request2.prototype._redirect = function(res) { + var url = res.headers.location; + if (!url) { + return this.callback(new Error("No location header for redirect"), res); + } + debug("redirect %s -> %s", this.url, url); + url = resolve(this.url, url); + res.resume(); + var headers = this.req.getHeaders ? this.req.getHeaders() : this.req._headers; + var changesOrigin = parse(url).host !== parse(this.url).host; + if (res.statusCode === 301 || res.statusCode === 302) { + headers = utils.cleanHeader(headers, changesOrigin); + this.method = this.method === "HEAD" ? "HEAD" : "GET"; + this._data = null; + } + if (res.statusCode === 303) { + headers = utils.cleanHeader(headers, changesOrigin); + this.method = "GET"; + this._data = null; + } + delete headers.host; + delete this.req; + delete this._formData; + _initHeaders(this); + this._endCalled = false; + this.url = url; + this.qs = {}; + this._query.length = 0; + this.set(headers); + this.emit("redirect", res); + this._redirectList.push(this.url); + this.end(this._callback); + return this; + }; + Request2.prototype.auth = function(user, pass, options) { + if (arguments.length === 1) + pass = ""; + if (_typeof(pass) === "object" && pass !== null) { + options = pass; + pass = ""; + } + if (!options) { + options = { + type: "basic" + }; + } + var encoder = function encoder2(string) { + return Buffer.from(string).toString("base64"); + }; + return this._auth(user, pass, options, encoder); + }; + Request2.prototype.ca = function(cert) { + this._ca = cert; + return this; + }; + Request2.prototype.key = function(cert) { + this._key = cert; + return this; + }; + Request2.prototype.pfx = function(cert) { + if (_typeof(cert) === "object" && !Buffer.isBuffer(cert)) { + this._pfx = cert.pfx; + this._passphrase = cert.passphrase; + } else { + this._pfx = cert; + } + return this; + }; + Request2.prototype.cert = function(cert) { + this._cert = cert; + return this; + }; + Request2.prototype.disableTLSCerts = function() { + this._disableTLSCerts = true; + return this; + }; + Request2.prototype.request = function() { + var _this3 = this; + if (this.req) + return this.req; + var options = {}; + try { + var query = qs.stringify(this.qs, { + indices: false, + strictNullHandling: true + }); + if (query) { + this.qs = {}; + this._query.push(query); + } + this._finalizeQueryString(); + } catch (err) { + return this.emit("error", err); + } + var url = this.url; + var retries = this._retries; + var queryStringBackticks; + if (url.includes("`")) { + var queryStartIndex = url.indexOf("?"); + if (queryStartIndex !== -1) { + var queryString = url.slice(queryStartIndex + 1); + queryStringBackticks = queryString.match(/`|%60/g); + } + } + if (url.indexOf("http") !== 0) + url = "http://".concat(url); + url = parse(url); + if (queryStringBackticks) { + var i = 0; + url.query = url.query.replace(/%60/g, function() { + return queryStringBackticks[i++]; + }); + url.search = "?".concat(url.query); + url.path = url.pathname + url.search; + } + if (/^https?\+unix:/.test(url.protocol) === true) { + url.protocol = "".concat(url.protocol.split("+")[0], ":"); + var unixParts = url.path.match(/^([^/]+)(.+)$/); + options.socketPath = unixParts[1].replace(/%2F/g, "/"); + url.path = unixParts[2]; + } + if (this._connectOverride) { + var _url = url, hostname = _url.hostname; + var match = hostname in this._connectOverride ? this._connectOverride[hostname] : this._connectOverride["*"]; + if (match) { + if (!this._header.host) { + this.set("host", url.host); + } + var newHost; + var newPort; + if (_typeof(match) === "object") { + newHost = match.host; + newPort = match.port; + } else { + newHost = match; + newPort = url.port; + } + url.host = /:/.test(newHost) ? "[".concat(newHost, "]") : newHost; + if (newPort) { + url.host += ":".concat(newPort); + url.port = newPort; + } + url.hostname = newHost; + } + } + options.method = this.method; + options.port = url.port; + options.path = url.path; + options.host = url.hostname; + options.ca = this._ca; + options.key = this._key; + options.pfx = this._pfx; + options.cert = this._cert; + options.passphrase = this._passphrase; + options.agent = this._agent; + options.rejectUnauthorized = typeof this._disableTLSCerts === "boolean" ? !this._disableTLSCerts : process.env.NODE_TLS_REJECT_UNAUTHORIZED !== "0"; + if (this._header.host) { + options.servername = this._header.host.replace(/:\d+$/, ""); + } + if (this._trustLocalhost && /^(?:localhost|127\.0\.0\.\d+|(0*:)+:0*1)$/.test(url.hostname)) { + options.rejectUnauthorized = false; + } + var mod = this._enableHttp2 ? exports2.protocols["http2:"].setProtocol(url.protocol) : exports2.protocols[url.protocol]; + this.req = mod.request(options); + var req = this.req; + req.setNoDelay(true); + if (options.method !== "HEAD") { + req.setHeader("Accept-Encoding", "gzip, deflate"); + } + this.protocol = url.protocol; + this.host = url.host; + req.once("drain", function() { + _this3.emit("drain"); + }); + req.on("error", function(err) { + if (_this3._aborted) + return; + if (_this3._retries !== retries) + return; + if (_this3.response) + return; + _this3.callback(err); + }); + if (url.auth) { + var auth = url.auth.split(":"); + this.auth(auth[0], auth[1]); + } + if (this.username && this.password) { + this.auth(this.username, this.password); + } + for (var key in this.header) { + if (Object.prototype.hasOwnProperty.call(this.header, key)) + req.setHeader(key, this.header[key]); + } + if (this.cookies) { + if (Object.prototype.hasOwnProperty.call(this._header, "cookie")) { + var tmpJar = new CookieJar.CookieJar(); + tmpJar.setCookies(this._header.cookie.split(";")); + tmpJar.setCookies(this.cookies.split(";")); + req.setHeader("Cookie", tmpJar.getCookies(CookieJar.CookieAccessInfo.All).toValueString()); + } else { + req.setHeader("Cookie", this.cookies); + } + } + return req; + }; + Request2.prototype.callback = function(err, res) { + if (this._shouldRetry(err, res)) { + return this._retry(); + } + var fn = this._callback || noop; + this.clearTimeout(); + if (this.called) + return console.warn("superagent: double callback bug"); + this.called = true; + if (!err) { + try { + if (!this._isResponseOK(res)) { + var msg = "Unsuccessful HTTP response"; + if (res) { + msg = http.STATUS_CODES[res.status] || msg; + } + err = new Error(msg); + err.status = res ? res.status : void 0; + } + } catch (err_) { + err = err_; + } + } + if (!err) { + return fn(null, res); + } + err.response = res; + if (this._maxRetries) + err.retries = this._retries - 1; + if (err && this.listeners("error").length > 0) { + this.emit("error", err); + } + fn(err, res); + }; + Request2.prototype._isHost = function(obj) { + return Buffer.isBuffer(obj) || obj instanceof Stream || obj instanceof FormData; + }; + Request2.prototype._emitResponse = function(body, files) { + var response = new Response2(this); + this.response = response; + response.redirects = this._redirectList; + if (body !== void 0) { + response.body = body; + } + response.files = files; + if (this._endCalled) { + response.pipe = function() { + throw new Error("end() has already been called, so it's too late to start piping"); + }; + } + this.emit("response", response); + return response; + }; + Request2.prototype.end = function(fn) { + this.request(); + debug("%s %s", this.method, this.url); + if (this._endCalled) { + throw new Error(".end() was called twice. This is not supported in superagent"); + } + this._endCalled = true; + this._callback = fn || noop; + this._end(); + }; + Request2.prototype._end = function() { + var _this4 = this; + if (this._aborted) + return this.callback(new Error("The request has been aborted even before .end() was called")); + var data = this._data; + var req = this.req; + var method = this.method; + this._setTimeouts(); + if (method !== "HEAD" && !req._headerSent) { + if (typeof data !== "string") { + var contentType = req.getHeader("Content-Type"); + if (contentType) + contentType = contentType.split(";")[0]; + var serialize = this._serializer || exports2.serialize[contentType]; + if (!serialize && isJSON(contentType)) { + serialize = exports2.serialize["application/json"]; + } + if (serialize) + data = serialize(data); + } + if (data && !req.getHeader("Content-Length")) { + req.setHeader("Content-Length", Buffer.isBuffer(data) ? data.length : Buffer.byteLength(data)); + } + } + req.once("response", function(res) { + debug("%s %s -> %s", _this4.method, _this4.url, res.statusCode); + if (_this4._responseTimeoutTimer) { + clearTimeout(_this4._responseTimeoutTimer); + } + if (_this4.piped) { + return; + } + var max = _this4._maxRedirects; + var mime2 = utils.type(res.headers["content-type"] || "") || "text/plain"; + var type = mime2.split("/")[0]; + var multipart = type === "multipart"; + var redirect = isRedirect(res.statusCode); + var responseType = _this4._responseType; + _this4.res = res; + if (redirect && _this4._redirects++ !== max) { + return _this4._redirect(res); + } + if (_this4.method === "HEAD") { + _this4.emit("end"); + _this4.callback(null, _this4._emitResponse()); + return; + } + if (_this4._shouldUnzip(res)) { + unzip(req, res); + } + var buffer = _this4._buffer; + if (buffer === void 0 && mime2 in exports2.buffer) { + buffer = Boolean(exports2.buffer[mime2]); + } + var parser2 = _this4._parser; + if (buffer === void 0) { + if (parser2) { + console.warn("A custom superagent parser has been set, but buffering strategy for the parser hasn't been configured. Call `req.buffer(true or false)` or set `superagent.buffer[mime] = true or false`"); + buffer = true; + } + } + if (!parser2) { + if (responseType) { + parser2 = exports2.parse.image; + buffer = true; + } else if (multipart) { + var form = new formidable.IncomingForm(); + parser2 = form.parse.bind(form); + buffer = true; + } else if (isImageOrVideo(mime2)) { + parser2 = exports2.parse.image; + buffer = true; + } else if (exports2.parse[mime2]) { + parser2 = exports2.parse[mime2]; + } else if (type === "text") { + parser2 = exports2.parse.text; + buffer = buffer !== false; + } else if (isJSON(mime2)) { + parser2 = exports2.parse["application/json"]; + buffer = buffer !== false; + } else if (buffer) { + parser2 = exports2.parse.text; + } else if (buffer === void 0) { + parser2 = exports2.parse.image; + buffer = true; + } + } + if (buffer === void 0 && isText(mime2) || isJSON(mime2)) { + buffer = true; + } + _this4._resBuffered = buffer; + var parserHandlesEnd = false; + if (buffer) { + var responseBytesLeft = _this4._maxResponseSize || 2e8; + res.on("data", function(buf) { + responseBytesLeft -= buf.byteLength || buf.length; + if (responseBytesLeft < 0) { + var err = new Error("Maximum response size reached"); + err.code = "ETOOLARGE"; + parserHandlesEnd = false; + res.destroy(err); + } + }); + } + if (parser2) { + try { + parserHandlesEnd = buffer; + parser2(res, function(err, obj, files) { + if (_this4.timedout) { + return; + } + if (err && !_this4._aborted) { + return _this4.callback(err); + } + if (parserHandlesEnd) { + _this4.emit("end"); + _this4.callback(null, _this4._emitResponse(obj, files)); + } + }); + } catch (err) { + _this4.callback(err); + return; + } + } + _this4.res = res; + if (!buffer) { + debug("unbuffered %s %s", _this4.method, _this4.url); + _this4.callback(null, _this4._emitResponse()); + if (multipart) + return; + res.once("end", function() { + debug("end %s %s", _this4.method, _this4.url); + _this4.emit("end"); + }); + return; + } + res.once("error", function(err) { + parserHandlesEnd = false; + _this4.callback(err, null); + }); + if (!parserHandlesEnd) + res.once("end", function() { + debug("end %s %s", _this4.method, _this4.url); + _this4.emit("end"); + _this4.callback(null, _this4._emitResponse()); + }); + }); + this.emit("request", this); + var getProgressMonitor = function getProgressMonitor2() { + var lengthComputable = true; + var total = req.getHeader("Content-Length"); + var loaded = 0; + var progress = new Stream.Transform(); + progress._transform = function(chunk, encoding, cb) { + loaded += chunk.length; + _this4.emit("progress", { + direction: "upload", + lengthComputable, + loaded, + total + }); + cb(null, chunk); + }; + return progress; + }; + var bufferToChunks = function bufferToChunks2(buffer) { + var chunkSize = 16 * 1024; + var chunking = new Stream.Readable(); + var totalLength = buffer.length; + var remainder = totalLength % chunkSize; + var cutoff = totalLength - remainder; + for (var i2 = 0; i2 < cutoff; i2 += chunkSize) { + var chunk = buffer.slice(i2, i2 + chunkSize); + chunking.push(chunk); + } + if (remainder > 0) { + var remainderBuffer = buffer.slice(-remainder); + chunking.push(remainderBuffer); + } + chunking.push(null); + return chunking; + }; + var formData = this._formData; + if (formData) { + var headers = formData.getHeaders(); + for (var i in headers) { + if (Object.prototype.hasOwnProperty.call(headers, i)) { + debug('setting FormData header: "%s: %s"', i, headers[i]); + req.setHeader(i, headers[i]); + } + } + formData.getLength(function(err, length) { + debug("got FormData Content-Length: %s", length); + if (typeof length === "number") { + req.setHeader("Content-Length", length); + } + formData.pipe(getProgressMonitor()).pipe(req); + }); + } else if (Buffer.isBuffer(data)) { + bufferToChunks(data).pipe(getProgressMonitor()).pipe(req); + } else { + req.end(data); + } + }; + Request2.prototype._shouldUnzip = function(res) { + if (res.statusCode === 204 || res.statusCode === 304) { + return false; + } + if (res.headers["content-length"] === "0") { + return false; + } + return /^\s*(?:deflate|gzip)\s*$/.test(res.headers["content-encoding"]); + }; + Request2.prototype.connect = function(connectOverride) { + if (typeof connectOverride === "string") { + this._connectOverride = { + "*": connectOverride + }; + } else if (_typeof(connectOverride) === "object") { + this._connectOverride = connectOverride; + } else { + this._connectOverride = void 0; + } + return this; + }; + Request2.prototype.trustLocalhost = function(toggle) { + this._trustLocalhost = toggle === void 0 ? true : toggle; + return this; + }; + if (!methods.includes("del")) { + methods = methods.slice(0); + methods.push("del"); + } + methods.forEach(function(method) { + var name = method; + method = method === "del" ? "delete" : method; + method = method.toUpperCase(); + request[name] = function(url, data, fn) { + var req = request(method, url); + if (typeof data === "function") { + fn = data; + data = null; + } + if (data) { + if (method === "GET" || method === "HEAD") { + req.query(data); + } else { + req.send(data); + } + } + if (fn) + req.end(fn); + return req; + }; + }); + function isText(mime2) { + var parts = mime2.split("/"); + var type = parts[0]; + var subtype = parts[1]; + return type === "text" || subtype === "x-www-form-urlencoded"; + } + function isImageOrVideo(mime2) { + var type = mime2.split("/")[0]; + return type === "image" || type === "video"; + } + function isJSON(mime2) { + return /[/+]json($|[^-\w])/.test(mime2); + } + function isRedirect(code) { + return [301, 302, 303, 305, 307, 308].includes(code); + } +}); + +// node_modules/smee-client/index.js +var require_smee_client = __commonJS((exports2, module2) => { + "use strict"; + var validator = require_validator2(); + var EventSource = require_eventsource(); + var superagent = require_node8(); + var url = require("url"); + var querystring = require("querystring"); + var Client = class { + constructor({source, target, logger = console}) { + this.source = source; + this.target = target; + this.logger = logger; + if (!validator.isURL(this.source)) { + throw new Error("The provided URL is invalid."); + } + } + static async createChannel() { + return superagent.head("https://smee.io/new").redirects(0).catch((err) => { + return err.response.headers.location; + }); + } + onmessage(msg) { + const data = JSON.parse(msg.data); + const target = url.parse(this.target, true); + const mergedQuery = Object.assign(target.query, data.query); + target.search = querystring.stringify(mergedQuery); + delete data.query; + const req = superagent.post(url.format(target)).send(data.body); + delete data.body; + Object.keys(data).forEach((key) => { + req.set(key, data[key]); + }); + req.end((err, res) => { + if (err) { + this.logger.error(err); + } else { + this.logger.info(`${req.method} ${req.url} - ${res.status}`); + } + }); + } + onopen() { + this.logger.info("Connected", this.events.url); + } + onerror(err) { + this.logger.error(err); + } + start() { + const events = new EventSource(this.source); + events.reconnectInterval = 0; + events.addEventListener("message", this.onmessage.bind(this)); + events.addEventListener("open", this.onopen.bind(this)); + events.addEventListener("error", this.onerror.bind(this)); + this.logger.info(`Forwarding ${this.source} to ${this.target}`); + this.events = events; + return events; + } + }; + module2.exports = Client; +}); + +// node_modules/probot/lib/helpers/webhook-proxy.js +var require_webhook_proxy = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.createWebhookProxy = void 0; + var createWebhookProxy = (opts) => { + try { + const SmeeClient = require_smee_client(); + const smee = new SmeeClient({ + logger: opts.logger, + source: opts.url, + target: `http://localhost:${opts.port}${opts.path}` + }); + return smee.start(); + } catch (error) { + opts.logger.warn("Run `npm install --save-dev smee-client` to proxy webhooks to localhost."); + return; + } + }; + exports2.createWebhookProxy = createWebhookProxy; +}); + +// node_modules/probot/lib/server/server.js +var require_server = __commonJS((exports2) => { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, {enumerable: true, get: function() { + return m[k]; + }}); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", {enumerable: true, value: v}); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.Server = void 0; + var express_1 = __importStar(require_express3()); + var path_1 = require("path"); + var get_log_1 = require_get_log(); + var logging_middleware_1 = require_logging_middleware(); + var webhook_proxy_1 = require_webhook_proxy(); + var version_1 = require_version4(); + var Server = class { + constructor(options = {}) { + this.version = version_1.VERSION; + this.expressApp = express_1.default(); + this.log = options.log || get_log_1.getLog().child({name: "server"}); + this.probotApp = new options.Probot(); + this.state = { + port: options.port, + host: options.host, + webhookPath: options.webhookPath || "/", + webhookProxy: options.webhookProxy + }; + this.expressApp.use(logging_middleware_1.getLoggingMiddleware(this.log)); + this.expressApp.use("/probot/static/", express_1.default.static(path_1.join(__dirname, "..", "..", "static"))); + this.expressApp.use(this.state.webhookPath, this.probotApp.webhooks.middleware); + this.expressApp.set("view engine", "hbs"); + this.expressApp.set("views", path_1.join(__dirname, "..", "..", "views")); + this.expressApp.get("/ping", (req, res) => res.end("PONG")); + } + async load(appFn) { + await appFn(this.probotApp, { + getRouter: (path) => this.router(path) + }); + } + async start() { + this.log.info(`Running Probot v${this.version} (Node.js: ${process.version})`); + const port = this.state.port || 3e3; + const {host, webhookPath, webhookProxy} = this.state; + const printableHost = host !== null && host !== void 0 ? host : "localhost"; + this.state.httpServer = await new Promise((resolve, reject) => { + const server = this.expressApp.listen(port, ...host ? [host] : [], () => { + if (webhookProxy) { + this.state.eventSource = webhook_proxy_1.createWebhookProxy({ + logger: this.log, + path: webhookPath, + port, + url: webhookProxy + }); + } + this.log.info(`Listening on http://${printableHost}:${port}`); + resolve(server); + }); + server.on("error", (error) => { + if (error.code === "EADDRINUSE") { + error = Object.assign(error, { + message: `Port ${port} is already in use. You can define the PORT environment variable to use a different port.` + }); + } + this.log.error(error); + reject(error); + }); + }); + return this.state.httpServer; + } + async stop() { + if (this.state.eventSource) + this.state.eventSource.close(); + if (!this.state.httpServer) + return; + const server = this.state.httpServer; + return new Promise((resolve) => server.close(resolve)); + } + router(path = "/") { + const newRouter = express_1.Router(); + this.expressApp.use(path, newRouter); + return newRouter; + } + }; + exports2.Server = Server; + Server.version = version_1.VERSION; +}); + +// node_modules/pkg-conf/node_modules/path-exists/index.js +var require_path_exists = __commonJS((exports2, module2) => { + "use strict"; + var fs = require("fs"); + module2.exports = (fp) => new Promise((resolve) => { + fs.access(fp, (err) => { + resolve(!err); + }); + }); + module2.exports.sync = (fp) => { + try { + fs.accessSync(fp); + return true; + } catch (err) { + return false; + } + }; +}); + +// node_modules/p-try/index.js +var require_p_try = __commonJS((exports2, module2) => { + "use strict"; + var pTry = (fn, ...arguments_) => new Promise((resolve) => { + resolve(fn(...arguments_)); + }); + module2.exports = pTry; + module2.exports.default = pTry; +}); + +// node_modules/p-limit/index.js +var require_p_limit = __commonJS((exports2, module2) => { + "use strict"; + var pTry = require_p_try(); + var pLimit = (concurrency) => { + if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) { + return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up")); + } + const queue = []; + let activeCount = 0; + const next = () => { + activeCount--; + if (queue.length > 0) { + queue.shift()(); + } + }; + const run2 = (fn, resolve, ...args) => { + activeCount++; + const result = pTry(fn, ...args); + resolve(result); + result.then(next, next); + }; + const enqueue = (fn, resolve, ...args) => { + if (activeCount < concurrency) { + run2(fn, resolve, ...args); + } else { + queue.push(run2.bind(null, fn, resolve, ...args)); + } + }; + const generator = (fn, ...args) => new Promise((resolve) => enqueue(fn, resolve, ...args)); + Object.defineProperties(generator, { + activeCount: { + get: () => activeCount + }, + pendingCount: { + get: () => queue.length + }, + clearQueue: { + value: () => { + queue.length = 0; + } + } + }); + return generator; + }; + module2.exports = pLimit; + module2.exports.default = pLimit; +}); + +// node_modules/pkg-conf/node_modules/p-locate/index.js +var require_p_locate = __commonJS((exports2, module2) => { + "use strict"; + var pLimit = require_p_limit(); + var EndError = class extends Error { + constructor(value) { + super(); + this.value = value; + } + }; + var testElement = (el, tester) => Promise.resolve(el).then(tester); + var finder = (el) => Promise.all(el).then((val) => val[1] === true && Promise.reject(new EndError(val[0]))); + module2.exports = (iterable, tester, opts) => { + opts = Object.assign({ + concurrency: Infinity, + preserveOrder: true + }, opts); + const limit = pLimit(opts.concurrency); + const items = [...iterable].map((el) => [el, limit(testElement, el, tester)]); + const checkLimit = pLimit(opts.preserveOrder ? 1 : Infinity); + return Promise.all(items.map((el) => checkLimit(finder, el))).then(() => { + }).catch((err) => err instanceof EndError ? err.value : Promise.reject(err)); + }; +}); + +// node_modules/pkg-conf/node_modules/locate-path/index.js +var require_locate_path = __commonJS((exports2, module2) => { + "use strict"; + var path = require("path"); + var pathExists = require_path_exists(); + var pLocate = require_p_locate(); + module2.exports = (iterable, options) => { + options = Object.assign({ + cwd: process.cwd() + }, options); + return pLocate(iterable, (el) => pathExists(path.resolve(options.cwd, el)), options); + }; + module2.exports.sync = (iterable, options) => { + options = Object.assign({ + cwd: process.cwd() + }, options); + for (const el of iterable) { + if (pathExists.sync(path.resolve(options.cwd, el))) { + return el; + } + } + }; +}); + +// node_modules/pkg-conf/node_modules/find-up/index.js +var require_find_up = __commonJS((exports2, module2) => { + "use strict"; + var path = require("path"); + var locatePath = require_locate_path(); + module2.exports = (filename, opts = {}) => { + const startDir = path.resolve(opts.cwd || ""); + const {root} = path.parse(startDir); + const filenames = [].concat(filename); + return new Promise((resolve) => { + (function find(dir) { + locatePath(filenames, {cwd: dir}).then((file) => { + if (file) { + resolve(path.join(dir, file)); + } else if (dir === root) { + resolve(null); + } else { + find(path.dirname(dir)); + } + }); + })(startDir); + }); + }; + module2.exports.sync = (filename, opts = {}) => { + let dir = path.resolve(opts.cwd || ""); + const {root} = path.parse(dir); + const filenames = [].concat(filename); + while (true) { + const file = locatePath.sync(filenames, {cwd: dir}); + if (file) { + return path.join(dir, file); + } + if (dir === root) { + return null; + } + dir = path.dirname(dir); + } + }; +}); + +// node_modules/graceful-fs/polyfills.js +var require_polyfills = __commonJS((exports2, module2) => { + var constants = require("constants"); + var origCwd = process.cwd; + var cwd = null; + var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform; + process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process); + return cwd; + }; + try { + process.cwd(); + } catch (er) { + } + if (typeof process.chdir === "function") { + chdir = process.chdir; + process.chdir = function(d) { + cwd = null; + chdir.call(process, d); + }; + if (Object.setPrototypeOf) + Object.setPrototypeOf(process.chdir, chdir); + } + var chdir; + module2.exports = patch; + function patch(fs) { + if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs); + } + if (!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); + if (!fs.lchmod) { + fs.lchmod = function(path, mode, cb) { + if (cb) + process.nextTick(cb); + }; + fs.lchmodSync = function() { + }; + } + if (!fs.lchown) { + fs.lchown = function(path, uid, gid, cb) { + if (cb) + process.nextTick(cb); + }; + fs.lchownSync = function() { + }; + } + if (platform === "win32") { + fs.rename = function(fs$rename) { + return function(from, to, cb) { + var start = Date.now(); + var 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) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er); + }); + }, backoff); + if (backoff < 100) + backoff += 10; + return; + } + if (cb) + cb(er); + }); + }; + }(fs.rename); + } + 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) { + eagCounter++; + return 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); + } + if (Object.setPrototypeOf) + Object.setPrototypeOf(read, fs$read); + return read; + }(fs.read); + fs.readSync = function(fs$readSync) { + return function(fd, buffer, offset, length, position) { + var eagCounter = 0; + while (true) { + 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) { + if (callback) + callback(err); + return; + } + fs2.fchmod(fd, mode, function(err2) { + fs2.close(fd, function(err22) { + if (callback) + callback(err2 || err22); + }); + }); + }); + }; + fs2.lchmodSync = function(path, mode) { + var fd = fs2.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode); + var threw = true; + var ret; + try { + ret = fs2.fchmodSync(fd, mode); + threw = false; + } finally { + if (threw) { + try { + fs2.closeSync(fd); + } catch (er) { + } + } else { + fs2.closeSync(fd); + } + } + return ret; + }; + } + function patchLutimes(fs2) { + if (constants.hasOwnProperty("O_SYMLINK")) { + fs2.lutimes = function(path, at, mt, cb) { + fs2.open(path, constants.O_SYMLINK, function(er, fd) { + if (er) { + if (cb) + cb(er); + return; + } + fs2.futimes(fd, at, mt, function(er2) { + fs2.close(fd, function(er22) { + if (cb) + cb(er2 || er22); + }); + }); + }); + }; + fs2.lutimesSync = function(path, at, mt) { + var fd = fs2.openSync(path, constants.O_SYMLINK); + var ret; + var threw = true; + try { + ret = fs2.futimesSync(fd, at, mt); + threw = false; + } finally { + if (threw) { + try { + fs2.closeSync(fd); + } catch (er) { + } + } else { + fs2.closeSync(fd); + } + } + return ret; + }; + } else { + fs2.lutimes = function(_a, _b, _c, cb) { + if (cb) + process.nextTick(cb); + }; + fs2.lutimesSync = function() { + }; + } + } + function chmodFix(orig) { + if (!orig) + return orig; + return function(target, mode, cb) { + return orig.call(fs, target, mode, function(er) { + if (chownErOk(er)) + er = null; + if (cb) + cb.apply(this, arguments); + }); + }; + } + function chmodFixSync(orig) { + if (!orig) + return orig; + return function(target, mode) { + try { + return orig.call(fs, target, mode); + } catch (er) { + if (!chownErOk(er)) + throw er; + } + }; + } + function chownFix(orig) { + if (!orig) + return orig; + return function(target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function(er) { + if (chownErOk(er)) + er = null; + if (cb) + cb.apply(this, arguments); + }); + }; + } + function chownFixSync(orig) { + if (!orig) + return orig; + return function(target, uid, gid) { + try { + return orig.call(fs, target, uid, gid); + } catch (er) { + if (!chownErOk(er)) + throw er; + } + }; + } + function statFix(orig) { + if (!orig) + return orig; + return function(target, options, cb) { + if (typeof options === "function") { + cb = options; + options = null; + } + function callback(er, stats) { + if (stats) { + if (stats.uid < 0) + stats.uid += 4294967296; + if (stats.gid < 0) + stats.gid += 4294967296; + } + if (cb) + cb.apply(this, arguments); + } + return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback); + }; + } + function statFixSync(orig) { + if (!orig) + return orig; + return function(target, options) { + var stats = options ? orig.call(fs, target, options) : orig.call(fs, target); + if (stats.uid < 0) + stats.uid += 4294967296; + if (stats.gid < 0) + stats.gid += 4294967296; + return stats; + }; + } + function chownErOk(er) { + if (!er) + return true; + if (er.code === "ENOSYS") + return true; + var nonroot = !process.getuid || process.getuid() !== 0; + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true; + } + return false; + } + } +}); + +// node_modules/graceful-fs/legacy-streams.js +var require_legacy_streams = __commonJS((exports2, module2) => { + var Stream = require("stream").Stream; + module2.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 self2 = this; + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; + this.flags = "r"; + this.mode = 438; + this.bufferSize = 64 * 1024; + options = options || {}; + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + if (this.encoding) + this.setEncoding(this.encoding); + if (this.start !== void 0) { + if (typeof this.start !== "number") { + throw TypeError("start must be a Number"); + } + if (this.end === void 0) { + this.end = Infinity; + } 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() { + self2._read(); + }); + return; + } + fs.open(this.path, this.flags, this.mode, function(err, fd) { + if (err) { + self2.emit("error", err); + self2.readable = false; + return; + } + self2.fd = fd; + self2.emit("open", fd); + self2._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 = true; + this.flags = "w"; + this.encoding = "binary"; + this.mode = 438; + this.bytesWritten = 0; + options = options || {}; + var keys = Object.keys(options); + for (var 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 = false; + this._queue = []; + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, void 0]); + this.flush(); + } + } + } +}); + +// node_modules/graceful-fs/clone.js +var require_clone = __commonJS((exports2, module2) => { + "use strict"; + module2.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 = Object.create(null); + Object.getOwnPropertyNames(obj).forEach(function(key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)); + }); + return copy; + } +}); + +// node_modules/graceful-fs/graceful-fs.js +var require_graceful_fs = __commonJS((exports2, module2) => { + var fs = require("fs"); + var polyfills = require_polyfills(); + var legacy = require_legacy_streams(); + var clone = require_clone(); + var util = require("util"); + var gracefulQueue; + var previousSymbol; + if (typeof Symbol === "function" && typeof Symbol.for === "function") { + gracefulQueue = Symbol.for("graceful-fs.queue"); + previousSymbol = Symbol.for("graceful-fs.previous"); + } else { + gracefulQueue = "___graceful-fs.queue"; + previousSymbol = "___graceful-fs.previous"; + } + function noop() { + } + function publishQueue(context, queue2) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue2; + } + }); + } + var debug = noop; + if (util.debuglog) + debug = util.debuglog("gfs4"); + else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) + debug = function() { + var m = util.format.apply(util, arguments); + m = "GFS4: " + m.split(/\n/).join("\nGFS4: "); + console.error(m); + }; + if (!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) { + if (!err) { + retry(); + } + if (typeof cb === "function") + cb.apply(this, arguments); + }); + } + Object.defineProperty(close, previousSymbol, { + value: fs$close + }); + return close; + }(fs.close); + fs.closeSync = function(fs$closeSync) { + function closeSync(fd) { + fs$closeSync.apply(fs, arguments); + retry(); + } + Object.defineProperty(closeSync, previousSymbol, { + value: fs$closeSync + }); + return closeSync; + }(fs.closeSync); + if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) { + process.on("exit", function() { + debug(fs[gracefulQueue]); + require("assert").equal(fs[gracefulQueue].length, 0); + }); + } + } + var queue; + if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); + } + module2.exports = patch(clone(fs)); + if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module2.exports = patch(fs); + fs.__patched = true; + } + 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) { + if (typeof options === "function") + cb = options, options = null; + return go$readFile(path, options, cb); + function go$readFile(path2, options2, cb2) { + return fs$readFile(path2, options2, function(err) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$readFile, [path2, options2, cb2]]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + retry(); + } + }); + } + } + var fs$writeFile = fs2.writeFile; + fs2.writeFile = writeFile; + function writeFile(path, data, options, cb) { + if (typeof options === "function") + cb = options, options = null; + return go$writeFile(path, data, options, cb); + function go$writeFile(path2, data2, options2, cb2) { + return fs$writeFile(path2, data2, options2, function(err) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$writeFile, [path2, data2, options2, cb2]]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + retry(); + } + }); + } + } + var fs$appendFile = fs2.appendFile; + if (fs$appendFile) + fs2.appendFile = appendFile; + function appendFile(path, data, options, cb) { + if (typeof options === "function") + cb = options, options = null; + return go$appendFile(path, data, options, cb); + function go$appendFile(path2, data2, options2, cb2) { + return fs$appendFile(path2, data2, options2, function(err) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$appendFile, [path2, data2, options2, cb2]]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + retry(); + } + }); + } + } + var fs$copyFile = fs2.copyFile; + if (fs$copyFile) + fs2.copyFile = copyFile; + function copyFile(src, dest, flags, cb) { + if (typeof flags === "function") { + cb = flags; + flags = 0; + } + return fs$copyFile(src, dest, flags, function(err) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([fs$copyFile, [src, dest, flags, cb]]); + else { + if (typeof cb === "function") + cb.apply(this, arguments); + retry(); + } + }); + } + var fs$readdir = fs2.readdir; + fs2.readdir = readdir; + function readdir(path, options, cb) { + var args = [path]; + if (typeof options !== "function") { + args.push(options); + } else { + cb = options; + } + args.push(go$readdir$cb); + return go$readdir(args); + function go$readdir$cb(err, files) { + if (files && files.sort) + files.sort(); + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$readdir, [args]]); + else { + if (typeof cb === "function") + cb.apply(this, arguments); + retry(); + } + } + } + function go$readdir(args) { + return fs$readdir.apply(fs2, args); + } + if (process.version.substr(0, 4) === "v0.8") { + var legStreams = legacy(fs2); + ReadStream = legStreams.ReadStream; + WriteStream = legStreams.WriteStream; + } + var fs$ReadStream = fs2.ReadStream; + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype); + ReadStream.prototype.open = ReadStream$open; + } + var fs$WriteStream = fs2.WriteStream; + if (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: true, + configurable: true + }); + Object.defineProperty(fs2, "WriteStream", { + get: function() { + return WriteStream; + }, + set: function(val) { + WriteStream = val; + }, + enumerable: true, + configurable: true + }); + var FileReadStream = ReadStream; + Object.defineProperty(fs2, "FileReadStream", { + get: function() { + return FileReadStream; + }, + set: function(val) { + FileReadStream = val; + }, + enumerable: true, + configurable: true + }); + var FileWriteStream = WriteStream; + Object.defineProperty(fs2, "FileWriteStream", { + get: function() { + return FileWriteStream; + }, + set: function(val) { + FileWriteStream = val; + }, + enumerable: true, + configurable: true + }); + function ReadStream(path, options) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this; + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments); + } + function ReadStream$open() { + var that = this; + open(that.path, that.flags, that.mode, function(err, fd) { + if (err) { + if (that.autoClose) + that.destroy(); + that.emit("error", err); + } else { + that.fd = fd; + that.emit("open", fd); + that.read(); + } + }); + } + function WriteStream(path, options) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this; + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments); + } + function WriteStream$open() { + var that = this; + open(that.path, that.flags, that.mode, function(err, fd) { + if (err) { + that.destroy(); + that.emit("error", err); + } else { + 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) { + if (typeof mode === "function") + cb = mode, mode = null; + return go$open(path, flags, mode, cb); + function go$open(path2, flags2, mode2, cb2) { + return fs$open(path2, flags2, mode2, function(err, fd) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$open, [path2, flags2, mode2, cb2]]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + retry(); + } + }); + } + } + return fs2; + } + function enqueue(elem) { + debug("ENQUEUE", elem[0].name, elem[1]); + fs[gracefulQueue].push(elem); + } + function retry() { + var elem = fs[gracefulQueue].shift(); + if (elem) { + debug("RETRY", elem[0].name, elem[1]); + elem[0].apply(null, elem[1]); + } + } +}); + +// node_modules/load-json-file/node_modules/strip-bom/index.js +var require_strip_bom = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = (x) => { + if (typeof x !== "string") { + throw new TypeError("Expected a string, got " + typeof x); + } + if (x.charCodeAt(0) === 65279) { + return x.slice(1); + } + return x; + }; +}); + +// node_modules/is-arrayish/index.js +var require_is_arrayish = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = function isArrayish(obj) { + if (!obj) { + return false; + } + return obj instanceof Array || Array.isArray(obj) || obj.length >= 0 && obj.splice instanceof Function; + }; +}); + +// node_modules/error-ex/index.js +var require_error_ex = __commonJS((exports2, module2) => { + "use strict"; + var util = require("util"); + var isArrayish = require_is_arrayish(); + var errorEx = function errorEx2(name, properties) { + if (!name || name.constructor !== String) { + properties = name || {}; + name = Error.name; + } + var errorExError = function ErrorEXError(message) { + if (!this) { + return new ErrorEXError(message); + } + message = message instanceof Error ? message.message : message || this.message; + Error.call(this, message); + Error.captureStackTrace(this, errorExError); + this.name = name; + Object.defineProperty(this, "message", { + configurable: true, + enumerable: false, + get: function() { + var newMessage = message.split(/\r?\n/g); + for (var key in properties) { + if (!properties.hasOwnProperty(key)) { + continue; + } + var modifier = properties[key]; + if ("message" in modifier) { + newMessage = modifier.message(this[key], newMessage) || newMessage; + if (!isArrayish(newMessage)) { + newMessage = [newMessage]; + } + } + } + return newMessage.join("\n"); + }, + set: function(v) { + message = v; + } + }); + var overwrittenStack = null; + var stackDescriptor = Object.getOwnPropertyDescriptor(this, "stack"); + var stackGetter = stackDescriptor.get; + var stackValue = stackDescriptor.value; + delete stackDescriptor.value; + delete stackDescriptor.writable; + stackDescriptor.set = function(newstack) { + overwrittenStack = newstack; + }; + stackDescriptor.get = function() { + var stack = (overwrittenStack || (stackGetter ? stackGetter.call(this) : stackValue)).split(/\r?\n+/g); + if (!overwrittenStack) { + stack[0] = this.name + ": " + this.message; + } + var lineCount = 1; + for (var key in properties) { + if (!properties.hasOwnProperty(key)) { + continue; + } + var modifier = properties[key]; + if ("line" in modifier) { + var line = modifier.line(this[key]); + if (line) { + stack.splice(lineCount++, 0, " " + line); + } + } + if ("stack" in modifier) { + modifier.stack(this[key], stack); + } + } + return stack.join("\n"); + }; + Object.defineProperty(this, "stack", stackDescriptor); + }; + if (Object.setPrototypeOf) { + Object.setPrototypeOf(errorExError.prototype, Error.prototype); + Object.setPrototypeOf(errorExError, Error); + } else { + util.inherits(errorExError, Error); + } + return errorExError; + }; + errorEx.append = function(str, def) { + return { + message: function(v, message) { + v = v || def; + if (v) { + message[0] += " " + str.replace("%s", v.toString()); + } + return message; + } + }; + }; + errorEx.line = function(str, def) { + return { + line: function(v) { + v = v || def; + if (v) { + return str.replace("%s", v.toString()); + } + return null; + } + }; + }; + module2.exports = errorEx; +}); + +// node_modules/json-parse-better-errors/index.js +var require_json_parse_better_errors = __commonJS((exports2, module2) => { + "use strict"; + module2.exports = parseJson; + function parseJson(txt, reviver, context) { + context = context || 20; + try { + return JSON.parse(txt, reviver); + } catch (e) { + if (typeof txt !== "string") { + const isEmptyArray = Array.isArray(txt) && txt.length === 0; + const errorMessage = "Cannot parse " + (isEmptyArray ? "an empty array" : String(txt)); + throw new TypeError(errorMessage); + } + const syntaxErr = e.message.match(/^Unexpected token.*position\s+(\d+)/i); + const errIdx = syntaxErr ? +syntaxErr[1] : e.message.match(/^Unexpected end of JSON.*/i) ? txt.length - 1 : null; + if (errIdx != null) { + const start = errIdx <= context ? 0 : errIdx - context; + const end = errIdx + context >= txt.length ? txt.length : errIdx + context; + e.message += ` while parsing near '${start === 0 ? "" : "..."}${txt.slice(start, end)}${end === txt.length ? "" : "..."}'`; + } else { + e.message += ` while parsing '${txt.slice(0, context * 2)}'`; + } + throw e; + } + } +}); + +// node_modules/parse-json/index.js +var require_parse_json = __commonJS((exports2, module2) => { + "use strict"; + var errorEx = require_error_ex(); + var fallback = require_json_parse_better_errors(); + var JSONError = errorEx("JSONError", { + fileName: errorEx.append("in %s") + }); + module2.exports = (input, reviver, filename) => { + if (typeof reviver === "string") { + filename = reviver; + reviver = null; + } + try { + try { + return JSON.parse(input, reviver); + } catch (err) { + fallback(input, reviver); + throw err; + } + } catch (err) { + err.message = err.message.replace(/\n/g, ""); + const jsonErr = new JSONError(err); + if (filename) { + jsonErr.fileName = filename; + } + throw jsonErr; + } + }; +}); + +// node_modules/pify/index.js +var require_pify = __commonJS((exports2, module2) => { + "use strict"; + var processFn = (fn, options) => function(...args) { + const P = options.promiseModule; + return new P((resolve, reject) => { + if (options.multiArgs) { + args.push((...result) => { + if (options.errorFirst) { + if (result[0]) { + reject(result); + } else { + result.shift(); + resolve(result); + } + } else { + resolve(result); + } + }); + } else if (options.errorFirst) { + args.push((error, result) => { + if (error) { + reject(error); + } else { + resolve(result); + } + }); + } else { + args.push(resolve); + } + fn.apply(this, args); + }); + }; + module2.exports = (input, options) => { + options = Object.assign({ + exclude: [/.+(Sync|Stream)$/], + errorFirst: true, + promiseModule: Promise + }, options); + const objType = typeof input; + if (!(input !== null && (objType === "object" || objType === "function"))) { + throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${input === null ? "null" : objType}\``); + } + const filter = (key) => { + const match = (pattern) => typeof pattern === "string" ? key === pattern : pattern.test(key); + return options.include ? options.include.some(match) : !options.exclude.some(match); + }; + let ret; + if (objType === "function") { + ret = function(...args) { + return options.excludeMain ? input(...args) : processFn(input, options).apply(this, args); + }; + } else { + ret = Object.create(Object.getPrototypeOf(input)); + } + for (const key in input) { + const property = input[key]; + ret[key] = typeof property === "function" && filter(key) ? processFn(property, options) : property; + } + return ret; + }; +}); + +// node_modules/load-json-file/index.js +var require_load_json_file = __commonJS((exports2, module2) => { + "use strict"; + var path = require("path"); + var fs = require_graceful_fs(); + var stripBom = require_strip_bom(); + var parseJson = require_parse_json(); + var pify = require_pify(); + var parse = (data, filePath, options = {}) => { + data = stripBom(data); + if (typeof options.beforeParse === "function") { + data = options.beforeParse(data); + } + return parseJson(data, options.reviver, path.relative(process.cwd(), filePath)); + }; + var loadJsonFile = (filePath, options) => pify(fs.readFile)(filePath, "utf8").then((data) => parse(data, filePath, options)); + module2.exports = loadJsonFile; + module2.exports.default = loadJsonFile; + module2.exports.sync = (filePath, options) => parse(fs.readFileSync(filePath, "utf8"), filePath, options); +}); + +// node_modules/pkg-conf/index.js +var require_pkg_conf = __commonJS((exports2, module2) => { + "use strict"; + var path = require("path"); + var findUp = require_find_up(); + var loadJsonFile = require_load_json_file(); + var filepaths = new WeakMap(); + var filepath = (conf) => filepaths.get(conf); + var findNextCwd = (pkgPath) => path.resolve(path.dirname(pkgPath), ".."); + var addFilePath = (object, filePath) => { + filepaths.set(object, filePath); + return object; + }; + var pkgConf = (namespace, options = {}) => { + if (!namespace) { + return Promise.reject(new TypeError("Expected a namespace")); + } + return findUp("package.json", options.cwd ? {cwd: options.cwd} : {}).then((filePath) => { + if (!filePath) { + return addFilePath(Object.assign({}, options.defaults), filePath); + } + return loadJsonFile(filePath).then((package_) => { + if (options.skipOnFalse && package_[namespace] === false) { + const newOptions = Object.assign({}, options, {cwd: findNextCwd(filePath)}); + return pkgConf(namespace, newOptions); + } + return addFilePath(Object.assign({}, options.defaults, package_[namespace]), filePath); + }); + }); + }; + var sync = (namespace, options = {}) => { + if (!namespace) { + throw new TypeError("Expected a namespace"); + } + const filePath = findUp.sync("package.json", options.cwd ? {cwd: options.cwd} : {}); + if (!filePath) { + return addFilePath(Object.assign({}, options.defaults), filePath); + } + const package_ = loadJsonFile.sync(filePath); + if (options.skipOnFalse && package_[namespace] === false) { + const newOptions = Object.assign({}, options, {cwd: findNextCwd(filePath)}); + return sync(namespace, newOptions); + } + return addFilePath(Object.assign({}, options.defaults, package_[namespace]), filePath); + }; + module2.exports = pkgConf; + module2.exports.default = pkgConf; + module2.exports.filepath = filepath; + module2.exports.sync = sync; +}); + +// node_modules/dotenv/lib/main.js +var require_main = __commonJS((exports2, module2) => { + var fs = require("fs"); + var path = require("path"); + function log2(message) { + console.log(`[dotenv][DEBUG] ${message}`); + } + var NEWLINE = "\n"; + var RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*(.*)?\s*$/; + var RE_NEWLINES = /\\n/g; + var NEWLINES_MATCH = /\n|\r|\r\n/; + function parse(src, options) { + const debug = Boolean(options && options.debug); + const obj = {}; + src.toString().split(NEWLINES_MATCH).forEach(function(line, idx) { + const keyValueArr = line.match(RE_INI_KEY_VAL); + if (keyValueArr != null) { + const key = keyValueArr[1]; + let val = keyValueArr[2] || ""; + const end = val.length - 1; + const isDoubleQuoted = val[0] === '"' && val[end] === '"'; + const isSingleQuoted = val[0] === "'" && val[end] === "'"; + if (isSingleQuoted || isDoubleQuoted) { + val = val.substring(1, end); + if (isDoubleQuoted) { + val = val.replace(RE_NEWLINES, NEWLINE); + } + } else { + val = val.trim(); + } + obj[key] = val; + } else if (debug) { + log2(`did not match key and value when parsing line ${idx + 1}: ${line}`); + } + }); + return obj; + } + function config(options) { + let dotenvPath = path.resolve(process.cwd(), ".env"); + let encoding = "utf8"; + let debug = false; + if (options) { + if (options.path != null) { + dotenvPath = options.path; + } + if (options.encoding != null) { + encoding = options.encoding; + } + if (options.debug != null) { + debug = true; + } + } + try { + const parsed = parse(fs.readFileSync(dotenvPath, {encoding}), {debug}); + Object.keys(parsed).forEach(function(key) { + if (!Object.prototype.hasOwnProperty.call(process.env, key)) { + process.env[key] = parsed[key]; + } else if (debug) { + log2(`"${key}" is already defined in \`process.env\` and will not be overwritten`); + } + }); + return {parsed}; + } catch (e) { + return {error: e}; + } + } + module2.exports.config = config; + module2.exports.parse = parse; +}); + +// node_modules/update-dotenv/index.js +var require_update_dotenv = __commonJS((exports2, module2) => { + var dotenv = require_main(); + var fs = require("fs"); + var path = require("path"); + var {promisify} = require("util"); + function escapeNewlines(str) { + return str.replace(/\n/g, "\\n"); + } + function format(key, value) { + return `${key}=${escapeNewlines(value)}`; + } + module2.exports = async function updateDotenv(env) { + const filename = path.join(process.cwd(), ".env"); + try { + const existing = dotenv.parse(await promisify(fs.readFile)(filename, "utf-8")); + env = Object.assign(existing, env); + } catch (err) { + if (err.code !== "ENOENT") { + throw err; + } + } + const contents = Object.keys(env).map((key) => format(key, env[key])).join("\n"); + await promisify(fs.writeFile)(filename, contents); + Object.assign(process.env, env); + return env; + }; +}); + +// node_modules/js-yaml/lib/js-yaml/common.js +var require_common3 = __commonJS((exports2, module2) => { + "use strict"; + function isNothing(subject) { + return typeof subject === "undefined" || subject === null; + } + function isObject(subject) { + return typeof subject === "object" && subject !== null; + } + function toArray(sequence) { + if (Array.isArray(sequence)) + return sequence; + else if (isNothing(sequence)) + return []; + return [sequence]; + } + function extend(target, source) { + var index, length, key, sourceKeys; + if (source) { + sourceKeys = Object.keys(source); + for (index = 0, length = sourceKeys.length; index < length; index += 1) { + key = sourceKeys[index]; + target[key] = source[key]; + } + } + return target; + } + function repeat(string, count) { + var result = "", cycle; + for (cycle = 0; cycle < count; cycle += 1) { + result += string; + } + return result; + } + function isNegativeZero(number) { + return number === 0 && Number.NEGATIVE_INFINITY === 1 / number; + } + module2.exports.isNothing = isNothing; + module2.exports.isObject = isObject; + module2.exports.toArray = toArray; + module2.exports.repeat = repeat; + module2.exports.isNegativeZero = isNegativeZero; + module2.exports.extend = extend; +}); + +// node_modules/js-yaml/lib/js-yaml/exception.js +var require_exception2 = __commonJS((exports2, module2) => { + "use strict"; + function YAMLException(reason, mark) { + Error.call(this); + this.name = "YAMLException"; + this.reason = reason; + this.mark = mark; + this.message = (this.reason || "(unknown reason)") + (this.mark ? " " + this.mark.toString() : ""); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + this.stack = new Error().stack || ""; + } + } + YAMLException.prototype = Object.create(Error.prototype); + YAMLException.prototype.constructor = YAMLException; + YAMLException.prototype.toString = function toString(compact) { + var result = this.name + ": "; + result += this.reason || "(unknown reason)"; + if (!compact && this.mark) { + result += " " + this.mark.toString(); + } + return result; + }; + module2.exports = YAMLException; +}); + +// node_modules/js-yaml/lib/js-yaml/mark.js +var require_mark = __commonJS((exports2, module2) => { + "use strict"; + var common = require_common3(); + function Mark(name, buffer, position, line, column) { + this.name = name; + this.buffer = buffer; + this.position = position; + this.line = line; + this.column = column; + } + Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { + var head, start, tail, end, snippet; + if (!this.buffer) + return null; + indent = indent || 4; + maxLength = maxLength || 75; + head = ""; + start = this.position; + while (start > 0 && "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(start - 1)) === -1) { + start -= 1; + if (this.position - start > maxLength / 2 - 1) { + head = " ... "; + start += 5; + break; + } + } + tail = ""; + end = this.position; + while (end < this.buffer.length && "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(end)) === -1) { + end += 1; + if (end - this.position > maxLength / 2 - 1) { + tail = " ... "; + end -= 5; + break; + } + } + snippet = this.buffer.slice(start, end); + return common.repeat(" ", indent) + head + snippet + tail + "\n" + common.repeat(" ", indent + this.position - start + head.length) + "^"; + }; + Mark.prototype.toString = function toString(compact) { + var snippet, where = ""; + if (this.name) { + where += 'in "' + this.name + '" '; + } + where += "at line " + (this.line + 1) + ", column " + (this.column + 1); + if (!compact) { + snippet = this.getSnippet(); + if (snippet) { + where += ":\n" + snippet; + } + } + return where; + }; + module2.exports = Mark; +}); + +// node_modules/js-yaml/lib/js-yaml/type.js +var require_type2 = __commonJS((exports2, module2) => { + "use strict"; + var YAMLException = require_exception2(); + var TYPE_CONSTRUCTOR_OPTIONS = [ + "kind", + "resolve", + "construct", + "instanceOf", + "predicate", + "represent", + "defaultStyle", + "styleAliases" + ]; + var YAML_NODE_KINDS = [ + "scalar", + "sequence", + "mapping" + ]; + function compileStyleAliases(map) { + var result = {}; + if (map !== null) { + Object.keys(map).forEach(function(style) { + map[style].forEach(function(alias) { + result[String(alias)] = style; + }); + }); + } + return result; + } + function Type(tag, options) { + options = options || {}; + Object.keys(options).forEach(function(name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + this.tag = tag; + this.kind = options["kind"] || null; + this.resolve = options["resolve"] || function() { + return true; + }; + this.construct = options["construct"] || function(data) { + return data; + }; + this.instanceOf = options["instanceOf"] || null; + this.predicate = options["predicate"] || null; + this.represent = options["represent"] || null; + this.defaultStyle = options["defaultStyle"] || null; + this.styleAliases = compileStyleAliases(options["styleAliases"] || null); + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } + } + module2.exports = Type; +}); + +// node_modules/js-yaml/lib/js-yaml/schema.js +var require_schema2 = __commonJS((exports2, module2) => { + "use strict"; + var common = require_common3(); + var YAMLException = require_exception2(); + var Type = require_type2(); + function compileList(schema, name, result) { + var exclude = []; + schema.include.forEach(function(includedSchema) { + result = compileList(includedSchema, name, result); + }); + schema[name].forEach(function(currentType) { + result.forEach(function(previousType, previousIndex) { + if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { + exclude.push(previousIndex); + } + }); + result.push(currentType); + }); + return result.filter(function(type, index) { + return exclude.indexOf(index) === -1; + }); + } + function compileMap() { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {} + }, index, length; + function collectType(type) { + result[type.kind][type.tag] = result["fallback"][type.tag] = type; + } + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); + } + return result; + } + function Schema(definition) { + this.include = definition.include || []; + this.implicit = definition.implicit || []; + this.explicit = definition.explicit || []; + this.implicit.forEach(function(type) { + if (type.loadKind && type.loadKind !== "scalar") { + throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported."); + } + }); + this.compiledImplicit = compileList(this, "implicit", []); + this.compiledExplicit = compileList(this, "explicit", []); + this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); + } + Schema.DEFAULT = null; + Schema.create = function createSchema() { + var schemas, types; + switch (arguments.length) { + case 1: + schemas = Schema.DEFAULT; + types = arguments[0]; + break; + case 2: + schemas = arguments[0]; + types = arguments[1]; + break; + default: + throw new YAMLException("Wrong number of arguments for Schema.create function"); + } + schemas = common.toArray(schemas); + types = common.toArray(types); + if (!schemas.every(function(schema) { + return schema instanceof Schema; + })) { + throw new YAMLException("Specified list of super schemas (or a single Schema object) contains a non-Schema object."); + } + if (!types.every(function(type) { + return type instanceof Type; + })) { + throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object."); + } + return new Schema({ + include: schemas, + explicit: types + }); + }; + module2.exports = Schema; +}); + +// node_modules/js-yaml/lib/js-yaml/type/str.js +var require_str2 = __commonJS((exports2, module2) => { + "use strict"; + var Type = require_type2(); + module2.exports = new Type("tag:yaml.org,2002:str", { + kind: "scalar", + construct: function(data) { + return data !== null ? data : ""; + } + }); +}); + +// node_modules/js-yaml/lib/js-yaml/type/seq.js +var require_seq2 = __commonJS((exports2, module2) => { + "use strict"; + var Type = require_type2(); + module2.exports = new Type("tag:yaml.org,2002:seq", { + kind: "sequence", + construct: function(data) { + return data !== null ? data : []; + } + }); +}); + +// node_modules/js-yaml/lib/js-yaml/type/map.js +var require_map2 = __commonJS((exports2, module2) => { + "use strict"; + var Type = require_type2(); + module2.exports = new Type("tag:yaml.org,2002:map", { + kind: "mapping", + construct: function(data) { + return data !== null ? data : {}; + } + }); +}); + +// node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +var require_failsafe2 = __commonJS((exports2, module2) => { + "use strict"; + var Schema = require_schema2(); + module2.exports = new Schema({ + explicit: [ + require_str2(), + require_seq2(), + require_map2() + ] + }); +}); + +// node_modules/js-yaml/lib/js-yaml/type/null.js +var require_null2 = __commonJS((exports2, module2) => { + "use strict"; + var Type = require_type2(); + function resolveYamlNull(data) { + if (data === null) + return true; + var max = data.length; + return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL"); + } + function constructYamlNull() { + return null; + } + function isNull(object) { + return object === null; + } + module2.exports = new Type("tag:yaml.org,2002:null", { + kind: "scalar", + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function() { + return "~"; + }, + lowercase: function() { + return "null"; + }, + uppercase: function() { + return "NULL"; + }, + camelcase: function() { + return "Null"; + } + }, + defaultStyle: "lowercase" + }); +}); + +// node_modules/js-yaml/lib/js-yaml/type/bool.js +var require_bool2 = __commonJS((exports2, module2) => { + "use strict"; + var Type = require_type2(); + function resolveYamlBoolean(data) { + if (data === null) + return false; + var max = data.length; + return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE"); + } + function constructYamlBoolean(data) { + return data === "true" || data === "True" || data === "TRUE"; + } + function isBoolean(object) { + return Object.prototype.toString.call(object) === "[object Boolean]"; + } + module2.exports = new Type("tag:yaml.org,2002:bool", { + kind: "scalar", + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function(object) { + return object ? "true" : "false"; + }, + uppercase: function(object) { + return object ? "TRUE" : "FALSE"; + }, + camelcase: function(object) { + return object ? "True" : "False"; + } + }, + defaultStyle: "lowercase" + }); +}); + +// node_modules/js-yaml/lib/js-yaml/type/int.js +var require_int2 = __commonJS((exports2, module2) => { + "use strict"; + var common = require_common3(); + var Type = require_type2(); + function isHexCode(c) { + return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102; + } + function isOctCode(c) { + return 48 <= c && c <= 55; + } + function isDecCode(c) { + return 48 <= c && c <= 57; + } + function resolveYamlInteger(data) { + if (data === null) + return false; + var max = data.length, index = 0, hasDigits = false, ch; + if (!max) + return false; + ch = data[index]; + if (ch === "-" || ch === "+") { + ch = data[++index]; + } + if (ch === "0") { + if (index + 1 === max) + return true; + ch = data[++index]; + if (ch === "b") { + index++; + for (; index < max; index++) { + ch = data[index]; + if (ch === "_") + continue; + if (ch !== "0" && ch !== "1") + return false; + hasDigits = true; + } + return hasDigits && ch !== "_"; + } + if (ch === "x") { + index++; + for (; index < max; index++) { + ch = data[index]; + if (ch === "_") + continue; + if (!isHexCode(data.charCodeAt(index))) + return false; + hasDigits = true; + } + return hasDigits && ch !== "_"; + } + for (; index < max; index++) { + ch = data[index]; + if (ch === "_") + continue; + if (!isOctCode(data.charCodeAt(index))) + return false; + hasDigits = true; + } + return hasDigits && ch !== "_"; + } + if (ch === "_") + return false; + for (; index < max; index++) { + ch = data[index]; + if (ch === "_") + continue; + if (ch === ":") + break; + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + if (!hasDigits || ch === "_") + return false; + if (ch !== ":") + return true; + return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); + } + function constructYamlInteger(data) { + var value = data, sign = 1, ch, base, digits = []; + if (value.indexOf("_") !== -1) { + value = value.replace(/_/g, ""); + } + ch = value[0]; + if (ch === "-" || ch === "+") { + if (ch === "-") + sign = -1; + value = value.slice(1); + ch = value[0]; + } + if (value === "0") + return 0; + if (ch === "0") { + if (value[1] === "b") + return sign * parseInt(value.slice(2), 2); + if (value[1] === "x") + return sign * parseInt(value, 16); + return sign * parseInt(value, 8); + } + if (value.indexOf(":") !== -1) { + value.split(":").forEach(function(v) { + digits.unshift(parseInt(v, 10)); + }); + value = 0; + base = 1; + digits.forEach(function(d) { + value += d * base; + base *= 60; + }); + return sign * value; + } + return sign * parseInt(value, 10); + } + function isInteger(object) { + return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object)); + } + module2.exports = new Type("tag:yaml.org,2002:int", { + kind: "scalar", + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function(obj) { + return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1); + }, + octal: function(obj) { + return obj >= 0 ? "0" + obj.toString(8) : "-0" + obj.toString(8).slice(1); + }, + decimal: function(obj) { + return obj.toString(10); + }, + hexadecimal: function(obj) { + return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1); + } + }, + defaultStyle: "decimal", + styleAliases: { + binary: [2, "bin"], + octal: [8, "oct"], + decimal: [10, "dec"], + hexadecimal: [16, "hex"] + } + }); +}); + +// node_modules/js-yaml/lib/js-yaml/type/float.js +var require_float2 = __commonJS((exports2, module2) => { + "use strict"; + var common = require_common3(); + var Type = require_type2(); + var YAML_FLOAT_PATTERN = new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"); + function resolveYamlFloat(data) { + if (data === null) + return false; + if (!YAML_FLOAT_PATTERN.test(data) || data[data.length - 1] === "_") { + return false; + } + return true; + } + function constructYamlFloat(data) { + var value, sign, base, digits; + value = data.replace(/_/g, "").toLowerCase(); + sign = value[0] === "-" ? -1 : 1; + digits = []; + if ("+-".indexOf(value[0]) >= 0) { + value = value.slice(1); + } + if (value === ".inf") { + return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + } else if (value === ".nan") { + return NaN; + } else if (value.indexOf(":") >= 0) { + value.split(":").forEach(function(v) { + digits.unshift(parseFloat(v, 10)); + }); + value = 0; + base = 1; + digits.forEach(function(d) { + value += d * base; + base *= 60; + }); + return sign * value; + } + return sign * parseFloat(value, 10); + } + var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + function representYamlFloat(object, style) { + var res; + if (isNaN(object)) { + switch (style) { + case "lowercase": + return ".nan"; + case "uppercase": + return ".NAN"; + case "camelcase": + return ".NaN"; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case "lowercase": + return ".inf"; + case "uppercase": + return ".INF"; + case "camelcase": + return ".Inf"; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case "lowercase": + return "-.inf"; + case "uppercase": + return "-.INF"; + case "camelcase": + return "-.Inf"; + } + } else if (common.isNegativeZero(object)) { + return "-0.0"; + } + res = object.toString(10); + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res; + } + function isFloat(object) { + return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object)); + } + module2.exports = new Type("tag:yaml.org,2002:float", { + kind: "scalar", + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: "lowercase" + }); +}); + +// node_modules/js-yaml/lib/js-yaml/schema/json.js +var require_json4 = __commonJS((exports2, module2) => { + "use strict"; + var Schema = require_schema2(); + module2.exports = new Schema({ + include: [ + require_failsafe2() + ], + implicit: [ + require_null2(), + require_bool2(), + require_int2(), + require_float2() + ] + }); +}); + +// node_modules/js-yaml/lib/js-yaml/schema/core.js +var require_core2 = __commonJS((exports2, module2) => { + "use strict"; + var Schema = require_schema2(); + module2.exports = new Schema({ + include: [ + require_json4() + ] + }); +}); + +// node_modules/js-yaml/lib/js-yaml/type/timestamp.js +var require_timestamp2 = __commonJS((exports2, module2) => { + "use strict"; + var Type = require_type2(); + var YAML_DATE_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"); + var YAML_TIMESTAMP_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"); + function resolveYamlTimestamp(data) { + if (data === null) + return false; + if (YAML_DATE_REGEXP.exec(data) !== null) + return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) + return true; + return false; + } + function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date; + match = YAML_DATE_REGEXP.exec(data); + if (match === null) + match = YAML_TIMESTAMP_REGEXP.exec(data); + if (match === null) + throw new Error("Date resolve error"); + year = +match[1]; + month = +match[2] - 1; + day = +match[3]; + if (!match[4]) { + return new Date(Date.UTC(year, month, day)); + } + hour = +match[4]; + minute = +match[5]; + second = +match[6]; + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { + fraction += "0"; + } + fraction = +fraction; + } + if (match[9]) { + tz_hour = +match[10]; + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 6e4; + if (match[9] === "-") + delta = -delta; + } + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + if (delta) + date.setTime(date.getTime() - delta); + return date; + } + function representYamlTimestamp(object) { + return object.toISOString(); + } + module2.exports = new Type("tag:yaml.org,2002:timestamp", { + kind: "scalar", + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp + }); +}); + +// node_modules/js-yaml/lib/js-yaml/type/merge.js +var require_merge3 = __commonJS((exports2, module2) => { + "use strict"; + var Type = require_type2(); + function resolveYamlMerge(data) { + return data === "<<" || data === null; + } + module2.exports = new Type("tag:yaml.org,2002:merge", { + kind: "scalar", + resolve: resolveYamlMerge + }); +}); + +// node_modules/js-yaml/lib/js-yaml/type/binary.js +var require_binary2 = __commonJS((exports2, module2) => { + "use strict"; + var NodeBuffer; + try { + _require = require; + NodeBuffer = _require("buffer").Buffer; + } catch (__) { + } + var _require; + var Type = require_type2(); + var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r"; + function resolveYamlBinary(data) { + if (data === null) + return false; + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); + if (code > 64) + continue; + if (code < 0) + return false; + bitlen += 6; + } + return bitlen % 8 === 0; + } + function constructYamlBinary(data) { + var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map = BASE64_MAP, bits = 0, result = []; + for (idx = 0; idx < max; idx++) { + if (idx % 4 === 0 && idx) { + result.push(bits >> 16 & 255); + result.push(bits >> 8 & 255); + result.push(bits & 255); + } + bits = bits << 6 | map.indexOf(input.charAt(idx)); + } + tailbits = max % 4 * 6; + if (tailbits === 0) { + result.push(bits >> 16 & 255); + result.push(bits >> 8 & 255); + result.push(bits & 255); + } else if (tailbits === 18) { + result.push(bits >> 10 & 255); + result.push(bits >> 2 & 255); + } else if (tailbits === 12) { + result.push(bits >> 4 & 255); + } + if (NodeBuffer) { + return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); + } + return result; + } + function representYamlBinary(object) { + var result = "", bits = 0, idx, tail, max = object.length, map = BASE64_MAP; + for (idx = 0; idx < max; idx++) { + if (idx % 3 === 0 && idx) { + result += map[bits >> 18 & 63]; + result += map[bits >> 12 & 63]; + result += map[bits >> 6 & 63]; + result += map[bits & 63]; + } + bits = (bits << 8) + object[idx]; + } + tail = max % 3; + if (tail === 0) { + result += map[bits >> 18 & 63]; + result += map[bits >> 12 & 63]; + result += map[bits >> 6 & 63]; + result += map[bits & 63]; + } else if (tail === 2) { + result += map[bits >> 10 & 63]; + result += map[bits >> 4 & 63]; + result += map[bits << 2 & 63]; + result += map[64]; + } else if (tail === 1) { + result += map[bits >> 2 & 63]; + result += map[bits << 4 & 63]; + result += map[64]; + result += map[64]; + } + return result; + } + function isBinary(object) { + return NodeBuffer && NodeBuffer.isBuffer(object); + } + module2.exports = new Type("tag:yaml.org,2002:binary", { + kind: "scalar", + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary + }); +}); + +// node_modules/js-yaml/lib/js-yaml/type/omap.js +var require_omap2 = __commonJS((exports2, module2) => { + "use strict"; + var Type = require_type2(); + var _hasOwnProperty = Object.prototype.hasOwnProperty; + var _toString = Object.prototype.toString; + function resolveYamlOmap(data) { + if (data === null) + return true; + var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data; + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; + if (_toString.call(pair) !== "[object Object]") + return false; + for (pairKey in pair) { + if (_hasOwnProperty.call(pair, pairKey)) { + if (!pairHasKey) + pairHasKey = true; + else + return false; + } + } + if (!pairHasKey) + return false; + if (objectKeys.indexOf(pairKey) === -1) + objectKeys.push(pairKey); + else + return false; + } + return true; + } + function constructYamlOmap(data) { + return data !== null ? data : []; + } + module2.exports = new Type("tag:yaml.org,2002:omap", { + kind: "sequence", + resolve: resolveYamlOmap, + construct: constructYamlOmap + }); +}); + +// node_modules/js-yaml/lib/js-yaml/type/pairs.js +var require_pairs2 = __commonJS((exports2, module2) => { + "use strict"; + var Type = require_type2(); + var _toString = Object.prototype.toString; + function resolveYamlPairs(data) { + if (data === null) + return true; + var index, length, pair, keys, result, object = data; + result = new Array(object.length); + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + if (_toString.call(pair) !== "[object Object]") + return false; + keys = Object.keys(pair); + if (keys.length !== 1) + return false; + result[index] = [keys[0], pair[keys[0]]]; + } + return true; + } + function constructYamlPairs(data) { + if (data === null) + return []; + var index, length, pair, keys, result, object = data; + result = new Array(object.length); + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + keys = Object.keys(pair); + result[index] = [keys[0], pair[keys[0]]]; + } + return result; + } + module2.exports = new Type("tag:yaml.org,2002:pairs", { + kind: "sequence", + resolve: resolveYamlPairs, + construct: constructYamlPairs + }); +}); + +// node_modules/js-yaml/lib/js-yaml/type/set.js +var require_set2 = __commonJS((exports2, module2) => { + "use strict"; + var Type = require_type2(); + var _hasOwnProperty = Object.prototype.hasOwnProperty; + function resolveYamlSet(data) { + if (data === null) + return true; + var key, object = data; + for (key in object) { + if (_hasOwnProperty.call(object, key)) { + if (object[key] !== null) + return false; + } + } + return true; + } + function constructYamlSet(data) { + return data !== null ? data : {}; + } + module2.exports = new Type("tag:yaml.org,2002:set", { + kind: "mapping", + resolve: resolveYamlSet, + construct: constructYamlSet + }); +}); + +// node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +var require_default_safe = __commonJS((exports2, module2) => { + "use strict"; + var Schema = require_schema2(); + module2.exports = new Schema({ + include: [ + require_core2() + ], + implicit: [ + require_timestamp2(), + require_merge3() + ], + explicit: [ + require_binary2(), + require_omap2(), + require_pairs2(), + require_set2() + ] + }); +}); + +// node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +var require_undefined = __commonJS((exports2, module2) => { + "use strict"; + var Type = require_type2(); + function resolveJavascriptUndefined() { + return true; + } + function constructJavascriptUndefined() { + return void 0; + } + function representJavascriptUndefined() { + return ""; + } + function isUndefined(object) { + return typeof object === "undefined"; + } + module2.exports = new Type("tag:yaml.org,2002:js/undefined", { + kind: "scalar", + resolve: resolveJavascriptUndefined, + construct: constructJavascriptUndefined, + predicate: isUndefined, + represent: representJavascriptUndefined + }); +}); + +// node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +var require_regexp = __commonJS((exports2, module2) => { + "use strict"; + var Type = require_type2(); + function resolveJavascriptRegExp(data) { + if (data === null) + return false; + if (data.length === 0) + return false; + var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = ""; + if (regexp[0] === "/") { + if (tail) + modifiers = tail[1]; + if (modifiers.length > 3) + return false; + if (regexp[regexp.length - modifiers.length - 1] !== "/") + return false; + } + return true; + } + function constructJavascriptRegExp(data) { + var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = ""; + if (regexp[0] === "/") { + if (tail) + modifiers = tail[1]; + regexp = regexp.slice(1, regexp.length - modifiers.length - 1); + } + return new RegExp(regexp, modifiers); + } + function representJavascriptRegExp(object) { + var result = "/" + object.source + "/"; + if (object.global) + result += "g"; + if (object.multiline) + result += "m"; + if (object.ignoreCase) + result += "i"; + return result; + } + function isRegExp(object) { + return Object.prototype.toString.call(object) === "[object RegExp]"; + } + module2.exports = new Type("tag:yaml.org,2002:js/regexp", { + kind: "scalar", + resolve: resolveJavascriptRegExp, + construct: constructJavascriptRegExp, + predicate: isRegExp, + represent: representJavascriptRegExp + }); +}); + +// node_modules/js-yaml/lib/js-yaml/type/js/function.js +var require_function = __commonJS((exports2, module2) => { + "use strict"; + var esprima; + try { + _require = require; + esprima = _require("esprima"); + } catch (_) { + if (typeof window !== "undefined") + esprima = window.esprima; + } + var _require; + var Type = require_type2(); + function resolveJavascriptFunction(data) { + if (data === null) + return false; + try { + var source = "(" + data + ")", ast = esprima.parse(source, {range: true}); + if (ast.type !== "Program" || ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ArrowFunctionExpression" && ast.body[0].expression.type !== "FunctionExpression") { + return false; + } + return true; + } catch (err) { + return false; + } + } + function constructJavascriptFunction(data) { + var source = "(" + data + ")", ast = esprima.parse(source, {range: true}), params = [], body; + if (ast.type !== "Program" || ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ArrowFunctionExpression" && ast.body[0].expression.type !== "FunctionExpression") { + throw new Error("Failed to resolve function"); + } + ast.body[0].expression.params.forEach(function(param) { + params.push(param.name); + }); + body = ast.body[0].expression.body.range; + if (ast.body[0].expression.body.type === "BlockStatement") { + return new Function(params, source.slice(body[0] + 1, body[1] - 1)); + } + return new Function(params, "return " + source.slice(body[0], body[1])); + } + function representJavascriptFunction(object) { + return object.toString(); + } + function isFunction(object) { + return Object.prototype.toString.call(object) === "[object Function]"; + } + module2.exports = new Type("tag:yaml.org,2002:js/function", { + kind: "scalar", + resolve: resolveJavascriptFunction, + construct: constructJavascriptFunction, + predicate: isFunction, + represent: representJavascriptFunction + }); +}); + +// node_modules/js-yaml/lib/js-yaml/schema/default_full.js +var require_default_full = __commonJS((exports2, module2) => { + "use strict"; + var Schema = require_schema2(); + module2.exports = Schema.DEFAULT = new Schema({ + include: [ + require_default_safe() + ], + explicit: [ + require_undefined(), + require_regexp(), + require_function() + ] + }); +}); + +// node_modules/js-yaml/lib/js-yaml/loader.js +var require_loader2 = __commonJS((exports2, module2) => { + "use strict"; + var common = require_common3(); + var YAMLException = require_exception2(); + var Mark = require_mark(); + var DEFAULT_SAFE_SCHEMA = require_default_safe(); + var DEFAULT_FULL_SCHEMA = require_default_full(); + var _hasOwnProperty = Object.prototype.hasOwnProperty; + var CONTEXT_FLOW_IN = 1; + var CONTEXT_FLOW_OUT = 2; + var CONTEXT_BLOCK_IN = 3; + var CONTEXT_BLOCK_OUT = 4; + var CHOMPING_CLIP = 1; + var CHOMPING_STRIP = 2; + var CHOMPING_KEEP = 3; + var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; + var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; + var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; + var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; + var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + function _class(obj) { + return Object.prototype.toString.call(obj); + } + function is_EOL(c) { + return c === 10 || c === 13; + } + function is_WHITE_SPACE(c) { + return c === 9 || c === 32; + } + function is_WS_OR_EOL(c) { + return c === 9 || c === 32 || c === 10 || c === 13; + } + function is_FLOW_INDICATOR(c) { + return c === 44 || c === 91 || c === 93 || c === 123 || c === 125; + } + function fromHexCode(c) { + var lc; + if (48 <= c && c <= 57) { + return c - 48; + } + lc = c | 32; + if (97 <= lc && lc <= 102) { + return lc - 97 + 10; + } + return -1; + } + function escapedHexLen(c) { + if (c === 120) { + return 2; + } + if (c === 117) { + return 4; + } + if (c === 85) { + return 8; + } + return 0; + } + function fromDecimalCode(c) { + if (48 <= c && c <= 57) { + return c - 48; + } + return -1; + } + function simpleEscapeSequence(c) { + return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : ""; + } + function charFromCodepoint(c) { + if (c <= 65535) { + return String.fromCharCode(c); + } + return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320); + } + var simpleEscapeCheck = new Array(256); + var simpleEscapeMap = new Array(256); + for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); + } + function State(input, options) { + this.input = input; + this.filename = options["filename"] || null; + this.schema = options["schema"] || DEFAULT_FULL_SCHEMA; + this.onWarning = options["onWarning"] || null; + this.legacy = options["legacy"] || false; + this.json = options["json"] || false; + this.listener = options["listener"] || null; + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; + this.documents = []; + } + function generateError(state, message) { + return new YAMLException(message, new Mark(state.filename, state.input, state.position, state.line, state.position - state.lineStart)); + } + function throwError(state, message) { + throw generateError(state, message); + } + function throwWarning(state, message) { + if (state.onWarning) { + state.onWarning.call(null, generateError(state, message)); + } + } + var directiveHandlers = { + YAML: function handleYamlDirective(state, name, args) { + var match, major, minor; + if (state.version !== null) { + throwError(state, "duplication of %YAML directive"); + } + if (args.length !== 1) { + throwError(state, "YAML directive accepts exactly one argument"); + } + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + if (match === null) { + throwError(state, "ill-formed argument of the YAML directive"); + } + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); + if (major !== 1) { + throwError(state, "unacceptable YAML version of the document"); + } + state.version = args[0]; + state.checkLineBreaks = minor < 2; + if (minor !== 1 && minor !== 2) { + throwWarning(state, "unsupported YAML version of the document"); + } + }, + TAG: function handleTagDirective(state, name, args) { + var handle, prefix; + if (args.length !== 2) { + throwError(state, "TAG directive accepts exactly two arguments"); + } + handle = args[0]; + prefix = args[1]; + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, "ill-formed tag handle (first argument) of the TAG directive"); + } + if (_hasOwnProperty.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, "ill-formed tag prefix (second argument) of the TAG directive"); + } + state.tagMap[handle] = prefix; + } + }; + function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; + if (start < end) { + _result = state.input.slice(start, end); + if (checkJson) { + for (_position = 0, _length = _result.length; _position < _length; _position += 1) { + _character = _result.charCodeAt(_position); + if (!(_character === 9 || 32 <= _character && _character <= 1114111)) { + throwError(state, "expected valid JSON character"); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state, "the stream contains non-printable characters"); + } + state.result += _result; + } + } + function mergeMappings(state, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity; + if (!common.isObject(source)) { + throwError(state, "cannot merge mappings; the provided source object is unacceptable"); + } + sourceKeys = Object.keys(source); + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; + if (!_hasOwnProperty.call(destination, key)) { + destination[key] = source[key]; + overridableKeys[key] = true; + } + } + } + function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { + var index, quantity; + if (Array.isArray(keyNode)) { + keyNode = Array.prototype.slice.call(keyNode); + for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { + if (Array.isArray(keyNode[index])) { + throwError(state, "nested arrays are not supported inside keys"); + } + if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") { + keyNode[index] = "[object Object]"; + } + } + } + if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") { + keyNode = "[object Object]"; + } + keyNode = String(keyNode); + if (_result === null) { + _result = {}; + } + if (keyTag === "tag:yaml.org,2002:merge") { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index], overridableKeys); + } + } else { + mergeMappings(state, _result, valueNode, overridableKeys); + } + } else { + if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) { + state.line = startLine || state.line; + state.position = startPos || state.position; + throwError(state, "duplicated mapping key"); + } + _result[keyNode] = valueNode; + delete overridableKeys[keyNode]; + } + return _result; + } + function readLineBreak(state) { + var ch; + ch = state.input.charCodeAt(state.position); + if (ch === 10) { + state.position++; + } else if (ch === 13) { + state.position++; + if (state.input.charCodeAt(state.position) === 10) { + state.position++; + } + } else { + throwError(state, "a line break is expected"); + } + state.line += 1; + state.lineStart = state.position; + } + function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, ch = state.input.charCodeAt(state.position); + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + if (allowComments && ch === 35) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 10 && ch !== 13 && ch !== 0); + } + if (is_EOL(ch)) { + readLineBreak(state); + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + while (ch === 32) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } + if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { + throwWarning(state, "deficient indentation"); + } + return lineBreaks; + } + function testDocumentSeparator(state) { + var _position = state.position, ch; + ch = state.input.charCodeAt(_position); + if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) { + _position += 3; + ch = state.input.charCodeAt(_position); + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } + return false; + } + function writeFoldedLines(state, count) { + if (count === 1) { + state.result += " "; + } else if (count > 1) { + state.result += common.repeat("\n", count - 1); + } + } + function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch; + ch = state.input.charCodeAt(state.position); + if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) { + return false; + } + if (ch === 63 || ch === 45) { + following = state.input.charCodeAt(state.position + 1); + if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } + state.kind = "scalar"; + state.result = ""; + captureStart = captureEnd = state.position; + hasPendingContent = false; + while (ch !== 0) { + if (ch === 58) { + following = state.input.charCodeAt(state.position + 1); + if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } + } else if (ch === 35) { + preceding = state.input.charCodeAt(state.position - 1); + if (is_WS_OR_EOL(preceding)) { + break; + } + } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } + ch = state.input.charCodeAt(++state.position); + } + captureSegment(state, captureStart, captureEnd, false); + if (state.result) { + return true; + } + state.kind = _kind; + state.result = _result; + return false; + } + function readSingleQuotedScalar(state, nodeIndent) { + var ch, captureStart, captureEnd; + ch = state.input.charCodeAt(state.position); + if (ch !== 39) { + return false; + } + state.kind = "scalar"; + state.result = ""; + state.position++; + captureStart = captureEnd = state.position; + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 39) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + if (ch === 39) { + captureStart = state.position; + state.position++; + captureEnd = state.position; + } else { + return true; + } + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, "unexpected end of the document within a single quoted scalar"); + } else { + state.position++; + captureEnd = state.position; + } + } + throwError(state, "unexpected end of the stream within a single quoted scalar"); + } + function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, captureEnd, hexLength, hexResult, tmp, ch; + ch = state.input.charCodeAt(state.position); + if (ch !== 34) { + return false; + } + state.kind = "scalar"; + state.result = ""; + state.position++; + captureStart = captureEnd = state.position; + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 34) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; + } else if (ch === 92) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; + } else { + throwError(state, "expected hexadecimal character"); + } + } + state.result += charFromCodepoint(hexResult); + state.position++; + } else { + throwError(state, "unknown escape sequence"); + } + captureStart = captureEnd = state.position; + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, "unexpected end of the document within a double quoted scalar"); + } else { + state.position++; + captureEnd = state.position; + } + } + throwError(state, "unexpected end of the stream within a double quoted scalar"); + } + function readFlowCollection(state, nodeIndent) { + var readNext = true, _line, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = {}, keyNode, keyTag, valueNode, ch; + ch = state.input.charCodeAt(state.position); + if (ch === 91) { + terminator = 93; + isMapping = false; + _result = []; + } else if (ch === 123) { + terminator = 125; + isMapping = true; + _result = {}; + } else { + return false; + } + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + ch = state.input.charCodeAt(++state.position); + while (ch !== 0) { + skipSeparationSpace(state, true, nodeIndent); + ch = state.input.charCodeAt(state.position); + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? "mapping" : "sequence"; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, "missed comma between flow collection entries"); + } + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; + if (ch === 63) { + following = state.input.charCodeAt(state.position + 1); + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); + ch = state.input.charCodeAt(state.position); + if ((isExplicitPair || state.line === _line) && ch === 58) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } + if (isMapping) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); + } else if (isPair) { + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode)); + } else { + _result.push(keyNode); + } + skipSeparationSpace(state, true, nodeIndent); + ch = state.input.charCodeAt(state.position); + if (ch === 44) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } + throwError(state, "unexpected end of the stream within a flow collection"); + } + function readBlockScalar(state, nodeIndent) { + var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch; + ch = state.input.charCodeAt(state.position); + if (ch === 124) { + folding = false; + } else if (ch === 62) { + folding = true; + } else { + return false; + } + state.kind = "scalar"; + state.result = ""; + while (ch !== 0) { + ch = state.input.charCodeAt(++state.position); + if (ch === 43 || ch === 45) { + if (CHOMPING_CLIP === chomping) { + chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, "repeat of a chomping mode identifier"); + } + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one"); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, "repeat of an indentation width identifier"); + } + } else { + break; + } + } + if (is_WHITE_SPACE(ch)) { + do { + ch = state.input.charCodeAt(++state.position); + } while (is_WHITE_SPACE(ch)); + if (ch === 35) { + do { + ch = state.input.charCodeAt(++state.position); + } while (!is_EOL(ch) && ch !== 0); + } + } + while (ch !== 0) { + readLineBreak(state); + state.lineIndent = 0; + ch = state.input.charCodeAt(state.position); + while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } + if (is_EOL(ch)) { + emptyLines++; + continue; + } + if (state.lineIndent < textIndent) { + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { + state.result += "\n"; + } + } + break; + } + if (folding) { + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines); + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat("\n", emptyLines + 1); + } else if (emptyLines === 0) { + if (didReadContent) { + state.result += " "; + } + } else { + state.result += common.repeat("\n", emptyLines); + } + } else { + state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines); + } + didReadContent = true; + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + while (!is_EOL(ch) && ch !== 0) { + ch = state.input.charCodeAt(++state.position); + } + captureSegment(state, captureStart, state.position, false); + } + return true; + } + function readBlockSequence(state, nodeIndent) { + var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + ch = state.input.charCodeAt(state.position); + while (ch !== 0) { + if (ch !== 45) { + break; + } + following = state.input.charCodeAt(state.position + 1); + if (!is_WS_OR_EOL(following)) { + break; + } + detected = true; + state.position++; + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) { + throwError(state, "bad indentation of a sequence entry"); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = "sequence"; + state.result = _result; + return true; + } + return false; + } + function readBlockMapping(state, nodeIndent, flowIndent) { + var following, allowCompact, _line, _pos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = {}, keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + ch = state.input.charCodeAt(state.position); + while (ch !== 0) { + following = state.input.charCodeAt(state.position + 1); + _line = state.line; + _pos = state.position; + if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) { + if (ch === 63) { + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + detected = true; + atExplicitKey = true; + allowCompact = true; + } else if (atExplicitKey) { + atExplicitKey = false; + allowCompact = true; + } else { + throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"); + } + state.position += 1; + ch = following; + } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + if (ch === 58) { + ch = state.input.charCodeAt(++state.position); + if (!is_WS_OR_EOL(ch)) { + throwError(state, "a whitespace character is expected after the key-value separator within a block mapping"); + } + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; + } else if (detected) { + throwError(state, "can not read an implicit mapping pair; a colon is missed"); + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; + } + } else if (detected) { + throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key"); + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; + } + } else { + break; + } + if (state.line === _line || state.lineIndent > nodeIndent) { + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } + if (!atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); + keyTag = keyNode = valueNode = null; + } + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } + if (state.lineIndent > nodeIndent && ch !== 0) { + throwError(state, "bad indentation of a mapping entry"); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + } + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = "mapping"; + state.result = _result; + } + return detected; + } + function readTagProperty(state) { + var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch; + ch = state.input.charCodeAt(state.position); + if (ch !== 33) + return false; + if (state.tag !== null) { + throwError(state, "duplication of a tag property"); + } + ch = state.input.charCodeAt(++state.position); + if (ch === 60) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); + } else if (ch === 33) { + isNamed = true; + tagHandle = "!!"; + ch = state.input.charCodeAt(++state.position); + } else { + tagHandle = "!"; + } + _position = state.position; + if (isVerbatim) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0 && ch !== 62); + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, "unexpected end of the stream within a verbatim tag"); + } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + if (ch === 33) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, "named tag handle cannot contain such characters"); + } + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, "tag suffix cannot contain exclamation marks"); + } + } + ch = state.input.charCodeAt(++state.position); + } + tagName = state.input.slice(_position, state.position); + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, "tag suffix cannot contain flow indicator characters"); + } + } + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, "tag name cannot contain such characters: " + tagName); + } + if (isVerbatim) { + state.tag = tagName; + } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; + } else if (tagHandle === "!") { + state.tag = "!" + tagName; + } else if (tagHandle === "!!") { + state.tag = "tag:yaml.org,2002:" + tagName; + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } + return true; + } + function readAnchorProperty(state) { + var _position, ch; + ch = state.input.charCodeAt(state.position); + if (ch !== 38) + return false; + if (state.anchor !== null) { + throwError(state, "duplication of an anchor property"); + } + ch = state.input.charCodeAt(++state.position); + _position = state.position; + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + if (state.position === _position) { + throwError(state, "name of an anchor node must contain at least one character"); + } + state.anchor = state.input.slice(_position, state.position); + return true; + } + function readAlias(state) { + var _position, alias, ch; + ch = state.input.charCodeAt(state.position); + if (ch !== 42) + return false; + ch = state.input.charCodeAt(++state.position); + _position = state.position; + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + if (state.position === _position) { + throwError(state, "name of an alias node must contain at least one character"); + } + alias = state.input.slice(_position, state.position); + if (!_hasOwnProperty.call(state.anchorMap, alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; + } + function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, type, flowIndent, blockIndent; + if (state.listener !== null) { + state.listener("open", state); + } + state.tag = null; + state.anchor = null; + state.kind = null; + state.result = null; + allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext; + if (allowToSeek) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } + if (indentStatus === 1) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } + blockIndent = state.position - state.lineStart; + if (indentStatus === 1) { + if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; + } else if (readAlias(state)) { + hasContent = true; + if (state.tag !== null || state.anchor !== null) { + throwError(state, "alias node should not have any properties"); + } + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; + if (state.tag === null) { + state.tag = "?"; + } + } + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (indentStatus === 0) { + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } + if (state.tag !== null && state.tag !== "!") { + if (state.tag === "?") { + if (state.result !== null && state.kind !== "scalar") { + throwError(state, 'unacceptable node kind for !> tag; it should be "scalar", not "' + state.kind + '"'); + } + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; + if (type.resolve(state.result)) { + state.result = type.construct(state.result); + state.tag = type.tag; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) { + type = state.typeMap[state.kind || "fallback"][state.tag]; + if (state.result !== null && type.kind !== state.kind) { + throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } + if (!type.resolve(state.result)) { + throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag"); + } else { + state.result = type.construct(state.result); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else { + throwError(state, "unknown tag !<" + state.tag + ">"); + } + } + if (state.listener !== null) { + state.listener("close", state); + } + return state.tag !== null || state.anchor !== null || hasContent; + } + function readDocument(state) { + var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch; + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = {}; + state.anchorMap = {}; + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + if (state.lineIndent > 0 || ch !== 37) { + break; + } + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; + if (directiveName.length < 1) { + throwError(state, "directive name must not be less than one character in length"); + } + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + if (ch === 35) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0 && !is_EOL(ch)); + break; + } + if (is_EOL(ch)) + break; + _position = state.position; + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + directiveArgs.push(state.input.slice(_position, state.position)); + } + if (ch !== 0) + readLineBreak(state); + if (_hasOwnProperty.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } + } + skipSeparationSpace(state, true, -1); + if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } else if (hasDirectives) { + throwError(state, "directives end mark is expected"); + } + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); + if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, "non-ASCII line breaks are interpreted as content"); + } + state.documents.push(state.result); + if (state.position === state.lineStart && testDocumentSeparator(state)) { + if (state.input.charCodeAt(state.position) === 46) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } + if (state.position < state.length - 1) { + throwError(state, "end of the stream or a document separator is expected"); + } else { + return; + } + } + function loadDocuments(input, options) { + input = String(input); + options = options || {}; + if (input.length !== 0) { + if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) { + input += "\n"; + } + if (input.charCodeAt(0) === 65279) { + input = input.slice(1); + } + } + var state = new State(input, options); + var nullpos = input.indexOf("\0"); + if (nullpos !== -1) { + state.position = nullpos; + throwError(state, "null byte is not allowed in input"); + } + state.input += "\0"; + while (state.input.charCodeAt(state.position) === 32) { + state.lineIndent += 1; + state.position += 1; + } + while (state.position < state.length - 1) { + readDocument(state); + } + return state.documents; + } + function loadAll(input, iterator, options) { + if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") { + options = iterator; + iterator = null; + } + var documents = loadDocuments(input, options); + if (typeof iterator !== "function") { + return documents; + } + for (var index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } + } + function load(input, options) { + var documents = loadDocuments(input, options); + if (documents.length === 0) { + return void 0; + } else if (documents.length === 1) { + return documents[0]; + } + throw new YAMLException("expected a single document in the stream, but found more"); + } + function safeLoadAll(input, iterator, options) { + if (typeof iterator === "object" && iterator !== null && typeof options === "undefined") { + options = iterator; + iterator = null; + } + return loadAll(input, iterator, common.extend({schema: DEFAULT_SAFE_SCHEMA}, options)); + } + function safeLoad(input, options) { + return load(input, common.extend({schema: DEFAULT_SAFE_SCHEMA}, options)); + } + module2.exports.loadAll = loadAll; + module2.exports.load = load; + module2.exports.safeLoadAll = safeLoadAll; + module2.exports.safeLoad = safeLoad; +}); + +// node_modules/js-yaml/lib/js-yaml/dumper.js +var require_dumper2 = __commonJS((exports2, module2) => { + "use strict"; + var common = require_common3(); + var YAMLException = require_exception2(); + var DEFAULT_FULL_SCHEMA = require_default_full(); + var DEFAULT_SAFE_SCHEMA = require_default_safe(); + var _toString = Object.prototype.toString; + var _hasOwnProperty = Object.prototype.hasOwnProperty; + var CHAR_TAB = 9; + var CHAR_LINE_FEED = 10; + var CHAR_CARRIAGE_RETURN = 13; + var CHAR_SPACE = 32; + var CHAR_EXCLAMATION = 33; + var CHAR_DOUBLE_QUOTE = 34; + var CHAR_SHARP = 35; + var CHAR_PERCENT = 37; + var CHAR_AMPERSAND = 38; + var CHAR_SINGLE_QUOTE = 39; + var CHAR_ASTERISK = 42; + var CHAR_COMMA = 44; + var CHAR_MINUS = 45; + var CHAR_COLON = 58; + var CHAR_EQUALS = 61; + var CHAR_GREATER_THAN = 62; + var CHAR_QUESTION = 63; + var CHAR_COMMERCIAL_AT = 64; + var CHAR_LEFT_SQUARE_BRACKET = 91; + var CHAR_RIGHT_SQUARE_BRACKET = 93; + var CHAR_GRAVE_ACCENT = 96; + var CHAR_LEFT_CURLY_BRACKET = 123; + var CHAR_VERTICAL_LINE = 124; + var CHAR_RIGHT_CURLY_BRACKET = 125; + var ESCAPE_SEQUENCES = {}; + ESCAPE_SEQUENCES[0] = "\\0"; + ESCAPE_SEQUENCES[7] = "\\a"; + ESCAPE_SEQUENCES[8] = "\\b"; + ESCAPE_SEQUENCES[9] = "\\t"; + ESCAPE_SEQUENCES[10] = "\\n"; + ESCAPE_SEQUENCES[11] = "\\v"; + ESCAPE_SEQUENCES[12] = "\\f"; + ESCAPE_SEQUENCES[13] = "\\r"; + ESCAPE_SEQUENCES[27] = "\\e"; + ESCAPE_SEQUENCES[34] = '\\"'; + ESCAPE_SEQUENCES[92] = "\\\\"; + ESCAPE_SEQUENCES[133] = "\\N"; + ESCAPE_SEQUENCES[160] = "\\_"; + ESCAPE_SEQUENCES[8232] = "\\L"; + ESCAPE_SEQUENCES[8233] = "\\P"; + var DEPRECATED_BOOLEANS_SYNTAX = [ + "y", + "Y", + "yes", + "Yes", + "YES", + "on", + "On", + "ON", + "n", + "N", + "no", + "No", + "NO", + "off", + "Off", + "OFF" + ]; + function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; + if (map === null) + return {}; + result = {}; + keys = Object.keys(map); + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); + if (tag.slice(0, 2) === "!!") { + tag = "tag:yaml.org,2002:" + tag.slice(2); + } + type = schema.compiledTypeMap["fallback"][tag]; + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } + result[tag] = style; + } + return result; + } + function encodeHex(character) { + var string, handle, length; + string = character.toString(16).toUpperCase(); + if (character <= 255) { + handle = "x"; + length = 2; + } else if (character <= 65535) { + handle = "u"; + length = 4; + } else if (character <= 4294967295) { + handle = "U"; + length = 8; + } else { + throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF"); + } + return "\\" + handle + common.repeat("0", length - string.length) + string; + } + function State(options) { + this.schema = options["schema"] || DEFAULT_FULL_SCHEMA; + this.indent = Math.max(1, options["indent"] || 2); + this.noArrayIndent = options["noArrayIndent"] || false; + this.skipInvalid = options["skipInvalid"] || false; + this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"]; + this.styleMap = compileStyleMap(this.schema, options["styles"] || null); + this.sortKeys = options["sortKeys"] || false; + this.lineWidth = options["lineWidth"] || 80; + this.noRefs = options["noRefs"] || false; + this.noCompatMode = options["noCompatMode"] || false; + this.condenseFlow = options["condenseFlow"] || false; + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; + this.tag = null; + this.result = ""; + this.duplicates = []; + this.usedDuplicates = null; + } + function indentString(string, spaces) { + var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length; + while (position < length) { + next = string.indexOf("\n", position); + if (next === -1) { + line = string.slice(position); + position = length; + } else { + line = string.slice(position, next + 1); + position = next + 1; + } + if (line.length && line !== "\n") + result += ind; + result += line; + } + return result; + } + function generateNextLine(state, level) { + return "\n" + common.repeat(" ", state.indent * level); + } + function testImplicitResolving(state, str) { + var index, length, type; + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; + if (type.resolve(str)) { + return true; + } + } + return false; + } + function isWhitespace(c) { + return c === CHAR_SPACE || c === CHAR_TAB; + } + function isPrintable(c) { + return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== 65279 || 65536 <= c && c <= 1114111; + } + function isNsChar(c) { + return isPrintable(c) && !isWhitespace(c) && c !== 65279 && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED; + } + function isPlainSafe(c, prev) { + return isPrintable(c) && c !== 65279 && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_COLON && (c !== CHAR_SHARP || prev && isNsChar(prev)); + } + function isPlainSafeFirst(c) { + return isPrintable(c) && c !== 65279 && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT; + } + function needIndentIndicator(string) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string); + } + var STYLE_PLAIN = 1; + var STYLE_SINGLE = 2; + var STYLE_LITERAL = 3; + var STYLE_FOLDED = 4; + var STYLE_DOUBLE = 5; + function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { + var i; + var char, prev_char; + var hasLineBreak = false; + var hasFoldableLine = false; + var shouldTrackWidth = lineWidth !== -1; + var previousLineBreak = -1; + var plain = isPlainSafeFirst(string.charCodeAt(0)) && !isWhitespace(string.charCodeAt(string.length - 1)); + if (singleLineOnly) { + for (i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + prev_char = i > 0 ? string.charCodeAt(i - 1) : null; + plain = plain && isPlainSafe(char, prev_char); + } + } else { + for (i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + if (char === CHAR_LINE_FEED) { + hasLineBreak = true; + if (shouldTrackWidth) { + hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " "; + previousLineBreak = i; + } + } else if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + prev_char = i > 0 ? string.charCodeAt(i - 1) : null; + plain = plain && isPlainSafe(char, prev_char); + } + hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " "); + } + if (!hasLineBreak && !hasFoldableLine) { + return plain && !testAmbiguousType(string) ? STYLE_PLAIN : STYLE_SINGLE; + } + if (indentPerLevel > 9 && needIndentIndicator(string)) { + return STYLE_DOUBLE; + } + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; + } + function writeScalar(state, string, level, iskey) { + state.dump = function() { + if (string.length === 0) { + return "''"; + } + if (!state.noCompatMode && DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) { + return "'" + string + "'"; + } + var indent = state.indent * Math.max(1, level); + var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel; + function testAmbiguity(string2) { + return testImplicitResolving(state, string2); + } + switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) { + case STYLE_PLAIN: + return string; + case STYLE_SINGLE: + return "'" + string.replace(/'/g, "''") + "'"; + case STYLE_LITERAL: + return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent)); + case STYLE_FOLDED: + return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); + case STYLE_DOUBLE: + return '"' + escapeString(string, lineWidth) + '"'; + default: + throw new YAMLException("impossible error: invalid scalar style"); + } + }(); + } + function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ""; + var clip = string[string.length - 1] === "\n"; + var keep = clip && (string[string.length - 2] === "\n" || string === "\n"); + var chomp = keep ? "+" : clip ? "" : "-"; + return indentIndicator + chomp + "\n"; + } + function dropEndingNewline(string) { + return string[string.length - 1] === "\n" ? string.slice(0, -1) : string; + } + function foldString(string, width) { + var lineRe = /(\n+)([^\n]*)/g; + var result = function() { + var nextLF = string.indexOf("\n"); + nextLF = nextLF !== -1 ? nextLF : string.length; + lineRe.lastIndex = nextLF; + return foldLine(string.slice(0, nextLF), width); + }(); + var prevMoreIndented = string[0] === "\n" || string[0] === " "; + var moreIndented; + var match; + while (match = lineRe.exec(string)) { + var prefix = match[1], line = match[2]; + moreIndented = line[0] === " "; + result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width); + prevMoreIndented = moreIndented; + } + return result; + } + function foldLine(line, width) { + if (line === "" || line[0] === " ") + return line; + var breakRe = / [^ ]/g; + var match; + var start = 0, end, curr = 0, next = 0; + var result = ""; + while (match = breakRe.exec(line)) { + next = match.index; + if (next - start > width) { + end = curr > start ? curr : next; + result += "\n" + line.slice(start, end); + start = end + 1; + } + curr = next; + } + result += "\n"; + if (line.length - start > width && curr > start) { + result += line.slice(start, curr) + "\n" + line.slice(curr + 1); + } else { + result += line.slice(start); + } + return result.slice(1); + } + function escapeString(string) { + var result = ""; + var char, nextChar; + var escapeSeq; + for (var i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + if (char >= 55296 && char <= 56319) { + nextChar = string.charCodeAt(i + 1); + if (nextChar >= 56320 && nextChar <= 57343) { + result += encodeHex((char - 55296) * 1024 + nextChar - 56320 + 65536); + i++; + continue; + } + } + escapeSeq = ESCAPE_SEQUENCES[char]; + result += !escapeSeq && isPrintable(char) ? string[i] : escapeSeq || encodeHex(char); + } + return result; + } + function writeFlowSequence(state, level, object) { + var _result = "", _tag = state.tag, index, length; + for (index = 0, length = object.length; index < length; index += 1) { + if (writeNode(state, level, object[index], false, false)) { + if (index !== 0) + _result += "," + (!state.condenseFlow ? " " : ""); + _result += state.dump; + } + } + state.tag = _tag; + state.dump = "[" + _result + "]"; + } + function writeBlockSequence(state, level, object, compact) { + var _result = "", _tag = state.tag, index, length; + for (index = 0, length = object.length; index < length; index += 1) { + if (writeNode(state, level + 1, object[index], true, true)) { + if (!compact || index !== 0) { + _result += generateNextLine(state, level); + } + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + _result += "-"; + } else { + _result += "- "; + } + _result += state.dump; + } + } + state.tag = _tag; + state.dump = _result || "[]"; + } + function writeFlowMapping(state, level, object) { + var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer; + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ""; + if (index !== 0) + pairBuffer += ", "; + if (state.condenseFlow) + pairBuffer += '"'; + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + if (!writeNode(state, level, objectKey, false, false)) { + continue; + } + if (state.dump.length > 1024) + pairBuffer += "? "; + pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " "); + if (!writeNode(state, level, objectValue, false, false)) { + continue; + } + pairBuffer += state.dump; + _result += pairBuffer; + } + state.tag = _tag; + state.dump = "{" + _result + "}"; + } + function writeBlockMapping(state, level, object, compact) { + var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer; + if (state.sortKeys === true) { + objectKeyList.sort(); + } else if (typeof state.sortKeys === "function") { + objectKeyList.sort(state.sortKeys); + } else if (state.sortKeys) { + throw new YAMLException("sortKeys must be a boolean or a function"); + } + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ""; + if (!compact || index !== 0) { + pairBuffer += generateNextLine(state, level); + } + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + if (!writeNode(state, level + 1, objectKey, true, true, true)) { + continue; + } + explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024; + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += "?"; + } else { + pairBuffer += "? "; + } + } + pairBuffer += state.dump; + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; + } + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ":"; + } else { + pairBuffer += ": "; + } + pairBuffer += state.dump; + _result += pairBuffer; + } + state.tag = _tag; + state.dump = _result || "{}"; + } + function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; + typeList = explicit ? state.explicitTypes : state.implicitTypes; + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; + if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) { + state.tag = explicit ? type.tag : "?"; + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; + if (_toString.call(type.represent) === "[object Function]") { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new YAMLException("!<" + type.tag + '> tag resolver accepts not "' + style + '" style'); + } + state.dump = _result; + } + return true; + } + } + return false; + } + function writeNode(state, level, object, block, compact, iskey) { + state.tag = null; + state.dump = object; + if (!detectType(state, object, false)) { + detectType(state, object, true); + } + var type = _toString.call(state.dump); + if (block) { + block = state.flowLevel < 0 || state.flowLevel > level; + } + var objectOrArray = type === "[object Object]" || type === "[object Array]", duplicateIndex, duplicate; + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; + } + if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) { + compact = false; + } + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = "*ref_" + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; + } + if (type === "[object Object]") { + if (block && Object.keys(state.dump).length !== 0) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = "&ref_" + duplicateIndex + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = "&ref_" + duplicateIndex + " " + state.dump; + } + } + } else if (type === "[object Array]") { + var arrayLevel = state.noArrayIndent && level > 0 ? level - 1 : level; + if (block && state.dump.length !== 0) { + writeBlockSequence(state, arrayLevel, state.dump, compact); + if (duplicate) { + state.dump = "&ref_" + duplicateIndex + state.dump; + } + } else { + writeFlowSequence(state, arrayLevel, state.dump); + if (duplicate) { + state.dump = "&ref_" + duplicateIndex + " " + state.dump; + } + } + } else if (type === "[object String]") { + if (state.tag !== "?") { + writeScalar(state, state.dump, level, iskey); + } + } else { + if (state.skipInvalid) + return false; + throw new YAMLException("unacceptable kind of an object to dump " + type); + } + if (state.tag !== null && state.tag !== "?") { + state.dump = "!<" + state.tag + "> " + state.dump; + } + } + return true; + } + function getDuplicateReferences(object, state) { + var objects = [], duplicatesIndexes = [], index, length; + inspectNode(object, objects, duplicatesIndexes); + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); + } + state.usedDuplicates = new Array(length); + } + function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, index, length; + if (object !== null && typeof object === "object") { + index = objects.indexOf(object); + if (index !== -1) { + if (duplicatesIndexes.indexOf(index) === -1) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } + } + function dump(input, options) { + options = options || {}; + var state = new State(options); + if (!state.noRefs) + getDuplicateReferences(input, state); + if (writeNode(state, 0, input, true, true)) + return state.dump + "\n"; + return ""; + } + function safeDump(input, options) { + return dump(input, common.extend({schema: DEFAULT_SAFE_SCHEMA}, options)); + } + module2.exports.dump = dump; + module2.exports.safeDump = safeDump; +}); + +// node_modules/js-yaml/lib/js-yaml.js +var require_js_yaml2 = __commonJS((exports2, module2) => { + "use strict"; + var loader = require_loader2(); + var dumper = require_dumper2(); + function deprecated(name) { + return function() { + throw new Error("Function " + name + " is deprecated and cannot be used."); + }; + } + module2.exports.Type = require_type2(); + module2.exports.Schema = require_schema2(); + module2.exports.FAILSAFE_SCHEMA = require_failsafe2(); + module2.exports.JSON_SCHEMA = require_json4(); + module2.exports.CORE_SCHEMA = require_core2(); + module2.exports.DEFAULT_SAFE_SCHEMA = require_default_safe(); + module2.exports.DEFAULT_FULL_SCHEMA = require_default_full(); + module2.exports.load = loader.load; + module2.exports.loadAll = loader.loadAll; + module2.exports.safeLoad = loader.safeLoad; + module2.exports.safeLoadAll = loader.safeLoadAll; + module2.exports.dump = dumper.dump; + module2.exports.safeDump = dumper.safeDump; + module2.exports.YAMLException = require_exception2(); + module2.exports.MINIMAL_SCHEMA = require_failsafe2(); + module2.exports.SAFE_SCHEMA = require_default_safe(); + module2.exports.DEFAULT_SCHEMA = require_default_full(); + module2.exports.scan = deprecated("scan"); + module2.exports.parse = deprecated("parse"); + module2.exports.compose = deprecated("compose"); + module2.exports.addConstructor = deprecated("addConstructor"); +}); + +// node_modules/js-yaml/index.js +var require_js_yaml3 = __commonJS((exports2, module2) => { + "use strict"; + var yaml = require_js_yaml2(); + module2.exports = yaml; +}); + +// node_modules/probot/lib/manifest-creation.js +var require_manifest_creation = __commonJS((exports2) => { + "use strict"; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : {default: mod}; + }; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.ManifestCreation = void 0; + var fs_1 = __importDefault(require("fs")); + var js_yaml_1 = __importDefault(require_js_yaml3()); + var path_1 = __importDefault(require("path")); + var update_dotenv_1 = __importDefault(require_update_dotenv()); + var probot_octokit_1 = require_probot_octokit(); + var ManifestCreation = class { + get pkg() { + let pkg; + try { + pkg = require(path_1.default.join(process.cwd(), "package.json")); + } catch (e) { + pkg = {}; + } + return pkg; + } + async createWebhookChannel() { + try { + const SmeeClient = require_smee_client(); + await this.updateEnv({ + WEBHOOK_PROXY_URL: await SmeeClient.createChannel() + }); + } catch (error) { + console.warn("Unable to connect to smee.io, try restarting your server."); + } + } + getManifest(pkg, baseUrl) { + let manifest = {}; + try { + const file = fs_1.default.readFileSync(path_1.default.join(process.cwd(), "app.yml"), "utf8"); + manifest = js_yaml_1.default.safeLoad(file); + } catch (error) { + if (error.code !== "ENOENT") { + throw error; + } + } + const generatedManifest = JSON.stringify(Object.assign({ + description: manifest.description || pkg.description, + hook_attributes: { + url: process.env.WEBHOOK_PROXY_URL || `${baseUrl}/` + }, + name: process.env.PROJECT_DOMAIN || manifest.name || pkg.name, + public: manifest.public || true, + redirect_url: `${baseUrl}/probot/setup`, + url: manifest.url || pkg.homepage || pkg.repository, + version: "v1" + }, manifest)); + return generatedManifest; + } + async createAppFromCode(code) { + const octokit = new probot_octokit_1.ProbotOctokit(); + const options = __objSpread({ + code, + mediaType: { + previews: ["fury"] + } + }, process.env.GHE_HOST && { + baseUrl: `${process.env.GHE_PROTOCOL || "https"}://${process.env.GHE_HOST}/api/v3` + }); + const response = await octokit.request("POST /app-manifests/:code/conversions", options); + const {id, webhook_secret, pem} = response.data; + await this.updateEnv({ + APP_ID: id.toString(), + PRIVATE_KEY: `"${pem}"`, + WEBHOOK_SECRET: webhook_secret + }); + return response.data.html_url; + } + async updateEnv(env) { + return update_dotenv_1.default(env); + } + get createAppUrl() { + const githubHost = process.env.GHE_HOST || `github.com`; + return `${process.env.GHE_PROTOCOL || "https"}://${githubHost}/settings/apps/new`; + } + }; + exports2.ManifestCreation = ManifestCreation; +}); + +// node_modules/probot/lib/apps/setup.js +var require_setup = __commonJS((exports2) => { + "use strict"; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : {default: mod}; + }; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.setupAppFactory = void 0; + var body_parser_1 = __importDefault(require_body_parser()); + var child_process_1 = require("child_process"); + var update_dotenv_1 = __importDefault(require_update_dotenv()); + var manifest_creation_1 = require_manifest_creation(); + var logging_middleware_1 = require_logging_middleware(); + var setupAppFactory = (host, port) => async function setupApp(app2, {getRouter}) { + const setup = new manifest_creation_1.ManifestCreation(); + if (process.env.NODE_ENV !== "production" && !(process.env.PROJECT_DOMAIN || process.env.WEBHOOK_PROXY_URL)) { + await setup.createWebhookChannel(); + } + if (!getRouter) { + throw new Error("getRouter is required to use the setup app"); + } + const route = getRouter(); + route.use(logging_middleware_1.getLoggingMiddleware(app2.log)); + printWelcomeMessage(app2, host, port); + route.get("/probot", async (req, res) => { + const baseUrl = getBaseUrl(req); + const pkg = setup.pkg; + const manifest = setup.getManifest(pkg, baseUrl); + const createAppUrl = setup.createAppUrl; + res.render("setup.hbs", {pkg, createAppUrl, manifest}); + }); + route.get("/probot/setup", async (req, res) => { + const {code} = req.query; + const response = await setup.createAppFromCode(code); + if (process.env.PROJECT_DOMAIN) { + child_process_1.exec("refresh", (error) => { + if (error) { + app2.log.error(error); + } + }); + } else { + printRestartMessage(app2); + } + res.redirect(`${response}/installations/new`); + }); + route.get("/probot/import", async (_req, res) => { + const {WEBHOOK_PROXY_URL, GHE_HOST} = process.env; + const GH_HOST = `https://${GHE_HOST !== null && GHE_HOST !== void 0 ? GHE_HOST : "github.com"}`; + res.render("import.hbs", {WEBHOOK_PROXY_URL, GH_HOST}); + }); + route.post("/probot/import", body_parser_1.default.json(), async (req, res) => { + const {appId, pem, webhook_secret} = req.body; + if (!appId || !pem || !webhook_secret) { + res.status(400).send("appId and/or pem and/or webhook_secret missing"); + return; + } + update_dotenv_1.default({ + APP_ID: appId, + PRIVATE_KEY: `"${pem}"`, + WEBHOOK_SECRET: webhook_secret + }); + res.end(); + printRestartMessage(app2); + }); + route.get("/probot/success", async (req, res) => { + res.render("success.hbs"); + }); + route.get("/", (req, res, next) => res.redirect("/probot")); + }; + exports2.setupAppFactory = setupAppFactory; + function printWelcomeMessage(app2, host, port) { + const domain = process.env.PROJECT_DOMAIN || `http://${host !== null && host !== void 0 ? host : "localhost"}:${port || 3e3}`; + [ + ``, + `Welcome to Probot!`, + `Probot is in setup mode, webhooks cannot be received and`, + `custom routes will not work until APP_ID and PRIVATE_KEY`, + `are configured in .env.`, + `Please follow the instructions at ${domain} to configure .env.`, + `Once you are done, restart the server.`, + `` + ].forEach((line) => { + app2.log.info(line); + }); + } + function printRestartMessage(app2) { + app2.log.info(""); + app2.log.info("Probot has been set up, please restart the server!"); + app2.log.info(""); + } + function getBaseUrl(req) { + const protocols = req.headers["x-forwarded-proto"] || req.protocol; + const protocol = typeof protocols === "string" ? protocols.split(",")[0] : protocols[0]; + const host = req.headers["x-forwarded-host"] || req.get("host"); + const baseUrl = `${protocol}://${host}`; + return baseUrl; + } +}); + +// node_modules/commander/index.js +var require_commander2 = __commonJS((exports2, module2) => { + var EventEmitter = require("events").EventEmitter; + var spawn = require("child_process").spawn; + var path = require("path"); + var fs = require("fs"); + var Option = class { + constructor(flags, description) { + this.flags = flags; + this.required = flags.includes("<"); + this.optional = flags.includes("["); + this.variadic = /\w\.\.\.[>\]]$/.test(flags); + this.mandatory = false; + const optionFlags = _parseOptionFlags(flags); + this.short = optionFlags.shortFlag; + this.long = optionFlags.longFlag; + this.negate = false; + if (this.long) { + this.negate = this.long.startsWith("--no-"); + } + this.description = description || ""; + this.defaultValue = void 0; + } + name() { + if (this.long) { + return this.long.replace(/^--/, ""); + } + return this.short.replace(/^-/, ""); + } + attributeName() { + return camelcase(this.name().replace(/^no-/, "")); + } + is(arg) { + return this.short === arg || this.long === arg; + } + }; + var CommanderError = class extends Error { + constructor(exitCode, code, message) { + super(message); + Error.captureStackTrace(this, this.constructor); + this.name = this.constructor.name; + this.code = code; + this.exitCode = exitCode; + this.nestedError = void 0; + } + }; + var Command = class extends EventEmitter { + constructor(name) { + super(); + this.commands = []; + this.options = []; + this.parent = null; + this._allowUnknownOption = false; + this._args = []; + this.rawArgs = null; + this._scriptPath = null; + this._name = name || ""; + this._optionValues = {}; + this._storeOptionsAsProperties = true; + this._storeOptionsAsPropertiesCalled = false; + this._passCommandToAction = true; + this._actionResults = []; + this._actionHandler = null; + this._executableHandler = false; + this._executableFile = null; + this._defaultCommandName = null; + this._exitCallback = null; + this._aliases = []; + this._combineFlagAndOptionalValue = true; + this._hidden = false; + this._hasHelpOption = true; + this._helpFlags = "-h, --help"; + this._helpDescription = "display help for command"; + this._helpShortFlag = "-h"; + this._helpLongFlag = "--help"; + this._hasImplicitHelpCommand = void 0; + this._helpCommandName = "help"; + this._helpCommandnameAndArgs = "help [command]"; + this._helpCommandDescription = "display help for command"; + } + command(nameAndArgs, actionOptsOrExecDesc, execOpts) { + let desc = actionOptsOrExecDesc; + let opts = execOpts; + if (typeof desc === "object" && desc !== null) { + opts = desc; + desc = null; + } + opts = opts || {}; + const args = nameAndArgs.split(/ +/); + const cmd = this.createCommand(args.shift()); + if (desc) { + cmd.description(desc); + cmd._executableHandler = true; + } + if (opts.isDefault) + this._defaultCommandName = cmd._name; + cmd._hidden = !!(opts.noHelp || opts.hidden); + cmd._hasHelpOption = this._hasHelpOption; + cmd._helpFlags = this._helpFlags; + cmd._helpDescription = this._helpDescription; + cmd._helpShortFlag = this._helpShortFlag; + cmd._helpLongFlag = this._helpLongFlag; + cmd._helpCommandName = this._helpCommandName; + cmd._helpCommandnameAndArgs = this._helpCommandnameAndArgs; + cmd._helpCommandDescription = this._helpCommandDescription; + cmd._exitCallback = this._exitCallback; + cmd._storeOptionsAsProperties = this._storeOptionsAsProperties; + cmd._passCommandToAction = this._passCommandToAction; + cmd._combineFlagAndOptionalValue = this._combineFlagAndOptionalValue; + cmd._executableFile = opts.executableFile || null; + this.commands.push(cmd); + cmd._parseExpectedArgs(args); + cmd.parent = this; + if (desc) + return this; + return cmd; + } + createCommand(name) { + return new Command(name); + } + addCommand(cmd, opts) { + if (!cmd._name) + throw new Error("Command passed to .addCommand() must have a name"); + function checkExplicitNames(commandArray) { + commandArray.forEach((cmd2) => { + if (cmd2._executableHandler && !cmd2._executableFile) { + throw new Error(`Must specify executableFile for deeply nested executable: ${cmd2.name()}`); + } + checkExplicitNames(cmd2.commands); + }); + } + checkExplicitNames(cmd.commands); + opts = opts || {}; + if (opts.isDefault) + this._defaultCommandName = cmd._name; + if (opts.noHelp || opts.hidden) + cmd._hidden = true; + this.commands.push(cmd); + cmd.parent = this; + return this; + } + arguments(desc) { + return this._parseExpectedArgs(desc.split(/ +/)); + } + addHelpCommand(enableOrNameAndArgs, description) { + if (enableOrNameAndArgs === false) { + this._hasImplicitHelpCommand = false; + } else { + this._hasImplicitHelpCommand = true; + if (typeof enableOrNameAndArgs === "string") { + this._helpCommandName = enableOrNameAndArgs.split(" ")[0]; + this._helpCommandnameAndArgs = enableOrNameAndArgs; + } + this._helpCommandDescription = description || this._helpCommandDescription; + } + return this; + } + _lazyHasImplicitHelpCommand() { + if (this._hasImplicitHelpCommand === void 0) { + this._hasImplicitHelpCommand = this.commands.length && !this._actionHandler && !this._findCommand("help"); + } + return this._hasImplicitHelpCommand; + } + _parseExpectedArgs(args) { + if (!args.length) + return; + args.forEach((arg) => { + const argDetails = { + required: false, + name: "", + variadic: false + }; + switch (arg[0]) { + case "<": + argDetails.required = true; + argDetails.name = arg.slice(1, -1); + break; + case "[": + argDetails.name = arg.slice(1, -1); + break; + } + if (argDetails.name.length > 3 && argDetails.name.slice(-3) === "...") { + argDetails.variadic = true; + argDetails.name = argDetails.name.slice(0, -3); + } + if (argDetails.name) { + this._args.push(argDetails); + } + }); + this._args.forEach((arg, i) => { + if (arg.variadic && i < this._args.length - 1) { + throw new Error(`only the last argument can be variadic '${arg.name}'`); + } + }); + return this; + } + exitOverride(fn) { + if (fn) { + this._exitCallback = fn; + } else { + this._exitCallback = (err) => { + if (err.code !== "commander.executeSubCommandAsync") { + throw err; + } else { + } + }; + } + return this; + } + _exit(exitCode, code, message) { + if (this._exitCallback) { + this._exitCallback(new CommanderError(exitCode, code, message)); + } + process.exit(exitCode); + } + action(fn) { + const listener = (args) => { + const expectedArgsCount = this._args.length; + const actionArgs = args.slice(0, expectedArgsCount); + if (this._passCommandToAction) { + actionArgs[expectedArgsCount] = this; + } else { + actionArgs[expectedArgsCount] = this.opts(); + } + if (args.length > expectedArgsCount) { + actionArgs.push(args.slice(expectedArgsCount)); + } + const actionResult = fn.apply(this, actionArgs); + let rootCommand = this; + while (rootCommand.parent) { + rootCommand = rootCommand.parent; + } + rootCommand._actionResults.push(actionResult); + }; + this._actionHandler = listener; + return this; + } + _checkForOptionNameClash(option) { + if (!this._storeOptionsAsProperties || this._storeOptionsAsPropertiesCalled) { + return; + } + if (option.name() === "help") { + return; + } + const commandProperty = this._getOptionValue(option.attributeName()); + if (commandProperty === void 0) { + return; + } + let foundClash = true; + if (option.negate) { + const positiveLongFlag = option.long.replace(/^--no-/, "--"); + foundClash = !this._findOption(positiveLongFlag); + } else if (option.long) { + const negativeLongFlag = option.long.replace(/^--/, "--no-"); + foundClash = !this._findOption(negativeLongFlag); + } + if (foundClash) { + throw new Error(`option '${option.name()}' clashes with existing property '${option.attributeName()}' on Command +- call storeOptionsAsProperties(false) to store option values safely, +- or call storeOptionsAsProperties(true) to suppress this check, +- or change option name + +Read more on https://git.io/JJc0W`); + } + } + _optionEx(config, flags, description, fn, defaultValue) { + const option = new Option(flags, description); + const oname = option.name(); + const name = option.attributeName(); + option.mandatory = !!config.mandatory; + this._checkForOptionNameClash(option); + if (typeof fn !== "function") { + if (fn instanceof RegExp) { + const regex = fn; + fn = (val, def) => { + const m = regex.exec(val); + return m ? m[0] : def; + }; + } else { + defaultValue = fn; + fn = null; + } + } + if (option.negate || option.optional || option.required || typeof defaultValue === "boolean") { + if (option.negate) { + const positiveLongFlag = option.long.replace(/^--no-/, "--"); + defaultValue = this._findOption(positiveLongFlag) ? this._getOptionValue(name) : true; + } + if (defaultValue !== void 0) { + this._setOptionValue(name, defaultValue); + option.defaultValue = defaultValue; + } + } + this.options.push(option); + this.on("option:" + oname, (val) => { + const oldValue = this._getOptionValue(name); + if (val !== null && fn) { + val = fn(val, oldValue === void 0 ? defaultValue : oldValue); + } else if (val !== null && option.variadic) { + if (oldValue === defaultValue || !Array.isArray(oldValue)) { + val = [val]; + } else { + val = oldValue.concat(val); + } + } + if (typeof oldValue === "boolean" || typeof oldValue === "undefined") { + if (val == null) { + this._setOptionValue(name, option.negate ? false : defaultValue || true); + } else { + this._setOptionValue(name, val); + } + } else if (val !== null) { + this._setOptionValue(name, option.negate ? false : val); + } + }); + return this; + } + option(flags, description, fn, defaultValue) { + return this._optionEx({}, flags, description, fn, defaultValue); + } + requiredOption(flags, description, fn, defaultValue) { + return this._optionEx({mandatory: true}, flags, description, fn, defaultValue); + } + combineFlagAndOptionalValue(arg) { + this._combineFlagAndOptionalValue = arg === void 0 || arg; + return this; + } + allowUnknownOption(arg) { + this._allowUnknownOption = arg === void 0 || arg; + return this; + } + storeOptionsAsProperties(value) { + this._storeOptionsAsPropertiesCalled = true; + this._storeOptionsAsProperties = value === void 0 || value; + if (this.options.length) { + throw new Error("call .storeOptionsAsProperties() before adding options"); + } + return this; + } + passCommandToAction(value) { + this._passCommandToAction = value === void 0 || value; + return this; + } + _setOptionValue(key, value) { + if (this._storeOptionsAsProperties) { + this[key] = value; + } else { + this._optionValues[key] = value; + } + } + _getOptionValue(key) { + if (this._storeOptionsAsProperties) { + return this[key]; + } + return this._optionValues[key]; + } + parse(argv, parseOptions) { + if (argv !== void 0 && !Array.isArray(argv)) { + throw new Error("first parameter to parse must be array or undefined"); + } + parseOptions = parseOptions || {}; + if (argv === void 0) { + argv = process.argv; + if (process.versions && process.versions.electron) { + parseOptions.from = "electron"; + } + } + this.rawArgs = argv.slice(); + let userArgs; + switch (parseOptions.from) { + case void 0: + case "node": + this._scriptPath = argv[1]; + userArgs = argv.slice(2); + break; + case "electron": + if (process.defaultApp) { + this._scriptPath = argv[1]; + userArgs = argv.slice(2); + } else { + userArgs = argv.slice(1); + } + break; + case "user": + userArgs = argv.slice(0); + break; + default: + throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`); + } + if (!this._scriptPath && process.mainModule) { + this._scriptPath = process.mainModule.filename; + } + this._name = this._name || this._scriptPath && path.basename(this._scriptPath, path.extname(this._scriptPath)); + this._parseCommand([], userArgs); + return this; + } + parseAsync(argv, parseOptions) { + this.parse(argv, parseOptions); + return Promise.all(this._actionResults).then(() => this); + } + _executeSubCommand(subcommand, args) { + args = args.slice(); + let launchWithNode = false; + const sourceExt = [".js", ".ts", ".tsx", ".mjs"]; + this._checkForMissingMandatoryOptions(); + let scriptPath = this._scriptPath; + if (!scriptPath && process.mainModule) { + scriptPath = process.mainModule.filename; + } + let baseDir; + try { + const resolvedLink = fs.realpathSync(scriptPath); + baseDir = path.dirname(resolvedLink); + } catch (e) { + baseDir = "."; + } + let bin = path.basename(scriptPath, path.extname(scriptPath)) + "-" + subcommand._name; + if (subcommand._executableFile) { + bin = subcommand._executableFile; + } + const localBin = path.join(baseDir, bin); + if (fs.existsSync(localBin)) { + bin = localBin; + } else { + sourceExt.forEach((ext) => { + if (fs.existsSync(`${localBin}${ext}`)) { + bin = `${localBin}${ext}`; + } + }); + } + launchWithNode = sourceExt.includes(path.extname(bin)); + let proc; + if (process.platform !== "win32") { + if (launchWithNode) { + args.unshift(bin); + args = incrementNodeInspectorPort(process.execArgv).concat(args); + proc = spawn(process.argv[0], args, {stdio: "inherit"}); + } else { + proc = spawn(bin, args, {stdio: "inherit"}); + } + } else { + args.unshift(bin); + args = incrementNodeInspectorPort(process.execArgv).concat(args); + proc = spawn(process.execPath, args, {stdio: "inherit"}); + } + const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"]; + signals.forEach((signal) => { + process.on(signal, () => { + if (proc.killed === false && proc.exitCode === null) { + proc.kill(signal); + } + }); + }); + const exitCallback = this._exitCallback; + if (!exitCallback) { + proc.on("close", process.exit.bind(process)); + } else { + proc.on("close", () => { + exitCallback(new CommanderError(process.exitCode || 0, "commander.executeSubCommandAsync", "(close)")); + }); + } + proc.on("error", (err) => { + if (err.code === "ENOENT") { + const executableMissing = `'${bin}' does not exist + - if '${subcommand._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead + - if the default executable name is not suitable, use the executableFile option to supply a custom name`; + throw new Error(executableMissing); + } else if (err.code === "EACCES") { + throw new Error(`'${bin}' not executable`); + } + if (!exitCallback) { + process.exit(1); + } else { + const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)"); + wrappedError.nestedError = err; + exitCallback(wrappedError); + } + }); + this.runningCommand = proc; + } + _dispatchSubcommand(commandName, operands, unknown) { + const subCommand = this._findCommand(commandName); + if (!subCommand) + this._helpAndError(); + if (subCommand._executableHandler) { + this._executeSubCommand(subCommand, operands.concat(unknown)); + } else { + subCommand._parseCommand(operands, unknown); + } + } + _parseCommand(operands, unknown) { + const parsed = this.parseOptions(unknown); + operands = operands.concat(parsed.operands); + unknown = parsed.unknown; + this.args = operands.concat(unknown); + if (operands && this._findCommand(operands[0])) { + this._dispatchSubcommand(operands[0], operands.slice(1), unknown); + } else if (this._lazyHasImplicitHelpCommand() && operands[0] === this._helpCommandName) { + if (operands.length === 1) { + this.help(); + } else { + this._dispatchSubcommand(operands[1], [], [this._helpLongFlag]); + } + } else if (this._defaultCommandName) { + outputHelpIfRequested(this, unknown); + this._dispatchSubcommand(this._defaultCommandName, operands, unknown); + } else { + if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) { + this._helpAndError(); + } + outputHelpIfRequested(this, parsed.unknown); + this._checkForMissingMandatoryOptions(); + if (parsed.unknown.length > 0) { + this.unknownOption(parsed.unknown[0]); + } + if (this._actionHandler) { + const args = this.args.slice(); + this._args.forEach((arg, i) => { + if (arg.required && args[i] == null) { + this.missingArgument(arg.name); + } else if (arg.variadic) { + args[i] = args.splice(i); + } + }); + this._actionHandler(args); + this.emit("command:" + this.name(), operands, unknown); + } else if (operands.length) { + if (this._findCommand("*")) { + this._dispatchSubcommand("*", operands, unknown); + } else if (this.listenerCount("command:*")) { + this.emit("command:*", operands, unknown); + } else if (this.commands.length) { + this.unknownCommand(); + } + } else if (this.commands.length) { + this._helpAndError(); + } else { + } + } + } + _findCommand(name) { + if (!name) + return void 0; + return this.commands.find((cmd) => cmd._name === name || cmd._aliases.includes(name)); + } + _findOption(arg) { + return this.options.find((option) => option.is(arg)); + } + _checkForMissingMandatoryOptions() { + for (let cmd = this; cmd; cmd = cmd.parent) { + cmd.options.forEach((anOption) => { + if (anOption.mandatory && cmd._getOptionValue(anOption.attributeName()) === void 0) { + cmd.missingMandatoryOptionValue(anOption); + } + }); + } + } + parseOptions(argv) { + const operands = []; + const unknown = []; + let dest = operands; + const args = argv.slice(); + function maybeOption(arg) { + return arg.length > 1 && arg[0] === "-"; + } + let activeVariadicOption = null; + while (args.length) { + const arg = args.shift(); + if (arg === "--") { + if (dest === unknown) + dest.push(arg); + dest.push(...args); + break; + } + if (activeVariadicOption && !maybeOption(arg)) { + this.emit(`option:${activeVariadicOption.name()}`, arg); + continue; + } + activeVariadicOption = null; + if (maybeOption(arg)) { + const option = this._findOption(arg); + if (option) { + if (option.required) { + const value = args.shift(); + if (value === void 0) + this.optionMissingArgument(option); + this.emit(`option:${option.name()}`, value); + } else if (option.optional) { + let value = null; + if (args.length > 0 && !maybeOption(args[0])) { + value = args.shift(); + } + this.emit(`option:${option.name()}`, value); + } else { + this.emit(`option:${option.name()}`); + } + activeVariadicOption = option.variadic ? option : null; + continue; + } + } + if (arg.length > 2 && arg[0] === "-" && arg[1] !== "-") { + const option = this._findOption(`-${arg[1]}`); + if (option) { + if (option.required || option.optional && this._combineFlagAndOptionalValue) { + this.emit(`option:${option.name()}`, arg.slice(2)); + } else { + this.emit(`option:${option.name()}`); + args.unshift(`-${arg.slice(2)}`); + } + continue; + } + } + if (/^--[^=]+=/.test(arg)) { + const index = arg.indexOf("="); + const option = this._findOption(arg.slice(0, index)); + if (option && (option.required || option.optional)) { + this.emit(`option:${option.name()}`, arg.slice(index + 1)); + continue; + } + } + if (arg.length > 1 && arg[0] === "-") { + dest = unknown; + } + dest.push(arg); + } + return {operands, unknown}; + } + opts() { + if (this._storeOptionsAsProperties) { + const result = {}; + const len = this.options.length; + for (let i = 0; i < len; i++) { + const key = this.options[i].attributeName(); + result[key] = key === this._versionOptionName ? this._version : this[key]; + } + return result; + } + return this._optionValues; + } + missingArgument(name) { + const message = `error: missing required argument '${name}'`; + console.error(message); + this._exit(1, "commander.missingArgument", message); + } + optionMissingArgument(option, flag) { + let message; + if (flag) { + message = `error: option '${option.flags}' argument missing, got '${flag}'`; + } else { + message = `error: option '${option.flags}' argument missing`; + } + console.error(message); + this._exit(1, "commander.optionMissingArgument", message); + } + missingMandatoryOptionValue(option) { + const message = `error: required option '${option.flags}' not specified`; + console.error(message); + this._exit(1, "commander.missingMandatoryOptionValue", message); + } + unknownOption(flag) { + if (this._allowUnknownOption) + return; + const message = `error: unknown option '${flag}'`; + console.error(message); + this._exit(1, "commander.unknownOption", message); + } + unknownCommand() { + const partCommands = [this.name()]; + for (let parentCmd = this.parent; parentCmd; parentCmd = parentCmd.parent) { + partCommands.unshift(parentCmd.name()); + } + const fullCommand = partCommands.join(" "); + const message = `error: unknown command '${this.args[0]}'.` + (this._hasHelpOption ? ` See '${fullCommand} ${this._helpLongFlag}'.` : ""); + console.error(message); + this._exit(1, "commander.unknownCommand", message); + } + version(str, flags, description) { + if (str === void 0) + return this._version; + this._version = str; + flags = flags || "-V, --version"; + description = description || "output the version number"; + const versionOption = new Option(flags, description); + this._versionOptionName = versionOption.attributeName(); + this.options.push(versionOption); + this.on("option:" + versionOption.name(), () => { + process.stdout.write(str + "\n"); + this._exit(0, "commander.version", str); + }); + return this; + } + description(str, argsDescription) { + if (str === void 0 && argsDescription === void 0) + return this._description; + this._description = str; + this._argsDescription = argsDescription; + return this; + } + alias(alias) { + if (alias === void 0) + return this._aliases[0]; + let command = this; + if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) { + command = this.commands[this.commands.length - 1]; + } + if (alias === command._name) + throw new Error("Command alias can't be the same as its name"); + command._aliases.push(alias); + return this; + } + aliases(aliases) { + if (aliases === void 0) + return this._aliases; + aliases.forEach((alias) => this.alias(alias)); + return this; + } + usage(str) { + if (str === void 0) { + if (this._usage) + return this._usage; + const args = this._args.map((arg) => { + return humanReadableArgName(arg); + }); + return [].concat(this.options.length || this._hasHelpOption ? "[options]" : [], this.commands.length ? "[command]" : [], this._args.length ? args : []).join(" "); + } + this._usage = str; + return this; + } + name(str) { + if (str === void 0) + return this._name; + this._name = str; + return this; + } + prepareCommands() { + const commandDetails = this.commands.filter((cmd) => { + return !cmd._hidden; + }).map((cmd) => { + const args = cmd._args.map((arg) => { + return humanReadableArgName(arg); + }).join(" "); + return [ + cmd._name + (cmd._aliases[0] ? "|" + cmd._aliases[0] : "") + (cmd.options.length ? " [options]" : "") + (args ? " " + args : ""), + cmd._description + ]; + }); + if (this._lazyHasImplicitHelpCommand()) { + commandDetails.push([this._helpCommandnameAndArgs, this._helpCommandDescription]); + } + return commandDetails; + } + largestCommandLength() { + const commands = this.prepareCommands(); + return commands.reduce((max, command) => { + return Math.max(max, command[0].length); + }, 0); + } + largestOptionLength() { + const options = [].slice.call(this.options); + options.push({ + flags: this._helpFlags + }); + return options.reduce((max, option) => { + return Math.max(max, option.flags.length); + }, 0); + } + largestArgLength() { + return this._args.reduce((max, arg) => { + return Math.max(max, arg.name.length); + }, 0); + } + padWidth() { + let width = this.largestOptionLength(); + if (this._argsDescription && this._args.length) { + if (this.largestArgLength() > width) { + width = this.largestArgLength(); + } + } + if (this.commands && this.commands.length) { + if (this.largestCommandLength() > width) { + width = this.largestCommandLength(); + } + } + return width; + } + optionHelp() { + const width = this.padWidth(); + const columns = process.stdout.columns || 80; + const descriptionWidth = columns - width - 4; + function padOptionDetails(flags, description) { + return pad(flags, width) + " " + optionalWrap(description, descriptionWidth, width + 2); + } + ; + const help = this.options.map((option) => { + const fullDesc = option.description + (!option.negate && option.defaultValue !== void 0 ? " (default: " + JSON.stringify(option.defaultValue) + ")" : ""); + return padOptionDetails(option.flags, fullDesc); + }); + const showShortHelpFlag = this._hasHelpOption && this._helpShortFlag && !this._findOption(this._helpShortFlag); + const showLongHelpFlag = this._hasHelpOption && !this._findOption(this._helpLongFlag); + if (showShortHelpFlag || showLongHelpFlag) { + let helpFlags = this._helpFlags; + if (!showShortHelpFlag) { + helpFlags = this._helpLongFlag; + } else if (!showLongHelpFlag) { + helpFlags = this._helpShortFlag; + } + help.push(padOptionDetails(helpFlags, this._helpDescription)); + } + return help.join("\n"); + } + commandHelp() { + if (!this.commands.length && !this._lazyHasImplicitHelpCommand()) + return ""; + const commands = this.prepareCommands(); + const width = this.padWidth(); + const columns = process.stdout.columns || 80; + const descriptionWidth = columns - width - 4; + return [ + "Commands:", + commands.map((cmd) => { + const desc = cmd[1] ? " " + cmd[1] : ""; + return (desc ? pad(cmd[0], width) : cmd[0]) + optionalWrap(desc, descriptionWidth, width + 2); + }).join("\n").replace(/^/gm, " "), + "" + ].join("\n"); + } + helpInformation() { + let desc = []; + if (this._description) { + desc = [ + this._description, + "" + ]; + const argsDescription = this._argsDescription; + if (argsDescription && this._args.length) { + const width = this.padWidth(); + const columns = process.stdout.columns || 80; + const descriptionWidth = columns - width - 5; + desc.push("Arguments:"); + this._args.forEach((arg) => { + desc.push(" " + pad(arg.name, width) + " " + wrap(argsDescription[arg.name] || "", descriptionWidth, width + 4)); + }); + desc.push(""); + } + } + let cmdName = this._name; + if (this._aliases[0]) { + cmdName = cmdName + "|" + this._aliases[0]; + } + let parentCmdNames = ""; + for (let parentCmd = this.parent; parentCmd; parentCmd = parentCmd.parent) { + parentCmdNames = parentCmd.name() + " " + parentCmdNames; + } + const usage = [ + "Usage: " + parentCmdNames + cmdName + " " + this.usage(), + "" + ]; + let cmds = []; + const commandHelp = this.commandHelp(); + if (commandHelp) + cmds = [commandHelp]; + let options = []; + if (this._hasHelpOption || this.options.length > 0) { + options = [ + "Options:", + "" + this.optionHelp().replace(/^/gm, " "), + "" + ]; + } + return usage.concat(desc).concat(options).concat(cmds).join("\n"); + } + outputHelp(cb) { + if (!cb) { + cb = (passthru) => { + return passthru; + }; + } + const cbOutput = cb(this.helpInformation()); + if (typeof cbOutput !== "string" && !Buffer.isBuffer(cbOutput)) { + throw new Error("outputHelp callback must return a string or a Buffer"); + } + process.stdout.write(cbOutput); + this.emit(this._helpLongFlag); + } + helpOption(flags, description) { + if (typeof flags === "boolean") { + this._hasHelpOption = flags; + return this; + } + this._helpFlags = flags || this._helpFlags; + this._helpDescription = description || this._helpDescription; + const helpFlags = _parseOptionFlags(this._helpFlags); + this._helpShortFlag = helpFlags.shortFlag; + this._helpLongFlag = helpFlags.longFlag; + return this; + } + help(cb) { + this.outputHelp(cb); + this._exit(process.exitCode || 0, "commander.help", "(outputHelp)"); + } + _helpAndError() { + this.outputHelp(); + this._exit(1, "commander.help", "(outputHelp)"); + } + }; + exports2 = module2.exports = new Command(); + exports2.program = exports2; + exports2.Command = Command; + exports2.Option = Option; + exports2.CommanderError = CommanderError; + function camelcase(flag) { + return flag.split("-").reduce((str, word) => { + return str + word[0].toUpperCase() + word.slice(1); + }); + } + function pad(str, width) { + const len = Math.max(0, width - str.length); + return str + Array(len + 1).join(" "); + } + function wrap(str, width, indent) { + const regex = new RegExp(".{1," + (width - 1) + "}([\\s\u200B]|$)|[^\\s\u200B]+?([\\s\u200B]|$)", "g"); + const lines = str.match(regex) || []; + return lines.map((line, i) => { + if (line.slice(-1) === "\n") { + line = line.slice(0, line.length - 1); + } + return (i > 0 && indent ? Array(indent + 1).join(" ") : "") + line.trimRight(); + }).join("\n"); + } + function optionalWrap(str, width, indent) { + if (str.match(/[\n]\s+/)) + return str; + const minWidth = 40; + if (width < minWidth) + return str; + return wrap(str, width, indent); + } + function outputHelpIfRequested(cmd, args) { + const helpOption = cmd._hasHelpOption && args.find((arg) => arg === cmd._helpLongFlag || arg === cmd._helpShortFlag); + if (helpOption) { + cmd.outputHelp(); + cmd._exit(0, "commander.helpDisplayed", "(outputHelp)"); + } + } + function humanReadableArgName(arg) { + const nameOutput = arg.name + (arg.variadic === true ? "..." : ""); + return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]"; + } + function _parseOptionFlags(flags) { + let shortFlag; + let longFlag; + const flagParts = flags.split(/[ |,]+/); + if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1])) + shortFlag = flagParts.shift(); + longFlag = flagParts.shift(); + if (!shortFlag && /^-[^-]$/.test(longFlag)) { + shortFlag = longFlag; + longFlag = void 0; + } + return {shortFlag, longFlag}; + } + function incrementNodeInspectorPort(args) { + return args.map((arg) => { + if (!arg.startsWith("--inspect")) { + return arg; + } + let debugOption; + let debugHost = "127.0.0.1"; + let debugPort = "9229"; + let match; + if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) { + debugOption = match[1]; + } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) { + debugOption = match[1]; + if (/^\d+$/.test(match[3])) { + debugPort = match[3]; + } else { + debugHost = match[3]; + } + } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) { + debugOption = match[1]; + debugHost = match[3]; + debugPort = match[4]; + } + if (debugOption && debugPort !== "0") { + return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`; + } + return arg; + }); + } +}); + +// node_modules/is-base64/is-base64.js +var require_is_base64 = __commonJS((exports2, module2) => { + (function(root) { + "use strict"; + function isBase64(v, opts) { + if (v instanceof Boolean || typeof v === "boolean") { + return false; + } + if (!(opts instanceof Object)) { + opts = {}; + } + if (opts.allowEmpty === false && v === "") { + return false; + } + var regex = "(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+/]{3}=)?"; + var mimeRegex = "(data:\\w+\\/[a-zA-Z\\+\\-\\.]+;base64,)"; + if (opts.mimeRequired === true) { + regex = mimeRegex + regex; + } else if (opts.allowMime === true) { + regex = mimeRegex + "?" + regex; + } + if (opts.paddingRequired === false) { + regex = "(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}(==)?|[A-Za-z0-9+\\/]{3}=?)?"; + } + return new RegExp("^" + regex + "$", "gi").test(v); + } + if (typeof exports2 !== "undefined") { + if (typeof module2 !== "undefined" && module2.exports) { + exports2 = module2.exports = isBase64; + } + exports2.isBase64 = isBase64; + } else if (typeof define === "function" && define.amd) { + define([], function() { + return isBase64; + }); + } else { + root.isBase64 = isBase64; + } + })(exports2); +}); + +// node_modules/@probot/get-private-key/dist-node/index.js +var require_dist_node25 = __commonJS((exports2) => { + "use strict"; + Object.defineProperty(exports2, "__esModule", {value: true}); + function _interopDefault(ex) { + return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex; + } + var path = require("path"); + var fs = require("fs"); + var isBase64 = _interopDefault(require_is_base64()); + var VERSION = "0.0.0-development"; + function getPrivateKey(options = {}) { + const env = options.env || process.env; + const cwd = options.cwd || process.cwd(); + if (options.filepath) { + return fs.readFileSync(path.resolve(cwd, options.filepath), "utf-8"); + } + if (env.PRIVATE_KEY) { + let privateKey = env.PRIVATE_KEY; + if (isBase64(privateKey)) { + privateKey = Buffer.from(privateKey, "base64").toString(); + } + const begin = "-----BEGIN RSA PRIVATE KEY-----"; + const end = "-----END RSA PRIVATE KEY-----"; + if (privateKey.includes(begin) && privateKey.includes(end)) { + return privateKey.replace(/\\n/g, "\n"); + } + throw new Error(`[@probot/get-private-key] The contents of "env.PRIVATE_KEY" could not be validated. Please check to ensure you have copied the contents of the .pem file correctly.`); + } + if (env.PRIVATE_KEY_PATH) { + const filepath = path.resolve(cwd, env.PRIVATE_KEY_PATH); + if (fs.existsSync(filepath)) { + return fs.readFileSync(filepath, "utf-8"); + } else { + throw new Error(`[@probot/get-private-key] Private key does not exists at path: "${env.PRIVATE_KEY_PATH}". Please check to ensure that "env.PRIVATE_KEY_PATH" is correct.`); + } + } + const pemFiles = fs.readdirSync(cwd).filter((path2) => path2.endsWith(".pem")); + if (pemFiles.length > 1) { + const paths = pemFiles.join(", "); + throw new Error(`[@probot/get-private-key] More than one file found: "${paths}". Set { filepath } option or set one of the environment variables: PRIVATE_KEY, PRIVATE_KEY_PATH`); + } else if (pemFiles[0]) { + return getPrivateKey({ + filepath: pemFiles[0], + cwd + }); + } + return null; + } + getPrivateKey.VERSION = VERSION; + exports2.getPrivateKey = getPrivateKey; +}); + +// node_modules/probot/lib/bin/read-cli-options.js +var require_read_cli_options = __commonJS((exports2) => { + "use strict"; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : {default: mod}; + }; + Object.defineProperty(exports2, "__esModule", {value: true}); + exports2.readCliOptions = void 0; + var commander_1 = __importDefault(require_commander2()); + var get_private_key_1 = require_dist_node25(); + function readCliOptions(argv) { + commander_1.default.usage("[options]