UNPKG

@bratel/coc-black-formatter

Version:

microsoft/vscode-black-formatter’s langauge server extension for coc.nvim.

1,575 lines (1,555 loc) • 2.18 MB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __esm = (fn, res) => function __init() { return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; }; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // node_modules/isexe/dist/cjs/posix.js var require_posix = __commonJS({ "node_modules/isexe/dist/cjs/posix.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.sync = exports2.isexe = void 0; var fs_1 = require("fs"); var promises_1 = require("fs/promises"); var isexe = async (path5, options = {}) => { const { ignoreErrors = false } = options; try { return checkStat(await (0, promises_1.stat)(path5), options); } catch (e) { const er = e; if (ignoreErrors || er.code === "EACCES") return false; throw er; } }; exports2.isexe = isexe; var sync2 = (path5, options = {}) => { const { ignoreErrors = false } = options; try { return checkStat((0, fs_1.statSync)(path5), options); } catch (e) { const er = e; if (ignoreErrors || er.code === "EACCES") return false; throw er; } }; exports2.sync = sync2; var checkStat = (stat2, options) => stat2.isFile() && checkMode(stat2, options); var checkMode = (stat2, options) => { var _a2, _b, _c; const myUid = options.uid ?? ((_a2 = process.getuid) == null ? void 0 : _a2.call(process)); const myGroups = options.groups ?? ((_b = process.getgroups) == null ? void 0 : _b.call(process)) ?? []; const myGid = options.gid ?? ((_c = process.getgid) == null ? void 0 : _c.call(process)) ?? myGroups[0]; if (myUid === void 0 || myGid === void 0) { throw new Error("cannot get uid or gid"); } const groups = /* @__PURE__ */ new Set([myGid, ...myGroups]); const mod = stat2.mode; const uid = stat2.uid; const gid = stat2.gid; const u = parseInt("100", 8); const g = parseInt("010", 8); const o = parseInt("001", 8); const ug = u | g; return !!(mod & o || mod & g && groups.has(gid) || mod & u && uid === myUid || mod & ug && myUid === 0); }; } }); // node_modules/isexe/dist/cjs/win32.js var require_win32 = __commonJS({ "node_modules/isexe/dist/cjs/win32.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.sync = exports2.isexe = void 0; var fs_1 = require("fs"); var promises_1 = require("fs/promises"); var isexe = async (path5, options = {}) => { const { ignoreErrors = false } = options; try { return checkStat(await (0, promises_1.stat)(path5), path5, options); } catch (e) { const er = e; if (ignoreErrors || er.code === "EACCES") return false; throw er; } }; exports2.isexe = isexe; var sync2 = (path5, options = {}) => { const { ignoreErrors = false } = options; try { return checkStat((0, fs_1.statSync)(path5), path5, options); } catch (e) { const er = e; if (ignoreErrors || er.code === "EACCES") return false; throw er; } }; exports2.sync = sync2; var checkPathExt = (path5, options) => { const { pathExt = process.env.PATHEXT || "" } = options; const peSplit = pathExt.split(";"); if (peSplit.indexOf("") !== -1) { return true; } for (let i = 0; i < peSplit.length; i++) { const p = peSplit[i].toLowerCase(); const ext2 = path5.substring(path5.length - p.length).toLowerCase(); if (p && ext2 === p) { return true; } } return false; }; var checkStat = (stat2, path5, options) => stat2.isFile() && checkPathExt(path5, options); } }); // node_modules/isexe/dist/cjs/options.js var require_options = __commonJS({ "node_modules/isexe/dist/cjs/options.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); } }); // node_modules/isexe/dist/cjs/index.js var require_cjs = __commonJS({ "node_modules/isexe/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { if (k2 === void 0) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (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 __importStar2 = 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)) __createBinding2(result, mod, k); } __setModuleDefault(result, mod); return result; }; var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p); }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.sync = exports2.isexe = exports2.posix = exports2.win32 = void 0; var posix3 = __importStar2(require_posix()); exports2.posix = posix3; var win322 = __importStar2(require_win32()); exports2.win32 = win322; __exportStar2(require_options(), exports2); var platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform; var impl = platform === "win32" ? win322 : posix3; exports2.isexe = impl.isexe; exports2.sync = impl.sync; } }); // node_modules/which/lib/index.js var require_lib = __commonJS({ "node_modules/which/lib/index.js"(exports2, module2) { var { isexe, sync: isexeSync } = require_cjs(); var { join, delimiter, sep: sep2, posix: posix3 } = require("path"); var isWindows = process.platform === "win32"; var rSlash = new RegExp(`[${posix3.sep}${sep2 === posix3.sep ? "" : sep2}]`.replace(/(\\)/g, "\\$1")); var rRel = new RegExp(`^\\.${rSlash.source}`); var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" }); var getPathInfo = (cmd, { path: optPath = process.env.PATH, pathExt: optPathExt = process.env.PATHEXT, delimiter: optDelimiter = delimiter }) => { const pathEnv = cmd.match(rSlash) ? [""] : [ // windows always checks the cwd first ...isWindows ? [process.cwd()] : [], ...(optPath || /* istanbul ignore next: very unusual */ "").split(optDelimiter) ]; if (isWindows) { const pathExtExe = optPathExt || [".EXE", ".CMD", ".BAT", ".COM"].join(optDelimiter); const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()]); if (cmd.includes(".") && pathExt[0] !== "") { pathExt.unshift(""); } return { pathEnv, pathExt, pathExtExe }; } return { pathEnv, pathExt: [""] }; }; var getPathPart = (raw, cmd) => { const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw; const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : ""; return prefix + join(pathPart, cmd); }; var which2 = async (cmd, opt = {}) => { const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt); const found = []; for (const envPart of pathEnv) { const p = getPathPart(envPart, cmd); for (const ext2 of pathExt) { const withExt = p + ext2; const is = await isexe(withExt, { pathExt: pathExtExe, ignoreErrors: true }); if (is) { if (!opt.all) { return withExt; } found.push(withExt); } } } if (opt.all && found.length) { return found; } if (opt.nothrow) { return null; } throw getNotFoundError(cmd); }; var whichSync = (cmd, opt = {}) => { const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt); const found = []; for (const pathEnvPart of pathEnv) { const p = getPathPart(pathEnvPart, cmd); for (const ext2 of pathExt) { const withExt = p + ext2; const is = isexeSync(withExt, { pathExt: pathExtExe, ignoreErrors: true }); if (is) { if (!opt.all) { return withExt; } found.push(withExt); } } } if (opt.all && found.length) { return found; } if (opt.nothrow) { return null; } throw getNotFoundError(cmd); }; module2.exports = which2; which2.sync = whichSync; } }); // node_modules/ms/index.js var require_ms = __commonJS({ "node_modules/ms/index.js"(exports2, module2) { var s = 1e3; var m = s * 60; var h = m * 60; var d = h * 24; var w = d * 7; var y = d * 365.25; module2.exports = function(val, options) { options = options || {}; var type = typeof val; if (type === "string" && val.length > 0) { return parse6(val); } else if (type === "number" && isFinite(val)) { 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 parse6(str) { str = String(str); if (str.length > 100) { return; } var match2 = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( str ); if (!match2) { return; } var n = parseFloat(match2[1]); var type = (match2[2] || "ms").toLowerCase(); switch (type) { case "years": case "year": case "yrs": case "yr": case "y": return n * y; case "weeks": case "week": case "w": return n * w; 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) { var msAbs = Math.abs(ms); if (msAbs >= d) { return Math.round(ms / d) + "d"; } if (msAbs >= h) { return Math.round(ms / h) + "h"; } if (msAbs >= m) { return Math.round(ms / m) + "m"; } if (msAbs >= s) { return Math.round(ms / s) + "s"; } return ms + "ms"; } function fmtLong(ms) { var msAbs = Math.abs(ms); if (msAbs >= d) { return plural(ms, msAbs, d, "day"); } if (msAbs >= h) { return plural(ms, msAbs, h, "hour"); } if (msAbs >= m) { return plural(ms, msAbs, m, "minute"); } if (msAbs >= s) { return plural(ms, msAbs, s, "second"); } return ms + " ms"; } function plural(ms, msAbs, n, name) { var isPlural = msAbs >= n * 1.5; return Math.round(ms / n) + " " + name + (isPlural ? "s" : ""); } } }); // node_modules/debug/src/common.js var require_common = __commonJS({ "node_modules/debug/src/common.js"(exports2, module2) { function setup(env) { createDebug.debug = createDebug; createDebug.default = createDebug; createDebug.coerce = coerce; createDebug.disable = disable; createDebug.enable = enable; createDebug.enabled = enabled; createDebug.humanize = require_ms(); createDebug.destroy = destroy; Object.keys(env).forEach((key) => { createDebug[key] = env[key]; }); createDebug.names = []; createDebug.skips = []; createDebug.formatters = {}; function selectColor(namespace) { let hash = 0; for (let i = 0; i < namespace.length; i++) { hash = (hash << 5) - hash + namespace.charCodeAt(i); hash |= 0; } return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; } createDebug.selectColor = selectColor; function createDebug(namespace) { let prevTime; let enableOverride = null; let namespacesCache; let enabledCache; function debug(...args) { if (!debug.enabled) { return; } const self2 = debug; const curr = Number(/* @__PURE__ */ new Date()); const ms = curr - (prevTime || curr); self2.diff = ms; self2.prev = prevTime; self2.curr = curr; prevTime = curr; args[0] = createDebug.coerce(args[0]); if (typeof args[0] !== "string") { args.unshift("%O"); } let index2 = 0; args[0] = args[0].replace(/%([a-zA-Z%])/g, (match2, format) => { if (match2 === "%%") { return "%"; } index2++; const formatter = createDebug.formatters[format]; if (typeof formatter === "function") { const val = args[index2]; match2 = formatter.call(self2, val); args.splice(index2, 1); index2--; } return match2; }); createDebug.formatArgs.call(self2, args); const logFn = self2.log || createDebug.log; logFn.apply(self2, args); } debug.namespace = namespace; debug.useColors = createDebug.useColors(); debug.color = createDebug.selectColor(namespace); debug.extend = extend; debug.destroy = createDebug.destroy; Object.defineProperty(debug, "enabled", { enumerable: true, configurable: false, get: () => { if (enableOverride !== null) { return enableOverride; } if (namespacesCache !== createDebug.namespaces) { namespacesCache = createDebug.namespaces; enabledCache = createDebug.enabled(namespace); } return enabledCache; }, set: (v) => { enableOverride = v; } }); if (typeof createDebug.init === "function") { createDebug.init(debug); } return debug; } function extend(namespace, delimiter) { const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace); newDebug.log = this.log; return newDebug; } function enable(namespaces) { createDebug.save(namespaces); createDebug.namespaces = namespaces; createDebug.names = []; createDebug.skips = []; const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean); for (const ns of split) { if (ns[0] === "-") { createDebug.skips.push(ns.slice(1)); } else { createDebug.names.push(ns); } } } function matchesTemplate(search, template) { let searchIndex = 0; let templateIndex = 0; let starIndex = -1; let matchIndex = 0; while (searchIndex < search.length) { if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) { if (template[templateIndex] === "*") { starIndex = templateIndex; matchIndex = searchIndex; templateIndex++; } else { searchIndex++; templateIndex++; } } else if (starIndex !== -1) { templateIndex = starIndex + 1; matchIndex++; searchIndex = matchIndex; } else { return false; } } while (templateIndex < template.length && template[templateIndex] === "*") { templateIndex++; } return templateIndex === template.length; } function disable() { const namespaces = [ ...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace) ].join(","); createDebug.enable(""); return namespaces; } function enabled(name) { for (const skip of createDebug.skips) { if (matchesTemplate(name, skip)) { return false; } } for (const ns of createDebug.names) { if (matchesTemplate(name, ns)) { return true; } } return false; } function coerce(val) { if (val instanceof Error) { return val.stack || val.message; } return val; } function destroy() { console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); } createDebug.enable(createDebug.load()); return createDebug; } module2.exports = setup; } }); // node_modules/debug/src/browser.js var require_browser = __commonJS({ "node_modules/debug/src/browser.js"(exports2, module2) { exports2.formatArgs = formatArgs; exports2.save = save; exports2.load = load; exports2.useColors = useColors; exports2.storage = localstorage(); exports2.destroy = /* @__PURE__ */ (() => { let warned2 = false; return () => { if (!warned2) { warned2 = true; console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); } }; })(); exports2.colors = [ "#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33" ]; function useColors() { if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) { return true; } if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { return false; } let m; return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); } function formatArgs(args) { args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module2.exports.humanize(this.diff); if (!this.useColors) { return; } const c = "color: " + this.color; args.splice(1, 0, c, "color: inherit"); let index2 = 0; let lastC = 0; args[0].replace(/%[a-zA-Z%]/g, (match2) => { if (match2 === "%%") { return; } index2++; if (match2 === "%c") { lastC = index2; } }); args.splice(lastC, 0, c); } exports2.log = console.debug || console.log || (() => { }); function save(namespaces) { try { if (namespaces) { exports2.storage.setItem("debug", namespaces); } else { exports2.storage.removeItem("debug"); } } catch (error) { } } function load() { let r; try { r = exports2.storage.getItem("debug") || exports2.storage.getItem("DEBUG"); } catch (error) { } if (!r && typeof process !== "undefined" && "env" in process) { r = process.env.DEBUG; } return r; } function localstorage() { try { return localStorage; } catch (error) { } } module2.exports = require_common()(exports2); var { formatters } = module2.exports; formatters.j = function(v) { try { return JSON.stringify(v); } catch (error) { return "[UnexpectedJSONParseError]: " + error.message; } }; } }); // node_modules/has-flag/index.js var require_has_flag = __commonJS({ "node_modules/has-flag/index.js"(exports2, module2) { "use strict"; module2.exports = (flag, argv = process.argv) => { const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--"; const position = argv.indexOf(prefix + flag); const terminatorPosition = argv.indexOf("--"); return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); }; } }); // node_modules/supports-color/index.js var require_supports_color = __commonJS({ "node_modules/supports-color/index.js"(exports2, module2) { "use strict"; var os = require("os"); var tty = require("tty"); var hasFlag = require_has_flag(); var { env } = process; var forceColor; if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) { forceColor = 0; } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) { forceColor = 1; } if ("FORCE_COLOR" in env) { if (env.FORCE_COLOR === "true") { forceColor = 1; } else if (env.FORCE_COLOR === "false") { forceColor = 0; } else { forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3); } } function translateLevel(level) { if (level === 0) { return false; } return { level, hasBasic: true, has256: level >= 2, has16m: level >= 3 }; } function supportsColor(haveStream, streamIsTTY) { if (forceColor === 0) { return 0; } if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) { return 3; } if (hasFlag("color=256")) { return 2; } if (haveStream && !streamIsTTY && forceColor === void 0) { return 0; } const min = forceColor || 0; if (env.TERM === "dumb") { return min; } if (process.platform === "win32") { const osRelease = os.release().split("."); if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) { return Number(osRelease[2]) >= 14931 ? 3 : 2; } return 1; } if ("CI" in env) { if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") { return 1; } return min; } if ("TEAMCITY_VERSION" in env) { return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; } if (env.COLORTERM === "truecolor") { return 3; } if ("TERM_PROGRAM" in env) { const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10); switch (env.TERM_PROGRAM) { case "iTerm.app": return version >= 3 ? 3 : 2; case "Apple_Terminal": return 2; } } if (/-256(color)?$/i.test(env.TERM)) { return 2; } if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { return 1; } if ("COLORTERM" in env) { return 1; } return min; } function getSupportLevel(stream3) { const level = supportsColor(stream3, stream3 && stream3.isTTY); return translateLevel(level); } module2.exports = { supportsColor: getSupportLevel, stdout: translateLevel(supportsColor(true, tty.isatty(1))), stderr: translateLevel(supportsColor(true, tty.isatty(2))) }; } }); // node_modules/debug/src/node.js var require_node = __commonJS({ "node_modules/debug/src/node.js"(exports2, module2) { var tty = require("tty"); var util2 = require("util"); exports2.init = init; exports2.log = log2; exports2.formatArgs = formatArgs; exports2.save = save; exports2.load = load; exports2.useColors = useColors; exports2.destroy = util2.deprecate( () => { }, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`." ); exports2.colors = [6, 2, 3, 4, 5, 1]; try { const supportsColor = require_supports_color(); if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { exports2.colors = [ 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221 ]; } } catch (error) { } exports2.inspectOpts = Object.keys(process.env).filter((key) => { return /^debug_/i.test(key); }).reduce((obj, key) => { const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => { return k.toUpperCase(); }); let 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; }, {}); function useColors() { return "colors" in exports2.inspectOpts ? Boolean(exports2.inspectOpts.colors) : tty.isatty(process.stderr.fd); } function formatArgs(args) { const { namespace: name, useColors: useColors2 } = this; if (useColors2) { const c = this.color; const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c); const prefix = ` ${colorCode};1m${name} \x1B[0m`; args[0] = prefix + args[0].split("\n").join("\n" + prefix); args.push(colorCode + "m+" + module2.exports.humanize(this.diff) + "\x1B[0m"); } else { args[0] = getDate() + name + " " + args[0]; } } function getDate() { if (exports2.inspectOpts.hideDate) { return ""; } return (/* @__PURE__ */ new Date()).toISOString() + " "; } function log2(...args) { return process.stderr.write(util2.formatWithOptions(exports2.inspectOpts, ...args) + "\n"); } function save(namespaces) { if (namespaces) { process.env.DEBUG = namespaces; } else { delete process.env.DEBUG; } } function load() { return process.env.DEBUG; } function init(debug) { debug.inspectOpts = {}; const keys = Object.keys(exports2.inspectOpts); for (let i = 0; i < keys.length; i++) { debug.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]]; } } module2.exports = require_common()(exports2); var { formatters } = module2.exports; formatters.o = function(v) { this.inspectOpts.colors = this.useColors; return util2.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" "); }; formatters.O = function(v) { this.inspectOpts.colors = this.useColors; return util2.inspect(v, this.inspectOpts); }; } }); // node_modules/debug/src/index.js var require_src = __commonJS({ "node_modules/debug/src/index.js"(exports2, module2) { if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) { module2.exports = require_browser(); } else { module2.exports = require_node(); } } }); // node_modules/wrappy/wrappy.js var require_wrappy = __commonJS({ "node_modules/wrappy/wrappy.js"(exports2, module2) { module2.exports = wrappy; function wrappy(fn, cb) { if (fn && cb) return wrappy(fn)(cb); if (typeof fn !== "function") throw new TypeError("need wrapper function"); Object.keys(fn).forEach(function(k) { wrapper[k] = fn[k]; }); return wrapper; function wrapper() { var args = new Array(arguments.length); for (var i = 0; i < args.length; i++) { args[i] = arguments[i]; } var ret = fn.apply(this, args); var cb2 = args[args.length - 1]; if (typeof ret === "function" && ret !== cb2) { Object.keys(cb2).forEach(function(k) { ret[k] = cb2[k]; }); } return ret; } } } }); // node_modules/once/once.js var require_once = __commonJS({ "node_modules/once/once.js"(exports2, module2) { var wrappy = require_wrappy(); module2.exports = wrappy(once2); module2.exports.strict = wrappy(onceStrict); once2.proto = once2(function() { Object.defineProperty(Function.prototype, "once", { value: function() { return once2(this); }, configurable: true }); Object.defineProperty(Function.prototype, "onceStrict", { value: function() { return onceStrict(this); }, configurable: true }); }); function once2(fn) { var f = function() { if (f.called) return f.value; f.called = true; return f.value = fn.apply(this, arguments); }; f.called = false; return f; } function onceStrict(fn) { var f = function() { if (f.called) throw new Error(f.onceError); f.called = true; return f.value = fn.apply(this, arguments); }; var name = fn.name || "Function wrapped with `once`"; f.onceError = name + " shouldn't be called more than once"; f.called = false; return f; } } }); // node_modules/end-of-stream/index.js var require_end_of_stream = __commonJS({ "node_modules/end-of-stream/index.js"(exports2, module2) { var once2 = require_once(); var noop = function() { }; var qnt = global.Bare ? queueMicrotask : process.nextTick.bind(process); var isRequest2 = function(stream3) { return stream3.setHeader && typeof stream3.abort === "function"; }; var isChildProcess = function(stream3) { return stream3.stdio && Array.isArray(stream3.stdio) && stream3.stdio.length === 3; }; var eos = function(stream3, opts, callback) { if (typeof opts === "function") return eos(stream3, null, opts); if (!opts) opts = {}; callback = once2(callback || noop); var ws = stream3._writableState; var rs = stream3._readableState; var readable = opts.readable || opts.readable !== false && stream3.readable; var writable = opts.writable || opts.writable !== false && stream3.writable; var cancelled = false; var onlegacyfinish = function() { if (!stream3.writable) onfinish(); }; var onfinish = function() { writable = false; if (!readable) callback.call(stream3); }; var onend = function() { readable = false; if (!writable) callback.call(stream3); }; var onexit = function(exitCode) { callback.call(stream3, exitCode ? new Error("exited with error code: " + exitCode) : null); }; var onerror = function(err) { callback.call(stream3, err); }; var onclose = function() { qnt(onclosenexttick); }; var onclosenexttick = function() { if (cancelled) return; if (readable && !(rs && (rs.ended && !rs.destroyed))) return callback.call(stream3, new Error("premature close")); if (writable && !(ws && (ws.ended && !ws.destroyed))) return callback.call(stream3, new Error("premature close")); }; var onrequest = function() { stream3.req.on("finish", onfinish); }; if (isRequest2(stream3)) { stream3.on("complete", onfinish); stream3.on("abort", onclose); if (stream3.req) onrequest(); else stream3.on("request", onrequest); } else if (writable && !ws) { stream3.on("end", onlegacyfinish); stream3.on("close", onlegacyfinish); } if (isChildProcess(stream3)) stream3.on("exit", onexit); stream3.on("end", onend); stream3.on("finish", onfinish); if (opts.error !== false) stream3.on("error", onerror); stream3.on("close", onclose); return function() { cancelled = true; stream3.removeListener("complete", onfinish); stream3.removeListener("abort", onclose); stream3.removeListener("request", onrequest); if (stream3.req) stream3.req.removeListener("finish", onfinish); stream3.removeListener("end", onlegacyfinish); stream3.removeListener("close", onlegacyfinish); stream3.removeListener("finish", onfinish); stream3.removeListener("exit", onexit); stream3.removeListener("end", onend); stream3.removeListener("error", onerror); stream3.removeListener("close", onclose); }; }; module2.exports = eos; } }); // node_modules/pump/index.js var require_pump = __commonJS({ "node_modules/pump/index.js"(exports2, module2) { var once2 = require_once(); var eos = require_end_of_stream(); var fs5; try { fs5 = require("fs"); } catch (e) { } var noop = function() { }; var ancient = typeof process === "undefined" ? false : /^v?\.0/.test(process.version); var isFn = function(fn) { return typeof fn === "function"; }; var isFS = function(stream3) { if (!ancient) return false; if (!fs5) return false; return (stream3 instanceof (fs5.ReadStream || noop) || stream3 instanceof (fs5.WriteStream || noop)) && isFn(stream3.close); }; var isRequest2 = function(stream3) { return stream3.setHeader && isFn(stream3.abort); }; var destroyer = function(stream3, reading, writing, callback) { callback = once2(callback); var closed = false; stream3.on("close", function() { closed = true; }); eos(stream3, { readable: reading, writable: writing }, function(err) { if (err) return callback(err); closed = true; callback(); }); var destroyed = false; return function(err) { if (closed) return; if (destroyed) return; destroyed = true; if (isFS(stream3)) return stream3.close(noop); if (isRequest2(stream3)) return stream3.abort(); if (isFn(stream3.destroy)) return stream3.destroy(); callback(err || new Error("stream was destroyed")); }; }; var call = function(fn) { fn(); }; var pipe = function(from, to) { return from.pipe(to); }; var pump = function() { var streams = Array.prototype.slice.call(arguments); var callback = isFn(streams[streams.length - 1] || noop) && streams.pop() || noop; if (Array.isArray(streams[0])) streams = streams[0]; if (streams.length < 2) throw new Error("pump requires two streams per minimum"); var error; var destroys = streams.map(function(stream3, i) { var reading = i < streams.length - 1; var writing = i > 0; return destroyer(stream3, reading, writing, function(err) { if (!error) error = err; if (err) destroys.forEach(call); if (reading) return; destroys.forEach(call); callback(error); }); }); return streams.reduce(pipe); }; module2.exports = pump; } }); // node_modules/get-stream/buffer-stream.js var require_buffer_stream = __commonJS({ "node_modules/get-stream/buffer-stream.js"(exports2, module2) { "use strict"; var { PassThrough: PassThroughStream } = require("stream"); module2.exports = (options) => { options = { ...options }; const { array } = options; let { encoding } = options; const isBuffer = encoding === "buffer"; let objectMode = false; if (array) { objectMode = !(encoding || isBuffer); } else { encoding = encoding || "utf8"; } if (isBuffer) { encoding = null; } const stream3 = new PassThroughStream({ objectMode }); if (encoding) { stream3.setEncoding(encoding); } let length = 0; const chunks = []; stream3.on("data", (chunk) => { chunks.push(chunk); if (objectMode) { length = chunks.length; } else { length += chunk.length; } }); stream3.getBufferedValue = () => { if (array) { return chunks; } return isBuffer ? Buffer.concat(chunks, length) : chunks.join(""); }; stream3.getBufferedLength = () => length; return stream3; }; } }); // node_modules/get-stream/index.js var require_get_stream = __commonJS({ "node_modules/get-stream/index.js"(exports2, module2) { "use strict"; var { constants: BufferConstants } = require("buffer"); var pump = require_pump(); var bufferStream = require_buffer_stream(); var MaxBufferError = class extends Error { constructor() { super("maxBuffer exceeded"); this.name = "MaxBufferError"; } }; async function getStream(inputStream, options) { if (!inputStream) { return Promise.reject(new Error("Expected a stream")); } options = { maxBuffer: Infinity, ...options }; const { maxBuffer } = options; let stream3; await new Promise((resolve6, reject2) => { const rejectPromise = (error) => { if (error && stream3.getBufferedLength() <= BufferConstants.MAX_LENGTH) { error.bufferedData = stream3.getBufferedValue(); } reject2(error); }; stream3 = pump(inputStream, bufferStream(options), (error) => { if (error) { rejectPromise(error); return; } resolve6(); }); stream3.on("data", () => { if (stream3.getBufferedLength() > maxBuffer) { rejectPromise(new MaxBufferError()); } }); }); return stream3.getBufferedValue(); } module2.exports = getStream; module2.exports.default = getStream; module2.exports.buffer = (stream3, options) => getStream(stream3, { ...options, encoding: "buffer" }); module2.exports.array = (stream3, options) => getStream(stream3, { ...options, array: true }); module2.exports.MaxBufferError = MaxBufferError; } }); // node_modules/pend/index.js var require_pend = __commonJS({ "node_modules/pend/index.js"(exports2, module2) { module2.exports = Pend; function Pend() { this.pending = 0; this.max = Infinity; this.listeners = []; this.waiting = []; this.error = null; } Pend.prototype.go = function(fn) { if (this.pending < this.max) { pendGo(this, fn); } else { this.waiting.push(fn); } }; Pend.prototype.wait = function(cb) { if (this.pending === 0) { cb(this.error); } else { this.listeners.push(cb); } }; Pend.prototype.hold = function() { return pendHold(this); }; function pendHold(self2) { self2.pending += 1; var called = false; return onCb; function onCb(err) { if (called) throw new Error("callback called twice"); called = true; self2.error = self2.error || err; self2.pending -= 1; if (self2.waiting.length > 0 && self2.pending < self2.max) { pendGo(self2, self2.waiting.shift()); } else if (self2.pending === 0) { var listeners = self2.listeners; self2.listeners = []; listeners.forEach(cbListener); } } function cbListener(listener) { listener(self2.error); } } function pendGo(self2, fn) { fn(pendHold(self2)); } } }); // node_modules/fd-slicer/index.js var require_fd_slicer = __commonJS({ "node_modules/fd-slicer/index.js"(exports2) { var fs5 = require("fs"); var util2 = require("util"); var stream3 = require("stream"); var Readable2 = stream3.Readable; var Writable = stream3.Writable; var PassThrough2 = stream3.PassThrough; var Pend = require_pend(); var EventEmitter2 = require("events").EventEmitter; exports2.createFromBuffer = createFromBuffer; exports2.createFromFd = createFromFd; exports2.BufferSlicer = BufferSlicer; exports2.FdSlicer = FdSlicer; util2.inherits(FdSlicer, EventEmitter2); function FdSlicer(fd, options) { options = options || {}; EventEmitter2.call(this); this.fd = fd; this.pend = new Pend(); this.pend.max = 1; this.refCount = 0; this.autoClose = !!options.autoClose; } FdSlicer.prototype.read = function(buffer, offset, length, position, callback) { var self2 = this; self2.pend.go(function(cb) { fs5.read(self2.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) { cb(); callback(err, bytesRead, buffer2); }); }); }; FdSlicer.prototype.write = function(buffer, offset, length, position, callback) { var self2 = this; self2.pend.go(function(cb) { fs5.write(self2.fd, buffer, offset, length, position, function(err, written, buffer2) { cb(); callback(err, written, buffer2); }); }); }; FdSlicer.prototype.createReadStream = function(options) { return new ReadStream(this, options); }; FdSlicer.prototype.createWriteStream = function(options) { return new WriteStream(this, options); }; FdSlicer.prototype.ref = function() { this.refCount += 1; }; FdSlicer.prototype.unref = function() { var self2 = this; self2.refCount -= 1; if (self2.refCount > 0) return; if (self2.refCount < 0) throw new Error("invalid unref"); if (self2.autoClose) { fs5.close(self2.fd, onCloseDone); } function onCloseDone(err) { if (err) { self2.emit("error", err); } else { self2.emit("close"); } } }; util2.inherits(ReadStream, Readable2); function ReadStream(context, options) { options = options || {}; Readable2.call(this, options); this.context = context; this.context.ref(); this.start = options.start || 0; this.endOffset = options.end; this.pos = this.start; this.destroyed = false; } ReadStream.prototype._read = function(n) { var self2 = this; if (self2.destroyed) return; var toRead = Math.min(self2._readableState.highWaterMark, n); if (self2.endOffset != null) { toRead = Math.min(toRead, self2.endOffset - self2.pos); } if (toRead <= 0) { self2.destroyed = true; self2.push(null); self2.context.unref(); return; } self2.context.pend.go(function(cb) { if (self2.destroyed) return cb(); var buffer = new Buffer(toRead); fs5.read(self2.context.fd, buffer, 0, toRead, self2.pos, function(err, bytesRead) { if (err) { self2.destroy(err); } else if (bytesRead === 0) { self2.destroyed = true; self2.push(null); self2.context.unref(); } else { self2.pos += bytesRead; self2.push(buffer.slice(0, bytesRead)); } cb(); }); }); }; ReadStream.prototype.destroy = function(err) { if (this.destroyed) return; err = err || new Error("stream destroyed"); this.destroyed = true; this.emit("error", err); this.context.unref(); }; util2.inherits(WriteStream, Writable); function WriteStream(context, options) { options = options || {}; Writable.call(this, options); this.context = context; this.context.ref(); this.start = options.start || 0; this.endOffset = options.end == null ? Infinity : +options.end; this.bytesWritten = 0; this.pos = this.start; this.destroyed = false; this.on("finish", this.destroy.bind(this)); } WriteStream.prototype._write = function(buffer, encoding, callback) { var self2 = this; if (self2.destroyed) return; if (self2.pos + buffer.length > self2.endOffset) { var err = new Error("maximum file length exceeded"); err.code = "ETOOBIG"; self2.destroy(); callback(err); return; } self2.context.pend.go(function(cb) { if (self2.destroyed) return cb(); fs5.write(self2.context.fd, buffer, 0, buffer.length, self2.pos, f