UNPKG

@wordbricks/fetch-mcp

Version:

Model Context Protocol (MCP) server for fetching data from the web

1,599 lines (1,581 loc) 728 kB
#!/usr/bin/env node import { createRequire } from "node:module"; var __create = Object.create; var __getProtoOf = Object.getPrototypeOf; var __defProp = Object.defineProperty; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __toESM = (mod, isNodeMode, target) => { target = mod != null ? __create(__getProtoOf(mod)) : {}; const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target; for (let key of __getOwnPropNames(mod)) if (!__hasOwnProp.call(to, key)) __defProp(to, key, { get: () => mod[key], enumerable: true }); return to; }; var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports); var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true, configurable: true, set: (newValue) => all[name] = () => newValue }); }; var __require = /* @__PURE__ */ createRequire(import.meta.url); // node_modules/dotenv/package.json var require_package = __commonJS((exports, module) => { module.exports = { name: "dotenv", version: "17.0.1", description: "Loads environment variables from .env file", main: "lib/main.js", types: "lib/main.d.ts", exports: { ".": { types: "./lib/main.d.ts", require: "./lib/main.js", default: "./lib/main.js" }, "./config": "./config.js", "./config.js": "./config.js", "./lib/env-options": "./lib/env-options.js", "./lib/env-options.js": "./lib/env-options.js", "./lib/cli-options": "./lib/cli-options.js", "./lib/cli-options.js": "./lib/cli-options.js", "./package.json": "./package.json" }, scripts: { "dts-check": "tsc --project tests/types/tsconfig.json", lint: "standard", pretest: "npm run lint && npm run dts-check", test: "tap run --allow-empty-coverage --disable-coverage --timeout=60000", "test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov", prerelease: "npm test", release: "standard-version" }, repository: { type: "git", url: "git://github.com/motdotla/dotenv.git" }, homepage: "https://github.com/motdotla/dotenv#readme", funding: "https://dotenvx.com", keywords: [ "dotenv", "env", ".env", "environment", "variables", "config", "settings" ], readmeFilename: "README.md", license: "BSD-2-Clause", devDependencies: { "@types/node": "^18.11.3", decache: "^4.6.2", sinon: "^14.0.1", standard: "^17.0.0", "standard-version": "^9.5.0", tap: "^19.2.0", typescript: "^4.8.4" }, engines: { node: ">=12" }, browser: { fs: false } }; }); // node_modules/dotenv/lib/main.js var require_main = __commonJS((exports, module) => { var fs = __require("fs"); var path = __require("path"); var os = __require("os"); var crypto = __require("crypto"); var packageJson = require_package(); var version = packageJson.version; var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg; function parse(src) { const obj = {}; let lines = src.toString(); lines = lines.replace(/\r\n?/mg, ` `); let match; while ((match = LINE.exec(lines)) != null) { const key = match[1]; let value = match[2] || ""; value = value.trim(); const maybeQuote = value[0]; value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2"); if (maybeQuote === '"') { value = value.replace(/\\n/g, ` `); value = value.replace(/\\r/g, "\r"); } obj[key] = value; } return obj; } function _parseVault(options) { options = options || {}; const vaultPath = _vaultPath(options); options.path = vaultPath; const result = DotenvModule.configDotenv(options); if (!result.parsed) { const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`); err.code = "MISSING_DATA"; throw err; } const keys = _dotenvKey(options).split(","); const length = keys.length; let decrypted; for (let i = 0;i < length; i++) { try { const key = keys[i].trim(); const attrs = _instructions(result, key); decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key); break; } catch (error) { if (i + 1 >= length) { throw error; } } } return DotenvModule.parse(decrypted); } function _warn(message) { console.error(`[dotenv@${version}][WARN] ${message}`); } function _debug(message) { console.log(`[dotenv@${version}][DEBUG] ${message}`); } function _log(message) { console.log(`[dotenv@${version}] ${message}`); } function _dotenvKey(options) { if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) { return options.DOTENV_KEY; } if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) { return process.env.DOTENV_KEY; } return ""; } function _instructions(result, dotenvKey) { let uri; try { uri = new URL(dotenvKey); } catch (error) { if (error.code === "ERR_INVALID_URL") { const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development"); err.code = "INVALID_DOTENV_KEY"; throw err; } throw error; } const key = uri.password; if (!key) { const err = new Error("INVALID_DOTENV_KEY: Missing key part"); err.code = "INVALID_DOTENV_KEY"; throw err; } const environment = uri.searchParams.get("environment"); if (!environment) { const err = new Error("INVALID_DOTENV_KEY: Missing environment part"); err.code = "INVALID_DOTENV_KEY"; throw err; } const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`; const ciphertext = result.parsed[environmentKey]; if (!ciphertext) { const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`); err.code = "NOT_FOUND_DOTENV_ENVIRONMENT"; throw err; } return { ciphertext, key }; } function _vaultPath(options) { let possibleVaultPath = null; if (options && options.path && options.path.length > 0) { if (Array.isArray(options.path)) { for (const filepath of options.path) { if (fs.existsSync(filepath)) { possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`; } } } else { possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`; } } else { possibleVaultPath = path.resolve(process.cwd(), ".env.vault"); } if (fs.existsSync(possibleVaultPath)) { return possibleVaultPath; } return null; } function _resolveHome(envPath) { return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath; } function _configVault(options) { const debug = Boolean(options && options.debug); const quiet = Boolean(options && options.quiet); if (debug || !quiet) { _log("Loading env from encrypted .env.vault"); } const parsed = DotenvModule._parseVault(options); let processEnv = process.env; if (options && options.processEnv != null) { processEnv = options.processEnv; } DotenvModule.populate(processEnv, parsed, options); return { parsed }; } function configDotenv(options) { const dotenvPath = path.resolve(process.cwd(), ".env"); let encoding = "utf8"; const debug = Boolean(options && options.debug); const quiet = Boolean(options && options.quiet); if (options && options.encoding) { encoding = options.encoding; } else { if (debug) { _debug("No encoding is specified. UTF-8 is used by default"); } } let optionPaths = [dotenvPath]; if (options && options.path) { if (!Array.isArray(options.path)) { optionPaths = [_resolveHome(options.path)]; } else { optionPaths = []; for (const filepath of options.path) { optionPaths.push(_resolveHome(filepath)); } } } let lastError; const parsedAll = {}; for (const path2 of optionPaths) { try { const parsed = DotenvModule.parse(fs.readFileSync(path2, { encoding })); DotenvModule.populate(parsedAll, parsed, options); } catch (e) { if (debug) { _debug(`Failed to load ${path2} ${e.message}`); } lastError = e; } } let processEnv = process.env; if (options && options.processEnv != null) { processEnv = options.processEnv; } const populated = DotenvModule.populate(processEnv, parsedAll, options); if (debug || !quiet) { const keysCount = Object.keys(populated).length; const shortPaths = []; for (const filePath of optionPaths) { try { const relative = path.relative(process.cwd(), filePath); shortPaths.push(relative); } catch (e) { if (debug) { _debug(`Failed to load ${filePath} ${e.message}`); } lastError = e; } } _log(`injecting env (${keysCount}) from ${shortPaths.join(",")} – [tip] encrypt with dotenvx: https://dotenvx.com`); } if (lastError) { return { parsed: parsedAll, error: lastError }; } else { return { parsed: parsedAll }; } } function config(options) { if (_dotenvKey(options).length === 0) { return DotenvModule.configDotenv(options); } const vaultPath = _vaultPath(options); if (!vaultPath) { _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`); return DotenvModule.configDotenv(options); } return DotenvModule._configVault(options); } function decrypt(encrypted, keyStr) { const key = Buffer.from(keyStr.slice(-64), "hex"); let ciphertext = Buffer.from(encrypted, "base64"); const nonce = ciphertext.subarray(0, 12); const authTag = ciphertext.subarray(-16); ciphertext = ciphertext.subarray(12, -16); try { const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce); aesgcm.setAuthTag(authTag); return `${aesgcm.update(ciphertext)}${aesgcm.final()}`; } catch (error) { const isRange = error instanceof RangeError; const invalidKeyLength = error.message === "Invalid key length"; const decryptionFailed = error.message === "Unsupported state or unable to authenticate data"; if (isRange || invalidKeyLength) { const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)"); err.code = "INVALID_DOTENV_KEY"; throw err; } else if (decryptionFailed) { const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY"); err.code = "DECRYPTION_FAILED"; throw err; } else { throw error; } } } function populate(processEnv, parsed, options = {}) { const debug = Boolean(options && options.debug); const override = Boolean(options && options.override); const populated = {}; if (typeof parsed !== "object") { const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate"); err.code = "OBJECT_REQUIRED"; throw err; } for (const key of Object.keys(parsed)) { if (Object.prototype.hasOwnProperty.call(processEnv, key)) { if (override === true) { processEnv[key] = parsed[key]; populated[key] = parsed[key]; } if (debug) { if (override === true) { _debug(`"${key}" is already defined and WAS overwritten`); } else { _debug(`"${key}" is already defined and was NOT overwritten`); } } } else { processEnv[key] = parsed[key]; populated[key] = parsed[key]; } } return populated; } var DotenvModule = { configDotenv, _configVault, _parseVault, config, decrypt, parse, populate }; exports.configDotenv = DotenvModule.configDotenv; exports._configVault = DotenvModule._configVault; exports._parseVault = DotenvModule._parseVault; exports.config = DotenvModule.config; exports.decrypt = DotenvModule.decrypt; exports.parse = DotenvModule.parse; exports.populate = DotenvModule.populate; module.exports = DotenvModule; }); // node_modules/dotenv/lib/env-options.js var require_env_options = __commonJS((exports, module) => { var options = {}; if (process.env.DOTENV_CONFIG_ENCODING != null) { options.encoding = process.env.DOTENV_CONFIG_ENCODING; } if (process.env.DOTENV_CONFIG_PATH != null) { options.path = process.env.DOTENV_CONFIG_PATH; } if (process.env.DOTENV_CONFIG_QUIET != null) { options.quiet = process.env.DOTENV_CONFIG_QUIET; } if (process.env.DOTENV_CONFIG_DEBUG != null) { options.debug = process.env.DOTENV_CONFIG_DEBUG; } if (process.env.DOTENV_CONFIG_OVERRIDE != null) { options.override = process.env.DOTENV_CONFIG_OVERRIDE; } if (process.env.DOTENV_CONFIG_DOTENV_KEY != null) { options.DOTENV_KEY = process.env.DOTENV_CONFIG_DOTENV_KEY; } module.exports = options; }); // node_modules/dotenv/lib/cli-options.js var require_cli_options = __commonJS((exports, module) => { var re = /^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/; module.exports = function optionMatcher(args) { const options = args.reduce(function(acc, cur) { const matches = cur.match(re); if (matches) { acc[matches[1]] = matches[2]; } return acc; }, {}); if (!("quiet" in options)) { options.quiet = "true"; } return options; }; }); // node_modules/dotenv/config.js var require_config = __commonJS(() => { (function() { require_main().config(Object.assign({}, require_env_options(), require_cli_options()(process.argv))); })(); }); // node_modules/bytes/index.js var require_bytes = __commonJS((exports, module) => { /*! * bytes * Copyright(c) 2012-2014 TJ Holowaychuk * Copyright(c) 2015 Jed Watson * MIT Licensed */ module.exports = bytes; module.exports.format = format; module.exports.parse = parse; var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g; var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/; var map2 = { b: 1, kb: 1 << 10, mb: 1 << 20, gb: 1 << 30, tb: Math.pow(1024, 4), pb: Math.pow(1024, 5) }; var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i; function bytes(value, options) { if (typeof value === "string") { return parse(value); } if (typeof value === "number") { return format(value, options); } return null; } function format(value, options) { if (!Number.isFinite(value)) { return null; } var mag = Math.abs(value); var thousandsSeparator = options && options.thousandsSeparator || ""; var unitSeparator = options && options.unitSeparator || ""; var decimalPlaces = options && options.decimalPlaces !== undefined ? options.decimalPlaces : 2; var fixedDecimals = Boolean(options && options.fixedDecimals); var unit = options && options.unit || ""; if (!unit || !map2[unit.toLowerCase()]) { if (mag >= map2.pb) { unit = "PB"; } else if (mag >= map2.tb) { unit = "TB"; } else if (mag >= map2.gb) { unit = "GB"; } else if (mag >= map2.mb) { unit = "MB"; } else if (mag >= map2.kb) { unit = "KB"; } else { unit = "B"; } } var val = value / map2[unit.toLowerCase()]; var str = val.toFixed(decimalPlaces); if (!fixedDecimals) { str = str.replace(formatDecimalsRegExp, "$1"); } if (thousandsSeparator) { str = str.split(".").map(function(s, i) { return i === 0 ? s.replace(formatThousandsRegExp, thousandsSeparator) : s; }).join("."); } return str + unitSeparator + unit; } function parse(val) { if (typeof val === "number" && !isNaN(val)) { return val; } if (typeof val !== "string") { return null; } var results = parseRegExp.exec(val); var floatValue; var unit = "b"; if (!results) { floatValue = parseInt(val, 10); unit = "b"; } else { floatValue = parseFloat(results[1]); unit = results[4].toLowerCase(); } if (isNaN(floatValue)) { return null; } return Math.floor(map2[unit] * floatValue); } }); // node_modules/depd/index.js var require_depd = __commonJS((exports, module) => { /*! * depd * Copyright(c) 2014-2018 Douglas Christopher Wilson * MIT Licensed */ var relative = __require("path").relative; module.exports = depd; var basePath = process.cwd(); function containsNamespace(str, namespace) { var vals = str.split(/[ ,]+/); var ns = String(namespace).toLowerCase(); for (var i = 0;i < vals.length; i++) { var val = vals[i]; if (val && (val === "*" || val.toLowerCase() === ns)) { return true; } } return false; } function convertDataDescriptorToAccessor(obj, prop, message) { var descriptor = Object.getOwnPropertyDescriptor(obj, prop); var value = descriptor.value; descriptor.get = function getter() { return value; }; if (descriptor.writable) { descriptor.set = function setter(val) { return value = val; }; } delete descriptor.value; delete descriptor.writable; Object.defineProperty(obj, prop, descriptor); return descriptor; } function createArgumentsString(arity) { var str = ""; for (var i = 0;i < arity; i++) { str += ", arg" + i; } return str.substr(2); } function createStackString(stack) { var str = this.name + ": " + this.namespace; if (this.message) { str += " deprecated " + this.message; } for (var i = 0;i < stack.length; i++) { str += ` at ` + stack[i].toString(); } return str; } function depd(namespace) { if (!namespace) { throw new TypeError("argument namespace is required"); } var stack = getStack(); var site = callSiteLocation(stack[1]); var file = site[0]; function deprecate(message) { log.call(deprecate, message); } deprecate._file = file; deprecate._ignored = isignored(namespace); deprecate._namespace = namespace; deprecate._traced = istraced(namespace); deprecate._warned = Object.create(null); deprecate.function = wrapfunction; deprecate.property = wrapproperty; return deprecate; } function eehaslisteners(emitter, type) { var count = typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type); return count > 0; } function isignored(namespace) { if (process.noDeprecation) { return true; } var str = process.env.NO_DEPRECATION || ""; return containsNamespace(str, namespace); } function istraced(namespace) { if (process.traceDeprecation) { return true; } var str = process.env.TRACE_DEPRECATION || ""; return containsNamespace(str, namespace); } function log(message, site) { var haslisteners = eehaslisteners(process, "deprecation"); if (!haslisteners && this._ignored) { return; } var caller; var callFile; var callSite; var depSite; var i = 0; var seen = false; var stack = getStack(); var file = this._file; if (site) { depSite = site; callSite = callSiteLocation(stack[1]); callSite.name = depSite.name; file = callSite[0]; } else { i = 2; depSite = callSiteLocation(stack[i]); callSite = depSite; } for (;i < stack.length; i++) { caller = callSiteLocation(stack[i]); callFile = caller[0]; if (callFile === file) { seen = true; } else if (callFile === this._file) { file = this._file; } else if (seen) { break; } } var key = caller ? depSite.join(":") + "__" + caller.join(":") : undefined; if (key !== undefined && key in this._warned) { return; } this._warned[key] = true; var msg = message; if (!msg) { msg = callSite === depSite || !callSite.name ? defaultMessage(depSite) : defaultMessage(callSite); } if (haslisteners) { var err = DeprecationError(this._namespace, msg, stack.slice(i)); process.emit("deprecation", err); return; } var format = process.stderr.isTTY ? formatColor : formatPlain; var output = format.call(this, msg, caller, stack.slice(i)); process.stderr.write(output + ` `, "utf8"); } function callSiteLocation(callSite) { var file = callSite.getFileName() || "<anonymous>"; var line = callSite.getLineNumber(); var colm = callSite.getColumnNumber(); if (callSite.isEval()) { file = callSite.getEvalOrigin() + ", " + file; } var site = [file, line, colm]; site.callSite = callSite; site.name = callSite.getFunctionName(); return site; } function defaultMessage(site) { var callSite = site.callSite; var funcName = site.name; if (!funcName) { funcName = "<anonymous@" + formatLocation(site) + ">"; } var context = callSite.getThis(); var typeName = context && callSite.getTypeName(); if (typeName === "Object") { typeName = undefined; } if (typeName === "Function") { typeName = context.name || typeName; } return typeName && callSite.getMethodName() ? typeName + "." + funcName : funcName; } function formatPlain(msg, caller, stack) { var timestamp = new Date().toUTCString(); var formatted = timestamp + " " + this._namespace + " deprecated " + msg; if (this._traced) { for (var i = 0;i < stack.length; i++) { formatted += ` at ` + stack[i].toString(); } return formatted; } if (caller) { formatted += " at " + formatLocation(caller); } return formatted; } function formatColor(msg, caller, stack) { var formatted = "\x1B[36;1m" + this._namespace + "\x1B[22;39m" + " \x1B[33;1mdeprecated\x1B[22;39m" + " \x1B[0m" + msg + "\x1B[39m"; if (this._traced) { for (var i = 0;i < stack.length; i++) { formatted += ` \x1B[36mat ` + stack[i].toString() + "\x1B[39m"; } return formatted; } if (caller) { formatted += " \x1B[36m" + formatLocation(caller) + "\x1B[39m"; } return formatted; } function formatLocation(callSite) { return relative(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2]; } function getStack() { var limit = Error.stackTraceLimit; var obj = {}; var prep = Error.prepareStackTrace; Error.prepareStackTrace = prepareObjectStackTrace; Error.stackTraceLimit = Math.max(10, limit); Error.captureStackTrace(obj); var stack = obj.stack.slice(1); Error.prepareStackTrace = prep; Error.stackTraceLimit = limit; return stack; } function prepareObjectStackTrace(obj, stack) { return stack; } function wrapfunction(fn, message) { if (typeof fn !== "function") { throw new TypeError("argument fn must be a function"); } var args = createArgumentsString(fn.length); var stack = getStack(); var site = callSiteLocation(stack[1]); site.name = fn.name; var deprecatedfn = new Function("fn", "log", "deprecate", "message", "site", `"use strict" ` + "return function (" + args + ") {" + `log.call(deprecate, message, site) ` + `return fn.apply(this, arguments) ` + "}")(fn, log, this, message, site); return deprecatedfn; } function wrapproperty(obj, prop, message) { if (!obj || typeof obj !== "object" && typeof obj !== "function") { throw new TypeError("argument obj must be object"); } var descriptor = Object.getOwnPropertyDescriptor(obj, prop); if (!descriptor) { throw new TypeError("must call property on owner object"); } if (!descriptor.configurable) { throw new TypeError("property must be configurable"); } var deprecate = this; var stack = getStack(); var site = callSiteLocation(stack[1]); site.name = prop; if ("value" in descriptor) { descriptor = convertDataDescriptorToAccessor(obj, prop, message); } var get = descriptor.get; var set2 = descriptor.set; if (typeof get === "function") { descriptor.get = function getter() { log.call(deprecate, message, site); return get.apply(this, arguments); }; } if (typeof set2 === "function") { descriptor.set = function setter() { log.call(deprecate, message, site); return set2.apply(this, arguments); }; } Object.defineProperty(obj, prop, descriptor); } function DeprecationError(namespace, message, stack) { var error = new Error; var stackString; Object.defineProperty(error, "constructor", { value: DeprecationError }); Object.defineProperty(error, "message", { configurable: true, enumerable: false, value: message, writable: true }); Object.defineProperty(error, "name", { enumerable: false, configurable: true, value: "DeprecationError", writable: true }); Object.defineProperty(error, "namespace", { configurable: true, enumerable: false, value: namespace, writable: true }); Object.defineProperty(error, "stack", { configurable: true, enumerable: false, get: function() { if (stackString !== undefined) { return stackString; } return stackString = createStackString.call(this, stack); }, set: function setter(val) { stackString = val; } }); return error; } }); // node_modules/setprototypeof/index.js var require_setprototypeof = __commonJS((exports, module) => { module.exports = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties); function setProtoOf(obj, proto) { obj.__proto__ = proto; return obj; } function mixinProperties(obj, proto) { for (var prop in proto) { if (!Object.prototype.hasOwnProperty.call(obj, prop)) { obj[prop] = proto[prop]; } } return obj; } }); // node_modules/statuses/codes.json var require_codes = __commonJS((exports, module) => { module.exports = { "100": "Continue", "101": "Switching Protocols", "102": "Processing", "103": "Early Hints", "200": "OK", "201": "Created", "202": "Accepted", "203": "Non-Authoritative Information", "204": "No Content", "205": "Reset Content", "206": "Partial Content", "207": "Multi-Status", "208": "Already Reported", "226": "IM Used", "300": "Multiple Choices", "301": "Moved Permanently", "302": "Found", "303": "See Other", "304": "Not Modified", "305": "Use Proxy", "307": "Temporary Redirect", "308": "Permanent Redirect", "400": "Bad Request", "401": "Unauthorized", "402": "Payment Required", "403": "Forbidden", "404": "Not Found", "405": "Method Not Allowed", "406": "Not Acceptable", "407": "Proxy Authentication Required", "408": "Request Timeout", "409": "Conflict", "410": "Gone", "411": "Length Required", "412": "Precondition Failed", "413": "Payload Too Large", "414": "URI Too Long", "415": "Unsupported Media Type", "416": "Range Not Satisfiable", "417": "Expectation Failed", "418": "I'm a Teapot", "421": "Misdirected Request", "422": "Unprocessable Entity", "423": "Locked", "424": "Failed Dependency", "425": "Too Early", "426": "Upgrade Required", "428": "Precondition Required", "429": "Too Many Requests", "431": "Request Header Fields Too Large", "451": "Unavailable For Legal Reasons", "500": "Internal Server Error", "501": "Not Implemented", "502": "Bad Gateway", "503": "Service Unavailable", "504": "Gateway Timeout", "505": "HTTP Version Not Supported", "506": "Variant Also Negotiates", "507": "Insufficient Storage", "508": "Loop Detected", "509": "Bandwidth Limit Exceeded", "510": "Not Extended", "511": "Network Authentication Required" }; }); // node_modules/statuses/index.js var require_statuses = __commonJS((exports, module) => { /*! * statuses * Copyright(c) 2014 Jonathan Ong * Copyright(c) 2016 Douglas Christopher Wilson * MIT Licensed */ var codes = require_codes(); module.exports = status; status.message = codes; status.code = createMessageToStatusCodeMap(codes); status.codes = createStatusCodeList(codes); status.redirect = { 300: true, 301: true, 302: true, 303: true, 305: true, 307: true, 308: true }; status.empty = { 204: true, 205: true, 304: true }; status.retry = { 502: true, 503: true, 504: true }; function createMessageToStatusCodeMap(codes2) { var map2 = {}; Object.keys(codes2).forEach(function forEachCode(code) { var message = codes2[code]; var status2 = Number(code); map2[message.toLowerCase()] = status2; }); return map2; } function createStatusCodeList(codes2) { return Object.keys(codes2).map(function mapCode(code) { return Number(code); }); } function getStatusCode(message) { var msg = message.toLowerCase(); if (!Object.prototype.hasOwnProperty.call(status.code, msg)) { throw new Error('invalid status message: "' + message + '"'); } return status.code[msg]; } function getStatusMessage(code) { if (!Object.prototype.hasOwnProperty.call(status.message, code)) { throw new Error("invalid status code: " + code); } return status.message[code]; } function status(code) { if (typeof code === "number") { return getStatusMessage(code); } if (typeof code !== "string") { throw new TypeError("code must be a number or string"); } var n = parseInt(code, 10); if (!isNaN(n)) { return getStatusMessage(n); } return getStatusCode(code); } }); // node_modules/inherits/inherits_browser.js var require_inherits_browser = __commonJS((exports, module) => { if (typeof Object.create === "function") { module.exports = function inherits(ctor, superCtor) { if (superCtor) { ctor.super_ = superCtor; ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } }); } }; } else { module.exports = function inherits(ctor, superCtor) { if (superCtor) { ctor.super_ = superCtor; var TempCtor = function() {}; TempCtor.prototype = superCtor.prototype; ctor.prototype = new TempCtor; ctor.prototype.constructor = ctor; } }; } }); // node_modules/inherits/inherits.js var require_inherits = __commonJS((exports, module) => { try { util3 = __require("util"); if (typeof util3.inherits !== "function") throw ""; module.exports = util3.inherits; } catch (e) { module.exports = require_inherits_browser(); } var util3; }); // node_modules/toidentifier/index.js var require_toidentifier = __commonJS((exports, module) => { /*! * toidentifier * Copyright(c) 2016 Douglas Christopher Wilson * MIT Licensed */ module.exports = toIdentifier; function toIdentifier(str) { return str.split(" ").map(function(token) { return token.slice(0, 1).toUpperCase() + token.slice(1); }).join("").replace(/[^ _0-9a-z]/gi, ""); } }); // node_modules/http-errors/index.js var require_http_errors = __commonJS((exports, module) => { /*! * http-errors * Copyright(c) 2014 Jonathan Ong * Copyright(c) 2016 Douglas Christopher Wilson * MIT Licensed */ var deprecate = require_depd()("http-errors"); var setPrototypeOf = require_setprototypeof(); var statuses = require_statuses(); var inherits = require_inherits(); var toIdentifier = require_toidentifier(); module.exports = createError; module.exports.HttpError = createHttpErrorConstructor(); module.exports.isHttpError = createIsHttpErrorFunction(module.exports.HttpError); populateConstructorExports(module.exports, statuses.codes, module.exports.HttpError); function codeClass(status) { return Number(String(status).charAt(0) + "00"); } function createError() { var err; var msg; var status = 500; var props = {}; for (var i = 0;i < arguments.length; i++) { var arg = arguments[i]; var type = typeof arg; if (type === "object" && arg instanceof Error) { err = arg; status = err.status || err.statusCode || status; } else if (type === "number" && i === 0) { status = arg; } else if (type === "string") { msg = arg; } else if (type === "object") { props = arg; } else { throw new TypeError("argument #" + (i + 1) + " unsupported type " + type); } } if (typeof status === "number" && (status < 400 || status >= 600)) { deprecate("non-error status code; use only 4xx or 5xx status codes"); } if (typeof status !== "number" || !statuses.message[status] && (status < 400 || status >= 600)) { status = 500; } var HttpError = createError[status] || createError[codeClass(status)]; if (!err) { err = HttpError ? new HttpError(msg) : new Error(msg || statuses.message[status]); Error.captureStackTrace(err, createError); } if (!HttpError || !(err instanceof HttpError) || err.status !== status) { err.expose = status < 500; err.status = err.statusCode = status; } for (var key in props) { if (key !== "status" && key !== "statusCode") { err[key] = props[key]; } } return err; } function createHttpErrorConstructor() { function HttpError() { throw new TypeError("cannot construct abstract class"); } inherits(HttpError, Error); return HttpError; } function createClientErrorConstructor(HttpError, name, code) { var className = toClassName(name); function ClientError(message) { var msg = message != null ? message : statuses.message[code]; var err = new Error(msg); Error.captureStackTrace(err, ClientError); setPrototypeOf(err, ClientError.prototype); Object.defineProperty(err, "message", { enumerable: true, configurable: true, value: msg, writable: true }); Object.defineProperty(err, "name", { enumerable: false, configurable: true, value: className, writable: true }); return err; } inherits(ClientError, HttpError); nameFunc(ClientError, className); ClientError.prototype.status = code; ClientError.prototype.statusCode = code; ClientError.prototype.expose = true; return ClientError; } function createIsHttpErrorFunction(HttpError) { return function isHttpError(val) { if (!val || typeof val !== "object") { return false; } if (val instanceof HttpError) { return true; } return val instanceof Error && typeof val.expose === "boolean" && typeof val.statusCode === "number" && val.status === val.statusCode; }; } function createServerErrorConstructor(HttpError, name, code) { var className = toClassName(name); function ServerError(message) { var msg = message != null ? message : statuses.message[code]; var err = new Error(msg); Error.captureStackTrace(err, ServerError); setPrototypeOf(err, ServerError.prototype); Object.defineProperty(err, "message", { enumerable: true, configurable: true, value: msg, writable: true }); Object.defineProperty(err, "name", { enumerable: false, configurable: true, value: className, writable: true }); return err; } inherits(ServerError, HttpError); nameFunc(ServerError, className); ServerError.prototype.status = code; ServerError.prototype.statusCode = code; ServerError.prototype.expose = false; return ServerError; } function nameFunc(func, name) { var desc = Object.getOwnPropertyDescriptor(func, "name"); if (desc && desc.configurable) { desc.value = name; Object.defineProperty(func, "name", desc); } } function populateConstructorExports(exports2, codes, HttpError) { codes.forEach(function forEachCode(code) { var CodeError; var name = toIdentifier(statuses.message[code]); switch (codeClass(code)) { case 400: CodeError = createClientErrorConstructor(HttpError, name, code); break; case 500: CodeError = createServerErrorConstructor(HttpError, name, code); break; } if (CodeError) { exports2[code] = CodeError; exports2[name] = CodeError; } }); } function toClassName(name) { return name.substr(-5) !== "Error" ? name + "Error" : name; } }); // node_modules/safer-buffer/safer.js var require_safer = __commonJS((exports, module) => { var buffer = __require("buffer"); var Buffer2 = buffer.Buffer; var safer = {}; var key; for (key in buffer) { if (!buffer.hasOwnProperty(key)) continue; if (key === "SlowBuffer" || key === "Buffer") continue; safer[key] = buffer[key]; } var Safer = safer.Buffer = {}; for (key in Buffer2) { if (!Buffer2.hasOwnProperty(key)) continue; if (key === "allocUnsafe" || key === "allocUnsafeSlow") continue; Safer[key] = Buffer2[key]; } safer.Buffer.prototype = Buffer2.prototype; if (!Safer.from || Safer.from === Uint8Array.from) { Safer.from = function(value, encodingOrOffset, length) { if (typeof value === "number") { throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value); } if (value && typeof value.length === "undefined") { throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); } return Buffer2(value, encodingOrOffset, length); }; } if (!Safer.alloc) { Safer.alloc = function(size, fill, encoding) { if (typeof size !== "number") { throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size); } if (size < 0 || size >= 2 * (1 << 30)) { throw new RangeError('The value "' + size + '" is invalid for option "size"'); } var buf = Buffer2(size); if (!fill || fill.length === 0) { buf.fill(0); } else if (typeof encoding === "string") { buf.fill(fill, encoding); } else { buf.fill(fill); } return buf; }; } if (!safer.kStringMaxLength) { try { safer.kStringMaxLength = process.binding("buffer").kStringMaxLength; } catch (e) {} } if (!safer.constants) { safer.constants = { MAX_LENGTH: safer.kMaxLength }; if (safer.kStringMaxLength) { safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength; } } module.exports = safer; }); // node_modules/iconv-lite/lib/bom-handling.js var require_bom_handling = __commonJS((exports) => { var BOMChar = "\uFEFF"; exports.PrependBOM = PrependBOMWrapper; function PrependBOMWrapper(encoder, options) { this.encoder = encoder; this.addBOM = true; } PrependBOMWrapper.prototype.write = function(str) { if (this.addBOM) { str = BOMChar + str; this.addBOM = false; } return this.encoder.write(str); }; PrependBOMWrapper.prototype.end = function() { return this.encoder.end(); }; exports.StripBOM = StripBOMWrapper; function StripBOMWrapper(decoder, options) { this.decoder = decoder; this.pass = false; this.options = options || {}; } StripBOMWrapper.prototype.write = function(buf) { var res = this.decoder.write(buf); if (this.pass || !res) return res; if (res[0] === BOMChar) { res = res.slice(1); if (typeof this.options.stripBOM === "function") this.options.stripBOM(); } this.pass = true; return res; }; StripBOMWrapper.prototype.end = function() { return this.decoder.end(); }; }); // node_modules/iconv-lite/encodings/internal.js var require_internal = __commonJS((exports, module) => { var Buffer2 = require_safer().Buffer; module.exports = { utf8: { type: "_internal", bomAware: true }, cesu8: { type: "_internal", bomAware: true }, unicode11utf8: "utf8", ucs2: { type: "_internal", bomAware: true }, utf16le: "ucs2", binary: { type: "_internal" }, base64: { type: "_internal" }, hex: { type: "_internal" }, _internal: InternalCodec }; function InternalCodec(codecOptions, iconv) { this.enc = codecOptions.encodingName; this.bomAware = codecOptions.bomAware; if (this.enc === "base64") this.encoder = InternalEncoderBase64; else if (this.enc === "cesu8") { this.enc = "utf8"; this.encoder = InternalEncoderCesu8; if (Buffer2.from("eda0bdedb2a9", "hex").toString() !== "\uD83D\uDCA9") { this.decoder = InternalDecoderCesu8; this.defaultCharUnicode = iconv.defaultCharUnicode; } } } InternalCodec.prototype.encoder = InternalEncoder; InternalCodec.prototype.decoder = InternalDecoder; var StringDecoder = __require("string_decoder").StringDecoder; if (!StringDecoder.prototype.end) StringDecoder.prototype.end = function() {}; function InternalDecoder(options, codec) { this.decoder = new StringDecoder(codec.enc); } InternalDecoder.prototype.write = function(buf) { if (!Buffer2.isBuffer(buf)) { buf = Buffer2.from(buf); } return this.decoder.write(buf); }; InternalDecoder.prototype.end = function() { return this.decoder.end(); }; function InternalEncoder(options, codec) { this.enc = codec.enc; } InternalEncoder.prototype.write = function(str) { return Buffer2.from(str, this.enc); }; InternalEncoder.prototype.end = function() {}; function InternalEncoderBase64(options, codec) { this.prevStr = ""; } InternalEncoderBase64.prototype.write = function(str) { str = this.prevStr + str; var completeQuads = str.length - str.length % 4; this.prevStr = str.slice(completeQuads); str = str.slice(0, completeQuads); return Buffer2.from(str, "base64"); }; InternalEncoderBase64.prototype.end = function() { return Buffer2.from(this.prevStr, "base64"); }; function InternalEncoderCesu8(options, codec) {} InternalEncoderCesu8.prototype.write = function(str) { var buf = Buffer2.alloc(str.length * 3), bufIdx = 0; for (var i = 0;i < str.length; i++) { var charCode = str.charCodeAt(i); if (charCode < 128) buf[bufIdx++] = charCode; else if (charCode < 2048) { buf[bufIdx++] = 192 + (charCode >>> 6); buf[bufIdx++] = 128 + (charCode & 63); } else { buf[bufIdx++] = 224 + (charCode >>> 12); buf[bufIdx++] = 128 + (charCode >>> 6 & 63); buf[bufIdx++] = 128 + (charCode & 63); } } return buf.slice(0, bufIdx); }; InternalEncoderCesu8.prototype.end = function() {}; function InternalDecoderCesu8(options, codec) { this.acc = 0; this.contBytes = 0; this.accBytes = 0; this.defaultCharUnicode = codec.defaultCharUnicode; } InternalDecoderCesu8.prototype.write = function(buf) { var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes, res = ""; for (var i = 0;i < buf.length; i++) { var curByte = buf[i]; if ((curByte & 192) !== 128) { if (contBytes > 0) { res += this.defaultCharUnicode; contBytes = 0; } if (curByte < 128) { res += String.fromCharCode(curByte); } else if (curByte < 224) { acc = curByte & 31; contBytes = 1; accBytes = 1; } else if (curByte < 240) { acc = curByte & 15; contBytes = 2; accBytes = 1; } else { res += this.defaultCharUnicode; } } else { if (contBytes > 0) { acc = acc << 6 | curByte & 63; contBytes--; accBytes++; if (contBytes === 0) { if (accBytes === 2 && acc < 128 && acc > 0) res += this.defaultCharUnicode; else if (accBytes === 3 && acc < 2048) res += this.defaultCharUnicode; else res += String.fromCharCode(acc); } } else { res += this.defaultCharUnicode; } } } this.acc = acc; this.contBytes = contBytes; this.accBytes = accBytes; return res; }; InternalDecoderCesu8.prototype.end = function() { var res = 0; if (this.contBytes > 0) res += this.defaultCharUnicode; return res; }; }); // node_modules/iconv-lite/encodings/utf32.js var require_utf32 = __commonJS((exports) => { var Buffer2 = require_safer().Buffer; exports._utf32 = Utf32Codec; function Utf32Codec(codecOptions, iconv) { this.iconv = iconv; this.bomAware = true; this.isLE = codecOptions.isLE; } exports.utf32le = { type: "_utf32", isLE: true }; exports.utf32be = { type: "_utf32", isLE: false }; exports.ucs4le = "utf32le"; exports.ucs4be = "utf32be"; Utf32Codec.prototype.encoder = Utf32Encoder; Utf32Codec.prototype.decoder = Utf32Decoder; function Utf32Encoder(options, codec) { this.isLE = codec.isLE; this.highSurrogate = 0; } Utf32Encoder.prototype.write = function(str) { var src = Buffer2.from(str, "ucs2"); var dst = Buffer2.alloc(src.length * 2); var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE; var offset = 0; for (var i = 0;i < src.length; i += 2) { var code = src.readUInt16LE(i); var isHighSurrogate = 55296 <= code && code < 56320; var isLowSurrogate = 56320 <= code && code < 57344; if (this.highSurrogate) { if (isHighSurrogate || !isLowSurrogate) { write32.call(dst, this.highSurrogate, offset); offset += 4; } else { var codepoint = (this.highSurrogate - 55296 << 10 | code - 56320) + 65536; write32.call(dst, codepoint, offset); offset += 4; this.highSurrogate = 0; continue; } } if (isHighSurrogate) this.highSurrogate = code; else { write32.call(dst, code, offset); offset += 4; this.highSurrogate = 0; } } if (offset < dst.length) dst = dst.slice(0, offset); return dst; }; Utf32Encoder.prototype.end = function() { if (!this.highSurrogate) return; var buf = Buffer2.alloc(4); if (this.isLE) buf.writeUInt32LE(this.highSurrogate, 0); else buf.writeUInt32BE(this.highSurrogate, 0); this.highSurrogate = 0; return buf; }; function Utf32Decoder(options, codec) { this.isLE = codec.isLE; this.badChar = codec.iconv.defaultCharUnicode.charCodeAt(0); this.overflow = []; } Utf32Decoder.prototype.write = function(src) { if (src.length === 0) return ""; var i = 0; var codepoint = 0; var dst = Buffer2.alloc(src.length + 4); var offset = 0; var isLE = this.isLE; var overflow = this.overflow; var badChar = this.badChar; if (overflow.length > 0) { for (;i < src.length && overflow.length < 4; i++) overflow.push(src[i]); if (overflow.length === 4) { if (isLE) { codepoint = overflow[i] | overflow[i + 1] << 8 | overflow[i + 2] << 16 | overflow[i + 3] << 24; } else { codepoint = overflow[i + 3] | overflow[i + 2] << 8 | overflow[i + 1] << 16 | overflow[i] << 24; } overflow.length = 0; offset = _writeCodepoint(dst, offset, codepoint, badChar); } } for (;i < src.length - 3; i += 4) { if (isLE) { codepoint = src[i] | src[i + 1] << 8 | src[i + 2] << 16 | src[i + 3] << 24; } else { codepoint = src[i + 3] | src[i + 2] << 8 | src[i + 1] << 16 | src[i] << 24; } offset = _writeCodepoint(dst, offset, codepoint, badChar); } for (;i < src.length; i++) { overflow.push(src[i]); } return dst.slice(0, offset).toString("ucs2"); }; function _writeCodepoint(dst, offset, codepoint, badChar) { if (codepoint < 0 || codepoint > 1114111) { codepoint = badChar; } if (codepoint >= 65536) { codepoint -= 65536; var high = 55296 | codepoint >> 10; dst[offset++] = high & 255; dst[offset++] = high >> 8; var codepoint = 56320 | codepoint & 1023; } dst[offset++] = codepoint & 255; dst[offset++] = codepoint >> 8; return offset; } Utf32Decoder.prototype.end = function() { this.overflow.length = 0; }; expo